@wix/evalforge-types 0.61.0 → 0.62.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
@@ -592,7 +592,8 @@ var AssertionTypeSchema = z22.enum([
592
592
  "build_passed",
593
593
  "time_limit",
594
594
  "cost",
595
- "llm_judge"
595
+ "llm_judge",
596
+ "api_call"
596
597
  ]);
597
598
  var AssertionParameterTypeSchema = z22.enum([
598
599
  "string",
@@ -671,6 +672,20 @@ var LlmJudgeConfigSchema = z22.object({
671
672
  /** User-defined parameters for this assertion */
672
673
  parameters: z22.array(AssertionParameterSchema).optional()
673
674
  });
675
+ var ApiCallConfigSchema = z22.strictObject({
676
+ /** URL to call */
677
+ url: z22.string().min(1),
678
+ /** HTTP method (default GET) */
679
+ method: z22.enum(["GET", "POST"]).optional(),
680
+ /** Request body (JSON string, for POST requests) */
681
+ requestBody: z22.string().optional(),
682
+ /** Expected JSON response to validate against (subset match — extra fields in actual are OK) */
683
+ expectedResponse: z22.string().min(1),
684
+ /** Request headers as JSON string of key-value pairs */
685
+ requestHeaders: z22.string().optional(),
686
+ /** Request timeout in milliseconds (default 30000) */
687
+ timeoutMs: z22.number().int().positive().optional()
688
+ });
674
689
  var AssertionBaseFields = {
675
690
  /** When true, the assertion's pass/fail logic is inverted (NOT operator). */
676
691
  negate: z22.boolean().optional()
@@ -695,6 +710,10 @@ var LlmJudgeAssertionSchema = LlmJudgeConfigSchema.extend({
695
710
  type: z22.literal("llm_judge"),
696
711
  ...AssertionBaseFields
697
712
  });
713
+ var ApiCallAssertionSchema = ApiCallConfigSchema.extend({
714
+ type: z22.literal("api_call"),
715
+ ...AssertionBaseFields
716
+ });
698
717
  var TimeAssertionSchema = TimeConfigSchema.extend({
699
718
  type: z22.literal("time_limit"),
700
719
  ...AssertionBaseFields
@@ -705,7 +724,8 @@ var AssertionSchema = z22.union([
705
724
  BuildPassedAssertionSchema,
706
725
  TimeAssertionSchema,
707
726
  CostAssertionSchema,
708
- LlmJudgeAssertionSchema
727
+ LlmJudgeAssertionSchema,
728
+ ApiCallAssertionSchema
709
729
  ]);
710
730
  var AssertionConfigSchema = z22.union([
711
731
  LlmJudgeConfigSchema,
@@ -714,6 +734,8 @@ var AssertionConfigSchema = z22.union([
714
734
  // requires skillNames
715
735
  ToolCalledWithParamConfigSchema,
716
736
  // requires toolName, uses strictObject
737
+ ApiCallConfigSchema,
738
+ // requires url + expectedResponse, uses strictObject
717
739
  TimeConfigSchema,
718
740
  // requires maxDurationMs, uses strictObject
719
741
  CostConfigSchema,
@@ -737,6 +759,8 @@ function validateAssertionConfig(type, config) {
737
759
  return TimeConfigSchema.safeParse(config).success;
738
760
  case "llm_judge":
739
761
  return LlmJudgeConfigSchema.safeParse(config).success;
762
+ case "api_call":
763
+ return ApiCallConfigSchema.safeParse(config).success;
740
764
  default:
741
765
  return false;
742
766
  }
@@ -1408,7 +1432,8 @@ var SYSTEM_ASSERTION_IDS = {
1408
1432
  BUILD_PASSED: "system:build_passed",
1409
1433
  TIME_LIMIT: "system:time_limit",
1410
1434
  COST: "system:cost",
1411
- LLM_JUDGE: "system:llm_judge"
1435
+ LLM_JUDGE: "system:llm_judge",
1436
+ API_CALL: "system:api_call"
1412
1437
  };
1413
1438
  function isSystemAssertionId(id) {
1414
1439
  return id.startsWith("system:");
@@ -1563,6 +1588,54 @@ var SYSTEM_ASSERTIONS = {
1563
1588
  required: false
1564
1589
  }
1565
1590
  ]
1591
+ },
1592
+ [SYSTEM_ASSERTION_IDS.API_CALL]: {
1593
+ id: SYSTEM_ASSERTION_IDS.API_CALL,
1594
+ name: "API Call",
1595
+ description: "Call an API endpoint and verify the response contains expected data",
1596
+ type: "api_call",
1597
+ parameters: [
1598
+ {
1599
+ name: "url",
1600
+ label: "URL",
1601
+ type: "string",
1602
+ required: true
1603
+ },
1604
+ {
1605
+ name: "method",
1606
+ label: "HTTP Method",
1607
+ type: "string",
1608
+ required: false,
1609
+ defaultValue: "GET"
1610
+ },
1611
+ {
1612
+ name: "requestBody",
1613
+ label: "Request Body (JSON)",
1614
+ type: "string",
1615
+ required: false
1616
+ },
1617
+ {
1618
+ name: "expectedResponse",
1619
+ label: "Expected Response (JSON)",
1620
+ type: "string",
1621
+ required: true
1622
+ },
1623
+ {
1624
+ name: "requestHeaders",
1625
+ label: "Headers (JSON)",
1626
+ type: "string",
1627
+ required: false,
1628
+ advanced: true
1629
+ },
1630
+ {
1631
+ name: "timeoutMs",
1632
+ label: "Timeout (ms)",
1633
+ type: "number",
1634
+ required: false,
1635
+ defaultValue: 3e4,
1636
+ advanced: true
1637
+ }
1638
+ ]
1566
1639
  }
1567
1640
  };
1568
1641
  function getSystemAssertions() {
@@ -1585,6 +1658,8 @@ export {
1585
1658
  AgentTypeSchema,
1586
1659
  AllowedCommands,
1587
1660
  AnyModelSchema,
1661
+ ApiCallAssertionSchema,
1662
+ ApiCallConfigSchema,
1588
1663
  ApiCallSchema,
1589
1664
  AssertionConfigSchema,
1590
1665
  AssertionParameterSchema,