@posthog/agent 2.1.82 → 2.1.83
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/adapters/claude/permissions/permission-options.js.map +1 -1
- package/dist/adapters/claude/tools.js.map +1 -1
- package/dist/agent.js +15 -6
- package/dist/agent.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/server/agent-server.js +24 -11
- package/dist/server/agent-server.js.map +1 -1
- package/dist/server/bin.cjs +24 -11
- package/dist/server/bin.cjs.map +1 -1
- package/package.json +1 -1
- package/src/adapters/acp-connection.ts +5 -4
- package/src/adapters/claude/claude-agent.ts +1 -1
- package/src/adapters/claude/conversion/sdk-to-acp.ts +6 -3
- package/src/adapters/claude/mcp/tool-metadata.ts +8 -5
- package/src/adapters/claude/permissions/permission-handlers.ts +1 -1
- package/src/adapters/claude/session/options.ts +11 -2
- package/src/agent.ts +2 -2
- package/src/sagas/apply-snapshot-saga.ts +6 -3
- package/src/sagas/capture-tree-saga.test.ts +1 -1
package/dist/server/bin.cjs
CHANGED
|
@@ -1175,7 +1175,7 @@ var import_uuid = require("uuid");
|
|
|
1175
1175
|
// package.json
|
|
1176
1176
|
var package_default = {
|
|
1177
1177
|
name: "@posthog/agent",
|
|
1178
|
-
version: "2.1.
|
|
1178
|
+
version: "2.1.83",
|
|
1179
1179
|
repository: "https://github.com/PostHog/twig",
|
|
1180
1180
|
description: "TypeScript agent framework wrapping Claude Agent SDK with Git-based task execution for PostHog",
|
|
1181
1181
|
exports: {
|
|
@@ -2467,7 +2467,7 @@ function isHttpMcpServer(config) {
|
|
|
2467
2467
|
async function fetchToolsFromHttpServer(_serverName, config) {
|
|
2468
2468
|
const transport = new import_streamableHttp.StreamableHTTPClientTransport(new URL(config.url), {
|
|
2469
2469
|
requestInit: {
|
|
2470
|
-
headers: config.headers
|
|
2470
|
+
headers: config.headers ?? {}
|
|
2471
2471
|
}
|
|
2472
2472
|
});
|
|
2473
2473
|
const client = new import_client.Client({
|
|
@@ -2847,7 +2847,7 @@ async function applyPlanApproval(response, context, updatedInput) {
|
|
|
2847
2847
|
return { behavior: "deny", message, interrupt: false };
|
|
2848
2848
|
}
|
|
2849
2849
|
async function handleEnterPlanModeTool(context) {
|
|
2850
|
-
const { session, toolInput
|
|
2850
|
+
const { session, toolInput } = context;
|
|
2851
2851
|
session.permissionMode = "plan";
|
|
2852
2852
|
await session.query.setPermissionMode("plan");
|
|
2853
2853
|
await context.emitConfigOptionsUpdate();
|
|
@@ -3195,6 +3195,11 @@ function buildSpawnWrapper(sessionId, onProcessSpawned, onProcessExited) {
|
|
|
3195
3195
|
child.kill("SIGTERM");
|
|
3196
3196
|
});
|
|
3197
3197
|
}
|
|
3198
|
+
if (!child.stdin || !child.stdout) {
|
|
3199
|
+
throw new Error(
|
|
3200
|
+
`Failed to get stdio streams for spawned process (pid=${child.pid})`
|
|
3201
|
+
);
|
|
3202
|
+
}
|
|
3198
3203
|
return {
|
|
3199
3204
|
stdin: child.stdin,
|
|
3200
3205
|
stdout: child.stdout,
|
|
@@ -3207,12 +3212,15 @@ function buildSpawnWrapper(sessionId, onProcessSpawned, onProcessExited) {
|
|
|
3207
3212
|
kill(signal) {
|
|
3208
3213
|
return child.kill(signal);
|
|
3209
3214
|
},
|
|
3215
|
+
// biome-ignore lint/suspicious/noExplicitAny: ChildProcess event listener types require any[]
|
|
3210
3216
|
on(event, listener) {
|
|
3211
3217
|
child.on(event, listener);
|
|
3212
3218
|
},
|
|
3219
|
+
// biome-ignore lint/suspicious/noExplicitAny: ChildProcess event listener types require any[]
|
|
3213
3220
|
once(event, listener) {
|
|
3214
3221
|
child.once(event, listener);
|
|
3215
3222
|
},
|
|
3223
|
+
// biome-ignore lint/suspicious/noExplicitAny: ChildProcess event listener types require any[]
|
|
3216
3224
|
off(event, listener) {
|
|
3217
3225
|
child.off(event, listener);
|
|
3218
3226
|
}
|
|
@@ -3893,15 +3901,16 @@ function createClaudeConnection(config) {
|
|
|
3893
3901
|
deviceType: config.deviceType
|
|
3894
3902
|
});
|
|
3895
3903
|
}
|
|
3904
|
+
const taskRunId = config.taskRunId;
|
|
3896
3905
|
agentWritable = createTappedWritableStream(streams.agent.writable, {
|
|
3897
3906
|
onMessage: (line) => {
|
|
3898
|
-
logWriter.appendRawLine(
|
|
3907
|
+
logWriter.appendRawLine(taskRunId, line);
|
|
3899
3908
|
},
|
|
3900
3909
|
logger
|
|
3901
3910
|
});
|
|
3902
3911
|
clientWritable = createTappedWritableStream(streams.client.writable, {
|
|
3903
3912
|
onMessage: (line) => {
|
|
3904
|
-
logWriter.appendRawLine(
|
|
3913
|
+
logWriter.appendRawLine(taskRunId, line);
|
|
3905
3914
|
},
|
|
3906
3915
|
logger
|
|
3907
3916
|
});
|
|
@@ -4097,7 +4106,7 @@ function createCodexConnection(config) {
|
|
|
4097
4106
|
}
|
|
4098
4107
|
});
|
|
4099
4108
|
const shouldTapLogs = config.taskRunId && logWriter;
|
|
4100
|
-
if (shouldTapLogs) {
|
|
4109
|
+
if (shouldTapLogs && config.taskRunId) {
|
|
4101
4110
|
const taskRunId2 = config.taskRunId;
|
|
4102
4111
|
if (!logWriter.isRegistered(taskRunId2)) {
|
|
4103
4112
|
logWriter.register(taskRunId2, {
|
|
@@ -9229,11 +9238,13 @@ var AsyncReaderWriterLock = class {
|
|
|
9229
9238
|
return;
|
|
9230
9239
|
if (this.writeQueue.length > 0) {
|
|
9231
9240
|
const next = this.writeQueue.shift();
|
|
9232
|
-
next
|
|
9241
|
+
if (next)
|
|
9242
|
+
next();
|
|
9233
9243
|
} else {
|
|
9234
9244
|
while (this.readQueue.length > 0 && !this.writerWaiting) {
|
|
9235
9245
|
const next = this.readQueue.shift();
|
|
9236
|
-
next
|
|
9246
|
+
if (next)
|
|
9247
|
+
next();
|
|
9237
9248
|
}
|
|
9238
9249
|
}
|
|
9239
9250
|
}
|
|
@@ -9749,27 +9760,29 @@ var ApplySnapshotSaga = class extends Saga {
|
|
|
9749
9760
|
if (!snapshot.archiveUrl) {
|
|
9750
9761
|
throw new Error("Cannot apply snapshot: no archive URL");
|
|
9751
9762
|
}
|
|
9763
|
+
const archiveUrl = snapshot.archiveUrl;
|
|
9752
9764
|
await this.step({
|
|
9753
9765
|
name: "create_tmp_dir",
|
|
9754
9766
|
execute: () => (0, import_promises2.mkdir)(tmpDir, { recursive: true }),
|
|
9755
9767
|
rollback: async () => {
|
|
9756
9768
|
}
|
|
9757
9769
|
});
|
|
9758
|
-
|
|
9770
|
+
const archivePath = (0, import_node_path4.join)(tmpDir, `${snapshot.treeHash}.tar.gz`);
|
|
9771
|
+
this.archivePath = archivePath;
|
|
9759
9772
|
await this.step({
|
|
9760
9773
|
name: "download_archive",
|
|
9761
9774
|
execute: async () => {
|
|
9762
9775
|
const arrayBuffer = await apiClient.downloadArtifact(
|
|
9763
9776
|
taskId,
|
|
9764
9777
|
runId,
|
|
9765
|
-
|
|
9778
|
+
archiveUrl
|
|
9766
9779
|
);
|
|
9767
9780
|
if (!arrayBuffer) {
|
|
9768
9781
|
throw new Error("Failed to download archive");
|
|
9769
9782
|
}
|
|
9770
9783
|
const base64Content = Buffer.from(arrayBuffer).toString("utf-8");
|
|
9771
9784
|
const binaryContent = Buffer.from(base64Content, "base64");
|
|
9772
|
-
await (0, import_promises2.writeFile)(
|
|
9785
|
+
await (0, import_promises2.writeFile)(archivePath, binaryContent);
|
|
9773
9786
|
},
|
|
9774
9787
|
rollback: async () => {
|
|
9775
9788
|
if (this.archivePath) {
|