@caupulican/pi-adaptative 0.80.72 → 0.80.73
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 +16 -0
- package/dist/core/agent-session.d.ts +1 -1
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +6 -1
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/memory/providers/file-store.d.ts.map +1 -1
- package/dist/core/memory/providers/file-store.js +11 -2
- package/dist/core/memory/providers/file-store.js.map +1 -1
- package/dist/core/memory/providers/transcript-recall.d.ts.map +1 -1
- package/dist/core/memory/providers/transcript-recall.js +14 -3
- package/dist/core/memory/providers/transcript-recall.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 +21 -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
|
@@ -408,6 +408,13 @@ export class InteractiveMode {
|
|
|
408
408
|
pendingClipboardImages = [];
|
|
409
409
|
clipboardImageCounter = 0;
|
|
410
410
|
loadingAnimation = undefined;
|
|
411
|
+
// Native-reflection debounce: prevents back-to-back/overlapping background reflection passes (cost
|
|
412
|
+
// guard). `_nativeReflectionInFlight` blocks a second pass while one runs; `_lastNativeReflectionAt`
|
|
413
|
+
// enforces a minimum gap between passes. Skipped corrections aren't lost — the next eligible pass
|
|
414
|
+
// reflects over the accumulated turn text.
|
|
415
|
+
_nativeReflectionInFlight = false;
|
|
416
|
+
_lastNativeReflectionAt = 0;
|
|
417
|
+
static NATIVE_REFLECTION_MIN_INTERVAL_MS = 45_000;
|
|
411
418
|
workingMessage = undefined;
|
|
412
419
|
workingVisible = true;
|
|
413
420
|
workingIndicatorOptions = undefined;
|
|
@@ -4834,6 +4841,15 @@ export class InteractiveMode {
|
|
|
4834
4841
|
maybeRunNativeReflection(messages) {
|
|
4835
4842
|
if (!this.isNativeReflectionEnabled())
|
|
4836
4843
|
return;
|
|
4844
|
+
// Debounce (cost guard): never run two background reflection passes at once, and never start one
|
|
4845
|
+
// within the min interval of the last — a multi-turn correction session would otherwise spawn
|
|
4846
|
+
// overlapping passes that re-reason the same task. The accumulated turn text is still reflected
|
|
4847
|
+
// on the next eligible pass, so no learning is dropped.
|
|
4848
|
+
if (this._nativeReflectionInFlight)
|
|
4849
|
+
return;
|
|
4850
|
+
const now = Date.now();
|
|
4851
|
+
if (now - this._lastNativeReflectionAt < InteractiveMode.NATIVE_REFLECTION_MIN_INTERVAL_MS)
|
|
4852
|
+
return;
|
|
4837
4853
|
const settings = this.getEffectiveAutoLearnSettings();
|
|
4838
4854
|
const toolCallCount = this.countAgentToolCalls(messages);
|
|
4839
4855
|
const contextPercent = this.session.getContextUsage()?.percent ?? 0;
|
|
@@ -4865,6 +4881,8 @@ export class InteractiveMode {
|
|
|
4865
4881
|
// User-configurable reflection model + thinking (auto-learn settings), restricted to AVAILABLE
|
|
4866
4882
|
// (authed) models — falls back to the session model when unset or unavailable.
|
|
4867
4883
|
const { model, thinkingLevel } = this._resolveReflectionModel(settings);
|
|
4884
|
+
this._nativeReflectionInFlight = true;
|
|
4885
|
+
this._lastNativeReflectionAt = now;
|
|
4868
4886
|
void this.session
|
|
4869
4887
|
.runReflectionPass({
|
|
4870
4888
|
signals: { trigger, toolCallCount, hadCorrection, contextHeadroomPct, usefulLately: 0 },
|
|
@@ -4875,6 +4893,9 @@ export class InteractiveMode {
|
|
|
4875
4893
|
})
|
|
4876
4894
|
.catch(() => {
|
|
4877
4895
|
// best-effort background learning; never disrupt the session
|
|
4896
|
+
})
|
|
4897
|
+
.finally(() => {
|
|
4898
|
+
this._nativeReflectionInFlight = false;
|
|
4878
4899
|
});
|
|
4879
4900
|
}
|
|
4880
4901
|
maybeStartAutoLearn() {
|