@caupulican/pi-adaptative 0.80.38 → 0.80.42
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 +20 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +18 -10
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts +1 -1
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +4 -2
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/settings-manager.d.ts +2 -0
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +1 -0
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +3 -0
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +3 -1
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +3 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +38 -14
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/docs/adaptive-extension-shared-state-audit.md +1 -1
- 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
|
@@ -205,7 +205,7 @@ export class AgentSession {
|
|
|
205
205
|
const contextWindow = this.model?.contextWindow ?? 0;
|
|
206
206
|
if (settings.enabled && contextWindow > 0 && !this.isCompacting) {
|
|
207
207
|
const contextTokens = this._estimateCurrentContextTokens(authoritativeMessages);
|
|
208
|
-
if (shouldCompact(contextTokens, contextWindow, settings)) {
|
|
208
|
+
if (shouldCompact(contextTokens, contextWindow, settings, this.model?.autoCompactionTriggerTokens)) {
|
|
209
209
|
const latestBefore = getLatestCompactionEntry(this.sessionManager.getBranch())?.id;
|
|
210
210
|
await this._runAutoCompaction("threshold", false);
|
|
211
211
|
const latestAfter = getLatestCompactionEntry(this.sessionManager.getBranch())?.id;
|
|
@@ -758,19 +758,27 @@ export class AgentSession {
|
|
|
758
758
|
if (!settings.enabled) {
|
|
759
759
|
return `Pi self-modification guardrails (local setting inactive):
|
|
760
760
|
- Do not modify Pi core, the installed Pi runtime, or pi-adaptative harness source for self-evolution.
|
|
761
|
-
- If self-modification is needed, ask the user to enable \`selfModification.enabled\` and set \`selfModification.sourcePath\` to the pi-adaptative source checkout.`;
|
|
762
|
-
}
|
|
763
|
-
|
|
764
|
-
|
|
761
|
+
- If self-modification is needed, ask the user to enable \`selfModification.enabled\` and set \`selfModification.sourcePaths\` (or legacy \`selfModification.sourcePath\`) to the pi-adaptative source checkout.`;
|
|
762
|
+
}
|
|
763
|
+
// Resolve from an ordered candidate list first (portable WSL/Termux switching
|
|
764
|
+
// from settings alone), then fall back to the legacy single sourcePath.
|
|
765
|
+
const rawCandidates = [
|
|
766
|
+
...(Array.isArray(settings.sourcePaths) ? settings.sourcePaths : []),
|
|
767
|
+
...(settings.sourcePath ? [settings.sourcePath] : []),
|
|
768
|
+
]
|
|
769
|
+
.map((candidate) => candidate?.trim())
|
|
770
|
+
.filter((candidate) => Boolean(candidate));
|
|
771
|
+
if (rawCandidates.length === 0) {
|
|
765
772
|
return `Pi self-modification guardrails (local setting active, source missing):
|
|
766
|
-
- Self-modification is enabled, but \`selfModification.sourcePath\` is
|
|
767
|
-
- Do not modify Pi core or runtime output. Ask the user to set \`selfModification.
|
|
773
|
+
- Self-modification is enabled, but no \`selfModification.sourcePaths\`/\`selfModification.sourcePath\` value is set.
|
|
774
|
+
- Do not modify Pi core or runtime output. Ask the user to set \`selfModification.sourcePaths\` to the pi-adaptative source checkout before proceeding.`;
|
|
768
775
|
}
|
|
769
|
-
const
|
|
776
|
+
const resolvedCandidates = rawCandidates.map((candidate) => resolvePath(candidate, this._cwd, { trim: true }));
|
|
777
|
+
const sourcePath = resolvedCandidates.find((candidate) => existsSync(candidate) && existsSync(resolvePath("package.json", candidate))) ?? resolvedCandidates[0];
|
|
770
778
|
const sourceLooksValid = existsSync(sourcePath) && existsSync(resolvePath("package.json", sourcePath));
|
|
771
779
|
const sourceStatus = sourceLooksValid
|
|
772
780
|
? sourcePath
|
|
773
|
-
: `${sourcePath} (missing or not a source checkout; ask the user to correct \`selfModification.
|
|
781
|
+
: `${sourcePath} (missing or not a source checkout; ask the user to correct \`selfModification.sourcePaths\` before editing)`;
|
|
774
782
|
const autonomy = this.settingsManager.getAutonomySettings();
|
|
775
783
|
const settingsGate = autonomy.mode === "full"
|
|
776
784
|
? "In autonomy.mode=full, autonomy/autoLearn setting tuning is covered by the standing autonomy grant; ask before changing credentials, provider auth, package sources, or unrelated preferences."
|
|
@@ -1703,7 +1711,7 @@ export class AgentSession {
|
|
|
1703
1711
|
}
|
|
1704
1712
|
}
|
|
1705
1713
|
}
|
|
1706
|
-
if (shouldCompact(contextTokens, contextWindow, settings)) {
|
|
1714
|
+
if (shouldCompact(contextTokens, contextWindow, settings, this.model?.autoCompactionTriggerTokens)) {
|
|
1707
1715
|
return await this._runAutoCompaction("threshold", false);
|
|
1708
1716
|
}
|
|
1709
1717
|
return false;
|