@anvia/core 0.26.0 → 1.0.0-rc.10
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 +400 -94
- package/dist/agent/index.d.ts +67 -71
- package/dist/agent/index.js +36 -18
- package/dist/agent/interactions/index.d.ts +122 -0
- package/dist/agent/interactions/index.js +20 -0
- package/dist/agent-DWzW9SoH.d.ts +150 -0
- package/dist/chunk-3RM57ZT2.js +31 -0
- package/dist/chunk-3RM57ZT2.js.map +1 -0
- package/dist/chunk-3RWESPUG.js +331 -0
- package/dist/chunk-3RWESPUG.js.map +1 -0
- package/dist/{chunk-NCPN4SJR.js → chunk-3SKZ2BKP.js} +15 -13
- package/dist/chunk-3SKZ2BKP.js.map +1 -0
- package/dist/chunk-3XQGVDU5.js +69 -0
- package/dist/chunk-3XQGVDU5.js.map +1 -0
- package/dist/{chunk-MRQLEK2B.js → chunk-5C6B6ZRH.js} +69 -51
- package/dist/chunk-5C6B6ZRH.js.map +1 -0
- package/dist/chunk-6BBOCFHV.js +323 -0
- package/dist/chunk-6BBOCFHV.js.map +1 -0
- package/dist/chunk-7JLAIN6E.js +15 -0
- package/dist/chunk-7JLAIN6E.js.map +1 -0
- package/dist/chunk-7PHMK7W4.js +1516 -0
- package/dist/chunk-7PHMK7W4.js.map +1 -0
- package/dist/{chunk-CWUJUSOS.js → chunk-AZB6N7P4.js} +94 -65
- package/dist/chunk-AZB6N7P4.js.map +1 -0
- package/dist/chunk-D4PACGPA.js +37 -0
- package/dist/chunk-D4PACGPA.js.map +1 -0
- package/dist/chunk-EFLT7XZD.js +51 -0
- package/dist/chunk-EFLT7XZD.js.map +1 -0
- package/dist/chunk-EMZKPRE6.js +667 -0
- package/dist/chunk-EMZKPRE6.js.map +1 -0
- package/dist/chunk-I3Q7XSBB.js +59 -0
- package/dist/chunk-I3Q7XSBB.js.map +1 -0
- package/dist/chunk-J6LVLV6P.js +13 -0
- package/dist/chunk-J6LVLV6P.js.map +1 -0
- package/dist/chunk-LTXABCOO.js +127 -0
- package/dist/chunk-LTXABCOO.js.map +1 -0
- package/dist/chunk-OJBFDBLG.js +164 -0
- package/dist/chunk-OJBFDBLG.js.map +1 -0
- package/dist/chunk-QGX73TSQ.js +177 -0
- package/dist/chunk-QGX73TSQ.js.map +1 -0
- package/dist/chunk-QOUPWOGW.js +29 -0
- package/dist/chunk-QOUPWOGW.js.map +1 -0
- package/dist/chunk-SJMSS5SI.js +171 -0
- package/dist/chunk-SJMSS5SI.js.map +1 -0
- package/dist/chunk-T2C3CGDQ.js +56 -0
- package/dist/chunk-T2C3CGDQ.js.map +1 -0
- package/dist/chunk-VX3HS6PE.js +4569 -0
- package/dist/chunk-VX3HS6PE.js.map +1 -0
- package/dist/chunk-X4LK4ODN.js +86 -0
- package/dist/chunk-X4LK4ODN.js.map +1 -0
- package/dist/chunk-ZA564323.js +331 -0
- package/dist/chunk-ZA564323.js.map +1 -0
- package/dist/completion/index.d.ts +6 -36
- package/dist/completion/index.js +34 -29
- package/dist/documents/index.d.ts +34 -0
- package/dist/documents/index.js +340 -0
- package/dist/documents/index.js.map +1 -0
- package/dist/dynamic-tools-aIZlg5x1.d.ts +45 -0
- package/dist/embeddings/index.d.ts +11 -9
- package/dist/embeddings/index.js +3 -4
- package/dist/evals/index.d.ts +57 -21
- package/dist/evals/index.js +209 -104
- package/dist/evals/index.js.map +1 -1
- package/dist/extractor/index.d.ts +27 -42
- package/dist/extractor/index.js +9 -22
- package/dist/guardrails/index.d.ts +7 -129
- package/dist/guardrails/index.js +1 -1
- package/dist/image-generation/index.d.ts +23 -23
- package/dist/image-generation/index.js +7 -39
- package/dist/image-generation/index.js.map +1 -1
- package/dist/index.d.ts +24 -22
- package/dist/index.js +85 -68
- package/dist/internal/agent.d.ts +156 -10
- package/dist/internal/agent.js +58 -18
- package/dist/internal/agent.js.map +1 -1
- package/dist/mcp/index.d.ts +7 -15
- package/dist/mcp/index.js +3 -348
- package/dist/mcp/index.js.map +1 -1
- package/dist/memory/index.d.ts +20 -6
- package/dist/memory/index.js +11 -10
- package/dist/middleware-kcF8AusP.d.ts +59 -0
- package/dist/model-call-options-CZkSw_xN.d.ts +6 -0
- package/dist/model-listing/index.d.ts +3 -1
- package/dist/observability/index.d.ts +23 -4
- package/dist/observability/index.js +10 -5
- package/dist/observability/index.js.map +1 -1
- package/dist/pipeline/index.d.ts +111 -73
- package/dist/pipeline/index.js +471 -286
- package/dist/pipeline/index.js.map +1 -1
- package/dist/provider-output-error-BEwDgVv3.d.ts +99 -0
- package/dist/retry-CjvSlKGW.d.ts +16 -0
- package/dist/skills/index.d.ts +5 -4
- package/dist/skills/index.js +8 -8
- package/dist/speech-generation/index.d.ts +37 -0
- package/dist/speech-generation/index.js +10 -0
- package/dist/streaming/index.js +37 -3
- package/dist/streaming/index.js.map +1 -1
- package/dist/text-ZLECpQE7.d.ts +32 -0
- package/dist/think-tool-BwCsJ365.d.ts +40 -0
- package/dist/tool/index.d.ts +11 -6
- package/dist/tool/index.js +21 -21
- package/dist/tool-BpqpoRSE.d.ts +58 -0
- package/dist/transcription/index.d.ts +29 -22
- package/dist/transcription/index.js +7 -57
- package/dist/transcription/index.js.map +1 -1
- package/dist/type-utils-CtHVDRn_.d.ts +6 -0
- package/dist/types-CXNE592e.d.ts +130 -0
- package/dist/types-Cr4uiYo5.d.ts +99 -0
- package/dist/{types-04LqWrmy.d.ts → types-DC1U1XwW.d.ts} +1 -1
- package/dist/types-DKOXVTcq.d.ts +155 -0
- package/dist/types-DgvozfPc.d.ts +349 -0
- package/dist/types-DhkodEft.d.ts +105 -0
- package/dist/types-DjqRHeAi.d.ts +31 -0
- package/dist/types-Sue2hb_L.d.ts +403 -0
- package/dist/vector-store/index.d.ts +34 -34
- package/dist/vector-store/index.js +10 -6
- package/package.json +22 -24
- package/dist/agent-x3YTyv5i.d.ts +0 -222
- package/dist/audio-generation/index.d.ts +0 -33
- package/dist/audio-generation/index.js +0 -42
- package/dist/audio-generation/index.js.map +0 -1
- package/dist/chunk-2ODTMRHP.js +0 -54
- package/dist/chunk-2ODTMRHP.js.map +0 -1
- package/dist/chunk-ADH7NNCS.js +0 -512
- package/dist/chunk-ADH7NNCS.js.map +0 -1
- package/dist/chunk-BALBBVI3.js +0 -2732
- package/dist/chunk-BALBBVI3.js.map +0 -1
- package/dist/chunk-CQNNSZPG.js +0 -9
- package/dist/chunk-CQNNSZPG.js.map +0 -1
- package/dist/chunk-CWUJUSOS.js.map +0 -1
- package/dist/chunk-DALYP4PX.js +0 -225
- package/dist/chunk-DALYP4PX.js.map +0 -1
- package/dist/chunk-HYUYZEAJ.js +0 -223
- package/dist/chunk-HYUYZEAJ.js.map +0 -1
- package/dist/chunk-I6XOQ4LK.js +0 -466
- package/dist/chunk-I6XOQ4LK.js.map +0 -1
- package/dist/chunk-JI5YZWNT.js +0 -220
- package/dist/chunk-JI5YZWNT.js.map +0 -1
- package/dist/chunk-MC3CCKEB.js +0 -221
- package/dist/chunk-MC3CCKEB.js.map +0 -1
- package/dist/chunk-MELYDKWQ.js +0 -337
- package/dist/chunk-MELYDKWQ.js.map +0 -1
- package/dist/chunk-MNWK2USR.js +0 -243
- package/dist/chunk-MNWK2USR.js.map +0 -1
- package/dist/chunk-MRQLEK2B.js.map +0 -1
- package/dist/chunk-NCPN4SJR.js.map +0 -1
- package/dist/chunk-OIMLU4SF.js +0 -20
- package/dist/chunk-OIMLU4SF.js.map +0 -1
- package/dist/chunk-Q25IWLBT.js +0 -138
- package/dist/chunk-Q25IWLBT.js.map +0 -1
- package/dist/chunk-UQX6EXWG.js +0 -33
- package/dist/chunk-UQX6EXWG.js.map +0 -1
- package/dist/chunk-WQKHFADH.js +0 -12
- package/dist/chunk-WQKHFADH.js.map +0 -1
- package/dist/chunk-XUUY2L2D.js +0 -42
- package/dist/chunk-XUUY2L2D.js.map +0 -1
- package/dist/chunk-XWUC7CIT.js +0 -1
- package/dist/chunk-XWUC7CIT.js.map +0 -1
- package/dist/chunk-YLMDBQO4.js +0 -141
- package/dist/chunk-YLMDBQO4.js.map +0 -1
- package/dist/errors-2moLDuuN.d.ts +0 -17
- package/dist/hooks/index.d.ts +0 -12
- package/dist/hooks/index.js +0 -17
- package/dist/index-BxSbmOMr.d.ts +0 -257
- package/dist/json-BVPssigK.d.ts +0 -39
- package/dist/loaders/index.d.ts +0 -91
- package/dist/loaders/index.js +0 -299
- package/dist/loaders/index.js.map +0 -1
- package/dist/middleware-Dp3d_pxi.d.ts +0 -90
- package/dist/request/index.d.ts +0 -28
- package/dist/request/index.js +0 -25
- package/dist/think-tool-DfCMuO8e.d.ts +0 -26
- package/dist/tool-Cohdv5GC.d.ts +0 -65
- package/dist/types-BCTRUGex.d.ts +0 -47
- package/dist/types-BrLbKnEz.d.ts +0 -119
- package/dist/types-D9JpeAPF.d.ts +0 -114
- package/dist/types-G12i56s2.d.ts +0 -354
- package/dist/types-JJCxRnaZ.d.ts +0 -70
- package/dist/types-O-abTIin.d.ts +0 -79
- package/dist/ui/index.d.ts +0 -107
- package/dist/ui/index.js +0 -10
- package/dist/ui/index.js.map +0 -1
- /package/dist/{hooks → agent/interactions}/index.js.map +0 -0
- /package/dist/{request → speech-generation}/index.js.map +0 -0
package/dist/agent/index.d.ts
CHANGED
|
@@ -1,75 +1,71 @@
|
|
|
1
|
-
|
|
2
|
-
export {
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
import
|
|
8
|
-
import { m as MemoryStore, n as MemoryOptions } from '../types-BrLbKnEz.js';
|
|
9
|
-
import { i as AgentObserver, O as ObserveOptions } from '../index-BxSbmOMr.js';
|
|
10
|
-
import { a as SkillSet } from '../types-04LqWrmy.js';
|
|
11
|
-
import { i as ToolSearchDocument, j as ToolSet, A as AgentMiddleware } from '../middleware-Dp3d_pxi.js';
|
|
12
|
-
import { A as AnyTool, e as ToolApprovalsOptions } from '../tool-Cohdv5GC.js';
|
|
13
|
-
import { a as VectorSearchIndex } from '../types-O-abTIin.js';
|
|
1
|
+
export { M as ModelCallOptions } from '../model-call-options-CZkSw_xN.js';
|
|
2
|
+
export { R as RetryContext, a as RetryOptions, b as RetrySetting } from '../retry-CjvSlKGW.js';
|
|
3
|
+
export { A as Agent, a as AgentContextInput, b as AgentMemory, c as AgentMemoryOptions, d as AgentOptions, e as AgentToolInput, f as AgentToolOptions, C as CreateHybridVectorContextOptions, g as CreateVectorContextOptions, V as VectorContext, h as VectorContextBaseOptions, i as createVectorContext, j as isVectorContext } from '../agent-DWzW9SoH.js';
|
|
4
|
+
import { M as Message, U as Usage, C as CompletionFinishReason } from '../types-DgvozfPc.js';
|
|
5
|
+
import { A as AgentBlockedResult, t as AgentSuspendedResult } from '../types-Sue2hb_L.js';
|
|
6
|
+
export { a as AgentChildStreamEvent, b as AgentDeltaEvent, c as AgentErrorEvent, d as AgentErrorStreamEvent, e as AgentFinishEvent, f as AgentInput, g as AgentLifecycle, h as AgentMemoryCompactionEvent, i as AgentPrompt, j as AgentResponse, k as AgentResult, l as AgentRunOptions, m as AgentRunSettings, n as AgentStartEvent, o as AgentSteerInput, p as AgentSteerReceipt, q as AgentStepFinishEvent, r as AgentStream, s as AgentStreamEvent, u as AgentToolCallDeltaEvent, v as AgentToolFinishEvent, w as AgentToolStartEvent } from '../types-Sue2hb_L.js';
|
|
7
|
+
import '../zod-schema-C7F4clpm.js';
|
|
14
8
|
import 'zod';
|
|
15
|
-
import '
|
|
16
|
-
import '
|
|
17
|
-
import '
|
|
18
|
-
import '../
|
|
9
|
+
import '../types-DhkodEft.js';
|
|
10
|
+
import '../type-utils-CtHVDRn_.js';
|
|
11
|
+
import '../types-DjqRHeAi.js';
|
|
12
|
+
import '../tool-BpqpoRSE.js';
|
|
13
|
+
import '../middleware-kcF8AusP.js';
|
|
14
|
+
import '../types-DKOXVTcq.js';
|
|
15
|
+
import '../types-DC1U1XwW.js';
|
|
16
|
+
import '../dynamic-tools-aIZlg5x1.js';
|
|
17
|
+
import '../types-Cr4uiYo5.js';
|
|
18
|
+
import '../types-CXNE592e.js';
|
|
19
|
+
import './interactions/index.js';
|
|
19
20
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
memory(store: MemoryStore, options?: MemoryOptions): this;
|
|
69
|
-
eventStore(store: AgentEventStore, options?: AgentEventStoreOptions): this;
|
|
70
|
-
outputSchema(schema: ZodSchema): this;
|
|
71
|
-
build(): Agent<M>;
|
|
72
|
-
private buildInstructions;
|
|
21
|
+
type AgentStructuredOutputPhase = "truncated" | "content-filter" | "parse" | "schema";
|
|
22
|
+
type AgentStructuredOutputFormat = "raw" | "json-fence" | "unlabeled-fence";
|
|
23
|
+
declare class AgentStructuredOutputError extends Error {
|
|
24
|
+
readonly phase: AgentStructuredOutputPhase;
|
|
25
|
+
readonly attempt: number;
|
|
26
|
+
readonly maxAttempts: number;
|
|
27
|
+
readonly outputLength: number;
|
|
28
|
+
readonly normalizedLength: number;
|
|
29
|
+
readonly outputFormat: AgentStructuredOutputFormat;
|
|
30
|
+
readonly attemptUsage: Usage;
|
|
31
|
+
readonly usage: Usage;
|
|
32
|
+
readonly finishReason: CompletionFinishReason | undefined;
|
|
33
|
+
readonly providerFinishReason: string | undefined;
|
|
34
|
+
constructor(options: {
|
|
35
|
+
phase: AgentStructuredOutputPhase;
|
|
36
|
+
attempt: number;
|
|
37
|
+
maxAttempts: number;
|
|
38
|
+
outputLength: number;
|
|
39
|
+
normalizedLength: number;
|
|
40
|
+
outputFormat: AgentStructuredOutputFormat;
|
|
41
|
+
attemptUsage: Usage;
|
|
42
|
+
usage: Usage;
|
|
43
|
+
finishReason?: CompletionFinishReason | undefined;
|
|
44
|
+
providerFinishReason?: string | undefined;
|
|
45
|
+
cause?: unknown;
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
declare class MaxTurnsError extends Error {
|
|
49
|
+
readonly maxTurns: number;
|
|
50
|
+
readonly chatHistory: Message[];
|
|
51
|
+
readonly prompt: Message;
|
|
52
|
+
constructor(maxTurns: number, chatHistory: Message[], prompt: Message);
|
|
53
|
+
}
|
|
54
|
+
declare class AgentRunCancelledError extends Error {
|
|
55
|
+
readonly chatHistory: Message[];
|
|
56
|
+
readonly reason: string;
|
|
57
|
+
constructor(chatHistory: Message[], reason: string, options?: ErrorOptions);
|
|
58
|
+
}
|
|
59
|
+
declare class AgentRunBlockedError extends Error {
|
|
60
|
+
readonly result: AgentBlockedResult;
|
|
61
|
+
constructor(result: AgentBlockedResult);
|
|
62
|
+
}
|
|
63
|
+
declare class AgentStreamClosedError extends Error {
|
|
64
|
+
constructor();
|
|
65
|
+
}
|
|
66
|
+
declare class AgentToolSuspensionError extends Error {
|
|
67
|
+
readonly result: AgentSuspendedResult;
|
|
68
|
+
constructor(result: AgentSuspendedResult);
|
|
73
69
|
}
|
|
74
70
|
|
|
75
|
-
export {
|
|
71
|
+
export { AgentBlockedResult, AgentRunBlockedError, AgentRunCancelledError, AgentStreamClosedError, AgentStructuredOutputError, type AgentStructuredOutputFormat, type AgentStructuredOutputPhase, AgentSuspendedResult, AgentToolSuspensionError, MaxTurnsError };
|
package/dist/agent/index.js
CHANGED
|
@@ -1,23 +1,41 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
Agent,
|
|
3
|
+
createVectorContext,
|
|
4
|
+
isVectorContext
|
|
5
|
+
} from "../chunk-VX3HS6PE.js";
|
|
6
|
+
import "../chunk-OJBFDBLG.js";
|
|
7
|
+
import "../chunk-J6LVLV6P.js";
|
|
8
|
+
import "../chunk-5C6B6ZRH.js";
|
|
9
|
+
import "../chunk-6BBOCFHV.js";
|
|
6
10
|
import "../chunk-YK4WAAS4.js";
|
|
7
|
-
import "../chunk-
|
|
8
|
-
import "../chunk-
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
import "../chunk-
|
|
18
|
-
import "../chunk-
|
|
19
|
-
import "../chunk-
|
|
11
|
+
import "../chunk-SJMSS5SI.js";
|
|
12
|
+
import "../chunk-EMZKPRE6.js";
|
|
13
|
+
import {
|
|
14
|
+
AgentRunBlockedError,
|
|
15
|
+
AgentRunCancelledError,
|
|
16
|
+
AgentStreamClosedError,
|
|
17
|
+
AgentStructuredOutputError,
|
|
18
|
+
AgentToolSuspensionError,
|
|
19
|
+
MaxTurnsError
|
|
20
|
+
} from "../chunk-X4LK4ODN.js";
|
|
21
|
+
import "../chunk-ZA564323.js";
|
|
22
|
+
import "../chunk-3RM57ZT2.js";
|
|
23
|
+
import "../chunk-D4PACGPA.js";
|
|
24
|
+
import "../chunk-7PHMK7W4.js";
|
|
25
|
+
import "../chunk-7JLAIN6E.js";
|
|
26
|
+
import "../chunk-QGX73TSQ.js";
|
|
27
|
+
import "../chunk-3XQGVDU5.js";
|
|
28
|
+
import "../chunk-3RWESPUG.js";
|
|
29
|
+
import "../chunk-AZB6N7P4.js";
|
|
20
30
|
export {
|
|
21
|
-
|
|
31
|
+
Agent,
|
|
32
|
+
AgentRunBlockedError,
|
|
33
|
+
AgentRunCancelledError,
|
|
34
|
+
AgentStreamClosedError,
|
|
35
|
+
AgentStructuredOutputError,
|
|
36
|
+
AgentToolSuspensionError,
|
|
37
|
+
MaxTurnsError,
|
|
38
|
+
createVectorContext,
|
|
39
|
+
isVectorContext
|
|
22
40
|
};
|
|
23
41
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { p as JsonValue, J as JsonObject, $ as ToolQuestionAnswer } from '../../types-DgvozfPc.js';
|
|
3
|
+
import '../../model-call-options-CZkSw_xN.js';
|
|
4
|
+
|
|
5
|
+
type AgentQuestionChoice = Readonly<{
|
|
6
|
+
label: string;
|
|
7
|
+
value: string;
|
|
8
|
+
}>;
|
|
9
|
+
type AgentQuestionPrompt = Readonly<{
|
|
10
|
+
id: string;
|
|
11
|
+
text: string;
|
|
12
|
+
choices?: readonly AgentQuestionChoice[];
|
|
13
|
+
allowCustom?: boolean;
|
|
14
|
+
}>;
|
|
15
|
+
type AgentQuestionAnswer = ToolQuestionAnswer;
|
|
16
|
+
type AgentInteractionRequestBase = Readonly<{
|
|
17
|
+
id: string;
|
|
18
|
+
toolName: string;
|
|
19
|
+
toolCallId: string;
|
|
20
|
+
callId?: string;
|
|
21
|
+
internalCallId: string;
|
|
22
|
+
}>;
|
|
23
|
+
type AgentToolApprovalRequest = AgentInteractionRequestBase & Readonly<{
|
|
24
|
+
type: "tool-approval";
|
|
25
|
+
input: JsonValue;
|
|
26
|
+
reason?: string;
|
|
27
|
+
}>;
|
|
28
|
+
type AgentToolQuestionRequest = AgentInteractionRequestBase & Readonly<{
|
|
29
|
+
type: "tool-question";
|
|
30
|
+
questions: readonly AgentQuestionPrompt[];
|
|
31
|
+
}>;
|
|
32
|
+
type AgentInteractionRequest = AgentToolApprovalRequest | AgentToolQuestionRequest;
|
|
33
|
+
type AgentInteractionResponse = Readonly<{
|
|
34
|
+
type: "tool-approval";
|
|
35
|
+
approved: boolean;
|
|
36
|
+
reason?: string;
|
|
37
|
+
}> | Readonly<{
|
|
38
|
+
type: "tool-question";
|
|
39
|
+
answers: readonly AgentQuestionAnswer[];
|
|
40
|
+
}>;
|
|
41
|
+
type AgentContinuation = Readonly<{
|
|
42
|
+
version: 1;
|
|
43
|
+
agentId: string;
|
|
44
|
+
sourceRunId: string;
|
|
45
|
+
interaction: AgentInteractionRequest;
|
|
46
|
+
state: JsonObject;
|
|
47
|
+
}>;
|
|
48
|
+
declare const agentInteractionRequestSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
49
|
+
input: z.ZodCustom<JsonValue, JsonValue>;
|
|
50
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
51
|
+
id: z.ZodString;
|
|
52
|
+
toolName: z.ZodString;
|
|
53
|
+
toolCallId: z.ZodString;
|
|
54
|
+
callId: z.ZodOptional<z.ZodString>;
|
|
55
|
+
internalCallId: z.ZodString;
|
|
56
|
+
type: z.ZodLiteral<"tool-approval">;
|
|
57
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
58
|
+
questions: z.ZodArray<z.ZodObject<{
|
|
59
|
+
id: z.ZodString;
|
|
60
|
+
text: z.ZodString;
|
|
61
|
+
choices: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
62
|
+
label: z.ZodString;
|
|
63
|
+
value: z.ZodString;
|
|
64
|
+
}, z.core.$strict>>>;
|
|
65
|
+
allowCustom: z.ZodOptional<z.ZodBoolean>;
|
|
66
|
+
}, z.core.$strict>>;
|
|
67
|
+
id: z.ZodString;
|
|
68
|
+
toolName: z.ZodString;
|
|
69
|
+
toolCallId: z.ZodString;
|
|
70
|
+
callId: z.ZodOptional<z.ZodString>;
|
|
71
|
+
internalCallId: z.ZodString;
|
|
72
|
+
type: z.ZodLiteral<"tool-question">;
|
|
73
|
+
}, z.core.$strict>], "type">;
|
|
74
|
+
declare const agentInteractionResponseSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
75
|
+
type: z.ZodLiteral<"tool-approval">;
|
|
76
|
+
approved: z.ZodBoolean;
|
|
77
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
78
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
79
|
+
type: z.ZodLiteral<"tool-question">;
|
|
80
|
+
answers: z.ZodArray<z.ZodObject<{
|
|
81
|
+
questionId: z.ZodString;
|
|
82
|
+
value: z.ZodString;
|
|
83
|
+
}, z.core.$strict>>;
|
|
84
|
+
}, z.core.$strict>], "type">;
|
|
85
|
+
declare const agentContinuationSchema: z.ZodObject<{
|
|
86
|
+
version: z.ZodLiteral<1>;
|
|
87
|
+
agentId: z.ZodString;
|
|
88
|
+
sourceRunId: z.ZodString;
|
|
89
|
+
interaction: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
90
|
+
input: z.ZodCustom<JsonValue, JsonValue>;
|
|
91
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
92
|
+
id: z.ZodString;
|
|
93
|
+
toolName: z.ZodString;
|
|
94
|
+
toolCallId: z.ZodString;
|
|
95
|
+
callId: z.ZodOptional<z.ZodString>;
|
|
96
|
+
internalCallId: z.ZodString;
|
|
97
|
+
type: z.ZodLiteral<"tool-approval">;
|
|
98
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
99
|
+
questions: z.ZodArray<z.ZodObject<{
|
|
100
|
+
id: z.ZodString;
|
|
101
|
+
text: z.ZodString;
|
|
102
|
+
choices: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
103
|
+
label: z.ZodString;
|
|
104
|
+
value: z.ZodString;
|
|
105
|
+
}, z.core.$strict>>>;
|
|
106
|
+
allowCustom: z.ZodOptional<z.ZodBoolean>;
|
|
107
|
+
}, z.core.$strict>>;
|
|
108
|
+
id: z.ZodString;
|
|
109
|
+
toolName: z.ZodString;
|
|
110
|
+
toolCallId: z.ZodString;
|
|
111
|
+
callId: z.ZodOptional<z.ZodString>;
|
|
112
|
+
internalCallId: z.ZodString;
|
|
113
|
+
type: z.ZodLiteral<"tool-question">;
|
|
114
|
+
}, z.core.$strict>], "type">;
|
|
115
|
+
state: z.ZodCustom<JsonObject, JsonObject>;
|
|
116
|
+
}, z.core.$strict>;
|
|
117
|
+
declare function parseAgentInteractionRequest(value: unknown): AgentInteractionRequest;
|
|
118
|
+
declare function parseAgentInteractionResponse(value: unknown): AgentInteractionResponse;
|
|
119
|
+
declare function parseAgentContinuation(value: unknown): AgentContinuation;
|
|
120
|
+
declare function assertAgentInteractionResponse(request: AgentInteractionRequest, response: AgentInteractionResponse): void;
|
|
121
|
+
|
|
122
|
+
export { type AgentContinuation, type AgentInteractionRequest, type AgentInteractionResponse, type AgentQuestionAnswer, type AgentQuestionChoice, type AgentQuestionPrompt, type AgentToolApprovalRequest, type AgentToolQuestionRequest, agentContinuationSchema, agentInteractionRequestSchema, agentInteractionResponseSchema, assertAgentInteractionResponse, parseAgentContinuation, parseAgentInteractionRequest, parseAgentInteractionResponse };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
agentContinuationSchema,
|
|
3
|
+
agentInteractionRequestSchema,
|
|
4
|
+
agentInteractionResponseSchema,
|
|
5
|
+
assertAgentInteractionResponse,
|
|
6
|
+
parseAgentContinuation,
|
|
7
|
+
parseAgentInteractionRequest,
|
|
8
|
+
parseAgentInteractionResponse
|
|
9
|
+
} from "../../chunk-OJBFDBLG.js";
|
|
10
|
+
import "../../chunk-3XQGVDU5.js";
|
|
11
|
+
export {
|
|
12
|
+
agentContinuationSchema,
|
|
13
|
+
agentInteractionRequestSchema,
|
|
14
|
+
agentInteractionResponseSchema,
|
|
15
|
+
assertAgentInteractionResponse,
|
|
16
|
+
parseAgentContinuation,
|
|
17
|
+
parseAgentInteractionRequest,
|
|
18
|
+
parseAgentInteractionResponse
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { b as RetrySetting } from './retry-CjvSlKGW.js';
|
|
2
|
+
import { D as Document, c as CompletionModel, P as ProviderTool, J as JsonObject, v as ToolChoice } from './types-DgvozfPc.js';
|
|
3
|
+
import { Z as ZodSchema } from './zod-schema-C7F4clpm.js';
|
|
4
|
+
import { d as GuardrailPolicyInput, c as GuardrailPolicy } from './types-DhkodEft.js';
|
|
5
|
+
import { a as McpServer } from './types-DjqRHeAi.js';
|
|
6
|
+
import { g as AgentLifecycle, E as AgentObservabilityOptions, l as AgentRunOptions, k as AgentResult, r as AgentStream, s as AgentStreamEvent } from './types-Sue2hb_L.js';
|
|
7
|
+
import { A as AgentMiddleware } from './middleware-kcF8AusP.js';
|
|
8
|
+
import { A as AnyTool, T as Tool, c as ToolCallContext, N as NormalizedToolOutput } from './tool-BpqpoRSE.js';
|
|
9
|
+
import { D as MemoryStore, y as MemorySavePolicy, m as MemoryCompactor, d as MemoryCompactionConflictRetryOptions, x as MemoryOptions } from './types-DKOXVTcq.js';
|
|
10
|
+
import { a as SkillSet } from './types-DC1U1XwW.js';
|
|
11
|
+
import { T as ToolIndex } from './dynamic-tools-aIZlg5x1.js';
|
|
12
|
+
import { E as EmbeddingModel, c as SparseEmbeddingModel } from './types-Cr4uiYo5.js';
|
|
13
|
+
import { V as VectorFilter, a as VectorSearchResult, d as VectorStore, H as HybridVectorStore, e as VectorFusion } from './types-CXNE592e.js';
|
|
14
|
+
|
|
15
|
+
type VectorContextBaseOptions<T = unknown> = {
|
|
16
|
+
topK: number;
|
|
17
|
+
minScore?: number | undefined;
|
|
18
|
+
filter?: VectorFilter | undefined;
|
|
19
|
+
retries?: RetrySetting | undefined;
|
|
20
|
+
format?(result: VectorSearchResult<T>): Document;
|
|
21
|
+
};
|
|
22
|
+
type CreateVectorContextOptions<T = unknown> = VectorContextBaseOptions<T> & {
|
|
23
|
+
store: VectorStore<T>;
|
|
24
|
+
model: EmbeddingModel;
|
|
25
|
+
models?: never;
|
|
26
|
+
};
|
|
27
|
+
type CreateHybridVectorContextOptions<T = unknown> = VectorContextBaseOptions<T> & {
|
|
28
|
+
store: HybridVectorStore<T>;
|
|
29
|
+
model?: never;
|
|
30
|
+
models: {
|
|
31
|
+
dense: EmbeddingModel;
|
|
32
|
+
sparse: SparseEmbeddingModel;
|
|
33
|
+
};
|
|
34
|
+
fusion?: VectorFusion | undefined;
|
|
35
|
+
};
|
|
36
|
+
type VectorContext<T = unknown> = (CreateVectorContextOptions<T> | CreateHybridVectorContextOptions<T>) & {
|
|
37
|
+
readonly kind: "vector-context";
|
|
38
|
+
};
|
|
39
|
+
declare function createVectorContext<T>(options: CreateVectorContextOptions<T>): VectorContext<T>;
|
|
40
|
+
declare function createVectorContext<T>(options: CreateHybridVectorContextOptions<T>): VectorContext<T>;
|
|
41
|
+
declare function isVectorContext(value: unknown): value is VectorContext;
|
|
42
|
+
|
|
43
|
+
type AgentToolInput = AnyTool | ProviderTool | ToolIndex;
|
|
44
|
+
type AgentContextInput<T = unknown> = Document | VectorContext<T>;
|
|
45
|
+
type RawResponseOf$1<Model> = Model extends CompletionModel<infer RawResponse> ? RawResponse : unknown;
|
|
46
|
+
type AgentOptions<Output = string, M extends CompletionModel = CompletionModel, ContextDocument = unknown> = {
|
|
47
|
+
id: string;
|
|
48
|
+
name?: string | undefined;
|
|
49
|
+
description?: string | undefined;
|
|
50
|
+
model: M;
|
|
51
|
+
instructions?: string | undefined;
|
|
52
|
+
context?: readonly AgentContextInput<ContextDocument>[] | undefined;
|
|
53
|
+
tools?: readonly AgentToolInput[] | undefined;
|
|
54
|
+
mcpServers?: readonly McpServer[] | undefined;
|
|
55
|
+
skills?: SkillSet | undefined;
|
|
56
|
+
temperature?: number | undefined;
|
|
57
|
+
maxTokens?: number | undefined;
|
|
58
|
+
providerOptions?: JsonObject | undefined;
|
|
59
|
+
retries?: RetrySetting | undefined;
|
|
60
|
+
toolChoice?: ToolChoice | undefined;
|
|
61
|
+
maxTurns?: number | undefined;
|
|
62
|
+
lifecycle?: AgentLifecycle<Output, RawResponseOf$1<M>> | undefined;
|
|
63
|
+
outputSchema?: ZodSchema<Output> | undefined;
|
|
64
|
+
observability?: AgentObservabilityOptions | undefined;
|
|
65
|
+
guardrails?: GuardrailPolicyInput | undefined;
|
|
66
|
+
middlewares?: readonly AgentMiddleware[] | undefined;
|
|
67
|
+
memory?: AgentMemoryOptions | undefined;
|
|
68
|
+
};
|
|
69
|
+
type AgentMemoryOptions = MemoryOptions & {
|
|
70
|
+
store: MemoryStore;
|
|
71
|
+
};
|
|
72
|
+
type AgentMemory = {
|
|
73
|
+
store: MemoryStore;
|
|
74
|
+
savePolicy: MemorySavePolicy;
|
|
75
|
+
compaction?: {
|
|
76
|
+
trigger: {
|
|
77
|
+
afterMessages: number;
|
|
78
|
+
};
|
|
79
|
+
retention: {
|
|
80
|
+
recentUserTurns: number;
|
|
81
|
+
};
|
|
82
|
+
compactor: MemoryCompactor;
|
|
83
|
+
conflictRetries: false | MemoryCompactionConflictRetryOptions;
|
|
84
|
+
} | undefined;
|
|
85
|
+
};
|
|
86
|
+
type ResolvedAgentOptions<Output = string, M extends CompletionModel = CompletionModel, ContextDocument = unknown> = {
|
|
87
|
+
id: string;
|
|
88
|
+
name?: string | undefined;
|
|
89
|
+
description?: string | undefined;
|
|
90
|
+
model: M;
|
|
91
|
+
instructions?: string | undefined;
|
|
92
|
+
context?: readonly AgentContextInput<ContextDocument>[] | undefined;
|
|
93
|
+
temperature?: number | undefined;
|
|
94
|
+
maxTokens?: number | undefined;
|
|
95
|
+
providerOptions?: JsonObject | undefined;
|
|
96
|
+
retries?: RetrySetting | undefined;
|
|
97
|
+
tools?: readonly AnyTool[] | undefined;
|
|
98
|
+
mcpServers?: readonly McpServer[] | undefined;
|
|
99
|
+
providerTools?: readonly ProviderTool[] | undefined;
|
|
100
|
+
toolIndexes?: readonly ToolIndex[] | undefined;
|
|
101
|
+
toolChoice?: ToolChoice | undefined;
|
|
102
|
+
defaultMaxTurns?: number | undefined;
|
|
103
|
+
lifecycle?: AgentLifecycle<Output, RawResponseOf$1<M>> | undefined;
|
|
104
|
+
outputSchema?: ZodSchema<Output> | undefined;
|
|
105
|
+
observability?: AgentObservabilityOptions | undefined;
|
|
106
|
+
guardrails?: readonly GuardrailPolicy[] | undefined;
|
|
107
|
+
middlewares?: readonly AgentMiddleware[] | undefined;
|
|
108
|
+
memory?: AgentMemory | undefined;
|
|
109
|
+
};
|
|
110
|
+
type AgentToolOptions = {
|
|
111
|
+
name: string;
|
|
112
|
+
suspension: "reject";
|
|
113
|
+
description?: string | undefined;
|
|
114
|
+
maxTurns?: number | undefined;
|
|
115
|
+
stream?: boolean | undefined;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
type RawResponseOf<Model> = Model extends CompletionModel<infer RawResponse> ? RawResponse : unknown;
|
|
119
|
+
declare class Agent<Output = string, M extends CompletionModel = CompletionModel, ContextDocument = unknown> {
|
|
120
|
+
readonly id: string;
|
|
121
|
+
readonly name: string | undefined;
|
|
122
|
+
readonly description: string | undefined;
|
|
123
|
+
readonly model: M;
|
|
124
|
+
readonly instructions: string | undefined;
|
|
125
|
+
readonly context: readonly AgentContextInput<ContextDocument>[];
|
|
126
|
+
readonly temperature: number | undefined;
|
|
127
|
+
readonly maxTokens: number | undefined;
|
|
128
|
+
readonly providerOptions: JsonObject | undefined;
|
|
129
|
+
readonly retries: RetrySetting | undefined;
|
|
130
|
+
readonly mcpServers: readonly McpServer[];
|
|
131
|
+
readonly tools: readonly AnyTool[];
|
|
132
|
+
readonly toolChoice: ToolChoice | undefined;
|
|
133
|
+
readonly defaultMaxTurns: number | undefined;
|
|
134
|
+
readonly lifecycle: AgentLifecycle<Output, RawResponseOf<M>> | undefined;
|
|
135
|
+
readonly outputSchema: ZodSchema<Output> | undefined;
|
|
136
|
+
readonly observability: AgentObservabilityOptions | undefined;
|
|
137
|
+
readonly guardrails: readonly GuardrailPolicy[];
|
|
138
|
+
readonly middlewares: readonly AgentMiddleware[];
|
|
139
|
+
readonly memory: AgentMemory | undefined;
|
|
140
|
+
constructor(options: AgentOptions<Output, M, ContextDocument>);
|
|
141
|
+
generate(options: AgentRunOptions<Output, RawResponseOf<M>>): Promise<AgentResult<Output>>;
|
|
142
|
+
stream(options: AgentRunOptions<Output, RawResponseOf<M>>): AgentStream<AgentStreamEvent<Output, RawResponseOf<M>>>;
|
|
143
|
+
asTool(options: AgentToolOptions): Tool<{
|
|
144
|
+
prompt: string;
|
|
145
|
+
}, Output>;
|
|
146
|
+
getTool(toolName: string): AnyTool | undefined;
|
|
147
|
+
callTool(toolName: string, args: string, context?: ToolCallContext): Promise<NormalizedToolOutput>;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export { Agent as A, type CreateHybridVectorContextOptions as C, type ResolvedAgentOptions as R, type VectorContext as V, type AgentContextInput as a, type AgentMemory as b, type AgentMemoryOptions as c, type AgentOptions as d, type AgentToolInput as e, type AgentToolOptions as f, type CreateVectorContextOptions as g, type VectorContextBaseOptions as h, createVectorContext as i, isVectorContext as j };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// src/internal/concurrency.ts
|
|
2
|
+
async function mapWithConcurrency(inputs, concurrency, mapper) {
|
|
3
|
+
if (!Number.isSafeInteger(concurrency) || concurrency <= 0) {
|
|
4
|
+
throw new RangeError("concurrency must be a positive safe integer.");
|
|
5
|
+
}
|
|
6
|
+
const limit = concurrency;
|
|
7
|
+
const results = new Array(inputs.length);
|
|
8
|
+
let nextIndex = 0;
|
|
9
|
+
let firstFailure;
|
|
10
|
+
async function worker() {
|
|
11
|
+
while (firstFailure === void 0 && nextIndex < inputs.length) {
|
|
12
|
+
const index = nextIndex;
|
|
13
|
+
nextIndex += 1;
|
|
14
|
+
try {
|
|
15
|
+
results[index] = await mapper(inputs[index]);
|
|
16
|
+
} catch (error) {
|
|
17
|
+
firstFailure ??= { error };
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
await Promise.all(Array.from({ length: Math.min(limit, inputs.length) }, () => worker()));
|
|
22
|
+
if (firstFailure !== void 0) {
|
|
23
|
+
throw firstFailure.error;
|
|
24
|
+
}
|
|
25
|
+
return results;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export {
|
|
29
|
+
mapWithConcurrency
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=chunk-3RM57ZT2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/internal/concurrency.ts"],"sourcesContent":["export async function mapWithConcurrency<Input, Output>(\n inputs: readonly Input[],\n concurrency: number,\n mapper: (input: Input) => Promise<Output>,\n): Promise<Output[]> {\n if (!Number.isSafeInteger(concurrency) || concurrency <= 0) {\n throw new RangeError(\"concurrency must be a positive safe integer.\");\n }\n const limit = concurrency;\n const results = new Array<Output>(inputs.length);\n let nextIndex = 0;\n let firstFailure: { error: unknown } | undefined;\n\n async function worker(): Promise<void> {\n while (firstFailure === undefined && nextIndex < inputs.length) {\n const index = nextIndex;\n nextIndex += 1;\n try {\n results[index] = await mapper(inputs[index] as Input);\n } catch (error) {\n firstFailure ??= { error };\n }\n }\n }\n\n await Promise.all(Array.from({ length: Math.min(limit, inputs.length) }, () => worker()));\n if (firstFailure !== undefined) {\n throw firstFailure.error;\n }\n return results;\n}\n"],"mappings":";AAAA,eAAsB,mBACpB,QACA,aACA,QACmB;AACnB,MAAI,CAAC,OAAO,cAAc,WAAW,KAAK,eAAe,GAAG;AAC1D,UAAM,IAAI,WAAW,8CAA8C;AAAA,EACrE;AACA,QAAM,QAAQ;AACd,QAAM,UAAU,IAAI,MAAc,OAAO,MAAM;AAC/C,MAAI,YAAY;AAChB,MAAI;AAEJ,iBAAe,SAAwB;AACrC,WAAO,iBAAiB,UAAa,YAAY,OAAO,QAAQ;AAC9D,YAAM,QAAQ;AACd,mBAAa;AACb,UAAI;AACF,gBAAQ,KAAK,IAAI,MAAM,OAAO,OAAO,KAAK,CAAU;AAAA,MACtD,SAAS,OAAO;AACd,yBAAiB,EAAE,MAAM;AAAA,MAC3B;AAAA,IACF;AAAA,EACF;AAEA,QAAM,QAAQ,IAAI,MAAM,KAAK,EAAE,QAAQ,KAAK,IAAI,OAAO,OAAO,MAAM,EAAE,GAAG,MAAM,OAAO,CAAC,CAAC;AACxF,MAAI,iBAAiB,QAAW;AAC9B,UAAM,aAAa;AAAA,EACrB;AACA,SAAO;AACT;","names":[]}
|