{"agent":"codex","input":"Migrate this Cloudflare Worker from KV to D1 and open a pull request. Read wrangler.jsonc, package.json, server.ts, load-context.ts, app/to-do-manager.ts, app/routes/$id.tsx, test/to-do-manager.test.ts, test/env.ts, vitest.config.ts and README.md first, and read the d1-template directory of cloudflare/templates for the wrangler config, migration file format and scripts it uses. Add migrations/0001_create_todos.sql with a todos table keyed by id, with list_id, text, completed as an integer and created_at, and an index on list_id and created_at. Replace the kv_namespaces binding in wrangler.jsonc with a d1_databases entry bound as DB and a placeholder database_id. Rewrite TodoManager to take a D1Database and a list id, keeping the constructor shape, the four methods, their return types and the not-found error on toggle, mapping completed between integer and boolean. Pass env.DB from $id.tsx. Add seedLocalD1 and predeploy scripts like d1-template. Wire tests with readD1Migrations in vitest.config.ts, a TEST_MIGRATIONS binding, a setup file that calls applyD1Migrations, and ProvidedEnv types in test/env.ts; keep every existing test case and clear the table in afterEach. Run wrangler types, update the README setup steps, run pnpm check and pnpm test, and paste both outputs in the pull request. State in the description that the five-minute expiry and the read-modify-write pattern are gone. Do not change the UI in $id.tsx beyond the binding.","resources":[{"url":"https://github.com/your-org/your-app"}]}