Pass 3 of 3 · Deep dive of PHAROSPass 1 · OverviewPass 2 · How it works
Code Observatory / module
edge_server
codeintel.edge_server
PINNED SOURCE Source and edges from the index at this commit. An execution appears only where one was recorded.
PHAROS at 975a38dMIT license
Around this symbol
Search all symbolsLoading
| Symbol | File | Resolved by |
|---|---|---|
| _Bucket | edge_server.py | same file |
| main | edge_server.py | same file |
| make_handler | edge_server.py | same file |
| Symbol | File | Resolved by |
|---|---|---|
| embeddings | embeddings.py | through an import |
codeintel.edge_serverbackend/app/codeintel/edge_server.py, lines 1–40Open source
"""Query-embedding server for the owner's machine (the "edge").The free production instance (512 MB) can embed queries itself, but withgranite-embedding-english-r2 that costs ~200 MB of its memory. With``EMBEDDING_BACKEND=edge-onnx`` it asks this server first and loads its owncopy of the model only while the edge is unreachable (see ``EdgeFirstEmbedder``). python -m app.codeintel.edge_server # 127.0.0.1:8790, model from EMBEDDING_ONNX_DIRBinds loopback only; publish it with ``tailscale funnel`` (seebackend/deployment/mac/). Every request but ``GET /health`` needs``Authorization: Bearer $EDGE_EMBED_TOKEN`` (constant-time compare). Inputs arebounded (texts per request, characters per text, body size) and rate-limited,so a leaked URL cannot be used for bulk embedding. Texts are embedded exactlyas given (``encode_raw``): the client adds the model's query prefix. Nothingis logged but counts.``POST /embed/batch`` ``{"texts": [...]}`` -> ``{"model_id": ..., "embeddings": [...]}``"""from __future__ import annotationsimport hmacimport jsonimport loggingimport osimport threadingimport timefrom http.server import BaseHTTPRequestHandler, ThreadingHTTPServerfrom .embeddings import Embedder, OnnxEmbedderlogger = logging.getLogger(__name__)MAX_TEXTS = 16MAX_TEXT_CHARS = 4000MAX_BODY_BYTES = 128 * 1024RATE_PER_SECOND = 10.0BURST = 30Shows the first 40 of 124 lines. The rest is on GitHub at this commit.
What the index recorded
- Signature
module backend.app.codeintel.edge_server- File
backend/app/codeintel/edge_server.py- Lines
- 1–124
- Parser
- python-ast
- Git blob
909dfc0fcf1334828a534248afdadb1c50262110- Call sites
- 3 named, 0 resolved, 3 left unlinked
- Outside this subset
- 1 more edges reach code outside the graph shown here
