- webhook.ts: createExportedHandler(opts) factory (offline send capture via baseFetch); scheduled() wraps runGuidanceCronTick in ctx.waitUntil — fail-closed unconfigured gate, paginated guidance: KV list (list_complete respected), loadGraph awaited ONCE per tick (the shared R2 memo), per-key getGuidanceSession → projectTurnCards → sendPhoto to envelope.chat_id ONLY (T-06-02), every log a [guidance-cron] category, zero KV writes - guidance-sessions.ts: GUIDANCE_KEY_PREFIX exported — the ONE key-scheme authority (list scans derive prefix + slice ids from it) - wrangler.jsonc: triggers.crons */1 * * * * (60 s scan, cadence in code) - guidance-cron.test.mjs GREEN completion: GC-C3/C5/C8/C9 wire the recording baseFetch through the factory (the header-documented seam — they defined the recorder but never passed it); GC-C7 uses readdirSync (require is undefined in ESM); GC-C1/C8/C9 drain inside the withConsole window (the tick's logs fire under waitUntil) - guidance-envelope.test.mjs: GE7 allows the GUIDANCE_KEY_PREFIX named import - 125/125 bot tests green; bot:typecheck clean
38 lines
2.1 KiB
JSON
38 lines
2.1 KiB
JSON
{
|
||
// KV namespace id is filled in plan 03 task 1 after `npx wrangler kv namespace create chat_sessions`
|
||
"name": "araharah-bot",
|
||
"main": "src/webhook.ts",
|
||
"compatibility_date": "2026-10-22",
|
||
// workers_dev: serve on the <name>.<account>.workers.dev URL — the WEBHOOK_URL
|
||
// target for this phase (Phase 3's custom route/domain may supersede)
|
||
"workers_dev": true,
|
||
// Workers static assets binding (D-13, D-14): serves ../web/dist. The
|
||
// Worker fetch still owns /api/* and /telegram/* first via
|
||
// run_worker_first (a GLOB ARRAY, not a boolean).
|
||
"assets": {
|
||
"directory": "../web/dist",
|
||
"binding": "ASSETS",
|
||
"not_found_handling": "none"
|
||
},
|
||
"run_worker_first": ["/api/*", "/telegram/*"],
|
||
// Public vars (NOT secrets): the deployed Mini App ORIGIN used to build
|
||
// the /cari venue card's OPEN deep link (<MINI_APP_URL>/?dest=<id>).
|
||
// It must equal the Mini App URL registered in @BotFather (Bot API 10.2
|
||
// enforces the origin). Never derived from user input.
|
||
"vars": { "MINI_APP_URL": "https://araharah-bot.araharah-bot.workers.dev" },
|
||
// R2 binding (D-01, the repo's FIRST r2_buckets entry): hosts the road-graph
|
||
// binary /api/route loads (worker-router.ts memoizes ONE GET per cold
|
||
// isolate). A bucket is NOT a KV namespace — GE5 (exactly ONE
|
||
// kv_namespaces) still holds. Forks create + upload their OWN bucket:
|
||
// `npx wrangler r2 bucket create <name>` + routing/scripts/upload-road-graph.mjs
|
||
// (docs/ROAD-GRAPH.md is the fork contract). The bucket name is public
|
||
// configuration, never a secret.
|
||
"r2_buckets": [{ "binding": "ROAD_GRAPH", "bucket_name": "araharah-graphs" }],
|
||
// The repo's FIRST Cron Trigger (06-07, D-11): 60 s scan; card cadence
|
||
// decided in code (CARD_CADENCE_S 180) — D-11's 60–120 s window. The tick
|
||
// is STATELESS (zero KV writes — the free-plan budget law). Local test:
|
||
// curl "http://localhost:8787/cdn-cgi/local/scheduled" against `wrangler dev`.
|
||
"triggers": { "crons": ["*/1 * * * *"] },
|
||
"kv_namespaces": [{ "binding": "chat_sessions", "id": "59f58a54bc44483e89872b20a005a5eb" }]
|
||
}
|