eval-quality 1.1.0 → 1.2.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.
|
@@ -30,7 +30,19 @@ export type CommandMechanism = {
|
|
|
30
30
|
readonly run: (request: CommandRunRequest, signal: AbortSignal) => Promise<CommandRunResult>;
|
|
31
31
|
readonly readArtifact: (path: string, maxBytes: number) => Promise<ArtifactRead>;
|
|
32
32
|
};
|
|
33
|
-
/**
|
|
33
|
+
/**
|
|
34
|
+
* Options first as `--{key}`, positionals after, both in the record's own key
|
|
35
|
+
* order. Exported for its own unit tests: this is the one place
|
|
36
|
+
* shell-injection safety is decided.
|
|
37
|
+
*
|
|
38
|
+
* An array value is the repeatable spelling. A great many command-line tools
|
|
39
|
+
* accept an option more than once and collect the values (`--env-pass A
|
|
40
|
+
* --env-pass B`), and a channel record holds one value per key, so before this
|
|
41
|
+
* a caller could send exactly one. The single JSON token an array used to
|
|
42
|
+
* produce (`--env-pass ["A","B"]`) reaches no parser that understands it, so
|
|
43
|
+
* nothing can depend on the old spelling. An empty array emits nothing, the
|
|
44
|
+
* same as `false`: there is no value to pass.
|
|
45
|
+
*/
|
|
34
46
|
export declare function buildArgv(channels: CommandProbeRequest['channels']): string[];
|
|
35
47
|
/**
|
|
36
48
|
* The real mechanism: an actual child process, an actual file read. Exported,
|
|
@@ -16,11 +16,13 @@
|
|
|
16
16
|
* 2. `argument` and `option` build the argv the same way a well-behaved CLI
|
|
17
17
|
* parser reads one: options first as `--{key}` (a boolean `true` is a
|
|
18
18
|
* bare flag, `false` is omitted, anything else gets one value token),
|
|
19
|
-
* positionals after in the record's own key order.
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
19
|
+
* positionals after in the record's own key order. An array value is the
|
|
20
|
+
* repeatable spelling: `--{key}` is emitted once per element, and an
|
|
21
|
+
* array positional contributes one token per element. `environment`
|
|
22
|
+
* passes through as declared, plus the host's own `PATH` so a `target`
|
|
23
|
+
* naming a bare command still resolves; a declared `PATH` key wins over
|
|
24
|
+
* that default. `stdin` is written and the stream is closed; `absent`
|
|
25
|
+
* closes it with nothing written.
|
|
24
26
|
* 3. `maxElapsedMs` and `maxOutputBytes` are enforced by this adapter, not
|
|
25
27
|
* borrowed from `AbortSignal`: exceeding either kills the process with
|
|
26
28
|
* `SIGKILL` and throws `budget-exhausted`, exactly as an HTTP cap does.
|
|
@@ -47,17 +49,37 @@ function stringifyScalar(value) {
|
|
|
47
49
|
return String(value);
|
|
48
50
|
return JSON.stringify(value);
|
|
49
51
|
}
|
|
50
|
-
/**
|
|
52
|
+
/**
|
|
53
|
+
* Options first as `--{key}`, positionals after, both in the record's own key
|
|
54
|
+
* order. Exported for its own unit tests: this is the one place
|
|
55
|
+
* shell-injection safety is decided.
|
|
56
|
+
*
|
|
57
|
+
* An array value is the repeatable spelling. A great many command-line tools
|
|
58
|
+
* accept an option more than once and collect the values (`--env-pass A
|
|
59
|
+
* --env-pass B`), and a channel record holds one value per key, so before this
|
|
60
|
+
* a caller could send exactly one. The single JSON token an array used to
|
|
61
|
+
* produce (`--env-pass ["A","B"]`) reaches no parser that understands it, so
|
|
62
|
+
* nothing can depend on the old spelling. An empty array emits nothing, the
|
|
63
|
+
* same as `false`: there is no value to pass.
|
|
64
|
+
*/
|
|
51
65
|
export function buildArgv(channels) {
|
|
52
66
|
const optionTokens = [];
|
|
53
67
|
for (const [key, value] of Object.entries(channels.option)) {
|
|
54
68
|
if (value === false)
|
|
55
69
|
continue;
|
|
70
|
+
if (Array.isArray(value)) {
|
|
71
|
+
for (const element of value) {
|
|
72
|
+
optionTokens.push(`--${key}`, stringifyScalar(element));
|
|
73
|
+
}
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
56
76
|
optionTokens.push(`--${key}`);
|
|
57
77
|
if (value !== true)
|
|
58
78
|
optionTokens.push(stringifyScalar(value));
|
|
59
79
|
}
|
|
60
|
-
const argumentTokens = Object.values(channels.argument).
|
|
80
|
+
const argumentTokens = Object.values(channels.argument).flatMap((value) => Array.isArray(value)
|
|
81
|
+
? value.map(stringifyScalar)
|
|
82
|
+
: [stringifyScalar(value)]);
|
|
61
83
|
return [...optionTokens, ...argumentTokens];
|
|
62
84
|
}
|
|
63
85
|
function buildEnv(declared) {
|
package/dist/index.d.ts
CHANGED
|
@@ -12,4 +12,4 @@ export type { ScoringPolicy } from './core/schemas/scoring-policy.ts';
|
|
|
12
12
|
export type { SealedEvaluatorBrief } from './core/schemas/sealed-evaluator-brief.ts';
|
|
13
13
|
export type { SealedRunRecord } from './core/schemas/sealed-run-record.ts';
|
|
14
14
|
export type { FixtureReset, ManifestationWitness, SensitivityWitness, SensitivityWitnessLeg, WitnessChannel, WitnessInputs, } from './core/schemas/sensitivity-witness.ts';
|
|
15
|
-
export declare const VERSION = "1.
|
|
15
|
+
export declare const VERSION = "1.2.0";
|
package/dist/index.js
CHANGED
package/package.json
CHANGED