@anvia/core 1.0.0-rc.1 → 1.0.0-rc.3
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 +344 -85
- package/dist/agent/index.d.ts +33 -18
- package/dist/agent/index.js +42 -17
- package/dist/agent-CXScUOpX.d.ts +150 -0
- package/dist/{chunk-R2LJSQUW.js → chunk-3CMWKK32.js} +260 -104
- package/dist/chunk-3CMWKK32.js.map +1 -0
- package/dist/chunk-3RM57ZT2.js +31 -0
- package/dist/chunk-3RM57ZT2.js.map +1 -0
- package/dist/chunk-5MK3BISB.js +704 -0
- package/dist/chunk-5MK3BISB.js.map +1 -0
- package/dist/chunk-AI5JMUW7.js +45 -0
- package/dist/chunk-AI5JMUW7.js.map +1 -0
- package/dist/{chunk-FNQB2JEH.js → chunk-AZB6N7P4.js} +94 -65
- package/dist/chunk-AZB6N7P4.js.map +1 -0
- package/dist/chunk-BEYBU7VJ.js +53 -0
- package/dist/chunk-BEYBU7VJ.js.map +1 -0
- package/dist/chunk-BY4OMNIU.js +4699 -0
- package/dist/chunk-BY4OMNIU.js.map +1 -0
- package/dist/chunk-D2ECOWN5.js +515 -0
- package/dist/chunk-D2ECOWN5.js.map +1 -0
- package/dist/{chunk-A3UBYTJT.js → chunk-FN7HLLAZ.js} +60 -6
- package/dist/chunk-FN7HLLAZ.js.map +1 -0
- package/dist/chunk-GKDERULJ.js +50 -0
- package/dist/chunk-GKDERULJ.js.map +1 -0
- package/dist/chunk-GQL5KRAH.js +331 -0
- package/dist/chunk-GQL5KRAH.js.map +1 -0
- package/dist/{chunk-5XKDW36Z.js → chunk-KFR4CDGK.js} +70 -75
- package/dist/chunk-KFR4CDGK.js.map +1 -0
- package/dist/chunk-KV6QCRQ4.js +171 -0
- package/dist/chunk-KV6QCRQ4.js.map +1 -0
- package/dist/{chunk-DMPUP4R3.js → chunk-LXMAFD23.js} +5 -5
- package/dist/{chunk-I6G7BC42.js → chunk-MGNTXGTX.js} +2 -6
- package/dist/chunk-MGNTXGTX.js.map +1 -0
- package/dist/chunk-PK5LKOFL.js +239 -0
- package/dist/chunk-PK5LKOFL.js.map +1 -0
- package/dist/chunk-QOUPWOGW.js +29 -0
- package/dist/chunk-QOUPWOGW.js.map +1 -0
- package/dist/chunk-TRQ3XRFD.js +54 -0
- package/dist/chunk-TRQ3XRFD.js.map +1 -0
- package/dist/chunk-VKYZZXP5.js +323 -0
- package/dist/chunk-VKYZZXP5.js.map +1 -0
- package/dist/chunk-ZCPOIDAQ.js +127 -0
- package/dist/chunk-ZCPOIDAQ.js.map +1 -0
- package/dist/client-DvUatElp.d.ts +84 -0
- package/dist/completion/index.d.ts +5 -4
- package/dist/completion/index.js +25 -28
- package/dist/documents/index.d.ts +34 -0
- package/dist/documents/index.js +315 -0
- package/dist/documents/index.js.map +1 -0
- package/dist/{dynamic-tools-i9woysFa.d.ts → dynamic-tools-AEBOTgu1.d.ts} +21 -9
- package/dist/embeddings/index.d.ts +11 -9
- package/dist/embeddings/index.js +3 -3
- package/dist/evals/index.d.ts +53 -25
- package/dist/evals/index.js +153 -103
- package/dist/evals/index.js.map +1 -1
- package/dist/extractor/index.d.ts +23 -26
- package/dist/extractor/index.js +7 -8
- package/dist/guardrails/index.d.ts +7 -129
- package/dist/guardrails/index.js +1 -1
- package/dist/image-generation/index.d.ts +18 -16
- package/dist/image-generation/index.js +2 -2
- package/dist/index.d.ts +26 -23
- package/dist/index.js +71 -48
- package/dist/interactions-csssHYcN.d.ts +174 -0
- package/dist/internal/agent.d.ts +36 -29
- package/dist/internal/agent.js +48 -15
- package/dist/internal/agent.js.map +1 -1
- package/dist/mcp/index.d.ts +19 -13
- package/dist/mcp/index.js +14 -348
- package/dist/mcp/index.js.map +1 -1
- package/dist/memory/index.d.ts +20 -6
- package/dist/memory/index.js +10 -10
- package/dist/message-schema-B2M7AYzR.d.ts +52 -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 +21 -6
- package/dist/observability/index.js +8 -5
- package/dist/observability/index.js.map +1 -1
- package/dist/pipeline/index.d.ts +106 -57
- package/dist/pipeline/index.js +419 -236
- package/dist/pipeline/index.js.map +1 -1
- package/dist/{retry-D3Ruy-ba.d.ts → retry-CjvSlKGW.d.ts} +2 -1
- package/dist/skills/index.d.ts +5 -4
- package/dist/skills/index.js +8 -7
- package/dist/speech-generation/index.d.ts +37 -0
- package/dist/speech-generation/index.js +8 -0
- package/dist/text-C_6eKrbC.d.ts +32 -0
- package/dist/{think-tool-DZqZj2LV.d.ts → think-tool-D8frXxwV.d.ts} +16 -2
- package/dist/tool/index.d.ts +9 -7
- package/dist/tool/index.js +12 -10
- package/dist/{tool-C_8GudXn.d.ts → tool-r62gf3QY.d.ts} +17 -8
- package/dist/transcription/index.d.ts +23 -14
- package/dist/transcription/index.js +2 -2
- package/dist/types-C3gv9EX6.d.ts +130 -0
- package/dist/{index-DxB74ybJ.d.ts → types-CElwurHZ.d.ts} +139 -88
- package/dist/types-CIPaIbZo.d.ts +105 -0
- package/dist/types-Cr4uiYo5.d.ts +99 -0
- package/dist/types-D9rKQ_as.d.ts +341 -0
- package/dist/types-DbolvLtZ.d.ts +155 -0
- package/dist/{types-DhQfwiZn.d.ts → types-RT3cuyRk.d.ts} +1 -1
- package/dist/vector-store/index.d.ts +33 -34
- package/dist/vector-store/index.js +7 -6
- package/package.json +10 -14
- package/dist/agent-DGYY_onS.d.ts +0 -145
- package/dist/audio-generation/index.d.ts +0 -31
- package/dist/audio-generation/index.js +0 -8
- package/dist/chunk-5XKDW36Z.js.map +0 -1
- package/dist/chunk-6WGGTJE6.js +0 -139
- package/dist/chunk-6WGGTJE6.js.map +0 -1
- package/dist/chunk-A3UBYTJT.js.map +0 -1
- package/dist/chunk-ADH7NNCS.js +0 -512
- package/dist/chunk-ADH7NNCS.js.map +0 -1
- package/dist/chunk-DZ3CKYTH.js +0 -267
- package/dist/chunk-DZ3CKYTH.js.map +0 -1
- package/dist/chunk-FNQB2JEH.js.map +0 -1
- package/dist/chunk-I6G7BC42.js.map +0 -1
- package/dist/chunk-IL3ZSNJI.js +0 -3748
- package/dist/chunk-IL3ZSNJI.js.map +0 -1
- package/dist/chunk-J6GNQART.js +0 -122
- package/dist/chunk-J6GNQART.js.map +0 -1
- package/dist/chunk-M3IOWB4Y.js +0 -280
- package/dist/chunk-M3IOWB4Y.js.map +0 -1
- package/dist/chunk-QY5GZ7HR.js +0 -39
- package/dist/chunk-QY5GZ7HR.js.map +0 -1
- package/dist/chunk-R2LJSQUW.js.map +0 -1
- package/dist/chunk-RFDVKCIE.js +0 -12
- package/dist/chunk-RFDVKCIE.js.map +0 -1
- package/dist/chunk-RMUBRRSK.js +0 -34
- package/dist/chunk-RMUBRRSK.js.map +0 -1
- package/dist/chunk-RXKHOYEH.js +0 -466
- package/dist/chunk-RXKHOYEH.js.map +0 -1
- package/dist/chunk-XDRSPSR7.js +0 -38
- package/dist/chunk-XDRSPSR7.js.map +0 -1
- package/dist/chunk-XWUC7CIT.js +0 -1
- package/dist/chunk-XWUC7CIT.js.map +0 -1
- package/dist/errors-CYKUcU89.d.ts +0 -17
- package/dist/json-Zo7K3xmt.d.ts +0 -40
- package/dist/loaders/index.d.ts +0 -86
- package/dist/loaders/index.js +0 -299
- package/dist/loaders/index.js.map +0 -1
- package/dist/middleware-KynLg_RW.d.ts +0 -56
- package/dist/types-B3A4YxaA.d.ts +0 -354
- package/dist/types-BBEGKB9m.d.ts +0 -119
- package/dist/types-DT3nEemY.d.ts +0 -79
- package/dist/types-DulRCYdB.d.ts +0 -70
- package/dist/types-p55Jc-sr.d.ts +0 -47
- 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/{chunk-DMPUP4R3.js.map → chunk-LXMAFD23.js.map} +0 -0
- /package/dist/{audio-generation → speech-generation}/index.js.map +0 -0
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { e as CompletionRequest, f as CompletionResponse, o as JsonValue, x as ToolResultContentPart, J as JsonObject, _ as ToolQuestionAnswer } from './types-D9rKQ_as.js';
|
|
2
|
+
import { M as MaybePromise } from './type-utils-CtHVDRn_.js';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
|
|
5
|
+
type CompletionRequestMiddlewareArgs = {
|
|
6
|
+
turn: number;
|
|
7
|
+
request: CompletionRequest;
|
|
8
|
+
originalRequest: CompletionRequest;
|
|
9
|
+
};
|
|
10
|
+
type CompletionRequestMiddlewareResult = {
|
|
11
|
+
request: CompletionRequest;
|
|
12
|
+
} | undefined;
|
|
13
|
+
type CompletionResponseMiddlewareArgs<RawResponse = unknown> = {
|
|
14
|
+
turn: number;
|
|
15
|
+
request: CompletionRequest;
|
|
16
|
+
response: CompletionResponse<RawResponse>;
|
|
17
|
+
originalResponse: CompletionResponse<RawResponse>;
|
|
18
|
+
};
|
|
19
|
+
type CompletionResponseMiddlewareResult<RawResponse = unknown> = {
|
|
20
|
+
response: CompletionResponse<RawResponse>;
|
|
21
|
+
} | undefined;
|
|
22
|
+
type ToolInputMiddlewareArgs = {
|
|
23
|
+
toolName: string;
|
|
24
|
+
args: string;
|
|
25
|
+
originalArgs: string;
|
|
26
|
+
turn: number;
|
|
27
|
+
toolCallId?: string | undefined;
|
|
28
|
+
internalCallId: string;
|
|
29
|
+
};
|
|
30
|
+
type ToolInputMiddlewareResult = {
|
|
31
|
+
args: JsonValue | string;
|
|
32
|
+
} | undefined;
|
|
33
|
+
type ToolResultMiddlewareArgs = {
|
|
34
|
+
toolName: string;
|
|
35
|
+
args: string;
|
|
36
|
+
result: string;
|
|
37
|
+
originalResult: string;
|
|
38
|
+
structuredResult?: readonly ToolResultContentPart[] | undefined;
|
|
39
|
+
originalStructuredResult?: readonly ToolResultContentPart[] | undefined;
|
|
40
|
+
turn: number;
|
|
41
|
+
toolCallId?: string | undefined;
|
|
42
|
+
internalCallId: string;
|
|
43
|
+
};
|
|
44
|
+
type ToolOutputMiddlewareArgs = ToolResultMiddlewareArgs;
|
|
45
|
+
type ToolOutputMiddlewareResult = string | {
|
|
46
|
+
result?: string | undefined;
|
|
47
|
+
structuredResult?: readonly ToolResultContentPart[] | undefined;
|
|
48
|
+
} | undefined;
|
|
49
|
+
interface AgentMiddleware<RawResponse = unknown> {
|
|
50
|
+
onCompletionRequest?(args: CompletionRequestMiddlewareArgs): MaybePromise<CompletionRequestMiddlewareResult>;
|
|
51
|
+
onCompletionResponse?(args: CompletionResponseMiddlewareArgs<RawResponse>): MaybePromise<CompletionResponseMiddlewareResult<RawResponse>>;
|
|
52
|
+
onToolInput?(args: ToolInputMiddlewareArgs): MaybePromise<ToolInputMiddlewareResult>;
|
|
53
|
+
onToolOutput?(args: ToolOutputMiddlewareArgs): MaybePromise<ToolOutputMiddlewareResult>;
|
|
54
|
+
}
|
|
55
|
+
declare function createMiddleware<RawResponse = unknown>(middleware: AgentMiddleware<RawResponse>): AgentMiddleware<RawResponse>;
|
|
56
|
+
|
|
57
|
+
type AgentQuestionChoice = Readonly<{
|
|
58
|
+
label: string;
|
|
59
|
+
value: string;
|
|
60
|
+
}>;
|
|
61
|
+
type AgentQuestionPrompt = Readonly<{
|
|
62
|
+
id: string;
|
|
63
|
+
text: string;
|
|
64
|
+
choices?: readonly AgentQuestionChoice[];
|
|
65
|
+
allowCustom?: boolean;
|
|
66
|
+
}>;
|
|
67
|
+
type AgentQuestionAnswer = ToolQuestionAnswer;
|
|
68
|
+
type AgentInteractionRequestBase = Readonly<{
|
|
69
|
+
id: string;
|
|
70
|
+
toolName: string;
|
|
71
|
+
toolCallId: string;
|
|
72
|
+
callId?: string;
|
|
73
|
+
internalCallId: string;
|
|
74
|
+
}>;
|
|
75
|
+
type AgentToolApprovalRequest = AgentInteractionRequestBase & Readonly<{
|
|
76
|
+
type: "tool-approval";
|
|
77
|
+
input: JsonValue;
|
|
78
|
+
reason?: string;
|
|
79
|
+
}>;
|
|
80
|
+
type AgentToolQuestionRequest = AgentInteractionRequestBase & Readonly<{
|
|
81
|
+
type: "tool-question";
|
|
82
|
+
questions: readonly AgentQuestionPrompt[];
|
|
83
|
+
}>;
|
|
84
|
+
type AgentInteractionRequest = AgentToolApprovalRequest | AgentToolQuestionRequest;
|
|
85
|
+
type AgentInteractionResponse = Readonly<{
|
|
86
|
+
type: "tool-approval";
|
|
87
|
+
approved: boolean;
|
|
88
|
+
reason?: string;
|
|
89
|
+
}> | Readonly<{
|
|
90
|
+
type: "tool-question";
|
|
91
|
+
answers: readonly AgentQuestionAnswer[];
|
|
92
|
+
}>;
|
|
93
|
+
type AgentContinuation = Readonly<{
|
|
94
|
+
version: 1;
|
|
95
|
+
agentId: string;
|
|
96
|
+
sourceRunId: string;
|
|
97
|
+
interaction: AgentInteractionRequest;
|
|
98
|
+
state: JsonObject;
|
|
99
|
+
}>;
|
|
100
|
+
declare const agentInteractionRequestSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
101
|
+
input: z.ZodCustom<JsonValue, JsonValue>;
|
|
102
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
103
|
+
id: z.ZodString;
|
|
104
|
+
toolName: z.ZodString;
|
|
105
|
+
toolCallId: z.ZodString;
|
|
106
|
+
callId: z.ZodOptional<z.ZodString>;
|
|
107
|
+
internalCallId: z.ZodString;
|
|
108
|
+
type: z.ZodLiteral<"tool-approval">;
|
|
109
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
110
|
+
questions: z.ZodArray<z.ZodObject<{
|
|
111
|
+
id: z.ZodString;
|
|
112
|
+
text: z.ZodString;
|
|
113
|
+
choices: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
114
|
+
label: z.ZodString;
|
|
115
|
+
value: z.ZodString;
|
|
116
|
+
}, z.core.$strict>>>;
|
|
117
|
+
allowCustom: z.ZodOptional<z.ZodBoolean>;
|
|
118
|
+
}, z.core.$strict>>;
|
|
119
|
+
id: z.ZodString;
|
|
120
|
+
toolName: z.ZodString;
|
|
121
|
+
toolCallId: z.ZodString;
|
|
122
|
+
callId: z.ZodOptional<z.ZodString>;
|
|
123
|
+
internalCallId: z.ZodString;
|
|
124
|
+
type: z.ZodLiteral<"tool-question">;
|
|
125
|
+
}, z.core.$strict>], "type">;
|
|
126
|
+
declare const agentInteractionResponseSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
127
|
+
type: z.ZodLiteral<"tool-approval">;
|
|
128
|
+
approved: z.ZodBoolean;
|
|
129
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
130
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
131
|
+
type: z.ZodLiteral<"tool-question">;
|
|
132
|
+
answers: z.ZodArray<z.ZodObject<{
|
|
133
|
+
questionId: z.ZodString;
|
|
134
|
+
value: z.ZodString;
|
|
135
|
+
}, z.core.$strict>>;
|
|
136
|
+
}, z.core.$strict>], "type">;
|
|
137
|
+
declare const agentContinuationSchema: z.ZodObject<{
|
|
138
|
+
version: z.ZodLiteral<1>;
|
|
139
|
+
agentId: z.ZodString;
|
|
140
|
+
sourceRunId: z.ZodString;
|
|
141
|
+
interaction: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
142
|
+
input: z.ZodCustom<JsonValue, JsonValue>;
|
|
143
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
144
|
+
id: z.ZodString;
|
|
145
|
+
toolName: z.ZodString;
|
|
146
|
+
toolCallId: z.ZodString;
|
|
147
|
+
callId: z.ZodOptional<z.ZodString>;
|
|
148
|
+
internalCallId: z.ZodString;
|
|
149
|
+
type: z.ZodLiteral<"tool-approval">;
|
|
150
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
151
|
+
questions: z.ZodArray<z.ZodObject<{
|
|
152
|
+
id: z.ZodString;
|
|
153
|
+
text: z.ZodString;
|
|
154
|
+
choices: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
155
|
+
label: z.ZodString;
|
|
156
|
+
value: z.ZodString;
|
|
157
|
+
}, z.core.$strict>>>;
|
|
158
|
+
allowCustom: z.ZodOptional<z.ZodBoolean>;
|
|
159
|
+
}, z.core.$strict>>;
|
|
160
|
+
id: z.ZodString;
|
|
161
|
+
toolName: z.ZodString;
|
|
162
|
+
toolCallId: z.ZodString;
|
|
163
|
+
callId: z.ZodOptional<z.ZodString>;
|
|
164
|
+
internalCallId: z.ZodString;
|
|
165
|
+
type: z.ZodLiteral<"tool-question">;
|
|
166
|
+
}, z.core.$strict>], "type">;
|
|
167
|
+
state: z.ZodCustom<JsonObject, JsonObject>;
|
|
168
|
+
}, z.core.$strict>;
|
|
169
|
+
declare function parseAgentInteractionRequest(value: unknown): AgentInteractionRequest;
|
|
170
|
+
declare function parseAgentInteractionResponse(value: unknown): AgentInteractionResponse;
|
|
171
|
+
declare function parseAgentContinuation(value: unknown): AgentContinuation;
|
|
172
|
+
declare function assertAgentInteractionResponse(request: AgentInteractionRequest, response: AgentInteractionResponse): void;
|
|
173
|
+
|
|
174
|
+
export { type AgentContinuation as A, type CompletionRequestMiddlewareArgs as C, type ToolInputMiddlewareArgs as T, type AgentInteractionRequest as a, type AgentInteractionResponse as b, type AgentMiddleware as c, type AgentQuestionAnswer as d, type AgentQuestionChoice as e, type AgentQuestionPrompt as f, type AgentToolApprovalRequest as g, type AgentToolQuestionRequest as h, type CompletionRequestMiddlewareResult as i, type CompletionResponseMiddlewareArgs as j, type CompletionResponseMiddlewareResult as k, type ToolInputMiddlewareResult as l, type ToolOutputMiddlewareArgs as m, type ToolOutputMiddlewareResult as n, type ToolResultMiddlewareArgs as o, agentContinuationSchema as p, agentInteractionRequestSchema as q, agentInteractionResponseSchema as r, createMiddleware as s, parseAgentContinuation as t, parseAgentInteractionRequest as u, parseAgentInteractionResponse as v, assertAgentInteractionResponse as w };
|
package/dist/internal/agent.d.ts
CHANGED
|
@@ -1,24 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
import { P as ProviderTool, M as Message, U as Usage,
|
|
3
|
-
import { T as ToolIndex } from '../dynamic-tools-
|
|
4
|
-
import { A as AnyTool
|
|
5
|
-
import {
|
|
6
|
-
import '../
|
|
7
|
-
import '../type-utils-CtHVDRn_.js';
|
|
8
|
-
import '../types-BBEGKB9m.js';
|
|
9
|
-
import '../middleware-KynLg_RW.js';
|
|
1
|
+
import { R as ResolvedAgentOptions, A as Agent } from '../agent-CXScUOpX.js';
|
|
2
|
+
import { C as CompletionModel, P as ProviderTool, M as Message, U as Usage, f as CompletionResponse, x as ToolResultContentPart } from '../types-D9rKQ_as.js';
|
|
3
|
+
import { T as ToolIndex } from '../dynamic-tools-AEBOTgu1.js';
|
|
4
|
+
import { A as AnyTool } from '../tool-r62gf3QY.js';
|
|
5
|
+
import { e as MemoryCompactionInfo } from '../types-DbolvLtZ.js';
|
|
6
|
+
import '../retry-CjvSlKGW.js';
|
|
10
7
|
import '../zod-schema-C7F4clpm.js';
|
|
11
8
|
import 'zod';
|
|
12
|
-
import '../types-
|
|
13
|
-
import '
|
|
14
|
-
import '
|
|
9
|
+
import '../types-CIPaIbZo.js';
|
|
10
|
+
import '../type-utils-CtHVDRn_.js';
|
|
11
|
+
import '../client-DvUatElp.js';
|
|
12
|
+
import 'node:child_process';
|
|
13
|
+
import 'node:stream';
|
|
14
|
+
import '@modelcontextprotocol/sdk/client/auth.js';
|
|
15
15
|
import '@modelcontextprotocol/sdk/client/streamableHttp.js';
|
|
16
|
-
import '
|
|
17
|
-
import '../types-
|
|
18
|
-
import '../
|
|
19
|
-
import '../
|
|
16
|
+
import '@modelcontextprotocol/sdk/shared/transport.js';
|
|
17
|
+
import '../types-CElwurHZ.js';
|
|
18
|
+
import '../interactions-csssHYcN.js';
|
|
19
|
+
import '../types-RT3cuyRk.js';
|
|
20
|
+
import '../types-Cr4uiYo5.js';
|
|
21
|
+
import '../model-call-options-CZkSw_xN.js';
|
|
22
|
+
import '../types-C3gv9EX6.js';
|
|
23
|
+
|
|
24
|
+
declare function createResolvedAgent<Output = string, M extends CompletionModel = CompletionModel, ContextDocument = unknown>(options: ResolvedAgentOptions<Output, M, ContextDocument>): Agent<Output, M, ContextDocument>;
|
|
25
|
+
declare function getResolvedAgentOptions<Output, M extends CompletionModel, ContextDocument>(agent: Agent<Output, M, ContextDocument>): ResolvedAgentOptions<Output, M, ContextDocument>;
|
|
20
26
|
|
|
21
27
|
type AgentToolState = {
|
|
28
|
+
configuredTools: readonly AnyTool[];
|
|
22
29
|
staticTools: readonly AnyTool[];
|
|
23
30
|
providerTools: readonly ProviderTool[];
|
|
24
31
|
toolIndexes: readonly ToolIndex[];
|
|
@@ -70,7 +77,9 @@ type RunStartHookArgs = {
|
|
|
70
77
|
run: RunControl;
|
|
71
78
|
};
|
|
72
79
|
type RunEndHookArgs = {
|
|
73
|
-
|
|
80
|
+
status: "completed";
|
|
81
|
+
output: unknown;
|
|
82
|
+
text: string;
|
|
74
83
|
usage: Usage;
|
|
75
84
|
messages: Message[];
|
|
76
85
|
run: RunControl;
|
|
@@ -104,7 +113,8 @@ type CompletionErrorHookArgs = {
|
|
|
104
113
|
};
|
|
105
114
|
type ToolHookArgs = {
|
|
106
115
|
toolName: string;
|
|
107
|
-
toolCallId
|
|
116
|
+
toolCallId: string;
|
|
117
|
+
callId?: string;
|
|
108
118
|
internalCallId: string;
|
|
109
119
|
args: string;
|
|
110
120
|
};
|
|
@@ -113,7 +123,7 @@ type ToolCallHookArgs = ToolHookArgs & {
|
|
|
113
123
|
};
|
|
114
124
|
type ToolResultHookArgs = ToolHookArgs & {
|
|
115
125
|
result: string;
|
|
116
|
-
structuredResult?:
|
|
126
|
+
structuredResult?: readonly ToolResultContentPart[] | undefined;
|
|
117
127
|
run: RunControl;
|
|
118
128
|
};
|
|
119
129
|
type ToolErrorHookArgs = ToolHookArgs & {
|
|
@@ -136,18 +146,15 @@ interface AgentHook<RawResponse = unknown> {
|
|
|
136
146
|
|
|
137
147
|
declare function createHook<RawResponse = unknown>(hook: AgentHook<RawResponse>): AgentHook<RawResponse>;
|
|
138
148
|
|
|
139
|
-
type ToolApprovalRequest<Args = unknown> = ToolApprovalContext<Args> & {
|
|
140
|
-
id: string;
|
|
141
|
-
reason?: string | undefined;
|
|
142
|
-
rejectMessage?: string | undefined;
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
declare function getAgentApprovalRequestDetails(approval: AgentToolApprovalRequest): ToolApprovalRequest | undefined;
|
|
146
|
-
|
|
147
149
|
type InternalAgentRunOptions = {
|
|
148
150
|
hook?: AgentHook | undefined;
|
|
151
|
+
onFailure?: ((failure: {
|
|
152
|
+
error: unknown;
|
|
153
|
+
messages: readonly Message[];
|
|
154
|
+
}) => void) | undefined;
|
|
155
|
+
onMemoryCompaction?: ((compaction: MemoryCompactionInfo) => void | Promise<void>) | undefined;
|
|
149
156
|
runId?: string | undefined;
|
|
150
157
|
};
|
|
151
|
-
declare function withInternalAgentRunOptions<T extends
|
|
158
|
+
declare function withInternalAgentRunOptions<T extends object>(options: T, internal: InternalAgentRunOptions): T;
|
|
152
159
|
|
|
153
|
-
export { type AgentHook, type InternalAgentRunOptions, createHook,
|
|
160
|
+
export { Agent, type AgentHook, type InternalAgentRunOptions, ResolvedAgentOptions, createHook, createResolvedAgent, getAgentToolState, getResolvedAgentOptions, withInternalAgentRunOptions };
|
package/dist/internal/agent.js
CHANGED
|
@@ -1,28 +1,61 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Agent,
|
|
3
3
|
createHook,
|
|
4
|
-
createResolvedAgent,
|
|
5
|
-
getAgentApprovalRequestDetails,
|
|
6
4
|
getAgentToolState,
|
|
7
|
-
|
|
5
|
+
markResolvedAgentOptions,
|
|
8
6
|
withInternalAgentRunOptions
|
|
9
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-BY4OMNIU.js";
|
|
10
8
|
import "../chunk-YK4WAAS4.js";
|
|
11
|
-
import "../chunk-
|
|
12
|
-
import "../chunk-
|
|
13
|
-
import "../chunk-
|
|
14
|
-
import "../chunk-
|
|
15
|
-
import "../chunk-
|
|
16
|
-
import "../chunk-
|
|
17
|
-
import "../chunk-
|
|
18
|
-
import "../chunk-
|
|
19
|
-
import "../chunk-
|
|
20
|
-
import "../chunk-
|
|
9
|
+
import "../chunk-5MK3BISB.js";
|
|
10
|
+
import "../chunk-CQNNSZPG.js";
|
|
11
|
+
import "../chunk-KV6QCRQ4.js";
|
|
12
|
+
import "../chunk-3CMWKK32.js";
|
|
13
|
+
import "../chunk-KFR4CDGK.js";
|
|
14
|
+
import "../chunk-VKYZZXP5.js";
|
|
15
|
+
import "../chunk-TRQ3XRFD.js";
|
|
16
|
+
import "../chunk-GQL5KRAH.js";
|
|
17
|
+
import "../chunk-3RM57ZT2.js";
|
|
18
|
+
import "../chunk-MGNTXGTX.js";
|
|
19
|
+
import "../chunk-D2ECOWN5.js";
|
|
20
|
+
import "../chunk-PK5LKOFL.js";
|
|
21
|
+
import "../chunk-FN7HLLAZ.js";
|
|
22
|
+
import "../chunk-AZB6N7P4.js";
|
|
23
|
+
|
|
24
|
+
// src/agent/resolved-agent.ts
|
|
25
|
+
function createResolvedAgent(options) {
|
|
26
|
+
return new Agent(markResolvedAgentOptions(options));
|
|
27
|
+
}
|
|
28
|
+
function getResolvedAgentOptions(agent) {
|
|
29
|
+
const toolState = getAgentToolState(agent);
|
|
30
|
+
return {
|
|
31
|
+
id: agent.id,
|
|
32
|
+
name: agent.name,
|
|
33
|
+
description: agent.description,
|
|
34
|
+
model: agent.model,
|
|
35
|
+
instructions: agent.instructions,
|
|
36
|
+
context: [...agent.context],
|
|
37
|
+
temperature: agent.temperature,
|
|
38
|
+
maxTokens: agent.maxTokens,
|
|
39
|
+
providerOptions: agent.providerOptions,
|
|
40
|
+
retries: agent.retries,
|
|
41
|
+
tools: [...toolState.configuredTools],
|
|
42
|
+
mcpServers: [...agent.mcpServers],
|
|
43
|
+
providerTools: [...toolState.providerTools],
|
|
44
|
+
toolIndexes: [...toolState.toolIndexes],
|
|
45
|
+
toolChoice: agent.toolChoice,
|
|
46
|
+
defaultMaxTurns: agent.defaultMaxTurns,
|
|
47
|
+
lifecycle: agent.lifecycle,
|
|
48
|
+
outputSchema: agent.outputSchema,
|
|
49
|
+
observability: agent.observability,
|
|
50
|
+
guardrails: [...agent.guardrails],
|
|
51
|
+
middlewares: [...agent.middlewares],
|
|
52
|
+
memory: agent.memory
|
|
53
|
+
};
|
|
54
|
+
}
|
|
21
55
|
export {
|
|
22
56
|
Agent,
|
|
23
57
|
createHook,
|
|
24
58
|
createResolvedAgent,
|
|
25
|
-
getAgentApprovalRequestDetails,
|
|
26
59
|
getAgentToolState,
|
|
27
60
|
getResolvedAgentOptions,
|
|
28
61
|
withInternalAgentRunOptions
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/agent/resolved-agent.ts"],"sourcesContent":["import type { CompletionModel } from \"../completion\";\nimport { Agent } from \"./agent\";\nimport { markResolvedAgentOptions } from \"./resolve-options\";\nimport { getAgentToolState } from \"./tool-state\";\nimport type { ResolvedAgentOptions } from \"./types\";\n\nexport function createResolvedAgent<\n Output = string,\n M extends CompletionModel = CompletionModel,\n ContextDocument = unknown,\n>(options: ResolvedAgentOptions<Output, M, ContextDocument>): Agent<Output, M, ContextDocument> {\n return new Agent(markResolvedAgentOptions(options));\n}\n\nexport function getResolvedAgentOptions<Output, M extends CompletionModel, ContextDocument>(\n agent: Agent<Output, M, ContextDocument>,\n): ResolvedAgentOptions<Output, M, ContextDocument> {\n const toolState = getAgentToolState(agent);\n return {\n id: agent.id,\n name: agent.name,\n description: agent.description,\n model: agent.model,\n instructions: agent.instructions,\n context: [...agent.context],\n temperature: agent.temperature,\n maxTokens: agent.maxTokens,\n providerOptions: agent.providerOptions,\n retries: agent.retries,\n tools: [...toolState.configuredTools],\n mcpServers: [...agent.mcpServers],\n providerTools: [...toolState.providerTools],\n toolIndexes: [...toolState.toolIndexes],\n toolChoice: agent.toolChoice,\n defaultMaxTurns: agent.defaultMaxTurns,\n lifecycle: agent.lifecycle,\n outputSchema: agent.outputSchema,\n observability: agent.observability,\n guardrails: [...agent.guardrails],\n middlewares: [...agent.middlewares],\n memory: agent.memory,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAMO,SAAS,oBAId,SAA8F;AAC9F,SAAO,IAAI,MAAM,yBAAyB,OAAO,CAAC;AACpD;AAEO,SAAS,wBACd,OACkD;AAClD,QAAM,YAAY,kBAAkB,KAAK;AACzC,SAAO;AAAA,IACL,IAAI,MAAM;AAAA,IACV,MAAM,MAAM;AAAA,IACZ,aAAa,MAAM;AAAA,IACnB,OAAO,MAAM;AAAA,IACb,cAAc,MAAM;AAAA,IACpB,SAAS,CAAC,GAAG,MAAM,OAAO;AAAA,IAC1B,aAAa,MAAM;AAAA,IACnB,WAAW,MAAM;AAAA,IACjB,iBAAiB,MAAM;AAAA,IACvB,SAAS,MAAM;AAAA,IACf,OAAO,CAAC,GAAG,UAAU,eAAe;AAAA,IACpC,YAAY,CAAC,GAAG,MAAM,UAAU;AAAA,IAChC,eAAe,CAAC,GAAG,UAAU,aAAa;AAAA,IAC1C,aAAa,CAAC,GAAG,UAAU,WAAW;AAAA,IACtC,YAAY,MAAM;AAAA,IAClB,iBAAiB,MAAM;AAAA,IACvB,WAAW,MAAM;AAAA,IACjB,cAAc,MAAM;AAAA,IACpB,eAAe,MAAM;AAAA,IACrB,YAAY,CAAC,GAAG,MAAM,UAAU;AAAA,IAChC,aAAa,CAAC,GAAG,MAAM,WAAW;AAAA,IAClC,QAAQ,MAAM;AAAA,EAChB;AACF;","names":[]}
|
package/dist/mcp/index.d.ts
CHANGED
|
@@ -1,17 +1,23 @@
|
|
|
1
|
-
import { M as
|
|
2
|
-
export { e as
|
|
3
|
-
import '
|
|
4
|
-
import '
|
|
1
|
+
import { M as McpClient, a as McpServer, b as McpClientGroupConnectOptions, c as McpTool } from '../client-DvUatElp.js';
|
|
2
|
+
export { d as McpClientOptions, e as McpClientTransport, f as McpConnectOptions, g as McpCustomTransport, h as McpServerInfo, i as McpStdioTransport, j as McpStreamableHttpTransport, k as McpTransport } from '../client-DvUatElp.js';
|
|
3
|
+
import 'node:child_process';
|
|
4
|
+
import 'node:stream';
|
|
5
|
+
import '@modelcontextprotocol/sdk/client/auth.js';
|
|
5
6
|
import '@modelcontextprotocol/sdk/client/streamableHttp.js';
|
|
6
|
-
import '
|
|
7
|
-
import '../
|
|
7
|
+
import '@modelcontextprotocol/sdk/shared/transport.js';
|
|
8
|
+
import '../types-D9rKQ_as.js';
|
|
9
|
+
import '../model-call-options-CZkSw_xN.js';
|
|
10
|
+
import '../tool-r62gf3QY.js';
|
|
8
11
|
|
|
9
|
-
declare
|
|
12
|
+
declare class McpClientGroup {
|
|
13
|
+
#private;
|
|
14
|
+
readonly clients: readonly McpClient[];
|
|
15
|
+
readonly servers: readonly McpServer[];
|
|
16
|
+
private constructor();
|
|
17
|
+
static connect(options: McpClientGroupConnectOptions): Promise<McpClientGroup>;
|
|
18
|
+
close(): Promise<void>;
|
|
19
|
+
}
|
|
10
20
|
|
|
11
|
-
declare
|
|
12
|
-
stdio(options: McpStdioOptions): McpConnection;
|
|
13
|
-
http(options: McpHttpOptions): McpConnection;
|
|
14
|
-
sse(options: McpSseOptions): McpConnection;
|
|
15
|
-
};
|
|
21
|
+
declare function isMcpTool(tool: unknown): tool is McpTool;
|
|
16
22
|
|
|
17
|
-
export {
|
|
23
|
+
export { McpClient, McpClientGroup, McpClientGroupConnectOptions, McpServer, McpTool, isMcpTool };
|