@posthog/agent 2.3.353 → 2.3.354
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/agent.js +17 -2
- package/dist/agent.js.map +1 -1
- package/dist/posthog-api.js +1 -1
- package/dist/posthog-api.js.map +1 -1
- package/dist/server/agent-server.d.ts +2 -0
- package/dist/server/agent-server.js +47 -6
- package/dist/server/agent-server.js.map +1 -1
- package/dist/server/bin.cjs +47 -6
- package/dist/server/bin.cjs.map +1 -1
- package/package.json +3 -3
- package/src/adapters/claude/conversion/sdk-to-acp.ts +31 -1
- package/src/server/agent-server.ts +54 -3
- package/src/server/question-relay.test.ts +124 -0
package/dist/agent.js
CHANGED
|
@@ -4030,7 +4030,7 @@ import { v7 as uuidv7 } from "uuid";
|
|
|
4030
4030
|
// package.json
|
|
4031
4031
|
var package_default = {
|
|
4032
4032
|
name: "@posthog/agent",
|
|
4033
|
-
version: "2.3.
|
|
4033
|
+
version: "2.3.354",
|
|
4034
4034
|
repository: "https://github.com/PostHog/code",
|
|
4035
4035
|
description: "TypeScript agent framework wrapping Claude Agent SDK with Git-based task execution for PostHog",
|
|
4036
4036
|
exports: {
|
|
@@ -8977,6 +8977,17 @@ async function handleSystemMessage(message, context) {
|
|
|
8977
8977
|
break;
|
|
8978
8978
|
}
|
|
8979
8979
|
}
|
|
8980
|
+
function classifyAgentError(result) {
|
|
8981
|
+
if (!result) return "agent_error";
|
|
8982
|
+
const text2 = result.trim();
|
|
8983
|
+
if (/API Error:\s*terminated\b/i.test(text2)) {
|
|
8984
|
+
return "upstream_stream_terminated";
|
|
8985
|
+
}
|
|
8986
|
+
if (/API Error:\s*Connection error\b/i.test(text2)) {
|
|
8987
|
+
return "upstream_connection_error";
|
|
8988
|
+
}
|
|
8989
|
+
return "agent_error";
|
|
8990
|
+
}
|
|
8980
8991
|
function handleResultMessage(message) {
|
|
8981
8992
|
const usage = extractUsageFromResult(message);
|
|
8982
8993
|
switch (message.subtype) {
|
|
@@ -8992,9 +9003,13 @@ function handleResultMessage(message) {
|
|
|
8992
9003
|
return { shouldStop: true, stopReason: "max_tokens", usage };
|
|
8993
9004
|
}
|
|
8994
9005
|
if (message.is_error) {
|
|
9006
|
+
const classification = classifyAgentError(message.result);
|
|
8995
9007
|
return {
|
|
8996
9008
|
shouldStop: true,
|
|
8997
|
-
error: RequestError.internalError(
|
|
9009
|
+
error: RequestError.internalError(
|
|
9010
|
+
{ classification, result: message.result },
|
|
9011
|
+
message.result
|
|
9012
|
+
),
|
|
8998
9013
|
usage
|
|
8999
9014
|
};
|
|
9000
9015
|
}
|