SIGN IN SIGN UP

feat(deepagents): add ContextHubBackend backend (#533)

This ports Python deepagents PR #3338 behavior into the JS SDK by
introducing a new first-class backend: `ContextHubBackend`.

Why:
- Context Hub repo persistence is now available as an SDK backend in JS,
matching the Python backend architecture.
- This gives JS users a canonical LangSmith Hub-backed file backend with
the same operational semantics (lazy pull, commit chaining, cache
invalidation, batch upload behavior).

What changed:
- Added `ContextHubBackend` in
`libs/deepagents/src/backends/context-hub.ts`.
- Exported it from backend and root package exports.
- Added parity-focused unit tests in `context-hub.test.ts`.
- Added integration contract tests in `context-hub.int.test.ts` (gated
by `LANGSMITH_API_KEY`).
- Updated `deepagents` peer dependency on `langsmith` from `>=0.5.20` to
`>=0.6.0` to rely on Hub directory APIs (`pullAgent` / `pushAgent`).
- Added a changeset for release notes.

Behavior highlights:
- Missing repo on pull is treated as empty and lazily created on first
write.
- In-memory file cache with linked-entry tracking (`getLinkedEntries`).
- Commit hash tracking with optimistic `parentCommit` chaining.
- Cache invalidation on mutating Hub failures.
- `uploadFiles` commits all valid UTF-8 files in a single batch commit
and returns per-file success/error.

Validation run:
- `pnpm install`
- `pnpm exec oxfmt --write ...` (touched files)
- `pnpm --filter deepagents exec oxlint ...` (touched files)
- `pnpm --filter deepagents exec vitest run
src/backends/context-hub.test.ts` (33 passed)
- `pnpm --filter deepagents exec vitest run --mode int
src/backends/context-hub.int.test.ts` (skipped without
`LANGSMITH_API_KEY`)
V
Vishnu Suresh committed
f0880899ea6726b7320b0888d0f6a10a7749e1bf
Parent: 7c33a86
Committed by GitHub <noreply@github.com> on 5/12/2026, 4:47:52 PM