Skip to content
  1. 59ddd69silen

    chore: release 0.1.5

  2. a233992silen

    Merge pull request 'Keep hero win queries from timing out on the full match history' (#7) from t3/fix-hero-winrate-504-timeout into main ## Why this was failing `lake.match_player_latest` is a view over `lake.match_player`: ```sql SELECT * FROM match_player QUALIFY row_number() OVER ( PARTITION BY match_id, account_id, start_time ORDER BY created_at DESC ) = 1 ``` The underlying table has 442,423,664 rows across 627 GB in 400 remote parquet files. Broad queries had to read every file, even with `LIMIT`, and the 30 s watchdog could not cancel the in-flight HTTPS reads. The request outlived the proxy timeout and returned HTTP 504. The system prompt was steering the model straight at that view. ## Changes - **Prompt**: explain that match data is huge, query `lake.match_player` with a recent `start_time` window, default to the last 24 hours for broad hero questions, and say which period was used. - **Query guard**: reject unbounded scans of `match_player` / `match_player_latest` before DuckDB fetches data. Metadata aggregates (`count(*)`, `min`, `max`) still work. - **Session**: set `preserve_insertion_order = false` so multi-day grouped queries fit inside the 1 GB cap. - **Answer budget**: cap one reply at 45 s. - **DuckDB wrapper**: a failed `TIMESTAMPTZ` conversion no longer crashes the server. - **Web UI**: show the result table immediately with the first 10 rows; SQL and the remaining rows stay behind an expander. `/sql` still shows its SQL and all rows. ## Testing - `zig build test` passes. - Hero query for the last 24 hours completes end-to-end in ~5 s. - Unbounded scans are rejected in under 1 s instead of hanging. - 7-day and 30-day windows complete in roughly 9 s and 15 s locally. All-time hero wins still require scanning hundreds of GB; the assistant now explains that and offers a recent window instead.

  3. 0120701silen

    Show result previews with SQL behind an expander Chat replies now show the result table immediately, with the first ten rows. SQL and any further rows stay behind a quiet expander so the answer remains readable but the data is visible.

  4. b572850silen

    Keep match-history queries inside the request budget The hero-win question timed out because the system prompt pointed the model at lake.match_player_latest, a windowed view over a 627 GB, 442M-row table. Even LIMIT had to read every file, and the watchdog cannot interrupt DuckDB's remote HTTP reads, so the proxy answered 504. Require a start_time or match_id filter for broad scans of match_player and match_player_latest, keep metadata aggregates like count(*) fast, turn off insertion-order buffering so multi-day aggregates fit in 1 GB, and cap each answer at 45 s. Also stop a failed TIMESTAMPTZ conversion from crashing the server.

  5. da8886asilen

    chore: release 0.1.4

  6. 844dd53silen

    Merge pull request 'Add Zig test coverage across config, auth, chat, HTTP and the LLM client' (#6) from t3/chat-non-technical-responses into main ## Summary - Add unit and socket-level tests for config parsing, auth/session/invite flows, the chat agent loop, the LLM client, HTTP routing/CSRF/cookies and session result handling. - Introduce testable seams: `config.loadFrom` takes an injected env map, and `chat.converse` takes a generic model and tool session so fakes replace the network and the live DuckLake catalog. - Fix a double-free in `Store.init` when `auth.json` fails to load. - Fix `/sql` with no statement falling through to the model; it now returns a usage error. - Document the one-click "See the data" link in the README and adjust the web UI and CSS to match. ## Testing - `zig build test` — 57/57 tests pass (~24s). - `zig fmt --check src/*.zig`. - Line coverage measured with a DWARF/GDB breakpoint harness: ~81% overall (1636/2010 executable lines), ~82% excluding lines inside `test` blocks. Per-file range runs from `chat.zig` at ~53% to `config.zig` at ~90%. - New tests cover corrupt `auth.json`, expired sessions and invites, unknown tools, blank SQL, SQL errors returned as tool results, the step limit, and real socket behaviour for the app server and LLM client. - Not run: live DuckLake queries (`Session.open`/extension install), successful `/sql` and `/tables` requests against the real catalog, and model-backed chat against a real provider. These paths are deliberately left to integration testing.

  7. 2fc3c22silen

    Cover config, HTTP routes, auth flows and the chat agent loop

  8. 311c4e4silen

    Keep SQL and result tables out of chat replies

  9. 7bd6f52silen

    chore: release 0.1.3

  10. 644f7fesilen

    Keep the query watchdog out of the request's thread lifecycle Each query used to spawn a short-lived thread and join it so the query could be interrupted after the timeout. When that pthread_join failed, Zig's std.Thread.join hit its unreachable and the panic aborted the whole server: thread 13 panic: reached unreachable code std/Thread.zig:803:17 in runQuery src/chat.zig:124:41 in answer A single query could therefore take the process down. Replace it with one long-lived supervisor thread: runQuery registers a stack-allocated deadline before it calls DuckDB and unregisters afterwards. The supervisor interrupts entries whose deadline passed, holds the registry mutex across interrupt() so a finished session cannot be touched, and never joins anything. Lazy start keeps main.zig unchanged, and a unit test covers the interrupt.

  11. e4f90a4silen

    chore: release 0.1.2

  12. abcc65asilen

    Merge pull request 'Statically link DuckDB and target baseline x86-64' (#5) from t3/fix-static-build-cert-crash into main ## Summary - Builds now default to `cpu_model = .baseline` instead of the native CPU, so `std` no longer emits AVX-512 instructions (the CA-certificate parser was crashing with `SIGILL` on older hosts). - DuckDB is linked from its vendored static archives (engine, `core_functions`, `json`, `parquet`, `icu`, httplib, loadable extensions) plus a vendored static `libstdc++`; only libc/libm stay dynamic so `ducklake` and `httpfs` can still be `dlopen`ed. - `scripts/fetch-duckdb.sh` now vendors the amd64/arm64 DuckDB archives and Debian's `libstdc++.a` with SHA-256 pins, staying idempotent and requiring nothing installed system-wide. - `src/duckdb.zig` registers the built-in extensions once per process before the first database opens, and adds a `res_init` shim for glibc. - The Dockerfile no longer ships `libduckdb.so` or runs `ldconfig`; README, deploy docs and `mise.toml` are updated to match. ## Testing - `zig build test` passes. - `ldd` on the release binary shows only `libm.so.6` and `libc.so.6`; the binary is a self-contained 83 MB executable. - Confirmed no `zmm`/AVX-512 instructions remain and `Certificate.parseTime` uses SSE2 instructions only. - End-to-end: `/up` returns 200, `/tables` works, and `SELECT count(*) FROM lake.leaderboard` returns `18385275`, both locally and in a freshly built Docker image. - Extension cache confirms runtime install still works for `ducklake` and `httpfs`.

  13. 517b58bsilen

    Statically link DuckDB and target baseline x86-64 - Vendor DuckDB static archives and libstdc++ with pinned checksums instead of libduckdb.so - Register built-in DuckDB extensions at startup and shim res_init for glibc - Default to baseline CPU to avoid SIGILL on older hosts, and update Docker and docs

  14. d13742bsilen

    chore: release 0.1.1

  15. 96f0baesilen

    Merge pull request 'Add web login, admin invites and invite-only signup' (#4) from t3/env-login-admin-invite-signup into main ## Summary - Adds environment-driven admin login (`ADMIN_USERNAME`, `ADMIN_PASSWORD`); when unset, the site stays open as before. - Lets admins create single-use 1/7/30-day invite links (`/signup?invite=…`) and revoke unused ones. - Adds invite-only signup with username/password validation and automatic sign-in. - Persists users and hashed invites to `auth.json` (mode `0600`); passwords use PBKDF2-HMAC-SHA256 with a random salt and invite codes are stored only as SHA-256 hashes. - Keeps sessions in memory behind an `HttpOnly`, `SameSite=Lax` cookie and gates `/api/chat` when auth is enabled; state-changing requests reject cross-site origins. - Adds `SESSION_TTL_HOURS`, `INVITE_TTL_HOURS` and `COOKIE_SECURE` settings. - Removes Discord entirely: `src/discord.zig`, `src/gateway.zig`, the registration script, the `/discord/interactions` route, `DISCORD_*` env vars and related docs/mise tasks. - Updates the web UI with login, signup and invite dialog views, and refreshes `README.md` and `docs/DEPLOY.md`. ## Testing - `zig fmt --check src` - `zig build test` - `zig build` - `node --check src/web/app.js` - `zig build test` covers admin login, invite redemption, single-use enforcement, case-insensitive username uniqueness, session resolution/expiry and persistence across restart. - Manual smoke tests: admin login, invite creation, signup, user login persistence across restart, used-invite rejection, non-admin 403, logged-out chat 401, cross-site POST 403, `/discord/interactions` → 404, and open mode without `ADMIN_PASSWORD`. - Verified the server starts without inference keys and still serves `/sql`.

  16. e80acaasilen

    Add web login, admin invites and invite-only signup - Admin signs in with ADMIN_USERNAME/ADMIN_PASSWORD; sessions use random HttpOnly, SameSite=Lax cookies and are rejected for cross-site state-changing requests. - Admins create single-use, expiring invites shareable as /signup?invite=... links; recipients pick a username and password and are signed in. - Persist accounts and SHA-256 hashed invite codes in storage/auth.json; store passwords as PBKDF2-HMAC-SHA256 hashes with per-user salts. - Remove the Discord bot, gateway connection and command registration script.

  17. 2f80645silen

    Merge pull request 'docs: add README describing the repository' (#1) from t3/make-a-pr into main Adds a short README covering the repository layout (`.twig.toml` Twig config) and a placeholder for development instructions. No code changes.

  18. 5b5af1esilen

    Merge origin/main into t3/make-a-pr # Conflicts: # README.md

  19. f49429esilen

    Merge pull request 'Add build.zig.zon and ino deploy labels to Docker image' (#3) from t3/support-ino-project-manifest into main ## Summary - Add `build.zig.zon` (name `totenschloss`, version `0.1.0`, fingerprint, Zig `0.14.1`) so `ino` can detect the project manifest. - Copy `build.zig.zon` alongside `build.zig` in the Docker build stage. - Add `remote`, `ino.deploy.server`, and `ino.deploy.host` labels to the runtime image so releases push and deploy through Ino. - Keeps secrets (`INO_API_KEY`, `INFERENCE_API_KEY`, `DISCORD_*`) out of the image; they stay in the release/Once environment. ## Testing - `docker build -t totenschloss:latest .` completed successfully. - Ran the image locally and probed `GET /up` — returned `ok`. - Verified `docker inspect` labels: `remote=silenloc/totenschloss`, `ino.deploy.server`, `ino.deploy.host`. - Confirmed `ino new` reports `semver: 0.1.0` and `ino exec` injects `INO_VERSION`. - Full deploy through Ino not run (requires registry login, DNS, and `ino once remote create`).

  20. ea1d6dbsilen

    Add build.zig.zon and ino deploy labels to Docker image - Include build.zig.zon in the Docker build context and Zig package manifest - Label the runtime image with remote and ino.deploy server/host metadata

  21. fd23a8asilen

    Merge pull request 'Add Totenschloss chat server and Discord bot over the Deadlock data lake' (#2) from t3/deadlock-duckdb-chat-app into main ## Summary - Adds a Zig HTTP server (`src/server.zig`, `src/main.zig`) that serves an embedded vanilla JS/CSS chat UI from a single binary. - Chat agent (`src/chat.zig`) answers in plain language using two tools, `describe_tables` and `run_sql`, backed by an Anthropic-format model client (`src/llm.zig`) for Divine or the Anthropic API. - Each request opens a private in-memory DuckDB (`src/duckdb.zig`, `src/session.zig`) attached read-only to the Deadlock DuckLake catalog over HTTPS, with a 1 GB memory cap, 30 s query timeout, and 4 concurrent chats. - SQL is never built from user text; every query passes an AST parser check, a lake-only table rule, table-function and scalar-function denials, a statement-kind check, and a locked-down read-only session (`src/sql_guard.zig`). - Adds Discord support (`src/discord.zig`, `src/gateway.zig`): signed `/discord/interactions` for the `/ask` slash command, plus a Gateway connection for `@`-mentions and DMs, with reconnect backoff and a stop on fatal close codes. - Adds once/Docker packaging: port 80, `GET /up` health check, `/storage` volume, `docs/DEPLOY.md`, `mise` tasks, and a DuckDB library fetch script. ## Testing - `mise run test` — 10 unit tests pass, covering the SQL guard, mention stripping and detection, Discord content clipping, signature rejection, and fatal close codes. - `zig fmt --check build.zig src/` — clean. - Local smoke test: server boots with DuckDB 2.0.0 and `GET /up` returns `ok` on port 8080. - Discord Gateway handshake checked against the real service with an invalid token: TLS, WebSocket upgrade, hello, and identify all succeed, and Discord replies with close code 4004 (authentication failed), which the client treats as fatal. - Not run: end-to-end model answers and live Discord replies, which need a valid bot token and (for `/ask`) a public HTTPS interactions URL.

  22. 28add5bsilen

    Add Totenschloss chat server over the Deadlock data lake - Serve a Zig HTTP server with an embedded vanilla JS/CSS chat UI - Answer questions via a tool-using LLM agent that runs read-only DuckDB queries - Guard queries with an AST check, lake-only tables, and session lockdown - Add Discord /ask and mention replies, Docker image, and mise build tasks

  23. 84a8307silen

    docs: add README describing the repository

  24. 663b723silen

    Initial commit