vieval 0.0.7 → 0.0.9

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.
@@ -495,15 +495,6 @@ interface ModelDefinition {
495
495
  declare function resolveModelByName(models: readonly ModelDefinition[], name: string): ModelDefinition | undefined;
496
496
  //#endregion
497
497
  //#region src/core/runner/task-context.d.ts
498
- /**
499
- * Options for selecting a model from the execution context.
500
- */
501
- interface TaskModelSelectionOptions {
502
- /**
503
- * Model id or alias name.
504
- */
505
- name: string;
506
- }
507
498
  /**
508
499
  * Task-scoped execution context exposed to runner executors.
509
500
  */
@@ -513,13 +504,9 @@ interface TaskExecutionContext {
513
504
  */
514
505
  cache: TaskCacheRuntime;
515
506
  /**
516
- * Resolves model configuration for the current task.
517
- *
518
- * Use when:
519
- * - no arguments are provided to use the model selected by run matrix/inferenceExecutor
520
- * - `name` is provided to resolve a specific model id or alias
507
+ * Configured model registrations available to model plugins.
521
508
  */
522
- model: (selection?: string | TaskModelSelectionOptions) => ModelDefinition;
509
+ models: readonly ModelDefinition[];
523
510
  }
524
511
  /**
525
512
  * Inputs used to build task execution context.
@@ -530,14 +517,13 @@ interface CreateTaskExecutionContextOptions {
530
517
  task: ScheduledTask;
531
518
  }
532
519
  /**
533
- * Creates task-scoped model resolver context for runner execution.
520
+ * Creates task-scoped context data for runner execution.
534
521
  *
535
522
  * Call stack:
536
523
  *
537
524
  * {@link runScheduledTasks}
538
525
  * -> {@link createTaskExecutionContext}
539
- * -> {@link resolveModelByName}
540
- * -> `task.model()` / `task.model({ name })`
526
+ * -> `TaskExecutionContext`
541
527
  */
542
528
  declare function createTaskExecutionContext(options: CreateTaskExecutionContextOptions): TaskExecutionContext;
543
529
  //#endregion
@@ -581,7 +567,7 @@ interface RunScheduledTasksOptions {
581
567
  * Creates per-task execution context.
582
568
  *
583
569
  * Use when:
584
- * - executor code needs per-task model resolution or other task-scoped data
570
+ * - executor code needs per-task models, cache, or other task-scoped data
585
571
  */
586
572
  createExecutionContext?: (task: ScheduledTask) => TaskExecutionContext;
587
573
  /**
@@ -1035,24 +1021,13 @@ interface TaskRunContext {
1035
1021
  */
1036
1022
  task: ScheduledTask;
1037
1023
  /**
1038
- * Matrix-scoped model resolver.
1039
- *
1040
- * Runtime impact:
1041
- * - `context.model()` uses `context.task.matrix.run.model` first when present
1042
- * - then falls back to inferenceExecutor-id match
1043
- * - then falls back to first configured model
1024
+ * Configured model registrations available to model plugins.
1044
1025
  *
1045
- * @example
1046
- * ```ts
1047
- * // matrix.run.model = 'gpt-4.1-mini'
1048
- * const defaultModel = context.model()
1049
- * // resolves the configured model whose id/model/alias matches 'gpt-4.1-mini'
1050
- *
1051
- * const judgeModel = context.model({ name: 'judge-large' })
1052
- * // explicit lookup bypasses matrix default
1053
- * ```
1026
+ * Use when:
1027
+ * - a plugin owns model selection semantics and needs access to registered models
1028
+ * - eval code resolves matrix-selected model axes through plugin helpers
1054
1029
  */
1055
- model: TaskExecutionContext['model'];
1030
+ models: TaskExecutionContext['models'];
1056
1031
  /**
1057
1032
  * Optional reporter lifecycle hooks for task-local case events.
1058
1033
  *
@@ -1378,5 +1353,5 @@ interface ConfigHookPlugin<TConfig> {
1378
1353
  configVievalResolved?: (config: TConfig) => void | Promise<void>;
1379
1354
  }
1380
1355
  //#endregion
1381
- export { CreateRunnerScheduleOptions as $, RunScheduledTasksOptions as A, resolveModelByName as B, TaskDefinition as C, TaskRunContext as D, TaskReporterHooks as E, CreateTaskExecutionContextOptions as F, createRunnerRuntimeContext as G, collectEvalEntries as H, TaskExecutionContext as I, AggregatedRunSummary as J, AggregatedProviderSummary as K, TaskModelSelectionOptions as L, RunnerTaskState as M, ScheduledTaskExecutor as N, TaskRunOutput as O, runScheduledTasks as P, aggregateRunResults as Q, createTaskExecutionContext as R, TaskConcurrencyConfig as S, TaskReporterEventPayload as T, CreateVievalRunnerRuntimeContextOptions as U, asProjectRelativePath as V, RunnerRuntimeContext as W, RunScore as X, RunResult as Y, RunScoreKind as Z, ScopedMatrices as _, CliOpenTelemetryReportingConfig as a, ScheduledTaskMatrix as at, TaskCaseReporterPayload as b, EvalDefinition as c, CreateFilesystemTaskCacheRuntimeOptions as ct, MatrixAxisValues as d, CacheFileHandle as dt, InferenceExecutor as et, MatrixDefinition as f, CacheFileOptions as ft, MatrixValue as g, MatrixRow as h, Awaitable as i, ScheduledTask as it, RunnerExecutionError as j, TelemetryAttributeValue as k, EvalModule as l, createFilesystemTaskCacheRuntime as lt, MatrixPrimitive as m, TaskCacheRuntime as mt, defineEval as n, RunnerMatrixInput as nt, CliReportingConfig as o, ScheduledTaskMatrixMeta as ot, MatrixLayer as p, CacheNamespace as pt, AggregatedRunResults as q, defineTask as r, RunnerMatrixSelection as rt, CollectedEvalEntry as s, createRunnerSchedule as st, ConfigHookPlugin as t, RunnerMatrixDefinition as tt, EvalModuleMap as u, normalizeCacheFilePathSegments as ut, TaskAutoRetryDelay as v, TaskExecutionPolicy as w, TaskCaseState as x, TaskCaseReporterEndPayload as y, ModelDefinition as z };
1382
- //# sourceMappingURL=index-5R1_k2nv.d.mts.map
1356
+ export { InferenceExecutor as $, RunScheduledTasksOptions as A, asProjectRelativePath as B, TaskDefinition as C, TaskRunContext as D, TaskReporterHooks as E, CreateTaskExecutionContextOptions as F, AggregatedProviderSummary as G, CreateVievalRunnerRuntimeContextOptions as H, TaskExecutionContext as I, RunResult as J, AggregatedRunResults as K, createTaskExecutionContext as L, RunnerTaskState as M, ScheduledTaskExecutor as N, TaskRunOutput as O, runScheduledTasks as P, CreateRunnerScheduleOptions as Q, ModelDefinition as R, TaskConcurrencyConfig as S, TaskReporterEventPayload as T, RunnerRuntimeContext as U, collectEvalEntries as V, createRunnerRuntimeContext as W, RunScoreKind as X, RunScore as Y, aggregateRunResults as Z, ScopedMatrices as _, CliOpenTelemetryReportingConfig as a, ScheduledTaskMatrixMeta as at, TaskCaseReporterPayload as b, EvalDefinition as c, createFilesystemTaskCacheRuntime as ct, MatrixAxisValues as d, CacheFileOptions as dt, RunnerMatrixDefinition as et, MatrixDefinition as f, CacheNamespace as ft, MatrixValue as g, MatrixRow as h, Awaitable as i, ScheduledTaskMatrix as it, RunnerExecutionError as j, TelemetryAttributeValue as k, EvalModule as l, normalizeCacheFilePathSegments as lt, MatrixPrimitive as m, defineEval as n, RunnerMatrixSelection as nt, CliReportingConfig as o, createRunnerSchedule as ot, MatrixLayer as p, TaskCacheRuntime as pt, AggregatedRunSummary as q, defineTask as r, ScheduledTask as rt, CollectedEvalEntry as s, CreateFilesystemTaskCacheRuntimeOptions as st, ConfigHookPlugin as t, RunnerMatrixInput as tt, EvalModuleMap as u, CacheFileHandle as ut, TaskAutoRetryDelay as v, TaskExecutionPolicy as w, TaskCaseState as x, TaskCaseReporterEndPayload as y, resolveModelByName as z };
1357
+ //# sourceMappingURL=index-BkjyCInx.d.mts.map
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { D as TaskRunContext, I as TaskExecutionContext, O as TaskRunOutput, S as TaskConcurrencyConfig, Y as RunResult, Z as RunScoreKind, et as InferenceExecutor, f as MatrixDefinition, it as ScheduledTask, k as TelemetryAttributeValue, o as CliReportingConfig, p as MatrixLayer, t as ConfigHookPlugin, w as TaskExecutionPolicy, z as ModelDefinition } from "./index-5R1_k2nv.mjs";
2
- import { a as requiredEnvFrom } from "./env-BeHv_5mo.mjs";
1
+ import { $ as InferenceExecutor, D as TaskRunContext, I as TaskExecutionContext, J as RunResult, O as TaskRunOutput, R as ModelDefinition, S as TaskConcurrencyConfig, X as RunScoreKind, f as MatrixDefinition, k as TelemetryAttributeValue, o as CliReportingConfig, p as MatrixLayer, rt as ScheduledTask, t as ConfigHookPlugin, w as TaskExecutionPolicy } from "./index-BkjyCInx.mjs";
2
+ import { a as requiredEnvFrom } from "./env-DfWZy_n4.mjs";
3
3
  import { expect } from "./expect.mjs";
4
4
  import * as _$c12 from "c12";
5
5
 
@@ -137,7 +137,7 @@ interface CliProjectConfig {
137
137
  * Model definitions available to project runtime execution.
138
138
  *
139
139
  * Inference executors control schedule fan-out, while models provide
140
- * runtime lookup metadata for `context.model(...)` during task execution.
140
+ * runtime lookup metadata for model plugin helpers during task execution.
141
141
  *
142
142
  * @default inherited from top-level config models
143
143
  */
@@ -253,11 +253,11 @@ interface CliComparisonConfig {
253
253
  * Execution context exposed to project-level `executor` implementations.
254
254
  *
255
255
  * Use when:
256
- * - a project executor needs the task-scoped model resolver plus case reporter hooks
256
+ * - a project executor needs task-scoped models plus case reporter hooks
257
257
  * - custom scheduling logic wants the same hook shape as `TaskRunContext`
258
258
  *
259
259
  * Expects:
260
- * - `model` resolves configured models for the current task
260
+ * - `models` exposes configured model registrations for plugin helpers
261
261
  * - `reporterHooks` follows `TaskRunContext['reporterHooks']`
262
262
  * - `telemetry` follows `TaskRunContext['telemetry']`
263
263
  * - `runtimeConcurrency` follows `TaskRunContext['runtimeConcurrency']`
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { i as registerEvalDefinition, l as loadEnv, o as createNoopTelemetryRuntime, s as defineConfig } from "./registry-BHGMxjpA.mjs";
2
2
  import { t as createSchedulerQueue } from "./queue-DsZQkZO_.mjs";
3
- import { n as requiredEnvFrom } from "./env--94B0UtW.mjs";
3
+ import { n as requiredEnvFrom } from "./env-nV5rVErX.mjs";
4
4
  import { defineEval, defineTask } from "./config.mjs";
5
5
  import { expect } from "./expect.mjs";
6
6
  import { errorMessageFrom, sleep } from "@moeru/std";
@@ -11,4 +11,4 @@ function resolveModelByName(models, name) {
11
11
  //#endregion
12
12
  export { resolveModelByName as t };
13
13
 
14
- //# sourceMappingURL=models-DIGdOUpJ.mjs.map
14
+ //# sourceMappingURL=models-pBSRUZhY.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"models-DIGdOUpJ.mjs","names":[],"sources":["../src/config/models.ts"],"sourcesContent":["import type { TaskExecutionPolicy } from './types'\n\n/**\n * Canonical model definition consumed by vieval runtime and config.\n *\n * Use when:\n * - declaring models in `vieval.config.*`\n * - resolving task runtime models by id, alias, or concrete model name\n *\n * Expects:\n * - `id` to be stable and unique within one config\n * - `inferenceExecutorId` to match scheduler/executor identifiers\n *\n * Returns:\n * - one normalized model registration record\n */\nexport interface ModelDefinition {\n /**\n * Stable model id.\n */\n id: string\n /**\n * Inference-executor id used for matching and reporting.\n */\n inferenceExecutorId: string\n /**\n * Executor reference passed through config.\n *\n * `vieval` core treats this as opaque runtime metadata. Builder plugins can\n * narrow this field with plugin-specific executor input types.\n */\n inferenceExecutor: unknown\n /**\n * Concrete model name passed to the inference executor.\n */\n model: string\n /**\n * Alias names that can resolve this model.\n */\n aliases: string[]\n /**\n * Optional execution policy hints attached to this model.\n */\n executionPolicy?: TaskExecutionPolicy\n /**\n * Optional model-level call parameters.\n */\n parameters?: Record<string, unknown>\n}\n\n/**\n * Resolves one model by id, model name, or alias in registration order.\n *\n * Returns:\n * - the first matching model, or `undefined` when no match exists\n */\nexport function resolveModelByName(\n models: readonly ModelDefinition[],\n name: string,\n): ModelDefinition | undefined {\n return models.find(model => model.id === name || model.model === name || model.aliases.includes(name))\n}\n"],"mappings":";;;;;;;AAwDA,SAAgB,mBACd,QACA,MAC6B;AAC7B,QAAO,OAAO,MAAK,UAAS,MAAM,OAAO,QAAQ,MAAM,UAAU,QAAQ,MAAM,QAAQ,SAAS,KAAK,CAAC"}
1
+ {"version":3,"file":"models-pBSRUZhY.mjs","names":[],"sources":["../src/config/models.ts"],"sourcesContent":["import type { TaskExecutionPolicy } from './types'\n\n/**\n * Canonical model definition consumed by vieval runtime and config.\n *\n * Use when:\n * - declaring models in `vieval.config.*`\n * - resolving task runtime models by id, alias, or concrete model name\n *\n * Expects:\n * - `id` to be stable and unique within one config\n * - `inferenceExecutorId` to match scheduler/executor identifiers\n *\n * Returns:\n * - one normalized model registration record\n */\nexport interface ModelDefinition {\n /**\n * Stable model id.\n */\n id: string\n /**\n * Inference-executor id used for matching and reporting.\n */\n inferenceExecutorId: string\n /**\n * Executor reference passed through config.\n *\n * `vieval` core treats this as opaque runtime metadata. Builder plugins can\n * narrow this field with plugin-specific executor input types.\n */\n inferenceExecutor: unknown\n /**\n * Concrete model name passed to the inference executor.\n */\n model: string\n /**\n * Alias names that can resolve this model.\n */\n aliases: string[]\n /**\n * Optional execution policy hints attached to this model.\n */\n executionPolicy?: TaskExecutionPolicy\n /**\n * Optional model-level call parameters.\n */\n parameters?: Record<string, unknown>\n}\n\n/**\n * Resolves one model by id, model name, or alias in registration order.\n *\n * Returns:\n * - the first matching model, or `undefined` when no match exists\n */\nexport function resolveModelByName(\n models: readonly ModelDefinition[],\n name: string,\n): ModelDefinition | undefined {\n return models.find(model => model.id === name || model.model === name || model.aliases.includes(name))\n}\n"],"mappings":";;;;;;;AAwDA,SAAgB,mBACd,QACA,MAC6B;AAC7B,QAAO,OAAO,MAAK,UAAS,MAAM,OAAO,QAAQ,MAAM,UAAU,QAAQ,MAAM,QAAQ,SAAS,KAAK,CAAC"}
@@ -1,4 +1,4 @@
1
- import { D as TaskRunContext, f as MatrixDefinition, t as ConfigHookPlugin, w as TaskExecutionPolicy, z as ModelDefinition } from "../../index-5R1_k2nv.mjs";
1
+ import { D as TaskRunContext, R as ModelDefinition, f as MatrixDefinition, t as ConfigHookPlugin, w as TaskExecutionPolicy } from "../../index-BkjyCInx.mjs";
2
2
 
3
3
  //#region src/plugins/chat-models/runtime-config.d.ts
4
4
  /**
@@ -80,7 +80,7 @@ type ChatModelRuntimeConfig = OpenAIChatModelRuntimeConfig | OllamaChatModelRunt
80
80
  * Normalizes one configured chat model into runtime executor config.
81
81
  *
82
82
  * Use when:
83
- * - eval code needs typed provider constructor options from `context.model()`
83
+ * - eval code needs typed provider constructor options from a resolved model
84
84
  * - model parameters should be validated once with clear error messages
85
85
  *
86
86
  * Expects:
@@ -95,7 +95,7 @@ declare function toChatModelRuntimeConfig(model: ModelDefinition): ChatModelRunt
95
95
  * Resolves OpenAI runtime config from one resolved run-context model.
96
96
  *
97
97
  * Use when:
98
- * - task execution already has `context.model()` output
98
+ * - task execution already has a model resolved through chat-model helpers
99
99
  * - eval code wants typed OpenAI provider options with a concise helper name
100
100
  *
101
101
  * Expects:
@@ -109,7 +109,7 @@ declare function openaiFromRunContext(model: ModelDefinition): OpenAIChatModelRu
109
109
  * Resolves Ollama runtime config from one resolved run-context model.
110
110
  *
111
111
  * Use when:
112
- * - task execution already has `context.model()` output
112
+ * - task execution already has a model resolved through chat-model helpers
113
113
  * - eval code wants typed Ollama provider options with a concise helper name
114
114
  *
115
115
  * Expects:
@@ -123,7 +123,7 @@ declare function ollamaFromRunContext(model: ModelDefinition): OllamaChatModelRu
123
123
  * Resolves OpenRouter runtime config from one resolved run-context model.
124
124
  *
125
125
  * Use when:
126
- * - task execution already has `context.model()` output
126
+ * - task execution already has a model resolved through chat-model helpers
127
127
  * - eval code wants typed OpenRouter provider options with a concise helper name
128
128
  *
129
129
  * Expects:
@@ -540,6 +540,63 @@ interface ChatModelsPluginOptions {
540
540
  */
541
541
  models: readonly ChatModelDefinition[];
542
542
  }
543
+ /**
544
+ * Matrix scope that can carry a chat model selector.
545
+ */
546
+ type MatrixModelScope = 'eval' | 'run';
547
+ /**
548
+ * Options for resolving a chat model from a matrix axis.
549
+ */
550
+ interface ModelFromMatrixOptions {
551
+ /**
552
+ * Matrix axis whose selected value is a model id, model name, or alias.
553
+ */
554
+ axis: string;
555
+ }
556
+ type MatrixModelContext = Pick<TaskRunContext, 'models' | 'task'>;
557
+ /**
558
+ * Resolves a configured chat model from one scoped matrix axis.
559
+ *
560
+ * Use when:
561
+ * - a matrix axis selects the agent, judge, or another chat model role
562
+ * - eval code should keep model lookup semantics inside the chat-models plugin
563
+ *
564
+ * Expects:
565
+ * - `scope` to identify `context.task.matrix.run` or `context.task.matrix.eval`
566
+ * - `options.axis` to exist and contain a model id, model name, or alias
567
+ *
568
+ * Returns:
569
+ * - the configured model matching the selected matrix value
570
+ */
571
+ declare function modelFromMatrix(context: MatrixModelContext, scope: MatrixModelScope, options: ModelFromMatrixOptions): ModelDefinition;
572
+ /**
573
+ * Resolves a configured chat model from one run-matrix axis.
574
+ *
575
+ * Use when:
576
+ * - run matrix selects the model used by the system under evaluation
577
+ * - callers want the scoped helper instead of passing `scope: 'run'`
578
+ *
579
+ * Expects:
580
+ * - `options.axis` to exist in `context.task.matrix.run`
581
+ *
582
+ * Returns:
583
+ * - the configured model matching the selected run-matrix value
584
+ */
585
+ declare function modelFromRun(context: MatrixModelContext, options: ModelFromMatrixOptions): ModelDefinition;
586
+ /**
587
+ * Resolves a configured chat model from one eval-matrix axis.
588
+ *
589
+ * Use when:
590
+ * - eval matrix selects a judge, rubric, or evaluator model
591
+ * - callers want the scoped helper instead of passing `scope: 'eval'`
592
+ *
593
+ * Expects:
594
+ * - `options.axis` to exist in `context.task.matrix.eval`
595
+ *
596
+ * Returns:
597
+ * - the configured model matching the selected eval-matrix value
598
+ */
599
+ declare function modelFromEval(context: MatrixModelContext, options: ModelFromMatrixOptions): ModelDefinition;
543
600
  /**
544
601
  * Creates a run-matrix `model` axis from configured chat model names.
545
602
  *
@@ -571,5 +628,5 @@ declare function ChatProviders(options: ChatProvidersPluginOptions): Plugin;
571
628
  */
572
629
  declare function ChatModels(options: ChatModelsPluginOptions): Plugin;
573
630
  //#endregion
574
- export { ChatModelDefinition, ChatModelExecutorInput, ChatModelExecutorLike, ChatModelFromBaseOptions, ChatModelFromOptions, ChatModelHeaders, ChatModelInferenceExecutor, ChatModelResolverContext, ChatModelResolverValue, ChatModelRuntimeConfig, ChatModelTelemetryProvider, ChatModelToolCall, ChatModels, ChatModelsPluginOptions, ChatProviderDefinition, ChatProviderFromOptions, ChatProviders, ChatProvidersPluginOptions, EmitChatModelErrorTelemetryOptions, EmitChatModelRequestTelemetryOptions, EmitChatModelResponseTelemetryOptions, GenericChatModelInferenceExecutor, OllamaChatModelInferenceExecutor, OllamaChatModelRuntimeConfig, OpenAIChatModelInferenceExecutor, OpenAIChatModelRuntimeConfig, OpenRouterChatModelInferenceExecutor, OpenRouterChatModelRuntimeConfig, OptionalProviderEnvMap, Plugin, PluginConfig, RequiredProviderEnvMap, chatModelFrom, chatModelMatrix, chatProviderFrom, emitChatModelErrorTelemetry, emitChatModelRequestTelemetry, emitChatModelResponseTelemetry, extractChatModelToolCalls, extractMeteringDimensions, ollamaFromRunContext, openaiFromRunContext, openrouterFromRunContext, toChatModelRuntimeConfig };
631
+ export { ChatModelDefinition, ChatModelExecutorInput, ChatModelExecutorLike, ChatModelFromBaseOptions, ChatModelFromOptions, ChatModelHeaders, ChatModelInferenceExecutor, ChatModelResolverContext, ChatModelResolverValue, ChatModelRuntimeConfig, ChatModelTelemetryProvider, ChatModelToolCall, ChatModels, ChatModelsPluginOptions, ChatProviderDefinition, ChatProviderFromOptions, ChatProviders, ChatProvidersPluginOptions, EmitChatModelErrorTelemetryOptions, EmitChatModelRequestTelemetryOptions, EmitChatModelResponseTelemetryOptions, GenericChatModelInferenceExecutor, MatrixModelScope, ModelFromMatrixOptions, OllamaChatModelInferenceExecutor, OllamaChatModelRuntimeConfig, OpenAIChatModelInferenceExecutor, OpenAIChatModelRuntimeConfig, OpenRouterChatModelInferenceExecutor, OpenRouterChatModelRuntimeConfig, OptionalProviderEnvMap, Plugin, PluginConfig, RequiredProviderEnvMap, chatModelFrom, chatModelMatrix, chatProviderFrom, emitChatModelErrorTelemetry, emitChatModelRequestTelemetry, emitChatModelResponseTelemetry, extractChatModelToolCalls, extractMeteringDimensions, modelFromEval, modelFromMatrix, modelFromRun, ollamaFromRunContext, openaiFromRunContext, openrouterFromRunContext, toChatModelRuntimeConfig };
575
632
  //# sourceMappingURL=index.d.mts.map
@@ -1,4 +1,5 @@
1
- import { n as requiredEnvFrom, t as envFrom } from "../../env--94B0UtW.mjs";
1
+ import { n as requiredEnvFrom, t as envFrom } from "../../env-nV5rVErX.mjs";
2
+ import { t as resolveModelByName } from "../../models-pBSRUZhY.mjs";
2
3
  import process from "node:process";
3
4
  import { errorMessageFrom } from "@moeru/std";
4
5
  //#region src/plugins/chat-models/runtime-config.ts
@@ -7,15 +8,19 @@ function getParameters(model) {
7
8
  }
8
9
  function parseOptionalStringParameter(parameters, key, modelId) {
9
10
  const value = parameters[key];
10
- return envFrom(value == null ? void 0 : String(value), {
11
- name: `${modelId}.parameters.${key}`,
11
+ const normalized = value == null ? void 0 : String(value);
12
+ const name = `${modelId}.parameters.${key}`;
13
+ return envFrom({ [name]: normalized }, {
14
+ name,
12
15
  type: "string"
13
16
  });
14
17
  }
15
18
  function parseRequiredStringParameter(parameters, key, modelId) {
16
19
  const value = parameters[key];
17
- return requiredEnvFrom(value == null ? void 0 : String(value), {
18
- name: `${modelId}.parameters.${key}`,
20
+ const normalized = value == null ? void 0 : String(value);
21
+ const name = `${modelId}.parameters.${key}`;
22
+ return requiredEnvFrom({ [name]: normalized }, {
23
+ name,
19
24
  type: "string"
20
25
  });
21
26
  }
@@ -41,7 +46,7 @@ function parseHeadersParameter(parameters, modelId) {
41
46
  * Normalizes one configured chat model into runtime executor config.
42
47
  *
43
48
  * Use when:
44
- * - eval code needs typed provider constructor options from `context.model()`
49
+ * - eval code needs typed provider constructor options from a resolved model
45
50
  * - model parameters should be validated once with clear error messages
46
51
  *
47
52
  * Expects:
@@ -79,7 +84,7 @@ function toChatModelRuntimeConfig(model) {
79
84
  * Resolves OpenAI runtime config from one resolved run-context model.
80
85
  *
81
86
  * Use when:
82
- * - task execution already has `context.model()` output
87
+ * - task execution already has a model resolved through chat-model helpers
83
88
  * - eval code wants typed OpenAI provider options with a concise helper name
84
89
  *
85
90
  * Expects:
@@ -97,7 +102,7 @@ function openaiFromRunContext(model) {
97
102
  * Resolves Ollama runtime config from one resolved run-context model.
98
103
  *
99
104
  * Use when:
100
- * - task execution already has `context.model()` output
105
+ * - task execution already has a model resolved through chat-model helpers
101
106
  * - eval code wants typed Ollama provider options with a concise helper name
102
107
  *
103
108
  * Expects:
@@ -115,7 +120,7 @@ function ollamaFromRunContext(model) {
115
120
  * Resolves OpenRouter runtime config from one resolved run-context model.
116
121
  *
117
122
  * Use when:
118
- * - task execution already has `context.model()` output
123
+ * - task execution already has a model resolved through chat-model helpers
119
124
  * - eval code wants typed OpenRouter provider options with a concise helper name
120
125
  *
121
126
  * Expects:
@@ -332,30 +337,28 @@ async function resolveChatModelResolverValue(value, context) {
332
337
  return value;
333
338
  }
334
339
  function resolveRequiredStringValue(value, name) {
335
- return requiredEnvFrom(value, {
340
+ return requiredEnvFrom({ [name]: value }, {
336
341
  name,
337
342
  type: "string"
338
343
  });
339
344
  }
340
345
  function resolveOptionalStringValue(value, name) {
341
- return envFrom(value, {
346
+ return envFrom({ [name]: value }, {
342
347
  name,
343
348
  type: "string"
344
349
  });
345
350
  }
346
351
  function resolveOptionalEnvValue(env, envKey) {
347
- const options = {
352
+ return envFrom(env, {
348
353
  name: envKey,
349
354
  type: "string"
350
- };
351
- return envFrom(env[envKey], options);
355
+ });
352
356
  }
353
357
  function resolveRequiredEnvValue(env, envKey) {
354
- const options = {
358
+ return requiredEnvFrom(env, {
355
359
  name: envKey,
356
360
  type: "string"
357
- };
358
- return requiredEnvFrom(env[envKey], options);
361
+ });
359
362
  }
360
363
  function resolveProviderParameters(provider, env) {
361
364
  const parameters = { ...provider.parameters };
@@ -479,6 +482,59 @@ function chatProviderFrom(options) {
479
482
  };
480
483
  }
481
484
  /**
485
+ * Resolves a configured chat model from one scoped matrix axis.
486
+ *
487
+ * Use when:
488
+ * - a matrix axis selects the agent, judge, or another chat model role
489
+ * - eval code should keep model lookup semantics inside the chat-models plugin
490
+ *
491
+ * Expects:
492
+ * - `scope` to identify `context.task.matrix.run` or `context.task.matrix.eval`
493
+ * - `options.axis` to exist and contain a model id, model name, or alias
494
+ *
495
+ * Returns:
496
+ * - the configured model matching the selected matrix value
497
+ */
498
+ function modelFromMatrix(context, scope, options) {
499
+ const selectedModelName = context.task.matrix[scope][options.axis];
500
+ if (selectedModelName == null) throw new Error(`Missing ${scope} matrix axis "${options.axis}".`);
501
+ const model = resolveModelByName(context.models, selectedModelName);
502
+ if (model == null) throw new Error(`Unknown configured chat model "${selectedModelName}" from ${scope} matrix axis "${options.axis}".`);
503
+ return model;
504
+ }
505
+ /**
506
+ * Resolves a configured chat model from one run-matrix axis.
507
+ *
508
+ * Use when:
509
+ * - run matrix selects the model used by the system under evaluation
510
+ * - callers want the scoped helper instead of passing `scope: 'run'`
511
+ *
512
+ * Expects:
513
+ * - `options.axis` to exist in `context.task.matrix.run`
514
+ *
515
+ * Returns:
516
+ * - the configured model matching the selected run-matrix value
517
+ */
518
+ function modelFromRun(context, options) {
519
+ return modelFromMatrix(context, "run", options);
520
+ }
521
+ /**
522
+ * Resolves a configured chat model from one eval-matrix axis.
523
+ *
524
+ * Use when:
525
+ * - eval matrix selects a judge, rubric, or evaluator model
526
+ * - callers want the scoped helper instead of passing `scope: 'eval'`
527
+ *
528
+ * Expects:
529
+ * - `options.axis` to exist in `context.task.matrix.eval`
530
+ *
531
+ * Returns:
532
+ * - the configured model matching the selected eval-matrix value
533
+ */
534
+ function modelFromEval(context, options) {
535
+ return modelFromMatrix(context, "eval", options);
536
+ }
537
+ /**
482
538
  * Creates a run-matrix `model` axis from configured chat model names.
483
539
  *
484
540
  * Use when:
@@ -534,6 +590,6 @@ function ChatModels(options) {
534
590
  };
535
591
  }
536
592
  //#endregion
537
- export { ChatModels, ChatProviders, chatModelFrom, chatModelMatrix, chatProviderFrom, emitChatModelErrorTelemetry, emitChatModelRequestTelemetry, emitChatModelResponseTelemetry, extractChatModelToolCalls, extractMeteringDimensions, ollamaFromRunContext, openaiFromRunContext, openrouterFromRunContext, toChatModelRuntimeConfig };
593
+ export { ChatModels, ChatProviders, chatModelFrom, chatModelMatrix, chatProviderFrom, emitChatModelErrorTelemetry, emitChatModelRequestTelemetry, emitChatModelResponseTelemetry, extractChatModelToolCalls, extractMeteringDimensions, modelFromEval, modelFromMatrix, modelFromRun, ollamaFromRunContext, openaiFromRunContext, openrouterFromRunContext, toChatModelRuntimeConfig };
538
594
 
539
595
  //# sourceMappingURL=index.mjs.map