@prismatic-io/lux 0.0.2-preview.40 → 0.0.2-preview.41

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 (54) hide show
  1. package/lib/answerers/persona/index.d.ts.map +1 -1
  2. package/lib/answerers/persona/index.js +6 -1
  3. package/lib/answerers/persona/index.js.map +1 -1
  4. package/lib/assertions/rubric/index.d.ts.map +1 -1
  5. package/lib/assertions/rubric/index.js +9 -1
  6. package/lib/assertions/rubric/index.js.map +1 -1
  7. package/lib/assertions/rubric/internal.d.ts.map +1 -1
  8. package/lib/assertions/rubric/internal.js +10 -7
  9. package/lib/assertions/rubric/internal.js.map +1 -1
  10. package/lib/cli/init-templates.d.ts +2 -2
  11. package/lib/cli/init-templates.d.ts.map +1 -1
  12. package/lib/cli/init-templates.js +16 -78
  13. package/lib/cli/init-templates.js.map +1 -1
  14. package/lib/core/model-cli.d.ts +22 -4
  15. package/lib/core/model-cli.d.ts.map +1 -1
  16. package/lib/core/model-cli.js +14 -1
  17. package/lib/core/model-cli.js.map +1 -1
  18. package/lib/drivers/claude-code/index.js +1 -1
  19. package/lib/drivers/claude-code/index.js.map +1 -1
  20. package/lib/drivers/shared/experiment-policy.d.ts.map +1 -1
  21. package/lib/drivers/shared/experiment-policy.js +5 -0
  22. package/lib/drivers/shared/experiment-policy.js.map +1 -1
  23. package/lib/orchestrator/config.d.ts +51 -9
  24. package/lib/orchestrator/config.d.ts.map +1 -1
  25. package/lib/orchestrator/doctor.d.ts.map +1 -1
  26. package/lib/orchestrator/doctor.js +35 -15
  27. package/lib/orchestrator/doctor.js.map +1 -1
  28. package/lib/orchestrator/experiment-context.d.ts +1 -1
  29. package/lib/orchestrator/experiment-corpus.d.ts.map +1 -1
  30. package/lib/orchestrator/experiment-corpus.js +4 -2
  31. package/lib/orchestrator/experiment-corpus.js.map +1 -1
  32. package/lib/orchestrator/experiment-identity.d.ts.map +1 -1
  33. package/lib/orchestrator/experiment-identity.js +28 -9
  34. package/lib/orchestrator/experiment-identity.js.map +1 -1
  35. package/lib/orchestrator/orchestrator.d.ts.map +1 -1
  36. package/lib/orchestrator/orchestrator.js +5 -3
  37. package/lib/orchestrator/orchestrator.js.map +1 -1
  38. package/lib/orchestrator/regrade.d.ts.map +1 -1
  39. package/lib/orchestrator/regrade.js +5 -1
  40. package/lib/orchestrator/regrade.js.map +1 -1
  41. package/package.json +1 -1
  42. package/skills/lux-answerer/SKILL.md +1 -1
  43. package/src/answerers/persona/index.ts +6 -1
  44. package/src/assertions/rubric/index.ts +14 -1
  45. package/src/assertions/rubric/internal.ts +10 -7
  46. package/src/cli/init-templates.ts +16 -78
  47. package/src/core/model-cli.ts +18 -2
  48. package/src/drivers/claude-code/index.ts +1 -1
  49. package/src/drivers/shared/experiment-policy.ts +5 -0
  50. package/src/orchestrator/doctor.ts +78 -17
  51. package/src/orchestrator/experiment-corpus.ts +10 -2
  52. package/src/orchestrator/experiment-identity.ts +41 -13
  53. package/src/orchestrator/orchestrator.ts +5 -8
  54. package/src/orchestrator/regrade.ts +5 -1
@@ -10,6 +10,7 @@ import {
10
10
  type ExperimentSelector,
11
11
  valueHash,
12
12
  } from "../core/index.js";
13
+ import { resolveHarnessForDriver } from "../core/model-cli.js";
13
14
  import { assertDisjointAnnotationSplits, selectGraderAnnotations } from "./annotation-loader.js";
14
15
  import { discoverCases, selectCases } from "./discover.js";
15
16
  import { experimentDriverIdentity } from "./driver-identity.js";
@@ -74,7 +75,10 @@ export const caseRubricCliReferences = (
74
75
  );
75
76
  return execution.loaded.campaign.profiles.flatMap((profileId) => {
76
77
  const profile = profileOrThrow(execution.config, profileId);
77
- const harness = profile.harness ?? execution.config.harness;
78
+ const harness = resolveHarnessForDriver(
79
+ profile.harness ?? execution.config.harness,
80
+ resolveDriverReference(authored, profile.driver, undefined, execution.config.driverDefaults),
81
+ );
78
82
  return rubrics.map(({ index, config }) => {
79
83
  const provider = config.provider ?? harness?.provider ?? "claude-code";
80
84
  const inheritsHarness =
@@ -129,7 +133,6 @@ export const agentCorpusHash = async (
129
133
  const profileCliIdentities = await Promise.all(
130
134
  execution.loaded.campaign.profiles.map(async (profileId) => {
131
135
  const profile = profileOrThrow(execution.config, profileId);
132
- const harness = profile.harness ?? execution.config.harness;
133
136
  const driver = bindSubjectRoot(
134
137
  resolveDriverReference(
135
138
  bound,
@@ -139,6 +142,10 @@ export const agentCorpusHash = async (
139
142
  ),
140
143
  execution.loaded.subjectRoot,
141
144
  );
145
+ const harness = resolveHarnessForDriver(
146
+ profile.harness ?? execution.config.harness,
147
+ driver,
148
+ );
142
149
  const answerer = bindSubjectRoot(
143
150
  resolveAnswererReference(
144
151
  bound,
@@ -223,6 +230,7 @@ export const graderCorpusHash = async (
223
230
  runDir: annotation.runDir,
224
231
  evidenceHash: valueHash({
225
232
  caseId: run.case.id,
233
+ driver: run.metadata.driver.name,
226
234
  prompt: run.case.prompt,
227
235
  events: run.events.flatMap((event) => {
228
236
  if (event.type === "lifecycle" || event.type === "ready") return [];
@@ -1,7 +1,9 @@
1
1
  import { readFile } from "node:fs/promises";
2
2
  import { isAbsolute, relative, resolve, sep } from "node:path";
3
3
  import { bindSubjectRoot, contentHash, valueHash } from "../core/index.js";
4
+ import { resolveHarnessForDriver } from "../core/model-cli.js";
4
5
  import { ReflectiveOptimizerConfigSchema } from "../optimization/reflective.js";
6
+ import { selectGraderAnnotations } from "./annotation-loader.js";
5
7
  import { authoredDependencyGraphHash } from "./authored-dependencies.js";
6
8
  import { assertValidationArgumentsBound } from "./candidates.js";
7
9
  import { selectCases } from "./discover.js";
@@ -25,6 +27,8 @@ import {
25
27
  resolveDriverReference,
26
28
  } from "./orchestrator.js";
27
29
  import { runtimeIdentity } from "./provenance.js";
30
+ import { loadFrozenRegradableRun, releaseFrozenRegradableRun } from "./regrade.js";
31
+ import { loadRubricDefinition } from "./rubric-loader.js";
28
32
  import { validatePluginConfig } from "./validate-plugin-config.js";
29
33
 
30
34
  export const resolvedProfileSnapshot = async (
@@ -41,18 +45,24 @@ export const resolvedProfileSnapshot = async (
41
45
  execution.loaded.campaign.evaluation.kind === "agent"
42
46
  ? (profile.driver ?? execution.config.defaultDriver)
43
47
  : undefined;
44
- const harness = profile.harness ?? execution.config.harness;
48
+ const harness = resolveHarnessForDriver(
49
+ profile.harness ?? execution.config.harness,
50
+ driver,
51
+ );
45
52
  const answerer =
46
53
  execution.loaded.campaign.evaluation.kind === "agent"
47
- ? (profile.answerer ?? execution.config.defaultAnswerer)
54
+ ? resolveAnswererReference(
55
+ { prompt: "" },
56
+ profile.answerer ?? execution.config.defaultAnswerer,
57
+ harness,
58
+ )
48
59
  : undefined;
49
- const answererCli = referencedAnswererCli(answerer);
60
+ const answererCli = driver || harness ? referencedAnswererCli(answerer) : undefined;
50
61
  let harnessCommand = harness?.command;
51
62
  if (!harnessCommand) {
52
63
  harnessCommand = harness?.provider === "codex" ? "codex" : "claude";
53
64
  }
54
- const capturesHarnessIdentity =
55
- Boolean(harness) || execution.loaded.campaign.evaluation.kind === "grader";
65
+ const capturesHarnessIdentity = Boolean(harness);
56
66
  const harnessCliIdentity = capturesHarnessIdentity
57
67
  ? await cliIdentity(harnessCommand, execution.config.rootDir)
58
68
  : null;
@@ -177,13 +187,28 @@ export const runtimeCliReferences = async (
177
187
  );
178
188
  }
179
189
  if (corpus.kind === "grader") {
180
- for (const profileId of execution.loaded.campaign.profiles) {
181
- const profile = profileOrThrow(execution.config, profileId);
182
- const harness = profile.harness ?? execution.config.harness;
183
- add(
184
- harness?.command ?? (harness?.provider === "codex" ? "codex" : "claude"),
185
- execution.config.rootDir,
186
- );
190
+ const annotations = execution.loaded.graderAnnotations?.annotations ?? [];
191
+ const selected = new Map(
192
+ selectorsBySplit(execution.loaded.campaign)
193
+ .flatMap((split) => selectGraderAnnotations(annotations, split.selector))
194
+ .map((annotation) => [annotation.id, annotation]),
195
+ );
196
+ for (const annotation of selected.values()) {
197
+ const run = await loadFrozenRegradableRun(annotation.runDir);
198
+ try {
199
+ const rubric = await loadRubricDefinition(
200
+ resolve(execution.loaded.subjectRoot, annotation.rubricPath),
201
+ );
202
+ const authored = {
203
+ ...run.case,
204
+ assertions: rubric.assertions,
205
+ driver: run.metadata.driver.name,
206
+ };
207
+ for (const reference of caseRubricCliReferences(execution, authored))
208
+ add(reference.command, execution.config.rootDir);
209
+ } finally {
210
+ await releaseFrozenRegradableRun(run);
211
+ }
187
212
  }
188
213
  }
189
214
  if (corpus.kind === "agent") {
@@ -201,7 +226,6 @@ export const runtimeCliReferences = async (
201
226
  );
202
227
  for (const profileId of execution.loaded.campaign.profiles) {
203
228
  const profile = profileOrThrow(execution.config, profileId);
204
- const harness = profile.harness ?? execution.config.harness;
205
229
  const driver = bindSubjectRoot(
206
230
  resolveDriverReference(
207
231
  authored,
@@ -211,6 +235,10 @@ export const runtimeCliReferences = async (
211
235
  ),
212
236
  execution.loaded.subjectRoot,
213
237
  );
238
+ const harness = resolveHarnessForDriver(
239
+ profile.harness ?? execution.config.harness,
240
+ driver,
241
+ );
214
242
  const answerer = bindSubjectRoot(
215
243
  resolveAnswererReference(
216
244
  authored,
@@ -23,6 +23,7 @@ import {
23
23
  type SuiteLifecycleHookContext,
24
24
  valueHash,
25
25
  } from "../core/index.js";
26
+ import { resolveHarnessForDriver } from "../core/model-cli.js";
26
27
  import {
27
28
  mergeAnswererReference,
28
29
  mergeDriverReference,
@@ -374,13 +375,9 @@ export class Orchestrator {
374
375
  request.subjectRoot,
375
376
  );
376
377
  const driverName = driverNameOf(driverRef);
378
+ const harness = resolveHarnessForDriver(this.harness, driverRef);
377
379
  const answererRef = bindSubjectRoot(
378
- resolveAnswererReference(
379
- evalCase,
380
- this.defaultAnswerer,
381
- this.harness,
382
- request.answererOverride,
383
- ),
380
+ resolveAnswererReference(evalCase, this.defaultAnswerer, harness, request.answererOverride),
384
381
  request.subjectRoot,
385
382
  );
386
383
  const answererName = answererNameOf(answererRef);
@@ -445,7 +442,7 @@ export class Orchestrator {
445
442
  implementationHash,
446
443
  assertions: assertionImplementations,
447
444
  validatedAssertionsHash,
448
- graderContext: this.harness,
445
+ graderContext: harness,
449
446
  skipJudge: request.skipJudge ?? false,
450
447
  });
451
448
  return await this.runWithPlugins(
@@ -467,7 +464,7 @@ export class Orchestrator {
467
464
  evaluatorConfigHash: valueHash({
468
465
  luxVersion: LUX_VERSION,
469
466
  implementationHash,
470
- harness: this.harness,
467
+ harness,
471
468
  driver: { name: driverPlugin.name, create: driverPlugin.create },
472
469
  answerer: { name: answererPlugin.name, create: answererPlugin.create },
473
470
  assertions: assertionImplementations,
@@ -33,6 +33,7 @@ import {
33
33
  readRunArtifactBytes,
34
34
  valueHash,
35
35
  } from "../core/index.js";
36
+ import { HarnessModelConfigSchema, resolveHarnessForDriver } from "../core/model-cli.js";
36
37
  import { registryForEvalCase } from "./case-extensions.js";
37
38
  import { evaluatorImplementationHash } from "./evaluator-identity.js";
38
39
  import { parsePersistedJson, readBoundedHandle, safeReadJson } from "./fs-read.js";
@@ -539,12 +540,15 @@ export const regradeRun = async (options: {
539
540
  const validatedAssertionsHash = valueHash(validatedAssertionConfigs);
540
541
  const assertionEvaluators = assertionEvaluatorIdentities(run.case.assertions ?? [], registry);
541
542
  const assertionPlugins = assertionPluginIdentities(run.case.assertions ?? [], registry);
543
+ const configuredHarness = HarnessModelConfigSchema.safeParse(options.graderContext);
542
544
  const graderHash = graderConfigHash({
543
545
  luxVersion: LUX_VERSION,
544
546
  implementationHash: await currentEvaluatorImplementationHash(),
545
547
  assertions: assertionEvaluators,
546
548
  validatedAssertionsHash,
547
- graderContext: options.graderContext,
549
+ graderContext: configuredHarness.success
550
+ ? configuredHarness.data
551
+ : (options.graderContext ?? resolveHarnessForDriver(undefined, run.metadata.driver)),
548
552
  });
549
553
  const report: GradingReport = await gradeRun(
550
554
  run,