diff --git a/packages/appkit/src/core/create-agent.ts b/packages/appkit/src/core/create-agent.ts index 23fdb184..9fad2547 100644 --- a/packages/appkit/src/core/create-agent.ts +++ b/packages/appkit/src/core/create-agent.ts @@ -7,8 +7,8 @@ import type { PluginData, } from "shared"; import { agent } from "../plugins/agent"; -import type { FunctionTool } from "../plugins/agent/tools/function-tool"; import type { AgentTool } from "../plugins/agent/types"; +import type { FunctionTool } from "../plugins/agents/tools/function-tool"; import { server } from "../plugins/server"; import type { TelemetryConfig } from "../telemetry"; import { createApp } from "./appkit"; diff --git a/packages/appkit/src/core/run-agent.ts b/packages/appkit/src/core/run-agent.ts index 2082e70c..e83c2c9c 100644 --- a/packages/appkit/src/core/run-agent.ts +++ b/packages/appkit/src/core/run-agent.ts @@ -9,8 +9,8 @@ import { type FunctionTool, functionToolToDefinition, isFunctionTool, -} from "../plugins/agent/tools/function-tool"; -import { isHostedTool } from "../plugins/agent/tools/hosted-tools"; +} from "../plugins/agents/tools/function-tool"; +import { isHostedTool } from "../plugins/agents/tools/hosted-tools"; import type { AgentDefinition, AgentTool, diff --git a/packages/appkit/src/index.ts b/packages/appkit/src/index.ts index 28743d4c..654e3fbc 100644 --- a/packages/appkit/src/index.ts +++ b/packages/appkit/src/index.ts @@ -88,15 +88,6 @@ export { server, serving, } from "./plugins"; -export { - type FunctionTool, - type HostedTool, - isFunctionTool, - isHostedTool, - mcpServer, - type ToolConfig, - tool, -} from "./plugins/agent/tools"; export { type AgentDefinition, type AgentsPluginConfig, @@ -110,6 +101,15 @@ export { type ToolkitEntry, type ToolkitOptions, } from "./plugins/agents"; +export { + type FunctionTool, + type HostedTool, + isFunctionTool, + isHostedTool, + mcpServer, + type ToolConfig, + tool, +} from "./plugins/agents/tools"; export type { EndpointConfig, ServingEndpointEntry, diff --git a/packages/appkit/src/plugins/agent/agent.ts b/packages/appkit/src/plugins/agent/agent.ts index 4fee598c..295541be 100644 --- a/packages/appkit/src/plugins/agent/agent.ts +++ b/packages/appkit/src/plugins/agent/agent.ts @@ -13,13 +13,14 @@ import type { import { createLogger } from "../../logging/logger"; import { Plugin, toPlugin } from "../../plugin"; import type { PluginManifest } from "../../registry"; -import { loadAgentConfigs } from "./config-loader"; -import { agentStreamDefaults } from "./defaults"; -import { AgentEventTranslator } from "./event-translator"; -import manifest from "./manifest.json"; -import { chatRequestSchema, invocationsRequestSchema } from "./schemas"; -import { buildBaseSystemPrompt, composeSystemPrompt } from "./system-prompt"; -import { InMemoryThreadStore } from "./thread-store"; +import { agentStreamDefaults } from "../agents/defaults"; +import { AgentEventTranslator } from "../agents/event-translator"; +import { chatRequestSchema, invocationsRequestSchema } from "../agents/schemas"; +import { + buildBaseSystemPrompt, + composeSystemPrompt, +} from "../agents/system-prompt"; +import { InMemoryThreadStore } from "../agents/thread-store"; import { AppKitMcpClient, type FunctionTool, @@ -27,7 +28,9 @@ import { isFunctionTool, isHostedTool, resolveHostedTools, -} from "./tools"; +} from "../agents/tools"; +import { loadAgentConfigs } from "./config-loader"; +import manifest from "./manifest.json"; import type { AgentPluginConfig, RegisteredAgent, ToolEntry } from "./types"; const logger = createLogger("agent"); @@ -254,7 +257,7 @@ export class AgentPlugin extends Plugin { } private async connectHostedTools( - hostedTools: import("./tools/hosted-tools").HostedTool[], + hostedTools: import("../agents/tools/hosted-tools").HostedTool[], ) { let host: string | undefined; let authenticate: () => Promise>; diff --git a/packages/appkit/src/plugins/agent/types.ts b/packages/appkit/src/plugins/agent/types.ts index 5ab8fc91..58acf5ea 100644 --- a/packages/appkit/src/plugins/agent/types.ts +++ b/packages/appkit/src/plugins/agent/types.ts @@ -4,8 +4,8 @@ import type { BasePluginConfig, ThreadStore, } from "shared"; -import type { FunctionTool } from "./tools/function-tool"; -import type { HostedTool } from "./tools/hosted-tools"; +import type { FunctionTool } from "../agents/tools/function-tool"; +import type { HostedTool } from "../agents/tools/hosted-tools"; export type AgentTool = FunctionTool | HostedTool; diff --git a/packages/appkit/src/plugins/agents/agents.ts b/packages/appkit/src/plugins/agents/agents.ts index cf4c4fdb..03b9257c 100644 --- a/packages/appkit/src/plugins/agents/agents.ts +++ b/packages/appkit/src/plugins/agents/agents.ts @@ -17,14 +17,13 @@ import type { import { createLogger } from "../../logging/logger"; import { Plugin, toPlugin } from "../../plugin"; import type { PluginManifest } from "../../registry"; -import { agentStreamDefaults } from "../agent/defaults"; -import { AgentEventTranslator } from "../agent/event-translator"; -import { chatRequestSchema, invocationsRequestSchema } from "../agent/schemas"; -import { - buildBaseSystemPrompt, - composeSystemPrompt, -} from "../agent/system-prompt"; -import { InMemoryThreadStore } from "../agent/thread-store"; +import { agentStreamDefaults } from "./defaults"; +import { AgentEventTranslator } from "./event-translator"; +import { loadAgentsFromDir } from "./load-agents"; +import manifest from "./manifest.json"; +import { chatRequestSchema, invocationsRequestSchema } from "./schemas"; +import { buildBaseSystemPrompt, composeSystemPrompt } from "./system-prompt"; +import { InMemoryThreadStore } from "./thread-store"; import { AppKitMcpClient, type FunctionTool, @@ -32,9 +31,7 @@ import { isFunctionTool, isHostedTool, resolveHostedTools, -} from "../agent/tools"; -import { loadAgentsFromDir } from "./load-agents"; -import manifest from "./manifest.json"; +} from "./tools"; import type { AgentDefinition, AgentsPluginConfig, @@ -296,8 +293,7 @@ export class AgentsPlugin extends Plugin implements ToolProvider { } // 2. Explicit tools (toolkit entries, function tools, hosted tools) - const hostedToCollect: import("../agent/tools/hosted-tools").HostedTool[] = - []; + const hostedToCollect: import("./tools/hosted-tools").HostedTool[] = []; for (const [key, tool] of Object.entries(def.tools ?? {})) { if (isToolkitEntry(tool)) { index.set(key, { @@ -381,7 +377,7 @@ export class AgentsPlugin extends Plugin implements ToolProvider { } private async connectHostedTools( - hostedTools: import("../agent/tools/hosted-tools").HostedTool[], + hostedTools: import("./tools/hosted-tools").HostedTool[], index: Map, ): Promise { let host: string | undefined; diff --git a/packages/appkit/src/plugins/agents/build-toolkit.ts b/packages/appkit/src/plugins/agents/build-toolkit.ts index cc070251..aa1a0ff2 100644 --- a/packages/appkit/src/plugins/agents/build-toolkit.ts +++ b/packages/appkit/src/plugins/agents/build-toolkit.ts @@ -1,6 +1,6 @@ import type { AgentToolDefinition } from "shared"; import { toJSONSchema } from "zod"; -import type { ToolRegistry } from "../agent/tools/define-tool"; +import type { ToolRegistry } from "./tools/define-tool"; import type { ToolkitEntry, ToolkitOptions } from "./types"; /** diff --git a/packages/appkit/src/plugins/agent/defaults.ts b/packages/appkit/src/plugins/agents/defaults.ts similarity index 100% rename from packages/appkit/src/plugins/agent/defaults.ts rename to packages/appkit/src/plugins/agents/defaults.ts diff --git a/packages/appkit/src/plugins/agent/event-translator.ts b/packages/appkit/src/plugins/agents/event-translator.ts similarity index 100% rename from packages/appkit/src/plugins/agent/event-translator.ts rename to packages/appkit/src/plugins/agents/event-translator.ts diff --git a/packages/appkit/src/plugins/agent/schemas.ts b/packages/appkit/src/plugins/agents/schemas.ts similarity index 100% rename from packages/appkit/src/plugins/agent/schemas.ts rename to packages/appkit/src/plugins/agents/schemas.ts diff --git a/packages/appkit/src/plugins/agent/system-prompt.ts b/packages/appkit/src/plugins/agents/system-prompt.ts similarity index 100% rename from packages/appkit/src/plugins/agent/system-prompt.ts rename to packages/appkit/src/plugins/agents/system-prompt.ts diff --git a/packages/appkit/src/plugins/agents/tests/agents-plugin.test.ts b/packages/appkit/src/plugins/agents/tests/agents-plugin.test.ts index 0b549d68..8116551e 100644 --- a/packages/appkit/src/plugins/agents/tests/agents-plugin.test.ts +++ b/packages/appkit/src/plugins/agents/tests/agents-plugin.test.ts @@ -11,10 +11,10 @@ import type { import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; import { z } from "zod"; import { CacheManager } from "../../../cache"; -import { defineTool, type ToolRegistry } from "../../agent/tools/define-tool"; // Import the class directly so we can construct it without a createApp import { AgentsPlugin } from "../agents"; import { buildToolkitEntries } from "../build-toolkit"; +import { defineTool, type ToolRegistry } from "../tools/define-tool"; import type { AgentsPluginConfig, ToolkitEntry } from "../types"; import { isToolkitEntry } from "../types"; diff --git a/packages/appkit/src/plugins/agents/tests/build-toolkit.test.ts b/packages/appkit/src/plugins/agents/tests/build-toolkit.test.ts index 0525073e..b1b6a60c 100644 --- a/packages/appkit/src/plugins/agents/tests/build-toolkit.test.ts +++ b/packages/appkit/src/plugins/agents/tests/build-toolkit.test.ts @@ -1,7 +1,7 @@ import { describe, expect, test } from "vitest"; import { z } from "zod"; -import { defineTool, type ToolRegistry } from "../../agent/tools/define-tool"; import { buildToolkitEntries } from "../build-toolkit"; +import { defineTool, type ToolRegistry } from "../tools/define-tool"; import { isToolkitEntry } from "../types"; const registry: ToolRegistry = { diff --git a/packages/appkit/src/plugins/agents/tests/create-agent.test.ts b/packages/appkit/src/plugins/agents/tests/create-agent.test.ts index a6802a67..3822897f 100644 --- a/packages/appkit/src/plugins/agents/tests/create-agent.test.ts +++ b/packages/appkit/src/plugins/agents/tests/create-agent.test.ts @@ -1,7 +1,7 @@ import { describe, expect, test } from "vitest"; import { z } from "zod"; import { createAgent } from "../../../core/create-agent-def"; -import { tool } from "../../agent/tools/tool"; +import { tool } from "../tools/tool"; import type { AgentDefinition } from "../types"; describe("createAgent", () => { diff --git a/packages/appkit/src/plugins/agent/tests/define-tool.test.ts b/packages/appkit/src/plugins/agents/tests/define-tool.test.ts similarity index 100% rename from packages/appkit/src/plugins/agent/tests/define-tool.test.ts rename to packages/appkit/src/plugins/agents/tests/define-tool.test.ts diff --git a/packages/appkit/src/plugins/agent/tests/event-translator.test.ts b/packages/appkit/src/plugins/agents/tests/event-translator.test.ts similarity index 100% rename from packages/appkit/src/plugins/agent/tests/event-translator.test.ts rename to packages/appkit/src/plugins/agents/tests/event-translator.test.ts diff --git a/packages/appkit/src/plugins/agent/tests/function-tool.test.ts b/packages/appkit/src/plugins/agents/tests/function-tool.test.ts similarity index 100% rename from packages/appkit/src/plugins/agent/tests/function-tool.test.ts rename to packages/appkit/src/plugins/agents/tests/function-tool.test.ts diff --git a/packages/appkit/src/plugins/agent/tests/hosted-tools.test.ts b/packages/appkit/src/plugins/agents/tests/hosted-tools.test.ts similarity index 100% rename from packages/appkit/src/plugins/agent/tests/hosted-tools.test.ts rename to packages/appkit/src/plugins/agents/tests/hosted-tools.test.ts diff --git a/packages/appkit/src/plugins/agents/tests/load-agents.test.ts b/packages/appkit/src/plugins/agents/tests/load-agents.test.ts index ff2967ea..5a7b1253 100644 --- a/packages/appkit/src/plugins/agents/tests/load-agents.test.ts +++ b/packages/appkit/src/plugins/agents/tests/load-agents.test.ts @@ -3,14 +3,14 @@ import os from "node:os"; import path from "node:path"; import { afterEach, beforeEach, describe, expect, test } from "vitest"; import { z } from "zod"; -import { defineTool, type ToolRegistry } from "../../agent/tools/define-tool"; -import { tool } from "../../agent/tools/tool"; import { buildToolkitEntries } from "../build-toolkit"; import { loadAgentFromFile, loadAgentsFromDir, parseFrontmatter, } from "../load-agents"; +import { defineTool, type ToolRegistry } from "../tools/define-tool"; +import { tool } from "../tools/tool"; let workDir: string; diff --git a/packages/appkit/src/plugins/agent/tests/mcp-server-helper.test.ts b/packages/appkit/src/plugins/agents/tests/mcp-server-helper.test.ts similarity index 100% rename from packages/appkit/src/plugins/agent/tests/mcp-server-helper.test.ts rename to packages/appkit/src/plugins/agents/tests/mcp-server-helper.test.ts diff --git a/packages/appkit/src/plugins/agents/tests/run-agent.test.ts b/packages/appkit/src/plugins/agents/tests/run-agent.test.ts index d933000c..1a974811 100644 --- a/packages/appkit/src/plugins/agents/tests/run-agent.test.ts +++ b/packages/appkit/src/plugins/agents/tests/run-agent.test.ts @@ -8,7 +8,7 @@ import { describe, expect, test, vi } from "vitest"; import { z } from "zod"; import { createAgent } from "../../../core/create-agent-def"; import { runAgent } from "../../../core/run-agent"; -import { tool } from "../../agent/tools/tool"; +import { tool } from "../tools/tool"; import type { ToolkitEntry } from "../types"; function scriptedAdapter(events: AgentEvent[]): AgentAdapter { diff --git a/packages/appkit/src/plugins/agent/tests/system-prompt.test.ts b/packages/appkit/src/plugins/agents/tests/system-prompt.test.ts similarity index 100% rename from packages/appkit/src/plugins/agent/tests/system-prompt.test.ts rename to packages/appkit/src/plugins/agents/tests/system-prompt.test.ts diff --git a/packages/appkit/src/plugins/agent/tests/thread-store.test.ts b/packages/appkit/src/plugins/agents/tests/thread-store.test.ts similarity index 100% rename from packages/appkit/src/plugins/agent/tests/thread-store.test.ts rename to packages/appkit/src/plugins/agents/tests/thread-store.test.ts diff --git a/packages/appkit/src/plugins/agent/tests/tool.test.ts b/packages/appkit/src/plugins/agents/tests/tool.test.ts similarity index 100% rename from packages/appkit/src/plugins/agent/tests/tool.test.ts rename to packages/appkit/src/plugins/agents/tests/tool.test.ts diff --git a/packages/appkit/src/plugins/agent/thread-store.ts b/packages/appkit/src/plugins/agents/thread-store.ts similarity index 100% rename from packages/appkit/src/plugins/agent/thread-store.ts rename to packages/appkit/src/plugins/agents/thread-store.ts diff --git a/packages/appkit/src/plugins/agent/tools/define-tool.ts b/packages/appkit/src/plugins/agents/tools/define-tool.ts similarity index 100% rename from packages/appkit/src/plugins/agent/tools/define-tool.ts rename to packages/appkit/src/plugins/agents/tools/define-tool.ts diff --git a/packages/appkit/src/plugins/agent/tools/function-tool.ts b/packages/appkit/src/plugins/agents/tools/function-tool.ts similarity index 100% rename from packages/appkit/src/plugins/agent/tools/function-tool.ts rename to packages/appkit/src/plugins/agents/tools/function-tool.ts diff --git a/packages/appkit/src/plugins/agent/tools/hosted-tools.ts b/packages/appkit/src/plugins/agents/tools/hosted-tools.ts similarity index 100% rename from packages/appkit/src/plugins/agent/tools/hosted-tools.ts rename to packages/appkit/src/plugins/agents/tools/hosted-tools.ts diff --git a/packages/appkit/src/plugins/agent/tools/index.ts b/packages/appkit/src/plugins/agents/tools/index.ts similarity index 100% rename from packages/appkit/src/plugins/agent/tools/index.ts rename to packages/appkit/src/plugins/agents/tools/index.ts diff --git a/packages/appkit/src/plugins/agent/tools/mcp-client.ts b/packages/appkit/src/plugins/agents/tools/mcp-client.ts similarity index 100% rename from packages/appkit/src/plugins/agent/tools/mcp-client.ts rename to packages/appkit/src/plugins/agents/tools/mcp-client.ts diff --git a/packages/appkit/src/plugins/agent/tools/tool.ts b/packages/appkit/src/plugins/agents/tools/tool.ts similarity index 100% rename from packages/appkit/src/plugins/agent/tools/tool.ts rename to packages/appkit/src/plugins/agents/tools/tool.ts diff --git a/packages/appkit/src/plugins/agents/types.ts b/packages/appkit/src/plugins/agents/types.ts index e343751b..4963a52a 100644 --- a/packages/appkit/src/plugins/agents/types.ts +++ b/packages/appkit/src/plugins/agents/types.ts @@ -5,8 +5,8 @@ import type { ThreadStore, ToolAnnotations, } from "shared"; -import type { FunctionTool } from "../agent/tools/function-tool"; -import type { HostedTool } from "../agent/tools/hosted-tools"; +import type { FunctionTool } from "./tools/function-tool"; +import type { HostedTool } from "./tools/hosted-tools"; /** * A tool reference produced by a plugin's `.toolkit()` call. The agents plugin diff --git a/packages/appkit/src/plugins/analytics/analytics.ts b/packages/appkit/src/plugins/analytics/analytics.ts index 8e77967b..f175121a 100644 --- a/packages/appkit/src/plugins/analytics/analytics.ts +++ b/packages/appkit/src/plugins/analytics/analytics.ts @@ -14,12 +14,12 @@ import { getWarehouseId, getWorkspaceClient } from "../../context"; import { createLogger } from "../../logging/logger"; import { Plugin, toPluginWithInstance } from "../../plugin"; import type { PluginManifest } from "../../registry"; +import { buildToolkitEntries } from "../agents/build-toolkit"; import { defineTool, executeFromRegistry, toolsFromRegistry, -} from "../agent/tools/define-tool"; -import { buildToolkitEntries } from "../agents/build-toolkit"; +} from "../agents/tools/define-tool"; import { queryDefaults } from "./defaults"; import manifest from "./manifest.json"; import { QueryProcessor } from "./query"; diff --git a/packages/appkit/src/plugins/files/plugin.ts b/packages/appkit/src/plugins/files/plugin.ts index 19fdeea1..7f538e45 100644 --- a/packages/appkit/src/plugins/files/plugin.ts +++ b/packages/appkit/src/plugins/files/plugin.ts @@ -21,13 +21,13 @@ import { createLogger } from "../../logging/logger"; import { Plugin, toPluginWithInstance } from "../../plugin"; import type { PluginManifest, ResourceRequirement } from "../../registry"; import { ResourceType } from "../../registry"; +import { buildToolkitEntries } from "../agents/build-toolkit"; import { defineTool, executeFromRegistry, type ToolRegistry, toolsFromRegistry, -} from "../agent/tools/define-tool"; -import { buildToolkitEntries } from "../agents/build-toolkit"; +} from "../agents/tools/define-tool"; import { FILES_DOWNLOAD_DEFAULTS, FILES_MAX_UPLOAD_SIZE, diff --git a/packages/appkit/src/plugins/genie/genie.ts b/packages/appkit/src/plugins/genie/genie.ts index 318c8925..18b339d6 100644 --- a/packages/appkit/src/plugins/genie/genie.ts +++ b/packages/appkit/src/plugins/genie/genie.ts @@ -12,13 +12,13 @@ import { getWorkspaceClient } from "../../context"; import { createLogger } from "../../logging"; import { Plugin, toPluginWithInstance } from "../../plugin"; import type { PluginManifest } from "../../registry"; +import { buildToolkitEntries } from "../agents/build-toolkit"; import { defineTool, executeFromRegistry, type ToolRegistry, toolsFromRegistry, -} from "../agent/tools/define-tool"; -import { buildToolkitEntries } from "../agents/build-toolkit"; +} from "../agents/tools/define-tool"; import { genieStreamDefaults } from "./defaults"; import manifest from "./manifest.json"; import type { diff --git a/packages/appkit/src/plugins/lakebase/lakebase.ts b/packages/appkit/src/plugins/lakebase/lakebase.ts index 56df8333..c940c6e8 100644 --- a/packages/appkit/src/plugins/lakebase/lakebase.ts +++ b/packages/appkit/src/plugins/lakebase/lakebase.ts @@ -10,12 +10,12 @@ import { import { createLogger } from "../../logging/logger"; import { Plugin, toPluginWithInstance } from "../../plugin"; import type { PluginManifest } from "../../registry"; +import { buildToolkitEntries } from "../agents/build-toolkit"; import { defineTool, executeFromRegistry, toolsFromRegistry, -} from "../agent/tools/define-tool"; -import { buildToolkitEntries } from "../agents/build-toolkit"; +} from "../agents/tools/define-tool"; import manifest from "./manifest.json"; import type { ILakebaseConfig } from "./types"; diff --git a/template/appkit.plugins.json b/template/appkit.plugins.json index 1d891256..9d113b0d 100644 --- a/template/appkit.plugins.json +++ b/template/appkit.plugins.json @@ -2,10 +2,10 @@ "$schema": "https://databricks.github.io/appkit/schemas/template-plugins.schema.json", "version": "1.0", "plugins": { - "agent": { - "name": "agent", - "displayName": "Agent Plugin", - "description": "Framework-agnostic AI agent with auto-tool-discovery from all registered plugins", + "agents": { + "name": "agents", + "displayName": "Agents Plugin", + "description": "AI agents driven by markdown configs or code, with auto-tool-discovery from registered plugins", "package": "@databricks/appkit", "resources": { "required": [],