@anvia/core 1.8.0 → 1.10.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 (113) hide show
  1. package/README.md +1 -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 +12 -12
  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-F5BPVVC2.js → chunk-2K7NSWUC.js} +4 -4
  12. package/dist/{chunk-3YN5B5UW.js → chunk-3PSBUYXQ.js} +2 -2
  13. package/dist/chunk-547CQSO2.js +100 -0
  14. package/dist/chunk-547CQSO2.js.map +1 -0
  15. package/dist/{chunk-OBM7JJCK.js → chunk-5G4NMOTJ.js} +2 -2
  16. package/dist/{chunk-RMOCTCS2.js → chunk-7AV3PEYW.js} +3 -3
  17. package/dist/{chunk-JIYOCTRF.js → chunk-7NWFT422.js} +4 -4
  18. package/dist/{chunk-ZDS7AHAX.js → chunk-AO2QL2VD.js} +18 -18
  19. package/dist/chunk-BH7RLRLQ.js +104 -0
  20. package/dist/chunk-BH7RLRLQ.js.map +1 -0
  21. package/dist/{chunk-ZMAF3I4H.js → chunk-CASF2TDK.js} +2 -2
  22. package/dist/{chunk-C36RVQHF.js → chunk-DRSKZVC6.js} +5 -5
  23. package/dist/{chunk-EWCRSYS6.js → chunk-EWTZ3IAH.js} +6 -6
  24. package/dist/chunk-F2UVTXNE.js +1 -0
  25. package/dist/chunk-F2UVTXNE.js.map +1 -0
  26. package/dist/chunk-IPNY5MMY.js +1 -0
  27. package/dist/chunk-IPNY5MMY.js.map +1 -0
  28. package/dist/{chunk-4EBIM3LP.js → chunk-KDGMHES4.js} +2 -2
  29. package/dist/{chunk-JJSMONFE.js → chunk-L2JI2GDH.js} +2 -2
  30. package/dist/{chunk-JU3RX364.js → chunk-MEFGXAKJ.js} +2 -2
  31. package/dist/{chunk-IZH2ZAE3.js → chunk-MNBKSRS5.js} +2 -2
  32. package/dist/chunk-PFSWAJTY.js +33 -0
  33. package/dist/chunk-PFSWAJTY.js.map +1 -0
  34. package/dist/{chunk-OXIK4SIH.js → chunk-PILUQCGV.js} +2 -2
  35. package/dist/{chunk-WSPB4OUU.js → chunk-V5NIO3J3.js} +3 -3
  36. package/dist/{chunk-XH2CVR4V.js → chunk-VUY2C2QD.js} +2 -2
  37. package/dist/{chunk-4IC3CQRL.js → chunk-VZ5ZZBNX.js} +5 -5
  38. package/dist/chunk-WGUE44ZD.js +82 -0
  39. package/dist/chunk-WGUE44ZD.js.map +1 -0
  40. package/dist/{chunk-6TAWRKFK.js → chunk-WRYBALCQ.js} +5 -5
  41. package/dist/{chunk-E5MIZ6Z5.js → chunk-X35O3AQG.js} +2 -2
  42. package/dist/{chunk-GXVJGJAN.js → chunk-XQRMPPTC.js} +8 -8
  43. package/dist/chunk-Y4Q66NQY.js +48 -0
  44. package/dist/chunk-Y4Q66NQY.js.map +1 -0
  45. package/dist/{chunk-MYHGOXHQ.js → chunk-Y5FHUUNC.js} +5 -5
  46. package/dist/decision/decide.js +16 -0
  47. package/dist/decision/decide.js.map +1 -0
  48. package/dist/decision/errors.js +11 -0
  49. package/dist/decision/errors.js.map +1 -0
  50. package/dist/decision/index.d.ts +164 -0
  51. package/dist/decision/index.js +35 -0
  52. package/dist/decision/index.js.map +1 -0
  53. package/dist/decision/questions.js +16 -0
  54. package/dist/decision/questions.js.map +1 -0
  55. package/dist/decision/result.js +10 -0
  56. package/dist/decision/result.js.map +1 -0
  57. package/dist/decision/types.js +2 -0
  58. package/dist/decision/types.js.map +1 -0
  59. package/dist/decision/validation.js +15 -0
  60. package/dist/decision/validation.js.map +1 -0
  61. package/dist/embeddings/index.js +8 -8
  62. package/dist/evals/index.js +2 -2
  63. package/dist/evals/metrics.js +2 -2
  64. package/dist/guardrails/index.js +7 -7
  65. package/dist/guardrails/runtime.js +2 -2
  66. package/dist/guardrails/text.js +2 -2
  67. package/dist/index.d.ts +1 -0
  68. package/dist/index.js +70 -42
  69. package/dist/internal/agent-runtime/agent-run.js +19 -19
  70. package/dist/internal/agent-runtime/prepared-tool-call.js +2 -2
  71. package/dist/internal/agent-runtime/retrieval.js +7 -7
  72. package/dist/internal/agent-runtime/tool-execution.js +12 -12
  73. package/dist/internal/agent.js +24 -24
  74. package/dist/internal/team-runtime/run.js +26 -26
  75. package/dist/internal/team-runtime/tools.js +4 -4
  76. package/dist/model-listing/index.js +1 -1
  77. package/dist/pipeline/index.js +3 -3
  78. package/dist/pipeline/pipeline.js +3 -3
  79. package/dist/skills/index.js +13 -13
  80. package/dist/skills/load.js +13 -13
  81. package/dist/skills/tools.js +12 -12
  82. package/dist/speech-generation/index.js +1 -1
  83. package/dist/tool/create-tool.js +3 -3
  84. package/dist/tool/dynamic-tools.js +8 -8
  85. package/dist/tool/index.js +17 -17
  86. package/dist/tool/question-tool.js +4 -4
  87. package/dist/tool/think-tool.js +4 -4
  88. package/dist/vector-store/index.js +10 -10
  89. package/dist/vector-store/ingest.js +2 -2
  90. package/dist/vector-store/retrieve.js +1 -1
  91. package/package.json +5 -1
  92. /package/dist/{chunk-WCJRGYF7.js.map → chunk-27MBNR47.js.map} +0 -0
  93. /package/dist/{chunk-F5BPVVC2.js.map → chunk-2K7NSWUC.js.map} +0 -0
  94. /package/dist/{chunk-3YN5B5UW.js.map → chunk-3PSBUYXQ.js.map} +0 -0
  95. /package/dist/{chunk-OBM7JJCK.js.map → chunk-5G4NMOTJ.js.map} +0 -0
  96. /package/dist/{chunk-RMOCTCS2.js.map → chunk-7AV3PEYW.js.map} +0 -0
  97. /package/dist/{chunk-JIYOCTRF.js.map → chunk-7NWFT422.js.map} +0 -0
  98. /package/dist/{chunk-ZDS7AHAX.js.map → chunk-AO2QL2VD.js.map} +0 -0
  99. /package/dist/{chunk-ZMAF3I4H.js.map → chunk-CASF2TDK.js.map} +0 -0
  100. /package/dist/{chunk-C36RVQHF.js.map → chunk-DRSKZVC6.js.map} +0 -0
  101. /package/dist/{chunk-EWCRSYS6.js.map → chunk-EWTZ3IAH.js.map} +0 -0
  102. /package/dist/{chunk-4EBIM3LP.js.map → chunk-KDGMHES4.js.map} +0 -0
  103. /package/dist/{chunk-JJSMONFE.js.map → chunk-L2JI2GDH.js.map} +0 -0
  104. /package/dist/{chunk-JU3RX364.js.map → chunk-MEFGXAKJ.js.map} +0 -0
  105. /package/dist/{chunk-IZH2ZAE3.js.map → chunk-MNBKSRS5.js.map} +0 -0
  106. /package/dist/{chunk-OXIK4SIH.js.map → chunk-PILUQCGV.js.map} +0 -0
  107. /package/dist/{chunk-WSPB4OUU.js.map → chunk-V5NIO3J3.js.map} +0 -0
  108. /package/dist/{chunk-XH2CVR4V.js.map → chunk-VUY2C2QD.js.map} +0 -0
  109. /package/dist/{chunk-4IC3CQRL.js.map → chunk-VZ5ZZBNX.js.map} +0 -0
  110. /package/dist/{chunk-6TAWRKFK.js.map → chunk-WRYBALCQ.js.map} +0 -0
  111. /package/dist/{chunk-E5MIZ6Z5.js.map → chunk-X35O3AQG.js.map} +0 -0
  112. /package/dist/{chunk-GXVJGJAN.js.map → chunk-XQRMPPTC.js.map} +0 -0
  113. /package/dist/{chunk-MYHGOXHQ.js.map → chunk-Y5FHUUNC.js.map} +0 -0
@@ -0,0 +1,33 @@
1
+ import {
2
+ assertQuestion
3
+ } from "./chunk-547CQSO2.js";
4
+
5
+ // src/decision/questions.ts
6
+ function choice(options) {
7
+ const question = { ...options, type: "choice" };
8
+ assertQuestion(question);
9
+ return question;
10
+ }
11
+ function multiLabel(options) {
12
+ const question = { ...options, type: "multi-label" };
13
+ assertQuestion(question);
14
+ return question;
15
+ }
16
+ function score(options) {
17
+ const question = { ...options, type: "score" };
18
+ assertQuestion(question);
19
+ return question;
20
+ }
21
+ function check(options) {
22
+ const question = { ...options, type: "check" };
23
+ assertQuestion(question);
24
+ return question;
25
+ }
26
+
27
+ export {
28
+ choice,
29
+ multiLabel,
30
+ score,
31
+ check
32
+ };
33
+ //# sourceMappingURL=chunk-PFSWAJTY.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/decision/questions.ts"],"sourcesContent":["import type {\n CheckQuestion,\n ChoiceQuestion,\n DecisionOptions,\n DecisionRubric,\n MultiLabelQuestion,\n ScoreQuestion,\n} from \"./types\";\nimport { assertQuestion } from \"./validation\";\n\nexport function choice<const Options extends DecisionOptions>(\n options: Omit<ChoiceQuestion<Options>, \"type\">,\n): ChoiceQuestion<Options> {\n const question: ChoiceQuestion<Options> = { ...options, type: \"choice\" };\n assertQuestion(question);\n return question;\n}\n\nexport function multiLabel<const Options extends DecisionOptions>(\n options: Omit<MultiLabelQuestion<Options>, \"type\">,\n): MultiLabelQuestion<Options> {\n const question: MultiLabelQuestion<Options> = { ...options, type: \"multi-label\" };\n assertQuestion(question);\n return question;\n}\n\nexport function score<const Rubric extends DecisionRubric>(\n options: Omit<ScoreQuestion<Rubric>, \"type\">,\n): ScoreQuestion<Rubric> {\n const question: ScoreQuestion<Rubric> = { ...options, type: \"score\" };\n assertQuestion(question);\n return question;\n}\n\nexport function check(options: Omit<CheckQuestion, \"type\">): CheckQuestion {\n const question: CheckQuestion = { ...options, type: \"check\" };\n assertQuestion(question);\n return question;\n}\n"],"mappings":";;;;;AAUO,SAAS,OACd,SACyB;AACzB,QAAM,WAAoC,EAAE,GAAG,SAAS,MAAM,SAAS;AACvE,iBAAe,QAAQ;AACvB,SAAO;AACT;AAEO,SAAS,WACd,SAC6B;AAC7B,QAAM,WAAwC,EAAE,GAAG,SAAS,MAAM,cAAc;AAChF,iBAAe,QAAQ;AACvB,SAAO;AACT;AAEO,SAAS,MACd,SACuB;AACvB,QAAM,WAAkC,EAAE,GAAG,SAAS,MAAM,QAAQ;AACpE,iBAAe,QAAQ;AACvB,SAAO;AACT;AAEO,SAAS,MAAM,SAAqD;AACzE,QAAM,WAA0B,EAAE,GAAG,SAAS,MAAM,QAAQ;AAC5D,iBAAe,QAAQ;AACvB,SAAO;AACT;","names":[]}
@@ -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
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  Agent
3
- } from "./chunk-EWCRSYS6.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-WSPB4OUU.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,12 +1,12 @@
1
- import {
2
- rewriteMessageText,
3
- textFromMessage
4
- } from "./chunk-ZXLCTQUX.js";
5
1
  import {
6
2
  allow,
7
3
  inputActions,
8
4
  outputActions
9
5
  } from "./chunk-MT3BLVYN.js";
6
+ import {
7
+ rewriteMessageText,
8
+ textFromMessage
9
+ } from "./chunk-ZXLCTQUX.js";
10
10
 
11
11
  // src/guardrails/runtime.ts
12
12
  async function runInputGuardrails(policies, context) {
@@ -136,4 +136,4 @@ export {
136
136
  runInputGuardrails,
137
137
  runOutputGuardrails
138
138
  };
139
- //# sourceMappingURL=chunk-4IC3CQRL.js.map
139
+ //# sourceMappingURL=chunk-VZ5ZZBNX.js.map
@@ -0,0 +1,82 @@
1
+ import {
2
+ assertResult
3
+ } from "./chunk-BH7RLRLQ.js";
4
+ import {
5
+ assertRequest
6
+ } from "./chunk-547CQSO2.js";
7
+ import {
8
+ mapWithConcurrency
9
+ } from "./chunk-4FIVU53H.js";
10
+ import {
11
+ resolveRetryOptions,
12
+ runWithRetries
13
+ } from "./chunk-POXHJF3H.js";
14
+ import {
15
+ throwIfAborted
16
+ } from "./chunk-USRKPEQN.js";
17
+
18
+ // src/decision/decide.ts
19
+ async function decide(options) {
20
+ throwIfAborted(options.abortSignal);
21
+ const request = {
22
+ state: options.state,
23
+ questions: options.questions,
24
+ providerOptions: options.providerOptions
25
+ };
26
+ assertRequest(request, options.model);
27
+ const retries = options.retries === void 0 || options.retries === false ? void 0 : resolveRetryOptions(options.retries);
28
+ return runWithRetries(
29
+ async () => {
30
+ throwIfAborted(options.abortSignal);
31
+ let result;
32
+ try {
33
+ result = await options.model.decision(request, { abortSignal: options.abortSignal });
34
+ } catch (error) {
35
+ throwIfAborted(options.abortSignal);
36
+ throw error;
37
+ }
38
+ throwIfAborted(options.abortSignal);
39
+ assertResult(result, request, options.model);
40
+ return result;
41
+ },
42
+ retries,
43
+ { streaming: false, abortSignal: options.abortSignal }
44
+ );
45
+ }
46
+ async function decideBatch(options) {
47
+ throwIfAborted(options.abortSignal);
48
+ if (!Number.isSafeInteger(options.concurrency) || options.concurrency <= 0) {
49
+ throw new RangeError("concurrency must be a positive safe integer.");
50
+ }
51
+ const inputs = Array.from(options.inputs);
52
+ const items = await mapWithConcurrency(
53
+ inputs.map((input, index) => ({ input, index })),
54
+ options.concurrency,
55
+ async ({
56
+ input,
57
+ index
58
+ }) => {
59
+ throwIfAborted(options.abortSignal);
60
+ try {
61
+ const result = await decide({
62
+ ...input,
63
+ model: options.model,
64
+ retries: options.retries,
65
+ abortSignal: options.abortSignal
66
+ });
67
+ return { index, status: "completed", result };
68
+ } catch (error) {
69
+ throwIfAborted(options.abortSignal);
70
+ return { index, status: "failed", error };
71
+ }
72
+ }
73
+ );
74
+ throwIfAborted(options.abortSignal);
75
+ return { items };
76
+ }
77
+
78
+ export {
79
+ decide,
80
+ decideBatch
81
+ };
82
+ //# sourceMappingURL=chunk-WGUE44ZD.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/decision/decide.ts"],"sourcesContent":["import { throwIfAborted } from \"../internal/abort\";\nimport { mapWithConcurrency } from \"../internal/concurrency\";\nimport { resolveRetryOptions, runWithRetries } from \"../retry\";\nimport { assertResult } from \"./result\";\nimport type {\n DecideBatchOptions,\n DecideOptions,\n DecisionBatchItem,\n DecisionBatchResult,\n DecisionModel,\n DecisionQuestions,\n DecisionRawResponseOf,\n DecisionRequest,\n DecisionResult,\n} from \"./types\";\nimport { assertRequest } from \"./validation\";\n\nexport async function decide<\n const Questions extends DecisionQuestions,\n Model extends DecisionModel,\n>(\n options: DecideOptions<Questions, Model>,\n): Promise<DecisionResult<Questions, DecisionRawResponseOf<Model>>> {\n throwIfAborted(options.abortSignal);\n const request: DecisionRequest<Questions> = {\n state: options.state,\n questions: options.questions,\n providerOptions: options.providerOptions,\n };\n assertRequest(request, options.model);\n const retries =\n options.retries === undefined || options.retries === false\n ? undefined\n : resolveRetryOptions(options.retries);\n return runWithRetries(\n async () => {\n throwIfAborted(options.abortSignal);\n let result;\n try {\n result = await options.model.decision(request, { abortSignal: options.abortSignal });\n } catch (error) {\n throwIfAborted(options.abortSignal);\n throw error;\n }\n throwIfAborted(options.abortSignal);\n assertResult(result, request, options.model);\n return result as DecisionResult<Questions, DecisionRawResponseOf<Model>>;\n },\n retries,\n { streaming: false, abortSignal: options.abortSignal },\n );\n}\n\n/** Execute independent inputs with bounded concurrency, preserving order and individual failures. */\nexport async function decideBatch<\n const Questions extends DecisionQuestions,\n Model extends DecisionModel,\n>(\n options: DecideBatchOptions<Questions, Model>,\n): Promise<DecisionBatchResult<Questions, DecisionRawResponseOf<Model>>> {\n throwIfAborted(options.abortSignal);\n if (!Number.isSafeInteger(options.concurrency) || options.concurrency <= 0) {\n throw new RangeError(\"concurrency must be a positive safe integer.\");\n }\n const inputs = Array.from(options.inputs);\n const items = await mapWithConcurrency(\n inputs.map((input, index) => ({ input, index })),\n options.concurrency,\n async ({\n input,\n index,\n }): Promise<DecisionBatchItem<Questions, DecisionRawResponseOf<Model>>> => {\n throwIfAborted(options.abortSignal);\n try {\n const result = await decide({\n ...input,\n model: options.model,\n retries: options.retries,\n abortSignal: options.abortSignal,\n });\n return { index, status: \"completed\", result };\n } catch (error) {\n throwIfAborted(options.abortSignal);\n return { index, status: \"failed\", error };\n }\n },\n );\n throwIfAborted(options.abortSignal);\n return { items };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAiBA,eAAsB,OAIpB,SACkE;AAClE,iBAAe,QAAQ,WAAW;AAClC,QAAM,UAAsC;AAAA,IAC1C,OAAO,QAAQ;AAAA,IACf,WAAW,QAAQ;AAAA,IACnB,iBAAiB,QAAQ;AAAA,EAC3B;AACA,gBAAc,SAAS,QAAQ,KAAK;AACpC,QAAM,UACJ,QAAQ,YAAY,UAAa,QAAQ,YAAY,QACjD,SACA,oBAAoB,QAAQ,OAAO;AACzC,SAAO;AAAA,IACL,YAAY;AACV,qBAAe,QAAQ,WAAW;AAClC,UAAI;AACJ,UAAI;AACF,iBAAS,MAAM,QAAQ,MAAM,SAAS,SAAS,EAAE,aAAa,QAAQ,YAAY,CAAC;AAAA,MACrF,SAAS,OAAO;AACd,uBAAe,QAAQ,WAAW;AAClC,cAAM;AAAA,MACR;AACA,qBAAe,QAAQ,WAAW;AAClC,mBAAa,QAAQ,SAAS,QAAQ,KAAK;AAC3C,aAAO;AAAA,IACT;AAAA,IACA;AAAA,IACA,EAAE,WAAW,OAAO,aAAa,QAAQ,YAAY;AAAA,EACvD;AACF;AAGA,eAAsB,YAIpB,SACuE;AACvE,iBAAe,QAAQ,WAAW;AAClC,MAAI,CAAC,OAAO,cAAc,QAAQ,WAAW,KAAK,QAAQ,eAAe,GAAG;AAC1E,UAAM,IAAI,WAAW,8CAA8C;AAAA,EACrE;AACA,QAAM,SAAS,MAAM,KAAK,QAAQ,MAAM;AACxC,QAAM,QAAQ,MAAM;AAAA,IAClB,OAAO,IAAI,CAAC,OAAO,WAAW,EAAE,OAAO,MAAM,EAAE;AAAA,IAC/C,QAAQ;AAAA,IACR,OAAO;AAAA,MACL;AAAA,MACA;AAAA,IACF,MAA2E;AACzE,qBAAe,QAAQ,WAAW;AAClC,UAAI;AACF,cAAM,SAAS,MAAM,OAAO;AAAA,UAC1B,GAAG;AAAA,UACH,OAAO,QAAQ;AAAA,UACf,SAAS,QAAQ;AAAA,UACjB,aAAa,QAAQ;AAAA,QACvB,CAAC;AACD,eAAO,EAAE,OAAO,QAAQ,aAAa,OAAO;AAAA,MAC9C,SAAS,OAAO;AACd,uBAAe,QAAQ,WAAW;AAClC,eAAO,EAAE,OAAO,QAAQ,UAAU,MAAM;AAAA,MAC1C;AAAA,IACF;AAAA,EACF;AACA,iBAAe,QAAQ,WAAW;AAClC,SAAO,EAAE,MAAM;AACjB;","names":[]}
@@ -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
@@ -0,0 +1,48 @@
1
+ // src/decision/errors.ts
2
+ var DecisionRefusalError = class extends Error {
3
+ provider;
4
+ modelId;
5
+ questionNames;
6
+ rawResponse;
7
+ constructor(options) {
8
+ super(`${options.provider}/${options.modelId} refused one or more decision questions.`);
9
+ this.name = "DecisionRefusalError";
10
+ this.provider = options.provider;
11
+ this.modelId = options.modelId;
12
+ this.questionNames = Object.freeze([...options.questionNames]);
13
+ this.rawResponse = options.rawResponse;
14
+ }
15
+ };
16
+ var DecisionCapabilityError = class extends Error {
17
+ provider;
18
+ modelId;
19
+ questionType;
20
+ constructor(options) {
21
+ super(
22
+ `${options.provider}/${options.modelId} does not support ${options.questionType} questions.`
23
+ );
24
+ this.name = "DecisionCapabilityError";
25
+ this.provider = options.provider;
26
+ this.modelId = options.modelId;
27
+ this.questionType = options.questionType;
28
+ }
29
+ };
30
+ var DecisionProviderOutputError = class extends Error {
31
+ provider;
32
+ modelId;
33
+ questionName;
34
+ constructor(message, options) {
35
+ super(message, options.cause === void 0 ? void 0 : { cause: options.cause });
36
+ this.name = "DecisionProviderOutputError";
37
+ this.provider = options.provider;
38
+ this.modelId = options.modelId;
39
+ this.questionName = options.questionName;
40
+ }
41
+ };
42
+
43
+ export {
44
+ DecisionRefusalError,
45
+ DecisionCapabilityError,
46
+ DecisionProviderOutputError
47
+ };
48
+ //# sourceMappingURL=chunk-Y4Q66NQY.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/decision/errors.ts"],"sourcesContent":["import type { DecisionQuestionType } from \"./types\";\n\n/** A provider declined one or more questions; no complete decision result is available. */\nexport class DecisionRefusalError extends Error {\n readonly provider: string;\n readonly modelId: string;\n readonly questionNames: readonly string[];\n readonly rawResponse: unknown;\n\n constructor(options: {\n provider: string;\n modelId: string;\n questionNames: readonly string[];\n rawResponse: unknown;\n }) {\n super(`${options.provider}/${options.modelId} refused one or more decision questions.`);\n this.name = \"DecisionRefusalError\";\n this.provider = options.provider;\n this.modelId = options.modelId;\n this.questionNames = Object.freeze([...options.questionNames]);\n this.rawResponse = options.rawResponse;\n }\n}\n\nexport class DecisionCapabilityError extends Error {\n readonly provider: string;\n readonly modelId: string;\n readonly questionType: DecisionQuestionType;\n\n constructor(options: { provider: string; modelId: string; questionType: DecisionQuestionType }) {\n super(\n `${options.provider}/${options.modelId} does not support ${options.questionType} questions.`,\n );\n this.name = \"DecisionCapabilityError\";\n this.provider = options.provider;\n this.modelId = options.modelId;\n this.questionType = options.questionType;\n }\n}\n\nexport class DecisionProviderOutputError extends Error {\n readonly provider: string;\n readonly modelId: string;\n readonly questionName: string | undefined;\n\n constructor(\n message: string,\n options: {\n provider: string;\n modelId: string;\n questionName?: string | undefined;\n cause?: unknown;\n },\n ) {\n super(message, options.cause === undefined ? undefined : { cause: options.cause });\n this.name = \"DecisionProviderOutputError\";\n this.provider = options.provider;\n this.modelId = options.modelId;\n this.questionName = options.questionName;\n }\n}\n"],"mappings":";AAGO,IAAM,uBAAN,cAAmC,MAAM;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAET,YAAY,SAKT;AACD,UAAM,GAAG,QAAQ,QAAQ,IAAI,QAAQ,OAAO,0CAA0C;AACtF,SAAK,OAAO;AACZ,SAAK,WAAW,QAAQ;AACxB,SAAK,UAAU,QAAQ;AACvB,SAAK,gBAAgB,OAAO,OAAO,CAAC,GAAG,QAAQ,aAAa,CAAC;AAC7D,SAAK,cAAc,QAAQ;AAAA,EAC7B;AACF;AAEO,IAAM,0BAAN,cAAsC,MAAM;AAAA,EACxC;AAAA,EACA;AAAA,EACA;AAAA,EAET,YAAY,SAAoF;AAC9F;AAAA,MACE,GAAG,QAAQ,QAAQ,IAAI,QAAQ,OAAO,qBAAqB,QAAQ,YAAY;AAAA,IACjF;AACA,SAAK,OAAO;AACZ,SAAK,WAAW,QAAQ;AACxB,SAAK,UAAU,QAAQ;AACvB,SAAK,eAAe,QAAQ;AAAA,EAC9B;AACF;AAEO,IAAM,8BAAN,cAA0C,MAAM;AAAA,EAC5C;AAAA,EACA;AAAA,EACA;AAAA,EAET,YACE,SACA,SAMA;AACA,UAAM,SAAS,QAAQ,UAAU,SAAY,SAAY,EAAE,OAAO,QAAQ,MAAM,CAAC;AACjF,SAAK,OAAO;AACZ,SAAK,WAAW,QAAQ;AACxB,SAAK,UAAU,QAAQ;AACvB,SAAK,eAAe,QAAQ;AAAA,EAC9B;AACF;","names":[]}
@@ -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-WGUE44ZD.js";
5
+ import "../chunk-BH7RLRLQ.js";
6
+ import "../chunk-547CQSO2.js";
7
+ import "../chunk-Y4Q66NQY.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,11 @@
1
+ import {
2
+ DecisionCapabilityError,
3
+ DecisionProviderOutputError,
4
+ DecisionRefusalError
5
+ } from "../chunk-Y4Q66NQY.js";
6
+ export {
7
+ DecisionCapabilityError,
8
+ DecisionProviderOutputError,
9
+ DecisionRefusalError
10
+ };
11
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,164 @@
1
+ import { t as JsonValue, J as JsonObject, U as Usage } from '../types-DYqZKDA8.js';
2
+ import { M as ModelCallOptions } from '../model-call-options-CZkSw_xN.js';
3
+ import { b as RetrySetting } from '../retry-CjvSlKGW.js';
4
+ export { R as RetryContext, a as RetryOptions } from '../retry-CjvSlKGW.js';
5
+
6
+ /** Labels mapped to descriptions or structured criteria; null leaves a label undescribed. */
7
+ type DecisionOptions = Readonly<Record<string, JsonValue>>;
8
+ /** Ordered levels indexed from zero. At least two levels are required. */
9
+ type DecisionRubric = readonly [JsonValue, JsonValue, ...JsonValue[]];
10
+ type ChoiceQuestion<Options extends DecisionOptions = DecisionOptions> = {
11
+ readonly type: "choice";
12
+ readonly instructions: string;
13
+ readonly options: Options;
14
+ };
15
+ type MultiLabelQuestion<Options extends DecisionOptions = DecisionOptions> = {
16
+ readonly type: "multi-label";
17
+ readonly instructions: string;
18
+ readonly options: Options;
19
+ /** Inclusive threshold on each label's independent probability. Defaults to 0.5. */
20
+ readonly threshold?: number | undefined;
21
+ };
22
+ type ScoreQuestion<Rubric extends DecisionRubric = DecisionRubric> = {
23
+ readonly type: "score";
24
+ readonly instructions: string;
25
+ readonly rubric: Rubric;
26
+ };
27
+ type CheckQuestion = {
28
+ readonly type: "check";
29
+ readonly instructions: string;
30
+ };
31
+ type DecisionQuestion = ChoiceQuestion | MultiLabelQuestion | ScoreQuestion | CheckQuestion;
32
+ type DecisionQuestions = Readonly<Record<string, DecisionQuestion>>;
33
+ type DecisionQuestionType = DecisionQuestion["type"];
34
+ type ChoiceAnswer<Label extends string = string> = {
35
+ readonly type: "choice";
36
+ readonly choice: Label;
37
+ /** Exclusive probabilities summing to one, when reported by the provider. */
38
+ readonly probabilities?: Readonly<Record<Label, number>> | undefined;
39
+ /** Provider-reported confidence; not derived from the highest probability. */
40
+ readonly confidence?: number | undefined;
41
+ };
42
+ type MultiLabelAnswer<Label extends string = string> = {
43
+ readonly type: "multi-label";
44
+ readonly labels: readonly Label[];
45
+ /** Independent probabilities; they do not need to sum to one. */
46
+ readonly probabilities: Readonly<Record<Label, number>>;
47
+ };
48
+ type ScoreAnswer<Rubric extends DecisionRubric = DecisionRubric> = {
49
+ readonly type: "score";
50
+ /** Position on the zero-indexed rubric, potentially fractional. */
51
+ readonly score: number;
52
+ readonly rubric: Rubric;
53
+ /** Exclusive distribution over rubric levels, in rubric order. */
54
+ readonly probabilities?: readonly number[] | undefined;
55
+ readonly confidence?: number | undefined;
56
+ };
57
+ type CheckAnswer = {
58
+ readonly type: "check";
59
+ /** Estimated probability of yes, between zero and one. */
60
+ readonly probability: number;
61
+ };
62
+ type DecisionAnswerFor<Question extends DecisionQuestion> = Question extends ChoiceQuestion<infer Options> ? ChoiceAnswer<Extract<keyof Options, string>> : Question extends MultiLabelQuestion<infer Options> ? MultiLabelAnswer<Extract<keyof Options, string>> : Question extends ScoreQuestion<infer Rubric> ? ScoreAnswer<Rubric> : Question extends CheckQuestion ? CheckAnswer : never;
63
+ type DecisionAnswers<Questions extends DecisionQuestions> = {
64
+ readonly [Name in keyof Questions]: DecisionAnswerFor<Questions[Name]>;
65
+ };
66
+ type DecisionResult<Questions extends DecisionQuestions, RawResponse = unknown> = {
67
+ readonly answers: DecisionAnswers<Questions>;
68
+ /** Omitted by backends that do not report token usage. */
69
+ readonly usage?: Usage | undefined;
70
+ readonly rawResponse: RawResponse;
71
+ };
72
+ type DecisionCapabilities = {
73
+ readonly questionSupport: Readonly<Record<DecisionQuestionType, "native" | "composed" | "unsupported">>;
74
+ readonly mixedQuestions: boolean;
75
+ readonly limits?: {
76
+ readonly maxQuestionsPerRequest?: number | undefined;
77
+ readonly maxChoiceOptions?: number | undefined;
78
+ readonly maxMultiLabelOptions?: number | undefined;
79
+ readonly maxRubricLevels?: number | undefined;
80
+ } | undefined;
81
+ };
82
+ type DecisionRequest<Questions extends DecisionQuestions = DecisionQuestions> = {
83
+ readonly state: JsonValue;
84
+ readonly questions: Questions;
85
+ readonly providerOptions?: JsonObject | undefined;
86
+ };
87
+ /** One provider invocation. Call decide() for validation, retries, and cancellation. */
88
+ interface DecisionModel<RawResponse = unknown> {
89
+ readonly provider: string;
90
+ readonly modelId: string;
91
+ readonly capabilities: DecisionCapabilities;
92
+ decision<const Questions extends DecisionQuestions>(request: DecisionRequest<Questions>, options?: ModelCallOptions): Promise<DecisionResult<Questions, RawResponse>>;
93
+ }
94
+ type DecisionRawResponseOf<Model extends DecisionModel> = Model extends DecisionModel<infer RawResponse> ? RawResponse : never;
95
+ type DecideOptions<Questions extends DecisionQuestions, Model extends DecisionModel = DecisionModel> = DecisionRequest<Questions> & {
96
+ readonly model: Model;
97
+ readonly retries?: RetrySetting | undefined;
98
+ readonly abortSignal?: AbortSignal | undefined;
99
+ };
100
+ type DecideBatchOptions<Questions extends DecisionQuestions, Model extends DecisionModel = DecisionModel> = {
101
+ readonly model: Model;
102
+ readonly inputs: Iterable<DecisionRequest<Questions>>;
103
+ readonly concurrency: number;
104
+ readonly retries?: RetrySetting | undefined;
105
+ readonly abortSignal?: AbortSignal | undefined;
106
+ };
107
+ type DecisionBatchItem<Questions extends DecisionQuestions, RawResponse = unknown> = {
108
+ readonly index: number;
109
+ readonly status: "completed";
110
+ readonly result: DecisionResult<Questions, RawResponse>;
111
+ } | {
112
+ readonly index: number;
113
+ readonly status: "failed";
114
+ readonly error: unknown;
115
+ };
116
+ type DecisionBatchResult<Questions extends DecisionQuestions, RawResponse = unknown> = {
117
+ readonly items: readonly DecisionBatchItem<Questions, RawResponse>[];
118
+ };
119
+
120
+ declare function decide<const Questions extends DecisionQuestions, Model extends DecisionModel>(options: DecideOptions<Questions, Model>): Promise<DecisionResult<Questions, DecisionRawResponseOf<Model>>>;
121
+ /** Execute independent inputs with bounded concurrency, preserving order and individual failures. */
122
+ declare function decideBatch<const Questions extends DecisionQuestions, Model extends DecisionModel>(options: DecideBatchOptions<Questions, Model>): Promise<DecisionBatchResult<Questions, DecisionRawResponseOf<Model>>>;
123
+
124
+ /** A provider declined one or more questions; no complete decision result is available. */
125
+ declare class DecisionRefusalError extends Error {
126
+ readonly provider: string;
127
+ readonly modelId: string;
128
+ readonly questionNames: readonly string[];
129
+ readonly rawResponse: unknown;
130
+ constructor(options: {
131
+ provider: string;
132
+ modelId: string;
133
+ questionNames: readonly string[];
134
+ rawResponse: unknown;
135
+ });
136
+ }
137
+ declare class DecisionCapabilityError extends Error {
138
+ readonly provider: string;
139
+ readonly modelId: string;
140
+ readonly questionType: DecisionQuestionType;
141
+ constructor(options: {
142
+ provider: string;
143
+ modelId: string;
144
+ questionType: DecisionQuestionType;
145
+ });
146
+ }
147
+ declare class DecisionProviderOutputError extends Error {
148
+ readonly provider: string;
149
+ readonly modelId: string;
150
+ readonly questionName: string | undefined;
151
+ constructor(message: string, options: {
152
+ provider: string;
153
+ modelId: string;
154
+ questionName?: string | undefined;
155
+ cause?: unknown;
156
+ });
157
+ }
158
+
159
+ declare function choice<const Options extends DecisionOptions>(options: Omit<ChoiceQuestion<Options>, "type">): ChoiceQuestion<Options>;
160
+ declare function multiLabel<const Options extends DecisionOptions>(options: Omit<MultiLabelQuestion<Options>, "type">): MultiLabelQuestion<Options>;
161
+ declare function score<const Rubric extends DecisionRubric>(options: Omit<ScoreQuestion<Rubric>, "type">): ScoreQuestion<Rubric>;
162
+ declare function check(options: Omit<CheckQuestion, "type">): CheckQuestion;
163
+
164
+ export { type CheckAnswer, type CheckQuestion, type ChoiceAnswer, type ChoiceQuestion, type DecideBatchOptions, type DecideOptions, type DecisionAnswerFor, type DecisionAnswers, type DecisionBatchItem, type DecisionBatchResult, type DecisionCapabilities, DecisionCapabilityError, type DecisionModel, type DecisionOptions, DecisionProviderOutputError, type DecisionQuestion, type DecisionQuestionType, type DecisionQuestions, type DecisionRawResponseOf, DecisionRefusalError, type DecisionRequest, type DecisionResult, type DecisionRubric, JsonObject, JsonValue, ModelCallOptions, type MultiLabelAnswer, type MultiLabelQuestion, RetrySetting, type ScoreAnswer, type ScoreQuestion, Usage, check, choice, decide, decideBatch, multiLabel, score };
@@ -0,0 +1,35 @@
1
+ import "../chunk-IPNY5MMY.js";
2
+ import {
3
+ check,
4
+ choice,
5
+ multiLabel,
6
+ score
7
+ } from "../chunk-PFSWAJTY.js";
8
+ import "../chunk-F2UVTXNE.js";
9
+ import {
10
+ decide,
11
+ decideBatch
12
+ } from "../chunk-WGUE44ZD.js";
13
+ import "../chunk-BH7RLRLQ.js";
14
+ import "../chunk-547CQSO2.js";
15
+ import {
16
+ DecisionCapabilityError,
17
+ DecisionProviderOutputError,
18
+ DecisionRefusalError
19
+ } from "../chunk-Y4Q66NQY.js";
20
+ import "../chunk-4FIVU53H.js";
21
+ import "../chunk-4C7AXYOM.js";
22
+ import "../chunk-POXHJF3H.js";
23
+ import "../chunk-USRKPEQN.js";
24
+ export {
25
+ DecisionCapabilityError,
26
+ DecisionProviderOutputError,
27
+ DecisionRefusalError,
28
+ check,
29
+ choice,
30
+ decide,
31
+ decideBatch,
32
+ multiLabel,
33
+ score
34
+ };
35
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,16 @@
1
+ import {
2
+ check,
3
+ choice,
4
+ multiLabel,
5
+ score
6
+ } from "../chunk-PFSWAJTY.js";
7
+ import "../chunk-547CQSO2.js";
8
+ import "../chunk-Y4Q66NQY.js";
9
+ import "../chunk-4C7AXYOM.js";
10
+ export {
11
+ check,
12
+ choice,
13
+ multiLabel,
14
+ score
15
+ };
16
+ //# sourceMappingURL=questions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,10 @@
1
+ import {
2
+ assertResult
3
+ } from "../chunk-BH7RLRLQ.js";
4
+ import "../chunk-547CQSO2.js";
5
+ import "../chunk-Y4Q66NQY.js";
6
+ import "../chunk-4C7AXYOM.js";
7
+ export {
8
+ assertResult
9
+ };
10
+ //# sourceMappingURL=result.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,2 @@
1
+ import "../chunk-F2UVTXNE.js";
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}