@hue-run/sdk 0.7.0 → 0.8.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 +19 -11
- package/ENVIRONMENTS.md +61 -0
- package/README.md +16 -1
- package/dist/cli/eval.js +79 -24
- package/dist/environment/client.d.ts +16 -2
- package/dist/environment/client.js +46 -3
- package/dist/environment/types.d.ts +131 -2
- package/dist/environment/world.d.ts +50 -0
- package/dist/environment/world.js +105 -0
- package/dist/environment.d.ts +2 -0
- package/dist/environment.js +1 -0
- package/dist/evals/environment-target.d.ts +53 -2
- package/dist/evals/environment-target.js +114 -10
- package/dist/evals/local-worker.d.ts +12 -5
- package/dist/evals/local-worker.js +13 -5
- package/dist/evals/runner.d.ts +1 -1
- package/dist/evals/runner.js +2 -2
- package/dist/evals/simulation.d.ts +14 -5
- package/dist/evals/simulation.js +26 -8
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/dist/evals/runner.d.ts
CHANGED
|
@@ -50,7 +50,7 @@ interface RunnerOptions {
|
|
|
50
50
|
* (for example a Hue-operated grading worker that owns the evaluator source) instead of
|
|
51
51
|
* refusing the run. Their IDs are reported in `deferredScorerVersionIds`. */
|
|
52
52
|
deferUnboundLocalScorers?: boolean;
|
|
53
|
-
/** Cases in flight at once, 1–
|
|
53
|
+
/** Cases in flight at once, 1–64. Default 1. */
|
|
54
54
|
concurrency?: number;
|
|
55
55
|
/** Deadline for JSON Schema scoring in its worker, 100–60000 ms. Default 2000. */
|
|
56
56
|
schemaTimeoutMillis?: number;
|
package/dist/evals/runner.js
CHANGED
|
@@ -80,8 +80,8 @@ function settings(options) {
|
|
|
80
80
|
if (typeof options.persistResultContent !== "boolean")
|
|
81
81
|
throw new TypeError("Choose persistResultContent explicitly: true or false");
|
|
82
82
|
const concurrency = options.concurrency ?? 1;
|
|
83
|
-
if (!Number.isInteger(concurrency) || concurrency < 1 || concurrency >
|
|
84
|
-
throw new RangeError("concurrency must be 1–
|
|
83
|
+
if (!Number.isInteger(concurrency) || concurrency < 1 || concurrency > 64)
|
|
84
|
+
throw new RangeError("concurrency must be 1–64");
|
|
85
85
|
const timeout = options.schemaTimeoutMillis ?? 2000;
|
|
86
86
|
if (!Number.isInteger(timeout) || timeout < 100 || timeout > 60_000)
|
|
87
87
|
throw new RangeError("schemaTimeoutMillis must be 100–60000");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { HueClient } from "../client.js";
|
|
2
2
|
import { type EnvironmentClient } from "../environment/client.js";
|
|
3
3
|
import type { EnvironmentTool } from "../environment/tools.js";
|
|
4
|
-
import type { EnvironmentIdentity, PublishableEnvironmentDefinition } from "../environment/types.js";
|
|
4
|
+
import type { EnvironmentIdentity, PublishableEnvironmentDefinition, WorldHandoff } from "../environment/types.js";
|
|
5
5
|
import { type EvaluationClient } from "./client.js";
|
|
6
6
|
import type { ActualAgentManifestInputV2, AttemptConnectionBundleV2, RequestedAttemptProviderV2 } from "./attempt.js";
|
|
7
7
|
import { type RunnerReport } from "./runner.js";
|
|
@@ -109,10 +109,15 @@ export interface SimulationTargetContext {
|
|
|
109
109
|
executionId: string;
|
|
110
110
|
/** Stable world identity for adapter control operations such as coverage reporting. */
|
|
111
111
|
environmentRunId: string;
|
|
112
|
-
/** Framework-neutral local callables backed by this attempt's isolated world
|
|
112
|
+
/** Framework-neutral local callables backed by this attempt's isolated world; empty for a
|
|
113
|
+
* gateway world, whose calls go to the provider mirrors in `world`. */
|
|
113
114
|
tools: Record<string, EnvironmentTool>;
|
|
114
|
-
/**
|
|
115
|
-
|
|
115
|
+
/** The mirror URLs, world token, environment carriers and MCP configuration of a gateway
|
|
116
|
+
* world; absent for a world created while the gateway was off. */
|
|
117
|
+
world?: WorldHandoff;
|
|
118
|
+
/** One MCP endpoint and bearer: the gateway world's first MCP mirror with the world token, or
|
|
119
|
+
* the deprecated execution-scoped `hue_sim_` capability of a legacy world. */
|
|
120
|
+
mcp?: SimulationMcpCapability;
|
|
116
121
|
/** Credential-bearing provider connections for this callback only. Hue never
|
|
117
122
|
* checkpoints, logs or adds this response to parity digests. */
|
|
118
123
|
connectionBundle?: AttemptConnectionBundleV2;
|
|
@@ -149,7 +154,7 @@ export interface RunSimulationOptions {
|
|
|
149
154
|
};
|
|
150
155
|
/** Local scorer callbacks bound by their declared source digests. */
|
|
151
156
|
localScorers?: LocalScorer[];
|
|
152
|
-
/** Cases in flight, 1–
|
|
157
|
+
/** Cases in flight, 1–64; defaults to 1. */
|
|
153
158
|
concurrency?: number;
|
|
154
159
|
/** JSON Schema worker deadline in milliseconds. */
|
|
155
160
|
schemaTimeoutMillis?: number;
|
|
@@ -157,6 +162,10 @@ export interface RunSimulationOptions {
|
|
|
157
162
|
maxSteps?: number;
|
|
158
163
|
/** Per-world lease in seconds, 1–86400. */
|
|
159
164
|
ttlSeconds?: number;
|
|
165
|
+
/** The agent revision under test, sent on world create for the world's fingerprint. */
|
|
166
|
+
agentRevision?: string;
|
|
167
|
+
/** Emit a one-time `DeprecationWarning` when the deployment serves a legacy world; on by default. */
|
|
168
|
+
deprecationWarnings?: boolean;
|
|
160
169
|
/** Cooperative caller cancellation signal. */
|
|
161
170
|
signal?: AbortSignal;
|
|
162
171
|
/** Optional display name for the fresh experiment. */
|
package/dist/evals/simulation.js
CHANGED
|
@@ -378,10 +378,21 @@ export async function runSimulation(options) {
|
|
|
378
378
|
baseUrl: options.client.baseUrl,
|
|
379
379
|
});
|
|
380
380
|
try {
|
|
381
|
-
|
|
381
|
+
// The agent revision is part of the attempt: a resume after it changed would otherwise
|
|
382
|
+
// finish the remaining cases under a different revision than the completed ones. A
|
|
383
|
+
// checkpoint written before revisions were tracked carries the definition digest alone and
|
|
384
|
+
// still matches its definition.
|
|
385
|
+
const scenarioDigest = digest({
|
|
386
|
+
definition: definitionIdentity(definition),
|
|
387
|
+
agentRevision: options.agentRevision ?? null,
|
|
388
|
+
});
|
|
382
389
|
let attempt = await store.read("active-attempt");
|
|
383
|
-
|
|
384
|
-
|
|
390
|
+
const previousDigest = digest(definitionIdentity(definition));
|
|
391
|
+
if (attempt &&
|
|
392
|
+
attempt.stage !== "completed" &&
|
|
393
|
+
attempt.scenarioDigest !== scenarioDigest &&
|
|
394
|
+
attempt.scenarioDigest !== previousDigest)
|
|
395
|
+
throw new Error("Recover the unfinished simulation before running a changed scenario or agent revision");
|
|
385
396
|
if (!attempt || attempt.stage === "completed") {
|
|
386
397
|
attempt = {
|
|
387
398
|
scenarioDigest,
|
|
@@ -432,6 +443,8 @@ export async function runSimulation(options) {
|
|
|
432
443
|
requested,
|
|
433
444
|
maxSteps: options.maxSteps,
|
|
434
445
|
ttlSeconds: options.ttlSeconds,
|
|
446
|
+
agentRevision: options.agentRevision,
|
|
447
|
+
deprecationWarnings: options.deprecationWarnings,
|
|
435
448
|
signal: options.signal,
|
|
436
449
|
onProgress: (event) => options.onProgress?.({
|
|
437
450
|
...event,
|
|
@@ -448,11 +461,16 @@ export async function runSimulation(options) {
|
|
|
448
461
|
executionId: targetContext.executionId,
|
|
449
462
|
environmentRunId: targetContext.environmentRunId,
|
|
450
463
|
tools: targetContext.tools,
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
464
|
+
...(targetContext.world ? { world: structuredClone(targetContext.world) } : {}),
|
|
465
|
+
...(targetContext.mcp
|
|
466
|
+
? {
|
|
467
|
+
mcp: {
|
|
468
|
+
url: targetContext.mcp.url,
|
|
469
|
+
token: targetContext.mcp.token,
|
|
470
|
+
expiresAt: targetContext.mcp.expiresAt,
|
|
471
|
+
},
|
|
472
|
+
}
|
|
473
|
+
: {}),
|
|
456
474
|
...(targetContext.connectionBundle
|
|
457
475
|
? { connectionBundle: structuredClone(targetContext.connectionBundle) }
|
|
458
476
|
: {}),
|
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.
|
|
2
|
+
export declare const sdkVersion = "0.8.0";
|
package/dist/version.js
CHANGED