@agentstep/agent-sdk 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.
@@ -97,17 +97,17 @@ function handleCreateInteraction(request) {
97
97
  ).run(interactionId2, sessionId2, seq, result2.status, environmentId ?? null, (/* @__PURE__ */ new Date()).toISOString());
98
98
  return jsonOk(buildResponse(interactionId2, result2, environmentId));
99
99
  }
100
- const agentName = data.agent || `auto-${(data.model || "gemini-2.5-flash").replace(/[^a-z0-9-]/g, "-")}`;
100
+ const modelId = data.model || "gemini-2.5-flash";
101
+ const agentName = data.agent || `auto-${modelId.replace(/[^a-z0-9-]/g, "-")}`;
101
102
  const listReq = new Request(request.url.replace(/\/google\/v1beta\/interactions.*/, `/v1/agents?limit=1000`), {
102
103
  headers: request.headers
103
104
  });
104
105
  const listRes = await handleListAgents(listReq);
105
106
  const listBody = await listRes.json();
106
- const existing = listBody.data?.find((a) => a.name === agentName);
107
+ const existing = listBody.data?.find((a) => a.name === agentName) ?? (data.agent ? void 0 : listBody.data?.find((a) => a.model?.id === modelId));
107
108
  if (existing) {
108
109
  agentId = existing.id;
109
110
  } else {
110
- const modelId = data.model || "gemini-2.5-flash";
111
111
  const createReq = new Request(request.url.replace(/\/google\/v1beta\/interactions.*/, `/v1/agents`), {
112
112
  method: "POST",
113
113
  headers: request.headers,
@@ -149,8 +149,7 @@ function handleCreateInteraction(request) {
149
149
  const tenantVaults = listVaults({
150
150
  tenantFilter: getTenantFilter(auth)
151
151
  });
152
- const agentVaults = tenantVaults.filter((v) => v.agent_id === agentId || !v.agent_id);
153
- const vaultIds = agentVaults.filter((v) => !v.archived_at).map((v) => v.id);
152
+ const vaultIds = tenantVaults.filter((v) => !v.archived_at && (v.agent_id === agentId || !v.agent_id)).map((v) => v.id);
154
153
  const sessReq = new Request(request.url.replace(/\/google\/v1beta\/interactions.*/, `/v1/sessions`), {
155
154
  method: "POST",
156
155
  headers: request.headers,
@@ -254,7 +254,7 @@ function handleCreateSession(request) {
254
254
  const vaultRow = getDb().prepare(`SELECT agent_id, tenant_id FROM vaults WHERE id = ?`).get(vid);
255
255
  if (!vaultRow) throw badRequest(`vault not found: ${vid}`);
256
256
  assertResourceTenant(auth, vaultRow.tenant_id, `vault not found: ${vid}`);
257
- if (vaultRow.agent_id !== agent.id) {
257
+ if (vaultRow.agent_id && vaultRow.agent_id !== agent.id) {
258
258
  throw badRequest(
259
259
  `vault ${vid} belongs to a different agent \u2014 vaults are scoped per-agent`
260
260
  );
@@ -4,7 +4,7 @@ import {
4
4
  handleCreateInteraction,
5
5
  handleDeleteInteraction,
6
6
  handleGetInteraction
7
- } from "../../chunk-VRWXVIIG.js";
7
+ } from "../../chunk-IS37752C.js";
8
8
  import {
9
9
  handleCreateGoogleAgent,
10
10
  handleDeleteGoogleAgent,
@@ -3,7 +3,7 @@ import {
3
3
  handleCreateInteraction,
4
4
  handleDeleteInteraction,
5
5
  handleGetInteraction
6
- } from "../../chunk-VRWXVIIG.js";
6
+ } from "../../chunk-IS37752C.js";
7
7
  import "../../chunk-RMCBO7K7.js";
8
8
  import "../../chunk-D2XITRN6.js";
9
9
  import "../../chunk-CWB2DQN5.js";
@@ -4,7 +4,7 @@ import {
4
4
  handleCreateInteraction,
5
5
  handleDeleteInteraction,
6
6
  handleGetInteraction
7
- } from "../chunk-VRWXVIIG.js";
7
+ } from "../chunk-IS37752C.js";
8
8
  import {
9
9
  handleCreateGoogleAgent,
10
10
  handleDeleteGoogleAgent,
@@ -103,7 +103,7 @@ import {
103
103
  handleGetSession,
104
104
  handleListSessions,
105
105
  handleUpdateSession
106
- } from "../chunk-R6NWAM37.js";
106
+ } from "../chunk-VSDPZ77X.js";
107
107
  import "../chunk-VCU64NHY.js";
108
108
  import {
109
109
  handleGetSetting,
@@ -5,7 +5,7 @@ import {
5
5
  handleGetSession,
6
6
  handleListSessions,
7
7
  handleUpdateSession
8
- } from "../chunk-R6NWAM37.js";
8
+ } from "../chunk-VSDPZ77X.js";
9
9
  import "../chunk-VCU64NHY.js";
10
10
  import "../chunk-ZBWKJ42J.js";
11
11
  import "../chunk-23UKWXJH.js";
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.37",
4
+ "version": "0.5.38",
5
5
  "description": "Core engine for AgentStep Gateway \u2014 backends, sandbox providers, session orchestration, and vault encryption.",
6
6
  "keywords": [
7
7
  "anthropic",