How apotheosys1982/chat-first-surface-shell works
1. This repository is a standalone, static browser prototype for a “chat-first” assistant shell. The app is not a full backend service; the runtime surface is the HTML/CSS/JS bundle under assistants/chat-first-surface-shell/public, mirrored into dist/chat-first-surface-shell for deployment.
2. The entry point is a single-page browser app: public/index.html loads the shell script, styles, motion CSS, and supporting data files. Netlify is the publishing target, and the repo is structured so the source app directory is what gets deployed directly.
3. The main interactive subsystem is the chat shell itself, centered on the composer. The README makes clear that the composer is treated as the command line for the surface, and the shell is intentionally “chat-first” rather than a generic dashboard. This is the first screen and the primary control surface.
4. Artifact handling is a distinct routing boundary. The shell prioritizes “artifact commands” over natural-language answer-room routing, and registered artifacts open in a full-viewport artifact layer. That means command interpretation and artifact presentation are a separate path from ordinary chat responses.
5. Uploaded or imported files are quarantined rather than becoming trusted sources automatically. The presence of source-registry.js, state-events.js, project-state.js, and the “source inbox” planning/history files suggests a source-ingestion pipeline with explicit approval/state transitions instead of immediate activation.
6. State management appears to be split across a few small client-side modules: project-state.js for persisted shell state, state-events.js for state change events, and source-registry.js for tracking approved sources/artifacts. This suggests a lightweight evented state model rather than a server-backed store.
7. Rendering is decomposed into shell chrome, content area, and motion/transition concerns. The motion/ directory contains shared-element and view-transition CSS libraries plus motion tokens, indicating that view changes and full-viewport artifact transitions are a first-class UI concern rather than incidental styling.
8. There is explicit support for a fallback-capable “HTML-in-Canvas” or canvas document stage. The repository contains a validation script for this (validate-chat-first-html-canvas-stage.js) and associated planning/evaluation docs, implying the app can attempt native canvas-based document rendering when browser APIs allow it, but must report DOM fallback honestly when they do not.
9. The viewport and scrolling behavior are constrained as part of the product architecture. Multiple planning/checksum items reference viewport lock, scroll stability, chrome direction, and offscreen tray behavior, which indicates the shell is designed to stay vertically constrained on both mobile and desktop and avoid horizontal pan or clipped UI regions.
10. The build/deployment workflow is simple but tightly governed. tools/compile-chat-first-answer-pack.js produces public/compiled-answer-pack.js, tools/sync-chat-first-state.js keeps source and mirror state aligned, and the various validate-* scripts enforce shell, routing, ingestion, rendering, and checksum invariants. The checksums/, receipts/, and logs/ directories show an audit trail for these validation passes.
11. The repo also contains a substantial planning-and-handoff layer (docs/, receipts/, logs/, top-level PLANNING_*.md, HANDOFF_*.md). These files are not runtime subsystems, but they are part of the architecture process: they document design decisions for routing, premium UI, artifact lifecycle, and live evaluation protocols.
12. In deployment terms, the architecture is “source app + mirrored dist bundle + static host.” Local development uses Python’s built-in HTTP server, while production is Netlify. That means the critical boundary is not an API tier, but consistency between the source directory, the compiled answer pack, and the published mirror.
Main entry points: script.js Shell script · index.html Index page · validate-chat-first-shell.js Validators · ARCHITECTURE.md Architecture docs
Components 19
Runtime surface
Static browser shell and its mirrored deployment bundle.
- Index page · Browser entry point that loads the shell bundle and supporting assets.
assistants/chat-first-surface-shell/public/index.html - Shell script · Primary client-side application logic for the chat-first surface.
assistants/chat-first-surface-shell/public/script.js - Shell styles · Core presentation for chrome, layout, and shell surface behavior.
assistants/chat-first-surface-shell/public/styles.css - Answer pack · Generated pack consumed by the browser shell for assistant answers and routing support.
assistants/chat-first-surface-shell/public/compiled-answer-pack.js - Netlify deploy · Publishes the mirrored static bundle as the production host target.
netlify.toml
Shell state
Client-side state, registry, and routing boundaries inside the app.
- Project state · Client-side persisted shell state for the current session and workspace.
assistants/chat-first-surface-shell/public/project-state.js - State events · Event layer for state transitions and shell activity.
assistants/chat-first-surface-shell/public/state-events.js - Source registry · Tracks approved sources and artifact registration, separating trusted sources from quarantined imports.
assistants/chat-first-surface-shell/public/source-registry.js - Artifact router · Prioritizes artifact commands and canonical open paths before ordinary chat routing.
tools/validate-chat-first-artifact-router.js - Canvas stage · Validates the fallback-capable HTML-in-Canvas document stage.
tools/validate-chat-first-html-canvas-stage.js
Motion layer
Transition and shared-element styling used by the shell and artifact views.
- Motion tokens · Shared motion variables and timing tokens for shell transitions.
assistants/chat-first-surface-shell/public/motion/motion-tokens.css - Shared motion · Shared-element transition styling for cross-view movement.
assistants/chat-first-surface-shell/public/motion/shared-element-library.css - View transitions · View-transition rules for full-viewport and artifact-layer changes.
assistants/chat-first-surface-shell/public/motion/view-transition-library.css
Build and validation
Compile, sync, and invariant checks for the repository.
- Compile pack · Builds the compiled answer pack consumed by the shell.
tools/compile-chat-first-answer-pack.js - State sync · Keeps source and mirrored state aligned between source app and dist bundle.
tools/sync-chat-first-state.js - Validators · Repository checks for shell behavior, routing, ingestion, renderer contracts, and syntax.
tools/validate-chat-first-shell.js
Planning and audit
Architectural docs, handoffs, receipts, logs, and checksums.
- Repo README · Top-level orientation for the standalone repository and deployment model.
README.md - Shell README · Explains the chat-first surface shell, composer-centric interaction model, and deployment shape.
assistants/chat-first-surface-shell/README.md - Architecture docs · Cross-cutting planning and architecture notes for routing, UI, artifact lifecycle, and evaluation.
docs/ARCHITECTURE.md
Connections 23
- Repo README → Shell README: points to · Repository overview flows into the shell-specific README.
- Shell README → Index page: defines entry · The shell README describes the browser entry surface.
- Index page → Shell script: loads · The SPA bootstraps the main client runtime.
- Index page → Shell styles: loads · The entry page includes core shell styling.
- Index page → Motion tokens: loads · Motion tokens support the shell's transition system.
- Shell script → Project state: persists · The shell runtime reads and writes persisted state.
- Shell script → State events: emits · State changes are modeled as events.
- Shell script → Source registry: routes through · Artifact and source handling use the registry boundary.
- Shell script → Artifact router: dispatches · Command interpretation separates artifact paths from chat answers.
- Shell script → Canvas stage: renders via · Document stage behavior is part of the interactive render path.
- Shell script → Shared motion: uses · Shared-element transitions coordinate shell and artifact views.
- Shell script → View transitions: uses · Fullscreen artifact and view changes rely on view-transition rules.
- Compile pack → Answer pack: produces · Build step generates the compiled answer pack shipped with the app.
- State sync → Project state: aligns · Synchronization keeps source and mirrored state consistent.
- Validators → Shell script: checks · Shell behavior is validated as part of the invariant suite.
- Validators → Artifact router: checks · Routing rules are validated explicitly.
- Validators → Canvas stage: checks · Canvas-stage fallback behavior is validated explicitly.
- Validators → Index page: checks · Entry-page and bundle wiring are part of shell validation.
- Netlify deploy → Index page: publishes · Production hosting serves the source app bundle as static content.
- Architecture docs → Artifact router: documents · Architecture docs record the routing and artifact lifecycle design.
- Architecture docs → Canvas stage: documents · Docs capture the HTML-in-Canvas spike and evaluation protocol.
- Architecture docs → Validators: documents · Validation expectations and evaluation process are documented.
- Architecture docs → Netlify deploy: documents · Deployment and mirrored-bundle conventions are covered in docs.