@hue-run/sdk 0.5.0 → 0.5.1
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/CLI.md +15 -12
- package/ENVIRONMENTS.md +1 -1
- package/EVALUATIONS.md +1 -1
- package/README.md +2 -2
- package/dist/cli/eval.js +3 -3
- package/dist/cli/login.d.ts +1 -1
- package/dist/cli/login.js +84 -52
- package/dist/evals/client.d.ts +1 -1
- package/dist/evals/client.js +1 -1
- package/dist/evals/scenarios.d.ts +2 -2
- package/dist/evals/scenarios.js +2 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/CLI.md
CHANGED
|
@@ -42,7 +42,7 @@ project manifest are refused because managers can update ancestor locks; Python
|
|
|
42
42
|
The generated `hue.setup.mjs` or `hue_setup.py` always selects `captureContent: false` /
|
|
43
43
|
`capture_content=False`. For a supported application, setup installs the dependency and adds the
|
|
44
44
|
managed import and middleware registration to the existing entrypoint; an unreferenced helper is
|
|
45
|
-
not a completed integration. TypeScript uses `@hue-run/sdk@0.5.
|
|
45
|
+
not a completed integration. TypeScript uses `@hue-run/sdk@0.5.1`, `@opentelemetry/api@1.9.1` and
|
|
46
46
|
`@opentelemetry/context-async-hooks@2.11.0`; Python uses published `hue-run==0.2.2`.
|
|
47
47
|
Content capture requires an ordinary account-managed key and a later explicit application decision.
|
|
48
48
|
|
|
@@ -145,14 +145,17 @@ handoff does not create a trial, reset quota or rerun business work.
|
|
|
145
145
|
`hue login` stores keys that a person creates in Hue; it never mints one, because setup
|
|
146
146
|
credentials are deliberately isolated from ordinary project keys. It prints the key settings page
|
|
147
147
|
(`<origin>/settings/integrations`, opened in a browser only when a terminal is attached and
|
|
148
|
-
`--no-browser` is absent), then reads
|
|
149
|
-
|
|
150
|
-
`
|
|
151
|
-
MCP `tools/list` request
|
|
152
|
-
`
|
|
148
|
+
`--no-browser` is absent), then reads one **Read and write** key from stdin without echo. By
|
|
149
|
+
default that single key serves both uses: it is checked with `GET /api/v1/projects/current` and
|
|
150
|
+
`GET /api/v1/datasets` (a **Read** or **Tracing only** key is refused because it cannot use
|
|
151
|
+
evaluations) and with an MCP `tools/list` request, then stored as `HUE_API_KEY` with
|
|
152
|
+
`HUE_BASE_URL` and `HUE_MCP_KEY` with `HUE_MCP_URL` in one write. A rejected key (`401` or `403`)
|
|
153
|
+
exits `1` and stores nothing. `--keys evaluations` stores only `HUE_API_KEY`; `--keys coding-agent`
|
|
154
|
+
stores only `HUE_MCP_KEY` and also accepts a **Read** key, for an agent that should only inspect the
|
|
155
|
+
project. Run them separately with different keys if you want to revoke either use alone.
|
|
153
156
|
|
|
154
157
|
```sh
|
|
155
|
-
hue login # both
|
|
158
|
+
hue login # one key for both uses into ./.env.hue
|
|
156
159
|
hue login --keys coding-agent --gitignore # only HUE_MCP_KEY; add .env.hue to .gitignore
|
|
157
160
|
hue login --origin https://staging.hue.run --env-file .env.staging
|
|
158
161
|
```
|
|
@@ -163,7 +166,7 @@ replaced only with `--force`. Empty values, whitespace and URLs are refused befo
|
|
|
163
166
|
The MCP endpoint is `https://mcp.hue.run/mcp` for `https://app.hue.run`,
|
|
164
167
|
`https://mcp.staging.hue.run/mcp` for `https://staging.hue.run` and `<origin>/api/mcp` otherwise;
|
|
165
168
|
plain HTTP origins are accepted for loopback test servers only. Output names variables and lengths
|
|
166
|
-
(`Stored
|
|
169
|
+
(`Stored the key (NN chars) as HUE_API_KEY and HUE_MCP_KEY`), never values. When git does not ignore the env file, the command
|
|
167
170
|
warns; `--gitignore` appends the file name to the `.gitignore` next to it. Exit codes: `0` stored,
|
|
168
171
|
`1` failed, `2` usage error, `130` interrupted.
|
|
169
172
|
|
|
@@ -297,7 +300,7 @@ node packages/sdk-typescript/scripts/verify-package.mjs --artifacts-dir .artifac
|
|
|
297
300
|
# Set project to an existing supported fixture; use the same directory on resume.
|
|
298
301
|
project=/absolute/path/to/supported-fixture
|
|
299
302
|
node packages/sdk-typescript/scripts/verify-setup-live.mjs \
|
|
300
|
-
--archive .artifacts/typescript/hue-run-sdk-0.5.
|
|
303
|
+
--archive .artifacts/typescript/hue-run-sdk-0.5.1.tgz \
|
|
301
304
|
--origin https://STAGING_ORIGIN \
|
|
302
305
|
--project "$project" --command setup \
|
|
303
306
|
--evidence .context/setup-staging-before-claim.json
|
|
@@ -308,7 +311,7 @@ the private local handoff and finish the real browser claim, then reconcile the
|
|
|
308
311
|
|
|
309
312
|
```sh
|
|
310
313
|
node packages/sdk-typescript/scripts/verify-setup-live.mjs \
|
|
311
|
-
--archive .artifacts/typescript/hue-run-sdk-0.5.
|
|
314
|
+
--archive .artifacts/typescript/hue-run-sdk-0.5.1.tgz \
|
|
312
315
|
--origin https://STAGING_ORIGIN \
|
|
313
316
|
--project "$project" --command claim \
|
|
314
317
|
--evidence .context/setup-staging-after-claim.json
|
|
@@ -336,8 +339,8 @@ the same version to `latest`, and clean-project literal `@latest` smoke remain s
|
|
|
336
339
|
and prints Hue's verdicts. It is the command-line form of `runSimulation()` (one-shot) and
|
|
337
340
|
`runLocalAgent()` (worker): the agent, its prompts and its provider credentials stay in the local
|
|
338
341
|
process, Hue creates one isolated simulated world per case, and Hue-owned outcome checks grade
|
|
339
|
-
the sealed world. Hue never executes the agent. `HUE_API_KEY` must be a **
|
|
340
|
-
|
|
342
|
+
the sealed world. Hue never executes the agent. `HUE_API_KEY` must be a **Read and
|
|
343
|
+
write** project key (a **Read** or **Tracing only** key cannot read Scenarios or create experiments);
|
|
341
344
|
the CLI never prints it. The optional `zod` peer of `@hue-run/sdk/evals` must be installed.
|
|
342
345
|
|
|
343
346
|
Write an adapter module that hands the case inputs and the world's tools or MCP connection to
|
package/ENVIRONMENTS.md
CHANGED
|
@@ -66,7 +66,7 @@ to the callback and is never written to checkpoints.
|
|
|
66
66
|
published immutable pins, such as a Scenario's frozen case and Hue-owned outcome checks or a saved
|
|
67
67
|
eval set with explicitly chosen scorer versions. `resolveScenarioPins(client, selector)` reads
|
|
68
68
|
those pins from a Scenario ID, its Hue URL or its name (`listScenarios` and `getScenario` expose
|
|
69
|
-
the underlying reads; a
|
|
69
|
+
the underlying reads; a Read and write key is required), and `resolveEvalSetPins`
|
|
70
70
|
resolves an eval set to its latest saved version. `runSimulation` creates the experiment directly
|
|
71
71
|
(`name` defaults to the dataset name, `config` to `{}`) and binds the pins and configuration into
|
|
72
72
|
the checkpoint identity, so resuming with different pins is refused like the other kinds.
|
package/EVALUATIONS.md
CHANGED
|
@@ -9,7 +9,7 @@ npm install @hue-run/sdk zod
|
|
|
9
9
|
|
|
10
10
|
The SDK executes targets and scorers on your machine. Hue stores pinned definitions, experiment progress and results. It does not execute uploaded source code. Follow the [installation guide](https://docs.hue.run/installation) to add `@hue-run/sdk` to your application.
|
|
11
11
|
|
|
12
|
-
Create a **
|
|
12
|
+
Create a **Read and write** project service key under **Settings → Integrations & API keys** and expose it to this server-side process as `HUE_API_KEY`. A **Tracing only** key cannot author datasets or evaluation runs.
|
|
13
13
|
|
|
14
14
|
```ts
|
|
15
15
|
import { randomUUID } from "node:crypto";
|
package/README.md
CHANGED
|
@@ -448,8 +448,8 @@ The unreleased `hue eval` command wraps `runSimulation()` and `runLocalAgent()`
|
|
|
448
448
|
file or a shell command: `hue eval --scenario "<name>" ./hue-agent.ts` creates a fresh experiment
|
|
449
449
|
from a published Scenario's immutable pins, runs the agent in one isolated world per case, waits
|
|
450
450
|
for Hue's outcome checks and prints the run URL and per-case PASS/FAIL verdicts with an exit code;
|
|
451
|
-
`--worker` registers the same adapter for runs launched from Hue. It needs a
|
|
452
|
-
|
|
451
|
+
`--worker` registers the same adapter for runs launched from Hue. It needs a Read and
|
|
452
|
+
write key in `HUE_API_KEY` (never printed) and keeps content capture off unless `--content`
|
|
453
453
|
is passed. See [Evaluate an agent against a Scenario](CLI.md#evaluate-an-agent-against-a-scenario).
|
|
454
454
|
Eval sets whose cases pin files instead of a world run as direct cases through `runExperiment()`:
|
|
455
455
|
`hue eval --set <slug> --scorer <slug> --command "…"` hands the agent each case's pinned files in a
|
package/dist/cli/eval.js
CHANGED
|
@@ -63,7 +63,7 @@ Output and limits:
|
|
|
63
63
|
--wait <seconds> Verdict wait after the run finishes (default: 300)
|
|
64
64
|
-h, --help Show this help
|
|
65
65
|
|
|
66
|
-
HUE_API_KEY must be a "
|
|
66
|
+
HUE_API_KEY must be a "Read and write" project key; it is never printed.
|
|
67
67
|
Code evaluators pinned to a direct run are graded by Hue's executor after the upload; the wait
|
|
68
68
|
covers them. Exit codes: 0 every case passed, 1 a case failed, errored or is incomplete,
|
|
69
69
|
2 usage error, 130 interrupted.
|
|
@@ -414,7 +414,7 @@ function redact(message, secrets) {
|
|
|
414
414
|
}
|
|
415
415
|
function explain(error) {
|
|
416
416
|
if (error instanceof HueApiError && (error.status === 401 || error.status === 403))
|
|
417
|
-
return `${error.message}. Check that HUE_API_KEY is a "
|
|
417
|
+
return `${error.message}. Check that HUE_API_KEY is a "Read and write" project key for this origin.`;
|
|
418
418
|
if (error instanceof Error) {
|
|
419
419
|
const causes = [];
|
|
420
420
|
let cause = error.cause;
|
|
@@ -933,7 +933,7 @@ export async function runEvalCommand(argv) {
|
|
|
933
933
|
}
|
|
934
934
|
const apiKey = process.env.HUE_API_KEY?.trim();
|
|
935
935
|
if (!apiKey)
|
|
936
|
-
throw new UsageError('HUE_API_KEY is required: a "
|
|
936
|
+
throw new UsageError('HUE_API_KEY is required: a "Read and write" project key, set in the environment or an ignored --env-file');
|
|
937
937
|
secrets.push(apiKey);
|
|
938
938
|
const baseUrl = values.origin ?? process.env.HUE_BASE_URL?.trim() ?? "https://app.hue.run";
|
|
939
939
|
const connection = { apiKey, baseUrl };
|
package/dist/cli/login.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export interface LoginCommandIo {
|
|
|
14
14
|
fetch?: typeof fetch;
|
|
15
15
|
openBrowser?: (url: string) => Promise<boolean>;
|
|
16
16
|
}
|
|
17
|
-
export declare const LOGIN_USAGE = "Usage: hue login [--origin URL] [--env-file PATH] [--keys evaluations|coding-agent|both]\n [--no-browser] [--force] [--gitignore]\n\nStore
|
|
17
|
+
export declare const LOGIN_USAGE = "Usage: hue login [--origin URL] [--env-file PATH] [--keys evaluations|coding-agent|both]\n [--no-browser] [--force] [--gitignore]\n\nStore the key you created in Hue in a private env file. By default one \"Read and write\" key serves\nboth evaluations (HUE_API_KEY) and your coding agent (HUE_MCP_KEY); it is validated against Hue\nbefore it is stored, and key values are never printed.\n\nOptions:\n --origin URL Hue origin (default https://app.hue.run)\n --env-file PATH Env file to write (default .env.hue in the current directory)\n --keys KIND evaluations (HUE_API_KEY), coding-agent (HUE_MCP_KEY) or both from one key\n (default both)\n --no-browser Do not open the key settings page in a browser\n --force Replace an existing different value in the env file\n --gitignore Add the env file to .gitignore when a git repository does not ignore it\n -h, --help Show this help";
|
|
18
18
|
/** Hue MCP endpoint that pairs with an application origin. */
|
|
19
19
|
export declare function mcpUrlForOrigin(origin: string): string;
|
|
20
20
|
/** Normalizes a Hue origin: HTTPS, or HTTP for loopback only; no credentials, path, query or hash. */
|
package/dist/cli/login.js
CHANGED
|
@@ -19,24 +19,26 @@ const KEY_KINDS = {
|
|
|
19
19
|
evaluations: {
|
|
20
20
|
variable: "HUE_API_KEY",
|
|
21
21
|
urlVariable: "HUE_BASE_URL",
|
|
22
|
-
preset: "Tracing and evaluations",
|
|
23
22
|
},
|
|
24
23
|
"coding-agent": {
|
|
25
24
|
variable: "HUE_MCP_KEY",
|
|
26
25
|
urlVariable: "HUE_MCP_URL",
|
|
27
|
-
preset: "Coding agent (read + evaluations)",
|
|
28
26
|
},
|
|
29
27
|
};
|
|
28
|
+
/** Settings preset that authorizes both evaluations and the coding agent's MCP reads and writes. */
|
|
29
|
+
const KEY_PRESET = "Read and write";
|
|
30
30
|
export const LOGIN_USAGE = `Usage: hue login [--origin URL] [--env-file PATH] [--keys evaluations|coding-agent|both]
|
|
31
31
|
[--no-browser] [--force] [--gitignore]
|
|
32
32
|
|
|
33
|
-
Store
|
|
34
|
-
|
|
33
|
+
Store the key you created in Hue in a private env file. By default one "Read and write" key serves
|
|
34
|
+
both evaluations (HUE_API_KEY) and your coding agent (HUE_MCP_KEY); it is validated against Hue
|
|
35
|
+
before it is stored, and key values are never printed.
|
|
35
36
|
|
|
36
37
|
Options:
|
|
37
38
|
--origin URL Hue origin (default ${DEFAULT_ORIGIN})
|
|
38
39
|
--env-file PATH Env file to write (default ${DEFAULT_ENV_FILE} in the current directory)
|
|
39
|
-
--keys KIND evaluations (HUE_API_KEY), coding-agent (HUE_MCP_KEY) or both
|
|
40
|
+
--keys KIND evaluations (HUE_API_KEY), coding-agent (HUE_MCP_KEY) or both from one key
|
|
41
|
+
(default both)
|
|
40
42
|
--no-browser Do not open the key settings page in a browser
|
|
41
43
|
--force Replace an existing different value in the env file
|
|
42
44
|
--gitignore Add the env file to .gitignore when a git repository does not ignore it
|
|
@@ -216,7 +218,10 @@ async function readBoundedText(response) {
|
|
|
216
218
|
function isRecord(value) {
|
|
217
219
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
218
220
|
}
|
|
219
|
-
/**
|
|
221
|
+
/**
|
|
222
|
+
* Mirrors `checkConnection()` with `GET /api/v1/projects/current`, then confirms evaluation access
|
|
223
|
+
* with `GET /api/v1/datasets`. No redirects are followed.
|
|
224
|
+
*/
|
|
220
225
|
async function checkEvaluationsKey(fetchImpl, origin, apiKey) {
|
|
221
226
|
let response;
|
|
222
227
|
try {
|
|
@@ -246,15 +251,44 @@ async function checkEvaluationsKey(fetchImpl, origin, apiKey) {
|
|
|
246
251
|
detail: `Hue answered HTTP ${response.status} while checking the evaluations key.`,
|
|
247
252
|
};
|
|
248
253
|
}
|
|
254
|
+
let projectName;
|
|
249
255
|
try {
|
|
250
256
|
const project = JSON.parse(await readBoundedText(response));
|
|
251
257
|
if (!isRecord(project) || typeof project.name !== "string")
|
|
252
258
|
throw new Error("Invalid project");
|
|
253
|
-
|
|
259
|
+
projectName = project.name;
|
|
254
260
|
}
|
|
255
261
|
catch {
|
|
256
262
|
return { ok: false, rejected: false, detail: "Hue returned an unexpected project response." };
|
|
257
263
|
}
|
|
264
|
+
// Every valid key reaches the project check; only a key with write access can list eval sets,
|
|
265
|
+
// so a Read or Tracing only key is refused here instead of failing later in `hue eval`.
|
|
266
|
+
let evaluations;
|
|
267
|
+
try {
|
|
268
|
+
evaluations = await fetchImpl(`${origin}/api/v1/datasets`, {
|
|
269
|
+
method: "GET",
|
|
270
|
+
headers: { authorization: `Bearer ${apiKey}`, accept: "application/json" },
|
|
271
|
+
redirect: "error",
|
|
272
|
+
signal: AbortSignal.timeout(REQUEST_TIMEOUT_MILLIS),
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
catch {
|
|
276
|
+
return { ok: false, rejected: false, detail: `Could not reach ${origin}.` };
|
|
277
|
+
}
|
|
278
|
+
await evaluations.body?.cancel();
|
|
279
|
+
if (evaluations.status === 401 || evaluations.status === 403)
|
|
280
|
+
return {
|
|
281
|
+
ok: false,
|
|
282
|
+
rejected: true,
|
|
283
|
+
detail: `This key cannot use evaluations (HTTP ${evaluations.status}); it is a Read or Tracing only key.`,
|
|
284
|
+
};
|
|
285
|
+
if (!evaluations.ok)
|
|
286
|
+
return {
|
|
287
|
+
ok: false,
|
|
288
|
+
rejected: false,
|
|
289
|
+
detail: `Hue answered HTTP ${evaluations.status} while checking evaluation access.`,
|
|
290
|
+
};
|
|
291
|
+
return { ok: true, detail: projectName };
|
|
258
292
|
}
|
|
259
293
|
/** Reads JSON-RPC messages from a JSON body or a `text/event-stream` body. */
|
|
260
294
|
function parseJsonRpcMessages(text, contentType) {
|
|
@@ -574,6 +608,9 @@ export async function runLoginCommand(argv, io = {}) {
|
|
|
574
608
|
if (keysOption !== "evaluations" && keysOption !== "coding-agent" && keysOption !== "both")
|
|
575
609
|
return fail(`--keys must be evaluations, coding-agent or both.\n\n${LOGIN_USAGE}`, 2);
|
|
576
610
|
const kinds = keysOption === "both" ? ["evaluations", "coding-agent"] : [keysOption];
|
|
611
|
+
// Every requested variable comes from one pasted key: the same "Read and write" preset serves
|
|
612
|
+
// evaluations and the coding agent, so asking twice would only add a step.
|
|
613
|
+
const variables = kinds.map((kind) => KEY_KINDS[kind].variable).join(" and ");
|
|
577
614
|
const origin = parseHueOrigin(parsed.values.origin ?? DEFAULT_ORIGIN);
|
|
578
615
|
if (!origin)
|
|
579
616
|
return fail("--origin must be an HTTPS origin such as https://app.hue.run (plain HTTP is accepted for loopback test servers only).", 2);
|
|
@@ -588,10 +625,9 @@ export async function runLoginCommand(argv, io = {}) {
|
|
|
588
625
|
return fail(error.message);
|
|
589
626
|
}
|
|
590
627
|
const settingsUrl = `${origin}${KEY_SETTINGS_PATH}`;
|
|
591
|
-
out("Hue keys are created in the app; this command validates and stores
|
|
592
|
-
out(`Create
|
|
593
|
-
|
|
594
|
-
out(` ${KEY_KINDS[kind].variable}: a "${KEY_KINDS[kind].preset}" key`);
|
|
628
|
+
out("Hue keys are created in the app; this command validates and stores one locally.");
|
|
629
|
+
out(`Create a "${KEY_PRESET}" key at: ${settingsUrl}`);
|
|
630
|
+
out(` It is stored as ${variables}.`);
|
|
595
631
|
if (!parsed.values["no-browser"] && isTTY(stdout)) {
|
|
596
632
|
const opened = await openBrowser(settingsUrl).catch(() => false);
|
|
597
633
|
if (opened)
|
|
@@ -603,75 +639,71 @@ export async function runLoginCommand(argv, io = {}) {
|
|
|
603
639
|
out(`${variable} is already stored in ${envDisplay}; a different value requires --force.`);
|
|
604
640
|
}
|
|
605
641
|
const stored = [];
|
|
606
|
-
//
|
|
607
|
-
// the
|
|
642
|
+
// Validation and the write record why they stopped instead of returning, so a key that did land
|
|
643
|
+
// in the file still reaches the ignore protection below.
|
|
608
644
|
let failure;
|
|
609
645
|
const prompter = isTTY(stdin)
|
|
610
646
|
? createTerminalPrompter(stdin, stdout)
|
|
611
647
|
: createLinePrompter(stdin, stdout);
|
|
612
|
-
const nothingElse = () => (stored.length ? "No further key was stored." : "Nothing was stored.");
|
|
613
648
|
try {
|
|
649
|
+
const answer = await prompter.ask(`Paste the "${KEY_PRESET}" key (${variables}): `);
|
|
650
|
+
const value = answer?.trim() ?? "";
|
|
651
|
+
const reason = answer === null ? null : invalidKeyReason(value);
|
|
652
|
+
const updates = {};
|
|
614
653
|
for (const kind of kinds) {
|
|
615
|
-
const { variable, urlVariable
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
[variable, value],
|
|
633
|
-
[urlVariable, urlValue],
|
|
634
|
-
]) {
|
|
635
|
-
const current = readEnvValue(envFile.text, name);
|
|
636
|
-
if (current !== undefined && current !== next)
|
|
637
|
-
failure ??= {
|
|
638
|
-
message: `${name} in ${envDisplay} already has a different value; rerun with --force to replace it.`,
|
|
639
|
-
};
|
|
640
|
-
}
|
|
641
|
-
if (failure)
|
|
642
|
-
break;
|
|
654
|
+
const { variable, urlVariable } = KEY_KINDS[kind];
|
|
655
|
+
updates[variable] = value;
|
|
656
|
+
updates[urlVariable] = kind === "evaluations" ? origin : mcpUrl;
|
|
657
|
+
}
|
|
658
|
+
if (answer === null)
|
|
659
|
+
failure = { message: `No key was entered; input ended.` };
|
|
660
|
+
else if (reason)
|
|
661
|
+
failure = {
|
|
662
|
+
message: `${reason} Create a "${KEY_PRESET}" key at ${settingsUrl} and paste it.`,
|
|
663
|
+
};
|
|
664
|
+
else if (!parsed.values.force) {
|
|
665
|
+
for (const [name, next] of Object.entries(updates)) {
|
|
666
|
+
const current = readEnvValue(envFile.text, name);
|
|
667
|
+
if (current !== undefined && current !== next)
|
|
668
|
+
failure ??= {
|
|
669
|
+
message: `${name} in ${envDisplay} already has a different value; rerun with --force to replace it.`,
|
|
670
|
+
};
|
|
643
671
|
}
|
|
672
|
+
}
|
|
673
|
+
for (const kind of failure ? [] : kinds) {
|
|
644
674
|
const check = kind === "evaluations"
|
|
645
675
|
? await checkEvaluationsKey(fetchImpl, origin, value)
|
|
646
676
|
: await checkCodingAgentKey(fetchImpl, mcpUrl, value);
|
|
647
677
|
if (!check.ok) {
|
|
648
678
|
failure = {
|
|
649
679
|
message: check.rejected
|
|
650
|
-
? `${check.detail} Create a "${
|
|
651
|
-
: `${check.detail}
|
|
680
|
+
? `${check.detail} Create a "${KEY_PRESET}" key at ${settingsUrl} and try again. Nothing was stored.`
|
|
681
|
+
: `${check.detail} Nothing was stored.`,
|
|
652
682
|
};
|
|
653
683
|
break;
|
|
654
684
|
}
|
|
655
685
|
out(kind === "evaluations"
|
|
656
|
-
? `Evaluations
|
|
657
|
-
: `Coding-agent
|
|
658
|
-
|
|
686
|
+
? `Evaluations access accepted for project "${check.detail}".`
|
|
687
|
+
: `Coding-agent access accepted; the Hue MCP server lists ${check.detail} tools.`);
|
|
688
|
+
}
|
|
689
|
+
if (!failure) {
|
|
690
|
+
const text = mergeEnvText(envFile.text, updates);
|
|
659
691
|
try {
|
|
660
692
|
await writePrivateFile(envPath, text, 0o600);
|
|
693
|
+
envFile = { text, exists: true };
|
|
694
|
+
stored.push(...kinds);
|
|
695
|
+
const urls = kinds.map((kind) => KEY_KINDS[kind].urlVariable).join(" and ");
|
|
696
|
+
out(`Stored the key (${value.length} chars) as ${variables}, with ${urls}, in ${envDisplay}.`);
|
|
661
697
|
}
|
|
662
698
|
catch (error) {
|
|
663
699
|
failure = { message: `Could not write ${envDisplay}: ${error.message}` };
|
|
664
|
-
break;
|
|
665
700
|
}
|
|
666
|
-
envFile = { text, exists: true };
|
|
667
|
-
stored.push(kind);
|
|
668
|
-
out(`Stored ${variable} (${value.length} chars) and ${urlVariable} in ${envDisplay}.`);
|
|
669
701
|
}
|
|
670
702
|
}
|
|
671
703
|
catch (error) {
|
|
672
704
|
failure =
|
|
673
705
|
error instanceof PromptInterrupted
|
|
674
|
-
? { message:
|
|
706
|
+
? { message: "Interrupted; nothing was stored.", code: 130 }
|
|
675
707
|
: { message: `hue login failed: ${error.message}` };
|
|
676
708
|
}
|
|
677
709
|
finally {
|
package/dist/evals/client.d.ts
CHANGED
|
@@ -230,7 +230,7 @@ export declare class EvaluationClient {
|
|
|
230
230
|
/** Acknowledged terminal queue state. */
|
|
231
231
|
state: "completed" | "attention";
|
|
232
232
|
}>;
|
|
233
|
-
/** Lists Scenarios (draft and published) of the project; requires a
|
|
233
|
+
/** Lists Scenarios (draft and published) of the project; requires a Read and write key. */
|
|
234
234
|
listCaseConversions(page?: PageOptions): Promise<Page<CaseConversionSummary>>;
|
|
235
235
|
/** Reads one Scenario with its immutable publication pins. */
|
|
236
236
|
getCaseConversion(id: string): Promise<CaseConversion>;
|
package/dist/evals/client.js
CHANGED
|
@@ -412,7 +412,7 @@ export class EvaluationClient {
|
|
|
412
412
|
completeLocalAgentRun(input) {
|
|
413
413
|
return this.request("POST", "/local-agent-worker/runs/complete", input);
|
|
414
414
|
}
|
|
415
|
-
/** Lists Scenarios (draft and published) of the project; requires a
|
|
415
|
+
/** Lists Scenarios (draft and published) of the project; requires a Read and write key. */
|
|
416
416
|
listCaseConversions(page) {
|
|
417
417
|
return this.request("GET", `/case-conversions${this.page(page)}`);
|
|
418
418
|
}
|
|
@@ -21,9 +21,9 @@ export interface ScenarioPins {
|
|
|
21
21
|
}
|
|
22
22
|
/** Subset of {@link EvaluationClient} used to resolve Scenario pins. */
|
|
23
23
|
export type ScenarioClient = Pick<EvaluationClient, "listCaseConversions" | "getCaseConversion" | "getDataset" | "getDatasetVersion" | "listDatasets">;
|
|
24
|
-
/** Lists Scenarios of the project; requires a
|
|
24
|
+
/** Lists Scenarios of the project; requires a Read and write key. */
|
|
25
25
|
export declare function listScenarios(client: Pick<EvaluationClient, "listCaseConversions">, page?: PageOptions): Promise<Page<CaseConversionSummary>>;
|
|
26
|
-
/** Reads one Scenario with its publication pins; requires a
|
|
26
|
+
/** Reads one Scenario with its publication pins; requires a Read and write key. */
|
|
27
27
|
export declare function getScenario(client: Pick<EvaluationClient, "getCaseConversion">, id: string): Promise<CaseConversion>;
|
|
28
28
|
/** How a selector was interpreted: a UUID, a Hue URL or a display name. */
|
|
29
29
|
export type ScenarioSelector = {
|
package/dist/evals/scenarios.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
2
2
|
/** Scenarios listed while resolving a name; bounds the registry reads of one selection. */
|
|
3
3
|
const MAX_LISTED = 200;
|
|
4
|
-
/** Lists Scenarios of the project; requires a
|
|
4
|
+
/** Lists Scenarios of the project; requires a Read and write key. */
|
|
5
5
|
export function listScenarios(client, page) {
|
|
6
6
|
return client.listCaseConversions(page);
|
|
7
7
|
}
|
|
8
|
-
/** Reads one Scenario with its publication pins; requires a
|
|
8
|
+
/** Reads one Scenario with its publication pins; requires a Read and write key. */
|
|
9
9
|
export function getScenario(client, id) {
|
|
10
10
|
return client.getCaseConversion(id);
|
|
11
11
|
}
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** Package version shared by the instrumentation scope and the export User-Agent. */
|
|
2
|
-
export declare const sdkVersion = "0.5.
|
|
2
|
+
export declare const sdkVersion = "0.5.1";
|
package/dist/version.js
CHANGED