@caupulican/pi-adaptative 0.80.44 → 0.80.45

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,6 +24,7 @@ import { BUILT_IN_PROVIDER_DISPLAY_NAMES } from "../../core/provider-display-nam
24
24
  import { getPendingReloadBlockers } from "../../core/reload-blockers.js";
25
25
  import { formatMissingSessionCwdPrompt, MissingSessionCwdError } from "../../core/session-cwd.js";
26
26
  import { isAutoLearnSessionId, SessionManager } from "../../core/session-manager.js";
27
+ import { validateSkillName } from "../../core/skills.js";
27
28
  import { BUILTIN_SLASH_COMMANDS } from "../../core/slash-commands.js";
28
29
  import { isInstallTelemetryEnabled } from "../../core/telemetry.js";
29
30
  import { allToolNames } from "../../core/tools/index.js";
@@ -5071,6 +5072,10 @@ export class InteractiveMode {
5071
5072
  done();
5072
5073
  void this.applyProfile(profile);
5073
5074
  },
5075
+ onProfileCreate: () => {
5076
+ done();
5077
+ void this.createProfileFlow();
5078
+ },
5074
5079
  onProfileEdit: (profileName) => {
5075
5080
  done();
5076
5081
  void this.openProfileResourceEditor(profileName);
@@ -5224,6 +5229,73 @@ export class InteractiveMode {
5224
5229
  this.updateEditorBorderColor();
5225
5230
  }
5226
5231
  }
5232
+ async createProfileFlow() {
5233
+ const name = await new Promise((resolve) => {
5234
+ this.showSelector((done) => {
5235
+ const input = new ExtensionInputComponent("Create Profile", "Enter profile name", (value) => {
5236
+ done();
5237
+ resolve(value);
5238
+ }, () => {
5239
+ done();
5240
+ resolve(undefined);
5241
+ }, { tui: this.ui });
5242
+ return { component: input, focus: input };
5243
+ });
5244
+ });
5245
+ if (name === undefined) {
5246
+ this.ui.requestRender();
5247
+ return;
5248
+ }
5249
+ const trimmed = name.trim();
5250
+ if (!trimmed) {
5251
+ this.showError("Profile name cannot be empty");
5252
+ return this.createProfileFlow();
5253
+ }
5254
+ // Validate name rules using validateSkillName
5255
+ const errors = validateSkillName(trimmed);
5256
+ if (errors.length > 0) {
5257
+ this.showError(`Invalid profile name: ${errors.join(", ")}`);
5258
+ return this.createProfileFlow();
5259
+ }
5260
+ // Collision check
5261
+ const existing = this.settingsManager.getProfileRegistry().getProfile(trimmed);
5262
+ if (existing) {
5263
+ this.showError(`Profile "${trimmed}" already exists`);
5264
+ return this.createProfileFlow();
5265
+ }
5266
+ // Open the resource editor on the NEW profile
5267
+ void this.openNewProfileEditor(trimmed);
5268
+ }
5269
+ async openNewProfileEditor(profileName) {
5270
+ const scope = "reusable-file";
5271
+ const kinds = await this.getProfileResourceKinds();
5272
+ this.showSelector((done) => {
5273
+ const editor = new ProfileResourceEditorComponent({
5274
+ profileName,
5275
+ initialResources: {},
5276
+ kinds,
5277
+ onSave: (resources) => {
5278
+ done();
5279
+ try {
5280
+ this.settingsManager.setProfileDefinition(profileName, {
5281
+ name: profileName,
5282
+ resources,
5283
+ }, scope);
5284
+ this.showStatus(`Saved profile "${profileName}" to ${scope}.`);
5285
+ this.ui.requestRender();
5286
+ }
5287
+ catch (error) {
5288
+ this.showError(error instanceof Error ? error.message : String(error));
5289
+ }
5290
+ },
5291
+ onCancel: () => {
5292
+ done();
5293
+ this.ui.requestRender();
5294
+ },
5295
+ });
5296
+ return { component: editor, focus: editor };
5297
+ });
5298
+ }
5227
5299
  async openProfileResourceEditor(profileName) {
5228
5300
  const profile = this.settingsManager.getProfileRegistry().getProfile(profileName);
5229
5301
  if (!profile) {