twinny-server 4.0.19 → 4.2.0
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/README.md +43 -12
- package/cli.js +8865 -2760
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,17 +1,27 @@
|
|
|
1
1
|
# twinny-server
|
|
2
2
|
|
|
3
3
|
Serve the models on one machine to the [Twinny](https://github.com/twinnydotdev/twinny)
|
|
4
|
-
VS Code extension on
|
|
4
|
+
VS Code extension on every other. One process, one config file, a key per developer.
|
|
5
5
|
|
|
6
6
|
```
|
|
7
|
-
VS Code + Twinny → twinny-server → Ollama / LM Studio / llama.cpp / any OpenAI-compatible server
|
|
7
|
+
VS Code + Twinny → twinny-server → Ollama / LM Studio / llama.cpp / any OpenAI-compatible server / teammates' computers
|
|
8
8
|
```
|
|
9
9
|
|
|
10
10
|
Needs Node 18 or newer. No other dependencies.
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
What you get:
|
|
13
|
+
|
|
14
|
+
- **Keys and usage.** A key per developer, stored as a hash, revoked live; requests, failures and token counts per person and per model, never the content.
|
|
15
|
+
- **An admin page** at `/admin`: backends, usage charts, people and invite links, providers and models edited live, policy, plan.
|
|
16
|
+
- **Team pooling.** Developers can share their own computer's models with the team through the gateway; no port to open on their side.
|
|
17
|
+
- **Plugins** (licence): pull requests and issues from GitHub, GitLab, Gitea and Bitbucket reviewed by your own models and posted back; Slack, Discord and Teams notifications; SSO sign-in (OIDC); a shared context index; nightly backups.
|
|
18
|
+
- **Policy and recording** (licence): rules the extension enforces, routing rules, a team system prompt; recorded request content for review and training data.
|
|
19
|
+
- **Operations.** A hash-chained audit log, read-only admin keys, Prometheus at `/metrics`, costs when a model has a price, a bounded queue for a busy GPU, Docker and Helm.
|
|
20
|
+
|
|
21
|
+
Free for up to 5 developers (active keys), for good. Larger teams install a
|
|
22
|
+
licence token; see [Licensing and seats](https://twinnydotdev.github.io/twinny-docs/teams/licensing/).
|
|
23
|
+
The server never contacts Twinny. What changed in each version is in the
|
|
24
|
+
[changelog](https://github.com/twinnydotdev/twinny/blob/main/CHANGELOG.md).
|
|
15
25
|
|
|
16
26
|
## Quick start
|
|
17
27
|
|
|
@@ -68,16 +78,20 @@ front of it. Anything but loopback is exposed to that network.
|
|
|
68
78
|
| `twinny-server quickstart [--yes] [--fresh] [--admin <name>] [--backend [kind=]host[:port]]` | Finds the model server (or asks the named one) for its models and writes the configuration if missing, makes an admin key if there is none, serves. `--yes` skips the questions; `--fresh` wipes keys, licence, usage, recordings and the configuration first. |
|
|
69
79
|
| `twinny-server init [file] [--backend [kind=]host[:port]]` | Writes a starter configuration for one server (`lmstudio=10.0.0.5`, `llamacpp=gpu-box:8080`, `http://host:8000`; Ollama here by default). Never overwrites. |
|
|
70
80
|
| `twinny-server reset --yes [--all]` | Removes keys, licence, usage and recordings; `--all` also the configuration file. Without `--yes` it only lists them. |
|
|
71
|
-
| `twinny-server serve --config <file
|
|
81
|
+
| `twinny-server serve --config <file> [--port <n>] [--host <addr>]` | Runs the gateway until SIGINT/SIGTERM. `--demo` serves a public, read-only admin page with one-hour guest keys. |
|
|
72
82
|
| `twinny-server keys create <name>` | Makes an access key for a developer. Printed once; only its hash is stored. |
|
|
73
83
|
| `twinny-server keys list` / `revoke <name>` | Shows keys; stops one, effective without a restart. |
|
|
74
84
|
| `twinny-server usage [--since 7d] [--by key]` | Requests, failures and reported token counts by key and model. |
|
|
75
|
-
| `twinny-server keys create <name> --admin` | A key that can also open the admin page at `http://<gateway>/admin`. |
|
|
85
|
+
| `twinny-server keys create <name> --admin [--read-only]` | A key that can also open the admin page at `http://<gateway>/admin`. Read-only admins can look but not change anything. |
|
|
86
|
+
| `twinny-server invites create <name> --url <gateway> [--admin] [--replace]` / `list` / `withdraw <id>` | An invite link that opens VS Code and connects the developer. One use, seven days, no seat until opened. |
|
|
76
87
|
| `twinny-server license [set <token>\|remove]` | The plan and seats. Free: up to 5 active keys. A licence from Twinny raises that; install it here or on the admin page. |
|
|
88
|
+
| `twinny-server recordings export [--format training\|raw]` / `stats` | Recorded request content (licence feature) as training data. |
|
|
89
|
+
| `twinny-server backup now` / `list` / `restore <archive> --yes` | The Backups plugin from the shell. Restore with the gateway stopped. |
|
|
77
90
|
| `twinny-server --version` | Prints the version. Track the extension's version. |
|
|
78
91
|
|
|
79
|
-
Exit codes from `serve`: `2` invalid config or arguments, `3` a
|
|
80
|
-
environment variable is unset, `4` unsupported provider kind, `5` port
|
|
92
|
+
Exit codes from `serve`: `2` invalid config or arguments, `3` no way in or a
|
|
93
|
+
named environment variable is unset, `4` unsupported provider kind, `5` port
|
|
94
|
+
in use, `6` the data directory was written by a newer twinny-server.
|
|
81
95
|
|
|
82
96
|
## Docker
|
|
83
97
|
|
|
@@ -96,6 +110,10 @@ docker compose up -d
|
|
|
96
110
|
the `twinny-data` volume, and every `docker compose run --rm twinny-server …`
|
|
97
111
|
command shares it with the running gateway.
|
|
98
112
|
|
|
113
|
+
For Kubernetes, `deploy/helm/twinny-server` in the repository is a Helm chart:
|
|
114
|
+
one pod, one volume, an optional Ingress with TLS, and a ServiceMonitor for
|
|
115
|
+
`/metrics`. Keep one replica.
|
|
116
|
+
|
|
99
117
|
## Backends
|
|
100
118
|
|
|
101
119
|
The gateway serves any provider kind the extension has an adapter for:
|
|
@@ -156,9 +174,19 @@ tailnet with `"listen": { "host": "0.0.0.0" }` in the configuration.
|
|
|
156
174
|
reassign a provider's models before deleting it.
|
|
157
175
|
- **Other config changes** (limits, address, auth), or direct file edits:
|
|
158
176
|
edit the file and restart. Keys never need a restart.
|
|
159
|
-
- **
|
|
160
|
-
|
|
161
|
-
|
|
177
|
+
- **Plugins:** `/admin` → **Plugins → Store** lists what this build carries;
|
|
178
|
+
switch one on and it gets its own page. Reviews and triage run on the
|
|
179
|
+
gateway's own chat aliases, in the background only while no developer
|
|
180
|
+
request is running, and appear in usage under `plugin:<id>`.
|
|
181
|
+
- **Audit log:** every admin change, hash-chained, under **Team → Audit log**;
|
|
182
|
+
filter, verify and export. `/metrics` answers Prometheus scrapes with an
|
|
183
|
+
admin key (a read-only one will do).
|
|
184
|
+
- **Files:** everything is in one directory, `~/.twinny/server` by default:
|
|
185
|
+
keys (hashes only), invites, the licence, `plugins/`, `audit/`, usage (one
|
|
186
|
+
file per day, deleted after 30 days) and recordings. `format.json` names
|
|
187
|
+
the layout; a newer server migrates it on start, an older one refuses to
|
|
188
|
+
start. Back it up together with the configuration, or let the Backups
|
|
189
|
+
plugin do it nightly.
|
|
162
190
|
|
|
163
191
|
## Configuration
|
|
164
192
|
|
|
@@ -204,6 +232,9 @@ lifecycle details are in
|
|
|
204
232
|
completions, headers or backend bodies. Opt-in recording stores request content
|
|
205
233
|
separately. Inference requests go to the backends you configure; there is no
|
|
206
234
|
telemetry or licence check sent to Twinny.
|
|
235
|
+
- Every change made through the admin page or CLI is in the audit log, each
|
|
236
|
+
line carrying the hash of the one before it; tokens for forges and webhooks
|
|
237
|
+
are kept in files only the server's user can read and never shown again.
|
|
207
238
|
|
|
208
239
|
## License
|
|
209
240
|
|