@garygentry/system1-core 0.1.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/LICENSE +21 -0
- package/README.md +13 -0
- package/dist/config/consent.d.ts +11 -0
- package/dist/config/consent.d.ts.map +1 -0
- package/dist/config/consent.js +33 -0
- package/dist/config/consent.js.map +1 -0
- package/dist/config/load.d.ts +64 -0
- package/dist/config/load.d.ts.map +1 -0
- package/dist/config/load.js +216 -0
- package/dist/config/load.js.map +1 -0
- package/dist/config/session.d.ts +31 -0
- package/dist/config/session.d.ts.map +1 -0
- package/dist/config/session.js +36 -0
- package/dist/config/session.js.map +1 -0
- package/dist/config.d.ts +28 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +64 -0
- package/dist/config.js.map +1 -0
- package/dist/decide.d.ts +57 -0
- package/dist/decide.d.ts.map +1 -0
- package/dist/decide.js +87 -0
- package/dist/decide.js.map +1 -0
- package/dist/egress/exclude.d.ts +24 -0
- package/dist/egress/exclude.d.ts.map +1 -0
- package/dist/egress/exclude.js +60 -0
- package/dist/egress/exclude.js.map +1 -0
- package/dist/egress/scrub.d.ts +12 -0
- package/dist/egress/scrub.d.ts.map +1 -0
- package/dist/egress/scrub.js +84 -0
- package/dist/egress/scrub.js.map +1 -0
- package/dist/egress/size.d.ts +16 -0
- package/dist/egress/size.d.ts.map +1 -0
- package/dist/egress/size.js +25 -0
- package/dist/egress/size.js.map +1 -0
- package/dist/errors.d.ts +44 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +23 -0
- package/dist/errors.js.map +1 -0
- package/dist/fixtures/store.d.ts +34 -0
- package/dist/fixtures/store.d.ts.map +1 -0
- package/dist/fixtures/store.js +74 -0
- package/dist/fixtures/store.js.map +1 -0
- package/dist/index.d.ts +59 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +33 -0
- package/dist/index.js.map +1 -0
- package/dist/model/answers.d.ts +38 -0
- package/dist/model/answers.d.ts.map +1 -0
- package/dist/model/answers.js +48 -0
- package/dist/model/answers.js.map +1 -0
- package/dist/model/profiles.d.ts +39 -0
- package/dist/model/profiles.d.ts.map +1 -0
- package/dist/model/profiles.js +42 -0
- package/dist/model/profiles.js.map +1 -0
- package/dist/model/types.d.ts +107 -0
- package/dist/model/types.d.ts.map +1 -0
- package/dist/model/types.js +17 -0
- package/dist/model/types.js.map +1 -0
- package/dist/model/validate.d.ts +17 -0
- package/dist/model/validate.d.ts.map +1 -0
- package/dist/model/validate.js +151 -0
- package/dist/model/validate.js.map +1 -0
- package/dist/ping.d.ts +30 -0
- package/dist/ping.d.ts.map +1 -0
- package/dist/ping.js +50 -0
- package/dist/ping.js.map +1 -0
- package/dist/prepare.d.ts +39 -0
- package/dist/prepare.d.ts.map +1 -0
- package/dist/prepare.js +84 -0
- package/dist/prepare.js.map +1 -0
- package/dist/project/project.d.ts +64 -0
- package/dist/project/project.d.ts.map +1 -0
- package/dist/project/project.js +144 -0
- package/dist/project/project.js.map +1 -0
- package/dist/run/budget.d.ts +20 -0
- package/dist/run/budget.d.ts.map +1 -0
- package/dist/run/budget.js +31 -0
- package/dist/run/budget.js.map +1 -0
- package/dist/run/pool.d.ts +16 -0
- package/dist/run/pool.d.ts.map +1 -0
- package/dist/run/pool.js +35 -0
- package/dist/run/pool.js.map +1 -0
- package/dist/run/spend.d.ts +34 -0
- package/dist/run/spend.d.ts.map +1 -0
- package/dist/run/spend.js +55 -0
- package/dist/run/spend.js.map +1 -0
- package/dist/sources/read.d.ts +40 -0
- package/dist/sources/read.d.ts.map +1 -0
- package/dist/sources/read.js +294 -0
- package/dist/sources/read.js.map +1 -0
- package/dist/sources/types.d.ts +79 -0
- package/dist/sources/types.d.ts.map +1 -0
- package/dist/sources/types.js +2 -0
- package/dist/sources/types.js.map +1 -0
- package/dist/spec/expect.d.ts +39 -0
- package/dist/spec/expect.d.ts.map +1 -0
- package/dist/spec/expect.js +95 -0
- package/dist/spec/expect.js.map +1 -0
- package/dist/spec/spec.d.ts +90 -0
- package/dist/spec/spec.d.ts.map +1 -0
- package/dist/spec/spec.js +252 -0
- package/dist/spec/spec.js.map +1 -0
- package/dist/split/split.d.ts +33 -0
- package/dist/split/split.d.ts.map +1 -0
- package/dist/split/split.js +116 -0
- package/dist/split/split.js.map +1 -0
- package/dist/testdata/index.d.ts +5 -0
- package/dist/testdata/index.d.ts.map +1 -0
- package/dist/testdata/index.js +6 -0
- package/dist/testdata/index.js.map +1 -0
- package/dist/testkit/fake-model.d.ts +14 -0
- package/dist/testkit/fake-model.d.ts.map +1 -0
- package/dist/testkit/fake-model.js +57 -0
- package/dist/testkit/fake-model.js.map +1 -0
- package/dist/testkit/tmp.d.ts +6 -0
- package/dist/testkit/tmp.d.ts.map +1 -0
- package/dist/testkit/tmp.js +46 -0
- package/dist/testkit/tmp.js.map +1 -0
- package/dist/tools/ask.d.ts +32 -0
- package/dist/tools/ask.d.ts.map +1 -0
- package/dist/tools/ask.js +59 -0
- package/dist/tools/ask.js.map +1 -0
- package/dist/tools/context.d.ts +52 -0
- package/dist/tools/context.d.ts.map +1 -0
- package/dist/tools/context.js +130 -0
- package/dist/tools/context.js.map +1 -0
- package/dist/tools/doctor.d.ts +37 -0
- package/dist/tools/doctor.d.ts.map +1 -0
- package/dist/tools/doctor.js +203 -0
- package/dist/tools/doctor.js.map +1 -0
- package/dist/tools/many.d.ts +74 -0
- package/dist/tools/many.d.ts.map +1 -0
- package/dist/tools/many.js +141 -0
- package/dist/tools/many.js.map +1 -0
- package/dist/tools/schemas.d.ts +293 -0
- package/dist/tools/schemas.d.ts.map +1 -0
- package/dist/tools/schemas.js +112 -0
- package/dist/tools/schemas.js.map +1 -0
- package/dist/tools/spec-check.d.ts +48 -0
- package/dist/tools/spec-check.d.ts.map +1 -0
- package/dist/tools/spec-check.js +164 -0
- package/dist/tools/spec-check.js.map +1 -0
- package/dist/tools/usage.d.ts +11 -0
- package/dist/tools/usage.d.ts.map +1 -0
- package/dist/tools/usage.js +27 -0
- package/dist/tools/usage.js.map +1 -0
- package/dist/transport/openrouter.d.ts +38 -0
- package/dist/transport/openrouter.d.ts.map +1 -0
- package/dist/transport/openrouter.js +89 -0
- package/dist/transport/openrouter.js.map +1 -0
- package/dist/version.d.ts +4 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +5 -0
- package/dist/version.js.map +1 -0
- package/dist/wiring.d.ts +30 -0
- package/dist/wiring.d.ts.map +1 -0
- package/dist/wiring.js +31 -0
- package/dist/wiring.js.map +1 -0
- package/package.json +63 -0
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { assertConsent } from "../config/consent.js";
|
|
2
|
+
import { DecisionsError, isDecisionsError } from "../errors.js";
|
|
3
|
+
import { prepare } from "../prepare.js";
|
|
4
|
+
import { project } from "../project/project.js";
|
|
5
|
+
import { checkBudget } from "../run/budget.js";
|
|
6
|
+
import { mapWithConcurrency } from "../run/pool.js";
|
|
7
|
+
import { sumUsage } from "../run/spend.js";
|
|
8
|
+
import { checkInput, deciderFor, resolveRequest } from "./context.js";
|
|
9
|
+
const EXCERPT = 120;
|
|
10
|
+
const SAMPLE = 5;
|
|
11
|
+
/**
|
|
12
|
+
* Fan-out: one question set over N items, each its own call, under the
|
|
13
|
+
* concurrency cap. Only what survives `keep` comes back in full.
|
|
14
|
+
*/
|
|
15
|
+
export async function runMany(ctx, rawInput) {
|
|
16
|
+
const input = checkInput("many", rawInput);
|
|
17
|
+
const started = performance.now();
|
|
18
|
+
const req = resolveRequest(ctx, input);
|
|
19
|
+
const prepared = await prepare({
|
|
20
|
+
sources: req.sources,
|
|
21
|
+
split: req.split,
|
|
22
|
+
questions: req.questions,
|
|
23
|
+
profile: req.profile,
|
|
24
|
+
cwd: ctx.config.repoRoot,
|
|
25
|
+
exclude: ctx.config.egress.exclude,
|
|
26
|
+
...(input.allowOutside ? { allowOutside: true } : {}),
|
|
27
|
+
});
|
|
28
|
+
const base = {
|
|
29
|
+
...(req.spec ? { spec: req.spec.name } : {}),
|
|
30
|
+
model: req.profile.id,
|
|
31
|
+
skipped: summariseSkipped(prepared.skipped),
|
|
32
|
+
redactions: { total: prepared.redactions.total, items: prepared.redactions.items },
|
|
33
|
+
projection: prepared.projection,
|
|
34
|
+
};
|
|
35
|
+
if (input.dryRun) {
|
|
36
|
+
return {
|
|
37
|
+
...base,
|
|
38
|
+
dryRun: true,
|
|
39
|
+
counts: counts(prepared.items.length, 0, 0, 0, 0, 0, prepared.skipped.length),
|
|
40
|
+
kept: [],
|
|
41
|
+
undecided: [],
|
|
42
|
+
failed: [],
|
|
43
|
+
usage: sumUsage([]),
|
|
44
|
+
wallClockMs: Math.round(performance.now() - started),
|
|
45
|
+
sampleIds: prepared.items.slice(0, SAMPLE).map((i) => i.id),
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
const decider = deciderFor(ctx, req.profile, input.mode ?? "auto");
|
|
49
|
+
if (decider.mode !== "replay") {
|
|
50
|
+
// Fail once, up front, rather than N times inside the pool.
|
|
51
|
+
assertConsent(ctx.config.egress.consent, ctx.config.repoRoot);
|
|
52
|
+
checkBudget(prepared.projection, ctx.config.budget, input.confirm ?? false);
|
|
53
|
+
}
|
|
54
|
+
const concurrency = Math.min(input.concurrency ?? ctx.config.concurrency, ctx.config.concurrency);
|
|
55
|
+
const settled = await mapWithConcurrency(prepared.items, concurrency, (item) => decider.decide({ state: item.state, questions: req.questions, namespace: req.namespace }));
|
|
56
|
+
const done = [];
|
|
57
|
+
const failed = [];
|
|
58
|
+
settled.forEach((outcome, i) => {
|
|
59
|
+
const item = prepared.items[i];
|
|
60
|
+
if ("value" in outcome)
|
|
61
|
+
done.push({ item, result: outcome.value });
|
|
62
|
+
else
|
|
63
|
+
failed.push({ id: item.id, ...describe(outcome.error) });
|
|
64
|
+
});
|
|
65
|
+
// Every item failing the same way is a failure of the run, not of the items.
|
|
66
|
+
const [first] = failed;
|
|
67
|
+
if (done.length === 0 && first && failed.every((f) => f.code === first.code)) {
|
|
68
|
+
const { error } = settled.find((s) => "error" in s);
|
|
69
|
+
const details = isDecisionsError(error) ? error.details : {};
|
|
70
|
+
throw new DecisionsError(first.code === "error" ? "invalid-request" : first.code, failed.length === 1 ? error.message : `All ${failed.length} items failed: ${error.message}`, { ...details, failed: failed.length });
|
|
71
|
+
}
|
|
72
|
+
const rows = done.map(({ item, result }) => ({
|
|
73
|
+
...row(item, result.answers),
|
|
74
|
+
flat: result.undecided,
|
|
75
|
+
}));
|
|
76
|
+
const projected = project({
|
|
77
|
+
rows,
|
|
78
|
+
keep: req.keep,
|
|
79
|
+
...(req.sort ? { sort: req.sort } : {}),
|
|
80
|
+
...(input.limit !== undefined ? { limit: input.limit } : {}),
|
|
81
|
+
...(input.fields ? { fields: input.fields } : {}),
|
|
82
|
+
undecidedOf: (r) => r.flat,
|
|
83
|
+
});
|
|
84
|
+
const strip = ({ flat, ...rest }) => ({
|
|
85
|
+
...rest,
|
|
86
|
+
...(flat.length ? { undecided: [...flat] } : {}),
|
|
87
|
+
});
|
|
88
|
+
return {
|
|
89
|
+
...base,
|
|
90
|
+
dryRun: false,
|
|
91
|
+
source: decider.mode === "replay" ? "replay" : "live",
|
|
92
|
+
counts: counts(prepared.items.length, projected.kept.length, projected.keptTotal, projected.undecided.length, projected.dropped, failed.length, prepared.skipped.length),
|
|
93
|
+
kept: projected.kept.map(strip),
|
|
94
|
+
undecided: projected.undecided.map(({ row, questions }) => ({ ...strip(row), questions })),
|
|
95
|
+
failed,
|
|
96
|
+
usage: sumUsage(done.map((d) => d.result.usage)),
|
|
97
|
+
wallClockMs: Math.round(performance.now() - started),
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
function row(item, answers) {
|
|
101
|
+
return {
|
|
102
|
+
id: item.id,
|
|
103
|
+
...(item.path ? { path: item.path } : {}),
|
|
104
|
+
...(item.lines ? { lines: item.lines } : {}),
|
|
105
|
+
...(traceable(item) ? {} : { excerpt: excerpt(item.state) }),
|
|
106
|
+
answers,
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Whether the id alone leads back to the text. Piped items have no file, and a
|
|
111
|
+
* single line (a row of grep output, a log line) is only useful with its text.
|
|
112
|
+
*/
|
|
113
|
+
function traceable(item) {
|
|
114
|
+
if (item.path === undefined)
|
|
115
|
+
return false;
|
|
116
|
+
const oneLine = item.lines !== undefined && item.lines.start === item.lines.end;
|
|
117
|
+
return item.id === item.path || !oneLine;
|
|
118
|
+
}
|
|
119
|
+
function excerpt(state) {
|
|
120
|
+
const text = (typeof state === "string" ? state : JSON.stringify(state))
|
|
121
|
+
.replace(/\s+/g, " ")
|
|
122
|
+
.trim();
|
|
123
|
+
return text.length > EXCERPT ? `${text.slice(0, EXCERPT - 1)}…` : text;
|
|
124
|
+
}
|
|
125
|
+
function counts(items, kept, keptTotal, undecided, dropped, failed, skipped) {
|
|
126
|
+
return { items, kept, keptTotal, undecided, dropped, failed, skipped };
|
|
127
|
+
}
|
|
128
|
+
export function summariseSkipped(skipped) {
|
|
129
|
+
const byReason = {};
|
|
130
|
+
for (const s of skipped)
|
|
131
|
+
byReason[s.reason] = (byReason[s.reason] ?? 0) + 1;
|
|
132
|
+
// Show excluded (secret-shaped) paths first: they are the ones worth noticing.
|
|
133
|
+
const ordered = [...skipped].sort((a, b) => Number(b.reason === "excluded") - Number(a.reason === "excluded"));
|
|
134
|
+
return { total: skipped.length, byReason, sample: ordered.slice(0, SAMPLE) };
|
|
135
|
+
}
|
|
136
|
+
function describe(error) {
|
|
137
|
+
return isDecisionsError(error)
|
|
138
|
+
? { code: error.code, message: error.message }
|
|
139
|
+
: { code: "error", message: error.message };
|
|
140
|
+
}
|
|
141
|
+
//# sourceMappingURL=many.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"many.js","sourceRoot":"","sources":["../../src/tools/many.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAEpD,OAAO,EAAE,cAAc,EAAkB,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EAAE;QAC9C,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,CAAA;AAC/C,CAAC"}
|
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
import { type Static, Type } from "typebox";
|
|
2
|
+
export declare const AskInput: Type.TObject<{
|
|
3
|
+
/** A saved spec: name (repo → user → bundled) or path. */
|
|
4
|
+
spec: Type.TOptional<Type.TString>;
|
|
5
|
+
/** An inline question set; mutually exclusive with `spec`. */
|
|
6
|
+
questions: Type.TOptional<Type.TRecord<"^.*$", Type.TUnion<[Type.TObject<{
|
|
7
|
+
type: Type.TLiteral<"noul">;
|
|
8
|
+
instructions: Type.TString;
|
|
9
|
+
/** Optional `true`/`false` criteria that sharpen an ambiguous statement. */
|
|
10
|
+
criteria: Type.TOptional<Type.TRecord<"^.*$", Type.TString>>;
|
|
11
|
+
}>, Type.TObject<{
|
|
12
|
+
type: Type.TLiteral<"choice">;
|
|
13
|
+
instructions: Type.TString;
|
|
14
|
+
/** Option key to when it applies. At least two, including a way out. */
|
|
15
|
+
criteria: Type.TRecord<"^.*$", Type.TString>;
|
|
16
|
+
}>, Type.TObject<{
|
|
17
|
+
type: Type.TLiteral<"score">;
|
|
18
|
+
instructions: Type.TString;
|
|
19
|
+
/** Levels, lowest first and 0-indexed. */
|
|
20
|
+
criteria: Type.TArray<Type.TString>;
|
|
21
|
+
}>]>>>;
|
|
22
|
+
/** Where the content comes from. Defaults to the spec's `source`. */
|
|
23
|
+
sources: Type.TOptional<Type.TArray<Type.TUnion<[Type.TObject<{
|
|
24
|
+
kind: Type.TLiteral<"text">;
|
|
25
|
+
text: Type.TString;
|
|
26
|
+
id: Type.TOptional<Type.TString>;
|
|
27
|
+
}>, Type.TObject<{
|
|
28
|
+
kind: Type.TLiteral<"stdin">;
|
|
29
|
+
text: Type.TString;
|
|
30
|
+
}>, Type.TObject<{
|
|
31
|
+
kind: Type.TLiteral<"file">;
|
|
32
|
+
path: Type.TString;
|
|
33
|
+
range: Type.TOptional<Type.TObject<{
|
|
34
|
+
start: Type.TInteger;
|
|
35
|
+
end: Type.TInteger;
|
|
36
|
+
}>>;
|
|
37
|
+
}>, Type.TObject<{
|
|
38
|
+
kind: Type.TLiteral<"glob">;
|
|
39
|
+
patterns: Type.TArray<Type.TString>;
|
|
40
|
+
}>, Type.TObject<{
|
|
41
|
+
kind: Type.TLiteral<"jsonl">;
|
|
42
|
+
path: Type.TString;
|
|
43
|
+
}>, Type.TObject<{
|
|
44
|
+
kind: Type.TLiteral<"diff">;
|
|
45
|
+
range: Type.TOptional<Type.TString>;
|
|
46
|
+
staged: Type.TOptional<Type.TBoolean>;
|
|
47
|
+
paths: Type.TOptional<Type.TArray<Type.TString>>;
|
|
48
|
+
}>]>>>;
|
|
49
|
+
/** `file` | `hunk` | `row` | `lines:N[/overlap]`. */
|
|
50
|
+
split: Type.TOptional<Type.TString>;
|
|
51
|
+
/** Filters, ANDed: `relevant>=0.7`, `kind in fix,feature`. */
|
|
52
|
+
keep: Type.TOptional<Type.TArray<Type.TString>>;
|
|
53
|
+
mode: Type.TOptional<Type.TUnion<[Type.TLiteral<"auto">, Type.TLiteral<"live">, Type.TLiteral<"record">, Type.TLiteral<"replay">]>>;
|
|
54
|
+
model: Type.TOptional<Type.TString>;
|
|
55
|
+
/**
|
|
56
|
+
* Read content that resolves outside the repo. Off by default: consent is
|
|
57
|
+
* given per repo (0009), so such a path is withheld unless asked for.
|
|
58
|
+
*/
|
|
59
|
+
allowOutside: Type.TOptional<Type.TBoolean>;
|
|
60
|
+
}>;
|
|
61
|
+
export declare const ManyInput: Type.TObject<{
|
|
62
|
+
/** A saved spec: name (repo → user → bundled) or path. */
|
|
63
|
+
spec: Type.TOptional<Type.TString>;
|
|
64
|
+
/** An inline question set; mutually exclusive with `spec`. */
|
|
65
|
+
questions: Type.TOptional<Type.TRecord<"^.*$", Type.TUnion<[Type.TObject<{
|
|
66
|
+
type: Type.TLiteral<"noul">;
|
|
67
|
+
instructions: Type.TString;
|
|
68
|
+
/** Optional `true`/`false` criteria that sharpen an ambiguous statement. */
|
|
69
|
+
criteria: Type.TOptional<Type.TRecord<"^.*$", Type.TString>>;
|
|
70
|
+
}>, Type.TObject<{
|
|
71
|
+
type: Type.TLiteral<"choice">;
|
|
72
|
+
instructions: Type.TString;
|
|
73
|
+
/** Option key to when it applies. At least two, including a way out. */
|
|
74
|
+
criteria: Type.TRecord<"^.*$", Type.TString>;
|
|
75
|
+
}>, Type.TObject<{
|
|
76
|
+
type: Type.TLiteral<"score">;
|
|
77
|
+
instructions: Type.TString;
|
|
78
|
+
/** Levels, lowest first and 0-indexed. */
|
|
79
|
+
criteria: Type.TArray<Type.TString>;
|
|
80
|
+
}>]>>>;
|
|
81
|
+
/** Where the content comes from. Defaults to the spec's `source`. */
|
|
82
|
+
sources: Type.TOptional<Type.TArray<Type.TUnion<[Type.TObject<{
|
|
83
|
+
kind: Type.TLiteral<"text">;
|
|
84
|
+
text: Type.TString;
|
|
85
|
+
id: Type.TOptional<Type.TString>;
|
|
86
|
+
}>, Type.TObject<{
|
|
87
|
+
kind: Type.TLiteral<"stdin">;
|
|
88
|
+
text: Type.TString;
|
|
89
|
+
}>, Type.TObject<{
|
|
90
|
+
kind: Type.TLiteral<"file">;
|
|
91
|
+
path: Type.TString;
|
|
92
|
+
range: Type.TOptional<Type.TObject<{
|
|
93
|
+
start: Type.TInteger;
|
|
94
|
+
end: Type.TInteger;
|
|
95
|
+
}>>;
|
|
96
|
+
}>, Type.TObject<{
|
|
97
|
+
kind: Type.TLiteral<"glob">;
|
|
98
|
+
patterns: Type.TArray<Type.TString>;
|
|
99
|
+
}>, Type.TObject<{
|
|
100
|
+
kind: Type.TLiteral<"jsonl">;
|
|
101
|
+
path: Type.TString;
|
|
102
|
+
}>, Type.TObject<{
|
|
103
|
+
kind: Type.TLiteral<"diff">;
|
|
104
|
+
range: Type.TOptional<Type.TString>;
|
|
105
|
+
staged: Type.TOptional<Type.TBoolean>;
|
|
106
|
+
paths: Type.TOptional<Type.TArray<Type.TString>>;
|
|
107
|
+
}>]>>>;
|
|
108
|
+
/** `file` | `hunk` | `row` | `lines:N[/overlap]`. */
|
|
109
|
+
split: Type.TOptional<Type.TString>;
|
|
110
|
+
/** Filters, ANDed: `relevant>=0.7`, `kind in fix,feature`. */
|
|
111
|
+
keep: Type.TOptional<Type.TArray<Type.TString>>;
|
|
112
|
+
mode: Type.TOptional<Type.TUnion<[Type.TLiteral<"auto">, Type.TLiteral<"live">, Type.TLiteral<"record">, Type.TLiteral<"replay">]>>;
|
|
113
|
+
model: Type.TOptional<Type.TString>;
|
|
114
|
+
/**
|
|
115
|
+
* Read content that resolves outside the repo. Off by default: consent is
|
|
116
|
+
* given per repo (0009), so such a path is withheld unless asked for.
|
|
117
|
+
*/
|
|
118
|
+
allowOutside: Type.TOptional<Type.TBoolean>;
|
|
119
|
+
sort: Type.TOptional<Type.TString>;
|
|
120
|
+
limit: Type.TOptional<Type.TInteger>;
|
|
121
|
+
/** Which answers to include per result. */
|
|
122
|
+
fields: Type.TOptional<Type.TArray<Type.TString>>;
|
|
123
|
+
/** Project the cost and stop: no calls, no consent needed. */
|
|
124
|
+
dryRun: Type.TOptional<Type.TBoolean>;
|
|
125
|
+
/** Proceed past the spend guard. */
|
|
126
|
+
confirm: Type.TOptional<Type.TBoolean>;
|
|
127
|
+
concurrency: Type.TOptional<Type.TInteger>;
|
|
128
|
+
}>;
|
|
129
|
+
export declare const UsageInput: Type.TObject<{
|
|
130
|
+
/** A session id, or `current` for the one this process detected. */
|
|
131
|
+
session: Type.TOptional<Type.TString>;
|
|
132
|
+
/** ISO date or timestamp. */
|
|
133
|
+
since: Type.TOptional<Type.TString>;
|
|
134
|
+
}>;
|
|
135
|
+
export declare const SpecCheckInput: Type.TObject<{
|
|
136
|
+
/** Spec name (repo → user → bundled) or path. */
|
|
137
|
+
spec: Type.TString;
|
|
138
|
+
/** `replay` (default) checks against committed fixtures; `record` captures fresh answers. */
|
|
139
|
+
mode: Type.TOptional<Type.TUnion<[Type.TLiteral<"replay">, Type.TLiteral<"record">]>>;
|
|
140
|
+
model: Type.TOptional<Type.TString>;
|
|
141
|
+
/** Proceed past the spend guard. */
|
|
142
|
+
confirm: Type.TOptional<Type.TBoolean>;
|
|
143
|
+
}>;
|
|
144
|
+
export type AskInput = Static<typeof AskInput>;
|
|
145
|
+
export type ManyInput = Static<typeof ManyInput>;
|
|
146
|
+
export type UsageInput = Static<typeof UsageInput>;
|
|
147
|
+
export type SpecCheckInput = Static<typeof SpecCheckInput>;
|
|
148
|
+
export declare const TOOL_SCHEMAS: {
|
|
149
|
+
readonly ask: Type.TObject<{
|
|
150
|
+
/** A saved spec: name (repo → user → bundled) or path. */
|
|
151
|
+
spec: Type.TOptional<Type.TString>;
|
|
152
|
+
/** An inline question set; mutually exclusive with `spec`. */
|
|
153
|
+
questions: Type.TOptional<Type.TRecord<"^.*$", Type.TUnion<[Type.TObject<{
|
|
154
|
+
type: Type.TLiteral<"noul">;
|
|
155
|
+
instructions: Type.TString;
|
|
156
|
+
/** Optional `true`/`false` criteria that sharpen an ambiguous statement. */
|
|
157
|
+
criteria: Type.TOptional<Type.TRecord<"^.*$", Type.TString>>;
|
|
158
|
+
}>, Type.TObject<{
|
|
159
|
+
type: Type.TLiteral<"choice">;
|
|
160
|
+
instructions: Type.TString;
|
|
161
|
+
/** Option key to when it applies. At least two, including a way out. */
|
|
162
|
+
criteria: Type.TRecord<"^.*$", Type.TString>;
|
|
163
|
+
}>, Type.TObject<{
|
|
164
|
+
type: Type.TLiteral<"score">;
|
|
165
|
+
instructions: Type.TString;
|
|
166
|
+
/** Levels, lowest first and 0-indexed. */
|
|
167
|
+
criteria: Type.TArray<Type.TString>;
|
|
168
|
+
}>]>>>;
|
|
169
|
+
/** Where the content comes from. Defaults to the spec's `source`. */
|
|
170
|
+
sources: Type.TOptional<Type.TArray<Type.TUnion<[Type.TObject<{
|
|
171
|
+
kind: Type.TLiteral<"text">;
|
|
172
|
+
text: Type.TString;
|
|
173
|
+
id: Type.TOptional<Type.TString>;
|
|
174
|
+
}>, Type.TObject<{
|
|
175
|
+
kind: Type.TLiteral<"stdin">;
|
|
176
|
+
text: Type.TString;
|
|
177
|
+
}>, Type.TObject<{
|
|
178
|
+
kind: Type.TLiteral<"file">;
|
|
179
|
+
path: Type.TString;
|
|
180
|
+
range: Type.TOptional<Type.TObject<{
|
|
181
|
+
start: Type.TInteger;
|
|
182
|
+
end: Type.TInteger;
|
|
183
|
+
}>>;
|
|
184
|
+
}>, Type.TObject<{
|
|
185
|
+
kind: Type.TLiteral<"glob">;
|
|
186
|
+
patterns: Type.TArray<Type.TString>;
|
|
187
|
+
}>, Type.TObject<{
|
|
188
|
+
kind: Type.TLiteral<"jsonl">;
|
|
189
|
+
path: Type.TString;
|
|
190
|
+
}>, Type.TObject<{
|
|
191
|
+
kind: Type.TLiteral<"diff">;
|
|
192
|
+
range: Type.TOptional<Type.TString>;
|
|
193
|
+
staged: Type.TOptional<Type.TBoolean>;
|
|
194
|
+
paths: Type.TOptional<Type.TArray<Type.TString>>;
|
|
195
|
+
}>]>>>;
|
|
196
|
+
/** `file` | `hunk` | `row` | `lines:N[/overlap]`. */
|
|
197
|
+
split: Type.TOptional<Type.TString>;
|
|
198
|
+
/** Filters, ANDed: `relevant>=0.7`, `kind in fix,feature`. */
|
|
199
|
+
keep: Type.TOptional<Type.TArray<Type.TString>>;
|
|
200
|
+
mode: Type.TOptional<Type.TUnion<[Type.TLiteral<"auto">, Type.TLiteral<"live">, Type.TLiteral<"record">, Type.TLiteral<"replay">]>>;
|
|
201
|
+
model: Type.TOptional<Type.TString>;
|
|
202
|
+
/**
|
|
203
|
+
* Read content that resolves outside the repo. Off by default: consent is
|
|
204
|
+
* given per repo (0009), so such a path is withheld unless asked for.
|
|
205
|
+
*/
|
|
206
|
+
allowOutside: Type.TOptional<Type.TBoolean>;
|
|
207
|
+
}>;
|
|
208
|
+
readonly many: Type.TObject<{
|
|
209
|
+
/** A saved spec: name (repo → user → bundled) or path. */
|
|
210
|
+
spec: Type.TOptional<Type.TString>;
|
|
211
|
+
/** An inline question set; mutually exclusive with `spec`. */
|
|
212
|
+
questions: Type.TOptional<Type.TRecord<"^.*$", Type.TUnion<[Type.TObject<{
|
|
213
|
+
type: Type.TLiteral<"noul">;
|
|
214
|
+
instructions: Type.TString;
|
|
215
|
+
/** Optional `true`/`false` criteria that sharpen an ambiguous statement. */
|
|
216
|
+
criteria: Type.TOptional<Type.TRecord<"^.*$", Type.TString>>;
|
|
217
|
+
}>, Type.TObject<{
|
|
218
|
+
type: Type.TLiteral<"choice">;
|
|
219
|
+
instructions: Type.TString;
|
|
220
|
+
/** Option key to when it applies. At least two, including a way out. */
|
|
221
|
+
criteria: Type.TRecord<"^.*$", Type.TString>;
|
|
222
|
+
}>, Type.TObject<{
|
|
223
|
+
type: Type.TLiteral<"score">;
|
|
224
|
+
instructions: Type.TString;
|
|
225
|
+
/** Levels, lowest first and 0-indexed. */
|
|
226
|
+
criteria: Type.TArray<Type.TString>;
|
|
227
|
+
}>]>>>;
|
|
228
|
+
/** Where the content comes from. Defaults to the spec's `source`. */
|
|
229
|
+
sources: Type.TOptional<Type.TArray<Type.TUnion<[Type.TObject<{
|
|
230
|
+
kind: Type.TLiteral<"text">;
|
|
231
|
+
text: Type.TString;
|
|
232
|
+
id: Type.TOptional<Type.TString>;
|
|
233
|
+
}>, Type.TObject<{
|
|
234
|
+
kind: Type.TLiteral<"stdin">;
|
|
235
|
+
text: Type.TString;
|
|
236
|
+
}>, Type.TObject<{
|
|
237
|
+
kind: Type.TLiteral<"file">;
|
|
238
|
+
path: Type.TString;
|
|
239
|
+
range: Type.TOptional<Type.TObject<{
|
|
240
|
+
start: Type.TInteger;
|
|
241
|
+
end: Type.TInteger;
|
|
242
|
+
}>>;
|
|
243
|
+
}>, Type.TObject<{
|
|
244
|
+
kind: Type.TLiteral<"glob">;
|
|
245
|
+
patterns: Type.TArray<Type.TString>;
|
|
246
|
+
}>, Type.TObject<{
|
|
247
|
+
kind: Type.TLiteral<"jsonl">;
|
|
248
|
+
path: Type.TString;
|
|
249
|
+
}>, Type.TObject<{
|
|
250
|
+
kind: Type.TLiteral<"diff">;
|
|
251
|
+
range: Type.TOptional<Type.TString>;
|
|
252
|
+
staged: Type.TOptional<Type.TBoolean>;
|
|
253
|
+
paths: Type.TOptional<Type.TArray<Type.TString>>;
|
|
254
|
+
}>]>>>;
|
|
255
|
+
/** `file` | `hunk` | `row` | `lines:N[/overlap]`. */
|
|
256
|
+
split: Type.TOptional<Type.TString>;
|
|
257
|
+
/** Filters, ANDed: `relevant>=0.7`, `kind in fix,feature`. */
|
|
258
|
+
keep: Type.TOptional<Type.TArray<Type.TString>>;
|
|
259
|
+
mode: Type.TOptional<Type.TUnion<[Type.TLiteral<"auto">, Type.TLiteral<"live">, Type.TLiteral<"record">, Type.TLiteral<"replay">]>>;
|
|
260
|
+
model: Type.TOptional<Type.TString>;
|
|
261
|
+
/**
|
|
262
|
+
* Read content that resolves outside the repo. Off by default: consent is
|
|
263
|
+
* given per repo (0009), so such a path is withheld unless asked for.
|
|
264
|
+
*/
|
|
265
|
+
allowOutside: Type.TOptional<Type.TBoolean>;
|
|
266
|
+
sort: Type.TOptional<Type.TString>;
|
|
267
|
+
limit: Type.TOptional<Type.TInteger>;
|
|
268
|
+
/** Which answers to include per result. */
|
|
269
|
+
fields: Type.TOptional<Type.TArray<Type.TString>>;
|
|
270
|
+
/** Project the cost and stop: no calls, no consent needed. */
|
|
271
|
+
dryRun: Type.TOptional<Type.TBoolean>;
|
|
272
|
+
/** Proceed past the spend guard. */
|
|
273
|
+
confirm: Type.TOptional<Type.TBoolean>;
|
|
274
|
+
concurrency: Type.TOptional<Type.TInteger>;
|
|
275
|
+
}>;
|
|
276
|
+
readonly usage: Type.TObject<{
|
|
277
|
+
/** A session id, or `current` for the one this process detected. */
|
|
278
|
+
session: Type.TOptional<Type.TString>;
|
|
279
|
+
/** ISO date or timestamp. */
|
|
280
|
+
since: Type.TOptional<Type.TString>;
|
|
281
|
+
}>;
|
|
282
|
+
readonly "spec-check": Type.TObject<{
|
|
283
|
+
/** Spec name (repo → user → bundled) or path. */
|
|
284
|
+
spec: Type.TString;
|
|
285
|
+
/** `replay` (default) checks against committed fixtures; `record` captures fresh answers. */
|
|
286
|
+
mode: Type.TOptional<Type.TUnion<[Type.TLiteral<"replay">, Type.TLiteral<"record">]>>;
|
|
287
|
+
model: Type.TOptional<Type.TString>;
|
|
288
|
+
/** Proceed past the spend guard. */
|
|
289
|
+
confirm: Type.TOptional<Type.TBoolean>;
|
|
290
|
+
}>;
|
|
291
|
+
};
|
|
292
|
+
export type ToolName = keyof typeof TOOL_SCHEMAS;
|
|
293
|
+
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/tools/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AA8F3C,eAAO,MAAM,QAAQ;IAtBnB,0DAA0D;;IAE1D,8DAA8D;;;;QAnC1D,4EAA4E;;;;;QAS5E,wEAAwE;;;;;QASxE,0CAA0C;;;IAmB9C,qEAAqE;;;;;;;;;;;;;;;;;;;;;;;;;;;IAErE,qDAAqD;;IAErD,8DAA8D;;;;IAI9D;;;OAGG;;EAO8C,CAAA;AAEnD,eAAO,MAAM,SAAS;IAxBpB,0DAA0D;;IAE1D,8DAA8D;;;;QAnC1D,4EAA4E;;;;;QAS5E,wEAAwE;;;;;QASxE,0CAA0C;;;IAmB9C,qEAAqE;;;;;;;;;;;;;;;;;;;;;;;;;;;IAErE,qDAAqD;;IAErD,8DAA8D;;;;IAI9D;;;OAGG;;;;IAcD,2CAA2C;;IAE3C,8DAA8D;;IAE9D,oCAAoC;;;EAKvC,CAAA;AAED,eAAO,MAAM,UAAU;IAEnB,oEAAoE;;IAEpE,6BAA6B;;EAIhC,CAAA;AAED,eAAO,MAAM,cAAc;IAEvB,iDAAiD;;IAEjD,6FAA6F;;;IAG7F,oCAAoC;;EAIvC,CAAA;AAED,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,QAAQ,CAAC,CAAA;AAC9C,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,SAAS,CAAC,CAAA;AAChD,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,UAAU,CAAC,CAAA;AAClD,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,OAAO,cAAc,CAAC,CAAA;AAE1D,eAAO,MAAM,YAAY;aACvB,GAAG;QArEH,0DAA0D;;QAE1D,8DAA8D;;;;YAnC1D,4EAA4E;;;;;YAS5E,wEAAwE;;;;;YASxE,0CAA0C;;;QAmB9C,qEAAqE;;;;;;;;;;;;;;;;;;;;;;;;;;;QAErE,qDAAqD;;QAErD,8DAA8D;;;;QAI9D;;;WAGG;;;aAuDH,IAAI;QAtEJ,0DAA0D;;QAE1D,8DAA8D;;;;YAnC1D,4EAA4E;;;;;YAS5E,wEAAwE;;;;;YASxE,0CAA0C;;;QAmB9C,qEAAqE;;;;;;;;;;;;;;;;;;;;;;;;;;;QAErE,qDAAqD;;QAErD,8DAA8D;;;;QAI9D;;;WAGG;;;;QAcD,2CAA2C;;QAE3C,8DAA8D;;QAE9D,oCAAoC;;;;aAsCtC,KAAK;QA7BH,oEAAoE;;QAEpE,6BAA6B;;;aA4B/B,YAAY;QApBV,iDAAiD;;QAEjD,6FAA6F;;;QAG7F,oCAAoC;;;CAgB9B,CAAA;AACV,MAAM,MAAM,QAAQ,GAAG,MAAM,OAAO,YAAY,CAAA"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { Type } from "typebox";
|
|
2
|
+
/**
|
|
3
|
+
* Tool inputs, defined once. The CLI builds these from argv. A future MCP or Pi
|
|
4
|
+
* adapter would take them directly, and `decide schema <tool>` prints them.
|
|
5
|
+
*/
|
|
6
|
+
const Source = Type.Union([
|
|
7
|
+
Type.Object({
|
|
8
|
+
kind: Type.Literal("text"),
|
|
9
|
+
text: Type.String(),
|
|
10
|
+
id: Type.Optional(Type.String()),
|
|
11
|
+
}),
|
|
12
|
+
Type.Object({ kind: Type.Literal("stdin"), text: Type.String() }),
|
|
13
|
+
Type.Object({
|
|
14
|
+
kind: Type.Literal("file"),
|
|
15
|
+
path: Type.String(),
|
|
16
|
+
range: Type.Optional(Type.Object({ start: Type.Integer({ minimum: 1 }), end: Type.Integer({ minimum: 1 }) })),
|
|
17
|
+
}),
|
|
18
|
+
Type.Object({ kind: Type.Literal("glob"), patterns: Type.Array(Type.String(), { minItems: 1 }) }),
|
|
19
|
+
Type.Object({ kind: Type.Literal("jsonl"), path: Type.String() }),
|
|
20
|
+
Type.Object({
|
|
21
|
+
kind: Type.Literal("diff"),
|
|
22
|
+
range: Type.Optional(Type.String()),
|
|
23
|
+
staged: Type.Optional(Type.Boolean()),
|
|
24
|
+
paths: Type.Optional(Type.Array(Type.String())),
|
|
25
|
+
}),
|
|
26
|
+
]);
|
|
27
|
+
/**
|
|
28
|
+
* A question, as it goes on the wire. Spelled out here (rather than an opaque
|
|
29
|
+
* record) so `decide schema <tool>` describes what a valid question is.
|
|
30
|
+
*/
|
|
31
|
+
const Question = Type.Union([
|
|
32
|
+
Type.Object({
|
|
33
|
+
type: Type.Literal("noul"),
|
|
34
|
+
instructions: Type.String({ minLength: 1 }),
|
|
35
|
+
/** Optional `true`/`false` criteria that sharpen an ambiguous statement. */
|
|
36
|
+
criteria: Type.Optional(Type.Record(Type.String(), Type.String())),
|
|
37
|
+
}, { additionalProperties: false }),
|
|
38
|
+
Type.Object({
|
|
39
|
+
type: Type.Literal("choice"),
|
|
40
|
+
instructions: Type.String({ minLength: 1 }),
|
|
41
|
+
/** Option key to when it applies. At least two, including a way out. */
|
|
42
|
+
criteria: Type.Record(Type.String(), Type.String(), { minProperties: 2 }),
|
|
43
|
+
}, { additionalProperties: false }),
|
|
44
|
+
Type.Object({
|
|
45
|
+
type: Type.Literal("score"),
|
|
46
|
+
instructions: Type.String({ minLength: 1 }),
|
|
47
|
+
/** Levels, lowest first and 0-indexed. */
|
|
48
|
+
criteria: Type.Array(Type.String(), { minItems: 2 }),
|
|
49
|
+
}, { additionalProperties: false }),
|
|
50
|
+
]);
|
|
51
|
+
const Mode = Type.Union([
|
|
52
|
+
Type.Literal("auto"),
|
|
53
|
+
Type.Literal("live"),
|
|
54
|
+
Type.Literal("record"),
|
|
55
|
+
Type.Literal("replay"),
|
|
56
|
+
]);
|
|
57
|
+
const Common = {
|
|
58
|
+
/** A saved spec: name (repo → user → bundled) or path. */
|
|
59
|
+
spec: Type.Optional(Type.String()),
|
|
60
|
+
/** An inline question set; mutually exclusive with `spec`. */
|
|
61
|
+
questions: Type.Optional(Type.Record(Type.String(), Question)),
|
|
62
|
+
/** Where the content comes from. Defaults to the spec's `source`. */
|
|
63
|
+
sources: Type.Optional(Type.Array(Source)),
|
|
64
|
+
/** `file` | `hunk` | `row` | `lines:N[/overlap]`. */
|
|
65
|
+
split: Type.Optional(Type.String()),
|
|
66
|
+
/** Filters, ANDed: `relevant>=0.7`, `kind in fix,feature`. */
|
|
67
|
+
keep: Type.Optional(Type.Array(Type.String())),
|
|
68
|
+
mode: Type.Optional(Mode),
|
|
69
|
+
model: Type.Optional(Type.String()),
|
|
70
|
+
/**
|
|
71
|
+
* Read content that resolves outside the repo. Off by default: consent is
|
|
72
|
+
* given per repo (0009), so such a path is withheld unless asked for.
|
|
73
|
+
*/
|
|
74
|
+
allowOutside: Type.Optional(Type.Boolean()),
|
|
75
|
+
};
|
|
76
|
+
/** Unknown properties are refused, so an input can't carry something we ignore. */
|
|
77
|
+
const strict = { additionalProperties: false };
|
|
78
|
+
export const AskInput = Type.Object(Common, strict);
|
|
79
|
+
export const ManyInput = Type.Object({
|
|
80
|
+
...Common,
|
|
81
|
+
sort: Type.Optional(Type.String()),
|
|
82
|
+
limit: Type.Optional(Type.Integer({ minimum: 0 })),
|
|
83
|
+
/** Which answers to include per result. */
|
|
84
|
+
fields: Type.Optional(Type.Array(Type.String())),
|
|
85
|
+
/** Project the cost and stop: no calls, no consent needed. */
|
|
86
|
+
dryRun: Type.Optional(Type.Boolean()),
|
|
87
|
+
/** Proceed past the spend guard. */
|
|
88
|
+
confirm: Type.Optional(Type.Boolean()),
|
|
89
|
+
concurrency: Type.Optional(Type.Integer({ minimum: 1 })),
|
|
90
|
+
}, strict);
|
|
91
|
+
export const UsageInput = Type.Object({
|
|
92
|
+
/** A session id, or `current` for the one this process detected. */
|
|
93
|
+
session: Type.Optional(Type.String()),
|
|
94
|
+
/** ISO date or timestamp. */
|
|
95
|
+
since: Type.Optional(Type.String()),
|
|
96
|
+
}, strict);
|
|
97
|
+
export const SpecCheckInput = Type.Object({
|
|
98
|
+
/** Spec name (repo → user → bundled) or path. */
|
|
99
|
+
spec: Type.String({ minLength: 1 }),
|
|
100
|
+
/** `replay` (default) checks against committed fixtures; `record` captures fresh answers. */
|
|
101
|
+
mode: Type.Optional(Type.Union([Type.Literal("replay"), Type.Literal("record")])),
|
|
102
|
+
model: Type.Optional(Type.String()),
|
|
103
|
+
/** Proceed past the spend guard. */
|
|
104
|
+
confirm: Type.Optional(Type.Boolean()),
|
|
105
|
+
}, strict);
|
|
106
|
+
export const TOOL_SCHEMAS = {
|
|
107
|
+
ask: AskInput,
|
|
108
|
+
many: ManyInput,
|
|
109
|
+
usage: UsageInput,
|
|
110
|
+
"spec-check": SpecCheckInput,
|
|
111
|
+
};
|
|
112
|
+
//# sourceMappingURL=schemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../../src/tools/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,IAAI,EAAE,MAAM,SAAS,CAAA;AAE3C;;;GAGG;AACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC;IACxB,IAAI,CAAC,MAAM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K,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IACjF,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;IACnC,oCAAoC;IACpC,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;CACvC,EACD,MAAM,CACP,CAAA;AAOD,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,GAAG,EAAE,QAAQ;IACb,IAAI,EAAE,SAAS;IACf,KAAK,EAAE,UAAU;IACjB,YAAY,EAAE,cAAc;CACpB,CAAA"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { Answers, Usage } from "../model/types.js";
|
|
2
|
+
import { type AnswerSource } from "../run/spend.js";
|
|
3
|
+
import { type ToolContext } from "./context.js";
|
|
4
|
+
import { type SkippedSummary } from "./many.js";
|
|
5
|
+
export type ExampleStatus = "pass" | "fail" | "undecided" | "captured" | "withheld";
|
|
6
|
+
export interface ExampleResult {
|
|
7
|
+
id: string;
|
|
8
|
+
/**
|
|
9
|
+
* - `pass`: every expectation met.
|
|
10
|
+
* - `fail`: at least one decided answer missed its expectation.
|
|
11
|
+
* - `undecided`: nothing failed, but an expected question came back too flat to judge.
|
|
12
|
+
* - `captured`: the example has no `expect`; its answers are shown for reading.
|
|
13
|
+
* - `withheld`: egress checks kept it from being sent (e.g. an excluded file).
|
|
14
|
+
*/
|
|
15
|
+
status: ExampleStatus;
|
|
16
|
+
/** Full answers, distributions included: reading them is the point. */
|
|
17
|
+
answers?: Answers;
|
|
18
|
+
failures?: Array<{
|
|
19
|
+
question: string;
|
|
20
|
+
expected: string;
|
|
21
|
+
}>;
|
|
22
|
+
undecided?: string[];
|
|
23
|
+
reason?: string;
|
|
24
|
+
}
|
|
25
|
+
export interface SpecCheckResult {
|
|
26
|
+
spec: string;
|
|
27
|
+
file: string;
|
|
28
|
+
model: string;
|
|
29
|
+
source: AnswerSource;
|
|
30
|
+
/** True when every example passed, or was captured with nothing to check. */
|
|
31
|
+
passed: boolean;
|
|
32
|
+
counts: Record<ExampleStatus, number> & {
|
|
33
|
+
examples: number;
|
|
34
|
+
};
|
|
35
|
+
examples: ExampleResult[];
|
|
36
|
+
usage: Usage;
|
|
37
|
+
skipped: SkippedSummary;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Run a spec's examples and compare each against its `expect`. Replay by
|
|
41
|
+
* default: this is an offline regression test for a spec and the fixtures
|
|
42
|
+
* committed beside it. `mode: "record"` captures fresh answers.
|
|
43
|
+
*
|
|
44
|
+
* A mismatch is a result (`passed: false`), not an error. Errors are reserved
|
|
45
|
+
* for a spec that cannot be checked: no examples, or answers never recorded.
|
|
46
|
+
*/
|
|
47
|
+
export declare function runSpecCheck(ctx: ToolContext, rawInput: unknown): Promise<SpecCheckResult>;
|
|
48
|
+
//# sourceMappingURL=spec-check.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spec-check.d.ts","sourceRoot":"","sources":["../../src/tools/spec-check.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAGvD,OAAO,EAAE,KAAK,YAAY,EAAY,MAAM,iBAAiB,CAAA;AAM7D,OAAO,EAA0B,KAAK,WAAW,EAAE,MAAM,cAAc,CAAA;AACvE,OAAO,EAAE,KAAK,cAAc,EAAoB,MAAM,WAAW,CAAA;AAGjE,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,MAAM,GAAG,WAAW,GAAG,UAAU,GAAG,UAAU,CAAA;AAEnF,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAA;IACV;;;;;;OAMG;IACH,MAAM,EAAE,aAAa,CAAA;IACrB,uEAAuE;IACvE,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,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