@caupulican/pi-adaptative 0.80.38 → 0.80.40

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 (28) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/core/agent-session.d.ts.map +1 -1
  3. package/dist/core/agent-session.js +16 -8
  4. package/dist/core/agent-session.js.map +1 -1
  5. package/dist/core/settings-manager.d.ts +2 -0
  6. package/dist/core/settings-manager.d.ts.map +1 -1
  7. package/dist/core/settings-manager.js +1 -0
  8. package/dist/core/settings-manager.js.map +1 -1
  9. package/dist/core/system-prompt.d.ts.map +1 -1
  10. package/dist/core/system-prompt.js +3 -0
  11. package/dist/core/system-prompt.js.map +1 -1
  12. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  13. package/dist/modes/interactive/components/settings-selector.js +3 -1
  14. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  15. package/dist/modes/interactive/interactive-mode.d.ts +3 -0
  16. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  17. package/dist/modes/interactive/interactive-mode.js +38 -14
  18. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  19. package/docs/adaptive-extension-shared-state-audit.md +1 -1
  20. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  21. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  22. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  23. package/examples/extensions/sandbox/package-lock.json +2 -2
  24. package/examples/extensions/sandbox/package.json +1 -1
  25. package/examples/extensions/with-deps/package-lock.json +2 -2
  26. package/examples/extensions/with-deps/package.json +1 -1
  27. package/npm-shrinkwrap.json +12 -12
  28. package/package.json +4 -4
@@ -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
- const rawSourcePath = settings.sourcePath?.trim();
764
- if (!rawSourcePath) {
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 not set.
767
- - Do not modify Pi core or runtime output. Ask the user to set \`selfModification.sourcePath\` to the pi-adaptative source checkout before proceeding.`;
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 sourcePath = resolvePath(rawSourcePath, this._cwd, { trim: true });
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.sourcePath\` before editing)`;
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."