@anvia/core 1.8.0 → 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.
- package/README.md +1 -0
- package/dist/agent/agent-tool.js +4 -4
- package/dist/agent/agent.js +23 -23
- package/dist/agent/index.js +27 -27
- package/dist/agent/resolve-options.js +12 -12
- package/dist/agent/resolved-agent.js +24 -24
- package/dist/agent/team/agent-team.js +27 -27
- package/dist/agent/team/index.js +27 -27
- package/dist/agent/tool-catalog.js +9 -9
- package/dist/{chunk-WCJRGYF7.js → chunk-27MBNR47.js} +5 -5
- package/dist/{chunk-3YN5B5UW.js → chunk-3PSBUYXQ.js} +2 -2
- package/dist/chunk-3YVGQNTI.js +82 -0
- package/dist/chunk-3YVGQNTI.js.map +1 -0
- package/dist/{chunk-OBM7JJCK.js → chunk-5G4NMOTJ.js} +2 -2
- package/dist/{chunk-RMOCTCS2.js → chunk-7AV3PEYW.js} +3 -3
- package/dist/{chunk-JIYOCTRF.js → chunk-7NWFT422.js} +4 -4
- package/dist/{chunk-F5BPVVC2.js → chunk-AGOZCYFP.js} +8 -8
- package/dist/chunk-AGPDR6FF.js +104 -0
- package/dist/chunk-AGPDR6FF.js.map +1 -0
- package/dist/chunk-AKQQG3IX.js +33 -0
- package/dist/chunk-AKQQG3IX.js.map +1 -0
- package/dist/{chunk-ZDS7AHAX.js → chunk-AO2QL2VD.js} +18 -18
- package/dist/chunk-BRGNY5ZB.js +33 -0
- package/dist/chunk-BRGNY5ZB.js.map +1 -0
- package/dist/{chunk-ZMAF3I4H.js → chunk-CASF2TDK.js} +2 -2
- package/dist/{chunk-C36RVQHF.js → chunk-DRSKZVC6.js} +5 -5
- package/dist/{chunk-EWCRSYS6.js → chunk-EWTZ3IAH.js} +6 -6
- package/dist/chunk-F2UVTXNE.js +1 -0
- package/dist/chunk-F2UVTXNE.js.map +1 -0
- package/dist/chunk-IPNY5MMY.js +1 -0
- package/dist/chunk-IPNY5MMY.js.map +1 -0
- package/dist/{chunk-4EBIM3LP.js → chunk-KDGMHES4.js} +2 -2
- package/dist/{chunk-GNBPXJC6.js → chunk-KL652GO5.js} +2 -2
- package/dist/{chunk-4IOC4SP6.js → chunk-KLDNHX4Z.js} +4 -4
- package/dist/{chunk-JJSMONFE.js → chunk-L2JI2GDH.js} +2 -2
- package/dist/{chunk-JU3RX364.js → chunk-MEFGXAKJ.js} +2 -2
- package/dist/{chunk-IZH2ZAE3.js → chunk-MNBKSRS5.js} +2 -2
- package/dist/{chunk-OXIK4SIH.js → chunk-PILUQCGV.js} +2 -2
- package/dist/{chunk-GI6APIEU.js → chunk-R4AJ2EE3.js} +4 -4
- package/dist/chunk-RW32K6OO.js +100 -0
- package/dist/chunk-RW32K6OO.js.map +1 -0
- package/dist/{chunk-WSPB4OUU.js → chunk-V5NIO3J3.js} +3 -3
- package/dist/{chunk-XH2CVR4V.js → chunk-VUY2C2QD.js} +2 -2
- package/dist/{chunk-4IC3CQRL.js → chunk-VZ5ZZBNX.js} +5 -5
- package/dist/{chunk-6TAWRKFK.js → chunk-WRYBALCQ.js} +5 -5
- package/dist/{chunk-E5MIZ6Z5.js → chunk-X35O3AQG.js} +2 -2
- package/dist/{chunk-GXVJGJAN.js → chunk-XQRMPPTC.js} +8 -8
- package/dist/{chunk-MYHGOXHQ.js → chunk-Y5FHUUNC.js} +5 -5
- package/dist/decision/decide.js +16 -0
- package/dist/decision/decide.js.map +1 -0
- package/dist/decision/errors.js +9 -0
- package/dist/decision/errors.js.map +1 -0
- package/dist/decision/index.d.ts +151 -0
- package/dist/decision/index.js +33 -0
- package/dist/decision/index.js.map +1 -0
- package/dist/decision/questions.js +16 -0
- package/dist/decision/questions.js.map +1 -0
- package/dist/decision/result.js +10 -0
- package/dist/decision/result.js.map +1 -0
- package/dist/decision/types.js +2 -0
- package/dist/decision/types.js.map +1 -0
- package/dist/decision/validation.js +15 -0
- package/dist/decision/validation.js.map +1 -0
- package/dist/embeddings/index.js +8 -8
- package/dist/evals/advanced-metrics.js +3 -3
- package/dist/evals/cli.js +3 -3
- package/dist/evals/index.js +8 -8
- package/dist/evals/metrics.js +4 -4
- package/dist/evals/runner.js +2 -2
- package/dist/guardrails/index.js +7 -7
- package/dist/guardrails/runtime.js +2 -2
- package/dist/guardrails/text.js +2 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +69 -43
- package/dist/internal/agent-runtime/agent-run.js +19 -19
- package/dist/internal/agent-runtime/prepared-tool-call.js +2 -2
- package/dist/internal/agent-runtime/retrieval.js +7 -7
- package/dist/internal/agent-runtime/tool-execution.js +12 -12
- package/dist/internal/agent.js +24 -24
- package/dist/internal/team-runtime/run.js +26 -26
- package/dist/internal/team-runtime/tools.js +4 -4
- package/dist/model-listing/index.js +1 -1
- package/dist/pipeline/index.js +3 -3
- package/dist/pipeline/pipeline.js +3 -3
- package/dist/skills/index.js +13 -13
- package/dist/skills/load.js +13 -13
- package/dist/skills/tools.js +12 -12
- package/dist/speech-generation/index.js +1 -1
- package/dist/tool/create-tool.js +3 -3
- package/dist/tool/dynamic-tools.js +8 -8
- package/dist/tool/index.js +17 -17
- package/dist/tool/question-tool.js +4 -4
- package/dist/tool/think-tool.js +4 -4
- package/dist/vector-store/index.js +10 -10
- package/dist/vector-store/ingest.js +2 -2
- package/dist/vector-store/retrieve.js +1 -1
- package/package.json +5 -1
- /package/dist/{chunk-WCJRGYF7.js.map → chunk-27MBNR47.js.map} +0 -0
- /package/dist/{chunk-3YN5B5UW.js.map → chunk-3PSBUYXQ.js.map} +0 -0
- /package/dist/{chunk-OBM7JJCK.js.map → chunk-5G4NMOTJ.js.map} +0 -0
- /package/dist/{chunk-RMOCTCS2.js.map → chunk-7AV3PEYW.js.map} +0 -0
- /package/dist/{chunk-JIYOCTRF.js.map → chunk-7NWFT422.js.map} +0 -0
- /package/dist/{chunk-F5BPVVC2.js.map → chunk-AGOZCYFP.js.map} +0 -0
- /package/dist/{chunk-ZDS7AHAX.js.map → chunk-AO2QL2VD.js.map} +0 -0
- /package/dist/{chunk-ZMAF3I4H.js.map → chunk-CASF2TDK.js.map} +0 -0
- /package/dist/{chunk-C36RVQHF.js.map → chunk-DRSKZVC6.js.map} +0 -0
- /package/dist/{chunk-EWCRSYS6.js.map → chunk-EWTZ3IAH.js.map} +0 -0
- /package/dist/{chunk-4EBIM3LP.js.map → chunk-KDGMHES4.js.map} +0 -0
- /package/dist/{chunk-GNBPXJC6.js.map → chunk-KL652GO5.js.map} +0 -0
- /package/dist/{chunk-4IOC4SP6.js.map → chunk-KLDNHX4Z.js.map} +0 -0
- /package/dist/{chunk-JJSMONFE.js.map → chunk-L2JI2GDH.js.map} +0 -0
- /package/dist/{chunk-JU3RX364.js.map → chunk-MEFGXAKJ.js.map} +0 -0
- /package/dist/{chunk-IZH2ZAE3.js.map → chunk-MNBKSRS5.js.map} +0 -0
- /package/dist/{chunk-OXIK4SIH.js.map → chunk-PILUQCGV.js.map} +0 -0
- /package/dist/{chunk-GI6APIEU.js.map → chunk-R4AJ2EE3.js.map} +0 -0
- /package/dist/{chunk-WSPB4OUU.js.map → chunk-V5NIO3J3.js.map} +0 -0
- /package/dist/{chunk-XH2CVR4V.js.map → chunk-VUY2C2QD.js.map} +0 -0
- /package/dist/{chunk-4IC3CQRL.js.map → chunk-VZ5ZZBNX.js.map} +0 -0
- /package/dist/{chunk-6TAWRKFK.js.map → chunk-WRYBALCQ.js.map} +0 -0
- /package/dist/{chunk-E5MIZ6Z5.js.map → chunk-X35O3AQG.js.map} +0 -0
- /package/dist/{chunk-GXVJGJAN.js.map → chunk-XQRMPPTC.js.map} +0 -0
- /package/dist/{chunk-MYHGOXHQ.js.map → chunk-Y5FHUUNC.js.map} +0 -0
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-JBQNCUXA.js";
|
|
4
4
|
import {
|
|
5
5
|
createSkillTools
|
|
6
|
-
} from "./chunk-
|
|
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-
|
|
29
|
+
//# sourceMappingURL=chunk-KDGMHES4.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
runEvalSuite
|
|
3
|
-
} from "./chunk-
|
|
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-
|
|
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-
|
|
663
|
+
//# sourceMappingURL=chunk-KLDNHX4Z.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
isToolIndex
|
|
3
|
-
} from "./chunk-
|
|
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-
|
|
168
|
+
//# sourceMappingURL=chunk-L2JI2GDH.js.map
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
attachPreparedToolOwner,
|
|
3
3
|
preparedToolInput,
|
|
4
4
|
withoutPreparedToolInput
|
|
5
|
-
} from "./chunk-
|
|
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-
|
|
58
|
+
//# sourceMappingURL=chunk-MEFGXAKJ.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createTool
|
|
3
|
-
} from "./chunk-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
48
|
+
//# sourceMappingURL=chunk-V5NIO3J3.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
InMemoryVectorStore
|
|
3
|
-
} from "./chunk-
|
|
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-
|
|
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-
|
|
139
|
+
//# sourceMappingURL=chunk-VZ5ZZBNX.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-
|
|
86
|
+
//# sourceMappingURL=chunk-WRYBALCQ.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createTool
|
|
3
|
-
} from "./chunk-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,151 @@
|
|
|
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
|
+
declare class DecisionCapabilityError extends Error {
|
|
125
|
+
readonly provider: string;
|
|
126
|
+
readonly modelId: string;
|
|
127
|
+
readonly questionType: DecisionQuestionType;
|
|
128
|
+
constructor(options: {
|
|
129
|
+
provider: string;
|
|
130
|
+
modelId: string;
|
|
131
|
+
questionType: DecisionQuestionType;
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
declare class DecisionProviderOutputError extends Error {
|
|
135
|
+
readonly provider: string;
|
|
136
|
+
readonly modelId: string;
|
|
137
|
+
readonly questionName: string | undefined;
|
|
138
|
+
constructor(message: string, options: {
|
|
139
|
+
provider: string;
|
|
140
|
+
modelId: string;
|
|
141
|
+
questionName?: string | undefined;
|
|
142
|
+
cause?: unknown;
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
declare function choice<const Options extends DecisionOptions>(options: Omit<ChoiceQuestion<Options>, "type">): ChoiceQuestion<Options>;
|
|
147
|
+
declare function multiLabel<const Options extends DecisionOptions>(options: Omit<MultiLabelQuestion<Options>, "type">): MultiLabelQuestion<Options>;
|
|
148
|
+
declare function score<const Rubric extends DecisionRubric>(options: Omit<ScoreQuestion<Rubric>, "type">): ScoreQuestion<Rubric>;
|
|
149
|
+
declare function check(options: Omit<CheckQuestion, "type">): CheckQuestion;
|
|
150
|
+
|
|
151
|
+
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, 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,33 @@
|
|
|
1
|
+
import "../chunk-IPNY5MMY.js";
|
|
2
|
+
import {
|
|
3
|
+
check,
|
|
4
|
+
choice,
|
|
5
|
+
multiLabel,
|
|
6
|
+
score
|
|
7
|
+
} from "../chunk-AKQQG3IX.js";
|
|
8
|
+
import "../chunk-F2UVTXNE.js";
|
|
9
|
+
import {
|
|
10
|
+
decide,
|
|
11
|
+
decideBatch
|
|
12
|
+
} from "../chunk-3YVGQNTI.js";
|
|
13
|
+
import "../chunk-AGPDR6FF.js";
|
|
14
|
+
import "../chunk-RW32K6OO.js";
|
|
15
|
+
import {
|
|
16
|
+
DecisionCapabilityError,
|
|
17
|
+
DecisionProviderOutputError
|
|
18
|
+
} from "../chunk-BRGNY5ZB.js";
|
|
19
|
+
import "../chunk-4FIVU53H.js";
|
|
20
|
+
import "../chunk-4C7AXYOM.js";
|
|
21
|
+
import "../chunk-POXHJF3H.js";
|
|
22
|
+
import "../chunk-USRKPEQN.js";
|
|
23
|
+
export {
|
|
24
|
+
DecisionCapabilityError,
|
|
25
|
+
DecisionProviderOutputError,
|
|
26
|
+
check,
|
|
27
|
+
choice,
|
|
28
|
+
decide,
|
|
29
|
+
decideBatch,
|
|
30
|
+
multiLabel,
|
|
31
|
+
score
|
|
32
|
+
};
|
|
33
|
+
//# 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-AKQQG3IX.js";
|
|
7
|
+
import "../chunk-RW32K6OO.js";
|
|
8
|
+
import "../chunk-BRGNY5ZB.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":[]}
|