@caupulican/pi-adaptative 0.80.82 → 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.
@@ -5568,8 +5568,14 @@ export class InteractiveMode {
5568
5568
  return;
5569
5569
  }
5570
5570
  try {
5571
+ const profileModel = await this.selectProfileModelForCreate();
5572
+ if (profileModel === undefined) {
5573
+ void this.openLibraryManagerFlow();
5574
+ return;
5575
+ }
5571
5576
  this.settingsManager.setProfileDefinition(trimmed, {
5572
5577
  name: trimmed,
5578
+ model: profileModel ?? undefined,
5573
5579
  resources: {},
5574
5580
  }, "directory");
5575
5581
  await this.applyProfile(trimmed);
@@ -5944,10 +5950,37 @@ export class InteractiveMode {
5944
5950
  this.showError(`Profile/situation "${trimmed}" already exists`);
5945
5951
  return this.createProfileFlow();
5946
5952
  }
5953
+ const profileModel = await this.selectProfileModelForCreate();
5954
+ if (profileModel === undefined) {
5955
+ this.ui.requestRender();
5956
+ return;
5957
+ }
5947
5958
  // Open the resource editor on the NEW profile
5948
- 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
+ });
5949
5982
  }
5950
- async openNewProfileEditor(profileName) {
5983
+ async openNewProfileEditor(profileName, profileModel) {
5951
5984
  const scope = "reusable-file";
5952
5985
  const kinds = await this.getProfileResourceKinds();
5953
5986
  this.showSelector((done) => {
@@ -5964,6 +5997,7 @@ export class InteractiveMode {
5964
5997
  try {
5965
5998
  this.settingsManager.setProfileDefinition(profileName, {
5966
5999
  name: profileName,
6000
+ model: profileModel,
5967
6001
  resources,
5968
6002
  }, scope);
5969
6003
  this.showStatus(`Saved profile "${profileName}" to ${scope}.`);
@@ -5982,17 +6016,17 @@ export class InteractiveMode {
5982
6016
  const resolvedEditPath = resolveResourceEditPath(id, pathValue, kind);
5983
6017
  if (!resolvedEditPath) {
5984
6018
  this.showWarning(`Resource "${id}" of kind "${kind}" has no editable file path.`);
5985
- void this.openNewProfileEditor(profileName);
6019
+ void this.openNewProfileEditor(profileName, profileModel);
5986
6020
  return;
5987
6021
  }
5988
6022
  if (!fs.existsSync(resolvedEditPath)) {
5989
6023
  this.showError(`Resolved path for "${id}" does not exist: ${resolvedEditPath}`);
5990
- void this.openNewProfileEditor(profileName);
6024
+ void this.openNewProfileEditor(profileName, profileModel);
5991
6025
  return;
5992
6026
  }
5993
6027
  await this.openEditorForPath(resolvedEditPath);
5994
6028
  await this.handleReloadCommand();
5995
- void this.openNewProfileEditor(profileName);
6029
+ void this.openNewProfileEditor(profileName, profileModel);
5996
6030
  },
5997
6031
  });
5998
6032
  return { component: editor, focus: editor };