@iqai/adk 0.0.13 → 0.0.15
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 +13 -0
- package/dist/index.d.mts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +38 -15
- package/dist/index.mjs +37 -14
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @iqai/adk
|
|
2
2
|
|
|
3
|
+
## 0.0.15
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 033217e: google-llm: exclude exclusive min/max from tool calls
|
|
8
|
+
|
|
9
|
+
## 0.0.14
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 25c9c8c: bug-fixes: session-managers, runner
|
|
14
|
+
new example: pglite
|
|
15
|
+
|
|
3
16
|
## 0.0.13
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -649,6 +649,7 @@ declare class GoogleLLM extends BaseLLM {
|
|
|
649
649
|
private convertFunctionsToTools;
|
|
650
650
|
/**
|
|
651
651
|
* Convert parameter types to Google Gemini format (uppercase types)
|
|
652
|
+
* Also removes unsupported fields like exclusiveMinimum/exclusiveMaximum
|
|
652
653
|
*/
|
|
653
654
|
private convertParametersToGoogleFormat;
|
|
654
655
|
/**
|
|
@@ -3489,9 +3490,10 @@ type index_SqliteSessionService = SqliteSessionService;
|
|
|
3489
3490
|
declare const index_SqliteSessionService: typeof SqliteSessionService;
|
|
3490
3491
|
declare const index_cloneSession: typeof cloneSession;
|
|
3491
3492
|
declare const index_generateSessionId: typeof generateSessionId;
|
|
3493
|
+
declare const index_sessionsSchema: typeof sessionsSchema;
|
|
3492
3494
|
declare const index_validateSession: typeof validateSession;
|
|
3493
3495
|
declare namespace index {
|
|
3494
|
-
export { index_InMemorySessionService as InMemorySessionService, type index_ListSessionOptions as ListSessionOptions, index_PgLiteSessionService as PgLiteSessionService, index_PostgresSessionService as PostgresSessionService, type index_Session as Session, type index_SessionService as SessionService, index_SessionState as SessionState, index_SqliteSessionService as SqliteSessionService, index_cloneSession as cloneSession, index_generateSessionId as generateSessionId, index_validateSession as validateSession };
|
|
3496
|
+
export { index_InMemorySessionService as InMemorySessionService, type index_ListSessionOptions as ListSessionOptions, index_PgLiteSessionService as PgLiteSessionService, index_PostgresSessionService as PostgresSessionService, type index_Session as Session, type index_SessionService as SessionService, index_SessionState as SessionState, index_SqliteSessionService as SqliteSessionService, index_cloneSession as cloneSession, index_generateSessionId as generateSessionId, index_sessionsSchema as sessionsSchema, index_validateSession as validateSession };
|
|
3495
3497
|
}
|
|
3496
3498
|
|
|
3497
3499
|
/**
|
|
@@ -3557,4 +3559,4 @@ declare class InMemoryRunner extends Runner {
|
|
|
3557
3559
|
|
|
3558
3560
|
declare const VERSION = "0.1.0";
|
|
3559
3561
|
|
|
3560
|
-
export { Agent, type AgentConfig, index$3 as Agents, AnthropicLLM, type AnthropicLLMConfig, AnthropicLLMConnection, ApiKeyCredential, ApiKeyScheme, type AudioTranscriptionConfig, AuthConfig, AuthCredential, AuthCredentialType, AuthHandler, AuthScheme, AuthSchemeType, BaseAgent, BaseLLM, BaseLLMConnection, type BaseMemoryService, BaseTool, BasicAuthCredential, BearerTokenCredential, type BuildFunctionDeclarationOptions, ExitLoopTool, FileOperationsTool, type FunctionCall, type FunctionDeclaration, FunctionTool, GetUserChoiceTool, GoogleLLM, type GoogleLLMConfig, GoogleSearch, HttpRequestTool, HttpScheme, type IToolContext, type ImageContent, InMemoryMemoryService, InMemoryRunner, InMemorySessionService, InvocationContext, type JSONSchema, LLMRegistry, LLMRequest, type LLMRequestConfig, LLMResponse, LangGraphAgent, type LangGraphAgentConfig, type LangGraphNode, type ListSessionOptions, LoadMemoryTool, LoopAgent, type LoopAgentConfig, type McpConfig, McpError, McpErrorType, McpSamplingHandler, type McpSamplingRequest, type McpSamplingResponse, McpToolset, type McpTransportType, index$1 as Memory, type MemoryResult, type Message, type MessageContent, type MessageRole, index$4 as Models, OAuth2Credential, OAuth2Scheme, type OAuthFlow, type OAuthFlows, OpenAILLM, type OpenAILLMConfig, OpenAILLMConnection, OpenIdConnectScheme, ParallelAgent, type ParallelAgentConfig, PersistentMemoryService, PgLiteSessionService, PostgresSessionService, RunConfig, Runner, type SamplingHandler, type SearchMemoryOptions, type SearchMemoryResponse, SequentialAgent, type SequentialAgentConfig, type Session, type SessionService, SessionState, index as Sessions, type SpeechConfig, SqliteSessionService, StreamingMode, type TextContent, type ToolCall, type ToolConfig, ToolContext, index$2 as Tools, TransferToAgentTool, UserInteractionTool, VERSION, adkToMcpToolType, buildFunctionDeclaration, cloneSession, createFunctionTool, createSamplingHandler, generateSessionId, getMcpTools, jsonSchemaToDeclaration, mcpSchemaToParameters, normalizeJsonSchema, registerProviders, validateSession };
|
|
3562
|
+
export { Agent, type AgentConfig, index$3 as Agents, AnthropicLLM, type AnthropicLLMConfig, AnthropicLLMConnection, ApiKeyCredential, ApiKeyScheme, type AudioTranscriptionConfig, AuthConfig, AuthCredential, AuthCredentialType, AuthHandler, AuthScheme, AuthSchemeType, BaseAgent, BaseLLM, BaseLLMConnection, type BaseMemoryService, BaseTool, BasicAuthCredential, BearerTokenCredential, type BuildFunctionDeclarationOptions, ExitLoopTool, FileOperationsTool, type FunctionCall, type FunctionDeclaration, FunctionTool, GetUserChoiceTool, GoogleLLM, type GoogleLLMConfig, GoogleSearch, HttpRequestTool, HttpScheme, type IToolContext, type ImageContent, InMemoryMemoryService, InMemoryRunner, InMemorySessionService, InvocationContext, type JSONSchema, LLMRegistry, LLMRequest, type LLMRequestConfig, LLMResponse, LangGraphAgent, type LangGraphAgentConfig, type LangGraphNode, type ListSessionOptions, LoadMemoryTool, LoopAgent, type LoopAgentConfig, type McpConfig, McpError, McpErrorType, McpSamplingHandler, type McpSamplingRequest, type McpSamplingResponse, McpToolset, type McpTransportType, index$1 as Memory, type MemoryResult, type Message, type MessageContent, type MessageRole, index$4 as Models, OAuth2Credential, OAuth2Scheme, type OAuthFlow, type OAuthFlows, OpenAILLM, type OpenAILLMConfig, OpenAILLMConnection, OpenIdConnectScheme, ParallelAgent, type ParallelAgentConfig, PersistentMemoryService, PgLiteSessionService, PostgresSessionService, RunConfig, Runner, type SamplingHandler, type SearchMemoryOptions, type SearchMemoryResponse, SequentialAgent, type SequentialAgentConfig, type Session, type SessionService, SessionState, index as Sessions, type SpeechConfig, SqliteSessionService, StreamingMode, type TextContent, type ToolCall, type ToolConfig, ToolContext, index$2 as Tools, TransferToAgentTool, UserInteractionTool, VERSION, adkToMcpToolType, buildFunctionDeclaration, cloneSession, createFunctionTool, createSamplingHandler, generateSessionId, getMcpTools, jsonSchemaToDeclaration, mcpSchemaToParameters, normalizeJsonSchema, registerProviders, sessionsSchema, validateSession };
|
package/dist/index.d.ts
CHANGED
|
@@ -649,6 +649,7 @@ declare class GoogleLLM extends BaseLLM {
|
|
|
649
649
|
private convertFunctionsToTools;
|
|
650
650
|
/**
|
|
651
651
|
* Convert parameter types to Google Gemini format (uppercase types)
|
|
652
|
+
* Also removes unsupported fields like exclusiveMinimum/exclusiveMaximum
|
|
652
653
|
*/
|
|
653
654
|
private convertParametersToGoogleFormat;
|
|
654
655
|
/**
|
|
@@ -3489,9 +3490,10 @@ type index_SqliteSessionService = SqliteSessionService;
|
|
|
3489
3490
|
declare const index_SqliteSessionService: typeof SqliteSessionService;
|
|
3490
3491
|
declare const index_cloneSession: typeof cloneSession;
|
|
3491
3492
|
declare const index_generateSessionId: typeof generateSessionId;
|
|
3493
|
+
declare const index_sessionsSchema: typeof sessionsSchema;
|
|
3492
3494
|
declare const index_validateSession: typeof validateSession;
|
|
3493
3495
|
declare namespace index {
|
|
3494
|
-
export { index_InMemorySessionService as InMemorySessionService, type index_ListSessionOptions as ListSessionOptions, index_PgLiteSessionService as PgLiteSessionService, index_PostgresSessionService as PostgresSessionService, type index_Session as Session, type index_SessionService as SessionService, index_SessionState as SessionState, index_SqliteSessionService as SqliteSessionService, index_cloneSession as cloneSession, index_generateSessionId as generateSessionId, index_validateSession as validateSession };
|
|
3496
|
+
export { index_InMemorySessionService as InMemorySessionService, type index_ListSessionOptions as ListSessionOptions, index_PgLiteSessionService as PgLiteSessionService, index_PostgresSessionService as PostgresSessionService, type index_Session as Session, type index_SessionService as SessionService, index_SessionState as SessionState, index_SqliteSessionService as SqliteSessionService, index_cloneSession as cloneSession, index_generateSessionId as generateSessionId, index_sessionsSchema as sessionsSchema, index_validateSession as validateSession };
|
|
3495
3497
|
}
|
|
3496
3498
|
|
|
3497
3499
|
/**
|
|
@@ -3557,4 +3559,4 @@ declare class InMemoryRunner extends Runner {
|
|
|
3557
3559
|
|
|
3558
3560
|
declare const VERSION = "0.1.0";
|
|
3559
3561
|
|
|
3560
|
-
export { Agent, type AgentConfig, index$3 as Agents, AnthropicLLM, type AnthropicLLMConfig, AnthropicLLMConnection, ApiKeyCredential, ApiKeyScheme, type AudioTranscriptionConfig, AuthConfig, AuthCredential, AuthCredentialType, AuthHandler, AuthScheme, AuthSchemeType, BaseAgent, BaseLLM, BaseLLMConnection, type BaseMemoryService, BaseTool, BasicAuthCredential, BearerTokenCredential, type BuildFunctionDeclarationOptions, ExitLoopTool, FileOperationsTool, type FunctionCall, type FunctionDeclaration, FunctionTool, GetUserChoiceTool, GoogleLLM, type GoogleLLMConfig, GoogleSearch, HttpRequestTool, HttpScheme, type IToolContext, type ImageContent, InMemoryMemoryService, InMemoryRunner, InMemorySessionService, InvocationContext, type JSONSchema, LLMRegistry, LLMRequest, type LLMRequestConfig, LLMResponse, LangGraphAgent, type LangGraphAgentConfig, type LangGraphNode, type ListSessionOptions, LoadMemoryTool, LoopAgent, type LoopAgentConfig, type McpConfig, McpError, McpErrorType, McpSamplingHandler, type McpSamplingRequest, type McpSamplingResponse, McpToolset, type McpTransportType, index$1 as Memory, type MemoryResult, type Message, type MessageContent, type MessageRole, index$4 as Models, OAuth2Credential, OAuth2Scheme, type OAuthFlow, type OAuthFlows, OpenAILLM, type OpenAILLMConfig, OpenAILLMConnection, OpenIdConnectScheme, ParallelAgent, type ParallelAgentConfig, PersistentMemoryService, PgLiteSessionService, PostgresSessionService, RunConfig, Runner, type SamplingHandler, type SearchMemoryOptions, type SearchMemoryResponse, SequentialAgent, type SequentialAgentConfig, type Session, type SessionService, SessionState, index as Sessions, type SpeechConfig, SqliteSessionService, StreamingMode, type TextContent, type ToolCall, type ToolConfig, ToolContext, index$2 as Tools, TransferToAgentTool, UserInteractionTool, VERSION, adkToMcpToolType, buildFunctionDeclaration, cloneSession, createFunctionTool, createSamplingHandler, generateSessionId, getMcpTools, jsonSchemaToDeclaration, mcpSchemaToParameters, normalizeJsonSchema, registerProviders, validateSession };
|
|
3562
|
+
export { Agent, type AgentConfig, index$3 as Agents, AnthropicLLM, type AnthropicLLMConfig, AnthropicLLMConnection, ApiKeyCredential, ApiKeyScheme, type AudioTranscriptionConfig, AuthConfig, AuthCredential, AuthCredentialType, AuthHandler, AuthScheme, AuthSchemeType, BaseAgent, BaseLLM, BaseLLMConnection, type BaseMemoryService, BaseTool, BasicAuthCredential, BearerTokenCredential, type BuildFunctionDeclarationOptions, ExitLoopTool, FileOperationsTool, type FunctionCall, type FunctionDeclaration, FunctionTool, GetUserChoiceTool, GoogleLLM, type GoogleLLMConfig, GoogleSearch, HttpRequestTool, HttpScheme, type IToolContext, type ImageContent, InMemoryMemoryService, InMemoryRunner, InMemorySessionService, InvocationContext, type JSONSchema, LLMRegistry, LLMRequest, type LLMRequestConfig, LLMResponse, LangGraphAgent, type LangGraphAgentConfig, type LangGraphNode, type ListSessionOptions, LoadMemoryTool, LoopAgent, type LoopAgentConfig, type McpConfig, McpError, McpErrorType, McpSamplingHandler, type McpSamplingRequest, type McpSamplingResponse, McpToolset, type McpTransportType, index$1 as Memory, type MemoryResult, type Message, type MessageContent, type MessageRole, index$4 as Models, OAuth2Credential, OAuth2Scheme, type OAuthFlow, type OAuthFlows, OpenAILLM, type OpenAILLMConfig, OpenAILLMConnection, OpenIdConnectScheme, ParallelAgent, type ParallelAgentConfig, PersistentMemoryService, PgLiteSessionService, PostgresSessionService, RunConfig, Runner, type SamplingHandler, type SearchMemoryOptions, type SearchMemoryResponse, SequentialAgent, type SequentialAgentConfig, type Session, type SessionService, SessionState, index as Sessions, type SpeechConfig, SqliteSessionService, StreamingMode, type TextContent, type ToolCall, type ToolConfig, ToolContext, index$2 as Tools, TransferToAgentTool, UserInteractionTool, VERSION, adkToMcpToolType, buildFunctionDeclaration, cloneSession, createFunctionTool, createSamplingHandler, generateSessionId, getMcpTools, jsonSchemaToDeclaration, mcpSchemaToParameters, normalizeJsonSchema, registerProviders, sessionsSchema, validateSession };
|
package/dist/index.js
CHANGED
|
@@ -4849,10 +4849,12 @@ var GoogleLLM = class extends BaseLLM {
|
|
|
4849
4849
|
}
|
|
4850
4850
|
/**
|
|
4851
4851
|
* Convert parameter types to Google Gemini format (uppercase types)
|
|
4852
|
+
* Also removes unsupported fields like exclusiveMinimum/exclusiveMaximum
|
|
4852
4853
|
*/
|
|
4853
4854
|
convertParametersToGoogleFormat(parameters) {
|
|
4854
4855
|
if (!parameters) return parameters;
|
|
4855
|
-
const
|
|
4856
|
+
const { exclusiveMinimum, exclusiveMaximum, ...rest } = parameters;
|
|
4857
|
+
const converted = { ...rest };
|
|
4856
4858
|
if (converted.type && typeof converted.type === "string") {
|
|
4857
4859
|
converted.type = converted.type.toUpperCase();
|
|
4858
4860
|
}
|
|
@@ -4860,10 +4862,7 @@ var GoogleLLM = class extends BaseLLM {
|
|
|
4860
4862
|
converted.properties = { ...converted.properties };
|
|
4861
4863
|
for (const [key, prop] of Object.entries(converted.properties)) {
|
|
4862
4864
|
if (prop && typeof prop === "object" && "type" in prop) {
|
|
4863
|
-
converted.properties[key] =
|
|
4864
|
-
...prop,
|
|
4865
|
-
type: typeof prop.type === "string" ? prop.type.toUpperCase() : prop.type
|
|
4866
|
-
};
|
|
4865
|
+
converted.properties[key] = this.convertParametersToGoogleFormat(prop);
|
|
4867
4866
|
}
|
|
4868
4867
|
}
|
|
4869
4868
|
}
|
|
@@ -6245,6 +6244,7 @@ __export(sessions_exports, {
|
|
|
6245
6244
|
SqliteSessionService: () => SqliteSessionService,
|
|
6246
6245
|
cloneSession: () => cloneSession,
|
|
6247
6246
|
generateSessionId: () => generateSessionId,
|
|
6247
|
+
sessionsSchema: () => sessionsSchema,
|
|
6248
6248
|
validateSession: () => validateSession
|
|
6249
6249
|
});
|
|
6250
6250
|
|
|
@@ -6509,15 +6509,17 @@ var PostgresSessionService = class {
|
|
|
6509
6509
|
session.events = [];
|
|
6510
6510
|
}
|
|
6511
6511
|
session.events.push(event);
|
|
6512
|
+
if (event.content) {
|
|
6513
|
+
session.messages = session.messages || [];
|
|
6514
|
+
session.messages.push({
|
|
6515
|
+
role: event.author,
|
|
6516
|
+
content: event.content
|
|
6517
|
+
});
|
|
6518
|
+
}
|
|
6512
6519
|
session.updatedAt = /* @__PURE__ */ new Date();
|
|
6513
6520
|
await this.updateSession(session);
|
|
6514
6521
|
return event;
|
|
6515
6522
|
}
|
|
6516
|
-
// TODO: Consider if table creation/migration logic is needed here or handled externally (e.g., drizzle-kit migrations)
|
|
6517
|
-
// TODO: Implement methods corresponding to Python's append_event, list_events,
|
|
6518
|
-
// get_app_state, update_app_state, get_user_state, update_user_state
|
|
6519
|
-
// if full parity with Python's DatabaseSessionService is desired.
|
|
6520
|
-
// This would require defining corresponding Drizzle schemas for Events, AppState, UserState.
|
|
6521
6523
|
};
|
|
6522
6524
|
|
|
6523
6525
|
// src/sessions/pglite-session-service.ts
|
|
@@ -7096,6 +7098,7 @@ var Runner = class {
|
|
|
7096
7098
|
});
|
|
7097
7099
|
}
|
|
7098
7100
|
let lastPartialEvent = null;
|
|
7101
|
+
let assistantContent = "";
|
|
7099
7102
|
try {
|
|
7100
7103
|
for await (const response of this.agent.runStreaming(invocationContext)) {
|
|
7101
7104
|
const event = new Event({
|
|
@@ -7107,14 +7110,23 @@ var Runner = class {
|
|
|
7107
7110
|
partial: response.is_partial,
|
|
7108
7111
|
raw_response: response.raw_response
|
|
7109
7112
|
});
|
|
7110
|
-
|
|
7111
|
-
await this.sessionService.appendEvent(session, event);
|
|
7112
|
-
}
|
|
7113
|
+
await this.sessionService.appendEvent(session, event);
|
|
7113
7114
|
if (event.is_partial) {
|
|
7114
7115
|
lastPartialEvent = event;
|
|
7115
7116
|
}
|
|
7117
|
+
if (response.role === "assistant" && response.content) {
|
|
7118
|
+
assistantContent += response.content;
|
|
7119
|
+
}
|
|
7116
7120
|
yield event;
|
|
7117
7121
|
}
|
|
7122
|
+
if (assistantContent.trim()) {
|
|
7123
|
+
session.messages = session.messages || [];
|
|
7124
|
+
session.messages.push({
|
|
7125
|
+
role: "assistant",
|
|
7126
|
+
content: assistantContent
|
|
7127
|
+
});
|
|
7128
|
+
await this.sessionService.updateSession(session);
|
|
7129
|
+
}
|
|
7118
7130
|
} catch (error) {
|
|
7119
7131
|
console.error("Error running agent:", error);
|
|
7120
7132
|
if (lastPartialEvent && session.events && session.events.length === 0) {
|
|
@@ -7144,6 +7156,13 @@ var Runner = class {
|
|
|
7144
7156
|
author: "user",
|
|
7145
7157
|
content: typeof newMessage.content === "string" ? newMessage.content : null
|
|
7146
7158
|
});
|
|
7159
|
+
if (event.author === "user" || event.author === "assistant") {
|
|
7160
|
+
session.messages = session.messages || [];
|
|
7161
|
+
session.messages.push({
|
|
7162
|
+
role: event.author,
|
|
7163
|
+
content: event.content
|
|
7164
|
+
});
|
|
7165
|
+
}
|
|
7147
7166
|
await this.sessionService.appendEvent(session, event);
|
|
7148
7167
|
}
|
|
7149
7168
|
/**
|
|
@@ -7156,7 +7175,10 @@ var Runner = class {
|
|
|
7156
7175
|
}) {
|
|
7157
7176
|
return new InvocationContext({
|
|
7158
7177
|
sessionId: session.id,
|
|
7159
|
-
messages:
|
|
7178
|
+
messages: [
|
|
7179
|
+
...session.messages || [],
|
|
7180
|
+
...newMessage ? [newMessage] : []
|
|
7181
|
+
],
|
|
7160
7182
|
config: runConfig,
|
|
7161
7183
|
userId: session.userId,
|
|
7162
7184
|
appName: this.appName,
|
|
@@ -7259,4 +7281,5 @@ var VERSION = "0.1.0";
|
|
|
7259
7281
|
|
|
7260
7282
|
|
|
7261
7283
|
|
|
7262
|
-
|
|
7284
|
+
|
|
7285
|
+
exports.Agent = Agent; exports.Agents = agents_exports; exports.AnthropicLLM = AnthropicLLM; exports.AnthropicLLMConnection = AnthropicLLMConnection; 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.BaseAgent = BaseAgent; exports.BaseLLM = BaseLLM; exports.BaseLLMConnection = BaseLLMConnection; exports.BaseTool = BaseTool; exports.BasicAuthCredential = BasicAuthCredential; exports.BearerTokenCredential = BearerTokenCredential; exports.ExitLoopTool = ExitLoopTool; exports.FileOperationsTool = FileOperationsTool; exports.FunctionTool = FunctionTool; exports.GetUserChoiceTool = GetUserChoiceTool; exports.GoogleLLM = GoogleLLM; exports.GoogleSearch = GoogleSearch; exports.HttpRequestTool = HttpRequestTool; exports.HttpScheme = HttpScheme; exports.InMemoryMemoryService = InMemoryMemoryService; exports.InMemoryRunner = InMemoryRunner; exports.InMemorySessionService = InMemorySessionService; exports.InvocationContext = InvocationContext; exports.LLMRegistry = LLMRegistry; exports.LLMRequest = LLMRequest; exports.LLMResponse = LLMResponse; exports.LangGraphAgent = LangGraphAgent; exports.LoadMemoryTool = LoadMemoryTool; exports.LoopAgent = LoopAgent; exports.McpError = McpError; exports.McpErrorType = McpErrorType; exports.McpSamplingHandler = McpSamplingHandler; exports.McpToolset = McpToolset; exports.Memory = memory_exports; exports.Models = models_exports; exports.OAuth2Credential = OAuth2Credential; exports.OAuth2Scheme = OAuth2Scheme; exports.OpenAILLM = OpenAILLM; exports.OpenAILLMConnection = OpenAILLMConnection; exports.OpenIdConnectScheme = OpenIdConnectScheme; exports.ParallelAgent = ParallelAgent; exports.PersistentMemoryService = PersistentMemoryService; exports.PgLiteSessionService = PgLiteSessionService; exports.PostgresSessionService = PostgresSessionService; exports.RunConfig = RunConfig; exports.Runner = Runner; exports.SequentialAgent = SequentialAgent; exports.SessionState = SessionState; exports.Sessions = sessions_exports; exports.SqliteSessionService = SqliteSessionService; exports.StreamingMode = StreamingMode; exports.ToolContext = ToolContext; exports.Tools = tools_exports; exports.TransferToAgentTool = TransferToAgentTool; exports.UserInteractionTool = UserInteractionTool; exports.VERSION = VERSION; exports.adkToMcpToolType = adkToMcpToolType; exports.buildFunctionDeclaration = buildFunctionDeclaration; exports.cloneSession = cloneSession; exports.createFunctionTool = createFunctionTool; exports.createSamplingHandler = createSamplingHandler; exports.generateSessionId = generateSessionId; exports.getMcpTools = getMcpTools; exports.jsonSchemaToDeclaration = jsonSchemaToDeclaration; exports.mcpSchemaToParameters = mcpSchemaToParameters; exports.normalizeJsonSchema = normalizeJsonSchema; exports.registerProviders = registerProviders; exports.sessionsSchema = sessionsSchema; exports.validateSession = validateSession;
|
package/dist/index.mjs
CHANGED
|
@@ -4849,10 +4849,12 @@ var GoogleLLM = class extends BaseLLM {
|
|
|
4849
4849
|
}
|
|
4850
4850
|
/**
|
|
4851
4851
|
* Convert parameter types to Google Gemini format (uppercase types)
|
|
4852
|
+
* Also removes unsupported fields like exclusiveMinimum/exclusiveMaximum
|
|
4852
4853
|
*/
|
|
4853
4854
|
convertParametersToGoogleFormat(parameters) {
|
|
4854
4855
|
if (!parameters) return parameters;
|
|
4855
|
-
const
|
|
4856
|
+
const { exclusiveMinimum, exclusiveMaximum, ...rest } = parameters;
|
|
4857
|
+
const converted = { ...rest };
|
|
4856
4858
|
if (converted.type && typeof converted.type === "string") {
|
|
4857
4859
|
converted.type = converted.type.toUpperCase();
|
|
4858
4860
|
}
|
|
@@ -4860,10 +4862,7 @@ var GoogleLLM = class extends BaseLLM {
|
|
|
4860
4862
|
converted.properties = { ...converted.properties };
|
|
4861
4863
|
for (const [key, prop] of Object.entries(converted.properties)) {
|
|
4862
4864
|
if (prop && typeof prop === "object" && "type" in prop) {
|
|
4863
|
-
converted.properties[key] =
|
|
4864
|
-
...prop,
|
|
4865
|
-
type: typeof prop.type === "string" ? prop.type.toUpperCase() : prop.type
|
|
4866
|
-
};
|
|
4865
|
+
converted.properties[key] = this.convertParametersToGoogleFormat(prop);
|
|
4867
4866
|
}
|
|
4868
4867
|
}
|
|
4869
4868
|
}
|
|
@@ -6245,6 +6244,7 @@ __export(sessions_exports, {
|
|
|
6245
6244
|
SqliteSessionService: () => SqliteSessionService,
|
|
6246
6245
|
cloneSession: () => cloneSession,
|
|
6247
6246
|
generateSessionId: () => generateSessionId,
|
|
6247
|
+
sessionsSchema: () => sessionsSchema,
|
|
6248
6248
|
validateSession: () => validateSession
|
|
6249
6249
|
});
|
|
6250
6250
|
|
|
@@ -6509,15 +6509,17 @@ var PostgresSessionService = class {
|
|
|
6509
6509
|
session.events = [];
|
|
6510
6510
|
}
|
|
6511
6511
|
session.events.push(event);
|
|
6512
|
+
if (event.content) {
|
|
6513
|
+
session.messages = session.messages || [];
|
|
6514
|
+
session.messages.push({
|
|
6515
|
+
role: event.author,
|
|
6516
|
+
content: event.content
|
|
6517
|
+
});
|
|
6518
|
+
}
|
|
6512
6519
|
session.updatedAt = /* @__PURE__ */ new Date();
|
|
6513
6520
|
await this.updateSession(session);
|
|
6514
6521
|
return event;
|
|
6515
6522
|
}
|
|
6516
|
-
// TODO: Consider if table creation/migration logic is needed here or handled externally (e.g., drizzle-kit migrations)
|
|
6517
|
-
// TODO: Implement methods corresponding to Python's append_event, list_events,
|
|
6518
|
-
// get_app_state, update_app_state, get_user_state, update_user_state
|
|
6519
|
-
// if full parity with Python's DatabaseSessionService is desired.
|
|
6520
|
-
// This would require defining corresponding Drizzle schemas for Events, AppState, UserState.
|
|
6521
6523
|
};
|
|
6522
6524
|
|
|
6523
6525
|
// src/sessions/pglite-session-service.ts
|
|
@@ -7096,6 +7098,7 @@ var Runner = class {
|
|
|
7096
7098
|
});
|
|
7097
7099
|
}
|
|
7098
7100
|
let lastPartialEvent = null;
|
|
7101
|
+
let assistantContent = "";
|
|
7099
7102
|
try {
|
|
7100
7103
|
for await (const response of this.agent.runStreaming(invocationContext)) {
|
|
7101
7104
|
const event = new Event({
|
|
@@ -7107,14 +7110,23 @@ var Runner = class {
|
|
|
7107
7110
|
partial: response.is_partial,
|
|
7108
7111
|
raw_response: response.raw_response
|
|
7109
7112
|
});
|
|
7110
|
-
|
|
7111
|
-
await this.sessionService.appendEvent(session, event);
|
|
7112
|
-
}
|
|
7113
|
+
await this.sessionService.appendEvent(session, event);
|
|
7113
7114
|
if (event.is_partial) {
|
|
7114
7115
|
lastPartialEvent = event;
|
|
7115
7116
|
}
|
|
7117
|
+
if (response.role === "assistant" && response.content) {
|
|
7118
|
+
assistantContent += response.content;
|
|
7119
|
+
}
|
|
7116
7120
|
yield event;
|
|
7117
7121
|
}
|
|
7122
|
+
if (assistantContent.trim()) {
|
|
7123
|
+
session.messages = session.messages || [];
|
|
7124
|
+
session.messages.push({
|
|
7125
|
+
role: "assistant",
|
|
7126
|
+
content: assistantContent
|
|
7127
|
+
});
|
|
7128
|
+
await this.sessionService.updateSession(session);
|
|
7129
|
+
}
|
|
7118
7130
|
} catch (error) {
|
|
7119
7131
|
console.error("Error running agent:", error);
|
|
7120
7132
|
if (lastPartialEvent && session.events && session.events.length === 0) {
|
|
@@ -7144,6 +7156,13 @@ var Runner = class {
|
|
|
7144
7156
|
author: "user",
|
|
7145
7157
|
content: typeof newMessage.content === "string" ? newMessage.content : null
|
|
7146
7158
|
});
|
|
7159
|
+
if (event.author === "user" || event.author === "assistant") {
|
|
7160
|
+
session.messages = session.messages || [];
|
|
7161
|
+
session.messages.push({
|
|
7162
|
+
role: event.author,
|
|
7163
|
+
content: event.content
|
|
7164
|
+
});
|
|
7165
|
+
}
|
|
7147
7166
|
await this.sessionService.appendEvent(session, event);
|
|
7148
7167
|
}
|
|
7149
7168
|
/**
|
|
@@ -7156,7 +7175,10 @@ var Runner = class {
|
|
|
7156
7175
|
}) {
|
|
7157
7176
|
return new InvocationContext({
|
|
7158
7177
|
sessionId: session.id,
|
|
7159
|
-
messages:
|
|
7178
|
+
messages: [
|
|
7179
|
+
...session.messages || [],
|
|
7180
|
+
...newMessage ? [newMessage] : []
|
|
7181
|
+
],
|
|
7160
7182
|
config: runConfig,
|
|
7161
7183
|
userId: session.userId,
|
|
7162
7184
|
appName: this.appName,
|
|
@@ -7258,5 +7280,6 @@ export {
|
|
|
7258
7280
|
mcpSchemaToParameters,
|
|
7259
7281
|
normalizeJsonSchema,
|
|
7260
7282
|
registerProviders,
|
|
7283
|
+
sessionsSchema,
|
|
7261
7284
|
validateSession
|
|
7262
7285
|
};
|