@maycombhq/sdk 2.0.0-beta.2 → 2.0.0-beta.21
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/npm/core/ai-decisions.d.ts +360 -0
- package/npm/core/api.d.ts +5806 -1212
- package/npm/core/audit.d.ts +165 -0
- package/npm/core/catalog.d.ts +220 -66
- package/npm/core/contract-check.d.ts +261 -0
- package/npm/core/decision-batches.d.ts +29 -0
- package/npm/core/declared-links.d.ts +62 -0
- package/npm/core/eol.d.ts +5 -0
- package/npm/core/fact-paths.d.ts +14 -0
- package/npm/core/facts-callers.d.ts +2 -0
- package/npm/core/facts-join-prototype.d.ts +66 -4
- package/npm/core/facts-join-vendor.d.ts +20 -2
- package/npm/core/facts-join.d.ts +320 -1
- package/npm/core/facts-terms.d.ts +108 -0
- package/npm/core/fs.d.ts +23 -4
- package/npm/core/host-questions.d.ts +93 -1
- package/npm/core/index.d.ts +22 -0
- package/npm/core/link-candidates.d.ts +103 -0
- package/npm/core/link-evidence.d.ts +212 -0
- package/npm/core/manifest-edit.d.ts +53 -4
- package/npm/core/merge.d.ts +28 -0
- package/npm/core/metarepo.d.ts +18 -1
- package/npm/core/migrate.d.ts +3 -2
- package/npm/core/org-notes.d.ts +180 -0
- package/npm/core/orgpack-defaults.d.ts +22 -6
- package/npm/core/orgpack-load.d.ts +19 -0
- package/npm/core/profile-migrate.d.ts +11 -0
- package/npm/core/question-order.d.ts +23 -0
- package/npm/core/question-owners.d.ts +53 -0
- package/npm/core/question-proposals.d.ts +77 -0
- package/npm/core/question-roles.d.ts +24 -0
- package/npm/core/questions.d.ts +85 -6
- package/npm/core/repo-reads.d.ts +44 -0
- package/npm/core/roles-migrate.d.ts +9 -0
- package/npm/core/runtime-migrate.d.ts +18 -0
- package/npm/core/schema/ai.d.ts +57 -9
- package/npm/core/schema/common.d.ts +32 -8
- package/npm/core/schema/component-type.d.ts +193 -0
- package/npm/core/schema/conventions.d.ts +80 -0
- package/npm/core/schema/fact-corrections.d.ts +96 -2
- package/npm/core/schema/facts.d.ts +410 -1
- package/npm/core/schema/kinds.d.ts +230 -66
- package/npm/core/schema/orgpack.d.ts +110 -7
- package/npm/core/schema/question.d.ts +228 -5
- package/npm/core/schema/reading-rules.d.ts +51 -0
- package/npm/core/schema/repo-type.d.ts +20 -2
- package/npm/core/schema/review.d.ts +7 -7
- package/npm/core/schema/scan-verify.d.ts +87 -45
- package/npm/core/schema/version.d.ts +4 -1
- package/npm/core/schema/workspace.d.ts +29 -11
- package/npm/core/shared-maps.d.ts +146 -0
- package/npm/core/stack-helpers.d.ts +32 -0
- package/npm/index.js +5614 -2343
- package/package.json +1 -1
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { Fact } from "./schema/facts.js";
|
|
3
|
+
/**
|
|
4
|
+
* The sample audit (plan item P3, ADR 0148): a person confirms a handful of a repo's kept facts
|
|
5
|
+
* and of the links the estate join makes from it, drawn at random but reproducibly from a seed,
|
|
6
|
+
* and the answers give a precision on the real estate. The answers are a person's record,
|
|
7
|
+
* `<repo>.audit.yaml` beside the facts, committed in a pull request like any other file of the
|
|
8
|
+
* metarepo; nothing is sent anywhere.
|
|
9
|
+
*
|
|
10
|
+
* The verifier never takes an audit's word into the facts file (a reader can't vouch for itself,
|
|
11
|
+
* and `atticus verify` writes `verified: line` on every fact a reader made): a right answer shows
|
|
12
|
+
* as `verified: sample` where the facts are read for a person (the Map's facts list), as long as
|
|
13
|
+
* the fact still cites the line the person saw. Pure: the caller reads and writes the file.
|
|
14
|
+
*/
|
|
15
|
+
export declare const AUDIT_ANSWERS: readonly ["right", "wrong", "unsure"];
|
|
16
|
+
export type AuditAnswer = (typeof AUDIT_ANSWERS)[number];
|
|
17
|
+
export declare const AuditItem: z.ZodObject<{
|
|
18
|
+
id: z.ZodString;
|
|
19
|
+
kind: z.ZodEnum<{
|
|
20
|
+
ai: "ai";
|
|
21
|
+
link: "link";
|
|
22
|
+
fact: "fact";
|
|
23
|
+
}>;
|
|
24
|
+
of: z.ZodString;
|
|
25
|
+
claim: z.ZodString;
|
|
26
|
+
cites: z.ZodArray<z.ZodString>;
|
|
27
|
+
fact: z.ZodOptional<z.ZodString>;
|
|
28
|
+
value: z.ZodOptional<z.ZodString>;
|
|
29
|
+
to: z.ZodOptional<z.ZodString>;
|
|
30
|
+
decided: z.ZodOptional<z.ZodString>;
|
|
31
|
+
run: z.ZodOptional<z.ZodString>;
|
|
32
|
+
answer: z.ZodOptional<z.ZodEnum<{
|
|
33
|
+
right: "right";
|
|
34
|
+
wrong: "wrong";
|
|
35
|
+
unsure: "unsure";
|
|
36
|
+
}>>;
|
|
37
|
+
note: z.ZodOptional<z.ZodString>;
|
|
38
|
+
by: z.ZodOptional<z.ZodString>;
|
|
39
|
+
at: z.ZodOptional<z.ZodString>;
|
|
40
|
+
}, z.core.$strict>;
|
|
41
|
+
export type AuditItemT = z.infer<typeof AuditItem>;
|
|
42
|
+
export declare const AuditDraw: z.ZodObject<{
|
|
43
|
+
seed: z.ZodString;
|
|
44
|
+
size: z.ZodNumber;
|
|
45
|
+
commit: z.ZodOptional<z.ZodString>;
|
|
46
|
+
at: z.ZodString;
|
|
47
|
+
}, z.core.$strict>;
|
|
48
|
+
export type AuditDrawT = z.infer<typeof AuditDraw>;
|
|
49
|
+
export declare const AuditFile: z.ZodObject<{
|
|
50
|
+
schema: z.ZodLiteral<1>;
|
|
51
|
+
repo: z.ZodString;
|
|
52
|
+
draws: z.ZodArray<z.ZodObject<{
|
|
53
|
+
seed: z.ZodString;
|
|
54
|
+
size: z.ZodNumber;
|
|
55
|
+
commit: z.ZodOptional<z.ZodString>;
|
|
56
|
+
at: z.ZodString;
|
|
57
|
+
}, z.core.$strict>>;
|
|
58
|
+
items: z.ZodArray<z.ZodObject<{
|
|
59
|
+
id: z.ZodString;
|
|
60
|
+
kind: z.ZodEnum<{
|
|
61
|
+
ai: "ai";
|
|
62
|
+
link: "link";
|
|
63
|
+
fact: "fact";
|
|
64
|
+
}>;
|
|
65
|
+
of: z.ZodString;
|
|
66
|
+
claim: z.ZodString;
|
|
67
|
+
cites: z.ZodArray<z.ZodString>;
|
|
68
|
+
fact: z.ZodOptional<z.ZodString>;
|
|
69
|
+
value: z.ZodOptional<z.ZodString>;
|
|
70
|
+
to: z.ZodOptional<z.ZodString>;
|
|
71
|
+
decided: z.ZodOptional<z.ZodString>;
|
|
72
|
+
run: z.ZodOptional<z.ZodString>;
|
|
73
|
+
answer: z.ZodOptional<z.ZodEnum<{
|
|
74
|
+
right: "right";
|
|
75
|
+
wrong: "wrong";
|
|
76
|
+
unsure: "unsure";
|
|
77
|
+
}>>;
|
|
78
|
+
note: z.ZodOptional<z.ZodString>;
|
|
79
|
+
by: z.ZodOptional<z.ZodString>;
|
|
80
|
+
at: z.ZodOptional<z.ZodString>;
|
|
81
|
+
}, z.core.$strict>>;
|
|
82
|
+
}, z.core.$strict>;
|
|
83
|
+
export type AuditFileT = z.infer<typeof AuditFile>;
|
|
84
|
+
export declare const AUDIT_DEFAULT_SIZE = 10;
|
|
85
|
+
export declare function parseAuditFile(text: string): {
|
|
86
|
+
ok: true;
|
|
87
|
+
file: AuditFileT;
|
|
88
|
+
} | {
|
|
89
|
+
ok: false;
|
|
90
|
+
issues: string[];
|
|
91
|
+
};
|
|
92
|
+
export declare function serializeAuditFile(file: AuditFileT): string;
|
|
93
|
+
/**
|
|
94
|
+
* The facts an audit may draw: those the verifier kept that a reader wrote. A person's own fact
|
|
95
|
+
* (a correction) is their word already, and one not yet checked isn't kept; neither is drawn.
|
|
96
|
+
*/
|
|
97
|
+
export declare function auditCandidates(facts: readonly Fact[]): AuditItemT[];
|
|
98
|
+
/**
|
|
99
|
+
* A reproducible random sample: `size` facts and `size` links (all of them when there are
|
|
100
|
+
* fewer), the same for the same candidates and seed whatever order they come in.
|
|
101
|
+
*/
|
|
102
|
+
export declare function drawAudit(o: {
|
|
103
|
+
facts: readonly AuditItemT[];
|
|
104
|
+
links: readonly AuditItemT[];
|
|
105
|
+
/** ADR 0181: the AI's decisions standing for the repo (its pairings and answers). */
|
|
106
|
+
ai?: readonly AuditItemT[];
|
|
107
|
+
size: number;
|
|
108
|
+
seed: string;
|
|
109
|
+
}): AuditItemT[];
|
|
110
|
+
/**
|
|
111
|
+
* A draw added to the file on record: items already there keep their answers, new ones are
|
|
112
|
+
* added unanswered, and a draw with the same seed, size and commit isn't recorded twice.
|
|
113
|
+
*/
|
|
114
|
+
export declare function mergeDraw(file: AuditFileT | undefined, repo: string, items: readonly AuditItemT[], draw: AuditDrawT): AuditFileT;
|
|
115
|
+
/**
|
|
116
|
+
* The Wilson score interval at 95%, rounded to three places: honest for a small sample and for
|
|
117
|
+
* a precision of 0 or 1, where the plain p ± 2σ is not. Undefined with nothing answered.
|
|
118
|
+
*/
|
|
119
|
+
export declare function wilson(right: number, n: number): {
|
|
120
|
+
low: number;
|
|
121
|
+
high: number;
|
|
122
|
+
} | undefined;
|
|
123
|
+
export interface AuditTally {
|
|
124
|
+
drawn: number;
|
|
125
|
+
right: number;
|
|
126
|
+
wrong: number;
|
|
127
|
+
unsure: number;
|
|
128
|
+
/** Drawn and not answered yet. */
|
|
129
|
+
open: number;
|
|
130
|
+
/** Drawn, but the fact or link is no longer as the person saw it: left out of the count. */
|
|
131
|
+
gone: number;
|
|
132
|
+
/** right / (right + wrong); null with neither. */
|
|
133
|
+
precision: number | null;
|
|
134
|
+
low: number | null;
|
|
135
|
+
high: number | null;
|
|
136
|
+
}
|
|
137
|
+
export interface AuditPrecision {
|
|
138
|
+
facts: AuditTally;
|
|
139
|
+
byKind: Record<string, AuditTally>;
|
|
140
|
+
links: AuditTally;
|
|
141
|
+
/** Links by how they were joined (ADR 0135's flags). */
|
|
142
|
+
byHow: Record<string, AuditTally>;
|
|
143
|
+
/** ADR 0181: the AI's decisions (its pairings and answers), apart from the facts and links. */
|
|
144
|
+
ai: AuditTally;
|
|
145
|
+
/** ADR 0181: the AI's decisions by what they decided: `link` or `question`. */
|
|
146
|
+
byAi: Record<string, AuditTally>;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Precision from the answers: of the items answered right or wrong, the share right, with the
|
|
150
|
+
* Wilson interval. Unsure and unanswered items are counted apart and never in the share; `keep`
|
|
151
|
+
* drops an item whose fact or link has changed since it was drawn (counted as gone).
|
|
152
|
+
*/
|
|
153
|
+
export declare function auditPrecision(items: readonly AuditItemT[], keep?: (i: AuditItemT) => boolean): AuditPrecision;
|
|
154
|
+
/** Several repos' precision summed: the estate's. */
|
|
155
|
+
export declare function sumAuditPrecision(list: readonly AuditPrecision[]): AuditPrecision;
|
|
156
|
+
/**
|
|
157
|
+
* Whether a fact item is still the fact the person saw: the same id, citing the same line with
|
|
158
|
+
* the same value. Used to keep an answer standing, and to show a right one as `verified: sample`.
|
|
159
|
+
*/
|
|
160
|
+
export declare function auditItemHolds(i: AuditItemT, facts: ReadonlyMap<string, Fact>): boolean;
|
|
161
|
+
/**
|
|
162
|
+
* The facts a person answered right in a sample audit that are still as they saw them: shown as
|
|
163
|
+
* `verified: sample` where the facts are read for a person (the facts file keeps `line`).
|
|
164
|
+
*/
|
|
165
|
+
export declare function sampleConfirmed(audit: AuditFileT | undefined, facts: readonly Fact[]): Set<string>;
|