@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.
@@ -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–16. Default 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;
@@ -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 > 16)
84
- throw new RangeError("concurrency must be 1–16");
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
- /** Short-lived capability for providers that execute MCP remotely. */
115
- mcp: SimulationMcpCapability;
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–16; defaults to 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. */
@@ -378,10 +378,21 @@ export async function runSimulation(options) {
378
378
  baseUrl: options.client.baseUrl,
379
379
  });
380
380
  try {
381
- const scenarioDigest = digest(definitionIdentity(definition));
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
- if (attempt && attempt.stage !== "completed" && attempt.scenarioDigest !== scenarioDigest)
384
- throw new Error("Recover the unfinished simulation before running a changed scenario");
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
- mcp: {
452
- url: targetContext.mcp.url,
453
- token: targetContext.mcp.token,
454
- expiresAt: targetContext.mcp.expiresAt,
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.7.0";
2
+ export declare const sdkVersion = "0.8.0";
package/dist/version.js CHANGED
@@ -1,3 +1,3 @@
1
1
  // Generated by scripts/write-version.mjs from package.json; do not edit by hand.
2
2
  /** Package version shared by the instrumentation scope and the export User-Agent. */
3
- export const sdkVersion = "0.7.0";
3
+ export const sdkVersion = "0.8.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hue-run/sdk",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "publishConfig": {