forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on mainFiltered to src/web/ai.rsClear filter

2026-09-17

✨ feat: the /rag nest — threads, answers with citations, and scope derived from the caller's instancesAhmet Kaan Gümüş · 39f97e4
✨ feat: the /rag nest — threads, answers with citations, and scope derived from the caller's instances

Merges lane/rag-nest. A separate nest and tables (rag_thread, rag_message)
over a new rag.chat capability: every answer is stored verbatim (abstained,
reason, citations resolved to the course-note file the asker may view), the
scope sent to the service is the caller's (sinif, ders) pairs, and the school's
existing AI caps and a new per-user tier govern it. course_note_file gains
rag_doc_id so a citation's corpus doc id finds its PDF.
✨ feat: add the /rag nest over the course-note RAG bridgeAhmet Kaan Gümüş · a61e0a6
✨ feat: add the /rag nest over the course-note RAG bridge

A separate rag_thread/rag_message pair of tables and a Module::Chatbot gated
/rag nest, mirroring the chatbot's asynchronous send: POST answers 202 with a
pending assistant row, an in-process task settles it, and both the poll read
and the SSE stream project a stale pending row as failed.

Every question is scoped server-side to the asker's own (sinif, ders) pairs —
class-section instances, a linked parent's children, school-wide club/study memberships
— never from the body. Each citation's corpus doc_id is resolved per candidate
to a course-note file the asker may view, and the two storage caps refuse an
over-bound reply whole rather than clipping it. rag.index replies now stamp
each file's rag_doc_id, the missing link between a citation and its file.

The chatbot's SSE helpers move to web/mod.rs so both nests stream through one
implementation, and the instance/course visibility gates move from web to
service so the scope deriver and the routes share one rule.

Gates: cargo check --all-targets, clippy -D warnings, limits_completeness,
spec_bounds, doc_sync (README regenerated), protected_routes_require_session
(MIN_PROTECTED 269 -> 318, the real swept count), ai_bridge (75 tests).
✨ feat: publish the rag.chat payloads and a GET /ai/capabilities probeAhmet Kaan Gümüş · 94cffa0
✨ feat: publish the rag.chat payloads and a GET /ai/capabilities probe

Add the rag.chat capability's wire contract (scoped question -> answer with
citations), the max-scope-pairs and rate-limit constants, and an authenticated
discovery route listing each capability's connected worker fleet. Document the
payloads and the rag.index reply's file<->doc_id echo in the README.

2026-09-05

✨ feat: AI bridge speaks hab/2; every frame names its schoolAhmet Kaan Gümüş · cedd07f
✨ feat: AI bridge speaks hab/2; every frame names its school

The shared AI fleet now serves every school: `Request`, `ApiRequest` and
`BlobRequest` carry `school`, responses echo it, api-reads and blob opens
resolve that school's database and files, and rag answers land in the same
school. New refusals `unknown_school` / `school_suspended`; hab/1 is rejected
at ALPN and at `Hello`.

2026-08-13

📝 feat: generate README endpoint table from the served OpenAPI specAhmet Kaan Gümüş · bf8046e
📝 feat: generate README endpoint table from the served OpenAPI spec

tests/doc_sync.rs renders the 275-row table from /api-docs/openapi.json
(auth floor from declared 403s, else the handler's Require* extractor,
asserting exactly one floor per operation), drift-gated in the suite;
UPDATE_DOCS=1 regenerates. Static rows are router-verified and plain
.route() registrations must reach the table or the suite fails.
Curated prose folded into handler doc comments; CLAUDE.md convention
updated (table generated; full suite = cargo nextest run).

2026-07-23

✨ feat(ai): QUIC bridge for out-of-process AI servicesAhmet Kaan Gümüş · dc49954
✨ feat(ai): QUIC bridge for out-of-process AI services

The AI features live in separate projects, so they need a transport. QUIC:
each request rides its own bidirectional stream on the service's single
long-lived connection, which puts multiplexing in the transport — no
correlation-id bookkeeping, no head-of-line blocking between concurrent
requests, one handshake instead of one per request.

The backend listens and the services dial in, so a service can sit behind
NAT, restart without the backend knowing its address, and scale out by
opening a second connection (each connection is an independent worker).

Protocol "hab/1", also the ALPN so an incompatible service is refused at the
TLS handshake rather than one frame later. Frames are length-prefixed JSON
(u32 big-endian) because the services will not be Rust; the length is checked
against an 8 MiB cap before any buffer is allocated. The control stream
carries Hello/Greeting and then stays open — its closure is the goodbye, so
there is no heartbeat frame, and a silent death is caught by the QUIC idle
timeout.

Routing is least-inflight rather than round-robin: AI request costs are
wildly uneven, and taking turns would pile a second long inference onto a
busy worker while an idle one sits next to it. Selection and the in-flight
increment happen under one lock so concurrent dispatches cannot overshoot a
worker's declared max_concurrent, which a Lease releases on drop.

Services authenticate with a shared token (constant-time compare); the
certificate only proves the backend, and is self-signed at boot unless a PEM
pair is configured. Since that regenerates per boot, GET /ai/certificate
publishes it (PEM + sha256) for a service to pin — public because a server
certificate is handed to every peer in the TLS handshake anyway, and 404 when
the bridge is off. A service must re-fetch on every reconnect, not once at
startup.

Off unless AI_QUIC_ADDR is set, so the API is unchanged for deployments
without AI. Set without AI_SHARED_TOKEN it refuses to boot rather than listen
unauthenticated.