@hue-run/sdk 0.9.0 → 0.11.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.
Files changed (56) hide show
  1. package/CLI.md +240 -49
  2. package/ENVIRONMENTS.md +48 -9
  3. package/EVALUATIONS.md +41 -21
  4. package/README.md +70 -30
  5. package/dist/cli/eval-direct.d.ts +12 -1
  6. package/dist/cli/eval-direct.js +145 -33
  7. package/dist/cli/eval.d.ts +28 -1
  8. package/dist/cli/eval.js +504 -81
  9. package/dist/cli/listen.d.ts +76 -0
  10. package/dist/cli/listen.js +816 -0
  11. package/dist/cli/mcp.d.ts +65 -7
  12. package/dist/cli/mcp.js +271 -73
  13. package/dist/client.d.ts +7 -4
  14. package/dist/client.js +36 -10
  15. package/dist/evals/checkpoint.d.ts +15 -1
  16. package/dist/evals/checkpoint.js +34 -3
  17. package/dist/evals/client.d.ts +24 -4
  18. package/dist/evals/client.js +92 -38
  19. package/dist/evals/environment-target.d.ts +18 -3
  20. package/dist/evals/environment-target.js +22 -10
  21. package/dist/evals/exit-cleanup.d.ts +4 -0
  22. package/dist/evals/exit-cleanup.js +26 -0
  23. package/dist/evals/files.d.ts +69 -3
  24. package/dist/evals/files.js +255 -42
  25. package/dist/evals/json.js +116 -9
  26. package/dist/evals/local-worker.d.ts +21 -3
  27. package/dist/evals/local-worker.js +14 -0
  28. package/dist/evals/runner.d.ts +45 -0
  29. package/dist/evals/runner.js +199 -21
  30. package/dist/evals/scenarios.d.ts +7 -5
  31. package/dist/evals/scenarios.js +71 -14
  32. package/dist/evals/scorer-publication.js +58 -3
  33. package/dist/evals/simulation.d.ts +17 -4
  34. package/dist/evals/simulation.js +8 -0
  35. package/dist/evals/types.d.ts +48 -0
  36. package/dist/evals/verdicts.d.ts +26 -2
  37. package/dist/evals/verdicts.js +72 -9
  38. package/dist/evals.d.ts +4 -3
  39. package/dist/evals.js +2 -2
  40. package/dist/inline-files.d.ts +4 -0
  41. package/dist/inline-files.js +48 -17
  42. package/dist/provider-tools.d.ts +12 -1
  43. package/dist/provider-tools.js +192 -106
  44. package/dist/safety.d.ts +7 -1
  45. package/dist/safety.js +9 -7
  46. package/dist/setup/cli.js +31 -8
  47. package/dist/setup/peers.d.ts +13 -0
  48. package/dist/setup/peers.js +44 -0
  49. package/dist/snapshot.d.ts +2 -2
  50. package/dist/snapshot.js +47 -12
  51. package/dist/tool-definitions.d.ts +18 -0
  52. package/dist/tool-definitions.js +232 -0
  53. package/dist/transport.js +2 -2
  54. package/dist/version.d.ts +1 -1
  55. package/dist/version.js +1 -1
  56. package/package.json +1 -1
@@ -1,9 +1,10 @@
1
1
  import type { ExperimentCase, LocalFile } from "../evals/types.js";
2
2
  import { TargetResult } from "../evals/types.js";
3
3
  import { type SimulationTargetContext } from "../evals/simulation.js";
4
+ import { type ExperimentVerdicts } from "../evals/verdicts.js";
4
5
  import type { JsonValue } from "../types.js";
5
6
  /** Adapter contract: the module's `default` or `runMyAgent` export. */
6
- export type EvalAdapter = (inputs: JsonValue, context: SimulationTargetContext) => JsonValue | undefined | Promise<JsonValue | undefined>;
7
+ export type EvalAdapter = (inputs: JsonValue, context: SimulationTargetContext) => JsonValue | TargetResult | undefined | Promise<JsonValue | TargetResult | undefined>;
7
8
  /**
8
9
  * Context of a direct (file) case: pinned input files in, generated documents out. The same
9
10
  * adapter module serves both modes; `mode` tells it which context it received.
@@ -20,6 +21,32 @@ export interface DirectTargetContext {
20
21
  signal?: AbortSignal;
21
22
  }
22
23
  export type DirectEvalAdapter = (inputs: JsonValue, context: DirectTargetContext) => JsonValue | TargetResult | undefined | Promise<JsonValue | TargetResult | undefined>;
24
+ export interface Output {
25
+ /** Human progress lines: stdout normally, stderr with --json. */
26
+ log(line: string): void;
27
+ /** Diagnostics; always stderr. */
28
+ error(line: string): void;
29
+ }
30
+ /**
31
+ * Spawns the agent command once in its own process group and returns its trimmed stdout. A
32
+ * timeout or Ctrl+C stops the agent the shell started, not only the shell: a survivor would still
33
+ * hold a world token and could write after Hue recorded the case as failed. The group is signalled
34
+ * even once the shell has exited, since a compound command's agent can outlive it, and a stopped
35
+ * command settles only when nothing in the group is left. A command that exits normally but
36
+ * leaves processes behind has them stopped the same way before it settles, so none can touch its
37
+ * outputs while they are collected. Once the group is found empty it is never signalled again,
38
+ * since its ID could be reused. Windows has no process group to signal, so the child alone is
39
+ * stopped there.
40
+ */
41
+ export declare function spawnAgentCommand(command: string, options: {
42
+ cwd?: string;
43
+ env: Record<string, string | undefined>;
44
+ stdin?: string;
45
+ timeoutSeconds: number;
46
+ signal?: AbortSignal;
47
+ }): Promise<string>;
48
+ export declare function renderTable(verdicts: ExperimentVerdicts, output: Output): void;
49
+ export declare function explain(error: unknown): string;
23
50
  /**
24
51
  * `hue eval`: runs a local adapter or command against a Scenario or eval set through
25
52
  * `runSimulation`, or registers it as an outbound worker through `runLocalAgent`.