Conversation
Comprehensive guide covering Session, SessionManager, context blocks, compaction, AI tools, search, storage, and custom providers.
|
- Remove MessageQueryOptions (exported type, never accepted by any method) - Remove needsCompaction (redundant with compactAfter auto-compaction) - Remove maxContextMessages builder method and field (only fed needsCompaction) - Update docs to reflect removals
| @@ -0,0 +1,785 @@ | |||
| # Sessions (Experimental) | |||
There was a problem hiding this comment.
🔴 New doc not added to index.md as required by docs/AGENTS.md
The docs/AGENTS.md rule file mandates that when adding a new doc: "Add it to index.md in the appropriate section." The new sessions.md file was created but not added to docs/index.md. This is a violation of the repository's mandatory documentation rules.
Prompt for agents
The docs/AGENTS.md file requires that new documentation files be added to docs/index.md in the appropriate section. The sessions.md file documents the Session API (experimental), which would fit under the 'AI Integration' section of docs/index.md, near the existing experimental entries like Workspace and Codemode. Add an entry like:
- [Sessions (Experimental)](./sessions.md) - Persistent conversation storage with tree-structured messages, context blocks, compaction, and search
This should go in the 'AI Integration' section of docs/index.md, around line 47-48 where the other experimental features are listed.
Was this helpful? React with 👍 or 👎 to provide feedback.
| // Get all responses that share the same parent as messageId | ||
| const siblings = session.getBranches(messageId); |
There was a problem hiding this comment.
🟡 getBranches documentation incorrectly describes the API as returning siblings instead of children
The documentation says getBranches(messageId) returns "all responses that share the same parent as messageId" (i.e., siblings), but the actual implementation at packages/agents/src/experimental/memory/session/providers/agent.ts:138 uses WHERE parent_id = ${messageId}, which returns children of messageId. A user following this doc who passes a child message ID expecting to get its siblings would instead get the children of that child. The variable name siblings reinforces the incorrect mental model.
Correct description
getBranches(messageId) returns all messages whose parent is messageId — i.e., all branches extending from that point. To get "sibling responses" for regeneration, you pass the parent (e.g., the user message ID), not one of the siblings.
| // Get all responses that share the same parent as messageId | |
| const siblings = session.getBranches(messageId); | |
| // Get all child messages that branch from messageId (e.g. multiple responses to a user message) | |
| const branches = session.getBranches(messageId); |
Was this helpful? React with 👍 or 👎 to provide feedback.
| export type { SkillProvider } from "./skills"; | ||
| export { isSkillProvider, R2SkillProvider } from "./skills"; | ||
| export type { MessageQueryOptions, SessionOptions } from "./types"; | ||
| export type { SessionOptions } from "./types"; |
There was a problem hiding this comment.
🟡 Missing changeset for public API removal from packages/agents
AGENTS.md requires: "Changes to packages/ that affect the public API or fix bugs need a changeset." This PR removes three public API items from packages/agents/ — the MessageQueryOptions type export (packages/agents/src/experimental/memory/session/index.ts:52), the maxContextMessages() builder method, and the needsCompaction() method on SessionManager (packages/agents/src/experimental/memory/session/manager.ts) — but does not add a changeset file describing these removals. While a pending agents: patch changeset exists from PR #1278, it documents unrelated changes (lifecycle hooks, dynamic context). Users relying on these exports (however unlikely given they were dead code) would not see the removal documented in the changelog. Additionally, experimental/session-multichat/README.md:75 still references the removed .maxContextMessages(count) method.
Prompt for agents
Add a changeset file for the agents package describing the removal of MessageQueryOptions, maxContextMessages(), and needsCompaction() from the experimental session API. Run `npx changeset` and select agents with a patch bump. Also update experimental/session-multichat/README.md line 75 to remove the reference to the now-deleted .maxContextMessages(count) builder method.
Was this helpful? React with 👍 or 👎 to provide feedback.
Summary
agents/experimental/memory/session)Test plan