@posthog/agent 2.3.353 → 2.3.356
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 +19 -2
- package/dist/agent.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/index.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 +98 -54
- package/dist/server/agent-server.js.map +1 -1
- package/dist/server/bin.cjs +98 -54
- package/dist/server/bin.cjs.map +1 -1
- package/package.json +3 -3
- package/src/acp-extensions.ts +3 -0
- package/src/adapters/claude/conversion/sdk-to-acp.ts +31 -1
- package/src/server/agent-server.ts +103 -53
- 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.356",
|
|
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: {
|
|
@@ -4191,6 +4191,8 @@ var POSTHOG_NOTIFICATIONS = {
|
|
|
4191
4191
|
CLOSE: "_posthog/close",
|
|
4192
4192
|
/** Agent status update (thinking, working, etc.) */
|
|
4193
4193
|
STATUS: "_posthog/status",
|
|
4194
|
+
/** Structured backend progress notification; events in the same turn group into one card on the client */
|
|
4195
|
+
PROGRESS: "_posthog/progress",
|
|
4194
4196
|
/** Task-level notification (progress, milestones) */
|
|
4195
4197
|
TASK_NOTIFICATION: "_posthog/task_notification",
|
|
4196
4198
|
/** Marks a boundary for log compaction */
|
|
@@ -8977,6 +8979,17 @@ async function handleSystemMessage(message, context) {
|
|
|
8977
8979
|
break;
|
|
8978
8980
|
}
|
|
8979
8981
|
}
|
|
8982
|
+
function classifyAgentError(result) {
|
|
8983
|
+
if (!result) return "agent_error";
|
|
8984
|
+
const text2 = result.trim();
|
|
8985
|
+
if (/API Error:\s*terminated\b/i.test(text2)) {
|
|
8986
|
+
return "upstream_stream_terminated";
|
|
8987
|
+
}
|
|
8988
|
+
if (/API Error:\s*Connection error\b/i.test(text2)) {
|
|
8989
|
+
return "upstream_connection_error";
|
|
8990
|
+
}
|
|
8991
|
+
return "agent_error";
|
|
8992
|
+
}
|
|
8980
8993
|
function handleResultMessage(message) {
|
|
8981
8994
|
const usage = extractUsageFromResult(message);
|
|
8982
8995
|
switch (message.subtype) {
|
|
@@ -8992,9 +9005,13 @@ function handleResultMessage(message) {
|
|
|
8992
9005
|
return { shouldStop: true, stopReason: "max_tokens", usage };
|
|
8993
9006
|
}
|
|
8994
9007
|
if (message.is_error) {
|
|
9008
|
+
const classification = classifyAgentError(message.result);
|
|
8995
9009
|
return {
|
|
8996
9010
|
shouldStop: true,
|
|
8997
|
-
error: RequestError.internalError(
|
|
9011
|
+
error: RequestError.internalError(
|
|
9012
|
+
{ classification, result: message.result },
|
|
9013
|
+
message.result
|
|
9014
|
+
),
|
|
8998
9015
|
usage
|
|
8999
9016
|
};
|
|
9000
9017
|
}
|