@wenathlan/getry 2.0.154 → 2.0.158
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.
- package/cli.ts +943 -0
- package/docs/features.md +104 -0
- package/docs/gateway.md +116 -0
- package/package.json +199 -16
- package/tests/cli.test.ts +300 -0
- package/tests/debonairlane.test.ts +66 -21
- package/tests/design.test.ts +9 -9
- package/tests/gateway.test.ts +962 -0
- package/tests/gatewayserver.ts +99 -0
- package/tests/intelligence.test.ts +62 -0
- package/tests/jsonpolicy.test.ts +289 -0
- package/tests/llm.test.ts +696 -0
- package/tests/modelroute.test.ts +112 -0
- package/tests/promptlibrary.test.ts +116 -0
- package/tests/providercli.test.ts +84 -0
- package/tests/providerconstants.test.ts +134 -0
- package/tests/providerfingerprint.test.ts +149 -0
- package/tests/providerfixtures.ts +224 -0
- package/tests/providermodels.test.ts +250 -0
- package/tests/provideroauth.test.ts +150 -0
- package/tests/researchfixtures.ts +4572 -0
- package/tests/sandboxmodality.test.ts +4 -4
- package/tests/serverauth.test.ts +394 -0
- package/tests/serverengine.test.ts +1074 -0
- package/tests/serverproperty.test.ts +220 -0
- package/tests/serverutils.test.ts +546 -0
- package/tests/streamfallback.test.ts +5 -1
- package/tests/torturellm.test.ts +807 -0
- package/docs/.gitkeep +0 -0
package/docs/features.md
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# getry features
|
|
2
|
+
|
|
3
|
+
every feature below is read from the code of the getry app root and the Sol theme.
|
|
4
|
+
|
|
5
|
+
## gateway
|
|
6
|
+
|
|
7
|
+
- universal engine — `engine.ts` `createversion(cfg)` turns one config into all 7 route handlers; every version behavior is config driven.
|
|
8
|
+
- five gateway versions — v1 zai, v2 babel, v3 nvidia, v4 opencode+kilo, v5 openrouter, cataloged in `gateway.ts`.
|
|
9
|
+
- 35 OpenAI-compatible routes — 7 route kinds (chat/completions, completions, embeddings, keys, messages, models, responses) per version, counted by `totalroutes()`.
|
|
10
|
+
- paused fallback — v2 babel answers 503 with a fallback route to v1; the engine checks the paused flag before every post route.
|
|
11
|
+
- dynamic version config — the config loader probes `sol/config.mjs|ts|js` for a user definition; `gatewayviewconfig.ts` ships the v1–v5 example catalog.
|
|
12
|
+
- route info endpoints — every version answers a get info descriptor (models, routes, fusion context, meta model).
|
|
13
|
+
- key status endpoint — the keys route reports auth mode, env key count, signup url and key url per version.
|
|
14
|
+
- model catalog endpoint — the models route lists the version models with context, max output, thinking/streaming/tools/vision flags; the devthink meta model rides first.
|
|
15
|
+
- request validation — malformed or non-object bodies answer 400 before any upstream call.
|
|
16
|
+
- cors handling — preflight and cors headers on every route.
|
|
17
|
+
- response formats — chat completion, anthropic message and response shapes built from one pipeline.
|
|
18
|
+
- gateway cli — `cli.ts` scaffolds and inspects gateway configs.
|
|
19
|
+
- gateway probe — `gatewayprobe.ts` runs a manual chat round trip against a deployed host.
|
|
20
|
+
- container smoke — `gatewaysmoke.ts` runs one full offline request cycle against the recorded openaicompat fixture.
|
|
21
|
+
|
|
22
|
+
## providers
|
|
23
|
+
|
|
24
|
+
- 12-entry provider table — openai, zai, openrouter, anthropic, google, qwen, deepseek, groq, mistral, xai, ollama, mimo with base urls and credential env vars (`providers.ts`).
|
|
25
|
+
- three wire protocols — openai, anthropic and google request/response mapping with per-family header builders.
|
|
26
|
+
- credential hygiene — keys resolve from env vars only, never literals; `redactProviderError` strips bearer values before any surface.
|
|
27
|
+
- transport retry — 3 attempts on 5xx and network faults with 250ms→4000ms exponential backoff.
|
|
28
|
+
- model listing — `listModels` resolves the provider catalog with context window and streaming flags.
|
|
29
|
+
- provider cli — `providercli.ts` inspects the provider surface.
|
|
30
|
+
- antigravity lineage — `antigravity.ts`, `oauth.ts`, `accounts.ts`, `request.ts`, `search.ts`, `fingerprint.ts`, `versionregistry.ts`, `constants.ts` carry the antigravity/gemini-cli/cloudcode-pa provider plugin: oauth with PKCE, token exchange and refresh, account files, request building, search and fingerprinting.
|
|
31
|
+
- multi-account manager — round-robin plus sticky account rotation, chmod 600 atomic writes, quota/429 detection with automatic rotation (`accounts.ts`).
|
|
32
|
+
|
|
33
|
+
## reasoning
|
|
34
|
+
|
|
35
|
+
- 7-level thinking ladder — none, minimal, low, medium, high, xhigh, max with budgets 0, 1400, 5500, 17000, 68000, 68000, 68000 (`thinking.ts`).
|
|
36
|
+
- default level — high (68000) resolved when the request names none.
|
|
37
|
+
- level validation — `islevel` checks request values against the ladder; `budgetof` resolves the token budget.
|
|
38
|
+
- provider param mapping — budgets map onto `thinking` (v1) or `chattemplatekwargs` (v3) per version config.
|
|
39
|
+
- two-calls pattern — the engine splits reasoning from response when the thinking budget plus response cap crosses the threshold (default 98304), with a fresh-response guarantee.
|
|
40
|
+
- reasoning-first emission — normalized chunks emit reasoning delta before content.
|
|
41
|
+
- thinking signature cache — LRU 100-entry cache preserves thinking blocks between chunks (`streaming.ts`).
|
|
42
|
+
|
|
43
|
+
## keys and rotation
|
|
44
|
+
|
|
45
|
+
- 13 auth methods — bearer, apikeyheader, queryparam, basic, oauth2clientcredentials, jwtsign, sigv4, hmacsign, cookie, mtls, keylesssdk, anonymous, none (`types.ts`).
|
|
46
|
+
- four key sources — db, env, inline, ephemeralurl resolved in order, first hit wins (`auth.ts`).
|
|
47
|
+
- three key rotation modes — single, roundrobin, lru.
|
|
48
|
+
- 22 nvidia keys — registered into the `nvidiaKey` table and rotated round-robin on v3 (`registernvidiakeys.ts`).
|
|
49
|
+
- ephemeral keys — v2 babel resolves ip-bound 60-minute keys from the provider key endpoint.
|
|
50
|
+
- weighted pool rotation — weight-based route picks with a cooldown ledger: 3 allowed fails, 5s cooldown, 5s escalation, 60s ceiling (`routerotation.ts`).
|
|
51
|
+
- meta model rotation — the devthink meta rotates across the version backend pool every 6 messages (v3, v4) or per request (v5).
|
|
52
|
+
- model rotation triggers — rotate on statuses (v3: 529, 404, 410) and on per-attempt timeout.
|
|
53
|
+
- retry with backoff — v3 config: 3 retries, 400ms base, 8000ms cap, ±20% jitter, retry statuses 429/502/503/504, 400 non-retryable.
|
|
54
|
+
- circuit breaker — optional per-version breaker that opens after n consecutive failures for a cooldown.
|
|
55
|
+
- model fallback — error-code catalog plus a fallback runner that walks the route chain, excluding tried routes, applying errors to key counters (`streamfallback.ts`).
|
|
56
|
+
|
|
57
|
+
## sessions
|
|
58
|
+
|
|
59
|
+
- session context store — one row per (sessionId, provider) with rotation index, thinking level and budget, context window, message count (`sessions.ts`).
|
|
60
|
+
- rotation cadence — `ROTATIONEVERY = 6` turns per rotation.
|
|
61
|
+
- session ordering — `freshestfirst` by last message; `contextshare` computes context window usage.
|
|
62
|
+
- history restore — v3 restores session history per config (limit 1000, truncate margin 4096).
|
|
63
|
+
- chat log persistence — every request/response row lands in `ChatMessage` via `savemsg` with version-specific fields.
|
|
64
|
+
|
|
65
|
+
## quota
|
|
66
|
+
|
|
67
|
+
- dual-source quota — antigravity plus gemini-cli quota summary retrieval (`quota.ts`).
|
|
68
|
+
- adaptive TTL cache — 15 minute default TTL, soft threshold at 90% remaining.
|
|
69
|
+
- background refresh — quota refreshes ahead of expiry at a 15 minute default interval.
|
|
70
|
+
- quota-aware account handling — `canProceedWithRequest`, exhausted detection and account skip by summary.
|
|
71
|
+
- quota groups — per-group definitions over weekly, 5h, daily, hourly and monthly windows.
|
|
72
|
+
- on-disk cache — `~/.config/opencode/cache/antigravity/quota.json`.
|
|
73
|
+
|
|
74
|
+
## data layer
|
|
75
|
+
|
|
76
|
+
- prisma + sqlite — `schema.prisma` with six models: ChatMessage, NvidiaKey, TownKey, ApiKey, SessionContext, OnboardingState.
|
|
77
|
+
- serverless adapter — libsql http/https or file url through `DATABASE_URL` with driver adapters.
|
|
78
|
+
- better-sqlite3 mirror — prepared-statement-only local runtime behind a dynamic import the browser never bundles (`db.ts`).
|
|
79
|
+
- typed in-memory seeds — KEYSEED, MESSAGESEED, SESSIONSEED answer the static build when the HTTPS endpoint is absent.
|
|
80
|
+
- key masking — `maskkey` renders keys as first 8 + last 4 characters.
|
|
81
|
+
|
|
82
|
+
## ui (Sol theme)
|
|
83
|
+
|
|
84
|
+
- route table — /intro, /onboarding, /, /versions, /thinking, /sessions, /404 mounted by `sol/Sol.tsx`.
|
|
85
|
+
- versions page — five gateway replica rows with provider chips, live dots and route chips, the parser pattern rail and quick-start calls.
|
|
86
|
+
- thinking page — the 7-level ladder with hairline budget bars against the 68k ceiling and the default rung marked.
|
|
87
|
+
- sessions page — the session ledger with rotation summary, masked keys meta rail and recent chat log.
|
|
88
|
+
- entry flow — intro and onboarding pages guarded by first-run flags (`onboardingstate.ts`).
|
|
89
|
+
- wingets — HomeEntrygate, ShellBrandmark, ShellEmptystate shared components.
|
|
90
|
+
- toast — the toast notification surface.
|
|
91
|
+
- copy law — every interface string lives in the label store (`labels.ts`); pages read through the typed accessor.
|
|
92
|
+
- scroll reveal — observeReveals drives the entrance animations (`reveal.ts`).
|
|
93
|
+
- theme switch — dark/light toggle over the Sol tokens (`theme.ts`).
|
|
94
|
+
|
|
95
|
+
## family integration
|
|
96
|
+
|
|
97
|
+
- family table — eight siblings (argan, cadria, debonair, forge, foundry, saddle, stealthhead, vault) with accents, consumed by the shell rail and the test suite (`family.ts`).
|
|
98
|
+
- family urls — the `"../" + slug + "/"` relative contract keeps cross-app links mount-proof (`familyurl.ts`).
|
|
99
|
+
- debonair lane — the debonair api lane of the family gateway (`debonairlane.ts`).
|
|
100
|
+
- workload lanes — `sandboxmodality.ts` declares the lanes this app owns in the family catalog.
|
|
101
|
+
|
|
102
|
+
## Dependencies
|
|
103
|
+
|
|
104
|
+
- synchronized dependency union — the eleven family apps share one dependency tree: identical `dependencies`, `devDependencies` and `peerDependencies` (same keys, same versions, nothing removed, highest semver wins on conflicts) and one `engines` catalog with node as maestro and the V 0.5.2 seat as catalog annotation (@family wave/depssync).
|
package/docs/gateway.md
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# getry gateway
|
|
2
|
+
|
|
3
|
+
## overview
|
|
4
|
+
|
|
5
|
+
- getry is the AI gateway of the wenathlan family (`@wenathlan/getry`, version 2.0.155, GPL-3.0-only).
|
|
6
|
+
- five provider gateways (v1 zai, v2 babel, v3 nvidia, v4 opencode+kilo, v5 openrouter) serve 35 OpenAI-compatible routes with the 7-level thinking system, the session store and the key rotation.
|
|
7
|
+
- `schema.prisma` describes the database the gateway lanes consume; the app ships as one static Sol surface plus a self-hosted gateway server.
|
|
8
|
+
- engine doctrine: one universal engine (`engine.ts`) consumes a config and generates every route handler per version — nothing is hardcoded per provider.
|
|
9
|
+
|
|
10
|
+
## module inventory
|
|
11
|
+
|
|
12
|
+
- `gateway.ts` — the gateway versions domain: `GATEWAYROUTES` (the 7 route kinds), `GATEWAYVERSIONS` (the v1–v5 catalog), `PARSERSTEPS` (the streaming parser pattern), `listversions`, `findversion`, `totalroutes`, `liveversions`.
|
|
13
|
+
- `gatewayconfig.ts` — the embedded single-version gateway definition (v1 zai sdk, keyless).
|
|
14
|
+
- `gatewayviewconfig.ts` — the shipped multi-version catalog (v1–v5) the console page renders; the config loader probes `sol/config.mjs|ts|js` for user overrides.
|
|
15
|
+
- `engine.ts` — the universal gateway engine: `createversion(cfg)` produces all route handlers from one `gatewayconfig`.
|
|
16
|
+
- `server.ts` — the gateway transport: sse/ndjson writers, heartbeat discard, frame parser, chunk builders, `makestreamresponse`, `createserver`, `main`/`runserver`, plus the config loader (`loadconfig`, `reloadconfig`, `getversion`, `listversions`).
|
|
17
|
+
- `auth.ts` — request auth and key resolution: token/session/request id extraction, `resolvekeys`, `buildauthheaders`, `buildauthqueryparams`.
|
|
18
|
+
- `types.ts` — the config surface: `gwauthmethod`, `authconfig`, `keysource`, `keyrotationmode`, `rotationconfig`, `retryconfig`, `timeout` types, `versionhandlers`, `gatewaydefinition`.
|
|
19
|
+
- `providers.ts` — the workbench chat provider transport: the 12-entry `PROVIDERS` table, per-protocol body/header builders, `streamChat`, `listModels`.
|
|
20
|
+
- `llm.ts` — the model call core: request building, provider calls, stream delta parsing, command guard, plan drafting, replan on fail, step reflection, usage accounting.
|
|
21
|
+
- `streaming.ts` — the SSE parser and stream normalizer: split-tolerant parsing, payload normalization, thinking signature cache, OpenAI/Anthropic transformers, auto-recovery.
|
|
22
|
+
- `streamfallback.ts` — the upstream error catalog and the fallback runner that walks the route chain when one model dies.
|
|
23
|
+
- `routerotation.ts` — weighted pool rotation with cooldown ledger (litellm-style knobs).
|
|
24
|
+
- `sessions.ts` — the per-(sessionId, provider) session context store and rotation index.
|
|
25
|
+
- `quota.ts` — dual-source (Antigravity + Gemini CLI) quota manager with adaptive TTL cache.
|
|
26
|
+
- `models.ts` — the merged model catalog (frozen 25/08/2026): model definitions, classifiers, thinking tables, endpoint routing.
|
|
27
|
+
- `intelligence.ts` — provenance, token estimation, markdown chunking, rag manifest, llms.txt, metric store.
|
|
28
|
+
- `oauth.ts` / `accounts.ts` / `recovery.ts` / `project.ts` — the provider oauth family, multi-account manager, recovery and project id discovery.
|
|
29
|
+
- `db.ts` — the database contract: typed rows, in-memory seeds, HTTPS accessors, better-sqlite3 mirror.
|
|
30
|
+
- `prismaconfig.ts` / `prismashim.ts` / `nodeshim.ts` — prisma schema path resolution and runtime shims.
|
|
31
|
+
- `gatewayprobe.ts` — manual chat round trip against a deployed gateway (`GET /v1/models`, `POST /v1/chat/completions`).
|
|
32
|
+
- `gatewaysmoke.ts` — offline container smoke: one full request cycle against the recorded openaicompat fixture.
|
|
33
|
+
- `registernvidiakeys.ts` — registers the 22 nvidia api keys into the `nvidiaKey` table.
|
|
34
|
+
- `cli.ts` / `providercli.ts` — the gateway cli and the provider cli.
|
|
35
|
+
- `versionregistry.ts`, `request.ts`, `search.ts`, `fingerprint.ts`, `constants.ts`, `antigravity.ts` — the antigravity/gemini-cli provider lineage: version resolution, request building, search, fingerprinting, endpoint constants.
|
|
36
|
+
- `json.ts` / `jsonschema.ts` / `jsonpolicy.ts` — the json model: extraction, declarative schema bridge, confidence policies.
|
|
37
|
+
- `family.ts` / `familyurl.ts` / `debonairlane.ts` — the family table, the relative-url contract, the debonair api lane.
|
|
38
|
+
- `labels.ts`, `theme.ts`, `reveal.ts`, `onboardingstate.ts`, `sandboxmodality.ts`, `utils.ts`, `typeface.ts` — copy store, theme switch, scroll reveal, first-run flags, workload lanes, shared helpers.
|
|
39
|
+
|
|
40
|
+
## providers
|
|
41
|
+
|
|
42
|
+
the gateway serves five provider versions (gateway.ts, gatewayviewconfig.ts):
|
|
43
|
+
|
|
44
|
+
- `v1` — zai (live). passthrough retransmit via the z ai web dev sdk, `keylesssdk` auth (no token, no chat id). models: devthink meta plus the glm family (glm-5.3, glm-5.3-flash, glm-5.3-fast, glm-5.3-air, glm-5.2, glm-5.1, glm-5, glm-5v, glm-5-turbo, glm-4-plus, glm-4-flash). default model `devthink`, maxtokens 8192, temperature range [0, 2] default 0.7.
|
|
45
|
+
- `v2` — babel town (paused). returns 503 with fallback to `/v1/chat/completions` on v1; embeddings disabled; auth via `x-token` header with ephemeral keys from `https://glm.babel.town/api/get_api_key` (60 minute expiry, ip bound). models: babel-glm-5.3, babel-glm-5.3-flash, babel-glm-5.2, babel-devthink.
|
|
46
|
+
- `v3` — nvidia nim (live). bearer auth with `roundrobin` key rotation over the 22 registered nvidia keys (db model `nvidiaKey`, env fallback `NVIDIA_API_KEY`). upstream `https://integrate.api.nvidia.com/v1`. 17 chat models (kimi-k3, deepseek-v4-pro, muse-glimmer-30b, laguna-xs-2.1, nemotron-3 family, gpt-oss-120b/20b, gemma-4-31b, mistral-nemotron, llama-3.2 vision) plus the devthink meta. the meta model rotates across the 4 backends (kimi-k3, deepseek-v4-pro-0813, muse-glimmer-30b, laguna-xs-2.1) every 6 messages.
|
|
47
|
+
- `v4` — opencode zen plus kilo (live). anonymous free tier, no api key; upstreams `https://opencode.ai/zen/v1` and `https://api.kilo.ai/api/gateway` with mutual fallback; free-tagged model discovery; devthink meta rotates every 6 messages.
|
|
48
|
+
- `v5` — openrouter (live). bearer auth over `OPENROUTER_API_KEY` (single-key rotation, signup url `https://openrouter.ai`, ride-along `http-referer`/`x-title` headers); 19 `:free` tagged models plus the devthink meta; the meta rotates per request (everynmessages 1).
|
|
49
|
+
|
|
50
|
+
beside the gateway versions, `providers.ts` carries the workbench transport table with 12 provider definitions — openai, zai, openrouter, anthropic, google, qwen, deepseek, groq, mistral, xai, ollama, mimo — each with base url, wire protocol and the env var that feeds its credential (never a literal key).
|
|
51
|
+
|
|
52
|
+
## routes
|
|
53
|
+
|
|
54
|
+
- every gateway version carries the same 7 route kinds (`GATEWAYROUTES`): `chat/completions`, `completions`, `embeddings`, `keys`, `messages`, `models`, `responses`.
|
|
55
|
+
- 5 versions × 7 route kinds = 35 routes (`totalroutes()`).
|
|
56
|
+
- `createversion` produces one handler per route kind (`versionhandlers`: handleinfo, handlekeys, handlemodels, handlechatcompletions, handlecompletions, handlemessages, handleresponses, handleembeddings).
|
|
57
|
+
- request pipeline per the engine: paused check → model resolution (requested / default / meta rotation pick) → auth resolution → body building (sampling params per policy, thinking param per config) → execution (retry backoff, rotation, timeout, circuit breaker) → streaming (byte passthrough, sse parsing, heartbeat discard, masking) → persistence (`savemsg`) → response building (OpenAI chat completion / anthropic message / response formats).
|
|
58
|
+
- the canonical streaming parser pattern (`PARSERSTEPS`): readablestream with safeenqueue/safeclose, 200ms keepalive only after 1s silence, upstream fetch with abortsignal timeout 2147483647, sse frame split on double newline (never partial), heartbeat discard, model masking to `devthink` via regex, normalized delta emission (reasoning before content), finish with stop reason plus single done plus savemsg.
|
|
59
|
+
|
|
60
|
+
## reasoning levels
|
|
61
|
+
|
|
62
|
+
the 7-level thinking ladder (`thinking.ts`), each level bound to a token budget:
|
|
63
|
+
|
|
64
|
+
- `none` — budget 0, no thinking.
|
|
65
|
+
- `minimal` — budget 1400, quick reasoning.
|
|
66
|
+
- `low` — budget 5500, light reasoning.
|
|
67
|
+
- `medium` — budget 17000, balanced.
|
|
68
|
+
- `high` — budget 68000, deep reasoning (the default, `DEFAULTTHINKINGLEVEL`).
|
|
69
|
+
- `xhigh` — budget 68000, extra deep.
|
|
70
|
+
- `max` — budget 68000, maximum.
|
|
71
|
+
|
|
72
|
+
- helpers: `listlevels`, `budgetof`, `islevel`, `formatbudget`.
|
|
73
|
+
- the engine maps the budget onto the provider param (`chattemplatekwargs` for v3, `thinking` for v1) and runs the two-calls pattern when the thinking budget plus the response cap crosses the threshold (default 98304).
|
|
74
|
+
|
|
75
|
+
## auth and key rotation
|
|
76
|
+
|
|
77
|
+
- 13 auth methods (`gwauthmethod` in types.ts): bearer, apikeyheader, queryparam, basic, oauth2clientcredentials, jwtsign, sigv4, hmacsign, cookie, mtls, keylesssdk, anonymous, none.
|
|
78
|
+
- key sources resolved in configured order, first hit wins: `db` (prisma model lookup), `env` (single or separator-joined), `inline` (config provided), `ephemeralurl` (babel town pattern).
|
|
79
|
+
- key rotation modes when multiple keys exist: `single`, `roundrobin`, `lru`.
|
|
80
|
+
- v3 carries the key pool: 22 nvidia keys registered into the `nvidiaKey` table, round-robin per request.
|
|
81
|
+
- pool-level rotation (`routerotation.ts`): weight-based picks with a cooldown ledger — 3 allowed fails, 5s cooldown, 5s escalation step, 60s ceiling (litellm router defaults lifted as pure math).
|
|
82
|
+
- session-level rotation (`sessions.ts`): the devthink meta model rotates every `ROTATIONEVERY = 6` turns within a session.
|
|
83
|
+
- errors from upstream land on the key counters (`applyerrortokey` on `ApiKeyRow`) and feed the fallback chain.
|
|
84
|
+
|
|
85
|
+
## streaming and fallback
|
|
86
|
+
|
|
87
|
+
- sse transport (`server.ts`): 200ms keepalive interval, suppressed under 1s of activity; `parsesseframes` splits frames on double newline; `discardheartbeat` drops colon-prefixed and ping lines; `maskmodel` rewrites the upstream model name to `devthink`; `makechunk`/`makefinalchunk` build normalized OpenAI-shaped chunks.
|
|
88
|
+
- stream normalizer (`streaming.ts`): split-tolerant SSE parsing, heterogeneous payload unwrapping (response/candidates/parts), LRU thinking signature cache (100 entries), OpenAI and Anthropic transformers, auto-recovery with exponential backoff plus 0–80ms jitter, synthetic finish injection on abrupt close.
|
|
89
|
+
- model fallback (`streamfallback.ts`): every upstream failure maps to one error code (transport, timeout, unauthorized, forbidden, notfound, gone, unprocessable, ratelimited); the runner walks the route chain in priority order, excluding already-tried routes, with the doubling backoff curve plus ±20% jitter from `@wenathlan/devthink/queue`.
|
|
90
|
+
- retry (`providers.ts` fetchWithRetry): 3 attempts, 5xx and network faults only, backoff 250ms base doubling to a 4000ms cap.
|
|
91
|
+
|
|
92
|
+
## data layer
|
|
93
|
+
|
|
94
|
+
- `schema.prisma` — sqlite datasource (prisma client with driver adapters; libsql http/https or file url for serverless deploy via `DATABASE_URL`).
|
|
95
|
+
- six models: `ChatMessage` (every interaction log across v1–v5), `NvidiaKey`, `TownKey`, `ApiKey` (the key pools), `SessionContext` (per-session rotation and thinking state), `OnboardingState` (first-run flags).
|
|
96
|
+
- `db.ts` — typed rows plus in-memory seeds (`KEYSEED`, `MESSAGESEED`, `SESSIONSEED`) the static build falls back to; the self-hosted deploy answers the same rows over HTTPS; a better-sqlite3 mirror at the foot of the file runs the local gateway runtime (prepared statements only, idempotent schema, dynamic import the browser never bundles).
|
|
97
|
+
- family sync contract: identity pointers are text, counts are 32-bit ints, time is datetime or iso text.
|
|
98
|
+
|
|
99
|
+
## sol surface
|
|
100
|
+
|
|
101
|
+
- `sol/Sol.tsx` mounts the route table: `/intro`, `/onboarding`, `/`, `/versions`, `/thinking`, `/sessions`, `/404`.
|
|
102
|
+
- subapps: `home`, `intro`, `notfound`, `onboarding`, `sessions`, `shell`, `thinking`, `toast`, `versions`, `wingets` (HomeEntrygate, ShellBrandmark, ShellEmptystate).
|
|
103
|
+
- `versions` — the gateway registry: five replica rows (version tag, provider chip, live dot, the 7 route chips), the parser pattern rail, quick-start calls. every row reads `gateway.ts`.
|
|
104
|
+
- `thinking` — the reasoning ladder: 7 rungs with hairline budget bars against the 68k ceiling, the default rung marked. every number reads `thinking.ts`.
|
|
105
|
+
- `sessions` — the session registry: session contexts as the ledger table, rotation summary and masked provider keys as the meta rail, the recent chat log below. rows arrive over HTTPS from the self-hosted database with seed fallback.
|
|
106
|
+
|
|
107
|
+
## family integration
|
|
108
|
+
|
|
109
|
+
- `family.ts` — the eight siblings beside getry in rail order (argan, cadria, debonair, forge, foundry, saddle, stealthhead, vault), each with its accent and dot ink; getry's own violet `#8b5cf6` lives in the theme tokens.
|
|
110
|
+
- `familyurl.ts` — the relative-url contract (`"../" + slug + "/"`) that keeps every cross-app link mount-proof.
|
|
111
|
+
- `debonairlane.ts` — the debonair api lane of the family gateway.
|
|
112
|
+
- `sandboxmodality.ts` — the workload lanes this app owns in the family catalog.
|
|
113
|
+
|
|
114
|
+
## tests
|
|
115
|
+
|
|
116
|
+
- 27 test files under `tests/` cover the gateway surface: gateway, server (auth, engine, property, utils), llm, modelroute, promptlibrary, routerotation, streamfallback, intelligence, jsonpolicy, family, design, cli, providercli, onboardingstate, sandboxmodality, debonairlane, torture.llm, plus the provider lineage (constants, fingerprint, models, oauth) and the shared fixtures (`gatewayserver.ts`, `providerfixtures.ts`, `researchfixtures.ts`).
|
package/package.json
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wenathlan/getry",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.158",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/wenathlan/devthink"
|
|
7
7
|
},
|
|
8
8
|
"description": "getry is the AI gateway of the wenathlan family: five provider gateways (v1 zai, v2 babel, v3 nvidia, v4 opencode+kilo, v5 openrouter) serving 35 OpenAI-compatible routes with the 7-level thinking system, the session store and the key rotation, described by schema.prisma and served as one static Sol surface. The envelope distributes the documentation set and the tests directory as one package.",
|
|
9
|
+
"bin": {
|
|
10
|
+
"getry": "./cli.ts"
|
|
11
|
+
},
|
|
9
12
|
"keywords": [
|
|
10
13
|
"getry",
|
|
11
14
|
"gateway",
|
|
@@ -19,30 +22,201 @@
|
|
|
19
22
|
"license": "GPL-3.0-only",
|
|
20
23
|
"engines": {
|
|
21
24
|
"bare": "^1.18.0",
|
|
22
|
-
"bun": "^1.4.
|
|
25
|
+
"bun": "^1.4.4",
|
|
26
|
+
"cargo": ">=1.85.0",
|
|
23
27
|
"chrome": "^16.0.912",
|
|
24
28
|
"cnpm": "^9.4.0",
|
|
25
29
|
"corepack": "^0.35.0",
|
|
26
30
|
"deno": "^2.9.5",
|
|
31
|
+
"dotnet": ">=8.0.0",
|
|
27
32
|
"ecmascript": "^5.0.0",
|
|
28
33
|
"firefox": ">=0.8.0",
|
|
34
|
+
"go": ">=1.24.0",
|
|
29
35
|
"iojs": "^1.0.0",
|
|
36
|
+
"java": ">=17",
|
|
30
37
|
"node": ">=26.13.0 <27",
|
|
31
|
-
"npm": "^12.1
|
|
38
|
+
"npm": "^12.2.1",
|
|
32
39
|
"pnpm": "^12.6.0",
|
|
40
|
+
"python": ">=3.11.0",
|
|
41
|
+
"rust": ">=1.85.0",
|
|
33
42
|
"teleport": ">=0.2.0",
|
|
34
43
|
"typescript": "^5.8.0",
|
|
44
|
+
"v": "^0.5.2",
|
|
35
45
|
"vscode": "^1.118.0",
|
|
36
46
|
"yarn": "^4.17.1"
|
|
37
47
|
},
|
|
48
|
+
"peerDependencies": {
|
|
49
|
+
"playwright": "^1.63.0"
|
|
50
|
+
},
|
|
38
51
|
"type": "module",
|
|
39
52
|
"exports": {
|
|
40
53
|
"./thinking": {
|
|
41
54
|
"types": "./thinking.ts",
|
|
42
55
|
"default": "./thinking.ts"
|
|
56
|
+
},
|
|
57
|
+
"./engine": {
|
|
58
|
+
"types": "./engine.ts",
|
|
59
|
+
"import": "./engine.ts",
|
|
60
|
+
"default": "./engine.ts"
|
|
61
|
+
},
|
|
62
|
+
"./llm": {
|
|
63
|
+
"types": "./llm.ts",
|
|
64
|
+
"import": "./llm.ts",
|
|
65
|
+
"default": "./llm.ts"
|
|
66
|
+
},
|
|
67
|
+
"./streaming": {
|
|
68
|
+
"types": "./streaming.ts",
|
|
69
|
+
"import": "./streaming.ts",
|
|
70
|
+
"default": "./streaming.ts"
|
|
71
|
+
},
|
|
72
|
+
"./streamfallback": {
|
|
73
|
+
"types": "./streaming.ts",
|
|
74
|
+
"import": "./streaming.ts",
|
|
75
|
+
"default": "./streaming.ts"
|
|
76
|
+
},
|
|
77
|
+
"./models": {
|
|
78
|
+
"types": "./models.ts",
|
|
79
|
+
"import": "./models.ts",
|
|
80
|
+
"default": "./models.ts"
|
|
81
|
+
},
|
|
82
|
+
"./request": {
|
|
83
|
+
"types": "./request.ts",
|
|
84
|
+
"import": "./request.ts",
|
|
85
|
+
"default": "./request.ts"
|
|
86
|
+
},
|
|
87
|
+
"./providers": {
|
|
88
|
+
"types": "./providers.ts",
|
|
89
|
+
"import": "./providers.ts",
|
|
90
|
+
"default": "./providers.ts"
|
|
91
|
+
},
|
|
92
|
+
"./antigravity": {
|
|
93
|
+
"types": "./antigravity.ts",
|
|
94
|
+
"import": "./antigravity.ts",
|
|
95
|
+
"default": "./antigravity.ts"
|
|
96
|
+
},
|
|
97
|
+
"./oauth": {
|
|
98
|
+
"types": "./oauth.ts",
|
|
99
|
+
"import": "./oauth.ts",
|
|
100
|
+
"default": "./oauth.ts"
|
|
101
|
+
},
|
|
102
|
+
"./accounts": {
|
|
103
|
+
"types": "./accounts.ts",
|
|
104
|
+
"import": "./accounts.ts",
|
|
105
|
+
"default": "./accounts.ts"
|
|
106
|
+
},
|
|
107
|
+
"./auth": {
|
|
108
|
+
"types": "./auth.ts",
|
|
109
|
+
"import": "./auth.ts",
|
|
110
|
+
"default": "./auth.ts"
|
|
111
|
+
},
|
|
112
|
+
"./server": {
|
|
113
|
+
"types": "./server.ts",
|
|
114
|
+
"import": "./server.ts",
|
|
115
|
+
"default": "./server.ts"
|
|
116
|
+
},
|
|
117
|
+
"./cli": {
|
|
118
|
+
"types": "./cli.ts",
|
|
119
|
+
"import": "./cli.ts",
|
|
120
|
+
"default": "./cli.ts"
|
|
121
|
+
},
|
|
122
|
+
"./providercli": {
|
|
123
|
+
"types": "./providers.ts",
|
|
124
|
+
"import": "./providers.ts",
|
|
125
|
+
"default": "./providers.ts"
|
|
126
|
+
},
|
|
127
|
+
"./project": {
|
|
128
|
+
"types": "./project.ts",
|
|
129
|
+
"import": "./project.ts",
|
|
130
|
+
"default": "./project.ts"
|
|
131
|
+
},
|
|
132
|
+
"./quota": {
|
|
133
|
+
"types": "./quota.ts",
|
|
134
|
+
"import": "./quota.ts",
|
|
135
|
+
"default": "./quota.ts"
|
|
136
|
+
},
|
|
137
|
+
"./recovery": {
|
|
138
|
+
"types": "./recovery.ts",
|
|
139
|
+
"import": "./recovery.ts",
|
|
140
|
+
"default": "./recovery.ts"
|
|
141
|
+
},
|
|
142
|
+
"./fingerprint": {
|
|
143
|
+
"types": "./fingerprint.ts",
|
|
144
|
+
"import": "./fingerprint.ts",
|
|
145
|
+
"default": "./fingerprint.ts"
|
|
146
|
+
},
|
|
147
|
+
"./search": {
|
|
148
|
+
"types": "./search.ts",
|
|
149
|
+
"import": "./search.ts",
|
|
150
|
+
"default": "./search.ts"
|
|
151
|
+
},
|
|
152
|
+
"./utils": {
|
|
153
|
+
"types": "./utils.ts",
|
|
154
|
+
"import": "./utils.ts",
|
|
155
|
+
"default": "./utils.ts"
|
|
156
|
+
},
|
|
157
|
+
"./versionregistry": {
|
|
158
|
+
"types": "./versionregistry.ts",
|
|
159
|
+
"import": "./versionregistry.ts",
|
|
160
|
+
"default": "./versionregistry.ts"
|
|
161
|
+
},
|
|
162
|
+
"./intelligence": {
|
|
163
|
+
"types": "./intelligence.ts",
|
|
164
|
+
"import": "./intelligence.ts",
|
|
165
|
+
"default": "./intelligence.ts"
|
|
166
|
+
},
|
|
167
|
+
"./json": {
|
|
168
|
+
"types": "./json.ts",
|
|
169
|
+
"import": "./json.ts",
|
|
170
|
+
"default": "./json.ts"
|
|
171
|
+
},
|
|
172
|
+
"./jsonpolicy": {
|
|
173
|
+
"types": "./json.ts",
|
|
174
|
+
"import": "./json.ts",
|
|
175
|
+
"default": "./json.ts"
|
|
176
|
+
},
|
|
177
|
+
"./jsonschema": {
|
|
178
|
+
"types": "./json.ts",
|
|
179
|
+
"import": "./json.ts",
|
|
180
|
+
"default": "./json.ts"
|
|
181
|
+
},
|
|
182
|
+
"./gatewayconfig": {
|
|
183
|
+
"types": "./gateway.ts",
|
|
184
|
+
"import": "./gateway.ts",
|
|
185
|
+
"default": "./gateway.ts"
|
|
186
|
+
},
|
|
187
|
+
"./gatewayviewconfig": {
|
|
188
|
+
"types": "./gateway.ts",
|
|
189
|
+
"import": "./gateway.ts",
|
|
190
|
+
"default": "./gateway.ts"
|
|
191
|
+
},
|
|
192
|
+
"./gatewayprobe": {
|
|
193
|
+
"types": "./gatewayprobe.ts",
|
|
194
|
+
"import": "./gatewayprobe.ts",
|
|
195
|
+
"default": "./gatewayprobe.ts"
|
|
196
|
+
},
|
|
197
|
+
"./gatewaysmoke": {
|
|
198
|
+
"types": "./gatewaysmoke.ts",
|
|
199
|
+
"import": "./gatewaysmoke.ts",
|
|
200
|
+
"default": "./gatewaysmoke.ts"
|
|
201
|
+
},
|
|
202
|
+
"./nodeshim": {
|
|
203
|
+
"types": "./nodeshim.ts",
|
|
204
|
+
"import": "./nodeshim.ts",
|
|
205
|
+
"default": "./nodeshim.ts"
|
|
206
|
+
},
|
|
207
|
+
"./types": {
|
|
208
|
+
"types": "./types.ts",
|
|
209
|
+
"import": "./types.ts",
|
|
210
|
+
"default": "./types.ts"
|
|
211
|
+
},
|
|
212
|
+
"./constants": {
|
|
213
|
+
"types": "./constants.ts",
|
|
214
|
+
"import": "./constants.ts",
|
|
215
|
+
"default": "./constants.ts"
|
|
43
216
|
}
|
|
44
217
|
},
|
|
45
218
|
"scripts": {
|
|
219
|
+
"db:generate": "prisma generate --schema schema.prisma",
|
|
46
220
|
"dev": "vite --host",
|
|
47
221
|
"build": "vite build",
|
|
48
222
|
"start": "vite preview --host",
|
|
@@ -59,16 +233,23 @@
|
|
|
59
233
|
"@fontsource-variable/inter": "^5.3.0",
|
|
60
234
|
"@fontsource-variable/jetbrains-mono": "^5.3.0",
|
|
61
235
|
"@fontsource-variable/outfit": "^5.3.0",
|
|
62
|
-
"@hono/node-server": "^2.1.
|
|
236
|
+
"@hono/node-server": "^2.1.6",
|
|
63
237
|
"@libsql/client": "^0.18.0",
|
|
64
238
|
"@prisma/adapter-libsql": "^7.10.1",
|
|
65
239
|
"@prisma/client": "^7.10.1",
|
|
66
|
-
"@wenathlan/
|
|
67
|
-
"@wenathlan/
|
|
68
|
-
"
|
|
240
|
+
"@wenathlan/cadria": "~2.0.155",
|
|
241
|
+
"@wenathlan/debonair": "~2.0.155",
|
|
242
|
+
"@wenathlan/devthink": "~2.0.154",
|
|
243
|
+
"@wenathlan/getry": "~2.0.155",
|
|
244
|
+
"@wenathlan/saddle": "~2.0.155",
|
|
245
|
+
"@wenathlan/argan": "~2.0.155",
|
|
246
|
+
"@wenathlan/vault": "~2.0.155",
|
|
247
|
+
"better-sqlite3": "^13.0.3",
|
|
248
|
+
"drizzle-orm": "^0.45.4",
|
|
249
|
+
"gsap": "^3.15.1",
|
|
69
250
|
"hono": "^4.13.16",
|
|
70
251
|
"ink": "^7.1.1",
|
|
71
|
-
"lucide-react": "^1.
|
|
252
|
+
"lucide-react": "^1.68.0",
|
|
72
253
|
"motion": "^12.43.0",
|
|
73
254
|
"react": "^19.3.1",
|
|
74
255
|
"react-devtools-core": "^8.0.0",
|
|
@@ -78,7 +259,7 @@
|
|
|
78
259
|
"z-ai-web-dev-sdk": "^0.0.18"
|
|
79
260
|
},
|
|
80
261
|
"devDependencies": {
|
|
81
|
-
"@biomejs/biome": "^2.6.
|
|
262
|
+
"@biomejs/biome": "^2.6.5",
|
|
82
263
|
"@capacitor/android": "^8.6.0",
|
|
83
264
|
"@capacitor/cli": "^8.6.0",
|
|
84
265
|
"@capacitor/core": "^8.6.0",
|
|
@@ -114,9 +295,9 @@
|
|
|
114
295
|
"@radix-ui/react-toggle": "^1.2.1",
|
|
115
296
|
"@radix-ui/react-toggle-group": "^1.2.1",
|
|
116
297
|
"@radix-ui/react-tooltip": "^1.4.1",
|
|
117
|
-
"@tailwindcss/postcss": "^4.3.
|
|
298
|
+
"@tailwindcss/postcss": "^4.3.4",
|
|
118
299
|
"@tailwindcss/typography": "^0.5.20",
|
|
119
|
-
"@tailwindcss/vite": "^4.3.
|
|
300
|
+
"@tailwindcss/vite": "^4.3.4",
|
|
120
301
|
"@tsconfig/node26": "^26.0.1",
|
|
121
302
|
"@types/better-sqlite3": "^9.6.0",
|
|
122
303
|
"@types/chrome": "^0.3.7",
|
|
@@ -126,7 +307,7 @@
|
|
|
126
307
|
"@types/react": "^19.3.0",
|
|
127
308
|
"@types/react-dom": "^19.3.0",
|
|
128
309
|
"@types/three": "^0.187.0",
|
|
129
|
-
"@vitejs/plugin-react": "^6.1
|
|
310
|
+
"@vitejs/plugin-react": "^6.2.1",
|
|
130
311
|
"add": "^2.0.9",
|
|
131
312
|
"autoprefixer": "^10.6.2",
|
|
132
313
|
"axios": "^1.21.0",
|
|
@@ -147,7 +328,7 @@
|
|
|
147
328
|
"hono": "^4.13.16",
|
|
148
329
|
"input-otp": "^1.5.0",
|
|
149
330
|
"jsdom": "26.1.0",
|
|
150
|
-
"lucide-react": "^1.
|
|
331
|
+
"lucide-react": "^1.68.0",
|
|
151
332
|
"mysql2": "^3.24.6",
|
|
152
333
|
"nanoid": "^6.0.2",
|
|
153
334
|
"next-themes": "^0.4.6",
|
|
@@ -162,12 +343,12 @@
|
|
|
162
343
|
"react-day-picker": "^10.0.2",
|
|
163
344
|
"react-dom": "^19.3.1",
|
|
164
345
|
"react-hook-form": "^7.91.0",
|
|
165
|
-
"react-resizable-panels": "^4.
|
|
346
|
+
"react-resizable-panels": "^4.18.0",
|
|
166
347
|
"recharts": "^3.10.1",
|
|
167
348
|
"sonner": "^2.0.8",
|
|
168
349
|
"streamdown": "^2.7.1",
|
|
169
350
|
"tailwind-merge": "^3.7.0",
|
|
170
|
-
"tailwindcss": "^4.3.
|
|
351
|
+
"tailwindcss": "^4.3.4",
|
|
171
352
|
"tailwindcss-animate": "^1.0.7",
|
|
172
353
|
"tsup": "^8.5.1",
|
|
173
354
|
"tsx": "^4.23.15",
|
|
@@ -176,7 +357,9 @@
|
|
|
176
357
|
"vaul": "^1.1.2",
|
|
177
358
|
"vite": "^8.3.5",
|
|
178
359
|
"vite-plugin-manus-runtime": "^0.0.59",
|
|
179
|
-
"vitest": "^5.0
|
|
360
|
+
"vitest": "^5.1.0",
|
|
361
|
+
"webpack": "^5.112.2",
|
|
362
|
+
"webpack-cli": "^6.0.1",
|
|
180
363
|
"wouter": "^3.13.0",
|
|
181
364
|
"yaml": "^2.9.1",
|
|
182
365
|
"zod": "^4.6.7"
|