@yemi33/minions 0.1.2380 → 0.1.2381

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.
@@ -138,7 +138,7 @@ const RENDER_VERSIONS = {
138
138
  // Bumped 4→5 for the clickable checkout-mode pill + picker (W-mr1b67zi0006b788).
139
139
  // Bumped 5→6 for multi-select hybrid liveValidation.type support (W-mr2m1ute000a9c01).
140
140
  // Bumped 6→7 for the liveValidation.autoDispatch toggle + pill "· auto-validate" suffix (W-mr2q361a00097e5c).
141
- projects: 7,
141
+ projects: 9,
142
142
  notes: 1,
143
143
  prd: 3,
144
144
  prs: 3,
@@ -105,13 +105,13 @@ function _renderProjectBranch(p) {
105
105
  // "Live checkout" (live — agents run in-place inside the operator's working
106
106
  // tree). Driven by p.checkoutMode (shared.CHECKOUT_MODES; engine defaults
107
107
  // unset → 'worktree'). Live is the riskier/special mode (capped to one mutating
108
- // dispatch per project, refuses on a dirty tree) so it gets a more prominent
109
- // color than the muted worktree pill.
108
+ // dispatch per project, with configurable dirty-tree recovery) so it gets a
109
+ // more prominent color than the muted worktree pill.
110
110
  //
111
111
  // Hybrid live-validation: when checkoutMode is 'live' AND p.liveValidationType
112
- // is set, coding WIs author in isolated worktrees and only the named validation
113
- // type runs in-place on the live checkout. This is a materially different
114
- // dispatch profile from full-live, so it gets its own pill.
112
+ // is set, only selected WI types run in-place and all others use isolated
113
+ // worktrees. This is a materially different dispatch profile from full-live,
114
+ // so it gets its own pill.
115
115
  // W-mr1b67zi0006b788: the pill is clickable — opens an inline picker (see
116
116
  // _openCheckoutModeMenu below) to switch between Worktrees / Live checkout /
117
117
  // Hybrid dispatch modes without leaving the Projects view. Shared
@@ -125,6 +125,10 @@ function _renderWorktreeModePill(p) {
125
125
  const common = ' data-checkout-pill="' + name + '" role="button" tabindex="0" aria-haspopup="true" aria-label="Change checkout mode"';
126
126
  if (p.checkoutMode === 'live') {
127
127
  const types = _liveValidationTypesArray(p);
128
+ if (p.liveValidationInvalid) {
129
+ const effectiveTypes = types.length > 0 ? types.join(', ') : 'none';
130
+ return ' <span class="project-mode-pill project-mode-hybrid project-mode-pill-clickable project-warn"' + common + ' title="Invalid hybrid configuration — unsupported settings are ignored. Effective live work-item types: ' + escHtml(effectiveTypes) + '. Click to repair.">⚠ Hybrid · invalid</span>';
131
+ }
128
132
  if (types.length > 0) {
129
133
  const typesText = types.join(', ');
130
134
  const vt = escapeHtml(typesText);
@@ -134,20 +138,19 @@ function _renderWorktreeModePill(p) {
134
138
  const autoDispatch = p.liveValidationAutoDispatch === true;
135
139
  const autoSuffix = autoDispatch ? ' · auto-validate' : '';
136
140
  const autoTitleBit = autoDispatch
137
- ? ' A validation work item is automatically dispatched after each coding work item completes.'
138
- : ' Auto-validation is OFF — validation must be dispatched manually after each coding work item completes.';
139
- return ' <span class="project-mode-pill project-mode-hybrid project-mode-pill-clickable"' + common + ' title="Hybrid live-validationcoding work items author in isolated worktrees; only the &quot;' + vt + '&quot; validation type(s) run in-place on the live checkout (capped to one mutating dispatch, refused on a dirty tree).' + escHtml(autoTitleBit) + ' Click to change.">⚡ Hybrid · ' + vt + escHtml(autoSuffix) + '</span>';
141
+ ? ' A test work item is automatically dispatched after each eligible coding work item completes.'
142
+ : ' Auto-validation is OFF — validation must be dispatched manually.';
143
+ return ' <span class="project-mode-pill project-mode-hybrid project-mode-pill-clickable"' + common + ' title="Hybrid dispatch — only the &quot;' + vt + '&quot; work-item type(s) run in-place; all others use isolated worktrees. Live work is capped to one mutating dispatch, and dirty-tree handling follows the configured auto-stash/reset policy.' + escHtml(autoTitleBit) + ' Click to change.">⚡ Hybrid · ' + vt + escHtml(autoSuffix) + '</span>';
140
144
  }
141
- return ' <span class="project-mode-pill project-mode-live project-mode-pill-clickable"' + common + ' title="Live-checkout dispatch mode — agents run in-place inside the project working tree (no isolated worktree); capped to one mutating dispatch and refused on a dirty tree. Click to change.">⚡ Live checkout</span>';
145
+ return ' <span class="project-mode-pill project-mode-live project-mode-pill-clickable"' + common + ' title="Live-checkout dispatch mode — agents run in-place inside the project working tree (no isolated worktree); capped to one mutating dispatch. Dirty-tree handling follows the configured auto-stash/reset policy. Click to change.">⚡ Live checkout</span>';
142
146
  }
143
147
  return ' <span class="project-mode-pill project-mode-isolated project-mode-pill-clickable"' + common + ' title="Worktree dispatch mode (default) — each agent runs in its own git worktree. Click to change.">Worktrees</span>';
144
148
  }
145
149
 
146
- // Work-item types eligible for hybrid live-validation (W-mr1b67zi0006b788).
147
- // Mirrors the set the server documents for project.liveValidation.type;
148
- // intentionally excludes the illustrative "build-and-test" example from the
149
- // server comments since that isn't a real WORK_TYPE value.
150
- const CHECKOUT_MODE_HYBRID_TYPES = ['implement', 'fix', 'docs', 'decompose', 'explore', 'ask', 'review', 'test', 'verify', 'setup'];
150
+ // Canonical work-item types that can meaningfully use the live checkout.
151
+ // Read-only root tasks are omitted because hybrid routing cannot change where
152
+ // they run. `build-and-test` is a playbook alias; `test` is the WI type.
153
+ const CHECKOUT_MODE_HYBRID_TYPES = ['test', 'implement', 'implement:large', 'fix', 'build-fix-complex', 'docs', 'decompose', 'review', 'verify', 'setup'];
151
154
  const CHECKOUT_MODE_HYBRID_DEFAULT_TYPE = 'test';
152
155
 
153
156
  function _findProjectInLastStatus(name) {
@@ -230,9 +233,10 @@ function _openCheckoutModeMenu(projectName, anchorEl) {
230
233
  desc.textContent = descText;
231
234
  item.appendChild(desc);
232
235
  }
236
+ const liveTypes = _liveValidationTypesArray(project);
233
237
  const isActive = (mode === 'worktree' && project.checkoutMode !== 'live')
234
- || (mode === 'live' && project.checkoutMode === 'live' && _liveValidationTypesArray(project).length === 0)
235
- || (mode === 'hybrid' && project.checkoutMode === 'live' && _liveValidationTypesArray(project).length > 0);
238
+ || (mode === 'live' && project.checkoutMode === 'live' && liveTypes.length === 0 && !project.liveValidationInvalid)
239
+ || (mode === 'hybrid' && project.checkoutMode === 'live' && (liveTypes.length > 0 || project.liveValidationInvalid));
236
240
  if (isActive) {
237
241
  item.setAttribute('aria-checked', 'true');
238
242
  item.classList.add('checkout-mode-menu-item-active');
@@ -254,8 +258,8 @@ function _openCheckoutModeMenu(projectName, anchorEl) {
254
258
  }
255
259
 
256
260
  addItem('Worktrees (default)', 'worktree', 'Each dispatch runs in its own isolated git worktree. Fully parallel, never touches your working directory.');
257
- addItem('Live checkout', 'live', 'Agents run in-place in the project folder. One mutating dispatch at a time; refuses to run on a dirty tree.');
258
- addItem('Hybrid dispatch…', 'hybrid', 'Coding work authors in isolated worktrees; only a chosen validation step (e.g. build-and-test) runs on the real checkout.');
261
+ addItem('Live checkout', 'live', 'Agents run in-place in the project folder. One mutating dispatch at a time; dirty-tree handling follows the auto-stash/reset policy.');
262
+ addItem('Hybrid dispatch…', 'hybrid', 'Only chosen work-item types (normally test) use the real checkout; all others use isolated worktrees.');
259
263
 
260
264
  document.body.appendChild(menu);
261
265
  const rect = anchorEl.getBoundingClientRect();
@@ -286,7 +290,7 @@ function _renderCheckoutModeHybridStep(menu, projectName) {
286
290
 
287
291
  const label = document.createElement('div');
288
292
  label.className = 'checkout-mode-menu-item';
289
- label.textContent = 'Work-item type(s) to validate live:';
293
+ label.textContent = 'Work-item type(s) to run live:';
290
294
  menu.appendChild(label);
291
295
 
292
296
  const currentTypes = _liveValidationTypesArray(project);
@@ -325,10 +329,23 @@ function _renderCheckoutModeHybridStep(menu, projectName) {
325
329
  autoDispatchCb.className = 'checkout-mode-menu-checkbox checkout-mode-menu-autodispatch-checkbox';
326
330
  autoDispatchCb.checked = project.liveValidationAutoDispatch === true;
327
331
  const autoDispatchText = document.createElement('span');
328
- autoDispatchText.textContent = 'Automatically validate after each coding work item completes';
332
+ autoDispatchText.textContent = 'Automatically run a test validation after each eligible coding work item completes';
329
333
  autoDispatchRow.appendChild(autoDispatchCb);
330
334
  autoDispatchRow.appendChild(autoDispatchText);
331
335
  menu.appendChild(autoDispatchRow);
336
+ const testTypeCheckbox = checkboxes.find(function(cb) {
337
+ return cb.value === CHECKOUT_MODE_HYBRID_DEFAULT_TYPE;
338
+ });
339
+ function syncAutoDispatchType() {
340
+ if (autoDispatchCb.checked && testTypeCheckbox) testTypeCheckbox.checked = true;
341
+ }
342
+ autoDispatchCb.addEventListener('change', syncAutoDispatchType);
343
+ if (testTypeCheckbox) {
344
+ testTypeCheckbox.addEventListener('change', function() {
345
+ if (!testTypeCheckbox.checked) autoDispatchCb.checked = false;
346
+ });
347
+ }
348
+ syncAutoDispatchType();
332
349
 
333
350
  const actions = document.createElement('div');
334
351
  actions.className = 'checkout-mode-menu-actions';
@@ -349,9 +366,9 @@ function _renderCheckoutModeHybridStep(menu, projectName) {
349
366
  applyBtn.className = 'checkout-mode-menu-btn checkout-mode-menu-btn-primary';
350
367
  applyBtn.textContent = 'Apply';
351
368
  applyBtn.addEventListener('click', function() {
369
+ const autoDispatch = autoDispatchCb.checked;
352
370
  const types = checkboxes.filter(function(cb) { return cb.checked; }).map(function(cb) { return cb.value; });
353
371
  if (types.length === 0) return; // require at least one selected type
354
- const autoDispatch = autoDispatchCb.checked;
355
372
  _closeCheckoutModeMenu();
356
373
  _applyCheckoutModeChange(projectName, 'live', types, autoDispatch);
357
374
  });
@@ -392,8 +409,8 @@ async function _applyCheckoutModeChange(projectName, newMode, liveValidationType
392
409
  // explicitly in the confirm message rather than burying it in the label.
393
410
  const autoDispatchNote = typesForLabel.length > 0
394
411
  ? (autoDispatchOn
395
- ? ' Auto-validation will be turned ON — a validation work item will be dispatched automatically after each coding work item completes, and coding agents will skip local builds/tests.'
396
- : ' Auto-validation will be OFF — you will need to dispatch validation manually after each coding work item completes.')
412
+ ? ' Auto-validation will be turned ON — a test work item will be dispatched automatically after each eligible coding work item completes, and eligible coding agents will skip local builds/tests.'
413
+ : ' Auto-validation will be OFF — you will need to dispatch validation manually.')
397
414
  : '';
398
415
  const ok = await confirmDialog({
399
416
  title: 'Change checkout mode?',
@@ -407,12 +424,14 @@ async function _applyCheckoutModeChange(projectName, newMode, liveValidationType
407
424
  const prevMode = project.checkoutMode;
408
425
  const prevType = project.liveValidationType;
409
426
  const prevAutoDispatch = project.liveValidationAutoDispatch;
427
+ const prevInvalid = project.liveValidationInvalid;
410
428
  const nextType = (newMode === 'live' && liveValidationType) ? liveValidationType : null;
411
429
  // Optimistic flip BEFORE awaiting the API call (per dashboard convention —
412
430
  // see projectChipRemove / removePinnedNote); reverted in the catch below.
413
431
  project.checkoutMode = newMode;
414
432
  project.liveValidationType = nextType;
415
433
  project.liveValidationAutoDispatch = nextType ? autoDispatchOn : false;
434
+ project.liveValidationInvalid = false;
416
435
  if (window._lastStatus && Array.isArray(window._lastStatus.projects)) renderProjects(window._lastStatus.projects);
417
436
 
418
437
  try {
@@ -434,6 +453,7 @@ async function _applyCheckoutModeChange(projectName, newMode, liveValidationType
434
453
  project.checkoutMode = prevMode;
435
454
  project.liveValidationType = prevType;
436
455
  project.liveValidationAutoDispatch = prevAutoDispatch;
456
+ project.liveValidationInvalid = prevInvalid;
437
457
  if (window._lastStatus && Array.isArray(window._lastStatus.projects)) renderProjects(window._lastStatus.projects);
438
458
  showToast('cmd-toast', 'Failed to update checkout mode: ' + (err && err.message || err), false);
439
459
  }
@@ -277,16 +277,18 @@ async function openSettings() {
277
277
  // (honors the legacy worktreeMode field). Chip is hidden by default and
278
278
  // toggled reactively below.
279
279
  // W-mr9mx93d000x1dda — third option "Hybrid dispatch": checkoutMode:'live'
280
- // PLUS a liveValidation block (coding WIs author in isolated worktrees; only
281
- // the chosen validation type(s) run in-place on the live checkout, with an
282
- // optional auto-dispatch-after-coding toggle). This mirrors the Projects-bar
280
+ // PLUS a liveValidation block (only chosen work-item types run in-place;
281
+ // all others use isolated worktrees, with an optional test auto-dispatch
282
+ // after eligible coding work). This mirrors the Projects-bar
283
283
  // picker (render-other.js _openCheckoutModeMenu / _renderCheckoutModeHybridStep)
284
284
  // so both surfaces configure the SAME liveValidation shape identically.
285
285
  var currentWtMode = (p.checkoutMode === 'live') ? 'live' : 'worktree';
286
286
  var lvTypes = (window._liveValidationTypesArray ? window._liveValidationTypesArray(p) : []);
287
- // 3-way UI mode: worktree / live / hybrid. Hybrid = live + >=1 validation type.
287
+ // 3-way UI mode: worktree / live / hybrid. Keep invalid persisted hybrid
288
+ // blocks in the hybrid editor so saving can repair rather than hide them as
289
+ // full-live.
288
290
  var currentCheckoutMode = (currentWtMode === 'live')
289
- ? (lvTypes.length > 0 ? 'hybrid' : 'live')
291
+ ? ((lvTypes.length > 0 || p.liveValidationInvalid) ? 'hybrid' : 'live')
290
292
  : 'worktree';
291
293
  var hybridTypes = window.CHECKOUT_MODE_HYBRID_TYPES || [];
292
294
  var hybridDefaultType = window.CHECKOUT_MODE_HYBRID_DEFAULT_TYPE || 'test';
@@ -303,26 +305,26 @@ async function openSettings() {
303
305
  var hybridPanel =
304
306
  '<div data-checkout-hybrid-panel="' + escHtml(p.name) + '" style="' + (currentCheckoutMode === 'hybrid' ? '' : 'display:none;') + 'margin-top:6px">' +
305
307
  '<div style="padding:6px 8px;background:rgba(234,179,8,0.12);border:1px solid var(--yellow);border-radius:4px;color:var(--yellow);font-size:var(--text-xs);line-height:1.4;margin-bottom:6px">' +
306
- '⚠ Hybrid mode: coding work items author in isolated worktrees; only the chosen validation type(s) run in-place on the live checkout (one mutating dispatch at a time; refused on a dirty tree).' +
308
+ '⚠ Hybrid mode: only the chosen work-item type(s) run in-place on the live checkout; all others use isolated worktrees (one mutating dispatch at a time; dirty-tree recovery follows the live-checkout auto-stash/reset settings).' +
307
309
  '</div>' +
308
- '<div style="font-size:var(--text-sm);color:var(--muted);margin-bottom:2px">Work-item type(s) to validate live:</div>' +
310
+ '<div style="font-size:var(--text-sm);color:var(--muted);margin-bottom:2px">Work-item type(s) to run live:</div>' +
309
311
  '<div style="margin-bottom:4px">' + hybridTypeChecks + '</div>' +
310
312
  '<label style="display:inline-flex;align-items:center;gap:6px;font-size:var(--text-sm);color:var(--text);margin-top:2px">' +
311
313
  '<input type="checkbox" id="set-liveValidationAutoDispatch-' + escHtml(p.name) + '"' + (hybridAutoPre ? ' checked' : '') + '>' +
312
- '<span>Automatically validate after each coding work item completes</span>' +
314
+ '<span>Automatically run a test validation after each eligible coding work item completes</span>' +
313
315
  '</label>' +
314
- '<div data-checkout-hybrid-error="' + escHtml(p.name) + '" style="display:none;margin-top:6px;color:var(--red);font-size:var(--text-xs)">Select at least one work-item type to validate live.</div>' +
316
+ '<div data-checkout-hybrid-error="' + escHtml(p.name) + '" style="display:none;margin-top:6px;color:var(--red);font-size:var(--text-xs)">Select at least one work-item type to run live.</div>' +
315
317
  '</div>';
316
318
  var worktreeModeBlock =
317
319
  '<div data-search="' + escHtml(wtModeSearch) + '" style="margin-bottom:6px">' +
318
320
  '<label style="font-size:var(--text-sm);color:var(--muted);display:block;margin-bottom:2px">Checkout mode</label>' +
319
321
  '<select id="set-checkoutMode-' + escHtml(p.name) + '" data-checkout-mode-select="' + escHtml(p.name) + '" style="width:100%;padding:4px 6px;background:var(--surface);border:1px solid var(--border);border-radius:4px;color:var(--text);font-size:var(--text-md)">' +
320
322
  '<option value="worktree" title="Each dispatch runs in its own isolated git worktree. Fully parallel, never touches your working directory."' + (currentCheckoutMode === 'worktree' ? ' selected' : '') + '>Worktree (default)</option>' +
321
- '<option value="live" title="Agents run in-place in the project folder. One mutating dispatch at a time; refuses to run on a dirty tree."' + (currentCheckoutMode === 'live' ? ' selected' : '') + '>Live checkout</option>' +
322
- '<option value="hybrid" title="Coding work authors in isolated worktrees; only a chosen validation step runs on the real checkout."' + (currentCheckoutMode === 'hybrid' ? ' selected' : '') + '>Hybrid dispatch</option>' +
323
+ '<option value="live" title="Agents run in-place in the project folder. One mutating dispatch at a time; dirty-tree handling follows the auto-stash/reset policy."' + (currentCheckoutMode === 'live' ? ' selected' : '') + '>Live checkout</option>' +
324
+ '<option value="hybrid" title="Only chosen work-item types run on the real checkout; all others use isolated worktrees."' + (currentCheckoutMode === 'hybrid' ? ' selected' : '') + '>Hybrid dispatch</option>' +
323
325
  '</select>' +
324
326
  '<div data-checkout-mode-chip="' + escHtml(p.name) + '" style="' + (currentCheckoutMode === 'live' ? '' : 'display:none;') + 'margin-top:6px;padding:6px 8px;background:rgba(234,179,8,0.12);border:1px solid var(--yellow);border-radius:4px;color:var(--yellow);font-size:var(--text-xs);line-height:1.4">' +
325
- '⚠ Live mode: dispatches run directly in this repo\'s checkout. Only one mutating dispatch runs at a time. Dirty working trees block dispatch — commit or stash before running.' +
327
+ '⚠ Live mode: dispatches run directly in this repo\'s checkout. Only one mutating dispatch runs at a time. Dirty-tree behavior follows the auto-stash/reset settings below.' +
326
328
  '</div>' +
327
329
  hybridPanel +
328
330
  '</div>';
@@ -774,6 +776,17 @@ async function openSettings() {
774
776
  if (hybridPanel) hybridPanel.style.display = (sel.value === 'hybrid') ? '' : 'none';
775
777
  });
776
778
  });
779
+ document.querySelectorAll('[id^="set-liveValidationAutoDispatch-"]').forEach(function(autoDispatch) {
780
+ autoDispatch.addEventListener('change', function() {
781
+ if (!autoDispatch.checked) return;
782
+ const projectName = autoDispatch.id.slice('set-liveValidationAutoDispatch-'.length);
783
+ const esc = (window.CSS && CSS.escape ? CSS.escape(projectName) : projectName);
784
+ const testType = document.querySelector(
785
+ '[data-live-validation-type="' + esc + '"][value="test"]',
786
+ );
787
+ if (testType) testType.checked = true;
788
+ });
789
+ });
777
790
  }
778
791
 
779
792
  // Lazily open/close the per-agent charter editor in the Settings Agents table.
@@ -1244,13 +1257,23 @@ async function saveSettings() {
1244
1257
  const types = [];
1245
1258
  typeEls.forEach(function(el) { if (el && el.checked) types.push(el.value); });
1246
1259
  const errEl = document.querySelector('[data-checkout-hybrid-error="' + esc + '"]');
1260
+ const autoEl = document.getElementById('set-liveValidationAutoDispatch-' + p.name);
1261
+ const autoDispatch = autoEl?.checked === true;
1247
1262
  if (types.length === 0) {
1248
- hybridValidationErrors.push(p.name);
1249
- if (errEl) errEl.style.display = '';
1263
+ hybridValidationErrors.push(p.name + ': select at least one live type');
1264
+ if (errEl) {
1265
+ errEl.textContent = 'Select at least one work-item type to run live.';
1266
+ errEl.style.display = '';
1267
+ }
1268
+ } else if (autoDispatch && types.indexOf('test') === -1) {
1269
+ hybridValidationErrors.push(p.name + ': auto-validation requires test');
1270
+ if (errEl) {
1271
+ errEl.textContent = 'Automatic validation requires the test type.';
1272
+ errEl.style.display = '';
1273
+ }
1250
1274
  } else {
1251
1275
  if (errEl) errEl.style.display = 'none';
1252
- const autoEl = document.getElementById('set-liveValidationAutoDispatch-' + p.name);
1253
- liveValidation = { type: types, autoDispatch: !!(autoEl && autoEl.checked) };
1276
+ liveValidation = { type: types, autoDispatch };
1254
1277
  }
1255
1278
  }
1256
1279
  // W-mqtvnnj1000357fa — per-project live-checkout auto-stash override.
@@ -1280,7 +1303,7 @@ async function saveSettings() {
1280
1303
  });
1281
1304
 
1282
1305
  if (hybridValidationErrors.length > 0) {
1283
- throw new Error('Hybrid dispatch needs at least one validation work-item type for: ' + hybridValidationErrors.join(', '));
1306
+ throw new Error('Invalid hybrid dispatch configuration: ' + hybridValidationErrors.join(', '));
1284
1307
  }
1285
1308
 
1286
1309
  // Save config
package/dashboard.js CHANGED
@@ -421,8 +421,14 @@ function mergeSettingsConfigUpdate(current, candidate, body, patch = {}) {
421
421
  // `candidate` in handleSettingsUpdate) is silently dropped on the way
422
422
  // through mergeSettingsConfigUpdate → mutateDashboardConfig and never
423
423
  // reaches disk — the endpoint would return 200 but persist nothing.
424
+ const modeWasRequested = Object.prototype.hasOwnProperty.call(update, 'checkoutMode')
425
+ || Object.prototype.hasOwnProperty.call(update, 'worktreeMode');
424
426
  if (Object.prototype.hasOwnProperty.call(candidateProject, 'checkoutMode')) {
425
427
  currentProject.checkoutMode = candidateProject.checkoutMode;
428
+ } else if (Object.prototype.hasOwnProperty.call(candidateProject, 'worktreeMode')) {
429
+ currentProject.checkoutMode = shared.resolveCheckoutMode(candidateProject);
430
+ } else if (!modeWasRequested && Object.prototype.hasOwnProperty.call(currentProject, 'worktreeMode')) {
431
+ currentProject.checkoutMode = shared.resolveCheckoutMode(currentProject);
426
432
  } else {
427
433
  delete currentProject.checkoutMode;
428
434
  }
@@ -832,7 +838,7 @@ async function copyWorkItemPrFields(item, input, pr = null, opts = {}) {
832
838
  if (structuredRef) {
833
839
  prRef = structuredRef; // explicit operator intent — trusted, no verification
834
840
  } else {
835
- if (String(item?.type || '').toLowerCase() !== WORK_TYPE.FIX) return;
841
+ if (!shared.isFixLikeWorkType(String(item?.type || '').toLowerCase())) return;
836
842
  const looseRef = getWorkItemPrRef(input);
837
843
  if (!looseRef) return;
838
844
  // issue #246 — confirm the loose ref is a PR (not an issue) before stamping.
@@ -2538,26 +2544,7 @@ function _buildStatusSlowState() {
2538
2544
  ...status,
2539
2545
  mainBranch,
2540
2546
  branchMismatch,
2541
- // P-a3f9b209 / W-mqgzcrln002613b3 — surface the per-project dispatch
2542
- // mode so the Projects view can render a "Worktrees" vs "Live checkout"
2543
- // pill. resolveCheckoutMode honors the legacy worktreeMode field and
2544
- // defaults to 'worktree' when unset (matches engine spawn behavior).
2545
- checkoutMode: shared.resolveCheckoutMode(p),
2546
- // Surface the hybrid live-validation type (when configured) so the
2547
- // Projects view can render a distinct "Hybrid" pill: coding WIs author
2548
- // in isolated worktrees while only the named validation type runs
2549
- // in-place on the live checkout. Only meaningful when checkoutMode is
2550
- // 'live'; null otherwise (full-live or worktree projects).
2551
- liveValidationType: (shared.resolveCheckoutMode(p) === 'live' && p.liveValidation && p.liveValidation.type)
2552
- ? p.liveValidation.type
2553
- : null,
2554
- // W-mr2q361a00097e5c — surface liveValidation.autoDispatch alongside
2555
- // .type so the hybrid picker can preselect the "auto-validate"
2556
- // checkbox and the pill can visibly distinguish manual vs
2557
- // auto-validating hybrid projects. Only meaningful when checkoutMode
2558
- // is 'live'; false otherwise (matches the implicit today-default of
2559
- // autoDispatch being absent/false).
2560
- liveValidationAutoDispatch: !!(shared.resolveCheckoutMode(p) === 'live' && p.liveValidation && p.liveValidation.autoDispatch === true),
2547
+ ..._projectCheckoutConfigView(p),
2561
2548
  };
2562
2549
  }),
2563
2550
  autoMode: {
@@ -4113,20 +4100,40 @@ function _resetPreambleCache() {
4113
4100
  _preambleCacheTs = 0;
4114
4101
  }
4115
4102
 
4116
- // Compact one-word-ish label for a project's effective dispatch checkout mode,
4117
- // for CC state surfaces (preamble + refresh). 'worktree' | 'live' |
4118
- // 'hybrid (live-validation: <type>)' so CC can see at a glance whether a project
4119
- // authors in isolated worktrees, runs in-place on the operator tree, or splits
4120
- // the two (coding → worktree, validation type → live). See resolveCheckoutMode.
4103
+ function _projectLiveValidationTypeValue(p) {
4104
+ const types = shared.resolveLiveValidationTypes(p);
4105
+ if (types.length === 0) return null;
4106
+ return Array.isArray(p?.liveValidation?.type) ? types : types[0];
4107
+ }
4108
+
4109
+ function _projectCheckoutConfigView(p) {
4110
+ const checkoutMode = shared.resolveCheckoutMode(p);
4111
+ return {
4112
+ checkoutMode,
4113
+ liveValidationType: checkoutMode === 'live' ? _projectLiveValidationTypeValue(p) : null,
4114
+ liveValidationInvalid: checkoutMode === 'live' && shared.isLiveValidationConfigInvalid(p),
4115
+ liveValidationAutoDispatch: !!shared.resolveLiveValidationAutoDispatchType(p),
4116
+ };
4117
+ }
4118
+
4119
+ // Compact checkout-mode label for Command Center state surfaces.
4121
4120
  function _projectCheckoutModeLabel(p) {
4122
- const mode = shared.resolveCheckoutMode(p);
4123
- if (mode === 'live' && p && p.liveValidation && p.liveValidation.type) {
4124
- // liveValidation.type may be a single string (legacy) or an array of
4125
- // strings (W-mr2m1ute000a9c01 — multi-select hybrid types); render all.
4126
- const types = Array.isArray(p.liveValidation.type) ? p.liveValidation.type : [p.liveValidation.type];
4121
+ const {
4122
+ checkoutMode,
4123
+ liveValidationType,
4124
+ liveValidationInvalid,
4125
+ } = _projectCheckoutConfigView(p);
4126
+ if (liveValidationInvalid) {
4127
+ const effectiveTypes = liveValidationType
4128
+ ? (Array.isArray(liveValidationType) ? liveValidationType : [liveValidationType])
4129
+ : [];
4130
+ return `hybrid (invalid liveValidation; effective live types: ${effectiveTypes.join(', ') || 'none'})`;
4131
+ }
4132
+ if (checkoutMode === 'live' && liveValidationType) {
4133
+ const types = Array.isArray(liveValidationType) ? liveValidationType : [liveValidationType];
4127
4134
  return `hybrid (live-validation: ${types.join(', ')})`;
4128
4135
  }
4129
- return mode;
4136
+ return checkoutMode;
4130
4137
  }
4131
4138
 
4132
4139
  function buildCCStatePreamble() {
@@ -4299,13 +4306,13 @@ function getWorkItemPrRef(input) {
4299
4306
  // afford to be loose because gating would still require explicit
4300
4307
  // operator intent.
4301
4308
  //
4302
- // FIX-TYPE GATE on the stamp path (W-mqbaby2a000pa8ee): in practice
4309
+ // FIX-LIKE GATE on the stamp path (W-mqbaby2a000pa8ee): in practice
4303
4310
  // the asymmetry leaked — the loose stamp writes to `item.pr_id` (a
4304
4311
  // canonical structured field), and the strict gate later reads
4305
4312
  // `item.pr_id` and sees the loose stamp AS IF it were structured
4306
4313
  // intent. To stop that leak without changing the loose detector
4307
4314
  // (which has other legitimate callers), `copyWorkItemPrFields` now
4308
- // gates the loose result on `item.type === "fix"`. Non-fix WIs only
4315
+ // gates the loose result through `isFixLikeWorkType`. Other WIs only
4309
4316
  // get stamped from structured fields (incl. references/follow-up).
4310
4317
  // See the comment block on `copyWorkItemPrFields` above for details.
4311
4318
  return shared.extractWorkItemPrRef(input);
@@ -10835,19 +10842,7 @@ What would you like to discuss or change? When you're happy, say "approve" and I
10835
10842
  name: p.name,
10836
10843
  localPath: p.localPath || null,
10837
10844
  mainBranch: p.mainBranch || null,
10838
- // P-a3f9b207 — surface checkoutMode so the Settings UI can pre-fill
10839
- // the per-project dropdown. resolveCheckoutMode honors the legacy
10840
- // worktreeMode field; 'worktree' (default) or 'live'.
10841
- checkoutMode: shared.resolveCheckoutMode(p),
10842
- // W-mr9mx93d000x1dda — surface the hybrid liveValidation config
10843
- // (type(s) + autoDispatch) so the Settings → Projects checkout-mode
10844
- // control can pre-fill its Hybrid sub-panel authoritatively (mirrors
10845
- // the /api/status project mapping the Projects-bar picker reads).
10846
- // Only meaningful under checkoutMode:'live'; null/false otherwise.
10847
- liveValidationType: (shared.resolveCheckoutMode(p) === 'live' && p.liveValidation && p.liveValidation.type)
10848
- ? p.liveValidation.type
10849
- : null,
10850
- liveValidationAutoDispatch: !!(shared.resolveCheckoutMode(p) === 'live' && p.liveValidation && p.liveValidation.autoDispatch === true),
10845
+ ..._projectCheckoutConfigView(p),
10851
10846
  // W-mqtvnnj1000357fa — surface the RAW per-project auto-stash override
10852
10847
  // (true / false / undefined) so the Settings UI can pre-select the
10853
10848
  // tri-state dropdown. Undefined means "use fleet default"