@tobi-or-not/quorum 0.4.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/dist/bench/fingerprint.d.ts +8 -5
- package/dist/bench/fingerprint.js +28 -9
- package/dist/bench/records.d.ts +168 -0
- package/dist/bench/records.js +106 -1
- package/dist/bench/runner.d.ts +18 -0
- package/dist/bench/runner.js +30 -4
- package/dist/cli/bench.d.ts +11 -4
- package/dist/cli/bench.js +34 -17
- package/dist/cli/bin.js +2 -2
- package/dist/cli/io.d.ts +5 -0
- package/dist/cli/main.d.ts +67 -24
- package/dist/cli/main.js +288 -59
- package/dist/cli/print-config.d.ts +8 -6
- package/dist/cli/print-config.js +26 -8
- package/dist/cli/render.d.ts +9 -3
- package/dist/cli/render.js +43 -2
- package/dist/config/claude-code.d.ts +2 -6
- package/dist/config/claude-code.js +6 -44
- package/dist/config/command.d.ts +10 -0
- package/dist/config/command.js +47 -0
- package/dist/config/env.d.ts +32 -19
- package/dist/config/env.js +95 -32
- package/dist/config/from-config.js +21 -3
- package/dist/config/resolve.d.ts +13 -1
- package/dist/config/resolve.js +27 -1
- package/dist/config/schema.d.ts +152 -5
- package/dist/config/schema.js +156 -12
- package/dist/core/clock.d.ts +17 -0
- package/dist/core/clock.js +14 -0
- package/dist/core/coverage.d.ts +74 -0
- package/dist/core/coverage.js +221 -0
- package/dist/core/diff.d.ts +101 -0
- package/dist/core/diff.js +178 -35
- package/dist/core/errors.d.ts +12 -3
- package/dist/core/errors.js +21 -2
- package/dist/core/estimate.d.ts +45 -0
- package/dist/core/estimate.js +188 -0
- package/dist/core/exclude.d.ts +42 -0
- package/dist/core/exclude.js +189 -0
- package/dist/core/flags.d.ts +14 -1
- package/dist/core/flags.js +56 -0
- package/dist/core/inputs.d.ts +38 -0
- package/dist/core/inputs.js +228 -0
- package/dist/core/limits.d.ts +83 -0
- package/dist/core/limits.js +169 -0
- package/dist/core/output.d.ts +3 -2
- package/dist/core/output.js +3 -2
- package/dist/core/parts.d.ts +146 -0
- package/dist/core/parts.js +388 -0
- package/dist/core/ports.d.ts +67 -2
- package/dist/core/ports.js +36 -1
- package/dist/core/prompts.d.ts +22 -3
- package/dist/core/prompts.js +43 -7
- package/dist/core/quorum.d.ts +26 -8
- package/dist/core/quorum.js +310 -73
- package/dist/core/retry.d.ts +36 -0
- package/dist/core/retry.js +46 -0
- package/dist/core/secrets.d.ts +98 -0
- package/dist/core/secrets.js +507 -0
- package/dist/core/stages/context.d.ts +131 -23
- package/dist/core/stages/context.js +331 -46
- package/dist/core/stages/panel.d.ts +13 -6
- package/dist/core/stages/panel.js +79 -19
- package/dist/core/stages/research.d.ts +110 -25
- package/dist/core/stages/research.js +338 -44
- package/dist/core/tokens.d.ts +31 -0
- package/dist/core/tokens.js +81 -0
- package/dist/core/types.d.ts +280 -25
- package/dist/core/verify.d.ts +6 -0
- package/dist/core/verify.js +6 -3
- package/dist/git/run.d.ts +223 -0
- package/dist/git/run.js +608 -0
- package/dist/git/tree.d.ts +43 -0
- package/dist/git/tree.js +171 -0
- package/dist/index.d.ts +26 -2
- package/dist/index.js +34 -2
- package/dist/providers/anthropic.d.ts +3 -1
- package/dist/providers/anthropic.js +10 -3
- package/dist/providers/claude-code.d.ts +56 -11
- package/dist/providers/claude-code.js +70 -25
- package/dist/providers/gemini.d.ts +5 -1
- package/dist/providers/gemini.js +65 -11
- package/dist/providers/http.d.ts +49 -4
- package/dist/providers/http.js +155 -14
- package/dist/providers/ollama.d.ts +4 -1
- package/dist/providers/ollama.js +13 -5
- package/dist/providers/openai-compatible.d.ts +4 -1
- package/dist/providers/openai-compatible.js +13 -5
- package/dist/providers/options.d.ts +12 -3
- package/dist/providers/options.js +30 -10
- package/dist/providers/size.d.ts +19 -15
- package/dist/providers/size.js +33 -73
- package/dist/sources/added.d.ts +49 -0
- package/dist/sources/added.js +134 -0
- package/dist/sources/diff.d.ts +13 -0
- package/dist/sources/diff.js +63 -0
- package/dist/sources/local.d.ts +41 -0
- package/dist/sources/local.js +251 -0
- package/dist/sources/paths.d.ts +45 -0
- package/dist/sources/paths.js +230 -0
- package/dist/sources/range.d.ts +21 -0
- package/dist/sources/range.js +75 -0
- package/dist/sources/read.d.ts +69 -0
- package/dist/sources/read.js +37 -0
- package/dist/sources/repository.d.ts +9 -0
- package/dist/sources/repository.js +28 -0
- package/dist/sources/skips.d.ts +49 -0
- package/dist/sources/skips.js +126 -0
- package/package.json +1 -1
- package/schema/quorum.schema.json +49 -1
package/dist/config/resolve.js
CHANGED
|
@@ -370,7 +370,9 @@ function bindRoles(roles, names) {
|
|
|
370
370
|
* preset's own variable is read only at the preset's origin. Every provider needs a context size, and the issue
|
|
371
371
|
* of a missing one names what to set (`reportMissingContext`). A `claude-code` provider in use gets its
|
|
372
372
|
* command as it gets its key: `QUORUM_CLAUDE_CODE_COMMAND`, else the config's, else `claude` in an absolute
|
|
373
|
-
* entry of `PATH`, found or refused here, and its billing warning.
|
|
373
|
+
* entry of `PATH`, found or refused here, and its billing warning. The review's limits, `maxReviewTokens` and
|
|
374
|
+
* `reviewTimeoutMs`, come from `QUORUM_MAX_REVIEW_TOKENS` and `QUORUM_REVIEW_TIMEOUT_MS`, else from the config,
|
|
375
|
+
* and are kept only when one of them sets them. A resolved config is returned as it is. The
|
|
374
376
|
* input must already have passed a config schema. `options.selection`, when given, names the profiles that
|
|
375
377
|
* run, over `QUORUM_PROFILES`, which is still checked; its ids are checked before anything is resolved.
|
|
376
378
|
*
|
|
@@ -443,6 +445,11 @@ export function resolveConfig(input, options) {
|
|
|
443
445
|
throw new ConfigError(issues);
|
|
444
446
|
const concurrency = own(input, 'concurrency');
|
|
445
447
|
const maxFindings = own(input, 'maxFindings');
|
|
448
|
+
const partTokens = own(input, 'partTokens');
|
|
449
|
+
const maxReviewTokens = own(layer, 'maxReviewTokens') ?? own(input, 'maxReviewTokens');
|
|
450
|
+
const reviewTimeoutMs = own(layer, 'reviewTimeoutMs') ?? own(input, 'reviewTimeoutMs');
|
|
451
|
+
const exclude = own(input, 'exclude');
|
|
452
|
+
const send = own(input, 'send');
|
|
446
453
|
const resolved = Object.freeze({
|
|
447
454
|
providers: deepFreeze(Object.fromEntries(checked.providers)),
|
|
448
455
|
profiles: Object.freeze([...profiles.profiles]),
|
|
@@ -452,6 +459,25 @@ export function resolveConfig(input, options) {
|
|
|
452
459
|
...maxFindings === undefined
|
|
453
460
|
? {}
|
|
454
461
|
: { maxFindings },
|
|
462
|
+
...partTokens === undefined
|
|
463
|
+
? {}
|
|
464
|
+
: { partTokens },
|
|
465
|
+
...maxReviewTokens === undefined
|
|
466
|
+
? {}
|
|
467
|
+
: { maxReviewTokens },
|
|
468
|
+
...reviewTimeoutMs === undefined
|
|
469
|
+
? {}
|
|
470
|
+
: { reviewTimeoutMs },
|
|
471
|
+
...exclude === undefined || exclude.length === 0
|
|
472
|
+
? {}
|
|
473
|
+
: {
|
|
474
|
+
exclude: Object.freeze([...exclude]),
|
|
475
|
+
},
|
|
476
|
+
...send === undefined || send.length === 0
|
|
477
|
+
? {}
|
|
478
|
+
: {
|
|
479
|
+
send: Object.freeze([...send]),
|
|
480
|
+
},
|
|
455
481
|
warnings: Object.freeze([
|
|
456
482
|
...layer.warnings,
|
|
457
483
|
...checked.warnings,
|
package/dist/config/schema.d.ts
CHANGED
|
@@ -3,9 +3,38 @@ import type { ConfigIssue } from '../core/errors.ts';
|
|
|
3
3
|
import type { JsonSchema, Provider } from '../core/ports.ts';
|
|
4
4
|
/** Whether `value` implements `Provider` as a code config can hand one over: an object whose `complete` is a function. */
|
|
5
5
|
export declare function isProvider(value: unknown): value is Provider;
|
|
6
|
+
/** The facts a provider object states of its calls, as the port names them. */
|
|
7
|
+
interface StatedFacts {
|
|
8
|
+
readonly timeoutMs?: number;
|
|
9
|
+
readonly retries?: number;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* The facts `provider` states, each read as own data, so a getter never runs and an inherited property
|
|
13
|
+
* or a proxy that throws states nothing: `stated` holds those that pass their check, and `problems` the
|
|
14
|
+
* field and wording of each that does not. A value is never quoted.
|
|
15
|
+
*/
|
|
16
|
+
export declare function statedFacts(provider: unknown): {
|
|
17
|
+
readonly stated: StatedFacts;
|
|
18
|
+
readonly problems: ReadonlyArray<{
|
|
19
|
+
readonly field: keyof StatedFacts;
|
|
20
|
+
readonly message: string;
|
|
21
|
+
}>;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* The `worstCase` a provider states, as own data: a function, else undefined. It is no fact of `FACTS`: a
|
|
25
|
+
* function is no number to check or to hash, so the fingerprint and the printed config never see it, and a
|
|
26
|
+
* value that is no function is an issue of `providerObject` and is never read here.
|
|
27
|
+
*/
|
|
28
|
+
export declare function statedWorstCase(provider: unknown): Provider['worstCase'];
|
|
29
|
+
/**
|
|
30
|
+
* The `room` a provider states, as own data: a function, else undefined, as `statedWorstCase` reads the worst
|
|
31
|
+
* case. It is no fact of `FACTS` either, so the fingerprint and the printed config never see it.
|
|
32
|
+
*/
|
|
33
|
+
export declare function statedRoom(provider: unknown): Provider['room'];
|
|
6
34
|
/**
|
|
7
35
|
* `entry` named `id`, the config's key for it, when it is a snapshot the schema made of a provider object: a
|
|
8
|
-
* copy that holds `id` as well, built from the snapshot's own data
|
|
36
|
+
* copy that holds `id` as well, built from the snapshot's own data, the facts and the `worstCase` and the
|
|
37
|
+
* `room` it states included. Anything else is returned as it is.
|
|
9
38
|
*/
|
|
10
39
|
export declare function nameSnapshot(id: string, entry: unknown): unknown;
|
|
11
40
|
/**
|
|
@@ -75,6 +104,8 @@ export declare const configFileSchema: z.ZodObject<{
|
|
|
75
104
|
native: "native";
|
|
76
105
|
inline: "inline";
|
|
77
106
|
}>>;
|
|
107
|
+
timeoutMs: z.ZodOptional<z.ZodInt>;
|
|
108
|
+
retries: z.ZodOptional<z.ZodInt>;
|
|
78
109
|
args: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
79
110
|
}, z.core.$strict>>>;
|
|
80
111
|
roles: z.ZodOptional<z.ZodObject<{
|
|
@@ -83,6 +114,11 @@ export declare const configFileSchema: z.ZodObject<{
|
|
|
83
114
|
}, z.core.$strict>>;
|
|
84
115
|
concurrency: z.ZodOptional<z.ZodInt>;
|
|
85
116
|
maxFindings: z.ZodOptional<z.ZodInt>;
|
|
117
|
+
partTokens: z.ZodOptional<z.ZodInt>;
|
|
118
|
+
maxReviewTokens: z.ZodOptional<z.ZodInt>;
|
|
119
|
+
reviewTimeoutMs: z.ZodOptional<z.ZodInt>;
|
|
120
|
+
exclude: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
121
|
+
send: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
86
122
|
profiles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
87
123
|
extends: z.ZodOptional<z.ZodEnum<{
|
|
88
124
|
[x: string]: string;
|
|
@@ -143,7 +179,55 @@ export declare const configFileSchema: z.ZodObject<{
|
|
|
143
179
|
export declare const configCodeSchema: z.ZodObject<{
|
|
144
180
|
$schema: z.ZodOptional<z.ZodString>;
|
|
145
181
|
version: z.ZodOptional<z.ZodLiteral<1>>;
|
|
146
|
-
providers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodPipe<z.ZodCustom<Provider, Provider>, z.ZodTransform<Provider, Provider>>, z.
|
|
182
|
+
providers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodPipe<z.ZodCustom<Provider, Provider>, z.ZodTransform<Provider, Provider>>, z.ZodPipe<z.ZodCustom<{
|
|
183
|
+
apiKey?: string | undefined;
|
|
184
|
+
command?: string | undefined;
|
|
185
|
+
preset?: "anthropic" | "gemini" | "ollama" | "ollama-cloud" | "lmstudio" | "llamacpp" | "vllm" | "openai" | "azure-openai" | "openrouter" | "groq" | "mistral" | "deepseek" | "together" | "fireworks" | "xai" | undefined;
|
|
186
|
+
protocol?: "openai-compatible" | "anthropic" | "gemini" | "ollama" | "claude-code" | undefined;
|
|
187
|
+
baseUrl?: string | undefined;
|
|
188
|
+
model?: string | undefined;
|
|
189
|
+
contextTokens?: number | undefined;
|
|
190
|
+
apiKeyEnv?: string | undefined;
|
|
191
|
+
auth?: "bearer" | "x-api-key" | "none" | "inherit" | "login" | "api-key" | {
|
|
192
|
+
header: string;
|
|
193
|
+
prefix?: string | undefined;
|
|
194
|
+
} | undefined;
|
|
195
|
+
headers?: Record<string, string> | undefined;
|
|
196
|
+
query?: Record<string, string> | undefined;
|
|
197
|
+
extraBody?: Record<string, z.core.util.JSONType> | undefined;
|
|
198
|
+
structuredOutput?: "prompt" | "json" | "schema" | undefined;
|
|
199
|
+
temperature?: number | null | undefined;
|
|
200
|
+
maxTokens?: number | undefined;
|
|
201
|
+
maxTokensField?: "max_tokens" | "max_completion_tokens" | undefined;
|
|
202
|
+
systemPrompt?: "native" | "inline" | undefined;
|
|
203
|
+
timeoutMs?: number | undefined;
|
|
204
|
+
retries?: number | undefined;
|
|
205
|
+
args?: string[] | undefined;
|
|
206
|
+
}, {
|
|
207
|
+
apiKey?: string | undefined;
|
|
208
|
+
command?: string | undefined;
|
|
209
|
+
preset?: "anthropic" | "gemini" | "ollama" | "ollama-cloud" | "lmstudio" | "llamacpp" | "vllm" | "openai" | "azure-openai" | "openrouter" | "groq" | "mistral" | "deepseek" | "together" | "fireworks" | "xai" | undefined;
|
|
210
|
+
protocol?: "openai-compatible" | "anthropic" | "gemini" | "ollama" | "claude-code" | undefined;
|
|
211
|
+
baseUrl?: string | undefined;
|
|
212
|
+
model?: string | undefined;
|
|
213
|
+
contextTokens?: number | undefined;
|
|
214
|
+
apiKeyEnv?: string | undefined;
|
|
215
|
+
auth?: "bearer" | "x-api-key" | "none" | "inherit" | "login" | "api-key" | {
|
|
216
|
+
header: string;
|
|
217
|
+
prefix?: string | undefined;
|
|
218
|
+
} | undefined;
|
|
219
|
+
headers?: Record<string, string> | undefined;
|
|
220
|
+
query?: Record<string, string> | undefined;
|
|
221
|
+
extraBody?: Record<string, z.core.util.JSONType> | undefined;
|
|
222
|
+
structuredOutput?: "prompt" | "json" | "schema" | undefined;
|
|
223
|
+
temperature?: number | null | undefined;
|
|
224
|
+
maxTokens?: number | undefined;
|
|
225
|
+
maxTokensField?: "max_tokens" | "max_completion_tokens" | undefined;
|
|
226
|
+
systemPrompt?: "native" | "inline" | undefined;
|
|
227
|
+
timeoutMs?: number | undefined;
|
|
228
|
+
retries?: number | undefined;
|
|
229
|
+
args?: string[] | undefined;
|
|
230
|
+
}>, z.ZodObject<{
|
|
147
231
|
apiKey: z.ZodOptional<z.ZodString>;
|
|
148
232
|
command: z.ZodOptional<z.ZodString>;
|
|
149
233
|
preset: z.ZodOptional<z.ZodEnum<{
|
|
@@ -204,14 +288,21 @@ export declare const configCodeSchema: z.ZodObject<{
|
|
|
204
288
|
native: "native";
|
|
205
289
|
inline: "inline";
|
|
206
290
|
}>>;
|
|
291
|
+
timeoutMs: z.ZodOptional<z.ZodInt>;
|
|
292
|
+
retries: z.ZodOptional<z.ZodInt>;
|
|
207
293
|
args: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
208
|
-
}, z.core.$strict
|
|
294
|
+
}, z.core.$strict>>]>>>;
|
|
209
295
|
roles: z.ZodOptional<z.ZodObject<{
|
|
210
296
|
research: z.ZodOptional<z.ZodString>;
|
|
211
297
|
voter: z.ZodOptional<z.ZodString>;
|
|
212
298
|
}, z.core.$strict>>;
|
|
213
299
|
concurrency: z.ZodOptional<z.ZodInt>;
|
|
214
300
|
maxFindings: z.ZodOptional<z.ZodInt>;
|
|
301
|
+
partTokens: z.ZodOptional<z.ZodInt>;
|
|
302
|
+
maxReviewTokens: z.ZodOptional<z.ZodInt>;
|
|
303
|
+
reviewTimeoutMs: z.ZodOptional<z.ZodInt>;
|
|
304
|
+
exclude: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
305
|
+
send: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
215
306
|
profiles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
216
307
|
extends: z.ZodOptional<z.ZodEnum<{
|
|
217
308
|
[x: string]: string;
|
|
@@ -272,7 +363,55 @@ export declare const configCodeSchema: z.ZodObject<{
|
|
|
272
363
|
export declare const configInputSchema: z.ZodObject<{
|
|
273
364
|
$schema: z.ZodOptional<z.ZodString>;
|
|
274
365
|
version: z.ZodOptional<z.ZodLiteral<1>>;
|
|
275
|
-
providers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodPipe<z.ZodCustom<Provider, Provider>, z.ZodTransform<Provider, Provider>>, z.
|
|
366
|
+
providers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodPipe<z.ZodCustom<Provider, Provider>, z.ZodTransform<Provider, Provider>>, z.ZodPipe<z.ZodCustom<{
|
|
367
|
+
apiKey?: string | undefined;
|
|
368
|
+
command?: string | undefined;
|
|
369
|
+
preset?: "anthropic" | "gemini" | "ollama" | "ollama-cloud" | "lmstudio" | "llamacpp" | "vllm" | "openai" | "azure-openai" | "openrouter" | "groq" | "mistral" | "deepseek" | "together" | "fireworks" | "xai" | undefined;
|
|
370
|
+
protocol?: "openai-compatible" | "anthropic" | "gemini" | "ollama" | "claude-code" | undefined;
|
|
371
|
+
baseUrl?: string | undefined;
|
|
372
|
+
model?: string | undefined;
|
|
373
|
+
contextTokens?: number | undefined;
|
|
374
|
+
apiKeyEnv?: string | undefined;
|
|
375
|
+
auth?: "bearer" | "x-api-key" | "none" | "inherit" | "login" | "api-key" | {
|
|
376
|
+
header: string;
|
|
377
|
+
prefix?: string | undefined;
|
|
378
|
+
} | undefined;
|
|
379
|
+
headers?: Record<string, string> | undefined;
|
|
380
|
+
query?: Record<string, string> | undefined;
|
|
381
|
+
extraBody?: Record<string, z.core.util.JSONType> | undefined;
|
|
382
|
+
structuredOutput?: "prompt" | "json" | "schema" | undefined;
|
|
383
|
+
temperature?: number | null | undefined;
|
|
384
|
+
maxTokens?: number | undefined;
|
|
385
|
+
maxTokensField?: "max_tokens" | "max_completion_tokens" | undefined;
|
|
386
|
+
systemPrompt?: "native" | "inline" | undefined;
|
|
387
|
+
timeoutMs?: number | undefined;
|
|
388
|
+
retries?: number | undefined;
|
|
389
|
+
args?: string[] | undefined;
|
|
390
|
+
}, {
|
|
391
|
+
apiKey?: string | undefined;
|
|
392
|
+
command?: string | undefined;
|
|
393
|
+
preset?: "anthropic" | "gemini" | "ollama" | "ollama-cloud" | "lmstudio" | "llamacpp" | "vllm" | "openai" | "azure-openai" | "openrouter" | "groq" | "mistral" | "deepseek" | "together" | "fireworks" | "xai" | undefined;
|
|
394
|
+
protocol?: "openai-compatible" | "anthropic" | "gemini" | "ollama" | "claude-code" | undefined;
|
|
395
|
+
baseUrl?: string | undefined;
|
|
396
|
+
model?: string | undefined;
|
|
397
|
+
contextTokens?: number | undefined;
|
|
398
|
+
apiKeyEnv?: string | undefined;
|
|
399
|
+
auth?: "bearer" | "x-api-key" | "none" | "inherit" | "login" | "api-key" | {
|
|
400
|
+
header: string;
|
|
401
|
+
prefix?: string | undefined;
|
|
402
|
+
} | undefined;
|
|
403
|
+
headers?: Record<string, string> | undefined;
|
|
404
|
+
query?: Record<string, string> | undefined;
|
|
405
|
+
extraBody?: Record<string, z.core.util.JSONType> | undefined;
|
|
406
|
+
structuredOutput?: "prompt" | "json" | "schema" | undefined;
|
|
407
|
+
temperature?: number | null | undefined;
|
|
408
|
+
maxTokens?: number | undefined;
|
|
409
|
+
maxTokensField?: "max_tokens" | "max_completion_tokens" | undefined;
|
|
410
|
+
systemPrompt?: "native" | "inline" | undefined;
|
|
411
|
+
timeoutMs?: number | undefined;
|
|
412
|
+
retries?: number | undefined;
|
|
413
|
+
args?: string[] | undefined;
|
|
414
|
+
}>, z.ZodObject<{
|
|
276
415
|
apiKey: z.ZodOptional<z.ZodString>;
|
|
277
416
|
command: z.ZodOptional<z.ZodString>;
|
|
278
417
|
preset: z.ZodOptional<z.ZodEnum<{
|
|
@@ -333,14 +472,21 @@ export declare const configInputSchema: z.ZodObject<{
|
|
|
333
472
|
native: "native";
|
|
334
473
|
inline: "inline";
|
|
335
474
|
}>>;
|
|
475
|
+
timeoutMs: z.ZodOptional<z.ZodInt>;
|
|
476
|
+
retries: z.ZodOptional<z.ZodInt>;
|
|
336
477
|
args: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
337
|
-
}, z.core.$strict
|
|
478
|
+
}, z.core.$strict>>]>>>;
|
|
338
479
|
roles: z.ZodOptional<z.ZodObject<{
|
|
339
480
|
research: z.ZodOptional<z.ZodString>;
|
|
340
481
|
voter: z.ZodOptional<z.ZodString>;
|
|
341
482
|
}, z.core.$strict>>;
|
|
342
483
|
concurrency: z.ZodOptional<z.ZodInt>;
|
|
343
484
|
maxFindings: z.ZodOptional<z.ZodInt>;
|
|
485
|
+
partTokens: z.ZodOptional<z.ZodInt>;
|
|
486
|
+
maxReviewTokens: z.ZodOptional<z.ZodInt>;
|
|
487
|
+
reviewTimeoutMs: z.ZodOptional<z.ZodInt>;
|
|
488
|
+
exclude: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
489
|
+
send: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
344
490
|
profiles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
345
491
|
extends: z.ZodOptional<z.ZodEnum<{
|
|
346
492
|
[x: string]: string;
|
|
@@ -439,3 +585,4 @@ export declare function parseConfig<T>(schema: z.ZodType<T>, value: unknown, pre
|
|
|
439
585
|
* secret pasted in the wrong place.
|
|
440
586
|
*/
|
|
441
587
|
export declare function unknownName(path: string, kind: 'provider' | 'profile', name: string, defined: readonly string[]): ConfigIssue;
|
|
588
|
+
export {};
|
package/dist/config/schema.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { ConfigError, isSafeSegment, issuePath } from "../core/errors.js";
|
|
3
|
+
import { MAX_PATTERNS, patternProblem, TOO_MANY_PATTERNS } from "../core/exclude.js";
|
|
4
|
+
import { MIN_PART_TOKENS } from "../core/parts.js";
|
|
5
|
+
import { MAX_RETRIES, MAX_STATED_TIMEOUT_MS, MAX_TIMEOUT_MS, MIN_TIMEOUT_MS, retriesProblem, timeoutProblem } from "../core/ports.js";
|
|
6
|
+
import { ownData } from "../core/stages/context.js";
|
|
3
7
|
import { securityProfile } from "../profiles/security.js";
|
|
4
8
|
import { wordList } from "../providers/options.js";
|
|
5
9
|
import { presets, withoutPrototype } from "../providers/presets.js";
|
|
@@ -19,6 +23,14 @@ const PROTOCOLS = {
|
|
|
19
23
|
const STRUCTURED_OUTPUTS = { prompt: true, json: true, schema: true };
|
|
20
24
|
const VERSION = 'must be 1, the only config version this quorum reads: upgrade quorum to read a later one';
|
|
21
25
|
const name = z.string().regex(NAME);
|
|
26
|
+
/** A path pattern of `exclude`, refused in the words `createQuorum` uses, since both ask `patternProblem`. */
|
|
27
|
+
const pattern = z.string().check((ctx) => {
|
|
28
|
+
const problem = patternProblem(ctx.value);
|
|
29
|
+
if (problem !== undefined)
|
|
30
|
+
ctx.issues.push({ code: 'custom', message: problem, input: ctx.value });
|
|
31
|
+
});
|
|
32
|
+
/** A path of `send`: a non-empty string, in the words `review` refuses it with, since the empty name is no file of a diff. */
|
|
33
|
+
const file = z.string({ error: 'must name a file' }).min(1, { error: 'must name a file' });
|
|
22
34
|
const roles = z.strictObject({
|
|
23
35
|
research: name.optional().describe('The provider that looks for candidate findings'),
|
|
24
36
|
voter: name.optional().describe('The provider every lens votes with, unless the lens names its own'),
|
|
@@ -51,9 +63,11 @@ const providerShape = {
|
|
|
51
63
|
extraBody: z.record(z.string(), z.json()).optional().describe('JSON values deep-merged into the request body last'),
|
|
52
64
|
structuredOutput: z.enum(Object.keys(STRUCTURED_OUTPUTS)).optional().describe('How the reply shape reaches the endpoint: described in the prompt, as a JSON object, or as a strict schema'),
|
|
53
65
|
temperature: z.number().nullable().optional().describe('The sampling temperature; null leaves the field out'),
|
|
54
|
-
maxTokens: z.int().min(1).optional().describe('The most tokens the reply may hold'),
|
|
66
|
+
maxTokens: z.int().min(1).optional().describe('The most tokens the reply may hold, thinking included, sent as the server\'s limit; 16000 when unset. On claude-code, Claude Code\'s own limit on each reply'),
|
|
55
67
|
maxTokensField: z.enum(['max_tokens', 'max_completion_tokens']).optional().describe('The body field that carries maxTokens, on the openai-compatible protocol'),
|
|
56
68
|
systemPrompt: z.enum(['native', 'inline']).optional().describe('Where the instructions go: the protocol\'s system field, or inline in the first message'),
|
|
69
|
+
timeoutMs: z.int().min(MIN_TIMEOUT_MS).max(MAX_TIMEOUT_MS).optional().describe('The deadline of one attempt of a call, in milliseconds; 600000 when unset. On claude-code, Claude Code\'s wait for each attempt\'s response headers, and the whole run\'s deadline is timeoutMs times retries plus one'),
|
|
70
|
+
retries: z.int().min(0).max(MAX_RETRIES).optional().describe('How many times a call that failed in passing is tried again; 2 when unset'),
|
|
57
71
|
args: z.array(z.string()).optional().describe('On claude-code, extra claude flags, each with its value: --effort, --fallback-model, --max-budget-usd, or --betas with auth api-key'),
|
|
58
72
|
};
|
|
59
73
|
const prompt = z.union([
|
|
@@ -103,6 +117,11 @@ function configSchema(provider, promptForm) {
|
|
|
103
117
|
roles: roles.optional().describe('The providers every profile uses, unless it names its own. research is required once several providers are defined; voter is research when unset'),
|
|
104
118
|
concurrency: z.int().min(1).optional().describe('The most provider calls in flight at once in one review, shared by every profile'),
|
|
105
119
|
maxFindings: z.int().min(1).optional().describe('The most findings of a research reply each profile reads, the only ones that can reach its panel'),
|
|
120
|
+
partTokens: z.int().min(MIN_PART_TOKENS).optional().describe('The most tokens of diff text, at one token per byte, one research request of a large change holds; 32768 when unset'),
|
|
121
|
+
maxReviewTokens: z.int().min(1).optional().describe('The most tokens, input and output, one review may spend; 2000000 when unset. Set here or in QUORUM_MAX_REVIEW_TOKENS'),
|
|
122
|
+
reviewTimeoutMs: z.int().min(MIN_TIMEOUT_MS).max(MAX_TIMEOUT_MS).optional().describe('The deadline of one review, in milliseconds; 1800000 when unset. Set here or in QUORUM_REVIEW_TIMEOUT_MS'),
|
|
123
|
+
exclude: z.array(pattern.describe('A path pattern: * and ? within a name, ** for whole directories, no / to match a file name in any directory, a leading / for the root')).max(MAX_PATTERNS, { error: TOO_MANY_PATTERNS }).optional().describe('The files left out of every request, by path pattern, each listed as excluded in meta.leftOut; nothing is excluded by default'),
|
|
124
|
+
send: z.array(file.describe('A file\'s path as the diff writes it, decoded')).optional().describe('The files sent to the models though held as secrets, each the path as the diff writes it and meta.leftOut lists it; none by default'),
|
|
106
125
|
profiles: z.record(name, profileSchema(promptForm)).optional().describe('The review profiles, by id: a built-in profile, one that extends it, or one of your own. The ones --profile names run, else the ones QUORUM_PROFILES names, else every one listed here, else the security profile alone'),
|
|
107
126
|
});
|
|
108
127
|
}
|
|
@@ -112,9 +131,67 @@ export function isProvider(value) {
|
|
|
112
131
|
}
|
|
113
132
|
/** The snapshots the schema made of provider objects, recognised by identity: a settings object is never taken for one, whatever its prototype holds. */
|
|
114
133
|
const SNAPSHOTS = new WeakSet();
|
|
115
|
-
/**
|
|
116
|
-
|
|
117
|
-
|
|
134
|
+
/** Each fact a provider states, with the check of its value: a deadline up to what a provider may state, which is more than an option takes. */
|
|
135
|
+
const FACTS = [
|
|
136
|
+
{
|
|
137
|
+
field: 'timeoutMs',
|
|
138
|
+
problem: value => timeoutProblem(value, MAX_STATED_TIMEOUT_MS),
|
|
139
|
+
},
|
|
140
|
+
{ field: 'retries', problem: retriesProblem },
|
|
141
|
+
];
|
|
142
|
+
/**
|
|
143
|
+
* The facts `provider` states, each read as own data, so a getter never runs and an inherited property
|
|
144
|
+
* or a proxy that throws states nothing: `stated` holds those that pass their check, and `problems` the
|
|
145
|
+
* field and wording of each that does not. A value is never quoted.
|
|
146
|
+
*/
|
|
147
|
+
export function statedFacts(provider) {
|
|
148
|
+
// No prototype, so a reader of `stated` never finds a fact on `Object.prototype`.
|
|
149
|
+
const stated = Object.create(null);
|
|
150
|
+
const problems = [];
|
|
151
|
+
for (const { field, problem } of FACTS) {
|
|
152
|
+
const value = ownData(provider, field);
|
|
153
|
+
if (value === undefined)
|
|
154
|
+
continue;
|
|
155
|
+
const message = problem(value);
|
|
156
|
+
if (message === undefined)
|
|
157
|
+
stated[field] = value;
|
|
158
|
+
else
|
|
159
|
+
problems.push({ field, message });
|
|
160
|
+
}
|
|
161
|
+
return { stated, problems };
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* The `worstCase` a provider states, as own data: a function, else undefined. It is no fact of `FACTS`: a
|
|
165
|
+
* function is no number to check or to hash, so the fingerprint and the printed config never see it, and a
|
|
166
|
+
* value that is no function is an issue of `providerObject` and is never read here.
|
|
167
|
+
*/
|
|
168
|
+
export function statedWorstCase(provider) {
|
|
169
|
+
const worstCase = ownData(provider, 'worstCase');
|
|
170
|
+
return typeof worstCase === 'function'
|
|
171
|
+
? worstCase
|
|
172
|
+
: undefined;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* The `room` a provider states, as own data: a function, else undefined, as `statedWorstCase` reads the worst
|
|
176
|
+
* case. It is no fact of `FACTS` either, so the fingerprint and the printed config never see it.
|
|
177
|
+
*/
|
|
178
|
+
export function statedRoom(provider) {
|
|
179
|
+
const room = ownData(provider, 'room');
|
|
180
|
+
return typeof room === 'function'
|
|
181
|
+
? room
|
|
182
|
+
: undefined;
|
|
183
|
+
}
|
|
184
|
+
/** A provider object as a snapshot: its fields as plain data, frozen, with no prototype. A `worstCase` or a `room` it states is kept as a field, and one it does not state leaves no field. */
|
|
185
|
+
function snapshot({ worstCase, room, ...fields }) {
|
|
186
|
+
const made = Object.freeze(withoutPrototype(Object.entries({
|
|
187
|
+
...fields,
|
|
188
|
+
...worstCase === undefined
|
|
189
|
+
? {}
|
|
190
|
+
: { worstCase },
|
|
191
|
+
...room === undefined
|
|
192
|
+
? {}
|
|
193
|
+
: { room },
|
|
194
|
+
})));
|
|
118
195
|
SNAPSHOTS.add(made);
|
|
119
196
|
return made;
|
|
120
197
|
}
|
|
@@ -122,7 +199,12 @@ function snapshot(fields) {
|
|
|
122
199
|
* The provider-object form of a code config's provider: an object whose `complete` is a function, read once
|
|
123
200
|
* into a snapshot. The check reads `model` and `complete` one time each, and nothing reads the object again,
|
|
124
201
|
* so a getter of the program's cannot run outside the guard that hides what it throws. The snapshot calls the
|
|
125
|
-
* method read here on the object itself, through `Reflect.apply`, which reads nothing off the function.
|
|
202
|
+
* method read here on the object itself, through `Reflect.apply`, which reads nothing off the function. The
|
|
203
|
+
* `timeoutMs` and `retries` it states are read as own data, so no getter runs for them; the snapshot keeps
|
|
204
|
+
* each that is in range, and a value out of range is an issue at its field. The `worstCase` it states is read
|
|
205
|
+
* as own data too and kept as a function that calls it on the object, so the review's token cap counts
|
|
206
|
+
* what the object says one call may cost; a value that is no function is an issue at its field. So is the
|
|
207
|
+
* `room` it states, which the review reads to know how much one request of the object may hold.
|
|
126
208
|
*/
|
|
127
209
|
const providerObject = z.custom(value => typeof value === 'object' && value !== null).transform((object, ctx) => {
|
|
128
210
|
const { model, complete } = object;
|
|
@@ -130,20 +212,67 @@ const providerObject = z.custom(value => typeof value === 'object' && value !==
|
|
|
130
212
|
ctx.issues.push({ code: 'custom', message: 'complete is not a function', input: object });
|
|
131
213
|
return z.NEVER;
|
|
132
214
|
}
|
|
215
|
+
const { stated, problems } = statedFacts(object);
|
|
216
|
+
const worstCase = ownData(object, 'worstCase');
|
|
217
|
+
const room = ownData(object, 'room');
|
|
218
|
+
const issues = [
|
|
219
|
+
...problems,
|
|
220
|
+
...worstCase === undefined || typeof worstCase === 'function'
|
|
221
|
+
? []
|
|
222
|
+
: [
|
|
223
|
+
{ field: 'worstCase', message: 'must be a function' },
|
|
224
|
+
],
|
|
225
|
+
...room === undefined || typeof room === 'function'
|
|
226
|
+
? []
|
|
227
|
+
: [
|
|
228
|
+
{ field: 'room', message: 'must be a function' },
|
|
229
|
+
],
|
|
230
|
+
];
|
|
231
|
+
// `continue` keeps the union from setting this form aside as aborted: the object took its shape, so its issues are the ones reported.
|
|
232
|
+
for (const { field, message } of issues) {
|
|
233
|
+
ctx.issues.push({
|
|
234
|
+
code: 'custom',
|
|
235
|
+
message,
|
|
236
|
+
input: object,
|
|
237
|
+
path: [field],
|
|
238
|
+
continue: true,
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
if (issues.length > 0)
|
|
242
|
+
return z.NEVER;
|
|
133
243
|
return snapshot({
|
|
134
244
|
model,
|
|
135
245
|
complete: request => Reflect.apply(complete, object, [request]),
|
|
246
|
+
...stated,
|
|
247
|
+
...typeof worstCase === 'function'
|
|
248
|
+
? {
|
|
249
|
+
worstCase: (request) => Reflect.apply(worstCase, object, [request]),
|
|
250
|
+
}
|
|
251
|
+
: {},
|
|
252
|
+
...typeof room === 'function'
|
|
253
|
+
? {
|
|
254
|
+
room: (request) => Reflect.apply(room, object, [request]),
|
|
255
|
+
}
|
|
256
|
+
: {},
|
|
136
257
|
});
|
|
137
258
|
});
|
|
138
259
|
/**
|
|
139
260
|
* `entry` named `id`, the config's key for it, when it is a snapshot the schema made of a provider object: a
|
|
140
|
-
* copy that holds `id` as well, built from the snapshot's own data
|
|
261
|
+
* copy that holds `id` as well, built from the snapshot's own data, the facts and the `worstCase` and the
|
|
262
|
+
* `room` it states included. Anything else is returned as it is.
|
|
141
263
|
*/
|
|
142
264
|
export function nameSnapshot(id, entry) {
|
|
143
265
|
if (typeof entry !== 'object' || entry === null || !SNAPSHOTS.has(entry))
|
|
144
266
|
return entry;
|
|
145
267
|
const { model, complete } = entry;
|
|
146
|
-
return snapshot({
|
|
268
|
+
return snapshot({
|
|
269
|
+
id,
|
|
270
|
+
model,
|
|
271
|
+
complete,
|
|
272
|
+
...statedFacts(entry).stated,
|
|
273
|
+
worstCase: statedWorstCase(entry),
|
|
274
|
+
room: statedRoom(entry),
|
|
275
|
+
});
|
|
147
276
|
}
|
|
148
277
|
/**
|
|
149
278
|
* A YAML or JSON config: data only, so a provider names the variable that holds its key and never holds
|
|
@@ -151,14 +280,29 @@ export function nameSnapshot(id, entry) {
|
|
|
151
280
|
* fill is optional, and the references between fields are checked once the layers are merged.
|
|
152
281
|
*/
|
|
153
282
|
export const configFileSchema = configSchema(z.strictObject(providerShape), prompt);
|
|
283
|
+
/** The settings of a provider in a code config: those of a file, which may also hold the key itself and the executable. */
|
|
284
|
+
const codeSettings = z.strictObject({
|
|
285
|
+
...providerShape,
|
|
286
|
+
apiKey: z.string().optional().describe('The key itself, which only a code config may hold'),
|
|
287
|
+
command: z.string().optional().describe('On claude-code, the claude executable: an absolute path, or a name found on PATH; only a code config may name it'),
|
|
288
|
+
});
|
|
289
|
+
/**
|
|
290
|
+
* Whether `value` may be the settings of a provider: anything but an object that holds a `complete`, unless
|
|
291
|
+
* that is plain data and no function, which the settings form reports as a field it does not know. An object
|
|
292
|
+
* that holds one is a provider object, read once, by `providerObject` alone; the settings form reads every
|
|
293
|
+
* field it knows through the object, a getter's included, so it is never offered one. Only the key and its
|
|
294
|
+
* descriptor are looked at here, so no getter of the object runs.
|
|
295
|
+
*/
|
|
296
|
+
function isSettings(value) {
|
|
297
|
+
if (typeof value !== 'object' || value === null || !('complete' in value))
|
|
298
|
+
return true;
|
|
299
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, 'complete');
|
|
300
|
+
return descriptor !== undefined && Object.hasOwn(descriptor, 'value') && typeof descriptor.value !== 'function';
|
|
301
|
+
}
|
|
154
302
|
/** What a code config may hold as a provider: settings that may hold their key, or an object implementing `Provider`. */
|
|
155
303
|
const codeProvider = z.union([
|
|
156
304
|
providerObject,
|
|
157
|
-
z.
|
|
158
|
-
...providerShape,
|
|
159
|
-
apiKey: z.string().optional().describe('The key itself, which only a code config may hold'),
|
|
160
|
-
command: z.string().optional().describe('On claude-code, the claude executable: an absolute path, or a name found on PATH; only a code config may name it'),
|
|
161
|
-
}),
|
|
305
|
+
z.custom(isSettings).pipe(codeSettings),
|
|
162
306
|
], { error: 'must be the settings of a provider, or an object whose complete is a function' });
|
|
163
307
|
/** A TS or JS config: the file variant, where a provider may also hold its key, or be an object implementing `Provider`. */
|
|
164
308
|
export const configCodeSchema = configSchema(codeProvider, prompt);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The time and the randomness the core reads, and the one timer it arms: the system's, unless a spec
|
|
3
|
+
* injects its own. The review holds it in its context and nothing outside the core sets it.
|
|
4
|
+
*/
|
|
5
|
+
export interface Clock {
|
|
6
|
+
/** Milliseconds on a monotonic clock, from an origin of its own: only the difference of two readings means anything. */
|
|
7
|
+
readonly now: () => number;
|
|
8
|
+
/** A number from 0 up to, and not including, 1. */
|
|
9
|
+
readonly random: () => number;
|
|
10
|
+
/** Calls `fire` once, after `ms` milliseconds; returns the function that cancels it, which may be called at any time and any number of times. */
|
|
11
|
+
readonly timer: (ms: number, fire: () => void) => () => void;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The system's clock. Each reading goes through a function that reads the global at the call, never a
|
|
15
|
+
* reference taken when the module loads, so a spec that replaces `Math.random` is seen.
|
|
16
|
+
*/
|
|
17
|
+
export declare const systemClock: Clock;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The system's clock. Each reading goes through a function that reads the global at the call, never a
|
|
3
|
+
* reference taken when the module loads, so a spec that replaces `Math.random` is seen.
|
|
4
|
+
*/
|
|
5
|
+
export const systemClock = Object.freeze({
|
|
6
|
+
now: () => performance.now(),
|
|
7
|
+
random: () => Math.random(),
|
|
8
|
+
timer: (ms, fire) => {
|
|
9
|
+
const handle = setTimeout(fire, ms);
|
|
10
|
+
return () => {
|
|
11
|
+
clearTimeout(handle);
|
|
12
|
+
};
|
|
13
|
+
},
|
|
14
|
+
});
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { IncompleteEntry, LeftOutFile } from './types.ts';
|
|
2
|
+
/** What a review covers of a diff: the diff every stage reads, and the files it leaves out. */
|
|
3
|
+
export interface ReviewScope {
|
|
4
|
+
/** The diff every stage reads: the given one less the excluded and the held sections. */
|
|
5
|
+
readonly diff: string;
|
|
6
|
+
/** The files left out, excluded, held as secrets or with a change the diff does not carry, in the diff's order, once per file and reason. */
|
|
7
|
+
readonly leftOut: LeftOutFile[];
|
|
8
|
+
/** Every file of the given diff, excluded and held ones too, in the diff's order, once each: '' for the text no header names, none for a blank preamble. */
|
|
9
|
+
readonly files: string[];
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* What a review covers of a diff: the files `excluded` leaves out, the files held back as secrets, and the
|
|
13
|
+
* files whose change the diff does not carry, found from the markers git prints in their place, each
|
|
14
|
+
* section read line by line (a trailing `\r` is dropped), so a Windows-made diff reads as any other. In
|
|
15
|
+
* each section:
|
|
16
|
+
* - a `binary` file shows as a line that starts with `Binary files ` and ends with ` differ`, or one
|
|
17
|
+
* that starts with `GIT binary patch`;
|
|
18
|
+
* - a `submodule` shows as a `Subproject commit` row (past at most one leading `+`, `-` or space), a
|
|
19
|
+
* header of mode 160000 (`new file mode`, `deleted file mode`, `old mode` and `new mode`), or an
|
|
20
|
+
* `index` line that ends in ` 160000`;
|
|
21
|
+
* - a `Submodule` line, which git's `log` and `diff` formats print in place of a header, at the end of
|
|
22
|
+
* the section before it, lists a `submodule` under the empty name, whatever section holds it.
|
|
23
|
+
*
|
|
24
|
+
* A file is listed by the diff's own path, decoded, in the diff's order, once per file and reason.
|
|
25
|
+
* `excluded` is asked once per distinct path a header names; a section it takes is listed as
|
|
26
|
+
* `excluded`, leaves the scope's `diff` and has its own markers left unread, but its `Submodule`
|
|
27
|
+
* lines still list their submodule, since such a line belongs to no section. Nothing a header does
|
|
28
|
+
* not name is ever excluded: the text before the first header, a diff without such headers and a
|
|
29
|
+
* header that names no path quorum reads.
|
|
30
|
+
*
|
|
31
|
+
* A header can read two ways: git does not quote a path that holds a space, so a rename's header
|
|
32
|
+
* (`a/src/auth.js b/src/x b/dist/auth.js`) can name a path the file does not have. A section is
|
|
33
|
+
* therefore excluded only when every `rename to` and `copy to` line it holds names the header's
|
|
34
|
+
* path, as `movedTo` reads them; otherwise it is kept, as a header quorum cannot read is, its markers
|
|
35
|
+
* read and its text sent. A forged line, such as a `format-patch` series carries in the next mail's
|
|
36
|
+
* message, can then only make quorum exclude less. That next mail's headers and message sit at the
|
|
37
|
+
* end of the previous file's section and leave with it when that file is excluded: no code hides
|
|
38
|
+
* there, since `git am` applies only the patch sections, and a `Submodule` line still counts.
|
|
39
|
+
*
|
|
40
|
+
* The empty name stands for a part of the diff that no `diff --git` header names: the text before the
|
|
41
|
+
* first header, a diff without such headers, a header that names no path quorum reads, and a `Submodule`
|
|
42
|
+
* line. A readable header never names the empty path, so it is never a file's.
|
|
43
|
+
*
|
|
44
|
+
* A file is held back when its name is a secret's, by any path its section names (its header, its `---`
|
|
45
|
+
* and `+++` lines, its `rename` and `copy` lines), or a line of it, removed and context lines included,
|
|
46
|
+
* holds a credential quorum recognizes (`secretRuleOf`). One file has one verdict: the sections of one
|
|
47
|
+
* path are one file, held by the first rule found in the diff's order, so when any of them is held every
|
|
48
|
+
* one leaves the scope's `diff`, and a credential in one holds the others. The file is listed once, at
|
|
49
|
+
* its first section, as `secret` with its `rule`, or as `deleted-secret` when its rule is `name` and every
|
|
50
|
+
* section of it is a whole deletion (`isWholeDeletion`): the change then adds no code, and the file is no
|
|
51
|
+
* gap. A deletion of a file held for a credential in it is `secret` and a gap, since the code it removes
|
|
52
|
+
* would go unread, as an edit of it would. A held section's own markers are left unread, as an excluded
|
|
53
|
+
* one's are, so a held binary file is listed `secret` only; its `Submodule` lines still list their
|
|
54
|
+
* submodule. The empty name is a file like any
|
|
55
|
+
* other: the text before the first header, a diff without such headers and a header quorum cannot read
|
|
56
|
+
* are held whole by one verdict.
|
|
57
|
+
*
|
|
58
|
+
* The order is: `excluded` first, so an excluded file is listed `excluded` only and judged no further;
|
|
59
|
+
* then `sent`, asked of each path a header names and never of the empty name, which sends a file whatever
|
|
60
|
+
* would hold it, so it is neither held nor listed; then the hold.
|
|
61
|
+
*
|
|
62
|
+
* The scope's `files` names every section's file as it is read, once each, in the diff's order, the held
|
|
63
|
+
* ones too: the empty name for the text no header names, and again, after the section that holds one, for
|
|
64
|
+
* a `Submodule` line; a preamble that is blank names no file.
|
|
65
|
+
*
|
|
66
|
+
* Detection is generous: a line of the same form elsewhere, such as a commit message line of a
|
|
67
|
+
* `format-patch` series, lists the file whose section holds it, and a hit anywhere in a file holds all
|
|
68
|
+
* of it, since a gap it should not have stops a review for a person to look, where a missed one would
|
|
69
|
+
* pass a change unread. The scope's `diff` is the given string itself when no section was excluded or
|
|
70
|
+
* held, the kept sections joined by line feeds when some were, and '' when every section was.
|
|
71
|
+
*/
|
|
72
|
+
export declare function reviewScope(diff: string, excluded?: (path: string) => boolean, sent?: (path: string) => boolean): ReviewScope;
|
|
73
|
+
/** The gaps the files left out make for one profile: one per reason, binary then submodule then secret, counting its files, and none for a reason with no file. A `deleted-secret` file is no gap. */
|
|
74
|
+
export declare function leftOutGaps(profile: string, leftOut: readonly LeftOutFile[]): IncompleteEntry[];
|