melchizedek-agents 1.0.0 → 1.0.1
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 +16 -0
- package/package.json +2 -2
- package/dist/lib/adkPeer.d.ts +0 -63
- package/dist/lib/adkPeer.js +0 -240
- package/dist/lib/compileAdk.d.ts +0 -32
- package/dist/lib/compileAdk.js +0 -142
- package/dist/lib/models/adkGeminiAdapter.d.ts +0 -90
- package/dist/lib/models/adkGeminiAdapter.js +0 -369
- package/dist/lib/models/adkShim.d.ts +0 -111
- package/dist/lib/models/adkShim.js +0 -136
- package/dist/lib/models/claudeLlm.d.ts +0 -79
- package/dist/lib/models/claudeLlm.js +0 -87
- package/dist/lib/models/fallback.d.ts +0 -48
- package/dist/lib/models/fallback.js +0 -116
- package/dist/lib/models/gatewayLlm.d.ts +0 -36
- package/dist/lib/models/gatewayLlm.js +0 -44
- package/dist/lib/models/gptLlm.d.ts +0 -99
- package/dist/lib/models/gptLlm.js +0 -129
- package/dist/lib/models/grokLlm.d.ts +0 -50
- package/dist/lib/models/grokLlm.js +0 -56
- package/dist/lib/models/kimiLlm.d.ts +0 -31
- package/dist/lib/models/kimiLlm.js +0 -35
- package/dist/lib/models/ollamaLlm.d.ts +0 -37
- package/dist/lib/models/ollamaLlm.js +0 -42
- package/dist/lib/models/openAiCompatibleLlm.d.ts +0 -96
- package/dist/lib/models/openAiCompatibleLlm.js +0 -156
- package/dist/lib/models/tracedGemini.d.ts +0 -41
- package/dist/lib/models/tracedGemini.js +0 -98
- package/dist/lib/runtime/adkMemoryBridge.d.ts +0 -46
- package/dist/lib/runtime/adkMemoryBridge.js +0 -68
- package/dist/lib/runtime/adkSessionBridge.d.ts +0 -78
- package/dist/lib/runtime/adkSessionBridge.js +0 -176
- package/dist/lib/tools/adkTool.d.ts +0 -81
- package/dist/lib/tools/adkTool.js +0 -268
- package/dist/lib/tools/collectionsSearchTool.d.ts +0 -56
- package/dist/lib/tools/collectionsSearchTool.js +0 -71
- package/dist/lib/tools/urlContextTool.d.ts +0 -32
- package/dist/lib/tools/urlContextTool.js +0 -43
- package/dist/lib/tools/webSearchTool.d.ts +0 -51
- package/dist/lib/tools/webSearchTool.js +0 -82
- package/dist/lib/tools/xSearchTool.d.ts +0 -59
- package/dist/lib/tools/xSearchTool.js +0 -74
|
@@ -1,268 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* lib/tools/adkTool.ts — the boundary where an own Tool becomes an ADK tool.
|
|
3
|
-
*
|
|
4
|
-
* WHY this file exists:
|
|
5
|
-
* Tools are the engine's own (lib/tools/tool.ts, ADR 0051): a name, the
|
|
6
|
-
* declaration the model receives, and `execute(args, ctx)`. Until 1.0.0
|
|
7
|
-
* removes ADK (ADR 0045) the ADK runtime runs the same tools, and this
|
|
8
|
-
* module is the one place that turns a Tool into what ADK consumes: a
|
|
9
|
-
* FunctionTool whose Gemini-dialect parameters come from the Tool's
|
|
10
|
-
* declaration, and whose execute hands the Tool a ToolContext read from
|
|
11
|
-
* ADK's own Context. Nothing else in lib/tools builds an ADK tool from an
|
|
12
|
-
* own Tool, and tool.ts and toolContract.ts import nothing from ADK.
|
|
13
|
-
*
|
|
14
|
-
* The ADK runtime behaves as it did when every tool was a FunctionTool:
|
|
15
|
-
* - the declaration ADK sends is the Tool's, in Gemini's dialect
|
|
16
|
-
* (toGeminiSchema), so contractToolDeclaration reads the same
|
|
17
|
-
* parameters through either path;
|
|
18
|
-
* - a long-running Tool is a long-running FunctionTool, and its pending
|
|
19
|
-
* (undefined) result is the null response ADK waits on;
|
|
20
|
-
* - a Tool that requires approval sets FunctionTool's own gate, which
|
|
21
|
-
* raises `adk_request_confirmation` as lib/compile.ts's gate does;
|
|
22
|
-
* - a Tool that throws becomes ADK's `Error in tool '<name>': …` response;
|
|
23
|
-
* - a Tool's `instruction`, and an InstructionTool's, are appended to the
|
|
24
|
-
* request's system instruction in the tool's processLlmRequest, joined
|
|
25
|
-
* as ADK's own appendInstructions joins them, at the tool's place in the
|
|
26
|
-
* agent's list: where ADK's load_memory and preload_memory wrote theirs
|
|
27
|
-
* (ADR 0059);
|
|
28
|
-
* - the context reaches the run's memory through ADK's own
|
|
29
|
-
* `Context.searchMemory`, so a search reads the silo ADK's tools read;
|
|
30
|
-
* - a NativeToolMarker is the shared sentinel the ADK runtime always ran
|
|
31
|
-
* for that server-side tool, which carries the same marker (ADR 0062);
|
|
32
|
-
* - a Tool's `contents` hook adds to the request's history in the tool's
|
|
33
|
-
* processLlmRequest, where ADK's load_skill_resource added a binary
|
|
34
|
-
* file (ADR 0083);
|
|
35
|
-
* - an own Toolset (the skills harness) is a BaseToolset whose getTools
|
|
36
|
-
* lists the Toolset's tools for ADK's ReadonlyContext, each through
|
|
37
|
-
* toAdkTool (ADR 0083).
|
|
38
|
-
*
|
|
39
|
-
* toAdkTool takes any of these and picks the wrapper.
|
|
40
|
-
*/
|
|
41
|
-
import { BaseTool, BaseToolset, FunctionTool, GOOGLE_SEARCH } from '../adkPeer.js';
|
|
42
|
-
import { currentTurnSignal } from '../runtime/turnControl.js';
|
|
43
|
-
import { COLLECTIONS_SEARCH } from './collectionsSearchTool.js';
|
|
44
|
-
import { OWN_TOOL, createToolContext, isInstructionTool, isNativeToolMarker, isOwnToolset, nativeToolMarkerOf } from './tool.js';
|
|
45
|
-
import { URL_CONTEXT } from './urlContextTool.js';
|
|
46
|
-
import { WEB_SEARCH } from './webSearchTool.js';
|
|
47
|
-
import { X_SEARCH } from './xSearchTool.js';
|
|
48
|
-
import { asTool, toGeminiSchema, toolCallContextFrom } from './toolContract.js';
|
|
49
|
-
/**
|
|
50
|
-
* ADK's Context seen as a ToolContext. Who the call is for is copied once;
|
|
51
|
-
* the rest reads through to ADK's Context, so a state write lands in ADK's
|
|
52
|
-
* own delta and `actions` is the event's actions.
|
|
53
|
-
*/
|
|
54
|
-
class AdkToolContext {
|
|
55
|
-
userId;
|
|
56
|
-
appName;
|
|
57
|
-
sessionId;
|
|
58
|
-
#adk;
|
|
59
|
-
#fallback;
|
|
60
|
-
constructor(adk) {
|
|
61
|
-
this.#adk = adk;
|
|
62
|
-
const who = toolCallContextFrom(adk);
|
|
63
|
-
this.userId = who?.userId;
|
|
64
|
-
this.appName = who?.appName;
|
|
65
|
-
this.sessionId = who?.sessionId;
|
|
66
|
-
}
|
|
67
|
-
/** A stand-in for the parts a partial Context (a test's) lacks. */
|
|
68
|
-
get #local() {
|
|
69
|
-
return (this.#fallback ??= createToolContext());
|
|
70
|
-
}
|
|
71
|
-
get invocationId() {
|
|
72
|
-
return this.#adk.invocationContext?.invocationId;
|
|
73
|
-
}
|
|
74
|
-
get agentName() {
|
|
75
|
-
const agent = this.#adk.invocationContext?.agent;
|
|
76
|
-
return agent?.name;
|
|
77
|
-
}
|
|
78
|
-
get functionCallId() {
|
|
79
|
-
return this.#adk.functionCallId;
|
|
80
|
-
}
|
|
81
|
-
get state() {
|
|
82
|
-
return this.#adk.state ?? this.#local.state;
|
|
83
|
-
}
|
|
84
|
-
get stateDelta() {
|
|
85
|
-
return this.#adk.actions?.stateDelta ?? this.#local.stateDelta;
|
|
86
|
-
}
|
|
87
|
-
get actions() {
|
|
88
|
-
return this.#adk.actions ?? this.#local.actions;
|
|
89
|
-
}
|
|
90
|
-
requestConfirmation(request = {}) {
|
|
91
|
-
this.#adk.requestConfirmation({ hint: request.hint, payload: request.payload });
|
|
92
|
-
}
|
|
93
|
-
get confirmation() {
|
|
94
|
-
const c = this.#adk.toolConfirmation;
|
|
95
|
-
return c ? { confirmed: c.confirmed, hint: c.hint, payload: c.payload } : undefined;
|
|
96
|
-
}
|
|
97
|
-
get signal() {
|
|
98
|
-
return this.#adk.abortSignal ?? currentTurnSignal();
|
|
99
|
-
}
|
|
100
|
-
get userContent() {
|
|
101
|
-
return this.#adk.invocationContext?.userContent;
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* ADK's own search: the run's memory service, under the session's app name
|
|
105
|
-
* and user id. Absent when the run has no memory service.
|
|
106
|
-
*/
|
|
107
|
-
get searchMemory() {
|
|
108
|
-
if (!this.#adk.invocationContext?.memoryService)
|
|
109
|
-
return undefined;
|
|
110
|
-
return (query) => this.#adk.searchMemory(query);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
/** The ToolContext for one ADK call; a standalone one outside a run. */
|
|
114
|
-
export function adkToolContext(adkContext) {
|
|
115
|
-
return adkContext && typeof adkContext === 'object' ? new AdkToolContext(adkContext) : createToolContext();
|
|
116
|
-
}
|
|
117
|
-
export function toFunctionTool(tool) {
|
|
118
|
-
const own = asTool(tool);
|
|
119
|
-
const declaration = own.declaration();
|
|
120
|
-
const options = {
|
|
121
|
-
name: own.name,
|
|
122
|
-
description: declaration.description,
|
|
123
|
-
parameters: toGeminiSchema(declaration.parameters),
|
|
124
|
-
execute: (args, adkContext) => own.execute((args ?? {}), adkToolContext(adkContext)),
|
|
125
|
-
isLongRunning: own.longRunning === true,
|
|
126
|
-
requireConfirmation: own.requiresApproval === true,
|
|
127
|
-
};
|
|
128
|
-
// Only a Tool that writes into the request needs more than FunctionTool.
|
|
129
|
-
const writes = typeof own.instruction === 'function' || typeof own.contents === 'function';
|
|
130
|
-
const adkTool = writes ? new InstructingFunctionTool(options) : new FunctionTool(options);
|
|
131
|
-
Object.defineProperty(adkTool, OWN_TOOL, { value: own });
|
|
132
|
-
return adkTool;
|
|
133
|
-
}
|
|
134
|
-
// ── Writing into the instruction (ADR 0059) ──────────────────────────────────
|
|
135
|
-
/**
|
|
136
|
-
* Appends to the request's system instruction exactly as ADK's own
|
|
137
|
-
* appendInstructions (models/llm_request.js, not exported) does: the texts
|
|
138
|
-
* joined by a blank line, after a blank line when there is one already.
|
|
139
|
-
*/
|
|
140
|
-
function appendInstruction(llmRequest, text) {
|
|
141
|
-
llmRequest.config ??= {};
|
|
142
|
-
const config = llmRequest.config;
|
|
143
|
-
config.systemInstruction = config.systemInstruction ? `${config.systemInstruction}\n\n${text}` : text;
|
|
144
|
-
}
|
|
145
|
-
/**
|
|
146
|
-
* The own tool an ADK tool carries. Read through `this`, not a private
|
|
147
|
-
* field, so the copy lib/compile.ts makes with Object.create to gate a tool
|
|
148
|
-
* still finds it.
|
|
149
|
-
*/
|
|
150
|
-
function carried(adkTool) {
|
|
151
|
-
return adkTool[OWN_TOOL];
|
|
152
|
-
}
|
|
153
|
-
/** A FunctionTool that also writes its Tool's instruction and contents, after declaring itself. */
|
|
154
|
-
class InstructingFunctionTool extends FunctionTool {
|
|
155
|
-
async processLlmRequest(request) {
|
|
156
|
-
await super.processLlmRequest(request);
|
|
157
|
-
const own = carried(this);
|
|
158
|
-
const text = await own.instruction?.(adkToolContext(request.toolContext));
|
|
159
|
-
if (text)
|
|
160
|
-
appendInstruction(request.llmRequest, text);
|
|
161
|
-
if (own.contents && request.llmRequest.contents) {
|
|
162
|
-
await own.contents(request.llmRequest.contents, adkToolContext(request.toolContext));
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
/** The ADK tool for an InstructionTool: declares nothing, and appends its instruction. */
|
|
167
|
-
class InstructionOnlyTool extends BaseTool {
|
|
168
|
-
async runAsync() {
|
|
169
|
-
throw new Error(`${this.name} only writes into the instruction and is never called by a model`);
|
|
170
|
-
}
|
|
171
|
-
async processLlmRequest(request) {
|
|
172
|
-
await super.processLlmRequest(request);
|
|
173
|
-
const text = await carried(this).instruction(adkToolContext(request.toolContext));
|
|
174
|
-
if (text)
|
|
175
|
-
appendInstruction(request.llmRequest, text);
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
/**
|
|
179
|
-
* ADK surface for an InstructionTool: a BaseTool that declares no function,
|
|
180
|
-
* so it never enters the request's tools, and appends the InstructionTool's
|
|
181
|
-
* text in processLlmRequest, where ADK's PreloadMemoryTool appended its own.
|
|
182
|
-
* instructionToolOf (lib/tools/tool.ts) reads the InstructionTool back.
|
|
183
|
-
*/
|
|
184
|
-
export function toAdkInstructionTool(tool) {
|
|
185
|
-
// ADK reads neither name nor description from a tool that declares
|
|
186
|
-
// nothing; ADK's PreloadMemoryTool used its name for both.
|
|
187
|
-
const adkTool = new InstructionOnlyTool({ name: tool.name, description: tool.name });
|
|
188
|
-
Object.defineProperty(adkTool, OWN_TOOL, { value: tool });
|
|
189
|
-
return adkTool;
|
|
190
|
-
}
|
|
191
|
-
// ── Server-side tools (ADR 0062) ─────────────────────────────────────────────
|
|
192
|
-
/**
|
|
193
|
-
* The ADK runtime's object for each NativeTool a marker may name: the
|
|
194
|
-
* engine's sentinels, which carry the same marker, and ADK's own
|
|
195
|
-
* GOOGLE_SEARCH. Code execution is the agent's `code_execution: gemini`,
|
|
196
|
-
* never a listed tool, so it has none.
|
|
197
|
-
*/
|
|
198
|
-
const ADK_NATIVE_TOOLS = {
|
|
199
|
-
web_search: WEB_SEARCH,
|
|
200
|
-
x_search: X_SEARCH,
|
|
201
|
-
url_context: URL_CONTEXT,
|
|
202
|
-
collections_search: COLLECTIONS_SEARCH,
|
|
203
|
-
google_search: GOOGLE_SEARCH,
|
|
204
|
-
};
|
|
205
|
-
/**
|
|
206
|
-
* ADK surface for a NativeToolMarker: the shared sentinel the ADK runtime
|
|
207
|
-
* has always run for it, which during processLlmRequest leaves itself in
|
|
208
|
-
* the request for the adapter (or adds Gemini's own tool object).
|
|
209
|
-
*/
|
|
210
|
-
export function toAdkNativeTool(marker) {
|
|
211
|
-
const native = nativeToolMarkerOf(marker);
|
|
212
|
-
const adkTool = native ? ADK_NATIVE_TOOLS[native] : undefined;
|
|
213
|
-
if (!adkTool) {
|
|
214
|
-
throw new Error(`${marker.name} names no server-side tool an agent can list (code execution is an agent's code_execution: gemini)`);
|
|
215
|
-
}
|
|
216
|
-
return adkTool;
|
|
217
|
-
}
|
|
218
|
-
// ── Toolsets (ADR 0083) ──────────────────────────────────────────────────────
|
|
219
|
-
/**
|
|
220
|
-
* The ADK toolset for an own Toolset: getTools hands the Toolset ADK's
|
|
221
|
-
* ReadonlyContext (its agent name, invocation id and state are what a
|
|
222
|
-
* ToolsetContext reads) and returns each tool through toAdkTool, the same
|
|
223
|
-
* FunctionTool for the same Tool on every request. toolsetOf
|
|
224
|
-
* (lib/tools/tool.ts) reads the Toolset back.
|
|
225
|
-
*/
|
|
226
|
-
class OwnToolsetAdapter extends BaseToolset {
|
|
227
|
-
#wrapped = new WeakMap();
|
|
228
|
-
constructor(toolset) {
|
|
229
|
-
super([]);
|
|
230
|
-
Object.defineProperty(this, OWN_TOOL, { value: toolset });
|
|
231
|
-
}
|
|
232
|
-
async getTools(context) {
|
|
233
|
-
const own = carried(this);
|
|
234
|
-
const tools = await own.getTools(context);
|
|
235
|
-
return tools.map((tool) => {
|
|
236
|
-
if (!tool || typeof tool !== 'object')
|
|
237
|
-
throw new Error(`${own.name ?? 'toolset'} listed a tool that is not an object`);
|
|
238
|
-
let adk = this.#wrapped.get(tool);
|
|
239
|
-
if (!adk) {
|
|
240
|
-
adk = toAdkTool(tool);
|
|
241
|
-
this.#wrapped.set(tool, adk);
|
|
242
|
-
}
|
|
243
|
-
return adk;
|
|
244
|
-
});
|
|
245
|
-
}
|
|
246
|
-
async close() { }
|
|
247
|
-
}
|
|
248
|
-
/** ADK surface for an own Toolset: a BaseToolset carrying it. */
|
|
249
|
-
export function toAdkToolset(toolset) {
|
|
250
|
-
return new OwnToolsetAdapter(toolset);
|
|
251
|
-
}
|
|
252
|
-
/**
|
|
253
|
-
* What the engine holds as a tool, as the ADK runtime consumes it: a Tool
|
|
254
|
-
* or a defineTool contract through toFunctionTool, an InstructionTool
|
|
255
|
-
* through toAdkInstructionTool, a NativeToolMarker through toAdkNativeTool.
|
|
256
|
-
* An ADK tool (one with runAsync) passes through as it is.
|
|
257
|
-
*/
|
|
258
|
-
export function toAdkTool(tool) {
|
|
259
|
-
if (tool instanceof BaseTool || 'runAsync' in tool)
|
|
260
|
-
return tool;
|
|
261
|
-
if (isOwnToolset(tool))
|
|
262
|
-
throw new Error(`${tool.name ?? 'a toolset'} is a toolset: wrap it with toAdkToolset`);
|
|
263
|
-
if (isNativeToolMarker(tool))
|
|
264
|
-
return toAdkNativeTool(tool);
|
|
265
|
-
if (isInstructionTool(tool))
|
|
266
|
-
return toAdkInstructionTool(tool);
|
|
267
|
-
return toFunctionTool(tool);
|
|
268
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* lib/tools/collectionsSearchTool.ts — xAI Collections search, sentinel-style.
|
|
3
|
-
*
|
|
4
|
-
* WHY this file exists:
|
|
5
|
-
* xAI's Agent Tools API can search "Collections" — hosted document stores
|
|
6
|
-
* (PDFs, text, CSVs) uploaded at console.x.ai or via the management API —
|
|
7
|
-
* semantic RAG run SERVER-SIDE, with citations back to source files
|
|
8
|
-
* (collections://<collection_id>/files/<file_id>). Declaring
|
|
9
|
-
* `collections_search` in an agent's YAML tools list turns it on for
|
|
10
|
-
* grok-* agents; xAI decides retrieval, we never ship documents in the
|
|
11
|
-
* prompt.
|
|
12
|
-
*
|
|
13
|
-
* HOW IT WORKS (mirrors xSearchTool.ts exactly):
|
|
14
|
-
* The sentinel self-registers in llmRequest.toolsDict; _getDeclaration()
|
|
15
|
-
* returns undefined so it is never sent as a client-side function tool.
|
|
16
|
-
* The GptLlm/GrokLlm request builder calls wantsCollectionsSearch() and
|
|
17
|
-
* appends the OpenAI-compatible wire shape:
|
|
18
|
-
* { type: 'file_search', vector_store_ids: [...], max_num_results? }
|
|
19
|
-
*
|
|
20
|
-
* WHICH COLLECTIONS: ids come from the environment, not YAML —
|
|
21
|
-
* XAI_COLLECTION_IDS (comma-separated) names the collections, and
|
|
22
|
-
* XAI_COLLECTIONS_MAX_RESULTS optionally caps retrieved chunks. Ids are
|
|
23
|
-
* deployment configuration (they differ per account/stage), which is
|
|
24
|
-
* what .env is for; the YAML stays shareable. Declared with no ids
|
|
25
|
-
* configured, the tool is omitted with a warning — never fatal.
|
|
26
|
-
*
|
|
27
|
-
* SCOPE: xAI-only. OpenAI's Responses API shares the file_search wire
|
|
28
|
-
* shape but searches OPENAI vector stores — a different product with
|
|
29
|
-
* different ids — so this sentinel gates to grok-* models and is a
|
|
30
|
-
* silent no-op everywhere else (same non-throwing routing contract as
|
|
31
|
-
* web_search / x_search).
|
|
32
|
-
*/
|
|
33
|
-
import { BaseTool } from '../adkPeer.ts';
|
|
34
|
-
import type { LlmRequest } from '@google/adk';
|
|
35
|
-
import { NATIVE_TOOL } from './tool.ts';
|
|
36
|
-
export declare const COLLECTIONS_SEARCH_TOOL_NAME = "collections_search";
|
|
37
|
-
/** The ADK runtime's form of COLLECTIONS_SEARCH_MARKER (lib/tools/nativeTools.ts), carrying its marker. */
|
|
38
|
-
export declare class CollectionsSearchTool extends BaseTool {
|
|
39
|
-
readonly [NATIVE_TOOL]: import("../model.ts").NativeTool;
|
|
40
|
-
constructor();
|
|
41
|
-
/** Never a client-side function tool — xAI runs retrieval server-side. */
|
|
42
|
-
_getDeclaration(): undefined;
|
|
43
|
-
/** Server-side tool: nothing to execute locally. */
|
|
44
|
-
runAsync(): Promise<unknown>;
|
|
45
|
-
processLlmRequest({ llmRequest }: {
|
|
46
|
-
llmRequest: LlmRequest;
|
|
47
|
-
}): Promise<void>;
|
|
48
|
-
}
|
|
49
|
-
/** Shared instance, mirroring WEB_SEARCH / X_SEARCH. */
|
|
50
|
-
export declare const COLLECTIONS_SEARCH: CollectionsSearchTool;
|
|
51
|
-
/** True when the agent requested collections search (xAI sentinel path), by marker. */
|
|
52
|
-
export declare function wantsCollectionsSearch(llmRequest: LlmRequest): boolean;
|
|
53
|
-
/** Sentinel test used by the request builder to skip function-tool emission: the collections_search marker, on either form. */
|
|
54
|
-
export declare function isCollectionsSearchSentinel(tool: unknown): boolean;
|
|
55
|
-
/** The XAI_COLLECTION* readers live in lib/tools/xaiSearchParams.ts (no @google/adk); re-exported here under their old names. */
|
|
56
|
-
export { collectionIdsFromEnv, collectionsMaxResultsFromEnv } from './xaiSearchParams.ts';
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* lib/tools/collectionsSearchTool.ts — xAI Collections search, sentinel-style.
|
|
3
|
-
*
|
|
4
|
-
* WHY this file exists:
|
|
5
|
-
* xAI's Agent Tools API can search "Collections" — hosted document stores
|
|
6
|
-
* (PDFs, text, CSVs) uploaded at console.x.ai or via the management API —
|
|
7
|
-
* semantic RAG run SERVER-SIDE, with citations back to source files
|
|
8
|
-
* (collections://<collection_id>/files/<file_id>). Declaring
|
|
9
|
-
* `collections_search` in an agent's YAML tools list turns it on for
|
|
10
|
-
* grok-* agents; xAI decides retrieval, we never ship documents in the
|
|
11
|
-
* prompt.
|
|
12
|
-
*
|
|
13
|
-
* HOW IT WORKS (mirrors xSearchTool.ts exactly):
|
|
14
|
-
* The sentinel self-registers in llmRequest.toolsDict; _getDeclaration()
|
|
15
|
-
* returns undefined so it is never sent as a client-side function tool.
|
|
16
|
-
* The GptLlm/GrokLlm request builder calls wantsCollectionsSearch() and
|
|
17
|
-
* appends the OpenAI-compatible wire shape:
|
|
18
|
-
* { type: 'file_search', vector_store_ids: [...], max_num_results? }
|
|
19
|
-
*
|
|
20
|
-
* WHICH COLLECTIONS: ids come from the environment, not YAML —
|
|
21
|
-
* XAI_COLLECTION_IDS (comma-separated) names the collections, and
|
|
22
|
-
* XAI_COLLECTIONS_MAX_RESULTS optionally caps retrieved chunks. Ids are
|
|
23
|
-
* deployment configuration (they differ per account/stage), which is
|
|
24
|
-
* what .env is for; the YAML stays shareable. Declared with no ids
|
|
25
|
-
* configured, the tool is omitted with a warning — never fatal.
|
|
26
|
-
*
|
|
27
|
-
* SCOPE: xAI-only. OpenAI's Responses API shares the file_search wire
|
|
28
|
-
* shape but searches OPENAI vector stores — a different product with
|
|
29
|
-
* different ids — so this sentinel gates to grok-* models and is a
|
|
30
|
-
* silent no-op everywhere else (same non-throwing routing contract as
|
|
31
|
-
* web_search / x_search).
|
|
32
|
-
*/
|
|
33
|
-
import { BaseTool } from '../adkPeer.js';
|
|
34
|
-
import { providerForModel } from '../models/providerMap.js';
|
|
35
|
-
import { COLLECTIONS_SEARCH_MARKER } from './nativeTools.js';
|
|
36
|
-
import { NATIVE_TOOL, nativeToolMarkerOf } from './tool.js';
|
|
37
|
-
export const COLLECTIONS_SEARCH_TOOL_NAME = 'collections_search';
|
|
38
|
-
/** The ADK runtime's form of COLLECTIONS_SEARCH_MARKER (lib/tools/nativeTools.ts), carrying its marker. */
|
|
39
|
-
export class CollectionsSearchTool extends BaseTool {
|
|
40
|
-
[NATIVE_TOOL] = COLLECTIONS_SEARCH_MARKER[NATIVE_TOOL];
|
|
41
|
-
constructor() {
|
|
42
|
-
super({ name: COLLECTIONS_SEARCH_TOOL_NAME, description: COLLECTIONS_SEARCH_MARKER.description });
|
|
43
|
-
}
|
|
44
|
-
/** Never a client-side function tool — xAI runs retrieval server-side. */
|
|
45
|
-
_getDeclaration() {
|
|
46
|
-
return undefined;
|
|
47
|
-
}
|
|
48
|
-
/** Server-side tool: nothing to execute locally. */
|
|
49
|
-
async runAsync() {
|
|
50
|
-
return Promise.resolve();
|
|
51
|
-
}
|
|
52
|
-
async processLlmRequest({ llmRequest }) {
|
|
53
|
-
if (!llmRequest.model)
|
|
54
|
-
return;
|
|
55
|
-
if (providerForModel(llmRequest.model) !== 'xai')
|
|
56
|
-
return; // no-op elsewhere
|
|
57
|
-
llmRequest.toolsDict[COLLECTIONS_SEARCH_TOOL_NAME] = this;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
/** Shared instance, mirroring WEB_SEARCH / X_SEARCH. */
|
|
61
|
-
export const COLLECTIONS_SEARCH = new CollectionsSearchTool();
|
|
62
|
-
/** True when the agent requested collections search (xAI sentinel path), by marker. */
|
|
63
|
-
export function wantsCollectionsSearch(llmRequest) {
|
|
64
|
-
return isCollectionsSearchSentinel(llmRequest.toolsDict?.[COLLECTIONS_SEARCH_TOOL_NAME]);
|
|
65
|
-
}
|
|
66
|
-
/** Sentinel test used by the request builder to skip function-tool emission: the collections_search marker, on either form. */
|
|
67
|
-
export function isCollectionsSearchSentinel(tool) {
|
|
68
|
-
return nativeToolMarkerOf(tool) === 'collections_search';
|
|
69
|
-
}
|
|
70
|
-
/** The XAI_COLLECTION* readers live in lib/tools/xaiSearchParams.ts (no @google/adk); re-exported here under their old names. */
|
|
71
|
-
export { collectionIdsFromEnv, collectionsMaxResultsFromEnv } from './xaiSearchParams.js';
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* lib/tools/urlContextTool.ts — `url_context`: the model reads the pages
|
|
3
|
-
* whose URLs appear in the conversation, server-side, on Gemini.
|
|
4
|
-
*
|
|
5
|
-
* WHY: ADK's URL_CONTEXT is Gemini's built-in URL reading, and it THROWS for
|
|
6
|
-
* any other model, which would fail a mixed-provider syndicate at request
|
|
7
|
-
* time. This is the same tool made safe to declare anywhere, the pattern
|
|
8
|
-
* web_search uses: on a Gemini model it adds `{ urlContext: {} }` to the
|
|
9
|
-
* request; on any other it does nothing, and `npm run doctor` reports it as
|
|
10
|
-
* dropped (lib/models/capabilities.ts). For reading a page on every
|
|
11
|
-
* provider, declare `web_extract` (client-side, SSRF-guarded).
|
|
12
|
-
*
|
|
13
|
-
* Exposure: Google fetches the URLs, not this host, so no address of this
|
|
14
|
-
* deployment's network is reachable through it. Page text arrives as model
|
|
15
|
-
* input; treat it as data, as any fetched page.
|
|
16
|
-
*/
|
|
17
|
-
import { BaseTool } from '../adkPeer.ts';
|
|
18
|
-
import type { LlmRequest } from '@google/adk';
|
|
19
|
-
import { NATIVE_TOOL } from './tool.ts';
|
|
20
|
-
export declare const URL_CONTEXT_TOOL_NAME = "url_context";
|
|
21
|
-
/** The ADK runtime's form of URL_CONTEXT_MARKER (lib/tools/nativeTools.ts), carrying its marker. */
|
|
22
|
-
export declare class UrlContextTool extends BaseTool {
|
|
23
|
-
readonly [NATIVE_TOOL]: import("../model.ts").NativeTool;
|
|
24
|
-
constructor();
|
|
25
|
-
/** Never a client-side function tool. */
|
|
26
|
-
_getDeclaration(): undefined;
|
|
27
|
-
runAsync(): Promise<unknown>;
|
|
28
|
-
processLlmRequest({ llmRequest }: {
|
|
29
|
-
llmRequest: LlmRequest;
|
|
30
|
-
}): Promise<void>;
|
|
31
|
-
}
|
|
32
|
-
export declare const URL_CONTEXT: UrlContextTool;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* lib/tools/urlContextTool.ts — `url_context`: the model reads the pages
|
|
3
|
-
* whose URLs appear in the conversation, server-side, on Gemini.
|
|
4
|
-
*
|
|
5
|
-
* WHY: ADK's URL_CONTEXT is Gemini's built-in URL reading, and it THROWS for
|
|
6
|
-
* any other model, which would fail a mixed-provider syndicate at request
|
|
7
|
-
* time. This is the same tool made safe to declare anywhere, the pattern
|
|
8
|
-
* web_search uses: on a Gemini model it adds `{ urlContext: {} }` to the
|
|
9
|
-
* request; on any other it does nothing, and `npm run doctor` reports it as
|
|
10
|
-
* dropped (lib/models/capabilities.ts). For reading a page on every
|
|
11
|
-
* provider, declare `web_extract` (client-side, SSRF-guarded).
|
|
12
|
-
*
|
|
13
|
-
* Exposure: Google fetches the URLs, not this host, so no address of this
|
|
14
|
-
* deployment's network is reachable through it. Page text arrives as model
|
|
15
|
-
* input; treat it as data, as any fetched page.
|
|
16
|
-
*/
|
|
17
|
-
import { BaseTool } from '../adkPeer.js';
|
|
18
|
-
import { providerForModel } from '../models/providerMap.js';
|
|
19
|
-
import { URL_CONTEXT_MARKER } from './nativeTools.js';
|
|
20
|
-
import { NATIVE_TOOL } from './tool.js';
|
|
21
|
-
export const URL_CONTEXT_TOOL_NAME = 'url_context';
|
|
22
|
-
/** The ADK runtime's form of URL_CONTEXT_MARKER (lib/tools/nativeTools.ts), carrying its marker. */
|
|
23
|
-
export class UrlContextTool extends BaseTool {
|
|
24
|
-
[NATIVE_TOOL] = URL_CONTEXT_MARKER[NATIVE_TOOL];
|
|
25
|
-
constructor() {
|
|
26
|
-
super({ name: URL_CONTEXT_TOOL_NAME, description: URL_CONTEXT_MARKER.description });
|
|
27
|
-
}
|
|
28
|
-
/** Never a client-side function tool. */
|
|
29
|
-
_getDeclaration() {
|
|
30
|
-
return undefined;
|
|
31
|
-
}
|
|
32
|
-
async runAsync() {
|
|
33
|
-
return Promise.resolve();
|
|
34
|
-
}
|
|
35
|
-
async processLlmRequest({ llmRequest }) {
|
|
36
|
-
if (!llmRequest.model || providerForModel(llmRequest.model) !== 'gemini')
|
|
37
|
-
return;
|
|
38
|
-
llmRequest.config = llmRequest.config ?? {};
|
|
39
|
-
llmRequest.config.tools = llmRequest.config.tools ?? [];
|
|
40
|
-
llmRequest.config.tools.push({ urlContext: {} });
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
export const URL_CONTEXT = new UrlContextTool();
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* lib/tools/webSearchTool.ts — provider-agnostic web search.
|
|
3
|
-
*
|
|
4
|
-
* WHY this file exists:
|
|
5
|
-
* ADK's built-in GOOGLE_SEARCH tool is Gemini grounding — it THROWS for any
|
|
6
|
-
* non-Gemini model. But every cloud provider this framework routes to has
|
|
7
|
-
* its own native web search: Gemini grounding, Anthropic's web_search
|
|
8
|
-
* server tool, OpenAI's Responses web_search tool, xAI's web_search server
|
|
9
|
-
* tool.
|
|
10
|
-
* Declaring `web_search` in an agent's YAML tools list routes to whichever
|
|
11
|
-
* of those the agent's model supports — the YAML stays model-agnostic.
|
|
12
|
-
*
|
|
13
|
-
* HOW IT WORKS:
|
|
14
|
-
* ADK calls processLlmRequest() on every tool while building the request,
|
|
15
|
-
* with llmRequest.model already set (LlmAgent resolves the model first).
|
|
16
|
-
* - Gemini model → push { googleSearch: {} } into config.tools, exactly
|
|
17
|
-
* what ADK's own GoogleSearchTool does for Gemini 2+.
|
|
18
|
-
* - Anything else → self-register in llmRequest.toolsDict as a sentinel.
|
|
19
|
-
* _getDeclaration() returns undefined, so the sentinel is never sent as
|
|
20
|
-
* a client-side function tool; each provider adapter calls
|
|
21
|
-
* wantsWebSearch(llmRequest) and enables its provider's NATIVE search
|
|
22
|
-
* (Claude: web_search server tool; GPT: Responses web_search; Grok:
|
|
23
|
-
* Agent Tools web_search). Models with no native search (local Ollama) omit
|
|
24
|
-
* the tool and warn — local mode stays keyless by design.
|
|
25
|
-
*
|
|
26
|
-
* `google_search` remains available as the Gemini-only ADK tool for
|
|
27
|
-
* backward compatibility; new YAMLs should declare `web_search`.
|
|
28
|
-
*/
|
|
29
|
-
import { BaseTool } from '../adkPeer.ts';
|
|
30
|
-
import type { LlmRequest } from '@google/adk';
|
|
31
|
-
import { NATIVE_TOOL } from './tool.ts';
|
|
32
|
-
export declare const WEB_SEARCH_TOOL_NAME = "web_search";
|
|
33
|
-
/** The ADK runtime's form of WEB_SEARCH_MARKER (lib/tools/nativeTools.ts), carrying its marker. */
|
|
34
|
-
export declare class WebSearchTool extends BaseTool {
|
|
35
|
-
readonly [NATIVE_TOOL]: import("../model.ts").NativeTool;
|
|
36
|
-
constructor();
|
|
37
|
-
/** Never a client-side function tool — providers run search server-side. */
|
|
38
|
-
_getDeclaration(): undefined;
|
|
39
|
-
/** Server-side tool: nothing to execute locally. */
|
|
40
|
-
runAsync(): Promise<unknown>;
|
|
41
|
-
processLlmRequest({ llmRequest }: {
|
|
42
|
-
llmRequest: LlmRequest;
|
|
43
|
-
}): Promise<void>;
|
|
44
|
-
}
|
|
45
|
-
/** Shared instance, mirroring ADK's GOOGLE_SEARCH constant pattern. */
|
|
46
|
-
export declare const WEB_SEARCH: WebSearchTool;
|
|
47
|
-
/** True when the agent requested web search (non-Gemini sentinel path), by marker. */
|
|
48
|
-
export declare function wantsWebSearch(llmRequest: LlmRequest): boolean;
|
|
49
|
-
/** True for toolsDict entries adapters must NOT send as function tools: the web_search marker, on either form. */
|
|
50
|
-
export declare function isWebSearchSentinel(tool: unknown): boolean;
|
|
51
|
-
export { xaiWebSearchParamsFromEnv } from './xaiSearchParams.ts';
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* lib/tools/webSearchTool.ts — provider-agnostic web search.
|
|
3
|
-
*
|
|
4
|
-
* WHY this file exists:
|
|
5
|
-
* ADK's built-in GOOGLE_SEARCH tool is Gemini grounding — it THROWS for any
|
|
6
|
-
* non-Gemini model. But every cloud provider this framework routes to has
|
|
7
|
-
* its own native web search: Gemini grounding, Anthropic's web_search
|
|
8
|
-
* server tool, OpenAI's Responses web_search tool, xAI's web_search server
|
|
9
|
-
* tool.
|
|
10
|
-
* Declaring `web_search` in an agent's YAML tools list routes to whichever
|
|
11
|
-
* of those the agent's model supports — the YAML stays model-agnostic.
|
|
12
|
-
*
|
|
13
|
-
* HOW IT WORKS:
|
|
14
|
-
* ADK calls processLlmRequest() on every tool while building the request,
|
|
15
|
-
* with llmRequest.model already set (LlmAgent resolves the model first).
|
|
16
|
-
* - Gemini model → push { googleSearch: {} } into config.tools, exactly
|
|
17
|
-
* what ADK's own GoogleSearchTool does for Gemini 2+.
|
|
18
|
-
* - Anything else → self-register in llmRequest.toolsDict as a sentinel.
|
|
19
|
-
* _getDeclaration() returns undefined, so the sentinel is never sent as
|
|
20
|
-
* a client-side function tool; each provider adapter calls
|
|
21
|
-
* wantsWebSearch(llmRequest) and enables its provider's NATIVE search
|
|
22
|
-
* (Claude: web_search server tool; GPT: Responses web_search; Grok:
|
|
23
|
-
* Agent Tools web_search). Models with no native search (local Ollama) omit
|
|
24
|
-
* the tool and warn — local mode stays keyless by design.
|
|
25
|
-
*
|
|
26
|
-
* `google_search` remains available as the Gemini-only ADK tool for
|
|
27
|
-
* backward compatibility; new YAMLs should declare `web_search`.
|
|
28
|
-
*/
|
|
29
|
-
import { BaseTool } from '../adkPeer.js';
|
|
30
|
-
import { providerForModel } from '../models/providerMap.js';
|
|
31
|
-
import { WEB_SEARCH_MARKER } from './nativeTools.js';
|
|
32
|
-
import { NATIVE_TOOL, nativeToolMarkerOf } from './tool.js';
|
|
33
|
-
export const WEB_SEARCH_TOOL_NAME = 'web_search';
|
|
34
|
-
/** The ADK runtime's form of WEB_SEARCH_MARKER (lib/tools/nativeTools.ts), carrying its marker. */
|
|
35
|
-
export class WebSearchTool extends BaseTool {
|
|
36
|
-
[NATIVE_TOOL] = WEB_SEARCH_MARKER[NATIVE_TOOL];
|
|
37
|
-
constructor() {
|
|
38
|
-
super({ name: WEB_SEARCH_TOOL_NAME, description: WEB_SEARCH_MARKER.description });
|
|
39
|
-
}
|
|
40
|
-
/** Never a client-side function tool — providers run search server-side. */
|
|
41
|
-
_getDeclaration() {
|
|
42
|
-
return undefined;
|
|
43
|
-
}
|
|
44
|
-
/** Server-side tool: nothing to execute locally. */
|
|
45
|
-
async runAsync() {
|
|
46
|
-
return Promise.resolve();
|
|
47
|
-
}
|
|
48
|
-
async processLlmRequest({ llmRequest }) {
|
|
49
|
-
if (!llmRequest.model)
|
|
50
|
-
return;
|
|
51
|
-
if (providerForModel(llmRequest.model) === 'gemini') {
|
|
52
|
-
// Native Gemini grounding — same wire shape ADK's GoogleSearchTool
|
|
53
|
-
// emits for Gemini 2+ (we can't reuse that class: it throws for
|
|
54
|
-
// non-Gemini models, and this tool must never throw on routing).
|
|
55
|
-
llmRequest.config = llmRequest.config ?? {};
|
|
56
|
-
llmRequest.config.tools = llmRequest.config.tools ?? [];
|
|
57
|
-
llmRequest.config.tools.push({ googleSearch: {} });
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
// Non-Gemini: leave a sentinel for the provider adapter. Safe because
|
|
61
|
-
// _getDeclaration() is undefined — ADK's appendTools never adds this
|
|
62
|
-
// to the function-tool declarations sent to the model.
|
|
63
|
-
llmRequest.toolsDict[WEB_SEARCH_TOOL_NAME] = this;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
/** Shared instance, mirroring ADK's GOOGLE_SEARCH constant pattern. */
|
|
67
|
-
export const WEB_SEARCH = new WebSearchTool();
|
|
68
|
-
/** True when the agent requested web search (non-Gemini sentinel path), by marker. */
|
|
69
|
-
export function wantsWebSearch(llmRequest) {
|
|
70
|
-
return isWebSearchSentinel(llmRequest.toolsDict?.[WEB_SEARCH_TOOL_NAME]);
|
|
71
|
-
}
|
|
72
|
-
/** True for toolsDict entries adapters must NOT send as function tools: the web_search marker, on either form. */
|
|
73
|
-
export function isWebSearchSentinel(tool) {
|
|
74
|
-
return nativeToolMarkerOf(tool) === 'web_search';
|
|
75
|
-
}
|
|
76
|
-
// ── xAI-only server-side constraints ─────────────────────────────────────────
|
|
77
|
-
//
|
|
78
|
-
// xAI's web_search domain filters (XAI_WEB_SEARCH_ALLOWED_DOMAINS /
|
|
79
|
-
// XAI_WEB_SEARCH_EXCLUDED_DOMAINS) are read in lib/tools/xaiSearchParams.ts,
|
|
80
|
-
// which imports nothing, so GrokAdapter reaches no @google/adk. Re-exported
|
|
81
|
-
// here under the old name.
|
|
82
|
-
export { xaiWebSearchParamsFromEnv } from './xaiSearchParams.js';
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* lib/tools/xSearchTool.ts — xAI X (Twitter) search, sentinel-style.
|
|
3
|
-
*
|
|
4
|
-
* WHY this file exists:
|
|
5
|
-
* xAI's Agent Tools API exposes `x_search` — server-side live search over
|
|
6
|
-
* X posts — as a first-class tool alongside `web_search` (verified live
|
|
7
|
-
* against api.x.ai/v1/responses, 2026-07-24). It is the one search
|
|
8
|
-
* capability no other provider offers, and the reason to route a
|
|
9
|
-
* news/social agent to a grok-* model at all.
|
|
10
|
-
*
|
|
11
|
-
* HOW IT WORKS (mirrors webSearchTool.ts exactly):
|
|
12
|
-
* Declaring `x_search` in an agent's YAML tools list self-registers a
|
|
13
|
-
* sentinel in llmRequest.toolsDict. _getDeclaration() returns undefined so
|
|
14
|
-
* it is never sent as a client-side function tool; the GptLlm/GrokLlm
|
|
15
|
-
* request builder calls wantsXSearch(llmRequest) and appends
|
|
16
|
-
* { type: 'x_search' } to the provider tools.
|
|
17
|
-
*
|
|
18
|
-
* SCOPE: xAI-only. Declare it ONLY on grok-* agents — other Responses-API
|
|
19
|
-
* providers (OpenAI) reject the unknown tool type with a 400, and Gemini/
|
|
20
|
-
* Anthropic adapters ignore the sentinel entirely (the tool degrades to a
|
|
21
|
-
* no-op there rather than throwing, same non-throwing routing contract as
|
|
22
|
-
* web_search).
|
|
23
|
-
*
|
|
24
|
-
* WHICH CONSTRAINTS: xAI accepts server-side search constraints on the tool
|
|
25
|
-
* object itself (verified against docs.x.ai/developers/tools/x-search,
|
|
26
|
-
* 2026-08-02): from_date/to_date (YYYY-MM-DD) and allowed_x_handles/
|
|
27
|
-
* excluded_x_handles (≤20 each, mutually exclusive). They come from the
|
|
28
|
-
* environment, not YAML — XAI_X_SEARCH_FROM_DATE, XAI_X_SEARCH_TO_DATE,
|
|
29
|
-
* XAI_X_SEARCH_ALLOWED_HANDLES, XAI_X_SEARCH_EXCLUDED_HANDLES (handle
|
|
30
|
-
* lists comma-separated, leading @ tolerated) — the XAI_COLLECTION_IDS
|
|
31
|
-
* doctrine: constraints are deployment configuration, the YAML stays
|
|
32
|
-
* shareable. Misconfiguration degrades with a warning, never fatally:
|
|
33
|
-
* malformed dates are dropped, oversize handle lists truncate, and when
|
|
34
|
-
* both lists are set the allowlist wins.
|
|
35
|
-
*/
|
|
36
|
-
import { BaseTool } from '../adkPeer.ts';
|
|
37
|
-
import type { LlmRequest } from '@google/adk';
|
|
38
|
-
import { NATIVE_TOOL } from './tool.ts';
|
|
39
|
-
export declare const X_SEARCH_TOOL_NAME = "x_search";
|
|
40
|
-
/** The ADK runtime's form of X_SEARCH_MARKER (lib/tools/nativeTools.ts), carrying its marker. */
|
|
41
|
-
export declare class XSearchTool extends BaseTool {
|
|
42
|
-
readonly [NATIVE_TOOL]: import("../model.ts").NativeTool;
|
|
43
|
-
constructor();
|
|
44
|
-
/** Never a client-side function tool — xAI runs the search server-side. */
|
|
45
|
-
_getDeclaration(): undefined;
|
|
46
|
-
/** Server-side tool: nothing to execute locally. */
|
|
47
|
-
runAsync(): Promise<unknown>;
|
|
48
|
-
processLlmRequest({ llmRequest }: {
|
|
49
|
-
llmRequest: LlmRequest;
|
|
50
|
-
}): Promise<void>;
|
|
51
|
-
}
|
|
52
|
-
/** Shared instance, mirroring WEB_SEARCH. */
|
|
53
|
-
export declare const X_SEARCH: XSearchTool;
|
|
54
|
-
/** True when the agent requested X search (xAI sentinel path), by marker. */
|
|
55
|
-
export declare function wantsXSearch(llmRequest: LlmRequest): boolean;
|
|
56
|
-
/** Sentinel test used by the request builder to skip function-tool emission: the x_search marker, on either form. */
|
|
57
|
-
export declare function isXSearchSentinel(tool: unknown): boolean;
|
|
58
|
-
/** The XAI_X_SEARCH_* reader lives in lib/tools/xaiSearchParams.ts (no @google/adk); re-exported here under its old name. */
|
|
59
|
-
export { xSearchParamsFromEnv } from './xaiSearchParams.ts';
|