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

@@ -60,10 +60,10 @@ export default function commandsExtension(pi: ExtensionAPI) {
if (selected && !selected.startsWith("---")) {
const cmdName = selected.split(" - ")[0].slice(1); // Remove leading /
const cmd = commands.find((c) => c.name === cmdName);
if (cmd?.path) {
const showPath = await ctx.ui.confirm(cmd.name, `View source path?\n${cmd.path}`);
if (cmd?.sourceInfo.path) {
const showPath = await ctx.ui.confirm(cmd.name, `View source path?\n${cmd.sourceInfo.path}`);
if (showPath) {
ctx.ui.notify(cmd.path, "info");
ctx.ui.notify(cmd.sourceInfo.path, "info");
}
}
}

View File

@@ -5,7 +5,13 @@
* Discover, filter, merge, or replace them.
*/
import { createAgentSession, DefaultResourceLoader, SessionManager, type Skill } from "@mariozechner/pi-coding-agent";
import {
createAgentSession,
createSyntheticSourceInfo,
DefaultResourceLoader,
SessionManager,
type Skill,
} from "@mariozechner/pi-coding-agent";
// Or define custom skills inline
const customSkill: Skill = {
@@ -13,7 +19,7 @@ const customSkill: Skill = {
description: "Custom project instructions",
filePath: "/virtual/SKILL.md",
baseDir: "/virtual",
source: "path",
sourceInfo: createSyntheticSourceInfo("/virtual/SKILL.md", { source: "sdk" }),
disableModelInvocation: false,
};

View File

@@ -6,6 +6,7 @@
import {
createAgentSession,
createSyntheticSourceInfo,
DefaultResourceLoader,
type PromptTemplate,
SessionManager,
@@ -15,8 +16,8 @@ import {
const deployTemplate: PromptTemplate = {
name: "deploy",
description: "Deploy the application",
source: "path",
filePath: "/virtual/prompts/deploy.md",
sourceInfo: createSyntheticSourceInfo("/virtual/prompts/deploy.md", { source: "sdk" }),
content: `# Deploy Instructions
1. Build: npm run build