@friendlyrobot/discord-pi-agent 0.7.5 → 0.7.7

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.
Files changed (2) hide show
  1. package/dist/index.js +9 -10
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -357,6 +357,12 @@ class AgentService {
357
357
  await this.ensureModelForSession(this.requireSession());
358
358
  }
359
359
  async ensureModelForSession(session) {
360
+ if (session.model) {
361
+ logger4.debug({
362
+ model: `${session.model.provider}/${session.model.id}`
363
+ }, "retaining existing session model");
364
+ return;
365
+ }
360
366
  const desiredModel = this.modelRegistry.find(this.config.modelProvider, this.config.modelId);
361
367
  const availableModels = await this.modelRegistry.getAvailable();
362
368
  logger4.debug({
@@ -368,16 +374,9 @@ class AgentService {
368
374
  if (!desiredModel) {
369
375
  throw new Error(`Configured model not found: ${this.config.modelProvider}/${this.config.modelId}. Check your pi agent config and installed extensions.`);
370
376
  }
371
- if (isSameModel(session.model, desiredModel)) {
372
- logger4.debug({
373
- model: `${desiredModel.provider}/${desiredModel.id}`
374
- }, "model already selected");
375
- return;
376
- }
377
377
  logger4.info({
378
- from: session.model ? `${session.model.provider}/${session.model.id}` : null,
379
378
  to: `${desiredModel.provider}/${desiredModel.id}`
380
- }, "switching model");
379
+ }, "setting initial session model");
381
380
  await session.setModel(desiredModel);
382
381
  await this.applyConfiguredThinkingLevelForSession(session);
383
382
  }
@@ -764,8 +763,8 @@ Example: !model openrouter/anthropic/claude-sonnet-4
764
763
  Use !model without args to see available models.`
765
764
  };
766
765
  }
767
- const provider = arg.substring(0, slashIndex);
768
- const modelId = arg.substring(slashIndex + 1);
766
+ const provider = arg.substring(0, slashIndex).trim();
767
+ const modelId = arg.substring(slashIndex + 1).trim();
769
768
  return {
770
769
  handled: true,
771
770
  response: await agentService.switchModel(provider, modelId, effectiveSession)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@friendlyrobot/discord-pi-agent",
3
- "version": "0.7.5",
3
+ "version": "0.7.7",
4
4
  "description": "Reusable Discord gateway bridge for persistent pi agent sessions",
5
5
  "license": "MIT",
6
6
  "type": "module",