@caupulican/pi-adaptative 0.80.67 → 0.80.69

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.
@@ -4814,6 +4814,23 @@ export class InteractiveMode {
4814
4814
  * warranted, run the in-process {@link AgentSession.runReflectionPass} as a fire-and-forget
4815
4815
  * background microtask. No subprocess, no blocking of the UI.
4816
4816
  */
4817
+ /**
4818
+ * Resolve the model + thinking level the native reflection pass should use, from auto-learn
4819
+ * settings (`model`, `thinkingLevel`). The configured model is honored only when its provider is
4820
+ * AVAILABLE (api key / logged in) — otherwise we fall back to the session model (undefined). This
4821
+ * lets the user pick a balanced/cheaper reflection model without risking an unusable one.
4822
+ */
4823
+ _resolveReflectionModel(settings) {
4824
+ let model;
4825
+ if (settings.model && settings.model !== "active") {
4826
+ const resolved = resolveCliModel({ cliModel: settings.model, modelRegistry: this.session.modelRegistry });
4827
+ if (resolved.model && this.session.modelRegistry.hasConfiguredAuth(resolved.model)) {
4828
+ model = resolved.model;
4829
+ }
4830
+ }
4831
+ const thinkingLevel = settings.thinkingLevel ?? "low";
4832
+ return { model, thinkingLevel };
4833
+ }
4817
4834
  maybeRunNativeReflection(messages) {
4818
4835
  if (!this.isNativeReflectionEnabled())
4819
4836
  return;
@@ -4841,11 +4858,16 @@ export class InteractiveMode {
4841
4858
  // Stable per-turn id so a duplicate scheduling/retry can't double-count the reflection cost.
4842
4859
  const lastId = messages[messages.length - 1]?.id;
4843
4860
  const reportId = lastId ? `reflection:${lastId}` : undefined;
4861
+ // User-configurable reflection model + thinking (auto-learn settings), restricted to AVAILABLE
4862
+ // (authed) models — falls back to the session model when unset or unavailable.
4863
+ const { model, thinkingLevel } = this._resolveReflectionModel(settings);
4844
4864
  void this.session
4845
4865
  .runReflectionPass({
4846
4866
  signals: { trigger, toolCallCount, hadCorrection, contextHeadroomPct, usefulLately: 0 },
4847
4867
  recentTurnText,
4848
4868
  reportId,
4869
+ model,
4870
+ thinkingLevel,
4849
4871
  })
4850
4872
  .catch(() => {
4851
4873
  // best-effort background learning; never disrupt the session