@google/adk 1.2.0 → 1.3.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/dist/cjs/agents/base_agent.js +19 -1
- package/dist/cjs/agents/instructions.js +81 -33
- package/dist/cjs/agents/invocation_context.js +0 -1
- package/dist/cjs/agents/llm_agent.js +52 -5
- package/dist/cjs/agents/processors/agent_transfer_llm_request_processor.js +7 -0
- package/dist/cjs/agents/processors/basic_llm_request_processor.js +8 -1
- package/dist/cjs/agents/processors/content_processor_utils.js +37 -24
- package/dist/cjs/agents/processors/content_request_processor.js +7 -0
- package/dist/cjs/agents/processors/context_compactor_request_processor.js +12 -0
- package/dist/cjs/agents/processors/identity_llm_request_processor.js +7 -0
- package/dist/cjs/agents/processors/instructions_llm_request_processor.js +5 -0
- package/dist/cjs/agents/processors/request_confirmation_llm_request_processor.js +9 -1
- package/dist/cjs/agents/processors/tool_filter_request_processor.js +7 -1
- package/dist/cjs/auth/auth_preprocessor.js +12 -10
- package/dist/cjs/auth/oauth2/oauth2_discovery.js +1 -1
- package/dist/cjs/code_executors/code_executor_context.js +7 -7
- package/dist/cjs/common.js +39 -0
- package/dist/cjs/context/summarizers/llm_summarizer.js +11 -0
- package/dist/cjs/context/token_based_context_compactor.js +1 -1
- package/dist/cjs/events/event.js +1 -1
- package/dist/cjs/integrations/agent_registry/agent_registry_mcp_toolset.js +21 -2
- package/dist/cjs/models/gemini_llm_connection.js +62 -19
- package/dist/cjs/models/google_llm.js +26 -8
- package/dist/cjs/plugins/security_plugin.js +16 -0
- package/dist/cjs/sessions/base_session_service.js +13 -2
- package/dist/cjs/sessions/database_session_service.js +2 -2
- package/dist/cjs/sessions/db/schema.js +45 -10
- package/dist/cjs/sessions/in_memory_session_service.js +2 -1
- package/dist/cjs/sessions/vertex_ai_session_service.js +2 -1
- package/dist/cjs/skills/gcp_skill_registry.js +104 -0
- package/dist/cjs/skills/loader.js +65 -0
- package/dist/cjs/skills/skill_registry.js +27 -0
- package/dist/cjs/tools/openapi_tool/openapi_spec_parser/openapi_spec_parser.js +232 -0
- package/dist/cjs/tools/openapi_tool/openapi_spec_parser/operation_parser.js +224 -0
- package/dist/cjs/tools/openapi_tool/openapi_spec_parser/tool_auth_handler.js +127 -0
- package/dist/cjs/tools/openapi_tool/openapi_toolset.js +133 -0
- package/dist/cjs/tools/openapi_tool/rest_api_tool.js +256 -0
- package/dist/cjs/tools/skill/load_skill_resource_tool.js +25 -3
- package/dist/cjs/tools/skill/load_skill_tool.js +12 -1
- package/dist/cjs/tools/skill/run_skill_script_tool.js +12 -1
- package/dist/cjs/tools/skill/search_skills_tool.js +108 -0
- package/dist/cjs/tools/skill/skill_toolset.js +40 -5
- package/dist/cjs/utils/async_queue.js +88 -0
- package/dist/cjs/utils/case_utils.js +53 -0
- package/dist/cjs/utils/env_aware_utils.js +4 -0
- package/dist/cjs/utils/live_connection_utils.js +284 -0
- package/dist/cjs/utils/model_name.js +9 -0
- package/dist/cjs/utils/streaming_utils.js +9 -8
- package/dist/cjs/version.js +1 -1
- package/dist/esm/agents/base_agent.js +19 -1
- package/dist/esm/agents/instructions.js +81 -33
- package/dist/esm/agents/invocation_context.js +0 -1
- package/dist/esm/agents/llm_agent.js +53 -5
- package/dist/esm/agents/processors/agent_transfer_llm_request_processor.js +7 -0
- package/dist/esm/agents/processors/basic_llm_request_processor.js +8 -1
- package/dist/esm/agents/processors/content_processor_utils.js +35 -23
- package/dist/esm/agents/processors/content_request_processor.js +7 -0
- package/dist/esm/agents/processors/context_compactor_request_processor.js +12 -0
- package/dist/esm/agents/processors/identity_llm_request_processor.js +7 -0
- package/dist/esm/agents/processors/instructions_llm_request_processor.js +5 -0
- package/dist/esm/agents/processors/request_confirmation_llm_request_processor.js +9 -1
- package/dist/esm/agents/processors/tool_filter_request_processor.js +7 -1
- package/dist/esm/auth/auth_preprocessor.js +12 -10
- package/dist/esm/auth/oauth2/oauth2_discovery.js +1 -1
- package/dist/esm/code_executors/code_executor_context.js +7 -7
- package/dist/esm/common.js +33 -1
- package/dist/esm/context/summarizers/llm_summarizer.js +11 -0
- package/dist/esm/context/token_based_context_compactor.js +1 -1
- package/dist/esm/events/event.js +1 -1
- package/dist/esm/integrations/agent_registry/agent_registry_mcp_toolset.js +21 -2
- package/dist/esm/models/gemini_llm_connection.js +62 -19
- package/dist/esm/models/google_llm.js +26 -8
- package/dist/esm/plugins/security_plugin.js +16 -0
- package/dist/esm/sessions/base_session_service.js +11 -1
- package/dist/esm/sessions/database_session_service.js +2 -2
- package/dist/esm/sessions/db/schema.js +44 -10
- package/dist/esm/sessions/in_memory_session_service.js +4 -2
- package/dist/esm/sessions/vertex_ai_session_service.js +4 -2
- package/dist/esm/skills/gcp_skill_registry.js +78 -0
- package/dist/esm/skills/loader.js +64 -0
- package/dist/esm/skills/skill_registry.js +7 -0
- package/dist/esm/tools/openapi_tool/openapi_spec_parser/openapi_spec_parser.js +206 -0
- package/dist/esm/tools/openapi_tool/openapi_spec_parser/operation_parser.js +198 -0
- package/dist/esm/tools/openapi_tool/openapi_spec_parser/tool_auth_handler.js +101 -0
- package/dist/esm/tools/openapi_tool/openapi_toolset.js +97 -0
- package/dist/esm/tools/openapi_tool/rest_api_tool.js +229 -0
- package/dist/esm/tools/skill/load_skill_resource_tool.js +25 -3
- package/dist/esm/tools/skill/load_skill_tool.js +12 -1
- package/dist/esm/tools/skill/run_skill_script_tool.js +12 -1
- package/dist/esm/tools/skill/search_skills_tool.js +82 -0
- package/dist/esm/tools/skill/skill_toolset.js +40 -5
- package/dist/esm/utils/async_queue.js +60 -0
- package/dist/esm/utils/case_utils.js +25 -0
- package/dist/esm/utils/env_aware_utils.js +4 -0
- package/dist/esm/utils/live_connection_utils.js +256 -0
- package/dist/esm/utils/model_name.js +8 -0
- package/dist/esm/utils/streaming_utils.js +9 -8
- package/dist/esm/version.js +1 -1
- package/dist/types/a2a/a2a_remote_agent_utils.d.ts +29 -4
- package/dist/types/a2a/event_converter_utils.d.ts +14 -1
- package/dist/types/a2a/metadata_converter_utils.d.ts +18 -0
- package/dist/types/a2a/part_converter_utils.d.ts +51 -6
- package/dist/types/agents/invocation_context.d.ts +0 -9
- package/dist/types/agents/llm_agent.d.ts +14 -0
- package/dist/types/agents/processors/agent_transfer_llm_request_processor.d.ts +14 -0
- package/dist/types/agents/processors/basic_llm_request_processor.d.ts +7 -0
- package/dist/types/agents/processors/content_processor_utils.d.ts +26 -0
- package/dist/types/agents/processors/content_request_processor.d.ts +16 -0
- package/dist/types/agents/processors/context_compactor_request_processor.d.ts +12 -0
- package/dist/types/agents/processors/identity_llm_request_processor.d.ts +7 -0
- package/dist/types/agents/processors/request_confirmation_llm_request_processor.d.ts +9 -1
- package/dist/types/agents/processors/tool_filter_request_processor.d.ts +12 -1
- package/dist/types/common.d.ts +15 -1
- package/dist/types/context/summarizers/llm_summarizer.d.ts +17 -0
- package/dist/types/events/event_actions.d.ts +1 -2
- package/dist/types/integrations/agent_registry/agent_registry_mcp_toolset.d.ts +21 -2
- package/dist/types/models/base_llm_connection.d.ts +10 -0
- package/dist/types/models/gemini_llm_connection.d.ts +15 -4
- package/dist/types/models/llm_response.d.ts +10 -1
- package/dist/types/plugins/security_plugin.d.ts +30 -0
- package/dist/types/sessions/base_session_service.d.ts +4 -0
- package/dist/types/sessions/db/schema.d.ts +1 -0
- package/dist/types/skills/gcp_skill_registry.d.ts +24 -0
- package/dist/types/skills/loader.d.ts +7 -0
- package/dist/types/skills/skill.d.ts +1 -1
- package/dist/types/skills/skill_registry.d.ts +29 -0
- package/dist/types/tools/openapi_tool/openapi_spec_parser/openapi_spec_parser.d.ts +34 -0
- package/dist/types/tools/openapi_tool/openapi_spec_parser/operation_parser.d.ts +59 -0
- package/dist/types/tools/openapi_tool/openapi_spec_parser/tool_auth_handler.d.ts +23 -0
- package/dist/types/tools/openapi_tool/openapi_toolset.d.ts +27 -0
- package/dist/types/tools/openapi_tool/rest_api_tool.d.ts +50 -0
- package/dist/types/tools/skill/load_skill_resource_tool.d.ts +1 -1
- package/dist/types/tools/skill/search_skills_tool.d.ts +14 -0
- package/dist/types/tools/skill/skill_toolset.d.ts +5 -0
- package/dist/types/utils/async_queue.d.ts +18 -0
- package/dist/types/utils/case_utils.d.ts +12 -0
- package/dist/types/utils/live_connection_utils.d.ts +30 -0
- package/dist/types/utils/model_name.d.ts +7 -0
- package/dist/types/utils/streaming_utils.d.ts +0 -1
- package/dist/types/version.d.ts +1 -1
- package/dist/web/agents/base_agent.js +31 -1
- package/dist/web/agents/instructions.js +81 -33
- package/dist/web/agents/invocation_context.js +0 -1
- package/dist/web/agents/llm_agent.js +53 -5
- package/dist/web/agents/processors/agent_transfer_llm_request_processor.js +7 -0
- package/dist/web/agents/processors/basic_llm_request_processor.js +8 -1
- package/dist/web/agents/processors/content_processor_utils.js +53 -23
- package/dist/web/agents/processors/content_request_processor.js +7 -0
- package/dist/web/agents/processors/context_compactor_request_processor.js +12 -0
- package/dist/web/agents/processors/identity_llm_request_processor.js +7 -0
- package/dist/web/agents/processors/instructions_llm_request_processor.js +5 -0
- package/dist/web/agents/processors/request_confirmation_llm_request_processor.js +9 -1
- package/dist/web/agents/processors/tool_filter_request_processor.js +7 -1
- package/dist/web/auth/auth_preprocessor.js +12 -10
- package/dist/web/auth/oauth2/oauth2_discovery.js +1 -1
- package/dist/web/code_executors/code_executor_context.js +7 -7
- package/dist/web/common.js +33 -1
- package/dist/web/context/summarizers/llm_summarizer.js +11 -0
- package/dist/web/context/token_based_context_compactor.js +1 -1
- package/dist/web/events/event.js +1 -1
- package/dist/web/integrations/agent_registry/agent_registry_mcp_toolset.js +21 -2
- package/dist/web/models/gemini_llm_connection.js +75 -19
- package/dist/web/models/google_llm.js +26 -8
- package/dist/web/plugins/security_plugin.js +16 -0
- package/dist/web/sessions/base_session_service.js +11 -1
- package/dist/web/sessions/database_session_service.js +2 -2
- package/dist/web/sessions/db/schema.js +44 -10
- package/dist/web/sessions/in_memory_session_service.js +4 -2
- package/dist/web/sessions/vertex_ai_session_service.js +4 -2
- package/dist/web/skills/gcp_skill_registry.js +78 -0
- package/dist/web/skills/loader.js +64 -0
- package/dist/web/skills/skill_registry.js +7 -0
- package/dist/web/tools/openapi_tool/openapi_spec_parser/openapi_spec_parser.js +221 -0
- package/dist/web/tools/openapi_tool/openapi_spec_parser/operation_parser.js +198 -0
- package/dist/web/tools/openapi_tool/openapi_spec_parser/tool_auth_handler.js +101 -0
- package/dist/web/tools/openapi_tool/openapi_toolset.js +97 -0
- package/dist/web/tools/openapi_tool/rest_api_tool.js +229 -0
- package/dist/web/tools/skill/load_skill_resource_tool.js +25 -3
- package/dist/web/tools/skill/load_skill_tool.js +12 -1
- package/dist/web/tools/skill/run_skill_script_tool.js +12 -1
- package/dist/web/tools/skill/search_skills_tool.js +82 -0
- package/dist/web/tools/skill/skill_toolset.js +40 -5
- package/dist/web/utils/async_queue.js +60 -0
- package/dist/web/utils/case_utils.js +25 -0
- package/dist/web/utils/env_aware_utils.js +4 -0
- package/dist/web/utils/live_connection_utils.js +254 -0
- package/dist/web/utils/model_name.js +8 -0
- package/dist/web/utils/streaming_utils.js +9 -8
- package/dist/web/version.js +1 -1
- package/package.json +3 -1
|
@@ -7,10 +7,12 @@ const require = topLevelCreateRequire(import.meta.url);
|
|
|
7
7
|
*/
|
|
8
8
|
var _a, _b;
|
|
9
9
|
import { context, trace } from "@opentelemetry/api";
|
|
10
|
+
import { FunctionTool } from "../tools/function_tool.js";
|
|
10
11
|
import {
|
|
11
12
|
createEvent,
|
|
12
13
|
createNewEventId,
|
|
13
14
|
getFunctionCalls,
|
|
15
|
+
getFunctionResponses,
|
|
14
16
|
isFinalResponse
|
|
15
17
|
} from "../events/event.js";
|
|
16
18
|
import { isBaseLlm } from "../models/base_llm.js";
|
|
@@ -32,6 +34,7 @@ import {
|
|
|
32
34
|
handleFunctionCallsAsync,
|
|
33
35
|
populateClientFunctionCallId
|
|
34
36
|
} from "./functions.js";
|
|
37
|
+
import { AUTH_PREPROCESSOR } from "../auth/auth_preprocessor.js";
|
|
35
38
|
import { AGENT_TRANSFER_LLM_REQUEST_PROCESSOR } from "./processors/agent_transfer_llm_request_processor.js";
|
|
36
39
|
import { BASIC_LLM_REQUEST_PROCESSOR } from "./processors/basic_llm_request_processor.js";
|
|
37
40
|
import { CODE_EXECUTION_REQUEST_PROCESSOR } from "./processors/code_execution_request_processor.js";
|
|
@@ -78,6 +81,7 @@ class LlmAgent extends (_b = BaseAgent, _a = LLM_AGENT_SIGNATURE_SYMBOL, _b) {
|
|
|
78
81
|
this.codeExecutor = config.codeExecutor;
|
|
79
82
|
this.requestProcessors = (_g = config.requestProcessors) != null ? _g : [
|
|
80
83
|
BASIC_LLM_REQUEST_PROCESSOR,
|
|
84
|
+
AUTH_PREPROCESSOR,
|
|
81
85
|
IDENTITY_LLM_REQUEST_PROCESSOR,
|
|
82
86
|
INSTRUCTIONS_LLM_REQUEST_PROCESSOR,
|
|
83
87
|
REQUEST_CONFIRMATION_LLM_REQUEST_PROCESSOR,
|
|
@@ -303,18 +307,26 @@ class LlmAgent extends (_b = BaseAgent, _a = LLM_AGENT_SIGNATURE_SYMBOL, _b) {
|
|
|
303
307
|
event.actions.stateDelta[this.outputKey] = result;
|
|
304
308
|
}
|
|
305
309
|
async *runAsyncImpl(context2) {
|
|
306
|
-
var _a2;
|
|
310
|
+
var _a2, _b2;
|
|
307
311
|
while (true) {
|
|
308
312
|
let lastEvent = void 0;
|
|
313
|
+
let stepHadToolCalls = false;
|
|
309
314
|
for await (const event of this.runOneStepAsync(context2)) {
|
|
310
315
|
if ((_a2 = context2.abortSignal) == null ? void 0 : _a2.aborted) {
|
|
311
316
|
return;
|
|
312
317
|
}
|
|
313
318
|
lastEvent = event;
|
|
319
|
+
if (getFunctionCalls(event).length > 0 || getFunctionResponses(event).length > 0) {
|
|
320
|
+
stepHadToolCalls = true;
|
|
321
|
+
}
|
|
314
322
|
this.maybeSaveOutputToState(event);
|
|
315
323
|
yield event;
|
|
316
324
|
}
|
|
317
|
-
if (!lastEvent
|
|
325
|
+
if (!lastEvent) {
|
|
326
|
+
break;
|
|
327
|
+
}
|
|
328
|
+
const isEmptyMetadataEvent = lastEvent.author === this.name && !lastEvent.partial && (!((_b2 = lastEvent.content) == null ? void 0 : _b2.parts) || lastEvent.content.parts.length === 0);
|
|
329
|
+
if (isFinalResponse(lastEvent) && !(isEmptyMetadataEvent && stepHadToolCalls)) {
|
|
318
330
|
break;
|
|
319
331
|
}
|
|
320
332
|
if (lastEvent.partial) {
|
|
@@ -339,6 +351,20 @@ class LlmAgent extends (_b = BaseAgent, _a = LLM_AGENT_SIGNATURE_SYMBOL, _b) {
|
|
|
339
351
|
// --------------------------------------------------------------------------
|
|
340
352
|
// #START LlmFlow Logic
|
|
341
353
|
// --------------------------------------------------------------------------
|
|
354
|
+
/**
|
|
355
|
+
* Runs the bidirectional (live) flow for this agent.
|
|
356
|
+
*
|
|
357
|
+
* Establishes a live connection to the model, drains the invocation's
|
|
358
|
+
* `liveRequestQueue` into the connection on a parallel task, and yields
|
|
359
|
+
* events derived from server messages until the queue closes, the model
|
|
360
|
+
* finishes, or an agent transfer occurs.
|
|
361
|
+
*
|
|
362
|
+
* If the live connection drops (network failure, server `goAway`) and a
|
|
363
|
+
* session resumption handle has been observed, the flow transparently
|
|
364
|
+
* reconnects using that handle up to {@link MAX_LIVE_RECONNECT_ATTEMPTS}
|
|
365
|
+
* times. Subsequent reconnects skip `sendHistory` because the server
|
|
366
|
+
* already holds the conversation state associated with the handle.
|
|
367
|
+
*/
|
|
342
368
|
// eslint-disable-next-line require-yield
|
|
343
369
|
async *runLiveFlow(_invocationContext) {
|
|
344
370
|
await Promise.resolve();
|
|
@@ -362,13 +388,28 @@ class LlmAgent extends (_b = BaseAgent, _a = LLM_AGENT_SIGNATURE_SYMBOL, _b) {
|
|
|
362
388
|
yield event;
|
|
363
389
|
}
|
|
364
390
|
}
|
|
365
|
-
|
|
391
|
+
const allTools = [...this.tools];
|
|
392
|
+
if (this.outputSchema && allTools.length > 0) {
|
|
393
|
+
const setModelResponseTool = new FunctionTool({
|
|
394
|
+
name: "set_model_response",
|
|
395
|
+
description: "Call this tool to submit your final response conforming to the output schema. Use this tool only when you have collected all the information and are ready to return the final answer.",
|
|
396
|
+
parameters: this.outputSchema,
|
|
397
|
+
execute: async (args, toolContext) => {
|
|
398
|
+
if (toolContext) {
|
|
399
|
+
toolContext.actions.skipSummarization = true;
|
|
400
|
+
}
|
|
401
|
+
return JSON.stringify(args);
|
|
402
|
+
}
|
|
403
|
+
});
|
|
404
|
+
allTools.push(setModelResponseTool);
|
|
405
|
+
}
|
|
406
|
+
for (const toolUnion of allTools) {
|
|
366
407
|
const toolContext = new Context({ invocationContext });
|
|
367
408
|
const tools = (await convertToolUnionToTools(
|
|
368
409
|
toolUnion,
|
|
369
410
|
new ReadonlyContext(invocationContext)
|
|
370
411
|
)).filter((tool) => {
|
|
371
|
-
return !llmRequest.allowedTools || llmRequest.allowedTools.includes(tool.name);
|
|
412
|
+
return !llmRequest.allowedTools || llmRequest.allowedTools.includes(tool.name) || tool.name === "set_model_response";
|
|
372
413
|
});
|
|
373
414
|
for (const tool of tools) {
|
|
374
415
|
await tool.processLlmRequest({ toolContext, llmRequest });
|
|
@@ -448,7 +489,14 @@ class LlmAgent extends (_b = BaseAgent, _a = LLM_AGENT_SIGNATURE_SYMBOL, _b) {
|
|
|
448
489
|
});
|
|
449
490
|
if (mergedEvent.content) {
|
|
450
491
|
const functionCalls = getFunctionCalls(mergedEvent);
|
|
451
|
-
|
|
492
|
+
const setModelResponseCall = functionCalls.find(
|
|
493
|
+
(call) => call.name === "set_model_response"
|
|
494
|
+
);
|
|
495
|
+
if (setModelResponseCall) {
|
|
496
|
+
const args = setModelResponseCall.args;
|
|
497
|
+
mergedEvent.content.parts = [{ text: JSON.stringify(args) }];
|
|
498
|
+
mergedEvent.actions.skipSummarization = true;
|
|
499
|
+
} else if (functionCalls && functionCalls.length) {
|
|
452
500
|
populateClientFunctionCallId(mergedEvent);
|
|
453
501
|
mergedEvent.longRunningToolIds = Array.from(
|
|
454
502
|
getLongRunningFunctionCalls(functionCalls, llmRequest.toolsDict)
|
|
@@ -30,6 +30,13 @@ class AgentTransferLlmRequestProcessor extends BaseLlmRequestProcessor {
|
|
|
30
30
|
}
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Appends transfer instructions and registers the `transfer_to_agent` tool
|
|
35
|
+
* when the agent has reachable transfer targets.
|
|
36
|
+
*
|
|
37
|
+
* @param invocationContext - The current invocation context.
|
|
38
|
+
* @param llmRequest - The request to augment with transfer instructions and the transfer tool.
|
|
39
|
+
*/
|
|
33
40
|
// eslint-disable-next-line require-yield
|
|
34
41
|
async *runAsync(invocationContext, llmRequest) {
|
|
35
42
|
if (!isLlmAgent(invocationContext.agent)) {
|
|
@@ -9,6 +9,13 @@ import { setOutputSchema } from "../../models/llm_request.js";
|
|
|
9
9
|
import { isLlmAgent } from "../llm_agent.js";
|
|
10
10
|
import { BaseLlmRequestProcessor } from "./base_llm_processor.js";
|
|
11
11
|
class BasicLlmRequestProcessor extends BaseLlmRequestProcessor {
|
|
12
|
+
/**
|
|
13
|
+
* Populates model name, generation config, output schema, and live connect
|
|
14
|
+
* settings on the request from the agent and run config.
|
|
15
|
+
*
|
|
16
|
+
* @param invocationContext - The current invocation context.
|
|
17
|
+
* @param llmRequest - The request object to populate in place.
|
|
18
|
+
*/
|
|
12
19
|
// eslint-disable-next-line require-yield
|
|
13
20
|
async *runAsync(invocationContext, llmRequest) {
|
|
14
21
|
var _a;
|
|
@@ -18,7 +25,7 @@ class BasicLlmRequestProcessor extends BaseLlmRequestProcessor {
|
|
|
18
25
|
}
|
|
19
26
|
llmRequest.model = agent.canonicalModel.model;
|
|
20
27
|
llmRequest.config = { ...(_a = agent.generateContentConfig) != null ? _a : {} };
|
|
21
|
-
if (agent.outputSchema) {
|
|
28
|
+
if (agent.outputSchema && (!agent.tools || agent.tools.length === 0)) {
|
|
22
29
|
setOutputSchema(llmRequest, agent.outputSchema);
|
|
23
30
|
}
|
|
24
31
|
if (invocationContext.runConfig) {
|
|
@@ -109,17 +109,19 @@ function convertForeignEvent(event) {
|
|
|
109
109
|
text: `[${event.author}] said: ${part.text}`
|
|
110
110
|
});
|
|
111
111
|
} else if (part.functionCall) {
|
|
112
|
-
const argsText = safeStringify(part.functionCall.args);
|
|
113
112
|
(_d = content.parts) == null ? void 0 : _d.push({
|
|
114
|
-
text: `[${event.author}] called tool \`${part.functionCall.name}\` with parameters: ${
|
|
113
|
+
text: `[${event.author}] called tool \`${part.functionCall.name}\` with parameters: ${safeStringify(
|
|
114
|
+
part.functionCall.args
|
|
115
|
+
)}`
|
|
115
116
|
});
|
|
116
117
|
} else if (part.functionResponse) {
|
|
117
|
-
const responseText = safeStringify(part.functionResponse.response);
|
|
118
118
|
(_e = content.parts) == null ? void 0 : _e.push({
|
|
119
|
-
text: `[${event.author}] tool \`${part.functionResponse.name}\` returned result: ${
|
|
119
|
+
text: `[${event.author}] tool \`${part.functionResponse.name}\` returned result: ${safeStringify(
|
|
120
|
+
part.functionResponse.response
|
|
121
|
+
)}`
|
|
120
122
|
});
|
|
121
123
|
} else {
|
|
122
|
-
(_f = content.parts) == null ? void 0 : _f.push(part);
|
|
124
|
+
(_f = content.parts) == null ? void 0 : _f.push(cloneDeep(part));
|
|
123
125
|
}
|
|
124
126
|
}
|
|
125
127
|
return createEvent({
|
|
@@ -135,9 +137,12 @@ function mergeFunctionResponseEvents(events) {
|
|
|
135
137
|
if (events.length === 0) {
|
|
136
138
|
throw new Error("Cannot merge an empty list of events.");
|
|
137
139
|
}
|
|
138
|
-
const mergedEvent = createEvent(
|
|
139
|
-
|
|
140
|
-
|
|
140
|
+
const mergedEvent = createEvent({
|
|
141
|
+
...events[0],
|
|
142
|
+
content: events[0].content ? cloneDeep(events[0].content) : void 0
|
|
143
|
+
});
|
|
144
|
+
const partsInMergedEvent = (_a = mergedEvent.content) == null ? void 0 : _a.parts;
|
|
145
|
+
if (!partsInMergedEvent || partsInMergedEvent.length === 0) {
|
|
141
146
|
throw new Error("There should be at least one function_response part.");
|
|
142
147
|
}
|
|
143
148
|
const partIndicesInMergedEvent = {};
|
|
@@ -152,16 +157,17 @@ function mergeFunctionResponseEvents(events) {
|
|
|
152
157
|
throw new Error("There should be at least one function_response part.");
|
|
153
158
|
}
|
|
154
159
|
for (const part of event.content.parts) {
|
|
155
|
-
|
|
156
|
-
|
|
160
|
+
const clonedPart = cloneDeep(part);
|
|
161
|
+
if (clonedPart.functionResponse && clonedPart.functionResponse.id) {
|
|
162
|
+
const functionCallId = clonedPart.functionResponse.id;
|
|
157
163
|
if (functionCallId in partIndicesInMergedEvent) {
|
|
158
|
-
partsInMergedEvent[partIndicesInMergedEvent[functionCallId]] =
|
|
164
|
+
partsInMergedEvent[partIndicesInMergedEvent[functionCallId]] = clonedPart;
|
|
159
165
|
} else {
|
|
160
|
-
partsInMergedEvent.push(
|
|
166
|
+
partsInMergedEvent.push(clonedPart);
|
|
161
167
|
partIndicesInMergedEvent[functionCallId] = partsInMergedEvent.length - 1;
|
|
162
168
|
}
|
|
163
169
|
} else {
|
|
164
|
-
partsInMergedEvent.push(
|
|
170
|
+
partsInMergedEvent.push(clonedPart);
|
|
165
171
|
}
|
|
166
172
|
}
|
|
167
173
|
}
|
|
@@ -176,7 +182,7 @@ function rearrangeEventsForLatestFunctionResponse(events) {
|
|
|
176
182
|
if (!(functionResponses == null ? void 0 : functionResponses.length)) {
|
|
177
183
|
return events;
|
|
178
184
|
}
|
|
179
|
-
|
|
185
|
+
const functionResponsesIds = new Set(
|
|
180
186
|
functionResponses.filter((response) => !!response.id).map((response) => response.id)
|
|
181
187
|
);
|
|
182
188
|
const secondLatestEvent = events.at(-2);
|
|
@@ -190,16 +196,16 @@ function rearrangeEventsForLatestFunctionResponse(events) {
|
|
|
190
196
|
}
|
|
191
197
|
}
|
|
192
198
|
}
|
|
193
|
-
let
|
|
199
|
+
let match;
|
|
194
200
|
for (let idx = events.length - 2; idx >= 0; idx--) {
|
|
195
201
|
const event = events[idx];
|
|
196
202
|
const functionCalls = getFunctionCalls(event);
|
|
197
203
|
if (!(functionCalls == null ? void 0 : functionCalls.length)) {
|
|
198
204
|
continue;
|
|
199
205
|
}
|
|
206
|
+
let matchedInEvent = false;
|
|
200
207
|
for (const functionCall of functionCalls) {
|
|
201
208
|
if (functionCall.id && functionResponsesIds.has(functionCall.id)) {
|
|
202
|
-
functionCallEventIdx = idx;
|
|
203
209
|
const functionCallIds = new Set(
|
|
204
210
|
functionCalls.map((fc) => fc.id).filter((id) => !!id)
|
|
205
211
|
);
|
|
@@ -213,12 +219,16 @@ function rearrangeEventsForLatestFunctionResponse(events) {
|
|
|
213
219
|
)}, function response ids provided: ${Array.from(functionResponsesIds).join(", ")}`
|
|
214
220
|
);
|
|
215
221
|
}
|
|
216
|
-
|
|
222
|
+
match = { eventIdx: idx, responseIds: functionCallIds };
|
|
223
|
+
matchedInEvent = true;
|
|
217
224
|
break;
|
|
218
225
|
}
|
|
219
226
|
}
|
|
227
|
+
if (matchedInEvent) {
|
|
228
|
+
break;
|
|
229
|
+
}
|
|
220
230
|
}
|
|
221
|
-
if (
|
|
231
|
+
if (!match) {
|
|
222
232
|
throw new Error(
|
|
223
233
|
`No function call event found for function responses ids: ${Array.from(
|
|
224
234
|
functionResponsesIds
|
|
@@ -226,17 +236,18 @@ function rearrangeEventsForLatestFunctionResponse(events) {
|
|
|
226
236
|
);
|
|
227
237
|
}
|
|
228
238
|
const functionResponseEvents = [];
|
|
229
|
-
|
|
239
|
+
const activeResponses = match.responseIds;
|
|
240
|
+
for (let idx = match.eventIdx + 1; idx < events.length - 1; idx++) {
|
|
230
241
|
const event = events[idx];
|
|
231
242
|
const responses = getFunctionResponses(event);
|
|
232
243
|
if (responses && responses.some(
|
|
233
|
-
(response) => response.id &&
|
|
244
|
+
(response) => response.id && activeResponses.has(response.id)
|
|
234
245
|
)) {
|
|
235
246
|
functionResponseEvents.push(event);
|
|
236
247
|
}
|
|
237
248
|
}
|
|
238
249
|
functionResponseEvents.push(events[events.length - 1]);
|
|
239
|
-
const resultEvents = events.slice(0,
|
|
250
|
+
const resultEvents = events.slice(0, match.eventIdx + 1);
|
|
240
251
|
resultEvents.push(mergeFunctionResponseEvents(functionResponseEvents));
|
|
241
252
|
return resultEvents;
|
|
242
253
|
}
|
|
@@ -275,7 +286,7 @@ function rearrangeEventsForAsyncFunctionResponsesInHistory(events) {
|
|
|
275
286
|
continue;
|
|
276
287
|
}
|
|
277
288
|
if (functionResponseEventsIndices.size === 1) {
|
|
278
|
-
const [responseIndex] =
|
|
289
|
+
const [responseIndex] = Array.from(functionResponseEventsIndices);
|
|
279
290
|
resultEvents.push(events[responseIndex]);
|
|
280
291
|
} else {
|
|
281
292
|
const indicesArray = Array.from(functionResponseEventsIndices).sort(
|
|
@@ -315,5 +326,6 @@ ${event.compactedContent}`
|
|
|
315
326
|
}
|
|
316
327
|
export {
|
|
317
328
|
getContents,
|
|
318
|
-
getCurrentTurnContents
|
|
329
|
+
getCurrentTurnContents,
|
|
330
|
+
mergeFunctionResponseEvents
|
|
319
331
|
};
|
|
@@ -12,6 +12,13 @@ import {
|
|
|
12
12
|
getCurrentTurnContents
|
|
13
13
|
} from "./content_processor_utils.js";
|
|
14
14
|
class ContentRequestProcessor {
|
|
15
|
+
/**
|
|
16
|
+
* Fills {@link LlmRequest.contents} based on the session event history and
|
|
17
|
+
* agent configuration.
|
|
18
|
+
*
|
|
19
|
+
* @param invocationContext - The current invocation context.
|
|
20
|
+
* @param llmRequest - The request whose contents field will be populated.
|
|
21
|
+
*/
|
|
15
22
|
// eslint-disable-next-line require-yield
|
|
16
23
|
async *runAsync(invocationContext, llmRequest) {
|
|
17
24
|
const agent = invocationContext.agent;
|
|
@@ -7,9 +7,21 @@ const require = topLevelCreateRequire(import.meta.url);
|
|
|
7
7
|
*/
|
|
8
8
|
import { ContextCompactionTrigger } from "../../plugins/base_plugin.js";
|
|
9
9
|
class ContextCompactorRequestProcessor {
|
|
10
|
+
/**
|
|
11
|
+
* @param compactors - Ordered list of compactors to evaluate; the first one
|
|
12
|
+
* that reports it should compact will perform the compaction.
|
|
13
|
+
*/
|
|
10
14
|
constructor(compactors) {
|
|
11
15
|
this.compactors = compactors;
|
|
12
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* Evaluates compactors in priority order. The first compactor that indicates
|
|
19
|
+
* it should compact will compact the session history, fire plugin hooks, and
|
|
20
|
+
* yield any newly generated events. Iteration stops after one compaction.
|
|
21
|
+
*
|
|
22
|
+
* @param invocationContext - The current invocation context.
|
|
23
|
+
* @param _llmRequest - Unused; present to satisfy the {@link BaseLlmRequestProcessor} interface.
|
|
24
|
+
*/
|
|
13
25
|
async *runAsync(invocationContext, _llmRequest) {
|
|
14
26
|
for (const compactor of this.compactors) {
|
|
15
27
|
const shouldCompact = await Promise.resolve(
|
|
@@ -8,6 +8,13 @@ const require = topLevelCreateRequire(import.meta.url);
|
|
|
8
8
|
import { appendInstructions } from "../../models/llm_request.js";
|
|
9
9
|
import { BaseLlmRequestProcessor } from "./base_llm_processor.js";
|
|
10
10
|
class IdentityLlmRequestProcessor extends BaseLlmRequestProcessor {
|
|
11
|
+
/**
|
|
12
|
+
* Appends agent name and description as identity instructions to the system
|
|
13
|
+
* prompt of the request.
|
|
14
|
+
*
|
|
15
|
+
* @param invocationContext - The current invocation context.
|
|
16
|
+
* @param llmRequest - The request object to append instructions to.
|
|
17
|
+
*/
|
|
11
18
|
// eslint-disable-next-line require-yield
|
|
12
19
|
async *runAsync(invocationContext, llmRequest) {
|
|
13
20
|
const agent = invocationContext.agent;
|
|
@@ -47,6 +47,11 @@ class InstructionsLlmRequestProcessor extends BaseLlmRequestProcessor {
|
|
|
47
47
|
}
|
|
48
48
|
appendInstructions(llmRequest, [instructionWithState]);
|
|
49
49
|
}
|
|
50
|
+
if (agent.outputSchema && agent.tools && agent.tools.length > 0) {
|
|
51
|
+
appendInstructions(llmRequest, [
|
|
52
|
+
'To output the final result, you must call the "set_model_response" function with the appropriate values. Do not output anything else.'
|
|
53
|
+
]);
|
|
54
|
+
}
|
|
50
55
|
}
|
|
51
56
|
}
|
|
52
57
|
const INSTRUCTIONS_LLM_REQUEST_PROCESSOR = new InstructionsLlmRequestProcessor();
|
|
@@ -18,7 +18,15 @@ import { isLlmAgent } from "../llm_agent.js";
|
|
|
18
18
|
import { ReadonlyContext } from "../readonly_context.js";
|
|
19
19
|
import { BaseLlmRequestProcessor } from "./base_llm_processor.js";
|
|
20
20
|
class RequestConfirmationLlmRequestProcessor extends BaseLlmRequestProcessor {
|
|
21
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* Resumes tool calls that were paused for user confirmation, re-invoking
|
|
23
|
+
* them with the confirmed or denied decision before the next LLM turn.
|
|
24
|
+
*
|
|
25
|
+
* @param invocationContext - The current invocation context, including the
|
|
26
|
+
* session event history used to locate pending confirmation responses.
|
|
27
|
+
* @yields Function response events for tools that have been confirmed and
|
|
28
|
+
* are ready to resume.
|
|
29
|
+
*/
|
|
22
30
|
async *runAsync(invocationContext) {
|
|
23
31
|
const agent = invocationContext.agent;
|
|
24
32
|
if (!isLlmAgent(agent)) {
|
|
@@ -10,7 +10,13 @@ import { isLlmAgent } from "../llm_agent.js";
|
|
|
10
10
|
import { ReadonlyContext } from "../readonly_context.js";
|
|
11
11
|
import { BaseLlmRequestProcessor } from "./base_llm_processor.js";
|
|
12
12
|
class ToolFilterRequestProcessor extends BaseLlmRequestProcessor {
|
|
13
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* Invokes plugin-based tool filtering and updates {@link LlmRequest.allowedTools}
|
|
15
|
+
* with the reduced tool set if any plugin returns a filtered result.
|
|
16
|
+
*
|
|
17
|
+
* @param invocationContext - The current invocation context.
|
|
18
|
+
* @param llmRequest - The request whose allowed tools may be restricted.
|
|
19
|
+
*/
|
|
14
20
|
// eslint-disable-next-line require-yield
|
|
15
21
|
async *runAsync(invocationContext, llmRequest) {
|
|
16
22
|
const agent = invocationContext.agent;
|
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
getFunctionResponses
|
|
18
18
|
} from "../events/event.js";
|
|
19
19
|
import { State } from "../sessions/state.js";
|
|
20
|
+
import { camelCaseKeys } from "../utils/case_utils.js";
|
|
20
21
|
import { AuthHandler } from "./auth_handler.js";
|
|
21
22
|
const TOOLSET_AUTH_CREDENTIAL_ID_PREFIX = "_adk_toolset_auth_";
|
|
22
23
|
async function storeAuthAndCollectResumeTargets(events, authFcIds, authResponses, state) {
|
|
@@ -25,17 +26,15 @@ async function storeAuthAndCollectResumeTargets(events, authFcIds, authResponses
|
|
|
25
26
|
const eventFunctionCalls = getFunctionCalls(event);
|
|
26
27
|
for (const functionCall of eventFunctionCalls) {
|
|
27
28
|
if (functionCall.id && authFcIds.has(functionCall.id) && functionCall.name === REQUEST_EUC_FUNCTION_CALL_NAME) {
|
|
28
|
-
const args = functionCall.args;
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
const args = camelCaseKeys(functionCall.args);
|
|
30
|
+
const authConfig = args == null ? void 0 : args.authConfig;
|
|
31
|
+
if (authConfig) {
|
|
32
|
+
requestedAuthConfigById[functionCall.id] = authConfig;
|
|
31
33
|
}
|
|
32
34
|
}
|
|
33
35
|
}
|
|
34
36
|
}
|
|
35
37
|
for (const fcId of authFcIds) {
|
|
36
|
-
if (!(fcId in authResponses)) {
|
|
37
|
-
continue;
|
|
38
|
-
}
|
|
39
38
|
const authConfig = authResponses[fcId];
|
|
40
39
|
const requestedAuthConfig = requestedAuthConfigById[fcId];
|
|
41
40
|
if (requestedAuthConfig && requestedAuthConfig.credentialKey) {
|
|
@@ -53,12 +52,15 @@ async function storeAuthAndCollectResumeTargets(events, authFcIds, authResponses
|
|
|
53
52
|
const eventFunctionCalls = getFunctionCalls(event);
|
|
54
53
|
for (const functionCall of eventFunctionCalls) {
|
|
55
54
|
if (functionCall.id === fcId && functionCall.name === REQUEST_EUC_FUNCTION_CALL_NAME) {
|
|
56
|
-
const args =
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
const args = camelCaseKeys(
|
|
56
|
+
functionCall.args
|
|
57
|
+
);
|
|
58
|
+
const functionCallId = args == null ? void 0 : args.functionCallId;
|
|
59
|
+
if (functionCallId) {
|
|
60
|
+
if (functionCallId.startsWith(TOOLSET_AUTH_CREDENTIAL_ID_PREFIX)) {
|
|
59
61
|
continue;
|
|
60
62
|
}
|
|
61
|
-
toolsToResume.add(
|
|
63
|
+
toolsToResume.add(functionCallId);
|
|
62
64
|
}
|
|
63
65
|
}
|
|
64
66
|
}
|
|
@@ -143,7 +143,7 @@ function validateDiscoveryUrl(urlStr) {
|
|
|
143
143
|
return false;
|
|
144
144
|
}
|
|
145
145
|
const host = normaliseHostname(url.hostname.toLowerCase());
|
|
146
|
-
if (host === "localhost" || host === "
|
|
146
|
+
if (host === "localhost" || host === "metadata.google.internal" || host === "metadata.goog" || host.startsWith("127.") || host === "[::1]" || host === "0.0.0.0" || host.startsWith("10.") || host.startsWith("192.168.") || host.startsWith("169.254.")) {
|
|
147
147
|
logger.warn(`Unsafe host for discovery URL: ${host}`);
|
|
148
148
|
return false;
|
|
149
149
|
}
|
|
@@ -70,7 +70,7 @@ class CodeExecutorContext {
|
|
|
70
70
|
* @return A list of input files in the code executor context.
|
|
71
71
|
*/
|
|
72
72
|
getInputFiles() {
|
|
73
|
-
if (!
|
|
73
|
+
if (!this.sessionState.has(INPUT_FILE_KEY)) {
|
|
74
74
|
return [];
|
|
75
75
|
}
|
|
76
76
|
return this.sessionState.get(INPUT_FILE_KEY);
|
|
@@ -80,13 +80,13 @@ class CodeExecutorContext {
|
|
|
80
80
|
* @param inputFiles The input files to add to the session state.
|
|
81
81
|
*/
|
|
82
82
|
addInputFiles(inputFiles) {
|
|
83
|
-
if (!
|
|
83
|
+
if (!this.sessionState.has(INPUT_FILE_KEY)) {
|
|
84
84
|
this.sessionState.set(INPUT_FILE_KEY, []);
|
|
85
85
|
}
|
|
86
86
|
this.sessionState.get(INPUT_FILE_KEY).push(...inputFiles);
|
|
87
87
|
}
|
|
88
88
|
clearInputFiles() {
|
|
89
|
-
if (
|
|
89
|
+
if (this.sessionState.has(INPUT_FILE_KEY)) {
|
|
90
90
|
this.sessionState.set(INPUT_FILE_KEY, []);
|
|
91
91
|
}
|
|
92
92
|
if (PROCESSED_FILE_NAMES_KEY in this.context) {
|
|
@@ -99,7 +99,7 @@ class CodeExecutorContext {
|
|
|
99
99
|
* @return The error count for the given invocation ID.
|
|
100
100
|
*/
|
|
101
101
|
getErrorCount(invocationId) {
|
|
102
|
-
if (!
|
|
102
|
+
if (!this.sessionState.has(ERROR_COUNT_KEY)) {
|
|
103
103
|
return 0;
|
|
104
104
|
}
|
|
105
105
|
return this.sessionState.get(ERROR_COUNT_KEY)[invocationId] || 0;
|
|
@@ -109,7 +109,7 @@ class CodeExecutorContext {
|
|
|
109
109
|
* @param invocationId The invocation ID to increment the error count for.
|
|
110
110
|
*/
|
|
111
111
|
incrementErrorCount(invocationId) {
|
|
112
|
-
if (!
|
|
112
|
+
if (!this.sessionState.has(ERROR_COUNT_KEY)) {
|
|
113
113
|
this.sessionState.set(ERROR_COUNT_KEY, {});
|
|
114
114
|
}
|
|
115
115
|
this.sessionState.get(ERROR_COUNT_KEY)[invocationId] = this.getErrorCount(invocationId) + 1;
|
|
@@ -119,7 +119,7 @@ class CodeExecutorContext {
|
|
|
119
119
|
* @param invocationId The invocation ID to reset the error count for.
|
|
120
120
|
*/
|
|
121
121
|
resetErrorCount(invocationId) {
|
|
122
|
-
if (!
|
|
122
|
+
if (!this.sessionState.has(ERROR_COUNT_KEY)) {
|
|
123
123
|
return;
|
|
124
124
|
}
|
|
125
125
|
const errorCounts = this.sessionState.get(ERROR_COUNT_KEY);
|
|
@@ -141,7 +141,7 @@ class CodeExecutorContext {
|
|
|
141
141
|
resultStdout,
|
|
142
142
|
resultStderr
|
|
143
143
|
}) {
|
|
144
|
-
if (!
|
|
144
|
+
if (!this.sessionState.has(CODE_EXECUTION_RESULTS_KEY)) {
|
|
145
145
|
this.sessionState.set(CODE_EXECUTION_RESULTS_KEY, {});
|
|
146
146
|
}
|
|
147
147
|
const codeExecutionResults = this.sessionState.get(
|
package/dist/esm/common.js
CHANGED
|
@@ -31,6 +31,7 @@ import { SequentialAgent, isSequentialAgent } from "./agents/sequential_agent.js
|
|
|
31
31
|
import { InMemoryArtifactService } from "./artifacts/in_memory_artifact_service.js";
|
|
32
32
|
import { AuthCredentialTypes } from "./auth/auth_credential.js";
|
|
33
33
|
import { AuthHandler } from "./auth/auth_handler.js";
|
|
34
|
+
import { AUTH_PREPROCESSOR, AuthPreprocessor } from "./auth/auth_preprocessor.js";
|
|
34
35
|
import { AuthProviderRegistry } from "./auth/auth_provider_registry.js";
|
|
35
36
|
import { OAuthGrantType } from "./auth/auth_schemes.js";
|
|
36
37
|
import { InMemoryCredentialService } from "./auth/credential_service/in_memory_credential_service.js";
|
|
@@ -111,20 +112,37 @@ import { URL_CONTEXT, UrlContextTool } from "./tools/url_context_tool.js";
|
|
|
111
112
|
import { VertexAiSearchTool } from "./tools/vertex_ai_search_tool.js";
|
|
112
113
|
import { VertexRagRetrievalTool } from "./tools/vertex_rag_retrieval_tool.js";
|
|
113
114
|
import { LogLevel, getLogger, setLogLevel, setLogger } from "./utils/logger.js";
|
|
114
|
-
import { isGemini2OrAbove } from "./utils/model_name.js";
|
|
115
|
+
import { isGemini2OrAbove, isGemini3xFlashLive } from "./utils/model_name.js";
|
|
115
116
|
import { zodObjectToSchema } from "./utils/simple_zod_to_json.js";
|
|
116
117
|
import { GoogleLLMVariant } from "./utils/variant_utils.js";
|
|
117
118
|
import { version } from "./version.js";
|
|
119
|
+
import { GCPSkillRegistry } from "./skills/gcp_skill_registry.js";
|
|
120
|
+
import {
|
|
121
|
+
loadAllSkillsInDir,
|
|
122
|
+
loadSkillFromDir,
|
|
123
|
+
loadSkillFromZipBuffer,
|
|
124
|
+
validateSkillDir
|
|
125
|
+
} from "./skills/loader.js";
|
|
118
126
|
import { ListSkillsTool } from "./tools/skill/list_skills_tool.js";
|
|
119
127
|
import { LoadSkillResourceTool } from "./tools/skill/load_skill_resource_tool.js";
|
|
120
128
|
import { LoadSkillTool } from "./tools/skill/load_skill_tool.js";
|
|
129
|
+
import { SearchSkillsTool } from "./tools/skill/search_skills_tool.js";
|
|
121
130
|
import { SkillToolset } from "./tools/skill/skill_toolset.js";
|
|
131
|
+
import { OpenApiSpecParser } from "./tools/openapi_tool/openapi_spec_parser/openapi_spec_parser.js";
|
|
132
|
+
import { OperationParser } from "./tools/openapi_tool/openapi_spec_parser/operation_parser.js";
|
|
133
|
+
import { ToolAuthHandler } from "./tools/openapi_tool/openapi_spec_parser/tool_auth_handler.js";
|
|
134
|
+
import { OpenAPIToolset } from "./tools/openapi_tool/openapi_toolset.js";
|
|
135
|
+
import {
|
|
136
|
+
RestApiTool,
|
|
137
|
+
createRestApiTool
|
|
138
|
+
} from "./tools/openapi_tool/rest_api_tool.js";
|
|
122
139
|
export * from "./artifacts/base_artifact_service.js";
|
|
123
140
|
export * from "./features/feature_registry.js";
|
|
124
141
|
export * from "./memory/base_memory_service.js";
|
|
125
142
|
export * from "./sessions/base_session_service.js";
|
|
126
143
|
export * from "./tools/base_tool.js";
|
|
127
144
|
export {
|
|
145
|
+
AUTH_PREPROCESSOR,
|
|
128
146
|
ActiveStreamingTool,
|
|
129
147
|
LlmAgent as Agent,
|
|
130
148
|
AgentTool,
|
|
@@ -132,6 +150,7 @@ export {
|
|
|
132
150
|
ApigeeLlm,
|
|
133
151
|
AuthCredentialTypes,
|
|
134
152
|
AuthHandler,
|
|
153
|
+
AuthPreprocessor,
|
|
135
154
|
AuthProviderRegistry,
|
|
136
155
|
BaseAgent,
|
|
137
156
|
BaseCodeExecutor,
|
|
@@ -157,6 +176,7 @@ export {
|
|
|
157
176
|
ExitLoopTool,
|
|
158
177
|
FileContentEncoding,
|
|
159
178
|
FunctionTool,
|
|
179
|
+
GCPSkillRegistry,
|
|
160
180
|
GOOGLE_MAPS_GROUNDING,
|
|
161
181
|
GOOGLE_SEARCH,
|
|
162
182
|
Gemini,
|
|
@@ -188,6 +208,9 @@ export {
|
|
|
188
208
|
OAuth2CredentialExchanger,
|
|
189
209
|
OAuth2DiscoveryManager,
|
|
190
210
|
OAuthGrantType,
|
|
211
|
+
OpenAPIToolset,
|
|
212
|
+
OpenApiSpecParser,
|
|
213
|
+
OperationParser,
|
|
191
214
|
PRELOAD_MEMORY,
|
|
192
215
|
ParallelAgent,
|
|
193
216
|
PluginManager,
|
|
@@ -195,9 +218,11 @@ export {
|
|
|
195
218
|
PreloadMemoryTool,
|
|
196
219
|
REQUEST_CONFIRMATION_FUNCTION_CALL_NAME,
|
|
197
220
|
ReadonlyContext,
|
|
221
|
+
RestApiTool,
|
|
198
222
|
RoutedAgent,
|
|
199
223
|
RoutedLlm,
|
|
200
224
|
Runner,
|
|
225
|
+
SearchSkillsTool,
|
|
201
226
|
SecurityPlugin,
|
|
202
227
|
SequentialAgent,
|
|
203
228
|
SessionStateCredentialService,
|
|
@@ -205,6 +230,7 @@ export {
|
|
|
205
230
|
State,
|
|
206
231
|
StreamingMode,
|
|
207
232
|
TokenBasedContextCompactor,
|
|
233
|
+
ToolAuthHandler,
|
|
208
234
|
ToolConfirmation,
|
|
209
235
|
TruncatingContextCompactor,
|
|
210
236
|
URL_CONTEXT,
|
|
@@ -214,6 +240,7 @@ export {
|
|
|
214
240
|
VertexRagRetrievalTool,
|
|
215
241
|
createEvent,
|
|
216
242
|
createEventActions,
|
|
243
|
+
createRestApiTool,
|
|
217
244
|
createSession,
|
|
218
245
|
functionsExportedForTestingOnly,
|
|
219
246
|
geminiInitParams,
|
|
@@ -232,16 +259,21 @@ export {
|
|
|
232
259
|
isFinalResponse,
|
|
233
260
|
isFunctionTool,
|
|
234
261
|
isGemini2OrAbove,
|
|
262
|
+
isGemini3xFlashLive,
|
|
235
263
|
isLlmAgent,
|
|
236
264
|
isLoopAgent,
|
|
237
265
|
isParallelAgent,
|
|
238
266
|
isRoutedAgent,
|
|
239
267
|
isRunner,
|
|
240
268
|
isSequentialAgent,
|
|
269
|
+
loadAllSkillsInDir,
|
|
270
|
+
loadSkillFromDir,
|
|
271
|
+
loadSkillFromZipBuffer,
|
|
241
272
|
setLogLevel,
|
|
242
273
|
setLogger,
|
|
243
274
|
stringifyContent,
|
|
244
275
|
toStructuredEvents,
|
|
276
|
+
validateSkillDir,
|
|
245
277
|
version,
|
|
246
278
|
zodObjectToSchema
|
|
247
279
|
};
|