@agentstep/agent-sdk 0.5.38 → 0.5.39
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.
|
@@ -104,7 +104,19 @@ function handleCreateInteraction(request) {
|
|
|
104
104
|
});
|
|
105
105
|
const listRes = await handleListAgents(listReq);
|
|
106
106
|
const listBody = await listRes.json();
|
|
107
|
-
const
|
|
107
|
+
const { listVaults } = await import("./db/vaults.js");
|
|
108
|
+
const { tenantFilter: getTenantFilter } = await import("./auth/scope.js");
|
|
109
|
+
const allVaults = listVaults({ tenantFilter: getTenantFilter(auth) }).filter((v) => !v.archived_at);
|
|
110
|
+
let existing;
|
|
111
|
+
if (data.agent) {
|
|
112
|
+
existing = listBody.data?.find((a) => a.name === agentName);
|
|
113
|
+
} else {
|
|
114
|
+
const modelMatches = listBody.data?.filter((a) => a.model?.id === modelId) ?? [];
|
|
115
|
+
const withVaults = modelMatches.filter(
|
|
116
|
+
(a) => allVaults.some((v) => v.agent_id === a.id || !v.agent_id)
|
|
117
|
+
);
|
|
118
|
+
existing = modelMatches.find((a) => allVaults.some((v) => v.agent_id === a.id)) ?? withVaults[0] ?? modelMatches[0];
|
|
119
|
+
}
|
|
108
120
|
if (existing) {
|
|
109
121
|
agentId = existing.id;
|
|
110
122
|
} else {
|
|
@@ -144,12 +156,7 @@ function handleCreateInteraction(request) {
|
|
|
144
156
|
}
|
|
145
157
|
}
|
|
146
158
|
if (!environmentId) throw badRequest("no environment available");
|
|
147
|
-
const
|
|
148
|
-
const { tenantFilter: getTenantFilter } = await import("./auth/scope.js");
|
|
149
|
-
const tenantVaults = listVaults({
|
|
150
|
-
tenantFilter: getTenantFilter(auth)
|
|
151
|
-
});
|
|
152
|
-
const vaultIds = tenantVaults.filter((v) => !v.archived_at && (v.agent_id === agentId || !v.agent_id)).map((v) => v.id);
|
|
159
|
+
const vaultIds = allVaults.filter((v) => v.agent_id === agentId || !v.agent_id).map((v) => v.id);
|
|
153
160
|
const sessReq = new Request(request.url.replace(/\/google\/v1beta\/interactions.*/, `/v1/sessions`), {
|
|
154
161
|
method: "POST",
|
|
155
162
|
headers: request.headers,
|
package/dist/handlers/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"license": "Apache-2.0",
|
|
3
3
|
"name": "@agentstep/agent-sdk",
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.39",
|
|
5
5
|
"description": "Core engine for AgentStep Gateway \u2014 backends, sandbox providers, session orchestration, and vault encryption.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"anthropic",
|