Skip to content
114 linesCodeBlameRaw

Pick any line to see why it is the way it is: the commit, the pull request and issue it came from, and what the agent was thinking.

The artifacts service is services/artifacts, the Worker g1t-artifacts, bound as ARTIFACTS by the API, the site and the agents; its live rooms move to it with a Durable Object transfer from g1t-docs-service, and its database, bucket, indexes and queue keep their names. The git store's binding and settings are GITSTORE, its ops scripts gitstore-*, and workflow run artifacts keep their compatible API under run_artifacts modules. The deploy tool puts a Worker that has never deployed before the Workers in its stage that bind to it, and the deploy guide gives the cutover runbook.1{
2 "$schema": "../../node_modules/wrangler/config-schema.json",
3 // Artifacts: docs (and later slides, designs and dashboards), their
4 // spaces, sharing and live editing. Until 2026-10 this Worker was
5 // g1t-docs-service (services/docs); its database, bucket, indexes and
6 // queue kept their names, and its live rooms moved here with the
7 // transfer migration below.
8 "name": "g1t-artifacts",
9 "account_id": "1e6f2cffa3f445920836e8ebe446bb58",
10 "compatibility_date": "2026-09-26",
11 "main": "./src/index.ts",
12 // Reached only through service bindings. The live socket's and uploads'
13 // viewer comes in a header the site sets after checking the session,
14 // which is only safe to trust because nothing else can reach this Worker.
15 "workers_dev": false,
16 "placement": { "mode": "off" },
17 "d1_databases": [
18 {
19 "binding": "DB",
20 "database_name": "g1t-docs",
21 // Create it once, then put its id here:
22 // npx wrangler d1 create g1t-docs
23 // npx wrangler d1 migrations apply g1t-docs --remote
24 "database_id": "8f2193ed-fd2b-4322-b6cb-c79090e7603d",
25 "migrations_dir": "migrations"
26 }
27 ],
28 // Files people put in pages (images, attachments), served from the
29 // usercontent origin at /docs-files/<key> (apps/web/workers/usercontent.ts).
30 // Create it once: npx wrangler r2 bucket create g1t-docs-files
31 // Self-hosted, any S3-compatible store instead: DOCS_FILES=s3 and the
32 // DOCS_S3_* settings (src/files.ts,
33 // docs.g1t.sh/guides/self-hosting-architecture/, "Storage").
34 "r2_buckets": [{ "binding": "FILES", "bucket_name": "g1t-docs-files" }],
35 // The semantic index agents recall from (src/indexer.ts, src/vectors.ts):
36 // Workers AI embeds passages (@cf/baai/bge-base-en-v1.5, 768 dimensions)
37 // into Vectorize, with metadata indexes on workspace_id and space_id so a
38 // query only reads spaces its reader may. Create it once:
39 // npx wrangler vectorize create g1t-docs --dimensions=768 --metric=cosine
40 // npx wrangler vectorize create-metadata-index g1t-docs --property-name=workspace_id --type=string
41 // npx wrangler vectorize create-metadata-index g1t-docs --property-name=space_id --type=string
42 // Without them Docs still keeps passages in D1 and recall matches words.
43 //
44 // Folios (Artifacts mode) have an index of their own, filtered by
45 // workspace, scope and kind. Create it once, before the first deploy that
46 // has this binding:
47 // npx wrangler vectorize create g1t-folios --dimensions=768 --metric=cosine
48 // npx wrangler vectorize create-metadata-index g1t-folios --property-name=workspace_id --type=string
49 // npx wrangler vectorize create-metadata-index g1t-folios --property-name=scope --type=string
50 // npx wrangler vectorize create-metadata-index g1t-folios --property-name=kind --type=string
51 // Without FOLIO_VECTORS, artifacts are searched and recalled by words.
52 "ai": { "binding": "AI" },
53 "vectorize": [
54 { "binding": "VECTORS", "index_name": "g1t-docs" },
55 { "binding": "FOLIO_VECTORS", "index_name": "g1t-folios" }
56 ],
57 "services": [
58 // Workspaces by slug, people's names and avatars, and teams.
59 { "binding": "IDENTITY", "service": "g1t-identity" },
60 // The workspace's agents: who they are, for agents' calls and mentions.
61 { "binding": "AGENTS", "service": "g1t-agents" },
62 // Mentions and suggestions reach people's inboxes (services/notify).
63 { "binding": "NOTIFY", "service": "g1t-notify" },
64 // Who may read a repository, what a change touched, and a project's
65 // docs folder (src/staleness.ts, src/repo-spaces.ts).
66 { "binding": "REPOS", "service": "g1t-repos" },
67 // What a merged pull request changed.
68 { "binding": "WORK", "service": "g1t-work" },
69 // doc.page.* events on the bus (src/events.ts).
70 { "binding": "EVENTS", "service": "g1t-events" }
71 ],
72 // Merges and pushes to default branches: pages whose cited code
73 // changed, and projects' docs read again (src/staleness.ts). The events
74 // service sends it what g1t_contracts::subscribers routes to
75 // SUBSCRIBER_DOCS. Create it once: npx wrangler queues create g1t-events-docs
76 "queues": {
77 // Its own backfill jobs ride the same queue (`docs.index`,
78 // src/indexer.ts): a workspace's pages and projects' docs indexed in
79 // batches, and waiting out the hourly embedding cap.
80 "producers": [{ "binding": "JOBS", "queue": "g1t-events-docs" }],
81 "consumers": [{ "queue": "g1t-events-docs", "max_batch_size": 20, "max_batch_timeout": 2, "max_retries": 3, "dead_letter_queue": "g1t-events-dlq" }]
82 },
83 // One room per page: it holds the page's Yjs document and open sockets,
84 // hibernating while nobody types (src/room.ts). And one per folio
85 // (Artifacts mode, src/folios/room.ts): PageRoom stays until Phase 7
86 // deletes it (`deleted_classes` in a v4 migration).
87 "durable_objects": {
88 "bindings": [
89 { "name": "PAGES", "class_name": "PageRoom" },
90 { "name": "FOLIOS", "class_name": "FolioRoom" }
91 ]
92 },
93 // Both classes were made on g1t-docs-service (v1 PageRoom, v2 FolioRoom,
94 // both SQLite). v3 transfers them, every room's storage with them, when
95 // this Worker first deploys; until the old Worker is deleted, its own
96 // bindings to them forward here. Never add new_sqlite_classes for them:
97 // the transfer makes them. A new Cloudflare account has no
98 // g1t-docs-service to transfer from, and `wrangler dev` learns a class
99 // is SQLite only from new_sqlite_classes: both use
100 // { "tag": "v3", "new_sqlite_classes": ["PageRoom", "FolioRoom"] }
101 // instead (docs.g1t.sh/guides/deploy-to-cloudflare/, "A first deploy").
102 "migrations": [
103 {
104 "tag": "v3",
105 "transferred_classes": [
106 { "from": "PageRoom", "from_script": "g1t-docs-service", "to": "PageRoom" },
107 { "from": "FolioRoom", "from_script": "g1t-docs-service", "to": "FolioRoom" }
108 ]
109 }
110 ],
111 // Daily: folios in the trash for over 30 days are deleted for good.
112 "triggers": { "crons": ["17 3 * * *"] },
113 "observability": { "enabled": true, "head_sampling_rate": 0.1 }
114}