diff --git a/apps/client/src/engine-link/screen-surface-e2e.test.ts b/apps/client/src/engine-link/screen-surface-e2e.test.ts index 0b4c595..fcbd90b 100644 --- a/apps/client/src/engine-link/screen-surface-e2e.test.ts +++ b/apps/client/src/engine-link/screen-surface-e2e.test.ts @@ -245,7 +245,7 @@ test('#175 headless: a real screen mirror crosses EngineLink + seeded Surface + assert.equal(loadedSurface?.id, 'surf-openinfo-fields', 'the engine served the actual seeded Surface') assert.ok(loadedSurface?.stack.some((block) => block.block === 'distillates' && block.query?.source === 'distillates')) assert.equal(mounted, true) - assert.match(headlessTarget.innerHTML, /Transcript · distillate stream/) + assert.match(headlessTarget.innerHTML, /class="glbl">Transcript${OCR_TEXT}`, 'g')) ?? []).length, diff --git a/apps/client/src/surfaces/blocks/ask.ts b/apps/client/src/surfaces/blocks/ask.ts index b14e9fc..184364e 100644 --- a/apps/client/src/surfaces/blocks/ask.ts +++ b/apps/client/src/surfaces/blocks/ask.ts @@ -11,5 +11,5 @@ export const renderAsk: BlockRenderer = () => 'div', { class: 'hgroup' }, h('div', { class: 'glbl' }, 'Ask'), - h('div', { class: 'rel' }, h('span', { class: 'mk p' }, '·'), h('span', { class: 'body' }, h('span', { class: 'why' }, 'ask this context — recall path P3'))), + h('div', { class: 'rel' }, h('span', { class: 'mk p' }, '·'), h('span', { class: 'body' }, h('span', { class: 'why' }, 'ask about what is here'))), ) diff --git a/apps/client/src/surfaces/blocks/custom.ts b/apps/client/src/surfaces/blocks/custom.ts index 1b39b99..040af06 100644 --- a/apps/client/src/surfaces/blocks/custom.ts +++ b/apps/client/src/surfaces/blocks/custom.ts @@ -17,6 +17,6 @@ export const renderCustom: BlockRenderer = ({ block }) => 'div', { class: 'rel' }, h('span', { class: 'mk p' }, '·'), - h('span', { class: 'body' }, h('span', { class: 'why' }, block.block === 'custom' ? 'sandboxed custom block — P6' : 'no renderer for this block type in this client build')), + h('span', { class: 'body' }, h('span', { class: 'why' }, block.block === 'custom' ? 'a self-contained custom block' : 'no renderer for this block type in this client build')), ), ) diff --git a/apps/client/src/surfaces/blocks/distillates.test.ts b/apps/client/src/surfaces/blocks/distillates.test.ts index 93d7fb2..f006e8b 100644 --- a/apps/client/src/surfaces/blocks/distillates.test.ts +++ b/apps/client/src/surfaces/blocks/distillates.test.ts @@ -38,10 +38,10 @@ test('the distillates block renders STORE-DERIVED windows: distilled text, a tim renderSurface({ surface, now, results: [undefined, result(items)] }, defaultBlockRegistry), ) - assert.match(html, /Transcript · distillate stream/) // the block's group label + assert.match(html, /class="glbl">Transcript2:30p/) // each line carries its timestamp (clockLabel of windowEnd) - assert.match(html, /class="why">distilled from capturefrom what was capturedTranscriptTranscript -const LABEL = 'Transcript · distillate stream' +// hud-voice §2: "distillate" is banned end-user vocabulary; the block is framed to the user as the +// transcript (its empty state and Settings toggle already say so), so the label is the human word (#242). +const LABEL = 'Transcript' /** * The `distillates` block — the transcript/distillate STREAM on a panel (#12). It reads the hydrated @@ -34,7 +36,7 @@ const streamRow = (distillate: Distillate, actions: Actions): VNode => 'span', { class: 'body' }, h('span', { class: 'ttl' }, distillate.text), - h('span', { class: 'why' }, 'distilled from capture'), + h('span', { class: 'why' }, 'from what was captured'), ), h('span', { class: 'go' }, ...actionButtons(actions, distillate.text)), ) diff --git a/apps/client/src/surfaces/blocks/drafts.test.ts b/apps/client/src/surfaces/blocks/drafts.test.ts index b076960..0505f05 100644 --- a/apps/client/src/surfaces/blocks/drafts.test.ts +++ b/apps/client/src/surfaces/blocks/drafts.test.ts @@ -40,8 +40,9 @@ test('the drafts block renders STORE-DERIVED drafts: the prepared body + a prove // WHY-line built from the draft's own provenance: act kind + human source counts. #118: NO machine trail // (endpoint/model/template id) at this human tier, nor the old `via ` phrasing — it stays // recorded on provenance and reachable on diagnostics + the ledger, just not rendered here. - assert.match(html, /class="why">follow-up draft · from 2 distillates \+ 1 momentfollow-up draft · from 2 summaries \+ 1 moment[^<]*via /) + assert.doesNotMatch(html, /distillate/) // hud-voice §2: the banned word never reaches the render (#242) // the copy affordance carries the body (the app prepares; the human executes — verbs never send) assert.match(html, /data-copy="Hi Dana, thanks for the time today/) }) diff --git a/apps/client/src/surfaces/blocks/drafts.ts b/apps/client/src/surfaces/blocks/drafts.ts index fab5c26..21dd999 100644 --- a/apps/client/src/surfaces/blocks/drafts.ts +++ b/apps/client/src/surfaces/blocks/drafts.ts @@ -26,11 +26,13 @@ const ACT_LABEL: Record = { nudge: 'nudge', } -const plural = (n: number, one: string): string => `${n} ${one}${n === 1 ? '' : 's'}` +const plural = (n: number, one: string, many: string): string => `${n} ${n === 1 ? one : many}` const whyLine = (draft: Draft): string => { const kind = ACT_LABEL[draft.actKind] ?? draft.actKind - const sources = `${plural(draft.provenance.sourceDistillates.length, 'distillate')} + ${plural(draft.provenance.sourceMoments.length, 'moment')}` + // hud-voice §2: "distillate" is banned end-user vocabulary → the human word for a distilled capture + // window is "summary" (#242). Explicit plural form ("summaries") since the naive +s is wrong here. + const sources = `${plural(draft.provenance.sourceDistillates.length, 'summary', 'summaries')} + ${plural(draft.provenance.sourceMoments.length, 'moment', 'moments')}` return `${kind} · from ${sources}` } diff --git a/apps/client/src/surfaces/blocks/fields-app.test.ts b/apps/client/src/surfaces/blocks/fields-app.test.ts index 947d3c3..5cce864 100644 --- a/apps/client/src/surfaces/blocks/fields-app.test.ts +++ b/apps/client/src/surfaces/blocks/fields-app.test.ts @@ -103,9 +103,9 @@ test('the SHIPPED fields-app document renders the fast-fields canon through the assert.match(html, /data-copy="Q3 renewal pricing"/) // the distillate/transcript stream block renders beneath the fields with its own human why-line - assert.match(html, /Transcript · distillate stream/) + assert.match(html, /class="glbl">Transcript { @@ -114,7 +114,7 @@ test('the shipped fields-app document is honest when the fields feature is OFF: assert.equal(fieldsBlock?.show, 'always', 'the app must not vanish when empty (unlike the HUD ride-along)') const html = renderToHtml(renderSurface({ surface, now, results: results([]) }, defaultBlockRegistry)) - assert.match(html, /Fields · fast/) // the card is present… + assert.match(html, /class="glbl">FieldsFieldstopic/) // the field label // the why-line is HUMAN (#117/#118): recency from the value's updatedAt, never the machine trail @@ -86,7 +86,7 @@ test('a provisional field renders the #66 micro-state dot (a real signal, not de test('empty is EXPLAINABLE, not silent: an always-visible fields block renders a no-fields line', () => { const html = renderToHtml(renderSurface({ surface, now, results: [undefined, result([])] }, defaultBlockRegistry)) - assert.match(html, /Fields · fast/) + assert.match(html, /class="glbl">FieldsFields -const LABEL = 'Fields · fast' +// hud-voice §2: "fast" is the internal lane/tier name (fast vs judged) — not the user's world; drop it (#242). +const LABEL = 'Fields' /** * The `fields` block — the fan-out substrate's surface (#61). It reads the hydrated `fields` query diff --git a/apps/client/src/surfaces/blocks/pinned-doc.test.ts b/apps/client/src/surfaces/blocks/pinned-doc.test.ts index 9a3f5bc..99b9c1f 100644 --- a/apps/client/src/surfaces/blocks/pinned-doc.test.ts +++ b/apps/client/src/surfaces/blocks/pinned-doc.test.ts @@ -48,3 +48,20 @@ test('pinned-doc copy payload is the pasteable reference ONLY — the title neve assert.doesNotMatch(payload ?? '', /—/) assert.doesNotMatch(payload ?? '', /Signed MSA/) }) + +test('a URL pin copies the FULLY REALIZED link — the full canonical URI, not the display title (#242)', () => { + // The owner canon: copy must yield the whole value (a full URL), never a short/display form. A url-kind + // pin displays a human title in the .ttl but its `uri` is the full canonical link — the copy payload is + // the uri, so a copied link is complete (scheme + host + path + query), never the bare domain shown as title. + const link: Pin = { + id: 'pin-url', workspaceId: 'ws', uri: 'https://docs.example.com/rfc/soc2?section=controls#c-4', + title: 'SOC 2 controls', kind: 'url', ingest: { status: 'ingested' }, createdAt: '2026-07-16T20:10:00Z', + } + const html = render([link]) + const payload = copyPayload(html) + assert.equal(payload, 'https://docs.example.com/rfc/soc2?section=controls#c-4') // the WHOLE URL + assert.match(html, /SOC 2 controls/) // the display title still renders on the row… + // …but never rides into the clipboard, and neither does the ext/kind decoration or a bare-domain shortening. + assert.doesNotMatch(payload ?? '', /SOC 2 controls|—/) + assert.notEqual(payload, 'docs.example.com') +}) diff --git a/apps/client/src/surfaces/blocks/pinned-doc.ts b/apps/client/src/surfaces/blocks/pinned-doc.ts index 4ade02b..796a50a 100644 --- a/apps/client/src/surfaces/blocks/pinned-doc.ts +++ b/apps/client/src/surfaces/blocks/pinned-doc.ts @@ -29,7 +29,9 @@ const pinRow = (pin: Pin, actions: Actions): VNode => h( 'span', { class: 'body' }, - h('span', { class: 'ttl' }, pin.title, ' ', h('span', { class: 'ext' }, pin.kind)), + // The kind tag carries its leading space inside the (non-selectable) .ext span so a native selection + // of the title yields the bare title with no trailing separator (#242). + h('span', { class: 'ttl' }, pin.title, h('span', { class: 'ext' }, ` ${pin.kind}`)), h('span', { class: 'why' }, ingestWhy(pin)), ), // copy payload = the document VALUE ONLY (`pin.uri`) — the pasteable reference, matching the fallback diff --git a/apps/client/src/surfaces/blocks/relevant-now.ts b/apps/client/src/surfaces/blocks/relevant-now.ts index 30ad6fc..1f1dbfb 100644 --- a/apps/client/src/surfaces/blocks/relevant-now.ts +++ b/apps/client/src/surfaces/blocks/relevant-now.ts @@ -114,7 +114,10 @@ const renderRow = ( const glyph = clarifyGlyph(row.entity, clarify) const ask = clarifyAsk(row.entity, dismissBase.workspaceId, clarify) const body: VNode[] = [ - h('span', { class: 'ttl' }, stateDot(row.entity.state, vocab), row.entity.name, ' ', h('span', { class: 'ext' }, ext)), + // The value (entity name) is the ONLY selectable text in the row title; the ext/kind tag carries its + // own leading space INSIDE the (non-selectable) .ext span so a native selection yields the bare value + // with no trailing separator (#242). + h('span', { class: 'ttl' }, stateDot(row.entity.state, vocab), row.entity.name, h('span', { class: 'ext' }, ` ${ext}`)), h('span', { class: 'why' }, why), ] if (ask) body.push(ask) diff --git a/apps/client/src/surfaces/blocks/selection-hygiene.test.ts b/apps/client/src/surfaces/blocks/selection-hygiene.test.ts new file mode 100644 index 0000000..816ce37 --- /dev/null +++ b/apps/client/src/surfaces/blocks/selection-hygiene.test.ts @@ -0,0 +1,131 @@ +import { test } from 'node:test' +import assert from 'node:assert/strict' +import type { Block, Distillate, Entity, RelevantEntity, TodoItem } from '@openinfo/contracts' +import type { NowContext } from '../block-renderer/index.js' +import type { VNode } from '../block-renderer/vnode.js' +import { hudStyles } from '../hud/styles.js' +import { panelStyles } from '../hud/panel-styles.js' +import { defaultBlockRegistry } from './index.js' + +/** + * SELECTION-HYGIENE regression (#242) — the headline QA defect: the HUD is used to select/copy VALUES out + * of rows, and a native double-click / drag / select-all must capture the bare value and NOTHING else (no + * why/context line, no mark glyph, no kind tag, no affordance label). The bug the owner saw was selecting a + * summary line yielding ".". + * + * The client has no bundler and the renderer is a PURE vnode tree, so this test proves the mechanism WITHOUT + * a DOM: it derives the set of non-selectable classes FROM THE ACTUAL STYLESHEET (never a hardcoded list), + * then walks a rendered row collecting the text a browser selection would keep — every text node with no + * `user-select:none` ancestor — and asserts it equals the bare value. Deriving the set from the live + * stylesheet is the by-construction guard: delete a rule in styles.ts and the matching decoration text leaks + * into `selectableText`, failing the equality below; the explicit `has(...)` assertions and the negative + * probe make that dependency load-bearing rather than vacuously green. + */ + +const now: NowContext = { live: true } + +/** + * Parse a CSS string into the set of classes made non-selectable. For each rule whose body declares + * `user-select:none`, the SUPPRESSED element is the last simple selector in each comma-separated selector + * (e.g. `.rel .body .ttl .ext` suppresses `.ext`; `.rel .go` suppresses `.go` and its children by + * inheritance), so we take the trailing class token. No hardcoded class list — the stylesheet is the source. + */ +const parseSuppressedClasses = (rawCss: string): Set => { + const out = new Set() + // Strip CSS comments first — they are not selectors, and ours name value classes (.ttl, .in-msg) that + // must NOT be treated as suppressed. + const css = rawCss.replace(/\/\*[\s\S]*?\*\//g, '') + for (const rule of css.split('}')) { + const brace = rule.indexOf('{') + if (brace === -1) continue + const selectorList = rule.slice(0, brace) + const body = rule.slice(brace + 1) + if (!/user-select\s*:\s*none/.test(body)) continue + for (const selector of selectorList.split(',')) { + const classes = selector.trim().match(/\.[A-Za-z0-9_-]+/g) + if (classes && classes.length > 0) out.add(classes[classes.length - 1]!.slice(1)) + } + } + return out +} + +const hasSuppressedClass = (attrs: Record, suppressed: ReadonlySet): boolean => { + const cls = attrs['class'] + return typeof cls === 'string' && cls.split(/\s+/).some((c) => suppressed.has(c)) +} + +/** The text a native selection across `node` would keep: every text node NOT under a user-select:none ancestor. */ +const selectableText = (node: VNode, suppressed: ReadonlySet, under = false): string => { + if (typeof node === 'string') return under ? '' : node + const nowUnder = under || hasSuppressedClass(node.attrs, suppressed) + return node.children.map((child) => selectableText(child, suppressed, nowUnder)).join('') +} + +const render = (block: Block, items: unknown[]): VNode => { + const node = defaultBlockRegistry[block.block]!({ block, now, result: { source: block.query!.source, items, truncated: false } }) + assert.ok(node && !Array.isArray(node), 'block renders a single root node') + return node +} + +const copyAction = [{ id: 'a-copy', label: 'Copy', verb: 'copy' as const, params: {} }] + +const suppressed = parseSuppressedClasses(`${hudStyles}\n${panelStyles}`) + +// A link surfaces as an `artifact` entity whose `name` is the extracted surface form — a FULL URL here, to +// double as the "fully realized value" proof: the whole URL selects, and none of the row decoration does. +const linkEntity: Entity = { + id: 'e-link', workspaceId: 'ws', kind: 'artifact', name: 'https://docs.example.com/soc2?section=controls#c-4', + aliases: [], momentRefs: [], outboundCount: 0, mentions: 3, + firstSeen: '2026-07-16T19:57:00Z', lastSeen: '2026-07-16T19:57:00Z', + provenance: [{ slot: 'llm', endpoint: 'dev-mac-omlx', windowEnd: '2026-07-16T19:57:00Z' }], + sightings: [{ via: 'heard', at: '2026-07-16T19:57:00Z' }], +} +const relBlock: Block = { block: 'relevant-now', show: 'always', query: { source: 'relevant-now', params: {} }, actions: copyAction } +const rel: RelevantEntity = { entity: linkEntity, score: 1, moments: [] } +const relNode = render(relBlock, [rel]) + +const todoBlock: Block = { block: 'todos', show: 'always', query: { source: 'todos', params: { session: 'current' } }, actions: copyAction } +const todo: TodoItem = { id: 't1', text: 'Send Dana the signed MSA', createdAt: '2026-07-16T14:40:00Z', provenance: { sessionId: 'ses', distillateId: 'dst-9' } } +const todoNode = render(todoBlock, [todo]) + +const distBlock: Block = { block: 'distillates', show: 'always', query: { source: 'distillates', params: {} }, actions: copyAction } +const distillate: Distillate = { + id: 'dst-1', sessionId: 'ses', workspaceId: 'ws', + windowStart: '2026-07-16T14:20:00Z', windowEnd: '2026-07-16T14:30:00Z', + sourceChunks: ['c-1'], text: 'Provide feedback to QA within 18 minutes', + voice: { scope: 'session', dials: { tone: 3, warmth: 4, wit: 2, charm: 2, specificity: 9, brevity: 8 } }, + provenance: { slot: 'llm', endpoint: 'llm.fast' }, schemaVersion: 1, createdAt: '2026-07-16T14:30:00Z', +} +const distNode = render(distBlock, [distillate]) + +test('a native selection of a relevant-now row keeps the bare value only — no why, mark, kind tag, or affordance', () => { + // The row DISPLAYS its why ("heard · …"), a mark glyph, the kind/mention tag, and a Copy button — none may + // ride into a selection. The only selectable text is the entity value (here, the full canonical URL). + assert.equal(selectableText(relNode, suppressed), linkEntity.name) +}) + +test('a native selection of a todos row keeps the bare to-do text only', () => { + assert.equal(selectableText(todoNode, suppressed), todo.text) +}) + +test('a native selection of a distillates (transcript) row keeps the bare value only — the ".from the meeting" defect cannot recur', () => { + // The exact shape the owner reported: value + adjacent why-line. The why ("from what was captured") and the + // clock (.mk) are decoration; a selection must yield only the distilled value. + assert.equal(selectableText(distNode, suppressed), distillate.text) +}) + +test('the classes this test relies on are non-selectable in the ACTUAL stylesheet (by-construction guard)', () => { + // Derived from styles.ts / panel-styles.ts, not hardcoded — removing any of these rules fails BOTH this + // assertion and the equality tests above (the decoration text would leak into selectableText). + for (const cls of ['why', 'ext', 'mk', 'glbl', 'go', 'dot', 't', 'unans', 'in-cites', 'in-who']) { + assert.ok(suppressed.has(cls), `.${cls} must be non-selectable`) + } +}) + +test('negative probe: were .why NOT suppressed, the why line WOULD leak — proving the guard is load-bearing', () => { + const weakened = new Set(suppressed) + weakened.delete('why') + const leaked = selectableText(relNode, weakened) + assert.notEqual(leaked, linkEntity.name) + assert.match(leaked, /heard/) // the why line rejoins the selection exactly when the rule is gone +}) diff --git a/apps/client/src/surfaces/blocks/summaries.test.ts b/apps/client/src/surfaces/blocks/summaries.test.ts index efeb7ed..7e811ad 100644 --- a/apps/client/src/surfaces/blocks/summaries.test.ts +++ b/apps/client/src/surfaces/blocks/summaries.test.ts @@ -50,6 +50,10 @@ test('HONEST degraded: a summary with no model prose renders a calm unavailable assert.match(html, /Summary unavailable — no summary model connected/) // calm human degraded copy (hud-voice §3) assert.match(html, /nothing invented/) // the why reassures: no fabrication assert.match(html, /title="no summarizer endpoint"/) // the machine reason stays reachable on inspection, not in glance + // #242: a degraded row has no value to copy — the copy affordance is SUPPRESSED, never a live button that + // would put an empty string on the clipboard. + assert.doesNotMatch(html, /data-copy=""/) + assert.doesNotMatch(html, /data-verb="copy"/) }) test('empty is EXPLAINABLE, and an on-match empty summaries block stays hidden', () => { diff --git a/apps/client/src/surfaces/blocks/summaries.ts b/apps/client/src/surfaces/blocks/summaries.ts index b052bc6..7a55f53 100644 --- a/apps/client/src/surfaces/blocks/summaries.ts +++ b/apps/client/src/surfaces/blocks/summaries.ts @@ -50,7 +50,9 @@ const summaryRow = (summary: Summary, actions: Actions): VNode => { // The recorded machine reason stays reachable on inspection (hud-voice §4), never in glance position. h('span', degraded && summary.degraded ? { class: 'why', title: summary.degraded.reason } : { class: 'why' }, why), ), - h('span', { class: 'go' }, ...actionButtons(actions, degraded ? '' : summary.text!)), + // A degraded row has NO value to copy — suppress the copy affordance entirely rather than shipping a + // live Copy button that puts an empty string on the clipboard (#242). Live rows copy the prose. + h('span', { class: 'go' }, ...(degraded ? [] : actionButtons(actions, summary.text!))), ) } diff --git a/apps/client/src/surfaces/blocks/transcript-inspector.ts b/apps/client/src/surfaces/blocks/transcript-inspector.ts index fbfce6c..6c6d4b6 100644 --- a/apps/client/src/surfaces/blocks/transcript-inspector.ts +++ b/apps/client/src/surfaces/blocks/transcript-inspector.ts @@ -80,7 +80,7 @@ const retentionRow = (ringLimit: number): VNode => 'span', { class: 'body' }, h('span', { class: 'ttl' }, `live feed · last ${ringLimit}, this session, not persisted`), - h('span', { class: 'why' }, 'transcript chunks are the ephemeral fast-path (#58); the durable stream is the distillate block'), + h('span', { class: 'why' }, 'transcript chunks are the ephemeral fast-path; the durable stream lives in the Transcript block'), ), ) diff --git a/apps/client/src/surfaces/hud/input-submit.test.ts b/apps/client/src/surfaces/hud/input-submit.test.ts index d85a2b9..27170db 100644 --- a/apps/client/src/surfaces/hud/input-submit.test.ts +++ b/apps/client/src/surfaces/hud/input-submit.test.ts @@ -176,7 +176,10 @@ test('a FAILED submit paints the reason as visible text (never a silent no-op)', await flush() const status = container.querySelector('.in-status')!.innerHTML - assert.match(status, /in-note error">no llm endpoint answered/) + // hud-voice §2 (#242): the strip shows ONE calm human line, never the raw exception verbatim… + assert.match(status, /class="in-note error"[^>]*>Couldn’t answer — the engine returned an error\./) + // …and the raw machine reason stays REACHABLE behind inspection (the hover title), never painted as slop. + assert.match(status, /title="[^"]*no llm endpoint answered \(fabric llm slot is empty\)[^"]*"/) // the user turn is still shown; the assistant turn is NOT fabricated const log = container.querySelector('.in-log')!.innerHTML assert.match(log, /You<\/span>hello/) @@ -226,6 +229,27 @@ test('a dropped file ingests via the injected upload, shows the attachment, and assert.match(container.querySelector('.in-log')!.innerHTML, /cited p\.2/) }) +test('a PAGELESS citation is named by its human title, never a raw chunk ordinal (#242)', async () => { + const session = new InputSession({ + // Two chunks from the same pageless source: the machine ordinal (#0/#1) must NOT render; the human + // title stands in, deduped so it appears once. + submit: async () => + reply('answered', 'cited', [ + { pinId: 'pin-9', pinTitle: 'onboarding notes', ordinal: 0, excerpt: 'a' }, + { pinId: 'pin-9', pinTitle: 'onboarding notes', ordinal: 1, excerpt: 'b' }, + ]), + }) + const { container, textarea, submit } = buildContainer() + session.install(container) + textarea.value = 'what did we agree?' + container.dispatch('click', submit) + await flush() + const log = container.querySelector('.in-log')!.innerHTML + assert.match(log, /cited onboarding notes/) // the human source name + assert.doesNotMatch(log, /#0|#1/) // never the raw chunk ordinal + assert.doesNotMatch(log, /onboarding notes · onboarding notes/) // deduped, not stuttered +}) + test('the local path is resolved via the preload webUtils bridge (Electron 32+ removed File.path)', async () => { // The desktop shell's real DOM File no longer carries `.path` (removed in Electron 32; this repo ships // 38) — the path now comes from webUtils.getPathForFile, exposed on window.openinfoFiles by preload.cts. diff --git a/apps/client/src/surfaces/hud/input-submit.ts b/apps/client/src/surfaces/hud/input-submit.ts index 7437bf7..8b7a922 100644 --- a/apps/client/src/surfaces/hud/input-submit.ts +++ b/apps/client/src/surfaces/hud/input-submit.ts @@ -137,7 +137,11 @@ const turnHtml = (turn: ChatTurn): string => const citationsHtml = (reply: ChatReply): string => { if (reply.citations.length === 0) return '' - const tags = reply.citations.map((c) => escapeHtml(c.page !== undefined ? `p.${c.page}` : `#${c.ordinal}`)).join(' · ') + // A page anchor is human ("p.3"); the chunk ORDINAL is a machine index (hud-voice §2), so a pageless + // source is named by its human title instead, never "#2" (#242). Deduped so repeated anchors don't stutter. + const tags = [...new Set(reply.citations.map((c) => (c.page !== undefined ? `p.${c.page}` : (c.pinTitle ?? 'a passage'))))] + .map(escapeHtml) + .join(' · ') return `
cited ${tags}
` } @@ -335,8 +339,10 @@ export class InputSession { const outcome = await this.deps.captureScreen() if (outcome.ok) screenshot = outcome.frame else captureNote = outcome.reason - } catch (error) { - captureNote = error instanceof Error ? error.message : String(error) + } catch { + // A capture bridge that throws is a screen-side failure, not the answer — say so in calm words, + // never paint the raw exception into the status line (hud-voice §2, #242). + captureNote = 'screen capture did not respond' } } else { captureNote = 'screen capture needs the desktop app' @@ -388,8 +394,14 @@ export class InputSession { const calm = calmChatStatus(reply, captureNote) this.status = calm.text === '' ? undefined : { kind: 'ok', text: calm.text, detail: calm.detail } } catch (error) { - // VISIBLE FAILURE — the reason is painted as text, never swallowed. - this.status = { kind: 'error', text: error instanceof Error ? error.message : String(error) } + // VISIBLE FAILURE — the reason is never swallowed, but the raw exception is machine-speak + // (hud-voice §2): the strip shows one calm human line and the raw message rides the hover title + // (the same detail-on-inspection pattern as calmChatStatus), reachable but never painted as slop (#242). + this.status = { + kind: 'error', + text: 'Couldn’t answer — the engine returned an error.', + detail: error instanceof Error ? error.message : String(error), + } } finally { this.streaming = undefined this.pending = false diff --git a/apps/client/src/surfaces/hud/notetaker-layout.test.ts b/apps/client/src/surfaces/hud/notetaker-layout.test.ts index 588b7c0..4fc5cc0 100644 --- a/apps/client/src/surfaces/hud/notetaker-layout.test.ts +++ b/apps/client/src/surfaces/hud/notetaker-layout.test.ts @@ -227,5 +227,5 @@ test('the note-taker zones are honest when empty (always-on blocks explain thems assert.match(right, /No transcript yet/) assert.match(right, /turn on “Distill what is captured” in Settings → Features/) // the on-match fields block simply stays hidden when it has produced nothing (no fabricated card) - assert.doesNotMatch(right, /Fields · fast/) + assert.doesNotMatch(right, /class="glbl">Fields