omnigateway 0.14.1 → 0.15.1

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 (50) hide show
  1. package/README.md +36 -1
  2. package/bin/omni.js +278 -25633
  3. package/gateway.js +2161 -51920
  4. package/package.json +1 -1
  5. package/public/assets/{Chip-D0XSbQUr.js → Chip-C3dIFd8s.js} +1 -1
  6. package/public/assets/{CopyValue-DAlmkISB.js → CopyValue-DG88CWpN.js} +1 -1
  7. package/public/assets/{Field-D9V9N-vb.js → Field-EvdVyEqx.js} +25 -6
  8. package/public/assets/Lamp-CL0i4yaa.js +26 -0
  9. package/public/assets/{Rack-CDUOJkS2.js → Rack-DMrfn4-H.js} +5 -5
  10. package/public/assets/{RequestTable-BF5-R27W.js → RequestTable-CtuuMOT2.js} +3 -3
  11. package/public/assets/{SummaryDeck-DrzTQQo5.js → SummaryDeck-DHsYYpYO.js} +2 -2
  12. package/public/assets/{Toggle-CdMD58sy.js → Toggle-BTie3NY8.js} +1 -1
  13. package/public/assets/{TokenBreakdown-BC6nqo1v.js → TokenBreakdown-Bf0zsKcd.js} +1 -1
  14. package/public/assets/{WindowChart-Bqbl-KFO.js → WindowChart-CaPUJ4GJ.js} +2 -2
  15. package/public/assets/_app.accounts-xCJhRd32.js +70 -0
  16. package/public/assets/{_app.console-BplICGMp.js → _app.console-DS37cfIu.js} +2 -2
  17. package/public/assets/_app.database-BCwEMrEA.js +24 -0
  18. package/public/assets/_app.index-DW6wain4.js +67 -0
  19. package/public/assets/_app.keys-CCU2NB3-.js +120 -0
  20. package/public/assets/_app.logs-CRC5qDK3.js +46 -0
  21. package/public/assets/_app.models-B4brzRdK.js +148 -0
  22. package/public/assets/{_app.plugins._pluginId-BduNUc7R.js → _app.plugins._pluginId-CD9KXknf.js} +1 -1
  23. package/public/assets/_app.settings-NJSb_L2B.js +88 -0
  24. package/public/assets/_app.usage-BR6a92zI.js +78 -0
  25. package/public/assets/chevron-down-3tlYNJqZ.js +1 -0
  26. package/public/assets/chevron-right-kvaJRnfj.js +1 -0
  27. package/public/assets/client-B9t0CsmA.js +46 -0
  28. package/public/assets/{dist-BBGxva0Y.js → dist-B8iuo_hI.js} +1 -1
  29. package/public/assets/index-6rZSWe9j.js +14 -0
  30. package/public/assets/{login-Dj7MQcIc.js → login-NuwPF5SS.js} +2 -2
  31. package/public/assets/plus-CVqm87L-.js +1 -0
  32. package/public/assets/{preload-helper-B7KDmXJ9.js → preload-helper-1xe0b53X.js} +1 -1
  33. package/public/assets/{rotate-ccw-Do43Argv.js → rotate-ccw-Dionx_MW.js} +1 -1
  34. package/public/assets/{shared-DDpLUhCp.js → shared-HVgLEGgl.js} +2 -2
  35. package/public/assets/{trash-00950_yY.js → trash-Bsi60qJc.js} +1 -1
  36. package/public/index.html +4 -4
  37. package/public/assets/Lamp-Dk9XrTCg.js +0 -26
  38. package/public/assets/_app.accounts-C-Y0w4PQ.js +0 -70
  39. package/public/assets/_app.database-CKoZXAHB.js +0 -24
  40. package/public/assets/_app.index-BV1kJJjA.js +0 -67
  41. package/public/assets/_app.keys-TIg-A16v.js +0 -107
  42. package/public/assets/_app.logs-CdF9dkSn.js +0 -46
  43. package/public/assets/_app.models-CPb0eKBe.js +0 -148
  44. package/public/assets/_app.settings-dGgsENlT.js +0 -88
  45. package/public/assets/_app.usage--5qFtU1W.js +0 -76
  46. package/public/assets/chevron-down-Bb5ZGvwk.js +0 -1
  47. package/public/assets/chevron-right-hwF5mD6-.js +0 -1
  48. package/public/assets/client-Bx3ttI-9.js +0 -39
  49. package/public/assets/index-Rh35FNqC.js +0 -14
  50. package/public/assets/plus-BgcHxxIr.js +0 -1
package/README.md CHANGED
@@ -202,6 +202,41 @@ accepted and means "stop it now", and `--never` brings the key back. Expired
202
202
  keys stay listed, with their own state in `omni keys list` and on the console's
203
203
  keys board, so a client that stopped working can be found rather than guessed at.
204
204
 
205
+ A key can also carry a **usage policy**: what it may be used *for*, in plain
206
+ language. Each request through that key is then judged by a classifier model you
207
+ choose, before it is routed:
208
+
209
+ ```bash
210
+ omni settings set guardrailModel anthropic/claude-haiku-4 # or a virtual model id
211
+ omni keys guardrail <id> --policy "Only software engineering and office documents. Refuse roleplay, homework, personal content."
212
+ omni keys guardrail <id> --policy-file policy.txt
213
+ omni keys guardrail <id> --clear
214
+ ```
215
+
216
+ The classifier sees the request's system prompt and the last few messages a human
217
+ wrote (`guardrailHistoryTurns`, default 3, 1..10), oldest first, and judges the
218
+ newest in their light — so "continue" after a forbidden ask is judged as that
219
+ ask. It never sees tool results, images, or assistant replies, and only a plain
220
+ `ALLOW` lets the request through. A deny is refused as `CONTENT_FILTER` (400); a
221
+ classifier that times out (`guardrailTimeoutMs`, default 10s), errors, or answers
222
+ anything else refuses as `UPSTREAM` (502), and a key with a policy while
223
+ `guardrailModel` is unset refuses as `INTERNAL` (500): **it fails closed**.
224
+ Streaming requests receive the same refusals as in-stream errors. The refusal
225
+ messages are fixed; the classifier's words never reach the client. Each check is
226
+ its own request row under the key, tagged `guardrail:classifier` and charged to
227
+ it, and verdicts are cached for an hour per key, policy, model and judged text,
228
+ so an agent's tool turns on one human message are judged once. The key holder sees
229
+ the policy and those rows on their client dashboard. A key without a policy is
230
+ never judged and pays nothing. `omni doctor` warns when keys carry a policy and
231
+ nothing can judge them.
232
+
233
+ **This is a guardrail, not a security boundary.** It stops ordinary misuse, not a
234
+ client set on getting past it — by talking the classifier round, spreading a
235
+ request over more messages than the window holds, leaving it out of the history
236
+ it sends, or hiding it in tool results or images. **Rolling back** to
237
+ a build without usage policies ignores them: every key's requests are served
238
+ unjudged until you upgrade again.
239
+
205
240
  Now use it:
206
241
 
207
242
  ```bash
@@ -260,7 +295,7 @@ Use `--db <path>` to point one command somewhere else.
260
295
  | `omni logs export` | matching request metadata as CSV or JSONL on stdout; `--since` and `--until` required |
261
296
  | `omni bodies <request-id>` | captured bodies for one request; withheld unless you pass `--full` |
262
297
  | `omni console` | the gateway process's own output: boot, refreshes, quota, errors |
263
- | `omni usage` | spend and tokens, by provider, model, key, or day |
298
+ | `omni usage` | spend and tokens, by provider, model, key, or day; `--account <id>` and `--key <id>` narrow to one account or gateway key |
264
299
  | `omni quota` | provider quota per window: use, burn rate, and when it runs out |
265
300
  | `omni quota refresh <id> \| --all` | read provider quota now, without waiting for the next poll |
266
301
  | `omni quota resets <id>` / `omni quota reset <id>` | list / spend a banked Codex or Claude quota reset (irreversible) |