fwdloop 0.26.2 → 0.28.0

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.
Files changed (73) hide show
  1. package/bin/fwdloop +46 -7
  2. package/package.json +2 -2
  3. package/src/authoring.js +21 -1
  4. package/src/canrun.js +23 -0
  5. package/src/config.js +18 -0
  6. package/src/declaration.js +129 -3
  7. package/src/drafter.js +38 -10
  8. package/src/flow.js +2 -1
  9. package/src/launcher.js +4 -2
  10. package/src/learnstore.js +3 -2
  11. package/src/mcp-checks.js +50 -0
  12. package/src/mcp-pick.js +33 -0
  13. package/src/mcp-sources.js +84 -0
  14. package/src/mcp-use.js +54 -0
  15. package/src/natural.js +23 -0
  16. package/src/panel/author.js +17 -1
  17. package/src/panel/authorcard.js +35 -0
  18. package/src/panel/authorflows.js +15 -6
  19. package/src/panel/authorstart.js +10 -6
  20. package/src/panel/authortrigger.js +263 -82
  21. package/src/panel/data.js +127 -9
  22. package/src/panel/index.html +945 -94
  23. package/src/panel/jobgrid.js +127 -0
  24. package/src/panel/scheduler.js +48 -6
  25. package/src/panel/server.js +33 -8
  26. package/src/panel/settings.js +119 -4
  27. package/src/panel/tickets.js +118 -0
  28. package/src/primitives.js +34 -5
  29. package/src/runner.js +129 -15
  30. package/src/schedule.js +5 -0
  31. package/src/summary-words.js +27 -7
  32. package/src/ticket-draft.js +85 -0
  33. package/src/ticket-labels.js +75 -0
  34. package/src/ticket-mcp.js +89 -0
  35. package/src/ticket-next.js +33 -0
  36. package/src/ticket-shape.js +33 -0
  37. package/src/trigger-clock.js +4 -4
  38. package/src/trigger-files.js +4 -4
  39. package/src/trigger-line.js +2 -1
  40. package/src/trigger-tickets.js +238 -0
  41. package/types/authoring.d.ts +5 -1
  42. package/types/canrun.d.ts +7 -0
  43. package/types/config.d.ts +6 -0
  44. package/types/declaration.d.ts +8 -0
  45. package/types/drafter.d.ts +552 -21
  46. package/types/mcp-checks.d.ts +8 -0
  47. package/types/mcp-pick.d.ts +23 -0
  48. package/types/mcp-sources.d.ts +51 -0
  49. package/types/mcp-use.d.ts +12 -0
  50. package/types/natural.d.ts +2 -0
  51. package/types/panel/author.d.ts +44 -0
  52. package/types/panel/authorcard.d.ts +11 -0
  53. package/types/panel/authorflows.d.ts +11 -1
  54. package/types/panel/authorstart.d.ts +3 -1
  55. package/types/panel/authortrigger.d.ts +83 -7
  56. package/types/panel/data.d.ts +78 -5
  57. package/types/panel/jobgrid.d.ts +109 -0
  58. package/types/panel/scheduler.d.ts +7 -2
  59. package/types/panel/server.d.ts +13 -2
  60. package/types/panel/settings.d.ts +3 -2
  61. package/types/panel/tickets.d.ts +103 -0
  62. package/types/primitives.d.ts +15 -2
  63. package/types/runner.d.ts +133 -75
  64. package/types/summary-words.d.ts +24 -4
  65. package/types/ticket-draft.d.ts +104 -0
  66. package/types/ticket-labels.d.ts +42 -0
  67. package/types/ticket-mcp.d.ts +57 -0
  68. package/types/ticket-next.d.ts +23 -0
  69. package/types/ticket-shape.d.ts +30 -0
  70. package/types/trigger-clock.d.ts +4 -3
  71. package/types/trigger-files.d.ts +3 -1
  72. package/types/trigger-line.d.ts +7 -0
  73. package/types/trigger-tickets.d.ts +105 -0
package/src/panel/data.js CHANGED
@@ -24,6 +24,7 @@ import {
24
24
  } from 'node:fs';
25
25
  import { createHash } from 'node:crypto';
26
26
  import { plainPlanCheck } from '../plain-checks.js';
27
+ import { compareNatural } from '../natural.js';
27
28
  import { join, sep } from 'node:path';
28
29
 
29
30
  import {
@@ -47,6 +48,13 @@ import {
47
48
  } from '../summary-words.js';
48
49
  import { MAX_STRUCTURE_RETRIES } from '../drafter.js';
49
50
  import { isResultRun, checkTypeOf, buildResult, downloadOf, readCitedChecks } from './result.js';
51
+ import { ticketListOf, ticketScheduleOf } from './tickets.js';
52
+ import { buildJobGrid } from './jobgrid.js';
53
+ import { readChecks } from '../diary.js';
54
+ import { readRunInputs } from '../runfile.js';
55
+ import { filterUnsure } from '../ticket-labels.js';
56
+ import { readSchedule } from '../schedule.js';
57
+ import { flowTypeOf } from '../declaration.js';
50
58
  import { thinkingRuleWords, thinkingTryWords } from '../thinking.js';
51
59
  import { readLearningsRecord } from '../flowmodel.js';
52
60
  import { readRunThinking } from '../runfile.js';
@@ -243,7 +251,7 @@ export const CRASHED_LABEL = 'crashed after taking your answer — start a fresh
243
251
  * @type {Record<string, string>}
244
252
  */
245
253
  export const SIGN_WORDS = {
246
- '[▶]': 'running', '[·]': 'waiting', '[II]': 'stuck', '[!]': 'expired', '[?]': 'crashed', '[✓]': 'passed', '[✗]': 'failed', '[■]': 'stopped',
254
+ '[▶]': 'running', '[·]': 'waiting', '[II]': 'stuck', '[!]': 'expired', '[?]': 'crashed', '[✓]': 'passed', '[✗]': 'failed', '[■]': 'stopped', '[–]': 'skipped',
247
255
  };
248
256
 
249
257
  /**
@@ -378,13 +386,15 @@ export function glyphPulses(g) {
378
386
  * - `[?]` crashed after taking your answer (amendment 2 (f)) — the answer was
379
387
  * consumed, the process is gone, no end row: cannot be carried on.
380
388
  * @param {{historyRow: any, askJson: any, consumedAnswerExists: boolean, hasStateJson: boolean, resume?: any, liveness?: 'running'|'gone'|'unknown', booksFresh?: boolean, lock?: string, resumable?: boolean, stoppedAtAsk?: string|null, jobEdited?: boolean, starting?: boolean}} ctx
381
- * @returns {{glyph: '[✓]'|'[✗]'|'[·]'|'[!]'|'[▶]'|'[?]'|'[II]'|'[■]', label: string}}
389
+ * @returns {{glyph: '[✓]'|'[✗]'|'[·]'|'[!]'|'[▶]'|'[?]'|'[II]'|'[■]'|'[–]', label: string}}
382
390
  */
383
391
  export function computeGlyph({
384
392
  historyRow, askJson, consumedAnswerExists, hasStateJson, resume, liveness, booksFresh, lock, resumable, stoppedAtAsk, jobEdited, starting,
385
393
  }) {
386
394
  if (historyRow) {
387
395
  if (historyRow.outcome === 'complete') return { glyph: '[✓]', label: 'passed' };
396
+ // M12 piece 3 (item 9): a ticket the signed labels do not match, or a closed one: grey, never failed
397
+ if (historyRow.outcome === 'skipped') return { glyph: '[–]', label: typeof historyRow.skipReason === 'string' && historyRow.skipReason !== '' ? `skipped — ${historyRow.skipReason}` : 'skipped' };
388
398
  // M6 amendment 4: a stopped (or cap-halted) run whose job was edited and signed since cannot be resumed; the words say so.
389
399
  if (jobEdited === true && (historyRow.outcome === 'stopped' || historyRow.outcome === 'cap-halt')) return { glyph: '[■]', label: JOB_EDITED_LINE };
390
400
  // M4e amendment 4 item 4: a run the human stopped, or one that hit its money cap and can be continued, is `[■]` stopped — never "failed".
@@ -1090,6 +1100,19 @@ export function getRunGlyph({
1090
1100
  return computeGlyph(loadRunContext(root, run.flowDir, run.runDir, flow, runId, catalogue, null));
1091
1101
  }
1092
1102
 
1103
+ /**
1104
+ * The time (ms) the run's history row was written, or null when it has none. @param {{root: string, flow: string, runId: string, catalogue: any}} opts
1105
+ */
1106
+ function getRunEndedAt({
1107
+ root, flow, runId, catalogue,
1108
+ }) {
1109
+ const run = resolveRunPath(root, flow, runId);
1110
+ if (!run.ok) return null;
1111
+ const at = loadRunContext(root, run.flowDir, run.runDir, flow, runId, catalogue, null).historyRow?.at;
1112
+ const ms = typeof at === 'string' ? Date.parse(at) : NaN;
1113
+ return Number.isFinite(ms) ? ms : null;
1114
+ }
1115
+
1093
1116
  /**
1094
1117
  * `GET /api/runs` — every flow under `root`, every run under each flow
1095
1118
  * (M4a scope item 2). A flow with zero runs still gets one row (`runId:
@@ -1455,7 +1478,7 @@ function waitingLineOf(ctx) {
1455
1478
  * through the same `runControls` the Stop door uses (`atAsk`), so "waiting" is one decision.
1456
1479
  */
1457
1480
  function jobWaitingLine(root, flowDir, flow, catalogue) {
1458
- const ids = listRunIds(flowDir).sort((a, b) => (Number(b.replace(/\D/g, '')) || 0) - (Number(a.replace(/\D/g, '')) || 0));
1481
+ const ids = listRunIds(flowDir).sort((a, b) => compareNatural(b, a));
1459
1482
  const history = readHistory(flowDir); // `atAsk` needs no end row (`runControls`), so an ended run is skipped by the same `endRow` rule before a context is built for it
1460
1483
  for (const id of ids) {
1461
1484
  const run = resolveRunDir(flowDir, id);
@@ -1481,7 +1504,7 @@ function scheduleBlockOf({ root, flowDir, flow, catalogue, t, home, now }) {
1481
1504
  return scheduleBlockWords({
1482
1505
  trigger: t && t.trigger ? t.trigger : null, home,
1483
1506
  last: lastStart ? { at: lastStart.at, runId: lastStart.runId, outcome: lastGlyph ? (SIGN_WORDS[lastGlyph.glyph] ?? 'ended') : 'ended', catchUp: !!(lastRec && lastRec.catchUp === true) } : null,
1484
- nextSlotMs: t ? t.nextSlotMs : null, armed: !!(t && t.armed), nowMs: now(),
1507
+ nextSlotMs: t ? t.nextSlotMs : null, armed: !!(t && t.armed), waiting: !!(t && t.waiting), lookProblem: t ? t.lookProblem ?? null : null, nowMs: now(),
1485
1508
  problem: latest && latest.outcome !== 'started' && ['busy', 'monthly-exhausted', 'refused'].includes(latest.outcome) ? latest : null,
1486
1509
  });
1487
1510
  }
@@ -1518,7 +1541,7 @@ function runSummary(ctx, glyph, { root, catalogue, triggerRead, now, home }) {
1518
1541
  }
1519
1542
  const send = ctx.arbiter && Array.isArray(ctx.arbiter.sends) ? ctx.arbiter.sends.find((x) => x.target && typeof x.target.path === 'string') : undefined;
1520
1543
  const endedPlain = endedWords({
1521
- outcome, died, line, destination: send ? send.target.path : null, canResume: ctx.resumable === true && ctx.sameJob === true, home,
1544
+ outcome, died, line, destination: send ? send.target.path : null, canResume: ctx.resumable === true && ctx.sameJob === true, home, skipReason: ctx.historyRow?.skipReason,
1522
1545
  });
1523
1546
  // M9 am7 item 1: ENDED opens with the run's local end date and time, then its outcome word, then today's reason (NEXT stays as it was)
1524
1547
  const ended = endedPlain === null ? null : {
@@ -1528,7 +1551,7 @@ function runSummary(ctx, glyph, { root, catalogue, triggerRead, now, home }) {
1528
1551
  const t = typeof triggerRead === 'function' ? triggerRead(ctx.flowName) : null;
1529
1552
  if (t && t.trigger) {
1530
1553
  const nx = scheduledNextFor({
1531
- trigger: t.trigger, armed: t.armed, nextSlotMs: t.nextSlotMs, lastOutcome: t.lastOutcome, waitingLine: jobWaitingLine(root, ctx.flowDir, ctx.flowName, catalogue), now: now(),
1554
+ trigger: t.trigger, armed: t.armed, waiting: t.waiting === true, lookProblem: t.lookProblem ?? null, nextSlotMs: t.nextSlotMs, lastOutcome: t.lastOutcome, waitingLine: jobWaitingLine(root, ctx.flowDir, ctx.flowName, catalogue), now: now(),
1532
1555
  });
1533
1556
  scheduled = { text: String(scheduledWords(t.trigger, home)), next: nx.text, nextRed: nx.red };
1534
1557
  }
@@ -1773,6 +1796,7 @@ export function getRunDetail({
1773
1796
  const model = deriveRunModel(ctx.auditRows);
1774
1797
  const modelWhy = model === null ? 'no audit.jsonl row in this run has ever named a model (no model step has run yet)' : null;
1775
1798
  const spendSummary = summarizeSpendRows(ctx.spendRows);
1799
+ const hasGrid = ctx.flowRead.ok && flowTypeOf(ctx.flowRead.declaration) === 'tickets';
1776
1800
 
1777
1801
  return {
1778
1802
  flow,
@@ -1791,6 +1815,9 @@ export function getRunDetail({
1791
1815
  })),
1792
1816
  // M10 am4: the Result tab shows for a job that reads a page, a CSV or a .docx; `checkType` is its distinct close classes (the tab's top card)
1793
1817
  hasResult: isResultRun(ctx.arbiter),
1818
+ // M13 am2 item 2: the ONE decider of the Result tab. The tab shows for a job that has M10's Result page (`hasResult`) or for a Tickets MCP job (the grid, `hasGrid`); a plain or MCP job keeps what it had before M13
1819
+ hasGrid,
1820
+ resultTab: isResultRun(ctx.arbiter) || hasGrid,
1794
1821
  checkType: ctx.flowRead.ok ? checkTypeOf(ctx.flowRead.declaration) : '\u2014',
1795
1822
  // M9 piece 6: the block at the top of the run page (ENDED / NEXT, SCHEDULED / NEXT), words set by code
1796
1823
  summary: runSummary(ctx, glyph, { root, catalogue, triggerRead, now, home }),
@@ -2076,6 +2103,32 @@ function buildJobPlan(declaration, asks, flowDir, flowHash = null, jobLines = /*
2076
2103
  return { steps, notChecked: { label: NOT_CHECKED_LABEL, items: view.items, readNotes: view.readNotes, recorded } };
2077
2104
  }
2078
2105
 
2106
+ /**
2107
+ * M13 am4 item 2: the Job tab's MCP keys, read off the run's own declaration; `{}` for a plain job. The hint of a tool is the newest OK check of this server that names it
2108
+ * (`read-only` or null); no check, or a tool it does not name, is null (the page shows the name alone).
2109
+ * @param {any} declaration @param {(() => Map<string, any>)|undefined} mcpChecks
2110
+ */
2111
+ function mcpJobFields(declaration, mcpChecks) {
2112
+ const flowType = flowTypeOf(declaration);
2113
+ if (flowType === 'plain') return {};
2114
+ const server = declaration.mcp?.server ?? null;
2115
+ /** @type {any|null} */
2116
+ let newest = null;
2117
+ for (const r of (mcpChecks ? mcpChecks().values() : [])) {
2118
+ if (r.server === server && r.ok === true && Array.isArray(r.tools) && (newest === null || String(r.at) > String(newest.at))) newest = r;
2119
+ }
2120
+ const names = Array.isArray(declaration.mcp?.tools) ? declaration.mcp.tools : [];
2121
+ const tools = names.map((/** @type {any} */ t) => {
2122
+ const name = typeof t === 'string' ? t : String(t?.name);
2123
+ const hit = newest?.tools.find((/** @type {any} */ x) => x?.name === name);
2124
+ return { name, hint: hit?.hint === 'read-only' ? 'read-only' : null };
2125
+ });
2126
+ return {
2127
+ flowType, mcp: server, tools,
2128
+ ...(flowType === 'tickets' ? { ticketFilter: declaration.ticketFilter ?? null, ticketWatch: declaration.ticketWatch ?? null } : {}),
2129
+ };
2130
+ }
2131
+
2079
2132
  /**
2080
2133
  * `GET /api/runs/:flow/:runId/job` — the Job tab (hamr's 2026-09-27
2081
2134
  * exit-check review #5: bareloop-style one-field-per-piece layout,
@@ -2085,11 +2138,13 @@ function buildJobPlan(declaration, asks, flowDir, flowHash = null, jobLines = /*
2085
2138
  * name carries its own why, never a blank or a guess. Field order (server
2086
2139
  * order matches the page's own render order): prose, asks, model, cap
2087
2140
  * (+redo cap), sources, sends, guardrails, plan (one row per step, amendment 34), signature.
2088
- * @param {{root: string, flow: string, runId: string, catalogue: any, scheduleRead?: (flow: string) => any, home?: string}} opts
2141
+ * M13 am4 item 2: an MCP or Tickets MCP job also carries `flowType`, `mcp` (the server) and `tools` (`{name, hint}`; the hint is the newest OK check's, else null);
2142
+ * a Tickets job adds `ticketFilter` and `ticketWatch`. A plain job's payload has none of these keys. `mcpChecks` reads the newest-check map (unsigned, config home).
2143
+ * @param {{root: string, flow: string, runId: string, catalogue: any, scheduleRead?: (flow: string) => any, home?: string, mcpChecks?: () => Map<string, any>}} opts
2089
2144
  * @returns {any|null}
2090
2145
  */
2091
2146
  export function getRunJob({
2092
- root, flow, runId, catalogue, scheduleRead, home,
2147
+ root, flow, runId, catalogue, scheduleRead, home, mcpChecks,
2093
2148
  }) {
2094
2149
  const run = resolveRunPath(root, flow, runId);
2095
2150
  if (!run.ok) return null;
@@ -2128,6 +2183,7 @@ export function getRunJob({
2128
2183
  flow,
2129
2184
  runId,
2130
2185
  resolved: true,
2186
+ ...mcpJobFields(flowRead.declaration, mcpChecks),
2131
2187
  // M9 am6 items 1-2 / am7 item 5: how this run began and the workflow's schedule now; words from src/summary-words.js, the same owner as the Run tab's SCHEDULE block
2132
2188
  started: startedWords(readTriggerRecord(run.runDir), (() => { const at = firstPidStartedAt(run.runDir); return at === null ? null : Date.parse(at); })(), home),
2133
2189
  schedule: (() => {
@@ -2222,13 +2278,71 @@ export function getRunResult({
2222
2278
  const { run, ctx } = got;
2223
2279
  const sig = ctx.flowRead.signature;
2224
2280
  const plan = buildJobPlan(ctx.flowRead.declaration, ctx.arbiter.asks ?? [], run.flowDir, typeof sig?.flow === 'string' ? sig.flow : null, ctx.flowRead.lines, csvRolesOf(ctx.arbiter));
2225
- return buildResult({
2281
+ const result = buildResult({
2226
2282
  flow, runId, runDir: run.runDir, root, flowRead: ctx.flowRead, arbiter: ctx.arbiter, historyRow: ctx.historyRow, auditRows: ctx.auditRows, logJson: ctx.logJson, notChecked: plan.notChecked.items, readNotes: plan.notChecked.readNotes,
2227
2283
  setupRows: (() => { const st = readSetup(run.flowDir); return st.present ? st.rows : []; })(),
2228
2284
  door: resultDoorOf(getRunAsks({
2229
2285
  root, flow, runId, catalogue, resumeAttempt, now,
2230
2286
  })),
2231
2287
  });
2288
+ // M12 piece 3 (item 9): the run a ticket schedule was set from also carries the ticket list (null for every other run)
2289
+ const tickets = getTicketList({
2290
+ root, flow, runId, catalogue,
2291
+ });
2292
+ return tickets === null ? result : { ...result, tickets };
2293
+ }
2294
+
2295
+ /**
2296
+ * M12 piece 3: the ticket list of the run a ticket schedule was set from (the Result tab's, and `Run it anyway`'s check), or null.
2297
+ * @param {{root: string, flow: string, runId: string, catalogue: any}} a
2298
+ */
2299
+ export function getTicketList({
2300
+ root, flow, runId, catalogue,
2301
+ }) {
2302
+ const run = resolveRunPath(root, flow, runId);
2303
+ if (!run.ok) return null;
2304
+ return ticketListOf({
2305
+ flowDir: run.flowDir, runId, runIdsOf: listRunIds, glyphOf: (id) => getRunGlyph({ root, flow, runId: id, catalogue }), atOf: (id) => getRunEndedAt({ root, flow, runId: id, catalogue }),
2306
+ });
2307
+ }
2308
+
2309
+ /**
2310
+ * M13 piece 6 (item 8): the Result tab's ONE grid of a job, all its runs (`buildJobGrid`, src/panel/jobgrid.js). Each run is read once through `loadRunContext`
2311
+ * (the glyph is `computeGlyph`'s, the money the history row's), a ticket run is named by the ticket number its `run.json` recorded. `Run it anyway` is offered
2312
+ * only for a ticket the ticket list (M12) puts in Skipped. `null` = the flow does not resolve.
2313
+ * @param {{root: string, flow: string, catalogue: any, now?: () => number}} a
2314
+ */
2315
+ export function getJobGrid({
2316
+ root, flow, catalogue, now = Date.now,
2317
+ }) {
2318
+ const fd = resolveFlowDir(root, flow);
2319
+ if (!fd.ok || !existsSync(fd.flowDir)) return null;
2320
+ const { flowDir } = fd;
2321
+ const runs = [];
2322
+ let flowType = null;
2323
+ for (const runId of listRunIds(flowDir)) {
2324
+ const run = resolveRunPath(root, flow, runId);
2325
+ if (!run.ok || !existsSync(run.runDir)) continue; // eslint-disable-line no-continue
2326
+ const ctx = loadRunContext(root, run.flowDir, run.runDir, flow, runId, catalogue, null);
2327
+ if (flowType === null && ctx.flowRead.ok) flowType = flowTypeOf(ctx.flowRead.declaration);
2328
+ const g = computeGlyph(ctx);
2329
+ const inputs = readRunInputs(run.runDir);
2330
+ const entry = inputs.ok ? inputs.entries.find((e) => e && e.ticket && Number.isInteger(e.ticket.number)) : null;
2331
+ const at = typeof ctx.historyRow?.at === 'string' ? Date.parse(ctx.historyRow.at) : NaN;
2332
+ runs.push({
2333
+ runId, glyph: g.glyph, ticket: entry ? entry.ticket.number : null, title: entry && typeof entry.ticket.title === 'string' ? entry.ticket.title : null, unsure: filterUnsure(entry), at: Number.isFinite(at) ? at : null,
2334
+ history: ctx.historyRow ?? null, spendRows: ctx.spendRows, diary: readChecks(run.runDir),
2335
+ steps: ctx.flowRead.ok ? (ctx.flowRead.declaration?.steps ?? []) : [],
2336
+ reason: g.glyph === '[–]' ? g.label.replace(/^skipped — ?/, '') || null : null,
2337
+ });
2338
+ }
2339
+ const sched = readSchedule(flowDir);
2340
+ const from = sched && sched.trigger?.kind === 'new-ticket' && typeof sched.from === 'string' ? sched.from : null;
2341
+ const list = from !== null && ticketScheduleOf(flowDir, from) !== null ? getTicketList({
2342
+ root, flow, runId: from, catalogue,
2343
+ }) : null;
2344
+ const numbers = new Set((list?.groups.find((x) => x.key === 'skip')?.rows ?? []).map((r) => r.number));
2345
+ return { flowType, ...buildJobGrid({ runs, anyway: from !== null ? { runId: from, numbers } : null, now: now() }) };
2232
2346
  }
2233
2347
 
2234
2348
  /**
@@ -2750,6 +2864,9 @@ export function getRunAsks({
2750
2864
  if (!results) return ask;
2751
2865
  return { ...ask, evidence: { ...ev, cited: citedLineOfResults(results, cited) } };
2752
2866
  };
2867
+ // M13 piece 7 (9.4): the same reader as the grid's mark (filterUnsure), so the ask page and the grid never disagree
2868
+ const runInputs = readRunInputs(run.runDir);
2869
+ const filterUnsureRun = runInputs.ok && runInputs.entries.some(filterUnsure);
2753
2870
  const asks = ordered.map(withSheet).map(withCited).map((ask, i) => ({
2754
2871
  ...ask,
2755
2872
  ...deriveAskOpenFields(ask, hasHistoryRow, resume),
@@ -2760,6 +2877,7 @@ export function getRunAsks({
2760
2877
  stepName: stepInfo[i].step,
2761
2878
  stepLine: stepInfo[i].line,
2762
2879
  stepWhy: stepInfo[i].why,
2880
+ ...(filterUnsureRun ? { filterUnsure: true } : {}),
2763
2881
  }));
2764
2882
  // M11 am11 item 3: the Ask tab of an expired-ask run offers Remove from Needs you when the card is in Needs you now
2765
2883
  const needs = getRunNeeds({