@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.
- package/CHANGELOG.md +26 -0
- package/dist/core/agent-session.d.ts +3 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +47 -2
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/cost-guard.d.ts +1 -1
- package/dist/core/cost-guard.d.ts.map +1 -1
- package/dist/core/cost-guard.js +2 -2
- package/dist/core/cost-guard.js.map +1 -1
- package/dist/core/profile-registry.d.ts +2 -1
- package/dist/core/profile-registry.d.ts.map +1 -1
- package/dist/core/profile-registry.js +32 -2
- package/dist/core/profile-registry.js.map +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +1 -0
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/settings-manager.d.ts +5 -0
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +39 -4
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/modes/interactive/components/profile-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/profile-selector.js +2 -0
- package/dist/modes/interactive/components/profile-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +23 -2
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +2 -1
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/docs/settings.md +4 -2
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/npm-shrinkwrap.json +12 -12
- 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
|
-
|
|
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
|
}
|