Repository navigation
[EPIC-D][LOU-D30] createAgent({ store }) wires sessions, checkpoints and approvals from one store - #94
Merged
Conversation
…and approvals from one store
- AgentStore { sessions?, checkpoints?, approvals? } (exported) and
memoryStore(); SqliteStore already satisfies it.
- createAgent({ store }): agent.session({ id }) defaults its transcript and
checkpoint stores from it (part by part; a session's own store /
checkpointStore win), store.approvals is the default approvalStore.
- SendOptions.sessionId: send()/stream() become durable runs checkpointed
in store.checkpoints; agent.approvals.resolve() keeps checkpointing them.
- agent.resume(id): finishes an interrupted durable run, else the session's
pending turn; null when nothing is pending.
- Docs (README, sessions, durable-execution, approvals, configuration,
api-overview), llms-full.txt, CHANGELOG.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016bY29ibQgv3MDdjAbUT4YR
# Conflicts: # CHANGELOG.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
AgentStoreinterface ({ sessions?: SessionStore; checkpoints?: CheckpointStore; approvals?: ApprovalStore }, exported from the root).SqliteStorealready satisfies it. NewmemoryStore()returns in-memory sessions, checkpoints and approvals (src/storage/agentStore.ts).createAgent({ store }):agent.session({ id })takes its transcript store fromstore.sessionsand its checkpoint store fromstore.checkpoints. A session's ownstore(aSessionStore, or{ sessions, checkpoints }) and itscheckpointStorestill win, one part at a time (withDefaultStores()in src/session/AgentSession.ts).store.approvalsis the defaultapprovalStore. An explicitapprovalStorestill wins.SendOptions.sessionId:send()/stream()become durable runs checkpointed instore.checkpoints. Passing it without a checkpoint store throws a clear error. Without it, runs are not checkpointed.agent.approvals.resolve()keeps checkpointing a run that paused under asessionId.agent.resume(sessionId): if a run is checkpointed under that id, it resumes it through the executor path (input: []), or returnsnullif that run already finished. Otherwise it delegates toagent.session({ id }).resume(). It returnsnullwhen nothing is pending, and throwsSessionAwaitingApprovalErrorwhile an approval is waiting.AgentStorecombinationFileSessionStore+LocalStorageCheckpointStore+StorageServiceApprovalStore), docs/durable-execution.md (a one-shot durable run with noAgentExecutor), approvals.md, configuration.md and api-overview.md are updated.llms-full.txtis regenerated. CHANGELOG has an Added entry.Why
This completes differentiator 1 in the audit ("host-agnostic durable sessions in one option"). Before, a durable job needed
AgentBuilder+ToolRegistry+AgentExecutor+ manual transcript saves. Now onestoreoption wires everything. The durable-job reference agent drops from about 60 to 25 non-blank lines (22 of them code).Acceptance criteria
createAgent({ store })with the exportedAgentStoreinterface.SqliteStoresatisfies it,memoryStore()is added, and the file-based combination is documented.store: sessions default their session and checkpoint stores from it, approvals default from it, andsend()/stream()usestore.checkpointsonly whensessionIdis passed (SendOptions.sessionIdadded). Explicit per-call options still win.agent.resume(sessionId)resumes a pending durable run or session turn and returnsnullwhen nothing is pending.store(snippets type-checked). llms regenerated, CHANGELOG updated.mockModelagainst bothmemoryStore()andSqliteStore(':memory:'). They cover session defaults, approval pause + resolve throughstore.approvals, crash +agent.resume()throughstore.checkpoints(session turn and one-shotsessionIdrun), and explicit-option precedence.How verified
npx tsc --noEmit: no errorsnpm run lint: 0 errors, 405 warnings (the same as main; the changed files have 0 warnings)npm run test:types: Type Errors no errorsnpx vitest run: Test Files 145 passed (145); Tests 2099 passed | 3 skipped (2102)npm run build && npm run build --workspace=packages/create-loushy-agent: successnpm run docs:verify-snippets -- --skip-build: all 109 snippet(s) type-check against src/; 6 also run cleanlynpm run docs:llms:check: exit 0npm run test:coverage && npm run fallow: coverage run passed (145 files); fallow "No issues found" and exit 0. The only duplication it reports already exists on main (Anthropic/OpenAI providers).🤖 Generated with Claude Code
https://claude.ai/code/session_016bY29ibQgv3MDdjAbUT4YR
Generated by Claude Code