Skip to content

Turbocharge Claude Code, Cursor, Codex, Gemini & every coding agent: faster, cheaper, with contextual understanding specific to your codebase.

Initial commit: Context Graph Engine

anirudhkumar-nanonets33e6d6bcba70
diff --git a/.env.example b/.env.example
new file mode 100644
index 00000000..6e71456d
--- /dev/null
+++ b/.env.example
@@ -0,0 +1,31 @@
+# Context Graph Engine configuration
+#
+# The engine runs FULLY LOCALLY by default — no keys required:
+# • Embeddings run in-process (transformers.js), model cached on first use.
+# • Extraction uses a local Ollama model (install: https://ollama.com).
+# Set the cloud keys below only if you want higher-quality cloud models; they
+# are picked up automatically when present.
+
+# --- Cloud (optional) ---------------------------------------------------------
+# Entity/relationship extraction on Claude (Anthropic).
+# ANTHROPIC_API_KEY=sk-ant-...
+# Optional: override the extraction model (default: claude-haiku-4-5-20251001)
+# CONTEXT_GRAPH_EXTRACTION_MODEL=claude-haiku-4-5-20251001
+
+# Embeddings on OpenAI (Anthropic has no embeddings endpoint).
+# OPENAI_API_KEY=sk-...
+# Optional: override the embedding model (default: text-embedding-3-small)
+# CONTEXT_GRAPH_EMBEDDING_MODEL=text-embedding-3-small
+
+# --- Local (defaults; used when the keys above are absent) --------------------
+# Force local even when cloud keys are set.
+# CONTEXT_GRAPH_LOCAL=1
+# In-process embedding model (default: Xenova/all-MiniLM-L6-v2)
+# CONTEXT_GRAPH_LOCAL_EMBEDDING_MODEL=Xenova/all-MiniLM-L6-v2
+# Local extraction via Ollama (default model: llama3.2)
+# CONTEXT_GRAPH_OLLAMA_MODEL=llama3.2
+# CONTEXT_GRAPH_OLLAMA_URL=http://localhost:11434
+
+# --- Storage ------------------------------------------------------------------
+# Where the graph database lives (default: ./.context-graph/graph.db)
+# CONTEXT_GRAPH_DB=./.context-graph/graph.db
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 00000000..c8bba29a
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,16 @@
+node_modules/
+dist/
+*.log
+
+# Local graph databases
+*.db
+*.db-shm
+*.db-wal
+.context-graph/
+
+# Env
+.env
+.env.local
+
+# OS
+.DS_Store
diff --git a/DEMO.md b/DEMO.md
new file mode 100644
index 00000000..ef1727f0
--- /dev/null
+++ b/DEMO.md
@@ -0,0 +1,139 @@
+# Context Graph Engine — Demo Guide
+
+> Read this to understand what's been built and to run a clean demo today.
+
+---
+
+## 1. What this is, in one sentence
+
+An **open-source library** that turns any pile of docs into a **structured context graph** — entities + typed relationships grounded in the source text — that AI agents **read from before doing work** and **write learnings back into**, so the shared knowledge compounds over time.
+
+Think "durable, structured memory for a team of agents" — the same integration shape as ByteRover, but self-hosted, embedded, and runnable with a single `curl`.
+
+---
+
+## 2. What's been built (status)
+
+| Piece | What it does | Status |
+|-------|--------------|--------|
+| **Core engine** (`src/engine.ts`) | `ingest` → `read` → `contribute` over a graph | ✅ Done |
+| **Knowledge graph model** (`src/graph/`) | Nodes (entities), edges (typed relations), chunks (evidence), each with `confidence` + `observation` counts | ✅ Done |
+| **Dedup + reinforcement** (`src/graph/merge.ts`) | New knowledge is matched to existing nodes by name/alias **and** embedding similarity; matches are merged & reinforced, not duplicated | ✅ Done |
+| **Retrieval** (`src/retrieval/`) | Semantic match on entities → one-hop graph expansion → supporting passages → a ready-to-inject prompt block | ✅ Done |
+| **Storage** (`src/graph/sqlite-store.ts`) | Embedded SQLite (`better-sqlite3`), zero infra; swappable behind a `GraphStore` interface | ✅ Done |
+| **Local-first providers** (`src/ai/local.ts`) | In-process embeddings (transformers.js) + local extraction (Ollama) — **runs with no API keys** | ✅ Done |
+| **Cloud auto-upgrade** (`src/engine.ts`) | If `ANTHROPIC_API_KEY` / `OPENAI_API_KEY` are set, uses Claude + OpenAI automatically for higher quality | ✅ Done |
+| **Three access modes** | Library, `context-graph` CLI, and `context-graph-mcp` MCP server for any agent | ✅ Done |
+| **One-line installer** (`install.sh`) | `curl … | sh` clones, builds, and puts both commands on PATH | ✅ Done |
+| Update modes (silent vs. flagged) | Deferred per your call — needs discussion | ⏸ Deferred |
+| Delete / decay of stale nodes | In the spec, not yet built | ⬜ Not started |
+
+**The whole codebase is commented** — every module has a doc comment explaining its role, and the non-obvious logic (dedup matching, reinforcement, chunk overlap, one-hop expansion) is annotated inline.
+
+---
+
+## 3. ⚠️ Before you demo: pick a provider
+
+The engine needs a model for **extraction** (pulling entities/relationships out of text). Embeddings run locally with no setup, but extraction needs one of:
+
+**Right now this machine has neither Ollama nor any API key set**, so pick one path first:
+
+### Path A — Cloud (fastest to a clean demo, best quality) ✅ recommended for a live demo
+```bash
+export ANTHROPIC_API_KEY=sk-ant-... # extraction via Claude
+export OPENAI_API_KEY=sk-... # embeddings via OpenAI (optional; local otherwise)
+```
+Reliable, fast, produces the richest graph. Best if you want the demo to look sharp.
+
+### Path B — Fully local (the "no keys" story your manager asked for)
+```bash
+# install Ollama from https://ollama.com, then:
+ollama pull llama3.2
+```
+No accounts, nothing leaves the machine. Slightly coarser graph and a one-time model download — this is the story to *tell*, but Path A is smoother to *show* live if you're short on time.
+
+> Tip: you can do both — run the demo on cloud for polish, then flip `CONTEXT_GRAPH_LOCAL=1` and re-run one command to prove it also works with zero keys.
+
+---
+
+## 4. The demo (60 seconds)
+
+The cleanest thing to show is the **library quickstart** — it's self-contained, uses an in-memory graph (leaves nothing behind), and tells the whole story in one run:
+
+```bash
+npm install
+npm run example
+```
+
+It walks through, live:
+1. **Ingest** a small "Payments Platform" doc → builds a graph of services and how they relate.
+2. **Read** `"what happens when a charge fails?"` → prints a structured context block (entities + relationships + sources) ready to drop into an agent prompt.
+3. **Contribute** a new learning (`"the Dunning Worker sends a Slack alert to #billing…"`) as if an agent discovered it mid-task.
+4. **Read again** → the new knowledge is now part of the graph.
+
+**The money moment:** step 3 doesn't just append text — the learning is extracted, deduped against existing entities, and merged. Re-observed facts get their `confidence` and `observation` count bumped instead of creating duplicates. That's the "gets smarter over time" claim, demonstrated.
+
+### CLI version (if you'd rather show the shell)
+```bash
+npm run build
+
+echo "Our billing worker retries failed charges 3x, then marks the subscription past_due." \
+ | node dist/cli.js --db ./demo.db ingest-text --title "Billing"
+
+node dist/cli.js --db ./demo.db query "how are failed charges handled?"
+
+node dist/cli.js --db ./demo.db contribute \
+ "After the final retry the billing worker posts a Slack alert to #billing." --agent oncall
+
+node dist/cli.js --db ./demo.db query "how does the team find out about failed charges?"
+
+node dist/cli.js --db ./demo.db stats
+```
+(Delete `demo.db*` afterward to reset.)
+
+### MCP version (if the audience cares about agent integration)
+Point Claude Code / Cursor at the server and the agent gets four tools — `context_read`, `context_contribute`, `context_ingest`, `context_stats`. The pitch: **read context → do the task → contribute what you learned**, on a shared team graph. Config is in the README.
+
+---
+
+## 5. Talking points (what to say while it runs)
+
+- **"It's a graph, not a bag of chunks."** A vector store gives you similar snippets. This gives an agent *structure* it can reason over — what things are, and how they connect — plus the source passages as evidence.
+- **"Agents write back."** Most RAG is read-only. Here an agent contributes a learning and it's merged into shared knowledge with provenance, so the next agent benefits.
+- **"It compounds."** Confidence + observation counts mean the tenth confirmation of a fact strengthens it; one-off noise stays low-confidence. The graph curates itself.
+- **"Zero infrastructure, one command."** Embedded SQLite, in-process embeddings, `curl | sh`. No database to stand up, no keys required to start. Cloud is an *upgrade*, not a requirement.
+- **"TypeScript & MCP-native."** Most comparable OSS (Graphiti, GraphRAG, Cognee, mem0) is Python and/or server/cloud-oriented. This slots directly into a JS/TS agent stack and speaks MCP out of the box.
+
+---
+
+## 6. One loose end before publishing
+
+`install.sh` and the README's `curl` command still contain a placeholder repo URL:
+
+```
+https://github.com/YOUR_ORG/context-graph-engine.git
+```
+
+Once this is pushed to GitHub, replace `YOUR_ORG/context-graph-engine` in **`install.sh`** and **`README.md`** (the local branch is `master`; the installer/README reference `main` — align those too). After that the one-line install is live. Not needed for today's demo — the library/CLI/MCP paths all run straight from the repo.
+
+---
+
+## 7. Where to look in the code
+
+```
+src/
+ engine.ts ← start here: ingest / read / contribute, provider selection
+ ai/
+ providers.ts ← config resolution (constructor → env → defaults) + interfaces
+ local.ts ← key-free LocalEmbedder + OllamaExtractor
+ anthropic.ts ← Claude extraction (tool-calling)
+ openai.ts ← OpenAI embeddings
+ graph/
+ types.ts ← the data model (nodes, edges, chunks) — read this to grok the domain
+ merge.ts ← dedup + reinforcement (the "gets smarter" logic)
+ sqlite-store.ts ← the embedded storage backend
+ retrieval/retriever.ts ← semantic match + one-hop expansion + prompt rendering
+ cli.ts ← the CLI
+ mcp.ts ← the MCP server
+examples/quickstart.ts ← the demo script from §4
+```
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 00000000..09273d28
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2026 Context Graph Engine contributors
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/README.md b/README.md
new file mode 100644
index 00000000..0729d217
--- /dev/null
+++ b/README.md
@@ -0,0 +1,245 @@
+# Context Graph Engine
+
+> Turn any docs into a structured **context graph** that AI agents read from before doing work — and contribute their learnings back to, so the graph gets smarter every time it's used.
+
+Dumping docs into a vector store gives you a bag of chunks. It doesn't give you *structure* an agent can reason over, and there's no clean way for an agent to send back what it learned mid-task. The Context Graph Engine fixes both:
+
+- **Ingest** any docs → a graph of **entities** (concepts, systems, people, APIs…) connected by typed **relationships**, grounded in the original source passages.
+- **Read** the graph before a task → get a compact, structured context bundle (entities + relationships + supporting sources), ready to drop into a prompt.
+- **Contribute** learnings back → new facts are deduplicated and merged into existing knowledge; repeated observations **reinforce** confidence. The graph compounds over time.
+
+Access it three ways: as a **library**, a **CLI**, or an **MCP server** that any agent (Claude Code, Cursor, …) can plug into.
+
+---
+
+## Install
+
+**One line, runs locally, no API keys required:**
+
+```bash
+curl -fsSL https://raw.githubusercontent.com/YOUR_ORG/context-graph-engine/main/install.sh | sh
+```
+
+This puts `context-graph` and `context-graph-mcp` on your PATH. Requires git and Node ≥ 20.
+
+Or as a library / dev dependency:
+
+```bash
+npm install context-graph-engine
+```
+
+### Runs locally by default — keys are optional
+
+Out of the box the engine needs **no accounts and no cloud calls**:
+
+- **Embeddings** run **in-process** via a small ONNX model (transformers.js) — downloaded and cached on first use.
+- **Extraction** uses a local **[Ollama](https://ollama.com)** model. Install Ollama and pull one:
+ ```bash
+ ollama pull llama3.2
+ ```
+
+Want higher-quality cloud models instead? Set either key and the engine uses it **automatically** (local remains the fallback):
+
+```bash
+export ANTHROPIC_API_KEY=sk-ant-... # cloud extraction (Claude)
+export OPENAI_API_KEY=sk-... # cloud embeddings (OpenAI)
+```
+
+Force local even when keys are present with `CONTEXT_GRAPH_LOCAL=1`.
+
+---
+
+## Quickstart (library)
+
+```ts
+import { ContextGraphEngine } from "context-graph-engine";
+
+const engine = new ContextGraphEngine(); // persists to ./.context-graph/graph.db
+
+// 1. Ingest docs — builds the graph.
+await engine.ingest(myMarkdownDocs, { title: "Onboarding" });
+await engine.ingestFile("./docs/architecture.md");
+
+// 2. Read before doing work.
+const ctx = await engine.read("how does authentication work?");
+console.log(ctx.prompt); // inject this string into your agent
+console.log(ctx.nodes); // structured entities
+console.log(ctx.edges); // structured relationships
+
+// 3. Contribute what an agent learned.
+await engine.contribute(
+ "The auth service rotates tokens every 15 minutes.",
+ { agentId: "code-reviewer" },
+);
+```
+
+Run the full working demo (needs both keys):
+
+```bash
+npm run example
+```
+
+---
+
+## CLI
+
+```bash
+# Ingest documents
+context-graph ingest ./docs/*.md
+echo "some notes" | context-graph ingest-text --title "Notes"
+
+# Read the graph
+context-graph query "how does billing retry failed charges?"
+context-graph query "billing" --json # full structured bundle
+
+# Contribute a learning
+context-graph contribute "Dunning worker retries 3x then marks past_due" --agent me
+
+# Inspect
+context-graph stats
+
+# Point at a specific graph file
+context-graph --db ./team-graph.db query "auth"
+```
+
+---
+
+## MCP server
+
+Expose the graph to any MCP client so agents can `context_read` and `context_contribute` directly — the same "shared skill / durable memory" model as tools like ByteRover.
+
+Add to your Claude Code / MCP client config:
+
+```json
+{
+ "mcpServers": {
+ "context-graph": {
+ "command": "context-graph-mcp",
+ "env": {
+ "CONTEXT_GRAPH_DB": "/absolute/path/to/team-graph.db"
+ }
+ }
+ }
+}
+```
+
+The API-key env vars are optional — add `ANTHROPIC_API_KEY` / `OPENAI_API_KEY` only if you want cloud models instead of the local defaults.
+
+Tools exposed:
+
+| Tool | What it does |
+|------|--------------|
+| `context_read` | Read relevant context for a query before working |
+| `context_contribute` | Write a learning back into the shared graph |
+| `context_ingest` | Ingest a document into the graph |
+| `context_stats` | Report how much the graph currently holds |
+
+A natural agent workflow: **read context → do the task → contribute what you learned.**
+
+---
+
+## How the graph gets smarter over time
+
+Every entity and relationship carries a `confidence` score and an `observations` count.
+
+- **Dedup on write.** When new knowledge comes in, each entity is matched against existing nodes by exact name/alias **and** embedding similarity (cosine ≥ `mergeThreshold`). A match is *merged*, not duplicated.
+- **Reinforcement.** Each re-observation increments `observations` and nudges `confidence` toward 1.0. Facts seen across many docs/agents rise to the top; one-off mentions stay low-confidence.
+- **Provenance.** Every node/edge tracks which documents and agents contributed to it.
+- **Grounding.** Source passages are kept as retrievable evidence and returned alongside the structured graph.
+
+This is what makes contributions compound: the tenth agent to confirm a fact strengthens it rather than cluttering the graph.
+
+---
+
+## How it works
+
+```
+ ingest / contribute read
+ ┌──────────────────────────┐ ┌────────────────────────┐
+ │ text → chunk → embed │ │ query → embed │
+ │ → extract (Claude) │ │ → semantic match nodes │
+ │ → MERGE (dedup + │───────────▶│ → expand 1 hop (edges) │
+ │ reinforce) │ graph │ → gather source chunks │
+ └──────────────────────────┘ (SQLite) │ → render context bundle│
+ └────────────────────────┘
+```
+
+- **Storage** — SQLite (via `better-sqlite3`) by default; swap in your own `GraphStore`.
+- **Extraction** — local **Ollama** (`llama3.2` by default) using structured JSON output; automatically upgrades to **Claude** (`claude-haiku-4-5`) if `ANTHROPIC_API_KEY` is set.
+- **Embeddings** — local **in-process** model (`Xenova/all-MiniLM-L6-v2`, 384-dim) by default; automatically upgrades to **OpenAI** (`text-embedding-3-small`) if `OPENAI_API_KEY` is set.
+- **Retrieval** — semantic match over entities + one-hop graph expansion + supporting source passages.
+
+> Note: embeddings from different models aren't comparable, so pick local **or** cloud for a given database and stick with it — don't switch providers mid-graph.
+
+---
+
+## Configuration
+
+Everything is configurable via constructor options, environment variables, or defaults (in that order):
+
+```ts
+new ContextGraphEngine({
+ dbPath: "./.context-graph/graph.db", // CONTEXT_GRAPH_DB
+ // Cloud (used automatically when set):
+ anthropicApiKey: process.env.ANTHROPIC_API_KEY,
+ openaiApiKey: process.env.OPENAI_API_KEY,
+ extractionModel: "claude-haiku-4-5-20251001", // CONTEXT_GRAPH_EXTRACTION_MODEL
+ embeddingModel: "text-embedding-3-small", // CONTEXT_GRAPH_EMBEDDING_MODEL
+ // Local (the zero-key fallback):
+ forceLocal: false, // CONTEXT_GRAPH_LOCAL=1 forces local
+ localEmbeddingModel: "Xenova/all-MiniLM-L6-v2",// CONTEXT_GRAPH_LOCAL_EMBEDDING_MODEL
+ ollamaModel: "llama3.2", // CONTEXT_GRAPH_OLLAMA_MODEL
+ ollamaBaseUrl: "http://localhost:11434", // CONTEXT_GRAPH_OLLAMA_URL
+ chunkSize: 1200,
+ chunkOverlap: 200,
+ mergeThreshold: 0.86, // higher = stricter dedup
+});
+```
+
+### Bring your own components
+
+The engine depends only on small interfaces, so you can replace any piece:
+
+```ts
+import { ContextGraphEngine, type Embedder, type Extractor, type GraphStore } from "context-graph-engine";
+
+new ContextGraphEngine({
+ store: myCustomStore, // e.g. Postgres/pgvector
+ embedder: myCustomEmbedder, // any embedding model
+ extractor: myCustomExtractor // any LLM, or a rules-based extractor
+});
+```
+
+This is exactly how the test suite runs the whole pipeline offline with fake providers.
+
+---
+
+## API reference (essentials)
+
+```ts
+class ContextGraphEngine {
+ ingest(text: string, opts?: { title?; source? }): Promise<IngestResult>;
+ ingestFile(path: string, opts?): Promise<IngestResult>;
+ read(query: string, opts?: { maxNodes?; maxChunks?; expand? }): Promise<ContextBundle>;
+ contribute(learning: string, opts?: { agentId?; source? }): Promise<ContributeResult>;
+ stats(): GraphStats;
+ close(): void;
+}
+```
+
+A `ContextBundle` contains `{ query, nodes, edges, chunks, prompt }` — use `prompt` for a ready-made context block, or the structured arrays to build your own.
+
+---
+
+## Development
+
+```bash
+npm install
+npm run build # compile to dist/
+npm run cli -- stats # run the CLI from source
+npm run mcp # run the MCP server from source
+```
+
+## License
+
+MIT
diff --git a/examples/quickstart.ts b/examples/quickstart.ts
new file mode 100644
index 00000000..74608c2c
--- /dev/null
+++ b/examples/quickstart.ts
@@ -0,0 +1,55 @@
+/**
+ * Quickstart — run with real Claude + OpenAI keys:
+ *
+ * export ANTHROPIC_API_KEY=sk-ant-...
+ * export OPENAI_API_KEY=sk-...
+ * npm run example
+ *
+ * Uses an in-memory graph so it leaves nothing behind.
+ */
+import "dotenv/config";
+import { ContextGraphEngine } from "../src/index.js";
+
+const DOCS = `
+# Payments Platform
+
+The Billing Service charges customers monthly. It calls the Payments Gateway,
+which integrates with Stripe. Failed charges are retried by the Dunning Worker
+up to three times before the subscription is marked past_due.
+
+Invoices are generated by the Invoicing Service and stored in Postgres. The
+Billing Service reads customer plans from the Catalog Service.
+`;
+
+async function main() {
+ const engine = new ContextGraphEngine({ dbPath: ":memory:" });
+
+ console.log("Ingesting docs…");
+ const ing = await engine.ingest(DOCS, { title: "Payments Platform" });
+ console.log(
+ ` ${ing.chunks} chunks -> +${ing.nodesCreated} entities, +${ing.edgesCreated} relationships\n`,
+ );
+
+ console.log("Reading context for an agent task:");
+ const bundle = await engine.read("what happens when a charge fails?");
+ console.log(bundle.prompt);
+
+ console.log("\nAn agent contributes a learning back:");
+ const c = await engine.contribute(
+ "The Dunning Worker sends a Slack alert to #billing after the final failed retry.",
+ { agentId: "oncall-agent" },
+ );
+ console.log(` +${c.nodesCreated} entities, ${c.nodesUpdated} reinforced\n`);
+
+ console.log("Reading again — the new learning is now part of the graph:");
+ const after = await engine.read("how is the team notified about failed charges?");
+ console.log(after.prompt);
+
+ console.log("\nFinal graph:", engine.stats());
+ engine.close();
+}
+
+main().catch((err) => {
+ console.error(err);
+ process.exit(1);
+});
diff --git a/install.sh b/install.sh
new file mode 100755
index 00000000..13c8ae21
--- /dev/null
+++ b/install.sh
@@ -0,0 +1,75 @@
+#!/usr/bin/env sh
+# Context Graph Engine — one-line installer.
+#
+# curl -fsSL https://raw.githubusercontent.com/YOUR_ORG/context-graph-engine/main/install.sh | sh
+#
+# Clones the repo, builds it, and puts the `context-graph` and
+# `context-graph-mcp` commands on your PATH. Requires git, Node >= 20, and npm.
+#
+# Environment overrides:
+# CGE_REPO git URL to install from (default: the YOUR_ORG repo below)
+# CGE_REF branch/tag/commit to check out (default: main)
+# CGE_HOME where to install (default: ~/.context-graph-engine)
+set -eu
+
+# ---- EDIT THIS to point at your published repository -------------------------
+REPO_URL="${CGE_REPO:-https://github.com/YOUR_ORG/context-graph-engine.git}"
+# ------------------------------------------------------------------------------
+REF="${CGE_REF:-main}"
+INSTALL_DIR="${CGE_HOME:-$HOME/.context-graph-engine}"
+
+info() { printf '\033[1;36m›\033[0m %s\n' "$1"; }
+err() { printf '\033[1;31m✗ %s\033[0m\n' "$1" >&2; }
+
+need() {
+ command -v "$1" >/dev/null 2>&1 || { err "'$1' is required but not installed. $2"; exit 1; }
+}
+
+need git "Install git and re-run."
+need node "Install Node.js >= 20 from https://nodejs.org and re-run."
+need npm "Install npm (bundled with Node.js) and re-run."
+
+# Enforce Node >= 20.
+NODE_MAJOR="$(node -p 'process.versions.node.split(".")[0]')"
+if [ "$NODE_MAJOR" -lt 20 ]; then
+ err "Node.js >= 20 is required (found $(node -v)). Upgrade and re-run."
+ exit 1
+fi
+
+if [ -d "$INSTALL_DIR/.git" ]; then
+ info "Updating existing install at $INSTALL_DIR"
+ git -C "$INSTALL_DIR" fetch --depth 1 origin "$REF"
+ git -C "$INSTALL_DIR" checkout -q "$REF"
+ git -C "$INSTALL_DIR" reset --hard -q "origin/$REF" 2>/dev/null || true
+else
+ info "Cloning $REPO_URL → $INSTALL_DIR"
+ git clone --depth 1 --branch "$REF" "$REPO_URL" "$INSTALL_DIR"
+fi
+
+info "Installing dependencies"
+( cd "$INSTALL_DIR" && npm install --silent )
+
+info "Building"
+( cd "$INSTALL_DIR" && npm run build --silent )
+
+info "Linking the 'context-graph' and 'context-graph-mcp' commands"
+( cd "$INSTALL_DIR" && npm link >/dev/null 2>&1 )
+
+echo
+info "Installed. Try: context-graph --help"
+cat <<'NEXT'
+
+ Runs locally out of the box:
+ • Embeddings run in-process (no key, no server — model downloads on first use).
+ • Extraction defaults to a local Ollama model. Install Ollama and pull one:
+ https://ollama.com then ollama pull llama3.2
+
+ Prefer higher-quality cloud extraction? Set keys and it's used automatically:
+ export ANTHROPIC_API_KEY=sk-ant-... # extraction
+ export OPENAI_API_KEY=sk-... # embeddings (optional)
+
+ Quick start:
+ echo "Our billing worker retries failed charges 3x then marks past_due." \
+ | context-graph ingest-text --title "Billing"
+ context-graph query "how are failed charges handled?"
+NEXT
diff --git a/package-lock.json b/package-lock.json
new file mode 100644
index 00000000..185e358e
--- /dev/null
+++ b/package-lock.json
@@ -0,0 +1,3258 @@
+{
+ "name": "context-graph-engine",
+ "version": "0.1.0",
+ "lockfileVersion": 3,
+ "requires": true,
+ "packages": {
+ "": {
+ "name": "context-graph-engine",
+ "version": "0.1.0",
+ "license": "MIT",
+ "dependencies": {
+ "@anthropic-ai/sdk": "^0.109.1",
+ "@huggingface/transformers": "^3.8.1",
+ "@modelcontextprotocol/sdk": "^1.29.0",
+ "better-sqlite3": "^12.11.1",
+ "commander": "^15.0.0",
+ "dotenv": "^17.4.2",
+ "openai": "^6.45.0",
+ "zod": "^4.4.3"
+ },
+ "bin": {
+ "context-graph": "dist/cli.js",
+ "context-graph-mcp": "dist/mcp.js"
+ },
+ "devDependencies": {
+ "@types/better-sqlite3": "^7.6.13",
+ "@types/node": "^26.1.0",
+ "tsx": "^4.22.4",
+ "typescript": "^6.0.3"
+ },
+ "engines": {
+ "node": ">=20"
+ }
+ },
+ "node_modules/@anthropic-ai/sdk": {
+ "version": "0.109.1",
+ "resolved": "https://registry.npmjs.org/@anthropic-ai/sdk/-/sdk-0.109.1.tgz",
+ "integrity": "sha512-q9OnEKLr5H9nxSuXdgDgJhxfYMiE+AaUEBze2Gk91UcaaLnsN+Lx5fbCYywiqurU/APLdwv23x03Wm6WN3EBsg==",
+ "license": "MIT",
+ "dependencies": {
+ "json-schema-to-ts": "^3.1.1",
+ "standardwebhooks": "^1.0.0"
+ },
+ "bin": {
+ "anthropic-ai-sdk": "bin/cli"
+ },
+ "peerDependencies": {
+ "zod": "^3.25.0 || ^4.0.0"
+ },
+ "peerDependenciesMeta": {
+ "zod": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@babel/runtime": {
+ "version": "7.29.7",
+ "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.29.7.tgz",
+ "integrity": "sha512-Nq8OhGWiZIZGV6hLHoyAKLLcJihP/xFeBMGJoUrxTX2psI8dCifzLhZISFb+VWS3wFMRDmCGw5R+dOySCqPLhw==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@emnapi/runtime": {
+ "version": "1.11.2",
+ "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.11.2.tgz",
+ "integrity": "sha512-kyOl3X0DuTiT1h2ft8r2fYO8JYtU9a9Xis/zBSiGArNaagCOWx90N1k2wxp18czFDH+OgcWGb5ZP/XMt3dcyPA==",
+ "license": "MIT",
+ "optional": true,
+ "dependencies": {
+ "tslib": "^2.4.0"
+ }
+ },
+ "node_modules/@esbuild/aix-ppc64": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.28.1.tgz",
+ "integrity": "sha512-Svl7tq8k/08+p6CXPpRjQ1fKX+1odH/BQbb48fV6fj3CWHhsoIOoY87w1oHXm0qEpkIK3ZfVgp0hed3XBXzXMQ==",
+ "cpu": [
+ "ppc64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "aix"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/android-arm": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.28.1.tgz",
+ "integrity": "sha512-0k2F129Xdio1TdJfzJ8sy1Q47vUD2NnwdhiAf7drUN1EBTfPf4hsFCtmMgu/6m8JSzsBrlmVjudMBQqOfG8usQ==",
+ "cpu": [
+ "arm"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "android"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/android-arm64": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.28.1.tgz",
+ "integrity": "sha512-34EGEbCIAgosYz6goLcopX6Mo7NyGv9tfwEM2/7Ce2VcVRk568iSvniGWcUXIy7wEDR1wzolcxcriFVrWYcwBg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "android"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/android-x64": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.28.1.tgz",
+ "integrity": "sha512-dbwY7ltSMDWsRatcRpCnES4F+im88OCUgGZjy52shC7GqHRE/cYlxNbB4Z4UpJswpcc4Qxd2oE/ufM0p61IKng==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "android"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/darwin-arm64": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.28.1.tgz",
+ "integrity": "sha512-TZbWkQY7kvTAXbXUT7uVACR5cMHsDiSz9z7ZKAX/RTq/WJEk3QyRr0wZpNhBDX+/0CtdqUIJlOiodQcta6tY3Q==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/darwin-x64": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.28.1.tgz",
+ "integrity": "sha512-zfdzgK9ACBNZLI/CyHTOx81SyNbM6YXn7rxSgX97VjyiPl9W1i4Ka4fgKECEoFCKGpvBj5qArWIGgQjOwkgskQ==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/freebsd-arm64": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.28.1.tgz",
+ "integrity": "sha512-wG2EA8ENdEI0qhkSZMjfqrdY+ziCYCPMmtZjjIwOmXFjmyzEHn+UUxk5of+SYsjtfs3VpnlC7QLzSI5hY/rOAw==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "freebsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/freebsd-x64": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.28.1.tgz",
+ "integrity": "sha512-i7dZ9vQgnvSCzi/rYCXNgtF/U+eKZNJBzu3eTQbRgHnM7tNSizLOkRFAl3qzVc/Op/u5YkHHa4pf/3DOYHthLQ==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "freebsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-arm": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.28.1.tgz",
+ "integrity": "sha512-qVXBOHQS+d5Y722GwJzJUtOLlX7km3CraOaGormF1pDtPd2C/l1SHRPgjLunLGe51Sh5YYWKMFDyV4SxgMQYTQ==",
+ "cpu": [
+ "arm"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-arm64": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.28.1.tgz",
+ "integrity": "sha512-yHs+0uc8+nvEAfAfxrWQKK5peSNzBc4PegcMO0EJ2hT71uA7vB8Ihg2e77R2P7SG5uYjPbHlLLmve4LLLRCf0g==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-ia32": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.28.1.tgz",
+ "integrity": "sha512-d1z4ZuP0ajrfz/FhGT4vv278rX8KnPPJx8i5+AtK7TYbx9Le9F1hyzurZpkEyjkGa9dUGhQow4C1NmeGvqxN2w==",
+ "cpu": [
+ "ia32"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-loong64": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.28.1.tgz",
+ "integrity": "sha512-M5sRjUVZrkm1OAPR3dlOYzNmN+loZKGVi1VUQGrwuqLcbR6qeAz+famMhjASeH3YVKvZz+zT1jlh/keC3Rj/lg==",
+ "cpu": [
+ "loong64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-mips64el": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.28.1.tgz",
+ "integrity": "sha512-mRObBZeHh2OxcBFPWE/FjylkRgZdYuiTR3vaTozquCGOH14iP9oN4x4Ge81CoIDYQrXmIxpFumJBu5MtZpnQJQ==",
+ "cpu": [
+ "mips64el"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-ppc64": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.28.1.tgz",
+ "integrity": "sha512-slScBsMAb3GFDcdrCgLwZtPYRoH2H/youv10QiZyRjmsP48fznoveWytSgCI/R0ZcUgpc0ZhIUEx6LHts8yrfQ==",
+ "cpu": [
+ "ppc64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-riscv64": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.28.1.tgz",
+ "integrity": "sha512-kw0owk1o0GFETUJyW0jc0G4Yzs0BHZn0JDZ8JRT088vjJYX777BAs1fDGxAC+q831qOs2DTC96mNsG2opdfyyQ==",
+ "cpu": [
+ "riscv64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-s390x": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.28.1.tgz",
+ "integrity": "sha512-/lAIjX8aYFRByhh6L5rYtPEDRqa9de/4V/juOXcta5frjvzXO4/sqEtyytse0g3zZFuWu5cDN0MkLz2qRDD2Ag==",
+ "cpu": [
+ "s390x"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-x64": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.28.1.tgz",
+ "integrity": "sha512-u/anNYF2mmVOEDwLtnQ1wOr3EZ9sTNGLWrsYGYwHWzGA3Si84IOkHXlbWTD1NB+9/1lcnweYKO54uhxZydNzfA==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/netbsd-arm64": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.28.1.tgz",
+ "integrity": "sha512-oks0DYbLwWMmaakTsCb+zL4E+aHRVLom9IJZOAthMQEPiQmydXHkziYEsGYRx0uNV/IjEKGAV941JzH02pflqw==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "netbsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/netbsd-x64": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.28.1.tgz",
+ "integrity": "sha512-aeL6lAnN89Hz43Mlh1G8ARasbuoYvSITDEx0tHh5b7jJnHcssqgjy9Yx430GDpmCa6OyrKoS0aNRjKundRizGg==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "netbsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/openbsd-arm64": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.28.1.tgz",
+ "integrity": "sha512-MEFJe5C3R8pwXdZ5Y21oo6m7ePiS0d9pWucn99O/wvyJZChoIQKrQDxKrGeW8F5+T0okTHesAmDeiHDTIq0V/Q==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "openbsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/openbsd-x64": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.28.1.tgz",
+ "integrity": "sha512-i/ZLIOafE0Z8cI/XANJAixoJL/uRAoS2xOA3rb0xN+KK0K177cMAsQYkzHtBrtMXAKuAc7HGgcWiZ/sRC1Nxgw==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "openbsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/openharmony-arm64": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.28.1.tgz",
+ "integrity": "sha512-ge+Z7EXFNt2BO1oAMsVpiQ8EwndV9i1xXerAeTIK7AtPs3bKFXQM7nlRxDSIUIMeueR1CNXxqztLzdNeReKBJg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "openharmony"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/sunos-x64": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.28.1.tgz",
+ "integrity": "sha512-BEjgtECkL3vY+SaSQ6nzVfiALUeFxpawyp8Jmf5PtYhf1Ug40N1h/hxlhts+f1FvSvarEigdxS3BlSMI2PJLcQ==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "sunos"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/win32-arm64": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.28.1.tgz",
+ "integrity": "sha512-lCv9eK/H6ZJWbE7bh2nw54CZ9M2nupBxJcTsdk/QQnWkdSjKGuxmmH8/GWrlT1eMmZfn4dGcCjRte397WqfQXA==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/win32-ia32": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.28.1.tgz",
+ "integrity": "sha512-zvb/mB2bSCoJOpoCBgYKKpX6YM6mJBlBUVUtVj41DlZJVEB6/0CKlRYxP5wWl1C1ILiCoAU5wZZ4q1P3qeS6Eg==",
+ "cpu": [
+ "ia32"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/win32-x64": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.28.1.tgz",
+ "integrity": "sha512-bm4Mowrv+GXMlpWX++EcXw/iLyd1o3+bJkC2DkWXYVvgZCqD/bSj9ctZeAMC3cIxgjRVR2Dufaiu4YPxr5gW1A==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@hono/node-server": {
+ "version": "1.19.14",
+ "resolved": "https://registry.npmjs.org/@hono/node-server/-/node-server-1.19.14.tgz",
+ "integrity": "sha512-GwtvgtXxnWsucXvbQXkRgqksiH2Qed37H9xHZocE5sA3N8O8O8/8FA3uclQXxXVzc9XBZuEOMK7+r02FmSpHtw==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=18.14.1"
+ },
+ "peerDependencies": {
+ "hono": "^4"
+ }
+ },
+ "node_modules/@huggingface/jinja": {
+ "version": "0.5.9",
+ "resolved": "https://registry.npmjs.org/@huggingface/jinja/-/jinja-0.5.9.tgz",
+ "integrity": "sha512-uWTG+l3VJRsl7EXxYizuL3P+cCPoc3cRqbWWRcQN0FhejRfbdq0RNhCmbY/YDtnTcz9icdLYuLDjsnz4d8JMuw==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@huggingface/transformers": {
+ "version": "3.8.1",
+ "resolved": "https://registry.npmjs.org/@huggingface/transformers/-/transformers-3.8.1.tgz",
+ "integrity": "sha512-tsTk4zVjImqdqjS8/AOZg2yNLd1z9S5v+7oUPpXaasDRwEDhB+xnglK1k5cad26lL5/ZIaeREgWWy0bs9y9pPA==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@huggingface/jinja": "^0.5.3",
+ "onnxruntime-node": "1.21.0",
+ "onnxruntime-web": "1.22.0-dev.20250409-89f8206ba4",
+ "sharp": "^0.34.1"
+ }
+ },
+ "node_modules/@img/colour": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/@img/colour/-/colour-1.1.0.tgz",
+ "integrity": "sha512-Td76q7j57o/tLVdgS746cYARfSyxk8iEfRxewL9h4OMzYhbW4TAcppl0mT4eyqXddh6L/jwoM75mo7ixa/pCeQ==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@img/sharp-darwin-arm64": {
+ "version": "0.34.5",
+ "resolved": "https://registry.npmjs.org/@img/sharp-darwin-arm64/-/sharp-darwin-arm64-0.34.5.tgz",
+ "integrity": "sha512-imtQ3WMJXbMY4fxb/Ndp6HBTNVtWCUI0WdobyheGf5+ad6xX8VIDO8u2xE4qc/fr08CKG/7dDseFtn6M6g/r3w==",
+ "cpu": [
+ "arm64"
+ ],
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": "^18.17.0 || ^20.3.0 || >=21.0.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ },
+ "optionalDependencies": {
+ "@img/sharp-libvips-darwin-arm64": "1.2.4"
+ }
+ },
+ "node_modules/@img/sharp-darwin-x64": {
+ "version": "0.34.5",
+ "resolved": "https://registry.npmjs.org/@img/sharp-darwin-x64/-/sharp-darwin-x64-0.34.5.tgz",
+ "integrity": "sha512-YNEFAF/4KQ/PeW0N+r+aVVsoIY0/qxxikF2SWdp+NRkmMB7y9LBZAVqQ4yhGCm/H3H270OSykqmQMKLBhBJDEw==",
+ "cpu": [
+ "x64"
+ ],
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": "^18.17.0 || ^20.3.0 || >=21.0.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ },
+ "optionalDependencies": {
+ "@img/sharp-libvips-darwin-x64": "1.2.4"
+ }
+ },
+ "node_modules/@img/sharp-libvips-darwin-arm64": {
+ "version": "1.2.4",
+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-arm64/-/sharp-libvips-darwin-arm64-1.2.4.tgz",
+ "integrity": "sha512-zqjjo7RatFfFoP0MkQ51jfuFZBnVE2pRiaydKJ1G/rHZvnsrHAOcQALIi9sA5co5xenQdTugCvtb1cuf78Vf4g==",
+ "cpu": [
+ "arm64"
+ ],
+ "license": "LGPL-3.0-or-later",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ }
+ },
+ "node_modules/@img/sharp-libvips-darwin-x64": {
+ "version": "1.2.4",
+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-x64/-/sharp-libvips-darwin-x64-1.2.4.tgz",
+ "integrity": "sha512-1IOd5xfVhlGwX+zXv2N93k0yMONvUlANylbJw1eTah8K/Jtpi15KC+WSiaX/nBmbm2HxRM1gZ0nSdjSsrZbGKg==",
+ "cpu": [
+ "x64"
+ ],
+ "license": "LGPL-3.0-or-later",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ }
+ },
+ "node_modules/@img/sharp-libvips-linux-arm": {
+ "version": "1.2.4",
+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm/-/sharp-libvips-linux-arm-1.2.4.tgz",
+ "integrity": "sha512-bFI7xcKFELdiNCVov8e44Ia4u2byA+l3XtsAj+Q8tfCwO6BQ8iDojYdvoPMqsKDkuoOo+X6HZA0s0q11ANMQ8A==",
+ "cpu": [
+ "arm"
+ ],
+ "license": "LGPL-3.0-or-later",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ }
+ },
+ "node_modules/@img/sharp-libvips-linux-arm64": {
+ "version": "1.2.4",
+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm64/-/sharp-libvips-linux-arm64-1.2.4.tgz",
+ "integrity": "sha512-excjX8DfsIcJ10x1Kzr4RcWe1edC9PquDRRPx3YVCvQv+U5p7Yin2s32ftzikXojb1PIFc/9Mt28/y+iRklkrw==",
+ "cpu": [
+ "arm64"
+ ],
+ "license": "LGPL-3.0-or-later",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ }
+ },
+ "node_modules/@img/sharp-libvips-linux-ppc64": {
+ "version": "1.2.4",
+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-ppc64/-/sharp-libvips-linux-ppc64-1.2.4.tgz",
+ "integrity": "sha512-FMuvGijLDYG6lW+b/UvyilUWu5Ayu+3r2d1S8notiGCIyYU/76eig1UfMmkZ7vwgOrzKzlQbFSuQfgm7GYUPpA==",
+ "cpu": [
+ "ppc64"
+ ],
+ "license": "LGPL-3.0-or-later",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ }
+ },
+ "node_modules/@img/sharp-libvips-linux-riscv64": {
+ "version": "1.2.4",
+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-riscv64/-/sharp-libvips-linux-riscv64-1.2.4.tgz",
+ "integrity": "sha512-oVDbcR4zUC0ce82teubSm+x6ETixtKZBh/qbREIOcI3cULzDyb18Sr/Wcyx7NRQeQzOiHTNbZFF1UwPS2scyGA==",
+ "cpu": [
+ "riscv64"
+ ],
+ "license": "LGPL-3.0-or-later",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ }
+ },
+ "node_modules/@img/sharp-libvips-linux-s390x": {
+ "version": "1.2.4",
+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-s390x/-/sharp-libvips-linux-s390x-1.2.4.tgz",
+ "integrity": "sha512-qmp9VrzgPgMoGZyPvrQHqk02uyjA0/QrTO26Tqk6l4ZV0MPWIW6LTkqOIov+J1yEu7MbFQaDpwdwJKhbJvuRxQ==",
+ "cpu": [
+ "s390x"
+ ],
+ "license": "LGPL-3.0-or-later",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ }
+ },
+ "node_modules/@img/sharp-libvips-linux-x64": {
+ "version": "1.2.4",
+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-x64/-/sharp-libvips-linux-x64-1.2.4.tgz",
+ "integrity": "sha512-tJxiiLsmHc9Ax1bz3oaOYBURTXGIRDODBqhveVHonrHJ9/+k89qbLl0bcJns+e4t4rvaNBxaEZsFtSfAdquPrw==",
+ "cpu": [
+ "x64"
+ ],
+ "license": "LGPL-3.0-or-later",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ }
+ },
+ "node_modules/@img/sharp-libvips-linuxmusl-arm64": {
+ "version": "1.2.4",
+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-arm64/-/sharp-libvips-linuxmusl-arm64-1.2.4.tgz",
+ "integrity": "sha512-FVQHuwx1IIuNow9QAbYUzJ+En8KcVm9Lk5+uGUQJHaZmMECZmOlix9HnH7n1TRkXMS0pGxIJokIVB9SuqZGGXw==",
+ "cpu": [
+ "arm64"
+ ],
+ "license": "LGPL-3.0-or-later",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ }
+ },
+ "node_modules/@img/sharp-libvips-linuxmusl-x64": {
+ "version": "1.2.4",
+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-x64/-/sharp-libvips-linuxmusl-x64-1.2.4.tgz",
+ "integrity": "sha512-+LpyBk7L44ZIXwz/VYfglaX/okxezESc6UxDSoyo2Ks6Jxc4Y7sGjpgU9s4PMgqgjj1gZCylTieNamqA1MF7Dg==",
+ "cpu": [
+ "x64"
+ ],
+ "license": "LGPL-3.0-or-later",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ }
+ },
+ "node_modules/@img/sharp-linux-arm": {
+ "version": "0.34.5",
+ "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm/-/sharp-linux-arm-0.34.5.tgz",
+ "integrity": "sha512-9dLqsvwtg1uuXBGZKsxem9595+ujv0sJ6Vi8wcTANSFpwV/GONat5eCkzQo/1O6zRIkh0m/8+5BjrRr7jDUSZw==",
+ "cpu": [
+ "arm"
+ ],
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": "^18.17.0 || ^20.3.0 || >=21.0.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ },
+ "optionalDependencies": {
+ "@img/sharp-libvips-linux-arm": "1.2.4"
+ }
+ },
+ "node_modules/@img/sharp-linux-arm64": {
+ "version": "0.34.5",
+ "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm64/-/sharp-linux-arm64-0.34.5.tgz",
+ "integrity": "sha512-bKQzaJRY/bkPOXyKx5EVup7qkaojECG6NLYswgktOZjaXecSAeCWiZwwiFf3/Y+O1HrauiE3FVsGxFg8c24rZg==",
+ "cpu": [
+ "arm64"
+ ],
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": "^18.17.0 || ^20.3.0 || >=21.0.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ },
+ "optionalDependencies": {
+ "@img/sharp-libvips-linux-arm64": "1.2.4"
+ }
+ },
+ "node_modules/@img/sharp-linux-ppc64": {
+ "version": "0.34.5",
+ "resolved": "https://registry.npmjs.org/@img/sharp-linux-ppc64/-/sharp-linux-ppc64-0.34.5.tgz",
+ "integrity": "sha512-7zznwNaqW6YtsfrGGDA6BRkISKAAE1Jo0QdpNYXNMHu2+0dTrPflTLNkpc8l7MUP5M16ZJcUvysVWWrMefZquA==",
+ "cpu": [
+ "ppc64"
+ ],
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": "^18.17.0 || ^20.3.0 || >=21.0.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ },
+ "optionalDependencies": {
+ "@img/sharp-libvips-linux-ppc64": "1.2.4"
+ }
+ },
+ "node_modules/@img/sharp-linux-riscv64": {
+ "version": "0.34.5",
+ "resolved": "https://registry.npmjs.org/@img/sharp-linux-riscv64/-/sharp-linux-riscv64-0.34.5.tgz",
+ "integrity": "sha512-51gJuLPTKa7piYPaVs8GmByo7/U7/7TZOq+cnXJIHZKavIRHAP77e3N2HEl3dgiqdD/w0yUfiJnII77PuDDFdw==",
+ "cpu": [
+ "riscv64"
+ ],
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": "^18.17.0 || ^20.3.0 || >=21.0.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ },
+ "optionalDependencies": {
+ "@img/sharp-libvips-linux-riscv64": "1.2.4"
+ }
+ },
+ "node_modules/@img/sharp-linux-s390x": {
+ "version": "0.34.5",
+ "resolved": "https://registry.npmjs.org/@img/sharp-linux-s390x/-/sharp-linux-s390x-0.34.5.tgz",
+ "integrity": "sha512-nQtCk0PdKfho3eC5MrbQoigJ2gd1CgddUMkabUj+rBevs8tZ2cULOx46E7oyX+04WGfABgIwmMC0VqieTiR4jg==",
+ "cpu": [
+ "s390x"
+ ],
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": "^18.17.0 || ^20.3.0 || >=21.0.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ },
+ "optionalDependencies": {
+ "@img/sharp-libvips-linux-s390x": "1.2.4"
+ }
+ },
+ "node_modules/@img/sharp-linux-x64": {
+ "version": "0.34.5",
+ "resolved": "https://registry.npmjs.org/@img/sharp-linux-x64/-/sharp-linux-x64-0.34.5.tgz",
+ "integrity": "sha512-MEzd8HPKxVxVenwAa+JRPwEC7QFjoPWuS5NZnBt6B3pu7EG2Ge0id1oLHZpPJdn3OQK+BQDiw9zStiHBTJQQQQ==",
+ "cpu": [
+ "x64"
+ ],
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": "^18.17.0 || ^20.3.0 || >=21.0.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ },
+ "optionalDependencies": {
+ "@img/sharp-libvips-linux-x64": "1.2.4"
+ }
+ },
+ "node_modules/@img/sharp-linuxmusl-arm64": {
+ "version": "0.34.5",
+ "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-arm64/-/sharp-linuxmusl-arm64-0.34.5.tgz",
+ "integrity": "sha512-fprJR6GtRsMt6Kyfq44IsChVZeGN97gTD331weR1ex1c1rypDEABN6Tm2xa1wE6lYb5DdEnk03NZPqA7Id21yg==",
+ "cpu": [
+ "arm64"
+ ],
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": "^18.17.0 || ^20.3.0 || >=21.0.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ },
+ "optionalDependencies": {
+ "@img/sharp-libvips-linuxmusl-arm64": "1.2.4"
+ }
+ },
+ "node_modules/@img/sharp-linuxmusl-x64": {
+ "version": "0.34.5",
+ "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-x64/-/sharp-linuxmusl-x64-0.34.5.tgz",
+ "integrity": "sha512-Jg8wNT1MUzIvhBFxViqrEhWDGzqymo3sV7z7ZsaWbZNDLXRJZoRGrjulp60YYtV4wfY8VIKcWidjojlLcWrd8Q==",
+ "cpu": [
+ "x64"
+ ],
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": "^18.17.0 || ^20.3.0 || >=21.0.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ },
+ "optionalDependencies": {
+ "@img/sharp-libvips-linuxmusl-x64": "1.2.4"
+ }
+ },
+ "node_modules/@img/sharp-wasm32": {
+ "version": "0.34.5",
+ "resolved": "https://registry.npmjs.org/@img/sharp-wasm32/-/sharp-wasm32-0.34.5.tgz",
+ "integrity": "sha512-OdWTEiVkY2PHwqkbBI8frFxQQFekHaSSkUIJkwzclWZe64O1X4UlUjqqqLaPbUpMOQk6FBu/HtlGXNblIs0huw==",
+ "cpu": [
+ "wasm32"
+ ],
+ "license": "Apache-2.0 AND LGPL-3.0-or-later AND MIT",
+ "optional": true,
+ "dependencies": {
+ "@emnapi/runtime": "^1.7.0"
+ },
+ "engines": {
+ "node": "^18.17.0 || ^20.3.0 || >=21.0.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ }
+ },
+ "node_modules/@img/sharp-win32-arm64": {
+ "version": "0.34.5",
+ "resolved": "https://registry.npmjs.org/@img/sharp-win32-arm64/-/sharp-win32-arm64-0.34.5.tgz",
+ "integrity": "sha512-WQ3AgWCWYSb2yt+IG8mnC6Jdk9Whs7O0gxphblsLvdhSpSTtmu69ZG1Gkb6NuvxsNACwiPV6cNSZNzt0KPsw7g==",
+ "cpu": [
+ "arm64"
+ ],
+ "license": "Apache-2.0 AND LGPL-3.0-or-later",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": "^18.17.0 || ^20.3.0 || >=21.0.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ }
+ },
+ "node_modules/@img/sharp-win32-ia32": {
+ "version": "0.34.5",
+ "resolved": "https://registry.npmjs.org/@img/sharp-win32-ia32/-/sharp-win32-ia32-0.34.5.tgz",
+ "integrity": "sha512-FV9m/7NmeCmSHDD5j4+4pNI8Cp3aW+JvLoXcTUo0IqyjSfAZJ8dIUmijx1qaJsIiU+Hosw6xM5KijAWRJCSgNg==",
+ "cpu": [
+ "ia32"
+ ],
+ "license": "Apache-2.0 AND LGPL-3.0-or-later",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": "^18.17.0 || ^20.3.0 || >=21.0.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ }
+ },
+ "node_modules/@img/sharp-win32-x64": {
+ "version": "0.34.5",
+ "resolved": "https://registry.npmjs.org/@img/sharp-win32-x64/-/sharp-win32-x64-0.34.5.tgz",
+ "integrity": "sha512-+29YMsqY2/9eFEiW93eqWnuLcWcufowXewwSNIT6UwZdUUCrM3oFjMWH/Z6/TMmb4hlFenmfAVbpWeup2jryCw==",
+ "cpu": [
+ "x64"
+ ],
+ "license": "Apache-2.0 AND LGPL-3.0-or-later",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": "^18.17.0 || ^20.3.0 || >=21.0.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ }
+ },
+ "node_modules/@isaacs/fs-minipass": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/@isaacs/fs-minipass/-/fs-minipass-4.0.1.tgz",
+ "integrity": "sha512-wgm9Ehl2jpeqP3zw/7mo3kRHFp5MEDhqAdwy1fTGkHAwnkGOVsgpvQhL8B5n1qlb01jV3n/bI0ZfZp5lWA1k4w==",
+ "license": "ISC",
+ "dependencies": {
+ "minipass": "^7.0.4"
+ },
+ "engines": {
+ "node": ">=18.0.0"
+ }
+ },
+ "node_modules/@modelcontextprotocol/sdk": {
+ "version": "1.29.0",
+ "resolved": "https://registry.npmjs.org/@modelcontextprotocol/sdk/-/sdk-1.29.0.tgz",
+ "integrity": "sha512-zo37mZA9hJWpULgkRpowewez1y6ML5GsXJPY8FI0tBBCd77HEvza4jDqRKOXgHNn867PVGCyTdzqpz0izu5ZjQ==",
+ "license": "MIT",
+ "dependencies": {
+ "@hono/node-server": "^1.19.9",
+ "ajv": "^8.17.1",
+ "ajv-formats": "^3.0.1",
+ "content-type": "^1.0.5",
+ "cors": "^2.8.5",
+ "cross-spawn": "^7.0.5",
+ "eventsource": "^3.0.2",
+ "eventsource-parser": "^3.0.0",
+ "express": "^5.2.1",
+ "express-rate-limit": "^8.2.1",
+ "hono": "^4.11.4",
+ "jose": "^6.1.3",
+ "json-schema-typed": "^8.0.2",
+ "pkce-challenge": "^5.0.0",
+ "raw-body": "^3.0.0",
+ "zod": "^3.25 || ^4.0",
+ "zod-to-json-schema": "^3.25.1"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "peerDependencies": {
+ "@cfworker/json-schema": "^4.1.1",
+ "zod": "^3.25 || ^4.0"
+ },
+ "peerDependenciesMeta": {
+ "@cfworker/json-schema": {
+ "optional": true
+ },
+ "zod": {
+ "optional": false
+ }
+ }
+ },
+ "node_modules/@protobufjs/aspromise": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz",
+ "integrity": "sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ==",
+ "license": "BSD-3-Clause"
+ },
+ "node_modules/@protobufjs/base64": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz",
+ "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==",
+ "license": "BSD-3-Clause"
+ },
+ "node_modules/@protobufjs/codegen": {
+ "version": "2.0.5",
+ "resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.5.tgz",
+ "integrity": "sha512-zgXFLzW3Ap33e6d0Wlj4MGIm6Ce8O89n/apUaGNB/jx+hw+ruWEp7EwGUshdLKVRCxZW12fp9r40E1mQrf/34g==",
+ "license": "BSD-3-Clause"
+ },
+ "node_modules/@protobufjs/eventemitter": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.1.tgz",
+ "integrity": "sha512-vW1GmwMZNnL+gMRaovlh9yZX74kc+TTU3FObkkurpMaRtBfLP3ldjS9KQWlwZgraRE0+dheEEoAxdzcJQ8eXZg==",
+ "license": "BSD-3-Clause"
+ },
+ "node_modules/@protobufjs/fetch": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.1.tgz",
+ "integrity": "sha512-GpptLrs57adMSuHi3VNj0mAF8dwh36LMaYF6XyJ6JMWlVsc+t42tm1HSEDmOs3A8fC9yyeisgLhsTVQokOZ0zw==",
+ "license": "BSD-3-Clause",
+ "dependencies": {
+ "@protobufjs/aspromise": "^1.1.1"
+ }
+ },
+ "node_modules/@protobufjs/float": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz",
+ "integrity": "sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ==",
+ "license": "BSD-3-Clause"
+ },
+ "node_modules/@protobufjs/path": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz",
+ "integrity": "sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA==",
+ "license": "BSD-3-Clause"
+ },
+ "node_modules/@protobufjs/pool": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz",
+ "integrity": "sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw==",
+ "license": "BSD-3-Clause"
+ },
+ "node_modules/@protobufjs/utf8": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.1.tgz",
+ "integrity": "sha512-oOAWABowe8EAbMyWKM0tYDKi8Yaox52D+HWZhAIJqQXbqe0xI/GV7FhLWqlEKreMkfDjshR5FKgi3mnle0h6Eg==",
+ "license": "BSD-3-Clause"
+ },
+ "node_modules/@stablelib/base64": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/@stablelib/base64/-/base64-1.0.1.tgz",
+ "integrity": "sha512-1bnPQqSxSuc3Ii6MhBysoWCg58j97aUjuCSZrGSmDxNqtytIi0k8utUenAwTZN4V5mXXYGsVUI9zeBqy+jBOSQ==",
+ "license": "MIT"
+ },
+ "node_modules/@types/better-sqlite3": {
+ "version": "7.6.13",
+ "resolved": "https://registry.npmjs.org/@types/better-sqlite3/-/better-sqlite3-7.6.13.tgz",
+ "integrity": "sha512-NMv9ASNARoKksWtsq/SHakpYAYnhBrQgGD8zkLYk/jaK8jUGn08CfEdTRgYhMypUQAfzSP8W6gNLe0q19/t4VA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@types/node": "*"
+ }
+ },
+ "node_modules/@types/node": {
+ "version": "26.1.0",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-26.1.0.tgz",
+ "integrity": "sha512-O0A1G3xPGy4w7AgQdAQYUlQ+BKk2Oovw8eRpofyp5KdBZULnbe+WqaOVNrm705SHphCiG4XHsACrSmPu1f+Kgw==",
+ "license": "MIT",
+ "dependencies": {
+ "undici-types": "~8.3.0"
+ }
+ },
+ "node_modules/accepts": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/accepts/-/accepts-2.0.0.tgz",
+ "integrity": "sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng==",
+ "license": "MIT",
+ "dependencies": {
+ "mime-types": "^3.0.0",
+ "negotiator": "^1.0.0"
+ },
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/ajv": {
+ "version": "8.20.0",
+ "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.20.0.tgz",
+ "integrity": "sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA==",
+ "license": "MIT",
+ "dependencies": {
+ "fast-deep-equal": "^3.1.3",
+ "fast-uri": "^3.0.1",
+ "json-schema-traverse": "^1.0.0",
+ "require-from-string": "^2.0.2"
+ },
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/epoberezkin"
+ }
+ },
+ "node_modules/ajv-formats": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-3.0.1.tgz",
+ "integrity": "sha512-8iUql50EUR+uUcdRQ3HDqa6EVyo3docL8g5WJ3FNcWmu62IbkGUue/pEyLBW8VGKKucTPgqeks4fIU1DA4yowQ==",
+ "license": "MIT",
+ "dependencies": {
+ "ajv": "^8.0.0"
+ },
+ "peerDependencies": {
+ "ajv": "^8.0.0"
+ },
+ "peerDependenciesMeta": {
+ "ajv": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/base64-js": {
+ "version": "1.5.1",
+ "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
+ "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==",
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/feross"
+ },
+ {
+ "type": "patreon",
+ "url": "https://www.patreon.com/feross"
+ },
+ {
+ "type": "consulting",
+ "url": "https://feross.org/support"
+ }
+ ],
+ "license": "MIT"
+ },
+ "node_modules/better-sqlite3": {
+ "version": "12.11.1",
+ "resolved": "https://registry.npmjs.org/better-sqlite3/-/better-sqlite3-12.11.1.tgz",
+ "integrity": "sha512-dq9AtApgg5PGFtBzPFSBl3HZQjHok5gaQCM6zh2Yk0aSmDCs1CbnVI8/HgASQkNKsWFpseIO9beg5xxpYhbIfA==",
+ "hasInstallScript": true,
+ "license": "MIT",
+ "dependencies": {
+ "bindings": "^1.5.0",
+ "prebuild-install": "^7.1.1"
+ },
+ "engines": {
+ "node": "20.x || 22.x || 23.x || 24.x || 25.x || 26.x"
+ }
+ },
+ "node_modules/bindings": {
+ "version": "1.5.0",
+ "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz",
+ "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==",
+ "license": "MIT",
+ "dependencies": {
+ "file-uri-to-path": "1.0.0"
+ }
+ },
+ "node_modules/bl": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz",
+ "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==",
+ "license": "MIT",
+ "dependencies": {
+ "buffer": "^5.5.0",
+ "inherits": "^2.0.4",
+ "readable-stream": "^3.4.0"
+ }
+ },
+ "node_modules/body-parser": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-2.3.0.tgz",
+ "integrity": "sha512-2cGmJupaNgg+QUwVLAucDuWuoMZ6EX9iHDRswZ5lsNYEmwPaRknMPCLZz07yTzVq/83p4o/wzbDZbBrTvGGTIw==",
+ "license": "MIT",
+ "dependencies": {
+ "bytes": "^3.1.2",
+ "content-type": "^2.0.0",
+ "debug": "^4.4.3",
+ "http-errors": "^2.0.1",
+ "iconv-lite": "^0.7.2",
+ "on-finished": "^2.4.1",
+ "qs": "^6.15.2",
+ "raw-body": "^3.0.2",
+ "type-is": "^2.1.0"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/express"
+ }
+ },
+ "node_modules/body-parser/node_modules/content-type": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/content-type/-/content-type-2.0.0.tgz",
+ "integrity": "sha512-j/O/d7GcZCyNl7/hwZAb606rzqkyvaDctLmckbxLzHvFBzTJHuGEdodATcP3yIRoDrLHkIATJuvzbFlp/ki2cQ==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/express"
+ }
+ },
+ "node_modules/boolean": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/boolean/-/boolean-3.2.0.tgz",
+ "integrity": "sha512-d0II/GO9uf9lfUHH2BQsjxzRJZBdsjgsBiW4BvhWk/3qoKwQFjIDVN19PfX8F2D/r9PCMTtLWjYVCFrpeYUzsw==",
+ "deprecated": "Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.",
+ "license": "MIT"
+ },
+ "node_modules/buffer": {
+ "version": "5.7.1",
+ "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz",
+ "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==",
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/feross"
+ },
+ {
+ "type": "patreon",
+ "url": "https://www.patreon.com/feross"
+ },
+ {
+ "type": "consulting",
+ "url": "https://feross.org/support"
+ }
+ ],
+ "license": "MIT",
+ "dependencies": {
+ "base64-js": "^1.3.1",
+ "ieee754": "^1.1.13"
+ }
+ },
+ "node_modules/bytes": {
+ "version": "3.1.2",
+ "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",
+ "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/call-bind-apply-helpers": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz",
+ "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==",
+ "license": "MIT",
+ "dependencies": {
+ "es-errors": "^1.3.0",
+ "function-bind": "^1.1.2"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/call-bound": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz",
+ "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==",
+ "license": "MIT",
+ "dependencies": {
+ "call-bind-apply-helpers": "^1.0.2",
+ "get-intrinsic": "^1.3.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/chownr": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz",
+ "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==",
+ "license": "ISC"
+ },
+ "node_modules/commander": {
+ "version": "15.0.0",
+ "resolved": "https://registry.npmjs.org/commander/-/commander-15.0.0.tgz",
+ "integrity": "sha512-z67u4ZhzCL/Tydu1lJARtEZYWbWaN7oYLHbsuzocr6y4N6WZAagG3RQ4FW61V1/0+jImpj293XfrcYnd1qxtPg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=22.12.0"
+ }
+ },
+ "node_modules/content-disposition": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-1.1.0.tgz",
+ "integrity": "sha512-5jRCH9Z/+DRP7rkvY83B+yGIGX96OYdJmzngqnw2SBSxqCFPd0w2km3s5iawpGX8krnwSGmF0FW5Nhr0Hfai3g==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/express"
+ }
+ },
+ "node_modules/content-type": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz",
+ "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/cookie": {
+ "version": "0.7.2",
+ "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz",
+ "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/cookie-signature": {
+ "version": "1.2.2",
+ "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.2.2.tgz",
+ "integrity": "sha512-D76uU73ulSXrD1UXF4KE2TMxVVwhsnCgfAyTg9k8P6KGZjlXKrOLe4dJQKI3Bxi5wjesZoFXJWElNWBjPZMbhg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=6.6.0"
+ }
+ },
+ "node_modules/cors": {
+ "version": "2.8.6",
+ "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.6.tgz",
+ "integrity": "sha512-tJtZBBHA6vjIAaF6EnIaq6laBBP9aq/Y3ouVJjEfoHbRBcHBAHYcMh/w8LDrk2PvIMMq8gmopa5D4V8RmbrxGw==",
+ "license": "MIT",
+ "dependencies": {
+ "object-assign": "^4",
+ "vary": "^1"
+ },
+ "engines": {
+ "node": ">= 0.10"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/express"
+ }
+ },
+ "node_modules/cross-spawn": {
+ "version": "7.0.6",
+ "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz",
+ "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==",
+ "license": "MIT",
+ "dependencies": {
+ "path-key": "^3.1.0",
+ "shebang-command": "^2.0.0",
+ "which": "^2.0.1"
+ },
+ "engines": {
+ "node": ">= 8"
+ }
+ },
+ "node_modules/debug": {
+ "version": "4.4.3",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",
+ "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==",
+ "license": "MIT",
+ "dependencies": {
+ "ms": "^2.1.3"
+ },
+ "engines": {
+ "node": ">=6.0"
+ },
+ "peerDependenciesMeta": {
+ "supports-color": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/decompress-response": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz",
+ "integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==",
+ "license": "MIT",
+ "dependencies": {
+ "mimic-response": "^3.1.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/deep-extend": {
+ "version": "0.6.0",
+ "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz",
+ "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=4.0.0"
+ }
+ },
+ "node_modules/define-data-property": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz",
+ "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==",
+ "license": "MIT",
+ "dependencies": {
+ "es-define-property": "^1.0.0",
+ "es-errors": "^1.3.0",
+ "gopd": "^1.0.1"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/define-properties": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.1.tgz",
+ "integrity": "sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==",
+ "license": "MIT",
+ "dependencies": {
+ "define-data-property": "^1.0.1",
+ "has-property-descriptors": "^1.0.0",
+ "object-keys": "^1.1.1"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/depd": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
+ "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/detect-libc": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz",
+ "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==",
+ "license": "Apache-2.0",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/detect-node": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/detect-node/-/detect-node-2.1.0.tgz",
+ "integrity": "sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g==",
+ "license": "MIT"
+ },
+ "node_modules/dotenv": {
+ "version": "17.4.2",
+ "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-17.4.2.tgz",
+ "integrity": "sha512-nI4U3TottKAcAD9LLud4Cb7b2QztQMUEfHbvhTH09bqXTxnSie8WnjPALV/WMCrJZ6UV/qHJ6L03OqO3LcdYZw==",
+ "license": "BSD-2-Clause",
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://dotenvx.com"
+ }
+ },
+ "node_modules/dunder-proto": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",
+ "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==",
+ "license": "MIT",
+ "dependencies": {
+ "call-bind-apply-helpers": "^1.0.1",
+ "es-errors": "^1.3.0",
+ "gopd": "^1.2.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/ee-first": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
+ "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==",
+ "license": "MIT"
+ },
+ "node_modules/encodeurl": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz",
+ "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/end-of-stream": {
+ "version": "1.4.5",
+ "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.5.tgz",
+ "integrity": "sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg==",
+ "license": "MIT",
+ "dependencies": {
+ "once": "^1.4.0"
+ }
+ },
+ "node_modules/es-define-property": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz",
+ "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/es-errors": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz",
+ "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/es-object-atoms": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.2.tgz",
+ "integrity": "sha512-HWcBoN6NileqtSydK2FqHbS/LoDd2pqrnQHLyJzBj4kOp/ky2MWMN694xOfkK8/SnUsW2DH7EfyVlydKCsm1Zw==",
+ "license": "MIT",
+ "dependencies": {
+ "es-errors": "^1.3.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/es6-error": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/es6-error/-/es6-error-4.1.1.tgz",
+ "integrity": "sha512-Um/+FxMr9CISWh0bi5Zv0iOD+4cFh5qLeks1qhAopKVAJw3drgKbKySikp7wGhDL0HPeaja0P5ULZrxLkniUVg==",
+ "license": "MIT"
+ },
+ "node_modules/esbuild": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.28.1.tgz",
+ "integrity": "sha512-HrJrvZv5ayxBzPfwphOoNzkzOIIlifzk0KJrGK2c8R4+LKpMtpYLQeUdjnwjWv/LZlkH2laZk+4w78pi99D4Vw==",
+ "dev": true,
+ "hasInstallScript": true,
+ "license": "MIT",
+ "bin": {
+ "esbuild": "bin/esbuild"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "optionalDependencies": {
+ "@esbuild/aix-ppc64": "0.28.1",
+ "@esbuild/android-arm": "0.28.1",
+ "@esbuild/android-arm64": "0.28.1",
+ "@esbuild/android-x64": "0.28.1",
+ "@esbuild/darwin-arm64": "0.28.1",
+ "@esbuild/darwin-x64": "0.28.1",
+ "@esbuild/freebsd-arm64": "0.28.1",
+ "@esbuild/freebsd-x64": "0.28.1",
+ "@esbuild/linux-arm": "0.28.1",
+ "@esbuild/linux-arm64": "0.28.1",
+ "@esbuild/linux-ia32": "0.28.1",
+ "@esbuild/linux-loong64": "0.28.1",
+ "@esbuild/linux-mips64el": "0.28.1",
+ "@esbuild/linux-ppc64": "0.28.1",
+ "@esbuild/linux-riscv64": "0.28.1",
+ "@esbuild/linux-s390x": "0.28.1",
+ "@esbuild/linux-x64": "0.28.1",
+ "@esbuild/netbsd-arm64": "0.28.1",
+ "@esbuild/netbsd-x64": "0.28.1",
+ "@esbuild/openbsd-arm64": "0.28.1",
+ "@esbuild/openbsd-x64": "0.28.1",
+ "@esbuild/openharmony-arm64": "0.28.1",
+ "@esbuild/sunos-x64": "0.28.1",
+ "@esbuild/win32-arm64": "0.28.1",
+ "@esbuild/win32-ia32": "0.28.1",
+ "@esbuild/win32-x64": "0.28.1"
+ }
+ },
+ "node_modules/escape-html": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
+ "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==",
+ "license": "MIT"
+ },
+ "node_modules/escape-string-regexp": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz",
+ "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/etag": {
+ "version": "1.8.1",
+ "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
+ "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/eventsource": {
+ "version": "3.0.7",
+ "resolved": "https://registry.npmjs.org/eventsource/-/eventsource-3.0.7.tgz",
+ "integrity": "sha512-CRT1WTyuQoD771GW56XEZFQ/ZoSfWid1alKGDYMmkt2yl8UXrVR4pspqWNEcqKvVIzg6PAltWjxcSSPrboA4iA==",
+ "license": "MIT",
+ "dependencies": {
+ "eventsource-parser": "^3.0.1"
+ },
+ "engines": {
+ "node": ">=18.0.0"
+ }
+ },
+ "node_modules/eventsource-parser": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/eventsource-parser/-/eventsource-parser-3.1.0.tgz",
+ "integrity": "sha512-kJezFj9YFAMLeORyi7aCLxLbD5/qWMQnoMVlVPyHIll7lgRJCc3JVln9Vgl9nwQi0YkMnhdGTMNn7CkRRAptMg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=18.0.0"
+ }
+ },
+ "node_modules/expand-template": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/expand-template/-/expand-template-2.0.3.tgz",
+ "integrity": "sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg==",
+ "license": "(MIT OR WTFPL)",
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/express": {
+ "version": "5.2.1",
+ "resolved": "https://registry.npmjs.org/express/-/express-5.2.1.tgz",
+ "integrity": "sha512-hIS4idWWai69NezIdRt2xFVofaF4j+6INOpJlVOLDO8zXGpUVEVzIYk12UUi2JzjEzWL3IOAxcTubgz9Po0yXw==",
+ "license": "MIT",
+ "dependencies": {
+ "accepts": "^2.0.0",
+ "body-parser": "^2.2.1",
+ "content-disposition": "^1.0.0",
+ "content-type": "^1.0.5",
+ "cookie": "^0.7.1",
+ "cookie-signature": "^1.2.1",
+ "debug": "^4.4.0",
+ "depd": "^2.0.0",
+ "encodeurl": "^2.0.0",
+ "escape-html": "^1.0.3",
+ "etag": "^1.8.1",
+ "finalhandler": "^2.1.0",
+ "fresh": "^2.0.0",
+ "http-errors": "^2.0.0",
+ "merge-descriptors": "^2.0.0",
+ "mime-types": "^3.0.0",
+ "on-finished": "^2.4.1",
+ "once": "^1.4.0",
+ "parseurl": "^1.3.3",
+ "proxy-addr": "^2.0.7",
+ "qs": "^6.14.0",
+ "range-parser": "^1.2.1",
+ "router": "^2.2.0",
+ "send": "^1.1.0",
+ "serve-static": "^2.2.0",
+ "statuses": "^2.0.1",
+ "type-is": "^2.0.1",
+ "vary": "^1.1.2"
+ },
+ "engines": {
+ "node": ">= 18"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/express"
+ }
+ },
+ "node_modules/express-rate-limit": {
+ "version": "8.5.2",
+ "resolved": "https://registry.npmjs.org/express-rate-limit/-/express-rate-limit-8.5.2.tgz",
+ "integrity": "sha512-5Kb34ipNX694DH48vN9irak1Qx30nb0PLYHXfJgw4YEjiC3ZEmZJhwOp+VfiCYwFzvFTdB9QkArYS5kXa2cx2A==",
+ "license": "MIT",
+ "dependencies": {
+ "ip-address": "^10.2.0"
+ },
+ "engines": {
+ "node": ">= 16"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/express-rate-limit"
+ },
+ "peerDependencies": {
+ "express": ">= 4.11"
+ }
+ },
+ "node_modules/fast-deep-equal": {
+ "version": "3.1.3",
+ "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
+ "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==",
+ "license": "MIT"
+ },
+ "node_modules/fast-sha256": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/fast-sha256/-/fast-sha256-1.3.0.tgz",
+ "integrity": "sha512-n11RGP/lrWEFI/bWdygLxhI+pVeo1ZYIVwvvPkW7azl/rOy+F3HYRZ2K5zeE9mmkhQppyv9sQFx0JM9UabnpPQ==",
+ "license": "Unlicense"
+ },
+ "node_modules/fast-uri": {
+ "version": "3.1.3",
+ "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.3.tgz",
+ "integrity": "sha512-i70LwGWUduXqzicKXWshooq+sWL1K3WUU5rKZNG/0i3a1OSoX3HqhH5WbWwTmqWfor4urUakGPiRQcleRZTwOg==",
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/fastify"
+ },
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/fastify"
+ }
+ ],
+ "license": "BSD-3-Clause"
+ },
+ "node_modules/file-uri-to-path": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz",
+ "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==",
+ "license": "MIT"
+ },
+ "node_modules/finalhandler": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-2.1.1.tgz",
+ "integrity": "sha512-S8KoZgRZN+a5rNwqTxlZZePjT/4cnm0ROV70LedRHZ0p8u9fRID0hJUZQpkKLzro8LfmC8sx23bY6tVNxv8pQA==",
+ "license": "MIT",
+ "dependencies": {
+ "debug": "^4.4.0",
+ "encodeurl": "^2.0.0",
+ "escape-html": "^1.0.3",
+ "on-finished": "^2.4.1",
+ "parseurl": "^1.3.3",
+ "statuses": "^2.0.1"
+ },
+ "engines": {
+ "node": ">= 18.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/express"
+ }
+ },
+ "node_modules/flatbuffers": {
+ "version": "25.9.23",
+ "resolved": "https://registry.npmjs.org/flatbuffers/-/flatbuffers-25.9.23.tgz",
+ "integrity": "sha512-MI1qs7Lo4Syw0EOzUl0xjs2lsoeqFku44KpngfIduHBYvzm8h2+7K8YMQh1JtVVVrUvhLpNwqVi4DERegUJhPQ==",
+ "license": "Apache-2.0"
+ },
+ "node_modules/forwarded": {
+ "version": "0.2.0",
+ "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",
+ "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/fresh": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/fresh/-/fresh-2.0.0.tgz",
+ "integrity": "sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/fs-constants": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz",
+ "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==",
+ "license": "MIT"
+ },
+ "node_modules/fsevents": {
+ "version": "2.3.3",
+ "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
+ "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
+ "dev": true,
+ "hasInstallScript": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": "^8.16.0 || ^10.6.0 || >=11.0.0"
+ }
+ },
+ "node_modules/function-bind": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
+ "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
+ "license": "MIT",
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/get-intrinsic": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz",
+ "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==",
+ "license": "MIT",
+ "dependencies": {
+ "call-bind-apply-helpers": "^1.0.2",
+ "es-define-property": "^1.0.1",
+ "es-errors": "^1.3.0",
+ "es-object-atoms": "^1.1.1",
+ "function-bind": "^1.1.2",
+ "get-proto": "^1.0.1",
+ "gopd": "^1.2.0",
+ "has-symbols": "^1.1.0",
+ "hasown": "^2.0.2",
+ "math-intrinsics": "^1.1.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/get-proto": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz",
+ "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==",
+ "license": "MIT",
+ "dependencies": {
+ "dunder-proto": "^1.0.1",
+ "es-object-atoms": "^1.0.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/github-from-package": {
+ "version": "0.0.0",
+ "resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz",
+ "integrity": "sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw==",
+ "license": "MIT"
+ },
+ "node_modules/global-agent": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/global-agent/-/global-agent-3.0.0.tgz",
+ "integrity": "sha512-PT6XReJ+D07JvGoxQMkT6qji/jVNfX/h364XHZOWeRzy64sSFr+xJ5OX7LI3b4MPQzdL4H8Y8M0xzPpsVMwA8Q==",
+ "license": "BSD-3-Clause",
+ "dependencies": {
+ "boolean": "^3.0.1",
+ "es6-error": "^4.1.1",
+ "matcher": "^3.0.0",
+ "roarr": "^2.15.3",
+ "semver": "^7.3.2",
+ "serialize-error": "^7.0.1"
+ },
+ "engines": {
+ "node": ">=10.0"
+ }
+ },
+ "node_modules/globalthis": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.4.tgz",
+ "integrity": "sha512-DpLKbNU4WylpxJykQujfCcwYWiV/Jhm50Goo0wrVILAv5jOr9d+H+UR3PhSCD2rCCEIg0uc+G+muBTwD54JhDQ==",
+ "license": "MIT",
+ "dependencies": {
+ "define-properties": "^1.2.1",
+ "gopd": "^1.0.1"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/gopd": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz",
+ "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/guid-typescript": {
+ "version": "1.0.9",
+ "resolved": "https://registry.npmjs.org/guid-typescript/-/guid-typescript-1.0.9.tgz",
+ "integrity": "sha512-Y8T4vYhEfwJOTbouREvG+3XDsjr8E3kIr7uf+JZ0BYloFsttiHU0WfvANVsR7TxNUJa/WpCnw/Ino/p+DeBhBQ==",
+ "license": "ISC"
+ },
+ "node_modules/has-property-descriptors": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz",
+ "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==",
+ "license": "MIT",
+ "dependencies": {
+ "es-define-property": "^1.0.0"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/has-symbols": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz",
+ "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/hasown": {
+ "version": "2.0.4",
+ "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.4.tgz",
+ "integrity": "sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==",
+ "license": "MIT",
+ "dependencies": {
+ "function-bind": "^1.1.2"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/hono": {
+ "version": "4.12.27",
+ "resolved": "https://registry.npmjs.org/hono/-/hono-4.12.27.tgz",
+ "integrity": "sha512-1yrb/+w6HWQJrUCLkJ2IF5jNIPvvFkblV5RNOYl6bV+OA6p9GLcMpHFFGTosSvHvcAUibuUukRqhlYI4z32C7Q==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=16.9.0"
+ }
+ },
+ "node_modules/http-errors": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz",
+ "integrity": "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==",
+ "license": "MIT",
+ "dependencies": {
+ "depd": "~2.0.0",
+ "inherits": "~2.0.4",
+ "setprototypeof": "~1.2.0",
+ "statuses": "~2.0.2",
+ "toidentifier": "~1.0.1"
+ },
+ "engines": {
+ "node": ">= 0.8"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/express"
+ }
+ },
+ "node_modules/iconv-lite": {
+ "version": "0.7.2",
+ "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.7.2.tgz",
+ "integrity": "sha512-im9DjEDQ55s9fL4EYzOAv0yMqmMBSZp6G0VvFyTMPKWxiSBHUj9NW/qqLmXUwXrrM7AvqSlTCfvqRb0cM8yYqw==",
+ "license": "MIT",
+ "dependencies": {
+ "safer-buffer": ">= 2.1.2 < 3.0.0"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/express"
+ }
+ },
+ "node_modules/ieee754": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",
+ "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==",
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/feross"
+ },
+ {
+ "type": "patreon",
+ "url": "https://www.patreon.com/feross"
+ },
+ {
+ "type": "consulting",
+ "url": "https://feross.org/support"
+ }
+ ],
+ "license": "BSD-3-Clause"
+ },
+ "node_modules/inherits": {
+ "version": "2.0.4",
+ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
+ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
+ "license": "ISC"
+ },
+ "node_modules/ini": {
+ "version": "1.3.8",
+ "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz",
+ "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==",
+ "license": "ISC"
+ },
+ "node_modules/ip-address": {
+ "version": "10.2.0",
+ "resolved": "https://registry.npmjs.org/ip-address/-/ip-address-10.2.0.tgz",
+ "integrity": "sha512-/+S6j4E9AHvW9SWMSEY9Xfy66O5PWvVEJ08O0y5JGyEKQpojb0K0GKpz/v5HJ/G0vi3D2sjGK78119oXZeE0qA==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 12"
+ }
+ },
+ "node_modules/ipaddr.js": {
+ "version": "1.9.1",
+ "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz",
+ "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.10"
+ }
+ },
+ "node_modules/is-promise": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-4.0.0.tgz",
+ "integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==",
+ "license": "MIT"
+ },
+ "node_modules/isexe": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
+ "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==",
+ "license": "ISC"
+ },
+ "node_modules/jose": {
+ "version": "6.2.3",
+ "resolved": "https://registry.npmjs.org/jose/-/jose-6.2.3.tgz",
+ "integrity": "sha512-YYVDInQKFJfR/xa3ojUTl8c2KoTwiL1R5Wg9YCydwH0x0B9grbzlg5HC7mMjCtUJjbQ/YnGEZIhI5tCgfTb4Hw==",
+ "license": "MIT",
+ "funding": {
+ "url": "https://github.com/sponsors/panva"
+ }
+ },
+ "node_modules/json-schema-to-ts": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/json-schema-to-ts/-/json-schema-to-ts-3.1.1.tgz",
+ "integrity": "sha512-+DWg8jCJG2TEnpy7kOm/7/AxaYoaRbjVB4LFZLySZlWn8exGs3A4OLJR966cVvU26N7X9TWxl+Jsw7dzAqKT6g==",
+ "license": "MIT",
+ "dependencies": {
+ "@babel/runtime": "^7.18.3",
+ "ts-algebra": "^2.0.0"
+ },
+ "engines": {
+ "node": ">=16"
+ }
+ },
+ "node_modules/json-schema-traverse": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz",
+ "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==",
+ "license": "MIT"
+ },
+ "node_modules/json-schema-typed": {
+ "version": "8.0.2",
+ "resolved": "https://registry.npmjs.org/json-schema-typed/-/json-schema-typed-8.0.2.tgz",
+ "integrity": "sha512-fQhoXdcvc3V28x7C7BMs4P5+kNlgUURe2jmUT1T//oBRMDrqy1QPelJimwZGo7Hg9VPV3EQV5Bnq4hbFy2vetA==",
+ "license": "BSD-2-Clause"
+ },
+ "node_modules/json-stringify-safe": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz",
+ "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==",
+ "license": "ISC"
+ },
+ "node_modules/long": {
+ "version": "5.3.2",
+ "resolved": "https://registry.npmjs.org/long/-/long-5.3.2.tgz",
+ "integrity": "sha512-mNAgZ1GmyNhD7AuqnTG3/VQ26o760+ZYBPKjPvugO8+nLbYfX6TVpJPseBvopbdY+qpZ/lKUnmEc1LeZYS3QAA==",
+ "license": "Apache-2.0"
+ },
+ "node_modules/matcher": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/matcher/-/matcher-3.0.0.tgz",
+ "integrity": "sha512-OkeDaAZ/bQCxeFAozM55PKcKU0yJMPGifLwV4Qgjitu+5MoAfSQN4lsLJeXZ1b8w0x+/Emda6MZgXS1jvsapng==",
+ "license": "MIT",
+ "dependencies": {
+ "escape-string-regexp": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/math-intrinsics": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz",
+ "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/media-typer": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-1.1.0.tgz",
+ "integrity": "sha512-aisnrDP4GNe06UcKFnV5bfMNPBUw4jsLGaWwWfnH3v02GnBuXX2MCVn5RbrWo0j3pczUilYblq7fQ7Nw2t5XKw==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/merge-descriptors": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-2.0.0.tgz",
+ "integrity": "sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/mime-db": {
+ "version": "1.54.0",
+ "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz",
+ "integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/mime-types": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-3.0.2.tgz",
+ "integrity": "sha512-Lbgzdk0h4juoQ9fCKXW4by0UJqj+nOOrI9MJ1sSj4nI8aI2eo1qmvQEie4VD1glsS250n15LsWsYtCugiStS5A==",
+ "license": "MIT",
+ "dependencies": {
+ "mime-db": "^1.54.0"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/express"
+ }
+ },
+ "node_modules/mimic-response": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz",
+ "integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/minimist": {
+ "version": "1.2.8",
+ "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz",
+ "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==",
+ "license": "MIT",
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/minipass": {
+ "version": "7.1.3",
+ "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.3.tgz",
+ "integrity": "sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A==",
+ "license": "BlueOak-1.0.0",
+ "engines": {
+ "node": ">=16 || 14 >=14.17"
+ }
+ },
+ "node_modules/minizlib": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-3.1.0.tgz",
+ "integrity": "sha512-KZxYo1BUkWD2TVFLr0MQoM8vUUigWD3LlD83a/75BqC+4qE0Hb1Vo5v1FgcfaNXvfXzr+5EhQ6ing/CaBijTlw==",
+ "license": "MIT",
+ "dependencies": {
+ "minipass": "^7.1.2"
+ },
+ "engines": {
+ "node": ">= 18"
+ }
+ },
+ "node_modules/mkdirp-classic": {
+ "version": "0.5.3",
+ "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz",
+ "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==",
+ "license": "MIT"
+ },
+ "node_modules/ms": {
+ "version": "2.1.3",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
+ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
+ "license": "MIT"
+ },
+ "node_modules/napi-build-utils": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/napi-build-utils/-/napi-build-utils-2.0.0.tgz",
+ "integrity": "sha512-GEbrYkbfF7MoNaoh2iGG84Mnf/WZfB0GdGEsM8wz7Expx/LlWf5U8t9nvJKXSp3qr5IsEbK04cBGhol/KwOsWA==",
+ "license": "MIT"
+ },
+ "node_modules/negotiator": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-1.0.0.tgz",
+ "integrity": "sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/node-abi": {
+ "version": "3.93.0",
+ "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.93.0.tgz",
+ "integrity": "sha512-Cu6yUpX5Iavugm8BeX7c0wgU9CvOqfd1yM6A1d2q2ZMjym7GjpASv2GdRcTq3Fx+Sb5OgBkEEpw4VnAbY6Y5RA==",
+ "license": "MIT",
+ "dependencies": {
+ "semver": "^7.3.5"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/object-assign": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
+ "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/object-inspect": {
+ "version": "1.13.4",
+ "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz",
+ "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/object-keys": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz",
+ "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/on-finished": {
+ "version": "2.4.1",
+ "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz",
+ "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==",
+ "license": "MIT",
+ "dependencies": {
+ "ee-first": "1.1.1"
+ },
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/once": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
+ "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==",
+ "license": "ISC",
+ "dependencies": {
+ "wrappy": "1"
+ }
+ },
+ "node_modules/onnxruntime-common": {
+ "version": "1.21.0",
+ "resolved": "https://registry.npmjs.org/onnxruntime-common/-/onnxruntime-common-1.21.0.tgz",
+ "integrity": "sha512-Q632iLLrtCAVOTO65dh2+mNbQir/QNTVBG3h/QdZBpns7mZ0RYbLRBgGABPbpU9351AgYy7SJf1WaeVwMrBFPQ==",
+ "license": "MIT"
+ },
+ "node_modules/onnxruntime-node": {
+ "version": "1.21.0",
+ "resolved": "https://registry.npmjs.org/onnxruntime-node/-/onnxruntime-node-1.21.0.tgz",
+ "integrity": "sha512-NeaCX6WW2L8cRCSqy3bInlo5ojjQqu2fD3D+9W5qb5irwxhEyWKXeH2vZ8W9r6VxaMPUan+4/7NDwZMtouZxEw==",
+ "hasInstallScript": true,
+ "license": "MIT",
+ "os": [
+ "win32",
+ "darwin",
+ "linux"
+ ],
+ "dependencies": {
+ "global-agent": "^3.0.0",
+ "onnxruntime-common": "1.21.0",
+ "tar": "^7.0.1"
+ }
+ },
+ "node_modules/onnxruntime-web": {
+ "version": "1.22.0-dev.20250409-89f8206ba4",
+ "resolved": "https://registry.npmjs.org/onnxruntime-web/-/onnxruntime-web-1.22.0-dev.20250409-89f8206ba4.tgz",
+ "integrity": "sha512-0uS76OPgH0hWCPrFKlL8kYVV7ckM7t/36HfbgoFw6Nd0CZVVbQC4PkrR8mBX8LtNUFZO25IQBqV2Hx2ho3FlbQ==",
+ "license": "MIT",
+ "dependencies": {
+ "flatbuffers": "^25.1.24",
+ "guid-typescript": "^1.0.9",
+ "long": "^5.2.3",
+ "onnxruntime-common": "1.22.0-dev.20250409-89f8206ba4",
+ "platform": "^1.3.6",
+ "protobufjs": "^7.2.4"
+ }
+ },
+ "node_modules/onnxruntime-web/node_modules/onnxruntime-common": {
+ "version": "1.22.0-dev.20250409-89f8206ba4",
+ "resolved": "https://registry.npmjs.org/onnxruntime-common/-/onnxruntime-common-1.22.0-dev.20250409-89f8206ba4.tgz",
+ "integrity": "sha512-vDJMkfCfb0b1A836rgHj+ORuZf4B4+cc2bASQtpeoJLueuFc5DuYwjIZUBrSvx/fO5IrLjLz+oTrB3pcGlhovQ==",
+ "license": "MIT"
+ },
+ "node_modules/openai": {
+ "version": "6.45.0",
+ "resolved": "https://registry.npmjs.org/openai/-/openai-6.45.0.tgz",
+ "integrity": "sha512-5DQVNErssk0afNpTTHUm/qZPU4iKR9OYdNid8Ib4puq4gHNNvGWZht2zY4h9a8JMF949Ik6m8gQutllVPbjdnw==",
+ "license": "Apache-2.0",
+ "peerDependencies": {
+ "@aws-sdk/credential-provider-node": ">=3.972.0 <4",
+ "@smithy/hash-node": ">=4.3.0 <5",
+ "@smithy/signature-v4": ">=5.4.0 <6",
+ "ws": "^8.18.0",
+ "zod": "^3.25 || ^4.0"
+ },
+ "peerDependenciesMeta": {
+ "@aws-sdk/credential-provider-node": {
+ "optional": true
+ },
+ "@smithy/hash-node": {
+ "optional": true
+ },
+ "@smithy/signature-v4": {
+ "optional": true
+ },
+ "ws": {
+ "optional": true
+ },
+ "zod": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/parseurl": {
+ "version": "1.3.3",
+ "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
+ "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/path-key": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz",
+ "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/path-to-regexp": {
+ "version": "8.4.2",
+ "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-8.4.2.tgz",
+ "integrity": "sha512-qRcuIdP69NPm4qbACK+aDogI5CBDMi1jKe0ry5rSQJz8JVLsC7jV8XpiJjGRLLol3N+R5ihGYcrPLTno6pAdBA==",
+ "license": "MIT",
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/express"
+ }
+ },
+ "node_modules/pkce-challenge": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/pkce-challenge/-/pkce-challenge-5.0.1.tgz",
+ "integrity": "sha512-wQ0b/W4Fr01qtpHlqSqspcj3EhBvimsdh0KlHhH8HRZnMsEa0ea2fTULOXOS9ccQr3om+GcGRk4e+isrZWV8qQ==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=16.20.0"
+ }
+ },
+ "node_modules/platform": {
+ "version": "1.3.6",
+ "resolved": "https://registry.npmjs.org/platform/-/platform-1.3.6.tgz",
+ "integrity": "sha512-fnWVljUchTro6RiCFvCXBbNhJc2NijN7oIQxbwsyL0buWJPG85v81ehlHI9fXrJsMNgTofEoWIQeClKpgxFLrg==",
+ "license": "MIT"
+ },
+ "node_modules/prebuild-install": {
+ "version": "7.1.3",
+ "resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-7.1.3.tgz",
+ "integrity": "sha512-8Mf2cbV7x1cXPUILADGI3wuhfqWvtiLA1iclTDbFRZkgRQS0NqsPZphna9V+HyTEadheuPmjaJMsbzKQFOzLug==",
+ "deprecated": "No longer maintained. Please contact the author of the relevant native addon; alternatives are available.",
+ "license": "MIT",
+ "dependencies": {
+ "detect-libc": "^2.0.0",
+ "expand-template": "^2.0.3",
+ "github-from-package": "0.0.0",
+ "minimist": "^1.2.3",
+ "mkdirp-classic": "^0.5.3",
+ "napi-build-utils": "^2.0.0",
+ "node-abi": "^3.3.0",
+ "pump": "^3.0.0",
+ "rc": "^1.2.7",
+ "simple-get": "^4.0.0",
+ "tar-fs": "^2.0.0",
+ "tunnel-agent": "^0.6.0"
+ },
+ "bin": {
+ "prebuild-install": "bin.js"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/protobufjs": {
+ "version": "7.6.4",
+ "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.6.4.tgz",
+ "integrity": "sha512-RJJPTTpvFfHcWLkIa2JFWK4XvtSzS0yEWDmunqHXli1h3JlkbcQZXDZdcWxv+JK3Xsl5/UFDPZ0iGm7DAengYw==",
+ "hasInstallScript": true,
+ "license": "BSD-3-Clause",
+ "dependencies": {
+ "@protobufjs/aspromise": "^1.1.2",
+ "@protobufjs/base64": "^1.1.2",
+ "@protobufjs/codegen": "^2.0.5",
+ "@protobufjs/eventemitter": "^1.1.1",
+ "@protobufjs/fetch": "^1.1.1",
+ "@protobufjs/float": "^1.0.2",
+ "@protobufjs/path": "^1.1.2",
+ "@protobufjs/pool": "^1.1.0",
+ "@protobufjs/utf8": "^1.1.1",
+ "@types/node": ">=13.7.0",
+ "long": "^5.3.2"
+ },
+ "engines": {
+ "node": ">=12.0.0"
+ }
+ },
+ "node_modules/proxy-addr": {
+ "version": "2.0.7",
+ "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz",
+ "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==",
+ "license": "MIT",
+ "dependencies": {
+ "forwarded": "0.2.0",
+ "ipaddr.js": "1.9.1"
+ },
+ "engines": {
+ "node": ">= 0.10"
+ }
+ },
+ "node_modules/pump": {
+ "version": "3.0.4",
+ "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.4.tgz",
+ "integrity": "sha512-VS7sjc6KR7e1ukRFhQSY5LM2uBWAUPiOPa/A3mkKmiMwSmRFUITt0xuj+/lesgnCv+dPIEYlkzrcyXgquIHMcA==",
+ "license": "MIT",
+ "dependencies": {
+ "end-of-stream": "^1.1.0",
+ "once": "^1.3.1"
+ }
+ },
+ "node_modules/qs": {
+ "version": "6.15.3",
+ "resolved": "https://registry.npmjs.org/qs/-/qs-6.15.3.tgz",
+ "integrity": "sha512-O9gl3zCl5h5blw1KGUzQKhA5oUXSl8rwUIM5o0S3nCXMliSvy5Dzx7/DJcI+SwgICv+IneSZwhBh1oSyEHA71A==",
+ "license": "BSD-3-Clause",
+ "dependencies": {
+ "es-define-property": "^1.0.1",
+ "side-channel": "^1.1.1"
+ },
+ "engines": {
+ "node": ">=0.6"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/range-parser": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.3.0.tgz",
+ "integrity": "sha512-hek2mFQpPuI4E1BBKrSto+BU3e3x4xuarsbiwr3+lf7p44juvFMV0XFWQAP3xUyqXA4RrXLIoaSUGbSt056ZMw==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/express"
+ }
+ },
+ "node_modules/raw-body": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-3.0.2.tgz",
+ "integrity": "sha512-K5zQjDllxWkf7Z5xJdV0/B0WTNqx6vxG70zJE4N0kBs4LovmEYWJzQGxC9bS9RAKu3bgM40lrd5zoLJ12MQ5BA==",
+ "license": "MIT",
+ "dependencies": {
+ "bytes": "~3.1.2",
+ "http-errors": "~2.0.1",
+ "iconv-lite": "~0.7.0",
+ "unpipe": "~1.0.0"
+ },
+ "engines": {
+ "node": ">= 0.10"
+ }
+ },
+ "node_modules/rc": {
+ "version": "1.2.8",
+ "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz",
+ "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==",
+ "license": "(BSD-2-Clause OR MIT OR Apache-2.0)",
+ "dependencies": {
+ "deep-extend": "^0.6.0",
+ "ini": "~1.3.0",
+ "minimist": "^1.2.0",
+ "strip-json-comments": "~2.0.1"
+ },
+ "bin": {
+ "rc": "cli.js"
+ }
+ },
+ "node_modules/readable-stream": {
+ "version": "3.6.2",
+ "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz",
+ "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==",
+ "license": "MIT",
+ "dependencies": {
+ "inherits": "^2.0.3",
+ "string_decoder": "^1.1.1",
+ "util-deprecate": "^1.0.1"
+ },
+ "engines": {
+ "node": ">= 6"
+ }
+ },
+ "node_modules/require-from-string": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz",
+ "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/roarr": {
+ "version": "2.15.4",
+ "resolved": "https://registry.npmjs.org/roarr/-/roarr-2.15.4.tgz",
+ "integrity": "sha512-CHhPh+UNHD2GTXNYhPWLnU8ONHdI+5DI+4EYIAOaiD63rHeYlZvyh8P+in5999TTSFgUYuKUAjzRI4mdh/p+2A==",
+ "license": "BSD-3-Clause",
+ "dependencies": {
+ "boolean": "^3.0.1",
+ "detect-node": "^2.0.4",
+ "globalthis": "^1.0.1",
+ "json-stringify-safe": "^5.0.1",
+ "semver-compare": "^1.0.0",
+ "sprintf-js": "^1.1.2"
+ },
+ "engines": {
+ "node": ">=8.0"
+ }
+ },
+ "node_modules/router": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/router/-/router-2.2.0.tgz",
+ "integrity": "sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ==",
+ "license": "MIT",
+ "dependencies": {
+ "debug": "^4.4.0",
+ "depd": "^2.0.0",
+ "is-promise": "^4.0.0",
+ "parseurl": "^1.3.3",
+ "path-to-regexp": "^8.0.0"
+ },
+ "engines": {
+ "node": ">= 18"
+ }
+ },
+ "node_modules/safe-buffer": {
+ "version": "5.2.1",
+ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
+ "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/feross"
+ },
+ {
+ "type": "patreon",
+ "url": "https://www.patreon.com/feross"
+ },
+ {
+ "type": "consulting",
+ "url": "https://feross.org/support"
+ }
+ ],
+ "license": "MIT"
+ },
+ "node_modules/safer-buffer": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
+ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
+ "license": "MIT"
+ },
+ "node_modules/semver": {
+ "version": "7.8.5",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.5.tgz",
+ "integrity": "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==",
+ "license": "ISC",
+ "bin": {
+ "semver": "bin/semver.js"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/semver-compare": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/semver-compare/-/semver-compare-1.0.0.tgz",
+ "integrity": "sha512-YM3/ITh2MJ5MtzaM429anh+x2jiLVjqILF4m4oyQB18W7Ggea7BfqdH/wGMK7dDiMghv/6WG7znWMwUDzJiXow==",
+ "license": "MIT"
+ },
+ "node_modules/send": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/send/-/send-1.2.1.tgz",
+ "integrity": "sha512-1gnZf7DFcoIcajTjTwjwuDjzuz4PPcY2StKPlsGAQ1+YH20IRVrBaXSWmdjowTJ6u8Rc01PoYOGHXfP1mYcZNQ==",
+ "license": "MIT",
+ "dependencies": {
+ "debug": "^4.4.3",
+ "encodeurl": "^2.0.0",
+ "escape-html": "^1.0.3",
+ "etag": "^1.8.1",
+ "fresh": "^2.0.0",
+ "http-errors": "^2.0.1",
+ "mime-types": "^3.0.2",
+ "ms": "^2.1.3",
+ "on-finished": "^2.4.1",
+ "range-parser": "^1.2.1",
+ "statuses": "^2.0.2"
+ },
+ "engines": {
+ "node": ">= 18"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/express"
+ }
+ },
+ "node_modules/serialize-error": {
+ "version": "7.0.1",
+ "resolved": "https://registry.npmjs.org/serialize-error/-/serialize-error-7.0.1.tgz",
+ "integrity": "sha512-8I8TjW5KMOKsZQTvoxjuSIa7foAwPWGOts+6o7sgjz41/qMD9VQHEDxi6PBvK2l0MXUmqZyNpUK+T2tQaaElvw==",
+ "license": "MIT",
+ "dependencies": {
+ "type-fest": "^0.13.1"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/serve-static": {
+ "version": "2.2.1",
+ "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-2.2.1.tgz",
+ "integrity": "sha512-xRXBn0pPqQTVQiC8wyQrKs2MOlX24zQ0POGaj0kultvoOCstBQM5yvOhAVSUwOMjQtTvsPWoNCHfPGwaaQJhTw==",
+ "license": "MIT",
+ "dependencies": {
+ "encodeurl": "^2.0.0",
+ "escape-html": "^1.0.3",
+ "parseurl": "^1.3.3",
+ "send": "^1.2.0"
+ },
+ "engines": {
+ "node": ">= 18"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/express"
+ }
+ },
+ "node_modules/setprototypeof": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",
+ "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==",
+ "license": "ISC"
+ },
+ "node_modules/sharp": {
+ "version": "0.34.5",
+ "resolved": "https://registry.npmjs.org/sharp/-/sharp-0.34.5.tgz",
+ "integrity": "sha512-Ou9I5Ft9WNcCbXrU9cMgPBcCK8LiwLqcbywW3t4oDV37n1pzpuNLsYiAV8eODnjbtQlSDwZ2cUEeQz4E54Hltg==",
+ "hasInstallScript": true,
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@img/colour": "^1.0.0",
+ "detect-libc": "^2.1.2",
+ "semver": "^7.7.3"
+ },
+ "engines": {
+ "node": "^18.17.0 || ^20.3.0 || >=21.0.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ },
+ "optionalDependencies": {
+ "@img/sharp-darwin-arm64": "0.34.5",
+ "@img/sharp-darwin-x64": "0.34.5",
+ "@img/sharp-libvips-darwin-arm64": "1.2.4",
+ "@img/sharp-libvips-darwin-x64": "1.2.4",
+ "@img/sharp-libvips-linux-arm": "1.2.4",
+ "@img/sharp-libvips-linux-arm64": "1.2.4",
+ "@img/sharp-libvips-linux-ppc64": "1.2.4",
+ "@img/sharp-libvips-linux-riscv64": "1.2.4",
+ "@img/sharp-libvips-linux-s390x": "1.2.4",
+ "@img/sharp-libvips-linux-x64": "1.2.4",
+ "@img/sharp-libvips-linuxmusl-arm64": "1.2.4",
+ "@img/sharp-libvips-linuxmusl-x64": "1.2.4",
+ "@img/sharp-linux-arm": "0.34.5",
+ "@img/sharp-linux-arm64": "0.34.5",
+ "@img/sharp-linux-ppc64": "0.34.5",
+ "@img/sharp-linux-riscv64": "0.34.5",
+ "@img/sharp-linux-s390x": "0.34.5",
+ "@img/sharp-linux-x64": "0.34.5",
+ "@img/sharp-linuxmusl-arm64": "0.34.5",
+ "@img/sharp-linuxmusl-x64": "0.34.5",
+ "@img/sharp-wasm32": "0.34.5",
+ "@img/sharp-win32-arm64": "0.34.5",
+ "@img/sharp-win32-ia32": "0.34.5",
+ "@img/sharp-win32-x64": "0.34.5"
+ }
+ },
+ "node_modules/shebang-command": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
+ "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==",
+ "license": "MIT",
+ "dependencies": {
+ "shebang-regex": "^3.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/shebang-regex": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz",
+ "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/side-channel": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.1.tgz",
+ "integrity": "sha512-6x6dK6zJdpTzF4sQeNYxwtvBzf6Eg4GtlesS94HOvTudUeyK2WXAaIfmDgsyslYrRBeFIlsi54AYsFGUuhmvrQ==",
+ "license": "MIT",
+ "dependencies": {
+ "es-errors": "^1.3.0",
+ "object-inspect": "^1.13.4",
+ "side-channel-list": "^1.0.1",
+ "side-channel-map": "^1.0.1",
+ "side-channel-weakmap": "^1.0.2"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/side-channel-list": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.1.tgz",
+ "integrity": "sha512-mjn/0bi/oUURjc5Xl7IaWi/OJJJumuoJFQJfDDyO46+hBWsfaVM65TBHq2eoZBhzl9EchxOijpkbRC8SVBQU0w==",
+ "license": "MIT",
+ "dependencies": {
+ "es-errors": "^1.3.0",
+ "object-inspect": "^1.13.4"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/side-channel-map": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz",
+ "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==",
+ "license": "MIT",
+ "dependencies": {
+ "call-bound": "^1.0.2",
+ "es-errors": "^1.3.0",
+ "get-intrinsic": "^1.2.5",
+ "object-inspect": "^1.13.3"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/side-channel-weakmap": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz",
+ "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==",
+ "license": "MIT",
+ "dependencies": {
+ "call-bound": "^1.0.2",
+ "es-errors": "^1.3.0",
+ "get-intrinsic": "^1.2.5",
+ "object-inspect": "^1.13.3",
+ "side-channel-map": "^1.0.1"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/simple-concat": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz",
+ "integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==",
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/feross"
+ },
+ {
+ "type": "patreon",
+ "url": "https://www.patreon.com/feross"
+ },
+ {
+ "type": "consulting",
+ "url": "https://feross.org/support"
+ }
+ ],
+ "license": "MIT"
+ },
+ "node_modules/simple-get": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-4.0.1.tgz",
+ "integrity": "sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA==",
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/feross"
+ },
+ {
+ "type": "patreon",
+ "url": "https://www.patreon.com/feross"
+ },
+ {
+ "type": "consulting",
+ "url": "https://feross.org/support"
+ }
+ ],
+ "license": "MIT",
+ "dependencies": {
+ "decompress-response": "^6.0.0",
+ "once": "^1.3.1",
+ "simple-concat": "^1.0.0"
+ }
+ },
+ "node_modules/sprintf-js": {
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.3.tgz",
+ "integrity": "sha512-Oo+0REFV59/rz3gfJNKQiBlwfHaSESl1pcGyABQsnnIfWOFt6JNj5gCog2U6MLZ//IGYD+nA8nI+mTShREReaA==",
+ "license": "BSD-3-Clause"
+ },
+ "node_modules/standardwebhooks": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/standardwebhooks/-/standardwebhooks-1.0.0.tgz",
+ "integrity": "sha512-BbHGOQK9olHPMvQNHWul6MYlrRTAOKn03rOe4A8O3CLWhNf4YHBqq2HJKKC+sfqpxiBY52pNeesD6jIiLDz8jg==",
+ "license": "MIT",
+ "dependencies": {
+ "@stablelib/base64": "^1.0.0",
+ "fast-sha256": "^1.3.0"
+ }
+ },
+ "node_modules/statuses": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz",
+ "integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/string_decoder": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
+ "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
+ "license": "MIT",
+ "dependencies": {
+ "safe-buffer": "~5.2.0"
+ }
+ },
+ "node_modules/strip-json-comments": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz",
+ "integrity": "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/tar": {
+ "version": "7.5.19",
+ "resolved": "https://registry.npmjs.org/tar/-/tar-7.5.19.tgz",
+ "integrity": "sha512-4LeEWl96twnS2Q7Bz4MGqgazLqO+hJN63GZxXoIqh1T3VweYD997gbU1ItNsQafqqXTXd5WFyFdReLtwvRBNiw==",
+ "license": "BlueOak-1.0.0",
+ "dependencies": {
+ "@isaacs/fs-minipass": "^4.0.0",
+ "chownr": "^3.0.0",
+ "minipass": "^7.1.2",
+ "minizlib": "^3.1.0",
+ "yallist": "^5.0.0"
+ },
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/tar-fs": {
+ "version": "2.1.5",
+ "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.5.tgz",
+ "integrity": "sha512-OboTd8mmMhZDNPV+UjQcK9yKAatXu2aJ+r1w4im1Otd4M4fl2hwvdoXUxIYHFTHWK/3y3FarBP70v3vwmGlOxw==",
+ "license": "MIT",
+ "dependencies": {
+ "chownr": "^1.1.1",
+ "mkdirp-classic": "^0.5.2",
+ "pump": "^3.0.0",
+ "tar-stream": "^2.1.4"
+ }
+ },
+ "node_modules/tar-stream": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz",
+ "integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==",
+ "license": "MIT",
+ "dependencies": {
+ "bl": "^4.0.3",
+ "end-of-stream": "^1.4.1",
+ "fs-constants": "^1.0.0",
+ "inherits": "^2.0.3",
+ "readable-stream": "^3.1.1"
+ },
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/tar/node_modules/chownr": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/chownr/-/chownr-3.0.0.tgz",
+ "integrity": "sha512-+IxzY9BZOQd/XuYPRmrvEVjF/nqj5kgT4kEq7VofrDoM1MxoRjEWkrCC3EtLi59TVawxTAn+orJwFQcrqEN1+g==",
+ "license": "BlueOak-1.0.0",
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/toidentifier": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
+ "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.6"
+ }
+ },
+ "node_modules/ts-algebra": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/ts-algebra/-/ts-algebra-2.0.0.tgz",
+ "integrity": "sha512-FPAhNPFMrkwz76P7cdjdmiShwMynZYN6SgOujD1urY4oNm80Ou9oMdmbR45LotcKOXoy7wSmHkRFE6Mxbrhefw==",
+ "license": "MIT"
+ },
+ "node_modules/tslib": {
+ "version": "2.8.1",
+ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",
+ "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",
+ "license": "0BSD",
+ "optional": true
+ },
+ "node_modules/tsx": {
+ "version": "4.22.4",
+ "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.22.4.tgz",
+ "integrity": "sha512-X8EX+XV4QR5xCsrgxaED954zTDfY8KqlDtskKEL0cHhyS/P8b4IFOvGDQpsC9Q1XnLq915wEfwwY/zzskCtmhg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "esbuild": "~0.28.0"
+ },
+ "bin": {
+ "tsx": "dist/cli.mjs"
+ },
+ "engines": {
+ "node": ">=18.0.0"
+ },
+ "optionalDependencies": {
+ "fsevents": "~2.3.3"
+ }
+ },
+ "node_modules/tunnel-agent": {
+ "version": "0.6.0",
+ "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",
+ "integrity": "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "safe-buffer": "^5.0.1"
+ },
+ "engines": {
+ "node": "*"
+ }
+ },
+ "node_modules/type-fest": {
+ "version": "0.13.1",
+ "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.13.1.tgz",
+ "integrity": "sha512-34R7HTnG0XIJcBSn5XhDd7nNFPRcXYRZrBB2O2jdKqYODldSzBAqzsWoZYYvduky73toYS/ESqxPvkDf/F0XMg==",
+ "license": "(MIT OR CC0-1.0)",
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/type-is": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/type-is/-/type-is-2.1.0.tgz",
+ "integrity": "sha512-faYHw0anBbc/kWF3zFTEnxSFOAGUX9GFbOBthvDdLsIlEoWOFOtS0zgCiQYwIskL9iGXZL3kAXD8OoZ4GmMATA==",
+ "license": "MIT",
+ "dependencies": {
+ "content-type": "^2.0.0",
+ "media-typer": "^1.1.0",
+ "mime-types": "^3.0.0"
+ },
+ "engines": {
+ "node": ">= 18"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/express"
+ }
+ },
+ "node_modules/type-is/node_modules/content-type": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/content-type/-/content-type-2.0.0.tgz",
+ "integrity": "sha512-j/O/d7GcZCyNl7/hwZAb606rzqkyvaDctLmckbxLzHvFBzTJHuGEdodATcP3yIRoDrLHkIATJuvzbFlp/ki2cQ==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/express"
+ }
+ },
+ "node_modules/typescript": {
+ "version": "6.0.3",
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-6.0.3.tgz",
+ "integrity": "sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "bin": {
+ "tsc": "bin/tsc",
+ "tsserver": "bin/tsserver"
+ },
+ "engines": {
+ "node": ">=14.17"
+ }
+ },
+ "node_modules/undici-types": {
+ "version": "8.3.0",
+ "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-8.3.0.tgz",
+ "integrity": "sha512-j375ScV60dom+YkPFIfTLcOiPxkN/buHz5GobjLhixFuANaNs3C9l4GmrWqejgXWJ7BbJcFYpTEUkS1Ge8bpZQ==",
+ "license": "MIT"
+ },
+ "node_modules/unpipe": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
+ "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/util-deprecate": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
+ "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==",
+ "license": "MIT"
+ },
+ "node_modules/vary": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
+ "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/which": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
+ "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
+ "license": "ISC",
+ "dependencies": {
+ "isexe": "^2.0.0"
+ },
+ "bin": {
+ "node-which": "bin/node-which"
+ },
+ "engines": {
+ "node": ">= 8"
+ }
+ },
+ "node_modules/wrappy": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
+ "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==",
+ "license": "ISC"
+ },
+ "node_modules/yallist": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/yallist/-/yallist-5.0.0.tgz",
+ "integrity": "sha512-YgvUTfwqyc7UXVMrB+SImsVYSmTS8X/tSrtdNZMImM+n7+QTriRXyXim0mBrTXNeqzVF0KWGgHPeiyViFFrNDw==",
+ "license": "BlueOak-1.0.0",
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/zod": {
+ "version": "4.4.3",
+ "resolved": "https://registry.npmjs.org/zod/-/zod-4.4.3.tgz",
+ "integrity": "sha512-ytENFjIJFl2UwYglde2jchW2Hwm4GJFLDiSXWdTrJQBIN9Fcyp7n4DhxJEiWNAJMV1/BqWfW/kkg71UDcHJyTQ==",
+ "license": "MIT",
+ "funding": {
+ "url": "https://github.com/sponsors/colinhacks"
+ }
+ },
+ "node_modules/zod-to-json-schema": {
+ "version": "3.25.2",
+ "resolved": "https://registry.npmjs.org/zod-to-json-schema/-/zod-to-json-schema-3.25.2.tgz",
+ "integrity": "sha512-O/PgfnpT1xKSDeQYSCfRI5Gy3hPf91mKVDuYLUHZJMiDFptvP41MSnWofm8dnCm0256ZNfZIM7DSzuSMAFnjHA==",
+ "license": "ISC",
+ "peerDependencies": {
+ "zod": "^3.25.28 || ^4"
+ }
+ }
+ }
+}
diff --git a/package.json b/package.json
new file mode 100644
index 00000000..b94b1119
--- /dev/null
+++ b/package.json
@@ -0,0 +1,61 @@
+{
+ "name": "context-graph-engine",
+ "version": "0.1.0",
+ "description": "An open-source engine that turns docs into a structured context graph that AI agents read from and contribute learnings back to.",
+ "keywords": [
+ "ai",
+ "agents",
+ "knowledge-graph",
+ "context",
+ "memory",
+ "rag",
+ "mcp",
+ "llm"
+ ],
+ "license": "MIT",
+ "type": "module",
+ "main": "./dist/index.js",
+ "types": "./dist/index.d.ts",
+ "exports": {
+ ".": {
+ "types": "./dist/index.d.ts",
+ "import": "./dist/index.js"
+ }
+ },
+ "bin": {
+ "context-graph": "./dist/cli.js",
+ "context-graph-mcp": "./dist/mcp.js"
+ },
+ "files": [
+ "dist",
+ "README.md",
+ "LICENSE"
+ ],
+ "scripts": {
+ "build": "tsc -p tsconfig.json",
+ "dev": "tsc -p tsconfig.json --watch",
+ "cli": "tsx src/cli.ts",
+ "mcp": "tsx src/mcp.ts",
+ "example": "tsx examples/quickstart.ts",
+ "prepublishOnly": "npm run build"
+ },
+ "engines": {
+ "node": ">=20"
+ },
+ "dependencies": {
+ "@anthropic-ai/sdk": "^0.109.1",
+ "@huggingface/transformers": "^3.8.1",
+ "@modelcontextprotocol/sdk": "^1.29.0",
+ "better-sqlite3": "^12.11.1",
+ "commander": "^15.0.0",
+ "dotenv": "^17.4.2",
+ "openai": "^6.45.0",
+ "zod": "^4.4.3"
+ },
+ "devDependencies": {
+ "@types/better-sqlite3": "^7.6.13",
+ "@types/node": "^26.1.0",
+ "tsx": "^4.22.4",
+ "typescript": "^6.0.3"
+ }
+}
diff --git a/src/ai/anthropic.ts b/src/ai/anthropic.ts
new file mode 100644
index 00000000..d200c7e6
--- /dev/null
+++ b/src/ai/anthropic.ts
@@ -0,0 +1,111 @@
+import Anthropic from "@anthropic-ai/sdk";
+import type { Extractor } from "./providers.js";
+import type { Extraction } from "../graph/types.js";
+
+const EXTRACTION_TOOL: Anthropic.Tool = {
+ name: "record_graph",
+ description:
+ "Record the entities and relationships extracted from the text as a knowledge graph.",
+ input_schema: {
+ type: "object",
+ properties: {
+ entities: {
+ type: "array",
+ description: "Distinct real-world entities or concepts mentioned in the text.",
+ items: {
+ type: "object",
+ properties: {
+ name: { type: "string", description: "Canonical, specific name of the entity." },
+ type: {
+ type: "string",
+ description:
+ "Coarse category, lowercase, e.g. concept, system, service, api, person, org, policy, tool, event, metric.",
+ },
+ summary: {
+ type: "string",
+ description:
+ "One or two sentences describing the entity, grounded in the text.",
+ },
+ aliases: {
+ type: "array",
+ items: { type: "string" },
+ description: "Alternate names/abbreviations used for this entity.",
+ },
+ },
+ required: ["name", "type", "summary"],
+ },
+ },
+ relations: {
+ type: "array",
+ description: "Directed relationships between the extracted entities.",
+ items: {
+ type: "object",
+ properties: {
+ source: { type: "string", description: "Name of the source entity." },
+ target: { type: "string", description: "Name of the target entity." },
+ relation: {
+ type: "string",
+ description:
+ "Predicate in snake_case, e.g. depends_on, part_of, authenticates_with, produces, owns, replaces.",
+ },
+ description: {
+ type: "string",
+ description: "Short explanation of the relationship.",
+ },
+ },
+ required: ["source", "target", "relation"],
+ },
+ },
+ },
+ required: ["entities", "relations"],
+ },
+};
+
+const SYSTEM_PROMPT = `You are a knowledge-graph extraction engine. Given a passage of text, identify the salient entities/concepts and the relationships between them.
+
+Rules:
+- Prefer specific, canonical entity names over pronouns or vague phrases.
+- Only include relationships where BOTH endpoints are in your entities list.
+- Deduplicate: merge obvious surface-form variants into one entity with aliases.
+- Do not invent facts that are not supported by the text.
+- Keep summaries concise and factual.
+Always respond by calling the record_graph tool.`;
+
+/** Entity/relationship extractor backed by Claude (Anthropic). */
+export class AnthropicExtractor implements Extractor {
+ private client: Anthropic;
+ private model: string;
+
+ constructor(apiKey: string, model: string) {
+ this.client = new Anthropic({ apiKey });
+ this.model = model;
+ }
+
+ async extract(text: string, opts?: { hint?: string }): Promise<Extraction> {
+ const userContent = opts?.hint
+ ? `Context hint: ${opts.hint}\n\nText:\n${text}`
+ : `Text:\n${text}`;
+
+ const response = await this.client.messages.create({
+ model: this.model,
+ max_tokens: 4096,
+ system: SYSTEM_PROMPT,
+ tools: [EXTRACTION_TOOL],
+ tool_choice: { type: "tool", name: "record_graph" },
+ messages: [{ role: "user", content: userContent }],
+ });
+
+ const toolUse = response.content.find(
+ (block): block is Anthropic.ToolUseBlock => block.type === "tool_use",
+ );
+ if (!toolUse) return { entities: [], relations: [] };
+
+ const input = toolUse.input as Partial<Extraction>;
+ return {
+ entities: (input.entities ?? []).filter((e) => e && e.name && e.type),
+ relations: (input.relations ?? []).filter(
+ (r) => r && r.source && r.target && r.relation,
+ ),
+ };
+ }
+}
diff --git a/src/ai/local.ts b/src/ai/local.ts
new file mode 100644
index 00000000..adc866ee
--- /dev/null
+++ b/src/ai/local.ts
@@ -0,0 +1,180 @@
+/**
+ * Local, key-free providers so the engine runs entirely on the user's machine.
+ *
+ * - {@link LocalEmbedder} embeds text in-process with a small ONNX model via
+ * transformers.js — no server, no API key, models cached to disk on first use.
+ * - {@link OllamaExtractor} extracts entities/relationships from a locally
+ * running Ollama (https://ollama.com) using its structured-output support.
+ *
+ * These are what the engine falls back to when no cloud API keys are present,
+ * making `curl | sh` → "just works" possible without any accounts.
+ */
+import type { Embedder, Extractor } from "./providers.js";
+import type { Extraction } from "../graph/types.js";
+
+/** Output dimensionality for known local embedding models. */
+const LOCAL_MODEL_DIMENSIONS: Record<string, number> = {
+ "Xenova/all-MiniLM-L6-v2": 384,
+ "Xenova/all-MiniLM-L12-v2": 384,
+ "Xenova/bge-small-en-v1.5": 384,
+ "Xenova/bge-base-en-v1.5": 768,
+ "Xenova/gte-small": 384,
+};
+
+// transformers.js is loaded lazily so importing the engine never pays the cost
+// (or the native onnxruntime dependency) unless local embeddings are used.
+type FeaturePipeline = (
+ texts: string[],
+ opts: { pooling: "mean"; normalize: boolean },
+) => Promise<{ tolist(): number[][] }>;
+
+/**
+ * Embedder that runs a sentence-transformer model in-process via transformers.js.
+ * The model is downloaded once and cached under the transformers.js cache dir.
+ */
+export class LocalEmbedder implements Embedder {
+ readonly dimensions: number;
+ private model: string;
+ private pipe?: Promise<FeaturePipeline>;
+
+ constructor(model = "Xenova/all-MiniLM-L6-v2") {
+ this.model = model;
+ this.dimensions = LOCAL_MODEL_DIMENSIONS[model] ?? 384;
+ }
+
+ private load(): Promise<FeaturePipeline> {
+ if (!this.pipe) {
+ this.pipe = import("@huggingface/transformers").then(({ pipeline, env }) => {
+ // Keep console noise down; models still download+cache on first use.
+ env.allowRemoteModels = true;
+ return pipeline("feature-extraction", this.model) as unknown as Promise<FeaturePipeline>;
+ });
+ }
+ return this.pipe;
+ }
+
+ async embed(texts: string[]): Promise<number[][]> {
+ if (texts.length === 0) return [];
+ const pipe = await this.load();
+ // Empty strings produce degenerate vectors; substitute a space.
+ const inputs = texts.map((t) => (t.trim().length === 0 ? " " : t));
+ const out = await pipe(inputs, { pooling: "mean", normalize: true });
+ return out.tolist();
+ }
+}
+
+/** JSON schema describing the extraction output — shared shape with the cloud extractor. */
+const EXTRACTION_SCHEMA = {
+ type: "object",
+ properties: {
+ entities: {
+ type: "array",
+ items: {
+ type: "object",
+ properties: {
+ name: { type: "string" },
+ type: { type: "string" },
+ summary: { type: "string" },
+ aliases: { type: "array", items: { type: "string" } },
+ },
+ required: ["name", "type", "summary"],
+ },
+ },
+ relations: {
+ type: "array",
+ items: {
+ type: "object",
+ properties: {
+ source: { type: "string" },
+ target: { type: "string" },
+ relation: { type: "string" },
+ description: { type: "string" },
+ },
+ required: ["source", "target", "relation"],
+ },
+ },
+ },
+ required: ["entities", "relations"],
+} as const;
+
+const SYSTEM_PROMPT = `You are a knowledge-graph extraction engine. Given a passage of text, identify the salient entities/concepts and the relationships between them.
+
+Rules:
+- Prefer specific, canonical entity names over pronouns or vague phrases.
+- Use coarse lowercase entity types, e.g. concept, system, service, api, person, org, policy, tool, event, metric.
+- Use snake_case relation predicates, e.g. depends_on, part_of, authenticates_with, produces, owns, replaces.
+- Only include relationships where BOTH endpoints are in your entities list.
+- Deduplicate obvious surface-form variants into one entity with aliases.
+- Do not invent facts unsupported by the text.
+Respond ONLY with a JSON object matching the schema.`;
+
+/**
+ * Entity/relationship extractor backed by a locally running Ollama instance.
+ * Uses Ollama's structured-output (`format`) support to get schema-valid JSON.
+ */
+export class OllamaExtractor implements Extractor {
+ private baseUrl: string;
+ private model: string;
+
+ constructor(model = "llama3.2", baseUrl = "http://localhost:11434") {
+ this.model = model;
+ this.baseUrl = baseUrl.replace(/\/$/, "");
+ }
+
+ async extract(text: string, opts?: { hint?: string }): Promise<Extraction> {
+ const userContent = opts?.hint
+ ? `Context hint: ${opts.hint}\n\nText:\n${text}`
+ : `Text:\n${text}`;
+
+ let res: Response;
+ try {
+ res = await fetch(`${this.baseUrl}/api/chat`, {
+ method: "POST",
+ headers: { "content-type": "application/json" },
+ body: JSON.stringify({
+ model: this.model,
+ stream: false,
+ format: EXTRACTION_SCHEMA,
+ options: { temperature: 0 },
+ messages: [
+ { role: "system", content: SYSTEM_PROMPT },
+ { role: "user", content: userContent },
+ ],
+ }),
+ });
+ } catch (err) {
+ throw new Error(
+ `Could not reach Ollama at ${this.baseUrl}. Start it (https://ollama.com) and pull a model ` +
+ `(e.g. \`ollama pull ${this.model}\`), or set ANTHROPIC_API_KEY to use cloud extraction. ` +
+ `Underlying error: ${err instanceof Error ? err.message : String(err)}`,
+ );
+ }
+
+ if (!res.ok) {
+ const body = await res.text().catch(() => "");
+ if (res.status === 404) {
+ throw new Error(
+ `Ollama has no model "${this.model}". Run \`ollama pull ${this.model}\`, or set ` +
+ `CONTEXT_GRAPH_OLLAMA_MODEL to a model you have.`,
+ );
+ }
+ throw new Error(`Ollama returned ${res.status}: ${body}`);
+ }
+
+ const data = (await res.json()) as { message?: { content?: string } };
+ const content = data.message?.content ?? "";
+ let parsed: Partial<Extraction>;
+ try {
+ parsed = JSON.parse(content) as Partial<Extraction>;
+ } catch {
+ return { entities: [], relations: [] };
+ }
+
+ return {
+ entities: (parsed.entities ?? []).filter((e) => e && e.name && e.type),
+ relations: (parsed.relations ?? []).filter(
+ (r) => r && r.source && r.target && r.relation,
+ ),
+ };
+ }
+}
diff --git a/src/ai/openai.ts b/src/ai/openai.ts
new file mode 100644
index 00000000..4de40874
--- /dev/null
+++ b/src/ai/openai.ts
@@ -0,0 +1,37 @@
+import OpenAI from "openai";
+import type { Embedder } from "./providers.js";
+
+/** Known output dimensionality for OpenAI embedding models. */
+const MODEL_DIMENSIONS: Record<string, number> = {
+ "text-embedding-3-small": 1536,
+ "text-embedding-3-large": 3072,
+ "text-embedding-ada-002": 1536,
+};
+
+/** Embedder backed by the OpenAI embeddings API. */
+export class OpenAIEmbedder implements Embedder {
+ readonly dimensions: number;
+ private client: OpenAI;
+ private model: string;
+
+ constructor(apiKey: string, model: string) {
+ this.client = new OpenAI({ apiKey });
+ this.model = model;
+ this.dimensions = MODEL_DIMENSIONS[model] ?? 1536;
+ }
+
+ async embed(texts: string[]): Promise<number[][]> {
+ if (texts.length === 0) return [];
+ // The API accepts batches; empty strings are not allowed, so guard them.
+ const inputs = texts.map((t) => (t.trim().length === 0 ? " " : t));
+ const response = await this.client.embeddings.create({
+ model: this.model,
+ input: inputs,
+ });
+ // Responses are returned in input order, but sort by index to be safe.
+ return response.data
+ .slice()
+ .sort((a, b) => a.index - b.index)
+ .map((d) => d.embedding as number[]);
+ }
+}
diff --git a/src/ai/providers.ts b/src/ai/providers.ts
new file mode 100644
index 00000000..5c57bd2b
--- /dev/null
+++ b/src/ai/providers.ts
@@ -0,0 +1,131 @@
+import type { Extraction } from "../graph/types.js";
+import type { GraphStore } from "../graph/store.js";
+
+/** Turns text into embedding vectors for semantic search and dedup. */
+export interface Embedder {
+ /** Vector dimensionality produced by {@link embed}. */
+ readonly dimensions: number;
+ /** Embed a batch of texts, returning one vector per input (order preserved). */
+ embed(texts: string[]): Promise<number[][]>;
+}
+
+/** Extracts entities and relationships from a passage of text. */
+export interface Extractor {
+ extract(text: string, opts?: { hint?: string }): Promise<Extraction>;
+}
+
+/**
+ * User-facing configuration for the engine. Anything omitted falls back to
+ * environment variables and then to sensible defaults.
+ */
+export interface EngineConfig {
+ /** Path to the SQLite graph file. Env: CONTEXT_GRAPH_DB. Default: ./.context-graph/graph.db */
+ dbPath?: string;
+
+ /** Anthropic key for extraction. Env: ANTHROPIC_API_KEY. */
+ anthropicApiKey?: string;
+ /** Extraction model. Env: CONTEXT_GRAPH_EXTRACTION_MODEL. Default: claude-haiku-4-5-20251001 */
+ extractionModel?: string;
+
+ /** OpenAI key for embeddings. Env: OPENAI_API_KEY. */
+ openaiApiKey?: string;
+ /** Embedding model. Env: CONTEXT_GRAPH_EMBEDDING_MODEL. Default: text-embedding-3-small */
+ embeddingModel?: string;
+
+ /**
+ * Force the fully-local providers (in-process embeddings + Ollama extraction)
+ * even when cloud API keys are present. Env: CONTEXT_GRAPH_LOCAL=1.
+ */
+ forceLocal?: boolean;
+ /** Local embedding model (transformers.js). Env: CONTEXT_GRAPH_LOCAL_EMBEDDING_MODEL. Default: Xenova/all-MiniLM-L6-v2 */
+ localEmbeddingModel?: string;
+ /** Ollama model for local extraction. Env: CONTEXT_GRAPH_OLLAMA_MODEL. Default: llama3.2 */
+ ollamaModel?: string;
+ /** Ollama base URL. Env: CONTEXT_GRAPH_OLLAMA_URL. Default: http://localhost:11434 */
+ ollamaBaseUrl?: string;
+
+ /** Target characters per chunk during ingestion. Default: 1200. */
+ chunkSize?: number;
+ /** Character overlap between adjacent chunks. Default: 200. */
+ chunkOverlap?: number;
+
+ /**
+ * Cosine-similarity threshold above which two entities are treated as the
+ * same node and merged. Higher = stricter. Default: 0.86.
+ */
+ mergeThreshold?: number;
+
+ // --- advanced: bring your own components ---
+ /** Override the storage backend (defaults to a SQLite store at dbPath). */
+ store?: GraphStore;
+ /** Override the embedder (defaults to OpenAI). */
+ embedder?: Embedder;
+ /** Override the extractor (defaults to Claude). */
+ extractor?: Extractor;
+}
+
+/** Fully-resolved configuration with all defaults applied. */
+export interface ResolvedConfig {
+ dbPath: string;
+ anthropicApiKey?: string;
+ extractionModel: string;
+ openaiApiKey?: string;
+ embeddingModel: string;
+ forceLocal: boolean;
+ localEmbeddingModel: string;
+ ollamaModel: string;
+ ollamaBaseUrl: string;
+ chunkSize: number;
+ chunkOverlap: number;
+ mergeThreshold: number;
+ store?: GraphStore;
+ embedder?: Embedder;
+ extractor?: Extractor;
+}
+
+export const DEFAULTS = {
+ dbPath: "./.context-graph/graph.db",
+ extractionModel: "claude-haiku-4-5-20251001",
+ embeddingModel: "text-embedding-3-small",
+ localEmbeddingModel: "Xenova/all-MiniLM-L6-v2",
+ ollamaModel: "llama3.2",
+ ollamaBaseUrl: "http://localhost:11434",
+ chunkSize: 1200,
+ chunkOverlap: 200,
+ mergeThreshold: 0.86,
+} as const;
+
+/** Merge user config with environment variables and defaults. */
+export function resolveConfig(config: EngineConfig = {}): ResolvedConfig {
+ const env = process.env;
+ return {
+ dbPath: config.dbPath ?? env.CONTEXT_GRAPH_DB ?? DEFAULTS.dbPath,
+ anthropicApiKey: config.anthropicApiKey ?? env.ANTHROPIC_API_KEY,
+ extractionModel:
+ config.extractionModel ??
+ env.CONTEXT_GRAPH_EXTRACTION_MODEL ??
+ DEFAULTS.extractionModel,
+ openaiApiKey: config.openaiApiKey ?? env.OPENAI_API_KEY,
+ embeddingModel:
+ config.embeddingModel ??
+ env.CONTEXT_GRAPH_EMBEDDING_MODEL ??
+ DEFAULTS.embeddingModel,
+ forceLocal:
+ config.forceLocal ??
+ ["1", "true", "yes"].includes((env.CONTEXT_GRAPH_LOCAL ?? "").toLowerCase()),
+ localEmbeddingModel:
+ config.localEmbeddingModel ??
+ env.CONTEXT_GRAPH_LOCAL_EMBEDDING_MODEL ??
+ DEFAULTS.localEmbeddingModel,
+ ollamaModel:
+ config.ollamaModel ?? env.CONTEXT_GRAPH_OLLAMA_MODEL ?? DEFAULTS.ollamaModel,
+ ollamaBaseUrl:
+ config.ollamaBaseUrl ?? env.CONTEXT_GRAPH_OLLAMA_URL ?? DEFAULTS.ollamaBaseUrl,
+ chunkSize: config.chunkSize ?? DEFAULTS.chunkSize,
+ chunkOverlap: config.chunkOverlap ?? DEFAULTS.chunkOverlap,
+ mergeThreshold: config.mergeThreshold ?? DEFAULTS.mergeThreshold,
+ store: config.store,
+ embedder: config.embedder,
+ extractor: config.extractor,
+ };
+}
diff --git a/src/cli.ts b/src/cli.ts
new file mode 100644
index 00000000..9829eea3
--- /dev/null
+++ b/src/cli.ts
@@ -0,0 +1,126 @@
+#!/usr/bin/env node
+/**
+ * `context-graph` CLI — a thin wrapper over {@link ContextGraphEngine} for use
+ * from the shell. Subcommands mirror the engine's core verbs:
+ *
+ * ingest / ingest-text build the graph from docs
+ * query read the graph for a query (the agent's "read context")
+ * contribute write a learning back into the graph
+ * stats report how much the graph holds
+ *
+ * A `--db <path>` flag (or CONTEXT_GRAPH_DB) selects which graph file to use.
+ */
+import "dotenv/config";
+import { Command } from "commander";
+import { readFileSync } from "node:fs";
+import { ContextGraphEngine } from "./engine.js";
+
+const program = new Command();
+
+program
+ .name("context-graph")
+ .description("Turn docs into a structured context graph that AI agents read from and write back to.")
+ .option("--db <path>", "path to the graph database (overrides CONTEXT_GRAPH_DB)");
+
+function engineFrom(): ContextGraphEngine {
+ const opts = program.opts<{ db?: string }>();
+ return new ContextGraphEngine({ dbPath: opts.db });
+}
+
+program
+ .command("ingest")
+ .description("Ingest one or more files into the graph")
+ .argument("<paths...>", "files to ingest")
+ .option("-t, --title <title>", "title override (single file only)")
+ .action(async (paths: string[], opts: { title?: string }) => {
+ const engine = engineFrom();
+ try {
+ for (const path of paths) {
+ const r = await engine.ingestFile(path, { title: paths.length === 1 ? opts.title : undefined });
+ if (r.skipped) {
+ console.log(`• ${r.title} — already ingested, skipped`);
+ } else {
+ console.log(
+ `✓ ${r.title} — ${r.chunks} chunks, +${r.nodesCreated} nodes (${r.nodesUpdated} reinforced), +${r.edgesCreated} edges (${r.edgesUpdated} reinforced)`,
+ );
+ }
+ }
+ } finally {
+ engine.close();
+ }
+ });
+
+program
+ .command("ingest-text")
+ .description("Ingest text passed as an argument or piped via stdin")
+ .argument("[text]", "text to ingest (or pipe via stdin)")
+ .option("-t, --title <title>", "document title", "inline")
+ .action(async (text: string | undefined, opts: { title: string }) => {
+ const engine = engineFrom();
+ try {
+ const content = text ?? readFileSync(0, "utf8");
+ const r = await engine.ingest(content, { title: opts.title });
+ console.log(
+ r.skipped
+ ? `• already ingested, skipped`
+ : `✓ ${r.chunks} chunks, +${r.nodesCreated} nodes, +${r.edgesCreated} edges`,
+ );
+ } finally {
+ engine.close();
+ }
+ });
+
+program
+ .command("query")
+ .description("Read the graph for a query and print the context bundle")
+ .argument("<text>", "the query")
+ .option("--json", "output the full bundle as JSON")
+ .option("-n, --max-nodes <n>", "max entities to surface", (v) => parseInt(v, 10), 8)
+ .option("-c, --max-chunks <n>", "max source passages to surface", (v) => parseInt(v, 10), 6)
+ .action(async (text: string, opts: { json?: boolean; maxNodes: number; maxChunks: number }) => {
+ const engine = engineFrom();
+ try {
+ const bundle = await engine.read(text, {
+ maxNodes: opts.maxNodes,
+ maxChunks: opts.maxChunks,
+ });
+ console.log(opts.json ? JSON.stringify(bundle, null, 2) : bundle.prompt);
+ } finally {
+ engine.close();
+ }
+ });
+
+program
+ .command("contribute")
+ .description("Contribute a learning back into the graph")
+ .argument("<text>", "the learning to record")
+ .option("-a, --agent <id>", "agent identifier", "cli")
+ .action(async (text: string, opts: { agent: string }) => {
+ const engine = engineFrom();
+ try {
+ const r = await engine.contribute(text, { agentId: opts.agent });
+ console.log(
+ `✓ contributed — +${r.nodesCreated} nodes (${r.nodesUpdated} reinforced), +${r.edgesCreated} edges (${r.edgesUpdated} reinforced)`,
+ );
+ } finally {
+ engine.close();
+ }
+ });
+
+program
+ .command("stats")
+ .description("Show graph statistics")
+ .action(() => {
+ const engine = engineFrom();
+ try {
+ const s = engine.stats();
+ console.log(`documents: ${s.documents}\nnodes: ${s.nodes}\nedges: ${s.edges}\nchunks: ${s.chunks}`);
+ } finally {
+ engine.close();
+ }
+ });
+
+program.parseAsync().catch((err) => {
+ console.error(err instanceof Error ? err.message : err);
+ process.exit(1);
+});
diff --git a/src/engine.ts b/src/engine.ts
new file mode 100644
index 00000000..4deeca80
--- /dev/null
+++ b/src/engine.ts
@@ -0,0 +1,268 @@
+import { readFileSync } from "node:fs";
+import { basename } from "node:path";
+import type { GraphStore } from "./graph/store.js";
+import { SqliteStore } from "./graph/sqlite-store.js";
+import type { Embedder, EngineConfig, Extractor, ResolvedConfig } from "./ai/providers.js";
+import { resolveConfig } from "./ai/providers.js";
+import { AnthropicExtractor } from "./ai/anthropic.js";
+import { OpenAIEmbedder } from "./ai/openai.js";
+import { LocalEmbedder, OllamaExtractor } from "./ai/local.js";
+import { chunkText } from "./ingest/chunker.js";
+import { mergeExtraction } from "./graph/merge.js";
+import { retrieve, type RetrieveOptions } from "./retrieval/retriever.js";
+import type { ContextBundle, Chunk, Extraction, GraphStats } from "./graph/types.js";
+import { contentHash, newId } from "./util/id.js";
+
+export interface IngestOptions {
+ /** Human-readable title for the document. Default: derived from source. */
+ title?: string;
+ /** Where the content came from (path, URL, label). Default: "inline". */
+ source?: string;
+}
+
+export interface IngestResult {
+ documentId: string;
+ title: string;
+ /** True if the document was already present (identical hash) and was skipped. */
+ skipped: boolean;
+ chunks: number;
+ nodesCreated: number;
+ nodesUpdated: number;
+ edgesCreated: number;
+ edgesUpdated: number;
+}
+
+export interface ContributeOptions {
+ /** Identifier of the agent contributing the learning. Default: "agent". */
+ agentId?: string;
+ /** Optional label for where the learning came from (task id, session, …). */
+ source?: string;
+}
+
+export interface ContributeResult {
+ documentId: string;
+ nodesCreated: number;
+ nodesUpdated: number;
+ edgesCreated: number;
+ edgesUpdated: number;
+}
+
+/**
+ * The Context Graph Engine.
+ *
+ * Turn documents into a structured knowledge graph ({@link ingest}), let agents
+ * read relevant context before doing work ({@link read}), and let them
+ * contribute learnings back so the graph improves over time ({@link contribute}).
+ */
+export class ContextGraphEngine {
+ private cfg: ResolvedConfig;
+ private _store?: GraphStore;
+ private _embedder?: Embedder;
+ private _extractor?: Extractor;
+
+ constructor(config: EngineConfig = {}) {
+ this.cfg = resolveConfig(config);
+ }
+
+ /** The underlying graph store (lazily opened). */
+ get store(): GraphStore {
+ if (!this._store) {
+ this._store = this.cfg.store ?? new SqliteStore(this.cfg.dbPath);
+ }
+ return this._store;
+ }
+
+ private get embedder(): Embedder {
+ if (!this._embedder) {
+ if (this.cfg.embedder) {
+ // Explicit override wins.
+ this._embedder = this.cfg.embedder;
+ } else if (!this.cfg.forceLocal && this.cfg.openaiApiKey) {
+ // Use cloud embeddings when a key is available.
+ this._embedder = new OpenAIEmbedder(this.cfg.openaiApiKey, this.cfg.embeddingModel);
+ } else {
+ // Fall back to fully-local, in-process embeddings (no key required).
+ this._embedder = new LocalEmbedder(this.cfg.localEmbeddingModel);
+ }
+ }
+ return this._embedder;
+ }
+
+ private get extractor(): Extractor {
+ if (!this._extractor) {
+ if (this.cfg.extractor) {
+ // Explicit override wins.
+ this._extractor = this.cfg.extractor;
+ } else if (!this.cfg.forceLocal && this.cfg.anthropicApiKey) {
+ // Use cloud extraction when a key is available.
+ this._extractor = new AnthropicExtractor(
+ this.cfg.anthropicApiKey,
+ this.cfg.extractionModel,
+ );
+ } else {
+ // Fall back to local extraction via a running Ollama instance.
+ this._extractor = new OllamaExtractor(this.cfg.ollamaModel, this.cfg.ollamaBaseUrl);
+ }
+ }
+ return this._extractor;
+ }
+
+ /** Ingest a document from disk. Title defaults to the file name. */
+ async ingestFile(path: string, opts: IngestOptions = {}): Promise<IngestResult> {
+ const text = readFileSync(path, "utf8");
+ return this.ingest(text, { title: opts.title ?? basename(path), source: opts.source ?? path });
+ }
+
+ /** Ingest raw text: chunk it, extract entities/relations, and merge into the graph. */
+ async ingest(text: string, opts: IngestOptions = {}): Promise<IngestResult> {
+ const now = new Date().toISOString();
+ const source = opts.source ?? "inline";
+ const title = opts.title ?? source;
+ const hash = contentHash(text);
+
+ const existing = this.store.getDocumentByHash(hash);
+ if (existing) {
+ return {
+ documentId: existing.id,
+ title: existing.title,
+ skipped: true,
+ chunks: 0,
+ nodesCreated: 0,
+ nodesUpdated: 0,
+ edgesCreated: 0,
+ edgesUpdated: 0,
+ };
+ }
+
+ const documentId = newId("doc");
+ this.store.insertDocument({ id: documentId, title, source, hash, createdAt: now });
+
+ const pieces = chunkText(text, this.cfg.chunkSize, this.cfg.chunkOverlap);
+ const embeddings = await this.embedder.embed(pieces);
+ pieces.forEach((piece, i) => {
+ const chunk: Chunk = {
+ id: newId("chunk"),
+ documentId,
+ ordinal: i,
+ text: piece,
+ embedding: embeddings[i],
+ createdAt: now,
+ };
+ this.store.insertChunk(chunk);
+ });
+
+ // Extract per chunk (parallel, bounded), then merge sequentially so each
+ // merge sees nodes created by earlier chunks.
+ const extractions = await mapWithConcurrency(pieces, 4, (piece) =>
+ this.extractor.extract(piece, { hint: title }),
+ );
+
+ const totals = { nodesCreated: 0, nodesUpdated: 0, edgesCreated: 0, edgesUpdated: 0 };
+ for (const extraction of extractions) {
+ const r = await mergeExtraction(
+ this.store,
+ this.embedder,
+ extraction,
+ `doc:${documentId}`,
+ this.cfg.mergeThreshold,
+ now,
+ );
+ totals.nodesCreated += r.nodesCreated;
+ totals.nodesUpdated += r.nodesUpdated;
+ totals.edgesCreated += r.edgesCreated;
+ totals.edgesUpdated += r.edgesUpdated;
+ }
+
+ return { documentId, title, skipped: false, chunks: pieces.length, ...totals };
+ }
+
+ /** Read the graph for a query, returning a structured context bundle. */
+ async read(query: string, opts: RetrieveOptions = {}): Promise<ContextBundle> {
+ return retrieve(this.store, this.embedder, query, opts);
+ }
+
+ /**
+ * Contribute a learning discovered by an agent. The text is stored as
+ * retrievable evidence and its entities/relations are merged into the graph,
+ * reinforcing what is already known and adding what is new.
+ */
+ async contribute(learning: string, opts: ContributeOptions = {}): Promise<ContributeResult> {
+ const now = new Date().toISOString();
+ const agentId = opts.agentId ?? "agent";
+ const provenance = `agent:${agentId}`;
+ const title = `Learning from ${agentId}: ${learning.slice(0, 60)}${learning.length > 60 ? "…" : ""}`;
+ const hash = contentHash(`${provenance}|${learning}`);
+
+ let documentId: string;
+ const existing = this.store.getDocumentByHash(hash);
+ if (existing) {
+ documentId = existing.id;
+ } else {
+ documentId = newId("doc");
+ this.store.insertDocument({
+ id: documentId,
+ title,
+ source: opts.source ?? provenance,
+ hash,
+ createdAt: now,
+ });
+ const [embedding] = await this.embedder.embed([learning]);
+ this.store.insertChunk({
+ id: newId("chunk"),
+ documentId,
+ ordinal: 0,
+ text: learning,
+ embedding,
+ createdAt: now,
+ });
+ }
+
+ const extraction: Extraction = await this.extractor.extract(learning, {
+ hint: "An agent's learning to fold into the shared knowledge graph.",
+ });
+ const r = await mergeExtraction(
+ this.store,
+ this.embedder,
+ extraction,
+ provenance,
+ this.cfg.mergeThreshold,
+ now,
+ );
+
+ return {
+ documentId,
+ nodesCreated: r.nodesCreated,
+ nodesUpdated: r.nodesUpdated,
+ edgesCreated: r.edgesCreated,
+ edgesUpdated: r.edgesUpdated,
+ };
+ }
+
+ /** Current graph statistics. */
+ stats(): GraphStats {
+ return this.store.stats();
+ }
+
+ /** Close the underlying store. */
+ close(): void {
+ this._store?.close();
+ }
+}
+
+/** Run `fn` over `items` with at most `limit` in flight at once, preserving order. */
+async function mapWithConcurrency<T, R>(
+ items: T[],
+ limit: number,
+ fn: (item: T, index: number) => Promise<R>,
+): Promise<R[]> {
+ const results: R[] = new Array(items.length);
+ let next = 0;
+ const workers = Array.from({ length: Math.min(limit, items.length) }, async () => {
+ while (next < items.length) {
+ const i = next++;
+ results[i] = await fn(items[i], i);
+ }
+ });
+ await Promise.all(workers);
+ return results;
+}
diff --git a/src/graph/merge.ts b/src/graph/merge.ts
new file mode 100644
index 00000000..8ea2401a
--- /dev/null
+++ b/src/graph/merge.ts
@@ -0,0 +1,179 @@
+import type { GraphStore } from "./store.js";
+import type { Embedder } from "../ai/providers.js";
+import type {
+ Extraction,
+ GraphEdge,
+ GraphNode,
+} from "./types.js";
+import { newId, normalizeName } from "../util/id.js";
+import { cosineSimilarity } from "../util/similarity.js";
+
+/** Reinforce a confidence score toward 1 as evidence accumulates. */
+function reinforce(confidence: number): number {
+ return Math.min(0.99, confidence + (1 - confidence) * 0.2);
+}
+
+/** Pick the more informative of two summaries (prefers the longer, richer one). */
+function betterSummary(existing: string, incoming: string): string {
+ if (!existing) return incoming;
+ if (!incoming) return existing;
+ return incoming.length > existing.length * 1.2 ? incoming : existing;
+}
+
+function uniq(values: string[]): string[] {
+ return [...new Set(values.filter((v) => v && v.length > 0))];
+}
+
+export interface MergeResult {
+ nodesCreated: number;
+ nodesUpdated: number;
+ edgesCreated: number;
+ edgesUpdated: number;
+ /** Maps normalized entity name -> node id, so callers can link chunks/edges. */
+ nameToId: Map<string, string>;
+}
+
+/**
+ * Merge an {@link Extraction} into the graph.
+ *
+ * Entities are matched against existing nodes by (a) exact normalized name /
+ * alias and (b) embedding similarity above `mergeThreshold`. Matches are
+ * reinforced (confidence up, observation count up, provenance appended);
+ * non-matches are created. Relations are then linked between the resolved node
+ * ids, deduped by (source, target, relation).
+ */
+export async function mergeExtraction(
+ store: GraphStore,
+ embedder: Embedder,
+ extraction: Extraction,
+ provenance: string,
+ mergeThreshold: number,
+ now: string,
+): Promise<MergeResult> {
+ const result: MergeResult = {
+ nodesCreated: 0,
+ nodesUpdated: 0,
+ edgesCreated: 0,
+ edgesUpdated: 0,
+ nameToId: new Map(),
+ };
+
+ const entities = extraction.entities;
+ if (entities.length > 0) {
+ // Embed all incoming entities in one batch.
+ const embedInputs = entities.map((e) => `${e.name}: ${e.summary}`);
+ const embeddings = await embedder.embed(embedInputs);
+
+ // Cache the full embedded-node set once; refresh with nodes we create so
+ // duplicates *within this same extraction* also collapse.
+ const candidatePool = store.allEmbeddedNodes();
+
+ for (let i = 0; i < entities.length; i++) {
+ const ent = entities[i];
+ const embedding = embeddings[i];
+ const norm = normalizeName(ent.name);
+ const aliases = uniq([norm, ...(ent.aliases ?? []).map(normalizeName)]);
+
+ const match = findMatch(store, candidatePool, norm, aliases, embedding, mergeThreshold);
+
+ if (match) {
+ match.summary = betterSummary(match.summary, ent.summary);
+ match.aliases = uniq([...match.aliases, ...aliases, norm]);
+ match.confidence = reinforce(match.confidence);
+ match.observations += 1;
+ match.provenance = uniq([...match.provenance, provenance]);
+ match.embedding = embedding;
+ match.updatedAt = now;
+ store.upsertNode(match);
+ result.nameToId.set(norm, match.id);
+ result.nodesUpdated += 1;
+ } else {
+ const node: GraphNode = {
+ id: newId("node"),
+ name: ent.name,
+ type: ent.type,
+ summary: ent.summary,
+ aliases,
+ confidence: 0.6,
+ observations: 1,
+ embedding,
+ provenance: [provenance],
+ createdAt: now,
+ updatedAt: now,
+ };
+ store.upsertNode(node);
+ candidatePool.push(node); // allow intra-batch dedup
+ result.nameToId.set(norm, node.id);
+ result.nodesCreated += 1;
+ }
+ }
+ }
+
+ // Link relations between resolved nodes.
+ for (const rel of extraction.relations) {
+ const sourceId = result.nameToId.get(normalizeName(rel.source));
+ const targetId = result.nameToId.get(normalizeName(rel.target));
+ if (!sourceId || !targetId || sourceId === targetId) continue;
+
+ const relation = normalizeName(rel.relation).replace(/\s+/g, "_");
+ const existing = store.findEdge(sourceId, targetId, relation);
+ if (existing) {
+ existing.description = betterSummary(existing.description, rel.description ?? "");
+ existing.confidence = reinforce(existing.confidence);
+ existing.observations += 1;
+ existing.provenance = uniq([...existing.provenance, provenance]);
+ existing.updatedAt = now;
+ store.upsertEdge(existing);
+ result.edgesUpdated += 1;
+ } else {
+ const edge: GraphEdge = {
+ id: newId("edge"),
+ sourceId,
+ targetId,
+ relation,
+ description: rel.description ?? "",
+ confidence: 0.6,
+ observations: 1,
+ provenance: [provenance],
+ createdAt: now,
+ updatedAt: now,
+ };
+ store.upsertEdge(edge);
+ result.edgesCreated += 1;
+ }
+ }
+
+ return result;
+}
+
+/** Find the best existing node to merge an incoming entity into, or undefined. */
+function findMatch(
+ store: GraphStore,
+ candidatePool: GraphNode[],
+ norm: string,
+ aliases: string[],
+ embedding: number[],
+ threshold: number,
+): GraphNode | undefined {
+ // 1) Exact name/alias hit is authoritative.
+ const byName = store.findNodesByName(norm);
+ if (byName.length > 0) {
+ // Prefer the most-observed among exact matches.
+ return byName.sort((a, b) => b.observations - a.observations)[0];
+ }
+
+ // 2) Otherwise, semantic match above the threshold.
+ let best: GraphNode | undefined;
+ let bestScore = threshold;
+ for (const node of candidatePool) {
+ if (!node.embedding) continue;
+ // Alias overlap is a strong signal; give it a small boost.
+ const aliasOverlap = node.aliases.some((a) => aliases.includes(a)) ? 0.05 : 0;
+ const score = cosineSimilarity(embedding, node.embedding) + aliasOverlap;
+ if (score >= bestScore) {
+ best = node;
+ bestScore = score;
+ }
+ }
+ return best;
+}
diff --git a/src/graph/sqlite-store.ts b/src/graph/sqlite-store.ts
new file mode 100644
index 00000000..5b985099
--- /dev/null
+++ b/src/graph/sqlite-store.ts
@@ -0,0 +1,368 @@
+import Database from "better-sqlite3";
+import { mkdirSync } from "node:fs";
+import { dirname } from "node:path";
+import type { GraphStore } from "./store.js";
+import type {
+ Chunk,
+ GraphDocument,
+ GraphEdge,
+ GraphNode,
+ GraphStats,
+} from "./types.js";
+import { normalizeName } from "../util/id.js";
+
+interface NodeRow {
+ id: string;
+ name: string;
+ norm_name: string;
+ type: string;
+ summary: string;
+ aliases: string;
+ confidence: number;
+ observations: number;
+ embedding: string | null;
+ provenance: string;
+ created_at: string;
+ updated_at: string;
+}
+
+interface EdgeRow {
+ id: string;
+ source_id: string;
+ target_id: string;
+ relation: string;
+ description: string;
+ confidence: number;
+ observations: number;
+ provenance: string;
+ created_at: string;
+ updated_at: string;
+}
+
+interface ChunkRow {
+ id: string;
+ document_id: string;
+ ordinal: number;
+ text: string;
+ embedding: string | null;
+ created_at: string;
+}
+
+/** File-backed graph store using SQLite via better-sqlite3. */
+export class SqliteStore implements GraphStore {
+ private db: Database.Database;
+
+ /** @param path Path to the .db file, or ":memory:" for an ephemeral graph. */
+ constructor(path: string) {
+ if (path !== ":memory:") {
+ mkdirSync(dirname(path), { recursive: true });
+ }
+ this.db = new Database(path);
+ this.db.pragma("journal_mode = WAL");
+ this.db.pragma("foreign_keys = ON");
+ this.migrate();
+ }
+
+ private migrate(): void {
+ this.db.exec(`
+ CREATE TABLE IF NOT EXISTS documents (
+ id TEXT PRIMARY KEY,
+ title TEXT NOT NULL,
+ source TEXT NOT NULL,
+ hash TEXT NOT NULL UNIQUE,
+ created_at TEXT NOT NULL
+ );
+
+ CREATE TABLE IF NOT EXISTS chunks (
+ id TEXT PRIMARY KEY,
+ document_id TEXT NOT NULL REFERENCES documents(id) ON DELETE CASCADE,
+ ordinal INTEGER NOT NULL,
+ text TEXT NOT NULL,
+ embedding TEXT,
+ created_at TEXT NOT NULL
+ );
+
+ CREATE TABLE IF NOT EXISTS nodes (
+ id TEXT PRIMARY KEY,
+ name TEXT NOT NULL,
+ norm_name TEXT NOT NULL,
+ type TEXT NOT NULL,
+ summary TEXT NOT NULL,
+ aliases TEXT NOT NULL DEFAULT '[]',
+ confidence REAL NOT NULL DEFAULT 0.5,
+ observations INTEGER NOT NULL DEFAULT 1,
+ embedding TEXT,
+ provenance TEXT NOT NULL DEFAULT '[]',
+ created_at TEXT NOT NULL,
+ updated_at TEXT NOT NULL
+ );
+ CREATE INDEX IF NOT EXISTS idx_nodes_norm_name ON nodes(norm_name);
+
+ CREATE TABLE IF NOT EXISTS edges (
+ id TEXT PRIMARY KEY,
+ source_id TEXT NOT NULL REFERENCES nodes(id) ON DELETE CASCADE,
+ target_id TEXT NOT NULL REFERENCES nodes(id) ON DELETE CASCADE,
+ relation TEXT NOT NULL,
+ description TEXT NOT NULL DEFAULT '',
+ confidence REAL NOT NULL DEFAULT 0.5,
+ observations INTEGER NOT NULL DEFAULT 1,
+ provenance TEXT NOT NULL DEFAULT '[]',
+ created_at TEXT NOT NULL,
+ updated_at TEXT NOT NULL,
+ UNIQUE(source_id, target_id, relation)
+ );
+ CREATE INDEX IF NOT EXISTS idx_edges_source ON edges(source_id);
+ CREATE INDEX IF NOT EXISTS idx_edges_target ON edges(target_id);
+ `);
+ }
+
+ // --- documents ---
+
+ getDocumentByHash(hash: string): GraphDocument | undefined {
+ const row = this.db
+ .prepare(`SELECT * FROM documents WHERE hash = ?`)
+ .get(hash) as (GraphDocument & { created_at: string }) | undefined;
+ if (!row) return undefined;
+ return {
+ id: row.id,
+ title: row.title,
+ source: row.source,
+ hash: row.hash,
+ createdAt: (row as unknown as { created_at: string }).created_at,
+ };
+ }
+
+ insertDocument(doc: GraphDocument): void {
+ this.db
+ .prepare(
+ `INSERT INTO documents (id, title, source, hash, created_at)
+ VALUES (@id, @title, @source, @hash, @createdAt)`,
+ )
+ .run(doc);
+ }
+
+ documentTitle(documentId: string): string {
+ const row = this.db
+ .prepare(`SELECT title FROM documents WHERE id = ?`)
+ .get(documentId) as { title: string } | undefined;
+ return row?.title ?? "unknown";
+ }
+
+ // --- chunks ---
+
+ insertChunk(chunk: Chunk): void {
+ this.db
+ .prepare(
+ `INSERT INTO chunks (id, document_id, ordinal, text, embedding, created_at)
+ VALUES (@id, @documentId, @ordinal, @text, @embedding, @createdAt)`,
+ )
+ .run({
+ ...chunk,
+ embedding: chunk.embedding ? JSON.stringify(chunk.embedding) : null,
+ });
+ }
+
+ getChunksByIds(ids: string[]): Chunk[] {
+ if (ids.length === 0) return [];
+ const placeholders = ids.map(() => "?").join(",");
+ const rows = this.db
+ .prepare(`SELECT * FROM chunks WHERE id IN (${placeholders})`)
+ .all(...ids) as ChunkRow[];
+ return rows.map(this.rowToChunk);
+ }
+
+ allEmbeddedChunks(): Chunk[] {
+ const rows = this.db
+ .prepare(`SELECT * FROM chunks WHERE embedding IS NOT NULL`)
+ .all() as ChunkRow[];
+ return rows.map(this.rowToChunk);
+ }
+
+ private rowToChunk(row: ChunkRow): Chunk {
+ return {
+ id: row.id,
+ documentId: row.document_id,
+ ordinal: row.ordinal,
+ text: row.text,
+ embedding: row.embedding ? JSON.parse(row.embedding) : undefined,
+ createdAt: row.created_at,
+ };
+ }
+
+ // --- nodes ---
+
+ getNodeById(id: string): GraphNode | undefined {
+ const row = this.db.prepare(`SELECT * FROM nodes WHERE id = ?`).get(id) as
+ | NodeRow
+ | undefined;
+ return row ? this.rowToNode(row) : undefined;
+ }
+
+ getNodesByIds(ids: string[]): GraphNode[] {
+ if (ids.length === 0) return [];
+ const placeholders = ids.map(() => "?").join(",");
+ const rows = this.db
+ .prepare(`SELECT * FROM nodes WHERE id IN (${placeholders})`)
+ .all(...ids) as NodeRow[];
+ return rows.map((r) => this.rowToNode(r));
+ }
+
+ findNodesByName(normalizedName: string): GraphNode[] {
+ // Match either the canonical normalized name or any alias. Aliases are
+ // stored normalized in a JSON array, so we match the quoted element form
+ // (e.g. `"oauth"`) to avoid partial-substring false positives.
+ const rows = this.db
+ .prepare(
+ `SELECT * FROM nodes
+ WHERE norm_name = ?
+ OR aliases LIKE ?`,
+ )
+ .all(normalizedName, `%${JSON.stringify(normalizedName)}%`) as NodeRow[];
+ return rows.map((r) => this.rowToNode(r));
+ }
+
+ allEmbeddedNodes(): GraphNode[] {
+ const rows = this.db
+ .prepare(`SELECT * FROM nodes WHERE embedding IS NOT NULL`)
+ .all() as NodeRow[];
+ return rows.map((r) => this.rowToNode(r));
+ }
+
+ upsertNode(node: GraphNode): void {
+ this.db
+ .prepare(
+ `INSERT INTO nodes
+ (id, name, norm_name, type, summary, aliases, confidence,
+ observations, embedding, provenance, created_at, updated_at)
+ VALUES
+ (@id, @name, @norm_name, @type, @summary, @aliases, @confidence,
+ @observations, @embedding, @provenance, @created_at, @updated_at)
+ ON CONFLICT(id) DO UPDATE SET
+ name = excluded.name,
+ norm_name = excluded.norm_name,
+ type = excluded.type,
+ summary = excluded.summary,
+ aliases = excluded.aliases,
+ confidence = excluded.confidence,
+ observations = excluded.observations,
+ embedding = excluded.embedding,
+ provenance = excluded.provenance,
+ updated_at = excluded.updated_at`,
+ )
+ .run({
+ id: node.id,
+ name: node.name,
+ norm_name: normalizeName(node.name),
+ type: node.type,
+ summary: node.summary,
+ aliases: JSON.stringify(node.aliases),
+ confidence: node.confidence,
+ observations: node.observations,
+ embedding: node.embedding ? JSON.stringify(node.embedding) : null,
+ provenance: JSON.stringify(node.provenance),
+ created_at: node.createdAt,
+ updated_at: node.updatedAt,
+ });
+ }
+
+ private rowToNode(row: NodeRow): GraphNode {
+ return {
+ id: row.id,
+ name: row.name,
+ type: row.type,
+ summary: row.summary,
+ aliases: JSON.parse(row.aliases),
+ confidence: row.confidence,
+ observations: row.observations,
+ embedding: row.embedding ? JSON.parse(row.embedding) : undefined,
+ provenance: JSON.parse(row.provenance),
+ createdAt: row.created_at,
+ updatedAt: row.updated_at,
+ };
+ }
+
+ // --- edges ---
+
+ findEdge(sourceId: string, targetId: string, relation: string): GraphEdge | undefined {
+ const row = this.db
+ .prepare(
+ `SELECT * FROM edges WHERE source_id = ? AND target_id = ? AND relation = ?`,
+ )
+ .get(sourceId, targetId, relation) as EdgeRow | undefined;
+ return row ? this.rowToEdge(row) : undefined;
+ }
+
+ upsertEdge(edge: GraphEdge): void {
+ this.db
+ .prepare(
+ `INSERT INTO edges
+ (id, source_id, target_id, relation, description, confidence,
+ observations, provenance, created_at, updated_at)
+ VALUES
+ (@id, @source_id, @target_id, @relation, @description, @confidence,
+ @observations, @provenance, @created_at, @updated_at)
+ ON CONFLICT(source_id, target_id, relation) DO UPDATE SET
+ description = excluded.description,
+ confidence = excluded.confidence,
+ observations = excluded.observations,
+ provenance = excluded.provenance,
+ updated_at = excluded.updated_at`,
+ )
+ .run({
+ id: edge.id,
+ source_id: edge.sourceId,
+ target_id: edge.targetId,
+ relation: edge.relation,
+ description: edge.description,
+ confidence: edge.confidence,
+ observations: edge.observations,
+ provenance: JSON.stringify(edge.provenance),
+ created_at: edge.createdAt,
+ updated_at: edge.updatedAt,
+ });
+ }
+
+ edgesForNodes(nodeIds: string[]): GraphEdge[] {
+ if (nodeIds.length === 0) return [];
+ const placeholders = nodeIds.map(() => "?").join(",");
+ const rows = this.db
+ .prepare(
+ `SELECT * FROM edges
+ WHERE source_id IN (${placeholders}) OR target_id IN (${placeholders})`,
+ )
+ .all(...nodeIds, ...nodeIds) as EdgeRow[];
+ return rows.map((r) => this.rowToEdge(r));
+ }
+
+ private rowToEdge(row: EdgeRow): GraphEdge {
+ return {
+ id: row.id,
+ sourceId: row.source_id,
+ targetId: row.target_id,
+ relation: row.relation,
+ description: row.description,
+ confidence: row.confidence,
+ observations: row.observations,
+ provenance: JSON.parse(row.provenance),
+ createdAt: row.created_at,
+ updatedAt: row.updated_at,
+ };
+ }
+
+ // --- misc ---
+
+ stats(): GraphStats {
+ const count = (table: string): number =>
+ (this.db.prepare(`SELECT COUNT(*) AS n FROM ${table}`).get() as { n: number }).n;
+ return {
+ documents: count("documents"),
+ nodes: count("nodes"),
+ edges: count("edges"),
+ chunks: count("chunks"),
+ };
+ }
+
+ close(): void {
+ this.db.close();
+ }
+}
diff --git a/src/graph/store.ts b/src/graph/store.ts
new file mode 100644
index 00000000..6d4acc42
--- /dev/null
+++ b/src/graph/store.ts
@@ -0,0 +1,47 @@
+import type {
+ Chunk,
+ GraphDocument,
+ GraphEdge,
+ GraphNode,
+ GraphStats,
+} from "./types.js";
+
+/**
+ * Storage backend for the context graph.
+ *
+ * The engine talks to the graph exclusively through this interface, so the
+ * SQLite backend can be swapped for another store (Postgres/pgvector, an
+ * in-memory store, a remote service) without touching engine logic.
+ */
+export interface GraphStore {
+ // --- documents ---
+ getDocumentByHash(hash: string): GraphDocument | undefined;
+ insertDocument(doc: GraphDocument): void;
+
+ // --- chunks ---
+ insertChunk(chunk: Chunk): void;
+ getChunksByIds(ids: string[]): Chunk[];
+ /** All chunks that have an embedding, for in-memory vector search. */
+ allEmbeddedChunks(): Chunk[];
+
+ // --- nodes ---
+ getNodeById(id: string): GraphNode | undefined;
+ getNodesByIds(ids: string[]): GraphNode[];
+ /** Nodes whose canonical name or an alias matches (normalized, exact). */
+ findNodesByName(normalizedName: string): GraphNode[];
+ /** All nodes that have an embedding, for in-memory vector search & dedup. */
+ allEmbeddedNodes(): GraphNode[];
+ upsertNode(node: GraphNode): void;
+
+ // --- edges ---
+ /** Existing edge with the same (source, target, relation), if any. */
+ findEdge(sourceId: string, targetId: string, relation: string): GraphEdge | undefined;
+ upsertEdge(edge: GraphEdge): void;
+ /** All edges incident to any of the given node ids. */
+ edgesForNodes(nodeIds: string[]): GraphEdge[];
+
+ // --- misc ---
+ documentTitle(documentId: string): string;
+ stats(): GraphStats;
+ close(): void;
+}
diff --git a/src/graph/types.ts b/src/graph/types.ts
new file mode 100644
index 00000000..993341b2
--- /dev/null
+++ b/src/graph/types.ts
@@ -0,0 +1,131 @@
+/**
+ * Core data model for the context graph.
+ *
+ * The graph has three primary record kinds:
+ * - {@link GraphNode} — an entity or concept ("what things are")
+ * - {@link GraphEdge} — a typed relationship between two nodes ("how things relate")
+ * - {@link Chunk} — a passage of source text that grounds nodes/edges in evidence
+ *
+ * Nodes and edges carry a `confidence` and `observations` count. Every time an
+ * agent re-observes the same fact, `observations` is incremented and confidence
+ * is reinforced — this is what lets the graph "get smarter over time".
+ */
+
+/** A source document that was ingested into the graph. */
+export interface GraphDocument {
+ id: string;
+ /** Human-readable title. */
+ title: string;
+ /** Where this came from: a file path, URL, or free-form label. */
+ source: string;
+ /** Content hash, used to skip re-ingesting identical documents. */
+ hash: string;
+ createdAt: string;
+}
+
+/** An entity or concept in the graph. */
+export interface GraphNode {
+ id: string;
+ /** Canonical display name, e.g. "OAuth 2.0". */
+ name: string;
+ /** Coarse category, e.g. "concept", "system", "person", "api", "policy". */
+ type: string;
+ /** A short natural-language description of the node, synthesized from evidence. */
+ summary: string;
+ /** Alternate names / surface forms that map to this node. */
+ aliases: string[];
+ /** 0..1 confidence that this node is real and correctly described. */
+ confidence: number;
+ /** How many times this entity has been observed across ingests/contributions. */
+ observations: number;
+ /** Vector embedding of `name + summary`, used for semantic matching & dedup. */
+ embedding?: number[];
+ /** Where this knowledge came from (document ids, agent ids). */
+ provenance: string[];
+ createdAt: string;
+ updatedAt: string;
+}
+
+/** A directed, typed relationship between two nodes. */
+export interface GraphEdge {
+ id: string;
+ sourceId: string;
+ targetId: string;
+ /** The predicate, e.g. "depends_on", "authenticates_with", "part_of". */
+ relation: string;
+ /** Optional natural-language description of the relationship. */
+ description: string;
+ confidence: number;
+ observations: number;
+ provenance: string[];
+ createdAt: string;
+ updatedAt: string;
+}
+
+/** A passage of source text, used as retrieval evidence. */
+export interface Chunk {
+ id: string;
+ documentId: string;
+ /** Ordinal position within the document. */
+ ordinal: number;
+ text: string;
+ embedding?: number[];
+ createdAt: string;
+}
+
+/** A single extracted entity, before it is merged into the graph. */
+export interface ExtractedEntity {
+ name: string;
+ type: string;
+ summary: string;
+ aliases?: string[];
+}
+
+/** A single extracted relationship, before it is merged into the graph. */
+export interface ExtractedRelation {
+ source: string;
+ target: string;
+ relation: string;
+ description?: string;
+}
+
+/** The result of running extraction over a piece of text. */
+export interface Extraction {
+ entities: ExtractedEntity[];
+ relations: ExtractedRelation[];
+}
+
+/** A node returned from retrieval, annotated with why it was surfaced. */
+export interface RetrievedNode extends GraphNode {
+ /** Relevance score in 0..1 (semantic similarity or traversal-derived). */
+ score: number;
+ /** How this node entered the result: direct semantic hit, or graph expansion. */
+ via: "semantic" | "expanded";
+}
+
+/** A chunk returned from retrieval. */
+export interface RetrievedChunk extends Chunk {
+ score: number;
+ documentTitle: string;
+}
+
+/** The structured context bundle an agent reads before doing work. */
+export interface ContextBundle {
+ query: string;
+ /** Entities relevant to the query, most-relevant first. */
+ nodes: RetrievedNode[];
+ /** Relationships connecting the surfaced nodes. */
+ edges: GraphEdge[];
+ /** Supporting source passages. */
+ chunks: RetrievedChunk[];
+ /** A ready-to-inject, human/LLM-readable rendering of the above. */
+ prompt: string;
+}
+
+/** Summary counts describing the current graph. */
+export interface GraphStats {
+ documents: number;
+ nodes: number;
+ edges: number;
+ chunks: number;
+}
diff --git a/src/index.ts b/src/index.ts
new file mode 100644
index 00000000..ca475ef6
--- /dev/null
+++ b/src/index.ts
@@ -0,0 +1,59 @@
+/**
+ * Context Graph Engine — public API.
+ *
+ * @example
+ * ```ts
+ * import { ContextGraphEngine } from "context-graph-engine";
+ *
+ * const engine = new ContextGraphEngine();
+ * await engine.ingest(myDocs, { title: "Onboarding" });
+ *
+ * const ctx = await engine.read("how does auth work?");
+ * console.log(ctx.prompt); // inject into your agent
+ *
+ * await engine.contribute("The auth service rotates tokens every 15 minutes.", {
+ * agentId: "code-reviewer",
+ * });
+ * ```
+ */
+export { ContextGraphEngine } from "./engine.js";
+export type {
+ IngestOptions,
+ IngestResult,
+ ContributeOptions,
+ ContributeResult,
+} from "./engine.js";
+
+export type {
+ EngineConfig,
+ ResolvedConfig,
+ Embedder,
+ Extractor,
+} from "./ai/providers.js";
+export { resolveConfig, DEFAULTS } from "./ai/providers.js";
+
+export type { RetrieveOptions } from "./retrieval/retriever.js";
+export { retrieve, renderPrompt } from "./retrieval/retriever.js";
+
+export type { GraphStore } from "./graph/store.js";
+export { SqliteStore } from "./graph/sqlite-store.js";
+export { mergeExtraction } from "./graph/merge.js";
+
+export type {
+ GraphNode,
+ GraphEdge,
+ GraphDocument,
+ Chunk,
+ ContextBundle,
+ RetrievedNode,
+ RetrievedChunk,
+ GraphStats,
+ Extraction,
+ ExtractedEntity,
+ ExtractedRelation,
+} from "./graph/types.js";
+
+// Providers, for advanced/custom setups.
+export { AnthropicExtractor } from "./ai/anthropic.js";
+export { OpenAIEmbedder } from "./ai/openai.js";
+export { LocalEmbedder, OllamaExtractor } from "./ai/local.js";
diff --git a/src/ingest/chunker.ts b/src/ingest/chunker.ts
new file mode 100644
index 00000000..f2567ad4
--- /dev/null
+++ b/src/ingest/chunker.ts
@@ -0,0 +1,62 @@
+/**
+ * Split a document into overlapping chunks for embedding and extraction.
+ *
+ * The splitter is paragraph-aware: it accumulates whole paragraphs up to the
+ * target size, and only hard-splits a paragraph that is larger than the target
+ * on its own. Adjacent chunks share `overlap` characters so context that spans
+ * a boundary is not lost.
+ */
+export function chunkText(
+ text: string,
+ targetSize: number,
+ overlap: number,
+): string[] {
+ const clean = text.replace(/\r\n/g, "\n").trim();
+ if (clean.length === 0) return [];
+ if (clean.length <= targetSize) return [clean];
+
+ const paragraphs = clean.split(/\n{2,}/);
+ const chunks: string[] = [];
+ let current = "";
+
+ const flush = () => {
+ const trimmed = current.trim();
+ if (trimmed.length > 0) chunks.push(trimmed);
+ // Seed the next chunk with the tail of this one for overlap.
+ current = overlap > 0 ? trimmed.slice(-overlap) : "";
+ };
+
+ for (const para of paragraphs) {
+ if (para.length > targetSize) {
+ // Paragraph too big on its own: flush, then hard-split by sentence.
+ if (current.trim().length > 0) flush();
+ for (const piece of hardSplit(para, targetSize, overlap)) chunks.push(piece);
+ current = overlap > 0 ? (chunks[chunks.length - 1] ?? "").slice(-overlap) : "";
+ continue;
+ }
+ if (current.length + para.length + 2 > targetSize && current.trim().length > 0) {
+ flush();
+ }
+ current += (current.length > 0 ? "\n\n" : "") + para;
+ }
+ if (current.trim().length > 0) chunks.push(current.trim());
+
+ // De-dup consecutive identical chunks that overlap-seeding can produce.
+ return chunks.filter((c, i) => i === 0 || c !== chunks[i - 1]);
+}
+
+/** Split a single oversized block by sentence boundaries into <= size pieces. */
+function hardSplit(block: string, size: number, overlap: number): string[] {
+ const sentences = block.split(/(?<=[.!?])\s+/);
+ const out: string[] = [];
+ let cur = "";
+ for (const s of sentences) {
+ if (cur.length + s.length + 1 > size && cur.length > 0) {
+ out.push(cur.trim());
+ cur = overlap > 0 ? cur.slice(-overlap) : "";
+ }
+ cur += (cur.length > 0 ? " " : "") + s;
+ }
+ if (cur.trim().length > 0) out.push(cur.trim());
+ return out;
+}
diff --git a/src/mcp.ts b/src/mcp.ts
new file mode 100644
index 00000000..91b22ceb
--- /dev/null
+++ b/src/mcp.ts
@@ -0,0 +1,119 @@
+#!/usr/bin/env node
+/**
+ * MCP server exposing the context graph to any MCP client (Claude Code, Cursor,
+ * etc.). Agents `context_read` before doing work and `context_contribute` what
+ * they learn — mirroring the "shared skill / durable memory" integration model.
+ *
+ * Run: context-graph-mcp (configure the db via CONTEXT_GRAPH_DB)
+ */
+import "dotenv/config";
+import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
+import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
+import { z } from "zod";
+import { ContextGraphEngine } from "./engine.js";
+
+const engine = new ContextGraphEngine();
+
+const server = new McpServer({
+ name: "context-graph-engine",
+ version: "0.1.0",
+});
+
+server.registerTool(
+ "context_read",
+ {
+ title: "Read shared context",
+ description:
+ "Read the shared context graph for a query BEFORE doing work. Returns relevant entities, relationships, and supporting sources as a ready-to-use context block.",
+ inputSchema: {
+ query: z.string().describe("What you need context about."),
+ maxNodes: z.number().int().min(1).max(50).optional().describe("Max entities (default 8)."),
+ maxChunks: z.number().int().min(0).max(50).optional().describe("Max source passages (default 6)."),
+ },
+ },
+ async ({ query, maxNodes, maxChunks }) => {
+ const bundle = await engine.read(query, { maxNodes, maxChunks });
+ return { content: [{ type: "text", text: bundle.prompt }] };
+ },
+);
+
+server.registerTool(
+ "context_contribute",
+ {
+ title: "Contribute a learning",
+ description:
+ "Contribute something you learned back into the shared context graph so future agents benefit. It is deduplicated and merged with existing knowledge.",
+ inputSchema: {
+ learning: z.string().describe("The fact or insight to record, in plain language."),
+ agentId: z.string().optional().describe("Your agent identifier (default 'agent')."),
+ },
+ },
+ async ({ learning, agentId }) => {
+ const r = await engine.contribute(learning, { agentId });
+ return {
+ content: [
+ {
+ type: "text",
+ text: `Recorded. +${r.nodesCreated} new entities, ${r.nodesUpdated} reinforced; +${r.edgesCreated} new relationships, ${r.edgesUpdated} reinforced.`,
+ },
+ ],
+ };
+ },
+);
+
+server.registerTool(
+ "context_ingest",
+ {
+ title: "Ingest a document",
+ description: "Ingest a document (raw text) into the shared context graph.",
+ inputSchema: {
+ text: z.string().describe("The document text to ingest."),
+ title: z.string().optional().describe("A title for the document."),
+ },
+ },
+ async ({ text, title }) => {
+ const r = await engine.ingest(text, { title });
+ return {
+ content: [
+ {
+ type: "text",
+ text: r.skipped
+ ? "Document already ingested; skipped."
+ : `Ingested "${r.title}": ${r.chunks} chunks, +${r.nodesCreated} entities, +${r.edgesCreated} relationships.`,
+ },
+ ],
+ };
+ },
+);
+
+server.registerTool(
+ "context_stats",
+ {
+ title: "Graph statistics",
+ description: "Report how much knowledge the shared context graph currently holds.",
+ inputSchema: {},
+ },
+ async () => {
+ const s = engine.stats();
+ return {
+ content: [
+ {
+ type: "text",
+ text: `documents: ${s.documents}, entities: ${s.nodes}, relationships: ${s.edges}, source passages: ${s.chunks}`,
+ },
+ ],
+ };
+ },
+);
+
+async function main(): Promise<void> {
+ const transport = new StdioServerTransport();
+ await server.connect(transport);
+ // Log to stderr so we don't corrupt the stdio JSON-RPC channel.
+ console.error("context-graph-engine MCP server running on stdio");
+}
+
+main().catch((err) => {
+ console.error(err);
+ process.exit(1);
+});
diff --git a/src/retrieval/retriever.ts b/src/retrieval/retriever.ts
new file mode 100644
index 00000000..017f69fd
--- /dev/null
+++ b/src/retrieval/retriever.ts
@@ -0,0 +1,147 @@
+import type { GraphStore } from "../graph/store.js";
+import type { Embedder } from "../ai/providers.js";
+import type {
+ ContextBundle,
+ GraphEdge,
+ GraphNode,
+ RetrievedChunk,
+ RetrievedNode,
+} from "../graph/types.js";
+import { topK } from "../util/similarity.js";
+
+export interface RetrieveOptions {
+ /** Max entities to surface via direct semantic match. Default: 8. */
+ maxNodes?: number;
+ /** Max supporting source passages to include. Default: 6. */
+ maxChunks?: number;
+ /** Whether to expand one hop out from the semantically-matched nodes. Default: true. */
+ expand?: boolean;
+ /** Drop semantic node hits scoring below this cosine value. Default: 0.15. */
+ minNodeScore?: number;
+}
+
+/**
+ * Read the graph for a query: semantic-match entities and passages, then expand
+ * one hop across relationships to pull in connected context. Returns a
+ * structured {@link ContextBundle} plus a ready-to-inject `prompt` rendering.
+ */
+export async function retrieve(
+ store: GraphStore,
+ embedder: Embedder,
+ query: string,
+ opts: RetrieveOptions = {},
+): Promise<ContextBundle> {
+ const maxNodes = opts.maxNodes ?? 8;
+ const maxChunks = opts.maxChunks ?? 6;
+ const expand = opts.expand ?? true;
+ const minNodeScore = opts.minNodeScore ?? 0.15;
+
+ const [queryVec] = await embedder.embed([query]);
+
+ // 1) Direct semantic matches over entities.
+ const nodeHits = topK(queryVec, store.allEmbeddedNodes(), (n) => n.embedding, maxNodes)
+ .filter((h) => h.score >= minNodeScore);
+
+ const nodesById = new Map<string, RetrievedNode>();
+ for (const { item, score } of nodeHits) {
+ nodesById.set(item.id, { ...item, score, via: "semantic" });
+ }
+
+ // 2) One-hop graph expansion from the matched entities.
+ let edges: GraphEdge[] = [];
+ if (expand && nodesById.size > 0) {
+ const seedIds = [...nodesById.keys()];
+ edges = store.edgesForNodes(seedIds);
+
+ const neighborIds = new Set<string>();
+ for (const e of edges) {
+ if (!nodesById.has(e.sourceId)) neighborIds.add(e.sourceId);
+ if (!nodesById.has(e.targetId)) neighborIds.add(e.targetId);
+ }
+ const neighbors = store.getNodesByIds([...neighborIds]);
+ const seedScore = new Map(nodeHits.map((h) => [h.item.id, h.score]));
+ for (const n of neighbors) {
+ // Score an expanded node by the best edge that reached it.
+ const best = bestEdgeScore(n.id, edges, seedScore);
+ nodesById.set(n.id, { ...n, score: best, via: "expanded" });
+ }
+ }
+
+ // Keep only edges whose endpoints are both in the final node set.
+ const finalNodes = [...nodesById.values()].sort((a, b) => b.score - a.score);
+ const nodeIdSet = new Set(finalNodes.map((n) => n.id));
+ edges = edges.filter((e) => nodeIdSet.has(e.sourceId) && nodeIdSet.has(e.targetId));
+
+ // 3) Supporting source passages.
+ const chunkHits = topK(queryVec, store.allEmbeddedChunks(), (c) => c.embedding, maxChunks);
+ const chunks: RetrievedChunk[] = chunkHits.map(({ item, score }) => ({
+ ...item,
+ score,
+ documentTitle: store.documentTitle(item.documentId),
+ }));
+
+ const bundle: ContextBundle = {
+ query,
+ nodes: finalNodes,
+ edges,
+ chunks,
+ prompt: "",
+ };
+ bundle.prompt = renderPrompt(bundle);
+ return bundle;
+}
+
+function bestEdgeScore(
+ nodeId: string,
+ edges: GraphEdge[],
+ seedScore: Map<string, number>,
+): number {
+ let best = 0;
+ for (const e of edges) {
+ const other =
+ e.sourceId === nodeId ? e.targetId : e.targetId === nodeId ? e.sourceId : null;
+ if (other === null) continue;
+ const seed = seedScore.get(other);
+ if (seed === undefined) continue;
+ best = Math.max(best, seed * e.confidence);
+ }
+ return best;
+}
+
+/** Render a bundle into a compact, LLM-friendly context block. */
+export function renderPrompt(bundle: ContextBundle): string {
+ const lines: string[] = [];
+ lines.push(`# Context for: ${bundle.query}`);
+
+ if (bundle.nodes.length > 0) {
+ lines.push("\n## Relevant entities");
+ for (const n of bundle.nodes) {
+ const conf = `${Math.round(n.confidence * 100)}%`;
+ lines.push(`- **${n.name}** (${n.type}, confidence ${conf}): ${n.summary}`);
+ }
+ }
+
+ if (bundle.edges.length > 0) {
+ const byId = new Map(bundle.nodes.map((n) => [n.id, n.name]));
+ lines.push("\n## Relationships");
+ for (const e of bundle.edges) {
+ const s = byId.get(e.sourceId) ?? e.sourceId;
+ const t = byId.get(e.targetId) ?? e.targetId;
+ const desc = e.description ? ` — ${e.description}` : "";
+ lines.push(`- ${s} —[${e.relation}]→ ${t}${desc}`);
+ }
+ }
+
+ if (bundle.chunks.length > 0) {
+ lines.push("\n## Supporting sources");
+ for (const c of bundle.chunks) {
+ lines.push(`- (${c.documentTitle}) ${c.text.replace(/\s+/g, " ").slice(0, 400)}`);
+ }
+ }
+
+ if (bundle.nodes.length === 0 && bundle.chunks.length === 0) {
+ lines.push("\n_No relevant context found in the graph yet._");
+ }
+
+ return lines.join("\n");
+}
diff --git a/src/util/id.ts b/src/util/id.ts
new file mode 100644
index 00000000..347d743d
--- /dev/null
+++ b/src/util/id.ts
@@ -0,0 +1,16 @@
+import { randomUUID, createHash } from "node:crypto";
+
+/** Generate a random unique id with a short type prefix, e.g. "node_ab12…". */
+export function newId(prefix: string): string {
+ return `${prefix}_${randomUUID().replace(/-/g, "").slice(0, 20)}`;
+}
+
+/** Stable content hash (sha256, hex) used for document dedup. */
+export function contentHash(input: string): string {
+ return createHash("sha256").update(input).digest("hex");
+}
+
+/** Normalize a name/alias for case- and whitespace-insensitive matching. */
+export function normalizeName(name: string): string {
+ return name.trim().toLowerCase().replace(/\s+/g, " ");
+}
diff --git a/src/util/similarity.ts b/src/util/similarity.ts
new file mode 100644
index 00000000..27dad453
--- /dev/null
+++ b/src/util/similarity.ts
@@ -0,0 +1,31 @@
+/** Cosine similarity of two equal-length vectors. Returns a value in [-1, 1]. */
+export function cosineSimilarity(a: number[], b: number[]): number {
+ if (a.length !== b.length || a.length === 0) return 0;
+ let dot = 0;
+ let normA = 0;
+ let normB = 0;
+ for (let i = 0; i < a.length; i++) {
+ dot += a[i] * b[i];
+ normA += a[i] * a[i];
+ normB += b[i] * b[i];
+ }
+ if (normA === 0 || normB === 0) return 0;
+ return dot / (Math.sqrt(normA) * Math.sqrt(normB));
+}
+
+/** Rank `items` by cosine similarity of `getVec(item)` to `query`, returning the top `k`. */
+export function topK<T>(
+ query: number[],
+ items: T[],
+ getVec: (item: T) => number[] | undefined,
+ k: number,
+): Array<{ item: T; score: number }> {
+ const scored: Array<{ item: T; score: number }> = [];
+ for (const item of items) {
+ const vec = getVec(item);
+ if (!vec) continue;
+ scored.push({ item, score: cosineSimilarity(query, vec) });
+ }
+ scored.sort((x, y) => y.score - x.score);
+ return scored.slice(0, k);
+}
diff --git a/tsconfig.json b/tsconfig.json
new file mode 100644
index 00000000..71f6a484
--- /dev/null
+++ b/tsconfig.json
@@ -0,0 +1,21 @@
+{
+ "compilerOptions": {
+ "target": "ES2022",
+ "module": "NodeNext",
+ "moduleResolution": "NodeNext",
+ "lib": ["ES2022"],
+ "outDir": "./dist",
+ "rootDir": "./src",
+ "declaration": true,
+ "declarationMap": true,
+ "sourceMap": true,
+ "strict": true,
+ "esModuleInterop": true,
+ "skipLibCheck": true,
+ "forceConsistentCasingInFileNames": true,
+ "resolveJsonModule": true,
+ "verbatimModuleSyntax": false
+ },
+ "include": ["src/**/*"],
+ "exclude": ["node_modules", "dist", "examples"]
+}