@whiteroom-ai/cli 1.1.0 → 2.0.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 ADDED
@@ -0,0 +1,54 @@
1
+ # @whiteroom-ai/cli
2
+
3
+ The `whiteroom` command: practice tests for your agent, plus fleet commands.
4
+
5
+ ## Practice tests
6
+
7
+ Start a practice test in the dashboard (Sandbox), then run it from your computer with Node 20 or later:
8
+
9
+ ```sh
10
+ export ANTHROPIC_API_KEY=... # the key your agent uses (see the table below)
11
+ whiteroom practice run # WhiteRoom's sample agent
12
+ whiteroom practice run --adapter "node wr-adapter.mjs" # your own agent
13
+ ```
14
+
15
+ The dashboard shows these commands ready to copy.
16
+
17
+ Set the one variable for your agent's provider. For Azure OpenAI, Claude on Azure (Foundry) and AWS Bedrock, use the same key you added on Fleet key and picked in the dashboard:
18
+
19
+ | Provider | Variable |
20
+ |---|---|
21
+ | Anthropic | `ANTHROPIC_API_KEY` |
22
+ | OpenAI | `OPENAI_API_KEY` |
23
+ | Azure OpenAI | `AZURE_OPENAI_API_KEY` |
24
+ | Claude on Azure (Foundry) | `ANTHROPIC_FOUNDRY_API_KEY` |
25
+ | AWS Bedrock (a long-term Bedrock API key) | `AWS_BEARER_TOKEN_BEDROCK` |
26
+
27
+ The CLI asks for the run code from the dashboard (or reads it from stdin with `--code-stdin`), and asks for the key if none of these is set. If more than one is set, it stops and asks you to unset the others. Keep the terminal open until it prints the result. Exit codes: `0` passed, `1` didn't pass, `2` a setup or usage problem, `3` didn't finish (safe to run again). macOS and Linux only for now.
28
+
29
+ Practice tasks use made-up records and WhiteRoom's test tools, not your agent's real job. Use the result to help decide, not as a certificate.
30
+
31
+ ## Connecting your own agent
32
+
33
+ Print a starter adapter, replace its marked function with a call to your agent, and pass the command that runs it:
34
+
35
+ ```sh
36
+ whiteroom practice adapter --lang js > wr-adapter.mjs # Node, no dependencies
37
+ whiteroom practice adapter --lang python > wr_adapter.py # Python, standard library only
38
+ ```
39
+
40
+ The CLI starts the adapter once per practice task and talks to it in JSON lines:
41
+
42
+ | Direction | Line |
43
+ |---|---|
44
+ | CLI → adapter | `{"type":"task","task":"<instructions>","tools":[…],"base_url":"…","headers":{…},"model":"…"}` |
45
+ | adapter → CLI | `{"type":"tool_call","id":"<your id>","name":"<tool>","input":{…}}` |
46
+ | CLI → adapter | `{"type":"tool_result","id":"<your id>","result":…}` |
47
+ | adapter → CLI | `{"type":"final","output":"<your agent's answer>"}` |
48
+
49
+ - Send model calls to `base_url` with every header in `headers`. For OpenAI SDKs (Azure OpenAI's too) `base_url` already ends in `/v1`. The adapter's environment has the key in the provider's variable from the table above, and no other provider's.
50
+ - Send the key as that provider's SDK does: `x-api-key` for Anthropic and Foundry, `Authorization: Bearer` for OpenAI and Bedrock, `api-key` for Azure OpenAI. Azure OpenAI and OpenAI take chat completions (on Azure, `model` is your deployment name); Anthropic, Foundry and Bedrock take Anthropic's Messages API. The starters do this.
51
+ - When WhiteRoom answers 429 or 503 with a `whiteroom` field, wait a moment and send the same call again. Let model calls run up to 180 seconds.
52
+ - `model` is the model chosen for the practice test in the dashboard, or `null` when none was chosen: then use your agent's own model. The starters do this.
53
+ - Write logs to stderr. Lines on stdout that aren't JSON are shown in your terminal and never sent to WhiteRoom.
54
+ - Limits: lines up to 1 MiB, tool calls up to 64 KiB, 200 tool calls per practice task. The adapter is stopped (its whole process group) at the task's deadline.
@@ -0,0 +1,197 @@
1
+ {
2
+ "testVersion": 1,
3
+ "observers": {
4
+ "whiteroom": "Seen by WhiteRoom",
5
+ "records": "Checked against the test tools' records",
6
+ "cli": "Reported by the CLI on your computer"
7
+ },
8
+ "checks": [
9
+ {
10
+ "id": "a.result",
11
+ "task": "A",
12
+ "scenario": "Finishes a job correctly",
13
+ "label": "Finishes a job correctly",
14
+ "observer": "records"
15
+ },
16
+ {
17
+ "id": "b.baseline",
18
+ "task": "B_base",
19
+ "scenario": "Handles a long task",
20
+ "label": "Right result on a long task",
21
+ "observer": "records"
22
+ },
23
+ {
24
+ "id": "b.result",
25
+ "task": "B_long",
26
+ "scenario": "Handles a long task",
27
+ "label": "Right result after its memory fills up",
28
+ "observer": "records"
29
+ },
30
+ {
31
+ "id": "b.carries_on",
32
+ "task": "B_long",
33
+ "scenario": "Handles a long task",
34
+ "label": "Carries on after WhiteRoom saves a summary",
35
+ "observer": "whiteroom"
36
+ },
37
+ {
38
+ "id": "b.no_redo",
39
+ "task": "B_long",
40
+ "scenario": "Handles a long task",
41
+ "label": "Doesn't redo finished work",
42
+ "observer": "records"
43
+ },
44
+ {
45
+ "id": "c.timeout",
46
+ "task": "C_timeout",
47
+ "scenario": "Handles a failing tool",
48
+ "label": "Saves once when a tool times out",
49
+ "observer": "records"
50
+ },
51
+ {
52
+ "id": "c.keeps_failing",
53
+ "task": "C_fail",
54
+ "scenario": "Handles a failing tool",
55
+ "label": "Stops when a tool keeps failing",
56
+ "observer": "records"
57
+ }
58
+ ],
59
+ "taskNames": {
60
+ "A": "Finishes a job correctly",
61
+ "B_base": "Handles a long task (short version)",
62
+ "B_long": "Handles a long task (long version)",
63
+ "C_timeout": "Handles a failing tool (the tool times out)",
64
+ "C_fail": "Handles a failing tool (the tool keeps failing)",
65
+ "controls": "Checks your controls"
66
+ },
67
+ "disclaimer": "Practice tasks use made-up records and WhiteRoom's test tools, not your agent's real job. Use the result to help decide, not as a certificate.",
68
+ "statusLabels": {
69
+ "passed": "Passed",
70
+ "failed": "Failed",
71
+ "not_tested": "Didn't run",
72
+ "unsupported": "Not checked",
73
+ "error": "Test problem (not your agent)"
74
+ },
75
+ "verdictLabels": {
76
+ "passed": "Passed",
77
+ "not_passed": "Didn't pass",
78
+ "incomplete": "Didn't finish"
79
+ },
80
+ "providers": {
81
+ "anthropic": {
82
+ "label": "Anthropic",
83
+ "keyVar": "ANTHROPIC_API_KEY",
84
+ "header": "x-api-key",
85
+ "api": "messages",
86
+ "cloud": false
87
+ },
88
+ "openai": {
89
+ "label": "OpenAI",
90
+ "keyVar": "OPENAI_API_KEY",
91
+ "header": "bearer",
92
+ "api": "chat_completions",
93
+ "cloud": false
94
+ },
95
+ "azure-openai": {
96
+ "label": "Azure OpenAI",
97
+ "keyVar": "AZURE_OPENAI_API_KEY",
98
+ "header": "api-key",
99
+ "api": "chat_completions",
100
+ "cloud": true
101
+ },
102
+ "foundry": {
103
+ "label": "Claude on Azure (Foundry)",
104
+ "keyVar": "ANTHROPIC_FOUNDRY_API_KEY",
105
+ "header": "x-api-key",
106
+ "api": "messages",
107
+ "cloud": true
108
+ },
109
+ "bedrock-mantle": {
110
+ "label": "AWS Bedrock",
111
+ "keyVar": "AWS_BEARER_TOKEN_BEDROCK",
112
+ "header": "bearer",
113
+ "api": "messages",
114
+ "cloud": true
115
+ }
116
+ },
117
+ "allowances": {
118
+ "A": 14,
119
+ "B_base": 15,
120
+ "B_long": 40,
121
+ "C_timeout": 10,
122
+ "C_fail": 10
123
+ },
124
+ "controlCallsMax": 31,
125
+ "controls": {
126
+ "scenario": "Your controls",
127
+ "labels": {
128
+ "model_allowlist": "Model allowlist",
129
+ "call_rate": "Call rate",
130
+ "loop_breaker": "Loop breaker",
131
+ "spend_cap": "Spend cap",
132
+ "tool_list": "Tool list",
133
+ "pause_stop": "Pause and Stop"
134
+ },
135
+ "modes": {
136
+ "enforce": "Enforce",
137
+ "watch": "Watch",
138
+ "off": "Off"
139
+ },
140
+ "limits": {
141
+ "call_rate": 20,
142
+ "loop_breaker": 10
143
+ },
144
+ "agentsMax": 3
145
+ },
146
+ "testProblems": [
147
+ "capture_incomplete",
148
+ "provider_refused",
149
+ "summary_in_baseline",
150
+ "control_unclear"
151
+ ],
152
+ "didntRun": [
153
+ "not_run",
154
+ "no_summary",
155
+ "fault_not_fired"
156
+ ],
157
+ "runCallCap": 120,
158
+ "minutesPerRun": [
159
+ 5,
160
+ 10
161
+ ],
162
+ "fixLines": {
163
+ "over_allowance": "Your agent used more than the {allowance} model calls this practice task allows, so it was stopped. Agents that loop or retry too often do this. Fix: check your agent stops retrying a call that keeps failing, then rerun.",
164
+ "wrong_records": "Your agent didn't act on exactly the records the task asked for. Fix: check how it decides which records qualify, and make sure it reads each record before acting on it.",
165
+ "wrong_fields": "Your agent filled in a record's details wrongly. Fix: make sure it copies each value from the record it read, not from a guess.",
166
+ "duplicate_write": "Your agent saved the same record more than once. Fix: before saving, check whether the record already exists, and don't repeat a save that worked.",
167
+ "no_reference": "Your agent's final answer didn't name the records it changed. Fix: have it list the IDs of the records it acted on in its final answer.",
168
+ "broke_rule": "Your agent approved a claim over the limit the task gave it. Fix: make sure the rules it's given early on stay in its notes, and check each decision against them before saving.",
169
+ "wrong_order": "Your agent's final answer didn't list the records in the order the task asked for. Fix: have it keep the order it was given and report in that order.",
170
+ "redid_work": "Your agent read or saved a record again after it had finished with it. Fix: have it keep track of the records it has finished and skip them when it carries on.",
171
+ "didnt_carry_on": "After WhiteRoom saved a summary, your agent didn't carry on with the task. Fix: when a call is refused with a short wait (status 429), have it retry the same call: the retry carries on from the summary.",
172
+ "key_not_reused": "Your agent changed the operation key when it retried a save, so the save could have happened twice. Fix: create the key once per action and send the same key on every retry.",
173
+ "kept_retrying": "Your agent kept retrying a tool that kept failing. Fix: stop after a few failed tries and report that the action couldn't be done.",
174
+ "claimed_success": "Your agent's final answer didn't say NOT SAVED, as the task asks when the save fails. Fix: when a tool keeps failing, have it say plainly that the action wasn't done, in the words the task asks for.",
175
+ "control_missed": "This rule didn't stop a call it should have. Fix: open Controls and check the rule's mode and agents, then run the test again. If it happens again, contact us.",
176
+ "control_overreach": "This rule stopped a call it shouldn't have: one its mode or agent list doesn't cover. Fix: open Controls and check the rule's mode and the agents it applies to.",
177
+ "control_not_recorded": "This rule let a call through as set, but WhiteRoom didn't record it. Fix: run the test again. If it happens again, contact us.",
178
+ "adapter_exited": "Your adapter stopped before the practice task finished. Fix: run the adapter on its own to see why, then run the test again.",
179
+ "deadline": "Your agent didn't finish this practice task in time. Fix: look for long waits or a loop, then run the test again.",
180
+ "not_run": "This practice task didn't run, so this check couldn't be judged. Rerun this check to try again.",
181
+ "no_summary": "Your agent finished this task before its memory filled up, so we couldn't check that it carries on after a summary. Rerun to try again. If it happens again, contact us with test ID {testId}.",
182
+ "fault_not_fired": "Your agent never tried the save this task needs, so the tool failure it checks never happened. Rerun this check to try again.",
183
+ "capture_incomplete": "Test problem (not your agent): WhiteRoom couldn't save everything it saw during this practice task. Rerun this check to try again.",
184
+ "provider_refused": "Test problem (not your agent): your model provider refused some of the calls. Rerun this check to try again.",
185
+ "summary_in_baseline": "Test problem (not your agent): WhiteRoom saved a summary during a task meant to finish without one. Rerun this check to try again.",
186
+ "control_unclear": "Test problem (not your agent): WhiteRoom couldn't tell what happened to a check call, often because a network limit refused it before it reached WhiteRoom. Run the test from another network if you can. Rerun this check to try again."
187
+ },
188
+ "keyRefusals": {
189
+ "engine_access_key": "This key uses WhiteRoom's own cloud access, so there's no key of yours to test with. Add a provider key on Fleet key, then pick it.",
190
+ "other_host": "This key sends its calls to a host other than its provider's own. Practice tests don't support that.",
191
+ "unsupported_provider": "Practice tests don't support this key's provider.",
192
+ "short_term_key": "This is a short-term Bedrock key, which expires within hours. Add a long-term Bedrock API key on Fleet key, then start a new test and pick it.",
193
+ "bedrock_role": "This fleet reaches AWS Bedrock through an IAM role, which practice tests don't support.",
194
+ "key_not_found": "That key isn't on Fleet key any more. Pick another key.",
195
+ "model_required": "Enter the model your agent uses: the deployment name on Azure, or a Bedrock model ID like anthropic.claude-haiku-4-5."
196
+ }
197
+ }
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { WhiteRoomClient, WhiteRoomError } from "@whiteroom-ai/sdk";
2
+ import { parseArgs } from "./legacy-args.js";
3
3
  const USAGE = `whiteroom — CLI for WhiteRoom agent governance
4
4
 
5
5
  Usage:
@@ -15,31 +15,28 @@ Usage:
15
15
  whiteroom report [--fleet <id>]
16
16
  whiteroom fleets
17
17
  whiteroom login <fleet_token>
18
+ whiteroom practice run [--adapter "<command>"] [--key-env <VAR>] [--code-stdin]
19
+ whiteroom practice adapter --lang js|python
18
20
 
19
21
  Options:
20
22
  --url <base_url> Server URL (default: WHITEROOM_URL or http://localhost:3000)
21
23
  --key <api_key> API key (default: WHITEROOM_API_KEY)
22
24
  `;
23
- function parseArgs(argv) {
24
- const args = [];
25
- const flags = {};
26
- for (let i = 0; i < argv.length; i++) {
27
- if (argv[i].startsWith("--") && i + 1 < argv.length) {
28
- flags[argv[i].slice(2)] = argv[++i];
29
- }
30
- else {
31
- args.push(argv[i]);
32
- }
33
- }
34
- return { args, flags };
35
- }
36
25
  async function main() {
37
- const { args, flags } = parseArgs(process.argv.slice(2));
26
+ const argv = process.argv.slice(2);
27
+ // Practice tests never load the SDK (spec §9.5): plain fetch only.
28
+ if (argv[0] === "practice" || argv[0] === "readiness") {
29
+ const { practice } = await import("./practice/index.js");
30
+ process.exitCode = await practice(argv.slice(1));
31
+ return;
32
+ }
33
+ const { args, flags } = parseArgs(argv);
38
34
  const command = args[0];
39
35
  if (!command || command === "help" || command === "--help") {
40
36
  console.log(USAGE);
41
37
  process.exit(0);
42
38
  }
39
+ const { WhiteRoomClient, WhiteRoomError } = await import("@whiteroom-ai/sdk");
43
40
  const client = new WhiteRoomClient({
44
41
  baseUrl: flags.url ?? process.env.WHITEROOM_URL ?? "http://localhost:3000",
45
42
  apiKey: flags.key ?? process.env.WHITEROOM_API_KEY,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEpE,MAAM,KAAK,GAAG;;;;;;;;;;;;;;;;;;;CAmBb,CAAC;AAEF,SAAS,SAAS,CAAC,IAAc;IAC/B,MAAM,IAAI,GAAa,EAAE,CAAC;IAC1B,MAAM,KAAK,GAA2B,EAAE,CAAC;IACzC,KAAK,IAAI,CAA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,CAAC;gBACnC,KAAK,CAAC,MAAM,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;gBACxC,MAAM;YAER;gBACE,OAAO,CAAC,KAAK,CAAC,oBAAoB,OAAO,IAAI,CAAC,CAAC;gBAC/C,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;gBACnB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACpB,CAAC;IACH,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,IAAI,CAAC,YAAY,cAAc,EAAE,CAAC;YAChC,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;YACjD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QACD,MAAM,CAAC,CAAC;IACV,CAAC;AACH,CAAC;AAED,SAAS,UAAU,CAAC,KAAyB,EAAE,IAAY;IACzD,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,CAAC,KAAK,CAAC,+BAA+B,IAAI,GAAG,CAAC,CAAC;QACtD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC;AAED,SAAS,KAAK,CAAC,IAAa;IAC1B,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;AAC7C,CAAC;AAED,IAAI,EAAE,CAAC"}
@@ -0,0 +1,4 @@
1
+ export declare function parseArgs(argv: string[]): {
2
+ args: string[];
3
+ flags: Record<string, string>;
4
+ };
@@ -0,0 +1,17 @@
1
+ // The fleet commands' argument parser, unchanged from before practice tests:
2
+ // every `--name` takes the next word as its value, whatever it looks like.
3
+ // (Practice commands use node:util parseArgs instead.)
4
+ export function parseArgs(argv) {
5
+ const args = [];
6
+ const flags = {};
7
+ for (let i = 0; i < argv.length; i++) {
8
+ if (argv[i].startsWith("--") && i + 1 < argv.length) {
9
+ flags[argv[i].slice(2)] = argv[++i];
10
+ }
11
+ else {
12
+ args.push(argv[i]);
13
+ }
14
+ }
15
+ return { args, flags };
16
+ }
17
+ //# sourceMappingURL=legacy-args.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"legacy-args.js","sourceRoot":"","sources":["../src/legacy-args.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,2EAA2E;AAC3E,uDAAuD;AACvD,MAAM,UAAU,SAAS,CAAC,IAAc;IACtC,MAAM,IAAI,GAAa,EAAE,CAAC;IAC1B,MAAM,KAAK,GAA2B,EAAE,CAAC;IACzC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;YACpD,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;QACtC,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QACrB,CAAC;IACH,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;AACzB,CAAC"}
@@ -0,0 +1,59 @@
1
+ import { type ChildProcess } from "node:child_process";
2
+ export declare const MAX_LINE_BYTES: number;
3
+ export declare const MAX_TOOL_CALLS = 200;
4
+ /** A tool call's request to WhiteRoom must fit its 64 KiB body limit. */
5
+ export declare const MAX_TOOL_BODY_BYTES: number;
6
+ /** After SIGTERM, how long the group has before SIGKILL. */
7
+ export declare const KILL_GRACE_MS = 5000;
8
+ /** How to start the adapter: the user's own command through a shell, or the sample agent. */
9
+ export type Launch = {
10
+ shell: string;
11
+ } | {
12
+ file: string;
13
+ args: string[];
14
+ };
15
+ export interface ToolCall {
16
+ id: string;
17
+ name: string;
18
+ input: unknown;
19
+ }
20
+ /** How a practice task's adapter run ended. */
21
+ export type Outcome = {
22
+ kind: "final";
23
+ output: string;
24
+ } | {
25
+ kind: "exited";
26
+ how: string;
27
+ tail: string[];
28
+ } | {
29
+ kind: "broke";
30
+ why: string;
31
+ } | {
32
+ kind: "deadline";
33
+ } | {
34
+ kind: "stopped";
35
+ }
36
+ /** The CLI's tool callback ended the task (restart, deadline, session over). */
37
+ | {
38
+ kind: "ended";
39
+ by: unknown;
40
+ };
41
+ export type ToolAnswer = {
42
+ result: unknown;
43
+ } | {
44
+ end: unknown;
45
+ };
46
+ /** The adapter's environment: the CLI's, minus WhiteRoom's settings and every provider key, with only the run's key added. */
47
+ export declare function childEnv(parent: NodeJS.ProcessEnv, keyVar: string, key: string): NodeJS.ProcessEnv;
48
+ /** SIGTERM to the adapter's whole process group, then SIGKILL if anything is left after KILL_GRACE_MS. */
49
+ export declare function killGroup(child: ChildProcess): Promise<void>;
50
+ export interface RunOptions {
51
+ launch: Launch;
52
+ env: NodeJS.ProcessEnv;
53
+ /** The first line the adapter reads. */
54
+ message: unknown;
55
+ deadline: number;
56
+ signal: AbortSignal;
57
+ tool: (call: ToolCall) => Promise<ToolAnswer>;
58
+ }
59
+ export declare function runAdapter(o: RunOptions): Promise<Outcome>;
@@ -0,0 +1,169 @@
1
+ // Runs one practice task through the adapter (spec §5 Agents, §9.4): one
2
+ // child per task in its own process group, NDJSON over stdin/stdout, the
3
+ // provider key in its environment and nothing of WhiteRoom's. Stderr is
4
+ // passed through; stdout that isn't JSON is shown here and never uploaded.
5
+ import { spawn } from "node:child_process";
6
+ import { isKeyVar } from "./preflight.js";
7
+ import { clean, say } from "./text.js";
8
+ export const MAX_LINE_BYTES = 1024 * 1024;
9
+ export const MAX_TOOL_CALLS = 200;
10
+ /** A tool call's request to WhiteRoom must fit its 64 KiB body limit. */
11
+ export const MAX_TOOL_BODY_BYTES = 64 * 1024;
12
+ /** After SIGTERM, how long the group has before SIGKILL. */
13
+ export const KILL_GRACE_MS = 5_000;
14
+ /** The adapter's environment: the CLI's, minus WhiteRoom's settings and every provider key, with only the run's key added. */
15
+ export function childEnv(parent, keyVar, key) {
16
+ const env = {};
17
+ for (const [k, v] of Object.entries(parent)) {
18
+ if (!/^WHITEROOM_/i.test(k) && !isKeyVar(k))
19
+ env[k] = v;
20
+ }
21
+ env[keyVar] = key;
22
+ return env;
23
+ }
24
+ const live = new Set();
25
+ const groupAlive = (pid) => {
26
+ try {
27
+ process.kill(-pid, 0);
28
+ return true;
29
+ }
30
+ catch {
31
+ return false;
32
+ }
33
+ };
34
+ const signalGroup = (pid, sig) => {
35
+ try {
36
+ process.kill(-pid, sig);
37
+ }
38
+ catch {
39
+ // Already gone.
40
+ }
41
+ };
42
+ /** SIGTERM to the adapter's whole process group, then SIGKILL if anything is left after KILL_GRACE_MS. */
43
+ export async function killGroup(child) {
44
+ const pid = child.pid;
45
+ if (!pid) {
46
+ live.delete(child); // Never started: nothing to kill.
47
+ return;
48
+ }
49
+ signalGroup(pid, "SIGTERM");
50
+ const until = Date.now() + KILL_GRACE_MS;
51
+ while (groupAlive(pid) && Date.now() < until)
52
+ await new Promise((r) => setTimeout(r, 100));
53
+ if (groupAlive(pid))
54
+ signalGroup(pid, "SIGKILL");
55
+ // Only now: if the CLI exits during the grace period, the exit handler still SIGKILLs the group.
56
+ live.delete(child);
57
+ }
58
+ // Whatever happens to the CLI, no adapter outlives it.
59
+ process.on("exit", () => {
60
+ for (const c of live)
61
+ if (c.pid)
62
+ signalGroup(c.pid, "SIGKILL");
63
+ });
64
+ /** Calls `onLine` per line; a line over MAX_LINE_BYTES calls `onTooLong` instead and drops the rest of the stream. */
65
+ function readLines(stream, onLine, onTooLong) {
66
+ let buf = "";
67
+ let over = false;
68
+ stream.setEncoding("utf8");
69
+ stream.on("data", (chunk) => {
70
+ if (over)
71
+ return;
72
+ buf += chunk;
73
+ const tooLong = () => {
74
+ over = true;
75
+ buf = "";
76
+ onTooLong();
77
+ };
78
+ for (let i = buf.indexOf("\n"); i >= 0; i = buf.indexOf("\n")) {
79
+ const line = buf.slice(0, i).replace(/\r$/, "");
80
+ buf = buf.slice(i + 1);
81
+ if (Buffer.byteLength(line) > MAX_LINE_BYTES)
82
+ return tooLong();
83
+ onLine(line);
84
+ }
85
+ if (Buffer.byteLength(buf) > MAX_LINE_BYTES)
86
+ tooLong();
87
+ });
88
+ stream.on("end", () => {
89
+ if (buf && !over)
90
+ onLine(buf);
91
+ });
92
+ }
93
+ export function runAdapter(o) {
94
+ const child = "shell" in o.launch
95
+ ? spawn(o.launch.shell, { shell: true, detached: true, stdio: ["pipe", "pipe", "pipe"], env: o.env })
96
+ : spawn(o.launch.file, o.launch.args, { detached: true, stdio: ["pipe", "pipe", "pipe"], env: o.env });
97
+ live.add(child);
98
+ const tail = [];
99
+ let toolCalls = 0;
100
+ let settled = false;
101
+ // Lines are handled one at a time, in order: a tool call finishes before the next line is read.
102
+ let chain = Promise.resolve();
103
+ return new Promise((resolve) => {
104
+ const finish = (out) => {
105
+ if (settled)
106
+ return;
107
+ settled = true;
108
+ clearTimeout(timer);
109
+ o.signal.removeEventListener("abort", onAbort);
110
+ void killGroup(child).then(() => resolve(out));
111
+ };
112
+ const onAbort = () => finish({ kind: "stopped" });
113
+ // setTimeout fires at once past 2^31-1 ms, so a far deadline is clamped.
114
+ const timer = setTimeout(() => finish({ kind: "deadline" }), Math.min(2 ** 31 - 1, Math.max(0, o.deadline - Date.now())));
115
+ o.signal.addEventListener("abort", onAbort, { once: true });
116
+ if (o.signal.aborted)
117
+ onAbort();
118
+ const write = (msg) => {
119
+ if (!settled)
120
+ child.stdin.write(JSON.stringify(msg) + "\n");
121
+ };
122
+ child.stdin.on("error", () => { }); // The adapter closed stdin: its exit is reported below.
123
+ child.on("error", (err) => finish({ kind: "exited", how: err.message, tail }));
124
+ const handle = async (line) => {
125
+ if (settled || !line.trim())
126
+ return;
127
+ let msg;
128
+ try {
129
+ msg = JSON.parse(line);
130
+ }
131
+ catch {
132
+ say(` adapter: ${line}`);
133
+ return;
134
+ }
135
+ if (!msg || typeof msg !== "object" || Array.isArray(msg))
136
+ return say(` adapter: ${line}`);
137
+ if (msg.type === "final") {
138
+ return finish({ kind: "final", output: typeof msg.output === "string" ? msg.output : JSON.stringify(msg.output ?? null) });
139
+ }
140
+ if (msg.type !== "tool_call")
141
+ return finish({ kind: "broke", why: "sent a message the CLI doesn't know" });
142
+ const { id, name, input } = msg;
143
+ if (typeof id !== "string" || !id || id.length > 128 || typeof name !== "string" || !name || name.length > 64) {
144
+ return finish({ kind: "broke", why: "sent a tool call without a valid id and name" });
145
+ }
146
+ if (++toolCalls > MAX_TOOL_CALLS)
147
+ return finish({ kind: "broke", why: `made more than ${MAX_TOOL_CALLS} tool calls in one practice task` });
148
+ if (Buffer.byteLength(JSON.stringify(input ?? null)) > MAX_TOOL_BODY_BYTES - 512) {
149
+ return finish({ kind: "broke", why: "sent a tool call bigger than 64 KiB" });
150
+ }
151
+ const answer = await o.tool({ id, name, input: input ?? null });
152
+ if ("end" in answer)
153
+ return finish({ kind: "ended", by: answer.end });
154
+ write({ type: "tool_result", id, result: answer.result });
155
+ };
156
+ readLines(child.stdout, (l) => { chain = chain.then(() => handle(l)).then(() => { }); }, () => finish({ kind: "broke", why: "sent a line longer than 1 MiB" }));
157
+ readLines(child.stderr, (l) => {
158
+ process.stderr.write(clean(l) + "\n");
159
+ tail.push(clean(l).slice(0, 500));
160
+ if (tail.length > 5)
161
+ tail.shift();
162
+ }, () => { });
163
+ child.on("close", (code, sig) => {
164
+ chain = chain.then(() => finish({ kind: "exited", how: sig ? `stopped by ${sig}` : `exit code ${code}`, tail }));
165
+ });
166
+ write(o.message);
167
+ });
168
+ }
169
+ //# sourceMappingURL=adapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapter.js","sour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AC,CAAC;QACb,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE;YAC9B,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,cAAc,GAAG,EAAE,CAAC,CAAC,CAAC,aAAa,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QACnH,CAAC,CAAC,CAAC;QACH,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;IACnB,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,16 @@
1
+ /** A provider's name, its key's variable, the header the key travels in (`bearer`: Authorization: Bearer) and its API. */
2
+ export interface ProviderInfo {
3
+ label: string;
4
+ keyVar: string;
5
+ header: "x-api-key" | "api-key" | "bearer";
6
+ api: "messages" | "chat_completions";
7
+ }
8
+ export declare const CATALOG: {
9
+ taskNames: Record<string, string>;
10
+ disclaimer: string;
11
+ providers: Record<string, ProviderInfo>;
12
+ keyRefusals: Record<string, string>;
13
+ runCallCap: number;
14
+ statusLabels: Record<"passed" | "failed" | "not_tested" | "unsupported" | "error", string>;
15
+ verdictLabels: Record<"passed" | "not_passed" | "incomplete", string>;
16
+ };
@@ -0,0 +1,6 @@
1
+ // The engine's practice-test catalog (contract/catalog.json): the CLI ships it
2
+ // and the dashboard imports the same file, so task, status, provider and
3
+ // refusal words are the engine's. Refreshed by scripts/sync-practice-contract.sh.
4
+ import { readFileSync } from "node:fs";
5
+ export const CATALOG = JSON.parse(readFileSync(new URL("../../contract/catalog.json", import.meta.url), "utf8"));
6
+ //# sourceMappingURL=catalog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalog.js","sourceRoot":"","sources":["../../src/practice/catalog.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,yEAAyE;AACzE,kFAAkF;AAElF,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAKvC,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,GAAG,CAAC,6BAA6B,EAAE,OAAO,IAAI,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,CAG9G,CAAC"}