Web application for browsing THINKT projects and sessions. Connects to the THINKT API server (Go) and is designed to be embedded by thinkt serve.
npm install
npm run dev # starts on http://localhost:7434, proxies /api to :8784The dev server expects the Go API server (thinkt serve) running on port 8784.
| Command | Description |
|---|---|
npm run dev |
Dev server with HMR (port 7434) |
npm run build |
Lint + typecheck + production build |
npm run build:fast |
Typecheck + production build (skip lint) |
npm run preview |
Preview production build (port 7435) |
npm run test |
Run tests in watch mode |
npm run test:run |
Run tests once |
npm run typecheck |
TypeScript type checking |
npm run lint |
ESLint |
npm run i18n:extract |
Extract translatable messages |
npm run i18n:compile |
Compile locale catalogs |
npm run i18n |
Extract + compile |
@wethinkt/ts-thinkt (../ts-thinkt) <- core library (types, parsers, API client)
\- thinkt-web (this project) <- web UI that consumes the library
src/
|- main.ts # App bootstrap, overlays, keyboard shortcuts
|- config.ts # API URL/auth/deep-link target resolution
|- styles.css # Global layout/theme styles
|- i18n.ts # Locale bootstrap + persistence
|- components/
| \- LanguageSelector.ts # Global language picker
\- api/
|- index.ts # Re-exports from ts-thinkt + local UI components
\- components/
|- ApiViewer.ts # Top-level orchestrator
|- ProjectBrowser.ts # Project list/search
|- SessionList.ts # Session list for selected project
|- ConversationView.ts # Session entry viewer
|- SearchOverlay.ts # Global search modal (text/semantic)
|- SettingsOverlay.ts # Settings/info modal (dashboard/indexer/sources/apps/auth)
\- *-styles.css # Overlay/component-scoped styles
Types and clients come from @wethinkt/ts-thinkt/api:
ThinktClient(high-level, camelCase domain types) is used by the UI.ThinktApiClient(low-level, snake_case OpenAPI types) is available for advanced/raw access.
The top-bar gear button opens SettingsOverlay. Tabs are:
Dashboard: API connection card + server info card (server host/port, fingerprint, version/revision, started time, uptime, pid, auth enabled).Indexer: split intoIndexer StatusandEmbedding Status, with separate progress bars.Sources: source list with per-source badge colors and status.Apps: open-in app configuration and default terminal.Auth: current token display (redacted by default), show/hide toggle, save/clear controls.
Behavior details:
- Data refreshes when the overlay opens.
Indexertab auto-refreshes every 5s.- Auto-refresh and listeners are cleaned up on close using
AbortController. - Close controls use an
xicon button with tooltipClose - ESC.
config.ts resolves runtime URL parameters with explicit precedence.
api-url is resolved once at startup in this order:
- Query parameter:
?api-url=http://host:port - Global variable:
window.THINKT_API_URL - Meta tag:
<meta name="thinkt-api-url" content="..."> - Build-time env:
VITE_API_URL - Same origin (
window.location.origin) - Fallback:
http://localhost:8784
Validation behavior:
api-urlmust be an absolute URL parseable bynew URL(...).- Invalid
api-urlis ignored and resolution continues to the next source. - Query params are checked only for
api-url; hash is not used for API base URL.
token is read at startup with this precedence:
- URL fragment (hash):
#token=... - Query parameter fallback:
?token=...
Hash is preferred because fragments are not sent to the server in HTTP requests.
The app can open a target session at startup. Params are read per-key from hash first, then query.
Parameter reference:
| Purpose | Primary key | Aliases | Required | Notes |
|---|---|---|---|---|
| Session path | session_path |
path, session |
Yes (for deep-link) | First non-empty value wins |
| Session id | session_id |
- | No | Used to select/highlight in session list |
| Project name | project_name |
project |
No | Used if project_id is not provided |
| Project id | project_id |
- | No | Preferred project selector |
| Entry line | line_num |
line |
No | Must parse as positive integer (> 0) |
Normalization and parsing:
- Values are trimmed; empty values are treated as missing.
line_num/lineis parsed as base-10 int; invalid/zero/negative values are ignored.- If no session path exists after alias resolution, deep-link loading is skipped.
Deep-link load flow (main.ts):
- If
project_idexists, try selecting by ID. - Else if
project_nameexists, try selecting by exact name. - If project not found, refresh projects once and retry.
- Load session by
session_path. - If
session_idexists, select that session in the list. - If
line_num/lineexists, scroll approximately to entry indexline - 1.
Failure behavior:
- Missing/invalid optional params are ignored.
- Deep-link errors are logged and do not crash app initialization.
Examples:
/#session_path=/abs/path/to/session.jsonl/#session_path=/abs/path/to/session.jsonl&project_id=abc123&session_id=s1&line_num=42/?api-url=http://localhost:8784#token=thinkt_20260227_example&session=/abs/path/to/session.jsonl/?session_path=/a.jsonl#session_path=/b.jsonl(hash wins, so/b.jsonlis used)/#session_path=%2FUsers%2Falice%2FMy%20Sessions%2Fs1.jsonl(URL-encoded path)
- For deep-link keys and
token, hash takes precedence over query. - For
api-url, query and non-URL config sources are used; hash is ignored. - Settings Auth tab updates only
#tokenand preserves other hash keys when possible.
Token sources used by the UI:
- Explicit client config token
- URL hash token (
#token) - URL query token (
?token)
Auth tab behavior:
Current Tokenis redacted by default.- Redaction format for thinkt tokens:
thinkt_YYYYMMDD_....LAST4. - Non-thinkt token redaction:
first4....last4. Show/Hidetoggles visibility.Save Tokenupdates the client config token and URL hash.Clear Tokenremoves token from client config and URL hash.
Dev caveat:
npm run devinjectsTHINKT_API_TOKENin the Vite proxy process.- In that mode, the browser app may not have the raw token value to display.
- Auth tab will show
Set (injected)when server auth is enabled but no browser-visible token exists.
When UI text changes:
- Use
i18n._(...)for user-facing strings. - Run
npm run i18nto extract and compile catalogs. - Commit updated locale files under
src/locales/.
@wethinkt/ts-thinkt(file:../ts-thinkt) - API client, types, parsers, analysis utilitiesvite- build toolingvitest- test runner@lingui/*- i18n extraction/compilation/runtime