@anvia/core 1.7.1 → 1.9.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 (129) hide show
  1. package/README.md +3 -0
  2. package/dist/agent/agent-tool.js +4 -4
  3. package/dist/agent/agent.js +23 -23
  4. package/dist/agent/index.js +27 -27
  5. package/dist/agent/resolve-options.js +11 -11
  6. package/dist/agent/resolved-agent.js +24 -24
  7. package/dist/agent/team/agent-team.js +27 -27
  8. package/dist/agent/team/index.js +27 -27
  9. package/dist/agent/tool-catalog.js +9 -9
  10. package/dist/{chunk-WCJRGYF7.js → chunk-27MBNR47.js} +5 -5
  11. package/dist/{chunk-3YN5B5UW.js → chunk-3PSBUYXQ.js} +2 -2
  12. package/dist/chunk-3YVGQNTI.js +82 -0
  13. package/dist/chunk-3YVGQNTI.js.map +1 -0
  14. package/dist/{chunk-OBM7JJCK.js → chunk-5G4NMOTJ.js} +2 -2
  15. package/dist/{chunk-WBXRVW5I.js → chunk-7AV3PEYW.js} +3 -3
  16. package/dist/{chunk-SBWSXEIH.js → chunk-7FBSGD6E.js} +1 -1
  17. package/dist/chunk-7FBSGD6E.js.map +1 -0
  18. package/dist/{chunk-NWCJXAE5.js → chunk-7NWFT422.js} +5 -5
  19. package/dist/{chunk-F5BPVVC2.js → chunk-AGOZCYFP.js} +8 -8
  20. package/dist/chunk-AGPDR6FF.js +104 -0
  21. package/dist/chunk-AGPDR6FF.js.map +1 -0
  22. package/dist/chunk-AKQQG3IX.js +33 -0
  23. package/dist/chunk-AKQQG3IX.js.map +1 -0
  24. package/dist/{chunk-KHUWYYOH.js → chunk-AO2QL2VD.js} +57 -51
  25. package/dist/chunk-AO2QL2VD.js.map +1 -0
  26. package/dist/chunk-BRGNY5ZB.js +33 -0
  27. package/dist/chunk-BRGNY5ZB.js.map +1 -0
  28. package/dist/{chunk-ZMAF3I4H.js → chunk-CASF2TDK.js} +2 -2
  29. package/dist/{chunk-C36RVQHF.js → chunk-DRSKZVC6.js} +5 -5
  30. package/dist/{chunk-3BYFZYEV.js → chunk-EWTZ3IAH.js} +6 -6
  31. package/dist/chunk-F2UVTXNE.js +1 -0
  32. package/dist/chunk-F2UVTXNE.js.map +1 -0
  33. package/dist/chunk-IPNY5MMY.js +1 -0
  34. package/dist/chunk-IPNY5MMY.js.map +1 -0
  35. package/dist/{chunk-5ZS3DPPC.js → chunk-KDGMHES4.js} +4 -4
  36. package/dist/{chunk-GNBPXJC6.js → chunk-KL652GO5.js} +2 -2
  37. package/dist/{chunk-4IOC4SP6.js → chunk-KLDNHX4Z.js} +4 -4
  38. package/dist/{chunk-JJSMONFE.js → chunk-L2JI2GDH.js} +2 -2
  39. package/dist/{chunk-5H5EHU5O.js → chunk-M32FTMYD.js} +2 -2
  40. package/dist/chunk-M32FTMYD.js.map +1 -0
  41. package/dist/{chunk-JU3RX364.js → chunk-MEFGXAKJ.js} +2 -2
  42. package/dist/{chunk-IZH2ZAE3.js → chunk-MNBKSRS5.js} +2 -2
  43. package/dist/{chunk-OXIK4SIH.js → chunk-PILUQCGV.js} +2 -2
  44. package/dist/{chunk-GI6APIEU.js → chunk-R4AJ2EE3.js} +4 -4
  45. package/dist/chunk-RW32K6OO.js +100 -0
  46. package/dist/chunk-RW32K6OO.js.map +1 -0
  47. package/dist/{chunk-M7X36BQ7.js → chunk-V5NIO3J3.js} +3 -3
  48. package/dist/{chunk-XH2CVR4V.js → chunk-VUY2C2QD.js} +2 -2
  49. package/dist/{chunk-6TAWRKFK.js → chunk-WRYBALCQ.js} +5 -5
  50. package/dist/{chunk-E5MIZ6Z5.js → chunk-X35O3AQG.js} +2 -2
  51. package/dist/{chunk-GXVJGJAN.js → chunk-XQRMPPTC.js} +8 -8
  52. package/dist/{chunk-MYHGOXHQ.js → chunk-Y5FHUUNC.js} +5 -5
  53. package/dist/decision/decide.js +16 -0
  54. package/dist/decision/decide.js.map +1 -0
  55. package/dist/decision/errors.js +9 -0
  56. package/dist/decision/errors.js.map +1 -0
  57. package/dist/decision/index.d.ts +151 -0
  58. package/dist/decision/index.js +33 -0
  59. package/dist/decision/index.js.map +1 -0
  60. package/dist/decision/questions.js +16 -0
  61. package/dist/decision/questions.js.map +1 -0
  62. package/dist/decision/result.js +10 -0
  63. package/dist/decision/result.js.map +1 -0
  64. package/dist/decision/types.js +2 -0
  65. package/dist/decision/types.js.map +1 -0
  66. package/dist/decision/validation.js +15 -0
  67. package/dist/decision/validation.js.map +1 -0
  68. package/dist/embeddings/index.js +8 -8
  69. package/dist/evals/advanced-metrics.js +3 -3
  70. package/dist/evals/cli.js +3 -3
  71. package/dist/evals/index.js +8 -8
  72. package/dist/evals/metrics.js +4 -4
  73. package/dist/evals/runner.js +2 -2
  74. package/dist/guardrails/index.js +6 -6
  75. package/dist/guardrails/text.js +2 -2
  76. package/dist/index.d.ts +1 -0
  77. package/dist/index.js +69 -43
  78. package/dist/internal/agent-runtime/agent-run.js +19 -19
  79. package/dist/internal/agent-runtime/execution.js +1 -1
  80. package/dist/internal/agent-runtime/prepared-tool-call.js +2 -2
  81. package/dist/internal/agent-runtime/retrieval.js +7 -7
  82. package/dist/internal/agent-runtime/run-options.js +1 -1
  83. package/dist/internal/agent-runtime/tool-execution.js +12 -12
  84. package/dist/internal/agent.d.ts +13 -7
  85. package/dist/internal/agent.js +25 -25
  86. package/dist/internal/team-runtime/run.js +26 -26
  87. package/dist/internal/team-runtime/tools.js +4 -4
  88. package/dist/model-listing/index.js +1 -1
  89. package/dist/pipeline/index.js +3 -3
  90. package/dist/pipeline/pipeline.js +3 -3
  91. package/dist/skills/index.js +14 -14
  92. package/dist/skills/load.js +13 -13
  93. package/dist/skills/tools.js +12 -12
  94. package/dist/speech-generation/index.js +1 -1
  95. package/dist/tool/create-tool.js +3 -3
  96. package/dist/tool/dynamic-tools.js +8 -8
  97. package/dist/tool/index.js +17 -17
  98. package/dist/tool/question-tool.js +4 -4
  99. package/dist/tool/think-tool.js +4 -4
  100. package/dist/vector-store/index.js +10 -10
  101. package/dist/vector-store/ingest.js +2 -2
  102. package/dist/vector-store/retrieve.js +1 -1
  103. package/package.json +5 -1
  104. package/dist/chunk-5H5EHU5O.js.map +0 -1
  105. package/dist/chunk-KHUWYYOH.js.map +0 -1
  106. package/dist/chunk-SBWSXEIH.js.map +0 -1
  107. /package/dist/{chunk-WCJRGYF7.js.map → chunk-27MBNR47.js.map} +0 -0
  108. /package/dist/{chunk-3YN5B5UW.js.map → chunk-3PSBUYXQ.js.map} +0 -0
  109. /package/dist/{chunk-OBM7JJCK.js.map → chunk-5G4NMOTJ.js.map} +0 -0
  110. /package/dist/{chunk-WBXRVW5I.js.map → chunk-7AV3PEYW.js.map} +0 -0
  111. /package/dist/{chunk-NWCJXAE5.js.map → chunk-7NWFT422.js.map} +0 -0
  112. /package/dist/{chunk-F5BPVVC2.js.map → chunk-AGOZCYFP.js.map} +0 -0
  113. /package/dist/{chunk-ZMAF3I4H.js.map → chunk-CASF2TDK.js.map} +0 -0
  114. /package/dist/{chunk-C36RVQHF.js.map → chunk-DRSKZVC6.js.map} +0 -0
  115. /package/dist/{chunk-3BYFZYEV.js.map → chunk-EWTZ3IAH.js.map} +0 -0
  116. /package/dist/{chunk-5ZS3DPPC.js.map → chunk-KDGMHES4.js.map} +0 -0
  117. /package/dist/{chunk-GNBPXJC6.js.map → chunk-KL652GO5.js.map} +0 -0
  118. /package/dist/{chunk-4IOC4SP6.js.map → chunk-KLDNHX4Z.js.map} +0 -0
  119. /package/dist/{chunk-JJSMONFE.js.map → chunk-L2JI2GDH.js.map} +0 -0
  120. /package/dist/{chunk-JU3RX364.js.map → chunk-MEFGXAKJ.js.map} +0 -0
  121. /package/dist/{chunk-IZH2ZAE3.js.map → chunk-MNBKSRS5.js.map} +0 -0
  122. /package/dist/{chunk-OXIK4SIH.js.map → chunk-PILUQCGV.js.map} +0 -0
  123. /package/dist/{chunk-GI6APIEU.js.map → chunk-R4AJ2EE3.js.map} +0 -0
  124. /package/dist/{chunk-M7X36BQ7.js.map → chunk-V5NIO3J3.js.map} +0 -0
  125. /package/dist/{chunk-XH2CVR4V.js.map → chunk-VUY2C2QD.js.map} +0 -0
  126. /package/dist/{chunk-6TAWRKFK.js.map → chunk-WRYBALCQ.js.map} +0 -0
  127. /package/dist/{chunk-E5MIZ6Z5.js.map → chunk-X35O3AQG.js.map} +0 -0
  128. /package/dist/{chunk-GXVJGJAN.js.map → chunk-XQRMPPTC.js.map} +0 -0
  129. /package/dist/{chunk-MYHGOXHQ.js.map → chunk-Y5FHUUNC.js.map} +0 -0
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  AgentRun
3
- } from "./chunk-KHUWYYOH.js";
3
+ } from "./chunk-AO2QL2VD.js";
4
4
  import {
5
5
  normalizeMemoryScope
6
6
  } from "./chunk-LAIATEUB.js";
@@ -12,7 +12,7 @@ import {
12
12
  } from "./chunk-NPJ2T3L5.js";
13
13
  import {
14
14
  prepareAgentTools
15
- } from "./chunk-JJSMONFE.js";
15
+ } from "./chunk-L2JI2GDH.js";
16
16
  import {
17
17
  getRegisteredAgentTool,
18
18
  registerAgentToolState
@@ -22,7 +22,7 @@ import {
22
22
  } from "./chunk-GLMYZ6OA.js";
23
23
  import {
24
24
  resolveAgentOptions
25
- } from "./chunk-OXIK4SIH.js";
25
+ } from "./chunk-PILUQCGV.js";
26
26
  import {
27
27
  cloneFrozenPlainData,
28
28
  snapshotAgentContext,
@@ -35,7 +35,7 @@ import {
35
35
  } from "./chunk-KY4VXIN2.js";
36
36
  import {
37
37
  createAgentTool
38
- } from "./chunk-3YN5B5UW.js";
38
+ } from "./chunk-3PSBUYXQ.js";
39
39
  import {
40
40
  isStreamingCompletionModel
41
41
  } from "./chunk-LGPXCJJO.js";
@@ -44,7 +44,7 @@ import {
44
44
  } from "./chunk-4ONUNWGC.js";
45
45
  import {
46
46
  prepareToolCall
47
- } from "./chunk-WCJRGYF7.js";
47
+ } from "./chunk-27MBNR47.js";
48
48
  import {
49
49
  ToolNotFoundError
50
50
  } from "./chunk-J6S6MT7O.js";
@@ -155,4 +155,4 @@ var Agent = class {
155
155
  export {
156
156
  Agent
157
157
  };
158
- //# sourceMappingURL=chunk-3BYFZYEV.js.map
158
+ //# sourceMappingURL=chunk-EWTZ3IAH.js.map
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=chunk-F2UVTXNE.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=chunk-IPNY5MMY.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,9 +1,9 @@
1
- import {
2
- createSkillTools
3
- } from "./chunk-OBM7JJCK.js";
4
1
  import {
5
2
  skillInstructions
6
3
  } from "./chunk-JBQNCUXA.js";
4
+ import {
5
+ createSkillTools
6
+ } from "./chunk-5G4NMOTJ.js";
7
7
 
8
8
  // src/skills/load.ts
9
9
  async function loadSkills(loaders) {
@@ -26,4 +26,4 @@ async function loadSkills(loaders) {
26
26
  export {
27
27
  loadSkills
28
28
  };
29
- //# sourceMappingURL=chunk-5ZS3DPPC.js.map
29
+ //# sourceMappingURL=chunk-KDGMHES4.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  runEvalSuite
3
- } from "./chunk-4IOC4SP6.js";
3
+ } from "./chunk-KLDNHX4Z.js";
4
4
 
5
5
  // src/evals/cli.ts
6
6
  var EvalAssertionError = class extends Error {
@@ -352,4 +352,4 @@ export {
352
352
  assertEvalOutcomes,
353
353
  runEvalCli
354
354
  };
355
- //# sourceMappingURL=chunk-GNBPXJC6.js.map
355
+ //# sourceMappingURL=chunk-KL652GO5.js.map
@@ -1,9 +1,6 @@
1
1
  import {
2
2
  defaultEvalTraceSelector
3
3
  } from "./chunk-PHLGGRHC.js";
4
- import {
5
- errorMessage
6
- } from "./chunk-ZYXMWEL4.js";
7
4
  import {
8
5
  EvalOutcome
9
6
  } from "./chunk-EJR6VVB3.js";
@@ -14,6 +11,9 @@ import {
14
11
  createConcurrencyLimiter,
15
12
  createEvalCaseSignal
16
13
  } from "./chunk-4OSA3MMA.js";
14
+ import {
15
+ errorMessage
16
+ } from "./chunk-ZYXMWEL4.js";
17
17
  import {
18
18
  Usage
19
19
  } from "./chunk-HJ6KTQTZ.js";
@@ -660,4 +660,4 @@ export {
660
660
  EvalFailFastError,
661
661
  runEvalSuite
662
662
  };
663
- //# sourceMappingURL=chunk-4IOC4SP6.js.map
663
+ //# sourceMappingURL=chunk-KLDNHX4Z.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  isToolIndex
3
- } from "./chunk-XH2CVR4V.js";
3
+ } from "./chunk-VUY2C2QD.js";
4
4
  import {
5
5
  isMcpTool
6
6
  } from "./chunk-PLDJCCVL.js";
@@ -165,4 +165,4 @@ function snapshotToolIndex(index) {
165
165
  export {
166
166
  prepareAgentTools
167
167
  };
168
- //# sourceMappingURL=chunk-JJSMONFE.js.map
168
+ //# sourceMappingURL=chunk-L2JI2GDH.js.map
@@ -1,7 +1,7 @@
1
1
  // src/internal/agent-runtime/execution.ts
2
- var AGENT_RUN_EXECUTION_VERSION = 1;
2
+ var AGENT_RUN_EXECUTION_VERSION = 2;
3
3
 
4
4
  export {
5
5
  AGENT_RUN_EXECUTION_VERSION
6
6
  };
7
- //# sourceMappingURL=chunk-5H5EHU5O.js.map
7
+ //# sourceMappingURL=chunk-M32FTMYD.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/internal/agent-runtime/execution.ts"],"sourcesContent":["import type { CompletionRequest, CompletionResponse, ToolCallPart } from \"../../completion\";\nimport type { NormalizedToolOutput, ToolCallContext } from \"../../tool\";\nimport type { AgentStreamEvent } from \"../../agent/run-types\";\n\n/** Runtime capability marker: older core versions must fail before accepting durable work. */\nexport const AGENT_RUN_EXECUTION_VERSION = 2;\n\n/** Normalized generation progress; never includes raw provider responses. */\nexport type AgentCompletionStreamEvent = Extract<\n AgentStreamEvent<unknown, unknown>,\n {\n type:\n | \"text_delta\"\n | \"reasoning_delta\"\n | \"tool_call_delta\"\n | \"tool_call\"\n | \"source\"\n | \"provider_tool_call\";\n }\n>;\n\nexport type AgentCompletionStream = AsyncGenerator<AgentCompletionStreamEvent, CompletionResponse>;\n\nexport type AgentToolExecutionResult =\n | { output: NormalizedToolOutput; failed: false }\n | { output: NormalizedToolOutput; failed: true; error: unknown };\n\n/** Internal persistence boundary used by execution runtimes. Callbacks own external effects. */\nexport interface AgentRunExecution {\n completion(\n turn: number,\n request: CompletionRequest,\n execute: () => Promise<CompletionResponse>,\n ): Promise<CompletionResponse>;\n streamCompletion?(\n turn: number,\n request: CompletionRequest,\n execute: () => AgentCompletionStream,\n ): AgentCompletionStream;\n tool(\n call: { turn: number; toolCall: ToolCallPart; args: string },\n execute: (context?: Pick<ToolCallContext, \"operationId\">) => Promise<AgentToolExecutionResult>,\n ): Promise<AgentToolExecutionResult>;\n}\n"],"mappings":";AAKO,IAAM,8BAA8B;","names":[]}
@@ -2,7 +2,7 @@ import {
2
2
  attachPreparedToolOwner,
3
3
  preparedToolInput,
4
4
  withoutPreparedToolInput
5
- } from "./chunk-WCJRGYF7.js";
5
+ } from "./chunk-27MBNR47.js";
6
6
  import {
7
7
  assertToolApprovalRequirement
8
8
  } from "./chunk-YZVFIW5D.js";
@@ -55,4 +55,4 @@ function snapshotApprovalRequirement(requirement) {
55
55
  export {
56
56
  createTool
57
57
  };
58
- //# sourceMappingURL=chunk-JU3RX364.js.map
58
+ //# sourceMappingURL=chunk-MEFGXAKJ.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createTool
3
- } from "./chunk-JU3RX364.js";
3
+ } from "./chunk-MEFGXAKJ.js";
4
4
 
5
5
  // src/tool/question-tool.ts
6
6
  import { z } from "zod";
@@ -44,4 +44,4 @@ export {
44
44
  createQuestionTool,
45
45
  isQuestionTool
46
46
  };
47
- //# sourceMappingURL=chunk-IZH2ZAE3.js.map
47
+ //# sourceMappingURL=chunk-MNBKSRS5.js.map
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-6BTJC3ES.js";
7
7
  import {
8
8
  isToolIndex
9
- } from "./chunk-XH2CVR4V.js";
9
+ } from "./chunk-VUY2C2QD.js";
10
10
  import {
11
11
  isMcpTool
12
12
  } from "./chunk-PLDJCCVL.js";
@@ -109,4 +109,4 @@ export {
109
109
  resolveAgentOptions,
110
110
  markResolvedAgentOptions
111
111
  };
112
- //# sourceMappingURL=chunk-OXIK4SIH.js.map
112
+ //# sourceMappingURL=chunk-PILUQCGV.js.map
@@ -7,13 +7,13 @@ import {
7
7
  resolveActualText,
8
8
  resolveExpected
9
9
  } from "./chunk-ZPXOBQDS.js";
10
+ import {
11
+ EvalOutcome
12
+ } from "./chunk-EJR6VVB3.js";
10
13
  import {
11
14
  errorMessage,
12
15
  formatValue
13
16
  } from "./chunk-ZYXMWEL4.js";
14
- import {
15
- EvalOutcome
16
- } from "./chunk-EJR6VVB3.js";
17
17
  import {
18
18
  mapWithConcurrency
19
19
  } from "./chunk-4FIVU53H.js";
@@ -1113,4 +1113,4 @@ export {
1113
1113
  turnRelevancy,
1114
1114
  knowledgeRetention
1115
1115
  };
1116
- //# sourceMappingURL=chunk-GI6APIEU.js.map
1116
+ //# sourceMappingURL=chunk-R4AJ2EE3.js.map
@@ -0,0 +1,100 @@
1
+ import {
2
+ DecisionCapabilityError
3
+ } from "./chunk-BRGNY5ZB.js";
4
+ import {
5
+ isJsonValue
6
+ } from "./chunk-4C7AXYOM.js";
7
+
8
+ // src/decision/validation.ts
9
+ function isRecord(value) {
10
+ if (typeof value !== "object" || value === null) return false;
11
+ const prototype = Object.getPrototypeOf(value);
12
+ if (prototype !== Object.prototype && prototype !== null) return false;
13
+ return Reflect.ownKeys(value).every((key) => {
14
+ const descriptor = Object.getOwnPropertyDescriptor(value, key);
15
+ return typeof key === "string" && descriptor?.enumerable === true && "value" in descriptor;
16
+ });
17
+ }
18
+ function assertQuestion(value) {
19
+ if (!isRecord(value)) throw new TypeError("Decision questions must be plain data objects.");
20
+ if (typeof value.instructions !== "string" || value.instructions.trim().length === 0) {
21
+ throw new TypeError("Decision instructions must be a non-empty string.");
22
+ }
23
+ switch (value.type) {
24
+ case "choice":
25
+ case "multi-label":
26
+ if (!isRecord(value.options) || !isJsonValue(value.options) || Object.keys(value.options).length === 0 || Object.keys(value.options).some((key) => key.trim().length === 0)) {
27
+ throw new TypeError("Decision options must contain non-empty labels with JSON criteria.");
28
+ }
29
+ if (value.type === "multi-label" && value.threshold !== void 0) {
30
+ if (!isProbability(value.threshold)) {
31
+ throw new RangeError("Multi-label threshold must be between zero and one.");
32
+ }
33
+ }
34
+ break;
35
+ case "score":
36
+ if (!Array.isArray(value.rubric) || value.rubric.length < 2 || !isJsonValue(value.rubric)) {
37
+ throw new TypeError("Decision rubric must contain at least two JSON levels.");
38
+ }
39
+ break;
40
+ case "check":
41
+ break;
42
+ default:
43
+ throw new TypeError("Unknown decision question type.");
44
+ }
45
+ }
46
+ function assertRequest(request, model) {
47
+ if (!isJsonValue(request.state)) throw new TypeError("Decision state must be JSON-compatible.");
48
+ if (!isRecord(request.questions) || Object.keys(request.questions).length === 0) {
49
+ throw new TypeError("Decision questions must be a non-empty plain data object.");
50
+ }
51
+ if (request.providerOptions !== void 0 && (!isRecord(request.providerOptions) || !isJsonValue(request.providerOptions))) {
52
+ throw new TypeError("Decision providerOptions must be a JSON object.");
53
+ }
54
+ const kinds = /* @__PURE__ */ new Set();
55
+ for (const [name, question] of Object.entries(request.questions)) {
56
+ if (name.trim().length === 0) throw new TypeError("Decision question names must be non-empty.");
57
+ assertQuestion(question);
58
+ const support = model.capabilities.questionSupport[question.type];
59
+ if (support !== "native" && support !== "composed") {
60
+ throw new DecisionCapabilityError({
61
+ provider: model.provider,
62
+ modelId: model.modelId,
63
+ questionType: question.type
64
+ });
65
+ }
66
+ kinds.add(question.type);
67
+ const limits = model.capabilities.limits;
68
+ if (question.type === "choice") {
69
+ assertLimit(Object.keys(question.options).length, limits?.maxChoiceOptions, "choice options");
70
+ } else if (question.type === "multi-label") {
71
+ assertLimit(Object.keys(question.options).length, limits?.maxMultiLabelOptions, "labels");
72
+ } else if (question.type === "score") {
73
+ assertLimit(question.rubric.length, limits?.maxRubricLevels, "rubric levels");
74
+ }
75
+ }
76
+ if (kinds.size > 1 && !model.capabilities.mixedQuestions) {
77
+ throw new TypeError(`${model.provider}/${model.modelId} does not support mixed questions.`);
78
+ }
79
+ assertLimit(
80
+ Object.keys(request.questions).length,
81
+ model.capabilities.limits?.maxQuestionsPerRequest,
82
+ "questions"
83
+ );
84
+ }
85
+ function isProbability(value) {
86
+ return typeof value === "number" && Number.isFinite(value) && value >= 0 && value <= 1;
87
+ }
88
+ function assertLimit(count, limit, name) {
89
+ if (limit !== void 0 && count > limit) {
90
+ throw new RangeError(`Decision request exceeds the model limit of ${limit} ${name}.`);
91
+ }
92
+ }
93
+
94
+ export {
95
+ isRecord,
96
+ assertQuestion,
97
+ assertRequest,
98
+ isProbability
99
+ };
100
+ //# sourceMappingURL=chunk-RW32K6OO.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/decision/validation.ts"],"sourcesContent":["import { isJsonValue } from \"../completion/json\";\nimport { DecisionCapabilityError } from \"./errors\";\nimport type { DecisionModel, DecisionQuestion, DecisionRequest } from \"./types\";\n\nexport function isRecord(value: unknown): value is Record<string, unknown> {\n if (typeof value !== \"object\" || value === null) return false;\n const prototype = Object.getPrototypeOf(value);\n if (prototype !== Object.prototype && prototype !== null) return false;\n return Reflect.ownKeys(value).every((key) => {\n const descriptor = Object.getOwnPropertyDescriptor(value, key);\n return typeof key === \"string\" && descriptor?.enumerable === true && \"value\" in descriptor;\n });\n}\n\nexport function assertQuestion(value: unknown): asserts value is DecisionQuestion {\n if (!isRecord(value)) throw new TypeError(\"Decision questions must be plain data objects.\");\n if (typeof value.instructions !== \"string\" || value.instructions.trim().length === 0) {\n throw new TypeError(\"Decision instructions must be a non-empty string.\");\n }\n switch (value.type) {\n case \"choice\":\n case \"multi-label\":\n if (\n !isRecord(value.options) ||\n !isJsonValue(value.options) ||\n Object.keys(value.options).length === 0 ||\n Object.keys(value.options).some((key) => key.trim().length === 0)\n ) {\n throw new TypeError(\"Decision options must contain non-empty labels with JSON criteria.\");\n }\n if (value.type === \"multi-label\" && value.threshold !== undefined) {\n if (!isProbability(value.threshold)) {\n throw new RangeError(\"Multi-label threshold must be between zero and one.\");\n }\n }\n break;\n case \"score\":\n if (!Array.isArray(value.rubric) || value.rubric.length < 2 || !isJsonValue(value.rubric)) {\n throw new TypeError(\"Decision rubric must contain at least two JSON levels.\");\n }\n break;\n case \"check\":\n break;\n default:\n throw new TypeError(\"Unknown decision question type.\");\n }\n}\n\nexport function assertRequest(request: DecisionRequest, model: DecisionModel): void {\n if (!isJsonValue(request.state)) throw new TypeError(\"Decision state must be JSON-compatible.\");\n if (!isRecord(request.questions) || Object.keys(request.questions).length === 0) {\n throw new TypeError(\"Decision questions must be a non-empty plain data object.\");\n }\n if (\n request.providerOptions !== undefined &&\n (!isRecord(request.providerOptions) || !isJsonValue(request.providerOptions))\n ) {\n throw new TypeError(\"Decision providerOptions must be a JSON object.\");\n }\n const kinds = new Set<string>();\n for (const [name, question] of Object.entries(request.questions)) {\n if (name.trim().length === 0) throw new TypeError(\"Decision question names must be non-empty.\");\n assertQuestion(question);\n const support = model.capabilities.questionSupport[question.type];\n if (support !== \"native\" && support !== \"composed\") {\n throw new DecisionCapabilityError({\n provider: model.provider,\n modelId: model.modelId,\n questionType: question.type,\n });\n }\n kinds.add(question.type);\n const limits = model.capabilities.limits;\n if (question.type === \"choice\") {\n assertLimit(Object.keys(question.options).length, limits?.maxChoiceOptions, \"choice options\");\n } else if (question.type === \"multi-label\") {\n assertLimit(Object.keys(question.options).length, limits?.maxMultiLabelOptions, \"labels\");\n } else if (question.type === \"score\") {\n assertLimit(question.rubric.length, limits?.maxRubricLevels, \"rubric levels\");\n }\n }\n if (kinds.size > 1 && !model.capabilities.mixedQuestions) {\n throw new TypeError(`${model.provider}/${model.modelId} does not support mixed questions.`);\n }\n assertLimit(\n Object.keys(request.questions).length,\n model.capabilities.limits?.maxQuestionsPerRequest,\n \"questions\",\n );\n}\n\nexport function isProbability(value: unknown): value is number {\n return typeof value === \"number\" && Number.isFinite(value) && value >= 0 && value <= 1;\n}\n\nfunction assertLimit(count: number, limit: number | undefined, name: string): void {\n if (limit !== undefined && count > limit) {\n throw new RangeError(`Decision request exceeds the model limit of ${limit} ${name}.`);\n }\n}\n"],"mappings":"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","names":[]}
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  Agent
3
- } from "./chunk-3BYFZYEV.js";
3
+ } from "./chunk-EWTZ3IAH.js";
4
4
  import {
5
5
  getAgentToolState
6
6
  } from "./chunk-A7BXVZXZ.js";
7
7
  import {
8
8
  markResolvedAgentOptions
9
- } from "./chunk-OXIK4SIH.js";
9
+ } from "./chunk-PILUQCGV.js";
10
10
 
11
11
  // src/agent/resolved-agent.ts
12
12
  function createResolvedAgent(options) {
@@ -45,4 +45,4 @@ export {
45
45
  createResolvedAgent,
46
46
  getResolvedAgentOptions
47
47
  };
48
- //# sourceMappingURL=chunk-M7X36BQ7.js.map
48
+ //# sourceMappingURL=chunk-V5NIO3J3.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  InMemoryVectorStore
3
- } from "./chunk-MYHGOXHQ.js";
3
+ } from "./chunk-Y5FHUUNC.js";
4
4
  import {
5
5
  retrieveDocuments
6
6
  } from "./chunk-CB2L2NIQ.js";
@@ -108,4 +108,4 @@ export {
108
108
  createToolIndex,
109
109
  isToolIndex
110
110
  };
111
- //# sourceMappingURL=chunk-XH2CVR4V.js.map
111
+ //# sourceMappingURL=chunk-VUY2C2QD.js.map
@@ -1,11 +1,11 @@
1
- import {
2
- defineInputGuardrail,
3
- defineOutputGuardrail
4
- } from "./chunk-6BTJC3ES.js";
5
1
  import {
6
2
  allow,
7
3
  block
8
4
  } from "./chunk-MT3BLVYN.js";
5
+ import {
6
+ defineInputGuardrail,
7
+ defineOutputGuardrail
8
+ } from "./chunk-6BTJC3ES.js";
9
9
 
10
10
  // src/guardrails/text.ts
11
11
  var guardrails = {
@@ -83,4 +83,4 @@ function replaceTextPattern(text, pattern, replacement) {
83
83
  export {
84
84
  guardrails
85
85
  };
86
- //# sourceMappingURL=chunk-6TAWRKFK.js.map
86
+ //# sourceMappingURL=chunk-WRYBALCQ.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createTool
3
- } from "./chunk-JU3RX364.js";
3
+ } from "./chunk-MEFGXAKJ.js";
4
4
 
5
5
  // src/internal/team-runtime/tools.ts
6
6
  import { z } from "zod";
@@ -64,4 +64,4 @@ export {
64
64
  teamTools,
65
65
  TEAM_INSTRUCTIONS
66
66
  };
67
- //# sourceMappingURL=chunk-E5MIZ6Z5.js.map
67
+ //# sourceMappingURL=chunk-X35O3AQG.js.map
@@ -1,7 +1,3 @@
1
- import {
2
- snapshotPipelineObservability,
3
- startPipelineRunObservers
4
- } from "./chunk-ETYB5JO6.js";
5
1
  import {
6
2
  childContext,
7
3
  combineAbortSignals,
@@ -9,9 +5,6 @@ import {
9
5
  runNode,
10
6
  stageContext
11
7
  } from "./chunk-EKZRAWBP.js";
12
- import {
13
- PipelineAgentSuspensionError
14
- } from "./chunk-R6722CIU.js";
15
8
  import {
16
9
  appendComposedGraph,
17
10
  appendParallelBranch,
@@ -21,6 +14,13 @@ import {
21
14
  withOutputNode,
22
15
  withTerminalPaths
23
16
  } from "./chunk-V3FFZWF3.js";
17
+ import {
18
+ snapshotPipelineObservability,
19
+ startPipelineRunObservers
20
+ } from "./chunk-ETYB5JO6.js";
21
+ import {
22
+ PipelineAgentSuspensionError
23
+ } from "./chunk-R6722CIU.js";
24
24
  import {
25
25
  extract
26
26
  } from "./chunk-VCOGUS3Q.js";
@@ -372,4 +372,4 @@ function normalizeParallelBranches(branches) {
372
372
  export {
373
373
  Pipeline
374
374
  };
375
- //# sourceMappingURL=chunk-GXVJGJAN.js.map
375
+ //# sourceMappingURL=chunk-XQRMPPTC.js.map
@@ -1,12 +1,12 @@
1
- import {
2
- matchesVectorFilter
3
- } from "./chunk-5WLIHNNJ.js";
4
1
  import {
5
2
  LshIndex
6
3
  } from "./chunk-ESOFEAYK.js";
7
4
  import {
8
5
  retrieveDocuments
9
6
  } from "./chunk-CB2L2NIQ.js";
7
+ import {
8
+ matchesVectorFilter
9
+ } from "./chunk-5WLIHNNJ.js";
10
10
  import {
11
11
  cosineSimilarity
12
12
  } from "./chunk-7F53DOML.js";
@@ -16,7 +16,7 @@ import {
16
16
  } from "./chunk-5V533R7F.js";
17
17
  import {
18
18
  createTool
19
- } from "./chunk-JU3RX364.js";
19
+ } from "./chunk-MEFGXAKJ.js";
20
20
 
21
21
  // src/vector-store/index.ts
22
22
  import { z } from "zod";
@@ -233,4 +233,4 @@ export {
233
233
  InMemoryVectorStore,
234
234
  createVectorSearchTool
235
235
  };
236
- //# sourceMappingURL=chunk-MYHGOXHQ.js.map
236
+ //# sourceMappingURL=chunk-Y5FHUUNC.js.map
@@ -0,0 +1,16 @@
1
+ import {
2
+ decide,
3
+ decideBatch
4
+ } from "../chunk-3YVGQNTI.js";
5
+ import "../chunk-AGPDR6FF.js";
6
+ import "../chunk-RW32K6OO.js";
7
+ import "../chunk-BRGNY5ZB.js";
8
+ import "../chunk-4FIVU53H.js";
9
+ import "../chunk-4C7AXYOM.js";
10
+ import "../chunk-POXHJF3H.js";
11
+ import "../chunk-USRKPEQN.js";
12
+ export {
13
+ decide,
14
+ decideBatch
15
+ };
16
+ //# sourceMappingURL=decide.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,9 @@
1
+ import {
2
+ DecisionCapabilityError,
3
+ DecisionProviderOutputError
4
+ } from "../chunk-BRGNY5ZB.js";
5
+ export {
6
+ DecisionCapabilityError,
7
+ DecisionProviderOutputError
8
+ };
9
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}