@posthog/agent 2.3.187 → 2.3.202

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@posthog/agent",
3
- "version": "2.3.187",
3
+ "version": "2.3.202",
4
4
  "repository": "https://github.com/PostHog/code",
5
5
  "description": "TypeScript agent framework wrapping Claude Agent SDK with Git-based task execution for PostHog",
6
6
  "exports": {
@@ -226,11 +226,19 @@ export function toolInfoFromToolUse(
226
226
  : undefined;
227
227
  const contentStr = input?.content ? String(input.content) : undefined;
228
228
  if (writeFilePath) {
229
- const oldContent =
229
+ let oldContent: string | null = null;
230
+ if (
230
231
  options?.cachedFileContent &&
231
232
  writeFilePath in options.cachedFileContent
232
- ? options.cachedFileContent[writeFilePath]
233
- : null;
233
+ ) {
234
+ oldContent = options.cachedFileContent[writeFilePath];
235
+ } else {
236
+ try {
237
+ oldContent = fs.readFileSync(writeFilePath, "utf-8");
238
+ } catch {
239
+ // File doesn't exist — genuinely a new file
240
+ }
241
+ }
234
242
  contentResult = toolContent()
235
243
  .diff(writeFilePath, oldContent, contentStr ?? "")
236
244
  .build();
@@ -338,7 +338,10 @@ async function handleDefaultPermissionFlow(
338
338
  suggestions,
339
339
  } = context;
340
340
 
341
- const toolInfo = toolInfoFromToolUse({ name: toolName, input: toolInput });
341
+ const toolInfo = toolInfoFromToolUse(
342
+ { name: toolName, input: toolInput },
343
+ { cachedFileContent: context.fileContentCache, cwd: session?.cwd },
344
+ );
342
345
 
343
346
  const options = buildPermissionOptions(
344
347
  toolName,