@maycombhq/sdk 2.0.0-beta.2 → 2.0.0-beta.22

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.
Files changed (61) hide show
  1. package/npm/core/ai-decisions.d.ts +373 -0
  2. package/npm/core/api.d.ts +5890 -1210
  3. package/npm/core/audit.d.ts +165 -0
  4. package/npm/core/catalog.d.ts +220 -66
  5. package/npm/core/cite.d.ts +20 -4
  6. package/npm/core/contract-check.d.ts +261 -0
  7. package/npm/core/decision-batches.d.ts +29 -0
  8. package/npm/core/declared-links.d.ts +62 -0
  9. package/npm/core/eol.d.ts +5 -0
  10. package/npm/core/fact-paths.d.ts +14 -0
  11. package/npm/core/facts-callers.d.ts +2 -0
  12. package/npm/core/facts-carry.d.ts +8 -2
  13. package/npm/core/facts-join-prototype.d.ts +66 -4
  14. package/npm/core/facts-join-vendor.d.ts +20 -2
  15. package/npm/core/facts-join.d.ts +325 -1
  16. package/npm/core/facts-terms.d.ts +108 -0
  17. package/npm/core/fs.d.ts +40 -4
  18. package/npm/core/glob.d.ts +14 -0
  19. package/npm/core/host-questions.d.ts +93 -1
  20. package/npm/core/identity.d.ts +28 -0
  21. package/npm/core/index.d.ts +24 -0
  22. package/npm/core/link-candidates.d.ts +103 -0
  23. package/npm/core/link-evidence.d.ts +212 -0
  24. package/npm/core/manifest-edit.d.ts +53 -4
  25. package/npm/core/merge.d.ts +28 -0
  26. package/npm/core/metarepo.d.ts +18 -1
  27. package/npm/core/migrate.d.ts +3 -2
  28. package/npm/core/org-notes.d.ts +180 -0
  29. package/npm/core/orgpack-defaults.d.ts +22 -6
  30. package/npm/core/orgpack-load.d.ts +19 -0
  31. package/npm/core/profile-migrate.d.ts +11 -0
  32. package/npm/core/question-order.d.ts +23 -0
  33. package/npm/core/question-owners.d.ts +53 -0
  34. package/npm/core/question-proposals.d.ts +77 -0
  35. package/npm/core/question-roles.d.ts +24 -0
  36. package/npm/core/questions.d.ts +90 -6
  37. package/npm/core/repo-files.d.ts +60 -0
  38. package/npm/core/repo-reads.d.ts +44 -0
  39. package/npm/core/roles-migrate.d.ts +9 -0
  40. package/npm/core/runtime-migrate.d.ts +18 -0
  41. package/npm/core/schema/ai.d.ts +57 -9
  42. package/npm/core/schema/common.d.ts +32 -8
  43. package/npm/core/schema/component-type.d.ts +193 -0
  44. package/npm/core/schema/conventions.d.ts +80 -0
  45. package/npm/core/schema/fact-corrections.d.ts +105 -2
  46. package/npm/core/schema/facts.d.ts +410 -1
  47. package/npm/core/schema/kinds.d.ts +230 -66
  48. package/npm/core/schema/orgpack.d.ts +159 -19
  49. package/npm/core/schema/question.d.ts +228 -5
  50. package/npm/core/schema/reading-rules.d.ts +51 -0
  51. package/npm/core/schema/repo-type.d.ts +20 -2
  52. package/npm/core/schema/review.d.ts +7 -7
  53. package/npm/core/schema/scan-verify.d.ts +87 -45
  54. package/npm/core/schema/version.d.ts +4 -1
  55. package/npm/core/schema/workspace.d.ts +29 -11
  56. package/npm/core/shared-maps.d.ts +146 -0
  57. package/npm/core/stack-helpers.d.ts +32 -0
  58. package/npm/fs-repo.d.ts +2 -1
  59. package/npm/index.js +6194 -2542
  60. package/npm/listing.d.ts +14 -0
  61. 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>;