Skip to content

Commit b195355

Browse files
committed
Revert "revert: "feat(deepagents): support multimodal files for backends (#298)" (#352)"
This reverts commit 03ea1c9.
1 parent 03ea1c9 commit b195355

61 files changed

Lines changed: 3846 additions & 1101 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.changeset/dry-insects-occur.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
"@langchain/node-vfs": patch
3+
"@langchain/quickjs": patch
4+
"@langchain/modal": patch
5+
"@langchain/sandbox-standard-tests": patch
6+
"deepagents": minor
7+
"deepagents-acp": patch
8+
---
9+
10+
feat(deepagents): support multimodal files for backends

libs/acp/src/acp-filesystem-backend.test.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ describe("ACPFilesystemBackend", () => {
4747
const result = await backend.read(path.join(tmpDir, "local.txt"));
4848

4949
expect(mockConn.readTextFile).toHaveBeenCalledTimes(1);
50-
expect(result).toBe("acp file content");
50+
expect(result.content).toBe("acp file content");
5151
});
5252

5353
it("should resolve relative paths using cwd", async () => {
@@ -73,7 +73,7 @@ describe("ACPFilesystemBackend", () => {
7373
const result = await backend.read(path.join(tmpDir, "local.txt"));
7474

7575
expect(mockConn.readTextFile).not.toHaveBeenCalled();
76-
expect(result).toContain("local file content");
76+
expect(result.content).toContain("local file content");
7777
});
7878

7979
it("should fall back to local FS when ACP read fails", async () => {
@@ -87,7 +87,7 @@ describe("ACPFilesystemBackend", () => {
8787
const result = await backend.read(path.join(tmpDir, "local.txt"));
8888

8989
expect(mockConn.readTextFile).toHaveBeenCalledTimes(1);
90-
expect(result).toContain("local file content");
90+
expect(result.content).toContain("local file content");
9191
});
9292

9393
it("should handle offset and limit when reading via ACP", async () => {
@@ -102,7 +102,7 @@ describe("ACPFilesystemBackend", () => {
102102

103103
const result = await backend.read(path.join(tmpDir, "local.txt"), 1, 2);
104104

105-
expect(result).toBe("line1\nline2");
105+
expect(result.content).toBe("line1\nline2");
106106
});
107107

108108
it("should pass sessionId in readTextFile call", async () => {
@@ -206,10 +206,12 @@ describe("ACPFilesystemBackend", () => {
206206
});
207207
backend.setSessionId("sess_123");
208208

209-
const entries = await backend.lsInfo(tmpDir);
209+
const lsResult = await backend.lsInfo(tmpDir);
210210

211211
expect(mockConn.readTextFile).not.toHaveBeenCalled();
212212
expect(mockConn.writeTextFile).not.toHaveBeenCalled();
213+
expect(lsResult.error).toBeUndefined();
214+
const entries = lsResult.files || [];
213215
expect(entries.some((e: any) => e.path.includes("local.txt"))).toBe(true);
214216
});
215217

@@ -232,9 +234,11 @@ describe("ACPFilesystemBackend", () => {
232234
});
233235
backend.setSessionId("sess_123");
234236

235-
const matches = await backend.globInfo("*.txt", tmpDir);
237+
const globResult = await backend.globInfo("*.txt", tmpDir);
236238

237239
expect(mockConn.readTextFile).not.toHaveBeenCalled();
240+
expect(globResult.error).toBeUndefined();
241+
const matches = globResult.files || [];
238242
expect(matches.length).toBeGreaterThan(0);
239243
});
240244
});

libs/acp/src/acp-filesystem-backend.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@
77
*/
88

99
import type { AgentSideConnection } from "@agentclientprotocol/sdk";
10-
import { FilesystemBackend, type WriteResult } from "deepagents";
10+
import {
11+
FilesystemBackend,
12+
type WriteResult,
13+
type ReadResult,
14+
} from "deepagents";
1115
import path from "node:path";
1216

1317
/**
@@ -40,7 +44,7 @@ export class ACPFilesystemBackend extends FilesystemBackend {
4044
filePath: string,
4145
offset?: number,
4246
limit?: number,
43-
): Promise<string> {
47+
): Promise<ReadResult> {
4448
if (!this.currentSessionId) {
4549
return super.read(filePath, offset, limit);
4650
}
@@ -61,7 +65,7 @@ export class ACPFilesystemBackend extends FilesystemBackend {
6165
text = lines.slice(start, end).join("\n");
6266
}
6367

64-
return text;
68+
return { content: text };
6569
} catch {
6670
return super.read(filePath, offset, limit);
6771
}

libs/deepagents/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
},
5050
"devDependencies": {
5151
"@langchain/anthropic": "^1.3.18",
52-
"@langchain/langgraph-checkpoint": "^1.0.0",
52+
"@langchain/langgraph-checkpoint": "^1.0.1",
5353
"@langchain/openai": "^1.2.8",
5454
"@langchain/sandbox-standard-tests": "workspace:*",
5555
"@langchain/tavily": "^1.2.0",

0 commit comments

Comments
 (0)