@victor-software-house/pi-acp 0.12.0 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -877,6 +877,7 @@ var PiAcpSession = class {
|
|
|
877
877
|
lastEmit = Promise.resolve();
|
|
878
878
|
unsubscribe;
|
|
879
879
|
cleanups;
|
|
880
|
+
pendingDiagnosticsReport;
|
|
880
881
|
constructor(opts) {
|
|
881
882
|
this.sessionId = opts.sessionId;
|
|
882
883
|
this.cwd = opts.cwd;
|
|
@@ -885,6 +886,7 @@ var PiAcpSession = class {
|
|
|
885
886
|
this.conn = opts.conn;
|
|
886
887
|
this.supportsTerminalOutput = opts.supportsTerminalOutput ?? false;
|
|
887
888
|
this.cleanups = opts.cleanups ?? [];
|
|
889
|
+
this.pendingDiagnosticsReport = opts.diagnosticsReport !== void 0 && opts.diagnosticsReport !== "" ? opts.diagnosticsReport : null;
|
|
888
890
|
this.unsubscribe = this.piSession.subscribe((ev) => this.handlePiEvent(ev));
|
|
889
891
|
}
|
|
890
892
|
dispose() {
|
|
@@ -930,6 +932,20 @@ var PiAcpSession = class {
|
|
|
930
932
|
};
|
|
931
933
|
});
|
|
932
934
|
const imageContents = Array.isArray(images) ? images.filter((img) => typeof img === "object" && img !== null && "type" in img && img.type === "image") : [];
|
|
935
|
+
if (this.pendingDiagnosticsReport !== null) {
|
|
936
|
+
const report = this.pendingDiagnosticsReport;
|
|
937
|
+
this.pendingDiagnosticsReport = null;
|
|
938
|
+
this.conn.sessionUpdate({
|
|
939
|
+
sessionId: this.sessionId,
|
|
940
|
+
update: {
|
|
941
|
+
sessionUpdate: "agent_message_chunk",
|
|
942
|
+
content: {
|
|
943
|
+
type: "text",
|
|
944
|
+
text: `${report}\n`
|
|
945
|
+
}
|
|
946
|
+
}
|
|
947
|
+
}).catch(() => {});
|
|
948
|
+
}
|
|
933
949
|
this.piSession.prompt(message, { images: imageContents }).catch(() => {
|
|
934
950
|
this.flushEmits().finally(() => {
|
|
935
951
|
const reason = this.cancelRequested ? "cancelled" : "error";
|
|
@@ -1345,6 +1361,43 @@ function acpPromptToPiMessage(blocks) {
|
|
|
1345
1361
|
};
|
|
1346
1362
|
}
|
|
1347
1363
|
//#endregion
|
|
1364
|
+
//#region src/resources/diagnostics.ts
|
|
1365
|
+
function buildDiagnosticsReport(input) {
|
|
1366
|
+
const sourceStats = input.sources.map((source) => {
|
|
1367
|
+
const skills = source.getSkills();
|
|
1368
|
+
const prompts = source.getPrompts();
|
|
1369
|
+
const failures = skills.diagnostics.filter((d) => d.type === "warning" || d.type === "error").map((d) => d.message);
|
|
1370
|
+
return {
|
|
1371
|
+
id: source.id,
|
|
1372
|
+
kind: source.kind,
|
|
1373
|
+
agentsFiles: source.getAgentsFiles().length,
|
|
1374
|
+
skills: skills.skills.length,
|
|
1375
|
+
prompts: prompts.prompts.length,
|
|
1376
|
+
failures
|
|
1377
|
+
};
|
|
1378
|
+
});
|
|
1379
|
+
const lines = [];
|
|
1380
|
+
if (sourceStats.length > 0) {
|
|
1381
|
+
lines.push("[pi-acp] resources active:");
|
|
1382
|
+
for (const s of sourceStats) lines.push(` ${s.id.padEnd(20)} kind=${s.kind} (${s.agentsFiles} AGENTS files, ${s.skills} skills, ${s.prompts} prompts)`);
|
|
1383
|
+
}
|
|
1384
|
+
const allFailures = [];
|
|
1385
|
+
for (const s of sourceStats) for (const f of s.failures) allFailures.push(` ${s.id.padEnd(20)} ${f}`);
|
|
1386
|
+
for (const d of input.manifestDiagnostics) {
|
|
1387
|
+
const where = d.path !== void 0 ? ` ${d.path}` : "";
|
|
1388
|
+
allFailures.push(` manifest[${d.source}${where}] ${d.message}`);
|
|
1389
|
+
}
|
|
1390
|
+
if (allFailures.length > 0) {
|
|
1391
|
+
if (lines.length > 0) lines.push("");
|
|
1392
|
+
lines.push("[pi-acp] resource failures:");
|
|
1393
|
+
lines.push(...allFailures);
|
|
1394
|
+
}
|
|
1395
|
+
return {
|
|
1396
|
+
text: lines.join("\n"),
|
|
1397
|
+
sourceStats
|
|
1398
|
+
};
|
|
1399
|
+
}
|
|
1400
|
+
//#endregion
|
|
1348
1401
|
//#region src/resources/sources/local.ts
|
|
1349
1402
|
/**
|
|
1350
1403
|
* LocalBackend: wraps pi's DefaultResourceLoader for one (cwd, agentDir) root.
|
|
@@ -1954,7 +2007,7 @@ var SshBackend = class {
|
|
|
1954
2007
|
//#endregion
|
|
1955
2008
|
//#region package.json
|
|
1956
2009
|
var name = "@victor-software-house/pi-acp";
|
|
1957
|
-
var version = "0.
|
|
2010
|
+
var version = "0.13.0";
|
|
1958
2011
|
//#endregion
|
|
1959
2012
|
//#region src/acp/agent.ts
|
|
1960
2013
|
/** Builtin ACP slash commands handled directly by the adapter. */
|
|
@@ -2149,7 +2202,9 @@ var PiAcpAgent = class {
|
|
|
2149
2202
|
}
|
|
2150
2203
|
return {
|
|
2151
2204
|
loader,
|
|
2152
|
-
modeResult
|
|
2205
|
+
modeResult,
|
|
2206
|
+
diagnosticsEnabled: loaded.manifest.diagnostics === true,
|
|
2207
|
+
manifestDiagnostics: diagnostics
|
|
2153
2208
|
};
|
|
2154
2209
|
}
|
|
2155
2210
|
/**
|
|
@@ -2223,7 +2278,7 @@ var PiAcpAgent = class {
|
|
|
2223
2278
|
};
|
|
2224
2279
|
}
|
|
2225
2280
|
async newSession(params) {
|
|
2226
|
-
const { loader: resourceLoader, modeResult } = await this.buildResourceLoader(params.cwd, params).catch((e) => {
|
|
2281
|
+
const { loader: resourceLoader, modeResult, diagnosticsEnabled, manifestDiagnostics } = await this.buildResourceLoader(params.cwd, params).catch((e) => {
|
|
2227
2282
|
const authErr = detectAuthError(e);
|
|
2228
2283
|
if (authErr !== null) throw authErr;
|
|
2229
2284
|
const msg = e instanceof Error ? e.message : String(e);
|
|
@@ -2234,6 +2289,10 @@ var PiAcpAgent = class {
|
|
|
2234
2289
|
modeResult.cleanup();
|
|
2235
2290
|
throw RequestError.invalidParams(`cwd must be an absolute path: ${params.cwd}`);
|
|
2236
2291
|
}
|
|
2292
|
+
const diagnosticsReport = diagnosticsEnabled ? buildDiagnosticsReport({
|
|
2293
|
+
sources: resourceLoader.listSources(),
|
|
2294
|
+
manifestDiagnostics
|
|
2295
|
+
}).text : "";
|
|
2237
2296
|
const acpReadOverlay = this.buildAcpReadOverlay(effectiveCwd);
|
|
2238
2297
|
let result;
|
|
2239
2298
|
try {
|
|
@@ -2269,7 +2328,8 @@ var PiAcpAgent = class {
|
|
|
2269
2328
|
piSession,
|
|
2270
2329
|
conn: this.conn,
|
|
2271
2330
|
supportsTerminalOutput: this.clientCapabilities.terminalOutput,
|
|
2272
|
-
cleanups: modeResult.ephemeral ? [modeResult.cleanup] : []
|
|
2331
|
+
cleanups: modeResult.ephemeral ? [modeResult.cleanup] : [],
|
|
2332
|
+
...diagnosticsReport !== "" ? { diagnosticsReport } : {}
|
|
2273
2333
|
});
|
|
2274
2334
|
this.sessions.register(session);
|
|
2275
2335
|
this.registerWithDaemon({
|
|
@@ -3327,4 +3387,4 @@ async function runDaemon() {
|
|
|
3327
3387
|
//#endregion
|
|
3328
3388
|
export { runDaemon };
|
|
3329
3389
|
|
|
3330
|
-
//# sourceMappingURL=daemon-
|
|
3390
|
+
//# sourceMappingURL=daemon-BdW4nUzA.mjs.map
|