@agnishc/edb-claude-proxy 0.10.8 → 0.10.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.10.9] - 2026-05-18
4
+
3
5
  ## [0.10.8] - 2026-05-18
4
6
 
5
7
  ## [0.10.6] - 2026-05-15
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agnishc/edb-claude-proxy",
3
- "version": "0.10.8",
3
+ "version": "0.10.9",
4
4
  "description": "Pi extension: claude_proxy tool — delegate tasks to Claude Code CLI from within pi",
5
5
  "keywords": [
6
6
  "pi-package",
@@ -0,0 +1,53 @@
1
+ import * as os from "node:os";
2
+ import { describe, expect, it } from "vitest";
3
+ import { formatToolCall } from "./format.js";
4
+
5
+ const HOME = os.homedir();
6
+
7
+ describe("formatToolCall", () => {
8
+ it("formats Read tool call", () => {
9
+ expect(formatToolCall("Read", { path: "/tmp/foo.ts" })).toBe("read /tmp/foo.ts");
10
+ });
11
+
12
+ it("shortens paths starting with home", () => {
13
+ const userPath = `${HOME}/project/src/index.ts`;
14
+ expect(formatToolCall("Read", { path: userPath })).toBe(`read ~${userPath.slice(HOME.length)}`);
15
+ });
16
+
17
+ it("formats Bash with truncated long commands", () => {
18
+ const longCmd = `echo ${"x".repeat(80)}`;
19
+ const result = formatToolCall("Bash", { command: longCmd });
20
+ // Format: "$ <60 chars>…" — total ~63 chars
21
+ expect(result.startsWith("$")).toBe(true);
22
+ expect(result.length).toBeLessThan(70);
23
+ expect(result.endsWith("…")).toBe(true);
24
+ });
25
+
26
+ it("formats short Bash commands", () => {
27
+ expect(formatToolCall("Bash", { command: "ls -la" })).toBe("$ ls -la");
28
+ });
29
+
30
+ it("formats Edit tool call", () => {
31
+ expect(formatToolCall("Edit", { path: "/tmp/foo.ts" })).toBe("edit /tmp/foo.ts");
32
+ });
33
+
34
+ it("formats Write tool call", () => {
35
+ expect(formatToolCall("Write", { path: "/tmp/foo.ts" })).toBe("write /tmp/foo.ts");
36
+ });
37
+
38
+ it("falls back to JSON for unknown tools", () => {
39
+ expect(formatToolCall("UnknownTool", { arg: "val" })).toBe('UnknownTool {"arg":"val"}');
40
+ });
41
+
42
+ it("truncates long JSON for unknown tools", () => {
43
+ const longVal = "x".repeat(80);
44
+ const result = formatToolCall("UnknownTool", { val: longVal });
45
+ expect(result.endsWith("…")).toBe(true);
46
+ expect(result.length).toBeLessThan(70);
47
+ });
48
+
49
+ it("handles missing path/command gracefully", () => {
50
+ expect(formatToolCall("Read", {})).toBe("read ...");
51
+ expect(formatToolCall("Bash", {})).toBe("$ ...");
52
+ });
53
+ });