@caupulican/pi-adaptative 0.80.83 → 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 (39) hide show
  1. package/CHANGELOG.md +26 -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 +47 -2
  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/sdk.d.ts.map +1 -1
  15. package/dist/core/sdk.js +1 -0
  16. package/dist/core/sdk.js.map +1 -1
  17. package/dist/core/settings-manager.d.ts +5 -0
  18. package/dist/core/settings-manager.d.ts.map +1 -1
  19. package/dist/core/settings-manager.js +39 -4
  20. package/dist/core/settings-manager.js.map +1 -1
  21. package/dist/modes/interactive/components/profile-selector.d.ts.map +1 -1
  22. package/dist/modes/interactive/components/profile-selector.js +2 -0
  23. package/dist/modes/interactive/components/profile-selector.js.map +1 -1
  24. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  25. package/dist/modes/interactive/components/settings-selector.js +23 -2
  26. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  27. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  28. package/dist/modes/interactive/interactive-mode.js +2 -1
  29. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  30. package/docs/settings.md +4 -2
  31. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  32. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  33. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  34. package/examples/extensions/sandbox/package-lock.json +2 -2
  35. package/examples/extensions/sandbox/package.json +1 -1
  36. package/examples/extensions/with-deps/package-lock.json +2 -2
  37. package/examples/extensions/with-deps/package.json +1 -1
  38. package/npm-shrinkwrap.json +12 -12
  39. package/package.json +4 -4
@@ -1113,9 +1113,13 @@ export class AgentSession {
1113
1113
  // =========================================================================
1114
1114
  async _runAgentPrompt(messages) {
1115
1115
  try {
1116
+ const maxGoalLoopRounds = this.settingsManager.getAutonomySettings().maxStallTurns;
1117
+ this.agent.maxStallTurns = maxGoalLoopRounds;
1118
+ let goalLoopRounds = 1;
1116
1119
  await this.agent.prompt(messages);
1117
- while (await this._handlePostAgentRun()) {
1120
+ while ((maxGoalLoopRounds === 0 || goalLoopRounds < maxGoalLoopRounds) && (await this._handlePostAgentRun())) {
1118
1121
  await this.agent.continue();
1122
+ goalLoopRounds++;
1119
1123
  }
1120
1124
  }
1121
1125
  finally {
@@ -2561,6 +2565,43 @@ export class AgentSession {
2561
2565
  const filter = this.settingsManager.getResourceProfileFilter("tools");
2562
2566
  return { allow: filter.allow ?? [], block: filter.block ?? [] };
2563
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
+ }
2564
2605
  /**
2565
2606
  * Re-resolve the active resource profile's model/thinking from current settings and apply it.
2566
2607
  * Only acts when the profile actually binds model/thinking AND that field was not set by an
@@ -2822,7 +2863,11 @@ export class AgentSession {
2822
2863
  extensionsResult.runtime.flagValues.set(name, value);
2823
2864
  }
2824
2865
  }
2825
- 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);
2826
2871
  if (this._extensionRunnerRef) {
2827
2872
  this._extensionRunnerRef.current = this._extensionRunner;
2828
2873
  }