Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

fleet-vector-api

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fleet-vector-api

**Real semantic search** across the SuperInstance ecosystem using Cloudflare Workers AI embeddings + Vectorize.

latest
npmnpm
Version
0.1.0
Version published
Maintainers
1
Created
Source

fleet-vector-api

Real semantic search across the SuperInstance ecosystem using Cloudflare Workers AI embeddings + Vectorize.

This isn't fake 32-dim hand-computed vectors. This is @cf/baai/bge-small-en-v1.5 — a real 384-dimensional embedding model running on Cloudflare's edge network, producing embeddings that actually understand what your crates do.

Pipeline

Crate README + Cargo.toml metadata
        ↓
Workers AI (bge-small-en-v1.5, 384-dim)
        ↓
Vectorize index (cosine similarity)
        ↓
Semantic search API at the edge

Why This Matters

The ecosystem has 548 crates. Finding related work across domains is hard:

  • "What crates use conservation laws?" → finds conservation-law, entropy-lint, agent-homeostasis, hodge-belief-rs
  • "sheaf theory" → finds persistent-sheaf, sheaf-cohomology, sheaf-agents-c, sheaf-coherence
  • "agent timing" → finds agent-cadence, agent-rubato, agent-groove, agent-swing

Keyword search misses cross-domain connections. Semantic embeddings catch them.

API

Ingest

curl -X POST http://localhost:8787/ingest \
  -H "Content-Type: application/json" \
  -d '{
    "crates": [{
      "name": "conservation-law",
      "description": "Core invariant for constraint-aware AI systems",
      "readme": "# Conservation Law\n\nImplements γ + η = C...",
      "version": "0.2.1",
      "keywords": ["conservation", "invariant", "ternary"]
    }]
  }'
curl -X POST http://localhost:8787/search \
  -H "Content-Type: application/json" \
  -d '{" query": "agent coordination with conservation laws", "topK": 5 }'

Find Similar

curl -X POST http://localhost:8787/similar \
  -H "Content-Type: application/json" \
  -d '{"crate_name": "conservation-law", "topK": 10}'

Debug Embed

curl -X POST http://localhost:8787/embed \
  -H "Content-Type: application/json" \
  -d '{"text": "ternary mathematics for agent systems"}'
# Returns: 384-dim vector, magnitude, preview

Endpoints

MethodPathDescription
POST/ingestIngest crate(s): README → Workers AI → Vectorize
POST/searchSemantic search across all crates
POST/similarFind crates similar to a given crate
GET/crates/:nameGet crate metadata + README preview
GET/statsIndex statistics
POST/embedDebug: embed arbitrary text
GET/healthHealth check

Batch Ingestion

# Ingest all crates from local filesystem
npm run ingest -- --api http://localhost:8787 --repos /home/phoenix/repos

# Dry run first
npm run ingest -- --dry-run

# Limit to first 10 for testing
npm run ingest -- --limit=10

Architecture Decisions

Why bge-small-en-v1.5 (384-dim) not bge-m3 (1024-dim)?

  • Latency: 384-dim embeddings are ~3x faster to generate at the edge
  • Cost: Fewer dimensions = cheaper Vectorize storage
  • Accuracy: For crate descriptions (technical English), 384-dim is sufficient
  • Upgrade path: Swap to @cf/baai/bge-m3 in wrangler.toml when needed

Why CLS pooling?

Cloudflare recommends pooling: 'cls' for bge models — uses the [CLS] token representation which captures full-sequence semantics better than mean pooling.

Why normalize to unit vectors?

Cosine similarity is the standard for semantic search. Unit vectors make dot product = cosine similarity, which is what Vectorize uses internally.

Storage

StorePurposeRetention
Vectorize384-dim embeddings + metadataPermanent
KVFull crate metadata JSON30 days (refresh on ingest)
R2Raw README.md filesPermanent

Local Development

npm install
npm run dev     # Starts wrangler dev on :8787
npm test        # Run unit tests

Deployment

# Create Vectorize index first
wrangler vectorize create fleet-crates --dimensions=384 --metric=cosine

# Deploy
npm run deploy

License

MIT OR Apache-2.0

FAQs

Package last updated on 11 Jun 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts