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.
Files changed (232) hide show
  1. package/CHANGELOG.md +489 -0
  2. package/LICENSE +21 -0
  3. package/README.md +269 -0
  4. package/dist/a2a/index.cjs +7 -0
  5. package/dist/a2a/index.cjs.map +1 -0
  6. package/dist/a2a/index.d.cts +30 -0
  7. package/dist/a2a/index.d.ts +30 -0
  8. package/dist/a2a/index.js +7 -0
  9. package/dist/a2a/index.js.map +1 -0
  10. package/dist/agent-UIQDSYCE.js +16 -0
  11. package/dist/agent-UIQDSYCE.js.map +1 -0
  12. package/dist/agent-builder-8W3mBR-N.d.ts +1075 -0
  13. package/dist/agent-builder-GEMYdb1p.d.cts +1075 -0
  14. package/dist/agent-graph-AMQYAWNF.js +1422 -0
  15. package/dist/agent-graph-AMQYAWNF.js.map +1 -0
  16. package/dist/ai-sdk-mcp.adapter-SEN6KHNU.js +124 -0
  17. package/dist/ai-sdk-mcp.adapter-SEN6KHNU.js.map +1 -0
  18. package/dist/browser/index.js +10 -0
  19. package/dist/browser/index.js.map +1 -0
  20. package/dist/bun-runtime.adapter-MQDAJLQM.js +8 -0
  21. package/dist/bun-runtime.adapter-MQDAJLQM.js.map +1 -0
  22. package/dist/bun-runtime.adapter-XKOUXVAK.cjs +8 -0
  23. package/dist/bun-runtime.adapter-XKOUXVAK.cjs.map +1 -0
  24. package/dist/chat-A3XMRPJL.js +129 -0
  25. package/dist/chat-A3XMRPJL.js.map +1 -0
  26. package/dist/chunk-2ZRU47NC.js +91 -0
  27. package/dist/chunk-2ZRU47NC.js.map +1 -0
  28. package/dist/chunk-3LD3JTH4.cjs +18 -0
  29. package/dist/chunk-3LD3JTH4.cjs.map +1 -0
  30. package/dist/chunk-5FE5TG2W.cjs +16 -0
  31. package/dist/chunk-5FE5TG2W.cjs.map +1 -0
  32. package/dist/chunk-6XF673YC.cjs +436 -0
  33. package/dist/chunk-6XF673YC.cjs.map +1 -0
  34. package/dist/chunk-7CKWZJNS.js +230 -0
  35. package/dist/chunk-7CKWZJNS.js.map +1 -0
  36. package/dist/chunk-BI2G665F.js +4588 -0
  37. package/dist/chunk-BI2G665F.js.map +1 -0
  38. package/dist/chunk-C5NLWJS2.js +139 -0
  39. package/dist/chunk-C5NLWJS2.js.map +1 -0
  40. package/dist/chunk-CJZ66SU3.cjs +4321 -0
  41. package/dist/chunk-CJZ66SU3.cjs.map +1 -0
  42. package/dist/chunk-DAMT2CXW.cjs +91 -0
  43. package/dist/chunk-DAMT2CXW.cjs.map +1 -0
  44. package/dist/chunk-E7WG3MO5.js +18 -0
  45. package/dist/chunk-E7WG3MO5.js.map +1 -0
  46. package/dist/chunk-EFDM6R4J.js +99 -0
  47. package/dist/chunk-EFDM6R4J.js.map +1 -0
  48. package/dist/chunk-F7WIPPEO.js +256 -0
  49. package/dist/chunk-F7WIPPEO.js.map +1 -0
  50. package/dist/chunk-FAYDE67N.js +6927 -0
  51. package/dist/chunk-FAYDE67N.js.map +1 -0
  52. package/dist/chunk-GAE2KKCM.js +21 -0
  53. package/dist/chunk-GAE2KKCM.js.map +1 -0
  54. package/dist/chunk-INLNGRXM.cjs +130 -0
  55. package/dist/chunk-INLNGRXM.cjs.map +1 -0
  56. package/dist/chunk-JKXKXB5O.js +130 -0
  57. package/dist/chunk-JKXKXB5O.js.map +1 -0
  58. package/dist/chunk-K6SAETGP.js +375 -0
  59. package/dist/chunk-K6SAETGP.js.map +1 -0
  60. package/dist/chunk-KEASLAYR.js +157 -0
  61. package/dist/chunk-KEASLAYR.js.map +1 -0
  62. package/dist/chunk-KKJVNM6O.js +436 -0
  63. package/dist/chunk-KKJVNM6O.js.map +1 -0
  64. package/dist/chunk-KYIMVRIM.js +16 -0
  65. package/dist/chunk-KYIMVRIM.js.map +1 -0
  66. package/dist/chunk-MB7NXIZD.js +4321 -0
  67. package/dist/chunk-MB7NXIZD.js.map +1 -0
  68. package/dist/chunk-MHHDXPGE.js +209 -0
  69. package/dist/chunk-MHHDXPGE.js.map +1 -0
  70. package/dist/chunk-NE6JJA5W.js +401 -0
  71. package/dist/chunk-NE6JJA5W.js.map +1 -0
  72. package/dist/chunk-PF46XZBF.cjs +6927 -0
  73. package/dist/chunk-PF46XZBF.cjs.map +1 -0
  74. package/dist/chunk-PSJIAGDE.cjs +375 -0
  75. package/dist/chunk-PSJIAGDE.cjs.map +1 -0
  76. package/dist/chunk-PWOQDXNQ.js +16 -0
  77. package/dist/chunk-PWOQDXNQ.js.map +1 -0
  78. package/dist/chunk-QYOMQBBZ.cjs +230 -0
  79. package/dist/chunk-QYOMQBBZ.cjs.map +1 -0
  80. package/dist/chunk-UDFXLC4J.cjs +16 -0
  81. package/dist/chunk-UDFXLC4J.cjs.map +1 -0
  82. package/dist/chunk-UO4NGXRT.cjs +259 -0
  83. package/dist/chunk-UO4NGXRT.cjs.map +1 -0
  84. package/dist/chunk-UPFDFLEW.js +40 -0
  85. package/dist/chunk-UPFDFLEW.js.map +1 -0
  86. package/dist/chunk-V55JSQS7.cjs +16 -0
  87. package/dist/chunk-V55JSQS7.cjs.map +1 -0
  88. package/dist/chunk-VJADHXZL.cjs +16 -0
  89. package/dist/chunk-VJADHXZL.cjs.map +1 -0
  90. package/dist/chunk-VRWD7LCI.js +59 -0
  91. package/dist/chunk-VRWD7LCI.js.map +1 -0
  92. package/dist/chunk-WKKQ443C.js +487 -0
  93. package/dist/chunk-WKKQ443C.js.map +1 -0
  94. package/dist/chunk-X2GHUHAF.js +436 -0
  95. package/dist/chunk-X2GHUHAF.js.map +1 -0
  96. package/dist/chunk-XLGW3XNI.cjs +256 -0
  97. package/dist/chunk-XLGW3XNI.cjs.map +1 -0
  98. package/dist/chunk-ZFJKX4DP.js +16 -0
  99. package/dist/chunk-ZFJKX4DP.js.map +1 -0
  100. package/dist/chunk-ZM2OEWM2.js +259 -0
  101. package/dist/chunk-ZM2OEWM2.js.map +1 -0
  102. package/dist/chunk-ZNAIP2XV.js +16 -0
  103. package/dist/chunk-ZNAIP2XV.js.map +1 -0
  104. package/dist/chunk-ZYFAZYSL.js +42 -0
  105. package/dist/chunk-ZYFAZYSL.js.map +1 -0
  106. package/dist/cli/index.js +421 -0
  107. package/dist/cli/index.js.map +1 -0
  108. package/dist/config-4MHT6TQW.js +153 -0
  109. package/dist/config-4MHT6TQW.js.map +1 -0
  110. package/dist/config-REERQFK4.cjs +153 -0
  111. package/dist/config-REERQFK4.cjs.map +1 -0
  112. package/dist/cost-tracker-JLOU7IZJ.js +7 -0
  113. package/dist/cost-tracker-JLOU7IZJ.js.map +1 -0
  114. package/dist/demo-C52GMSYH.js +188 -0
  115. package/dist/demo-C52GMSYH.js.map +1 -0
  116. package/dist/deno/index.js +306 -0
  117. package/dist/deno/index.js.map +1 -0
  118. package/dist/deno-runtime.adapter-F744HY7K.js +8 -0
  119. package/dist/deno-runtime.adapter-F744HY7K.js.map +1 -0
  120. package/dist/deno-runtime.adapter-RFEVNSCV.cjs +8 -0
  121. package/dist/deno-runtime.adapter-RFEVNSCV.cjs.map +1 -0
  122. package/dist/dev-D7DDVDA4.js +218 -0
  123. package/dist/dev-D7DDVDA4.js.map +1 -0
  124. package/dist/edge/index.js +10 -0
  125. package/dist/edge/index.js.map +1 -0
  126. package/dist/edge-runtime.adapter-UQCW2F7X.js +8 -0
  127. package/dist/edge-runtime.adapter-UQCW2F7X.js.map +1 -0
  128. package/dist/edge-runtime.adapter-YED6F3AY.cjs +8 -0
  129. package/dist/edge-runtime.adapter-YED6F3AY.cjs.map +1 -0
  130. package/dist/graph-MGFAQZ5W.js +50 -0
  131. package/dist/graph-MGFAQZ5W.js.map +1 -0
  132. package/dist/graph-visualization-HBSVQXJK.js +9 -0
  133. package/dist/graph-visualization-HBSVQXJK.js.map +1 -0
  134. package/dist/index-BRgqNnh3.d.cts +982 -0
  135. package/dist/index-CZxpYUxZ.d.ts +982 -0
  136. package/dist/index.cjs +14789 -0
  137. package/dist/index.cjs.map +1 -0
  138. package/dist/index.d.cts +10275 -0
  139. package/dist/index.d.ts +10275 -0
  140. package/dist/index.js +14789 -0
  141. package/dist/index.js.map +1 -0
  142. package/dist/init-CFWXTQ35.js +133 -0
  143. package/dist/init-CFWXTQ35.js.map +1 -0
  144. package/dist/llm-VWO4MC7J.cjs +17 -0
  145. package/dist/llm-VWO4MC7J.cjs.map +1 -0
  146. package/dist/llm-XLXVSPBI.js +17 -0
  147. package/dist/llm-XLXVSPBI.js.map +1 -0
  148. package/dist/logging-WRAK5ZXT.js +33 -0
  149. package/dist/logging-WRAK5ZXT.js.map +1 -0
  150. package/dist/metrics-FAHZVVD4.js +47 -0
  151. package/dist/metrics-FAHZVVD4.js.map +1 -0
  152. package/dist/node/index.cjs +280 -0
  153. package/dist/node/index.cjs.map +1 -0
  154. package/dist/node/index.d.cts +51 -0
  155. package/dist/node/index.d.ts +51 -0
  156. package/dist/node/index.js +280 -0
  157. package/dist/node/index.js.map +1 -0
  158. package/dist/node-runtime.adapter-5L7PJ6W2.js +8 -0
  159. package/dist/node-runtime.adapter-5L7PJ6W2.js.map +1 -0
  160. package/dist/node-runtime.adapter-CCRZVGHB.cjs +8 -0
  161. package/dist/node-runtime.adapter-CCRZVGHB.cjs.map +1 -0
  162. package/dist/persist-usage-WTBTCWEF.js +7 -0
  163. package/dist/persist-usage-WTBTCWEF.js.map +1 -0
  164. package/dist/plugin-RCPBWUUA.js +207 -0
  165. package/dist/plugin-RCPBWUUA.js.map +1 -0
  166. package/dist/plugins/index.cjs +75 -0
  167. package/dist/plugins/index.cjs.map +1 -0
  168. package/dist/plugins/index.d.cts +8 -0
  169. package/dist/plugins/index.d.ts +8 -0
  170. package/dist/plugins/index.js +75 -0
  171. package/dist/plugins/index.js.map +1 -0
  172. package/dist/plugins-L4ING3CX.js +4625 -0
  173. package/dist/plugins-L4ING3CX.js.map +1 -0
  174. package/dist/providers/index.cjs +189 -0
  175. package/dist/providers/index.cjs.map +1 -0
  176. package/dist/providers/index.d.cts +168 -0
  177. package/dist/providers/index.d.ts +168 -0
  178. package/dist/providers/index.js +189 -0
  179. package/dist/providers/index.js.map +1 -0
  180. package/dist/providers-3RNQ5CKZ.js +59 -0
  181. package/dist/providers-3RNQ5CKZ.js.map +1 -0
  182. package/dist/providers-66GPXUGQ.cjs +59 -0
  183. package/dist/providers-66GPXUGQ.cjs.map +1 -0
  184. package/dist/repl-K6QN4I2S.js +678 -0
  185. package/dist/repl-K6QN4I2S.js.map +1 -0
  186. package/dist/rest/index.cjs +17 -0
  187. package/dist/rest/index.cjs.map +1 -0
  188. package/dist/rest/index.d.cts +102 -0
  189. package/dist/rest/index.d.ts +102 -0
  190. package/dist/rest/index.js +17 -0
  191. package/dist/rest/index.js.map +1 -0
  192. package/dist/runtime-deno.js +15 -0
  193. package/dist/runtime-deno.js.map +1 -0
  194. package/dist/runtime-edge.js +15 -0
  195. package/dist/runtime-edge.js.map +1 -0
  196. package/dist/runtime-node.js +15 -0
  197. package/dist/runtime-node.js.map +1 -0
  198. package/dist/scraping/index.cjs +11 -0
  199. package/dist/scraping/index.cjs.map +1 -0
  200. package/dist/scraping/index.d.cts +17 -0
  201. package/dist/scraping/index.d.ts +17 -0
  202. package/dist/scraping/index.js +11 -0
  203. package/dist/scraping/index.js.map +1 -0
  204. package/dist/semantic-scraping.port-CZWUea88.d.cts +54 -0
  205. package/dist/semantic-scraping.port-CZWUea88.d.ts +54 -0
  206. package/dist/server/index.js +166 -0
  207. package/dist/server/index.js.map +1 -0
  208. package/dist/testing/index.cjs +25 -0
  209. package/dist/testing/index.cjs.map +1 -0
  210. package/dist/testing/index.d.cts +63 -0
  211. package/dist/testing/index.d.ts +63 -0
  212. package/dist/testing/index.js +25 -0
  213. package/dist/testing/index.js.map +1 -0
  214. package/dist/token-counter.port-CRgxZZGe.d.ts +334 -0
  215. package/dist/token-counter.port-D7BHMCRR.d.cts +334 -0
  216. package/dist/tools-BZM33OBZ.js +10 -0
  217. package/dist/tools-BZM33OBZ.js.map +1 -0
  218. package/dist/tracing-XA3TEWP4.js +48 -0
  219. package/dist/tracing-XA3TEWP4.js.map +1 -0
  220. package/dist/types-CVsP7gFI.d.cts +235 -0
  221. package/dist/types-CVsP7gFI.d.ts +235 -0
  222. package/dist/virtual-fs.adapter-BBLS-3AY.d.ts +26 -0
  223. package/dist/virtual-fs.adapter-nb0CTYOj.d.cts +26 -0
  224. package/dist/workflow/index.cjs +9 -0
  225. package/dist/workflow/index.cjs.map +1 -0
  226. package/dist/workflow/index.d.cts +62 -0
  227. package/dist/workflow/index.d.ts +62 -0
  228. package/dist/workflow/index.js +9 -0
  229. package/dist/workflow/index.js.map +1 -0
  230. package/dist/workflow.port-BaCttxrw.d.cts +153 -0
  231. package/dist/workflow.port-BaCttxrw.d.ts +153 -0
  232. package/package.json +230 -0
@@ -0,0 +1,982 @@
1
+ import { T as Tool } from './types-CVsP7gFI.cjs';
2
+ import { q as Plugin, aa as PluginSetupContext, e as PluginContext, Z as BeforeRunParams, _ as BeforeRunResult, W as AfterRunParams, a1 as BeforeToolParams, a2 as BeforeToolResult, Y as AfterToolParams, $ as BeforeStepParams, a0 as BeforeStepResult, X as AfterStepParams, a8 as OnErrorParams, a9 as OnErrorResult, r as PluginHooks, o as AgentRunOptions, p as AgentResult, T as TelemetryPort, n as CostTrackerPort, c as ToolCache, C as CircuitBreaker } from './agent-builder-GEMYdb1p.cjs';
3
+ import { a as FilesystemZone } from './token-counter.port-D7BHMCRR.cjs';
4
+ import { AgentCapability, DelegationResult } from './a2a/index.cjs';
5
+ import { ZodType, z } from 'zod';
6
+ import { d as WorkflowResult, h as WorkflowStep, W as WorkflowContext, a as WorkflowDefinition, b as WorkflowPort } from './workflow.port-BaCttxrw.cjs';
7
+ import { I as ISemanticScrapingPort } from './semantic-scraping.port-CZWUea88.cjs';
8
+
9
+ declare class PluginManager {
10
+ private readonly plugins;
11
+ private readonly subscriptions;
12
+ private initPromise?;
13
+ private disposed;
14
+ register(plugin: Plugin): void;
15
+ initialize(ctx: PluginSetupContext): Promise<void>;
16
+ private doInitialize;
17
+ private rollback;
18
+ private detachAllSubscriptions;
19
+ /** Collect all plugin tools with deterministic override protection. */
20
+ collectTools(): Record<string, Tool<any, any>>;
21
+ runBeforeRun(ctx: PluginContext, params: BeforeRunParams): Promise<BeforeRunResult>;
22
+ runAfterRun(ctx: PluginContext, params: AfterRunParams): Promise<void>;
23
+ runBeforeTool(ctx: PluginContext, params: BeforeToolParams): Promise<BeforeToolResult>;
24
+ runAfterTool(ctx: PluginContext, params: AfterToolParams): Promise<void>;
25
+ runBeforeStep(ctx: PluginContext, params: BeforeStepParams): Promise<BeforeStepResult>;
26
+ runAfterStep(ctx: PluginContext, params: AfterStepParams): Promise<void>;
27
+ runOnError(ctx: PluginContext, params: OnErrorParams): Promise<OnErrorResult>;
28
+ dispose(): Promise<void>;
29
+ get count(): number;
30
+ getPlugins(): readonly Plugin[];
31
+ }
32
+
33
+ interface McpServerPort {
34
+ /** Start the MCP server with the given options */
35
+ start(options: McpServerOptions): Promise<void>;
36
+ /** Stop the MCP server */
37
+ stop(): Promise<void>;
38
+ /** Return all registered tool definitions */
39
+ getRegisteredTools(): McpToolServerDefinition[];
40
+ }
41
+ interface McpServerOptions {
42
+ /** Server name advertised in initialize response */
43
+ name: string;
44
+ /** Server version advertised in initialize response */
45
+ version: string;
46
+ /** Transport type: stdio (line-delimited JSON-RPC) or sse (HTTP SSE) */
47
+ transport: "stdio" | "sse";
48
+ /** Port for SSE transport (default: 3100) */
49
+ port?: number;
50
+ /** Only expose tools whose names match this list */
51
+ toolFilter?: string[];
52
+ }
53
+ interface McpToolServerDefinition {
54
+ name: string;
55
+ description: string;
56
+ inputSchema: Record<string, unknown>;
57
+ }
58
+
59
+ interface ValidationResult<T = unknown> {
60
+ readonly success: boolean;
61
+ readonly data?: T;
62
+ readonly error?: string;
63
+ }
64
+ interface ValidationPort {
65
+ validate<T>(schema: unknown, data: unknown): ValidationResult<T>;
66
+ validateOrThrow<T>(schema: unknown, data: unknown): T;
67
+ }
68
+
69
+ interface ChunkOptions {
70
+ strategy: "fixed" | "sliding-window" | "semantic" | "recursive";
71
+ /** Max tokens per chunk (word-count proxy). Default: 512 */
72
+ maxTokens?: number;
73
+ /** Overlap in tokens for sliding-window strategy. Default: 50 */
74
+ overlap?: number;
75
+ /** Separators for recursive strategy. Default: ['\n\n', '\n', '. ', ' '] */
76
+ separators?: string[];
77
+ }
78
+ interface Chunk {
79
+ id: string;
80
+ text: string;
81
+ index: number;
82
+ metadata: {
83
+ startOffset: number;
84
+ endOffset: number;
85
+ tokenCount: number;
86
+ source?: string;
87
+ };
88
+ }
89
+ interface ChunkingPort {
90
+ chunk(text: string, options?: ChunkOptions): Chunk[];
91
+ }
92
+
93
+ interface SourceAttribution {
94
+ chunkId: string;
95
+ chunkIndex: number;
96
+ documentId?: string;
97
+ startOffset: number;
98
+ endOffset: number;
99
+ relevanceScore: number;
100
+ }
101
+ interface ScoredResult {
102
+ id: string;
103
+ text: string;
104
+ score: number;
105
+ source?: SourceAttribution;
106
+ }
107
+ interface ReRankingOptions {
108
+ strategy: "tfidf" | "bm25" | "mmr";
109
+ /** Lambda for MMR diversity (0 = max diversity, 1 = max relevance). Default: 0.7 */
110
+ lambda?: number;
111
+ }
112
+ interface ReRankingPort {
113
+ rerank(query: string, results: ScoredResult[], options?: ReRankingOptions): ScoredResult[];
114
+ }
115
+
116
+ declare abstract class BasePlugin implements Plugin {
117
+ abstract readonly name: string;
118
+ readonly version = "1.0.0";
119
+ readonly hooks: PluginHooks;
120
+ constructor();
121
+ protected abstract buildHooks(): PluginHooks;
122
+ }
123
+
124
+ type AgentCardSource = "manual" | "override" | "auto";
125
+ interface AgentCardSnapshot {
126
+ agentsMd: string;
127
+ skillsMd: string;
128
+ source: {
129
+ agents: AgentCardSource;
130
+ skills: AgentCardSource;
131
+ };
132
+ }
133
+ interface AgentCardProvider {
134
+ getAgentCard(): Promise<AgentCardSnapshot>;
135
+ }
136
+ interface AgentCardDocument {
137
+ title: string;
138
+ name: string;
139
+ sessionId: string;
140
+ maxSteps: number;
141
+ summary: string;
142
+ instructions: string;
143
+ tools: string[];
144
+ generatedAt: string;
145
+ }
146
+ interface SkillsDocument {
147
+ title: string;
148
+ name: string;
149
+ summary: string;
150
+ skills: string[];
151
+ generatedAt: string;
152
+ }
153
+ interface AgentCardPluginOptions {
154
+ paths?: {
155
+ agents?: string;
156
+ skills?: string;
157
+ };
158
+ readZones?: FilesystemZone[];
159
+ overrides?: {
160
+ agents?: string | Partial<AgentCardDocument>;
161
+ skills?: string | Partial<SkillsDocument>;
162
+ };
163
+ }
164
+ declare class AgentCardPlugin implements Plugin, AgentCardProvider {
165
+ readonly name = "agent-card";
166
+ readonly version = "1.0.0";
167
+ readonly tools: Record<string, Tool<any, any>>;
168
+ private readonly options;
169
+ private setupCtx?;
170
+ private latestCtx?;
171
+ readonly hooks: {
172
+ beforeRun: (ctx: PluginContext, _params: {
173
+ prompt: string;
174
+ }) => Promise<void>;
175
+ afterRun: (ctx: PluginContext, _params: {
176
+ result: {
177
+ text: string;
178
+ steps: unknown[];
179
+ sessionId: string;
180
+ };
181
+ }) => Promise<void>;
182
+ };
183
+ constructor(options?: AgentCardPluginOptions);
184
+ setup(ctx: PluginSetupContext): void;
185
+ getAgentCard(): Promise<AgentCardSnapshot>;
186
+ private resolveAgentsMarkdown;
187
+ private resolveSkillsMarkdown;
188
+ private tryReadManual;
189
+ private createAutoAgentCard;
190
+ private createAutoSkillsCard;
191
+ private mergeAgentCard;
192
+ private mergeSkillsCard;
193
+ private renderAgentCard;
194
+ private renderSkillsCard;
195
+ }
196
+ declare function createAgentCardPlugin(options?: AgentCardPluginOptions): AgentCardPlugin;
197
+
198
+ interface A2AJsonRpcRequest {
199
+ jsonrpc: "2.0";
200
+ id?: string | number | null;
201
+ method: string;
202
+ params?: unknown;
203
+ }
204
+ interface A2AJsonRpcError {
205
+ code: number;
206
+ message: string;
207
+ data?: unknown;
208
+ }
209
+ interface A2AJsonRpcResponse {
210
+ jsonrpc: "2.0";
211
+ id: string | number | null;
212
+ result?: unknown;
213
+ error?: A2AJsonRpcError;
214
+ }
215
+ type A2ATaskStatus = "queued" | "running" | "completed" | "failed" | "cancelled";
216
+ interface A2ATask {
217
+ id: string;
218
+ status: A2ATaskStatus;
219
+ prompt: string;
220
+ output?: string;
221
+ error?: string;
222
+ metadata?: Record<string, unknown>;
223
+ createdAt: string;
224
+ updatedAt: string;
225
+ completedAt?: string;
226
+ }
227
+ interface A2ATasksSendParams {
228
+ prompt: string;
229
+ taskId?: string;
230
+ metadata?: Record<string, unknown>;
231
+ }
232
+ interface A2ATaskEvent {
233
+ type: 'task:queued' | 'task:running' | 'task:completed' | 'task:failed' | 'task:cancelled';
234
+ taskId: string;
235
+ task: A2ATask;
236
+ timestamp: string;
237
+ }
238
+ type TaskEventListener = (event: A2ATaskEvent) => void;
239
+ interface A2ARequestHandlers {
240
+ sendTask(params: A2ATasksSendParams): Promise<A2ATask>;
241
+ getTask(taskId: string): Promise<A2ATask | null>;
242
+ listTasks?(): Promise<A2ATask[]>;
243
+ cancelTask?(taskId: string): Promise<A2ATask | null>;
244
+ getAgentCard?(): Promise<unknown>;
245
+ sendTaskSubscribe?(params: A2ATasksSendParams): AsyncIterable<A2ATaskEvent>;
246
+ }
247
+ declare function createA2AJsonRpcHandler(handlers: A2ARequestHandlers): (request: A2AJsonRpcRequest) => Promise<A2AJsonRpcResponse>;
248
+ declare function createA2AHttpHandler(jsonRpcHandler: (request: A2AJsonRpcRequest) => Promise<A2AJsonRpcResponse>, sseHandlers?: {
249
+ sendTaskSubscribe?: (params: A2ATasksSendParams) => AsyncIterable<A2ATaskEvent>;
250
+ }): (request: Request) => Promise<Response>;
251
+ declare function createA2ASseHandler(handlers: Pick<A2ARequestHandlers, 'sendTaskSubscribe'>): (params: A2ATasksSendParams) => AsyncIterable<A2ATaskEvent>;
252
+
253
+ interface PushNotificationConfig {
254
+ url: string;
255
+ headers?: Record<string, string>;
256
+ events?: A2ATaskEvent['type'][];
257
+ }
258
+ declare class A2APushNotifier {
259
+ private readonly subscriptions;
260
+ private readonly fetchImpl;
261
+ constructor(fetchImpl?: typeof fetch);
262
+ private static readonly BLOCKED_HEADERS;
263
+ private static readonly LOCAL_HOSTS;
264
+ subscribe(taskId: string, config: PushNotificationConfig): void;
265
+ unsubscribe(taskId: string, url: string): void;
266
+ notify(event: A2ATaskEvent): Promise<void>;
267
+ cleanup(taskId: string): void;
268
+ }
269
+
270
+ interface A2ATaskRetryConfig {
271
+ maxAttempts: number;
272
+ initialBackoffMs: number;
273
+ backoffMultiplier: number;
274
+ maxBackoffMs: number;
275
+ jitterRatio: number;
276
+ }
277
+ interface A2ATaskQueueConfig {
278
+ leaseDurationMs: number;
279
+ retentionMs: number;
280
+ maxTerminalTasks: number;
281
+ retry: A2ATaskRetryConfig;
282
+ now?: () => number;
283
+ idFactory?: () => string;
284
+ }
285
+ interface A2ATaskLease {
286
+ taskId: string;
287
+ leaseId: string;
288
+ workerId: string;
289
+ expiresAt: string;
290
+ attempt: number;
291
+ maxAttempts: number;
292
+ }
293
+ interface A2ATaskFailResult {
294
+ task: A2ATask;
295
+ willRetry: boolean;
296
+ retryDelayMs: number;
297
+ attempts: number;
298
+ maxAttempts: number;
299
+ }
300
+ interface A2ATaskQueueSnapshot {
301
+ version: 1;
302
+ entries: Array<{
303
+ task: A2ATask;
304
+ attempts: number;
305
+ maxAttempts: number;
306
+ nextAttemptAt: number;
307
+ finishedAt?: number;
308
+ lease?: {
309
+ leaseId: string;
310
+ workerId: string;
311
+ expiresAt: number;
312
+ };
313
+ }>;
314
+ }
315
+ declare class A2ADurableTaskQueue {
316
+ private readonly entries;
317
+ private readonly now;
318
+ private readonly idFactory;
319
+ private readonly config;
320
+ constructor(config?: Partial<A2ATaskQueueConfig>);
321
+ get size(): number;
322
+ enqueue(task: A2ATask, options?: {
323
+ maxAttempts?: number;
324
+ }): A2ATask;
325
+ get(taskId: string): A2ATask | null;
326
+ list(): A2ATask[];
327
+ acquire(taskId: string, workerId: string): A2ATaskLease | null;
328
+ extendLease(taskId: string, leaseId: string, leaseDurationMs?: number): boolean;
329
+ complete(taskId: string, output: string, leaseId?: string): A2ATask | null;
330
+ fail(taskId: string, error: string, leaseId?: string): A2ATaskFailResult | null;
331
+ cancel(taskId: string): A2ATask | null;
332
+ evictExpired(): void;
333
+ snapshot(): A2ATaskQueueSnapshot;
334
+ hydrate(snapshot: A2ATaskQueueSnapshot | null | undefined): void;
335
+ private validateLease;
336
+ private resolveExpiredLeases;
337
+ private computeBackoffDelay;
338
+ }
339
+
340
+ interface A2AAgentRuntime {
341
+ sessionId: string;
342
+ run(prompt: string, options?: AgentRunOptions): Promise<AgentResult>;
343
+ }
344
+ interface A2APluginOptions {
345
+ fetch?: typeof fetch;
346
+ requestTimeoutMs?: number;
347
+ agentCardProvider?: AgentCardProvider;
348
+ retry?: Partial<A2ATaskRetryConfig>;
349
+ queue?: Partial<Pick<A2ATaskQueueConfig, "leaseDurationMs" | "retentionMs" | "maxTerminalTasks">>;
350
+ taskQueue?: A2ADurableTaskQueue;
351
+ persistQueueState?: boolean;
352
+ }
353
+ declare class A2APlugin implements Plugin {
354
+ readonly name = "a2a";
355
+ readonly version = "1.0.0";
356
+ readonly tools: Record<string, Tool<any, any>>;
357
+ private readonly fetchImpl;
358
+ private readonly requestTimeoutMs;
359
+ private readonly agentCardProvider?;
360
+ private readonly taskQueue;
361
+ private readonly persistQueueStateEnabled;
362
+ private readonly delegationManager;
363
+ private readonly pushNotifier;
364
+ private readonly taskEventListeners;
365
+ private static readonly QUEUE_SNAPSHOT_KEY;
366
+ private static readonly DEFAULT_MAX_TERMINAL_TASKS;
367
+ private static readonly DEFAULT_RETENTION_MS;
368
+ private evictionTimer?;
369
+ private queueHydrated;
370
+ private queueHydrationPromise;
371
+ private setupCtx?;
372
+ private latestCtx?;
373
+ readonly hooks: {
374
+ beforeRun: (ctx: PluginContext, _params: {
375
+ prompt: string;
376
+ }) => Promise<void>;
377
+ afterRun: (ctx: PluginContext, params: {
378
+ result: {
379
+ text: string;
380
+ };
381
+ }) => Promise<void>;
382
+ onError: (ctx: PluginContext, params: {
383
+ error: unknown;
384
+ phase: "run" | "stream" | "tool" | "step" | "setup";
385
+ }) => Promise<void>;
386
+ };
387
+ constructor(options?: A2APluginOptions);
388
+ setup(ctx: PluginSetupContext): void;
389
+ dispose(): void;
390
+ createJsonRpcHandler(agent: A2AAgentRuntime): (request: A2AJsonRpcRequest) => Promise<A2AJsonRpcResponse> & {
391
+ sendTaskSubscribe?: (params: A2ATasksSendParams) => AsyncGenerator<A2ATaskEvent, void, unknown>;
392
+ };
393
+ createHttpHandler(agent: A2AAgentRuntime): (request: Request) => Promise<Response>;
394
+ getTask(taskId: string): A2ATask | null;
395
+ listTasks(): A2ATask[];
396
+ registerAgent(agent: AgentCapability): void;
397
+ unregisterAgent(name: string): void;
398
+ listAgents(): AgentCapability[];
399
+ delegateTask(prompt: string, requiredSkills: string[]): Promise<DelegationResult>;
400
+ subscribeToTaskNotifications(taskId: string, config: PushNotificationConfig): void;
401
+ unsubscribeFromTaskNotifications(taskId: string, url: string): void;
402
+ private normalizeCallParams;
403
+ private callRemoteEndpoint;
404
+ private queueTask;
405
+ private markTaskRunning;
406
+ private markTaskCompleted;
407
+ private markTaskFailed;
408
+ private executeTaskWithRetry;
409
+ private evictStaleTasks;
410
+ private emitTaskEvent;
411
+ private createWorkerId;
412
+ private normalizeError;
413
+ private ensureQueueHydrated;
414
+ private hydrateQueueFromMemory;
415
+ private persistQueueState;
416
+ private sleep;
417
+ private discoverAgent;
418
+ private subscribeToTask;
419
+ private getTaskIdFromContext;
420
+ private getLeaseIdFromContext;
421
+ private isQueueManagedRun;
422
+ private resolveAgentCard;
423
+ private cloneTask;
424
+ }
425
+ declare function createA2APlugin(options?: A2APluginOptions): A2APlugin;
426
+
427
+ interface ContentFilter {
428
+ readonly name: string;
429
+ test(content: string): boolean;
430
+ }
431
+ interface GuardrailsPluginOptions {
432
+ /** Zod schema to validate the input prompt */
433
+ inputSchema?: ZodType;
434
+ /** Zod schema to validate the output text */
435
+ outputSchema?: ZodType;
436
+ /** Per-tool argument validation schemas (keyed by tool name) */
437
+ toolSchemas?: Record<string, ZodType>;
438
+ /** Content filters applied to both input and output */
439
+ contentFilters?: ContentFilter[];
440
+ /** Custom input validators */
441
+ inputValidators?: Array<(prompt: string) => string | null>;
442
+ /** Custom output validators */
443
+ outputValidators?: Array<(output: string) => string | null>;
444
+ /** Action on validation failure: 'throw' (default) or 'warn' */
445
+ onFailure?: "throw" | "warn";
446
+ /** Validation adapter (defaults to ZodValidationAdapter) */
447
+ validator?: ValidationPort;
448
+ }
449
+ declare class GuardrailsError extends Error {
450
+ readonly code: "input_validation" | "output_validation" | "content_filter" | "tool_validation";
451
+ constructor(code: GuardrailsError["code"], message: string);
452
+ }
453
+ declare class GuardrailsPlugin extends BasePlugin {
454
+ readonly name = "guardrails";
455
+ private readonly options;
456
+ private readonly validator;
457
+ constructor(options?: GuardrailsPluginOptions);
458
+ protected buildHooks(): PluginHooks;
459
+ private beforeRun;
460
+ private afterRun;
461
+ private beforeTool;
462
+ private fail;
463
+ }
464
+ declare function createGuardrailsPlugin(options?: GuardrailsPluginOptions): GuardrailsPlugin;
465
+ declare function createPiiFilter(): ContentFilter;
466
+
467
+ interface OneCrawlPluginOptions {
468
+ /** onecrawl Crawler instance — if not provided, one will be created lazily */
469
+ crawler?: unknown;
470
+ /** Maximum content length per scraped page (default: 10000) */
471
+ maxContentLength?: number;
472
+ /** Timeout per request in ms (default: 30000) */
473
+ timeout?: number;
474
+ /** Validation adapter (defaults to ZodValidationAdapter) */
475
+ validator?: ValidationPort;
476
+ }
477
+ declare class OneCrawlPlugin extends BasePlugin {
478
+ readonly name = "crawl";
479
+ private readonly options;
480
+ private crawlerPromise;
481
+ private readonly validator;
482
+ constructor(options?: OneCrawlPluginOptions);
483
+ protected buildHooks(): PluginHooks;
484
+ private getCrawler;
485
+ private initCrawler;
486
+ get tools(): Record<string, Tool<any, any>>;
487
+ dispose(): Promise<void>;
488
+ }
489
+ declare function createOneCrawlPlugin(options?: OneCrawlPluginOptions): OneCrawlPlugin;
490
+
491
+ interface VectorlessPluginOptions {
492
+ /** Pre-configured vectorless instance */
493
+ vectorless?: unknown;
494
+ /** Knowledge base — pre-loaded knowledge to query against */
495
+ knowledgeBase?: unknown;
496
+ /** Model to use for knowledge generation (default: uses vectorless default) */
497
+ model?: unknown;
498
+ /** Validation adapter (defaults to ZodValidationAdapter) */
499
+ validator?: ValidationPort;
500
+ /** Custom chunking adapter (defaults to DefaultChunkingAdapter) */
501
+ chunkingAdapter?: ChunkingPort;
502
+ /** Custom re-ranking adapter (defaults to DefaultReRankingAdapter) */
503
+ rerankingAdapter?: ReRankingPort;
504
+ }
505
+ declare class VectorlessPlugin extends BasePlugin {
506
+ readonly name = "knowledge";
507
+ private readonly options;
508
+ private vectorlessPromise;
509
+ private currentKnowledge;
510
+ private readonly validator;
511
+ readonly chunks: Map<string, Chunk>;
512
+ readonly chunkingAdapter: ChunkingPort;
513
+ readonly rerankingAdapter: ReRankingPort;
514
+ private _toolsCache?;
515
+ constructor(options?: VectorlessPluginOptions);
516
+ protected buildHooks(): PluginHooks;
517
+ private getVectorless;
518
+ private initVectorless;
519
+ get tools(): Record<string, Tool<any, any>>;
520
+ dispose(): Promise<void>;
521
+ }
522
+ declare function createVectorlessPlugin(options?: VectorlessPluginOptions): VectorlessPlugin;
523
+
524
+ declare const EvalMetricsSchema: z.ZodObject<{
525
+ latencyMs: z.ZodNumber;
526
+ stepCount: z.ZodNumber;
527
+ toolCalls: z.ZodRecord<z.ZodString, z.ZodNumber>;
528
+ tokenUsage: z.ZodOptional<z.ZodObject<{
529
+ prompt: z.ZodDefault<z.ZodNumber>;
530
+ completion: z.ZodDefault<z.ZodNumber>;
531
+ total: z.ZodDefault<z.ZodNumber>;
532
+ }, "strip", z.ZodTypeAny, {
533
+ prompt: number;
534
+ completion: number;
535
+ total: number;
536
+ }, {
537
+ prompt?: number | undefined;
538
+ completion?: number | undefined;
539
+ total?: number | undefined;
540
+ }>>;
541
+ customScores: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodNumber>>;
542
+ }, "strip", z.ZodTypeAny, {
543
+ toolCalls: Record<string, number>;
544
+ latencyMs: number;
545
+ stepCount: number;
546
+ customScores: Record<string, number>;
547
+ tokenUsage?: {
548
+ prompt: number;
549
+ completion: number;
550
+ total: number;
551
+ } | undefined;
552
+ }, {
553
+ toolCalls: Record<string, number>;
554
+ latencyMs: number;
555
+ stepCount: number;
556
+ tokenUsage?: {
557
+ prompt?: number | undefined;
558
+ completion?: number | undefined;
559
+ total?: number | undefined;
560
+ } | undefined;
561
+ customScores?: Record<string, number> | undefined;
562
+ }>;
563
+ type EvalMetrics = z.infer<typeof EvalMetricsSchema>;
564
+ declare const EvalResultSchema: z.ZodObject<{
565
+ id: z.ZodString;
566
+ sessionId: z.ZodString;
567
+ prompt: z.ZodString;
568
+ output: z.ZodString;
569
+ metrics: z.ZodObject<{
570
+ latencyMs: z.ZodNumber;
571
+ stepCount: z.ZodNumber;
572
+ toolCalls: z.ZodRecord<z.ZodString, z.ZodNumber>;
573
+ tokenUsage: z.ZodOptional<z.ZodObject<{
574
+ prompt: z.ZodDefault<z.ZodNumber>;
575
+ completion: z.ZodDefault<z.ZodNumber>;
576
+ total: z.ZodDefault<z.ZodNumber>;
577
+ }, "strip", z.ZodTypeAny, {
578
+ prompt: number;
579
+ completion: number;
580
+ total: number;
581
+ }, {
582
+ prompt?: number | undefined;
583
+ completion?: number | undefined;
584
+ total?: number | undefined;
585
+ }>>;
586
+ customScores: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodNumber>>;
587
+ }, "strip", z.ZodTypeAny, {
588
+ toolCalls: Record<string, number>;
589
+ latencyMs: number;
590
+ stepCount: number;
591
+ customScores: Record<string, number>;
592
+ tokenUsage?: {
593
+ prompt: number;
594
+ completion: number;
595
+ total: number;
596
+ } | undefined;
597
+ }, {
598
+ toolCalls: Record<string, number>;
599
+ latencyMs: number;
600
+ stepCount: number;
601
+ tokenUsage?: {
602
+ prompt?: number | undefined;
603
+ completion?: number | undefined;
604
+ total?: number | undefined;
605
+ } | undefined;
606
+ customScores?: Record<string, number> | undefined;
607
+ }>;
608
+ createdAt: z.ZodDefault<z.ZodNumber>;
609
+ }, "strip", z.ZodTypeAny, {
610
+ prompt: string;
611
+ id: string;
612
+ output: string;
613
+ createdAt: number;
614
+ sessionId: string;
615
+ metrics: {
616
+ toolCalls: Record<string, number>;
617
+ latencyMs: number;
618
+ stepCount: number;
619
+ customScores: Record<string, number>;
620
+ tokenUsage?: {
621
+ prompt: number;
622
+ completion: number;
623
+ total: number;
624
+ } | undefined;
625
+ };
626
+ }, {
627
+ prompt: string;
628
+ id: string;
629
+ output: string;
630
+ sessionId: string;
631
+ metrics: {
632
+ toolCalls: Record<string, number>;
633
+ latencyMs: number;
634
+ stepCount: number;
635
+ tokenUsage?: {
636
+ prompt?: number | undefined;
637
+ completion?: number | undefined;
638
+ total?: number | undefined;
639
+ } | undefined;
640
+ customScores?: Record<string, number> | undefined;
641
+ };
642
+ createdAt?: number | undefined;
643
+ }>;
644
+ type EvalResult = z.infer<typeof EvalResultSchema>;
645
+
646
+ interface EvalScorer {
647
+ readonly name: string;
648
+ score(prompt: string, output: string, metrics: EvalMetrics): Promise<number> | number;
649
+ }
650
+ interface EvalsPluginOptions {
651
+ /** Custom scoring functions */
652
+ scorers?: EvalScorer[];
653
+ /** Whether to persist results via MemoryPort metadata (default: false) */
654
+ persist?: boolean;
655
+ /** Callback invoked after each evaluation */
656
+ onEval?: (result: EvalResult) => void | Promise<void>;
657
+ }
658
+ declare class EvalsPlugin extends BasePlugin {
659
+ readonly name = "evals";
660
+ private readonly options;
661
+ private readonly results;
662
+ private readonly runStates;
663
+ constructor(options?: EvalsPluginOptions);
664
+ protected buildHooks(): PluginHooks;
665
+ private beforeRun;
666
+ private afterRun;
667
+ private afterTool;
668
+ private onError;
669
+ /** Get all collected eval results */
670
+ getResults(): readonly EvalResult[];
671
+ /** Get the most recent eval result */
672
+ getLastResult(): EvalResult | undefined;
673
+ /** Clear collected results */
674
+ clearResults(): void;
675
+ }
676
+ declare function createEvalsPlugin(options?: EvalsPluginOptions): EvalsPlugin;
677
+
678
+ interface WorkflowPluginConfig {
679
+ steps: WorkflowStep[];
680
+ initialContext?: WorkflowContext;
681
+ }
682
+ type WorkflowPluginInput = WorkflowPluginConfig | WorkflowDefinition;
683
+ declare class WorkflowError extends Error {
684
+ readonly result: WorkflowResult;
685
+ constructor(message: string, result: WorkflowResult);
686
+ }
687
+ declare class WorkflowPlugin extends BasePlugin {
688
+ readonly name = "workflow";
689
+ private readonly steps;
690
+ private readonly initialContext;
691
+ private readonly definition?;
692
+ private readonly engine?;
693
+ private lastResult;
694
+ constructor(config: WorkflowPluginInput, engine?: WorkflowPort);
695
+ protected buildHooks(): PluginHooks;
696
+ getLastResult(): WorkflowResult | undefined;
697
+ private beforeRun;
698
+ private executeWorkflow;
699
+ private executeWithRetry;
700
+ private rollback;
701
+ }
702
+ declare function createWorkflowPlugin(config: WorkflowPluginInput, engine?: WorkflowPort): WorkflowPlugin;
703
+
704
+ interface ObservabilityConfig {
705
+ enableTracing?: boolean;
706
+ enableMetrics?: boolean;
707
+ enableCostEstimation?: boolean;
708
+ costPerInputToken?: number;
709
+ costPerOutputToken?: number;
710
+ maxSpans?: number;
711
+ }
712
+ interface Span {
713
+ id: string;
714
+ traceId: string;
715
+ name: string;
716
+ startTime: number;
717
+ endTime?: number;
718
+ attributes: Record<string, unknown>;
719
+ parentId?: string;
720
+ status: 'ok' | 'error';
721
+ children: Span[];
722
+ }
723
+ interface AgentMetrics {
724
+ totalTokens: {
725
+ input: number;
726
+ output: number;
727
+ };
728
+ totalLatencyMs: number;
729
+ toolCalls: {
730
+ name: string;
731
+ latencyMs: number;
732
+ success: boolean;
733
+ }[];
734
+ llmCalls: {
735
+ latencyMs: number;
736
+ inputTokens: number;
737
+ outputTokens: number;
738
+ }[];
739
+ estimatedCostUsd?: number;
740
+ }
741
+ declare class ObservabilityPlugin extends BasePlugin {
742
+ readonly name = "observability";
743
+ readonly version = "1.0.0";
744
+ private config;
745
+ private spans;
746
+ private rootSpans;
747
+ private activeSpans;
748
+ private sessionMetrics;
749
+ private sessionStartTimes;
750
+ private toolStartTimes;
751
+ private readonly toolSpanStack;
752
+ private readonly maxSpans;
753
+ constructor(config?: ObservabilityConfig);
754
+ protected buildHooks(): PluginHooks;
755
+ private generateId;
756
+ private createSpan;
757
+ private endSpan;
758
+ private getOrCreateMetrics;
759
+ private onRequest;
760
+ private onResponse;
761
+ private onToolStart;
762
+ private onToolEnd;
763
+ private onError;
764
+ getTraces(): Span[];
765
+ getMetrics(sessionId?: string): AgentMetrics;
766
+ private deepCopyMetrics;
767
+ exportOpenTelemetry(): object;
768
+ reset(): void;
769
+ }
770
+ /** @deprecated Use `ObservabilityConfig` instead */
771
+ type ObservabilityPluginConfig = ObservabilityConfig;
772
+ /** @deprecated Use `new ObservabilityPlugin(config)` instead */
773
+ declare function createObservabilityPlugin(config?: ObservabilityConfig): ObservabilityPlugin;
774
+
775
+ interface SemanticScrapingPluginOptions {
776
+ /** Custom adapter — if not provided, an in-memory adapter is created. */
777
+ adapter?: ISemanticScrapingPort;
778
+ }
779
+ declare class SemanticScrapingPlugin extends BasePlugin {
780
+ readonly name = "semantic-scraping";
781
+ private readonly adapter;
782
+ constructor(options?: SemanticScrapingPluginOptions);
783
+ protected buildHooks(): PluginHooks;
784
+ get tools(): Record<string, Tool<any, any>>;
785
+ }
786
+ declare function createSemanticScrapingPlugin(options?: SemanticScrapingPluginOptions): SemanticScrapingPlugin;
787
+
788
+ type ReRankingStrategy = NonNullable<ReRankingOptions["strategy"]>;
789
+ interface SemanticWebSearchQuality {
790
+ traceId: string;
791
+ cacheServed: boolean;
792
+ durationMs: number;
793
+ strategyRequested: ReRankingStrategy;
794
+ strategyUsed: ReRankingStrategy;
795
+ fallbackUsed: boolean;
796
+ candidates: number;
797
+ reranked: number;
798
+ averageScore: number;
799
+ searchAttempts: number;
800
+ scrapeAttempts: number;
801
+ scrapeFailures: number;
802
+ }
803
+ interface SemanticWebSearchResponse {
804
+ query: string;
805
+ results: Array<{
806
+ rank: number;
807
+ score: number;
808
+ title: string;
809
+ url: string;
810
+ snippet: string;
811
+ citation: string;
812
+ }>;
813
+ citations: string[];
814
+ quality: SemanticWebSearchQuality;
815
+ cost?: {
816
+ model: string;
817
+ promptTokens: number;
818
+ completionTokens: number;
819
+ totalTokens: number;
820
+ totalCost: number;
821
+ currency: "USD";
822
+ };
823
+ cacheHit: boolean;
824
+ }
825
+ interface SemanticWebSearchPluginOptions {
826
+ apiKey?: string;
827
+ crawler?: {
828
+ search: (query: string, options?: {
829
+ limit?: number;
830
+ }) => Promise<unknown>;
831
+ crawl?: (url: string) => Promise<unknown>;
832
+ close?: () => Promise<void>;
833
+ };
834
+ reranker?: ReRankingPort;
835
+ telemetry?: TelemetryPort;
836
+ costTracker?: CostTrackerPort;
837
+ costModel?: string;
838
+ emitTelemetry?: boolean;
839
+ cache?: ToolCache;
840
+ circuitBreaker?: CircuitBreaker;
841
+ defaultLimit?: number;
842
+ defaultScrapeTopK?: number;
843
+ defaultStrategy?: ReRankingStrategy;
844
+ fallbackStrategy?: ReRankingStrategy;
845
+ fallbackOnRerankError?: boolean;
846
+ requestTimeoutMs?: number;
847
+ maxRetries?: number;
848
+ retryDelayMs?: number;
849
+ cacheTtlMs?: number;
850
+ }
851
+ declare class SemanticWebSearchPlugin extends BasePlugin {
852
+ private readonly options;
853
+ readonly name = "Semantic Web Search";
854
+ readonly description = "Native search\u2192rerank\u2192citation pipeline for high-quality web evidence.";
855
+ private crawlerPromise;
856
+ private readonly reranker;
857
+ private readonly telemetry?;
858
+ private readonly costTracker?;
859
+ private readonly costModel;
860
+ private readonly emitTelemetry;
861
+ private readonly cache;
862
+ private readonly circuitBreaker;
863
+ private readonly defaultLimit;
864
+ private readonly defaultScrapeTopK;
865
+ private readonly defaultStrategy;
866
+ private readonly fallbackStrategy;
867
+ private readonly fallbackOnRerankError;
868
+ private readonly requestTimeoutMs;
869
+ private readonly maxRetries;
870
+ private readonly retryDelayMs;
871
+ private readonly cacheTtlMs;
872
+ constructor(options?: SemanticWebSearchPluginOptions);
873
+ protected buildHooks(): {};
874
+ get tools(): {
875
+ semantic_web_search: Tool<{
876
+ query: string;
877
+ limit?: number | undefined;
878
+ strategy?: "tfidf" | "bm25" | "mmr" | undefined;
879
+ scrapeTopK?: number | undefined;
880
+ }, SemanticWebSearchResponse>;
881
+ };
882
+ dispose(): Promise<void>;
883
+ private getCrawler;
884
+ private initCrawler;
885
+ private normalizeResults;
886
+ private normalizeEntry;
887
+ private enrichTopResults;
888
+ private normalizeCrawlContent;
889
+ private executeWithRetry;
890
+ private withTimeout;
891
+ private sleep;
892
+ private calculateAverageScore;
893
+ private buildCostRecord;
894
+ private estimateTokens;
895
+ private emitEvent;
896
+ private emitMetric;
897
+ private toTelemetryAttribute;
898
+ }
899
+ declare function createSemanticWebSearchPlugin(options?: SemanticWebSearchPluginOptions): SemanticWebSearchPlugin;
900
+
901
+ interface JsonRpcRequest {
902
+ jsonrpc: "2.0";
903
+ id: string | number | null;
904
+ method: string;
905
+ params?: Record<string, unknown>;
906
+ }
907
+ interface JsonRpcResponse {
908
+ jsonrpc: "2.0";
909
+ id: string | number | null;
910
+ result?: unknown;
911
+ error?: {
912
+ code: number;
913
+ message: string;
914
+ data?: unknown;
915
+ };
916
+ }
917
+ type McpToolExecutor = (name: string, args: Record<string, unknown>) => Promise<{
918
+ content: Array<{
919
+ type: string;
920
+ text?: string;
921
+ }>;
922
+ isError?: boolean;
923
+ }>;
924
+ declare class DefaultMcpServerAdapter implements McpServerPort {
925
+ private tools;
926
+ private toolsByName;
927
+ private executor;
928
+ private options?;
929
+ private stdinHandler?;
930
+ private stdinBuffer;
931
+ private httpServer?;
932
+ private sseClients;
933
+ constructor(tools: McpToolServerDefinition[], executor: McpToolExecutor);
934
+ private rebuildToolIndex;
935
+ getRegisteredTools(): McpToolServerDefinition[];
936
+ setTools(tools: McpToolServerDefinition[]): void;
937
+ start(options: McpServerOptions): Promise<void>;
938
+ stop(): Promise<void>;
939
+ handleRequest(request: JsonRpcRequest): Promise<JsonRpcResponse>;
940
+ private startStdio;
941
+ private processStdioLine;
942
+ private startSse;
943
+ private handleHttpRequest;
944
+ private static readonly MAX_BODY_SIZE;
945
+ private readBody;
946
+ }
947
+
948
+ interface McpServerPluginOptions {
949
+ /** Default server name (default: "gaussflow-mcp-server") */
950
+ name?: string;
951
+ /** Default server version (default: "1.0.0") */
952
+ version?: string;
953
+ /** Additional static tool definitions to expose */
954
+ extraTools?: McpToolServerDefinition[];
955
+ /** Custom tool executor; defaults to looking up tools from setupContext */
956
+ executor?: (name: string, args: Record<string, unknown>) => Promise<{
957
+ content: Array<{
958
+ type: string;
959
+ text?: string;
960
+ }>;
961
+ isError?: boolean;
962
+ }>;
963
+ }
964
+ declare class McpServerPlugin implements Plugin {
965
+ readonly name = "mcp-server";
966
+ readonly version = "1.0.0";
967
+ readonly tools: Record<string, Tool<any, any>>;
968
+ private adapter?;
969
+ private readonly pluginOptions;
970
+ private collectedTools;
971
+ constructor(options?: McpServerPluginOptions);
972
+ setup(ctx: PluginSetupContext): Promise<void>;
973
+ dispose(): Promise<void>;
974
+ /** Expose the underlying adapter for testing */
975
+ getAdapter(): DefaultMcpServerAdapter | undefined;
976
+ /** Expose collected tools for testing */
977
+ getCollectedTools(): McpToolServerDefinition[];
978
+ private defaultExecutor;
979
+ }
980
+ declare function createMcpServerPlugin(options?: McpServerPluginOptions): McpServerPlugin;
981
+
982
+ export { SemanticWebSearchPlugin as $, type A2AAgentRuntime as A, BasePlugin as B, type ChunkingPort as C, DefaultMcpServerAdapter as D, type EvalMetrics as E, type EvalsPluginOptions as F, GuardrailsError as G, GuardrailsPlugin as H, type GuardrailsPluginOptions as I, McpServerPlugin as J, type McpServerPluginOptions as K, type McpServerPort as L, type McpServerOptions as M, type McpToolExecutor as N, type McpToolServerDefinition as O, PluginManager as P, type ObservabilityConfig as Q, type ReRankingPort as R, type ScoredResult as S, ObservabilityPlugin as T, type ObservabilityPluginConfig as U, type ValidationPort as V, OneCrawlPlugin as W, type OneCrawlPluginOptions as X, type PushNotificationConfig as Y, SemanticScrapingPlugin as Z, type SemanticScrapingPluginOptions as _, type ChunkOptions as a, type SemanticWebSearchPluginOptions as a0, type SourceAttribution as a1, type TaskEventListener as a2, VectorlessPlugin as a3, type VectorlessPluginOptions as a4, WorkflowError as a5, WorkflowPlugin as a6, type WorkflowPluginConfig as a7, type WorkflowPluginInput as a8, createA2AHttpHandler as a9, createA2AJsonRpcHandler as aa, createA2APlugin as ab, createA2ASseHandler as ac, createAgentCardPlugin as ad, createEvalsPlugin as ae, createGuardrailsPlugin as af, createMcpServerPlugin as ag, createObservabilityPlugin as ah, createOneCrawlPlugin as ai, createPiiFilter as aj, createSemanticScrapingPlugin as ak, createSemanticWebSearchPlugin as al, createVectorlessPlugin as am, createWorkflowPlugin as an, type Span as ao, type Chunk as b, type ReRankingOptions as c, type ValidationResult as d, type A2AJsonRpcRequest as e, type A2AJsonRpcResponse as f, A2APlugin as g, type A2APluginOptions as h, A2APushNotifier as i, type A2ARequestHandlers as j, type A2ATask as k, type A2ATaskEvent as l, type A2ATaskStatus as m, type A2ATasksSendParams as n, AgentCardPlugin as o, type AgentCardPluginOptions as p, type AgentCardProvider as q, type AgentCardSnapshot as r, type AgentCardSource as s, type AgentMetrics as t, type ContentFilter as u, EvalMetricsSchema as v, type EvalResult as w, EvalResultSchema as x, type EvalScorer as y, EvalsPlugin as z };