@hue-run/sdk 0.5.1 → 0.7.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/CLI.md +17 -14
- package/ENVIRONMENTS.md +1 -1
- package/EVALUATIONS.md +19 -0
- package/README.md +35 -4
- package/dist/cli/eval.js +11 -8
- package/dist/cli/login.js +1 -1
- package/dist/client.js +3 -2
- package/dist/config.d.ts +3 -1
- package/dist/config.js +8 -1
- package/dist/evals/client.d.ts +98 -1
- package/dist/evals/client.js +195 -0
- package/dist/evals/types.d.ts +77 -0
- package/dist/live-spans.d.ts +25 -0
- package/dist/live-spans.js +115 -0
- package/dist/transport.d.ts +17 -0
- package/dist/transport.js +390 -61
- package/dist/types.d.ts +7 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/CLI.md
CHANGED
|
@@ -42,8 +42,8 @@ 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.
|
|
46
|
-
`@opentelemetry/context-async-hooks@2.11.0`; Python uses
|
|
45
|
+
not a completed integration. TypeScript uses `@hue-run/sdk@0.7.0`, `@opentelemetry/api@1.9.1` and
|
|
46
|
+
`@opentelemetry/context-async-hooks@2.11.0`; Python setup uses its separately tested package pin.
|
|
47
47
|
Content capture requires an ordinary account-managed key and a later explicit application decision.
|
|
48
48
|
|
|
49
49
|
The generated bootstrap supplies standard active SERVER-span context across asynchronous/streaming
|
|
@@ -231,7 +231,8 @@ capability `setup_telemetry_write`.
|
|
|
231
231
|
Normal project credentials and unknown token shapes are refused in setup responses and private
|
|
232
232
|
managed state. These credentials authorize metadata-only OTLP at `/api/v1/otlp/v1/traces` and exact
|
|
233
233
|
content-free receipt verification at `/api/v1/setup/traces/{traceId}/receipt`. They do not authorize
|
|
234
|
-
generic project, receipt, evaluation, log or browsing APIs.
|
|
234
|
+
generic project, receipt, evaluation, log or browsing APIs. The Python package version
|
|
235
|
+
pinned by setup can export with the setup
|
|
235
236
|
credential; the CLI verifies the dedicated setup receipt instead of Python's generic receipt helper.
|
|
236
237
|
|
|
237
238
|
Each command uses bounded timeouts and retries. Provisioning records at most five attempts per local
|
|
@@ -300,7 +301,7 @@ node packages/sdk-typescript/scripts/verify-package.mjs --artifacts-dir .artifac
|
|
|
300
301
|
# Set project to an existing supported fixture; use the same directory on resume.
|
|
301
302
|
project=/absolute/path/to/supported-fixture
|
|
302
303
|
node packages/sdk-typescript/scripts/verify-setup-live.mjs \
|
|
303
|
-
--archive .artifacts/typescript/hue-run-sdk-0.
|
|
304
|
+
--archive .artifacts/typescript/hue-run-sdk-0.7.0.tgz \
|
|
304
305
|
--origin https://STAGING_ORIGIN \
|
|
305
306
|
--project "$project" --command setup \
|
|
306
307
|
--evidence .context/setup-staging-before-claim.json
|
|
@@ -311,7 +312,7 @@ the private local handoff and finish the real browser claim, then reconcile the
|
|
|
311
312
|
|
|
312
313
|
```sh
|
|
313
314
|
node packages/sdk-typescript/scripts/verify-setup-live.mjs \
|
|
314
|
-
--archive .artifacts/typescript/hue-run-sdk-0.
|
|
315
|
+
--archive .artifacts/typescript/hue-run-sdk-0.7.0.tgz \
|
|
315
316
|
--origin https://STAGING_ORIGIN \
|
|
316
317
|
--project "$project" --command claim \
|
|
317
318
|
--evidence .context/setup-staging-after-claim.json
|
|
@@ -333,14 +334,14 @@ Publication under a candidate dist-tag, registry acceptance, production activati
|
|
|
333
334
|
the same version to `latest`, and clean-project literal `@latest` smoke remain separate gates; see
|
|
334
335
|
[RELEASING.md](../../RELEASING.md).
|
|
335
336
|
|
|
336
|
-
## Evaluate an agent against a
|
|
337
|
+
## Evaluate an agent against a case
|
|
337
338
|
|
|
338
|
-
`hue eval` runs a developer's local agent against a published Hue
|
|
339
|
+
`hue eval` runs a developer's local agent against a published Hue case or a saved eval set
|
|
339
340
|
and prints Hue's verdicts. It is the command-line form of `runSimulation()` (one-shot) and
|
|
340
341
|
`runLocalAgent()` (worker): the agent, its prompts and its provider credentials stay in the local
|
|
341
342
|
process, Hue creates one isolated simulated world per case, and Hue-owned outcome checks grade
|
|
342
343
|
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
|
|
344
|
+
write** project key (a **Read** or **Tracing only** key cannot read cases or create runs);
|
|
344
345
|
the CLI never prints it. The optional `zod` peer of `@hue-run/sdk/evals` must be installed.
|
|
345
346
|
|
|
346
347
|
Write an adapter module that hands the case inputs and the world's tools or MCP connection to
|
|
@@ -362,16 +363,18 @@ export default function runMyAgent(inputs: JsonValue, context: SimulationTargetC
|
|
|
362
363
|
```
|
|
363
364
|
|
|
364
365
|
```sh
|
|
365
|
-
hue eval --
|
|
366
|
-
hue eval --
|
|
366
|
+
hue eval --case "Refund an eligible charge" ./hue-agent.ts --env-file .env.hue
|
|
367
|
+
hue eval --case https://app.hue.run/projects/demo/scenarios/<id> ./hue-agent.ts --baseline <run id>
|
|
367
368
|
hue eval --set "Billing regressions" --scorer-version <id> ./hue-agent.ts --save-version
|
|
368
|
-
hue eval --
|
|
369
|
+
hue eval --case "Refund an eligible charge" --command "python agent.py" --timeout 120 --content
|
|
369
370
|
hue eval --worker ./hue-agent.ts --agent-key support-agent --env-file .env.hue
|
|
370
371
|
```
|
|
371
372
|
|
|
372
|
-
|
|
373
|
+
`--scenario` remains an alias for `--case` for existing scripts. Pass one selection flag.
|
|
374
|
+
|
|
375
|
+
The one-shot mode resolves the selection (`--case` by name, ID or URL; `--set` by name, ID or
|
|
373
376
|
URL with explicit `--scorer-version` pins; or `--dataset-version` with `--scorer-version`),
|
|
374
|
-
creates a fresh
|
|
377
|
+
creates a fresh run from those immutable pins named `<case> · <agent key> · <revision>`
|
|
375
378
|
(`--name` overrides), prints `Run: <url>` and `Experiment: <id>` as soon as the experiment exists,
|
|
376
379
|
one line per case event (world created, agent started, world sealed), then
|
|
377
380
|
`Waiting for Hue checks...` and a table with one row per case: boolean metrics as `PASS`/`FAIL`,
|
|
@@ -421,7 +424,7 @@ on any Node.js version.
|
|
|
421
424
|
|
|
422
425
|
Eval sets whose cases pin no simulated world — a task plus pinned input files, answered with
|
|
423
426
|
generated documents — run as **direct** cases through `runExperiment()`. `hue eval` detects this
|
|
424
|
-
from the saved version (`--mode direct|simulation` overrides the detection; `--
|
|
427
|
+
from the saved version (`--mode direct|simulation` overrides the detection; `--case` is always
|
|
425
428
|
a simulation). `--set` accepts the eval set's slug, name, ID or URL; `--set-version <n>` pins a
|
|
426
429
|
saved version other than the latest; `--scorer <slug|name|id>` pins an evaluator at its newest
|
|
427
430
|
published version, beside or instead of explicit `--scorer-version` IDs.
|
package/ENVIRONMENTS.md
CHANGED
|
@@ -79,7 +79,7 @@ until every item has a terminal result for every pin or the budget elapses (`com
|
|
|
79
79
|
`summarizeVerdicts` turns results into per-case rows with `passed` and totals; `compareVerdicts`
|
|
80
80
|
diffs two summaries by case key; and `collectExperimentVerdicts` combines those reads for one
|
|
81
81
|
experiment. The `hue eval` command uses the same path; see
|
|
82
|
-
[Evaluate an agent against a
|
|
82
|
+
[Evaluate an agent against a case](CLI.md#evaluate-an-agent-against-a-case).
|
|
83
83
|
|
|
84
84
|
### Pinned provider-profile preflight
|
|
85
85
|
|
package/EVALUATIONS.md
CHANGED
|
@@ -70,6 +70,25 @@ try {
|
|
|
70
70
|
}
|
|
71
71
|
```
|
|
72
72
|
|
|
73
|
+
For new registry code, use `createEvalSet`, `getEvalSet`, `listEvalSets`,
|
|
74
|
+
`createEvalSetVersion`, `getEvalSetVersion`, `listEvalSetCases`, `addEvalSetCase`,
|
|
75
|
+
and `freezeEvalSetVersion`. Evaluators use `createEvaluator`, `getEvaluator`,
|
|
76
|
+
`listEvaluators`, `publishEvaluatorVersion`, and `getEvaluatorVersion`. These
|
|
77
|
+
methods return product fields such as `evalSetId` and `evalSetVersionId` alongside
|
|
78
|
+
the existing v1 fields. Evaluator versions include `evaluatorId` when the server
|
|
79
|
+
supplies their owning identity; older v1 responses may omit it. They use the existing v1 paths;
|
|
80
|
+
the earlier method names remain callable for existing integrations.
|
|
81
|
+
|
|
82
|
+
For new run and scoring code, use `createRun`, `getRun`, `listRunItems`,
|
|
83
|
+
`getRunCase`, `startRunExecution`, `getRunExecution`,
|
|
84
|
+
`completeRunExecution`, and `finishRun`. Use `createScoring`, `getScoring`,
|
|
85
|
+
`listScorings`, `listScoringItems`, `getScoringSubject`,
|
|
86
|
+
`submitScoringResults`, `listScoringResults`, and `getScoringResult` to score
|
|
87
|
+
saved subjects. `createRun` accepts `evalSetVersionId` and
|
|
88
|
+
`evaluatorVersionIds`; `createScoring` and `submitScoringResults` use evaluator
|
|
89
|
+
version IDs. A run ID and a scoring ID identify different records. The methods
|
|
90
|
+
use the existing v1 paths and leave existing runner entry points callable.
|
|
91
|
+
|
|
73
92
|
Create another experiment with the same frozen version and different `config` to compare configurations. The runner reads the exact experiment case/version and scorer definitions; it never resolves a mutable latest version. `rescore` accepts an existing evaluation-run ID and has no target callback. Subject IDs refer to immutable saved outputs and trace evidence.
|
|
74
93
|
|
|
75
94
|
`rescore` preserves terminal scores already recorded for each item and evaluator version,
|
package/README.md
CHANGED
|
@@ -329,7 +329,8 @@ const hue = createHue({
|
|
|
329
329
|
|
|
330
330
|
## Delivery behavior
|
|
331
331
|
|
|
332
|
-
Exports
|
|
332
|
+
Exports retry temporary HTTP/network failures (429, 502, 503, 504 and connection errors,
|
|
333
|
+
honoring `Retry-After`) within the export timeout, by OpenTelemetry's OTLP/HTTP exporter rules. Each
|
|
333
334
|
request is limited to 1 MiB before gzip (with space reserved for gzip overhead) and each content value to 256 KiB. Batches
|
|
334
335
|
split at record boundaries. Each signal queues at most 2,048 records, including
|
|
335
336
|
exports in flight; overflow is reported through the callback, counters and next
|
|
@@ -349,6 +350,36 @@ drain, including records emitted before its call. Stop request production
|
|
|
349
350
|
before shutdown so late spans cannot race it. A client does not own instrumented
|
|
350
351
|
operations still running in the application.
|
|
351
352
|
|
|
353
|
+
## Live spans
|
|
354
|
+
|
|
355
|
+
OpenTelemetry exports a span only when it ends, so a long streamed turn would otherwise stay
|
|
356
|
+
invisible until it finishes. When a Hue or AI span is still open at the transport's next 500 ms
|
|
357
|
+
tick, the transport queues a placeholder: an ordinary OTLP span whose parent is the running span,
|
|
358
|
+
with its name, kind, start time and current attributes, an end time of 0,
|
|
359
|
+
`hue.span_type = "pending_span"` and `hue.pending_parent_id` (the running span's own parent,
|
|
360
|
+
omitted for a root). Hue shows the span as running and replaces the placeholder when the real span
|
|
361
|
+
arrives. A placeholder whose span has ended by the time it is exported is not sent.
|
|
362
|
+
|
|
363
|
+
- Only spans from the client's tracer (`withSpan`, `tool`, `model`, `hue.tracer` and the AI SDK
|
|
364
|
+
adapters) and spans with a `gen_ai.`, `ai.`, `llm.` or `traceloop.` attribute at start, or a
|
|
365
|
+
name starting with `ai.`, are announced. HTTP, database and other framework spans are not.
|
|
366
|
+
- Placeholder attributes follow `captureContent` and `redact` like the real span. Tool
|
|
367
|
+
definitions, system instructions and any value over 64 KiB are left out.
|
|
368
|
+
- Placeholders are advisory. They are queued only while the queue is under a quarter of its
|
|
369
|
+
record and byte budgets, and skipped silently otherwise. While queued they count in
|
|
370
|
+
`pendingSpans` and `pendingBytes`, but never as accepted, rejected, failed or dropped records.
|
|
371
|
+
Losing only placeholders records a warning and does not make `flush()` throw.
|
|
372
|
+
- A Hue server that accepts placeholders sends `Hue-Pending-Spans: 1` on trace acknowledgements.
|
|
373
|
+
When a response to a request carrying placeholders lacks it, the receiver predates them: the
|
|
374
|
+
transport attributes up to one rejection per placeholder to them, records one warning and stops
|
|
375
|
+
sending placeholders for that client. Other rejections count against real spans as usual.
|
|
376
|
+
- Opt out with `liveSpans: false`. Setup credentials never send placeholders.
|
|
377
|
+
- With an existing provider, announcements start in `spanProcessor.onStart`. A wrapping processor
|
|
378
|
+
that forwards `onStart` should forward `onEnd` for the same spans: a span that ends without
|
|
379
|
+
reaching Hue is forgotten at the next tick, but a placeholder already sent keeps it showing as
|
|
380
|
+
running until Hue marks the trace stalled. The filtering wrapper above forwards no starts, so it
|
|
381
|
+
sends no placeholders.
|
|
382
|
+
|
|
352
383
|
## Verify a stored application trace
|
|
353
384
|
|
|
354
385
|
After exercising a real application request and finishing its stream, flush the
|
|
@@ -445,12 +476,12 @@ their agents with `runLocalAgent()`; setup does not register workers or launch s
|
|
|
445
476
|
### Command-line evaluation
|
|
446
477
|
|
|
447
478
|
The unreleased `hue eval` command wraps `runSimulation()` and `runLocalAgent()` for an adapter
|
|
448
|
-
file or a shell command: `hue eval --
|
|
449
|
-
from a published
|
|
479
|
+
file or a shell command: `hue eval --case "<name>" ./hue-agent.ts` creates a fresh run
|
|
480
|
+
from a published case's immutable pins, runs the agent in one isolated world per case, waits
|
|
450
481
|
for Hue's outcome checks and prints the run URL and per-case PASS/FAIL verdicts with an exit code;
|
|
451
482
|
`--worker` registers the same adapter for runs launched from Hue. It needs a Read and
|
|
452
483
|
write key in `HUE_API_KEY` (never printed) and keeps content capture off unless `--content`
|
|
453
|
-
is passed. See [Evaluate an agent against a
|
|
484
|
+
is passed. See [Evaluate an agent against a case](CLI.md#evaluate-an-agent-against-a-case).
|
|
454
485
|
Eval sets whose cases pin files instead of a world run as direct cases through `runExperiment()`:
|
|
455
486
|
`hue eval --set <slug> --scorer <slug> --command "…"` hands the agent each case's pinned files in a
|
|
456
487
|
private directory, uploads the documents it writes and waits for Hue's grading executor to score
|
package/dist/cli/eval.js
CHANGED
|
@@ -18,10 +18,11 @@ import { runSimulation, } from "../evals/simulation.js";
|
|
|
18
18
|
import { collectExperimentVerdicts, compareVerdicts, metricPassed, } from "../evals/verdicts.js";
|
|
19
19
|
const USAGE = `Usage: hue eval [adapter-file] [options]
|
|
20
20
|
|
|
21
|
-
Run a local agent against a
|
|
21
|
+
Run a local agent against a published case or eval set, then print Hue's verdicts.
|
|
22
22
|
|
|
23
23
|
Selection (exactly one, not used with --worker):
|
|
24
|
-
--
|
|
24
|
+
--case <name|id|url> Published case to run
|
|
25
|
+
--scenario <name|id|url> Legacy alias for --case
|
|
25
26
|
--set <name|id|url> Saved eval set; requires --scorer or --scorer-version
|
|
26
27
|
--set-version <n> Saved version number of the eval set (default: latest saved)
|
|
27
28
|
--dataset-version <id> Frozen dataset version; requires --scorer or --scorer-version
|
|
@@ -51,7 +52,7 @@ Connection:
|
|
|
51
52
|
--origin <url> Hue origin (default: HUE_BASE_URL or https://app.hue.run)
|
|
52
53
|
|
|
53
54
|
Output and limits:
|
|
54
|
-
--name <run name>
|
|
55
|
+
--name <run name> Run name (default: <case> · <agent key> · <revision>)
|
|
55
56
|
--baseline <experiment id|url> Compare verdicts with a previous experiment
|
|
56
57
|
--json Print one JSON document on stdout; progress goes to stderr
|
|
57
58
|
--content Capture telemetry content; one-shot also persists
|
|
@@ -82,6 +83,7 @@ function parse(argv) {
|
|
|
82
83
|
allowPositionals: true,
|
|
83
84
|
strict: true,
|
|
84
85
|
options: {
|
|
86
|
+
case: { type: "string" },
|
|
85
87
|
scenario: { type: "string" },
|
|
86
88
|
set: { type: "string" },
|
|
87
89
|
"set-version": { type: "string" },
|
|
@@ -508,15 +510,16 @@ async function resolveSelection(client, values) {
|
|
|
508
510
|
const extra = [...(values["scorer-version"] ?? [])];
|
|
509
511
|
for (const selector of values.scorer ?? [])
|
|
510
512
|
extra.push(await resolveScorerVersion(client, selector));
|
|
511
|
-
|
|
513
|
+
const caseSelector = values.case ?? values.scenario;
|
|
514
|
+
if (caseSelector) {
|
|
512
515
|
if (values["set-version"])
|
|
513
516
|
throw new UsageError("--set-version applies to --set only");
|
|
514
|
-
const pins = await resolveScenarioPins(client,
|
|
517
|
+
const pins = await resolveScenarioPins(client, caseSelector);
|
|
515
518
|
pins.scorerVersionIds = [...new Set([...pins.scorerVersionIds, ...extra])];
|
|
516
519
|
return pins;
|
|
517
520
|
}
|
|
518
521
|
if (!extra.length)
|
|
519
|
-
throw new UsageError(`${values.set ? "--set" : "--dataset-version"} needs at least one --scorer or --scorer-version; use --
|
|
522
|
+
throw new UsageError(`${values.set ? "--set" : "--dataset-version"} needs at least one --scorer or --scorer-version; use --case for published pins`);
|
|
520
523
|
if (values.set) {
|
|
521
524
|
const pins = await resolveEvalSetPins(client, values.set, { scorerVersionIds: extra });
|
|
522
525
|
if (values["set-version"] === undefined)
|
|
@@ -918,11 +921,11 @@ export async function runEvalCommand(argv) {
|
|
|
918
921
|
const adapterFile = positionals[0];
|
|
919
922
|
if ((adapterFile ? 1 : 0) + (values.command ? 1 : 0) !== 1)
|
|
920
923
|
throw new UsageError("Pass exactly one agent: an adapter file or --command");
|
|
921
|
-
const selections = [values.scenario, values.set, values["dataset-version"]].filter((value) => value !== undefined).length;
|
|
924
|
+
const selections = [values.case, values.scenario, values.set, values["dataset-version"]].filter((value) => value !== undefined).length;
|
|
922
925
|
if (values.worker && selections)
|
|
923
926
|
throw new UsageError("--worker takes no selection; Hue chooses the run to execute");
|
|
924
927
|
if (!values.worker && selections !== 1)
|
|
925
|
-
throw new UsageError("Pass exactly one of --
|
|
928
|
+
throw new UsageError("Pass exactly one of --case, --set or --dataset-version");
|
|
926
929
|
if (values["env-file"]) {
|
|
927
930
|
try {
|
|
928
931
|
process.loadEnvFile(resolve(values["env-file"]));
|
package/dist/cli/login.js
CHANGED
|
@@ -739,6 +739,6 @@ export async function runLoginCommand(argv, io = {}) {
|
|
|
739
739
|
// `hue mcp install` defaults to production; a non-default origin needs its own endpoint.
|
|
740
740
|
out(` hue mcp install --client claude-code${mcpUrl === mcpUrlForOrigin(DEFAULT_ORIGIN) ? "" : ` --url ${mcpUrl}`}`);
|
|
741
741
|
if (stored.includes("evaluations"))
|
|
742
|
-
out(` hue eval --
|
|
742
|
+
out(` hue eval --case "<name>" ./hue-agent.ts --env-file ${envDisplay}`);
|
|
743
743
|
return 0;
|
|
744
744
|
}
|
package/dist/client.js
CHANGED
|
@@ -6,6 +6,7 @@ import { W3CTraceContextPropagator } from "@opentelemetry/core";
|
|
|
6
6
|
import { LoggerProvider } from "@opentelemetry/sdk-logs";
|
|
7
7
|
import { TracerProvider } from "@opentelemetry/sdk-trace";
|
|
8
8
|
import { defaultResource, resourceFromAttributes } from "@opentelemetry/resources";
|
|
9
|
+
import { HUE_SCOPE } from "./config.js";
|
|
9
10
|
import { encodeContent, noopSpan, safeSpan } from "./safety.js";
|
|
10
11
|
import { createHueTransport, HueExportError } from "./transport.js";
|
|
11
12
|
import { verifyTrace } from "./receipt.js";
|
|
@@ -197,8 +198,8 @@ export class HueClient {
|
|
|
197
198
|
}
|
|
198
199
|
this.captureContent = this.transport.options.captureContent;
|
|
199
200
|
this.enabled = this.transport.options.enabled !== false;
|
|
200
|
-
this.tracer = new ContextualTracer(this.tracerProvider.getTracer(
|
|
201
|
-
this.logger = this.loggerProvider.getLogger(
|
|
201
|
+
this.tracer = new ContextualTracer(this.tracerProvider.getTracer(HUE_SCOPE, sdkVersion), this.storage, () => this.enabled && !this.closed, () => this.transport.instrumentationFailure());
|
|
202
|
+
this.logger = this.loggerProvider.getLogger(HUE_SCOPE, sdkVersion);
|
|
202
203
|
}
|
|
203
204
|
/**
|
|
204
205
|
* Verifies that Hue stored a trace by ID, optionally waiting for expected span IDs and normalized
|
package/dist/config.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import type { HueOptions, SharedHueOptions } from "./types.js";
|
|
2
2
|
export declare const MAX_BODY_BYTES: number;
|
|
3
3
|
export declare const MAX_CONTENT_BYTES: number;
|
|
4
|
+
/** Instrumentation scope of the client's own tracer and logger. */
|
|
5
|
+
export declare const HUE_SCOPE = "@hue-run/sdk";
|
|
4
6
|
/** Loopback hostnames that may use plain HTTP without opting in. */
|
|
5
7
|
export declare function isLoopbackHost(hostname: string): boolean;
|
|
6
8
|
/** True when a validated origin exports over plain HTTP to a host other than loopback. */
|
|
7
9
|
export declare function isInsecureOrigin(baseUrl: string): boolean;
|
|
8
|
-
export declare function validateOptions(options: HueOptions): HueOptions & Required<Pick<SharedHueOptions, "captureContent" | "baseUrl" | "timeoutMillis" | "maxQueueBytes">> & {
|
|
10
|
+
export declare function validateOptions(options: HueOptions): HueOptions & Required<Pick<SharedHueOptions, "captureContent" | "baseUrl" | "timeoutMillis" | "maxQueueBytes" | "liveSpans">> & {
|
|
9
11
|
/** Project key after validation; empty for a disabled client. */
|
|
10
12
|
apiKey: string;
|
|
11
13
|
/** Service name after validation; `hue-disabled` for a disabled client. */
|
package/dist/config.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export const MAX_BODY_BYTES = 1024 * 1024;
|
|
2
2
|
export const MAX_CONTENT_BYTES = 256 * 1024;
|
|
3
|
+
/** Instrumentation scope of the client's own tracer and logger. */
|
|
4
|
+
export const HUE_SCOPE = "@hue-run/sdk";
|
|
3
5
|
/** Loopback hostnames that may use plain HTTP without opting in. */
|
|
4
6
|
export function isLoopbackHost(hostname) {
|
|
5
7
|
return hostname === "localhost" || hostname === "127.0.0.1" || hostname === "[::1]";
|
|
@@ -30,6 +32,7 @@ export function validateOptions(options) {
|
|
|
30
32
|
baseUrl: "https://app.hue.run",
|
|
31
33
|
timeoutMillis: 10000,
|
|
32
34
|
maxQueueBytes: 8 * 1024 * 1024,
|
|
35
|
+
liveSpans: false,
|
|
33
36
|
};
|
|
34
37
|
}
|
|
35
38
|
if (typeof options.captureContent !== "boolean")
|
|
@@ -74,5 +77,9 @@ export function validateOptions(options) {
|
|
|
74
77
|
maxQueueBytes < 1024 ||
|
|
75
78
|
maxQueueBytes > 64 * 1024 * 1024)
|
|
76
79
|
throw new TypeError("maxQueueBytes must be 1024–67108864");
|
|
77
|
-
|
|
80
|
+
if (options.liveSpans !== undefined && typeof options.liveSpans !== "boolean")
|
|
81
|
+
throw new TypeError("liveSpans must be a boolean");
|
|
82
|
+
// Setup credentials send installer telemetry only, never in-progress placeholders.
|
|
83
|
+
const liveSpans = options.liveSpans !== false && !options.apiKey.startsWith("hue_setup_");
|
|
84
|
+
return { ...options, baseUrl: url.origin, timeoutMillis, maxQueueBytes, liveSpans };
|
|
78
85
|
}
|
package/dist/evals/client.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ProjectConnection } from "../types.js";
|
|
2
2
|
import { type AttemptConnectionBundleV2, type PrepareAttemptRequestV2 } from "./attempt.js";
|
|
3
|
-
import type { ArtifactReservation, ArtifactUpload, CaseConversion, CaseConversionSummary, CaseWrite, CompleteExecution, Completion, Dataset, DatasetCase, DatasetVersion, EvaluationItem, EvaluationRun, EvaluationRunSummary, EnvironmentEvidenceSnapshot, Execution, Experiment, ExperimentCase, ExperimentItem, Identity, JsonValue, LocalAgentClaim, LocalAgentRegistration, RegisteredLocalAgent, JudgeBudget, JudgeJob, Page, PageOptions, RegistryPageOptions, Result, ResultSummary, Scorer, ScorerDefinition, ScorerVersion, SimulationMcpCapability, StartExecution, Subject, StoredResult } from "./types.js";
|
|
3
|
+
import type { ArtifactReservation, ArtifactUpload, CaseConversion, CaseConversionSummary, CaseWrite, CompleteExecution, Completion, Dataset, DatasetCase, DatasetVersion, EvalSet, EvalSetCase, EvalSetVersion, EvaluationItem, EvaluationRun, EvaluationRunSummary, EnvironmentEvidenceSnapshot, Execution, Experiment, ExperimentCase, ExperimentItem, Evaluator, EvaluatorVersion, Identity, JsonValue, LocalAgentClaim, LocalAgentRegistration, RegisteredLocalAgent, JudgeBudget, JudgeJob, Page, PageOptions, RegistryPageOptions, Result, ResultSummary, Run, RunCase, Scorer, ScorerDefinition, ScorerVersion, Scoring, ScoringResultInput, ScoringResultSummary, ScoringSubject, ScoringSummary, SimulationMcpCapability, StartExecution, Subject, StoredResult, StoredScoringResult } from "./types.js";
|
|
4
4
|
/** Connection options for {@link createEvaluationClient}. */
|
|
5
5
|
export interface EvaluationClientOptions {
|
|
6
6
|
/** Project service key sent as a Bearer token; server side only. */
|
|
@@ -71,6 +71,39 @@ export declare class EvaluationClient {
|
|
|
71
71
|
publishScorerVersion(id: string, definition: ScorerDefinition): Promise<ScorerVersion>;
|
|
72
72
|
/** Reads a published scorer version. */
|
|
73
73
|
getScorerVersion(id: string): Promise<ScorerVersion>;
|
|
74
|
+
/** Creates an eval set using the existing v1 registry path. */
|
|
75
|
+
createEvalSet(input: Identity): Promise<EvalSet>;
|
|
76
|
+
/** Reads an eval set and its versions. */
|
|
77
|
+
getEvalSet(id: string): Promise<EvalSet>;
|
|
78
|
+
/** Lists eval sets. */
|
|
79
|
+
listEvalSets(page?: RegistryPageOptions): Promise<Page<Omit<EvalSet, "versions">>>;
|
|
80
|
+
/** Creates a draft eval set version, optionally copying cases from another version. */
|
|
81
|
+
createEvalSetVersion(id: string, input?: {
|
|
82
|
+
fromVersionId?: string;
|
|
83
|
+
}): Promise<EvalSetVersion>;
|
|
84
|
+
/** Reads an eval set version. */
|
|
85
|
+
getEvalSetVersion(id: string): Promise<EvalSetVersion>;
|
|
86
|
+
/** Lists cases in an eval set version. */
|
|
87
|
+
listEvalSetCases(id: string, page?: PageOptions): Promise<Page<EvalSetCase>>;
|
|
88
|
+
/** Adds a case to a draft eval set version at its expected revision. */
|
|
89
|
+
addEvalSetCase(id: string, input: CaseWrite): Promise<{
|
|
90
|
+
/** The stored case. */
|
|
91
|
+
item: EvalSetCase;
|
|
92
|
+
/** The version with its new revision. */
|
|
93
|
+
version: EvalSetVersion;
|
|
94
|
+
}>;
|
|
95
|
+
/** Freezes a draft eval set version at its expected revision. */
|
|
96
|
+
freezeEvalSetVersion(id: string, expectedRevision: number): Promise<EvalSetVersion>;
|
|
97
|
+
/** Creates an evaluator identity. */
|
|
98
|
+
createEvaluator(input: Identity): Promise<Evaluator>;
|
|
99
|
+
/** Reads an evaluator and its published versions. */
|
|
100
|
+
getEvaluator(id: string): Promise<Evaluator>;
|
|
101
|
+
/** Lists evaluators. */
|
|
102
|
+
listEvaluators(page?: RegistryPageOptions): Promise<Page<Evaluator>>;
|
|
103
|
+
/** Publishes an immutable evaluator version. */
|
|
104
|
+
publishEvaluatorVersion(id: string, definition: ScorerDefinition): Promise<EvaluatorVersion>;
|
|
105
|
+
/** Reads a published evaluator version. */
|
|
106
|
+
getEvaluatorVersion(id: string): Promise<EvaluatorVersion>;
|
|
74
107
|
/** Creates an experiment over a frozen dataset version with pinned scorer versions and a configuration. */
|
|
75
108
|
createExperiment(input: {
|
|
76
109
|
idempotencyKey: string;
|
|
@@ -175,6 +208,70 @@ export declare class EvaluationClient {
|
|
|
175
208
|
listResults(id: string, page?: PageOptions): Promise<Page<ResultSummary>>;
|
|
176
209
|
/** Reads a full stored result. */
|
|
177
210
|
getResult(id: string): Promise<StoredResult>;
|
|
211
|
+
/** Creates a run using product request fields on the existing v1 path. */
|
|
212
|
+
createRun(input: {
|
|
213
|
+
idempotencyKey: string;
|
|
214
|
+
name: string;
|
|
215
|
+
evalSetVersionId: string;
|
|
216
|
+
evaluatorVersionIds: string[];
|
|
217
|
+
config: JsonValue;
|
|
218
|
+
}): Promise<{
|
|
219
|
+
/** Run ID. */
|
|
220
|
+
id: string;
|
|
221
|
+
/** ID of the run's scoring pass. */
|
|
222
|
+
scoringId: string;
|
|
223
|
+
/** Existing v1 field for the scoring pass ID. */
|
|
224
|
+
evaluationRunId: string;
|
|
225
|
+
}>;
|
|
226
|
+
/** Reads a run with its scoring progress. */
|
|
227
|
+
getRun(id: string): Promise<Run>;
|
|
228
|
+
/** Lists a run's cases with their latest executions. */
|
|
229
|
+
listRunItems(id: string, page?: PageOptions): Promise<Page<ExperimentItem>>;
|
|
230
|
+
/** Reads one frozen case of a run. */
|
|
231
|
+
getRunCase(id: string, caseId: string): Promise<RunCase>;
|
|
232
|
+
/** Starts or replays a target execution for a run case. */
|
|
233
|
+
startRunExecution(id: string, caseId: string, input: StartExecution): Promise<Execution>;
|
|
234
|
+
/** Reads one run execution. */
|
|
235
|
+
getRunExecution(id: string): Promise<Execution>;
|
|
236
|
+
/** Saves a run execution's outcome. */
|
|
237
|
+
completeRunExecution(id: string, input: CompleteExecution): Promise<Completion>;
|
|
238
|
+
/** Marks a run finished. */
|
|
239
|
+
finishRun(id: string, idempotencyKey: string): Promise<{
|
|
240
|
+
/** Run ID. */
|
|
241
|
+
id: string;
|
|
242
|
+
/** When the run finished. */
|
|
243
|
+
finishedAt: string;
|
|
244
|
+
}>;
|
|
245
|
+
/** Creates a standalone scoring pass over saved subjects. */
|
|
246
|
+
createScoring(input: {
|
|
247
|
+
idempotencyKey: string;
|
|
248
|
+
name: string;
|
|
249
|
+
subjectIds: string[];
|
|
250
|
+
evaluatorVersionIds: string[];
|
|
251
|
+
}): Promise<{
|
|
252
|
+
/** Scoring pass ID. */
|
|
253
|
+
id: string;
|
|
254
|
+
}>;
|
|
255
|
+
/** Reads a scoring pass and its pinned evaluators. */
|
|
256
|
+
getScoring(id: string): Promise<Scoring>;
|
|
257
|
+
/** Lists scoring passes in the project. */
|
|
258
|
+
listScorings(page?: PageOptions): Promise<Page<ScoringSummary>>;
|
|
259
|
+
/** Lists the subjects of a scoring pass. */
|
|
260
|
+
listScoringItems(id: string, page?: PageOptions): Promise<Page<EvaluationItem>>;
|
|
261
|
+
/** Reads a saved subject with product-named source fields. */
|
|
262
|
+
getScoringSubject(id: string): Promise<ScoringSubject>;
|
|
263
|
+
/** Uploads evaluator results for a scoring pass using product request fields. */
|
|
264
|
+
submitScoringResults(id: string, input: {
|
|
265
|
+
idempotencyKey: string;
|
|
266
|
+
results: ScoringResultInput[];
|
|
267
|
+
}): Promise<{
|
|
268
|
+
/** Stored result IDs, in input order. */
|
|
269
|
+
ids: string[];
|
|
270
|
+
}>;
|
|
271
|
+
/** Lists result summaries for a scoring pass. */
|
|
272
|
+
listScoringResults(id: string, page?: PageOptions): Promise<Page<ScoringResultSummary>>;
|
|
273
|
+
/** Reads a stored evaluator result. */
|
|
274
|
+
getScoringResult(id: string): Promise<StoredScoringResult>;
|
|
178
275
|
/** Dispatches hosted judge jobs for `llm_judge` pins; check {@link getJudgeBudget} first. */
|
|
179
276
|
createJudgeJobs(id: string, input: {
|
|
180
277
|
idempotencyKey: string;
|