Graphrt

State Store

Seen-id sets with TTL (filter_unseen), JSON key/values and atomic counters

Stable v0.1.0 Node.js 11 actions
Use in Graphrt Desktop

About

A Graphrt plugin that gives workflows a small local memory. Its main job is polling: a workflow that checks new comments, DMs or orders every few minutes calls filter_unseen and handles only the ids it has not seen before. It also stores small JSON values and atomic counters.

What it can do

  • 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.

Actions

Each action is a step you can add to a workflow. Agents can also use most of them as tools.

  • 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
Show all 11 actions
  • Clear namespace state-store.clear_namespace

Settings

Graphrt starts plugins with a clean environment. Only these values reach the plugin, and secrets stay out of logs.

  • STATE_STORE_DIR Optional
    Absolute directory for the namespace files (default ~/.graphrt/state-store, a leading ~/ is expanded). Created with mode 0700, files are 0600.

How to use it

In Graphrt Desktop

  1. Open Plugins and search for State Store.
  2. Click Install and approve it.
  3. Follow the setup steps on the plugin's page, then paste the settings it needs.
  4. Describe a job that needs it, and the builder adds the steps.
Plugins in Graphrt Desktop

With the 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#}} …
Plugins in the docs