diff --git a/packages/sdk/README.md b/packages/sdk/README.md index 97a7e5eeb..f4e8b2205 100644 --- a/packages/sdk/README.md +++ b/packages/sdk/README.md @@ -179,7 +179,7 @@ const hooks = createHookRegistry({ }); ``` -28 lifecycle events including `PreToolUse`, `PostToolUse`, `PostToolUseFailure`, `Setup`, `SessionStart`, `SessionEnd`, `Stop`, `StopFailure`, `SubagentStart`, `SubagentStop`, `UserPromptSubmit`, `PermissionRequest`, `PermissionDenied`, `TaskCreated`, `TaskCompleted`, `ConfigChange`, `WorktreeCreate`, `WorktreeRemove`, `CwdChanged`, `FileChanged`, `Notification`, `PreCompact`, `PostCompact`, `TeammateIdle`, `Elicitation`, `ElicitationResult`, and `InstructionsLoaded`. +18 lifecycle events including `PreToolUse`, `PostToolUse`, `PostToolUseFailure`, `Setup`, `SessionStart`, `SessionEnd`, `Stop`, `StopFailure`, `SubagentStart`, `SubagentStop`, `UserPromptSubmit`, `PermissionRequest`, `PermissionDenied`, `TaskCreated`, `TaskCompleted`, `ConfigChange`, `PreCompact`, and `PostCompact`. ### Subagents diff --git a/packages/sdk/src/agent.ts b/packages/sdk/src/agent.ts index 7d3957ae3..42ea80968 100644 --- a/packages/sdk/src/agent.ts +++ b/packages/sdk/src/agent.ts @@ -56,8 +56,6 @@ import { import { QueryController } from './query-controller.js' import { loadPlugins, type LoadedPlugin } from './plugins/loader.js' import { loadFilesystemSkills } from './skills/fs-loader.js' -import { loadCommandDefinitions, commandDefinitionsToSlashCommands } from './commands/fs-loader.js' -import type { CommandDefinition } from './commands/types.js' import type { FileCheckpoint, FileCheckpointState } from './utils/file-checkpoints.js' import { rewindCheckpoint } from './utils/file-checkpoints.js' import { getContextWindowSize } from './utils/tokens.js' @@ -288,7 +286,6 @@ export class Agent { private pluginSkillNames = new Set() private explicitSkillNames = new Set() private fileSkillNames = new Set() - private loadedCommands: CommandDefinition[] = [] private fileCheckpointState: FileCheckpointState = {} private latestUserMessageId: string | undefined private lastContextUsage: ContextUsageResult | null = null @@ -427,13 +424,6 @@ export class Agent { }) } - private getPluginCommands(): CommandDefinition[] { - return this.loadedPlugins.flatMap((plugin) => { - if (plugin.lume?.hooksOnly) return [] - return plugin.commands || [] - }) - } - private buildBaseToolPool(options: AgentOptions = this.cfg): ToolDefinition[] { const pluginTools = this.getPluginTools() const bindSkillRegistry = (tool: ToolDefinition) => tool.name === 'Skill' @@ -609,10 +599,6 @@ export class Agent { shouldLoadSkill: this.cfg.shouldLoadFilesystemSkill, }) this.registerExplicitSkills() - this.loadedCommands = [ - ...(await loadCommandDefinitions(cwd)), - ...this.getPluginCommands(), - ] this.resetHookRegistry() const mergedAgents = { @@ -1291,16 +1277,7 @@ export class Agent { { name: '/mcp', description: 'Inspect MCP server status' }, { name: '/reload-plugins', description: 'Reload plugins from disk' }, ] - const fileAndPluginCommands = commandDefinitionsToSlashCommands(this.loadedCommands) - const byName = new Map() - for (const command of [...builtins, ...fileAndPluginCommands]) { - byName.set(command.name, { - name: command.name, - description: command.description, - ...(command.argumentHint ? { argumentHint: command.argumentHint } : {}), - }) - } - return Array.from(byName.values()) + return builtins } async getInitializationResult(): Promise { @@ -1410,10 +1387,6 @@ export class Agent { shouldLoadSkill: this.cfg.shouldLoadFilesystemSkill, }) this.registerExplicitSkills() - this.loadedCommands = [ - ...(await loadCommandDefinitions(this.cfg.cwd || process.cwd())), - ...this.getPluginCommands(), - ] this.resetHookRegistry() await this.rebuildToolPool() diff --git a/packages/sdk/src/commands/fs-loader.ts b/packages/sdk/src/commands/fs-loader.ts deleted file mode 100644 index f0912da21..000000000 --- a/packages/sdk/src/commands/fs-loader.ts +++ /dev/null @@ -1,17 +0,0 @@ -import type { CommandDefinition } from './types.js' - -export async function loadCommandDefinitions( - _cwd: string, -): Promise { - return [] -} - -export function commandDefinitionsToSlashCommands( - commands: CommandDefinition[], -) { - return commands.map((command) => ({ - name: `/${command.name}`, - description: command.description, - argumentHint: command.argumentHint, - })) -} diff --git a/packages/sdk/src/commands/types.ts b/packages/sdk/src/commands/types.ts deleted file mode 100644 index 753c7ba2c..000000000 --- a/packages/sdk/src/commands/types.ts +++ /dev/null @@ -1,7 +0,0 @@ -export interface CommandDefinition { - name: string - description: string - argumentHint?: string - source?: string - path?: string -} diff --git a/packages/sdk/src/hooks.ts b/packages/sdk/src/hooks.ts index 1b00a4eb9..4f7408b4e 100644 --- a/packages/sdk/src/hooks.ts +++ b/packages/sdk/src/hooks.ts @@ -18,9 +18,6 @@ * - TaskCreated: task created * - TaskCompleted: task finished * - ConfigChange: settings changed - * - CwdChanged: working directory changed - * - FileChanged: file modified - * - Notification: system notification */ import { spawn } from 'child_process' @@ -51,17 +48,8 @@ export const HOOK_EVENTS = [ 'TaskCreated', 'TaskCompleted', 'ConfigChange', - 'WorktreeCreate', - 'WorktreeRemove', - 'CwdChanged', - 'FileChanged', - 'Notification', 'PreCompact', 'PostCompact', - 'TeammateIdle', - 'Elicitation', - 'ElicitationResult', - 'InstructionsLoaded', ] as const export type HookEvent = typeof HOOK_EVENTS[number] diff --git a/packages/sdk/src/index.ts b/packages/sdk/src/index.ts index 5279bb815..f7d3ce564 100644 --- a/packages/sdk/src/index.ts +++ b/packages/sdk/src/index.ts @@ -168,14 +168,9 @@ export type { } from './mcp/manager.js' // -------------------------------------------------------------------------- -// Slash Commands +// Skills // -------------------------------------------------------------------------- -export { - loadCommandDefinitions, - commandDefinitionsToSlashCommands, -} from './commands/fs-loader.js' -export type { CommandDefinition } from './commands/types.js' export { loadFilesystemSkills } from './skills/fs-loader.js' // -------------------------------------------------------------------------- diff --git a/packages/sdk/src/plugins/loader.ts b/packages/sdk/src/plugins/loader.ts index 322592a9f..8acfc2f49 100644 --- a/packages/sdk/src/plugins/loader.ts +++ b/packages/sdk/src/plugins/loader.ts @@ -12,7 +12,6 @@ import type { } from '../types.js' import type { HookConfig, HookDefinition } from '../hooks.js' import type { SkillDefinition } from '../skills/types.js' -import type { CommandDefinition } from '../commands/types.js' import type { CommandToolContribution } from './normalized.js' import { spawnWithProcessSandbox } from '../utils/process-sandbox.js' @@ -35,7 +34,6 @@ export interface LoadedPlugin { hooks?: HookConfig mcpServers?: Record skills?: SkillDefinition[] - commands?: CommandDefinition[] config?: Record lume?: { hooksOnly?: boolean } } @@ -448,7 +446,6 @@ export async function loadPlugins( hooks: await resolveHooksConfig(manifest.hooks, pluginPath), mcpServers: manifest.mcpServers, skills: manifest.skills, - commands: manifest.commands, config: spec.config, lume: manifest.lume, } @@ -512,7 +509,6 @@ export async function loadPlugins( hasMcpServers: !!plugin.mcpServers, hasSkills: !!(plugin.skills?.length), hasTools: !!(plugin.tools?.length), - hasCommands: !!(plugin.commands?.length), hooksOnly: plugin.lume?.hooksOnly ?? false, }); loaded.push(plugin)