@friendlyrobot/discord-pi-agent 0.7.2 → 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.
@@ -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
@@ -102,7 +102,8 @@ async function collectReply(session, prompt, options = {}) {
102
102
  let sawAgentEnd = false;
103
103
  logger3.debug({
104
104
  logPrefix,
105
- promptLength: prompt.length
105
+ promptLength: prompt.length,
106
+ prompt
106
107
  }, "prompt start");
107
108
  const unsubscribe = session.subscribe((event) => {
108
109
  eventCount += 1;
@@ -400,10 +401,10 @@ class AgentService {
400
401
  }
401
402
  }
402
403
  }
403
- async listModels() {
404
+ async listModels(session) {
405
+ const effectiveSession = session ?? this.session;
404
406
  const availableModels = await this.modelRegistry.getAvailable();
405
- const session = this.session;
406
- const currentDisplay = session?.model ? `${session.model.provider}/${session.model.id}` : null;
407
+ const currentDisplay = effectiveSession?.model ? `${effectiveSession.model.provider}/${effectiveSession.model.id}` : null;
407
408
  const lines = availableModels.map((model) => {
408
409
  const display = `${model.provider}/${model.id}`;
409
410
  const marker = currentDisplay === display ? " (current)" : "";
@@ -417,8 +418,8 @@ Usage: !model <provider/modelId> to switch.`
417
418
  ].join(`
418
419
  `);
419
420
  }
420
- async switchModel(provider, modelId) {
421
- const session = this.requireSession();
421
+ async switchModel(provider, modelId, session) {
422
+ const effectiveSession = session ?? this.requireSession();
422
423
  const model = this.modelRegistry.find(provider, modelId);
423
424
  if (!model) {
424
425
  const availableModels = await this.modelRegistry.getAvailable();
@@ -430,20 +431,20 @@ Models from "${provider}": ${matches.join(", ")}` : `
430
431
  Use !model to see all available models.`;
431
432
  return `Model not found: ${provider}/${modelId}.${hint}`;
432
433
  }
433
- if (isSameModel(session.model, model)) {
434
+ if (isSameModel(effectiveSession.model, model)) {
434
435
  return `Already using ${provider}/${modelId}.`;
435
436
  }
436
- await session.setModel(model);
437
- await this.applyConfiguredThinkingLevelForSession(session);
438
- const thinkingInfo = session.supportsThinking() ? ` (thinking: ${session.thinkingLevel})` : "";
437
+ await effectiveSession.setModel(model);
438
+ await this.applyConfiguredThinkingLevelForSession(effectiveSession);
439
+ const thinkingInfo = effectiveSession.supportsThinking() ? ` (thinking: ${effectiveSession.thinkingLevel})` : "";
439
440
  return `Switched to ${provider}/${modelId}${thinkingInfo}.`;
440
441
  }
441
- getCurrentModelDisplay() {
442
- const session = this.session;
443
- if (!session?.model) {
442
+ getCurrentModelDisplay(session) {
443
+ const effectiveSession = session ?? this.session;
444
+ if (!effectiveSession?.model) {
444
445
  return "(no model selected)";
445
446
  }
446
- return `${session.model.provider}/${session.model.id}`;
447
+ return `${effectiveSession.model.provider}/${effectiveSession.model.id}`;
447
448
  }
448
449
  getThinkingLevel() {
449
450
  const session = this.requireSession();
@@ -739,8 +740,8 @@ async function handleCommand(input, ctx) {
739
740
  }
740
741
  const parts = trimmed.split(" ");
741
742
  if (parts.length === 1) {
742
- const current = agentService.getCurrentModelDisplay();
743
- const modelList = await agentService.listModels();
743
+ const current = agentService.getCurrentModelDisplay(effectiveSession);
744
+ const modelList = await agentService.listModels(effectiveSession);
744
745
  return {
745
746
  handled: true,
746
747
  response: `Current model: ${current}
@@ -762,7 +763,7 @@ Use !model without args to see available models.`
762
763
  const modelId = arg.substring(slashIndex + 1);
763
764
  return {
764
765
  handled: true,
765
- response: await agentService.switchModel(provider, modelId)
766
+ response: await agentService.switchModel(provider, modelId, effectiveSession)
766
767
  };
767
768
  }
768
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.2",
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.0",
39
- "@mariozechner/pi-coding-agent": "^0.73.0",
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.0",
49
- "@typescript/native-preview": "^7.0.0-dev.20260506.1",
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
  }