Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/agent/src/acp-extensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ export const POSTHOG_NOTIFICATIONS = {
/** Marks a boundary for log compaction */
COMPACT_BOUNDARY: "_posthog/compact_boundary",

/** Conversation history was cleared via /clear. Carries the fresh SDK
* session id; rehydration treats the entry as a conversation boundary. */
CONVERSATION_CLEARED: "_posthog/conversation_cleared",

/** Token usage update for a session turn */
USAGE_UPDATE: "_posthog/usage_update",

Expand Down
6 changes: 4 additions & 2 deletions packages/agent/src/adapters/base-acp-agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export abstract class BaseAcpAgent implements Agent {
protected abstract interrupt(): Promise<void>;

async cancel(params: CancelNotification): Promise<void> {
if (this.sessionId !== params.sessionId) {
if (!this.hasSession(params.sessionId)) {
throw new Error("Session ID mismatch");
}
this.session.cancelled = true;
Expand Down Expand Up @@ -100,6 +100,8 @@ export abstract class BaseAcpAgent implements Agent {
}
}

/** Adapters may widen this to accept alternate ids for the live session
* (e.g. the Claude adapter's post-/clear SDK session id). */
hasSession(sessionId: string): boolean {
return this.sessionId === sessionId;
}
Expand All @@ -108,7 +110,7 @@ export abstract class BaseAcpAgent implements Agent {
sessionId: string,
notification: SessionNotification,
): void {
if (this.sessionId === sessionId) {
if (this.hasSession(sessionId)) {
this.session.notificationHistory.push(notification);
}
}
Expand Down
6 changes: 5 additions & 1 deletion packages/agent/src/adapters/claude/UPSTREAM.md
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,11 @@ Fork of `@anthropic-ai/claude-agent-acp`. Upstream repo: https://github.com/anth
- **Model alias version match** (#702, e1e1c69): Refuse cross-version alias matches in `resolveModelPreference`
so `claude-opus-4-6` doesn't get copied onto the `opus` alias when it resolves to 4.7.
- **Hide /clear** (#705, cfce130): `/clear` removed from advertised commands; clients should use
`session/new` for the same effect.
`session/new` for the same effect. Superseded: PostHog Code now implements `/clear` itself in
`clearConversation` (prompt() intercepts it and swaps in a fresh SDK session; a
`_posthog/conversation_cleared` log marker bounds rehydration), still never forwarding it to the SDK.
A build that predates this marker skips it as an unrecognized notification and keeps rendering
pre-clear history on rehydration, so the history-drop only renders correctly on builds that ship it.
- **No-op ping events** (#698, 694221a): `streamEventToAcpNotifications` no-ops `ping` keep-alive events
instead of falling through to `unreachable` and spamming stderr.

Expand Down
Loading
Loading