@muthuishere/routsi 0.1.2 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +43 -1
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -40,6 +40,28 @@ curl localhost:8080/v1/chat/completions -H 'content-type: application/json' \
40
40
  - **`model: "openrouter/anthropic/claude-haiku-4.5"`** — a concrete model, no routing.
41
41
  - **`model: "devin/opus"`** — an agent as a model.
42
42
 
43
+ #### Custom decider
44
+
45
+ `auto`/dynamic routing normally classifies with the built-in `Rules`
46
+ heuristic. To plug in your own routing brain, add a `decider:` block to
47
+ `models.yaml`:
48
+
49
+ ```yaml
50
+ decider:
51
+ command: "node examples/decider.js" # any executable/runtime, run via `sh -c`
52
+ timeout: 3s # optional, default 3s
53
+ ```
54
+
55
+ routsi writes a JSON request to the command's stdin
56
+ (`model`/`conversation_id`/`messages`/`levels`/`tiers`) and reads
57
+ `{"level": "low"|"medium"|"high"}` back from stdout. Any failure — crash,
58
+ timeout, non-zero exit, malformed/empty/unknown output — falls back to the
59
+ built-in `Rules` decision, so a broken decider never fails a request. Leaving
60
+ `decider.command` empty (the default) keeps today's behavior unchanged. See
61
+ [`examples/`](examples/README.md) for the full contract and copyable Node/
62
+ Python starting points, and [ADR-007](docs/adr/007-external-decider.md) for
63
+ the design.
64
+
43
65
  ### Forwarding to an agent model (devin/…)
44
66
 
45
67
  Agent CLIs expose their inner models as `<agent>/<model>` catalog entries — from
@@ -111,7 +133,27 @@ dashboard Workers panel. If no worker is live, requests fast-fail with `503`. No
111
133
  auth in v1 (reserved `workers.auth` config placeholder). `routsi worker scaffold` prints
112
134
  an editable curl-only version.
113
135
 
114
- Install the worker as an **agent skill** so any agent session can become a worker:
136
+ **Two ways to serve a queue:**
137
+
138
+ - **Headless subprocess** (above) — `routsi worker run --agent 'cmd'` shells each
139
+ question to `cmd` and posts back its stdout.
140
+ - **Agent-driven** — a *running* agent session (Claude Code, codex, opencode) becomes the
141
+ worker itself and answers with its own reasoning, no subprocess in the middle, using
142
+ three helper subcommands that share the same register/poll/answer flags:
143
+
144
+ ```sh
145
+ routsi worker register --proxy URL --queue NAME # one-shot register
146
+ routsi worker poll --proxy URL --queue NAME --wait 25 # one long-poll; prints a job or nothing
147
+ printf '%s' "the answer" | routsi worker answer --proxy URL --queue NAME --id JOBID
148
+ ```
149
+
150
+ `poll` prints `{"id","prompt","messages"}` for one job and exits 0, or prints nothing on
151
+ an idle wait window (also exit 0) — an agent loops register once, then poll → compose the
152
+ answer itself → answer, repeating until told to stop.
153
+
154
+ Install the worker as an **agent skill** so any agent session can become a worker — the
155
+ skill walks the agent through the agent-driven loop above (and documents the headless
156
+ mode as an alternative):
115
157
 
116
158
  ```sh
117
159
  routsi install --skills # into ~/.claude/skills and ~/.codex/skills
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@muthuishere/routsi",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "OpenAI-compatible dynamic LLM router — a single Go binary, installed via npm as a prebuilt native binary",
5
5
  "license": "MIT",
6
6
  "bin": {