@agentstep/gateway 0.4.9 → 0.4.10
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 +45 -2
- package/package.json +1 -1
package/dist/gateway.js
CHANGED
|
@@ -88630,7 +88630,7 @@ function buildOpenApiDocument(opts) {
|
|
|
88630
88630
|
openapi: "3.1.0",
|
|
88631
88631
|
info: {
|
|
88632
88632
|
title: "AgentStep Gateway",
|
|
88633
|
-
version: "0.4.
|
|
88633
|
+
version: "0.4.10",
|
|
88634
88634
|
description: "Open-source, drop-in replacement for the Claude Managed Agents API. Self-hosted agent gateway with 7 agent harnesses and 11 sandbox providers. Use with `@agentstep/agent-sdk` or the official Anthropic SDK \u2014 just change the baseURL."
|
|
88635
88635
|
},
|
|
88636
88636
|
servers: [{ url: opts.serverUrl, description: "This host" }],
|
|
@@ -236700,6 +236700,9 @@ async function teeRemoteStreamInner(localSessionId, remoteSessionId) {
|
|
|
236700
236700
|
let buffer = "";
|
|
236701
236701
|
let sawRequiresAction = false;
|
|
236702
236702
|
let lastToolUseEvt = null;
|
|
236703
|
+
let turnToolCalls = 0;
|
|
236704
|
+
let turnRunningAt = 0;
|
|
236705
|
+
let turnUsage = { input_tokens: 0, output_tokens: 0, cache_read_input_tokens: 0, cache_creation_input_tokens: 0 };
|
|
236703
236706
|
try {
|
|
236704
236707
|
while (true) {
|
|
236705
236708
|
const { done, value } = await reader.read();
|
|
@@ -236739,6 +236742,46 @@ async function teeRemoteStreamInner(localSessionId, remoteSessionId) {
|
|
|
236739
236742
|
origin: "server",
|
|
236740
236743
|
processedAt: Date.now()
|
|
236741
236744
|
});
|
|
236745
|
+
if (localType === "session.status_running") {
|
|
236746
|
+
turnRunningAt = Date.now();
|
|
236747
|
+
}
|
|
236748
|
+
if (localType.includes("tool_use")) {
|
|
236749
|
+
turnToolCalls++;
|
|
236750
|
+
}
|
|
236751
|
+
if (localType === "span.model_request_end") {
|
|
236752
|
+
const mu = evt.model_usage ?? evt.usage;
|
|
236753
|
+
if (mu) {
|
|
236754
|
+
turnUsage.input_tokens += mu.input_tokens ?? 0;
|
|
236755
|
+
turnUsage.output_tokens += mu.output_tokens ?? 0;
|
|
236756
|
+
turnUsage.cache_read_input_tokens += mu.cache_read_input_tokens ?? 0;
|
|
236757
|
+
turnUsage.cache_creation_input_tokens += mu.cache_creation_input_tokens ?? 0;
|
|
236758
|
+
}
|
|
236759
|
+
}
|
|
236760
|
+
if (localType === "session.status_idle") {
|
|
236761
|
+
const activeSec = turnRunningAt > 0 ? (Date.now() - turnRunningAt) / 1e3 : 0;
|
|
236762
|
+
bumpSessionStats2(
|
|
236763
|
+
localSessionId,
|
|
236764
|
+
{ turn_count: 1, tool_calls_count: turnToolCalls, active_seconds: Math.round(activeSec), duration_seconds: Math.round(activeSec) },
|
|
236765
|
+
turnUsage.input_tokens > 0 || turnUsage.output_tokens > 0 ? turnUsage : void 0
|
|
236766
|
+
);
|
|
236767
|
+
if (reentryCount === 0) {
|
|
236768
|
+
const session = getSession2(localSessionId);
|
|
236769
|
+
if (session && !session.title) {
|
|
236770
|
+
const firstUserEvt = listEvents2(localSessionId, { limit: 1, order: "asc" });
|
|
236771
|
+
if (firstUserEvt.length > 0 && firstUserEvt[0].type === "user.message") {
|
|
236772
|
+
try {
|
|
236773
|
+
const p2 = JSON.parse(firstUserEvt[0].payload_json);
|
|
236774
|
+
const text2 = p2.content?.[0]?.text;
|
|
236775
|
+
if (text2) updateSessionMutable2(localSessionId, { title: text2.slice(0, 60) });
|
|
236776
|
+
} catch {
|
|
236777
|
+
}
|
|
236778
|
+
}
|
|
236779
|
+
}
|
|
236780
|
+
}
|
|
236781
|
+
turnToolCalls = 0;
|
|
236782
|
+
turnRunningAt = 0;
|
|
236783
|
+
turnUsage = { input_tokens: 0, output_tokens: 0, cache_read_input_tokens: 0, cache_creation_input_tokens: 0 };
|
|
236784
|
+
}
|
|
236742
236785
|
if (localType === "tool_use" || localType === "agent.custom_tool_use") {
|
|
236743
236786
|
lastToolUseEvt = evt;
|
|
236744
236787
|
}
|
|
@@ -237593,7 +237636,7 @@ function buildOpenApiDocument2(opts) {
|
|
|
237593
237636
|
openapi: "3.1.0",
|
|
237594
237637
|
info: {
|
|
237595
237638
|
title: "AgentStep Gateway",
|
|
237596
|
-
version: "0.4.
|
|
237639
|
+
version: "0.4.10",
|
|
237597
237640
|
description: "Open-source, drop-in replacement for the Claude Managed Agents API. Self-hosted agent gateway with 7 agent harnesses and 11 sandbox providers. Use with `@agentstep/agent-sdk` or the official Anthropic SDK \u2014 just change the baseURL."
|
|
237598
237641
|
},
|
|
237599
237642
|
servers: [{ url: opts.serverUrl, description: "This host" }],
|
package/package.json
CHANGED