fix(coding-agent): unify source provenance, closes #1734
This commit is contained in:
@@ -333,7 +333,7 @@ export class InteractiveMode {
|
||||
.map((command) => ({
|
||||
type: "warning" as const,
|
||||
message: `Extension command '/${command.name}' conflicts with built-in interactive command. Skipping in autocomplete.`,
|
||||
path: command.extensionPath,
|
||||
path: command.sourceInfo.path,
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
@@ -544,35 +544,30 @@ export async function runRpcMode(session: AgentSession): Promise<never> {
|
||||
case "get_commands": {
|
||||
const commands: RpcSlashCommand[] = [];
|
||||
|
||||
// Extension commands
|
||||
for (const command of session.extensionRunner?.getRegisteredCommands() ?? []) {
|
||||
commands.push({
|
||||
name: command.name,
|
||||
description: command.description,
|
||||
source: "extension",
|
||||
path: command.extensionPath,
|
||||
sourceInfo: command.sourceInfo,
|
||||
});
|
||||
}
|
||||
|
||||
// Prompt templates (source is always "user" | "project" | "path" in coding-agent)
|
||||
for (const template of session.promptTemplates) {
|
||||
commands.push({
|
||||
name: template.name,
|
||||
description: template.description,
|
||||
source: "prompt",
|
||||
location: template.source as RpcSlashCommand["location"],
|
||||
path: template.filePath,
|
||||
sourceInfo: template.sourceInfo,
|
||||
});
|
||||
}
|
||||
|
||||
// Skills (source is always "user" | "project" | "path" in coding-agent)
|
||||
for (const skill of session.resourceLoader.getSkills().skills) {
|
||||
commands.push({
|
||||
name: `skill:${skill.name}`,
|
||||
description: skill.description,
|
||||
source: "skill",
|
||||
location: skill.source as RpcSlashCommand["location"],
|
||||
path: skill.filePath,
|
||||
sourceInfo: skill.sourceInfo,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import type { ImageContent, Model } from "@mariozechner/pi-ai";
|
||||
import type { SessionStats } from "../../core/agent-session.js";
|
||||
import type { BashResult } from "../../core/bash-executor.js";
|
||||
import type { CompactionResult } from "../../core/compaction/index.js";
|
||||
import type { SourceInfo } from "../../core/source-info.js";
|
||||
|
||||
// ============================================================================
|
||||
// RPC Commands (stdin)
|
||||
@@ -78,10 +79,8 @@ export interface RpcSlashCommand {
|
||||
description?: string;
|
||||
/** What kind of command this is */
|
||||
source: "extension" | "prompt" | "skill";
|
||||
/** Where the command was loaded from (undefined for extensions) */
|
||||
location?: "user" | "project" | "path";
|
||||
/** File path to the command source */
|
||||
path?: string;
|
||||
/** Source metadata for the owning resource */
|
||||
sourceInfo: SourceInfo;
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
|
||||
Reference in New Issue
Block a user