@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
|
@@ -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
|
|
@@ -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,82 @@
|
|
|
1
|
+
import {
|
|
2
|
+
assertResult
|
|
3
|
+
} from "./chunk-AGPDR6FF.js";
|
|
4
|
+
import {
|
|
5
|
+
assertRequest
|
|
6
|
+
} from "./chunk-RW32K6OO.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-3YVGQNTI.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":[]}
|
|
@@ -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,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
extract
|
|
3
|
+
} from "./chunk-VCOGUS3Q.js";
|
|
1
4
|
import {
|
|
2
5
|
resolveActual,
|
|
3
6
|
resolveActualText,
|
|
@@ -5,21 +8,18 @@ import {
|
|
|
5
8
|
resolveJudgePrompt
|
|
6
9
|
} from "./chunk-ZPXOBQDS.js";
|
|
7
10
|
import {
|
|
8
|
-
|
|
9
|
-
} from "./chunk-
|
|
11
|
+
EvalOutcome
|
|
12
|
+
} from "./chunk-EJR6VVB3.js";
|
|
10
13
|
import {
|
|
11
14
|
evalValuesEqual,
|
|
12
15
|
formatValue
|
|
13
16
|
} from "./chunk-ZYXMWEL4.js";
|
|
14
17
|
import {
|
|
15
|
-
|
|
16
|
-
} from "./chunk-
|
|
18
|
+
embedText
|
|
19
|
+
} from "./chunk-YCTXTOOQ.js";
|
|
17
20
|
import {
|
|
18
21
|
cosineSimilarity
|
|
19
22
|
} from "./chunk-7F53DOML.js";
|
|
20
|
-
import {
|
|
21
|
-
embedText
|
|
22
|
-
} from "./chunk-YCTXTOOQ.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-AGOZCYFP.js.map
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isProbability,
|
|
3
|
+
isRecord
|
|
4
|
+
} from "./chunk-RW32K6OO.js";
|
|
5
|
+
import {
|
|
6
|
+
DecisionProviderOutputError
|
|
7
|
+
} from "./chunk-BRGNY5ZB.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-AGPDR6FF.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":"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","names":[]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import {
|
|
2
|
+
assertQuestion
|
|
3
|
+
} from "./chunk-RW32K6OO.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-AKQQG3IX.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":[]}
|
|
@@ -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,33 @@
|
|
|
1
|
+
// src/decision/errors.ts
|
|
2
|
+
var DecisionCapabilityError = class extends Error {
|
|
3
|
+
provider;
|
|
4
|
+
modelId;
|
|
5
|
+
questionType;
|
|
6
|
+
constructor(options) {
|
|
7
|
+
super(
|
|
8
|
+
`${options.provider}/${options.modelId} does not support ${options.questionType} questions.`
|
|
9
|
+
);
|
|
10
|
+
this.name = "DecisionCapabilityError";
|
|
11
|
+
this.provider = options.provider;
|
|
12
|
+
this.modelId = options.modelId;
|
|
13
|
+
this.questionType = options.questionType;
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
var DecisionProviderOutputError = class extends Error {
|
|
17
|
+
provider;
|
|
18
|
+
modelId;
|
|
19
|
+
questionName;
|
|
20
|
+
constructor(message, options) {
|
|
21
|
+
super(message, options.cause === void 0 ? void 0 : { cause: options.cause });
|
|
22
|
+
this.name = "DecisionProviderOutputError";
|
|
23
|
+
this.provider = options.provider;
|
|
24
|
+
this.modelId = options.modelId;
|
|
25
|
+
this.questionName = options.questionName;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export {
|
|
30
|
+
DecisionCapabilityError,
|
|
31
|
+
DecisionProviderOutputError
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=chunk-BRGNY5ZB.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/decision/errors.ts"],"sourcesContent":["import type { DecisionQuestionType } from \"./types\";\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":";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,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":[]}
|