@friendlyrobot/discord-pi-agent 0.7.3 → 0.7.4
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 +3 -3
- package/dist/index.js +16 -16
- package/package.json +5 -5
package/dist/agent-service.d.ts
CHANGED
|
@@ -24,9 +24,9 @@ export declare class AgentService {
|
|
|
24
24
|
private requireSession;
|
|
25
25
|
private applyConfiguredThinkingLevel;
|
|
26
26
|
private applyConfiguredThinkingLevelForSession;
|
|
27
|
-
listModels(): Promise<string>;
|
|
28
|
-
switchModel(provider: string, modelId: string): Promise<string>;
|
|
29
|
-
getCurrentModelDisplay(): string;
|
|
27
|
+
listModels(session?: AgentSession | null): Promise<string>;
|
|
28
|
+
switchModel(provider: string, modelId: string, session?: AgentSession | null): Promise<string>;
|
|
29
|
+
getCurrentModelDisplay(session?: AgentSession | null): string;
|
|
30
30
|
getThinkingLevel(): {
|
|
31
31
|
current: ThinkingLevel;
|
|
32
32
|
available: ThinkingLevel[];
|
package/dist/index.js
CHANGED
|
@@ -401,10 +401,10 @@ class AgentService {
|
|
|
401
401
|
}
|
|
402
402
|
}
|
|
403
403
|
}
|
|
404
|
-
async listModels() {
|
|
404
|
+
async listModels(session) {
|
|
405
|
+
const effectiveSession = session ?? this.session;
|
|
405
406
|
const availableModels = await this.modelRegistry.getAvailable();
|
|
406
|
-
const
|
|
407
|
-
const currentDisplay = session?.model ? `${session.model.provider}/${session.model.id}` : null;
|
|
407
|
+
const currentDisplay = effectiveSession?.model ? `${effectiveSession.model.provider}/${effectiveSession.model.id}` : null;
|
|
408
408
|
const lines = availableModels.map((model) => {
|
|
409
409
|
const display = `${model.provider}/${model.id}`;
|
|
410
410
|
const marker = currentDisplay === display ? " (current)" : "";
|
|
@@ -418,8 +418,8 @@ Usage: !model <provider/modelId> to switch.`
|
|
|
418
418
|
].join(`
|
|
419
419
|
`);
|
|
420
420
|
}
|
|
421
|
-
async switchModel(provider, modelId) {
|
|
422
|
-
const
|
|
421
|
+
async switchModel(provider, modelId, session) {
|
|
422
|
+
const effectiveSession = session ?? this.requireSession();
|
|
423
423
|
const model = this.modelRegistry.find(provider, modelId);
|
|
424
424
|
if (!model) {
|
|
425
425
|
const availableModels = await this.modelRegistry.getAvailable();
|
|
@@ -431,20 +431,20 @@ Models from "${provider}": ${matches.join(", ")}` : `
|
|
|
431
431
|
Use !model to see all available models.`;
|
|
432
432
|
return `Model not found: ${provider}/${modelId}.${hint}`;
|
|
433
433
|
}
|
|
434
|
-
if (isSameModel(
|
|
434
|
+
if (isSameModel(effectiveSession.model, model)) {
|
|
435
435
|
return `Already using ${provider}/${modelId}.`;
|
|
436
436
|
}
|
|
437
|
-
await
|
|
438
|
-
await this.applyConfiguredThinkingLevelForSession(
|
|
439
|
-
const thinkingInfo =
|
|
437
|
+
await effectiveSession.setModel(model);
|
|
438
|
+
await this.applyConfiguredThinkingLevelForSession(effectiveSession);
|
|
439
|
+
const thinkingInfo = effectiveSession.supportsThinking() ? ` (thinking: ${effectiveSession.thinkingLevel})` : "";
|
|
440
440
|
return `Switched to ${provider}/${modelId}${thinkingInfo}.`;
|
|
441
441
|
}
|
|
442
|
-
getCurrentModelDisplay() {
|
|
443
|
-
const
|
|
444
|
-
if (!
|
|
442
|
+
getCurrentModelDisplay(session) {
|
|
443
|
+
const effectiveSession = session ?? this.session;
|
|
444
|
+
if (!effectiveSession?.model) {
|
|
445
445
|
return "(no model selected)";
|
|
446
446
|
}
|
|
447
|
-
return `${
|
|
447
|
+
return `${effectiveSession.model.provider}/${effectiveSession.model.id}`;
|
|
448
448
|
}
|
|
449
449
|
getThinkingLevel() {
|
|
450
450
|
const session = this.requireSession();
|
|
@@ -740,8 +740,8 @@ async function handleCommand(input, ctx) {
|
|
|
740
740
|
}
|
|
741
741
|
const parts = trimmed.split(" ");
|
|
742
742
|
if (parts.length === 1) {
|
|
743
|
-
const current = agentService.getCurrentModelDisplay();
|
|
744
|
-
const modelList = await agentService.listModels();
|
|
743
|
+
const current = agentService.getCurrentModelDisplay(effectiveSession);
|
|
744
|
+
const modelList = await agentService.listModels(effectiveSession);
|
|
745
745
|
return {
|
|
746
746
|
handled: true,
|
|
747
747
|
response: `Current model: ${current}
|
|
@@ -763,7 +763,7 @@ Use !model without args to see available models.`
|
|
|
763
763
|
const modelId = arg.substring(slashIndex + 1);
|
|
764
764
|
return {
|
|
765
765
|
handled: true,
|
|
766
|
-
response: await agentService.switchModel(provider, modelId)
|
|
766
|
+
response: await agentService.switchModel(provider, modelId, effectiveSession)
|
|
767
767
|
};
|
|
768
768
|
}
|
|
769
769
|
if (trimmed === "!compact") {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@friendlyrobot/discord-pi-agent",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.4",
|
|
4
4
|
"description": "Reusable Discord gateway bridge for persistent pi agent sessions",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
"typecheck": "tsgo --noEmit -p tsconfig.json"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@mariozechner/pi-ai": "^0.73.
|
|
39
|
-
"@mariozechner/pi-coding-agent": "^0.73.
|
|
38
|
+
"@mariozechner/pi-ai": "^0.73.1",
|
|
39
|
+
"@mariozechner/pi-coding-agent": "^0.73.1",
|
|
40
40
|
"discord.js": "^14.26.4",
|
|
41
41
|
"dotenv": "^17.4.2",
|
|
42
42
|
"marked": "^18.0.3",
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
"prettier": "^3.8.3"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@types/node": "^25.6.
|
|
49
|
-
"@typescript/native-preview": "^7.0.0-dev.
|
|
48
|
+
"@types/node": "^25.6.2",
|
|
49
|
+
"@typescript/native-preview": "^7.0.0-dev.20260507.1",
|
|
50
50
|
"@vitest/ui": "^4.1.5",
|
|
51
51
|
"vitest": "^4.1.5"
|
|
52
52
|
}
|