@floless/app 0.127.0 → 0.127.1

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/dist/web/app.css CHANGED
@@ -2054,6 +2054,19 @@
2054
2054
  .req-run-note { margin: 0; color: var(--text-muted); line-height: 1.45; }
2055
2055
  .req-run-where { font-family: var(--mono); font-size: 10px; color: var(--text-dim);
2056
2056
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
2057
+ /* §F's only recovery action: copy the server-stamped command, then continue in the user's own
2058
+ terminal. It is a button rather than an input so it cannot resemble somewhere to answer the
2059
+ parked question; long commands wrap instead of truncating the one thing the user must recover. */
2060
+ .req-run-resume { display: flex; flex-direction: column; gap: 4px; }
2061
+ .req-run-resume-label { color: var(--text-muted); font-size: 10.5px; font-weight: 600; }
2062
+ .req-run-resume-command { appearance: none; width: 100%; min-height: 30px; padding: 6px 8px;
2063
+ text-align: left; cursor: pointer; color: var(--accent-bright); background: var(--surface-2);
2064
+ border: 1px solid var(--border-strong); border-radius: 4px; font-family: var(--mono); font-size: 10.5px;
2065
+ line-height: 1.45; overflow-wrap: anywhere; transition: border-color 0.12s, background 0.12s, color 0.12s; }
2066
+ .req-run-resume-command code { font: inherit; }
2067
+ .req-run-resume-command:hover { border-color: var(--accent-dim); background: var(--accent-soft); color: var(--text); }
2068
+ .req-run-resume-command:active { background: var(--surface-3); }
2069
+ .req-run-resume-command:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
2057
2070
  /* The agent's question, VERBATIM. A quote, deliberately — the warn rule and the italic say
2058
2071
  "somebody said this to you", where a plain paragraph would read as floless's own prose and a
2059
2072
  field would read as somewhere to answer. There is nowhere to answer; that is the point. */
@@ -4819,6 +4832,8 @@ table.hist tr.current td { background:var(--accent-soft); }
4819
4832
  flight and an animation would say otherwise. */
4820
4833
  .ws-revision-card.state-staged { border-left:3px solid var(--accent); }
4821
4834
  .ws-revision-card.state-staged .wrc-dot { flex:none; width:8px; height:8px; border-radius:50%; background:var(--accent); }
4835
+ .ws-revision-card.state-filter-ready { border-left:3px solid var(--accent); }
4836
+ .ws-revision-card.state-filter-ready .wrc-dot { flex:none; width:8px; height:8px; border-radius:50%; background:var(--accent); }
4822
4837
  .ws-revision-card .wrc-actions { display:flex; gap:6px; flex:none; }
4823
4838
  @media (prefers-reduced-motion: reduce) { .ws-revision-card .wrc-spin { animation:none; } }
4824
4839
  .hist .gate-badge.ai-read { background:var(--accent-soft); border-color:var(--accent-dim); color:var(--accent-bright); }
package/dist/web/aware.js CHANGED
@@ -7074,11 +7074,24 @@
7074
7074
  stopped: { badge: 'Stopped', cls: 'muted', note: () => 'You stopped this run.' },
7075
7075
  };
7076
7076
 
7077
- function runStatusHtml(run) {
7077
+ // A parked run is a hand-off, not a browser-owned conversation (§G). The server stamps a command
7078
+ // only for this explicit recovery set, but retain the same guard here: a newer/malformed server
7079
+ // response must not turn an arbitrary terminal state into an implied "resume" instruction.
7080
+ const RESUMABLE_RUN_STATES = new Set(['needs-you', 'stopped', 'interrupted', 'contract-violation', 'exited-unresolved']);
7081
+
7082
+ async function copyResumeCommand(command) {
7083
+ if (!command) return 'empty';
7084
+ return (await copyToClipboard(command)) ? 'ok' : 'denied';
7085
+ }
7086
+
7087
+ function runStatusHtml(run, stampedResumeCommand) {
7078
7088
  if (!run || !run.state) return '';
7079
7089
  const v = RUN_VIEW[run.state] || { badge: String(run.state), cls: 'muted', note: () => '' };
7080
7090
  const rt = runtimeLabel(run.runtime);
7081
7091
  const note = v.note(rt);
7092
+ // `resumeCommand` belongs to the SERVER'S request view, not persisted `run` metadata: the
7093
+ // store deliberately carries only runtime/session identity, while terminal-runtime.ts owns argv.
7094
+ const resumeCommand = RESUMABLE_RUN_STATES.has(run.state) ? stampedResumeCommand : null;
7082
7095
  return `
7083
7096
  <div class="req-run-status">
7084
7097
  <div class="req-run-head">
@@ -7087,7 +7100,8 @@
7087
7100
  </div>
7088
7101
  ${note ? `<p class="req-run-note">${escapeHtml(note)}</p>` : ''}
7089
7102
  ${run.question ? `<p class="req-run-question">${escapeHtml(run.question)}</p>` : ''}
7090
- ${run.cwd ? `<div class="req-run-where">${escapeHtml(rt)} · ${escapeHtml(run.cwd)}</div>` : ''}
7103
+ ${resumeCommand ? `<div class="req-run-resume"><span class="req-run-resume-label">Continue in terminal</span><button type="button" class="req-run-resume-command" data-resume-command="${escapeAttr(resumeCommand)}" data-tip="Copy command to continue this session" aria-label="Copy resume command: ${escapeAttr(resumeCommand)}"><code>${escapeHtml(resumeCommand)}</code></button></div>` : ''}
7104
+ ${run.cwd ? `<div class="req-run-where">Run in · ${escapeHtml(run.cwd)}</div>` : ''}
7091
7105
  ${run.lastOutput ? `<details class="req-run-output"><summary>Show what it printed</summary><pre>${escapeHtml(run.lastOutput)}</pre></details>` : ''}
7092
7106
  </div>`;
7093
7107
  }
@@ -7611,11 +7625,11 @@
7611
7625
  ? '<span class="req-lifecycle" data-tip="This clears itself when your terminal AI finishes or fails the organize">finishing in your terminal</span>'
7612
7626
  : inFlight
7613
7627
  ? '<span class="req-lifecycle" data-tip="Stop the run first — clearing it now would leave the agent working on a request that no longer exists">running</span>'
7614
- : `<button class="req-del" data-id="${escapeAttr(r.id)}" data-tip="Clear this request">×</button>`;
7615
- // A parked run gets NO re-run: it is waiting on a decision only the human can make, and a
7616
- // second headless attempt would either abandon that question or look like floless answering
7617
- // it. Every other terminal state has nothing pending, so running again is a fair offer.
7618
- const canRunNow = headlessReady() && r.canRun && !inFlight && !(run && run.state === 'needs-you');
7628
+ : `<button class="req-del" data-id="${escapeAttr(r.id)}" data-tip="${r.resumeCommand ? 'Clear this request and discard its saved terminal session' : 'Clear this request'}">×</button>`;
7629
+ // A server-stamped handoff gets NO re-run. The original terminal session may already be live;
7630
+ // starting a second headless agent would put two writers in one folder. The browser decides no
7631
+ // policy here: it simply withholds ▶ whenever the server supplied the resume command.
7632
+ const canRunNow = headlessReady() && r.canRun && !inFlight && !r.resumeCommand;
7619
7633
  const runBtn = inFlight
7620
7634
  ? `<button class="req-stop" data-id="${escapeAttr(r.id)}" data-tip="Stop this run">■</button>`
7621
7635
  : canRunNow
@@ -7627,12 +7641,12 @@
7627
7641
  <div class="req-head"><span class="${badgeCls}">${label}</span> ${owner ? `<span class="req-owner">${highlightQuery(owner, requestQuery)}</span>` : ''}${time}</div>
7628
7642
  <div class="req-instruction">${highlightQuery(instructionFor(r), requestQuery) || 'This request has no instruction, so it can’t be handed to your terminal AI. Clear it and queue it again.'}</div>
7629
7643
  ${r.snapshots && r.snapshots.length ? `<div class="req-thumbs">${r.snapshots.map((sp, i) => { const pdf = /\.pdf$/i.test(String(sp)); return `<button type="button" class="req-thumb" data-id="${escapeAttr(r.id)}" data-n="${i}" aria-label="View ${pdf ? 'PDF' : 'screenshot'} ${i + 1}">${pdf ? '<span class="req-thumb-pdf">PDF</span>' : `<img src="/api/requests/${encodeURIComponent(r.id)}/snapshot/${i}" alt="">`}</button>`; }).join('')}</div>` : ''}
7630
- ${runStatusHtml(run)}
7644
+ ${runStatusHtml(run, r.resumeCommand)}
7631
7645
  ${!r.canRun && r.runWhy && anyRunnable ? `<div class="req-why-not">Runs only from your terminal — ${escapeHtml(r.runWhy)}</div>` : ''}
7632
7646
  </div>
7633
7647
  <div class="req-actions">
7634
7648
  ${runBtn}
7635
- <button class="req-copy" data-id="${escapeAttr(r.id)}" data-tip="Copy this instruction">⧉</button>
7649
+ ${r.resumeCommand ? '' : `<button class="req-copy" data-id="${escapeAttr(r.id)}" data-tip="Copy this instruction">⧉</button>`}
7636
7650
  ${del}
7637
7651
  </div>
7638
7652
  </div>`;
@@ -7658,6 +7672,14 @@
7658
7672
  else showToast(...copyFailToast(res));
7659
7673
  };
7660
7674
  });
7675
+ $list.querySelectorAll('.req-run-resume-command').forEach((b) => {
7676
+ b.onclick = async () => {
7677
+ const res = await copyResumeCommand(b.dataset.resumeCommand || '');
7678
+ if (res === 'ok') showToast('Copied — run it in the folder shown below', 'ok');
7679
+ else if (res === 'empty') showToast('Nothing to copy — this run has no resume command', 'err');
7680
+ else showToast('Could not copy — select the command and copy it manually', 'err');
7681
+ };
7682
+ });
7661
7683
  $list.querySelectorAll('.req-del').forEach((b) => { b.onclick = () => deleteOneRequest(b.dataset.id); });
7662
7684
  $list.querySelectorAll('.req-thumb').forEach((b) => {
7663
7685
  b.onclick = () => window.open(`/api/requests/${encodeURIComponent(b.dataset.id)}/snapshot/${b.dataset.n}`, '_blank');
@@ -116,6 +116,9 @@ footer{margin-top:auto;border-top:1px solid var(--line);padding-top:12px}
116
116
  #canvas image.bg{opacity:.28}
117
117
  #canvas path.el{pointer-events:stroke}
118
118
  #canvas text.el{pointer-events:all;cursor:pointer;user-select:none}
119
+ /* Filtered-out vector content stays as quiet, non-selectable drawing context. The selector must beat
120
+ the text rule above, otherwise dim labels still open the eyedropper. */
121
+ #canvas .el.is-context{opacity:.2;pointer-events:none}
119
122
  #empty{position:absolute;inset:0;display:none;align-items:center;justify-content:center;padding:40px;text-align:center;color:var(--mut)}
120
123
  #empty.show{display:flex}
121
124
  #empty>div{max-width:44ch}
@@ -291,6 +294,7 @@ import { matchesActive, modeDims, canonicalMode, selFromFilter, eyedropperAdd, c
291
294
  const APP_ID = new URLSearchParams(location.search).get('app') || '';
292
295
  // Workspaces: project-keyed contract (see steel-editor.html). Empty = legacy app-keyed URLs.
293
296
  const PROJECT = new URLSearchParams(location.search).get('project') || '';
297
+ let revisionRequest = new URLSearchParams(location.search).get('revisionRequest') || '';
294
298
  const PROJECT_QS = PROJECT ? ('?project=' + encodeURIComponent(PROJECT)) : '';
295
299
  const CONTRACT_QS = PROJECT ? (PROJECT_QS + '&quietMissing=1') : PROJECT_QS;
296
300
  const SVGNS = 'http://www.w3.org/2000/svg';
@@ -972,10 +976,12 @@ function syncFacetChecks(){
972
976
  function apply(){
973
977
  for(const { node, el } of nodes){
974
978
  const vis = matchesActive(el, mode, sel);
975
- node.style.display = vis ? '' : 'none';
979
+ node.classList.toggle('is-context', !vis);
980
+ node.setAttribute('aria-hidden', String(!vis));
976
981
  }
982
+ if(eyeEl && !matchesActive(eyeEl, mode, sel)) closeEye();
977
983
  const cur = (sheets[active] && sheets[active].elements) || [];
978
- let html = '<b>' + countShown(cur, mode, sel) + '</b> of <b>' + cur.length + '</b> shown';
984
+ let html = '<b>' + countShown(cur, mode, sel) + '</b> selected of <b>' + cur.length + '</b> · remaining elements shown as context';
979
985
  if(sheets.length > 1){
980
986
  let sa = 0, ta = 0;
981
987
  for(const s of sheets){ const els = s.elements || []; sa += countShown(els, mode, sel); ta += els.length; }
@@ -1122,6 +1128,14 @@ async function saveNow(){
1122
1128
  // external change and reload itself the instant the user saved. The id is consumed by that echo, or
1123
1129
  // dropped when the write fails, or discarded when the SSE channel closes (nothing can echo after that).
1124
1130
  const t = res.headers.get('ETag'); if(t) serverEtag = t;
1131
+ if(revisionRequest && PROJECT && serverEtag){
1132
+ const checkpoint = await fetch(`/api/projects/${encodeURIComponent(PROJECT)}/revision-requests/${encodeURIComponent(revisionRequest)}/filter-saved`, {
1133
+ method:'POST', headers:{'content-type':'application/json'}, body:JSON.stringify({etag:serverEtag}),
1134
+ });
1135
+ if(!checkpoint.ok) throw new Error(await checkpoint.text());
1136
+ revisionRequest = '';
1137
+ history.replaceState(null, '', location.pathname + PROJECT_QS);
1138
+ }
1125
1139
  dirty = false; setSaved('saved');
1126
1140
  } catch(e){
1127
1141
  // The id is deliberately KEPT here. No response arrived, so we do not know whether the write landed —
@@ -5289,6 +5289,7 @@
5289
5289
  function resetRevisionState() {
5290
5290
  lastRevState = 'none';
5291
5291
  revCardReq = null;
5292
+ $revisionCard._renderKey = '';
5292
5293
  revisionGen++; // voids any render still in flight for the project being left
5293
5294
  stopRevisionPoll();
5294
5295
  $revisionCard.hidden = true;
@@ -5356,6 +5357,18 @@
5356
5357
 
5357
5358
  function buildPendingCard(req) {
5358
5359
  const n = (req.sourceRefs && req.sourceRefs.length) || (req.snapshots && req.snapshots.length) || 1;
5360
+ if (req.prepassReady) {
5361
+ // The terminal AI has completed the deterministic pre-read; it is now waiting on the real Filter
5362
+ // Save checkpoint below, not on another pasted instruction. A static dot avoids claiming work is
5363
+ // still running, and the real action only focuses the existing Filter iframe — it never fakes Save.
5364
+ const dot = revEl('span', 'wrc-dot'); dot.setAttribute('aria-hidden', 'true');
5365
+ const txt = revEl('span', 'wrc-text');
5366
+ txt.appendChild(revEl('b', null, 'Steel Filter is ready.'));
5367
+ txt.appendChild(document.createTextNode(' Review the Steel Filter and Save to continue the read.'));
5368
+ const review = revEl('button', 'btn-mini', 'Review Filter');
5369
+ review.type = 'button'; review.dataset.revfilter = ''; review.setAttribute('data-tip', 'Focus the Steel Filter below');
5370
+ return [dot, txt, review];
5371
+ }
5359
5372
  const spin = revEl('span', 'wrc-spin'); spin.setAttribute('aria-hidden', 'true');
5360
5373
  const txt = revEl('span', 'wrc-text');
5361
5374
  txt.appendChild(revEl('b', null, `Reading the ${isInitialRevisionRead(req) ? 'initial' : 'revised'} set…`));
@@ -5489,12 +5502,25 @@
5489
5502
  // paints the truth.
5490
5503
  if (revReviewState) return;
5491
5504
  revCardReq = failed || staged || pending;
5492
- $revisionCard.className = 'ws-revision-card state-' + state;
5505
+ if (pending?.prepassReady && frames.drawings.dataset.want) {
5506
+ const u = new URL(frames.drawings.dataset.want, location.origin);
5507
+ if (u.searchParams.get('revisionRequest') !== pending.id) {
5508
+ u.searchParams.set('revisionRequest', pending.id);
5509
+ frames.drawings.dataset.want = u.pathname + u.search;
5510
+ if (frames.drawings.dataset.loaded) frames.drawings.src = frames.drawings.dataset.want;
5511
+ }
5512
+ }
5513
+ const cardKey = `${state}:${revCardReq ? revCardReq.id : ''}:${pending && pending.prepassReady ? 'filter-ready' : 'read-pending'}`;
5514
+ if ($revisionCard._renderKey === cardKey && !$revisionCard.hidden) return; // preserve focus across the 3 s poll
5515
+ const restoreFocus = typeof document !== 'undefined' && $revisionCard.contains(document.activeElement);
5516
+ $revisionCard._renderKey = cardKey;
5517
+ $revisionCard.className = 'ws-revision-card state-' + state + (pending && pending.prepassReady ? ' state-filter-ready' : '');
5493
5518
  $revisionCard.replaceChildren(...(
5494
5519
  state === 'failed' ? buildFailedCard(failed)
5495
5520
  : state === 'staged' ? buildStagedCard(staged)
5496
5521
  : buildPendingCard(pending)));
5497
5522
  $revisionCard.hidden = false;
5523
+ if (restoreFocus) $revisionCard.querySelector('button')?.focus();
5498
5524
  }
5499
5525
 
5500
5526
  $revisionCard.addEventListener('click', async (e) => {
@@ -5509,6 +5535,8 @@
5509
5535
  if (res === 'ok') showToast('Instruction copied', 'ok');
5510
5536
  else if (res === 'empty') showToast('Nothing to copy — this request has no instruction', 'err');
5511
5537
  else showToast('Copy blocked — use the Requests panel', 'warn');
5538
+ } else if (e.target.closest('[data-revfilter]')) {
5539
+ frames.drawings?.focus();
5512
5540
  } else if (e.target.closest('[data-revdismiss]')) {
5513
5541
  try { await api(`/api/requests/${encodeURIComponent(req.id)}`, { method: 'DELETE' }); } catch { /* already gone */ }
5514
5542
  lastRevState = 'none';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floless/app",
3
- "version": "0.127.0",
3
+ "version": "0.127.1",
4
4
  "type": "module",
5
5
  "description": "Thin localhost host for floless.app — serves web/ and shells the aware CLI. No engine, no LLM.",
6
6
  "bin": {