State Store
Set id yang sudah dilihat dengan TTL (filter_unseen), key/value JSON dan counter atomik
Stabil v0.1.0 Node.js 11 aksi
Tentang
Plugin Graphrt yang memberi workflow memori lokal yang kecil. Tugas utamanya untuk polling. Workflow yang mengecek komentar, DM atau pesanan baru setiap beberapa menit memanggil filter_unseen dan hanya memproses id yang belum pernah dilihat. Plugin ini juga menyimpan nilai JSON kecil dan counter atomik.
Yang bisa dilakukan
- Seen ids: filter_unseen (check and mark in one atomic step), mark_seen, is_seen, forget_seen. - Ids expire ttl_days (default 90) after they were last marked. - A namespace holds at most 100 000 ids, when it is full, the least recently seen ids are dropped first. This is intentional: an id that keeps showing up in polls stays known, while ids no feed returns any more go first. - Re-marking an id that was marked less than an hour ago (same TTL) changes nothing, so a poll that sees only known ids does not rewrite the file. Recency for eviction therefore has a one-hour granularity.
- Key/value: get, set (any JSON value, optional ttl_seconds), delete, list_keys (by prefix, paginated), increment (atomic counter).
- Housekeeping: list_namespaces, clear_namespace (workflow node only, so an agent cannot wipe seen ids).
- Safe under concurrency and crashes: see Guarantees.
Aksi
Setiap aksi adalah langkah yang bisa ditambahkan ke workflow. Agent juga bisa memakai sebagian besar aksi sebagai tool.
- Filter unseen ids
state-store.filter_unseen - Mark ids seen
state-store.mark_seen - Is id seen
state-store.is_seen - Forget seen ids
state-store.forget_seen - Get value
state-store.get - Set value
state-store.set - Delete key
state-store.delete - List keys
state-store.list_keys - Increment counter
state-store.increment - List namespaces
state-store.list_namespaces
Tampilkan semua 11 aksi
- Clear namespace
state-store.clear_namespace
Pengaturan
Graphrt menyalakan plugin dengan environment yang bersih. Hanya nilai ini yang sampai ke plugin, dan secret tidak masuk log.
-
STATE_STORE_DIROpsionalAbsolute directory for the namespace files (default ~/.graphrt/state-store, a leading ~/ is expanded). Created with mode 0700, files are 0600.
Cara memakainya
Di Graphrt Desktop
- Buka Plugins dan cari State Store.
- Klik Install lalu setujui.
- Ikuti langkah setup di halaman plugin, lalu tempel pengaturan yang dibutuhkan.
- Jelaskan pekerjaan yang membutuhkannya, dan builder menambahkan langkahnya.
Dengan CLI
terminal
$ graphrt plugin install state-store workflow.yaml
- { id: fresh, type: state-store.filter_unseen, namespace: fb-comments, ids: "{{#fetch.data.ids#}}" }
# … handle {{#fresh.data.new_ids#}} …