@caupulican/pi-adaptative 0.80.45 → 0.80.46

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 (29) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/core/profile-registry.d.ts +1 -0
  3. package/dist/core/profile-registry.d.ts.map +1 -1
  4. package/dist/core/profile-registry.js +40 -20
  5. package/dist/core/profile-registry.js.map +1 -1
  6. package/dist/core/resource-loader.d.ts.map +1 -1
  7. package/dist/core/resource-loader.js +133 -4
  8. package/dist/core/resource-loader.js.map +1 -1
  9. package/dist/core/settings-manager.d.ts +9 -0
  10. package/dist/core/settings-manager.d.ts.map +1 -1
  11. package/dist/core/settings-manager.js +67 -1
  12. package/dist/core/settings-manager.js.map +1 -1
  13. package/dist/modes/interactive/components/settings-selector.d.ts +11 -1
  14. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  15. package/dist/modes/interactive/components/settings-selector.js +39 -1
  16. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  17. package/dist/modes/interactive/interactive-mode.d.ts +2 -0
  18. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  19. package/dist/modes/interactive/interactive-mode.js +86 -1
  20. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  21. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  22. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  23. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  24. package/examples/extensions/sandbox/package-lock.json +2 -2
  25. package/examples/extensions/sandbox/package.json +1 -1
  26. package/examples/extensions/with-deps/package-lock.json +2 -2
  27. package/examples/extensions/with-deps/package.json +1 -1
  28. package/npm-shrinkwrap.json +12 -12
  29. package/package.json +4 -4
@@ -62,7 +62,7 @@ import { ProfileResourceEditorComponent, } from "./components/profile-resource-e
62
62
  import { ProfileSelectorComponent } from "./components/profile-selector.js";
63
63
  import { ScopedModelsSelectorComponent } from "./components/scoped-models-selector.js";
64
64
  import { SessionSelectorComponent } from "./components/session-selector.js";
65
- import { SettingsSelectorComponent } from "./components/settings-selector.js";
65
+ import { SelectSubmenu, SettingsSelectorComponent } from "./components/settings-selector.js";
66
66
  import { SkillInvocationMessageComponent } from "./components/skill-invocation-message.js";
67
67
  import { ToolExecutionComponent } from "./components/tool-execution.js";
68
68
  import { ToolGroupComponent } from "./components/tool-group.js";
@@ -4926,6 +4926,8 @@ export class InteractiveMode {
4926
4926
  : undefined,
4927
4927
  activeProfileName: this.settingsManager.getActiveResourceProfileNames()[0],
4928
4928
  profileOptions,
4929
+ externalResourceRoots: this.settingsManager.getExternalResourceRoots(),
4930
+ trustedResourceRoots: this.settingsManager.getTrustedResourceRoots(),
4929
4931
  }, {
4930
4932
  onAutoCompactChange: (enabled) => {
4931
4933
  this.session.setAutoCompactionEnabled(enabled);
@@ -5088,6 +5090,14 @@ export class InteractiveMode {
5088
5090
  done();
5089
5091
  this.deleteProfileFromSource(profileName);
5090
5092
  },
5093
+ onAddExternalResourceRoot: () => {
5094
+ done();
5095
+ void this.addExternalResourceRootFlow();
5096
+ },
5097
+ onRemoveExternalResourceRoot: (root) => {
5098
+ done();
5099
+ void this.removeExternalResourceRootFlow(root);
5100
+ },
5091
5101
  onCancel: () => {
5092
5102
  done();
5093
5103
  this.ui.requestRender();
@@ -5388,6 +5398,81 @@ export class InteractiveMode {
5388
5398
  this.showError(error instanceof Error ? error.message : String(error));
5389
5399
  }
5390
5400
  }
5401
+ async addExternalResourceRootFlow() {
5402
+ const rootPath = await new Promise((resolve) => {
5403
+ this.showSelector((done) => {
5404
+ const input = new ExtensionInputComponent("Add External Root", "Enter external root directory path", (value) => {
5405
+ done();
5406
+ resolve(value);
5407
+ }, () => {
5408
+ done();
5409
+ resolve(undefined);
5410
+ }, { tui: this.ui });
5411
+ return { component: input, focus: input };
5412
+ });
5413
+ });
5414
+ if (rootPath === undefined) {
5415
+ this.ui.requestRender();
5416
+ return;
5417
+ }
5418
+ const trimmed = rootPath.trim();
5419
+ if (!trimmed) {
5420
+ this.showError("Directory path cannot be empty");
5421
+ return;
5422
+ }
5423
+ const canonical = this.settingsManager.canonicalizePath(trimmed);
5424
+ if (!canonical) {
5425
+ this.showError(`Invalid path: ${trimmed}`);
5426
+ return;
5427
+ }
5428
+ // Prompt for trust confirmation (Yes/No)
5429
+ const trust = await new Promise((resolve) => {
5430
+ this.showSelector((done) => {
5431
+ const submenu = new SelectSubmenu("Trust external source?", "This directory can load custom extensions that execute arbitrary code on your machine.", [
5432
+ { value: "yes", label: "Yes", description: "Trust this directory and enable loading resources." },
5433
+ { value: "no", label: "No", description: "Do not trust this directory. Skip loading resources." },
5434
+ ], "no", (value) => {
5435
+ done();
5436
+ resolve(value === "yes");
5437
+ }, () => {
5438
+ done();
5439
+ resolve(false);
5440
+ });
5441
+ return { component: submenu, focus: submenu.getSelectList() };
5442
+ });
5443
+ });
5444
+ if (!trust) {
5445
+ this.showStatus("Aborted. External root was not trusted.");
5446
+ return;
5447
+ }
5448
+ try {
5449
+ const currentRoots = this.settingsManager.getExternalResourceRoots();
5450
+ if (!currentRoots.includes(canonical)) {
5451
+ this.settingsManager.setExternalResourceRoots([...currentRoots, canonical], "global");
5452
+ }
5453
+ this.settingsManager.addTrustedResourceRoot(canonical, "global");
5454
+ this.showStatus(`Added trusted external root: ${canonical}`);
5455
+ await this.handleReloadCommand();
5456
+ }
5457
+ catch (error) {
5458
+ this.showError(error instanceof Error ? error.message : String(error));
5459
+ }
5460
+ }
5461
+ async removeExternalResourceRootFlow(root) {
5462
+ try {
5463
+ const currentRoots = this.settingsManager.getExternalResourceRoots();
5464
+ const currentTrusted = this.settingsManager.getTrustedResourceRoots();
5465
+ const newRoots = currentRoots.filter((r) => r !== root);
5466
+ const newTrusted = currentTrusted.filter((r) => r !== root);
5467
+ this.settingsManager.setExternalResourceRoots(newRoots, "global");
5468
+ this.settingsManager.setTrustedResourceRoots(newTrusted, "global");
5469
+ this.showStatus(`Removed external root: ${root}`);
5470
+ await this.handleReloadCommand();
5471
+ }
5472
+ catch (error) {
5473
+ this.showError(error instanceof Error ? error.message : String(error));
5474
+ }
5475
+ }
5391
5476
  async handleModelCommand(searchTerm) {
5392
5477
  if (!searchTerm) {
5393
5478
  await this.showModelSelector();