@iqai/adk 0.1.9 → 0.1.10
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 +6 -0
- package/README.md +1 -2
- package/dist/index.d.mts +67 -14
- package/dist/index.d.ts +67 -14
- package/dist/index.js +258 -88
- package/dist/index.mjs +206 -36
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2; var _class3; var _class4; var _class5; var _class6; var _class7; var _class8; var _class9; var _class10; var _class11; var _class12; var _class13; var _class14; var _class15; var _class16; var _class17; var _class18; var _class19; var _class20; var _class21; var _class22; var _class23; var _class24; var _class25; var _class26; var _class27; var _class28; var _class29; var _class30; var _class31; var _class32;var __defProp = Object.defineProperty;
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2; var _class3; var _class4; var _class5; var _class6; var _class7; var _class8; var _class9; var _class10; var _class11; var _class12; var _class13; var _class14; var _class15; var _class16; var _class17; var _class18; var _class19; var _class20; var _class21; var _class22; var _class23; var _class24; var _class25; var _class26; var _class27; var _class28; var _class29; var _class30; var _class31; var _class32;var __defProp = Object.defineProperty;
|
|
2
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
@@ -25,14 +25,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
25
25
|
};
|
|
26
26
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
27
|
|
|
28
|
-
// src/
|
|
28
|
+
// src/logger/index.ts
|
|
29
29
|
var _chalk = require('chalk'); var _chalk2 = _interopRequireDefault(_chalk);
|
|
30
30
|
function isDebugEnabled() {
|
|
31
31
|
return process.env.NODE_ENV === "development" || process.env.ADK_DEBUG === "true";
|
|
32
32
|
}
|
|
33
33
|
var Logger;
|
|
34
34
|
var init_logger = __esm({
|
|
35
|
-
"src/
|
|
35
|
+
"src/logger/index.ts"() {
|
|
36
36
|
Logger = (_class = class {
|
|
37
37
|
|
|
38
38
|
__init2() {this.isDebugEnabled = isDebugEnabled()}
|
|
@@ -3685,6 +3685,139 @@ __export(events_exports, {
|
|
|
3685
3685
|
// src/flows/llm-flows/base-llm-flow.ts
|
|
3686
3686
|
init_logger();
|
|
3687
3687
|
|
|
3688
|
+
// src/logger/log-formatter.ts
|
|
3689
|
+
var LogFormatter = class _LogFormatter {
|
|
3690
|
+
/**
|
|
3691
|
+
* Formats function calls for display in logs.
|
|
3692
|
+
* Returns a comma-separated string of function names with argument previews.
|
|
3693
|
+
*
|
|
3694
|
+
* @param functionCalls Array of Parts containing function calls
|
|
3695
|
+
* @returns Formatted string representation of function calls
|
|
3696
|
+
*/
|
|
3697
|
+
static formatFunctionCalls(functionCalls) {
|
|
3698
|
+
if (!functionCalls || functionCalls.length === 0) {
|
|
3699
|
+
return "none";
|
|
3700
|
+
}
|
|
3701
|
+
return functionCalls.filter((part) => part.functionCall).map((part) => {
|
|
3702
|
+
const fc = part.functionCall;
|
|
3703
|
+
const argsPreview = fc.args ? JSON.stringify(fc.args).substring(0, 50) + (JSON.stringify(fc.args).length > 50 ? "..." : "") : "{}";
|
|
3704
|
+
return `${fc.name}(${argsPreview})`;
|
|
3705
|
+
}).join(", ");
|
|
3706
|
+
}
|
|
3707
|
+
/**
|
|
3708
|
+
* Formats content preview for debug logging.
|
|
3709
|
+
* Uses a consistent format for displaying content in logs.
|
|
3710
|
+
*
|
|
3711
|
+
* @param content Content object to format
|
|
3712
|
+
* @returns Formatted string representation of content
|
|
3713
|
+
*/
|
|
3714
|
+
static formatContentPreview(content) {
|
|
3715
|
+
if (!content) return "none";
|
|
3716
|
+
if (content.parts && Array.isArray(content.parts)) {
|
|
3717
|
+
const textParts = content.parts.filter((part) => part.text).map((part) => part.text).join(" ");
|
|
3718
|
+
return textParts.length > 80 ? `${textParts.substring(0, 80)}...` : textParts || "no text content";
|
|
3719
|
+
}
|
|
3720
|
+
const stringified = JSON.stringify(content);
|
|
3721
|
+
return stringified.length > 80 ? `${stringified.substring(0, 80)}...` : stringified;
|
|
3722
|
+
}
|
|
3723
|
+
/**
|
|
3724
|
+
* Formats response content preview for debug logging.
|
|
3725
|
+
* Specifically handles LlmResponse content structure.
|
|
3726
|
+
*
|
|
3727
|
+
* @param llmResponse LlmResponse object to format
|
|
3728
|
+
* @returns Formatted string representation of response content
|
|
3729
|
+
*/
|
|
3730
|
+
static formatResponsePreview(llmResponse) {
|
|
3731
|
+
if (!llmResponse.content) return "none";
|
|
3732
|
+
return _LogFormatter.formatContentPreview(llmResponse.content);
|
|
3733
|
+
}
|
|
3734
|
+
/**
|
|
3735
|
+
* Formats a single function call for detailed logging.
|
|
3736
|
+
* Provides more detailed formatting than formatFunctionCalls for individual calls.
|
|
3737
|
+
*
|
|
3738
|
+
* @param functionCall FunctionCall object to format
|
|
3739
|
+
* @returns Formatted string representation of the function call
|
|
3740
|
+
*/
|
|
3741
|
+
static formatSingleFunctionCall(functionCall) {
|
|
3742
|
+
const argsStr = functionCall.args ? JSON.stringify(functionCall.args, null, 2) : "{}";
|
|
3743
|
+
return `${functionCall.name}(
|
|
3744
|
+
${argsStr}
|
|
3745
|
+
)`;
|
|
3746
|
+
}
|
|
3747
|
+
/**
|
|
3748
|
+
* Formats function response for detailed logging.
|
|
3749
|
+
* Provides detailed formatting for function response objects.
|
|
3750
|
+
*
|
|
3751
|
+
* @param part Part containing function response
|
|
3752
|
+
* @returns Formatted string representation of the function response
|
|
3753
|
+
*/
|
|
3754
|
+
static formatFunctionResponse(part) {
|
|
3755
|
+
if (!part.functionResponse) return "none";
|
|
3756
|
+
const response = part.functionResponse;
|
|
3757
|
+
const responseStr = response.response ? JSON.stringify(response.response, null, 2) : "{}";
|
|
3758
|
+
return `${response.name} -> ${responseStr}`;
|
|
3759
|
+
}
|
|
3760
|
+
/**
|
|
3761
|
+
* Formats content parts for detailed inspection.
|
|
3762
|
+
* Shows the structure and content of all parts in a Content object.
|
|
3763
|
+
*
|
|
3764
|
+
* @param content Content object with parts to format
|
|
3765
|
+
* @returns Array of formatted strings, one per part
|
|
3766
|
+
*/
|
|
3767
|
+
static formatContentParts(content) {
|
|
3768
|
+
if (!content.parts) return ["no parts"];
|
|
3769
|
+
return content.parts.map((part, index) => {
|
|
3770
|
+
const partType = _LogFormatter.getPartType(part);
|
|
3771
|
+
const preview = _LogFormatter.getPartPreview(part);
|
|
3772
|
+
return `[${index}] ${partType}: ${preview}`;
|
|
3773
|
+
});
|
|
3774
|
+
}
|
|
3775
|
+
/**
|
|
3776
|
+
* Gets the type of a Part for logging purposes.
|
|
3777
|
+
*
|
|
3778
|
+
* @param part Part object to analyze
|
|
3779
|
+
* @returns String describing the part type
|
|
3780
|
+
*/
|
|
3781
|
+
static getPartType(part) {
|
|
3782
|
+
if (part.text !== void 0) return "text";
|
|
3783
|
+
if (part.functionCall !== void 0) return "function_call";
|
|
3784
|
+
if (part.functionResponse !== void 0) return "function_response";
|
|
3785
|
+
if (part.fileData !== void 0) return "file_data";
|
|
3786
|
+
if (part.executableCode !== void 0) return "executable_code";
|
|
3787
|
+
if (part.codeExecutionResult !== void 0) return "code_execution_result";
|
|
3788
|
+
return "unknown";
|
|
3789
|
+
}
|
|
3790
|
+
/**
|
|
3791
|
+
* Gets a preview of Part content for logging purposes.
|
|
3792
|
+
*
|
|
3793
|
+
* @param part Part object to preview
|
|
3794
|
+
* @returns String preview of the part content
|
|
3795
|
+
*/
|
|
3796
|
+
static getPartPreview(part) {
|
|
3797
|
+
if (part.text !== void 0) {
|
|
3798
|
+
return part.text.length > 50 ? `"${part.text.substring(0, 50)}..."` : `"${part.text}"`;
|
|
3799
|
+
}
|
|
3800
|
+
if (part.functionCall !== void 0) {
|
|
3801
|
+
return _LogFormatter.formatSingleFunctionCall(part.functionCall);
|
|
3802
|
+
}
|
|
3803
|
+
if (part.functionResponse !== void 0) {
|
|
3804
|
+
return _LogFormatter.formatFunctionResponse(part);
|
|
3805
|
+
}
|
|
3806
|
+
if (part.fileData !== void 0) {
|
|
3807
|
+
return `file: ${part.fileData.mimeType || "unknown type"}`;
|
|
3808
|
+
}
|
|
3809
|
+
if (part.executableCode !== void 0) {
|
|
3810
|
+
const code = part.executableCode.code || "";
|
|
3811
|
+
return code.length > 50 ? `"${code.substring(0, 50)}..."` : `"${code}"`;
|
|
3812
|
+
}
|
|
3813
|
+
if (part.codeExecutionResult !== void 0) {
|
|
3814
|
+
const outcome = part.codeExecutionResult.outcome || "unknown";
|
|
3815
|
+
return `execution result: ${outcome}`;
|
|
3816
|
+
}
|
|
3817
|
+
return "unknown content";
|
|
3818
|
+
}
|
|
3819
|
+
};
|
|
3820
|
+
|
|
3688
3821
|
// src/tools/index.ts
|
|
3689
3822
|
var tools_exports = {};
|
|
3690
3823
|
__export(tools_exports, {
|
|
@@ -3722,6 +3855,7 @@ __export(tools_exports, {
|
|
|
3722
3855
|
buildFunctionDeclaration: () => buildFunctionDeclaration,
|
|
3723
3856
|
createFunctionTool: () => createFunctionTool,
|
|
3724
3857
|
createSamplingHandler: () => createSamplingHandler,
|
|
3858
|
+
createTool: () => createTool,
|
|
3725
3859
|
getMcpTools: () => getMcpTools,
|
|
3726
3860
|
jsonSchemaToDeclaration: () => jsonSchemaToDeclaration,
|
|
3727
3861
|
mcpSchemaToParameters: () => mcpSchemaToParameters,
|
|
@@ -3729,6 +3863,68 @@ __export(tools_exports, {
|
|
|
3729
3863
|
});
|
|
3730
3864
|
init_base_tool();
|
|
3731
3865
|
|
|
3866
|
+
// src/tools/base/create-tool.ts
|
|
3867
|
+
init_base_tool();
|
|
3868
|
+
var _v4 = require('zod/v4'); var z = _interopRequireWildcard(_v4);
|
|
3869
|
+
var CreatedTool = class extends BaseTool {
|
|
3870
|
+
|
|
3871
|
+
|
|
3872
|
+
|
|
3873
|
+
constructor(config) {
|
|
3874
|
+
super({
|
|
3875
|
+
name: config.name,
|
|
3876
|
+
description: config.description,
|
|
3877
|
+
isLongRunning: _nullishCoalesce(config.isLongRunning, () => ( false)),
|
|
3878
|
+
shouldRetryOnFailure: _nullishCoalesce(config.shouldRetryOnFailure, () => ( false)),
|
|
3879
|
+
maxRetryAttempts: _nullishCoalesce(config.maxRetryAttempts, () => ( 3))
|
|
3880
|
+
});
|
|
3881
|
+
this.func = config.fn;
|
|
3882
|
+
this.schema = config.schema;
|
|
3883
|
+
this.functionDeclaration = this.buildDeclaration();
|
|
3884
|
+
}
|
|
3885
|
+
/**
|
|
3886
|
+
* Executes the tool function with validation
|
|
3887
|
+
*/
|
|
3888
|
+
async runAsync(args, context) {
|
|
3889
|
+
try {
|
|
3890
|
+
const validatedArgs = this.schema.parse(args);
|
|
3891
|
+
const result = await Promise.resolve(
|
|
3892
|
+
this.func.length > 1 ? this.func(validatedArgs, context) : this.func(validatedArgs)
|
|
3893
|
+
);
|
|
3894
|
+
return _nullishCoalesce(result, () => ( {}));
|
|
3895
|
+
} catch (error) {
|
|
3896
|
+
if (error instanceof z.ZodError) {
|
|
3897
|
+
return {
|
|
3898
|
+
error: `Invalid arguments for ${this.name}: ${z.prettifyError(error)}`
|
|
3899
|
+
};
|
|
3900
|
+
}
|
|
3901
|
+
return {
|
|
3902
|
+
error: `Error executing ${this.name}: ${error instanceof Error ? error.message : String(error)}`
|
|
3903
|
+
};
|
|
3904
|
+
}
|
|
3905
|
+
}
|
|
3906
|
+
/**
|
|
3907
|
+
* Returns the function declaration for this tool
|
|
3908
|
+
*/
|
|
3909
|
+
getDeclaration() {
|
|
3910
|
+
return this.functionDeclaration;
|
|
3911
|
+
}
|
|
3912
|
+
/**
|
|
3913
|
+
* Builds the function declaration from the Zod schema
|
|
3914
|
+
*/
|
|
3915
|
+
buildDeclaration() {
|
|
3916
|
+
const parameters = z.toJSONSchema(this.schema);
|
|
3917
|
+
return {
|
|
3918
|
+
name: this.name,
|
|
3919
|
+
description: this.description,
|
|
3920
|
+
parameters
|
|
3921
|
+
};
|
|
3922
|
+
}
|
|
3923
|
+
};
|
|
3924
|
+
function createTool(config) {
|
|
3925
|
+
return new CreatedTool(config);
|
|
3926
|
+
}
|
|
3927
|
+
|
|
3732
3928
|
// src/tools/tool-context.ts
|
|
3733
3929
|
var ToolContext = class extends CallbackContext {
|
|
3734
3930
|
/**
|
|
@@ -5280,7 +5476,7 @@ function mcpSchemaToParameters(mcpTool) {
|
|
|
5280
5476
|
}
|
|
5281
5477
|
|
|
5282
5478
|
// src/tools/mcp/create-tool.ts
|
|
5283
|
-
async function
|
|
5479
|
+
async function createTool2(mcpTool, client) {
|
|
5284
5480
|
try {
|
|
5285
5481
|
return new McpToolAdapter(mcpTool, client);
|
|
5286
5482
|
} catch (error) {
|
|
@@ -5614,7 +5810,7 @@ var McpToolset = (_class21 = class {
|
|
|
5614
5810
|
for (const mcpTool of toolsResponse.tools) {
|
|
5615
5811
|
if (this.isSelected(mcpTool, context)) {
|
|
5616
5812
|
try {
|
|
5617
|
-
const tool = await
|
|
5813
|
+
const tool = await createTool2(mcpTool, client);
|
|
5618
5814
|
tools.push(tool);
|
|
5619
5815
|
} catch (toolError) {
|
|
5620
5816
|
console.error(
|
|
@@ -6150,7 +6346,7 @@ var BaseLlmFlow = (_class22 = class {constructor() { _class22.prototype.__init39
|
|
|
6150
6346
|
}).join(", ");
|
|
6151
6347
|
const systemInstruction = llmRequest.getSystemInstructionText() || "";
|
|
6152
6348
|
const truncatedSystemInstruction = systemInstruction.length > 100 ? `${systemInstruction.substring(0, 100)}...` : systemInstruction;
|
|
6153
|
-
const contentPreview = _optionalChain([llmRequest, 'access', _188 => _188.contents, 'optionalAccess', _189 => _189.length]) > 0 ?
|
|
6349
|
+
const contentPreview = _optionalChain([llmRequest, 'access', _188 => _188.contents, 'optionalAccess', _189 => _189.length]) > 0 ? LogFormatter.formatContentPreview(llmRequest.contents[0]) : "none";
|
|
6154
6350
|
this.logger.debugStructured("\u{1F4E4} LLM Request", {
|
|
6155
6351
|
Model: llm.model,
|
|
6156
6352
|
Agent: invocationContext.agent.name,
|
|
@@ -6174,12 +6370,13 @@ var BaseLlmFlow = (_class22 = class {constructor() { _class22.prototype.__init39
|
|
|
6174
6370
|
llmResponse
|
|
6175
6371
|
);
|
|
6176
6372
|
const tokenCount = _optionalChain([llmResponse, 'access', _195 => _195.usageMetadata, 'optionalAccess', _196 => _196.totalTokenCount]) || "unknown";
|
|
6177
|
-
const
|
|
6178
|
-
const
|
|
6373
|
+
const functionCalls = _optionalChain([llmResponse, 'access', _197 => _197.content, 'optionalAccess', _198 => _198.parts, 'optionalAccess', _199 => _199.filter, 'call', _200 => _200((part) => part.functionCall)]) || [];
|
|
6374
|
+
const functionCallsDisplay = LogFormatter.formatFunctionCalls(functionCalls);
|
|
6375
|
+
const responsePreview = LogFormatter.formatResponsePreview(llmResponse);
|
|
6179
6376
|
this.logger.debugStructured("\u{1F4E5} LLM Response", {
|
|
6180
6377
|
Model: llm.model,
|
|
6181
6378
|
"Token Count": tokenCount,
|
|
6182
|
-
"Function Calls":
|
|
6379
|
+
"Function Calls": functionCallsDisplay,
|
|
6183
6380
|
"Response Preview": responsePreview,
|
|
6184
6381
|
"Finish Reason": llmResponse.finishReason || "unknown",
|
|
6185
6382
|
"Response #": responseCount,
|
|
@@ -6265,34 +6462,6 @@ var BaseLlmFlow = (_class22 = class {constructor() { _class22.prototype.__init39
|
|
|
6265
6462
|
}
|
|
6266
6463
|
return event;
|
|
6267
6464
|
}
|
|
6268
|
-
/**
|
|
6269
|
-
* Logs data in a visually appealing format that works well in any terminal size.
|
|
6270
|
-
* Uses vertical layout for better readability and respects debug settings.
|
|
6271
|
-
*/
|
|
6272
|
-
_formatContentPreview(content) {
|
|
6273
|
-
if (!content) return "none";
|
|
6274
|
-
if (content.parts && Array.isArray(content.parts)) {
|
|
6275
|
-
const textParts = content.parts.filter((part) => part.text).map((part) => part.text).join(" ");
|
|
6276
|
-
return textParts.length > 80 ? `${textParts.substring(0, 80)}...` : textParts || "no text content";
|
|
6277
|
-
}
|
|
6278
|
-
if (typeof content === "string") {
|
|
6279
|
-
return content.length > 80 ? `${content.substring(0, 80)}...` : content;
|
|
6280
|
-
}
|
|
6281
|
-
const stringified = JSON.stringify(content);
|
|
6282
|
-
return stringified.length > 80 ? `${stringified.substring(0, 80)}...` : stringified;
|
|
6283
|
-
}
|
|
6284
|
-
/**
|
|
6285
|
-
* Formats response content preview for debug logging
|
|
6286
|
-
*/
|
|
6287
|
-
_formatResponsePreview(llmResponse) {
|
|
6288
|
-
if (!llmResponse.content) return "none";
|
|
6289
|
-
if (llmResponse.content.parts && Array.isArray(llmResponse.content.parts)) {
|
|
6290
|
-
const textParts = llmResponse.content.parts.filter((part) => part.text).map((part) => part.text).join(" ");
|
|
6291
|
-
return textParts.length > 80 ? `${textParts.substring(0, 80)}...` : textParts || "no text content";
|
|
6292
|
-
}
|
|
6293
|
-
const stringified = JSON.stringify(llmResponse.content);
|
|
6294
|
-
return stringified.length > 80 ? `${stringified.substring(0, 80)}...` : stringified;
|
|
6295
|
-
}
|
|
6296
6465
|
__getLlm(invocationContext) {
|
|
6297
6466
|
const llm = invocationContext.agent.canonicalModel;
|
|
6298
6467
|
return llm;
|
|
@@ -6345,7 +6514,7 @@ var EnhancedAuthConfig = class {
|
|
|
6345
6514
|
*/
|
|
6346
6515
|
generateCredentialKey() {
|
|
6347
6516
|
const schemeKey = this.authScheme.type || "unknown";
|
|
6348
|
-
const credentialKey = _optionalChain([this, 'access',
|
|
6517
|
+
const credentialKey = _optionalChain([this, 'access', _201 => _201.rawAuthCredential, 'optionalAccess', _202 => _202.type]) || "none";
|
|
6349
6518
|
const timestamp = Date.now();
|
|
6350
6519
|
return `adk_${schemeKey}_${credentialKey}_${timestamp}`;
|
|
6351
6520
|
}
|
|
@@ -6502,7 +6671,7 @@ var AuthLlmRequestProcessor = class extends BaseLlmRequestProcessor {
|
|
|
6502
6671
|
*/
|
|
6503
6672
|
parseAndStoreAuthResponse(authHandler, invocationContext) {
|
|
6504
6673
|
try {
|
|
6505
|
-
const credentialKey = _optionalChain([authHandler, 'access',
|
|
6674
|
+
const credentialKey = _optionalChain([authHandler, 'access', _203 => _203.authConfig, 'access', _204 => _204.context, 'optionalAccess', _205 => _205.credentialKey]) || `temp:${Date.now()}`;
|
|
6506
6675
|
const fullCredentialKey = credentialKey.startsWith("temp:") ? credentialKey : `temp:${credentialKey}`;
|
|
6507
6676
|
invocationContext.session.state[fullCredentialKey] = authHandler.credential;
|
|
6508
6677
|
if (authHandler.authConfig.authScheme.type === "oauth2" || authHandler.authConfig.authScheme.type === "openIdConnect") {
|
|
@@ -6610,7 +6779,7 @@ var BuiltInCodeExecutor = class extends BaseCodeExecutor {
|
|
|
6610
6779
|
* Pre-process the LLM request for Gemini 2.0+ models to use the code execution tool
|
|
6611
6780
|
*/
|
|
6612
6781
|
processLlmRequest(llmRequest) {
|
|
6613
|
-
if (!_optionalChain([llmRequest, 'access',
|
|
6782
|
+
if (!_optionalChain([llmRequest, 'access', _206 => _206.model, 'optionalAccess', _207 => _207.startsWith, 'call', _208 => _208("gemini-2")])) {
|
|
6614
6783
|
throw new Error(
|
|
6615
6784
|
`Gemini code execution tool is not supported for model ${llmRequest.model}`
|
|
6616
6785
|
);
|
|
@@ -6655,7 +6824,7 @@ var CodeExecutionUtils = class _CodeExecutionUtils {
|
|
|
6655
6824
|
* Extracts the first code block from the content and truncates everything after it
|
|
6656
6825
|
*/
|
|
6657
6826
|
static extractCodeAndTruncateContent(content, codeBlockDelimiters) {
|
|
6658
|
-
if (!_optionalChain([content, 'optionalAccess',
|
|
6827
|
+
if (!_optionalChain([content, 'optionalAccess', _209 => _209.parts, 'optionalAccess', _210 => _210.length])) {
|
|
6659
6828
|
return null;
|
|
6660
6829
|
}
|
|
6661
6830
|
for (let idx = 0; idx < content.parts.length; idx++) {
|
|
@@ -6741,7 +6910,7 @@ ${fileNames}`);
|
|
|
6741
6910
|
* Converts the code execution parts to text parts in a Content
|
|
6742
6911
|
*/
|
|
6743
6912
|
static convertCodeExecutionParts(content, codeBlockDelimiter, executionResultDelimiters) {
|
|
6744
|
-
if (!_optionalChain([content, 'access',
|
|
6913
|
+
if (!_optionalChain([content, 'access', _211 => _211.parts, 'optionalAccess', _212 => _212.length])) {
|
|
6745
6914
|
return;
|
|
6746
6915
|
}
|
|
6747
6916
|
const lastPart = content.parts[content.parts.length - 1];
|
|
@@ -7134,7 +7303,7 @@ async function* runPostProcessor(invocationContext, llmResponse) {
|
|
|
7134
7303
|
function extractAndReplaceInlineFiles(codeExecutorContext, llmRequest) {
|
|
7135
7304
|
const allInputFiles = codeExecutorContext.getInputFiles();
|
|
7136
7305
|
const savedFileNames = new Set(allInputFiles.map((f) => f.name));
|
|
7137
|
-
for (let i = 0; i < (_optionalChain([llmRequest, 'access',
|
|
7306
|
+
for (let i = 0; i < (_optionalChain([llmRequest, 'access', _213 => _213.contents, 'optionalAccess', _214 => _214.length]) || 0); i++) {
|
|
7138
7307
|
const content = llmRequest.contents[i];
|
|
7139
7308
|
if (content.role !== "user" || !content.parts) {
|
|
7140
7309
|
continue;
|
|
@@ -7166,7 +7335,7 @@ Available file: \`${fileName}\`
|
|
|
7166
7335
|
}
|
|
7167
7336
|
function getOrSetExecutionId(invocationContext, codeExecutorContext) {
|
|
7168
7337
|
const agent = invocationContext.agent;
|
|
7169
|
-
if (!hasCodeExecutor(agent) || !_optionalChain([agent, 'access',
|
|
7338
|
+
if (!hasCodeExecutor(agent) || !_optionalChain([agent, 'access', _215 => _215.codeExecutor, 'optionalAccess', _216 => _216.stateful])) {
|
|
7170
7339
|
return void 0;
|
|
7171
7340
|
}
|
|
7172
7341
|
let executionId = codeExecutorContext.getExecutionId();
|
|
@@ -7397,7 +7566,7 @@ function rearrangeEventsForLatestFunctionResponse(events) {
|
|
|
7397
7566
|
continue;
|
|
7398
7567
|
}
|
|
7399
7568
|
const functionResponses2 = event.getFunctionResponses();
|
|
7400
|
-
if (_optionalChain([functionResponses2, 'optionalAccess',
|
|
7569
|
+
if (_optionalChain([functionResponses2, 'optionalAccess', _217 => _217.some, 'call', _218 => _218((fr) => fr.id && functionResponsesIds.has(fr.id))])) {
|
|
7401
7570
|
functionResponseEvents.push(event);
|
|
7402
7571
|
}
|
|
7403
7572
|
}
|
|
@@ -7496,7 +7665,7 @@ function mergeFunctionResponseEvents(functionResponseEvents) {
|
|
|
7496
7665
|
const partIndicesInMergedEvent = {};
|
|
7497
7666
|
for (let idx = 0; idx < partsInMergedEvent.length; idx++) {
|
|
7498
7667
|
const part = partsInMergedEvent[idx];
|
|
7499
|
-
if (_optionalChain([part, 'access',
|
|
7668
|
+
if (_optionalChain([part, 'access', _219 => _219.functionResponse, 'optionalAccess', _220 => _220.id])) {
|
|
7500
7669
|
partIndicesInMergedEvent[part.functionResponse.id] = idx;
|
|
7501
7670
|
}
|
|
7502
7671
|
}
|
|
@@ -7505,7 +7674,7 @@ function mergeFunctionResponseEvents(functionResponseEvents) {
|
|
|
7505
7674
|
throw new Error("There should be at least one function_response part.");
|
|
7506
7675
|
}
|
|
7507
7676
|
for (const part of event.content.parts) {
|
|
7508
|
-
if (_optionalChain([part, 'access',
|
|
7677
|
+
if (_optionalChain([part, 'access', _221 => _221.functionResponse, 'optionalAccess', _222 => _222.id])) {
|
|
7509
7678
|
const functionCallId = part.functionResponse.id;
|
|
7510
7679
|
if (functionCallId in partIndicesInMergedEvent) {
|
|
7511
7680
|
partsInMergedEvent[partIndicesInMergedEvent[functionCallId]] = part;
|
|
@@ -7755,7 +7924,7 @@ var PlanReActPlanner = class extends BasePlanner {
|
|
|
7755
7924
|
let firstFcPartIndex = -1;
|
|
7756
7925
|
for (let i = 0; i < responseParts.length; i++) {
|
|
7757
7926
|
if (responseParts[i].functionCall) {
|
|
7758
|
-
if (!_optionalChain([responseParts, 'access',
|
|
7927
|
+
if (!_optionalChain([responseParts, 'access', _223 => _223[i], 'access', _224 => _224.functionCall, 'optionalAccess', _225 => _225.name])) {
|
|
7759
7928
|
continue;
|
|
7760
7929
|
}
|
|
7761
7930
|
preservedParts.push(responseParts[i]);
|
|
@@ -7794,7 +7963,7 @@ var PlanReActPlanner = class extends BasePlanner {
|
|
|
7794
7963
|
* Handles non-function-call parts of the response
|
|
7795
7964
|
*/
|
|
7796
7965
|
_handleNonFunctionCallParts(responsePart, preservedParts) {
|
|
7797
|
-
if (_optionalChain([responsePart, 'access',
|
|
7966
|
+
if (_optionalChain([responsePart, 'access', _226 => _226.text, 'optionalAccess', _227 => _227.includes, 'call', _228 => _228(FINAL_ANSWER_TAG)])) {
|
|
7798
7967
|
const [reasoningText, finalAnswerText] = this._splitByLastPattern(
|
|
7799
7968
|
responsePart.text,
|
|
7800
7969
|
FINAL_ANSWER_TAG
|
|
@@ -8271,7 +8440,7 @@ var LlmAgent = (_class23 = class _LlmAgent extends BaseAgent {
|
|
|
8271
8440
|
* This matches the Python implementation's _llm_flow property
|
|
8272
8441
|
*/
|
|
8273
8442
|
get llmFlow() {
|
|
8274
|
-
if (this.disallowTransferToParent && this.disallowTransferToPeers && !_optionalChain([this, 'access',
|
|
8443
|
+
if (this.disallowTransferToParent && this.disallowTransferToPeers && !_optionalChain([this, 'access', _229 => _229.subAgents, 'optionalAccess', _230 => _230.length])) {
|
|
8275
8444
|
return new SingleFlow();
|
|
8276
8445
|
}
|
|
8277
8446
|
return new AutoFlow();
|
|
@@ -8281,7 +8450,7 @@ var LlmAgent = (_class23 = class _LlmAgent extends BaseAgent {
|
|
|
8281
8450
|
* This matches the Python implementation's __maybe_save_output_to_state
|
|
8282
8451
|
*/
|
|
8283
8452
|
maybeSaveOutputToState(event) {
|
|
8284
|
-
if (this.outputKey && event.isFinalResponse() && _optionalChain([event, 'access',
|
|
8453
|
+
if (this.outputKey && event.isFinalResponse() && _optionalChain([event, 'access', _231 => _231.content, 'optionalAccess', _232 => _232.parts])) {
|
|
8285
8454
|
const result = event.content.parts.map((part) => part.text || "").join("");
|
|
8286
8455
|
if (result) {
|
|
8287
8456
|
if (!event.actions.stateDelta) {
|
|
@@ -8644,7 +8813,7 @@ var LoopAgent = class extends BaseAgent {
|
|
|
8644
8813
|
for (const subAgent of this.subAgents) {
|
|
8645
8814
|
for await (const event of subAgent.runAsync(ctx)) {
|
|
8646
8815
|
yield event;
|
|
8647
|
-
if (_optionalChain([event, 'access',
|
|
8816
|
+
if (_optionalChain([event, 'access', _233 => _233.actions, 'optionalAccess', _234 => _234.escalate])) {
|
|
8648
8817
|
return;
|
|
8649
8818
|
}
|
|
8650
8819
|
}
|
|
@@ -8955,17 +9124,17 @@ var RunConfig = class {
|
|
|
8955
9124
|
*/
|
|
8956
9125
|
|
|
8957
9126
|
constructor(config) {
|
|
8958
|
-
this.speechConfig = _optionalChain([config, 'optionalAccess',
|
|
8959
|
-
this.responseModalities = _optionalChain([config, 'optionalAccess',
|
|
8960
|
-
this.saveInputBlobsAsArtifacts = _optionalChain([config, 'optionalAccess',
|
|
8961
|
-
this.supportCFC = _optionalChain([config, 'optionalAccess',
|
|
8962
|
-
this.streamingMode = _optionalChain([config, 'optionalAccess',
|
|
8963
|
-
this.outputAudioTranscription = _optionalChain([config, 'optionalAccess',
|
|
8964
|
-
this.inputAudioTranscription = _optionalChain([config, 'optionalAccess',
|
|
8965
|
-
this.realtimeInputConfig = _optionalChain([config, 'optionalAccess',
|
|
8966
|
-
this.enableAffectiveDialog = _optionalChain([config, 'optionalAccess',
|
|
8967
|
-
this.proactivity = _optionalChain([config, 'optionalAccess',
|
|
8968
|
-
this.maxLlmCalls = _nullishCoalesce(_optionalChain([config, 'optionalAccess',
|
|
9127
|
+
this.speechConfig = _optionalChain([config, 'optionalAccess', _235 => _235.speechConfig]);
|
|
9128
|
+
this.responseModalities = _optionalChain([config, 'optionalAccess', _236 => _236.responseModalities]);
|
|
9129
|
+
this.saveInputBlobsAsArtifacts = _optionalChain([config, 'optionalAccess', _237 => _237.saveInputBlobsAsArtifacts]) || false;
|
|
9130
|
+
this.supportCFC = _optionalChain([config, 'optionalAccess', _238 => _238.supportCFC]) || false;
|
|
9131
|
+
this.streamingMode = _optionalChain([config, 'optionalAccess', _239 => _239.streamingMode]) || "NONE" /* NONE */;
|
|
9132
|
+
this.outputAudioTranscription = _optionalChain([config, 'optionalAccess', _240 => _240.outputAudioTranscription]);
|
|
9133
|
+
this.inputAudioTranscription = _optionalChain([config, 'optionalAccess', _241 => _241.inputAudioTranscription]);
|
|
9134
|
+
this.realtimeInputConfig = _optionalChain([config, 'optionalAccess', _242 => _242.realtimeInputConfig]);
|
|
9135
|
+
this.enableAffectiveDialog = _optionalChain([config, 'optionalAccess', _243 => _243.enableAffectiveDialog]);
|
|
9136
|
+
this.proactivity = _optionalChain([config, 'optionalAccess', _244 => _244.proactivity]);
|
|
9137
|
+
this.maxLlmCalls = _nullishCoalesce(_optionalChain([config, 'optionalAccess', _245 => _245.maxLlmCalls]), () => ( 500));
|
|
8969
9138
|
this.validateMaxLlmCalls();
|
|
8970
9139
|
}
|
|
8971
9140
|
/**
|
|
@@ -9109,7 +9278,7 @@ var InMemoryMemoryService = (_class28 = class {
|
|
|
9109
9278
|
}
|
|
9110
9279
|
const userSessions = this._sessionEvents.get(userKey);
|
|
9111
9280
|
const filteredEvents = session.events.filter(
|
|
9112
|
-
(event) => _optionalChain([event, 'access',
|
|
9281
|
+
(event) => _optionalChain([event, 'access', _246 => _246.content, 'optionalAccess', _247 => _247.parts])
|
|
9113
9282
|
);
|
|
9114
9283
|
userSessions.set(session.id, filteredEvents);
|
|
9115
9284
|
}
|
|
@@ -9248,7 +9417,7 @@ var InMemorySessionService = (_class29 = class extends BaseSessionService {const
|
|
|
9248
9417
|
return this.createSessionImpl(appName, userId, state, sessionId);
|
|
9249
9418
|
}
|
|
9250
9419
|
createSessionImpl(appName, userId, state, sessionId) {
|
|
9251
|
-
const finalSessionId = _optionalChain([sessionId, 'optionalAccess',
|
|
9420
|
+
const finalSessionId = _optionalChain([sessionId, 'optionalAccess', _248 => _248.trim, 'call', _249 => _249()]) || _crypto.randomUUID.call(void 0, );
|
|
9252
9421
|
const session = {
|
|
9253
9422
|
appName,
|
|
9254
9423
|
userId,
|
|
@@ -9405,7 +9574,7 @@ var InMemorySessionService = (_class29 = class extends BaseSessionService {const
|
|
|
9405
9574
|
warning(`sessionId ${sessionId} not in sessions[appName][userId]`);
|
|
9406
9575
|
return event;
|
|
9407
9576
|
}
|
|
9408
|
-
if (_optionalChain([event, 'access',
|
|
9577
|
+
if (_optionalChain([event, 'access', _250 => _250.actions, 'optionalAccess', _251 => _251.stateDelta])) {
|
|
9409
9578
|
for (const key in event.actions.stateDelta) {
|
|
9410
9579
|
const value = event.actions.stateDelta[key];
|
|
9411
9580
|
if (key.startsWith(State.APP_PREFIX)) {
|
|
@@ -9439,14 +9608,14 @@ function _findFunctionCallEventIfLastEventIsFunctionResponse(session) {
|
|
|
9439
9608
|
return null;
|
|
9440
9609
|
}
|
|
9441
9610
|
const lastEvent = events[events.length - 1];
|
|
9442
|
-
if (_optionalChain([lastEvent, 'access',
|
|
9443
|
-
const functionCallId = _optionalChain([lastEvent, 'access',
|
|
9611
|
+
if (_optionalChain([lastEvent, 'access', _252 => _252.content, 'optionalAccess', _253 => _253.parts, 'optionalAccess', _254 => _254.some, 'call', _255 => _255((part) => part.functionResponse)])) {
|
|
9612
|
+
const functionCallId = _optionalChain([lastEvent, 'access', _256 => _256.content, 'access', _257 => _257.parts, 'access', _258 => _258.find, 'call', _259 => _259(
|
|
9444
9613
|
(part) => part.functionResponse
|
|
9445
|
-
), 'optionalAccess',
|
|
9614
|
+
), 'optionalAccess', _260 => _260.functionResponse, 'optionalAccess', _261 => _261.id]);
|
|
9446
9615
|
if (!functionCallId) return null;
|
|
9447
9616
|
for (let i = events.length - 2; i >= 0; i--) {
|
|
9448
9617
|
const event = events[i];
|
|
9449
|
-
const functionCalls = _optionalChain([event, 'access',
|
|
9618
|
+
const functionCalls = _optionalChain([event, 'access', _262 => _262.getFunctionCalls, 'optionalCall', _263 => _263()]) || [];
|
|
9450
9619
|
for (const functionCall of functionCalls) {
|
|
9451
9620
|
if (functionCall.id === functionCallId) {
|
|
9452
9621
|
return event;
|
|
@@ -9634,15 +9803,15 @@ var Runner = (_class30 = class {
|
|
|
9634
9803
|
*/
|
|
9635
9804
|
_findAgentToRun(session, rootAgent) {
|
|
9636
9805
|
const event = _findFunctionCallEventIfLastEventIsFunctionResponse(session);
|
|
9637
|
-
if (_optionalChain([event, 'optionalAccess',
|
|
9806
|
+
if (_optionalChain([event, 'optionalAccess', _264 => _264.author])) {
|
|
9638
9807
|
return rootAgent.findAgent(event.author);
|
|
9639
9808
|
}
|
|
9640
|
-
const nonUserEvents = _optionalChain([session, 'access',
|
|
9809
|
+
const nonUserEvents = _optionalChain([session, 'access', _265 => _265.events, 'optionalAccess', _266 => _266.filter, 'call', _267 => _267((e) => e.author !== "user"), 'access', _268 => _268.reverse, 'call', _269 => _269()]) || [];
|
|
9641
9810
|
for (const event2 of nonUserEvents) {
|
|
9642
9811
|
if (event2.author === rootAgent.name) {
|
|
9643
9812
|
return rootAgent;
|
|
9644
9813
|
}
|
|
9645
|
-
const agent = _optionalChain([rootAgent, 'access',
|
|
9814
|
+
const agent = _optionalChain([rootAgent, 'access', _270 => _270.findSubAgent, 'optionalCall', _271 => _271(event2.author)]);
|
|
9646
9815
|
if (!agent) {
|
|
9647
9816
|
this.logger.debug(
|
|
9648
9817
|
`Event from an unknown agent: ${event2.author}, event id: ${event2.id}`
|
|
@@ -9990,7 +10159,7 @@ var AgentBuilder = (_class31 = class _AgentBuilder {
|
|
|
9990
10159
|
sessionId: session.id,
|
|
9991
10160
|
newMessage
|
|
9992
10161
|
})) {
|
|
9993
|
-
if (_optionalChain([event, 'access',
|
|
10162
|
+
if (_optionalChain([event, 'access', _272 => _272.content, 'optionalAccess', _273 => _273.parts]) && Array.isArray(event.content.parts)) {
|
|
9994
10163
|
const content = event.content.parts.map(
|
|
9995
10164
|
(part) => (part && typeof part === "object" && "text" in part ? part.text : "") || ""
|
|
9996
10165
|
).join("");
|
|
@@ -10070,7 +10239,7 @@ var VertexAiSessionService = class extends BaseSessionService {
|
|
|
10070
10239
|
path: `operations/${operationId}`,
|
|
10071
10240
|
request_dict: {}
|
|
10072
10241
|
});
|
|
10073
|
-
if (_optionalChain([lroResponse, 'optionalAccess',
|
|
10242
|
+
if (_optionalChain([lroResponse, 'optionalAccess', _274 => _274.done])) {
|
|
10074
10243
|
break;
|
|
10075
10244
|
}
|
|
10076
10245
|
await new Promise((resolve) => setTimeout(resolve, 1e3));
|
|
@@ -10441,12 +10610,12 @@ var DatabaseSessionService = (_class32 = class extends BaseSessionService {
|
|
|
10441
10610
|
}
|
|
10442
10611
|
async createSession(appName, userId, state, sessionId) {
|
|
10443
10612
|
await this.ensureInitialized();
|
|
10444
|
-
const id = _optionalChain([sessionId, 'optionalAccess',
|
|
10613
|
+
const id = _optionalChain([sessionId, 'optionalAccess', _275 => _275.trim, 'call', _276 => _276()]) || this.generateSessionId();
|
|
10445
10614
|
return await this.db.transaction().execute(async (trx) => {
|
|
10446
10615
|
const appState = await trx.selectFrom("app_states").selectAll().where("app_name", "=", appName).executeTakeFirst();
|
|
10447
10616
|
const userState = await trx.selectFrom("user_states").selectAll().where("app_name", "=", appName).where("user_id", "=", userId).executeTakeFirst();
|
|
10448
|
-
let currentAppState = this.parseJsonSafely(_optionalChain([appState, 'optionalAccess',
|
|
10449
|
-
let currentUserState = this.parseJsonSafely(_optionalChain([userState, 'optionalAccess',
|
|
10617
|
+
let currentAppState = this.parseJsonSafely(_optionalChain([appState, 'optionalAccess', _277 => _277.state]), {});
|
|
10618
|
+
let currentUserState = this.parseJsonSafely(_optionalChain([userState, 'optionalAccess', _278 => _278.state]), {});
|
|
10450
10619
|
if (!appState) {
|
|
10451
10620
|
await trx.insertInto("app_states").values({
|
|
10452
10621
|
app_name: appName,
|
|
@@ -10505,21 +10674,21 @@ var DatabaseSessionService = (_class32 = class extends BaseSessionService {
|
|
|
10505
10674
|
return void 0;
|
|
10506
10675
|
}
|
|
10507
10676
|
let eventQuery = trx.selectFrom("events").selectAll().where("session_id", "=", sessionId).orderBy("timestamp", "desc");
|
|
10508
|
-
if (_optionalChain([config, 'optionalAccess',
|
|
10677
|
+
if (_optionalChain([config, 'optionalAccess', _279 => _279.afterTimestamp])) {
|
|
10509
10678
|
eventQuery = eventQuery.where(
|
|
10510
10679
|
"timestamp",
|
|
10511
10680
|
">=",
|
|
10512
10681
|
new Date(config.afterTimestamp * 1e3)
|
|
10513
10682
|
);
|
|
10514
10683
|
}
|
|
10515
|
-
if (_optionalChain([config, 'optionalAccess',
|
|
10684
|
+
if (_optionalChain([config, 'optionalAccess', _280 => _280.numRecentEvents])) {
|
|
10516
10685
|
eventQuery = eventQuery.limit(config.numRecentEvents);
|
|
10517
10686
|
}
|
|
10518
10687
|
const storageEvents = await eventQuery.execute();
|
|
10519
10688
|
const appState = await trx.selectFrom("app_states").selectAll().where("app_name", "=", appName).executeTakeFirst();
|
|
10520
10689
|
const userState = await trx.selectFrom("user_states").selectAll().where("app_name", "=", appName).where("user_id", "=", userId).executeTakeFirst();
|
|
10521
|
-
const currentAppState = this.parseJsonSafely(_optionalChain([appState, 'optionalAccess',
|
|
10522
|
-
const currentUserState = this.parseJsonSafely(_optionalChain([userState, 'optionalAccess',
|
|
10690
|
+
const currentAppState = this.parseJsonSafely(_optionalChain([appState, 'optionalAccess', _281 => _281.state]), {});
|
|
10691
|
+
const currentUserState = this.parseJsonSafely(_optionalChain([userState, 'optionalAccess', _282 => _282.state]), {});
|
|
10523
10692
|
const sessionState = this.parseJsonSafely(storageSession.state, {});
|
|
10524
10693
|
const mergedState = this.mergeState(
|
|
10525
10694
|
currentAppState,
|
|
@@ -10577,13 +10746,13 @@ var DatabaseSessionService = (_class32 = class extends BaseSessionService {
|
|
|
10577
10746
|
}
|
|
10578
10747
|
const appState = await trx.selectFrom("app_states").selectAll().where("app_name", "=", session.appName).executeTakeFirst();
|
|
10579
10748
|
const userState = await trx.selectFrom("user_states").selectAll().where("app_name", "=", session.appName).where("user_id", "=", session.userId).executeTakeFirst();
|
|
10580
|
-
let currentAppState = this.parseJsonSafely(_optionalChain([appState, 'optionalAccess',
|
|
10581
|
-
let currentUserState = this.parseJsonSafely(_optionalChain([userState, 'optionalAccess',
|
|
10749
|
+
let currentAppState = this.parseJsonSafely(_optionalChain([appState, 'optionalAccess', _283 => _283.state]), {});
|
|
10750
|
+
let currentUserState = this.parseJsonSafely(_optionalChain([userState, 'optionalAccess', _284 => _284.state]), {});
|
|
10582
10751
|
let sessionState = this.parseJsonSafely(storageSession.state, {});
|
|
10583
10752
|
let appStateDelta = {};
|
|
10584
10753
|
let userStateDelta = {};
|
|
10585
10754
|
let sessionStateDelta = {};
|
|
10586
|
-
if (_optionalChain([event, 'access',
|
|
10755
|
+
if (_optionalChain([event, 'access', _285 => _285.actions, 'optionalAccess', _286 => _286.stateDelta])) {
|
|
10587
10756
|
const deltas = this.extractStateDelta(event.actions.stateDelta);
|
|
10588
10757
|
appStateDelta = deltas.appStateDelta;
|
|
10589
10758
|
userStateDelta = deltas.userStateDelta;
|
|
@@ -10729,7 +10898,7 @@ var DatabaseSessionService = (_class32 = class extends BaseSessionService {
|
|
|
10729
10898
|
* Overrides the base class method to work with plain object state.
|
|
10730
10899
|
*/
|
|
10731
10900
|
updateSessionState(session, event) {
|
|
10732
|
-
if (!_optionalChain([event, 'access',
|
|
10901
|
+
if (!_optionalChain([event, 'access', _287 => _287.actions, 'optionalAccess', _288 => _288.stateDelta])) {
|
|
10733
10902
|
return;
|
|
10734
10903
|
}
|
|
10735
10904
|
for (const [key, value] of Object.entries(event.actions.stateDelta)) {
|
|
@@ -10899,7 +11068,7 @@ var GcsArtifactService = class {
|
|
|
10899
11068
|
};
|
|
10900
11069
|
return part;
|
|
10901
11070
|
} catch (error) {
|
|
10902
|
-
if (_optionalChain([error, 'optionalAccess',
|
|
11071
|
+
if (_optionalChain([error, 'optionalAccess', _289 => _289.code]) === 404) {
|
|
10903
11072
|
return null;
|
|
10904
11073
|
}
|
|
10905
11074
|
throw error;
|
|
@@ -11144,4 +11313,5 @@ var VERSION = "0.1.0";
|
|
|
11144
11313
|
|
|
11145
11314
|
|
|
11146
11315
|
|
|
11147
|
-
|
|
11316
|
+
|
|
11317
|
+
exports.AF_FUNCTION_CALL_ID_PREFIX = AF_FUNCTION_CALL_ID_PREFIX; exports.Agent = LlmAgent; exports.AgentBuilder = AgentBuilder; exports.Agents = agents_exports; exports.AiSdkLlm = AiSdkLlm; exports.AnthropicLlm = AnthropicLlm; exports.ApiKeyCredential = ApiKeyCredential; exports.ApiKeyScheme = ApiKeyScheme; exports.AuthConfig = AuthConfig; exports.AuthCredential = AuthCredential; exports.AuthCredentialType = AuthCredentialType; exports.AuthHandler = AuthHandler; exports.AuthScheme = AuthScheme; exports.AuthSchemeType = AuthSchemeType; exports.AuthTool = AuthTool; exports.AutoFlow = AutoFlow; exports.BaseAgent = BaseAgent; exports.BaseCodeExecutor = BaseCodeExecutor; exports.BaseLLMConnection = BaseLLMConnection; exports.BaseLlm = BaseLlm; exports.BaseLlmFlow = BaseLlmFlow; exports.BaseLlmRequestProcessor = BaseLlmRequestProcessor; exports.BaseLlmResponseProcessor = BaseLlmResponseProcessor; exports.BasePlanner = BasePlanner; exports.BaseSessionService = BaseSessionService; exports.BaseTool = BaseTool; exports.BasicAuthCredential = BasicAuthCredential; exports.BearerTokenCredential = BearerTokenCredential; exports.BuiltInCodeExecutor = BuiltInCodeExecutor; exports.BuiltInPlanner = BuiltInPlanner; exports.CallbackContext = CallbackContext; exports.CodeExecutionUtils = CodeExecutionUtils; exports.CodeExecutorContext = CodeExecutorContext; exports.DatabaseSessionService = DatabaseSessionService; exports.EnhancedAuthConfig = EnhancedAuthConfig; exports.Event = Event; exports.EventActions = EventActions; exports.Events = events_exports; exports.ExitLoopTool = ExitLoopTool; exports.FileOperationsTool = FileOperationsTool; exports.Flows = flows_exports; exports.FunctionTool = FunctionTool; exports.GcsArtifactService = GcsArtifactService; exports.GetUserChoiceTool = GetUserChoiceTool; exports.GoogleLlm = GoogleLlm; exports.GoogleSearch = GoogleSearch; exports.HttpRequestTool = HttpRequestTool; exports.HttpScheme = HttpScheme; exports.InMemoryArtifactService = InMemoryArtifactService; exports.InMemoryMemoryService = InMemoryMemoryService; exports.InMemoryRunner = InMemoryRunner; exports.InMemorySessionService = InMemorySessionService; exports.InvocationContext = InvocationContext; exports.LLMRegistry = LLMRegistry; exports.LangGraphAgent = LangGraphAgent; exports.LlmAgent = LlmAgent; exports.LlmCallsLimitExceededError = LlmCallsLimitExceededError; exports.LlmRequest = LlmRequest; exports.LlmResponse = LlmResponse; exports.LoadArtifactsTool = LoadArtifactsTool; exports.LoadMemoryTool = LoadMemoryTool; exports.LoopAgent = LoopAgent; exports.McpAbi = McpAbi; exports.McpAtp = McpAtp; exports.McpBamm = McpBamm; exports.McpCoinGecko = McpCoinGecko; exports.McpDiscord = McpDiscord; exports.McpError = McpError; exports.McpErrorType = McpErrorType; exports.McpFilesystem = McpFilesystem; exports.McpFraxlend = McpFraxlend; exports.McpGeneric = McpGeneric; exports.McpIqWiki = McpIqWiki; exports.McpMemory = McpMemory; exports.McpNearAgent = McpNearAgent; exports.McpNearIntentSwaps = McpNearIntentSwaps; exports.McpOdos = McpOdos; exports.McpSamplingHandler = McpSamplingHandler; exports.McpTelegram = McpTelegram; exports.McpToolset = McpToolset; exports.Memory = memory_exports; exports.Models = models_exports; exports.OAuth2Credential = OAuth2Credential; exports.OAuth2Scheme = OAuth2Scheme; exports.OpenAiLlm = OpenAiLlm; exports.OpenIdConnectScheme = OpenIdConnectScheme; exports.ParallelAgent = ParallelAgent; exports.PlanReActPlanner = PlanReActPlanner; exports.REQUEST_EUC_FUNCTION_CALL_NAME = REQUEST_EUC_FUNCTION_CALL_NAME; exports.ReadonlyContext = ReadonlyContext; exports.RunConfig = RunConfig; exports.Runner = Runner; exports.SequentialAgent = SequentialAgent; exports.Sessions = sessions_exports; exports.SingleFlow = SingleFlow; exports.State = State; exports.StreamingMode = StreamingMode; exports.TelemetryService = TelemetryService; exports.ToolContext = ToolContext; exports.Tools = tools_exports; exports.TransferToAgentTool = TransferToAgentTool; exports.UserInteractionTool = UserInteractionTool; exports.VERSION = VERSION; exports.VertexAiSessionService = VertexAiSessionService; exports._findFunctionCallEventIfLastEventIsFunctionResponse = _findFunctionCallEventIfLastEventIsFunctionResponse; exports.adkToMcpToolType = adkToMcpToolType; exports.agentTransferRequestProcessor = requestProcessor8; exports.basicRequestProcessor = requestProcessor2; exports.buildFunctionDeclaration = buildFunctionDeclaration; exports.codeExecutionRequestProcessor = requestProcessor3; exports.codeExecutionResponseProcessor = responseProcessor; exports.contentRequestProcessor = requestProcessor4; exports.createAuthToolArguments = createAuthToolArguments; exports.createBranchContextForSubAgent = createBranchContextForSubAgent; exports.createDatabaseSessionService = createDatabaseSessionService; exports.createFunctionTool = createFunctionTool; exports.createMysqlSessionService = createMysqlSessionService; exports.createPostgresSessionService = createPostgresSessionService; exports.createSamplingHandler = createSamplingHandler; exports.createSqliteSessionService = createSqliteSessionService; exports.createTool = createTool; exports.generateAuthEvent = generateAuthEvent; exports.generateClientFunctionCallId = generateClientFunctionCallId; exports.getLongRunningFunctionCalls = getLongRunningFunctionCalls; exports.getMcpTools = getMcpTools; exports.handleFunctionCallsAsync = handleFunctionCallsAsync; exports.handleFunctionCallsLive = handleFunctionCallsLive; exports.identityRequestProcessor = requestProcessor5; exports.initializeTelemetry = initializeTelemetry; exports.injectSessionState = injectSessionState; exports.instructionsRequestProcessor = requestProcessor6; exports.isEnhancedAuthConfig = isEnhancedAuthConfig; exports.jsonSchemaToDeclaration = jsonSchemaToDeclaration; exports.mcpSchemaToParameters = mcpSchemaToParameters; exports.mergeAgentRun = mergeAgentRun; exports.mergeParallelFunctionResponseEvents = mergeParallelFunctionResponseEvents; exports.newInvocationContextId = newInvocationContextId; exports.nlPlanningRequestProcessor = requestProcessor7; exports.nlPlanningResponseProcessor = responseProcessor2; exports.normalizeJsonSchema = normalizeJsonSchema; exports.populateClientFunctionCallId = populateClientFunctionCallId; exports.registerProviders = registerProviders; exports.removeClientFunctionCallId = removeClientFunctionCallId; exports.requestProcessor = requestProcessor; exports.shutdownTelemetry = shutdownTelemetry; exports.telemetryService = telemetryService; exports.traceLlmCall = traceLlmCall; exports.traceToolCall = traceToolCall; exports.tracer = tracer;
|