Files
smartchat/readme.hints.md
T
jkunz dd04edb420 feat(initial): scaffold @push.rocks/smartchat with core, CLI, and web layers
Three-layer architecture built on @push.rocks/smartagent:
- ts/ — ChatSession wrapping runAgent() with conversation state management
- ts_cli/ — ink-based terminal chat TUI (React.createElement, no JSX)
- ts_web/ — Lit web components (smartchat-window, smartchat-message, smartchat-input)
2026-03-06 23:20:12 +00:00

30 lines
1.8 KiB
Markdown

# Project Readme Hints
## Overview
`@push.rocks/smartchat` v0.0.1 provides interactive chat interfaces for AI agents — CLI TUI and web components, built on `@push.rocks/smartagent`.
## Architecture
- **`ts/`** — Core: `ChatSession` wraps `runAgent()` with in-memory conversation state
- **`ts_cli/`** — CLI TUI using ink (React for CLI) with `React.createElement` (no JSX/TSX — tsbuild doesn't support `jsx` tsconfig option)
- **`ts_web/`** — Web components using Lit (no decorators — tsbuild uses TC39 decorators which are incompatible with Lit's legacy decorators; use `static properties` and `customElements.define()` instead)
## Key Dependencies
- `@push.rocks/smartagent ^3.0.1` — agentic loop, `runAgent()`
- `@push.rocks/smartai ^2.0.0` — model providers, types (`LanguageModelV3`, `ModelMessage`, `ToolSet`)
- `ink ^6.8.0` — React-based terminal UI
- `ink-text-input ^6.0.0` — text input component for ink
- `lit ^3.2.0` — web component framework
- `react ^19.0.0` — React for ink
## Build Notes
- **No JSX/TSX**: tsbuild crashes with `jsx` in tsconfig.json. All React components use `React.createElement` (aliased as `h`).
- **No Lit decorators**: tsbuild uses TC39 standard decorators which are incompatible with Lit's `@property`/`@customElement`. Use `static properties` and `customElements.define()`.
- **No ink-spinner**: Dropped due to JSX.Element type incompatibility with React 19. Uses simple text characters instead.
- Types from AI SDK (`ModelMessage`, `ToolSet`) are imported through `@push.rocks/smartai` (which re-exports them from `ai`).
- `IAgentRunResult.usage` uses `inputTokens`/`outputTokens` (not `promptTokens`/`completionTokens`).
## Package Exports
- `.` → Core (`ChatSession`, interfaces)
- `./cli` → CLI TUI (`startChat()`)
- `./web` → Web components (`SmartchatWindow`, `SmartchatMessage`, `SmartchatInput`)