free-coding-models 0.3.12 → 0.3.14

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.
@@ -350,6 +350,38 @@ export function createKeyHandler(ctx) {
350
350
  }
351
351
  }
352
352
 
353
+ // 📖 Keep the width-warning runtime state synced with the persisted Settings toggle
354
+ // 📖 so the overlay reacts immediately when the user enables or disables it.
355
+ function syncWidthsWarningState() {
356
+ const widthsWarningDisabled = state.config.settings?.disableWidthsWarning === true
357
+ state.disableWidthsWarning = widthsWarningDisabled
358
+
359
+ if (widthsWarningDisabled) {
360
+ state.widthWarningStartedAt = null
361
+ state.widthWarningDismissed = false
362
+ return
363
+ }
364
+
365
+ state.widthWarningShowCount = 0
366
+ if ((state.terminalCols || 80) < 166) {
367
+ state.widthWarningStartedAt = Date.now()
368
+ state.widthWarningDismissed = false
369
+ return
370
+ }
371
+
372
+ state.widthWarningStartedAt = null
373
+ state.widthWarningDismissed = false
374
+ }
375
+
376
+ // 📖 Toggle the width-warning setting and apply the effect immediately instead
377
+ // 📖 of waiting for a resize or restart.
378
+ function toggleWidthsWarningSetting() {
379
+ if (!state.config.settings) state.config.settings = {}
380
+ state.config.settings.disableWidthsWarning = !state.config.settings.disableWidthsWarning
381
+ syncWidthsWarningState()
382
+ saveConfig(state.config)
383
+ }
384
+
353
385
  function resetInstallEndpointsOverlay() {
354
386
  state.installEndpointsOpen = false
355
387
  state.installEndpointsPhase = 'providers'
@@ -1040,9 +1072,7 @@ export function createKeyHandler(ctx) {
1040
1072
 
1041
1073
  // 📖 Widths Warning toggle (Enter to toggle)
1042
1074
  if (state.settingsCursor === widthWarningRowIdx) {
1043
- if (!state.config.settings) state.config.settings = {}
1044
- state.config.settings.disableWidthsWarning = !state.config.settings.disableWidthsWarning
1045
- saveConfig(state.config)
1075
+ toggleWidthsWarningSetting()
1046
1076
  return
1047
1077
  }
1048
1078
 
@@ -1080,9 +1110,7 @@ export function createKeyHandler(ctx) {
1080
1110
  ) return
1081
1111
  // 📖 Widths Warning toggle (disable/enable)
1082
1112
  if (state.settingsCursor === widthWarningRowIdx) {
1083
- if (!state.config.settings) state.config.settings = {}
1084
- state.config.settings.disableWidthsWarning = !state.config.settings.disableWidthsWarning
1085
- saveConfig(state.config)
1113
+ toggleWidthsWarningSetting()
1086
1114
  return
1087
1115
  }
1088
1116
  // 📖 Profile system removed - API keys now persist permanently across all sessions
package/src/overlays.js CHANGED
@@ -217,11 +217,13 @@ export function createOverlayRenderers(state, deps) {
217
217
  const updateRow = `${updateBullet}${chalk.bold(updateActionLabel).padEnd(44)} ${updateStatus}`
218
218
  cursorLineByRow[updateRowIdx] = lines.length
219
219
  lines.push(updateCursor ? chalk.bgRgb(30, 30, 60)(updateRow) : updateRow)
220
- // 📖 Widths Warning toggle row (disable widths warning)
220
+ // 📖 Width warning visibility row for the startup narrow-terminal overlay.
221
221
  const disableWidthsWarning = Boolean(state.config.settings?.disableWidthsWarning)
222
222
  const widthWarningBullet = state.settingsCursor === widthWarningRowIdx ? chalk.bold.cyan(' ❯ ') : chalk.dim(' ')
223
- const widthWarningStatus = disableWidthsWarning ? chalk.greenBright('DISABLED') : chalk.dim('enabled')
224
- const widthWarningRow = `${widthWarningBullet}${chalk.bold('Disable Widths Warning').padEnd(44)} ${widthWarningStatus}`
223
+ const widthWarningStatus = disableWidthsWarning
224
+ ? chalk.redBright('🙈 Disabled')
225
+ : chalk.greenBright('👁 Enabled')
226
+ const widthWarningRow = `${widthWarningBullet}${chalk.bold('Small Width Warnings').padEnd(44)} ${widthWarningStatus}`
225
227
  cursorLineByRow[widthWarningRowIdx] = lines.length
226
228
  lines.push(state.settingsCursor === widthWarningRowIdx ? chalk.bgRgb(30, 30, 60)(widthWarningRow) : widthWarningRow)
227
229
  if (updateState === 'error' && state.settingsUpdateError) {
@@ -181,7 +181,7 @@ export function renderTable(results, pendingPings, frame, cursor = null, sortCol
181
181
  const W_TOKENS = 7
182
182
  // const W_USAGE = 7 // Usage column removed
183
183
  const MIN_TABLE_WIDTH = 166
184
- const warningDurationMs = 4_000
184
+ const warningDurationMs = 2_000
185
185
  const elapsed = widthWarningStartedAt ? Math.max(0, Date.now() - widthWarningStartedAt) : warningDurationMs
186
186
  const remainingMs = Math.max(0, warningDurationMs - elapsed)
187
187
  const showWidthWarning = terminalCols > 0 && terminalCols < MIN_TABLE_WIDTH && !disableWidthsWarning && !widthWarningDismissed && widthWarningShowCount < 2 && remainingMs > 0