@caupulican/pi-adaptative 0.78.4 → 0.80.0
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 +17 -0
- package/dist/core/agent-session.d.ts +1 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +34 -2
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/resource-loader.d.ts +1 -0
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +26 -1
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/settings-manager.d.ts +14 -2
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +32 -2
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +2 -0
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +16 -2
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +441 -1
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +36 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +731 -2
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/docs/settings.md +33 -5
- package/docs/usage.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 +15 -18
- package/package.json +4 -4
|
@@ -712,6 +712,10 @@ export class AgentSession {
|
|
|
712
712
|
const sourceStatus = sourceLooksValid
|
|
713
713
|
? sourcePath
|
|
714
714
|
: `${sourcePath} (missing or not a source checkout; ask the user to correct \`selfModification.sourcePath\` before editing)`;
|
|
715
|
+
const autonomy = this.settingsManager.getAutonomySettings();
|
|
716
|
+
const settingsGate = autonomy.mode === "full"
|
|
717
|
+
? "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."
|
|
718
|
+
: "Ask for explicit approval before changing global settings.";
|
|
715
719
|
return `Pi self-modification guardrails (local setting active):
|
|
716
720
|
- Authorized pi-adaptative source path: ${sourceStatus}
|
|
717
721
|
- Only modify Pi core/harness source under the authorized source path; never patch installed node_modules or generated runtime output as the source of truth.
|
|
@@ -719,7 +723,31 @@ export class AgentSession {
|
|
|
719
723
|
- Preserve user changes: check git status before and after, avoid unrelated edits, and do not overwrite concurrent work.
|
|
720
724
|
- Validate with focused tests and broader checks proportional to risk before claiming success.
|
|
721
725
|
- Reload/restart/renew only after source changes are saved and auditable.
|
|
722
|
-
-
|
|
726
|
+
- ${settingsGate}
|
|
727
|
+
- Always ask for explicit approval before publishing, pushing, tagging, or releasing.`;
|
|
728
|
+
}
|
|
729
|
+
_buildAutonomyPrompt() {
|
|
730
|
+
const autoLearn = this.settingsManager.getAutoLearnSettings();
|
|
731
|
+
const autonomy = this.settingsManager.getAutonomySettings();
|
|
732
|
+
if (!autoLearn.enabled && autonomy.mode === "off") {
|
|
733
|
+
return undefined;
|
|
734
|
+
}
|
|
735
|
+
const reflection = autoLearn.reflectionReview ?? autonomy.mode !== "off";
|
|
736
|
+
const model = autoLearn.model?.trim() || "active";
|
|
737
|
+
if (autonomy.mode === "full") {
|
|
738
|
+
return `Pi autonomy policy (mode full, standing autonomy):
|
|
739
|
+
- Setting-authorized background learners may run after long sessions or corrective/complex turns using model ${model}; they may act without asking first inside this standing grant.
|
|
740
|
+
- Standing grant: write high-confidence durable memory, create/patch user/project skills, create/patch small user/project extensions/tools, tune autonomy/autoLearn settings, edit the authorized selfModification.sourcePath, run validation, and leave audit/rollback evidence.
|
|
741
|
+
- Hard stops still require explicit foreground approval: publish/npm release, git push, tag creation, credential/provider-auth changes, destructive user-data deletion, network-exposed services, or expanding authority beyond this policy.
|
|
742
|
+
- Treat current-turn evidence as a cue, not proof; prefer deterministic or longitudinal corroboration for durable behavior changes.
|
|
743
|
+
- Active-task work remains primary: autonomy runs must not interrupt user-visible execution or claim task completion without evidence.`;
|
|
744
|
+
}
|
|
745
|
+
return `Pi autonomy policy (mode ${autonomy.mode}):
|
|
746
|
+
- Setting-authorized background learners may run after long sessions${reflection ? " or corrective/complex turns" : ""} using model ${model}.
|
|
747
|
+
- Background learning may query durable memory and run bounded learning tools.
|
|
748
|
+
- Auto-apply is limited to high-confidence durable memory when explicitly configured; tooling, skill, prompt, extension, settings, and core-source changes stay proposal/approval-gated.
|
|
749
|
+
- Treat current-turn evidence as a cue, not proof; prefer longitudinal corroboration before changing durable behavior.
|
|
750
|
+
- Active-task work remains primary: learning runs must not interrupt user-visible execution or claim task completion.`;
|
|
723
751
|
}
|
|
724
752
|
_rebuildSystemPrompt(toolNames) {
|
|
725
753
|
const validToolNames = toolNames.filter((name) => this._toolRegistry.has(name));
|
|
@@ -737,7 +765,11 @@ export class AgentSession {
|
|
|
737
765
|
}
|
|
738
766
|
const loaderSystemPrompt = this._resourceLoader.getSystemPrompt();
|
|
739
767
|
const loaderAppendSystemPrompt = this._resourceLoader.getAppendSystemPrompt();
|
|
740
|
-
const appendSystemPromptParts = [
|
|
768
|
+
const appendSystemPromptParts = [
|
|
769
|
+
this._buildSelfModificationPrompt(),
|
|
770
|
+
this._buildAutonomyPrompt(),
|
|
771
|
+
...loaderAppendSystemPrompt,
|
|
772
|
+
].filter((part) => Boolean(part));
|
|
741
773
|
const appendSystemPrompt = appendSystemPromptParts.length > 0 ? appendSystemPromptParts.join("\n\n") : undefined;
|
|
742
774
|
const loadedSkills = this._resourceLoader.getSkills().skills;
|
|
743
775
|
const loadedContextFiles = this._resourceLoader.getAgentsFiles().agentsFiles;
|