fix(extensibility): added centralized session slash command discovery for extensions
- Added a shared session command helper that aggregates extension, prompt, and skill slash commands. - Updated ACP, extension UI, runtime-init, and task executor extension contexts to return session command data instead of empty arrays.
This commit is contained in:
@@ -49,6 +49,7 @@ import { Settings } from "../../config/settings";
|
||||
import { clearPluginRootsAndCaches, resolveActiveProjectRegistryPath } from "../../discovery/helpers";
|
||||
import type { ExtensionUIContext, ExtensionUIDialogOptions } from "../../extensibility/extensions";
|
||||
import { runExtensionCompact } from "../../extensibility/extensions/compact-handler";
|
||||
import { getSessionSlashCommands } from "../../extensibility/extensions/get-commands-handler";
|
||||
import { buildSkillPromptMessage, getSkillSlashCommandName } from "../../extensibility/skills";
|
||||
import { loadSlashCommands } from "../../extensibility/slash-commands";
|
||||
import { MCPManager } from "../../mcp/manager";
|
||||
@@ -1741,7 +1742,7 @@ export class AcpAgent implements Agent {
|
||||
getActiveTools: () => record.session.getActiveToolNames(),
|
||||
getAllTools: () => record.session.getAllToolNames(),
|
||||
setActiveTools: toolNames => record.session.setActiveToolsByName(toolNames),
|
||||
getCommands: () => [],
|
||||
getCommands: () => getSessionSlashCommands(record.session),
|
||||
setModel: async model => {
|
||||
const apiKey = await record.session.modelRegistry.getApiKey(model);
|
||||
if (!apiKey) {
|
||||
|
||||
@@ -16,6 +16,7 @@ import type {
|
||||
SendUserMessageHandler,
|
||||
TerminalInputHandler,
|
||||
} from "../../extensibility/extensions";
|
||||
import { getSessionSlashCommands } from "../../extensibility/extensions/get-commands-handler";
|
||||
import { HookEditorComponent } from "../../modes/components/hook-editor";
|
||||
import { HookInputComponent } from "../../modes/components/hook-input";
|
||||
import { HookSelectorComponent } from "../../modes/components/hook-selector";
|
||||
@@ -109,7 +110,7 @@ export class ExtensionUiController {
|
||||
},
|
||||
getThinkingLevel: () => this.ctx.session.thinkingLevel,
|
||||
setThinkingLevel: level => this.ctx.session.setThinkingLevel(level),
|
||||
getCommands: () => [],
|
||||
getCommands: () => getSessionSlashCommands(this.ctx.session),
|
||||
getSessionName: () => this.ctx.sessionManager.getSessionName(),
|
||||
setSessionName: name => this.#updateSessionName(name),
|
||||
};
|
||||
@@ -349,7 +350,7 @@ export class ExtensionUiController {
|
||||
},
|
||||
getThinkingLevel: () => this.ctx.session.thinkingLevel,
|
||||
setThinkingLevel: (level, persist) => this.ctx.session.setThinkingLevel(level, persist),
|
||||
getCommands: () => [],
|
||||
getCommands: () => getSessionSlashCommands(this.ctx.session),
|
||||
getSessionName: () => this.ctx.sessionManager.getSessionName(),
|
||||
setSessionName: name => this.#updateSessionName(name),
|
||||
};
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
* caller-supplied hooks.
|
||||
*/
|
||||
import { runExtensionCompact, runExtensionSetModel } from "../extensibility/extensions/compact-handler";
|
||||
import { getSessionSlashCommands } from "../extensibility/extensions/get-commands-handler";
|
||||
import type { ExtensionError, ExtensionUIContext } from "../extensibility/extensions/types";
|
||||
import type { AgentSession } from "../session/agent-session";
|
||||
|
||||
@@ -59,7 +60,7 @@ export async function initializeExtensions(session: AgentSession, options: Initi
|
||||
getActiveTools: () => session.getActiveToolNames(),
|
||||
getAllTools: () => session.getAllToolNames(),
|
||||
setActiveTools: (toolNames: string[]) => session.setActiveToolsByName(toolNames),
|
||||
getCommands: () => [],
|
||||
getCommands: () => getSessionSlashCommands(session),
|
||||
setModel: model => runExtensionSetModel(session, model),
|
||||
getThinkingLevel: () => session.thinkingLevel,
|
||||
setThinkingLevel: level => session.setThinkingLevel(level),
|
||||
|
||||
Reference in New Issue
Block a user