gauss-ai 4.0.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/CHANGELOG.md +489 -0
- package/LICENSE +21 -0
- package/README.md +269 -0
- package/dist/a2a/index.cjs +7 -0
- package/dist/a2a/index.cjs.map +1 -0
- package/dist/a2a/index.d.cts +30 -0
- package/dist/a2a/index.d.ts +30 -0
- package/dist/a2a/index.js +7 -0
- package/dist/a2a/index.js.map +1 -0
- package/dist/agent-UIQDSYCE.js +16 -0
- package/dist/agent-UIQDSYCE.js.map +1 -0
- package/dist/agent-builder-8W3mBR-N.d.ts +1075 -0
- package/dist/agent-builder-GEMYdb1p.d.cts +1075 -0
- package/dist/agent-graph-AMQYAWNF.js +1422 -0
- package/dist/agent-graph-AMQYAWNF.js.map +1 -0
- package/dist/ai-sdk-mcp.adapter-SEN6KHNU.js +124 -0
- package/dist/ai-sdk-mcp.adapter-SEN6KHNU.js.map +1 -0
- package/dist/browser/index.js +10 -0
- package/dist/browser/index.js.map +1 -0
- package/dist/bun-runtime.adapter-MQDAJLQM.js +8 -0
- package/dist/bun-runtime.adapter-MQDAJLQM.js.map +1 -0
- package/dist/bun-runtime.adapter-XKOUXVAK.cjs +8 -0
- package/dist/bun-runtime.adapter-XKOUXVAK.cjs.map +1 -0
- package/dist/chat-A3XMRPJL.js +129 -0
- package/dist/chat-A3XMRPJL.js.map +1 -0
- package/dist/chunk-2ZRU47NC.js +91 -0
- package/dist/chunk-2ZRU47NC.js.map +1 -0
- package/dist/chunk-3LD3JTH4.cjs +18 -0
- package/dist/chunk-3LD3JTH4.cjs.map +1 -0
- package/dist/chunk-5FE5TG2W.cjs +16 -0
- package/dist/chunk-5FE5TG2W.cjs.map +1 -0
- package/dist/chunk-6XF673YC.cjs +436 -0
- package/dist/chunk-6XF673YC.cjs.map +1 -0
- package/dist/chunk-7CKWZJNS.js +230 -0
- package/dist/chunk-7CKWZJNS.js.map +1 -0
- package/dist/chunk-BI2G665F.js +4588 -0
- package/dist/chunk-BI2G665F.js.map +1 -0
- package/dist/chunk-C5NLWJS2.js +139 -0
- package/dist/chunk-C5NLWJS2.js.map +1 -0
- package/dist/chunk-CJZ66SU3.cjs +4321 -0
- package/dist/chunk-CJZ66SU3.cjs.map +1 -0
- package/dist/chunk-DAMT2CXW.cjs +91 -0
- package/dist/chunk-DAMT2CXW.cjs.map +1 -0
- package/dist/chunk-E7WG3MO5.js +18 -0
- package/dist/chunk-E7WG3MO5.js.map +1 -0
- package/dist/chunk-EFDM6R4J.js +99 -0
- package/dist/chunk-EFDM6R4J.js.map +1 -0
- package/dist/chunk-F7WIPPEO.js +256 -0
- package/dist/chunk-F7WIPPEO.js.map +1 -0
- package/dist/chunk-FAYDE67N.js +6927 -0
- package/dist/chunk-FAYDE67N.js.map +1 -0
- package/dist/chunk-GAE2KKCM.js +21 -0
- package/dist/chunk-GAE2KKCM.js.map +1 -0
- package/dist/chunk-INLNGRXM.cjs +130 -0
- package/dist/chunk-INLNGRXM.cjs.map +1 -0
- package/dist/chunk-JKXKXB5O.js +130 -0
- package/dist/chunk-JKXKXB5O.js.map +1 -0
- package/dist/chunk-K6SAETGP.js +375 -0
- package/dist/chunk-K6SAETGP.js.map +1 -0
- package/dist/chunk-KEASLAYR.js +157 -0
- package/dist/chunk-KEASLAYR.js.map +1 -0
- package/dist/chunk-KKJVNM6O.js +436 -0
- package/dist/chunk-KKJVNM6O.js.map +1 -0
- package/dist/chunk-KYIMVRIM.js +16 -0
- package/dist/chunk-KYIMVRIM.js.map +1 -0
- package/dist/chunk-MB7NXIZD.js +4321 -0
- package/dist/chunk-MB7NXIZD.js.map +1 -0
- package/dist/chunk-MHHDXPGE.js +209 -0
- package/dist/chunk-MHHDXPGE.js.map +1 -0
- package/dist/chunk-NE6JJA5W.js +401 -0
- package/dist/chunk-NE6JJA5W.js.map +1 -0
- package/dist/chunk-PF46XZBF.cjs +6927 -0
- package/dist/chunk-PF46XZBF.cjs.map +1 -0
- package/dist/chunk-PSJIAGDE.cjs +375 -0
- package/dist/chunk-PSJIAGDE.cjs.map +1 -0
- package/dist/chunk-PWOQDXNQ.js +16 -0
- package/dist/chunk-PWOQDXNQ.js.map +1 -0
- package/dist/chunk-QYOMQBBZ.cjs +230 -0
- package/dist/chunk-QYOMQBBZ.cjs.map +1 -0
- package/dist/chunk-UDFXLC4J.cjs +16 -0
- package/dist/chunk-UDFXLC4J.cjs.map +1 -0
- package/dist/chunk-UO4NGXRT.cjs +259 -0
- package/dist/chunk-UO4NGXRT.cjs.map +1 -0
- package/dist/chunk-UPFDFLEW.js +40 -0
- package/dist/chunk-UPFDFLEW.js.map +1 -0
- package/dist/chunk-V55JSQS7.cjs +16 -0
- package/dist/chunk-V55JSQS7.cjs.map +1 -0
- package/dist/chunk-VJADHXZL.cjs +16 -0
- package/dist/chunk-VJADHXZL.cjs.map +1 -0
- package/dist/chunk-VRWD7LCI.js +59 -0
- package/dist/chunk-VRWD7LCI.js.map +1 -0
- package/dist/chunk-WKKQ443C.js +487 -0
- package/dist/chunk-WKKQ443C.js.map +1 -0
- package/dist/chunk-X2GHUHAF.js +436 -0
- package/dist/chunk-X2GHUHAF.js.map +1 -0
- package/dist/chunk-XLGW3XNI.cjs +256 -0
- package/dist/chunk-XLGW3XNI.cjs.map +1 -0
- package/dist/chunk-ZFJKX4DP.js +16 -0
- package/dist/chunk-ZFJKX4DP.js.map +1 -0
- package/dist/chunk-ZM2OEWM2.js +259 -0
- package/dist/chunk-ZM2OEWM2.js.map +1 -0
- package/dist/chunk-ZNAIP2XV.js +16 -0
- package/dist/chunk-ZNAIP2XV.js.map +1 -0
- package/dist/chunk-ZYFAZYSL.js +42 -0
- package/dist/chunk-ZYFAZYSL.js.map +1 -0
- package/dist/cli/index.js +421 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/config-4MHT6TQW.js +153 -0
- package/dist/config-4MHT6TQW.js.map +1 -0
- package/dist/config-REERQFK4.cjs +153 -0
- package/dist/config-REERQFK4.cjs.map +1 -0
- package/dist/cost-tracker-JLOU7IZJ.js +7 -0
- package/dist/cost-tracker-JLOU7IZJ.js.map +1 -0
- package/dist/demo-C52GMSYH.js +188 -0
- package/dist/demo-C52GMSYH.js.map +1 -0
- package/dist/deno/index.js +306 -0
- package/dist/deno/index.js.map +1 -0
- package/dist/deno-runtime.adapter-F744HY7K.js +8 -0
- package/dist/deno-runtime.adapter-F744HY7K.js.map +1 -0
- package/dist/deno-runtime.adapter-RFEVNSCV.cjs +8 -0
- package/dist/deno-runtime.adapter-RFEVNSCV.cjs.map +1 -0
- package/dist/dev-D7DDVDA4.js +218 -0
- package/dist/dev-D7DDVDA4.js.map +1 -0
- package/dist/edge/index.js +10 -0
- package/dist/edge/index.js.map +1 -0
- package/dist/edge-runtime.adapter-UQCW2F7X.js +8 -0
- package/dist/edge-runtime.adapter-UQCW2F7X.js.map +1 -0
- package/dist/edge-runtime.adapter-YED6F3AY.cjs +8 -0
- package/dist/edge-runtime.adapter-YED6F3AY.cjs.map +1 -0
- package/dist/graph-MGFAQZ5W.js +50 -0
- package/dist/graph-MGFAQZ5W.js.map +1 -0
- package/dist/graph-visualization-HBSVQXJK.js +9 -0
- package/dist/graph-visualization-HBSVQXJK.js.map +1 -0
- package/dist/index-BRgqNnh3.d.cts +982 -0
- package/dist/index-CZxpYUxZ.d.ts +982 -0
- package/dist/index.cjs +14789 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +10275 -0
- package/dist/index.d.ts +10275 -0
- package/dist/index.js +14789 -0
- package/dist/index.js.map +1 -0
- package/dist/init-CFWXTQ35.js +133 -0
- package/dist/init-CFWXTQ35.js.map +1 -0
- package/dist/llm-VWO4MC7J.cjs +17 -0
- package/dist/llm-VWO4MC7J.cjs.map +1 -0
- package/dist/llm-XLXVSPBI.js +17 -0
- package/dist/llm-XLXVSPBI.js.map +1 -0
- package/dist/logging-WRAK5ZXT.js +33 -0
- package/dist/logging-WRAK5ZXT.js.map +1 -0
- package/dist/metrics-FAHZVVD4.js +47 -0
- package/dist/metrics-FAHZVVD4.js.map +1 -0
- package/dist/node/index.cjs +280 -0
- package/dist/node/index.cjs.map +1 -0
- package/dist/node/index.d.cts +51 -0
- package/dist/node/index.d.ts +51 -0
- package/dist/node/index.js +280 -0
- package/dist/node/index.js.map +1 -0
- package/dist/node-runtime.adapter-5L7PJ6W2.js +8 -0
- package/dist/node-runtime.adapter-5L7PJ6W2.js.map +1 -0
- package/dist/node-runtime.adapter-CCRZVGHB.cjs +8 -0
- package/dist/node-runtime.adapter-CCRZVGHB.cjs.map +1 -0
- package/dist/persist-usage-WTBTCWEF.js +7 -0
- package/dist/persist-usage-WTBTCWEF.js.map +1 -0
- package/dist/plugin-RCPBWUUA.js +207 -0
- package/dist/plugin-RCPBWUUA.js.map +1 -0
- package/dist/plugins/index.cjs +75 -0
- package/dist/plugins/index.cjs.map +1 -0
- package/dist/plugins/index.d.cts +8 -0
- package/dist/plugins/index.d.ts +8 -0
- package/dist/plugins/index.js +75 -0
- package/dist/plugins/index.js.map +1 -0
- package/dist/plugins-L4ING3CX.js +4625 -0
- package/dist/plugins-L4ING3CX.js.map +1 -0
- package/dist/providers/index.cjs +189 -0
- package/dist/providers/index.cjs.map +1 -0
- package/dist/providers/index.d.cts +168 -0
- package/dist/providers/index.d.ts +168 -0
- package/dist/providers/index.js +189 -0
- package/dist/providers/index.js.map +1 -0
- package/dist/providers-3RNQ5CKZ.js +59 -0
- package/dist/providers-3RNQ5CKZ.js.map +1 -0
- package/dist/providers-66GPXUGQ.cjs +59 -0
- package/dist/providers-66GPXUGQ.cjs.map +1 -0
- package/dist/repl-K6QN4I2S.js +678 -0
- package/dist/repl-K6QN4I2S.js.map +1 -0
- package/dist/rest/index.cjs +17 -0
- package/dist/rest/index.cjs.map +1 -0
- package/dist/rest/index.d.cts +102 -0
- package/dist/rest/index.d.ts +102 -0
- package/dist/rest/index.js +17 -0
- package/dist/rest/index.js.map +1 -0
- package/dist/runtime-deno.js +15 -0
- package/dist/runtime-deno.js.map +1 -0
- package/dist/runtime-edge.js +15 -0
- package/dist/runtime-edge.js.map +1 -0
- package/dist/runtime-node.js +15 -0
- package/dist/runtime-node.js.map +1 -0
- package/dist/scraping/index.cjs +11 -0
- package/dist/scraping/index.cjs.map +1 -0
- package/dist/scraping/index.d.cts +17 -0
- package/dist/scraping/index.d.ts +17 -0
- package/dist/scraping/index.js +11 -0
- package/dist/scraping/index.js.map +1 -0
- package/dist/semantic-scraping.port-CZWUea88.d.cts +54 -0
- package/dist/semantic-scraping.port-CZWUea88.d.ts +54 -0
- package/dist/server/index.js +166 -0
- package/dist/server/index.js.map +1 -0
- package/dist/testing/index.cjs +25 -0
- package/dist/testing/index.cjs.map +1 -0
- package/dist/testing/index.d.cts +63 -0
- package/dist/testing/index.d.ts +63 -0
- package/dist/testing/index.js +25 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/token-counter.port-CRgxZZGe.d.ts +334 -0
- package/dist/token-counter.port-D7BHMCRR.d.cts +334 -0
- package/dist/tools-BZM33OBZ.js +10 -0
- package/dist/tools-BZM33OBZ.js.map +1 -0
- package/dist/tracing-XA3TEWP4.js +48 -0
- package/dist/tracing-XA3TEWP4.js.map +1 -0
- package/dist/types-CVsP7gFI.d.cts +235 -0
- package/dist/types-CVsP7gFI.d.ts +235 -0
- package/dist/virtual-fs.adapter-BBLS-3AY.d.ts +26 -0
- package/dist/virtual-fs.adapter-nb0CTYOj.d.cts +26 -0
- package/dist/workflow/index.cjs +9 -0
- package/dist/workflow/index.cjs.map +1 -0
- package/dist/workflow/index.d.cts +62 -0
- package/dist/workflow/index.d.ts +62 -0
- package/dist/workflow/index.js +9 -0
- package/dist/workflow/index.js.map +1 -0
- package/dist/workflow.port-BaCttxrw.d.cts +153 -0
- package/dist/workflow.port-BaCttxrw.d.ts +153 -0
- package/package.json +230 -0
|
@@ -0,0 +1,1075 @@
|
|
|
1
|
+
import { T as Tool, L as LanguageModel } from './types-CVsP7gFI.js';
|
|
2
|
+
import { M as Message, F as FilesystemPort, A as AgentEventType, e as AgentEventHandler, f as McpToolsetSelection, P as PolicyContext, T as TokenCounterPort, g as PolicyEnginePort, h as SubagentConfig, i as ApprovalConfig, C as CheckpointConfig, j as AgentConfig } from './token-counter.port-CRgxZZGe.js';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
|
|
5
|
+
declare const TodoStatusSchema: z.ZodEnum<["pending", "in_progress", "done", "blocked"]>;
|
|
6
|
+
type TodoStatus = z.infer<typeof TodoStatusSchema>;
|
|
7
|
+
declare const TodoSchema: z.ZodObject<{
|
|
8
|
+
id: z.ZodString;
|
|
9
|
+
title: z.ZodString;
|
|
10
|
+
description: z.ZodOptional<z.ZodString>;
|
|
11
|
+
status: z.ZodDefault<z.ZodEnum<["pending", "in_progress", "done", "blocked"]>>;
|
|
12
|
+
dependencies: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
13
|
+
priority: z.ZodDefault<z.ZodEnum<["low", "medium", "high", "critical"]>>;
|
|
14
|
+
createdAt: z.ZodDefault<z.ZodNumber>;
|
|
15
|
+
updatedAt: z.ZodDefault<z.ZodNumber>;
|
|
16
|
+
completedAt: z.ZodOptional<z.ZodNumber>;
|
|
17
|
+
}, "strip", z.ZodTypeAny, {
|
|
18
|
+
status: "done" | "pending" | "in_progress" | "blocked";
|
|
19
|
+
id: string;
|
|
20
|
+
title: string;
|
|
21
|
+
dependencies: string[];
|
|
22
|
+
priority: "low" | "medium" | "high" | "critical";
|
|
23
|
+
createdAt: number;
|
|
24
|
+
updatedAt: number;
|
|
25
|
+
description?: string | undefined;
|
|
26
|
+
completedAt?: number | undefined;
|
|
27
|
+
}, {
|
|
28
|
+
id: string;
|
|
29
|
+
title: string;
|
|
30
|
+
status?: "done" | "pending" | "in_progress" | "blocked" | undefined;
|
|
31
|
+
description?: string | undefined;
|
|
32
|
+
dependencies?: string[] | undefined;
|
|
33
|
+
priority?: "low" | "medium" | "high" | "critical" | undefined;
|
|
34
|
+
createdAt?: number | undefined;
|
|
35
|
+
updatedAt?: number | undefined;
|
|
36
|
+
completedAt?: number | undefined;
|
|
37
|
+
}>;
|
|
38
|
+
type Todo = z.infer<typeof TodoSchema>;
|
|
39
|
+
declare const TodoListSchema: z.ZodArray<z.ZodObject<{
|
|
40
|
+
id: z.ZodString;
|
|
41
|
+
title: z.ZodString;
|
|
42
|
+
description: z.ZodOptional<z.ZodString>;
|
|
43
|
+
status: z.ZodDefault<z.ZodEnum<["pending", "in_progress", "done", "blocked"]>>;
|
|
44
|
+
dependencies: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
45
|
+
priority: z.ZodDefault<z.ZodEnum<["low", "medium", "high", "critical"]>>;
|
|
46
|
+
createdAt: z.ZodDefault<z.ZodNumber>;
|
|
47
|
+
updatedAt: z.ZodDefault<z.ZodNumber>;
|
|
48
|
+
completedAt: z.ZodOptional<z.ZodNumber>;
|
|
49
|
+
}, "strip", z.ZodTypeAny, {
|
|
50
|
+
status: "done" | "pending" | "in_progress" | "blocked";
|
|
51
|
+
id: string;
|
|
52
|
+
title: string;
|
|
53
|
+
dependencies: string[];
|
|
54
|
+
priority: "low" | "medium" | "high" | "critical";
|
|
55
|
+
createdAt: number;
|
|
56
|
+
updatedAt: number;
|
|
57
|
+
description?: string | undefined;
|
|
58
|
+
completedAt?: number | undefined;
|
|
59
|
+
}, {
|
|
60
|
+
id: string;
|
|
61
|
+
title: string;
|
|
62
|
+
status?: "done" | "pending" | "in_progress" | "blocked" | undefined;
|
|
63
|
+
description?: string | undefined;
|
|
64
|
+
dependencies?: string[] | undefined;
|
|
65
|
+
priority?: "low" | "medium" | "high" | "critical" | undefined;
|
|
66
|
+
createdAt?: number | undefined;
|
|
67
|
+
updatedAt?: number | undefined;
|
|
68
|
+
completedAt?: number | undefined;
|
|
69
|
+
}>, "many">;
|
|
70
|
+
type TodoList = z.infer<typeof TodoListSchema>;
|
|
71
|
+
declare const WriteTodosInputSchema: z.ZodObject<{
|
|
72
|
+
todos: z.ZodArray<z.ZodObject<{
|
|
73
|
+
id: z.ZodString;
|
|
74
|
+
title: z.ZodString;
|
|
75
|
+
description: z.ZodOptional<z.ZodString>;
|
|
76
|
+
status: z.ZodDefault<z.ZodEnum<["pending", "in_progress", "done", "blocked"]>>;
|
|
77
|
+
dependencies: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
78
|
+
priority: z.ZodDefault<z.ZodEnum<["low", "medium", "high", "critical"]>>;
|
|
79
|
+
createdAt: z.ZodDefault<z.ZodNumber>;
|
|
80
|
+
updatedAt: z.ZodDefault<z.ZodNumber>;
|
|
81
|
+
completedAt: z.ZodOptional<z.ZodNumber>;
|
|
82
|
+
}, "strip", z.ZodTypeAny, {
|
|
83
|
+
status: "done" | "pending" | "in_progress" | "blocked";
|
|
84
|
+
id: string;
|
|
85
|
+
title: string;
|
|
86
|
+
dependencies: string[];
|
|
87
|
+
priority: "low" | "medium" | "high" | "critical";
|
|
88
|
+
createdAt: number;
|
|
89
|
+
updatedAt: number;
|
|
90
|
+
description?: string | undefined;
|
|
91
|
+
completedAt?: number | undefined;
|
|
92
|
+
}, {
|
|
93
|
+
id: string;
|
|
94
|
+
title: string;
|
|
95
|
+
status?: "done" | "pending" | "in_progress" | "blocked" | undefined;
|
|
96
|
+
description?: string | undefined;
|
|
97
|
+
dependencies?: string[] | undefined;
|
|
98
|
+
priority?: "low" | "medium" | "high" | "critical" | undefined;
|
|
99
|
+
createdAt?: number | undefined;
|
|
100
|
+
updatedAt?: number | undefined;
|
|
101
|
+
completedAt?: number | undefined;
|
|
102
|
+
}>, "many">;
|
|
103
|
+
}, "strip", z.ZodTypeAny, {
|
|
104
|
+
todos: {
|
|
105
|
+
status: "done" | "pending" | "in_progress" | "blocked";
|
|
106
|
+
id: string;
|
|
107
|
+
title: string;
|
|
108
|
+
dependencies: string[];
|
|
109
|
+
priority: "low" | "medium" | "high" | "critical";
|
|
110
|
+
createdAt: number;
|
|
111
|
+
updatedAt: number;
|
|
112
|
+
description?: string | undefined;
|
|
113
|
+
completedAt?: number | undefined;
|
|
114
|
+
}[];
|
|
115
|
+
}, {
|
|
116
|
+
todos: {
|
|
117
|
+
id: string;
|
|
118
|
+
title: string;
|
|
119
|
+
status?: "done" | "pending" | "in_progress" | "blocked" | undefined;
|
|
120
|
+
description?: string | undefined;
|
|
121
|
+
dependencies?: string[] | undefined;
|
|
122
|
+
priority?: "low" | "medium" | "high" | "critical" | undefined;
|
|
123
|
+
createdAt?: number | undefined;
|
|
124
|
+
updatedAt?: number | undefined;
|
|
125
|
+
completedAt?: number | undefined;
|
|
126
|
+
}[];
|
|
127
|
+
}>;
|
|
128
|
+
type WriteTodosInput = z.infer<typeof WriteTodosInputSchema>;
|
|
129
|
+
declare const UpdateTodoInputSchema: z.ZodObject<{
|
|
130
|
+
id: z.ZodString;
|
|
131
|
+
status: z.ZodOptional<z.ZodEnum<["pending", "in_progress", "done", "blocked"]>>;
|
|
132
|
+
title: z.ZodOptional<z.ZodString>;
|
|
133
|
+
description: z.ZodOptional<z.ZodString>;
|
|
134
|
+
}, "strip", z.ZodTypeAny, {
|
|
135
|
+
id: string;
|
|
136
|
+
status?: "done" | "pending" | "in_progress" | "blocked" | undefined;
|
|
137
|
+
description?: string | undefined;
|
|
138
|
+
title?: string | undefined;
|
|
139
|
+
}, {
|
|
140
|
+
id: string;
|
|
141
|
+
status?: "done" | "pending" | "in_progress" | "blocked" | undefined;
|
|
142
|
+
description?: string | undefined;
|
|
143
|
+
title?: string | undefined;
|
|
144
|
+
}>;
|
|
145
|
+
type UpdateTodoInput = z.infer<typeof UpdateTodoInputSchema>;
|
|
146
|
+
|
|
147
|
+
declare const CheckpointSchema: z.ZodObject<{
|
|
148
|
+
id: z.ZodString;
|
|
149
|
+
sessionId: z.ZodString;
|
|
150
|
+
stepIndex: z.ZodNumber;
|
|
151
|
+
conversation: z.ZodArray<z.ZodObject<{
|
|
152
|
+
role: z.ZodEnum<["user", "assistant", "system"]>;
|
|
153
|
+
content: z.ZodString;
|
|
154
|
+
timestamp: z.ZodOptional<z.ZodNumber>;
|
|
155
|
+
}, "strip", z.ZodTypeAny, {
|
|
156
|
+
role: "system" | "user" | "assistant";
|
|
157
|
+
content: string;
|
|
158
|
+
timestamp?: number | undefined;
|
|
159
|
+
}, {
|
|
160
|
+
role: "system" | "user" | "assistant";
|
|
161
|
+
content: string;
|
|
162
|
+
timestamp?: number | undefined;
|
|
163
|
+
}>, "many">;
|
|
164
|
+
todos: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
165
|
+
id: z.ZodString;
|
|
166
|
+
title: z.ZodString;
|
|
167
|
+
description: z.ZodOptional<z.ZodString>;
|
|
168
|
+
status: z.ZodDefault<z.ZodEnum<["pending", "in_progress", "done", "blocked"]>>;
|
|
169
|
+
dependencies: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
170
|
+
priority: z.ZodDefault<z.ZodEnum<["low", "medium", "high", "critical"]>>;
|
|
171
|
+
createdAt: z.ZodDefault<z.ZodNumber>;
|
|
172
|
+
updatedAt: z.ZodDefault<z.ZodNumber>;
|
|
173
|
+
completedAt: z.ZodOptional<z.ZodNumber>;
|
|
174
|
+
}, "strip", z.ZodTypeAny, {
|
|
175
|
+
status: "done" | "pending" | "in_progress" | "blocked";
|
|
176
|
+
id: string;
|
|
177
|
+
title: string;
|
|
178
|
+
dependencies: string[];
|
|
179
|
+
priority: "low" | "medium" | "high" | "critical";
|
|
180
|
+
createdAt: number;
|
|
181
|
+
updatedAt: number;
|
|
182
|
+
description?: string | undefined;
|
|
183
|
+
completedAt?: number | undefined;
|
|
184
|
+
}, {
|
|
185
|
+
id: string;
|
|
186
|
+
title: string;
|
|
187
|
+
status?: "done" | "pending" | "in_progress" | "blocked" | undefined;
|
|
188
|
+
description?: string | undefined;
|
|
189
|
+
dependencies?: string[] | undefined;
|
|
190
|
+
priority?: "low" | "medium" | "high" | "critical" | undefined;
|
|
191
|
+
createdAt?: number | undefined;
|
|
192
|
+
updatedAt?: number | undefined;
|
|
193
|
+
completedAt?: number | undefined;
|
|
194
|
+
}>, "many">>;
|
|
195
|
+
filesSnapshot: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
196
|
+
toolResults: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
197
|
+
generatedTokens: z.ZodDefault<z.ZodNumber>;
|
|
198
|
+
lastToolCallId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
199
|
+
metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
200
|
+
createdAt: z.ZodDefault<z.ZodNumber>;
|
|
201
|
+
}, "strip", z.ZodTypeAny, {
|
|
202
|
+
id: string;
|
|
203
|
+
createdAt: number;
|
|
204
|
+
todos: {
|
|
205
|
+
status: "done" | "pending" | "in_progress" | "blocked";
|
|
206
|
+
id: string;
|
|
207
|
+
title: string;
|
|
208
|
+
dependencies: string[];
|
|
209
|
+
priority: "low" | "medium" | "high" | "critical";
|
|
210
|
+
createdAt: number;
|
|
211
|
+
updatedAt: number;
|
|
212
|
+
description?: string | undefined;
|
|
213
|
+
completedAt?: number | undefined;
|
|
214
|
+
}[];
|
|
215
|
+
sessionId: string;
|
|
216
|
+
stepIndex: number;
|
|
217
|
+
conversation: {
|
|
218
|
+
role: "system" | "user" | "assistant";
|
|
219
|
+
content: string;
|
|
220
|
+
timestamp?: number | undefined;
|
|
221
|
+
}[];
|
|
222
|
+
filesSnapshot: Record<string, string>;
|
|
223
|
+
toolResults: Record<string, unknown>;
|
|
224
|
+
generatedTokens: number;
|
|
225
|
+
lastToolCallId: string | null;
|
|
226
|
+
metadata: Record<string, unknown>;
|
|
227
|
+
}, {
|
|
228
|
+
id: string;
|
|
229
|
+
sessionId: string;
|
|
230
|
+
stepIndex: number;
|
|
231
|
+
conversation: {
|
|
232
|
+
role: "system" | "user" | "assistant";
|
|
233
|
+
content: string;
|
|
234
|
+
timestamp?: number | undefined;
|
|
235
|
+
}[];
|
|
236
|
+
createdAt?: number | undefined;
|
|
237
|
+
todos?: {
|
|
238
|
+
id: string;
|
|
239
|
+
title: string;
|
|
240
|
+
status?: "done" | "pending" | "in_progress" | "blocked" | undefined;
|
|
241
|
+
description?: string | undefined;
|
|
242
|
+
dependencies?: string[] | undefined;
|
|
243
|
+
priority?: "low" | "medium" | "high" | "critical" | undefined;
|
|
244
|
+
createdAt?: number | undefined;
|
|
245
|
+
updatedAt?: number | undefined;
|
|
246
|
+
completedAt?: number | undefined;
|
|
247
|
+
}[] | undefined;
|
|
248
|
+
filesSnapshot?: Record<string, string> | undefined;
|
|
249
|
+
toolResults?: Record<string, unknown> | undefined;
|
|
250
|
+
generatedTokens?: number | undefined;
|
|
251
|
+
lastToolCallId?: string | null | undefined;
|
|
252
|
+
metadata?: Record<string, unknown> | undefined;
|
|
253
|
+
}>;
|
|
254
|
+
type Checkpoint = z.infer<typeof CheckpointSchema>;
|
|
255
|
+
|
|
256
|
+
interface MemoryPort {
|
|
257
|
+
saveTodos(sessionId: string, todos: Todo[]): Promise<void>;
|
|
258
|
+
loadTodos(sessionId: string): Promise<Todo[]>;
|
|
259
|
+
saveCheckpoint(sessionId: string, checkpoint: Checkpoint): Promise<void>;
|
|
260
|
+
loadLatestCheckpoint(sessionId: string): Promise<Checkpoint | null>;
|
|
261
|
+
listCheckpoints(sessionId: string): Promise<Checkpoint[]>;
|
|
262
|
+
deleteOldCheckpoints(sessionId: string, keepCount: number): Promise<void>;
|
|
263
|
+
saveConversation(sessionId: string, messages: Message[]): Promise<void>;
|
|
264
|
+
loadConversation(sessionId: string): Promise<Message[]>;
|
|
265
|
+
saveMetadata(sessionId: string, key: string, value: unknown): Promise<void>;
|
|
266
|
+
loadMetadata<T = unknown>(sessionId: string, key: string): Promise<T | null>;
|
|
267
|
+
deleteMetadata(sessionId: string, key: string): Promise<void>;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
declare const UserProfileSchema: z.ZodObject<{
|
|
271
|
+
userId: z.ZodString;
|
|
272
|
+
preferences: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
273
|
+
language: z.ZodOptional<z.ZodString>;
|
|
274
|
+
style: z.ZodOptional<z.ZodEnum<["concise", "detailed", "technical", "casual"]>>;
|
|
275
|
+
context: z.ZodOptional<z.ZodString>;
|
|
276
|
+
updatedAt: z.ZodDefault<z.ZodNumber>;
|
|
277
|
+
createdAt: z.ZodDefault<z.ZodNumber>;
|
|
278
|
+
}, "strip", z.ZodTypeAny, {
|
|
279
|
+
createdAt: number;
|
|
280
|
+
updatedAt: number;
|
|
281
|
+
userId: string;
|
|
282
|
+
preferences: Record<string, unknown>;
|
|
283
|
+
language?: string | undefined;
|
|
284
|
+
style?: "concise" | "detailed" | "technical" | "casual" | undefined;
|
|
285
|
+
context?: string | undefined;
|
|
286
|
+
}, {
|
|
287
|
+
userId: string;
|
|
288
|
+
createdAt?: number | undefined;
|
|
289
|
+
updatedAt?: number | undefined;
|
|
290
|
+
preferences?: Record<string, unknown> | undefined;
|
|
291
|
+
language?: string | undefined;
|
|
292
|
+
style?: "concise" | "detailed" | "technical" | "casual" | undefined;
|
|
293
|
+
context?: string | undefined;
|
|
294
|
+
}>;
|
|
295
|
+
type UserProfile = z.infer<typeof UserProfileSchema>;
|
|
296
|
+
declare const UserMemorySchema: z.ZodObject<{
|
|
297
|
+
id: z.ZodString;
|
|
298
|
+
content: z.ZodString;
|
|
299
|
+
tags: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
300
|
+
confidence: z.ZodDefault<z.ZodNumber>;
|
|
301
|
+
source: z.ZodDefault<z.ZodEnum<["explicit", "inferred"]>>;
|
|
302
|
+
createdAt: z.ZodDefault<z.ZodNumber>;
|
|
303
|
+
}, "strip", z.ZodTypeAny, {
|
|
304
|
+
id: string;
|
|
305
|
+
createdAt: number;
|
|
306
|
+
content: string;
|
|
307
|
+
tags: string[];
|
|
308
|
+
confidence: number;
|
|
309
|
+
source: "explicit" | "inferred";
|
|
310
|
+
}, {
|
|
311
|
+
id: string;
|
|
312
|
+
content: string;
|
|
313
|
+
createdAt?: number | undefined;
|
|
314
|
+
tags?: string[] | undefined;
|
|
315
|
+
confidence?: number | undefined;
|
|
316
|
+
source?: "explicit" | "inferred" | undefined;
|
|
317
|
+
}>;
|
|
318
|
+
type UserMemory = z.infer<typeof UserMemorySchema>;
|
|
319
|
+
type UserMemoryInput = z.input<typeof UserMemorySchema>;
|
|
320
|
+
declare const SharedKnowledgeSchema: z.ZodObject<{
|
|
321
|
+
id: z.ZodString;
|
|
322
|
+
content: z.ZodString;
|
|
323
|
+
category: z.ZodOptional<z.ZodString>;
|
|
324
|
+
tags: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
325
|
+
usageCount: z.ZodDefault<z.ZodNumber>;
|
|
326
|
+
createdAt: z.ZodDefault<z.ZodNumber>;
|
|
327
|
+
}, "strip", z.ZodTypeAny, {
|
|
328
|
+
id: string;
|
|
329
|
+
createdAt: number;
|
|
330
|
+
content: string;
|
|
331
|
+
tags: string[];
|
|
332
|
+
usageCount: number;
|
|
333
|
+
category?: string | undefined;
|
|
334
|
+
}, {
|
|
335
|
+
id: string;
|
|
336
|
+
content: string;
|
|
337
|
+
createdAt?: number | undefined;
|
|
338
|
+
tags?: string[] | undefined;
|
|
339
|
+
category?: string | undefined;
|
|
340
|
+
usageCount?: number | undefined;
|
|
341
|
+
}>;
|
|
342
|
+
type SharedKnowledge = z.infer<typeof SharedKnowledgeSchema>;
|
|
343
|
+
type SharedKnowledgeInput = z.input<typeof SharedKnowledgeSchema>;
|
|
344
|
+
|
|
345
|
+
interface LearningPort {
|
|
346
|
+
getProfile(userId: string): Promise<UserProfile | null>;
|
|
347
|
+
updateProfile(userId: string, updates: Partial<Omit<UserProfile, "userId" | "createdAt">>): Promise<UserProfile>;
|
|
348
|
+
deleteProfile(userId: string): Promise<void>;
|
|
349
|
+
addMemory(userId: string, memory: Omit<UserMemoryInput, "id" | "createdAt">): Promise<UserMemory>;
|
|
350
|
+
getMemories(userId: string, options?: {
|
|
351
|
+
tags?: string[];
|
|
352
|
+
limit?: number;
|
|
353
|
+
since?: number;
|
|
354
|
+
}): Promise<UserMemory[]>;
|
|
355
|
+
deleteMemory(userId: string, memoryId: string): Promise<void>;
|
|
356
|
+
clearMemories(userId: string): Promise<void>;
|
|
357
|
+
addKnowledge(knowledge: Omit<SharedKnowledgeInput, "id" | "createdAt" | "usageCount">): Promise<SharedKnowledge>;
|
|
358
|
+
queryKnowledge(query: string, options?: {
|
|
359
|
+
category?: string;
|
|
360
|
+
limit?: number;
|
|
361
|
+
}): Promise<SharedKnowledge[]>;
|
|
362
|
+
incrementKnowledgeUsage(knowledgeId: string): Promise<void>;
|
|
363
|
+
deleteKnowledge(knowledgeId: string): Promise<void>;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
interface McpToolDefinition {
|
|
367
|
+
name: string;
|
|
368
|
+
description: string;
|
|
369
|
+
inputSchema: Record<string, unknown>;
|
|
370
|
+
domain?: string;
|
|
371
|
+
}
|
|
372
|
+
interface McpToolResult {
|
|
373
|
+
content: McpToolResultContent[];
|
|
374
|
+
isError?: boolean;
|
|
375
|
+
}
|
|
376
|
+
interface McpToolResultContent {
|
|
377
|
+
type: "text" | "image" | "resource";
|
|
378
|
+
text?: string;
|
|
379
|
+
data?: string;
|
|
380
|
+
mimeType?: string;
|
|
381
|
+
}
|
|
382
|
+
interface McpServerInfo {
|
|
383
|
+
id: string;
|
|
384
|
+
name: string;
|
|
385
|
+
status: "connected" | "disconnected" | "error";
|
|
386
|
+
toolCount: number;
|
|
387
|
+
transport: "stdio" | "http" | "sse" | "streamable-http";
|
|
388
|
+
}
|
|
389
|
+
interface McpServerConfig {
|
|
390
|
+
id: string;
|
|
391
|
+
name: string;
|
|
392
|
+
transport: "stdio" | "http" | "sse" | "streamable-http";
|
|
393
|
+
command?: string;
|
|
394
|
+
args?: string[];
|
|
395
|
+
url?: string;
|
|
396
|
+
env?: Record<string, string>;
|
|
397
|
+
headers?: Record<string, string>;
|
|
398
|
+
}
|
|
399
|
+
interface McpPort {
|
|
400
|
+
/** Discover all available tools from connected MCP servers */
|
|
401
|
+
discoverTools(): Promise<Record<string, McpToolDefinition>>;
|
|
402
|
+
/** Execute a tool by name with given arguments */
|
|
403
|
+
executeTool(name: string, args: unknown): Promise<McpToolResult>;
|
|
404
|
+
/** List connected MCP servers */
|
|
405
|
+
listServers(): Promise<McpServerInfo[]>;
|
|
406
|
+
/** Connect to a new MCP server */
|
|
407
|
+
connect(config: McpServerConfig): Promise<void>;
|
|
408
|
+
/** Disconnect from an MCP server */
|
|
409
|
+
disconnect(serverId: string): Promise<void>;
|
|
410
|
+
/** Close all connections */
|
|
411
|
+
closeAll(): Promise<void>;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
interface TelemetrySpan {
|
|
415
|
+
setAttribute(key: string, value: string | number | boolean): void;
|
|
416
|
+
setStatus(code: "OK" | "ERROR", message?: string): void;
|
|
417
|
+
end(): void;
|
|
418
|
+
}
|
|
419
|
+
interface TelemetryPort {
|
|
420
|
+
startSpan(name: string, attributes?: Record<string, string | number | boolean>): TelemetrySpan;
|
|
421
|
+
recordMetric(name: string, value: number, attributes?: Record<string, string>): void;
|
|
422
|
+
flush(): Promise<void>;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
interface CostTokenUsage {
|
|
426
|
+
inputTokens: number;
|
|
427
|
+
outputTokens: number;
|
|
428
|
+
model: string;
|
|
429
|
+
provider: string;
|
|
430
|
+
timestamp: number;
|
|
431
|
+
}
|
|
432
|
+
interface CostEstimate {
|
|
433
|
+
totalInputTokens: number;
|
|
434
|
+
totalOutputTokens: number;
|
|
435
|
+
totalCost: number;
|
|
436
|
+
currency: "USD";
|
|
437
|
+
breakdown: Array<{
|
|
438
|
+
model: string;
|
|
439
|
+
inputTokens: number;
|
|
440
|
+
outputTokens: number;
|
|
441
|
+
cost: number;
|
|
442
|
+
}>;
|
|
443
|
+
}
|
|
444
|
+
interface CostTrackerPort {
|
|
445
|
+
recordUsage(usage: CostTokenUsage): void;
|
|
446
|
+
getEstimate(): CostEstimate;
|
|
447
|
+
getSessionBudget(): number | null;
|
|
448
|
+
isOverBudget(): boolean;
|
|
449
|
+
reset(): void;
|
|
450
|
+
exportUsage(): string;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
interface PluginRunMetadata {
|
|
454
|
+
readonly [key: string]: unknown;
|
|
455
|
+
}
|
|
456
|
+
/** Context passed to plugin hooks — read-only snapshot of the current run */
|
|
457
|
+
interface PluginContext {
|
|
458
|
+
readonly sessionId: string;
|
|
459
|
+
readonly agentName?: string;
|
|
460
|
+
readonly config: Readonly<{
|
|
461
|
+
instructions: string;
|
|
462
|
+
maxSteps: number;
|
|
463
|
+
}>;
|
|
464
|
+
readonly filesystem: FilesystemPort;
|
|
465
|
+
readonly memory: MemoryPort;
|
|
466
|
+
readonly learning?: LearningPort;
|
|
467
|
+
readonly toolNames: readonly string[];
|
|
468
|
+
readonly runMetadata?: PluginRunMetadata;
|
|
469
|
+
}
|
|
470
|
+
/** Context passed once during plugin setup */
|
|
471
|
+
interface PluginSetupContext extends Omit<PluginContext, "runMetadata"> {
|
|
472
|
+
/** Subscribe to agent lifecycle events; returned function unsubscribes */
|
|
473
|
+
on(eventType: AgentEventType | "*", handler: AgentEventHandler): () => void;
|
|
474
|
+
}
|
|
475
|
+
interface BeforeRunParams {
|
|
476
|
+
prompt: string;
|
|
477
|
+
}
|
|
478
|
+
interface BeforeRunResult {
|
|
479
|
+
prompt?: string;
|
|
480
|
+
}
|
|
481
|
+
interface AfterRunParams {
|
|
482
|
+
result: {
|
|
483
|
+
text: string;
|
|
484
|
+
steps: unknown[];
|
|
485
|
+
sessionId: string;
|
|
486
|
+
};
|
|
487
|
+
}
|
|
488
|
+
interface BeforeToolParams {
|
|
489
|
+
toolName: string;
|
|
490
|
+
args: unknown;
|
|
491
|
+
}
|
|
492
|
+
interface BeforeToolResult {
|
|
493
|
+
args?: unknown;
|
|
494
|
+
skip?: boolean;
|
|
495
|
+
result?: unknown;
|
|
496
|
+
}
|
|
497
|
+
interface AfterToolParams {
|
|
498
|
+
toolName: string;
|
|
499
|
+
args: unknown;
|
|
500
|
+
result: unknown;
|
|
501
|
+
}
|
|
502
|
+
interface BeforeStepParams {
|
|
503
|
+
stepIndex: number;
|
|
504
|
+
step: unknown;
|
|
505
|
+
}
|
|
506
|
+
interface BeforeStepResult {
|
|
507
|
+
step?: unknown;
|
|
508
|
+
skip?: boolean;
|
|
509
|
+
}
|
|
510
|
+
interface AfterStepParams {
|
|
511
|
+
stepIndex: number;
|
|
512
|
+
step: unknown;
|
|
513
|
+
}
|
|
514
|
+
interface OnErrorParams {
|
|
515
|
+
error: unknown;
|
|
516
|
+
phase: "run" | "stream" | "tool" | "step" | "setup";
|
|
517
|
+
}
|
|
518
|
+
interface OnErrorResult {
|
|
519
|
+
suppress?: boolean;
|
|
520
|
+
}
|
|
521
|
+
interface PluginHooks {
|
|
522
|
+
beforeRun?(ctx: PluginContext, params: BeforeRunParams): Promise<BeforeRunResult | void> | BeforeRunResult | void;
|
|
523
|
+
afterRun?(ctx: PluginContext, params: AfterRunParams): Promise<void> | void;
|
|
524
|
+
beforeTool?(ctx: PluginContext, params: BeforeToolParams): Promise<BeforeToolResult | void> | BeforeToolResult | void;
|
|
525
|
+
afterTool?(ctx: PluginContext, params: AfterToolParams): Promise<void> | void;
|
|
526
|
+
beforeStep?(ctx: PluginContext, params: BeforeStepParams): Promise<BeforeStepResult | void> | BeforeStepResult | void;
|
|
527
|
+
afterStep?(ctx: PluginContext, params: AfterStepParams): Promise<void> | void;
|
|
528
|
+
onError?(ctx: PluginContext, params: OnErrorParams): Promise<OnErrorResult | void> | OnErrorResult | void;
|
|
529
|
+
}
|
|
530
|
+
interface Plugin {
|
|
531
|
+
readonly name: string;
|
|
532
|
+
readonly version?: string;
|
|
533
|
+
readonly hooks?: PluginHooks;
|
|
534
|
+
readonly tools?: Record<string, Tool<any, any>>;
|
|
535
|
+
setup?(ctx: PluginSetupContext): Promise<void> | void;
|
|
536
|
+
dispose?(): Promise<void> | void;
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
interface RuntimePort {
|
|
540
|
+
/** Human-readable runtime identifier */
|
|
541
|
+
readonly name: 'node' | 'deno' | 'bun' | 'edge' | 'unknown';
|
|
542
|
+
/** Generate a unique identifier */
|
|
543
|
+
randomUUID(): string;
|
|
544
|
+
/** HTTP fetch (standard Fetch API) */
|
|
545
|
+
fetch(input: string | URL | Request, init?: RequestInit): Promise<Response>;
|
|
546
|
+
/** Read an environment variable */
|
|
547
|
+
getEnv(key: string): string | undefined;
|
|
548
|
+
/** Schedule a delayed callback. Returns a disposable handle. */
|
|
549
|
+
setTimeout(callback: () => void, ms: number): {
|
|
550
|
+
clear(): void;
|
|
551
|
+
};
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
interface LifecycleHooks {
|
|
555
|
+
onStartup?: () => Promise<void>;
|
|
556
|
+
onShutdown?: () => Promise<void>;
|
|
557
|
+
onHealthCheck?: () => Promise<HealthStatus>;
|
|
558
|
+
}
|
|
559
|
+
interface HealthStatus {
|
|
560
|
+
healthy: boolean;
|
|
561
|
+
details?: Record<string, {
|
|
562
|
+
status: 'up' | 'down';
|
|
563
|
+
message?: string;
|
|
564
|
+
}>;
|
|
565
|
+
}
|
|
566
|
+
declare class LifecycleManager {
|
|
567
|
+
private _isReady;
|
|
568
|
+
private _isShuttingDown;
|
|
569
|
+
private readonly hooks;
|
|
570
|
+
private readonly runningOperations;
|
|
571
|
+
constructor(hooks: LifecycleHooks);
|
|
572
|
+
startup(): Promise<void>;
|
|
573
|
+
shutdown(): Promise<void>;
|
|
574
|
+
healthCheck(): Promise<HealthStatus>;
|
|
575
|
+
get isReady(): boolean;
|
|
576
|
+
get isShuttingDown(): boolean;
|
|
577
|
+
/**
|
|
578
|
+
* Track a running operation for graceful shutdown.
|
|
579
|
+
* Returns a cleanup function to remove the operation from tracking.
|
|
580
|
+
*/
|
|
581
|
+
trackOperation<T>(operation: Promise<T>): Promise<T>;
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
type TemplateValue = string | number | boolean | null | undefined | any[] | Record<string, any>;
|
|
585
|
+
interface PromptTemplateConfig {
|
|
586
|
+
template: string;
|
|
587
|
+
variables?: Record<string, TemplateValue>;
|
|
588
|
+
partials?: Record<string, PromptTemplate>;
|
|
589
|
+
}
|
|
590
|
+
declare class PromptTemplate {
|
|
591
|
+
private readonly config;
|
|
592
|
+
constructor(config: PromptTemplateConfig);
|
|
593
|
+
compile(overrides?: Record<string, TemplateValue>): string;
|
|
594
|
+
private processLoops;
|
|
595
|
+
private processConditionals;
|
|
596
|
+
private processFilters;
|
|
597
|
+
extend(overrides: Partial<PromptTemplateConfig>): PromptTemplate;
|
|
598
|
+
get requiredVariables(): string[];
|
|
599
|
+
static from(template: string): PromptTemplate;
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
declare abstract class AbstractBuilder<T> {
|
|
603
|
+
protected abstract validate(): void;
|
|
604
|
+
protected abstract construct(): T;
|
|
605
|
+
build(): T;
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
/**
|
|
609
|
+
* Circuit Breaker implementation following the classic pattern
|
|
610
|
+
* States: closed → open → half-open
|
|
611
|
+
*/
|
|
612
|
+
interface CircuitBreakerConfig {
|
|
613
|
+
readonly failureThreshold: number;
|
|
614
|
+
readonly resetTimeoutMs: number;
|
|
615
|
+
readonly monitorWindowMs: number;
|
|
616
|
+
}
|
|
617
|
+
declare enum CircuitBreakerState {
|
|
618
|
+
CLOSED = "closed",
|
|
619
|
+
OPEN = "open",
|
|
620
|
+
HALF_OPEN = "half-open"
|
|
621
|
+
}
|
|
622
|
+
declare class CircuitBreaker {
|
|
623
|
+
private readonly config;
|
|
624
|
+
private state;
|
|
625
|
+
private failures;
|
|
626
|
+
private lastFailureTime;
|
|
627
|
+
private halfOpenTestInProgress;
|
|
628
|
+
constructor(config?: CircuitBreakerConfig);
|
|
629
|
+
execute<T>(operation: () => Promise<T>): Promise<T>;
|
|
630
|
+
getState(): CircuitBreakerState;
|
|
631
|
+
getFailureCount(): number;
|
|
632
|
+
reset(): void;
|
|
633
|
+
private shouldReject;
|
|
634
|
+
private onSuccess;
|
|
635
|
+
private onFailure;
|
|
636
|
+
private updateState;
|
|
637
|
+
private cleanupOldFailures;
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
/**
|
|
641
|
+
* Rate Limiter using token bucket algorithm
|
|
642
|
+
*/
|
|
643
|
+
interface RateLimiterConfig {
|
|
644
|
+
readonly maxTokens: number;
|
|
645
|
+
readonly refillRateMs: number;
|
|
646
|
+
}
|
|
647
|
+
declare class RateLimiter {
|
|
648
|
+
private readonly config;
|
|
649
|
+
private tokens;
|
|
650
|
+
private lastRefillTime;
|
|
651
|
+
private waitQueue;
|
|
652
|
+
private processingScheduled;
|
|
653
|
+
constructor(config?: RateLimiterConfig);
|
|
654
|
+
/**
|
|
655
|
+
* Acquire a token, waiting if necessary
|
|
656
|
+
*/
|
|
657
|
+
acquire(): Promise<void>;
|
|
658
|
+
/**
|
|
659
|
+
* Try to acquire a token immediately
|
|
660
|
+
* @returns true if token acquired, false otherwise
|
|
661
|
+
*/
|
|
662
|
+
tryAcquire(): boolean;
|
|
663
|
+
/**
|
|
664
|
+
* Get number of available tokens
|
|
665
|
+
*/
|
|
666
|
+
get availableTokens(): number;
|
|
667
|
+
/**
|
|
668
|
+
* Reset the rate limiter to initial state
|
|
669
|
+
*/
|
|
670
|
+
reset(): void;
|
|
671
|
+
private refillTokens;
|
|
672
|
+
private processQueue;
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
/**
|
|
676
|
+
* LRU Cache with TTL support for tool execution results
|
|
677
|
+
*/
|
|
678
|
+
interface ToolCacheConfig {
|
|
679
|
+
readonly defaultTtlMs: number;
|
|
680
|
+
readonly maxSize: number;
|
|
681
|
+
readonly cleanupIntervalMs?: number;
|
|
682
|
+
}
|
|
683
|
+
declare class ToolCache<T = any> {
|
|
684
|
+
private readonly config;
|
|
685
|
+
private cache;
|
|
686
|
+
private lastCleanup;
|
|
687
|
+
private readonly cleanupIntervalMs;
|
|
688
|
+
constructor(config?: ToolCacheConfig);
|
|
689
|
+
/**
|
|
690
|
+
* Check if a non-expired entry exists for the key
|
|
691
|
+
*/
|
|
692
|
+
has(key: string): boolean;
|
|
693
|
+
/**
|
|
694
|
+
* Get a cached value
|
|
695
|
+
*/
|
|
696
|
+
get(key: string): T | undefined;
|
|
697
|
+
/**
|
|
698
|
+
* Set a cached value
|
|
699
|
+
*/
|
|
700
|
+
set(key: string, value: T, ttlMs?: number): void;
|
|
701
|
+
/**
|
|
702
|
+
* Invalidate a specific cache entry
|
|
703
|
+
*/
|
|
704
|
+
invalidate(key: string): boolean;
|
|
705
|
+
/**
|
|
706
|
+
* Clear all cache entries
|
|
707
|
+
*/
|
|
708
|
+
clear(): void;
|
|
709
|
+
/**
|
|
710
|
+
* Get current cache size
|
|
711
|
+
*/
|
|
712
|
+
get size(): number;
|
|
713
|
+
/**
|
|
714
|
+
* Get cache hit/miss statistics
|
|
715
|
+
*/
|
|
716
|
+
getStats(): {
|
|
717
|
+
hits: number;
|
|
718
|
+
misses: number;
|
|
719
|
+
size: number;
|
|
720
|
+
};
|
|
721
|
+
/**
|
|
722
|
+
* Reset statistics
|
|
723
|
+
*/
|
|
724
|
+
resetStats(): void;
|
|
725
|
+
private hitCount;
|
|
726
|
+
private missCount;
|
|
727
|
+
private evictLRU;
|
|
728
|
+
private cleanupExpired;
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
declare enum MiddlewarePriority {
|
|
732
|
+
/** Executes first — security, auth, rate limiting */
|
|
733
|
+
FIRST = 0,
|
|
734
|
+
/** Executes early — validation, input transformation */
|
|
735
|
+
EARLY = 250,
|
|
736
|
+
/** Default priority */
|
|
737
|
+
NORMAL = 500,
|
|
738
|
+
/** Executes late — logging, metrics */
|
|
739
|
+
LATE = 750,
|
|
740
|
+
/** Executes last — cleanup, final telemetry */
|
|
741
|
+
LAST = 1000
|
|
742
|
+
}
|
|
743
|
+
interface MiddlewareContext {
|
|
744
|
+
readonly sessionId: string;
|
|
745
|
+
readonly agentName?: string;
|
|
746
|
+
readonly timestamp: number;
|
|
747
|
+
/** Mutable metadata bag — each middleware can read/write entries */
|
|
748
|
+
readonly metadata: Record<string, unknown>;
|
|
749
|
+
}
|
|
750
|
+
interface BeforeAgentParams {
|
|
751
|
+
prompt: string;
|
|
752
|
+
instructions: string;
|
|
753
|
+
tools: Record<string, Tool<any, any>>;
|
|
754
|
+
}
|
|
755
|
+
interface BeforeAgentResult {
|
|
756
|
+
/** Modified prompt (optional — original used if omitted) */
|
|
757
|
+
prompt?: string;
|
|
758
|
+
/** Modified instructions (optional) */
|
|
759
|
+
instructions?: string;
|
|
760
|
+
/** Additional tools to inject (merged with existing) */
|
|
761
|
+
tools?: Record<string, Tool<any, any>>;
|
|
762
|
+
/** If true, skip agent execution entirely and use `earlyResult` */
|
|
763
|
+
abort?: boolean;
|
|
764
|
+
/** Result to return when `abort` is true */
|
|
765
|
+
earlyResult?: string;
|
|
766
|
+
}
|
|
767
|
+
interface AfterAgentParams {
|
|
768
|
+
prompt: string;
|
|
769
|
+
result: {
|
|
770
|
+
text: string;
|
|
771
|
+
steps: unknown[];
|
|
772
|
+
sessionId: string;
|
|
773
|
+
};
|
|
774
|
+
}
|
|
775
|
+
interface AfterAgentResult {
|
|
776
|
+
/** Modified result text (optional) */
|
|
777
|
+
text?: string;
|
|
778
|
+
}
|
|
779
|
+
interface BeforeToolCallParams {
|
|
780
|
+
toolName: string;
|
|
781
|
+
args: unknown;
|
|
782
|
+
stepIndex: number;
|
|
783
|
+
}
|
|
784
|
+
interface BeforeToolCallResult {
|
|
785
|
+
/** Modified args (optional) */
|
|
786
|
+
args?: unknown;
|
|
787
|
+
/** If true, skip this tool call and use `mockResult` */
|
|
788
|
+
skip?: boolean;
|
|
789
|
+
/** Result to return when `skip` is true */
|
|
790
|
+
mockResult?: unknown;
|
|
791
|
+
}
|
|
792
|
+
interface AfterToolCallParams {
|
|
793
|
+
toolName: string;
|
|
794
|
+
args: unknown;
|
|
795
|
+
result: unknown;
|
|
796
|
+
stepIndex: number;
|
|
797
|
+
durationMs: number;
|
|
798
|
+
}
|
|
799
|
+
interface AfterToolCallResult {
|
|
800
|
+
/** Modified result (optional) */
|
|
801
|
+
result?: unknown;
|
|
802
|
+
}
|
|
803
|
+
interface OnMiddlewareErrorParams {
|
|
804
|
+
error: unknown;
|
|
805
|
+
phase: "beforeAgent" | "afterAgent" | "beforeTool" | "afterTool";
|
|
806
|
+
middlewareName: string;
|
|
807
|
+
}
|
|
808
|
+
interface OnMiddlewareErrorResult {
|
|
809
|
+
/** If true, suppress the error and continue the chain */
|
|
810
|
+
suppress?: boolean;
|
|
811
|
+
/** Fallback result to use when suppressing */
|
|
812
|
+
fallbackResult?: unknown;
|
|
813
|
+
}
|
|
814
|
+
interface MiddlewarePort {
|
|
815
|
+
/** Unique name for this middleware */
|
|
816
|
+
readonly name: string;
|
|
817
|
+
/** Execution priority — lower values execute first */
|
|
818
|
+
readonly priority: MiddlewarePriority;
|
|
819
|
+
/** Called before agent execution starts */
|
|
820
|
+
beforeAgent?(ctx: MiddlewareContext, params: BeforeAgentParams): Promise<BeforeAgentResult | void> | BeforeAgentResult | void;
|
|
821
|
+
/** Called after agent execution completes */
|
|
822
|
+
afterAgent?(ctx: MiddlewareContext, params: AfterAgentParams): Promise<AfterAgentResult | void> | AfterAgentResult | void;
|
|
823
|
+
/** Called before each tool invocation */
|
|
824
|
+
beforeTool?(ctx: MiddlewareContext, params: BeforeToolCallParams): Promise<BeforeToolCallResult | void> | BeforeToolCallResult | void;
|
|
825
|
+
/** Called after each tool invocation */
|
|
826
|
+
afterTool?(ctx: MiddlewareContext, params: AfterToolCallParams): Promise<AfterToolCallResult | void> | AfterToolCallResult | void;
|
|
827
|
+
/** Called when an error occurs in this or another middleware */
|
|
828
|
+
onError?(ctx: MiddlewareContext, params: OnMiddlewareErrorParams): Promise<OnMiddlewareErrorResult | void> | OnMiddlewareErrorResult | void;
|
|
829
|
+
/** Called once during agent initialization */
|
|
830
|
+
setup?(ctx: MiddlewareContext): Promise<void> | void;
|
|
831
|
+
/** Called once during agent shutdown */
|
|
832
|
+
teardown?(ctx: MiddlewareContext): Promise<void> | void;
|
|
833
|
+
}
|
|
834
|
+
interface BeforeAgentChainResult extends BeforeAgentParams {
|
|
835
|
+
/** If true, agent execution should be skipped and `earlyResult` returned */
|
|
836
|
+
aborted?: boolean;
|
|
837
|
+
/** Text to return when aborted */
|
|
838
|
+
earlyResult?: string;
|
|
839
|
+
}
|
|
840
|
+
interface MiddlewareChainPort {
|
|
841
|
+
/** Add a middleware to the chain */
|
|
842
|
+
use(middleware: MiddlewarePort): void;
|
|
843
|
+
/** Remove a middleware by name */
|
|
844
|
+
remove(name: string): boolean;
|
|
845
|
+
/** Get all registered middleware (sorted by priority) */
|
|
846
|
+
list(): readonly MiddlewarePort[];
|
|
847
|
+
/** Execute beforeAgent hooks in priority order */
|
|
848
|
+
runBeforeAgent(ctx: MiddlewareContext, params: BeforeAgentParams): Promise<BeforeAgentChainResult>;
|
|
849
|
+
/** Execute afterAgent hooks in reverse priority order */
|
|
850
|
+
runAfterAgent(ctx: MiddlewareContext, params: AfterAgentParams): Promise<AfterAgentParams>;
|
|
851
|
+
/** Execute beforeTool hooks in priority order */
|
|
852
|
+
runBeforeTool(ctx: MiddlewareContext, params: BeforeToolCallParams): Promise<BeforeToolCallResult>;
|
|
853
|
+
/** Execute afterTool hooks in reverse priority order */
|
|
854
|
+
runAfterTool(ctx: MiddlewareContext, params: AfterToolCallParams): Promise<AfterToolCallParams>;
|
|
855
|
+
/** Initialize all middleware */
|
|
856
|
+
setup(ctx: MiddlewareContext): Promise<void>;
|
|
857
|
+
/** Teardown all middleware */
|
|
858
|
+
teardown(ctx: MiddlewareContext): Promise<void>;
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
type EventKey = AgentEventType | "*";
|
|
862
|
+
/**
|
|
863
|
+
* Portable event bus for agent lifecycle events.
|
|
864
|
+
* Supports typed subscriptions, wildcard listeners, auto-filled metadata,
|
|
865
|
+
* hierarchical parent/child relationships, bubbling, capturing, and anti-storm protection.
|
|
866
|
+
*/
|
|
867
|
+
interface EventBusOptions {
|
|
868
|
+
/** Maximum listeners allowed per event type (default: 100). */
|
|
869
|
+
maxListenersPerEvent?: number;
|
|
870
|
+
/** Maximum bubbled events per second from a single child (default: 100). */
|
|
871
|
+
maxBubblesPerSecond?: number;
|
|
872
|
+
}
|
|
873
|
+
declare class EventBus {
|
|
874
|
+
private readonly sessionId;
|
|
875
|
+
private readonly listeners;
|
|
876
|
+
private readonly maxListenersPerEvent;
|
|
877
|
+
private readonly maxBubblesPerSecond;
|
|
878
|
+
private parent;
|
|
879
|
+
private readonly children;
|
|
880
|
+
private namespace;
|
|
881
|
+
private readonly namespacedListeners;
|
|
882
|
+
private readonly bubbleCounts;
|
|
883
|
+
constructor(sessionId: string, options?: EventBusOptions);
|
|
884
|
+
/** Subscribe to a specific event type or '*' for all events. Returns unsubscribe fn. */
|
|
885
|
+
on(eventType: EventKey, handler: AgentEventHandler): () => void;
|
|
886
|
+
/** Unsubscribe a handler from a specific event type. */
|
|
887
|
+
off(eventType: EventKey, handler: AgentEventHandler): void;
|
|
888
|
+
/** Emit an event, auto-filling timestamp and sessionId. Also bubbles to parent. */
|
|
889
|
+
emit(type: AgentEventType, data?: unknown): void;
|
|
890
|
+
/** Remove all listeners for a given event type, or all listeners if no type specified. */
|
|
891
|
+
removeAllListeners(eventType?: EventKey): void;
|
|
892
|
+
/** Return the number of listeners for a given event type. */
|
|
893
|
+
listenerCount(eventType: EventKey): number;
|
|
894
|
+
/** Create a child bus with a given namespace. */
|
|
895
|
+
createChild(childNamespace: string): EventBus;
|
|
896
|
+
/** Broadcast an event from this bus to ALL children recursively (capturing phase). */
|
|
897
|
+
broadcast(type: AgentEventType, data?: unknown): void;
|
|
898
|
+
/** Subscribe to events bubbled from a specific child namespace. */
|
|
899
|
+
onNamespaced(childNamespace: string, handler: AgentEventHandler): () => void;
|
|
900
|
+
/** Get all child buses. */
|
|
901
|
+
getChildren(): Map<string, EventBus>;
|
|
902
|
+
/** Get the parent bus, or null for root. */
|
|
903
|
+
getParent(): EventBus | null;
|
|
904
|
+
/** Dispatch an event to local listeners (specific + wildcard). */
|
|
905
|
+
private dispatchLocal;
|
|
906
|
+
/** Bubble an event to the parent bus with _source and _bubbled metadata. */
|
|
907
|
+
private bubbleToParent;
|
|
908
|
+
/** Check if a child is within the allowed bubble rate. Returns true if allowed. */
|
|
909
|
+
private checkBubbleRate;
|
|
910
|
+
}
|
|
911
|
+
|
|
912
|
+
interface AgentResult<TOutput = unknown> {
|
|
913
|
+
text: string;
|
|
914
|
+
steps: unknown[];
|
|
915
|
+
sessionId: string;
|
|
916
|
+
/** Parsed structured output when `output` is configured via builder or run options. */
|
|
917
|
+
output?: TOutput;
|
|
918
|
+
/** Tool calls extracted from all steps. */
|
|
919
|
+
toolCalls: Array<{
|
|
920
|
+
name: string;
|
|
921
|
+
args?: unknown;
|
|
922
|
+
stepIndex: number;
|
|
923
|
+
}>;
|
|
924
|
+
}
|
|
925
|
+
interface AgentRunOptions {
|
|
926
|
+
pluginMetadata?: PluginRunMetadata;
|
|
927
|
+
mcpToolset?: McpToolsetSelection;
|
|
928
|
+
policyContext?: PolicyContext;
|
|
929
|
+
}
|
|
930
|
+
|
|
931
|
+
interface AgentInternalConfig {
|
|
932
|
+
model: LanguageModel;
|
|
933
|
+
instructions: string;
|
|
934
|
+
id?: string;
|
|
935
|
+
name?: string;
|
|
936
|
+
maxSteps: number;
|
|
937
|
+
fs: FilesystemPort;
|
|
938
|
+
memory: MemoryPort;
|
|
939
|
+
tokenCounter: TokenCounterPort;
|
|
940
|
+
mcp?: McpPort;
|
|
941
|
+
policyEngine?: PolicyEnginePort;
|
|
942
|
+
runtime?: RuntimePort;
|
|
943
|
+
learning?: LearningPort;
|
|
944
|
+
userId?: string;
|
|
945
|
+
planning: boolean;
|
|
946
|
+
subagents: boolean;
|
|
947
|
+
subagentConfig?: Partial<SubagentConfig>;
|
|
948
|
+
approvalConfig?: Required<ApprovalConfig>;
|
|
949
|
+
checkpointConfig?: Required<CheckpointConfig>;
|
|
950
|
+
extraTools?: Record<string, Tool<any, any>>;
|
|
951
|
+
plugins?: Plugin[];
|
|
952
|
+
costTracker?: CostTrackerPort;
|
|
953
|
+
circuitBreaker?: CircuitBreaker;
|
|
954
|
+
rateLimiter?: RateLimiter;
|
|
955
|
+
toolCache?: ToolCache;
|
|
956
|
+
lifecycleHooks?: LifecycleHooks;
|
|
957
|
+
telemetry?: TelemetryPort;
|
|
958
|
+
/** AI SDK Output specification for structured output (passthrough to ToolLoopAgent). */
|
|
959
|
+
output?: any;
|
|
960
|
+
/** Middleware stack — composable, priority-ordered hooks */
|
|
961
|
+
middleware?: MiddlewarePort[];
|
|
962
|
+
}
|
|
963
|
+
declare class Agent {
|
|
964
|
+
readonly sessionId: string;
|
|
965
|
+
readonly eventBus: EventBus;
|
|
966
|
+
private readonly config;
|
|
967
|
+
private _runtime;
|
|
968
|
+
private _runtimePromise;
|
|
969
|
+
private readonly tokenTracker;
|
|
970
|
+
private readonly pluginManager;
|
|
971
|
+
private readonly middlewareChain;
|
|
972
|
+
private _toolManager?;
|
|
973
|
+
private _executionEngine?;
|
|
974
|
+
private readonly lifecycleManager;
|
|
975
|
+
private readonly circuitBreaker?;
|
|
976
|
+
private readonly rateLimiter?;
|
|
977
|
+
private readonly toolCache?;
|
|
978
|
+
private readonly telemetry?;
|
|
979
|
+
constructor(config: AgentInternalConfig);
|
|
980
|
+
private get toolManager();
|
|
981
|
+
private get executionEngine();
|
|
982
|
+
/** Lazy-initialized runtime adapter. Resolves on first use. */
|
|
983
|
+
private ensureRuntime;
|
|
984
|
+
static create(config: AgentConfig): AgentBuilder;
|
|
985
|
+
static minimal(config: AgentConfig): Agent;
|
|
986
|
+
static full(config: AgentConfig & {
|
|
987
|
+
memory?: MemoryPort;
|
|
988
|
+
mcp?: McpPort;
|
|
989
|
+
tokenCounter?: TokenCounterPort;
|
|
990
|
+
}): Agent;
|
|
991
|
+
/**
|
|
992
|
+
* Auto-configuring factory that works in any runtime.
|
|
993
|
+
* Uses universal adapters (VirtualFilesystem, InMemoryAdapter, ApproximateTokenCounter)
|
|
994
|
+
* that require zero platform-specific APIs.
|
|
995
|
+
*
|
|
996
|
+
* For runtime-specific adapters (LocalFilesystem, DenoFilesystem, OpfsFilesystem, etc.),
|
|
997
|
+
* use `Agent.create()` and compose manually.
|
|
998
|
+
*/
|
|
999
|
+
static auto(config: AgentConfig): Agent;
|
|
1000
|
+
startup(): Promise<void>;
|
|
1001
|
+
shutdown(): Promise<void>;
|
|
1002
|
+
healthCheck(): Promise<HealthStatus>;
|
|
1003
|
+
get isReady(): boolean;
|
|
1004
|
+
get isShuttingDown(): boolean;
|
|
1005
|
+
run(prompt: string, options?: AgentRunOptions): Promise<AgentResult>;
|
|
1006
|
+
stream(params: {
|
|
1007
|
+
messages: Array<{
|
|
1008
|
+
role: string;
|
|
1009
|
+
content: unknown;
|
|
1010
|
+
}>;
|
|
1011
|
+
}, options?: AgentRunOptions): Promise<any>;
|
|
1012
|
+
dispose(): Promise<void>;
|
|
1013
|
+
}
|
|
1014
|
+
|
|
1015
|
+
declare class AgentBuilder extends AbstractBuilder<Agent> {
|
|
1016
|
+
private readonly agentConfig;
|
|
1017
|
+
private maxStepsOverride?;
|
|
1018
|
+
private fs?;
|
|
1019
|
+
private memory?;
|
|
1020
|
+
private learning?;
|
|
1021
|
+
private userId?;
|
|
1022
|
+
private tokenCounter?;
|
|
1023
|
+
private mcp?;
|
|
1024
|
+
private policyEngine?;
|
|
1025
|
+
private runtime?;
|
|
1026
|
+
private costTracker?;
|
|
1027
|
+
private planning;
|
|
1028
|
+
private subagents;
|
|
1029
|
+
private subagentConfig?;
|
|
1030
|
+
private approvalConfig?;
|
|
1031
|
+
private circuitBreaker?;
|
|
1032
|
+
private rateLimiter?;
|
|
1033
|
+
private toolCache?;
|
|
1034
|
+
private telemetryAdapter?;
|
|
1035
|
+
private extraTools;
|
|
1036
|
+
private readonly plugins;
|
|
1037
|
+
private lifecycleHooks?;
|
|
1038
|
+
private readonly eventHandlers;
|
|
1039
|
+
/** AI SDK Output specification (e.g. Output.object({schema})) */
|
|
1040
|
+
private outputSpec?;
|
|
1041
|
+
constructor(config: AgentConfig);
|
|
1042
|
+
withFilesystem(fs: FilesystemPort): this;
|
|
1043
|
+
withMemory(memory: MemoryPort): this;
|
|
1044
|
+
withLearning(learning: LearningPort, userId?: string): this;
|
|
1045
|
+
withTokenCounter(counter: TokenCounterPort): this;
|
|
1046
|
+
withMcp(mcp: McpPort): this;
|
|
1047
|
+
withPolicyEngine(policyEngine: PolicyEnginePort): this;
|
|
1048
|
+
withRuntime(runtime: RuntimePort): this;
|
|
1049
|
+
withCostTracker(tracker: CostTrackerPort): this;
|
|
1050
|
+
withPlanning(): this;
|
|
1051
|
+
withSubagents(config?: Partial<SubagentConfig>): this;
|
|
1052
|
+
withApproval(config?: Partial<ApprovalConfig>): this;
|
|
1053
|
+
withMaxSteps(steps: number): this;
|
|
1054
|
+
withCircuitBreaker(config?: Partial<CircuitBreakerConfig>): this;
|
|
1055
|
+
withRateLimiter(config?: Partial<RateLimiterConfig>): this;
|
|
1056
|
+
withToolCache(config?: Partial<ToolCacheConfig>): this;
|
|
1057
|
+
withTools(tools: Record<string, Tool<any, any>>): this;
|
|
1058
|
+
withTool(name: string, tool: Tool): this;
|
|
1059
|
+
withPlugin(plugin: Plugin): this;
|
|
1060
|
+
on(type: AgentEventType | "*", handler: AgentEventHandler): this;
|
|
1061
|
+
withLifecycle(hooks: LifecycleHooks): this;
|
|
1062
|
+
withTelemetry(adapter: TelemetryPort): this;
|
|
1063
|
+
/**
|
|
1064
|
+
* Set structured output specification (AI SDK passthrough).
|
|
1065
|
+
* Usage: `.withOutput(Output.object({ schema: z.object({...}) }))`
|
|
1066
|
+
*/
|
|
1067
|
+
withOutput(output: any): this;
|
|
1068
|
+
withInstructions(instructions: string): this;
|
|
1069
|
+
withInstructions(template: PromptTemplate, variables?: Record<string, string>): this;
|
|
1070
|
+
protected validate(): void;
|
|
1071
|
+
protected construct(): Agent;
|
|
1072
|
+
build(): Agent;
|
|
1073
|
+
}
|
|
1074
|
+
|
|
1075
|
+
export { type BeforeStepParams as $, AbstractBuilder as A, type BeforeAgentParams as B, CircuitBreaker as C, type McpToolResult as D, EventBus as E, type McpToolDefinition as F, type McpServerInfo as G, type McpServerConfig as H, type TelemetrySpan as I, type CostTokenUsage as J, type CostEstimate as K, type LearningPort as L, type MemoryPort as M, Agent as N, type AfterToolCallResult as O, type PluginRunMetadata as P, type OnMiddlewareErrorParams as Q, RateLimiter as R, type SharedKnowledgeInput as S, type TelemetryPort as T, type UserProfile as U, type OnMiddlewareErrorResult as V, type AfterRunParams as W, type AfterStepParams as X, type AfterToolParams as Y, type BeforeRunParams as Z, type BeforeRunResult as _, AgentBuilder as a, type BeforeStepResult as a0, type BeforeToolParams as a1, type BeforeToolResult as a2, CheckpointSchema as a3, type HealthStatus as a4, type LifecycleHooks as a5, LifecycleManager as a6, type McpToolResultContent as a7, type OnErrorParams as a8, type OnErrorResult as a9, type PluginSetupContext as aa, PromptTemplate as ab, type PromptTemplateConfig as ac, SharedKnowledgeSchema as ad, type TodoList as ae, TodoListSchema as af, TodoSchema as ag, type TodoStatus as ah, TodoStatusSchema as ai, type UpdateTodoInput as aj, UpdateTodoInputSchema as ak, UserMemorySchema as al, UserProfileSchema as am, type WriteTodosInput as an, WriteTodosInputSchema as ao, type McpPort as b, ToolCache as c, type RuntimePort as d, type PluginContext as e, type MiddlewareChainPort as f, type MiddlewarePort as g, type MiddlewareContext as h, type BeforeAgentChainResult as i, type AfterAgentParams as j, type BeforeToolCallParams as k, type BeforeToolCallResult as l, type AfterToolCallParams as m, type CostTrackerPort as n, type AgentRunOptions as o, type AgentResult as p, type Plugin as q, type PluginHooks as r, MiddlewarePriority as s, type BeforeAgentResult as t, type AfterAgentResult as u, type Todo as v, type Checkpoint as w, type UserMemoryInput as x, type UserMemory as y, type SharedKnowledge as z };
|