Graphrt

File Watcher

Notice added, modified and removed files in allowed directories by polling, snapshot to a self-contained cursor, list changes since a cursor, or wait up to 5 minutes for the next change, bounded, read-only, never follows symlinks

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

About

A Graphrt plugin that notices new, changed and removed files in directories you allow. graphrt nodes and tools are request/response, so there is no background watcher: the plugin polls. A snapshot becomes a cursor, later calls rescan and report what changed since that cursor, or wait (up to five minutes) for the next change.

What it can do

  • snapshot: records the entries under a directory (type, size, modified time) and returns a cursor.
  • list_changes: rescans the cursor's directory and returns added, modified and removed entries, with a new cursor to continue from.
  • wait_for_change: polls every poll_interval_ms (default 2000, at least 250) until something changes or timeout_seconds (default 60, at most 300) pass, returns changed, the changes and a new cursor either way. With a cursor, changes made since that cursor are returned at once, so nothing is missed between calls.
  • Filters: max_depth (default 5, at most 20), include_hidden, name_pattern ( and ?, e.g. .csv).

Actions

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

  • Snapshot a directory file-watcher.snapshot
  • List changes since a cursor file-watcher.list_changes
  • Wait for a change file-watcher.wait_for_change

Settings

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

  • FILE_WATCHER_ALLOWED_DIRS (required)
    Comma-separated directories (absolute or ~/...) that may be watched, subdirectories included
  • FILE_WATCHER_MAX_ENTRIES 10000
    Most entries one snapshot looks at, counting those name_pattern skips (10 to 100000), a bigger tree gives truncated: true

How to use it

In Graphrt Desktop

  1. Open Plugins and search for File Watcher.
  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 file-watcher
workflow.yaml
- { id: changes, type: file-watcher.list_changes, cursor: "{{#saved.data.value#}}" }
Plugins in the docs