* fix missing files in skillsMiddleware
* Update tests
* Add integration tests + fixes
* Restore skills.test.ts from main
* Update tests to unit from integration
* Update unit tests
* fix test
* changeset
* fix(deepagents): prevent infinite loop when read_file returns large content (#82)
When a tool returned a large result with few but very long lines, the
agent could enter an infinite eviction/read loop. The content would be
evicted to the filesystem, then read_file would return all the content
(since it only had a line limit, not a character limit), which would
again exceed the eviction threshold.
fixes#82
* export FileData from right place
* add changesets
* fix: handle empty oldString in performStringReplacement (#161)
When both file content and oldString are empty, `content.split("")`
returns an empty array, causing `occurrences` to be -1 and returning
an invalid success response.
This change:
- Adds special case handling for empty files: when both content and
oldString are empty, treat it as "set initial content" and return
[newString, 0]
- Returns a clear error when oldString is empty but file has content
- Adds comprehensive tests for empty oldString scenarios
This allows users to edit empty files by passing oldString="" with
their desired content, while preventing ambiguous empty replacements
on non-empty files.
fixes#161
* retrigger
* fix(middleware): avoid unnecessary REMOVE_ALL_MESSAGES in PatchToolCallsMiddleware
The middleware was unconditionally triggering REMOVE_ALL_MESSAGES on every
request, even when there were no dangling tool calls to patch. This caused
unnecessary frontend re-renders and UI flickering when using useStream with
fetchStateHistory: true.
Added a needsPatch flag to track whether any dangling tool calls are found,
and only trigger the state rebuild when patching is actually needed.
Fixes#127
* retrigger
* fix test
* add changeset
* fix(deepagents): use new StateSchema class
* format
* fix bundling
* run unit tests also in windows
* revert
* fix windows test issue
* bump lc
* bump lc
* path normalization
* feat(deepagents): align JS implementation with Python deepagents
This commit addresses divergences between the JavaScript and Python
implementations of the deepagents library, porting several features
from Python and adding comprehensive test coverage.
Changes:
Deprecation:
- Mark `createAgentMemoryMiddleware` as deprecated in favor of
`createMemoryMiddleware` which uses BackendProtocol abstraction
Filesystem middleware (fs.ts):
- Port comprehensive tool descriptions from Python's filesystem.py
- Add TOOLS_EXCLUDED_FROM_EVICTION constant for eviction control
- Add NUM_CHARS_PER_TOKEN constant for token estimation
- Add createContentPreview() for showing head/tail of large results
- Update eviction logic to skip excluded tools and show content preview
Path validation (backends/utils.ts):
- Add validateFilePath() with security checks for path traversal
- Reject Windows absolute paths and tilde expansion
- Support allowedPrefixes validation
Skills middleware (skills.ts):
- Show "(higher priority)" indicator for last source in locations
- Display allowedTools in skill list when specified
Summarization middleware (summarization.ts):
- Port SummarizationMiddleware from Python with backend offloading
- Support conversation history persistence to filesystem
- Add tool argument truncation for old messages
- Re-export base summarizationMiddleware from langchain
Middleware utilities (utils.ts):
- Add appendToSystemMessage() helper
- Add prependToSystemMessage() helper
* format
* fix test
* feat(deepagents): add MemoryMiddleware for AGENTS.md support
Port of langchain-ai/deepagents#646 to TypeScript.
Adds MemoryMiddleware that loads persistent context from AGENTS.md files
following the agents.md specification. Unlike skills (which are on-demand),
memory is always loaded at agent startup and injected into the system prompt.
Changes:
- Add createMemoryMiddleware in middleware/memory.ts
- Add `memory` parameter to createDeepAgent for automatic middleware setup
- Export MemoryMiddleware from package index
- Add unit tests for memory loading and prompt injection
Usage:
const agent = createDeepAgent({
memory: [
"~/.deepagents/AGENTS.md",
"./.deepagents/AGENTS.md",
],
});
* add example
* internal: migrate to libs
* release process
* no need of npm tokens
* feat: bundle deepagent-cli from deepagents
* only for mac now
* fix
* fix linter
* tweak
* Potential fix for code scanning alert no. 14: Workflow does not contain permissions
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
* Potential fix for code scanning alert no. 18: Uncontrolled command line
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
* allow console in scripts
* make it experimental
* allow in CLI as well
---------
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
* internal: migrate to libs
* format
* update
* format
* codespell
* release process
* format
* update deps
* no need of npm tokens
* fix lock file
* type strictness
* no need for withLangGraph
* format
* fix
* remove withLanggraph
* add changeset