@posthog/agent 2.3.43 → 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.43",
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: {
@@ -3295,6 +3295,10 @@ var ClaudeAcpAgent = class extends BaseAcpAgent {
3295
3295
  (m) => m.contextWindow
3296
3296
  );
3297
3297
  const contextWindowSize = contextWindows.length > 0 ? Math.min(...contextWindows) : getDefaultContextWindow(this.session.modelId ?? "");
3298
+ this.session.contextSize = contextWindowSize;
3299
+ if (lastAssistantTotalUsage !== null) {
3300
+ this.session.contextUsed = lastAssistantTotalUsage;
3301
+ }
3298
3302
  if (lastAssistantTotalUsage !== null) {
3299
3303
  await this.client.sessionUpdate({
3300
3304
  sessionId: params.sessionId,
@@ -4491,7 +4495,7 @@ var SessionLogWriter = class _SessionLogWriter {
4491
4495
  taskId: context.taskId,
4492
4496
  runId: context.runId
4493
4497
  });
4494
- this.sessions.set(sessionId, { context });
4498
+ this.sessions.set(sessionId, { context, currentTurnMessages: [] });
4495
4499
  this.lastFlushAttemptTime.set(sessionId, Date.now());
4496
4500
  if (this.localCachePath) {
4497
4501
  const sessionDir = path6.join(
@@ -4538,6 +4542,7 @@ var SessionLogWriter = class _SessionLogWriter {
4538
4542
  const nonChunkAgentText = this.extractAgentMessageText(message);
4539
4543
  if (nonChunkAgentText) {
4540
4544
  session.lastAgentMessage = nonChunkAgentText;
4545
+ session.currentTurnMessages.push(nonChunkAgentText);
4541
4546
  }
4542
4547
  const entry = {
4543
4548
  type: "notification",
@@ -4634,6 +4639,7 @@ var SessionLogWriter = class _SessionLogWriter {
4634
4639
  const { text: text2, firstTimestamp } = session.chunkBuffer;
4635
4640
  session.chunkBuffer = void 0;
4636
4641
  session.lastAgentMessage = text2;
4642
+ session.currentTurnMessages.push(text2);
4637
4643
  const entry = {
4638
4644
  type: "notification",
4639
4645
  timestamp: firstTimestamp,
@@ -4659,6 +4665,17 @@ var SessionLogWriter = class _SessionLogWriter {
4659
4665
  getLastAgentMessage(sessionId) {
4660
4666
  return this.sessions.get(sessionId)?.lastAgentMessage;
4661
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
+ }
4662
4679
  extractAgentMessageText(message) {
4663
4680
  if (message.method !== "session/update") {
4664
4681
  return null;