autodev-cli 1.4.202 → 1.4.204

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/out/taskLoop.js CHANGED
@@ -841,6 +841,7 @@ class TaskLoopRunner {
841
841
  this._webhookPoller.setOnCommand((cmd) => this._handleCommand(cmd));
842
842
  this._webhookPoller.setOnMcpUpdate((entries) => this._handleMcpUpdate(entries));
843
843
  this._webhookPoller.setOnSkillUpdate((skills) => this._handleSkillUpdate(skills));
844
+ this._webhookPoller.setOnSettingsUpdate((s) => this._handleSettingsUpdate(s));
844
845
  this._webhookPoller.setOnExportRequest((agentId) => void this._handleExportRequest(agentId));
845
846
  this._webhookPoller.setOnRestoreRequest((agentId, downloadUrl) => void this._handleRestoreRequest(agentId, downloadUrl));
846
847
  this._webhookPoller.setOnExportConfig((exportEnabled, exportDailyBackup, agentId) => this._handleExportConfig(exportEnabled, exportDailyBackup, agentId));
@@ -1102,6 +1103,43 @@ class TaskLoopRunner {
1102
1103
  this._cb?.log(`⚠️ skill update failed: ${err instanceof Error ? err.message : String(err)}`);
1103
1104
  }
1104
1105
  }
1106
+ /**
1107
+ * Handle settings_update pushed from pixel-office: live-flip the opt-in gates
1108
+ * that control mcp_update / skill_update, so the office can enable them
1109
+ * WITHOUT the user hand-editing .autodev/settings.json or restarting the loop.
1110
+ *
1111
+ * SECURITY — this frame is intentionally NOT gated by any opt-in setting: it
1112
+ * IS the mechanism that flips those opt-ins on. Its trust boundary is the
1113
+ * authenticated office WS channel — the very same channel that already
1114
+ * delivers mcp_update, tasks and steering to this agent. A STRICT whitelist
1115
+ * (whitelistRemoteSettingsUpdate) means a frame can only ever set the two
1116
+ * booleans { mcpUpdateEnabled, skillUpdateEnabled } — never arbitrary
1117
+ * settings such as serverApiKey, provider, wsUrl or filesystem paths.
1118
+ */
1119
+ _handleSettingsUpdate(settings) {
1120
+ const root = this._workspaceRoot;
1121
+ if (!root)
1122
+ return;
1123
+ try {
1124
+ const whitelisted = (0, settingsLoader_1.whitelistRemoteSettingsUpdate)(settings);
1125
+ if (Object.keys(whitelisted).length === 0) {
1126
+ this._cb?.log('⚙ settings_update ignored — no recognized keys (only mcpUpdateEnabled/skillUpdateEnabled are accepted)');
1127
+ return;
1128
+ }
1129
+ // Persist so the flip survives a restart…
1130
+ (0, settingsLoader_1.mergeSettingsForRoot)(root, whitelisted);
1131
+ // …and apply live so a subsequent mcp_update/skill_update frame is honored
1132
+ // immediately, with no restart. Only the whitelisted keys are copied.
1133
+ if (this._settings) {
1134
+ Object.assign(this._settings, whitelisted);
1135
+ }
1136
+ const parts = Object.entries(whitelisted).map(([k, v]) => `${k}=${v}`).join(', ');
1137
+ this._cb?.log(`⚙ settings_update applied: ${parts}`);
1138
+ }
1139
+ catch (err) {
1140
+ this._cb?.log(`⚠️ settings_update failed: ${err instanceof Error ? err.message : String(err)}`);
1141
+ }
1142
+ }
1105
1143
  /** Handle export_request from pixel-office: create backup zip and upload. */
1106
1144
  async _handleExportRequest(agentId) {
1107
1145
  const root = this._workspaceRoot;
@@ -1384,10 +1422,15 @@ class TaskLoopRunner {
1384
1422
  return;
1385
1423
  }
1386
1424
  }
1387
- // Persistent-process grok (ACP `grok agent stdio`, grok-cli AND grok-tui):
1388
- // a mid-run steer is a QUEUED session/prompt delivered to the LIVE process —
1389
- // it never exits, so the steer reaches the same long-lived agent.
1390
- if (root && turnInFlight && (provider === 'grok-cli' || provider === 'grok-tui') && (0, grokTuiProvider_1.isGrokAcpBusy)(root)) {
1425
+ // Persistent-process grok (ACP `grok agent stdio`): grok-acp directly, plus
1426
+ // grok-cli/grok-tui when routed over the persistent ACP session. A mid-run
1427
+ // steer is a QUEUED session/prompt delivered to the LIVE process — it never
1428
+ // exits, so the steer reaches the same long-lived agent IMMEDIATELY instead
1429
+ // of being buffered to the turn boundary below. (grok-acp — the explicit
1430
+ // provider added after this branch was first written — was omitted from the
1431
+ // literal grok-cli/grok-tui check, so its steers wrongly fell through to the
1432
+ // boundary buffer; usesGrokAcpSession() covers all three uniformly.)
1433
+ if (root && turnInFlight && usesGrokAcpSession(provider, root) && (0, grokTuiProvider_1.isGrokAcpBusy)(root)) {
1391
1434
  if ((0, grokTuiProvider_1.steerGrokAcp)(root, clean, msg => this._cb?.log(msg))) {
1392
1435
  this._cb?.log(`⚡ Steered mid-turn (grok ACP): "${clean.slice(0, 80)}"`);
1393
1436
  onDelivered?.();