Create @chatcops/store-redis for Upstash and other Redis clients
I maintainer di solito rispondono entro 1 giorno
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
On Vercel and Workers each request can land on a different instance, so in-memory conversations and rate limits don't work there. Upstash Redis is the usual answer for those platforms, since it's reached over HTTP and works on every runtime. This package is the store for it, and for any other Redis client through a small interface.
This is a bigger one, for someone who has had a few PRs merged here. The interfaces and the tests it has to pass already exist: packages/core/src/storage/types.ts and runStorageConformance from @chatcops/core/testing. CONTRIBUTING.md has a "Writing a store package" section with the package layout.
What to do
Create packages/store-redis:
import { Redis } from '@upstash/redis';
import { redisStorage, fromIoRedis } from '@chatcops/store-redis';
storage: redisStorage({ redis: Redis.fromEnv() })
storage: redisStorage({ redis: fromIoRedis(new IORedis(url)) })
// options: prefix (default 'chatcops'), conversationTtlMs (default 30 days)
- All four capabilities:
conversations(withappend,updateMessage,removeMessage,list,purge),counters,kv(withsetIfAbsent) andevents(withquery). - Define a small
RedisLikeinterface with the commands you need.@upstash/redisshould fit it as is, andfromIoRedisadapts ioredis (itsevaltakes arguments differently).@upstash/redisis an optional peer dependency, and ioredis isn't a dependency at all. - Layout:
- a hash per conversation (
created_at,updated_at,version,metadata) - a list of JSON messages per conversation
- a sorted set of conversation ids by
updated_at, forlistandpurge PEXPIREon the conversation keys, so idle conversations expire on their own
- a hash per conversation (
- Anything that reads and then writes runs as one Lua script (
EVAL), so it's atomic:appendwith its version check,updateMessage,removeMessage, and counter increments that set the expiry only on a new key. Upstash supportsEVAL. kv:SETwithPX, andNXforsetIfAbsent. Values are JSON.events: a capped stream (XADDwithMAXLEN ~), or a hash of counts per hour bucket if that makesquerysimpler. Explain your choice in the PR."private": trueinpackage.json. A maintainer publishes it for the first time.
Testing
CI runs Redis and the Upstash REST emulator. CHATCOPS_TEST_UPSTASH_URL with CHATCOPS_TEST_UPSTASH_TOKEN is for @upstash/redis, and CHATCOPS_TEST_REDIS_URL is for ioredis. Run the suite against both. Locally, docker run -p 6379:6379 redis:7-alpine is enough for the ioredis side.
Acceptance criteria
-
runStorageConformancepasses with nothing skipped through@upstash/redisand throughfromIoRedis - Two storages with different prefixes on one Redis don't see each other's data
- A short README with the Vercel setup
- Changeset for
@chatcops/store-redis(minor) -
pnpm -r build,pnpm test:coverage(90% lines, 80% branches for store packages),pnpm lintandpnpm publintpass
Want to work on this? Comment below and I'll assign it to you. Please take one issue at a time, branch off dev, and open your PR against dev with Closes #<this issue number>. Setup notes (pnpm, build before test) are in CONTRIBUTING.md.
- Lingua principale
- TypeScript
- Stelle
- 13
- Fork
- 7
- Merge medio
- 4h 11m
- PR unite (30g)
- 122
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di codercops/chatcops
-
enhancement hacktoberfest help wanted server
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
I maintainer di solito rispondono entro 1 giorno
-
Document the pre-chat formForse già presa @masyarakatai l’ha presa 4 giorni fa. Apertadocumentation good first issue hacktoberfest widget
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
codercops/chatcops#70 · 3 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement hacktoberfest help wanted server
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
I maintainer di solito rispondono entro 1 giorno
-
enhancement hacktoberfest help wanted server
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
I maintainer di solito rispondono entro 1 giorno
-
core enhancement hacktoberfest help wanted
Difficoltà 3/5 1-2 giorni Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di codercops/chatcops
Issue simili
-
Edit: Tele Posadas HDApertacheck:passed streams:edit
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
area:mcp bug has repro platform:vscode regression
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
anthropics/claude-code#103970 ·
I maintainer di solito rispondono entro 1 giorno
-
skillopt: success-reflect prompt omits the edit schema, so every success-only edit is droppedAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Workspace secrets/constants containing "$" are corrupted when resolved in data source optionsApertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
I maintainer di solito rispondono entro 1 giorno
-
sdk-typescript: unquoted COPY globs in shell form are silently dropped from the image build contextApertabug javascript
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno