@posthog/agent 2.3.46 → 2.3.53

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 CHANGED
@@ -281,7 +281,7 @@ import { v7 as uuidv7 } from "uuid";
281
281
  // package.json
282
282
  var package_default = {
283
283
  name: "@posthog/agent",
284
- version: "2.3.46",
284
+ version: "2.3.53",
285
285
  repository: "https://github.com/PostHog/code",
286
286
  description: "TypeScript agent framework wrapping Claude Agent SDK with Git-based task execution for PostHog",
287
287
  exports: {
@@ -4495,7 +4495,7 @@ var SessionLogWriter = class _SessionLogWriter {
4495
4495
  taskId: context.taskId,
4496
4496
  runId: context.runId
4497
4497
  });
4498
- this.sessions.set(sessionId, { context });
4498
+ this.sessions.set(sessionId, { context, currentTurnMessages: [] });
4499
4499
  this.lastFlushAttemptTime.set(sessionId, Date.now());
4500
4500
  if (this.localCachePath) {
4501
4501
  const sessionDir = path6.join(
@@ -4542,6 +4542,7 @@ var SessionLogWriter = class _SessionLogWriter {
4542
4542
  const nonChunkAgentText = this.extractAgentMessageText(message);
4543
4543
  if (nonChunkAgentText) {
4544
4544
  session.lastAgentMessage = nonChunkAgentText;
4545
+ session.currentTurnMessages.push(nonChunkAgentText);
4545
4546
  }
4546
4547
  const entry = {
4547
4548
  type: "notification",
@@ -4638,6 +4639,7 @@ var SessionLogWriter = class _SessionLogWriter {
4638
4639
  const { text: text2, firstTimestamp } = session.chunkBuffer;
4639
4640
  session.chunkBuffer = void 0;
4640
4641
  session.lastAgentMessage = text2;
4642
+ session.currentTurnMessages.push(text2);
4641
4643
  const entry = {
4642
4644
  type: "notification",
4643
4645
  timestamp: firstTimestamp,
@@ -4663,6 +4665,17 @@ var SessionLogWriter = class _SessionLogWriter {
4663
4665
  getLastAgentMessage(sessionId) {
4664
4666
  return this.sessions.get(sessionId)?.lastAgentMessage;
4665
4667
  }
4668
+ getFullAgentResponse(sessionId) {
4669
+ const session = this.sessions.get(sessionId);
4670
+ if (!session || session.currentTurnMessages.length === 0) return void 0;
4671
+ return session.currentTurnMessages.join("\n\n");
4672
+ }
4673
+ resetTurnMessages(sessionId) {
4674
+ const session = this.sessions.get(sessionId);
4675
+ if (session) {
4676
+ session.currentTurnMessages = [];
4677
+ }
4678
+ }
4666
4679
  extractAgentMessageText(message) {
4667
4680
  if (message.method !== "session/update") {
4668
4681
  return null;