@ixo/decision-oracle 0.2.12 → 0.2.14
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 +2 -1
- package/dist/cli/commands/reviewer-note.d.ts +11 -0
- package/dist/cli/commands/reviewer-note.d.ts.map +1 -0
- package/dist/cli/commands/reviewer-note.js +36 -0
- package/dist/cli/commands/reviewer-note.js.map +1 -0
- package/dist/cli/index.js +2 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/lib/usage.d.ts +1 -1
- package/dist/cli/lib/usage.d.ts.map +1 -1
- package/dist/cli/lib/usage.js +1 -0
- package/dist/cli/lib/usage.js.map +1 -1
- package/dist/db/schema.d.ts +20 -0
- package/dist/db/schema.d.ts.map +1 -1
- package/dist/db/schema.js +7 -0
- package/dist/db/schema.js.map +1 -1
- package/dist/lib/api-lane/retention.d.ts.map +1 -1
- package/dist/lib/api-lane/retention.js +5 -1
- package/dist/lib/api-lane/retention.js.map +1 -1
- package/dist/lib/claim-erase.d.ts.map +1 -1
- package/dist/lib/claim-erase.js +5 -1
- package/dist/lib/claim-erase.js.map +1 -1
- package/dist/lib/openhands/store.d.ts.map +1 -1
- package/dist/lib/openhands/store.js +5 -2
- package/dist/lib/openhands/store.js.map +1 -1
- package/dist/lib/redact.d.ts.map +1 -1
- package/dist/lib/redact.js +1 -0
- package/dist/lib/redact.js.map +1 -1
- package/dist/lib/review/reviewer-note-prompt.d.ts +43 -0
- package/dist/lib/review/reviewer-note-prompt.d.ts.map +1 -0
- package/dist/lib/review/reviewer-note-prompt.js +106 -0
- package/dist/lib/review/reviewer-note-prompt.js.map +1 -0
- package/dist/lib/review/reviewer-note.d.ts +67 -0
- package/dist/lib/review/reviewer-note.d.ts.map +1 -0
- package/dist/lib/review/reviewer-note.js +138 -0
- package/dist/lib/review/reviewer-note.js.map +1 -0
- package/dist/middleware/capability.d.ts +1 -1
- package/dist/middleware/capability.d.ts.map +1 -1
- package/dist/middleware/capability.js +4 -0
- package/dist/middleware/capability.js.map +1 -1
- package/dist/oracle.d.ts +1 -0
- package/dist/oracle.d.ts.map +1 -1
- package/dist/oracle.js +7 -0
- package/dist/oracle.js.map +1 -1
- package/dist/routes/v1/admin.d.ts.map +1 -1
- package/dist/routes/v1/admin.js +59 -0
- package/dist/routes/v1/admin.js.map +1 -1
- package/dist/routes/v1/claims.js +3 -0
- package/dist/routes/v1/claims.js.map +1 -1
- package/dist/routes/v1/reviews.js +2 -0
- package/dist/routes/v1/reviews.js.map +1 -1
- package/dist/workflows/claim-ingest.d.ts.map +1 -1
- package/dist/workflows/claim-ingest.js +23 -0
- package/dist/workflows/claim-ingest.js.map +1 -1
- package/docs/api.md +5 -3
- package/docs/guide.md +9 -0
- package/migrations/0026_reviewer_note.sql +1 -0
- package/migrations/meta/0026_snapshot.json +2983 -0
- package/migrations/meta/_journal.json +7 -0
- package/package.json +1 -1
- package/skills/create-rubric/SKILL.md +7 -0
package/dist/lib/redact.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"redact.js","sourceRoot":"","sources":["../../src/lib/redact.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,eAAe;IACf,UAAU;IACV,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,SAAS;IACT,UAAU;IACV,eAAe;IACf,SAAS;IACT,QAAQ;IACR,OAAO;IACP,OAAO;IACP,WAAW;IACX,WAAW;IACX,UAAU;IACV,OAAO;IACP,YAAY;IACZ,OAAO;CACR,CAAC;AAEF;;;;;GAKG;AACH,MAAM,WAAW,GACf,oFAAoF,CAAC;AAEvF,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,GAAW,EAAW,EAAE;IAClD,IAAI,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC;QAAE,OAAO,KAAK,CAAC;IACxC,MAAM,CAAC,GAAG,GAAG,CAAC,WAAW,EAAE,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C,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;IAChE,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The reviewer note's prompt, output schema, input message and caps (lib/review/reviewer-note.ts
|
|
3
|
+
* runs them) — pure, so the eval harness (dev/reviewer-note-eval.ts) runs the SAME prompt against a
|
|
4
|
+
* real model outside a Worker. The rules are the owner's (2026-10-21): plain words for a
|
|
5
|
+
* non-technical person, `says` restates what the answer claims (never whether it passed),
|
|
6
|
+
* `checkThese` names only concrete gaps with what to do, nothing invented, no recommendation.
|
|
7
|
+
*/
|
|
8
|
+
import type { ActFacts } from "../../act.js";
|
|
9
|
+
import type { AttachmentFact } from "../facts/factset.js";
|
|
10
|
+
import type { ReviewTaskShape } from "./tasks.js";
|
|
11
|
+
export declare const NOTE_PROMPT = "You help a person who must decide whether to accept someone's submitted work and pay for it. They are not technical. You are shown the submitted answer, the files sent with it, what the automatic checks said, and the questions the person must answer.\n\nWrite two things, for that person, in plain everyday words (reading age about 12, short sentences, no jargon):\n\n1. \"says\": one or two sentences, at most 45 words, saying WHAT THE ANSWER CLAIMS: its findings, numbers, places, dates. Report the content itself. Do not say whether it passed any rule. Never describe the answer as specific, detailed, valid, consistent, acceptable, good or placeholder. No praise and no verdict.\n\n2. \"checkThese\": one to four short lines, each at most 25 words. Only concrete gaps the person can act on:\n- a file the automatic checks did not read (say so honestly, e.g. \"The PDF report wasn't read: open it and see that it matches the summary.\");\n- a claim in the answer that no check measured or confirmed;\n- something only a person can confirm (for example: nobody visited or tested it);\n- a mismatch between parts of the answer.\nEnd each line with what the person can do. No generic lines like \"verify the accuracy\". Use an empty list only if truly nothing is unverified.\n\nRules:\n- Use only what you are shown. Never invent findings. If something was not checked, say it was not checked.\n- Never recommend approving or rejecting, and never hint which way to lean.\n- Never mention rule names, check names, field keys, ids, hashes or links. Say \"the PDF report\", not a field name. The product's own web address may be named if the answer is about it.\n- Write in the same language as the answer. Neutral tone. No markdown, no bullet characters.";
|
|
12
|
+
export declare const NOTE_SCHEMA: {
|
|
13
|
+
name: string;
|
|
14
|
+
schema: {
|
|
15
|
+
type: string;
|
|
16
|
+
properties: {
|
|
17
|
+
says: {
|
|
18
|
+
type: string;
|
|
19
|
+
};
|
|
20
|
+
checkThese: {
|
|
21
|
+
type: string;
|
|
22
|
+
items: {
|
|
23
|
+
type: string;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
required: string[];
|
|
28
|
+
additionalProperties: boolean;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
/** The model's answer, held to the caps: `says` cut at SAYS_MAX_WORDS, over-long items dropped. */
|
|
32
|
+
export declare function capNote(raw: unknown): {
|
|
33
|
+
says: string;
|
|
34
|
+
checkThese: string[];
|
|
35
|
+
} | null;
|
|
36
|
+
/** The user message: the answer, its files, what the checks said, and the person's questions. */
|
|
37
|
+
export declare function noteInput(input: {
|
|
38
|
+
answers: Record<string, unknown>;
|
|
39
|
+
attachments: AttachmentFact[];
|
|
40
|
+
facts: ActFacts;
|
|
41
|
+
tasks: Pick<ReviewTaskShape, "prompt">[];
|
|
42
|
+
}): string;
|
|
43
|
+
//# sourceMappingURL=reviewer-note-prompt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reviewer-note-prompt.d.ts","sourceRoot":"","sources":["../../../src/lib/review/reviewer-note-prompt.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAU/C,eAAO,MAAM,WAAW,6tDAiBqE,CAAC;AAE9F,eAAO,MAAM,WAAW;IACtB,IAAI;IACJ,MAAM;QACJ,IAAI;QACJ,UAAU;YACR,IAAI;gBAAI,IAAI;;YACZ,UAAU;gBAAI,IAAI;gBAAW,KAAK;oBAAI,IAAI;;;;QAE5C,QAAQ;QACR,oBAAoB;;CAEvB,CAAC;AAUF,mGAAmG;AACnG,wBAAgB,OAAO,CAAC,GAAG,EAAE,OAAO,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,EAAE,CAAA;CAAE,GAAG,IAAI,CAenF;AAsBD,iGAAiG;AACjG,wBAAgB,SAAS,CAAC,KAAK,EAAE;IAC/B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,WAAW,EAAE,cAAc,EAAE,CAAC;IAC9B,KAAK,EAAE,QAAQ,CAAC;IAChB,KAAK,EAAE,IAAI,CAAC,eAAe,EAAE,QAAQ,CAAC,EAAE,CAAC;CAC1C,GAAG,MAAM,CAgCT"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The reviewer note's prompt, output schema, input message and caps (lib/review/reviewer-note.ts
|
|
3
|
+
* runs them) — pure, so the eval harness (dev/reviewer-note-eval.ts) runs the SAME prompt against a
|
|
4
|
+
* real model outside a Worker. The rules are the owner's (2026-10-21): plain words for a
|
|
5
|
+
* non-technical person, `says` restates what the answer claims (never whether it passed),
|
|
6
|
+
* `checkThese` names only concrete gaps with what to do, nothing invented, no recommendation.
|
|
7
|
+
*/
|
|
8
|
+
import { canonicalJson } from "../hash.js";
|
|
9
|
+
/** The owner's caps (prompt rules 2–3), enforced here too — the model is asked, the code makes sure. */
|
|
10
|
+
const SAYS_MAX_WORDS = 50;
|
|
11
|
+
const ITEM_MAX_WORDS = 30;
|
|
12
|
+
const MAX_ITEMS = 4;
|
|
13
|
+
/** What the model is shown of the answer: enough to restate it, bounded so one claim can't blow up the call. */
|
|
14
|
+
const ANSWER_VALUE_MAX = 1_500;
|
|
15
|
+
const ANSWERS_MAX = 8_000;
|
|
16
|
+
export const NOTE_PROMPT = `You help a person who must decide whether to accept someone's submitted work and pay for it. They are not technical. You are shown the submitted answer, the files sent with it, what the automatic checks said, and the questions the person must answer.
|
|
17
|
+
|
|
18
|
+
Write two things, for that person, in plain everyday words (reading age about 12, short sentences, no jargon):
|
|
19
|
+
|
|
20
|
+
1. "says": one or two sentences, at most 45 words, saying WHAT THE ANSWER CLAIMS: its findings, numbers, places, dates. Report the content itself. Do not say whether it passed any rule. Never describe the answer as specific, detailed, valid, consistent, acceptable, good or placeholder. No praise and no verdict.
|
|
21
|
+
|
|
22
|
+
2. "checkThese": one to four short lines, each at most 25 words. Only concrete gaps the person can act on:
|
|
23
|
+
- a file the automatic checks did not read (say so honestly, e.g. "The PDF report wasn't read: open it and see that it matches the summary.");
|
|
24
|
+
- a claim in the answer that no check measured or confirmed;
|
|
25
|
+
- something only a person can confirm (for example: nobody visited or tested it);
|
|
26
|
+
- a mismatch between parts of the answer.
|
|
27
|
+
End each line with what the person can do. No generic lines like "verify the accuracy". Use an empty list only if truly nothing is unverified.
|
|
28
|
+
|
|
29
|
+
Rules:
|
|
30
|
+
- Use only what you are shown. Never invent findings. If something was not checked, say it was not checked.
|
|
31
|
+
- Never recommend approving or rejecting, and never hint which way to lean.
|
|
32
|
+
- Never mention rule names, check names, field keys, ids, hashes or links. Say "the PDF report", not a field name. The product's own web address may be named if the answer is about it.
|
|
33
|
+
- Write in the same language as the answer. Neutral tone. No markdown, no bullet characters.`;
|
|
34
|
+
export const NOTE_SCHEMA = {
|
|
35
|
+
name: "reviewer_note",
|
|
36
|
+
schema: {
|
|
37
|
+
type: "object",
|
|
38
|
+
properties: {
|
|
39
|
+
says: { type: "string" },
|
|
40
|
+
checkThese: { type: "array", items: { type: "string" } },
|
|
41
|
+
},
|
|
42
|
+
required: ["says", "checkThese"],
|
|
43
|
+
additionalProperties: false,
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
const words = (s) => s.trim().split(/\s+/).filter(Boolean);
|
|
47
|
+
const plain = (s) => s
|
|
48
|
+
.replace(/[*_`#>]+/g, "")
|
|
49
|
+
.replace(/^\s*[-•]\s*/, "")
|
|
50
|
+
.replace(/\s+/g, " ")
|
|
51
|
+
.trim();
|
|
52
|
+
/** The model's answer, held to the caps: `says` cut at SAYS_MAX_WORDS, over-long items dropped. */
|
|
53
|
+
export function capNote(raw) {
|
|
54
|
+
const obj = raw && typeof raw === "object" ? raw : null;
|
|
55
|
+
if (!obj || typeof obj.says !== "string" || !Array.isArray(obj.checkThese))
|
|
56
|
+
return null;
|
|
57
|
+
const saysWords = words(plain(obj.says));
|
|
58
|
+
if (saysWords.length === 0)
|
|
59
|
+
return null;
|
|
60
|
+
const says = saysWords.length <= SAYS_MAX_WORDS
|
|
61
|
+
? saysWords.join(" ")
|
|
62
|
+
: `${saysWords.slice(0, SAYS_MAX_WORDS).join(" ")}…`;
|
|
63
|
+
const checkThese = obj.checkThese
|
|
64
|
+
.filter((x) => typeof x === "string")
|
|
65
|
+
.map(plain)
|
|
66
|
+
.filter((x) => x.length > 0 && words(x).length <= ITEM_MAX_WORDS)
|
|
67
|
+
.slice(0, MAX_ITEMS);
|
|
68
|
+
return { says, checkThese };
|
|
69
|
+
}
|
|
70
|
+
/** Whether an automatic check was sent this file: the AI checks' frozen request bodies say. */
|
|
71
|
+
function readByChecks(attachment, facts) {
|
|
72
|
+
const sent = Object.values(facts.ai ?? {})
|
|
73
|
+
.map((f) => "transcript" in f && f.transcript ? JSON.stringify(f.transcript.request?.body ?? null) : "")
|
|
74
|
+
.join("\n");
|
|
75
|
+
if (!sent)
|
|
76
|
+
return false;
|
|
77
|
+
if (attachment.mediaType.startsWith("image/"))
|
|
78
|
+
return /"(image_url|input_image)"/.test(sent);
|
|
79
|
+
return sent.includes(JSON.stringify(attachment.name).slice(1, -1));
|
|
80
|
+
}
|
|
81
|
+
/** One answer value as the model sees it: strings capped, everything else as compact JSON. */
|
|
82
|
+
const shown = (v) => typeof v === "string"
|
|
83
|
+
? v.length > ANSWER_VALUE_MAX
|
|
84
|
+
? `${v.slice(0, ANSWER_VALUE_MAX)}…`
|
|
85
|
+
: v
|
|
86
|
+
: v;
|
|
87
|
+
/** The user message: the answer, its files, what the checks said, and the person's questions. */
|
|
88
|
+
export function noteInput(input) {
|
|
89
|
+
const answerJson = canonicalJson(Object.fromEntries(Object.entries(input.answers).map(([k, v]) => [k, shown(v)])));
|
|
90
|
+
const checks = ["ext", "ai"].flatMap((lane) => Object.values(input.facts[lane] ?? {}).map((f) => f.status === "ok"
|
|
91
|
+
? { result: f.value === false ? "did not pass" : "passed", said: f.reason ?? "" }
|
|
92
|
+
: { result: "could not run", said: f.detail }));
|
|
93
|
+
return [
|
|
94
|
+
`THE ANSWER:\n${answerJson.length > ANSWERS_MAX ? `${answerJson.slice(0, ANSWERS_MAX)}…` : answerJson}`,
|
|
95
|
+
`FILES SENT WITH IT:\n${input.attachments.length === 0
|
|
96
|
+
? "(none)"
|
|
97
|
+
: input.attachments
|
|
98
|
+
.map((a) => `- ${a.name} (${a.mediaType})${readByChecks(a, input.facts) ? "" : " — NOT read by any automatic check"}`)
|
|
99
|
+
.join("\n")}`,
|
|
100
|
+
`WHAT THE AUTOMATIC CHECKS SAID:\n${checks.length === 0
|
|
101
|
+
? "(no automatic checks)"
|
|
102
|
+
: checks.map((c) => `- ${c.result}: ${c.said}`).join("\n")}`,
|
|
103
|
+
`QUESTIONS THE PERSON MUST ANSWER:\n${input.tasks.length === 0 ? "(none)" : input.tasks.map((t) => `- ${t.prompt}`).join("\n")}`,
|
|
104
|
+
].join("\n\n");
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=reviewer-note-prompt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reviewer-note-prompt.js","sourceRoot":"","sources":["../../../src/lib/review/reviewer-note-prompt.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OA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AE,CAAC,CAAC,IAAI,CAAC,IAAI,CACzF,EAAE;KACH,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The reviewer note: what a person about to answer a review needs before they decide — what the
|
|
3
|
+
* answer actually claims, in plain words, and what no automatic check could verify (owner,
|
|
4
|
+
* 2026-10-21). An AI check's own `reason` is written for its rule ("the summary is specific, not
|
|
5
|
+
* placeholder text"), which tells the person deciding nothing; this note is written for them.
|
|
6
|
+
*
|
|
7
|
+
* reviewerNote: { says, checkThese[], model, createdAt }
|
|
8
|
+
*
|
|
9
|
+
* Made ONLY for a claim that lands `pending_review`, inside the evaluate step right after the
|
|
10
|
+
* decision is recorded (the answers never leave that step), by ONE model call on the same provider
|
|
11
|
+
* seam the AI checks use. It is OUTSIDE the decision: never in the FactSet, never sent to the
|
|
12
|
+
* engine, never in the receipt, never read by the act lane — so it can never move a verdict. No
|
|
13
|
+
* recommendation, by design: "the oracle never decides" holds for the note too. Fail-soft: any
|
|
14
|
+
* failure (provider, parse, D1) leaves the decision exactly as it is, with no note, and the UI falls
|
|
15
|
+
* back to the checks. It restates the answers, so it is PII: served to reviewers, the owner and
|
|
16
|
+
* grant holders (never the submitter's view), never logged, erased with the claim body.
|
|
17
|
+
*
|
|
18
|
+
* On by default for an OpenHands checker (`openhands` set), off otherwise unless
|
|
19
|
+
* `policies.reviewerNote: true`.
|
|
20
|
+
*/
|
|
21
|
+
import type { ActFacts } from "../../act.js";
|
|
22
|
+
import type { Config } from "../../config.js";
|
|
23
|
+
import type { Database } from "../../db/client.js";
|
|
24
|
+
import type { OracleEnv } from "../../env.js";
|
|
25
|
+
import type { EngineClient } from "../engine/client.js";
|
|
26
|
+
import type { AttachmentFact } from "../facts/factset.js";
|
|
27
|
+
import type { AiCall } from "../facts/producer.js";
|
|
28
|
+
import type { Logger } from "../logger.js";
|
|
29
|
+
import type { TraceContext } from "../tracing.js";
|
|
30
|
+
export { capNote, NOTE_PROMPT, noteInput } from "./reviewer-note-prompt.js";
|
|
31
|
+
export interface ReviewerNote {
|
|
32
|
+
/** 1–2 plain sentences: what the answer claims. */
|
|
33
|
+
says: string;
|
|
34
|
+
/** What no check could verify or a person should double-check — each ending with what to do. */
|
|
35
|
+
checkThese: string[];
|
|
36
|
+
model: string;
|
|
37
|
+
createdAt: string;
|
|
38
|
+
}
|
|
39
|
+
/** Whether this oracle makes notes: `policies.reviewerNote`, else on for an OpenHands checker. */
|
|
40
|
+
export declare function reviewerNoteEnabled(): boolean;
|
|
41
|
+
export interface NoteDeps {
|
|
42
|
+
config: Config;
|
|
43
|
+
logger: Logger;
|
|
44
|
+
trace: TraceContext;
|
|
45
|
+
env?: OracleEnv;
|
|
46
|
+
cache?: OracleEnv["CACHE_KV"];
|
|
47
|
+
aiCalls?: AiCall[];
|
|
48
|
+
}
|
|
49
|
+
/** ONE model call → the capped note, or null on any failure (logged, never thrown). */
|
|
50
|
+
export declare function makeReviewerNote(deps: NoteDeps, claimId: string, user: string, now?: Date): Promise<ReviewerNote | null>;
|
|
51
|
+
/**
|
|
52
|
+
* Make and store the note for a claim just recorded `pending_review` (the evaluate step), or
|
|
53
|
+
* regenerate one for a claim already held (the admin route). Fail-soft end to end: a throw here
|
|
54
|
+
* would retry the evaluate step over a decision that is already recorded, so nothing escapes.
|
|
55
|
+
*/
|
|
56
|
+
export declare function writeReviewerNote(deps: NoteDeps & {
|
|
57
|
+
db: Database;
|
|
58
|
+
engine: Pick<EngineClient, "getManifest">;
|
|
59
|
+
}, input: {
|
|
60
|
+
claimId: string;
|
|
61
|
+
protocolDid: string;
|
|
62
|
+
pendingTasks: string[];
|
|
63
|
+
answers: Record<string, unknown>;
|
|
64
|
+
attachments: AttachmentFact[];
|
|
65
|
+
facts: ActFacts;
|
|
66
|
+
}): Promise<ReviewerNote | null>;
|
|
67
|
+
//# sourceMappingURL=reviewer-note.d.ts.map
|
|
@@ -0,0 +1 @@
|
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gB,CACpC,IAAI,EAAE,QAAQ,EACd,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EACZ,GAAG,GAAE,IAAiB,GACrB,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CA6D9B;AAED;;;;GAIG;AACH,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,QAAQ,GAAG;IAAE,EAAE,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,IAAI,CAAC,YAAY,EAAE,aAAa,CAAC,CAAA;CAAE,EAC5E,KAAK,EAAE;IACL,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,WAAW,EAAE,cAAc,EAAE,CAAC;IAC9B,KAAK,EAAE,QAAQ,CAAC;CACjB,GACA,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CA4B9B"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The reviewer note: what a person about to answer a review needs before they decide — what the
|
|
3
|
+
* answer actually claims, in plain words, and what no automatic check could verify (owner,
|
|
4
|
+
* 2026-10-21). An AI check's own `reason` is written for its rule ("the summary is specific, not
|
|
5
|
+
* placeholder text"), which tells the person deciding nothing; this note is written for them.
|
|
6
|
+
*
|
|
7
|
+
* reviewerNote: { says, checkThese[], model, createdAt }
|
|
8
|
+
*
|
|
9
|
+
* Made ONLY for a claim that lands `pending_review`, inside the evaluate step right after the
|
|
10
|
+
* decision is recorded (the answers never leave that step), by ONE model call on the same provider
|
|
11
|
+
* seam the AI checks use. It is OUTSIDE the decision: never in the FactSet, never sent to the
|
|
12
|
+
* engine, never in the receipt, never read by the act lane — so it can never move a verdict. No
|
|
13
|
+
* recommendation, by design: "the oracle never decides" holds for the note too. Fail-soft: any
|
|
14
|
+
* failure (provider, parse, D1) leaves the decision exactly as it is, with no note, and the UI falls
|
|
15
|
+
* back to the checks. It restates the answers, so it is PII: served to reviewers, the owner and
|
|
16
|
+
* grant holders (never the submitter's view), never logged, erased with the claim body.
|
|
17
|
+
*
|
|
18
|
+
* On by default for an OpenHands checker (`openhands` set), off otherwise unless
|
|
19
|
+
* `policies.reviewerNote: true`.
|
|
20
|
+
*/
|
|
21
|
+
import { eq } from "drizzle-orm";
|
|
22
|
+
import { decisions } from "../../db/schema.js";
|
|
23
|
+
import { getOracle } from "../../oracle.js";
|
|
24
|
+
import { persistAiCalls } from "../facts/builder.js";
|
|
25
|
+
import { alertIfCreditsExhausted, prepareModelCall, recordSpend, } from "../facts/stock/ai-provider.js";
|
|
26
|
+
import { fetchClient, MAX_JSON_DOC_BYTES, readCappedBytes } from "../http/client.js";
|
|
27
|
+
import { reportError } from "../sentry.js";
|
|
28
|
+
import { capNote, NOTE_PROMPT, NOTE_SCHEMA, noteInput } from "./reviewer-note-prompt.js";
|
|
29
|
+
import { reviewTaskOf } from "./tasks.js";
|
|
30
|
+
export { capNote, NOTE_PROMPT, noteInput } from "./reviewer-note-prompt.js";
|
|
31
|
+
/** Whether this oracle makes notes: `policies.reviewerNote`, else on for an OpenHands checker. */
|
|
32
|
+
export function reviewerNoteEnabled() {
|
|
33
|
+
const { policies, openhands } = getOracle().config;
|
|
34
|
+
return policies.reviewerNote ?? openhands !== undefined;
|
|
35
|
+
}
|
|
36
|
+
const NOTE_TIMEOUT_MS = 30_000;
|
|
37
|
+
/** ONE model call → the capped note, or null on any failure (logged, never thrown). */
|
|
38
|
+
export async function makeReviewerNote(deps, claimId, user, now = new Date()) {
|
|
39
|
+
const model = deps.config.AI_CHECK_MODEL;
|
|
40
|
+
let prepared;
|
|
41
|
+
let envelope = null;
|
|
42
|
+
let usage = null;
|
|
43
|
+
let callId = null;
|
|
44
|
+
try {
|
|
45
|
+
prepared = prepareModelCall(deps, {
|
|
46
|
+
model,
|
|
47
|
+
system: NOTE_PROMPT,
|
|
48
|
+
user,
|
|
49
|
+
schema: NOTE_SCHEMA,
|
|
50
|
+
tag: { claimId, fact: "review.note" },
|
|
51
|
+
idempotent: true,
|
|
52
|
+
});
|
|
53
|
+
const res = await fetchClient(prepared.url, {
|
|
54
|
+
method: "POST",
|
|
55
|
+
trace: deps.trace,
|
|
56
|
+
attempts: 2,
|
|
57
|
+
timeoutMs: NOTE_TIMEOUT_MS,
|
|
58
|
+
headers: { "content-type": "application/json", ...prepared.headers },
|
|
59
|
+
body: JSON.stringify(prepared.body),
|
|
60
|
+
send: prepared.send,
|
|
61
|
+
});
|
|
62
|
+
const bytes = await readCappedBytes(res, MAX_JSON_DOC_BYTES).catch(() => null);
|
|
63
|
+
const raw = bytes ? new TextDecoder().decode(bytes) : "";
|
|
64
|
+
try {
|
|
65
|
+
envelope = JSON.parse(raw);
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
/* non-JSON — below */
|
|
69
|
+
}
|
|
70
|
+
callId = prepared.callId(envelope);
|
|
71
|
+
usage = prepared.usage(envelope);
|
|
72
|
+
if (!res.ok) {
|
|
73
|
+
if (prepared)
|
|
74
|
+
await alertIfCreditsExhausted(deps, prepared.provider, raw);
|
|
75
|
+
throw new Error(`the model endpoint returned ${res.status}`);
|
|
76
|
+
}
|
|
77
|
+
const content = prepared.content(envelope);
|
|
78
|
+
if (content === null)
|
|
79
|
+
throw new Error("no completion content");
|
|
80
|
+
const capped = capNote(JSON.parse(content));
|
|
81
|
+
if (!capped)
|
|
82
|
+
throw new Error("the model's note did not have the expected shape");
|
|
83
|
+
return { ...capped, model, createdAt: now.toISOString() };
|
|
84
|
+
}
|
|
85
|
+
catch (err) {
|
|
86
|
+
// Never the note or the answers in the log line: ids and the reason only.
|
|
87
|
+
deps.logger.warn("review.note.failed", {
|
|
88
|
+
claimId,
|
|
89
|
+
detail: err instanceof Error ? err.message : String(err),
|
|
90
|
+
});
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
finally {
|
|
94
|
+
if (prepared) {
|
|
95
|
+
recordSpend(deps, {
|
|
96
|
+
provider: prepared.provider,
|
|
97
|
+
model,
|
|
98
|
+
fact: "review.note",
|
|
99
|
+
callId,
|
|
100
|
+
callIds: prepared.callIds(envelope),
|
|
101
|
+
usage,
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Make and store the note for a claim just recorded `pending_review` (the evaluate step), or
|
|
108
|
+
* regenerate one for a claim already held (the admin route). Fail-soft end to end: a throw here
|
|
109
|
+
* would retry the evaluate step over a decision that is already recorded, so nothing escapes.
|
|
110
|
+
*/
|
|
111
|
+
export async function writeReviewerNote(deps, input) {
|
|
112
|
+
const { claimId } = input;
|
|
113
|
+
try {
|
|
114
|
+
const manifest = await deps.engine.getManifest(input.protocolDid).catch(() => null);
|
|
115
|
+
const review = manifest && "review" in manifest ? manifest.review : undefined;
|
|
116
|
+
const tasks = input.pendingTasks.map((id) => reviewTaskOf(id, review));
|
|
117
|
+
const aiCalls = [];
|
|
118
|
+
const note = await makeReviewerNote({ ...deps, aiCalls }, claimId, noteInput({ ...input, tasks }));
|
|
119
|
+
await persistAiCalls(deps.db, claimId, aiCalls, deps.logger);
|
|
120
|
+
if (!note)
|
|
121
|
+
return null;
|
|
122
|
+
await deps.db
|
|
123
|
+
.update(decisions)
|
|
124
|
+
.set({ reviewerNote: note })
|
|
125
|
+
.where(eq(decisions.claimId, claimId));
|
|
126
|
+
deps.logger.info("review.note.written", { claimId, items: note.checkThese.length });
|
|
127
|
+
return note;
|
|
128
|
+
}
|
|
129
|
+
catch (err) {
|
|
130
|
+
deps.logger.warn("review.note.failed", {
|
|
131
|
+
claimId,
|
|
132
|
+
detail: err instanceof Error ? err.message : String(err),
|
|
133
|
+
});
|
|
134
|
+
reportError(err, { lane: "review", step: "note" });
|
|
135
|
+
return null;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
//# sourceMappingURL=reviewer-note.js.map
|
|
@@ -0,0 +1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GAAG,EAAE,CAAC;QACb,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,oBAAoB,EAAE;YACrC,OAAO;YACP,MAAM,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;SACzD,CAAC,CAAC;QACH,WAAW,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;QACnD,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -13,7 +13,7 @@ import type { AppEnv } from "../context.js";
|
|
|
13
13
|
/** Until the strict step: an invocation still minting `{ can: "*" }` keeps working. */
|
|
14
14
|
export declare const ACCEPT_WILDCARD = true;
|
|
15
15
|
/** [method, path pattern (`:param` = one segment), the one action it accepts]. */
|
|
16
|
-
export declare const ROUTE_ACTIONS: readonly [readonly ["POST", "/v1/collections/register", "collections/register"], readonly ["GET", "/v1/collections", "collections/read"], readonly ["POST", "/v1/collections/:collectionId/pause", "collections/pause"], readonly ["POST", "/v1/collections/:collectionId/resume", "collections/resume"], readonly ["POST", "/v1/collections/:collectionId/scan", "collections/scan"], readonly ["PATCH", "/v1/collections/:collectionId/settings", "collections/settings"], readonly ["GET", "/v1/collections/:collectionId/settings", "collections/settings-read"], readonly ["POST", "/v1/collections/:collectionId/reviewers", "collections/reviewers-grant"], readonly ["GET", "/v1/collections/:collectionId/reviewers", "collections/reviewers-read"], readonly ["POST", "/v1/collections/:collectionId/reviewers/:delegationCid/revoke", "collections/reviewers-revoke"], readonly ["GET", "/v1/claims", "claims/read"], readonly ["GET", "/v1/claims/:claimId", "claims/read"], readonly ["DELETE", "/v1/claims/:claimId/body", "claims/erase"], readonly ["GET", "/v1/reviews/:claimId", "reviews/read"], readonly ["POST", "/v1/reviews/:claimId", "reviews/submit"], readonly ["GET", "/v1/admin/status", "admin/status"], readonly ["POST", "/v1/admin/collections/relink", "admin/collections-relink"], readonly ["GET", "/v1/oauth/approvals/:approvalId", "oauth/approval/read"], readonly ["POST", "/v1/oauth/approvals/:approvalId", "oauth/approval/approve"], readonly ["GET", "/v1/oauth/standing/:grantId", "oauth/standing/read"], readonly ["PUT", "/v1/oauth/standing/:grantId", "oauth/standing/set"], readonly ["DELETE", "/v1/oauth/standing/:grantId", "oauth/standing/revoke"]];
|
|
16
|
+
export declare const ROUTE_ACTIONS: readonly [readonly ["POST", "/v1/collections/register", "collections/register"], readonly ["GET", "/v1/collections", "collections/read"], readonly ["POST", "/v1/collections/:collectionId/pause", "collections/pause"], readonly ["POST", "/v1/collections/:collectionId/resume", "collections/resume"], readonly ["POST", "/v1/collections/:collectionId/scan", "collections/scan"], readonly ["PATCH", "/v1/collections/:collectionId/settings", "collections/settings"], readonly ["GET", "/v1/collections/:collectionId/settings", "collections/settings-read"], readonly ["POST", "/v1/collections/:collectionId/reviewers", "collections/reviewers-grant"], readonly ["GET", "/v1/collections/:collectionId/reviewers", "collections/reviewers-read"], readonly ["POST", "/v1/collections/:collectionId/reviewers/:delegationCid/revoke", "collections/reviewers-revoke"], readonly ["GET", "/v1/claims", "claims/read"], readonly ["GET", "/v1/claims/:claimId", "claims/read"], readonly ["DELETE", "/v1/claims/:claimId/body", "claims/erase"], readonly ["GET", "/v1/reviews/:claimId", "reviews/read"], readonly ["POST", "/v1/reviews/:claimId", "reviews/submit"], readonly ["GET", "/v1/admin/status", "admin/status"], readonly ["POST", "/v1/admin/collections/relink", "admin/collections-relink"], readonly ["POST", "/v1/admin/claims/:claimId/reviewer-note", "admin/reviewer-note"], readonly ["GET", "/v1/oauth/approvals/:approvalId", "oauth/approval/read"], readonly ["POST", "/v1/oauth/approvals/:approvalId", "oauth/approval/approve"], readonly ["GET", "/v1/oauth/standing/:grantId", "oauth/standing/read"], readonly ["PUT", "/v1/oauth/standing/:grantId", "oauth/standing/set"], readonly ["DELETE", "/v1/oauth/standing/:grantId", "oauth/standing/revoke"]];
|
|
17
17
|
export type OracleAction = (typeof ROUTE_ACTIONS)[number][2];
|
|
18
18
|
/** Actions the legacy `*` NEVER stands in for, whatever `ACCEPT_WILDCARD` says (S3 review §3). */
|
|
19
19
|
export declare const STRICT_ACTIONS: ReadonlySet<OracleAction>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capability.d.ts","sourceRoot":"","sources":["../../src/middleware/capability.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAGzC,uFAAuF;AACvF,eAAO,MAAM,eAAe,OAAO,CAAC;AAEpC,kFAAkF;AAClF,eAAO,MAAM,aAAa,sBACvB,MAAM,EAAE,0BAA0B,EAAE,sBAAsB,aAC1D,KAAK,EAAE,iBAAiB,EAAE,kBAAkB,aAC5C,MAAM,EAAE,qCAAqC,EAAE,mBAAmB,aAClE,MAAM,EAAE,sCAAsC,EAAE,oBAAoB,aACpE,MAAM,EAAE,oCAAoC,EAAE,kBAAkB,aAEhE,OAAO,EAAE,wCAAwC,EAAE,sBAAsB,aACzE,KAAK,EAAE,wCAAwC,EAAE,2BAA2B,aAE5E,MAAM,EAAE,yCAAyC,EAAE,6BAA6B,aAChF,KAAK,EAAE,yCAAyC,EAAE,4BAA4B,aAE7E,MAAM,EACN,+DAA+D,EAC/D,8BAA8B,aAE/B,KAAK,EAAE,YAAY,EAAE,aAAa,aAClC,KAAK,EAAE,qBAAqB,EAAE,aAAa,aAE3C,QAAQ,EAAE,0BAA0B,EAAE,cAAc,aACpD,KAAK,EAAE,sBAAsB,EAAE,cAAc,aAC7C,MAAM,EAAE,sBAAsB,EAAE,gBAAgB,aAChD,KAAK,EAAE,kBAAkB,EAAE,cAAc,aAEzC,MAAM,EAAE,8BAA8B,EAAE,0BAA0B,aAElE,KAAK,EAAE,iCAAiC,EAAE,qBAAqB,aAC/D,MAAM,EAAE,iCAAiC,EAAE,wBAAwB,aAEnE,KAAK,EAA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,MAAM,EAAE,yCAAyC,EAAE,qBAAqB,aAExE,KAAK,EAAE,iCAAiC,EAAE,qBAAqB,aAC/D,MAAM,EAAE,iCAAiC,EAAE,wBAAwB,aAEnE,KAAK,EAAE,6BAA6B,EAAE,qBAAqB,aAC3D,KAAK,EAAE,6BAA6B,EAAE,oBAAoB,aAC1D,QAAQ,EAAE,6BAA6B,EAAE,uBAAuB,EACzD,CAAC;AAEX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AAE7D,kGAAkG;AAClG,eAAO,MAAM,cAAc,EAAE,WAAW,CAAC,YAAY,CAkBnD,CAAC;AAEH,uGAAuG;AACvG,eAAO,MAAM,aAAa,EAAE,SAAS,MAAM,EAK1C,CAAC;AAUF;sFACsF;AACtF,wBAAgB,SAAS,CACvB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,GACX;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,YAAY,CAAA;CAAE,GAAG,IAAI,CAIlD;AAED;;gCAEgC;AAChC,eAAO,MAAM,aAAa,gEAuBxB,CAAC"}
|
|
@@ -40,6 +40,8 @@ export const ROUTE_ACTIONS = [
|
|
|
40
40
|
["GET", "/v1/admin/status", "admin/status"],
|
|
41
41
|
// The operator's company-link backfill (lib/register.ts) — strict from day one, below.
|
|
42
42
|
["POST", "/v1/admin/collections/relink", "admin/collections-relink"],
|
|
43
|
+
// The operator's reviewer-note (re)make for a held claim (lib/review/reviewer-note.ts) — strict.
|
|
44
|
+
["POST", "/v1/admin/claims/:claimId/reviewer-note", "admin/reviewer-note"],
|
|
43
45
|
// AuthHub's approvals back-channel (MCP over OAuth, S7) — strict from day one, below.
|
|
44
46
|
["GET", "/v1/oauth/approvals/:approvalId", "oauth/approval/read"],
|
|
45
47
|
["POST", "/v1/oauth/approvals/:approvalId", "oauth/approval/approve"],
|
|
@@ -60,6 +62,8 @@ export const STRICT_ACTIONS = new Set([
|
|
|
60
62
|
// A review answer settles a verdict (the fold acts on it): a token that can do anything may not.
|
|
61
63
|
"reviews/submit",
|
|
62
64
|
"admin/collections-relink",
|
|
65
|
+
// It spends a model call and re-reads a claim body: only a token minted for it.
|
|
66
|
+
"admin/reviewer-note",
|
|
63
67
|
"oauth/approval/read",
|
|
64
68
|
"oauth/approval/approve",
|
|
65
69
|
"oauth/standing/read",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capability.js","sourceRoot":"","sources":["../../src/middleware/capability.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,uFAAuF;AACvF,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,CAAC;AAEpC,kFAAkF;AAClF,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,CAAC,MAAM,EAAE,0BAA0B,EAAE,sBAAsB,CAAC;IAC5D,CAAC,KAAK,EAAE,iBAAiB,EAAE,kBAAkB,CAAC;IAC9C,CAAC,MAAM,EAAE,qCAAqC,EAAE,mBAAmB,CAAC;IACpE,CAAC,MAAM,EAAE,sCAAsC,EAAE,oBAAoB,CAAC;IACtE,CAAC,MAAM,EAAE,oCAAoC,EAAE,kBAAkB,CAAC;IAClE,4EAA4E;IAC5E,CAAC,OAAO,EAAE,wCAAwC,EAAE,sBAAsB,CAAC;IAC3E,CAAC,KAAK,EAAE,wCAAwC,EAAE,2BAA2B,CAAC;IAC9E,+EAA+E;IAC/E,CAAC,MAAM,EAAE,yCAAyC,EAAE,6BAA6B,CAAC;IAClF,CAAC,KAAK,EAAE,yCAAyC,EAAE,4BAA4B,CAAC;IAChF;QACE,MAAM;QACN,+DAA+D;QAC/D,8BAA8B;KAC/B;IACD,CAAC,KAAK,EAAE,YAAY,EAAE,aAAa,CAAC;IACpC,CAAC,KAAK,E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AAC,CAAC;QACjE,CAAC;QACD,OAAO,IAAI,EAAE,CAAC;IAChB,CAAC;IACD,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,QAAQ,CAAC,SAAS,CACtB,uBAAuB,CAAC,CAAC,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC,GAAG,CAAC,IAAI,yBAAyB,SAAS,CAAC,GAAG,IAAI,CAC5F,CAAC;IACJ,CAAC;IACD,IAAI,SAAS,CAAC,GAAG,KAAK,KAAK,CAAC,MAAM,EAAE,CAAC;QACnC,MAAM,QAAQ,CAAC,SAAS,CACtB,gCAAgC,KAAK,CAAC,MAAM,yCAAyC,SAAS,CAAC,GAAG,IAAI,CACvG,CAAC;IACJ,CAAC;IACD,OAAO,IAAI,EAAE,CAAC;AAChB,CAAC,CAAC,CAAC"}
|
package/dist/oracle.d.ts
CHANGED
|
@@ -54,6 +54,7 @@ export declare const OracleConfigSchema: z.ZodObject<{
|
|
|
54
54
|
act: z.ZodOptional<z.ZodCustom<unknown, unknown>>;
|
|
55
55
|
actSummary: z.ZodOptional<z.ZodString>;
|
|
56
56
|
allowStandingApprovals: z.ZodBoolean;
|
|
57
|
+
reviewerNote: z.ZodOptional<z.ZodBoolean>;
|
|
57
58
|
}, z.core.$strip>;
|
|
58
59
|
facts: z.ZodOptional<z.ZodCustom<unknown, unknown>>;
|
|
59
60
|
archive: z.ZodOptional<z.ZodCustom<unknown, unknown>>;
|
package/dist/oracle.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oracle.d.ts","sourceRoot":"","sources":["../src/oracle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,O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|
package/dist/oracle.js
CHANGED
|
@@ -143,6 +143,13 @@ const BaseConfigSchema = z.object({
|
|
|
143
143
|
* and every OAuth submit needs the user's approval of that claim.
|
|
144
144
|
*/
|
|
145
145
|
allowStandingApprovals: z.boolean(),
|
|
146
|
+
/**
|
|
147
|
+
* Make a reviewer note for each claim held for a person (`pending_review`): one AI call that
|
|
148
|
+
* says, in plain words, what the answer claims and what no check could verify
|
|
149
|
+
* (lib/review/reviewer-note.ts). Outside the decision — never sent to the engine. Absent ⇒ on
|
|
150
|
+
* for an OpenHands checker (`openhands` set), off otherwise.
|
|
151
|
+
*/
|
|
152
|
+
reviewerNote: z.boolean().optional(),
|
|
146
153
|
}),
|
|
147
154
|
/**
|
|
148
155
|
* HOW this oracle produces facts — the provider seam. Zod only carries it through; the TYPE
|
package/dist/oracle.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oracle.js","sourceRoot":"","sources":["../src/oracle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGzD,8FAA8F;AAC9F,MAAM,SAAS,GAAG,CAAC,CAAC,MAAM,CAAC;IACzB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACxB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,0CAA0C,CAAC;CACjF,CAAC,CAAC;AAEH;wFACwF;AACxF,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC;AAE7D;;;;GAIG;AACH,MAAM,aAAa,GAAG,CAAC;KACpB,GAAG,EAAE;KACL,GAAG,CAAC,MAAM,EAAE,yCAAyC,CAAC;KACtD,UAAU,CAAC,MAAM,EAAE,+DAA+D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5B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"admin.d.ts","sourceRoot":"","sources":["../../../src/routes/v1/admin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAa5C,eAAO,MAAM,KAAK,qDAAqB,CAAC"}
|
package/dist/routes/v1/admin.js
CHANGED
|
@@ -18,9 +18,12 @@ import { CollectionId } from "../../contracts/index.js";
|
|
|
18
18
|
import { readApiBacklog, readChainBacklog } from "../../cron/backlog.js";
|
|
19
19
|
import { createEngineClient } from "../../lib/engine/client.js";
|
|
20
20
|
import { AppError } from "../../lib/errors.js";
|
|
21
|
+
import { depsFromEnv } from "../../lib/ixo/index.js";
|
|
21
22
|
import { readiness } from "../../lib/readiness.js";
|
|
22
23
|
import { RELINK_CAP, relinkCollections } from "../../lib/register.js";
|
|
24
|
+
import { writeReviewerNote } from "../../lib/review/reviewer-note.js";
|
|
23
25
|
import { validate } from "../../lib/validator.js";
|
|
26
|
+
import { sourceFor } from "../../workflows/claim-source.js";
|
|
24
27
|
export const admin = new Hono();
|
|
25
28
|
/**
|
|
26
29
|
* The engine read is best-effort: a slow engine answers `engine: null`, never a slow status. 1 s,
|
|
@@ -98,4 +101,60 @@ async function withTimeout(p, ms) {
|
|
|
98
101
|
clearTimeout(timer);
|
|
99
102
|
}
|
|
100
103
|
}
|
|
104
|
+
const ClaimParam = z.object({ claimId: z.string().regex(/^[\x21-\x7e]{1,512}$/) });
|
|
105
|
+
/**
|
|
106
|
+
* Make (or remake) the reviewer note for a claim held for a person — for a claim decided before
|
|
107
|
+
* this oracle made notes, or one whose note failed. Operators only (ORACLE_ADMIN_DIDS). It re-pulls
|
|
108
|
+
* the body through the claim's own lane (the answers are never stored here), so the note is built
|
|
109
|
+
* from the same bytes the decision was. The note never reaches the response: read it where a
|
|
110
|
+
* reviewer does (GET /v1/reviews/:claimId); this answers only whether one was written.
|
|
111
|
+
*/
|
|
112
|
+
admin.post("/claims/:claimId/reviewer-note", validate("param", ClaimParam), async (c) => {
|
|
113
|
+
const config = c.get("config");
|
|
114
|
+
if (!config.ORACLE_ADMIN_DIDS.includes(c.get("principal").did)) {
|
|
115
|
+
throw AppError.forbidden("Operators only (ORACLE_ADMIN_DIDS)");
|
|
116
|
+
}
|
|
117
|
+
const { claimId } = c.req.valid("param");
|
|
118
|
+
const db = await c.var.db();
|
|
119
|
+
const [decision, ingest] = await Promise.all([
|
|
120
|
+
db.query.decisions.findFirst({ where: (t, { eq }) => eq(t.claimId, claimId) }),
|
|
121
|
+
db.query.claimIngests.findFirst({ where: (t, { eq }) => eq(t.claimId, claimId) }),
|
|
122
|
+
]);
|
|
123
|
+
if (!decision || !ingest)
|
|
124
|
+
throw AppError.notFound(`No decision for claim ${claimId}`);
|
|
125
|
+
if (decision.status !== "pending_review" || !decision.facts) {
|
|
126
|
+
throw AppError.conflict(`Claim ${claimId} is not held for a person (${decision.status})`);
|
|
127
|
+
}
|
|
128
|
+
const deps = depsFromEnv(c.env, { claimId });
|
|
129
|
+
const source = sourceFor(ingest.lane ?? "chain", c.env, deps);
|
|
130
|
+
const { content: _content, ...pulled } = await source.pull(claimId);
|
|
131
|
+
const note = await writeReviewerNote({
|
|
132
|
+
config,
|
|
133
|
+
logger: deps.logger,
|
|
134
|
+
trace: deps.trace,
|
|
135
|
+
env: c.env,
|
|
136
|
+
cache: c.env.CACHE_KV,
|
|
137
|
+
db,
|
|
138
|
+
engine: createEngineClient({
|
|
139
|
+
config,
|
|
140
|
+
logger: deps.logger,
|
|
141
|
+
trace: deps.trace,
|
|
142
|
+
cache: c.env.CACHE_KV,
|
|
143
|
+
}),
|
|
144
|
+
}, {
|
|
145
|
+
claimId,
|
|
146
|
+
protocolDid: await source.protocolDid(decision.collectionId),
|
|
147
|
+
pendingTasks: decision.decision?.pendingTasks ?? [],
|
|
148
|
+
answers: pulled.body,
|
|
149
|
+
attachments: pulled.attachments.map((a) => ({
|
|
150
|
+
question: a.question,
|
|
151
|
+
name: a.name,
|
|
152
|
+
mediaType: a.mediaType,
|
|
153
|
+
cid: a.cid ?? null,
|
|
154
|
+
size: a.size ?? null,
|
|
155
|
+
})),
|
|
156
|
+
facts: decision.facts,
|
|
157
|
+
});
|
|
158
|
+
return c.json({ claimId, written: note !== null }, note ? 200 : 503);
|
|
159
|
+
});
|
|
101
160
|
//# sourceMappingURL=admin.js.map
|