@wix/evalforge-types 0.86.0 → 0.88.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/build/index.mjs CHANGED
@@ -143,7 +143,13 @@ function normalizeModelId(modelId) {
143
143
  var nullToUndefined = (val) => val === null ? void 0 : val;
144
144
  var ModelConfigSchema = z4.object({
145
145
  model: AnyModelSchema,
146
- temperature: z4.preprocess(nullToUndefined, z4.number().min(0).max(1).optional()).optional(),
146
+ // In Zod v4, z.preprocess() creates ZodEffects which is not recognized as optional
147
+ // by the object schema. Outer .optional() ensures missing keys are accepted; inner
148
+ // .optional() handles null→undefined conversion from the preprocessor.
149
+ temperature: z4.preprocess(
150
+ nullToUndefined,
151
+ z4.number().min(0).max(1).optional()
152
+ ).optional(),
147
153
  maxTokens: z4.preprocess(nullToUndefined, z4.number().min(1).optional()).optional(),
148
154
  /** Number of agentic turns. 0 = unlimited (agent runs until done or timeout). */
149
155
  maxTurns: z4.preprocess(nullToUndefined, z4.number().int().min(0).optional()).optional()
@@ -1938,79 +1944,101 @@ var CreateProjectInputSchema = ProjectSchema.omit({
1938
1944
  var UpdateProjectInputSchema = CreateProjectInputSchema.partial();
1939
1945
 
1940
1946
  // src/template/template.ts
1947
+ import { z as z35 } from "zod";
1948
+ var SourceFileSchema = z35.object({
1949
+ path: z35.string().min(1),
1950
+ content: z35.string()
1951
+ });
1952
+ var ExtraFileSchema = z35.object({
1953
+ path: z35.string().min(1),
1954
+ content: z35.string().optional(),
1955
+ gitSource: GitHubSourceSchema.optional()
1956
+ }).refine((ef) => ef.content !== void 0 || ef.gitSource !== void 0, {
1957
+ message: "ExtraFile must have either content or gitSource"
1958
+ });
1941
1959
  var TemplateSchema = TenantEntitySchema.extend({
1942
- /** GitHub source reference for fetching template files */
1943
- source: GitHubSourceSchema.optional()
1960
+ source: GitHubSourceSchema.optional(),
1961
+ sourceFiles: z35.array(SourceFileSchema).optional(),
1962
+ extraFiles: z35.array(ExtraFileSchema).optional()
1944
1963
  });
1964
+ var singleSourceKind = (t) => !(t.source && t.sourceFiles?.length);
1965
+ var singleSourceKindError = {
1966
+ message: "Set source or sourceFiles, not both"
1967
+ };
1945
1968
  var CreateTemplateInputSchema = TemplateSchema.omit({
1946
1969
  id: true,
1947
1970
  createdAt: true,
1948
1971
  updatedAt: true,
1949
1972
  deleted: true
1950
- });
1951
- var UpdateTemplateInputSchema = CreateTemplateInputSchema.partial();
1973
+ }).refine(singleSourceKind, singleSourceKindError);
1974
+ var UpdateTemplateInputSchema = TemplateSchema.omit({
1975
+ id: true,
1976
+ createdAt: true,
1977
+ updatedAt: true,
1978
+ deleted: true
1979
+ }).partial().refine(singleSourceKind, singleSourceKindError);
1952
1980
 
1953
1981
  // src/agent/agent-config.ts
1954
- import { z as z35 } from "zod";
1955
- var BaseAgentConfigSchema = z35.object({
1982
+ import { z as z36 } from "zod";
1983
+ var BaseAgentConfigSchema = z36.object({
1956
1984
  /** Model ID (Claude or OpenAI). */
1957
1985
  model: AnyModelSchema.optional(),
1958
1986
  /** Sampling temperature (0–1). */
1959
- temperature: z35.number().min(0).max(1).optional(),
1987
+ temperature: z36.number().min(0).max(1).optional(),
1960
1988
  /** Max output tokens per turn. */
1961
- maxTokens: z35.number().int().min(1).optional(),
1989
+ maxTokens: z36.number().int().min(1).optional(),
1962
1990
  /** Number of agentic turns. 0 = unlimited. */
1963
- maxTurns: z35.number().int().min(0).optional(),
1991
+ maxTurns: z36.number().int().min(0).optional(),
1964
1992
  /** Execution timeout in milliseconds. Overrides the default maxTurns-based calculation. */
1965
- maxDurationMs: z35.number().int().min(0).optional()
1993
+ maxDurationMs: z36.number().int().min(0).optional()
1966
1994
  });
1967
- var EffortLevelSchema = z35.enum(["low", "medium", "high", "max"]);
1995
+ var EffortLevelSchema = z36.enum(["low", "medium", "high", "max"]);
1968
1996
  var ClaudeCodeConfigSchema = BaseAgentConfigSchema.extend({
1969
1997
  /** Extended thinking token budget. */
1970
- maxThinkingTokens: z35.number().int().min(0).optional(),
1998
+ maxThinkingTokens: z36.number().int().min(0).optional(),
1971
1999
  /** Override the default allowedTools list passed to the SDK. */
1972
- allowedTools: z35.array(z35.string()).optional(),
2000
+ allowedTools: z36.array(z36.string()).optional(),
1973
2001
  /** Tools to remove from the model's context entirely. */
1974
- disallowedTools: z35.array(z35.string()).optional(),
2002
+ disallowedTools: z36.array(z36.string()).optional(),
1975
2003
  /** Controls thinking depth: low, medium, high, max. */
1976
2004
  effort: EffortLevelSchema.optional(),
1977
2005
  /** Maximum USD spend per run. Stops execution when reached. */
1978
- maxBudgetUsd: z35.number().min(0).optional()
2006
+ maxBudgetUsd: z36.number().min(0).optional()
1979
2007
  });
1980
- var PermissionValueSchema = z35.enum(["allow", "deny"]);
1981
- var OpenCodePermissionSchema = z35.record(
1982
- z35.string(),
1983
- z35.union([PermissionValueSchema, z35.record(z35.string(), PermissionValueSchema)])
2008
+ var PermissionValueSchema = z36.enum(["allow", "deny"]);
2009
+ var OpenCodePermissionSchema = z36.record(
2010
+ z36.string(),
2011
+ z36.union([PermissionValueSchema, z36.record(z36.string(), PermissionValueSchema)])
1984
2012
  );
1985
- var ThinkingVariantSchema = z35.enum(["high", "low", "none"]);
2013
+ var ThinkingVariantSchema = z36.enum(["high", "low", "none"]);
1986
2014
  var OpenCodeConfigSchema = BaseAgentConfigSchema.extend({
1987
2015
  /** Permission overrides (defaults: allow-all). */
1988
2016
  permission: OpenCodePermissionSchema.optional(),
1989
2017
  /** Maps to `--variant` CLI flag. 'none' omits --thinking entirely. Default: 'high'. */
1990
2018
  thinkingVariant: ThinkingVariantSchema.optional(),
1991
2019
  /** Nucleus sampling (0–1). Alternative to temperature. */
1992
- topP: z35.number().min(0).max(1).optional()
2020
+ topP: z36.number().min(0).max(1).optional()
1993
2021
  }).omit({ maxTokens: true });
1994
- var ReasoningEffortSchema = z35.enum(["low", "medium", "high"]);
2022
+ var ReasoningEffortSchema = z36.enum(["low", "medium", "high"]);
1995
2023
  var SimpleAgentConfigSchema = BaseAgentConfigSchema.extend({
1996
2024
  /** Anthropic thinking budget in tokens. Default: 10 000. */
1997
- thinkingBudgetTokens: z35.number().int().min(0).optional(),
2025
+ thinkingBudgetTokens: z36.number().int().min(0).optional(),
1998
2026
  /** Nucleus sampling (0–1). Alternative to temperature. */
1999
- topP: z35.number().min(0).max(1).optional(),
2027
+ topP: z36.number().min(0).max(1).optional(),
2000
2028
  /** Integer seed for deterministic/reproducible results (if model supports it). */
2001
- seed: z35.number().int().optional(),
2029
+ seed: z36.number().int().optional(),
2002
2030
  /** Stop sequences — model stops when generating any of these strings. */
2003
- stopSequences: z35.array(z35.string()).optional(),
2031
+ stopSequences: z36.array(z36.string()).optional(),
2004
2032
  /** OpenAI reasoning effort level. Default: 'high'. */
2005
2033
  reasoningEffort: ReasoningEffortSchema.optional(),
2006
2034
  /** Frequency penalty (−2 to 2). Reduces repetition of same tokens. */
2007
- frequencyPenalty: z35.number().min(-2).max(2).optional(),
2035
+ frequencyPenalty: z36.number().min(-2).max(2).optional(),
2008
2036
  /** Presence penalty (−2 to 2). Encourages topic diversity. */
2009
- presencePenalty: z35.number().min(-2).max(2).optional()
2037
+ presencePenalty: z36.number().min(-2).max(2).optional()
2010
2038
  });
2011
2039
 
2012
2040
  // src/schedule/eval-schedule.ts
2013
- import { z as z36 } from "zod";
2041
+ import { z as z37 } from "zod";
2014
2042
  var FrequencyType = /* @__PURE__ */ ((FrequencyType2) => {
2015
2043
  FrequencyType2["DAILY"] = "daily";
2016
2044
  FrequencyType2["WEEKDAY"] = "weekday";
@@ -2020,31 +2048,31 @@ var FrequencyType = /* @__PURE__ */ ((FrequencyType2) => {
2020
2048
  })(FrequencyType || {});
2021
2049
  var EvalScheduleSchema = TenantEntitySchema.extend({
2022
2050
  /** Whether the schedule is active */
2023
- enabled: z36.boolean(),
2051
+ enabled: z37.boolean(),
2024
2052
  /** Test suite to run */
2025
- suiteId: z36.string(),
2053
+ suiteId: z37.string(),
2026
2054
  /** Preset that provides agent + entities for this schedule */
2027
- presetId: z36.string(),
2055
+ presetId: z37.string(),
2028
2056
  /** How often to run */
2029
- frequencyType: z36.nativeEnum(FrequencyType),
2057
+ frequencyType: z37.nativeEnum(FrequencyType),
2030
2058
  /** Time of day in 24h format (HH:MM), hours 00-23, minutes 00-59 */
2031
- timeOfDay: z36.string().regex(/^([01]\d|2[0-3]):[0-5]\d$/),
2059
+ timeOfDay: z37.string().regex(/^([01]\d|2[0-3]):[0-5]\d$/),
2032
2060
  /** Day of week (0=Sun, 6=Sat) for weekly schedules */
2033
- dayOfWeek: z36.number().min(0).max(6).optional(),
2061
+ dayOfWeek: z37.number().min(0).max(6).optional(),
2034
2062
  /** Day of month (1-31) for monthly schedules */
2035
- dayOfMonth: z36.number().min(1).max(31).optional(),
2063
+ dayOfMonth: z37.number().min(1).max(31).optional(),
2036
2064
  /** IANA timezone (e.g., 'America/New_York') */
2037
- timezone: z36.string(),
2065
+ timezone: z37.string(),
2038
2066
  /** ID of the last eval run created by this schedule */
2039
- lastRunId: z36.string().optional(),
2067
+ lastRunId: z37.string().optional(),
2040
2068
  /** Denormalized status of the last run */
2041
- lastRunStatus: z36.string().optional(),
2069
+ lastRunStatus: z37.string().optional(),
2042
2070
  /** ISO timestamp of the last run */
2043
- lastRunAt: z36.string().optional(),
2071
+ lastRunAt: z37.string().optional(),
2044
2072
  /** Next scheduled run time in UTC (pre-computed for efficient querying, set by backend) */
2045
- nextRunAt: z36.string().optional(),
2073
+ nextRunAt: z37.string().optional(),
2046
2074
  /** Per-scenario variable values forwarded to runs triggered by this schedule (scenarioId → varName → value) */
2047
- variables: z36.record(z36.string(), z36.record(z36.string(), z36.string())).optional()
2075
+ variables: z37.record(z37.string(), z37.record(z37.string(), z37.string())).optional()
2048
2076
  });
2049
2077
  function isValidTimezone(tz) {
2050
2078
  try {
@@ -2057,14 +2085,14 @@ function isValidTimezone(tz) {
2057
2085
  function validateScheduleFields(data, ctx, options) {
2058
2086
  if (data.frequencyType === "weekly" /* WEEKLY */ && data.dayOfWeek == null) {
2059
2087
  ctx.addIssue({
2060
- code: z36.ZodIssueCode.custom,
2088
+ code: z37.ZodIssueCode.custom,
2061
2089
  message: "dayOfWeek is required for weekly schedules",
2062
2090
  path: ["dayOfWeek"]
2063
2091
  });
2064
2092
  }
2065
2093
  if (data.frequencyType === "monthly" /* MONTHLY */ && data.dayOfMonth == null) {
2066
2094
  ctx.addIssue({
2067
- code: z36.ZodIssueCode.custom,
2095
+ code: z37.ZodIssueCode.custom,
2068
2096
  message: "dayOfMonth is required for monthly schedules",
2069
2097
  path: ["dayOfMonth"]
2070
2098
  });
@@ -2072,7 +2100,7 @@ function validateScheduleFields(data, ctx, options) {
2072
2100
  const shouldValidateTz = options.partial ? data.timezone !== void 0 : true;
2073
2101
  if (shouldValidateTz && !isValidTimezone(data.timezone)) {
2074
2102
  ctx.addIssue({
2075
- code: z36.ZodIssueCode.custom,
2103
+ code: z37.ZodIssueCode.custom,
2076
2104
  message: "Invalid IANA timezone",
2077
2105
  path: ["timezone"]
2078
2106
  });
@@ -2193,6 +2221,7 @@ export {
2193
2221
  EvaluationResultSchema,
2194
2222
  ExecutionTraceSchema,
2195
2223
  ExpectedFileSchema,
2224
+ ExtraFileSchema,
2196
2225
  FileContentCheckSchema,
2197
2226
  FileContentTestSchema,
2198
2227
  FileModificationSchema,
@@ -2256,6 +2285,7 @@ export {
2256
2285
  SkillWasCalledAssertionSchema,
2257
2286
  SkillWasCalledConfigSchema,
2258
2287
  SkillWithLatestVersionSchema,
2288
+ SourceFileSchema,
2259
2289
  SubAgentSchema,
2260
2290
  TRACE_EVENT_PREFIX,
2261
2291
  TargetSchema,