@caupulican/pi-adaptative 0.80.81 → 0.80.83

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 (32) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/core/model-router/status.d.ts +1 -0
  3. package/dist/core/model-router/status.d.ts.map +1 -1
  4. package/dist/core/model-router/status.js +1 -0
  5. package/dist/core/model-router/status.js.map +1 -1
  6. package/dist/core/profile-registry.d.ts +2 -1
  7. package/dist/core/profile-registry.d.ts.map +1 -1
  8. package/dist/core/profile-registry.js +15 -0
  9. package/dist/core/profile-registry.js.map +1 -1
  10. package/dist/core/settings-manager.d.ts +5 -0
  11. package/dist/core/settings-manager.d.ts.map +1 -1
  12. package/dist/core/settings-manager.js +68 -1
  13. package/dist/core/settings-manager.js.map +1 -1
  14. package/dist/modes/interactive/components/settings-selector.d.ts +2 -0
  15. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  16. package/dist/modes/interactive/components/settings-selector.js +196 -11
  17. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  18. package/dist/modes/interactive/interactive-mode.d.ts +1 -0
  19. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  20. package/dist/modes/interactive/interactive-mode.js +51 -5
  21. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  22. package/docs/resources.md +7 -1
  23. package/docs/settings.md +24 -2
  24. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  25. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  26. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  27. package/examples/extensions/sandbox/package-lock.json +2 -2
  28. package/examples/extensions/sandbox/package.json +1 -1
  29. package/examples/extensions/with-deps/package-lock.json +2 -2
  30. package/examples/extensions/with-deps/package.json +1 -1
  31. package/npm-shrinkwrap.json +12 -12
  32. package/package.json +4 -4
@@ -5150,6 +5150,7 @@ export class InteractiveMode {
5150
5150
  autonomy: this.settingsManager.getAutonomySettings(),
5151
5151
  autonomyScope: projectSettings.autonomy ? "project" : "global",
5152
5152
  modelRouter: this.settingsManager.getModelRouterSettings(),
5153
+ modelRouterScope: projectSettings.modelRouter ? "project" : "global",
5153
5154
  autoLearn: this.settingsManager.getAutoLearnSettings(),
5154
5155
  autoLearnScope: projectSettings.autoLearn ? "project" : "global",
5155
5156
  autoLearnModelOptions: this.getAutoLearnModelOptions(),
@@ -5293,6 +5294,17 @@ export class InteractiveMode {
5293
5294
  this.applyAutonomyMode(settings.mode ?? "off", scope);
5294
5295
  this.showStatus(`Autonomy mode ${settings.mode ?? "off"} saved to ${scope}. Use /autonomy status.`);
5295
5296
  },
5297
+ onModelRouterChange: (settings, scope) => {
5298
+ this.settingsManager.setModelRouterSettings(settings, scope);
5299
+ for (const value of [settings.cheapModel, settings.expensiveModel, settings.learningModel]) {
5300
+ const validationMessage = this.validateAutoLearnModelValue(value);
5301
+ if (validationMessage) {
5302
+ this.showWarning(validationMessage.replace("Auto Learn model", "Model router model"));
5303
+ }
5304
+ }
5305
+ this.updateAutoLearnFooter();
5306
+ this.showStatus(`Model Router settings saved to ${scope}. Use /session or /usage to inspect routing.`);
5307
+ },
5296
5308
  onAutoLearnChange: (settings, scope) => {
5297
5309
  this.settingsManager.setAutoLearnSettings(settings, scope);
5298
5310
  const validationMessage = this.validateAutoLearnModelValue(settings.model);
@@ -5556,8 +5568,14 @@ export class InteractiveMode {
5556
5568
  return;
5557
5569
  }
5558
5570
  try {
5571
+ const profileModel = await this.selectProfileModelForCreate();
5572
+ if (profileModel === undefined) {
5573
+ void this.openLibraryManagerFlow();
5574
+ return;
5575
+ }
5559
5576
  this.settingsManager.setProfileDefinition(trimmed, {
5560
5577
  name: trimmed,
5578
+ model: profileModel ?? undefined,
5561
5579
  resources: {},
5562
5580
  }, "directory");
5563
5581
  await this.applyProfile(trimmed);
@@ -5932,10 +5950,37 @@ export class InteractiveMode {
5932
5950
  this.showError(`Profile/situation "${trimmed}" already exists`);
5933
5951
  return this.createProfileFlow();
5934
5952
  }
5953
+ const profileModel = await this.selectProfileModelForCreate();
5954
+ if (profileModel === undefined) {
5955
+ this.ui.requestRender();
5956
+ return;
5957
+ }
5935
5958
  // Open the resource editor on the NEW profile
5936
- void this.openNewProfileEditor(trimmed);
5959
+ void this.openNewProfileEditor(trimmed, profileModel ?? undefined);
5960
+ }
5961
+ async selectProfileModelForCreate() {
5962
+ const modelOptions = [
5963
+ {
5964
+ value: "(none)",
5965
+ label: "(none)",
5966
+ description: "Do not pin a foreground profile model; use the session/default model",
5967
+ },
5968
+ ...this.getAutoLearnModelOptions(),
5969
+ ];
5970
+ return await new Promise((resolve) => {
5971
+ this.showSelector((done) => {
5972
+ const selector = new SelectSubmenu("Profile Model", "Pick the foreground model for this profile from authenticated/configured providers.", modelOptions, "(none)", (value) => {
5973
+ done();
5974
+ resolve(value === "(none)" ? null : value);
5975
+ }, () => {
5976
+ done();
5977
+ resolve(undefined);
5978
+ });
5979
+ return { component: selector, focus: selector.getSelectList() };
5980
+ });
5981
+ });
5937
5982
  }
5938
- async openNewProfileEditor(profileName) {
5983
+ async openNewProfileEditor(profileName, profileModel) {
5939
5984
  const scope = "reusable-file";
5940
5985
  const kinds = await this.getProfileResourceKinds();
5941
5986
  this.showSelector((done) => {
@@ -5952,6 +5997,7 @@ export class InteractiveMode {
5952
5997
  try {
5953
5998
  this.settingsManager.setProfileDefinition(profileName, {
5954
5999
  name: profileName,
6000
+ model: profileModel,
5955
6001
  resources,
5956
6002
  }, scope);
5957
6003
  this.showStatus(`Saved profile "${profileName}" to ${scope}.`);
@@ -5970,17 +6016,17 @@ export class InteractiveMode {
5970
6016
  const resolvedEditPath = resolveResourceEditPath(id, pathValue, kind);
5971
6017
  if (!resolvedEditPath) {
5972
6018
  this.showWarning(`Resource "${id}" of kind "${kind}" has no editable file path.`);
5973
- void this.openNewProfileEditor(profileName);
6019
+ void this.openNewProfileEditor(profileName, profileModel);
5974
6020
  return;
5975
6021
  }
5976
6022
  if (!fs.existsSync(resolvedEditPath)) {
5977
6023
  this.showError(`Resolved path for "${id}" does not exist: ${resolvedEditPath}`);
5978
- void this.openNewProfileEditor(profileName);
6024
+ void this.openNewProfileEditor(profileName, profileModel);
5979
6025
  return;
5980
6026
  }
5981
6027
  await this.openEditorForPath(resolvedEditPath);
5982
6028
  await this.handleReloadCommand();
5983
- void this.openNewProfileEditor(profileName);
6029
+ void this.openNewProfileEditor(profileName, profileModel);
5984
6030
  },
5985
6031
  });
5986
6032
  return { component: editor, focus: editor };