Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/sdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
29 changes: 1 addition & 28 deletions packages/sdk/src/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -288,7 +286,6 @@ export class Agent {
private pluginSkillNames = new Set<string>()
private explicitSkillNames = new Set<string>()
private fileSkillNames = new Set<string>()
private loadedCommands: CommandDefinition[] = []
private fileCheckpointState: FileCheckpointState = {}
private latestUserMessageId: string | undefined
private lastContextUsage: ContextUsageResult | null = null
Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -609,10 +599,6 @@ export class Agent {
shouldLoadSkill: this.cfg.shouldLoadFilesystemSkill,
})
this.registerExplicitSkills()
this.loadedCommands = [
...(await loadCommandDefinitions(cwd)),
...this.getPluginCommands(),
]
this.resetHookRegistry()

const mergedAgents = {
Expand Down Expand Up @@ -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<string, SlashCommand>()
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<InitializationResult> {
Expand Down Expand Up @@ -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()

Expand Down
17 changes: 0 additions & 17 deletions packages/sdk/src/commands/fs-loader.ts

This file was deleted.

7 changes: 0 additions & 7 deletions packages/sdk/src/commands/types.ts

This file was deleted.

12 changes: 0 additions & 12 deletions packages/sdk/src/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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]
Expand Down
7 changes: 1 addition & 6 deletions packages/sdk/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'

// --------------------------------------------------------------------------
Expand Down
4 changes: 0 additions & 4 deletions packages/sdk/src/plugins/loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand All @@ -35,7 +34,6 @@ export interface LoadedPlugin {
hooks?: HookConfig
mcpServers?: Record<string, unknown>
skills?: SkillDefinition[]
commands?: CommandDefinition[]
config?: Record<string, unknown>
lume?: { hooksOnly?: boolean }
}
Expand Down Expand Up @@ -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,
}
Expand Down Expand Up @@ -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)
Expand Down
Loading