@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
|
@@ -35,6 +35,7 @@ __export(schema_exports, {
|
|
|
35
35
|
ENTITIES: () => ENTITIES,
|
|
36
36
|
SCHEMA_VERSION_1_JSON: () => SCHEMA_VERSION_1_JSON,
|
|
37
37
|
SCHEMA_VERSION_KEY: () => SCHEMA_VERSION_KEY,
|
|
38
|
+
STORAGE_KEY_COLUMN_LENGTH: () => STORAGE_KEY_COLUMN_LENGTH,
|
|
38
39
|
StorageAppState: () => StorageAppState,
|
|
39
40
|
StorageEvent: () => StorageEvent,
|
|
40
41
|
StorageMetadata: () => StorageMetadata,
|
|
@@ -51,6 +52,7 @@ var import_event = require("../../events/event.js");
|
|
|
51
52
|
*/
|
|
52
53
|
const SCHEMA_VERSION_KEY = "schema_version";
|
|
53
54
|
const SCHEMA_VERSION_1_JSON = "1";
|
|
55
|
+
const STORAGE_KEY_COLUMN_LENGTH = 191;
|
|
54
56
|
class CamelCaseToSnakeCaseJsonType extends import_core.JsonType {
|
|
55
57
|
convertToDatabaseValue(value) {
|
|
56
58
|
return JSON.stringify((0, import_event.transformToSnakeCaseEvent)(value));
|
|
@@ -79,7 +81,11 @@ let StorageAppState = class {
|
|
|
79
81
|
}
|
|
80
82
|
};
|
|
81
83
|
__decorateClass([
|
|
82
|
-
(0, import_core.PrimaryKey)({
|
|
84
|
+
(0, import_core.PrimaryKey)({
|
|
85
|
+
type: "string",
|
|
86
|
+
fieldName: "app_name",
|
|
87
|
+
length: STORAGE_KEY_COLUMN_LENGTH
|
|
88
|
+
})
|
|
83
89
|
], StorageAppState.prototype, "appName", 2);
|
|
84
90
|
__decorateClass([
|
|
85
91
|
(0, import_core.Property)({ type: "json" })
|
|
@@ -102,10 +108,18 @@ let StorageUserState = class {
|
|
|
102
108
|
}
|
|
103
109
|
};
|
|
104
110
|
__decorateClass([
|
|
105
|
-
(0, import_core.PrimaryKey)({
|
|
111
|
+
(0, import_core.PrimaryKey)({
|
|
112
|
+
type: "string",
|
|
113
|
+
fieldName: "app_name",
|
|
114
|
+
length: STORAGE_KEY_COLUMN_LENGTH
|
|
115
|
+
})
|
|
106
116
|
], StorageUserState.prototype, "appName", 2);
|
|
107
117
|
__decorateClass([
|
|
108
|
-
(0, import_core.PrimaryKey)({
|
|
118
|
+
(0, import_core.PrimaryKey)({
|
|
119
|
+
type: "string",
|
|
120
|
+
fieldName: "user_id",
|
|
121
|
+
length: STORAGE_KEY_COLUMN_LENGTH
|
|
122
|
+
})
|
|
109
123
|
], StorageUserState.prototype, "userId", 2);
|
|
110
124
|
__decorateClass([
|
|
111
125
|
(0, import_core.Property)({ type: "json" })
|
|
@@ -129,13 +143,21 @@ let StorageSession = class {
|
|
|
129
143
|
}
|
|
130
144
|
};
|
|
131
145
|
__decorateClass([
|
|
132
|
-
(0, import_core.PrimaryKey)({ type: "string" })
|
|
146
|
+
(0, import_core.PrimaryKey)({ type: "string", length: STORAGE_KEY_COLUMN_LENGTH })
|
|
133
147
|
], StorageSession.prototype, "id", 2);
|
|
134
148
|
__decorateClass([
|
|
135
|
-
(0, import_core.PrimaryKey)({
|
|
149
|
+
(0, import_core.PrimaryKey)({
|
|
150
|
+
type: "string",
|
|
151
|
+
fieldName: "app_name",
|
|
152
|
+
length: STORAGE_KEY_COLUMN_LENGTH
|
|
153
|
+
})
|
|
136
154
|
], StorageSession.prototype, "appName", 2);
|
|
137
155
|
__decorateClass([
|
|
138
|
-
(0, import_core.PrimaryKey)({
|
|
156
|
+
(0, import_core.PrimaryKey)({
|
|
157
|
+
type: "string",
|
|
158
|
+
fieldName: "user_id",
|
|
159
|
+
length: STORAGE_KEY_COLUMN_LENGTH
|
|
160
|
+
})
|
|
139
161
|
], StorageSession.prototype, "userId", 2);
|
|
140
162
|
__decorateClass([
|
|
141
163
|
(0, import_core.Property)({ type: "json" })
|
|
@@ -161,16 +183,28 @@ import_core.PrimaryKey.name;
|
|
|
161
183
|
let StorageEvent = class {
|
|
162
184
|
};
|
|
163
185
|
__decorateClass([
|
|
164
|
-
(0, import_core.PrimaryKey)({ type: "string" })
|
|
186
|
+
(0, import_core.PrimaryKey)({ type: "string", length: STORAGE_KEY_COLUMN_LENGTH })
|
|
165
187
|
], StorageEvent.prototype, "id", 2);
|
|
166
188
|
__decorateClass([
|
|
167
|
-
(0, import_core.PrimaryKey)({
|
|
189
|
+
(0, import_core.PrimaryKey)({
|
|
190
|
+
type: "string",
|
|
191
|
+
fieldName: "app_name",
|
|
192
|
+
length: STORAGE_KEY_COLUMN_LENGTH
|
|
193
|
+
})
|
|
168
194
|
], StorageEvent.prototype, "appName", 2);
|
|
169
195
|
__decorateClass([
|
|
170
|
-
(0, import_core.PrimaryKey)({
|
|
196
|
+
(0, import_core.PrimaryKey)({
|
|
197
|
+
type: "string",
|
|
198
|
+
fieldName: "user_id",
|
|
199
|
+
length: STORAGE_KEY_COLUMN_LENGTH
|
|
200
|
+
})
|
|
171
201
|
], StorageEvent.prototype, "userId", 2);
|
|
172
202
|
__decorateClass([
|
|
173
|
-
(0, import_core.PrimaryKey)({
|
|
203
|
+
(0, import_core.PrimaryKey)({
|
|
204
|
+
type: "string",
|
|
205
|
+
fieldName: "session_id",
|
|
206
|
+
length: STORAGE_KEY_COLUMN_LENGTH
|
|
207
|
+
})
|
|
174
208
|
], StorageEvent.prototype, "sessionId", 2);
|
|
175
209
|
__decorateClass([
|
|
176
210
|
(0, import_core.Property)({ type: "string", fieldName: "invocation_id" })
|
|
@@ -196,6 +230,7 @@ const ENTITIES = [
|
|
|
196
230
|
ENTITIES,
|
|
197
231
|
SCHEMA_VERSION_1_JSON,
|
|
198
232
|
SCHEMA_VERSION_KEY,
|
|
233
|
+
STORAGE_KEY_COLUMN_LENGTH,
|
|
199
234
|
StorageAppState,
|
|
200
235
|
StorageEvent,
|
|
201
236
|
StorageMetadata,
|
|
@@ -66,11 +66,12 @@ class InMemorySessionService extends import_base_session_service.BaseSessionServ
|
|
|
66
66
|
sessionId
|
|
67
67
|
}) {
|
|
68
68
|
var _a;
|
|
69
|
+
const filteredState = state ? (0, import_base_session_service.trimTempState)(state) : void 0;
|
|
69
70
|
const session = (0, import_session.createSession)({
|
|
70
71
|
id: sessionId || (0, import_env_aware_utils.randomUUID)(),
|
|
71
72
|
appName,
|
|
72
73
|
userId,
|
|
73
|
-
state,
|
|
74
|
+
state: filteredState,
|
|
74
75
|
events: [],
|
|
75
76
|
lastUpdateTime: Date.now()
|
|
76
77
|
});
|
|
@@ -107,11 +107,12 @@ let VertexAiSessionService = class extends import_base_session_service.BaseSessi
|
|
|
107
107
|
}) {
|
|
108
108
|
var _a;
|
|
109
109
|
const reasoningEngineId = this.getReasoningEngineId(appName);
|
|
110
|
+
const filteredState = state ? (0, import_base_session_service.trimTempState)(state) : void 0;
|
|
110
111
|
let apiResponse = await this.sessions.createInternal({
|
|
111
112
|
name: `reasoningEngines/${reasoningEngineId}`,
|
|
112
113
|
userId,
|
|
113
114
|
config: {
|
|
114
|
-
...
|
|
115
|
+
...filteredState ? { sessionState: filteredState } : {},
|
|
115
116
|
...sessionId ? { sessionId } : {}
|
|
116
117
|
}
|
|
117
118
|
});
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
"use strict";
|
|
8
|
+
var __defProp = Object.defineProperty;
|
|
9
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
10
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
11
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
12
|
+
var __export = (target, all) => {
|
|
13
|
+
for (var name in all)
|
|
14
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
15
|
+
};
|
|
16
|
+
var __copyProps = (to, from, except, desc) => {
|
|
17
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
18
|
+
for (let key of __getOwnPropNames(from))
|
|
19
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
20
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
21
|
+
}
|
|
22
|
+
return to;
|
|
23
|
+
};
|
|
24
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
26
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
27
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
28
|
+
if (decorator = decorators[i])
|
|
29
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
30
|
+
if (kind && result) __defProp(target, key, result);
|
|
31
|
+
return result;
|
|
32
|
+
};
|
|
33
|
+
var gcp_skill_registry_exports = {};
|
|
34
|
+
__export(gcp_skill_registry_exports, {
|
|
35
|
+
GCPSkillRegistry: () => GCPSkillRegistry
|
|
36
|
+
});
|
|
37
|
+
module.exports = __toCommonJS(gcp_skill_registry_exports);
|
|
38
|
+
var import_vertexai = require("@google-cloud/vertexai");
|
|
39
|
+
var import_experimental = require("../utils/experimental.js");
|
|
40
|
+
var import_loader = require("./loader.js");
|
|
41
|
+
/**
|
|
42
|
+
* @license
|
|
43
|
+
* Copyright 2026 Google LLC
|
|
44
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
45
|
+
*/
|
|
46
|
+
let GCPSkillRegistry = class {
|
|
47
|
+
constructor(options = {}) {
|
|
48
|
+
this.projectId = options.projectId || process.env.GOOGLE_CLOUD_PROJECT;
|
|
49
|
+
this.location = options.location || process.env.GOOGLE_CLOUD_LOCATION;
|
|
50
|
+
this.client = options.client || new import_vertexai.Client({
|
|
51
|
+
project: this.projectId,
|
|
52
|
+
location: this.location
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
async getSkill(name) {
|
|
56
|
+
const apiClient = this.client.apiClient;
|
|
57
|
+
const httpResponse = await apiClient.request({
|
|
58
|
+
path: `skills/${name}`,
|
|
59
|
+
httpMethod: "GET",
|
|
60
|
+
httpOptions: { apiVersion: "v1beta1" }
|
|
61
|
+
});
|
|
62
|
+
const response = await httpResponse.json();
|
|
63
|
+
const zippedFilesystem = response.zippedFilesystem || response.zipped_filesystem;
|
|
64
|
+
if (!zippedFilesystem) {
|
|
65
|
+
throw new Error(`Skill '${name}' does not contain zipped filesystem.`);
|
|
66
|
+
}
|
|
67
|
+
const zipBuffer = Buffer.from(zippedFilesystem, "base64");
|
|
68
|
+
return (0, import_loader.loadSkillFromZipBuffer)(zipBuffer);
|
|
69
|
+
}
|
|
70
|
+
async searchSkills(query) {
|
|
71
|
+
const apiClient = this.client.apiClient;
|
|
72
|
+
const trimmedQuery = query.trim();
|
|
73
|
+
const isSearch = trimmedQuery.length > 0;
|
|
74
|
+
const path = isSearch ? `skills:retrieve?query=${encodeURIComponent(trimmedQuery)}` : "skills";
|
|
75
|
+
const httpResponse = await apiClient.request({
|
|
76
|
+
path,
|
|
77
|
+
httpMethod: "GET",
|
|
78
|
+
httpOptions: { apiVersion: "v1beta1" }
|
|
79
|
+
});
|
|
80
|
+
const response = await httpResponse.json();
|
|
81
|
+
const skillsList = isSearch ? response.retrievedSkills || response.retrieved_skills : response.skills;
|
|
82
|
+
const results = [];
|
|
83
|
+
if (skillsList && Array.isArray(skillsList)) {
|
|
84
|
+
for (const s of skillsList) {
|
|
85
|
+
const skillNameStr = s.skillName || s.skill_name || s.name || "";
|
|
86
|
+
const descriptionStr = s.description || "";
|
|
87
|
+
const parts = skillNameStr.split("/");
|
|
88
|
+
const name = skillNameStr ? parts[parts.length - 1] : "";
|
|
89
|
+
results.push({
|
|
90
|
+
name,
|
|
91
|
+
description: descriptionStr
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return results;
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
GCPSkillRegistry = __decorateClass([
|
|
99
|
+
import_experimental.experimental
|
|
100
|
+
], GCPSkillRegistry);
|
|
101
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
102
|
+
0 && (module.exports = {
|
|
103
|
+
GCPSkillRegistry
|
|
104
|
+
});
|
|
@@ -36,10 +36,12 @@ var loader_exports = {};
|
|
|
36
36
|
__export(loader_exports, {
|
|
37
37
|
loadAllSkillsInDir: () => loadAllSkillsInDir,
|
|
38
38
|
loadSkillFromDir: () => loadSkillFromDir,
|
|
39
|
+
loadSkillFromZipBuffer: () => loadSkillFromZipBuffer,
|
|
39
40
|
parseSkillMdContent: () => parseSkillMdContent,
|
|
40
41
|
validateSkillDir: () => validateSkillDir
|
|
41
42
|
});
|
|
42
43
|
module.exports = __toCommonJS(loader_exports);
|
|
44
|
+
var import_adm_zip = __toESM(require("adm-zip"), 1);
|
|
43
45
|
var import_js_yaml = __toESM(require("js-yaml"), 1);
|
|
44
46
|
var fs = __toESM(require("node:fs/promises"), 1);
|
|
45
47
|
var path = __toESM(require("node:path"), 1);
|
|
@@ -274,10 +276,73 @@ async function loadAllSkillsInDir(skillsBasePath) {
|
|
|
274
276
|
}
|
|
275
277
|
return skills;
|
|
276
278
|
}
|
|
279
|
+
function loadSkillFromZipBuffer(zipBuffer) {
|
|
280
|
+
const zip = new import_adm_zip.default(zipBuffer);
|
|
281
|
+
const entries = zip.getEntries();
|
|
282
|
+
let skillMdContent = "";
|
|
283
|
+
for (const entry of entries) {
|
|
284
|
+
if (entry.isDirectory) continue;
|
|
285
|
+
if (entry.entryName.toLowerCase() === "skill.md") {
|
|
286
|
+
skillMdContent = entry.getData().toString("utf-8");
|
|
287
|
+
break;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
if (!skillMdContent) {
|
|
291
|
+
throw new Error("SKILL.md not found in zipped filesystem.");
|
|
292
|
+
}
|
|
293
|
+
const { frontmatter: parsed, body } = parseSkillMdContent(skillMdContent);
|
|
294
|
+
const frontmatter = import_skill.FrontmatterSchema.parse(parsed);
|
|
295
|
+
const references = {};
|
|
296
|
+
const assets = {};
|
|
297
|
+
const scripts = {};
|
|
298
|
+
function loadZipDir(prefix) {
|
|
299
|
+
const res = {};
|
|
300
|
+
const normPrefix = prefix.endsWith("/") ? prefix : `${prefix}/`;
|
|
301
|
+
for (const entry of entries) {
|
|
302
|
+
if (entry.isDirectory) continue;
|
|
303
|
+
if (entry.entryName.startsWith(normPrefix)) {
|
|
304
|
+
if (entry.entryName.includes("__pycache__")) continue;
|
|
305
|
+
const relativePath = entry.entryName.substring(normPrefix.length);
|
|
306
|
+
if (!relativePath) continue;
|
|
307
|
+
const data = entry.getData();
|
|
308
|
+
try {
|
|
309
|
+
res[relativePath] = data.toString("utf-8");
|
|
310
|
+
} catch (_e) {
|
|
311
|
+
res[relativePath] = data;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
return res;
|
|
316
|
+
}
|
|
317
|
+
const refFiles = loadZipDir("references");
|
|
318
|
+
for (const [key, val] of Object.entries(refFiles)) {
|
|
319
|
+
references[key] = val;
|
|
320
|
+
}
|
|
321
|
+
const assetFiles = loadZipDir("assets");
|
|
322
|
+
for (const [key, val] of Object.entries(assetFiles)) {
|
|
323
|
+
assets[key] = val;
|
|
324
|
+
}
|
|
325
|
+
const rawScripts = loadZipDir("scripts");
|
|
326
|
+
for (const [key, val] of Object.entries(rawScripts)) {
|
|
327
|
+
if (typeof val === "string") {
|
|
328
|
+
scripts[key] = { src: val };
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
return {
|
|
332
|
+
frontmatter,
|
|
333
|
+
instructions: body,
|
|
334
|
+
resources: {
|
|
335
|
+
references,
|
|
336
|
+
assets,
|
|
337
|
+
scripts
|
|
338
|
+
}
|
|
339
|
+
};
|
|
340
|
+
}
|
|
277
341
|
// Annotate the CommonJS export names for ESM import in node:
|
|
278
342
|
0 && (module.exports = {
|
|
279
343
|
loadAllSkillsInDir,
|
|
280
344
|
loadSkillFromDir,
|
|
345
|
+
loadSkillFromZipBuffer,
|
|
281
346
|
parseSkillMdContent,
|
|
282
347
|
validateSkillDir
|
|
283
348
|
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
"use strict";
|
|
8
|
+
var __defProp = Object.defineProperty;
|
|
9
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
10
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
11
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
+
var skill_registry_exports = {};
|
|
22
|
+
module.exports = __toCommonJS(skill_registry_exports);
|
|
23
|
+
/**
|
|
24
|
+
* @license
|
|
25
|
+
* Copyright 2026 Google LLC
|
|
26
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
27
|
+
*/
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
"use strict";
|
|
8
|
+
var __defProp = Object.defineProperty;
|
|
9
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
10
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
11
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
12
|
+
var __export = (target, all) => {
|
|
13
|
+
for (var name in all)
|
|
14
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
15
|
+
};
|
|
16
|
+
var __copyProps = (to, from, except, desc) => {
|
|
17
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
18
|
+
for (let key of __getOwnPropNames(from))
|
|
19
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
20
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
21
|
+
}
|
|
22
|
+
return to;
|
|
23
|
+
};
|
|
24
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
26
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
27
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
28
|
+
if (decorator = decorators[i])
|
|
29
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
30
|
+
if (kind && result) __defProp(target, key, result);
|
|
31
|
+
return result;
|
|
32
|
+
};
|
|
33
|
+
var openapi_spec_parser_exports = {};
|
|
34
|
+
__export(openapi_spec_parser_exports, {
|
|
35
|
+
OpenApiSpecParser: () => OpenApiSpecParser
|
|
36
|
+
});
|
|
37
|
+
module.exports = __toCommonJS(openapi_spec_parser_exports);
|
|
38
|
+
var import_experimental = require("../../../utils/experimental.js");
|
|
39
|
+
var import_operation_parser = require("./operation_parser.js");
|
|
40
|
+
/**
|
|
41
|
+
* @license
|
|
42
|
+
* Copyright 2026 Google LLC
|
|
43
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
44
|
+
*/
|
|
45
|
+
const VALID_SCHEMA_TYPES = /* @__PURE__ */ new Set([
|
|
46
|
+
"array",
|
|
47
|
+
"boolean",
|
|
48
|
+
"integer",
|
|
49
|
+
"null",
|
|
50
|
+
"number",
|
|
51
|
+
"object",
|
|
52
|
+
"string"
|
|
53
|
+
]);
|
|
54
|
+
let OpenApiSpecParser = class {
|
|
55
|
+
constructor(options = {}) {
|
|
56
|
+
var _a;
|
|
57
|
+
this.preservePropertyNames = (_a = options.preservePropertyNames) != null ? _a : false;
|
|
58
|
+
}
|
|
59
|
+
parse(openapiSpec) {
|
|
60
|
+
const resolvedSpec = resolveReferences(openapiSpec);
|
|
61
|
+
const sanitizedSpec = sanitizeSchemaTypes(resolvedSpec);
|
|
62
|
+
return collectOperations(sanitizedSpec, {
|
|
63
|
+
preservePropertyNames: this.preservePropertyNames
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
__decorateClass([
|
|
68
|
+
import_experimental.experimental
|
|
69
|
+
], OpenApiSpecParser.prototype, "parse", 1);
|
|
70
|
+
OpenApiSpecParser = __decorateClass([
|
|
71
|
+
import_experimental.experimental
|
|
72
|
+
], OpenApiSpecParser);
|
|
73
|
+
function resolveReferences(spec) {
|
|
74
|
+
const resolvedCache = /* @__PURE__ */ new Map();
|
|
75
|
+
const specCopy = JSON.parse(JSON.stringify(spec));
|
|
76
|
+
const recursiveResolve = (obj, currentDoc, seenRefs = /* @__PURE__ */ new Set()) => {
|
|
77
|
+
if (typeof obj !== "object" || obj === null) {
|
|
78
|
+
return obj;
|
|
79
|
+
}
|
|
80
|
+
if (Array.isArray(obj)) {
|
|
81
|
+
return obj.map((item) => recursiveResolve(item, currentDoc, seenRefs));
|
|
82
|
+
}
|
|
83
|
+
const objRecord = obj;
|
|
84
|
+
if ("$ref" in objRecord && typeof objRecord["$ref"] === "string") {
|
|
85
|
+
const refString = objRecord["$ref"];
|
|
86
|
+
if (seenRefs.has(refString) && !resolvedCache.has(refString)) {
|
|
87
|
+
const copy = { ...objRecord };
|
|
88
|
+
delete copy["$ref"];
|
|
89
|
+
return copy;
|
|
90
|
+
}
|
|
91
|
+
seenRefs.add(refString);
|
|
92
|
+
if (resolvedCache.has(refString)) {
|
|
93
|
+
return resolvedCache.get(refString);
|
|
94
|
+
}
|
|
95
|
+
let resolvedValue = resolveRef(refString, currentDoc);
|
|
96
|
+
if (resolvedValue !== void 0) {
|
|
97
|
+
resolvedValue = recursiveResolve(resolvedValue, currentDoc, seenRefs);
|
|
98
|
+
resolvedCache.set(refString, resolvedValue);
|
|
99
|
+
return resolvedValue;
|
|
100
|
+
} else {
|
|
101
|
+
return obj;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
const newDict = {};
|
|
105
|
+
for (const [key, value] of Object.entries(objRecord)) {
|
|
106
|
+
newDict[key] = recursiveResolve(value, currentDoc, seenRefs);
|
|
107
|
+
}
|
|
108
|
+
return newDict;
|
|
109
|
+
};
|
|
110
|
+
return recursiveResolve(specCopy, specCopy);
|
|
111
|
+
}
|
|
112
|
+
function resolveRef(refString, currentDoc) {
|
|
113
|
+
const parts = refString.split("/");
|
|
114
|
+
if (parts[0] !== "#") {
|
|
115
|
+
throw new Error(`External references not supported: ${refString}`);
|
|
116
|
+
}
|
|
117
|
+
let current = currentDoc;
|
|
118
|
+
for (const part of parts.slice(1)) {
|
|
119
|
+
if (typeof current === "object" && current !== null && part in current) {
|
|
120
|
+
current = current[part];
|
|
121
|
+
} else {
|
|
122
|
+
return void 0;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
return current;
|
|
126
|
+
}
|
|
127
|
+
function sanitizeSchemaTypes(openapiSpec) {
|
|
128
|
+
const specCopy = JSON.parse(JSON.stringify(openapiSpec));
|
|
129
|
+
const sanitizeTypeField = (schemaDict) => {
|
|
130
|
+
if (!("type" in schemaDict)) return;
|
|
131
|
+
const typeValue = schemaDict["type"];
|
|
132
|
+
if (typeof typeValue === "string") {
|
|
133
|
+
const normalizedType = typeValue.toLowerCase();
|
|
134
|
+
if (VALID_SCHEMA_TYPES.has(normalizedType)) {
|
|
135
|
+
schemaDict["type"] = normalizedType;
|
|
136
|
+
} else {
|
|
137
|
+
delete schemaDict["type"];
|
|
138
|
+
}
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
if (Array.isArray(typeValue)) {
|
|
142
|
+
const validTypes = [];
|
|
143
|
+
for (const entry of typeValue) {
|
|
144
|
+
if (typeof entry !== "string") continue;
|
|
145
|
+
const normalizedEntry = entry.toLowerCase();
|
|
146
|
+
if (VALID_SCHEMA_TYPES.has(normalizedEntry) && !validTypes.includes(normalizedEntry)) {
|
|
147
|
+
validTypes.push(normalizedEntry);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
if (validTypes.length > 0) {
|
|
151
|
+
schemaDict["type"] = validTypes;
|
|
152
|
+
} else {
|
|
153
|
+
delete schemaDict["type"];
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
const sanitizeRecursive = (obj, inSchema) => {
|
|
158
|
+
if (typeof obj !== "object" || obj === null) {
|
|
159
|
+
return obj;
|
|
160
|
+
}
|
|
161
|
+
if (Array.isArray(obj)) {
|
|
162
|
+
return obj.map((item) => sanitizeRecursive(item, inSchema));
|
|
163
|
+
}
|
|
164
|
+
const objRecord = obj;
|
|
165
|
+
if (inSchema) {
|
|
166
|
+
sanitizeTypeField(objRecord);
|
|
167
|
+
}
|
|
168
|
+
for (const [key, value] of Object.entries(objRecord)) {
|
|
169
|
+
const isSchemaContainer = key === "schema" || key === "schemas";
|
|
170
|
+
objRecord[key] = sanitizeRecursive(value, inSchema || isSchemaContainer);
|
|
171
|
+
}
|
|
172
|
+
return objRecord;
|
|
173
|
+
};
|
|
174
|
+
return sanitizeRecursive(specCopy, false);
|
|
175
|
+
}
|
|
176
|
+
function collectOperations(spec, options = {}) {
|
|
177
|
+
var _a, _b, _c, _d;
|
|
178
|
+
const preservePropertyNames = (_a = options.preservePropertyNames) != null ? _a : false;
|
|
179
|
+
const operations = [];
|
|
180
|
+
const baseUrl = ((_c = (_b = spec.servers) == null ? void 0 : _b[0]) == null ? void 0 : _c.url) || "";
|
|
181
|
+
const globalSecurity = spec.security || [];
|
|
182
|
+
let globalSchemeName;
|
|
183
|
+
if (globalSecurity.length > 0) {
|
|
184
|
+
globalSchemeName = Object.keys(globalSecurity[0])[0];
|
|
185
|
+
}
|
|
186
|
+
const authSchemes = ((_d = spec.components) == null ? void 0 : _d.securitySchemes) || {};
|
|
187
|
+
for (const [path, pathItem] of Object.entries(spec.paths || {})) {
|
|
188
|
+
if (!pathItem) continue;
|
|
189
|
+
const methods = [
|
|
190
|
+
"get",
|
|
191
|
+
"post",
|
|
192
|
+
"put",
|
|
193
|
+
"delete",
|
|
194
|
+
"patch",
|
|
195
|
+
"head",
|
|
196
|
+
"options",
|
|
197
|
+
"trace"
|
|
198
|
+
];
|
|
199
|
+
for (const method of methods) {
|
|
200
|
+
const operation = pathItem[method];
|
|
201
|
+
if (!operation) continue;
|
|
202
|
+
const pathParams = pathItem.parameters || [];
|
|
203
|
+
const opParams = operation.parameters || [];
|
|
204
|
+
operation.parameters = [...opParams, ...pathParams];
|
|
205
|
+
if (!operation.operationId) {
|
|
206
|
+
operation.operationId = `${method}_${path.replace(/[^a-zA-Z0-9]/g, "_")}`;
|
|
207
|
+
}
|
|
208
|
+
const parser = new import_operation_parser.OperationParser(operation, {
|
|
209
|
+
preservePropertyNames
|
|
210
|
+
});
|
|
211
|
+
let authSchemeName;
|
|
212
|
+
if (operation.security && operation.security.length > 0) {
|
|
213
|
+
authSchemeName = Object.keys(operation.security[0])[0];
|
|
214
|
+
}
|
|
215
|
+
authSchemeName = authSchemeName || globalSchemeName;
|
|
216
|
+
const authScheme = authSchemeName ? authSchemes[authSchemeName] : void 0;
|
|
217
|
+
operations.push({
|
|
218
|
+
name: parser.getFunctionName(),
|
|
219
|
+
description: parser.getDescription(),
|
|
220
|
+
endpoint: { baseUrl, path, method },
|
|
221
|
+
operation,
|
|
222
|
+
parameters: parser.getParameters(),
|
|
223
|
+
authScheme
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
return operations;
|
|
228
|
+
}
|
|
229
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
230
|
+
0 && (module.exports = {
|
|
231
|
+
OpenApiSpecParser
|
|
232
|
+
});
|