fix: address round-1 review findings

- slow_down now sleeps (and waits longer) instead of re-polling at
  once; the interval cap that could lower a server interval is gone.
  The deadline already bounds the loop.
- Non-JSON error bodies from gateways and the Vercel checkpoint no
  longer surface as SyntaxError; the HTTP status is preserved.
- Drop the dead process.env.NOUS_API_KEY fallback in fetchModels:
  envApiKeyAuth already resolves it into the credential upstream.
- apply() persists the catalog flag before mutating memory, so a
  read-only agent dir cannot leave the two out of step.
- sleep() replaced with node:timers/promises; three unused exports
  removed; stale tags.user comment corrected; hermes filter explained.
- Tests: 8 (was 4). Pin tierOf, the tier header, and withoutTierHeader
  on both stream entry points; t.mock.method replaces hand-rolled fetch
  swaps; stub gains getAgentDir.
- Docs: README covers install lockfile flag, hermes row, browser-UA
  posture, and typecheck path pinning; AGENTS.md allowlist includes
  pi-coding-agent; tests/AGENTS.md contracts updated.
This commit is contained in:
AlexKucera committed 2026-11-25 09:48:55 +01:00
1 parent 8bbece7613
commit 00d50e10de
7 files changed
+102 -50

No files matched your search

+5 -2
View File
@@ -34,7 +34,7 @@ Then in pi:
| Catalog | Live signal | Models |
|---|---|---|
| full | everything | 409 |
| full | every chat model except Hermes-branded ids (none in the catalog as of 2026-11-25) | 409 |
| free | `synthesizedFreeVariant`, also suffixed `:free` | 3 |
| promo | `pricing.original` above the current price | 42 |
@@ -48,14 +48,17 @@ The choice is saved in `~/.pi/agent/nous-portal-catalog` and survives restarts.
- `upstage/solar-mini4:free` is left out of the baseline on purpose: it alone requires a `tags` body field that the other free models reject with a 500, so no single request shape serves all of them.
- Subscription quota is per day. When the "Today" gauge is exhausted, inference returns `503 ChatGPT subscription inference is temporarily unavailable`. Purchased credits keep the API-key route working.
- Requests to the portal's OAuth endpoints send a browser-like `User-Agent`, `Origin` and `Referer` (only to `portal.nousresearch.com`, never to inference). This gets past the Vercel browser checkpoint that otherwise rejects CLI clients. It is a robustness and terms-of-use risk, not a security one: if Nous tightens the checkpoint or treats the client as evasion, login can break or the account can be flagged.
## Development
```bash
npm install --legacy-peer-deps # typescript + jiti only; pi injects @earendil-works/* at load time
npm install --legacy-peer-deps --no-package-lock # typescript + jiti only; pi injects @earendil-works/* at load time
npm run check # tsc --noEmit + node --test
```
Typechecking needs a local pi install: `tsconfig.json` `paths` point `@earendil-works/pi-ai` and `pi-coding-agent` at the type declarations under `~/.pi/agent/install/releases/<version>/`. Update those three paths when pi is upgraded. The extension itself runs against any pi with the native provider interface; only `tsc` is pinned.
## License
GPL-3.0-or-later. See [LICENSE](LICENSE).