@caupulican/pi-adaptative 0.80.84 → 0.80.85

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 +19 -0
  2. package/dist/core/agent-session.d.ts +3 -0
  3. package/dist/core/agent-session.d.ts.map +1 -1
  4. package/dist/core/agent-session.js +42 -1
  5. package/dist/core/agent-session.js.map +1 -1
  6. package/dist/core/cost-guard.d.ts +1 -1
  7. package/dist/core/cost-guard.d.ts.map +1 -1
  8. package/dist/core/cost-guard.js +2 -2
  9. package/dist/core/cost-guard.js.map +1 -1
  10. package/dist/core/profile-registry.d.ts +2 -1
  11. package/dist/core/profile-registry.d.ts.map +1 -1
  12. package/dist/core/profile-registry.js +32 -2
  13. package/dist/core/profile-registry.js.map +1 -1
  14. package/dist/core/settings-manager.d.ts +2 -0
  15. package/dist/core/settings-manager.d.ts.map +1 -1
  16. package/dist/core/settings-manager.js +33 -3
  17. package/dist/core/settings-manager.js.map +1 -1
  18. package/dist/modes/interactive/components/profile-selector.d.ts.map +1 -1
  19. package/dist/modes/interactive/components/profile-selector.js +2 -0
  20. package/dist/modes/interactive/components/profile-selector.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
@@ -2565,6 +2565,43 @@ export class AgentSession {
2565
2565
  const filter = this.settingsManager.getResourceProfileFilter("tools");
2566
2566
  return { allow: filter.allow ?? [], block: filter.block ?? [] };
2567
2567
  }
2568
+ _isToolOrCommandAllowedByProfile(name) {
2569
+ if (this._allowedToolNames && !this._allowedToolNames.has(name))
2570
+ return false;
2571
+ if (this._excludedToolNames?.has(name))
2572
+ return false;
2573
+ const filter = this._toolProfileFilter;
2574
+ if (!filter)
2575
+ return true;
2576
+ if (filter.allow.length > 0 && !matchesResourceProfilePattern(name, filter.allow))
2577
+ return false;
2578
+ if (matchesResourceProfilePattern(name, filter.block))
2579
+ return false;
2580
+ return true;
2581
+ }
2582
+ _hasToolOrCommandProfileGate() {
2583
+ return Boolean(this._allowedToolNames ||
2584
+ this._excludedToolNames ||
2585
+ (this._toolProfileFilter &&
2586
+ (this._toolProfileFilter.allow.length > 0 || this._toolProfileFilter.block.length > 0)));
2587
+ }
2588
+ _filterExtensionsForRuntime(extensions) {
2589
+ if (this.settingsManager.getActiveResourceProfileNames().length === 0) {
2590
+ return this.settingsManager.hasExplicitActiveResourceProfileSelection()
2591
+ ? []
2592
+ : extensions.filter((extension) => extension.sourceInfo.source === "inline");
2593
+ }
2594
+ const hasToolOrCommandGate = this._hasToolOrCommandProfileGate();
2595
+ return extensions
2596
+ .filter((extension) => this.settingsManager.isResourceAllowedByProfile("extensions", extension.path, extension.sourceInfo.baseDir))
2597
+ .map((extension) => {
2598
+ if (!hasToolOrCommandGate)
2599
+ return extension;
2600
+ const tools = new Map(Array.from(extension.tools.entries()).filter(([name]) => this._isToolOrCommandAllowedByProfile(name)));
2601
+ const commands = new Map(Array.from(extension.commands.entries()).filter(([name]) => this._isToolOrCommandAllowedByProfile(name)));
2602
+ return { ...extension, tools, commands };
2603
+ });
2604
+ }
2568
2605
  /**
2569
2606
  * Re-resolve the active resource profile's model/thinking from current settings and apply it.
2570
2607
  * Only acts when the profile actually binds model/thinking AND that field was not set by an
@@ -2826,7 +2863,11 @@ export class AgentSession {
2826
2863
  extensionsResult.runtime.flagValues.set(name, value);
2827
2864
  }
2828
2865
  }
2829
- this._extensionRunner = new ExtensionRunner(extensionsResult.extensions, extensionsResult.runtime, this._cwd, this.sessionManager, this._modelRegistry);
2866
+ const extensions = this._filterExtensionsForRuntime(extensionsResult.extensions);
2867
+ const runtimeExtensionPaths = new Set(extensions.map((extension) => extension.path));
2868
+ extensionsResult.runtime.pendingProviderRegistrations =
2869
+ extensionsResult.runtime.pendingProviderRegistrations.filter((registration) => runtimeExtensionPaths.has(registration.extensionPath));
2870
+ this._extensionRunner = new ExtensionRunner(extensions, extensionsResult.runtime, this._cwd, this.sessionManager, this._modelRegistry);
2830
2871
  if (this._extensionRunnerRef) {
2831
2872
  this._extensionRunnerRef.current = this._extensionRunner;
2832
2873
  }