@floless/app 0.133.1 → 0.133.2

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.
@@ -55037,7 +55037,7 @@ function appVersion() {
55037
55037
  return resolveVersion({
55038
55038
  isSea: isSea2(),
55039
55039
  sqVersionXml: readSqVersionXml(),
55040
- define: true ? "0.133.1" : void 0,
55040
+ define: true ? "0.133.2" : void 0,
55041
55041
  pkgVersion: readPkgVersion()
55042
55042
  });
55043
55043
  }
@@ -55053,7 +55053,7 @@ function resolveChannel(s) {
55053
55053
  function appChannel() {
55054
55054
  return resolveChannel({
55055
55055
  isSea: isSea2(),
55056
- define: true ? "0.133.1" : void 0,
55056
+ define: true ? "0.133.2" : void 0,
55057
55057
  // argv[1] is the entry the runtime actually loaded (…/dist/floless-server.cjs), which is what
55058
55058
  // carries the npx cache prefix. Absent under the SEA exe, which never reaches the npx branch.
55059
55059
  modulePath: process.argv[1]
@@ -59485,11 +59485,11 @@ function parseIndexBytes(bytes2) {
59485
59485
  const kept = [];
59486
59486
  const opaque = [];
59487
59487
  const seen = /* @__PURE__ */ new Set();
59488
- const dropped = [];
59488
+ const dropped2 = [];
59489
59489
  for (const row of exportsValue) {
59490
59490
  const kind = row?.kind;
59491
59491
  if (!isExportKind(kind)) {
59492
- dropped.push(`unknown kind ${JSON.stringify(kind)}`);
59492
+ dropped2.push(`unknown kind ${JSON.stringify(kind)}`);
59493
59493
  opaque.push(row);
59494
59494
  continue;
59495
59495
  }
@@ -59498,16 +59498,16 @@ function parseIndexBytes(bytes2) {
59498
59498
  }
59499
59499
  const key2 = receiptKey(row.kind, row.variant);
59500
59500
  if (seen.has(key2)) {
59501
- dropped.push(`duplicate "${key2.trim()}"`);
59501
+ dropped2.push(`duplicate "${key2.trim()}"`);
59502
59502
  opaque.push(row);
59503
59503
  continue;
59504
59504
  }
59505
59505
  seen.add(key2);
59506
59506
  kept.push(row);
59507
59507
  }
59508
- if (dropped.length) {
59508
+ if (dropped2.length) {
59509
59509
  console.warn(
59510
- `project export index: ignored ${dropped.length} unreadable receipt(s) \u2014 ${dropped.join(", ")}`
59510
+ `project export index: ignored ${dropped2.length} unreadable receipt(s) \u2014 ${dropped2.join(", ")}`
59511
59511
  );
59512
59512
  }
59513
59513
  return { exports: kept, opaque };
@@ -61668,6 +61668,7 @@ var CODEX_COMPLETION_SCHEMA = {
61668
61668
  var MAX_QUESTION = 2e3;
61669
61669
  var MAX_ANSWER_CODE_UNITS = 8e3;
61670
61670
  var MAX_ANSWER_BYTES = 32 * 1024;
61671
+ var MAX_DROPPED = 500;
61671
61672
  function validateCompletion(value) {
61672
61673
  if (!value || typeof value !== "object" || Array.isArray(value)) {
61673
61674
  return { kind: "violation", why: "completion was not an object" };
@@ -61684,16 +61685,18 @@ function validateCompletion(value) {
61684
61685
  if (answerText.length > MAX_ANSWER_CODE_UNITS || answerBytes > MAX_ANSWER_BYTES) {
61685
61686
  return { kind: "violation", why: "outcome answered exceeded the answer limit" };
61686
61687
  }
61687
- if (text5) return { kind: "violation", why: "outcome answered also carried a question" };
61688
- return { kind: "answered", answer: answerText };
61688
+ return { kind: "answered", answer: answerText, ...dropped("question", text5) };
61689
61689
  }
61690
- if (answerText) return { kind: "violation", why: `outcome ${String(outcome)} also carried an answer` };
61691
61690
  if (outcome === "needs-you" && !text5) {
61692
61691
  return { kind: "violation", why: "outcome needs-you carried no question" };
61693
61692
  }
61694
- if (outcome === "needs-you") return { kind: "needs-you", question: text5 };
61695
- if (outcome === "refused") return { kind: "refused", question: text5 };
61696
- return { kind: "applied" };
61693
+ if (outcome === "needs-you") return { kind: "needs-you", question: text5, ...dropped("answer", answerText) };
61694
+ if (outcome === "refused") return { kind: "refused", question: text5, ...dropped("answer", answerText) };
61695
+ return { kind: "applied", ...dropped("answer", answerText) };
61696
+ }
61697
+ function dropped(field, text5) {
61698
+ const flat = text5.replace(/\s+/g, " ").trim();
61699
+ return flat ? { dropped: { field, text: flat.slice(0, MAX_DROPPED) } } : {};
61697
61700
  }
61698
61701
  function readCompletion(terminal) {
61699
61702
  const ev = terminal;
@@ -74243,9 +74246,9 @@ function publishProgress(id, event) {
74243
74246
  s.buffered.push({ seq, frame });
74244
74247
  s.bytes += frame.length;
74245
74248
  while (s.bytes > MAX_BUFFER_BYTES && s.buffered.length > 1) {
74246
- const dropped = s.buffered.shift();
74247
- s.bytes -= dropped.frame.length;
74248
- s.droppedBefore = dropped.seq;
74249
+ const dropped2 = s.buffered.shift();
74250
+ s.bytes -= dropped2.frame.length;
74251
+ s.droppedBefore = dropped2.seq;
74249
74252
  }
74250
74253
  }
74251
74254
  function subscribeProgress(id, reply, afterSeq, owner2) {
@@ -90386,6 +90389,11 @@ async function settle(deps, lease, code, out, err2, sessionCaptureError = null)
90386
90389
  const after = deps.getRequest(lease.requestId);
90387
90390
  const gone = !after || after.status === "staged";
90388
90391
  const base = { exitCode: code ?? void 0, lastOutput: tail(err2) || tail(prose(out)) };
90392
+ if (completion.kind !== "violation" && completion.dropped) {
90393
+ console.error(
90394
+ `[terminal-run] ${lease.requestType} run ${lease.requestId} finished ${completion.kind} carrying an unused \`${completion.dropped.field}\`; dropped: ${completion.dropped.text}`
90395
+ );
90396
+ }
90389
90397
  if (sessionCaptureError) {
90390
90398
  if (lease.runtime === "codex") {
90391
90399
  try {
package/dist/web/app.css CHANGED
@@ -384,6 +384,42 @@
384
384
  }
385
385
  .msg.aware .body { border-left-color: var(--text-dim); }
386
386
  .msg.instructor-answer .body { border-left-color: var(--accent); }
387
+ /* Rendered answer prose (answerProse in aware.js). Scoped to this card so no other message body
388
+ inherits a document-ish scale, and re-scaled from the browser defaults an h3/ul would bring into
389
+ a card set at the body's own font-size (mostly down — h3 15.2px→15px, ul padding 40px→17px —
390
+ though h5 comes back UP, because the UA's .83em is smaller than the body text it introduces).
391
+ h3 must stay clear of `strong`, which shares its color and weight: at equal size the top heading
392
+ level and an inline bold phrase were indistinguishable, so h3 carries the heavier weight.
393
+ The new-answer badge is ALWAYS the first child (merely hidden until the answer is new), so the
394
+ heading after it needs the same top-trim a real first child gets. */
395
+ .msg.instructor-answer .body > :first-child,
396
+ .msg.instructor-answer .body > .answer-new-badge + * { margin-top: 0; }
397
+ .msg.instructor-answer .body > :last-child { margin-bottom: 0; }
398
+ .msg.instructor-answer .body h3,
399
+ .msg.instructor-answer .body h4,
400
+ .msg.instructor-answer .body h5 { margin: 14px 0 5px; line-height: 1.35; font-weight: 600; }
401
+ .msg.instructor-answer .body h3 { font-size: 15px; font-weight: 700; color: var(--text); }
402
+ .msg.instructor-answer .body h4 {
403
+ font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-dim);
404
+ }
405
+ .msg.instructor-answer .body h5 { font-size: 12px; color: var(--text); }
406
+ .msg.instructor-answer .body p { margin: 0 0 9px; }
407
+ .msg.instructor-answer .body ul, .msg.instructor-answer .body ol { margin: 0 0 9px; padding-left: 17px; }
408
+ .msg.instructor-answer .body li { margin: 0 0 4px; }
409
+ .msg.instructor-answer .body li::marker { color: var(--text-dim); }
410
+ .msg.instructor-answer .body code {
411
+ font-family: var(--mono); font-size: 11.5px; background: var(--surface-3);
412
+ padding: 1px 5px; border-radius: 3px; color: var(--text-muted);
413
+ }
414
+ .msg.instructor-answer .body pre {
415
+ margin: 0 0 9px; padding: 9px 10px; background: var(--surface-3); border-radius: 5px;
416
+ overflow-x: auto; scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent;
417
+ }
418
+ .msg.instructor-answer .body pre::-webkit-scrollbar { height: 7px; }
419
+ .msg.instructor-answer .body pre::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 7px; }
420
+ .msg.instructor-answer .body pre::-webkit-scrollbar-track { background: transparent; }
421
+ .msg.instructor-answer .body pre code { background: none; padding: 0; font-size: 11.5px; }
422
+ .msg.instructor-answer .body strong { color: var(--text); font-weight: 600; }
387
423
  .answer-new-badge { display: none; margin-bottom: 6px; color: var(--accent); font-family: var(--mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; }
388
424
  .msg.instructor-answer-new .answer-new-badge { display: block; }
389
425
  .msg.instructor-answer-new .body {
package/dist/web/app.js CHANGED
@@ -291,7 +291,42 @@ function msgEl(cls, who, html, timestamp = new Date()) {
291
291
  return div;
292
292
  }
293
293
  function mdInline(s) {
294
- return s.replace(/\*\*(.+?)\*\*/g, '<strong>$1</strong>').replace(/`(.+?)`/g, '<code>$1</code>');
294
+ // CODE SPANS COME OUT FIRST and go back last. Emphasis used to run over them, rewriting the inside
295
+ // of a <code>: `demos/*/*.flo` came out as `demos/<em>/</em>.flo` — the asterisks GONE from a path
296
+ // a reader copies, and the same for globs (`**/*.ts`), flags, regexes and pointer code, which is a
297
+ // large share of what an Instructor answer is made of. Markdown never processes emphasis inside a
298
+ // code span. Lifting them out also keeps emphasis able to WRAP one (`*see `foo` now*`), which
299
+ // per-segment processing would have broken instead.
300
+ //
301
+ // Bold FIRST among what remains, so the single-asterisk pass that follows sees only real italics.
302
+ // That pass may span the <strong> markup the earlier one produced — `*"the **first** point"*` is
303
+ // ordinary prose, and a guard against `<` left its asterisks on screen.
304
+ //
305
+ // WHAT MAKES THAT SAFE HAS TWO SHAPES, and only one of them is a call-site rule. `answerProse`
306
+ // (aware.js) and the guide description escape the WHOLE string before calling in. The narration
307
+ // lines cannot: they carry authored `**`/`` ` `` on purpose, so their producer escapes each
308
+ // INTERPOLATED VALUE where the line is assembled (see transform() in aware.js) and hands the line
309
+ // over already safe. Adding a narration line means escaping every interpolation there — nothing at
310
+ // this end will catch it for you. Either way no `<` here came from a user, so no pass can build a
311
+ // tag or an attribute out of one.
312
+ //
313
+ // Crossing tags CAN misnest (`<strong>a <em>b</strong> c</em>` from overlapping markers); the
314
+ // parser reparents it into valid-but-different DOM. Acceptable for prose, and the reason this is a
315
+ // pass chain rather than a parser.
316
+ const NUL = String.fromCharCode(0);
317
+ const code = [];
318
+ // NUL is stripped from the input BEFORE any placeholder is minted, so the sentinel cannot collide
319
+ // with text that happened to contain one — the single hazard a mask-and-restore carries. Restored
320
+ // by split parity rather than a regex: placeholders are then the only NULs present, so every odd
321
+ // segment is one, and neither emphasis pass adds or removes a NUL.
322
+ const masked = String(s).split(NUL).join('')
323
+ .replace(/`([^`]+)`/g, (_, body) => NUL + (code.push(body) - 1) + NUL);
324
+ return masked
325
+ .replace(/\*\*(.+?)\*\*/g, '<strong>$1</strong>')
326
+ .replace(/\*(?!\s)([^*]+?)\*/g, '<em>$1</em>')
327
+ .split(NUL)
328
+ .map((part, i) => (i % 2 ? `<code>${code[Number(part)]}</code>` : part))
329
+ .join('');
295
330
  }
296
331
 
297
332
  function renderTopology() {
package/dist/web/aware.js CHANGED
@@ -216,9 +216,81 @@
216
216
  return !answer.project && !!currentId && answer.appId === currentId;
217
217
  }
218
218
 
219
+ /* The terminal AI writes its answer as markdown, and the card used to render that markdown raw —
220
+ a reader met a literal `# Dimension` and `**Where this lives:**` where a heading and a bold lead
221
+ belonged. This handles the block shapes those answers actually contain; mdInline still does the
222
+ inline half (bold, code, italic).
223
+
224
+ ESCAPE FIRST, then build. Every branch below composes markup out of text that can no longer
225
+ carry any, which is the order the guide description in this file already uses and the reason the
226
+ `<img src=x onerror=…>` case in instructor-answers-rendered.test.ts stays inert prose.
227
+
228
+ ponytail: hand-rolled for the handful of line shapes these answers use rather than shipping a
229
+ markdown library into web/ — reach for one when answers start carrying tables, links, nested
230
+ lists, or 4-space-indented code (which flattens into a paragraph here; fenced blocks are what
231
+ the models actually emit, and indent-detection would misfire on list continuations). */
232
+ function answerProse(raw) {
233
+ const out = [];
234
+ let list = null;
235
+ let para = [];
236
+ let fence = null;
237
+ const closeList = () => { if (list) { out.push(`</${list}>`); list = null; } };
238
+ // Joined with <br>, not a space. The renderer this replaced turned EVERY newline into one, and a
239
+ // model that hard-wraps a paragraph, or writes `key: value` runs and unbulleted steps as bare
240
+ // lines, would otherwise have that structure silently collapse into one running sentence. Soft-
241
+ // wrap joining is the stricter markdown reading; fidelity to what the AI laid out matters more
242
+ // here, and a blank line still starts a real new paragraph.
243
+ const closePara = () => { if (para.length) { out.push(`<p>${mdInline(para.join('<br>'))}</p>`); para = []; } };
244
+ const openList = (kind) => { if (list !== kind) { closeList(); out.push(`<${kind}>`); list = kind; } };
245
+
246
+ for (const line of escapeHtml(raw || '').split(/\r?\n/)) {
247
+ if (/^\s*```/.test(line)) {
248
+ if (fence) { out.push(`<pre><code>${fence.join('\n')}</code></pre>`); fence = null; }
249
+ else { closePara(); closeList(); fence = []; }
250
+ continue;
251
+ }
252
+ if (fence) { fence.push(line); continue; }
253
+
254
+ // `\S` first: `"## "` with nothing after it would otherwise match, `.trim()` to empty, and emit
255
+ // an EMPTY heading — the characters gone from the screen and an accessibility failure ("heading
256
+ // must have content") in their place. Failing the match instead drops it to a paragraph, where
257
+ // the degenerate input at least stays visible as the text the model typed.
258
+ const heading = /^(#{1,6})\s+(\S.*)$/.exec(line);
259
+ if (heading) {
260
+ closePara(); closeList();
261
+ // Levels collapse to h3/h4/h5: this is a card in a narrow side panel, so a document h1 would
262
+ // be both oversized here and a lie about the page's outline.
263
+ const tag = heading[1].length === 1 ? 'h3' : heading[1].length === 2 ? 'h4' : 'h5';
264
+ out.push(`<${tag}>${mdInline(heading[2].trim())}</${tag}>`);
265
+ continue;
266
+ }
267
+
268
+ const bullet = /^\s*[-*]\s+(.+)$/.exec(line);
269
+ const numbered = /^\s*\d+[.)]\s+(.+)$/.exec(line);
270
+ if (bullet || numbered) {
271
+ closePara();
272
+ openList(bullet ? 'ul' : 'ol');
273
+ out.push(`<li>${mdInline((bullet || numbered)[1].trim())}</li>`);
274
+ continue;
275
+ }
276
+
277
+ if (!line.trim()) { closePara(); closeList(); continue; }
278
+ // closeList BEFORE the paragraph opens. A prose line after a list item used to append a <p>
279
+ // while the <ul> was still open — content the parser keeps but the list semantics lose, since
280
+ // <p> is not permitted content for <ul> and a screen reader stops reading it as part of the
281
+ // list. The line becomes a paragraph AFTER the list instead.
282
+ closeList();
283
+ para.push(line.trim());
284
+ }
285
+ // An unterminated fence still renders as the code block it was opening, rather than vanishing.
286
+ if (fence) out.push(`<pre><code>${fence.join('\n')}</code></pre>`);
287
+ closePara(); closeList();
288
+ return out.join('');
289
+ }
290
+
219
291
  function answerCard(answer, isNew) {
220
292
  const subject = escapeHtml(answer.instructorContext.subject || 'this context');
221
- const prose = escapeHtml(answer.answer || '').replace(/\r?\n/g, '<br>');
293
+ const prose = answerProse(answer.answer);
222
294
  const runtime = answer.runtime === 'claude' ? 'Claude' : answer.runtime === 'codex' ? 'Codex' : 'terminal AI';
223
295
  const card = msgEl(`aware instructor-answer${isNew ? ' instructor-answer-new' : ''}`,
224
296
  `${runtime} · ${subject}`,
@@ -664,13 +664,16 @@
664
664
  });
665
665
 
666
666
  def('shell.narrative-tab', {
667
- label: 'Narrative', actsOn: 'Shows curated workflow and run narration', group: 'In the Narrative panel',
667
+ label: 'Narrative', actsOn: 'Shows curated workflow and run narration, not the chat transcript',
668
+ group: 'In the Narrative panel',
668
669
  persistence: 'none', interaction: 'mode', risk: [], guidance: 'on-demand',
670
+ why: 'Narration follows the workflow, so a question you asked lands under AI answers instead — this tab never fills up with your own prompts.',
669
671
  });
670
672
 
671
673
  def('shell.ai-answers-tab', {
672
674
  label: 'AI answers', actsOn: 'Shows durable read-only answers for the visible workflow or project', group: 'In the Narrative panel',
673
675
  persistence: 'none', interaction: 'mode', risk: [], guidance: 'on-demand',
676
+ why: 'An answer outlives the run that wrote it, so a question asked once stays readable here instead of scrolling away in the terminal.',
674
677
  });
675
678
 
676
679
  def('shell.requests-run', {
@@ -27,6 +27,17 @@
27
27
  once per FILE (surfaceScope) rather than per command, because a registration
28
28
  file is wholly one surface — see the note beside SURFACE below.
29
29
 
30
+ `why` is OPTIONAL and, today, NOT READ COPY. Two consumers: the command
31
+ sheet's search haystack (instructor.js), and the `tip` of the entry the sheet
32
+ synthesizes when the command it activates has NO control on screen — a branch
33
+ any registered, always-rendered button never reaches, and which
34
+ controlGuidance would then suppress anyway because an entry carrying `actsOn`
35
+ never runs out of derived facts. So `why` earns a command its keyword hits
36
+ and covers the off-screen case; it is not what a user reads beside a live
37
+ control. Write it, but do not budget prose there expecting it on screen —
38
+ the sentence the strip reads out is `actsOn`. (Recorded because a commit
39
+ claimed the opposite and nothing here said otherwise.)
40
+
30
41
  `guidance` exists because `interaction` alone got tiers wrong: treating every
31
42
  gesture as a narrated command would demand step text for canvas pan and orbit,
32
43
  which need none, while drag-to-place genuinely does.
@@ -127,11 +127,10 @@
127
127
  <aside class="chat" id="chat-panel" data-group="In the Narrative panel">
128
128
  <div class="panel-label">
129
129
  <span class="narrative-tabs" role="tablist" aria-label="Left panel content">
130
- <button data-command-id="shell.narrative-tab" type="button" class="narrative-tab active" id="narrative-tab" role="tab" aria-selected="true" aria-controls="messages">Narrative</button>
131
- <button data-command-id="shell.ai-answers-tab" type="button" class="narrative-tab" id="ai-answers-tab" role="tab" aria-selected="false" aria-controls="ai-answers" tabindex="-1">AI answers <span class="answer-unread" id="answer-unread" hidden></span></button>
130
+ <button data-command-id="shell.narrative-tab" type="button" class="narrative-tab active" id="narrative-tab" role="tab" aria-selected="true" aria-controls="messages" data-tip="Curated narration of this workflow and its runs — the full chat stays in your terminal AI">Narrative</button>
131
+ <button data-command-id="shell.ai-answers-tab" type="button" class="narrative-tab" id="ai-answers-tab" role="tab" aria-selected="false" aria-controls="ai-answers" tabindex="-1" data-tip="Answers your terminal AI wrote for an Instructor question, kept with this workflow or project">AI answers <span class="answer-unread" id="answer-unread" hidden></span></button>
132
132
  </span>
133
133
  <span class="label-end">
134
- <span class="role">curated · full chat in your terminal</span>
135
134
  <button data-command-id="shell.narrative-panel" type="button" class="panel-toggle" data-side="left" aria-label="Collapse Narrative panel" aria-controls="chat-panel" aria-expanded="true" data-tip="Collapse Narrative panel">‹</button>
136
135
  </span>
137
136
  </div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floless/app",
3
- "version": "0.133.1",
3
+ "version": "0.133.2",
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": {