summaryrefslogtreecommitdiffhomepage
path: root/packages/core/tests
diff options
context:
space:
mode:
authorAdam Malczewski <[email protected]>2026-05-22 00:19:14 +0900
committerAdam Malczewski <[email protected]>2026-05-22 00:19:14 +0900
commitfb97d4cb72d0a90dde102b7001603716ee6e4c3b (patch)
tree55c6e8b56b3395008523ab94c16c4f526083d846 /packages/core/tests
parent7884709e3b2adb1b65c1c086257e0300eed51cee (diff)
downloaddispatch-fb97d4cb72d0a90dde102b7001603716ee6e4c3b.tar.gz
dispatch-fb97d4cb72d0a90dde102b7001603716ee6e4c3b.zip
feat: agent summoning system, todo improvements, security fixes, double-execution bug fix
- Add summon/retrieve tools for spawning child agents in new tabs - summon: non-blocking, returns agent_id immediately - retrieve: blocking, waits for child to finish, returns result - Child tools are intersected with parent permissions (no privilege escalation) - Working directory validated to stay within workspace - Abort controller stops orphaned agents on tab close - Rename task_list tool to todo with comprehensive usage guidance in system prompt - Rename PermissionLog.svelte to ToolPermissions.svelte - Add 'Summon agents' toggle to tool permissions UI - Redesign TaskListPanel with DaisyUI checkboxes (indeterminate for in-progress) - Remove 'blocked' status from task system - Add tab-created WebSocket event for child agent tab visibility - Add HMR cleanup for WebSocket connections (close stale connections on hot reload) - Fix ensureAssistantMessage to not throw on closed tabs - Fix double tool execution: remove execute from AI SDK tool() in registry.ts (agent.ts already executes tools manually via executeToolWithStreaming) - Fix all pre-existing test failures (missing mocks, stale API signatures) - Add debug info to copy button (tab ID, injected skills, all tab IDs) - Add tab ID and tools to conversation copy output
Diffstat (limited to 'packages/core/tests')
-rw-r--r--packages/core/tests/agent/agent.test.ts14
1 files changed, 13 insertions, 1 deletions
diff --git a/packages/core/tests/agent/agent.test.ts b/packages/core/tests/agent/agent.test.ts
index 5be210a..be5272f 100644
--- a/packages/core/tests/agent/agent.test.ts
+++ b/packages/core/tests/agent/agent.test.ts
@@ -1,8 +1,18 @@
import { describe, expect, it, vi } from "vitest";
import { z } from "zod";
-import { Agent } from "../../src/agent/agent.js";
import type { AgentConfig } from "../../src/types/index.js";
+// Mock bun:sqlite to avoid Bun-only import in vitest/Node
+vi.mock("../../src/db/index.js", () => ({
+ getDatabase: vi.fn(() => ({})),
+}));
+
+// Mock the credentials module that depends on the DB
+vi.mock("../../src/credentials/claude.js", () => ({
+ buildBillingHeaderValue: vi.fn(() => ""),
+ SYSTEM_IDENTITY: "You are a test agent.",
+}));
+
// Mock the ai module's streamText
vi.mock("ai", async () => {
const actual = await import("ai");
@@ -20,6 +30,8 @@ vi.mock("@ai-sdk/openai-compatible", () => ({
})),
}));
+const { Agent } = await import("../../src/agent/agent.js");
+
function makeConfig(overrides: Partial<AgentConfig> = {}): AgentConfig {
return {
model: "test-model",