@zabaca/zbc 0.19.0 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Zabaca
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zabaca/zbc",
3
- "version": "0.19.0",
3
+ "version": "0.20.0",
4
4
  "description": "Zabaca stack CLI — scaffold and deploy infrastructure",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -9,6 +9,7 @@
9
9
  },
10
10
  "files": [
11
11
  "CHANGELOG.md",
12
+ "LICENSE",
12
13
  "bin",
13
14
  "src",
14
15
  "templates",
@@ -25,6 +25,29 @@ function substitute(body: string, vars: Record<string, string>): string {
25
25
  })
26
26
  }
27
27
 
28
+ /**
29
+ * Extensions a template may carry that are bytes rather than source. Kept as an
30
+ * allow-list rather than sniffed: a template tree is ours, so what is in it is
31
+ * known, and a guess that reads a source file as binary would silently stop
32
+ * substituting its `{{VARS}}`.
33
+ */
34
+ const BINARY_TEMPLATE_EXTENSIONS = new Set([
35
+ '.png',
36
+ '.jpg',
37
+ '.jpeg',
38
+ '.gif',
39
+ '.webp',
40
+ '.avif',
41
+ '.ico',
42
+ '.woff',
43
+ '.woff2',
44
+ '.pdf',
45
+ ])
46
+
47
+ function isBinaryTemplate(sourcePath: string): boolean {
48
+ return BINARY_TEMPLATE_EXTENSIONS.has(path.extname(sourcePath).toLowerCase())
49
+ }
50
+
28
51
  /**
29
52
  * Copy a single template file. Returns true if written, false if skipped.
30
53
  * Always logs the action.
@@ -42,6 +65,20 @@ export async function copyTemplateFile(
42
65
  return false
43
66
  }
44
67
 
68
+ // A binary template is copied as bytes, not as text. Every template was text
69
+ // until walgit's `assets/agentgit-og.png` — the card its Worker serves — and
70
+ // reading a file as UTF-8 and writing the string back does not round-trip:
71
+ // the bytes that are not valid UTF-8 come out as U+FFFD, so the scaffolded
72
+ // PNG is not a PNG. Substitution is skipped too, deliberately: `{{VARS}}` is
73
+ // a source-text convention and a match inside compressed bytes would be
74
+ // damage rather than configuration.
75
+ if (isBinaryTemplate(sourcePath)) {
76
+ await fs.mkdir(path.dirname(destPath), { recursive: true })
77
+ await Bun.write(destPath, Bun.file(sourcePath))
78
+ console.log(` write ${path.relative(process.cwd(), destPath)}`)
79
+ return true
80
+ }
81
+
45
82
  let body = await Bun.file(sourcePath).text()
46
83
  if (opts.vars) body = substitute(body, opts.vars)
47
84
 
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "name": "@zbc/inbox",
3
+ "license": "MIT",
3
4
  "version": "0.0.1",
4
5
  "private": true,
5
6
  "type": "module",
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "name": "secret-relay",
3
+ "license": "MIT",
3
4
  "private": true,
4
5
  "type": "module",
5
6
  "description": "zbc Secret Relay — brokers E2E-encrypted Secret Requests between the CLI and a browser",
@@ -1,3 +1,5 @@
1
+ <img src="assets/agentgit-mark.svg" alt="" width="72" height="72">
2
+
1
3
  # walgit
2
4
 
3
5
  A git host where **object storage holds the write-ahead log and is the source of
@@ -91,13 +93,21 @@ come from the log only, because two records of one fact disagree the first time
91
93
  a write fails between them.
92
94
 
93
95
  Each datapoint carries, as blobs: `kind` (`clone-advertise`, `clone`,
94
- `push-advertise`, `push`, `instructions`, `health`, `other`), `outcome`
96
+ `push-advertise`, `push`, `instructions`, `landing`, `og-image`, `favicon`,
97
+ `provenance`, `health`, `other`), `outcome`
95
98
  (`ok`/`reject`), `reject`, `repo`, `temperature` (`cold`/`warm`), `answered`
96
- (`container`/`edge`); and as doubles: `status`, `ttfb_ms`, `total_ms`,
99
+ (`container`/`edge`), `bucket`; and as doubles: `status`, `ttfb_ms`, `total_ms`,
97
100
  `bytes_served`, `bytes_received`, `cold`. The index is `kind`, so refusals — the
98
101
  rare thing an operator is hunting — are sampled independently of clones, the
99
102
  loud thing.
100
103
 
104
+ `bucket` (blob7) is the shape of an **unroutable** path, and is written only for
105
+ `kind = other`, empty everywhere else: one of `favicon`, `apple-touch`,
106
+ `well-known`, `dotfile`, `php`, `bare-name`, `else`. It exists because the
107
+ dataset records no path on purpose — a path is attacker-controlled and unbounded
108
+ — which left a burst of 404s unattributable. A bucket name is bounded, so the
109
+ question "what are these?" is a `GROUP BY` rather than a guess.
110
+
101
111
  Refusals are counted **by kind**, never as an error rate, because the kinds mean
102
112
  different things: `size-cap` (abuse or a misconfigured client), `collision` (a
103
113
  product signal about naming), `unauthorized`, `not-found`, `unavailable`, and
@@ -125,6 +135,14 @@ SELECT blob1 AS kind, blob3 AS reject, count() AS n, sum(double4) AS bytes_serve
125
135
  FROM walgit_requests WHERE timestamp > now() - INTERVAL '24' HOUR GROUP BY kind, reject
126
136
  ```
127
137
 
138
+ And what the 404s actually are:
139
+
140
+ ```sql
141
+ SELECT blob7 AS bucket, sum(_sample_interval) AS n
142
+ FROM walgit_requests WHERE index1 = 'other' AND timestamp > now() - INTERVAL '24' HOUR
143
+ GROUP BY bucket
144
+ ```
145
+
128
146
  It runs where the app's environment is — inside the container, or anywhere the
129
147
  same `WALGIT_*` variables are set:
130
148
 
@@ -475,6 +493,18 @@ nobody reads (`operatorFrom`, `shared/operator.ts`). A contact that is an email
475
493
  address or an `https://` URL is rendered as a link on the page; anything else is
476
494
  rendered as text.
477
495
 
496
+ `WALGIT_POSTHOG_KEY` turns on **browser analytics** on the landing page, and
497
+ `WALGIT_POSTHOG_HOST` says where to send them (PostHog Cloud US unless set —
498
+ usually set to a reverse proxy on the deployment's own name, with
499
+ `WALGIT_POSTHOG_UI_HOST` naming the PostHog region the project lives in).
500
+ Edge-only for the same reason as the operator pair: the container renders
501
+ nothing a browser runs. The edge telemetry above already counts page views and
502
+ records nothing about who made them; this is for the questions it cannot
503
+ answer — referrer, scroll depth, return visits — once traffic is real. The
504
+ snippet creates no profile for an anonymous reader; session replay follows
505
+ the PostHog project's own setting. Unset, the page carries no script at all (`analyticsFrom`,
506
+ `shared/analytics.ts`).
507
+
478
508
  For the three boolean flags — `WALGIT_APPEND_ONLY`, `WALGIT_PUBLIC` and
479
509
  `WALGIT_SIGNER_LISTS` — **on means `1` or `true`, and nothing else**
480
510
  (`flagEnabled`, `shared/policy.ts`). An unrecognised value (`yes`, `on`, `TRUE`)
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><rect width="32" height="32" rx="7" fill="#ede6de"/><g transform="translate(1 1) scale(.9375)"><path stroke="#14100e" fill="none" stroke-width="4.5" d="M9 25V9M9 13c0 6 14 3 14 11"/><circle fill="#14100e" cx="9" cy="8" r="5"/><circle fill="#14100e" cx="9" cy="25" r="5"/><rect fill="#c56a3e" x="17.5" y="18.5" width="11" height="11" rx="2"/></g></svg>
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "name": "@zbc/walgit",
3
+ "license": "MIT",
3
4
  "version": "0.0.1",
4
5
  "private": true,
5
6
  "type": "module",
@@ -0,0 +1,100 @@
1
+ /**
2
+ * Browser analytics on the landing page, or none.
3
+ *
4
+ * `shared/telemetry.ts` already counts every request at the edge, page views
5
+ * included, and records nothing about who made them — no IP, no user agent —
6
+ * by design. That answers "how many", and it cannot answer what a launch page
7
+ * actually needs to know once traffic is real: where a reader came from,
8
+ * whether they scrolled to the clone command, whether the same person came
9
+ * back. Those are browser questions, and a browser tool answers them.
10
+ *
11
+ * Off unless the instance says otherwise. The project key is a public,
12
+ * write-only token — it lands in the page source of every PostHog site — but
13
+ * WHICH project is an instance's business, not the template's: this package
14
+ * ships to other companies, and a hard-coded key would send their readers to
15
+ * ours. So the key and host are two edge-only variables, read here the way
16
+ * `shared/operator.ts` reads its two, and the page carries no script at all
17
+ * when the key is unset. Edge-only for the same reason the operator is: the
18
+ * container serves nothing a browser renders, and putting the key on
19
+ * `CONTAINER_ENV` would restart the container to rotate it.
20
+ *
21
+ * What the snippet is told: no person profiles for anonymous readers. Session
22
+ * replay is left to the PostHog project's own setting — the page has no forms
23
+ * and nothing to type into, so a recording shows scrolling and clicks and
24
+ * PostHog's default input masking covers the rest. Turned on 2026-09-18 after
25
+ * shipping off for a day; an operator who wants it off again sets it off in
26
+ * the project, not here.
27
+ */
28
+
29
+ /** The variables analytics is read from, and only those. */
30
+ export type AnalyticsVar = 'WALGIT_POSTHOG_KEY' | 'WALGIT_POSTHOG_HOST' | 'WALGIT_POSTHOG_UI_HOST'
31
+
32
+ /** An environment named exactly by those variables — see `OperatorEnv`. */
33
+ export type AnalyticsEnv = Partial<Record<AnalyticsVar, string>>
34
+
35
+ export type Analytics = {
36
+ /** The PostHog project API key, `phc_…`. */
37
+ key: string
38
+ /**
39
+ * The ingestion origin. PostHog Cloud US unless the instance says EU,
40
+ * self-hosted, or — the usual reason to set it — a reverse proxy on the
41
+ * deployment's own name, so a browser sees one first-party origin.
42
+ */
43
+ host: string
44
+ /**
45
+ * The PostHog app the project lives in. Only matters when `host` is a
46
+ * proxy: the SDK needs it to reach the toolbar and the app's own endpoints,
47
+ * which the proxy does not carry. Harmless otherwise.
48
+ */
49
+ uiHost: string
50
+ }
51
+
52
+ export const DEFAULT_POSTHOG_HOST = 'https://us.i.posthog.com'
53
+ export const DEFAULT_POSTHOG_UI_HOST = 'https://us.posthog.com'
54
+
55
+ /**
56
+ * The `defaults` date the SDK is initialised with — PostHog's own mechanism
57
+ * for shipping new default behaviour without breaking an existing snippet.
58
+ * Bump deliberately, after reading what changed.
59
+ */
60
+ export const POSTHOG_DEFAULTS = '2026-05-30'
61
+
62
+ /** Read an environment into an analytics config, or `null` for "off". */
63
+ export function analyticsFrom(
64
+ env: AnalyticsEnv | Record<string, string | undefined>,
65
+ ): Analytics | null {
66
+ const key = trimmed(env.WALGIT_POSTHOG_KEY)
67
+ if (key === null) return null
68
+ return {
69
+ key,
70
+ host: trimmed(env.WALGIT_POSTHOG_HOST) ?? DEFAULT_POSTHOG_HOST,
71
+ uiHost: trimmed(env.WALGIT_POSTHOG_UI_HOST) ?? DEFAULT_POSTHOG_UI_HOST,
72
+ }
73
+ }
74
+
75
+ /**
76
+ * The `<script>` the head carries, or the empty string.
77
+ *
78
+ * PostHog's own loader stub, verbatim from their docs, then `init`. The two
79
+ * values are interpolated as JSON string literals, so a key or host containing
80
+ * a quote cannot close the literal early — both come from an operator's own
81
+ * config, but "cannot" is cheaper than "would not".
82
+ */
83
+ export function analyticsScript(analytics: Analytics | null): string {
84
+ if (analytics === null) return ''
85
+ const key = JSON.stringify(analytics.key)
86
+ const host = JSON.stringify(analytics.host)
87
+ const uiHost = JSON.stringify(analytics.uiHost)
88
+ return (
89
+ '<script>\n' +
90
+ '!function(t,e){var o,n,p,r;e.__SV||(window.posthog=e,e._i=[],e.init=function(i,s,a){function g(t,e){var o=e.split(".");2==o.length&&(t=t[o[0]],e=o[1]),t[e]=function(){t.push([e].concat(Array.prototype.slice.call(arguments,0)))}}(p=t.createElement("script")).type="text/javascript",p.crossOrigin="anonymous",p.async=!0,p.src=s.api_host.replace(".i.posthog.com","-assets.i.posthog.com")+"/static/array.js",(r=t.getElementsByTagName("script")[0]).parentNode.insertBefore(p,r);var u=e;for(void 0!==a?u=e[a]=[]:a="posthog",u.people=u.people||[],u.toString=function(t){var e="posthog";return"posthog"!==a&&(e+="."+a),t||(e+=" (stub)"),e},u.people.toString=function(){return u.toString(1)+".people (stub)"},o="init capture register register_once register_for_session unregister unregister_for_session getFeatureFlag getFeatureFlagPayload isFeatureEnabled reloadFeatureFlags updateEarlyAccessFeatureEnrollment getEarlyAccessFeatures on onFeatureFlags onSessionId getSurveys getActiveMatchingSurveys renderSurvey canRenderSurvey getNextSurveyStep identify setPersonProperties group resetGroups setPersonPropertiesForFlags resetPersonPropertiesForFlags setGroupPropertiesForFlags resetGroupPropertiesForFlags reset get_distinct_id getGroups get_session_id get_session_replay_url alias set_config startSessionRecording stopSessionRecording sessionRecordingStarted captureException loadToolbar get_property getSessionProperty createPersonProfile opt_in_capturing opt_out_capturing has_opted_in_capturing has_opted_out_capturing clear_opt_in_out_capturing debug".split(" "),n=0;n<o.length;n++)g(u,o[n]);e._i.push([i,s,a])},e.__SV=1)}(document,window.posthog||[]);\n' +
91
+ `posthog.init(${key},{api_host:${host},ui_host:${uiHost},defaults:"${POSTHOG_DEFAULTS}",person_profiles:"identified_only"});\n` +
92
+ '</script>\n'
93
+ )
94
+ }
95
+
96
+ const trimmed = (raw: string | undefined): string | null => {
97
+ if (raw === undefined) return null
98
+ const value = raw.trim()
99
+ return value === '' ? null : value
100
+ }
@@ -0,0 +1,72 @@
1
+ /**
2
+ * `/favicon.ico` and the touch icons — the requests a browser makes without
3
+ * being asked.
4
+ *
5
+ * The head already carries the mark as a data URI (`shared/landing.ts`), which
6
+ * is enough for Chrome and Firefox and is not enough for anyone else: Safari,
7
+ * most link unfurlers and every feed reader ask for `/favicon.ico` regardless.
8
+ * Until this module existed those requests fell through to the container and
9
+ * came back 404 — during the 2026-09-18 launch burst, ~282 of them in two
10
+ * hours, tracking landing page views nearly one for one. Every one was a
11
+ * container round trip for a file the edge can answer from a string constant.
12
+ *
13
+ * So the same shape `shared/robots.ts` and `shared/og-image.ts` have: this
14
+ * module states the paths, the methods and the headers, the Worker owns the
15
+ * response. Runtime-neutral (docs/adr/0010), so a test reaches it with no
16
+ * runtime.
17
+ *
18
+ * No collision with a repository, the same argument the other two make:
19
+ * smart-HTTP paths are `/<name>.git/…`, so a repository literally called
20
+ * `favicon.ico` is reached at `/favicon.ico.git/…` and is untouched by this
21
+ * route.
22
+ */
23
+
24
+ import { MARK_SVG } from './landing'
25
+
26
+ /** The one icon path every client asks for whatever the head says. */
27
+ export const FAVICON_PATH = '/favicon.ico'
28
+
29
+ /**
30
+ * The two paths iOS and macOS ask for when a page is bookmarked, neither of
31
+ * which is declared in the head. There is no raster to serve them, and a
32
+ * missing one is not an error worth a body — see `TOUCH_ICON_STATUS`.
33
+ */
34
+ export const TOUCH_ICON_PATHS = ['/apple-touch-icon.png', '/apple-touch-icon-precomposed.png']
35
+
36
+ /**
37
+ * The bytes are the mark the head inlines, read from the one constant, so the
38
+ * tab icon and the masthead cannot drift apart.
39
+ *
40
+ * Served as SVG under a `.ico` name deliberately: the extension is what clients
41
+ * request, and every client that requests it honours the `content-type` over
42
+ * the name. An actual ICO would be a second rendering of the same mark to keep
43
+ * in sync, which is the thing this whole file exists to avoid.
44
+ */
45
+ export const FAVICON_BODY = MARK_SVG
46
+ export const FAVICON_CONTENT_TYPE = 'image/svg+xml'
47
+
48
+ /**
49
+ * 204: there is no raster, and a 404 is what the browser retries. A no-content
50
+ * answer is the cheapest way to say "there is nothing here, stop asking", and
51
+ * with the cache header below it is asked once a day rather than once a page.
52
+ */
53
+ export const TOUCH_ICON_STATUS = 204
54
+
55
+ /**
56
+ * A day, for the same reason the card's picture gets one (`shared/og-image.ts`):
57
+ * the mark states no capability and no limit, so nothing in it can outlive a
58
+ * config change, and this is exactly the traffic worth absorbing at the edge.
59
+ */
60
+ export const ICON_CACHE_CONTROL = 'public, max-age=86400'
61
+
62
+ /** Only GET or HEAD on the one path. A POST to it is git, and falls through. */
63
+ export function wantsFavicon(method: string, pathname: string): boolean {
64
+ if (method !== 'GET' && method !== 'HEAD') return false
65
+ return pathname === FAVICON_PATH
66
+ }
67
+
68
+ /** Only GET or HEAD on the two touch-icon paths. */
69
+ export function wantsTouchIcon(method: string, pathname: string): boolean {
70
+ if (method !== 'GET' && method !== 'HEAD') return false
71
+ return TOUCH_ICON_PATHS.includes(pathname)
72
+ }
@@ -50,7 +50,9 @@
50
50
  */
51
51
 
52
52
  import type { Capabilities } from './capabilities'
53
+ import { analyticsScript, type Analytics } from './analytics'
53
54
  import { contactHref, type Operator } from './operator'
55
+ import { OG_IMAGE_HEIGHT, OG_IMAGE_PATH, OG_IMAGE_WIDTH } from './og-image'
54
56
  import { describeBytes, describeWindow } from './policy'
55
57
  import { EVENTS_PATH, SIGNERS_REF } from './protocol'
56
58
  import { CONTENT_SIGNAL } from './robots'
@@ -872,32 +874,43 @@ function roadmapPulls(caps: Capabilities): string {
872
874
  }
873
875
 
874
876
  /**
875
- * The standfirst under `What's next.`, which has to survive the rows leaving.
877
+ * `What's next.`, which has to survive its rows leaving — all of them.
876
878
  *
877
879
  * The two functions above are the page's best rule applied to a promise: a row
878
880
  * LEAVES when its deployment ships the thing, so the list is always what is
879
- * still ahead. What nobody checked is what the sentence above the list says
880
- * once three of the four rows have left. *"Where this is going, in the order it
881
- * gets there"* promises a sequence, and on the deployment that has shipped the
882
- * most — Signer Lists, Reader Lists and Proposals all on, which is agentgit —
883
- * the list under it is one row. A standfirst describing an ORDER over a single
884
- * item reads as a roadmap that ran out rather than one that was delivered.
885
- *
886
- * So the lede is rendered from the same fragments the list is built from: the
887
- * rows are COUNTED out of the markup rather than re-derived from the flags,
888
- * because a count computed from the capabilities is a second reading of the
889
- * same question and the two would eventually disagree. `<h3>` is one per row.
890
- *
891
- * The no-date promise is in both spellings. It is the one thing on this page
892
- * that is not rendered from config, so it is the one sentence that has to admit
893
- * as much however many rows are left to admit it about.
881
+ * still ahead. The section follows the same rule. It used to end in a CI row
882
+ * that never left, because nothing on any deployment could ship it — and that
883
+ * was the tell: CI is a runner, with logs, status and compute of its own,
884
+ * which is a different product, not the next feature of this one. With that
885
+ * row gone the deployment that has shipped the most (agentgit: Signer Lists,
886
+ * Reader Lists, Proposals) has nothing left to promise, and a heading over an
887
+ * empty list would say the roadmap ran out. So the section renders only where
888
+ * a row is left, and the fine print that used to close it (`permanence`,
889
+ * `limits`) stands on its own below, on every deployment.
890
+ *
891
+ * The lede counts rows out of the markup rather than re-deriving them from
892
+ * the flags — a second reading of the same question would eventually
893
+ * disagree with the first. One row gets a sentence that promises no order.
894
894
  */
895
- function roadmapLede(caps: Capabilities): string {
896
- const rows = 1 + (roadmapOwnership(caps) + roadmapPulls(caps)).split('<h3>').length - 1
895
+ function roadmapSection(caps: Capabilities): string {
896
+ const rows = roadmapOwnership(caps) + roadmapPulls(caps)
897
+ const count = rows.split('<h3>').length - 1
898
+ if (count === 0) return ''
897
899
 
898
- return rows === 1
899
- ? 'One thing is left, and nothing here is a date — it is designed in the open before it ships.'
900
- : 'Where this is going, in the order it gets there. Nothing here is a date — each one is designed in the open before it ships.'
900
+ const lede =
901
+ count === 1
902
+ ? 'One thing is left, and nothing here is a date — it is designed in the open before it ships.'
903
+ : 'Where this is going, in the order it gets there. Nothing here is a date — each one is designed in the open before it ships.'
904
+
905
+ return `
906
+ <section>
907
+ <h2>What's next.</h2>
908
+ <p>${lede}</p>
909
+ <ul class="road">
910
+ ${rows}
911
+ </ul>
912
+ </section>
913
+ `
901
914
  }
902
915
 
903
916
  /**
@@ -1075,18 +1088,23 @@ export function renderLanding(
1075
1088
  * fixture that is not about the operator wants to say.
1076
1089
  */
1077
1090
  operator: Operator | null = null,
1091
+ /**
1092
+ * Browser analytics (`shared/analytics.ts`), beside the operator for the
1093
+ * same reason: nothing branches on it, the manual never carries it, and a
1094
+ * deployment that configured none renders a page with no script at all.
1095
+ */
1096
+ analytics: Analytics | null = null,
1078
1097
  ): string {
1079
1098
  return (
1080
1099
  PAGE.replaceAll('{{HOST}}', () => host)
1100
+ .replace('{{ANALYTICS}}', () => analyticsScript(analytics))
1081
1101
  // `replaceAll`, because the sentence written to travel now travels in
1082
1102
  // three places: the description, the Open Graph card and the Twitter card.
1083
1103
  // One rendering, substituted thrice — not three strings to keep in step.
1084
1104
  .replaceAll('{{META_DESCRIPTION}}', () => metaDescription(caps))
1085
1105
  .replace('{{HERO_UNDER}}', () => heroUnder(caps))
1086
1106
  .replace('{{CLAIMS}}', () => claims(caps))
1087
- .replace('{{ROADMAP_LEDE}}', () => roadmapLede(caps))
1088
- .replace('{{ROADMAP_OWNERSHIP}}', () => roadmapOwnership(caps))
1089
- .replace('{{ROADMAP_PULLS}}', () => roadmapPulls(caps))
1107
+ .replace('{{ROADMAP}}', () => roadmapSection(caps))
1090
1108
  .replace('{{CLIENT}}', () => clientChapter(caps))
1091
1109
  .replace('{{EVENTS}}', () => eventsSection(host, caps))
1092
1110
  .replace('{{COLLISION}}', () => collisionSection(host, caps))
@@ -1145,6 +1163,45 @@ const WIRE_CLIENT = `
1145
1163
  });
1146
1164
  `
1147
1165
 
1166
+ /**
1167
+ * The mark, once — three commits, and the newest one is a square.
1168
+ *
1169
+ * Two people on the trunk, an agent on the branch: the graph git already
1170
+ * draws, with the one node this host exists for drawn differently. Painted in
1171
+ * the page's own palette (bone tile, ground ink, copper agent) so it holds on
1172
+ * a light tab strip and a dark one without a second asset. Concept sheet: the
1173
+ * "three nodes" mark, framing L, 2026-09-18. The source of truth for the
1174
+ * geometry is `assets/agentgit-mark.svg`, which this is a transcription of and
1175
+ * which the og card is rendered from.
1176
+ *
1177
+ * ONE constant because the mark now appears twice on this page — as the
1178
+ * favicon and in the masthead — and a logo kept in two places drifts, starting
1179
+ * with the copy nobody looks at closely.
1180
+ */
1181
+ const MARK_GEOMETRY = `<rect width="32" height="32" rx="7" fill="#ede6de"/><g transform="translate(1 1) scale(.9375)"><path stroke="#14100e" fill="none" stroke-width="4.5" d="M9 25V9M9 13c0 6 14 3 14 11"/><circle fill="#14100e" cx="9" cy="8" r="5"/><circle fill="#14100e" cx="9" cy="25" r="5"/><rect fill="#c56a3e" x="17.5" y="18.5" width="11" height="11" rx="2"/></g>`
1182
+
1183
+ /**
1184
+ * The mark as a standalone document. Exported because `/favicon.ico` is now a
1185
+ * route too (`shared/favicon.ts`) — the clients that ignore the tag below ask
1186
+ * for that path whatever the head says — and the tag and the route must be the
1187
+ * same picture, so they read one constant.
1188
+ */
1189
+ export const MARK_SVG = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">${MARK_GEOMETRY}</svg>`
1190
+
1191
+ /**
1192
+ * The favicon, inline as a data URI as well as a route: the tag costs no
1193
+ * request for the browsers that honour it, and `shared/favicon.ts` catches the
1194
+ * ones that ask for `/favicon.ico` regardless.
1195
+ */
1196
+ const MARK_FAVICON_HREF = `data:image/svg+xml,${encodeURIComponent(MARK_SVG)}`
1197
+
1198
+ /**
1199
+ * The masthead's copy. Inline, so it is there on the first paint and costs no
1200
+ * request, and `aria-hidden` because the wordmark it sits beside already says
1201
+ * the name — a screen reader announcing both would say it twice.
1202
+ */
1203
+ const MARK_INLINE = `<svg class="mark" viewBox="0 0 32 32" aria-hidden="true" focusable="false">${MARK_GEOMETRY}</svg>`
1204
+
1148
1205
  const PAGE = `<!doctype html>
1149
1206
  <html lang="en">
1150
1207
  <head>
@@ -1163,25 +1220,38 @@ const PAGE = `<!doctype html>
1163
1220
  that says something the page does not is the drift every rendered claim
1164
1221
  here exists to prevent, so the description below is the SAME rendering,
1165
1222
  not a second copy of it.
1166
- No picture, and no card layout that needs one. A preview image has to be
1167
- a fetchable raster at a stable URL, which means an asset in the Worker
1168
- bundle and a route serving it, and neither exists yet. The summary card is
1169
- the one that is honest without a picture; the wide variant pointing at
1170
- nothing degrades worse than this does. -->
1223
+ The picture is the mark, rendered once and committed — assets/
1224
+ agentgit-og.png, served by the Worker at ${OG_IMAGE_PATH}
1225
+ (shared/og-image.ts). It is stated absolutely, on this deployment's own
1226
+ host: a crawler resolves neither a relative path nor a data URI, so a
1227
+ relative one is an empty card that looks filled in. The size is declared
1228
+ because several platforms lay the card out before they have fetched the
1229
+ bytes, and it is the size the PNG is actually rendered at — the two
1230
+ numbers live in shared/og-image.ts so they cannot drift apart. -->
1171
1231
  <meta property="og:type" content="website">
1172
1232
  <meta property="og:site_name" content="agentgit">
1173
1233
  <meta property="og:title" content="agentgit — Git for AI agents">
1174
1234
  <meta property="og:description" content="{{META_DESCRIPTION}}">
1175
1235
  <meta property="og:url" content="https://{{HOST}}/">
1176
- <meta name="twitter:card" content="summary">
1236
+ <meta property="og:image" content="https://{{HOST}}${OG_IMAGE_PATH}">
1237
+ <meta property="og:image:width" content="${OG_IMAGE_WIDTH}">
1238
+ <meta property="og:image:height" content="${OG_IMAGE_HEIGHT}">
1239
+ <meta property="og:image:alt" content="agentgit — Git for AI agents">
1240
+ <meta name="twitter:card" content="summary_large_image">
1177
1241
  <meta name="twitter:title" content="agentgit — Git for AI agents">
1178
1242
  <meta name="twitter:description" content="{{META_DESCRIPTION}}">
1243
+ <meta name="twitter:image" content="https://{{HOST}}${OG_IMAGE_PATH}">
1179
1244
  <!-- The agent-facing version of this page. GET / splits on Accept: a browser
1180
1245
  gets this HTML, everything else gets the manual as text. Fetch tools that
1181
1246
  agents drive send a browser's Accept, so they land here; this is how they
1182
1247
  find the page they wanted. -->
1183
1248
  <link rel="alternate" type="text/plain" href="https://{{HOST}}/llms.txt" title="The manual, for agents">
1184
- <style>
1249
+ <!-- The mark, from the one MARK_GEOMETRY constant above: the favicon and the
1250
+ masthead are the same paths, so they cannot drift. -->
1251
+ <link rel="icon" type="image/svg+xml" href="${MARK_FAVICON_HREF}">
1252
+ <!-- Browser analytics, when the instance configured any (shared/analytics.ts).
1253
+ Empty otherwise: a template that ships to other companies carries no key. -->
1254
+ {{ANALYTICS}}<style>
1185
1255
  /* Deliberately single-theme: a launch page with a fixed identity.
1186
1256
  Every colour is painted explicitly so it holds on either host ground. */
1187
1257
  :root {
@@ -1254,7 +1324,9 @@ const PAGE = `<!doctype html>
1254
1324
  .skip:focus { clip-path: none; color: var(--sunk); }
1255
1325
 
1256
1326
  .badge {
1257
- display: inline-block;
1327
+ display: inline-flex;
1328
+ align-items: center;
1329
+ gap: .5rem;
1258
1330
  font-size: .68rem;
1259
1331
  letter-spacing: .14em;
1260
1332
  text-transform: uppercase;
@@ -1264,6 +1336,16 @@ const PAGE = `<!doctype html>
1264
1336
  margin-bottom: 2rem;
1265
1337
  }
1266
1338
 
1339
+ /* The mark, at the badge's own cap height so it reads as part of the line
1340
+ rather than as a picture next to it. It carries its own bone tile, so it
1341
+ needs nothing from the ground behind it. */
1342
+ .badge .mark {
1343
+ width: 1.15rem;
1344
+ height: 1.15rem;
1345
+ flex: none;
1346
+ display: block;
1347
+ }
1348
+
1267
1349
  h1 {
1268
1350
  font-family: var(--mono);
1269
1351
  font-weight: 700;
@@ -1629,6 +1711,9 @@ const PAGE = `<!doctype html>
1629
1711
  max-width: 58ch;
1630
1712
  margin: 0;
1631
1713
  }
1714
+ /* The fine print stands on its own now that the roadmap can be absent: the
1715
+ same muted line, set a section's distance below whatever came before. */
1716
+ .caveat.fine { margin-top: 5rem; }
1632
1717
 
1633
1718
  /* A chapter break: the rule says "different subject", the kicker names it,
1634
1719
  and the paragraph is the widest prose on the page because it has no
@@ -1701,7 +1786,7 @@ const PAGE = `<!doctype html>
1701
1786
  <div class="wrap">
1702
1787
 
1703
1788
  <main id="start">
1704
- <span class="badge">agentgit — open source, run your own</span>
1789
+ <span class="badge">${MARK_INLINE}<span>agentgit — open source, run your own</span></span>
1705
1790
 
1706
1791
  <h1>Git for AI agents<span class="dot">.</span></h1>
1707
1792
 
@@ -1732,20 +1817,8 @@ const PAGE = `<!doctype html>
1732
1817
  </ul>
1733
1818
  </section>
1734
1819
 
1735
- <section>
1736
- <h2>What's next.</h2>
1737
- <p>{{ROADMAP_LEDE}}</p>
1738
- <ul class="road">
1739
- {{ROADMAP_OWNERSHIP}}
1740
- {{ROADMAP_PULLS}}
1741
- <li>
1742
- <span class="when">Soon</span>
1743
- <h3>CI</h3>
1744
- <p>A ref moving is already an event and the client already runs a command on it, so the step left is running that command somewhere other than your laptop.</p>
1745
- </li>
1746
- </ul>
1747
- <p class="caveat">{{PERMANENCE}} Not a place for anything you cannot lose.{{LIMITS}}</p>
1748
- </section>
1820
+ {{ROADMAP}}
1821
+ <p class="caveat fine">{{PERMANENCE}} Not a place for anything you cannot lose.{{LIMITS}}</p>
1749
1822
  {{OPERATOR}}{{CLOSE}}
1750
1823
  </main>
1751
1824
 
@@ -0,0 +1,51 @@
1
+ /**
2
+ * `/agentgit-og.png` — the picture the link becomes.
3
+ *
4
+ * The head used to argue for a `summary` card on the grounds that a preview
5
+ * image "has to be a fetchable raster at a stable URL, which means an asset in
6
+ * the Worker bundle and a route serving it, and neither exists yet". This is
7
+ * the route, and `assets/agentgit-og.png` is the asset: a card rendered once,
8
+ * from the mark that is already the favicon, and committed. It is NOT rendered
9
+ * per request — a crawler fetching a picture must not wake the container any
10
+ * more than a reader fetching the page does.
11
+ *
12
+ * Everything the document decides is here, and the bytes are not: the Worker
13
+ * imports the PNG (only `worker/` may reach a bundler), and this module states
14
+ * the path, the methods, the dimensions and the headers. That keeps `shared/`
15
+ * runtime-neutral (docs/adr/0010) and keeps the head's advertised size and the
16
+ * served picture's size one pair of numbers.
17
+ *
18
+ * No collision with a repository, the same argument `/robots.txt` and
19
+ * `/llms.txt` make: smart-HTTP paths are `/<name>.git/…`, so a repository
20
+ * literally called `agentgit-og.png` is reached at `/agentgit-og.png.git/…`
21
+ * and is untouched by this route.
22
+ */
23
+
24
+ /** The one path. Named for the site rather than `/og.png` so it reads as the
25
+ * card's picture in a log, a referrer and a README's `<img src>`. */
26
+ export const OG_IMAGE_PATH = '/agentgit-og.png'
27
+
28
+ /** The card size every platform specifies for the large-summary layout. The
29
+ * head advertises these two numbers and the committed PNG is rendered at
30
+ * them; a crawler that finds a different size crops it itself. */
31
+ export const OG_IMAGE_WIDTH = 1200
32
+ export const OG_IMAGE_HEIGHT = 630
33
+
34
+ export const OG_IMAGE_CONTENT_TYPE = 'image/png'
35
+
36
+ /**
37
+ * A day, where the page and the manual get a minute.
38
+ *
39
+ * The reason those two are short is that they render this deployment's limits
40
+ * and capabilities, so a stale copy at the edge states a cap the push path no
41
+ * longer has. The picture renders none of that — it is a mark and a wordmark —
42
+ * so nothing in it can outlive a config change, and the crawlers fetching it
43
+ * are exactly the traffic worth absorbing at the edge.
44
+ */
45
+ export const OG_IMAGE_CACHE_CONTROL = 'public, max-age=86400'
46
+
47
+ /** Only GET or HEAD on the one path. Nothing else is this picture. */
48
+ export function wantsOgImage(method: string, pathname: string): boolean {
49
+ if (method !== 'GET' && method !== 'HEAD') return false
50
+ return pathname === OG_IMAGE_PATH
51
+ }
@@ -54,6 +54,17 @@ export type RequestKind =
54
54
  // would hide the one number a launch actually turns on: how many people read
55
55
  // the page versus how many clients read the protocol.
56
56
  | 'landing'
57
+ // The card's picture (`shared/og-image.ts`), answered at the edge like the
58
+ // page and, like the page, its own kind. A crawler burst fetching a 40 KB
59
+ // raster is not a burst of people reading the page, and counting the two
60
+ // together would put the second number into the first — which is the one
61
+ // number a launch is read by.
62
+ | 'og-image'
63
+ // `/favicon.ico` and the touch icons (`shared/favicon.ts`), answered at the
64
+ // edge. Its own kind rather than `other`, because `other` is the unroutable
65
+ // bucket and these are requests walgit now answers — and because the count
66
+ // is the measure of what the route absorbed.
67
+ | 'favicon'
57
68
  | 'health'
58
69
  // Someone asking who pushed (docs/adr/0011). Its own kind rather than
59
70
  // `other`, because `other` is the unroutable bucket and a provenance read is
@@ -69,6 +80,56 @@ export interface RequestFacts {
69
80
  kind: RequestKind
70
81
  /** The repository the path names, or `''` for a request that names none. */
71
82
  repo: string
83
+ /**
84
+ * For kind `other` only: which SHAPE of unroutable path this was. Present
85
+ * nowhere else, because nowhere else is a mystery.
86
+ */
87
+ bucket?: OtherBucket
88
+ }
89
+
90
+ /**
91
+ * The shape of an unroutable path, as a closed set.
92
+ *
93
+ * `other` is where every 404 lands, and until this existed a spike in it was
94
+ * unattributable: the dataset records no path, so the 282 rows of the
95
+ * 2026-09-18 launch burst could only be guessed at (browser favicons, plus a
96
+ * scanner baseline). One bounded blob makes the next such question a SQL query.
97
+ *
98
+ * Bounded is the whole design. A path is attacker-controlled and unbounded, so
99
+ * it never reaches the dataset; what reaches it is one of these seven names,
100
+ * and an input that matches none of them is `else`.
101
+ */
102
+ export type OtherBucket =
103
+ | 'favicon'
104
+ | 'apple-touch'
105
+ | 'well-known'
106
+ | 'dotfile'
107
+ | 'php'
108
+ | 'bare-name'
109
+ | 'else'
110
+
111
+ /**
112
+ * Sort a path into one of the seven. Pure, total and never throwing: a bucket
113
+ * is a count, and a count is never worth failing a request over, so anything
114
+ * unexpected is `else`.
115
+ *
116
+ * `favicon` and `apple-touch` should be empty once the edge routes answer them
117
+ * (`shared/favicon.ts`) — they are kept as tripwires, so a route that stops
118
+ * matching shows up as rows rather than as silence.
119
+ */
120
+ export function otherBucket(pathname: string): OtherBucket {
121
+ try {
122
+ if (pathname === '/favicon.ico' || pathname === '/favicon.svg') return 'favicon'
123
+ if (pathname.startsWith('/apple-touch-icon')) return 'apple-touch'
124
+ if (pathname.startsWith('/.well-known/')) return 'well-known'
125
+ const segments = pathname.split('/').filter((s) => s.length > 0)
126
+ if (segments.some((s) => s.startsWith('.'))) return 'dotfile'
127
+ if (pathname.endsWith('.php')) return 'php'
128
+ if (segments.length === 1 && !segments[0]!.includes('.')) return 'bare-name'
129
+ return 'else'
130
+ } catch {
131
+ return 'else'
132
+ }
72
133
  }
73
134
 
74
135
  /**
@@ -98,7 +159,7 @@ export function classifyRequest(method: string, pathname: string, search: string
98
159
  }
99
160
 
100
161
  const route = SMART_HTTP.exec(pathname)
101
- if (!route) return { kind: 'other', repo: '' }
162
+ if (!route) return { kind: 'other', repo: '', bucket: otherBucket(pathname) }
102
163
  const repo = route[1]!
103
164
 
104
165
  if (route[2] === 'git-upload-pack') return { kind: 'clone', repo }
@@ -109,7 +170,9 @@ export function classifyRequest(method: string, pathname: string, search: string
109
170
  const service = new URLSearchParams(search).get('service')
110
171
  if (service === 'git-receive-pack') return { kind: 'push-advertise', repo }
111
172
  if (service === 'git-upload-pack') return { kind: 'clone-advertise', repo }
112
- return { kind: 'other', repo }
173
+ // A smart-HTTP-shaped path that named no service: routable enough to name a
174
+ // repository, so the bucket is `else` rather than anything about the shape.
175
+ return { kind: 'other', repo, bucket: 'else' }
113
176
  }
114
177
 
115
178
  /**
@@ -146,6 +209,11 @@ function fromStatus(status: number): RejectKind {
146
209
  export interface RequestMetric {
147
210
  kind: RequestKind
148
211
  repo: string
212
+ /**
213
+ * For kind `other`: which shape of unroutable path. Every other kind writes
214
+ * `''`, so the column exists on every row and a `GROUP BY` over it is honest.
215
+ */
216
+ bucket?: OtherBucket
149
217
  outcome: Outcome
150
218
  reject: RejectKind | ''
151
219
  status: number
@@ -188,6 +256,10 @@ export function toDataPoint(metric: RequestMetric): DataPoint {
188
256
  metric.repo,
189
257
  metric.cold ? 'cold' : 'warm',
190
258
  metric.served ? 'container' : 'edge',
259
+ // Seventh blob, added after a launch burst of unattributable 404s. A
260
+ // bucket name or `''` — never the path (see `otherBucket`). Appending
261
+ // rather than inserting is what keeps every existing query working.
262
+ metric.kind === 'other' ? (metric.bucket ?? 'else') : '',
191
263
  ],
192
264
  doubles: [
193
265
  metric.status,
@@ -208,6 +280,7 @@ export const BLOB_COLUMNS = [
208
280
  'repo',
209
281
  'temperature',
210
282
  'answered',
283
+ 'bucket',
211
284
  ] as const
212
285
  export const DOUBLE_COLUMNS = [
213
286
  'status',
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Binary assets the Worker bundles.
3
+ *
4
+ * `wrangler.jsonc`'s `rules` entry gives `**\/*.png` the `Data` loader, so the
5
+ * bundler turns an import of one into the file's bytes. Only `worker/` may
6
+ * reach a bundler like this — `shared/` is compiled by two programs and may
7
+ * import no runtime (docs/adr/0010), which is why `shared/og-image.ts` holds
8
+ * the route's decisions and none of its bytes.
9
+ */
10
+ declare module '*.png' {
11
+ const bytes: ArrayBuffer
12
+ export default bytes
13
+ }
@@ -33,6 +33,16 @@ import { parseTokens } from '../shared/credentials'
33
33
  import { authorizeAnnounce, authorizeSubscribe } from '../shared/events'
34
34
  import { renderLanding, wantsLanding } from '../shared/landing'
35
35
  import { renderLlms, wantsLlms } from '../shared/llms'
36
+ import {
37
+ FAVICON_BODY,
38
+ FAVICON_CONTENT_TYPE,
39
+ ICON_CACHE_CONTROL,
40
+ TOUCH_ICON_STATUS,
41
+ wantsFavicon,
42
+ wantsTouchIcon,
43
+ } from '../shared/favicon'
44
+ import { OG_IMAGE_CACHE_CONTROL, OG_IMAGE_CONTENT_TYPE, wantsOgImage } from '../shared/og-image'
45
+ import { analyticsFrom } from '../shared/analytics'
36
46
  import { operatorFrom } from '../shared/operator'
37
47
  import { renderRobots, wantsRobots } from '../shared/robots'
38
48
  import {
@@ -51,6 +61,10 @@ import {
51
61
  type RequestMetric,
52
62
  } from '../shared/telemetry'
53
63
  import { BROADCAST_PATH, EVENTS_OBJECT_NAME, WalgitEvents } from './events-do'
64
+ // The card's picture, as bytes in the bundle (wrangler.jsonc's `Data` rule).
65
+ // Rendered once by `scripts/render-og-image.ts` in the zbc repository and
66
+ // committed — never drawn per request.
67
+ import OG_IMAGE_BYTES from '../assets/agentgit-og.png'
54
68
 
55
69
  export interface Env {
56
70
  WALGIT_CONTAINER: DurableObjectNamespace<WalgitContainer>
@@ -149,6 +163,14 @@ export interface Env {
149
163
  */
150
164
  WALGIT_OPERATOR?: string
151
165
  WALGIT_CONTACT?: string
166
+ /**
167
+ * Browser analytics on the landing page (`shared/analytics.ts`). Edge-only,
168
+ * like the two above and for the same reason. Read ONLY through
169
+ * `analyticsFrom`.
170
+ */
171
+ WALGIT_POSTHOG_KEY?: string
172
+ WALGIT_POSTHOG_HOST?: string
173
+ WALGIT_POSTHOG_UI_HOST?: string
152
174
  WALGIT_EVENTS: DurableObjectNamespace<WalgitEvents>
153
175
  }
154
176
 
@@ -285,6 +307,9 @@ export default {
285
307
  // beside the capabilities and passed to both documents, so the page and
286
308
  // the manual cannot name two different operators.
287
309
  const operator = operatorFrom(env)
310
+ // Browser analytics for the page (`shared/analytics.ts`), off unless the
311
+ // instance set a key. Read beside the two reads it mirrors.
312
+ const analytics = analyticsFrom(env)
288
313
 
289
314
  // The browser half of `/`, answered at the edge (shared/landing.ts). Placed
290
315
  // before every other decision on purpose: a link on an aggregator points at
@@ -297,7 +322,7 @@ export default {
297
322
  // them: this document and `/llms.txt` want a bare hostname they prefix
298
323
  // with `https://`/`wss://` themselves, while `GET /` needs a full origin
299
324
  // including the scheme, and one field could not serve both.
300
- const page = renderLanding(url.host, caps, operator)
325
+ const page = renderLanding(url.host, caps, operator, analytics)
301
326
  const bytes = new TextEncoder().encode(page)
302
327
  record(env, ctx, {
303
328
  kind: 'landing',
@@ -397,6 +422,102 @@ export default {
397
422
  })
398
423
  }
399
424
 
425
+ // `/agentgit-og.png` — the picture the card the head advertises is made
426
+ // of (shared/og-image.ts). At the edge for the reason the page is, and
427
+ // more so: the traffic is crawlers, arriving in a burst when a link is
428
+ // posted, and not one of them should wake the container for a picture
429
+ // that changes only on deploy. The bytes are in the bundle, so nothing is
430
+ // fetched to serve it. Same collision argument as `/llms.txt` and
431
+ // `/robots.txt`: a repository called `agentgit-og.png` is reached at
432
+ // `/agentgit-og.png.git/…`, so this route cannot shadow one.
433
+ if (wantsOgImage(request.method, url.pathname)) {
434
+ record(env, ctx, {
435
+ kind: 'og-image',
436
+ repo: '',
437
+ outcome: 'ok',
438
+ reject: '',
439
+ status: 200,
440
+ served: false,
441
+ cold: false,
442
+ ttfbMs: Date.now() - startedAt,
443
+ totalMs: Date.now() - startedAt,
444
+ // A HEAD is answered with headers only, so it served no bytes.
445
+ bytesServed: request.method === 'HEAD' ? 0 : OG_IMAGE_BYTES.byteLength,
446
+ bytesReceived: 0,
447
+ })
448
+ return new Response(request.method === 'HEAD' ? null : OG_IMAGE_BYTES, {
449
+ status: 200,
450
+ headers: {
451
+ 'content-type': OG_IMAGE_CONTENT_TYPE,
452
+ // A day, where the page and the manual get a minute: the picture
453
+ // states no capability and no limit, so nothing in it can outlive a
454
+ // config change.
455
+ 'cache-control': OG_IMAGE_CACHE_CONTROL,
456
+ // A HEAD must answer the size the GET would send; a Response built
457
+ // from a null body would otherwise report none.
458
+ 'content-length': String(OG_IMAGE_BYTES.byteLength),
459
+ },
460
+ })
461
+ }
462
+
463
+ // `/favicon.ico` — the request a browser makes on every first view of the
464
+ // page whatever the head declares, and the one the container was answering
465
+ // 404 to ~282 times in the two hours after the launch link went up. The
466
+ // bytes are the mark the head already inlines, read from one constant
467
+ // (shared/favicon.ts → shared/landing.ts), so the tab and the masthead
468
+ // cannot drift. Same collision argument as `/llms.txt`, `/robots.txt` and
469
+ // `/agentgit-og.png`: a repository called `favicon.ico` is reached at
470
+ // `/favicon.ico.git/…`, so this route cannot shadow one.
471
+ if (wantsFavicon(request.method, url.pathname)) {
472
+ const bytes = new TextEncoder().encode(FAVICON_BODY)
473
+ record(env, ctx, {
474
+ kind: 'favicon',
475
+ repo: '',
476
+ outcome: 'ok',
477
+ reject: '',
478
+ status: 200,
479
+ served: false,
480
+ cold: false,
481
+ ttfbMs: Date.now() - startedAt,
482
+ totalMs: Date.now() - startedAt,
483
+ bytesServed: request.method === 'HEAD' ? 0 : bytes.byteLength,
484
+ bytesReceived: 0,
485
+ })
486
+ return new Response(request.method === 'HEAD' ? null : bytes, {
487
+ status: 200,
488
+ headers: {
489
+ 'content-type': FAVICON_CONTENT_TYPE,
490
+ 'cache-control': ICON_CACHE_CONTROL,
491
+ // A HEAD must answer the size the GET would send.
492
+ 'content-length': String(bytes.byteLength),
493
+ },
494
+ })
495
+ }
496
+
497
+ // The touch icons iOS asks for when a page is bookmarked, which the head
498
+ // does not declare and no raster exists for. 204 rather than 404 because a
499
+ // 404 is what a client retries; with the day-long cache header above, this
500
+ // is asked once a day instead of once a page. Same collision argument.
501
+ if (wantsTouchIcon(request.method, url.pathname)) {
502
+ record(env, ctx, {
503
+ kind: 'favicon',
504
+ repo: '',
505
+ outcome: 'ok',
506
+ reject: '',
507
+ status: TOUCH_ICON_STATUS,
508
+ served: false,
509
+ cold: false,
510
+ ttfbMs: Date.now() - startedAt,
511
+ totalMs: Date.now() - startedAt,
512
+ bytesServed: 0,
513
+ bytesReceived: 0,
514
+ })
515
+ return new Response(null, {
516
+ status: TOUCH_ICON_STATUS,
517
+ headers: { 'cache-control': ICON_CACHE_CONTROL },
518
+ })
519
+ }
520
+
400
521
  // The ref-event stream, answered at the edge for the same reason the
401
522
  // landing page is: a subscription is a socket the container has no reason
402
523
  // to hold, and holding one would keep the single container awake for as
@@ -618,13 +739,16 @@ function stripInternal(request: Request): Request {
618
739
 
619
740
  /** The facts known before the container answers. */
620
741
  function base(
621
- facts: { kind: RequestMetric['kind']; repo: string },
742
+ facts: { kind: RequestMetric['kind']; repo: string; bucket?: RequestMetric['bucket'] },
622
743
  request: Request,
623
- ): Pick<RequestMetric, 'kind' | 'repo' | 'bytesReceived'> {
744
+ ): Pick<RequestMetric, 'kind' | 'repo' | 'bucket' | 'bytesReceived'> {
624
745
  const declared = Number(request.headers.get('content-length') ?? '0')
625
746
  return {
626
747
  kind: facts.kind,
627
748
  repo: facts.repo,
749
+ // Only `other` carries one, and only `other` writes it to the datapoint —
750
+ // which is the one kind that reaches this helper without a route to name.
751
+ bucket: facts.bucket,
628
752
  bytesReceived: Number.isFinite(declared) ? declared : 0,
629
753
  }
630
754
  }
@@ -14,6 +14,16 @@
14
14
  "compatibility_date": "2026-07-01",
15
15
  "compatibility_flags": ["nodejs_compat"],
16
16
  "observability": { "enabled": true },
17
+ // The link-preview card (assets/agentgit-og.png, shared/og-image.ts) travels
18
+ // in the Worker bundle as bytes: a crawler fetching the picture must not
19
+ // wake the container any more than a reader fetching the page does, and a
20
+ // 40 KB flat-colour PNG is cheaper to carry than a second service to fetch
21
+ // it from. `Data` is the loader that makes `import png from './x.png'` the
22
+ // file's ArrayBuffer (worker/assets.d.ts declares that for TypeScript).
23
+ // `fallthrough` so wrangler's own default Data rule (`**/*.bin`) still
24
+ // applies after this one; without it wrangler warns that this rule silently
25
+ // replaces the built-in.
26
+ "rules": [{ "type": "Data", "globs": ["**/*.png"], "fallthrough": true }],
17
27
  "containers": [
18
28
  {
19
29
  "class_name": "WalgitContainer",
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "name": "@zbc/warehouse",
3
+ "license": "MIT",
3
4
  "version": "0.0.1",
4
5
  "private": true,
5
6
  "type": "module",