@friendlyrobot/discord-pi-agent 0.9.8 → 0.9.9
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.
- package/dist/agent-service.d.ts +1 -0
- package/dist/index.js +44 -4
- package/package.json +1 -1
package/dist/agent-service.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export declare class AgentService {
|
|
|
14
14
|
createSession(sessionDir: string): Promise<AgentSession>;
|
|
15
15
|
prompt(text: string): Promise<string>;
|
|
16
16
|
reloadResources(): Promise<string>;
|
|
17
|
+
getExtensionsSummary(): string;
|
|
17
18
|
compact(): Promise<string>;
|
|
18
19
|
resetSession(): Promise<string>;
|
|
19
20
|
getStatus(): AgentStatus;
|
package/dist/index.js
CHANGED
|
@@ -282,6 +282,33 @@ class AgentService {
|
|
|
282
282
|
`Extensions (${extensions.length}): ${extensions.join(", ") || "(none)"}`,
|
|
283
283
|
`AGENTS.md files (${agentsFiles.length}): ${agentsFiles.join(", ") || "(none)"}`
|
|
284
284
|
].join(`
|
|
285
|
+
`);
|
|
286
|
+
}
|
|
287
|
+
getExtensionsSummary() {
|
|
288
|
+
const result = this.resourceLoader.getExtensions();
|
|
289
|
+
const { extensions, errors } = result;
|
|
290
|
+
if (extensions.length === 0) {
|
|
291
|
+
return "Extensions: (none loaded)";
|
|
292
|
+
}
|
|
293
|
+
const lines = extensions.map((ext) => {
|
|
294
|
+
const toolCount = ext.tools.size;
|
|
295
|
+
const commandCount = ext.commands.size;
|
|
296
|
+
const parts = [];
|
|
297
|
+
if (toolCount > 0) {
|
|
298
|
+
parts.push(`${toolCount} tool${toolCount !== 1 ? "s" : ""}`);
|
|
299
|
+
}
|
|
300
|
+
if (commandCount > 0) {
|
|
301
|
+
parts.push(`${commandCount} command${commandCount !== 1 ? "s" : ""}`);
|
|
302
|
+
}
|
|
303
|
+
const summary = parts.length > 0 ? ` (${parts.join(", ")})` : "";
|
|
304
|
+
return ` ${ext.path}${summary}`;
|
|
305
|
+
});
|
|
306
|
+
const header = `Extensions (${extensions.length}):`;
|
|
307
|
+
const errorLines = errors.length > 0 ? [
|
|
308
|
+
`Errors (${errors.length}):`,
|
|
309
|
+
...errors.map((e) => ` ${e.path}: ${e.error}`)
|
|
310
|
+
] : [];
|
|
311
|
+
return [header, ...lines, ...errorLines].join(`
|
|
285
312
|
`);
|
|
286
313
|
}
|
|
287
314
|
async compact() {
|
|
@@ -602,13 +629,13 @@ import {
|
|
|
602
629
|
} from "discord.js";
|
|
603
630
|
|
|
604
631
|
// src/commands.ts
|
|
605
|
-
function getSessionStatusText(session, promptQueue) {
|
|
632
|
+
function getSessionStatusText(session, promptQueue, extras) {
|
|
606
633
|
const model = session.model ? `${session.model.provider}/${session.model.id}` : "(no model selected)";
|
|
607
634
|
const contextUsage = session.getContextUsage();
|
|
608
635
|
const contextLine = contextUsage ? contextUsage.tokens === null || contextUsage.percent === null ? `context: ?/${contextUsage.contextWindow}` : `context: ${contextUsage.tokens}/${contextUsage.contextWindow} (${Math.round(contextUsage.percent)}%)` : "context: (unavailable)";
|
|
609
636
|
const thinkingInfo = session.supportsThinking() ? `thinking: ${session.thinkingLevel} (available: ${session.getAvailableThinkingLevels().join(", ")})` : "thinking: not supported";
|
|
610
637
|
const queueStatus = promptQueue.getSnapshot();
|
|
611
|
-
|
|
638
|
+
const lines = [
|
|
612
639
|
`model: ${model}`,
|
|
613
640
|
`session-id: ${session.sessionId}`,
|
|
614
641
|
`session-file: ${session.sessionFile ?? "(none)"}`,
|
|
@@ -617,7 +644,15 @@ function getSessionStatusText(session, promptQueue) {
|
|
|
617
644
|
contextLine,
|
|
618
645
|
`queue-pending: ${queueStatus.pending}`,
|
|
619
646
|
`queue-busy: ${queueStatus.busy}`
|
|
620
|
-
]
|
|
647
|
+
];
|
|
648
|
+
if (extras?.tools && extras.tools.length > 0) {
|
|
649
|
+
const toolLines = extras.tools.map((t) => ` ${t.name} - ${t.description}`);
|
|
650
|
+
lines.push("", `Tools (${extras.tools.length}):`, ...toolLines);
|
|
651
|
+
}
|
|
652
|
+
if (extras?.extensionsSummary) {
|
|
653
|
+
lines.push("", extras.extensionsSummary);
|
|
654
|
+
}
|
|
655
|
+
return lines.join(`
|
|
621
656
|
`);
|
|
622
657
|
}
|
|
623
658
|
function getThinkingInfo(session) {
|
|
@@ -677,9 +712,14 @@ async function handleCommand(input, ctx) {
|
|
|
677
712
|
response: "No active session."
|
|
678
713
|
};
|
|
679
714
|
}
|
|
715
|
+
const tools = effectiveSession.getAllTools();
|
|
716
|
+
const extensionsSummary = agentService.getExtensionsSummary();
|
|
680
717
|
return {
|
|
681
718
|
handled: true,
|
|
682
|
-
response: getSessionStatusText(effectiveSession, promptQueue
|
|
719
|
+
response: getSessionStatusText(effectiveSession, promptQueue, {
|
|
720
|
+
tools,
|
|
721
|
+
extensionsSummary
|
|
722
|
+
})
|
|
683
723
|
};
|
|
684
724
|
}
|
|
685
725
|
if (trimmed === "!thinking" || trimmed.startsWith("!thinking ")) {
|