fix(coding-agent): unify source provenance, closes #1734

This commit is contained in:
Mario Zechner
2026-03-23 02:02:42 +01:00
parent 883862a354
commit 4e5af01d73
26 changed files with 340 additions and 157 deletions

View File

@@ -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,
});
}

View File

@@ -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;
}
// ============================================================================