@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.
- 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-F5BPVVC2.js → chunk-2K7NSWUC.js} +4 -4
- package/dist/{chunk-3YN5B5UW.js → chunk-3PSBUYXQ.js} +2 -2
- package/dist/chunk-547CQSO2.js +100 -0
- package/dist/chunk-547CQSO2.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-ZDS7AHAX.js → chunk-AO2QL2VD.js} +18 -18
- package/dist/chunk-BH7RLRLQ.js +104 -0
- package/dist/chunk-BH7RLRLQ.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-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-PFSWAJTY.js +33 -0
- package/dist/chunk-PFSWAJTY.js.map +1 -0
- package/dist/{chunk-OXIK4SIH.js → chunk-PILUQCGV.js} +2 -2
- 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-WGUE44ZD.js +82 -0
- package/dist/chunk-WGUE44ZD.js.map +1 -0
- 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-Y4Q66NQY.js +48 -0
- package/dist/chunk-Y4Q66NQY.js.map +1 -0
- 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 +11 -0
- package/dist/decision/errors.js.map +1 -0
- package/dist/decision/index.d.ts +164 -0
- package/dist/decision/index.js +35 -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/index.js +2 -2
- package/dist/evals/metrics.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 +70 -42
- 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-F5BPVVC2.js.map → chunk-2K7NSWUC.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-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-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-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
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
import {
|
|
2
2
|
prepareAgentTools
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-5WLIHNNJ.js";
|
|
3
|
+
} from "../chunk-L2JI2GDH.js";
|
|
4
|
+
import "../chunk-VUY2C2QD.js";
|
|
5
|
+
import "../chunk-Y5FHUUNC.js";
|
|
7
6
|
import "../chunk-3FIX7GLM.js";
|
|
8
7
|
import "../chunk-ESOFEAYK.js";
|
|
9
8
|
import "../chunk-CB2L2NIQ.js";
|
|
9
|
+
import "../chunk-5WLIHNNJ.js";
|
|
10
10
|
import "../chunk-PJNE75WC.js";
|
|
11
11
|
import "../chunk-PLDJCCVL.js";
|
|
12
12
|
import "../chunk-3J2CSVPR.js";
|
|
13
13
|
import "../chunk-ERN7P6Q4.js";
|
|
14
|
-
import "../chunk-7F53DOML.js";
|
|
15
14
|
import "../chunk-YCTXTOOQ.js";
|
|
16
15
|
import "../chunk-DU4WA6LQ.js";
|
|
17
|
-
import "../chunk-4FIVU53H.js";
|
|
18
16
|
import "../chunk-KO5NMTAM.js";
|
|
19
17
|
import "../chunk-TFIOU6UR.js";
|
|
20
18
|
import "../chunk-GPVXCY5I.js";
|
|
19
|
+
import "../chunk-7F53DOML.js";
|
|
20
|
+
import "../chunk-4FIVU53H.js";
|
|
21
21
|
import "../chunk-NVALGVQG.js";
|
|
22
22
|
import "../chunk-ZHC5CD6J.js";
|
|
23
23
|
import "../chunk-5V533R7F.js";
|
|
24
|
-
import "../chunk-
|
|
25
|
-
import "../chunk-
|
|
24
|
+
import "../chunk-MEFGXAKJ.js";
|
|
25
|
+
import "../chunk-27MBNR47.js";
|
|
26
26
|
import "../chunk-YZVFIW5D.js";
|
|
27
|
-
import "../chunk-J6S6MT7O.js";
|
|
28
27
|
import "../chunk-VHPT2C4P.js";
|
|
28
|
+
import "../chunk-J6S6MT7O.js";
|
|
29
29
|
import "../chunk-BONQTXRQ.js";
|
|
30
30
|
import "../chunk-4C7AXYOM.js";
|
|
31
31
|
import "../chunk-SQAAVYJG.js";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ToolCallError,
|
|
3
|
-
ToolJsonError
|
|
4
|
-
} from "./chunk-J6S6MT7O.js";
|
|
5
1
|
import {
|
|
6
2
|
normalizeToolResultOutput,
|
|
7
3
|
parseToolArgs
|
|
8
4
|
} from "./chunk-VHPT2C4P.js";
|
|
5
|
+
import {
|
|
6
|
+
ToolCallError,
|
|
7
|
+
ToolJsonError
|
|
8
|
+
} from "./chunk-J6S6MT7O.js";
|
|
9
9
|
|
|
10
10
|
// src/internal/agent-runtime/prepared-tool-call.ts
|
|
11
11
|
var preparedToolInputSymbol = /* @__PURE__ */ Symbol("preparedToolInput");
|
|
@@ -90,4 +90,4 @@ export {
|
|
|
90
90
|
prepareToolCall,
|
|
91
91
|
prepareToolCallFromInput
|
|
92
92
|
};
|
|
93
|
-
//# sourceMappingURL=chunk-
|
|
93
|
+
//# sourceMappingURL=chunk-27MBNR47.js.map
|
|
@@ -14,12 +14,12 @@ import {
|
|
|
14
14
|
import {
|
|
15
15
|
EvalOutcome
|
|
16
16
|
} from "./chunk-EJR6VVB3.js";
|
|
17
|
-
import {
|
|
18
|
-
cosineSimilarity
|
|
19
|
-
} from "./chunk-7F53DOML.js";
|
|
20
17
|
import {
|
|
21
18
|
embedText
|
|
22
19
|
} from "./chunk-YCTXTOOQ.js";
|
|
20
|
+
import {
|
|
21
|
+
cosineSimilarity
|
|
22
|
+
} from "./chunk-7F53DOML.js";
|
|
23
23
|
import {
|
|
24
24
|
throwIfAborted
|
|
25
25
|
} from "./chunk-USRKPEQN.js";
|
|
@@ -328,4 +328,4 @@ export {
|
|
|
328
328
|
llmJudge,
|
|
329
329
|
llmScore
|
|
330
330
|
};
|
|
331
|
-
//# sourceMappingURL=chunk-
|
|
331
|
+
//# sourceMappingURL=chunk-2K7NSWUC.js.map
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-LGPXCJJO.js";
|
|
4
4
|
import {
|
|
5
5
|
createTool
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-MEFGXAKJ.js";
|
|
7
7
|
import {
|
|
8
8
|
AgentRunBlockedError,
|
|
9
9
|
AgentToolSuspensionError
|
|
@@ -78,4 +78,4 @@ function createAgentTool(agent, options) {
|
|
|
78
78
|
export {
|
|
79
79
|
createAgentTool
|
|
80
80
|
};
|
|
81
|
-
//# sourceMappingURL=chunk-
|
|
81
|
+
//# sourceMappingURL=chunk-3PSBUYXQ.js.map
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DecisionCapabilityError
|
|
3
|
+
} from "./chunk-Y4Q66NQY.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-547CQSO2.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":";;;;;;;;AAIO,SAAS,SAAS,OAAkD;AACzE,MAAI,OAAO,UAAU,YAAY,UAAU,KAAM,QAAO;AACxD,QAAM,YAAY,OAAO,eAAe,KAAK;AAC7C,MAAI,cAAc,OAAO,aAAa,cAAc,KAAM,QAAO;AACjE,SAAO,QAAQ,QAAQ,KAAK,EAAE,MAAM,CAAC,QAAQ;AAC3C,UAAM,aAAa,OAAO,yBAAyB,OAAO,GAAG;AAC7D,WAAO,OAAO,QAAQ,YAAY,YAAY,eAAe,QAAQ,WAAW;AAAA,EAClF,CAAC;AACH;AAEO,SAAS,eAAe,OAAmD;AAChF,MAAI,CAAC,SAAS,KAAK,EAAG,OAAM,IAAI,UAAU,gDAAgD;AAC1F,MAAI,OAAO,MAAM,iBAAiB,YAAY,MAAM,aAAa,KAAK,EAAE,WAAW,GAAG;AACpF,UAAM,IAAI,UAAU,mDAAmD;AAAA,EACzE;AACA,UAAQ,MAAM,MAAM;AAAA,IAClB,KAAK;AAAA,IACL,KAAK;AACH,UACE,CAAC,SAAS,MAAM,OAAO,KACvB,CAAC,YAAY,MAAM,OAAO,KAC1B,OAAO,KAAK,MAAM,OAAO,EAAE,WAAW,KACtC,OAAO,KAAK,MAAM,OAAO,EAAE,KAAK,CAAC,QAAQ,IAAI,KAAK,EAAE,WAAW,CAAC,GAChE;AACA,cAAM,IAAI,UAAU,oEAAoE;AAAA,MAC1F;AACA,UAAI,MAAM,SAAS,iBAAiB,MAAM,cAAc,QAAW;AACjE,YAAI,CAAC,cAAc,MAAM,SAAS,GAAG;AACnC,gBAAM,IAAI,WAAW,qDAAqD;AAAA,QAC5E;AAAA,MACF;AACA;AAAA,IACF,KAAK;AACH,UAAI,CAAC,MAAM,QAAQ,MAAM,MAAM,KAAK,MAAM,OAAO,SAAS,KAAK,CAAC,YAAY,MAAM,MAAM,GAAG;AACzF,cAAM,IAAI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O,QAAQ,QAAQ,iBAAiB,eAAe;AAAA,IAC9E;AAAA,EACF;AACA,MAAI,MAAM,OAAO,KAAK,CAAC,MAAM,aAAa,gBAAgB;AACxD,UAAM,IAAI,UAAU,GAAG,MAAM,QAAQ,IAAI,MAAM,OAAO,oCAAoC;AAAA,EAC5F;AACA;AAAA,IACE,OAAO,KAAK,QAAQ,SAAS,EAAE;AAAA,IAC/B,MAAM,aAAa,QAAQ;AAAA,IAC3B;AAAA,EACF;AACF;AAEO,SAAS,cAAc,OAAiC;AAC7D,SAAO,OAAO,UAAU,YAAY,OAAO,SAAS,KAAK,KAAK,SAAS,KAAK,SAAS;AACvF;AAEA,SAAS,YAAY,OAAe,OAA2B,MAAoB;AACjF,MAAI,UAAU,UAAa,QAAQ,OAAO;AACxC,UAAM,IAAI,WAAW,+CAA+C,KAAK,IAAI,IAAI,GAAG;AAAA,EACtF;AACF;","names":[]}
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-2NLINXRF.js";
|
|
4
4
|
import {
|
|
5
5
|
createTool
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-MEFGXAKJ.js";
|
|
7
7
|
import {
|
|
8
8
|
abortError,
|
|
9
9
|
throwIfAborted
|
|
@@ -245,4 +245,4 @@ function appendLimited(current, chunk) {
|
|
|
245
245
|
export {
|
|
246
246
|
createSkillTools
|
|
247
247
|
};
|
|
248
|
-
//# sourceMappingURL=chunk-
|
|
248
|
+
//# sourceMappingURL=chunk-5G4NMOTJ.js.map
|
|
@@ -3,13 +3,13 @@ import {
|
|
|
3
3
|
} from "./chunk-X6WS3XWL.js";
|
|
4
4
|
import {
|
|
5
5
|
TeamRun
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-7NWFT422.js";
|
|
7
7
|
import {
|
|
8
8
|
TeamStream
|
|
9
9
|
} from "./chunk-3TAQXJBC.js";
|
|
10
10
|
import {
|
|
11
11
|
Agent
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-EWTZ3IAH.js";
|
|
13
13
|
import {
|
|
14
14
|
assertPositiveSafeInteger
|
|
15
15
|
} from "./chunk-NPJ2T3L5.js";
|
|
@@ -104,4 +104,4 @@ var AgentTeam = class {
|
|
|
104
104
|
export {
|
|
105
105
|
AgentTeam
|
|
106
106
|
};
|
|
107
|
-
//# sourceMappingURL=chunk-
|
|
107
|
+
//# sourceMappingURL=chunk-7AV3PEYW.js.map
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
import {
|
|
12
12
|
TEAM_INSTRUCTIONS,
|
|
13
13
|
teamTools
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-X35O3AQG.js";
|
|
15
15
|
import {
|
|
16
16
|
AgentTeamInteractionError,
|
|
17
17
|
AgentTeamLimitError
|
|
@@ -19,10 +19,10 @@ import {
|
|
|
19
19
|
import {
|
|
20
20
|
createResolvedAgent,
|
|
21
21
|
getResolvedAgentOptions
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-V5NIO3J3.js";
|
|
23
23
|
import {
|
|
24
24
|
AgentRun
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-AO2QL2VD.js";
|
|
26
26
|
import {
|
|
27
27
|
withInternalAgentRunOptions
|
|
28
28
|
} from "./chunk-7FBSGD6E.js";
|
|
@@ -619,4 +619,4 @@ var TeamRun = class {
|
|
|
619
619
|
export {
|
|
620
620
|
TeamRun
|
|
621
621
|
};
|
|
622
|
-
//# sourceMappingURL=chunk-
|
|
622
|
+
//# sourceMappingURL=chunk-7NWFT422.js.map
|
|
@@ -1,17 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
STRUCTURED_OUTPUT_RETRY_PROMPT,
|
|
3
|
-
STRUCTURED_OUTPUT_TRUNCATED_RETRY_PROMPT,
|
|
4
|
-
normalizeStructuredOutput,
|
|
5
|
-
structuredOutputRepairPreview
|
|
6
|
-
} from "./chunk-SXE4J43E.js";
|
|
7
1
|
import {
|
|
8
2
|
ToolCallExecutor
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import {
|
|
11
|
-
AgentInteractionSignal,
|
|
12
|
-
ToolExecutionSuspension,
|
|
13
|
-
approvalInteraction
|
|
14
|
-
} from "./chunk-5IURMWFN.js";
|
|
3
|
+
} from "./chunk-DRSKZVC6.js";
|
|
15
4
|
import {
|
|
16
5
|
normalizeMemoryScope
|
|
17
6
|
} from "./chunk-LAIATEUB.js";
|
|
@@ -34,26 +23,37 @@ import {
|
|
|
34
23
|
addTurnToToolCallDelta,
|
|
35
24
|
isGenerationDeltaEvent
|
|
36
25
|
} from "./chunk-YWRXOPHC.js";
|
|
26
|
+
import {
|
|
27
|
+
STRUCTURED_OUTPUT_RETRY_PROMPT,
|
|
28
|
+
STRUCTURED_OUTPUT_TRUNCATED_RETRY_PROMPT,
|
|
29
|
+
normalizeStructuredOutput,
|
|
30
|
+
structuredOutputRepairPreview
|
|
31
|
+
} from "./chunk-SXE4J43E.js";
|
|
37
32
|
import {
|
|
38
33
|
parseContinuationState,
|
|
39
34
|
questionResult,
|
|
40
35
|
serializeContinuationState
|
|
41
36
|
} from "./chunk-5I2NVRHC.js";
|
|
37
|
+
import {
|
|
38
|
+
AgentInteractionSignal,
|
|
39
|
+
ToolExecutionSuspension,
|
|
40
|
+
approvalInteraction
|
|
41
|
+
} from "./chunk-5IURMWFN.js";
|
|
42
42
|
import {
|
|
43
43
|
isQuestionTool
|
|
44
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-MNBKSRS5.js";
|
|
45
45
|
import {
|
|
46
46
|
startAgentRunObservers
|
|
47
47
|
} from "./chunk-YNA3UR42.js";
|
|
48
48
|
import {
|
|
49
49
|
MemoryCompactionError
|
|
50
50
|
} from "./chunk-LQJ4KHMY.js";
|
|
51
|
-
import {
|
|
52
|
-
extractRagText
|
|
53
|
-
} from "./chunk-MJCMKZFP.js";
|
|
54
51
|
import {
|
|
55
52
|
createAsyncQueue
|
|
56
53
|
} from "./chunk-EZR5AV3J.js";
|
|
54
|
+
import {
|
|
55
|
+
extractRagText
|
|
56
|
+
} from "./chunk-MJCMKZFP.js";
|
|
57
57
|
import {
|
|
58
58
|
runControl
|
|
59
59
|
} from "./chunk-FAPIZJS2.js";
|
|
@@ -78,7 +78,7 @@ import {
|
|
|
78
78
|
import {
|
|
79
79
|
runInputGuardrails,
|
|
80
80
|
runOutputGuardrails
|
|
81
|
-
} from "./chunk-
|
|
81
|
+
} from "./chunk-VZ5ZZBNX.js";
|
|
82
82
|
import {
|
|
83
83
|
appendGuardrailPolicies,
|
|
84
84
|
hasEnforcedOutputGuardrails
|
|
@@ -2349,4 +2349,4 @@ function observerRunEnd(outcome) {
|
|
|
2349
2349
|
export {
|
|
2350
2350
|
AgentRun
|
|
2351
2351
|
};
|
|
2352
|
-
//# sourceMappingURL=chunk-
|
|
2352
|
+
//# sourceMappingURL=chunk-AO2QL2VD.js.map
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isProbability,
|
|
3
|
+
isRecord
|
|
4
|
+
} from "./chunk-547CQSO2.js";
|
|
5
|
+
import {
|
|
6
|
+
DecisionProviderOutputError
|
|
7
|
+
} from "./chunk-Y4Q66NQY.js";
|
|
8
|
+
import {
|
|
9
|
+
isJsonValue
|
|
10
|
+
} from "./chunk-4C7AXYOM.js";
|
|
11
|
+
|
|
12
|
+
// src/decision/result.ts
|
|
13
|
+
function assertResult(value, request, model) {
|
|
14
|
+
function fail(message, questionName) {
|
|
15
|
+
throw new DecisionProviderOutputError(message, {
|
|
16
|
+
provider: model.provider,
|
|
17
|
+
modelId: model.modelId,
|
|
18
|
+
questionName
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
if (!isRecord(value) || !Object.hasOwn(value, "rawResponse")) {
|
|
22
|
+
fail("Decision model returned an invalid result.");
|
|
23
|
+
}
|
|
24
|
+
const answers = value.answers;
|
|
25
|
+
if (!isRecord(answers) || !sameKeys(answers, Object.keys(request.questions))) {
|
|
26
|
+
fail("Decision answers must match the requested question names.");
|
|
27
|
+
}
|
|
28
|
+
for (const [name, question] of Object.entries(request.questions)) {
|
|
29
|
+
const answer = answers[name];
|
|
30
|
+
if (!isRecord(answer) || answer.type !== question.type) {
|
|
31
|
+
fail("Decision answer has an invalid shape or type.", name);
|
|
32
|
+
}
|
|
33
|
+
if (answer.confidence !== void 0 && !isProbability(answer.confidence)) {
|
|
34
|
+
fail("Decision confidence must be between zero and one.", name);
|
|
35
|
+
}
|
|
36
|
+
if (!validAnswer(answer, question))
|
|
37
|
+
fail("Decision answer violates its question contract.", name);
|
|
38
|
+
}
|
|
39
|
+
if (value.usage !== void 0 && !validUsage(value.usage)) {
|
|
40
|
+
fail("Decision model returned invalid token usage.");
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
function validAnswer(answer, question) {
|
|
44
|
+
switch (question.type) {
|
|
45
|
+
case "choice": {
|
|
46
|
+
const labels = Object.keys(question.options);
|
|
47
|
+
return typeof answer.choice === "string" && Object.hasOwn(question.options, answer.choice) && (answer.probabilities === void 0 || validDistribution(answer.probabilities, labels, true));
|
|
48
|
+
}
|
|
49
|
+
case "multi-label": {
|
|
50
|
+
const labels = Object.keys(question.options);
|
|
51
|
+
if (!Array.isArray(answer.labels) || !isJsonValue(answer.labels) || new Set(answer.labels).size !== answer.labels.length || !validDistribution(answer.probabilities, labels, false))
|
|
52
|
+
return false;
|
|
53
|
+
const probabilities = answer.probabilities;
|
|
54
|
+
const selected = labels.filter(
|
|
55
|
+
(label) => probabilities[label] >= (question.threshold ?? 0.5)
|
|
56
|
+
);
|
|
57
|
+
return answer.labels.length === selected.length && answer.labels.every((label) => typeof label === "string" && selected.includes(label));
|
|
58
|
+
}
|
|
59
|
+
case "score":
|
|
60
|
+
return typeof answer.score === "number" && Number.isFinite(answer.score) && answer.score >= 0 && answer.score <= question.rubric.length - 1 && isJsonValue(answer.rubric) && jsonEqual(answer.rubric, question.rubric) && (answer.probabilities === void 0 || Array.isArray(answer.probabilities) && isJsonValue(answer.probabilities) && answer.probabilities.length === question.rubric.length && answer.probabilities.every(isProbability) && sumsToOne(answer.probabilities));
|
|
61
|
+
case "check":
|
|
62
|
+
return isProbability(answer.probability);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
function jsonEqual(left, right) {
|
|
66
|
+
if (left === right) return true;
|
|
67
|
+
if (Array.isArray(left) || Array.isArray(right)) {
|
|
68
|
+
return Array.isArray(left) && Array.isArray(right) && left.length === right.length && left.every((value, index) => jsonEqual(value, right[index]));
|
|
69
|
+
}
|
|
70
|
+
if (!isRecord(left) || !isRecord(right)) return false;
|
|
71
|
+
const keys = Object.keys(left);
|
|
72
|
+
return sameKeys(right, keys) && keys.every((key) => jsonEqual(left[key], right[key]));
|
|
73
|
+
}
|
|
74
|
+
function validDistribution(value, labels, exclusive) {
|
|
75
|
+
if (!isRecord(value) || !sameKeys(value, labels)) return false;
|
|
76
|
+
const probabilities = Object.values(value);
|
|
77
|
+
return probabilities.every(isProbability) && (!exclusive || sumsToOne(probabilities));
|
|
78
|
+
}
|
|
79
|
+
function sumsToOne(values) {
|
|
80
|
+
return Math.abs(values.reduce((sum, probability) => sum + probability, 0) - 1) <= 1e-5;
|
|
81
|
+
}
|
|
82
|
+
function sameKeys(value, keys) {
|
|
83
|
+
return Object.keys(value).length === keys.length && keys.every((key) => Object.hasOwn(value, key));
|
|
84
|
+
}
|
|
85
|
+
function validUsage(value) {
|
|
86
|
+
if (!isRecord(value)) return false;
|
|
87
|
+
const fields = [
|
|
88
|
+
"inputTokens",
|
|
89
|
+
"outputTokens",
|
|
90
|
+
"totalTokens",
|
|
91
|
+
"cachedInputTokens",
|
|
92
|
+
"cacheCreationInputTokens"
|
|
93
|
+
];
|
|
94
|
+
return fields.every(
|
|
95
|
+
(key) => typeof value[key] === "number" && Number.isFinite(value[key]) && value[key] >= 0
|
|
96
|
+
) && (value.details === void 0 || isRecord(value.details) && Object.values(value.details).every(
|
|
97
|
+
(count) => typeof count === "number" && Number.isFinite(count) && count >= 0
|
|
98
|
+
));
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export {
|
|
102
|
+
assertResult
|
|
103
|
+
};
|
|
104
|
+
//# sourceMappingURL=chunk-BH7RLRLQ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/decision/result.ts"],"sourcesContent":["import { isJsonValue } from \"../completion/json\";\nimport type { JsonValue } from \"../completion/types\";\nimport { DecisionProviderOutputError } from \"./errors\";\nimport type { DecisionModel, DecisionQuestion, DecisionRequest } from \"./types\";\nimport { isProbability, isRecord } from \"./validation\";\n\n/** Validate provider answers before callers use them to branch or act. */\nexport function assertResult(value: unknown, request: DecisionRequest, model: DecisionModel): void {\n function fail(message: string, questionName?: string): never {\n throw new DecisionProviderOutputError(message, {\n provider: model.provider,\n modelId: model.modelId,\n questionName,\n });\n }\n if (!isRecord(value) || !Object.hasOwn(value, \"rawResponse\")) {\n fail(\"Decision model returned an invalid result.\");\n }\n const answers = value.answers;\n if (!isRecord(answers) || !sameKeys(answers, Object.keys(request.questions))) {\n fail(\"Decision answers must match the requested question names.\");\n }\n for (const [name, question] of Object.entries(request.questions)) {\n const answer = answers[name];\n if (!isRecord(answer) || answer.type !== question.type) {\n fail(\"Decision answer has an invalid shape or type.\", name);\n }\n if (answer.confidence !== undefined && !isProbability(answer.confidence)) {\n fail(\"Decision confidence must be between zero and one.\", name);\n }\n if (!validAnswer(answer, question))\n fail(\"Decision answer violates its question contract.\", name);\n }\n if (value.usage !== undefined && !validUsage(value.usage)) {\n fail(\"Decision model returned invalid token usage.\");\n }\n}\n\nfunction validAnswer(answer: Record<string, unknown>, question: DecisionQuestion): boolean {\n switch (question.type) {\n case \"choice\": {\n const labels = Object.keys(question.options);\n return (\n typeof answer.choice === \"string\" &&\n Object.hasOwn(question.options, answer.choice) &&\n (answer.probabilities === undefined ||\n validDistribution(answer.probabilities, labels, true))\n );\n }\n case \"multi-label\": {\n const labels = Object.keys(question.options);\n if (\n !Array.isArray(answer.labels) ||\n !isJsonValue(answer.labels) ||\n new Set(answer.labels).size !== answer.labels.length ||\n !validDistribution(answer.probabilities, labels, false)\n )\n return false;\n const probabilities = answer.probabilities as Record<string, number>;\n const selected = labels.filter(\n (label) => probabilities[label]! >= (question.threshold ?? 0.5),\n );\n return (\n answer.labels.length === selected.length &&\n answer.labels.every((label) => typeof label === \"string\" && selected.includes(label))\n );\n }\n case \"score\":\n return (\n typeof answer.score === \"number\" &&\n Number.isFinite(answer.score) &&\n answer.score >= 0 &&\n answer.score <= question.rubric.length - 1 &&\n isJsonValue(answer.rubric) &&\n jsonEqual(answer.rubric, question.rubric) &&\n (answer.probabilities === undefined ||\n (Array.isArray(answer.probabilities) &&\n isJsonValue(answer.probabilities) &&\n answer.probabilities.length === question.rubric.length &&\n answer.probabilities.every(isProbability) &&\n sumsToOne(answer.probabilities)))\n );\n case \"check\":\n return isProbability(answer.probability);\n }\n}\n\nfunction jsonEqual(left: JsonValue, right: JsonValue): boolean {\n if (left === right) return true;\n if (Array.isArray(left) || Array.isArray(right)) {\n return (\n Array.isArray(left) &&\n Array.isArray(right) &&\n left.length === right.length &&\n left.every((value, index) => jsonEqual(value, right[index]!))\n );\n }\n if (!isRecord(left) || !isRecord(right)) return false;\n const keys = Object.keys(left);\n return sameKeys(right, keys) && keys.every((key) => jsonEqual(left[key]!, right[key]!));\n}\n\nfunction validDistribution(value: unknown, labels: string[], exclusive: boolean): boolean {\n if (!isRecord(value) || !sameKeys(value, labels)) return false;\n const probabilities = Object.values(value);\n return probabilities.every(isProbability) && (!exclusive || sumsToOne(probabilities));\n}\n\nfunction sumsToOne(values: number[]): boolean {\n // Permit ordinary rounding in provider probability distributions.\n return Math.abs(values.reduce((sum, probability) => sum + probability, 0) - 1) <= 1e-5;\n}\n\nfunction sameKeys(value: Record<string, unknown>, keys: string[]): boolean {\n return (\n Object.keys(value).length === keys.length && keys.every((key) => Object.hasOwn(value, key))\n );\n}\n\nfunction validUsage(value: unknown): boolean {\n if (!isRecord(value)) return false;\n const fields = [\n \"inputTokens\",\n \"outputTokens\",\n \"totalTokens\",\n \"cachedInputTokens\",\n \"cacheCreationInputTokens\",\n ];\n return (\n fields.every(\n (key) => typeof value[key] === \"number\" && Number.isFinite(value[key]) && value[key] >= 0,\n ) &&\n (value.details === undefined ||\n (isRecord(value.details) &&\n Object.values(value.details).every(\n (count) => typeof count === \"number\" && Number.isFinite(count) && count >= 0,\n )))\n );\n}\n"],"mappings":";;;;;;;;;;;;AAOO,SAAS,aAAa,OAAgB,SAA0B,OAA4B;AACjG,WAAS,KAAK,SAAiB,cAA8B;AAC3D,UAAM,IAAI,4BAA4B,SAAS;AAAA,MAC7C,UAAU,MAAM;AAAA,MAChB,SAAS,MAAM;AAAA,MACf;AAAA,IACF,CAAC;AAAA,EACH;AACA,MAAI,CAAC,SAAS,KAAK,KAAK,CAAC,OAAO,OAAO,OAAO,aAAa,GAAG;AAC5D,SAAK,4CAA4C;AAAA,EACnD;AACA,QAAM,UAAU,MAAM;AACtB,MAAI,CAAC,SAAS,OAAO,KAAK,CAAC,SAAS,SAAS,OAAO,KAAK,QAAQ,SAAS,CAAC,GAAG;AAC5E,SAAK,2DAA2D;AAAA,EAClE;AACA,aAAW,CAAC,MAAM,QAAQ,KAAK,OAAO,QAAQ,QAAQ,SAAS,GAAG;AAChE,UAAM,SAAS,QAAQ,IAAI;AAC3B,QAAI,CAAC,SAAS,MAAM,KAAK,OAAO,SAAS,SAAS,MAAM;AACtD,WAAK,iDAAiD,IAAI;AAAA,IAC5D;AACA,QAAI,OAAO,eAAe,UAAa,CAAC,cAAc,OAAO,UAAU,GAAG;AACxE,WAAK,qDAAqD,IAAI;AAAA,IAChE;AACA,QAAI,CAAC,YAAY,QAAQ,QAAQ;AAC/B,WAAK,mDAAmD,IAAI;AAAA,EAChE;AACA,MAAI,MAAM,UAAU,UAAa,CAAC,WAAW,MAAM,KAAK,GAAG;AACzD,SAAK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G,CAAC,KAAK,MAAM,GAAG,KAAK;AAAA,EAC1F,MACC,MAAM,YAAY,UAChB,SAAS,MAAM,OAAO,KACrB,OAAO,OAAO,MAAM,OAAO,EAAE;AAAA,IAC3B,CAAC,UAAU,OAAO,UAAU,YAAY,OAAO,SAAS,KAAK,KAAK,SAAS;AAAA,EAC7E;AAER;","names":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createTool
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-MEFGXAKJ.js";
|
|
4
4
|
|
|
5
5
|
// src/tool/think-tool.ts
|
|
6
6
|
import { z } from "zod";
|
|
@@ -21,4 +21,4 @@ function createThinkTool(options = {}) {
|
|
|
21
21
|
export {
|
|
22
22
|
createThinkTool
|
|
23
23
|
};
|
|
24
|
-
//# sourceMappingURL=chunk-
|
|
24
|
+
//# sourceMappingURL=chunk-CASF2TDK.js.map
|
|
@@ -2,12 +2,12 @@ import {
|
|
|
2
2
|
AgentInteractionSignal,
|
|
3
3
|
ToolExecutionSuspension
|
|
4
4
|
} from "./chunk-5IURMWFN.js";
|
|
5
|
-
import {
|
|
6
|
-
isQuestionTool
|
|
7
|
-
} from "./chunk-IZH2ZAE3.js";
|
|
8
5
|
import {
|
|
9
6
|
isSkillTool
|
|
10
7
|
} from "./chunk-2NLINXRF.js";
|
|
8
|
+
import {
|
|
9
|
+
isQuestionTool
|
|
10
|
+
} from "./chunk-MNBKSRS5.js";
|
|
11
11
|
import {
|
|
12
12
|
runControl,
|
|
13
13
|
toolCallControl
|
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
import {
|
|
31
31
|
prepareToolCall,
|
|
32
32
|
prepareToolCallFromInput
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-27MBNR47.js";
|
|
34
34
|
import {
|
|
35
35
|
assertToolApprovalRequirement,
|
|
36
36
|
toolMayRequireApproval
|
|
@@ -967,4 +967,4 @@ function agentToolEventPayload(toolCall, internalCallId, event) {
|
|
|
967
967
|
export {
|
|
968
968
|
ToolCallExecutor
|
|
969
969
|
};
|
|
970
|
-
//# sourceMappingURL=chunk-
|
|
970
|
+
//# sourceMappingURL=chunk-DRSKZVC6.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AgentRun
|
|
3
|
-
} from "./chunk-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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":[]}
|
|
@@ -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
|
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
|