From fb97d4cb72d0a90dde102b7001603716ee6e4c3b Mon Sep 17 00:00:00 2001 From: Adam Malczewski Date: Fri, 22 May 2026 00:19:14 +0900 Subject: 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 --- packages/core/tests/agent/agent.test.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'packages/core/tests') 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 { return { model: "test-model", -- cgit v1.2.3