@caupulican/pi-adaptative 0.80.95 → 0.80.97
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 +21 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +39 -0
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/toolkit/reflex-interpreter.d.ts +28 -0
- package/dist/core/toolkit/reflex-interpreter.d.ts.map +1 -0
- package/dist/core/toolkit/reflex-interpreter.js +62 -0
- package/dist/core/toolkit/reflex-interpreter.js.map +1 -0
- package/dist/core/tools/run-toolkit-script.d.ts +8 -0
- package/dist/core/tools/run-toolkit-script.d.ts.map +1 -1
- package/dist/core/tools/run-toolkit-script.js +21 -3
- package/dist/core/tools/run-toolkit-script.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +7 -1
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +147 -0
- 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 +12 -0
- package/dist/modes/interactive/interactive-mode.js.map +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
|
@@ -114,6 +114,15 @@ function contextCurationSummary(settings) {
|
|
|
114
114
|
return "disabled";
|
|
115
115
|
return `on · ${settings.model ?? "no model"} · ${settings.maxJobsPerTurn ?? 4} jobs/turn`;
|
|
116
116
|
}
|
|
117
|
+
function learningPolicySummary(settings) {
|
|
118
|
+
if (!settings.enabled)
|
|
119
|
+
return "disabled (legacy direct-apply)";
|
|
120
|
+
return `on · auto-apply ${settings.autoApplyEnabled ? "on" : "off"} · conf>=${settings.confidenceThreshold ?? 60}`;
|
|
121
|
+
}
|
|
122
|
+
function modelCapabilitySummary(settings) {
|
|
123
|
+
const mode = settings.mode ?? "auto";
|
|
124
|
+
return mode === "auto" ? "auto (derived from the model's context window)" : mode;
|
|
125
|
+
}
|
|
117
126
|
function workerDelegationSummary(settings) {
|
|
118
127
|
if (!(settings.enabled ?? DEFAULT_WORKER_DELEGATION_ENABLED))
|
|
119
128
|
return "disabled";
|
|
@@ -551,6 +560,122 @@ class ResearchLaneSettingsSubmenu extends Container {
|
|
|
551
560
|
this.settingsList.handleInput(data);
|
|
552
561
|
}
|
|
553
562
|
}
|
|
563
|
+
class LearningPolicySettingsSubmenu extends Container {
|
|
564
|
+
settingsList;
|
|
565
|
+
state;
|
|
566
|
+
scope;
|
|
567
|
+
constructor(settings, onChange, onCancel, scope = "global") {
|
|
568
|
+
super();
|
|
569
|
+
this.state = { ...settings };
|
|
570
|
+
this.scope = scope;
|
|
571
|
+
const items = [
|
|
572
|
+
{
|
|
573
|
+
id: "learning-policy-scope",
|
|
574
|
+
label: "Save scope",
|
|
575
|
+
description: "Save these learning-policy settings globally or in the project's .pi/settings.json",
|
|
576
|
+
currentValue: this.scope,
|
|
577
|
+
values: ["global", "project"],
|
|
578
|
+
},
|
|
579
|
+
{
|
|
580
|
+
id: "learning-policy-enabled",
|
|
581
|
+
label: "Enabled",
|
|
582
|
+
description: "Gate reflection writes through the learning policy (proposals, audits, rollback). Disabled keeps legacy direct-apply with audit records.",
|
|
583
|
+
currentValue: String(this.state.enabled ?? false),
|
|
584
|
+
values: ["true", "false"],
|
|
585
|
+
},
|
|
586
|
+
{
|
|
587
|
+
id: "learning-policy-auto-apply",
|
|
588
|
+
label: "Auto-apply",
|
|
589
|
+
description: "Allow eligible writes to auto-apply; otherwise everything becomes a proposal",
|
|
590
|
+
currentValue: String(this.state.autoApplyEnabled ?? false),
|
|
591
|
+
values: ["true", "false"],
|
|
592
|
+
},
|
|
593
|
+
{
|
|
594
|
+
id: "learning-policy-confidence",
|
|
595
|
+
label: "Confidence threshold",
|
|
596
|
+
description: "Minimum confidence (0-100) before a write may auto-apply; below it, proposal or no-op",
|
|
597
|
+
currentValue: String(this.state.confidenceThreshold ?? 60),
|
|
598
|
+
values: ["25", "50", "60", "75", "90"],
|
|
599
|
+
},
|
|
600
|
+
{
|
|
601
|
+
id: "learning-policy-min-observations",
|
|
602
|
+
label: "Min observations",
|
|
603
|
+
description: "Observations required before auto-apply (allowedAutoApplyLayers stays JSON-only)",
|
|
604
|
+
currentValue: String(this.state.minObservations ?? 2),
|
|
605
|
+
values: ["1", "2", "3", "5"],
|
|
606
|
+
},
|
|
607
|
+
];
|
|
608
|
+
this.settingsList = new SettingsList(items, Math.min(items.length, 10), getSettingsListTheme(), (id, newValue) => {
|
|
609
|
+
switch (id) {
|
|
610
|
+
case "learning-policy-scope":
|
|
611
|
+
this.scope = newValue;
|
|
612
|
+
break;
|
|
613
|
+
case "learning-policy-enabled":
|
|
614
|
+
this.state = { ...this.state, enabled: newValue === "true" };
|
|
615
|
+
break;
|
|
616
|
+
case "learning-policy-auto-apply":
|
|
617
|
+
this.state = { ...this.state, autoApplyEnabled: newValue === "true" };
|
|
618
|
+
break;
|
|
619
|
+
case "learning-policy-confidence":
|
|
620
|
+
this.state = { ...this.state, confidenceThreshold: Number(newValue) };
|
|
621
|
+
break;
|
|
622
|
+
case "learning-policy-min-observations":
|
|
623
|
+
this.state = { ...this.state, minObservations: Number(newValue) };
|
|
624
|
+
break;
|
|
625
|
+
default:
|
|
626
|
+
return;
|
|
627
|
+
}
|
|
628
|
+
onChange({ ...this.state }, this.scope);
|
|
629
|
+
}, onCancel);
|
|
630
|
+
this.addChild(this.settingsList);
|
|
631
|
+
}
|
|
632
|
+
handleInput(data) {
|
|
633
|
+
this.settingsList.handleInput(data);
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
class ModelCapabilitySettingsSubmenu extends Container {
|
|
637
|
+
settingsList;
|
|
638
|
+
state;
|
|
639
|
+
scope;
|
|
640
|
+
constructor(settings, onChange, onCancel, scope = "global") {
|
|
641
|
+
super();
|
|
642
|
+
this.state = { ...settings };
|
|
643
|
+
this.scope = scope;
|
|
644
|
+
const items = [
|
|
645
|
+
{
|
|
646
|
+
id: "model-capability-scope",
|
|
647
|
+
label: "Save scope",
|
|
648
|
+
description: "Save globally or in the project's .pi/settings.json",
|
|
649
|
+
currentValue: this.scope,
|
|
650
|
+
values: ["global", "project"],
|
|
651
|
+
},
|
|
652
|
+
{
|
|
653
|
+
id: "model-capability-mode",
|
|
654
|
+
label: "Mode",
|
|
655
|
+
description: '"auto" derives the tool surface and lane budgets from the model\'s own context window; "off" disables adaptation; a class name forces it',
|
|
656
|
+
currentValue: this.state.mode ?? "auto",
|
|
657
|
+
values: ["auto", "off", "full", "lean", "minimal", "chat"],
|
|
658
|
+
},
|
|
659
|
+
];
|
|
660
|
+
this.settingsList = new SettingsList(items, Math.min(items.length, 10), getSettingsListTheme(), (id, newValue) => {
|
|
661
|
+
switch (id) {
|
|
662
|
+
case "model-capability-scope":
|
|
663
|
+
this.scope = newValue;
|
|
664
|
+
break;
|
|
665
|
+
case "model-capability-mode":
|
|
666
|
+
this.state = { ...this.state, mode: newValue };
|
|
667
|
+
break;
|
|
668
|
+
default:
|
|
669
|
+
return;
|
|
670
|
+
}
|
|
671
|
+
onChange({ ...this.state }, this.scope);
|
|
672
|
+
}, onCancel);
|
|
673
|
+
this.addChild(this.settingsList);
|
|
674
|
+
}
|
|
675
|
+
handleInput(data) {
|
|
676
|
+
this.settingsList.handleInput(data);
|
|
677
|
+
}
|
|
678
|
+
}
|
|
554
679
|
class ContextCurationSettingsSubmenu extends Container {
|
|
555
680
|
settingsList;
|
|
556
681
|
state;
|
|
@@ -1210,6 +1335,8 @@ export class SettingsSelectorComponent extends Container {
|
|
|
1210
1335
|
let currentAutonomy = { ...config.autonomy };
|
|
1211
1336
|
let currentResearchLane = { ...config.researchLane };
|
|
1212
1337
|
let currentContextCuration = { ...config.contextCuration };
|
|
1338
|
+
let currentLearningPolicy = { ...config.learningPolicy };
|
|
1339
|
+
let currentModelCapability = { ...config.modelCapability };
|
|
1213
1340
|
let currentWorkerDelegation = { ...config.workerDelegation };
|
|
1214
1341
|
let currentModelRouter = { ...config.modelRouter };
|
|
1215
1342
|
let currentAutoLearn = { ...config.autoLearn };
|
|
@@ -1333,6 +1460,26 @@ export class SettingsSelectorComponent extends Container {
|
|
|
1333
1460
|
callbacks.onWorkerDelegationChange(settings, scope);
|
|
1334
1461
|
}, () => done(workerDelegationSummary(currentWorkerDelegation)), config.workerDelegationScope ?? "global"),
|
|
1335
1462
|
},
|
|
1463
|
+
{
|
|
1464
|
+
id: "learning-policy",
|
|
1465
|
+
label: "Learning Policy",
|
|
1466
|
+
description: "Gate reflection-sourced durable writes: proposals, confidence thresholds, audits, and rollback",
|
|
1467
|
+
currentValue: learningPolicySummary(currentLearningPolicy),
|
|
1468
|
+
submenu: (_currentValue, done) => new LearningPolicySettingsSubmenu(currentLearningPolicy, (settings, scope) => {
|
|
1469
|
+
currentLearningPolicy = { ...settings };
|
|
1470
|
+
callbacks.onLearningPolicyChange(settings, scope);
|
|
1471
|
+
}, () => done(learningPolicySummary(currentLearningPolicy)), config.learningPolicyScope ?? "global"),
|
|
1472
|
+
},
|
|
1473
|
+
{
|
|
1474
|
+
id: "model-capability",
|
|
1475
|
+
label: "Model Capability",
|
|
1476
|
+
description: "How pi adapts the tool surface and lane budgets to small models (derived from the model's own metadata)",
|
|
1477
|
+
currentValue: modelCapabilitySummary(currentModelCapability),
|
|
1478
|
+
submenu: (_currentValue, done) => new ModelCapabilitySettingsSubmenu(currentModelCapability, (settings, scope) => {
|
|
1479
|
+
currentModelCapability = { ...settings };
|
|
1480
|
+
callbacks.onModelCapabilityChange(settings, scope);
|
|
1481
|
+
}, () => done(modelCapabilitySummary(currentModelCapability)), config.modelCapabilityScope ?? "global"),
|
|
1482
|
+
},
|
|
1336
1483
|
{
|
|
1337
1484
|
id: "context-curation",
|
|
1338
1485
|
label: "Context Curation",
|