Skip to content

Commit 087ab75

Browse files
committed
docs(spec): archive web chat codemirror resource projection
1 parent dc13c2f commit 087ab75

9 files changed

Lines changed: 154 additions & 0 deletions

File tree

openspec/changes/web-chat-codemirror-resource-projection/.openspec.yaml renamed to openspec/changes/archive/2026-06-01-web-chat-codemirror-resource-projection/.openspec.yaml

File renamed without changes.

openspec/changes/web-chat-codemirror-resource-projection/plans/plan.md renamed to openspec/changes/archive/2026-06-01-web-chat-codemirror-resource-projection/plans/plan.md

File renamed without changes.

openspec/changes/web-chat-codemirror-resource-projection/review/self-review.html renamed to openspec/changes/archive/2026-06-01-web-chat-codemirror-resource-projection/review/self-review.html

File renamed without changes.

openspec/changes/web-chat-codemirror-resource-projection/review/self-review.md renamed to openspec/changes/archive/2026-06-01-web-chat-codemirror-resource-projection/review/self-review.md

File renamed without changes.

openspec/changes/web-chat-codemirror-resource-projection/specs/web-chat-view-framework7-overlay-resource-law/spec.md renamed to openspec/changes/archive/2026-06-01-web-chat-codemirror-resource-projection/specs/web-chat-view-framework7-overlay-resource-law/spec.md

File renamed without changes.

openspec/changes/web-chat-codemirror-resource-projection/specs/web-chat-view/spec.md renamed to openspec/changes/archive/2026-06-01-web-chat-codemirror-resource-projection/specs/web-chat-view/spec.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@
109109
- **THEN** the row label stays the reference label
110110
- **AND** the row detail prefers the image or file name over a generic resource kind description
111111

112+
## ADDED Requirements
113+
112114
### Requirement: Web chat view SHALL expose CodeMirror mode ownership for composer and transcript
113115

114116
The shared WebChat surface SHALL treat the composer and message bubble as two explicit CodeMirror modes over the same Markdown resource grammar. The composer mode SHALL be writable and preserve normal editing behavior. The bubble mode SHALL be readonly and may hide structural source details such as resource footnote definitions as presentation-only projection.

openspec/changes/web-chat-codemirror-resource-projection/tasks.md renamed to openspec/changes/archive/2026-06-01-web-chat-codemirror-resource-projection/tasks.md

File renamed without changes.

openspec/specs/web-chat-view-framework7-overlay-resource-law/spec.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,35 @@ Sent-message resource presentation SHALL be driven from the same serialized sour
6565
- **THEN** the raw source still contains both the inline token and its Markdown footnote definition
6666
- **AND** hiding footnote definition lines in preview mode remains a view projection rather than a storage mutation
6767

68+
#### Scenario: Resource token widgets are shared across writable and readonly CodeMirror surfaces
69+
70+
- **WHEN** an inline resource token resolves in the composer or in a sent message bubble
71+
- **THEN** both surfaces use one shared CodeMirror resource-token widget family
72+
- **AND** the widget family renders comment, file, and image references through one shared icon-with-number visual atom
73+
- **AND** the visual atom accepts ink/surface/border variables without requiring token, card, or bar-specific drawing forks
74+
- **AND** the visual atom draws its visible internals as two stacked SVG layers: base icon layer plus info layer
75+
- **AND** the base icon layer uses the official lucide resource glyphs rather than hand-drawn lookalike paths
76+
- **AND** the stacked real SVG layers, including the lucide-generated base SVG and the local info SVG, are owned by a shared named grid area instead of absolute-position overlay stitching or anonymous grid-line coordinates
77+
- **AND** the info SVG layer stacks above the base icon SVG layer by explicit z-index ordering
78+
- **AND** comment, file, and image base glyphs share one opacity rule unless a future spec names a separate visual state
79+
- **AND** visual differences are mode policy differences rather than separate parsing implementations
80+
- **AND** Framework7 resource preview activation receives the same `WebChatResourceReference` from either surface
81+
82+
#### Scenario: Resource bar is a no-scroll icon strip by default
83+
84+
- **GIVEN** a sent message bubble contains several resolved resources
85+
- **WHEN** the in-bubble resource bar renders those resources
86+
- **THEN** each child owns a stable icon tile size
87+
- **AND** the bar may wrap into additional rows when space is constrained
88+
- **AND** the bar does not show uncontrolled horizontal or vertical scrollbars in normal desktop or iPhone 14 message widths
89+
90+
#### Scenario: Writable composer projection does not hide editing truth
91+
92+
- **WHEN** the operator edits a draft containing resource tokens
93+
- **THEN** CodeMirror decorations may make the token look like a resource affordance
94+
- **AND** the actual Markdown token text remains the editable draft truth
95+
- **AND** the composer does not hide footnote definition source as if it were a readonly transcript bubble
96+
6897
### Requirement: Resource activation SHALL be parity across token and tile
6998

7099
Resource detail behavior SHALL be keyed by the resolved resource itself, not by where the operator clicked it from.

openspec/specs/web-chat-view/spec.md

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,3 +389,126 @@ The shared chat package SHALL use `viewKey` as the UI merge and render identity
389389
- **THEN** `web-chat-view` treats the token as unresolved source text or an unresolved resource reference
390390
- **AND** it does not recover the comment by reading `metadata.webChatCommentResources`
391391
- **AND** the failure remains visible to tests and source inspection as a serialization bug
392+
393+
#### Scenario: Composer and bubble share one resource token projection law
394+
395+
- **GIVEN** the writable composer contains an inline resource token such as `[^Comment 1]`
396+
- **AND** the pending resource list contains the matching comment resource
397+
- **WHEN** the composer CodeMirror renders the draft
398+
- **THEN** the token is decorated with the shared icon-with-number resource affordance
399+
- **AND** the underlying draft text remains editable Markdown
400+
- **AND** submitting still serializes the final message as raw Markdown content without WebChat resource metadata
401+
402+
#### Scenario: Composer resource completion is scoped to the current draft message
403+
404+
- **GIVEN** the transcript already contains sent messages with Markdown resource footnotes such as `[^Image 1]` and `[^File 1]`
405+
- **AND** the current composer draft has its own pending resources
406+
- **WHEN** the operator opens `@` or `^` completion in the composer
407+
- **THEN** completion suggestions include only current composer resources and host-provided composer-scoped resources
408+
- **AND** resources reconstructed from other transcript messages are not offered
409+
- **AND** `Comment N`, `Image N`, and `File N` numbering is local to the current message rather than global across the room
410+
411+
#### Scenario: Composer upload opens the resource preview immediately
412+
413+
- **GIVEN** the composer accepts a newly uploaded image or file
414+
- **WHEN** the pending asset is admitted into the current draft resource list
415+
- **THEN** the same resource preview layer used by clicking the resource rail icon opens automatically for that newly accepted resource
416+
- **AND** duplicate or rejected files do not reopen a stale preview
417+
418+
#### Scenario: Resource icon number is normalized for all token surfaces
419+
420+
- **GIVEN** a resource label or token text resolves to resource number `1` through `9`
421+
- **WHEN** the composer token, readonly bubble token, or resource card renders that resource
422+
- **THEN** the visible icon number is the resolved single digit
423+
- **AND** a resource number outside `1` through `9` renders `*`
424+
- **AND** comment, file, and image variants are rendered by the same icon-with-number component family
425+
426+
#### Scenario: Resource icon atom supports visual theming and browser-min-font-safe scaling
427+
428+
- **GIVEN** the shared resource icon atom is rendered with different ink and surface CSS variables
429+
- **WHEN** image, comment, and file variants render in the walkthrough surface
430+
- **THEN** the icon glyph, number, and extension badge remain legible across those colors
431+
- **AND** the image glyph and image number use the same ink color
432+
- **AND** small numeric and extension text uses `font-size: 1rem` with transform scale instead of shrinking only through `font-size`
433+
434+
#### Scenario: Resource icon atom draws visible marks through layered SVG
435+
436+
- **GIVEN** the shared resource icon atom renders a comment, file, or image variant
437+
- **WHEN** the visible icon internals are constructed
438+
- **THEN** the base resource glyph is drawn in a base SVG layer using the official lucide glyph for that kind
439+
- **AND** the resource number, badge, and extension marks are drawn in a separate info SVG layer
440+
- **AND** the two SVG layers share one stable viewBox coordinate system
441+
- **AND** the two real SVG elements, including the lucide-generated base SVG and the local info SVG, are placed into the same named grid area by the component layout rather than stitched together with absolute positioning or anonymous grid-line coordinates
442+
- **AND** the info SVG layer has an explicit stacking order above the base icon SVG layer
443+
- **AND** base glyph opacity is controlled by one shared component law instead of kind-specific opacity exceptions
444+
- **AND** token, card, preview, and resource bar surfaces do not add their own visible HTML overlays for the resource number or extension
445+
446+
#### Scenario: Resource icon container protects SVG layers from rounded clipping
447+
448+
- **GIVEN** the shared resource icon atom has a border radius and hidden overflow
449+
- **WHEN** the base and info SVG layers render inside the icon container
450+
- **THEN** the container provides safe padding derived from the effective corner radius
451+
- **AND** the padding equals `min(border-radius, width, height) / 4`
452+
- **AND** the base and info SVG layers remain same-size grid layers inside the padded content box
453+
454+
#### Scenario: Resource icon atom follows user-directed optical alignment
455+
456+
- **GIVEN** the shared resource icon atom renders image, comment, and file variants
457+
- **WHEN** the info layer draws each variant-specific mark
458+
- **THEN** the image number is centered inside its circular badge
459+
- **AND** user-tuned image badge SVG coordinates and radius are preserved as component attributes
460+
- **AND** the image number badge stroke uses currentColor with a thin `0.5` stroke width
461+
- **AND** the comment variant uses the official `MessageSquareDot` base glyph with a smaller centered number
462+
- **AND** the file variant offsets and scales the info layer so the file number remains centered while the extension badge sits at the bottom-right corner
463+
- **AND** user-tuned comment/file SVG coordinates are preserved as component attributes
464+
- **AND** the file extension badge stroke uses currentColor with a thin `0.5` stroke width
465+
- **AND** the file extension still uses scaled `1rem` text rather than browser-minimum font-size dependency
466+
467+
#### Scenario: File resource icon uses extension as a badge
468+
469+
- **GIVEN** a file resource has a resolved extension such as `PDF`
470+
- **WHEN** the file resource icon renders
471+
- **THEN** the file number is centered inside the file icon
472+
- **AND** the extension renders as a bottom-right corner badge
473+
- **AND** inline and tile sizes share the same badge SVG coordinate law rather than applying an inline-only badge translation
474+
- **AND** the file info SVG layer is not resized or repositioned as a whole layer
475+
- **AND** any file-specific optical scale or offset is folded into internal SVG coordinates and text scale variables
476+
- **AND** the extension text uses scaled `1rem` text rather than a browser-minimum font-size dependency
477+
478+
#### Scenario: Readonly bubble keeps sent projection semantics
479+
480+
- **GIVEN** a sent message contains inline resource tokens and matching Markdown footnote definitions
481+
- **WHEN** the readonly bubble CodeMirror renders the message
482+
- **THEN** inline tokens use the same icon-with-number resource affordance family
483+
- **AND** footnote definition lines collapse out of normal reading mode
484+
- **AND** the in-bubble resource bar is rendered from the same resolved resources
485+
- **AND** the in-bubble resource bar controls child tile dimensions without uncontrolled horizontal or vertical scrollbars
486+
487+
#### Scenario: Resource preview and completion copy uses reference names and file names
488+
489+
- **GIVEN** an image or file resource has a reference label such as `Image 1` or `File 1`
490+
- **AND** the resource also has an extension, MIME type, and file name
491+
- **WHEN** the preview layer renders its header
492+
- **THEN** the header eyebrow shows the reference label instead of the extension or MIME type
493+
- **AND** MIME and size details stay in the metadata line
494+
- **WHEN** the composer completion panel renders that resource
495+
- **THEN** the row label stays the reference label
496+
- **AND** the row detail prefers the image or file name over a generic resource kind description
497+
498+
### Requirement: Web chat view SHALL expose CodeMirror mode ownership for composer and transcript
499+
500+
The shared WebChat surface SHALL treat the composer and message bubble as two explicit CodeMirror modes over the same Markdown resource grammar. The composer mode SHALL be writable and preserve normal editing behavior. The bubble mode SHALL be readonly and may hide structural source details such as resource footnote definitions as presentation-only projection.
501+
502+
#### Scenario: Composer is writable CodeMirror
503+
504+
- **WHEN** the WebChat composer mounts in a browser runtime
505+
- **THEN** the draft surface is a CodeMirror editor
506+
- **AND** editing the document updates the composer draft
507+
- **AND** the editor is not configured with readonly or non-editable CodeMirror facets
508+
509+
#### Scenario: Bubble is readonly CodeMirror
510+
511+
- **WHEN** a message bubble mounts
512+
- **THEN** the content surface is a CodeMirror editor
513+
- **AND** the editor is configured with readonly state and non-editable DOM behavior
514+
- **AND** resource-token projection remains interactive for opening resource details

0 commit comments

Comments
 (0)