@agentstep/gateway 0.5.37 → 0.5.38
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/gateway.js +14 -15
- package/package.json +1 -1
package/dist/gateway.js
CHANGED
|
@@ -219721,7 +219721,7 @@ var init_vaults = __esm({
|
|
|
219721
219721
|
}
|
|
219722
219722
|
});
|
|
219723
219723
|
|
|
219724
|
-
// ../agent-sdk/dist/chunk-
|
|
219724
|
+
// ../agent-sdk/dist/chunk-VSDPZ77X.js
|
|
219725
219725
|
function getAgentTenantId2(id) {
|
|
219726
219726
|
const row = getDb().prepare(`SELECT tenant_id FROM agents WHERE id = ?`).get(id);
|
|
219727
219727
|
return row?.tenant_id;
|
|
@@ -219839,7 +219839,7 @@ function handleCreateSession(request2) {
|
|
|
219839
219839
|
const vaultRow = getDb().prepare(`SELECT agent_id, tenant_id FROM vaults WHERE id = ?`).get(vid);
|
|
219840
219840
|
if (!vaultRow) throw badRequest(`vault not found: ${vid}`);
|
|
219841
219841
|
assertResourceTenant(auth, vaultRow.tenant_id, `vault not found: ${vid}`);
|
|
219842
|
-
if (vaultRow.agent_id !== agent.id) {
|
|
219842
|
+
if (vaultRow.agent_id && vaultRow.agent_id !== agent.id) {
|
|
219843
219843
|
throw badRequest(
|
|
219844
219844
|
`vault ${vid} belongs to a different agent \u2014 vaults are scoped per-agent`
|
|
219845
219845
|
);
|
|
@@ -220225,8 +220225,8 @@ function parseMs(v2) {
|
|
|
220225
220225
|
return Number.isFinite(t2) ? t2 : void 0;
|
|
220226
220226
|
}
|
|
220227
220227
|
var ALLOWED_STATUSES, AgentRef, ResourceSchema, CreateSchema2, UpdateSchema2;
|
|
220228
|
-
var
|
|
220229
|
-
"../agent-sdk/dist/chunk-
|
|
220228
|
+
var init_chunk_VSDPZ77X = __esm({
|
|
220229
|
+
"../agent-sdk/dist/chunk-VSDPZ77X.js"() {
|
|
220230
220230
|
"use strict";
|
|
220231
220231
|
init_chunk_VCU64NHY();
|
|
220232
220232
|
init_chunk_ZBWKJ42J();
|
|
@@ -220321,7 +220321,7 @@ __export(sessions_exports, {
|
|
|
220321
220321
|
var init_sessions = __esm({
|
|
220322
220322
|
"../agent-sdk/dist/handlers/sessions.js"() {
|
|
220323
220323
|
"use strict";
|
|
220324
|
-
|
|
220324
|
+
init_chunk_VSDPZ77X();
|
|
220325
220325
|
init_chunk_VCU64NHY();
|
|
220326
220326
|
init_chunk_ZBWKJ42J();
|
|
220327
220327
|
init_chunk_23UKWXJH();
|
|
@@ -221785,7 +221785,7 @@ var init_bus = __esm({
|
|
|
221785
221785
|
}
|
|
221786
221786
|
});
|
|
221787
221787
|
|
|
221788
|
-
// ../agent-sdk/dist/chunk-
|
|
221788
|
+
// ../agent-sdk/dist/chunk-IS37752C.js
|
|
221789
221789
|
function ensureTable() {
|
|
221790
221790
|
const db = getDb();
|
|
221791
221791
|
db.exec(`
|
|
@@ -221853,17 +221853,17 @@ function handleCreateInteraction(request2) {
|
|
|
221853
221853
|
).run(interactionId2, sessionId2, seq, result2.status, environmentId ?? null, (/* @__PURE__ */ new Date()).toISOString());
|
|
221854
221854
|
return jsonOk(buildResponse(interactionId2, result2, environmentId));
|
|
221855
221855
|
}
|
|
221856
|
-
const
|
|
221856
|
+
const modelId = data.model || "gemini-2.5-flash";
|
|
221857
|
+
const agentName = data.agent || `auto-${modelId.replace(/[^a-z0-9-]/g, "-")}`;
|
|
221857
221858
|
const listReq = new Request(request2.url.replace(/\/google\/v1beta\/interactions.*/, `/v1/agents?limit=1000`), {
|
|
221858
221859
|
headers: request2.headers
|
|
221859
221860
|
});
|
|
221860
221861
|
const listRes = await handleListAgents2(listReq);
|
|
221861
221862
|
const listBody = await listRes.json();
|
|
221862
|
-
const existing = listBody.data?.find((a) => a.name === agentName);
|
|
221863
|
+
const existing = listBody.data?.find((a) => a.name === agentName) ?? (data.agent ? void 0 : listBody.data?.find((a) => a.model?.id === modelId));
|
|
221863
221864
|
if (existing) {
|
|
221864
221865
|
agentId = existing.id;
|
|
221865
221866
|
} else {
|
|
221866
|
-
const modelId = data.model || "gemini-2.5-flash";
|
|
221867
221867
|
const createReq = new Request(request2.url.replace(/\/google\/v1beta\/interactions.*/, `/v1/agents`), {
|
|
221868
221868
|
method: "POST",
|
|
221869
221869
|
headers: request2.headers,
|
|
@@ -221905,8 +221905,7 @@ function handleCreateInteraction(request2) {
|
|
|
221905
221905
|
const tenantVaults = listVaults2({
|
|
221906
221906
|
tenantFilter: getTenantFilter(auth)
|
|
221907
221907
|
});
|
|
221908
|
-
const
|
|
221909
|
-
const vaultIds = agentVaults.filter((v2) => !v2.archived_at).map((v2) => v2.id);
|
|
221908
|
+
const vaultIds = tenantVaults.filter((v2) => !v2.archived_at && (v2.agent_id === agentId || !v2.agent_id)).map((v2) => v2.id);
|
|
221910
221909
|
const sessReq = new Request(request2.url.replace(/\/google\/v1beta\/interactions.*/, `/v1/sessions`), {
|
|
221911
221910
|
method: "POST",
|
|
221912
221911
|
headers: request2.headers,
|
|
@@ -222168,8 +222167,8 @@ function buildResponse(id, result, environmentId) {
|
|
|
222168
222167
|
};
|
|
222169
222168
|
}
|
|
222170
222169
|
var CreateSchema4;
|
|
222171
|
-
var
|
|
222172
|
-
"../agent-sdk/dist/chunk-
|
|
222170
|
+
var init_chunk_IS37752C = __esm({
|
|
222171
|
+
"../agent-sdk/dist/chunk-IS37752C.js"() {
|
|
222173
222172
|
"use strict";
|
|
222174
222173
|
init_chunk_RMCBO7K7();
|
|
222175
222174
|
init_chunk_F4WUVOLE();
|
|
@@ -226886,7 +226885,7 @@ __export(handlers_exports, {
|
|
|
226886
226885
|
var init_handlers3 = __esm({
|
|
226887
226886
|
"../agent-sdk/dist/handlers/index.js"() {
|
|
226888
226887
|
"use strict";
|
|
226889
|
-
|
|
226888
|
+
init_chunk_IS37752C();
|
|
226890
226889
|
init_chunk_2HTAIROL();
|
|
226891
226890
|
init_chunk_PULMO5OO();
|
|
226892
226891
|
init_chunk_3CDJ2VQN();
|
|
@@ -226906,7 +226905,7 @@ var init_handlers3 = __esm({
|
|
|
226906
226905
|
init_chunk_CCNG7D6Y();
|
|
226907
226906
|
init_chunk_R7MZNZNC();
|
|
226908
226907
|
init_chunk_DQIQBMC2();
|
|
226909
|
-
|
|
226908
|
+
init_chunk_VSDPZ77X();
|
|
226910
226909
|
init_chunk_VCU64NHY();
|
|
226911
226910
|
init_chunk_52K3LOFD();
|
|
226912
226911
|
init_chunk_2E43SH4Y();
|
package/package.json
CHANGED