| 1 | { |
| 2 | "$schema": "../../node_modules/wrangler/config-schema.json", |
| 3 | "name": "g1t-docs-service", |
| 4 | "account_id": "1e6f2cffa3f445920836e8ebe446bb58", |
| 5 | "compatibility_date": "2026-09-26", |
| 6 | "main": "./src/index.ts", |
| 7 | // Reached only through service bindings. The live socket's and uploads' |
| 8 | // viewer comes in a header the site sets after checking the session, |
| 9 | // which is only safe to trust because nothing else can reach this Worker. |
| 10 | "workers_dev": false, |
| 11 | "placement": { "mode": "off" }, |
| 12 | "d1_databases": [ |
| 13 | { |
| 14 | "binding": "DB", |
| 15 | "database_name": "g1t-docs", |
| 16 | // Create it once, then put its id here: |
| 17 | // npx wrangler d1 create g1t-docs |
| 18 | // npx wrangler d1 migrations apply g1t-docs --remote |
| 19 | "database_id": "8f2193ed-fd2b-4322-b6cb-c79090e7603d", |
| 20 | "migrations_dir": "migrations" |
| 21 | } |
| 22 | ], |
| 23 | // Files people put in pages (images, attachments), served from the |
| 24 | // usercontent origin at /docs-files/<key> (apps/web/workers/usercontent.ts). |
| 25 | // Create it once: npx wrangler r2 bucket create g1t-docs-files |
| 26 | // Self-hosted, any S3-compatible store instead: DOCS_FILES=s3 and the |
| 27 | // DOCS_S3_* settings (src/files.ts, docs/SELF_HOSTING.md). |
| 28 | "r2_buckets": [{ "binding": "FILES", "bucket_name": "g1t-docs-files" }], |
| 29 | // The semantic index agents recall from (src/indexer.ts, src/vectors.ts): |
| 30 | // Workers AI embeds passages (@cf/baai/bge-base-en-v1.5, 768 dimensions) |
| 31 | // into Vectorize, with metadata indexes on workspace_id and space_id so a |
| 32 | // query only reads spaces its reader may. Create it once: |
| 33 | // npx wrangler vectorize create g1t-docs --dimensions=768 --metric=cosine |
| 34 | // npx wrangler vectorize create-metadata-index g1t-docs --property-name=workspace_id --type=string |
| 35 | // npx wrangler vectorize create-metadata-index g1t-docs --property-name=space_id --type=string |
| 36 | // Without them Docs still keeps passages in D1 and recall matches words. |
| 37 | "ai": { "binding": "AI" }, |
| 38 | "vectorize": [{ "binding": "VECTORS", "index_name": "g1t-docs" }], |
| 39 | "services": [ |
| 40 | // Workspaces by slug, people's names and avatars, and teams. |
| 41 | { "binding": "IDENTITY", "service": "g1t-identity" }, |
| 42 | // The workspace's agents: who they are, for agents' calls and mentions. |
| 43 | { "binding": "AGENTS", "service": "g1t-agents" }, |
| 44 | // Mentions and suggestions reach people's inboxes (services/notify). |
| 45 | { "binding": "NOTIFY", "service": "g1t-notify" }, |
| 46 | // Who may read a repository, what a change touched, and a project's |
| 47 | // docs folder (src/staleness.ts, src/repo-spaces.ts). |
| 48 | { "binding": "REPOS", "service": "g1t-repos" }, |
| 49 | // What a merged pull request changed. |
| 50 | { "binding": "WORK", "service": "g1t-work" }, |
| 51 | // doc.page.* events on the bus (src/events.ts). |
| 52 | { "binding": "EVENTS", "service": "g1t-events" } |
| 53 | ], |
| 54 | // Merges and pushes to default branches: pages whose cited code |
| 55 | // changed, and projects' docs read again (src/staleness.ts). The events |
| 56 | // service sends it what g1t_contracts::subscribers routes to |
| 57 | // SUBSCRIBER_DOCS. Create it once: npx wrangler queues create g1t-events-docs |
| 58 | "queues": { |
| 59 | // Its own backfill jobs ride the same queue (`docs.index`, |
| 60 | // src/indexer.ts): a workspace's pages and projects' docs indexed in |
| 61 | // batches, and waiting out the hourly embedding cap. |
| 62 | "producers": [{ "binding": "JOBS", "queue": "g1t-events-docs" }], |
| 63 | "consumers": [{ "queue": "g1t-events-docs", "max_batch_size": 20, "max_batch_timeout": 2, "max_retries": 3, "dead_letter_queue": "g1t-events-dlq" }] |
| 64 | }, |
| 65 | // One room per page: it holds the page's Yjs document and open sockets, |
| 66 | // hibernating while nobody types (src/room.ts). |
| 67 | "durable_objects": { |
| 68 | "bindings": [{ "name": "PAGES", "class_name": "PageRoom" }] |
| 69 | }, |
| 70 | "migrations": [{ "tag": "v1", "new_sqlite_classes": ["PageRoom"] }], |
| 71 | "observability": { "enabled": true, "head_sampling_rate": 0.1 } |
| 72 | } |