@caupulican/pi-adaptative 0.80.12 → 0.80.13

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.
@@ -149,6 +149,7 @@ const AUTONOMY_AUTO_LEARN_PRESETS = {
149
149
  };
150
150
  const AUTONOMY_MODES = ["off", "safe", "balanced", "full"];
151
151
  const AUTO_LEARN_RESERVATION_MS = 2 * 60 * 1000;
152
+ const AUTO_LEARN_THINKING_LEVEL = "xhigh";
152
153
  export const AUTO_LEARN_HISTORY_RETENTION_MS = 7 * 24 * 60 * 60 * 1000;
153
154
  function definedStringSet(values) {
154
155
  const set = new Set();
@@ -313,6 +314,7 @@ export function buildAutoLearnSpawnArgs(spawnTarget, options) {
313
314
  options.name,
314
315
  "--model",
315
316
  options.modelPattern,
317
+ ...(options.thinkingLevel ? ["--thinking", options.thinkingLevel] : []),
316
318
  "--session-dir",
317
319
  options.sessionDir,
318
320
  "--session-id",
@@ -428,8 +430,6 @@ export class InteractiveMode {
428
430
  // Auto-compaction state
429
431
  autoCompactionLoader = undefined;
430
432
  autoCompactionEscapeHandler;
431
- // Auto Learn background runner state
432
- autoLearnLastStatus = "idle";
433
433
  // Auto-retry state
434
434
  retryLoader = undefined;
435
435
  retryCountdown = undefined;
@@ -4050,17 +4050,15 @@ export class InteractiveMode {
4050
4050
  }
4051
4051
  cleanupCompletedAutoLearnRun(runId, artifactPaths) {
4052
4052
  const dataDir = this.getAutoLearnDataDir();
4053
- const removed = artifactPaths.filter((filePath) => removeAutoLearnArtifactPath(filePath, dataDir)).length;
4053
+ for (const filePath of artifactPaths)
4054
+ removeAutoLearnArtifactPath(filePath, dataDir);
4054
4055
  this.withAutoLearnStateLock((current) => {
4055
4056
  const state = this.pruneAutoLearnState(current);
4056
4057
  const runs = { ...(state.runs ?? {}) };
4057
4058
  delete runs[runId];
4058
4059
  return { result: undefined, next: { ...state, runs } };
4059
4060
  });
4060
- if (removed > 0) {
4061
- this.autoLearnLastStatus = `cleaned ${removed} artifact(s)`;
4062
- this.updateAutoLearnFooter();
4063
- }
4061
+ this.updateAutoLearnFooter();
4064
4062
  }
4065
4063
  markAutoLearnReservationRunning(reservation, pid, settings) {
4066
4064
  this.withAutoLearnStateLock((current) => {
@@ -4113,6 +4111,7 @@ export class InteractiveMode {
4113
4111
  const args = buildAutoLearnSpawnArgs(spawnTarget, {
4114
4112
  name: `Auto Learn ${runId}`,
4115
4113
  modelPattern,
4114
+ thinkingLevel: AUTO_LEARN_THINKING_LEVEL,
4116
4115
  sessionDir,
4117
4116
  sessionId,
4118
4117
  promptPath,
@@ -4121,7 +4120,6 @@ export class InteractiveMode {
4121
4120
  if (invalidSpawnInput) {
4122
4121
  const message = `Auto Learn not started: ${invalidSpawnInput} contains a null byte.`;
4123
4122
  this.appendAutoLearnLog(logPath, message);
4124
- this.autoLearnLastStatus = "start failed";
4125
4123
  this.updateAutoLearnFooter();
4126
4124
  return `${message} Log: ${logPath}`;
4127
4125
  }
@@ -4149,7 +4147,6 @@ export class InteractiveMode {
4149
4147
  const message = error instanceof Error ? error.message : String(error);
4150
4148
  this.releaseAutoLearnReservation(reservation, options.cooldownKind);
4151
4149
  this.appendAutoLearnLog(logPath, `Auto Learn failed to write prompt file: ${message}`);
4152
- this.autoLearnLastStatus = "start failed";
4153
4150
  this.updateAutoLearnFooter();
4154
4151
  return `Auto Learn not started: failed to write prompt file (${message}). Log: ${logPath}`;
4155
4152
  }
@@ -4177,7 +4174,6 @@ export class InteractiveMode {
4177
4174
  const message = error instanceof Error ? error.message : String(error);
4178
4175
  this.releaseAutoLearnReservation(reservation, options.cooldownKind);
4179
4176
  this.appendAutoLearnLog(logPath, `Auto Learn failed to start: ${message}`);
4180
- this.autoLearnLastStatus = "start failed";
4181
4177
  this.updateAutoLearnFooter();
4182
4178
  return `Auto Learn not started: failed to spawn background learner (${message}). Log: ${logPath}`;
4183
4179
  }
@@ -4193,7 +4189,6 @@ export class InteractiveMode {
4193
4189
  }
4194
4190
  if (!child || typeof child.pid !== "number" || child.pid <= 0) {
4195
4191
  this.releaseAutoLearnReservation(reservation, options.cooldownKind);
4196
- this.autoLearnLastStatus = "start failed";
4197
4192
  this.updateAutoLearnFooter();
4198
4193
  return `Auto Learn not started: failed to spawn background learner. Log: ${logPath}`;
4199
4194
  }
@@ -4204,9 +4199,8 @@ export class InteractiveMode {
4204
4199
  });
4205
4200
  child.unref();
4206
4201
  this.markAutoLearnReservationRunning(reservation, childPid, settings);
4207
- this.autoLearnLastStatus = `running ${modelPattern}`;
4208
4202
  this.updateAutoLearnFooter();
4209
- return `Auto Learn started (${reason}) with ${modelPattern}. Log: ${logPath}`;
4203
+ return `Auto Learn started. Log: ${logPath}`;
4210
4204
  }
4211
4205
  sanitizeAutoLearnDigestText(text) {
4212
4206
  return text
@@ -4342,12 +4336,12 @@ export class InteractiveMode {
4342
4336
  return false;
4343
4337
  const decision = this.evaluateAutoLearn(false);
4344
4338
  if (!decision.shouldRun) {
4345
- this.autoLearnLastStatus = decision.reason;
4346
4339
  this.updateAutoLearnFooter();
4347
4340
  return false;
4348
4341
  }
4349
4342
  const message = this.launchAutoLearn(decision.reason, false);
4350
- this.showStatus(message);
4343
+ if (!message.startsWith("Auto Learn started"))
4344
+ this.showStatus(message);
4351
4345
  return message.startsWith("Auto Learn started");
4352
4346
  }
4353
4347
  maybeStartAutonomyReview(messages) {
@@ -4361,7 +4355,8 @@ export class InteractiveMode {
4361
4355
  promptKind: "reflection",
4362
4356
  turnDigest: decision.digest,
4363
4357
  });
4364
- this.showStatus(message);
4358
+ if (!message.startsWith("Auto Learn started"))
4359
+ this.showStatus(message);
4365
4360
  return message.startsWith("Auto Learn started");
4366
4361
  }
4367
4362
  updateAutoLearnFooter() {
@@ -4370,7 +4365,10 @@ export class InteractiveMode {
4370
4365
  this.footerDataProvider.setExtensionStatus("auto-learn", undefined);
4371
4366
  return;
4372
4367
  }
4373
- this.footerDataProvider.setExtensionStatus("auto-learn", theme.fg("accent", `learn: ${this.autoLearnLastStatus}`));
4368
+ const tenant = this.getAutoLearnTenantKey();
4369
+ const state = this.getPrunedAutoLearnState();
4370
+ const hasActiveRun = Object.values(state.runs ?? {}).some((run) => run.tenant === tenant && this.isAutoLearnPidAlive(run.pid));
4371
+ this.footerDataProvider.setExtensionStatus("auto-learn", hasActiveRun ? theme.fg("warning", "(learning)") : undefined);
4374
4372
  this.footer.invalidate();
4375
4373
  this.ui.requestRender();
4376
4374
  }