forked from JSONbored/metagraphed
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwrangler.jsonc
More file actions
181 lines (181 loc) · 6.72 KB
/
Copy pathwrangler.jsonc
File metadata and controls
181 lines (181 loc) · 6.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
{
"$schema": "./node_modules/wrangler/config-schema.json",
"name": "metagraphed",
"main": "workers/api.mjs",
"compatibility_date": "2026-06-06",
"compatibility_flags": ["nodejs_compat"],
"minify": true,
"observability": {
"enabled": true,
"head_sampling_rate": 1,
"logs": {
"enabled": true,
"head_sampling_rate": 1,
"invocation_logs": true,
},
"traces": {
"enabled": true,
"head_sampling_rate": 1,
},
},
"placement": {
"mode": "smart",
},
"assets": {
"directory": "./public",
"binding": "ASSETS",
"run_worker_first": [
"/",
"/.well-known/api-catalog",
"/.well-known/mcp/server-card.json",
"/.well-known/agent-tools/*",
"/og.png",
"/og",
"/api/*",
"/rpc/*",
"/metagraph/*",
"/mcp",
"/health",
],
"not_found_handling": "404-page",
},
"vars": {
"METAGRAPH_CONTRACT_VERSION": "2026-06-06.1",
"METAGRAPH_ENABLE_RPC_PROXY": "true",
"METAGRAPH_R2_LATEST_PREFIX": "latest/",
// Kill-switch for the AI layer (semantic search + /ask). When "true" and the
// AI/VECTORIZE bindings are present, the routes serve live; otherwise they
// return 503 ai_unavailable. Flip to "false" to instantly disable.
"METAGRAPH_ENABLE_AI": "true",
},
// api.metagraph.sh is the backend worker's custom domain (the canonical agent
// surface). The apex metagraph.sh is the metagraphed-ui worker. Agents hit the
// human-facing apex too, so the machine-discovery PATHS the backend generates
// canonically are routed here as well — these specific routes win over the UI
// worker's apex catch-all, so the SAME backend serves them on both hosts (no
// duplicated content). The UI keeps serving `/` and every human page.
//
// Deliberately NOT routed here (owned by the metagraphed-ui worker on the apex):
// - `/` — stays the UI app; the UI worker adds the homepage RFC 8288
// `Link` header (see metagraphed-ui src/server.ts).
// - `/sitemap.xml` — host-scoped. A sitemap on metagraph.sh must list
// metagraph.sh human pages; the UI worker serves that. The
// backend serves its own API/agent sitemap at
// api.metagraph.sh/sitemap.xml. Routing the apex sitemap
// here would shadow the human sitemap with cross-host
// api.metagraph.sh URLs (which crawlers ignore).
"routes": [
{ "pattern": "api.metagraph.sh", "custom_domain": true },
{ "pattern": "metagraph.sh/.well-known/*", "zone_name": "metagraph.sh" },
{ "pattern": "metagraph.sh/llms.txt", "zone_name": "metagraph.sh" },
{ "pattern": "metagraph.sh/llms-full.txt", "zone_name": "metagraph.sh" },
{ "pattern": "metagraph.sh/auth.md", "zone_name": "metagraph.sh" },
{ "pattern": "metagraph.sh/agent.md", "zone_name": "metagraph.sh" },
],
"kv_namespaces": [
{
"binding": "METAGRAPH_CONTROL",
"id": "9c5577a3454d4830b2ffd2f83775efb1",
},
],
"r2_buckets": [
{
"binding": "METAGRAPH_ARCHIVE",
"bucket_name": "metagraphed-artifacts",
},
],
// AI-native layer (semantic search + grounded /ask). Workers AI runs the
// embedding (bge-base-en-v1.5, 768-dim) + answer (llama-3.1-8b) models; the
// Vectorize index holds the registry embeddings, refreshed by the daily
// embedding-sync cron. Absent in local/CI, so the AI routes degrade to 503.
"ai": {
"binding": "AI",
},
"vectorize": [
{
"binding": "VECTORIZE",
"index_name": "metagraphed-registry-v2",
},
],
// Live operational-health store. Written every 15 minutes by the cron prober
// (src/health-prober.mjs) and read live by the serving layer — decoupled from
// the 6h build so a stale structural snapshot never freezes health.
"d1_databases": [
{
"binding": "METAGRAPH_HEALTH_DB",
"database_name": "metagraphed-health",
"database_id": "fcb0b856-1829-46a3-a2f1-c1ba3a9a1915",
"migrations_dir": "migrations",
},
],
// Postgres-backed serving (ADR 0013): the dedicated data Worker (wrangler.data.jsonc)
// owns the postgres.js driver + Hyperdrive binding; this Worker routes the
// chain_events / deep-history paths to it, keeping this bundle lean.
"services": [{ "binding": "DATA_API", "service": "metagraphed-data-api" }],
// Cron prober: every 15 minutes probes the operational surfaces into D1/KV
// (served live); the hourly trigger prunes the D1 time-series. 15 min (96
// checks/day/surface) is ample for a registry's uptime + incident signal and
// far politer to the probed subnets than the old 2-min sweep. Registered
// automatically on the next Workers Builds deploy.
"triggers": {
// */3 = fast drain of R2-staged chain-event/neuron batches into D1 (#1346
// Option A, ~5-min ingestion); */15 = health probe; 0 = hourly prune/rollup;
// 37 3 = daily embedding sync; 47 5 = daily neuron-history rollup (#1345).
"crons": [
"*/3 * * * *",
"*/15 * * * *",
"0 * * * *",
"37 3 * * *",
"47 5 * * *",
],
},
// Per-client abuse control for the read-only RPC proxy (an abuse prerequisite
// for enabling METAGRAPH_ENABLE_RPC_PROXY). 100 requests / 60s per client IP;
// `period` must be 10 or 60. The Worker skips the check when this binding is
// absent (local dev), so it only enforces on Cloudflare.
"ratelimits": [
{
"name": "RPC_RATE_LIMITER",
"namespace_id": "1001",
"simple": {
"limit": 100,
"period": 60,
},
},
// Per-client abuse control for the MCP JSON-RPC endpoint. 100 requests /
// 60s per client IP, paired with MCP's body and batch caps so a public POST
// cannot amplify one request into unbounded artifact/KV reads. Skipped when
// the binding is absent (local dev/CI).
{
"name": "MCP_RATE_LIMITER",
"namespace_id": "1003",
"simple": {
"limit": 100,
"period": 60,
},
},
// Per-client abuse control for the AI routes (semantic + /ask). 20 requests
// / 60s per client IP — tighter than the RPC proxy because /ask drives an
// LLM call. Skipped when the binding is absent (local dev/CI).
{
"name": "AI_RATE_LIMITER",
"namespace_id": "1002",
"simple": {
"limit": 20,
"period": 60,
},
},
// Per-client abuse control for Postgres-backed data API routes. 60
// requests / 60s per client IP, paired with strict query validation and DB
// statement timeouts in the data Worker. Skipped when the binding is absent
// (local dev/CI).
{
"name": "DATA_RATE_LIMITER",
"namespace_id": "1004",
"simple": {
"limit": 60,
"period": 60,
},
},
],
}