aweshare 0.3.8 → 0.4.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.
Files changed (56) hide show
  1. package/README.md +61 -52
  2. package/apps/agent/dist/cli.js +20 -87
  3. package/apps/agent/dist/cli.js.map +1 -1
  4. package/apps/agent/dist/config.d.ts +5 -1
  5. package/apps/agent/dist/config.js +25 -4
  6. package/apps/agent/dist/config.js.map +1 -1
  7. package/apps/agent/dist/connection.js +2 -0
  8. package/apps/agent/dist/connection.js.map +1 -1
  9. package/apps/agent/dist/hub.d.ts +0 -2
  10. package/apps/agent/dist/hub.js +4 -14
  11. package/apps/agent/dist/hub.js.map +1 -1
  12. package/apps/consumer/dist/cli.d.ts +2 -0
  13. package/apps/consumer/dist/cli.js +151 -0
  14. package/apps/consumer/dist/cli.js.map +1 -0
  15. package/apps/consumer/dist/hub.d.ts +37 -0
  16. package/apps/consumer/dist/hub.js +152 -0
  17. package/apps/consumer/dist/hub.js.map +1 -0
  18. package/apps/consumer/dist/table.d.ts +11 -0
  19. package/apps/consumer/dist/table.js +23 -0
  20. package/apps/consumer/dist/table.js.map +1 -0
  21. package/apps/consumer/package.json +16 -0
  22. package/apps/hub/dist/admin.d.ts +3 -3
  23. package/apps/hub/dist/admin.js +5 -169
  24. package/apps/hub/dist/admin.js.map +1 -1
  25. package/apps/hub/dist/cli.js +13 -21
  26. package/apps/hub/dist/cli.js.map +1 -1
  27. package/apps/hub/dist/config.d.ts +5 -0
  28. package/apps/hub/dist/config.js +99 -0
  29. package/apps/hub/dist/config.js.map +1 -1
  30. package/apps/hub/dist/consumer.d.ts +5 -1
  31. package/apps/hub/dist/consumer.js +38 -10
  32. package/apps/hub/dist/consumer.js.map +1 -1
  33. package/apps/hub/dist/db.d.ts +9 -19
  34. package/apps/hub/dist/db.js +70 -49
  35. package/apps/hub/dist/db.js.map +1 -1
  36. package/apps/hub/dist/invites.js +4 -3
  37. package/apps/hub/dist/invites.js.map +1 -1
  38. package/apps/hub/dist/limiter.d.ts +8 -0
  39. package/apps/hub/dist/limiter.js +26 -0
  40. package/apps/hub/dist/limiter.js.map +1 -1
  41. package/apps/hub/dist/server.js +5 -10
  42. package/apps/hub/dist/server.js.map +1 -1
  43. package/apps/hub/dist/tunnel.js +14 -0
  44. package/apps/hub/dist/tunnel.js.map +1 -1
  45. package/apps/hub/package.json +1 -0
  46. package/bin/aweshare.mjs +11 -7
  47. package/bin/self-update.mjs +1 -1
  48. package/package.json +3 -1
  49. package/packages/protocol/dist/errors.d.ts +0 -2
  50. package/packages/protocol/dist/errors.js +0 -2
  51. package/packages/protocol/dist/errors.js.map +1 -1
  52. package/packages/protocol/dist/messages.d.ts +4 -0
  53. package/packages/protocol/dist/messages.js.map +1 -1
  54. package/apps/agent/dist/table.d.ts +0 -12
  55. package/apps/agent/dist/table.js +0 -26
  56. package/apps/agent/dist/table.js.map +0 -1
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
  <img src="./logo/logo.png" alt="aweshare" width="760">
3
3
  <h1>aweshare: Local-first AI Capability Relay</h1>
4
4
  <p><strong>An open-source, local-first AI capability relay.</strong></p>
5
- <p>Share local Ollama/vLLM or authorized OpenAI/Anthropic backends through a grant-based hub, consumed with standard SDKs via <code>namespace/alias</code>.</p>
5
+ <p>Share local Ollama/vLLM or authorized OpenAI/Anthropic backends through a self-hosted hub, consumed with standard SDKs via <code>namespace/alias</code>.</p>
6
6
  <p><strong>Upstream API keys never leave the producer's device.</strong></p>
7
7
  <p>
8
8
  <strong>English</strong> ·
@@ -14,7 +14,7 @@
14
14
  <a href="https://ko-fi.com/mugpeng"><img src="https://img.shields.io/badge/Ko--fi-Buy%20me%20a%20coffee-FF5E5B?style=flat-square&logo=ko-fi&logoColor=white" alt="Ko-fi"></a>
15
15
  </p>
16
16
  <p>
17
- <a href="https://github.com/wehuman01/aweshare-source/releases"><img src="https://img.shields.io/badge/version-0.3.8-7C3AED?style=flat-square" alt="Version"></a>
17
+ <a href="https://github.com/wehuman01/aweshare-source/releases"><img src="https://img.shields.io/badge/version-0.4.0-7C3AED?style=flat-square" alt="Version"></a>
18
18
  <a href="https://github.com/wehuman01/aweshare"><img src="https://img.shields.io/badge/node-%E2%89%A522-0EA5E9?style=flat-square" alt="Node"></a>
19
19
  <a href="https://github.com/wehuman01/aweshare/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-proprietary-E34F26?style=flat-square" alt="License"></a>
20
20
  <a href="https://www.npmjs.com/package/aweshare"><img src="https://img.shields.io/badge/npm-aweshare-7C3AED?style=flat-square" alt="npm package"></a>
@@ -35,7 +35,7 @@
35
35
  ```
36
36
  Consumer (standard SDK, zero changes) Producer side
37
37
  ┌───────────────────────┐ ┌────────────────────────────┐
38
- │ Claude Code │ │ aweshare agent (Node CLI) │
38
+ │ Claude Code │ │ aweshare producer (Node CLI) │
39
39
  │ ANTHROPIC_BASE_URL ──┼──► HTTPS ──┤ ~/.aweshare/config.toml │
40
40
  │ OpenAI SDK / Codex │ │ ~/.aweshare/secrets.json │
41
41
  └───────────────────────┘ │ │ upstream key injection │
@@ -44,11 +44,11 @@ Consumer (standard SDK, zero changes) Producer side
44
44
  ▼ │
45
45
  ┌─────────────────────────────┐ │
46
46
  │ aweshare hub (public, 1 node)│◄───── WSS reverse tunnel (agent dials out)
47
- │ auth / grants / route / meter│ no public IP, no port forwarding needed
47
+ │ auth / route / meter │ no public IP, no port forwarding needed
48
48
  └─────────────────────────────┘
49
49
  ```
50
50
 
51
- - **Grant-based trust**: consumers can only use aliases explicitly granted to them. No payments, no marketplace.
51
+ - **Invite-only trust**: admission runs through one-time invite codes the operator mints; every admitted consumer may call every offering. No payments, no marketplace.
52
52
  - **Namespaced aliases**: `peng/gpt-4o` is globally unique with one owner — routing is a deterministic lookup.
53
53
  - v1 relays **native transparent SSE** for OpenAI↔OpenAI (chat completions and Responses), Anthropic↔Anthropic. No cross-protocol conversion, no smart routing, no web console.
54
54
 
@@ -56,7 +56,7 @@ Consumer (standard SDK, zero changes) Producer side
56
56
 
57
57
  - To route and meter, **consumer prompts and model responses transit the hub in plaintext — this is not end-to-end encryption**. The hub persists no request/response content, but the hub operator can technically see it. Only use a hub instance you trust — which is why the hub is open source and self-hostable.
58
58
  - Upstream API keys never leave the producer's device and are never sent to consumers. Tokens are stored **hash-only** (peppered SHA-256): the plaintext is shown exactly once at issue/redeem and can never be re-displayed. Invite codes are the deliberate exception — their plaintext is kept so the operator can re-view them with `hub list --reveal`; a DB leak exposes unredeemed codes, but no tokens.
59
- - Token revocation is **reversible suspension** (`hub revoke --id N` / `hub restore --id N`, by invite), and an invite and the producer it minted move together: revoking a redeemed code suspends that producer (and closes its tunnel), and restoring from either handle revives both. Nothing is deleted on revoke — grants, offerings and usage history survive a suspension.
59
+ - Token revocation is **reversible suspension** (`hub revoke --id N` / `hub restore --id N`, by invite), and an invite and the producer it minted move together: revoking a redeemed code suspends that producer (and closes its tunnel), and restoring from either handle revives both. Nothing is deleted on revoke — offerings and usage history survive a suspension.
60
60
 
61
61
  ### Compliance and disclaimer
62
62
 
@@ -97,26 +97,21 @@ aweshare hub invite --name peng [--expires-in 7d] # → asi_..., send to th
97
97
  aweshare hub invite --count 10 [--expires-in 7d]
98
98
 
99
99
  # the producer redeems it themselves (no token hand-off needed):
100
- aweshare agent join --hub https://hub.example.com --code asi_... [--name NAME --email YOU@EXAMPLE.COM]
100
+ aweshare producer join --hub https://hub.example.com --code asi_... [--name NAME --email YOU@EXAMPLE.COM]
101
101
  ```
102
102
 
103
- Consumers join the same way — a consumer code redeems into an `asc_` key the consumer keeps (no aweshare install needed):
103
+ Consumers join the same way — a consumer code redeems into an `asc_` key the consumer keeps:
104
104
 
105
105
  ```bash
106
106
  aweshare hub invite --role consumer --name alice [--expires-in 7d] # → asi_..., send to the consumer
107
107
 
108
- # the consumer redeems it themselves with one curl:
109
- curl -s -X POST https://hub.example.com/invites/v1/redeem \
110
- -H 'content-type: application/json' -d '{"code":"asi_..."}'
111
- # → {"role":"consumer","name":"alice","token":"asc_..."} — set as the SDK API key
112
- ```
113
-
114
- Prefer hand-delivering keys? Direct issuance still works via the admin API:
108
+ # the consumer redeems it themselves (prints the asc_ token once, with the SDK
109
+ # env vars ready to paste — save the token, it will not be shown again):
110
+ aweshare consumer join --hub https://hub.example.com --code asi_...
115
111
 
116
- ```bash
117
- curl -X POST https://hub.example.com/admin/v1/tokens \
118
- -H "Authorization: Bearer asa_... (the admin token)" -H "content-type: application/json" \
119
- -d '{"role":"consumer","name":"alice"}' # → asc_..., give to the consumer
112
+ # no aweshare installed? one curl works too:
113
+ # curl -s -X POST https://hub.example.com/invites/v1/redeem \
114
+ # -H 'content-type: application/json' -d '{"code":"asi_..."}'
120
115
  ```
121
116
 
122
117
  Three token roles, one per party:
@@ -125,11 +120,11 @@ Three token roles, one per party:
125
120
  |---|---|---|
126
121
  | `admin` | hub operator (you only) | the admin REST API (`/admin/v1/*`); CLI side: `hub invite` / `list [invites\|producers\|consumers]` / `revoke` / `restore` |
127
122
  | `producer` (`asp_...`) | the agent on the producer's machine | set as `token` in `~/.aweshare/config.toml`; the agent registers its offerings with it |
128
- | `consumer` (`asc_...`) | whoever calls the models | set in SDK env vars (`ANTHROPIC_AUTH_TOKEN` / `OPENAI_API_KEY`); the hub uses it to decide which aliases they may call |
123
+ | `consumer` (`asc_...`) | whoever calls the models | set in SDK env vars (`ANTHROPIC_AUTH_TOKEN` / `OPENAI_API_KEY`); it identifies the consumer for metering, limits and suspension |
129
124
 
130
125
  The producer's `name` becomes their alias namespace (the `peng/` in `peng/gpt-4o`).
131
126
 
132
- Identity and permission are deliberately split. The operator issues identities invite codes for producers, `asc_…` keys for consumers while each producer alone decides who may call their own aliases (`aweshare agent grant`; the admin API can read grants for audit but cannot write them). A fresh consumer key can call nothing until a producer grants it, so the hub works the same whether you run everything yourself (private hub) or producers who don't know each other share yours (community hub).
127
+ The operator owns admission: one-time invite codes for both roles, the only admission path (every identity carries its invite handle for its whole lifecycle). A redeemed consumer key may call **every** offering on the hub if you let someone in, they can use what is shared. Guardrails: per-consumer `hub limits` (rate, concurrency, token budgets), per-offering caps (`maxConcurrentUsers`, `dailyTokens`) and `hub revoke` suspension, all enforced by the hub.
133
128
 
134
129
  ### 2. Producer first run (in this order)
135
130
 
@@ -137,29 +132,25 @@ Identity and permission are deliberately split. The operator issues identities
137
132
  npm install -g aweshare # ⓪ once, on the producer machine (Node ≥ 22)
138
133
 
139
134
  # ① join with your invite code (writes ~/.aweshare/config.toml + secrets.json, 0600)
140
- aweshare agent join --hub https://hub.example.com --code asi_...
135
+ aweshare producer join --hub https://hub.example.com --code asi_...
141
136
  # or, with a producer token handed to you directly:
142
- aweshare agent init --hub https://hub.example.com --token asp_...
137
+ aweshare producer init --hub https://hub.example.com --token asp_...
143
138
 
144
139
  # ② Edit the config (see below); put upstream keys in secrets.json — they never leave this machine
145
140
 
146
141
  # ③ doctor: pre-flight checks, ordered to find the first failing link
147
- aweshare agent doctor
142
+ aweshare producer doctor
148
143
 
149
- # ④ Grant a consumer
150
- aweshare agent grant --alias peng/qwen2.5.7b --consumer alice
151
- # time-limited trial: add --expires-in 7d (re-granting refreshes the expiry)
152
-
153
- # ⑤ Start (long-running; when it stops, aliases go offline and consumers get 503)
154
- aweshare agent start
144
+ # ④ Start (long-running; when it stops, aliases go offline and consumers get 503)
145
+ aweshare producer start
155
146
  ```
156
147
 
157
148
  ### 3. Consumer first run (in this order)
158
149
 
159
150
  ```bash
160
151
  # ⓪ redeem your invite code (skip if the operator handed you an asc_ key directly)
161
- curl -s -X POST https://hub.example.com/invites/v1/redeem \
162
- -H 'content-type: application/json' -d '{"code":"asi_..."}' # → your asc_ token
152
+ # prints the token once with ready-to-paste env vars — save it, it will not be shown again
153
+ aweshare consumer join --hub https://hub.example.com --code asi_...
163
154
 
164
155
  # ① one small curl to prove the path
165
156
  curl https://hub.example.com/v1/chat/completions \
@@ -197,7 +188,7 @@ If Claude Code has a stale OAuth login it overrides env config — switch with `
197
188
  base_url = "https://hub.example.com/v1"
198
189
  ```
199
190
 
200
- **Discovering models**: `GET /v1/models` (OpenAI SDK `client.models.list()`) returns every alias granted to the key, with online status.
191
+ **Discovering models**: `GET /v1/models` (OpenAI SDK `client.models.list()`) returns every alias registered on the hub, with online status.
201
192
 
202
193
  ## Producer config reference (~/.aweshare/config.toml)
203
194
 
@@ -227,8 +218,21 @@ alias = "peng/qwen2.5.7b" # namespace must be your producer name
227
218
  backend = "ollama"
228
219
  upstreamModel = "qwen2.5:7b" # the real backend id (full tag from `ollama list`)
229
220
  maxConcurrency = 1 # start at 1 for local models; raise for cloud APIs
221
+ # maxConcurrentUsers = 3 # distinct concurrent consumers (hub default 3)
222
+ # dailyTokens = 1000000 # shared tokens per UTC day (default 1M; 0 = unlimited)
230
223
  ```
231
224
 
225
+ One offering exposes exactly one upstream model: consumers call the alias and the hub rewrites the request's model to `upstreamModel` before dispatch — they can never pick another model. To share more models, add more `[[offerings]]`.
226
+
227
+ **Per-offering usage caps** ride along in the same block; both are optional and enforced by the hub (defaults apply when unset, including for agents that predate them):
228
+
229
+ | Key | Default | Meaning | Enforcement |
230
+ |---|---|---|---|
231
+ | `maxConcurrentUsers` | 3 | distinct consumers with a request in flight on this alias | 429 `PRODUCER_MAX_USERS` |
232
+ | `dailyTokens` | 1000000 | tokens (prompt + completion) shared across all consumers on this alias, per UTC day; `0` = unlimited | 429 `QUOTA_EXCEEDED` (resets at UTC midnight) |
233
+
234
+ `maxConcurrency` caps in-flight **requests**; `maxConcurrentUsers` caps in-flight **people** — a single consumer firing 5 parallel requests needs `maxConcurrency ≥ 5` but still counts as one user. Daily caps count recorded usage (see "Honest limits" below).
235
+
232
236
  Key hygiene: use dedicated, least-privilege, revocable keys with budget alerts; keep `secrets.json` at 0600 and out of git/screenshots; rotate on suspected leaks. Before sharing, check the upstream's terms: account rules, subscription limits, forwarding and commercial-use constraints.
233
237
 
234
238
  ## Consumer limits (hub-wide defaults + per-consumer overrides)
@@ -252,8 +256,6 @@ curl -X PUT https://hub.example.com/admin/v1/consumers/alice/limits \
252
256
  | `tpm` | max tokens (prompt + completion) in any sliding 60s window | 429 `RATE_LIMITED` (in-memory window, like the RPS bucket) |
253
257
  | `maxTotalTokens` | lifetime token budget for this consumer | 429 `QUOTA_EXCEEDED` (sums `usage_events`) |
254
258
 
255
- Grants can also carry an expiry: `aweshare agent grant --alias peng/gpt-4o --consumer alice --expires-in 7d`. Grant writes are producer-owned — the admin API keeps read-only audit access but rejects admin-token writes with `403 NOT_GRANTED`. An expired grant returns `403 GRANT_EXPIRED`; re-granting refreshes the expiry.
256
-
257
259
  Honest limits: token-based caps count what upstreams report — Ollama streams report no usage, so they contribute 0. Both TPM and the lifetime budget are observed-usage thresholds, not hard reservations: one request can cross the threshold, and concurrent requests that start before earlier usage is recorded can overshoot it further. Once recorded usage has reached the threshold, new requests are rejected.
258
260
 
259
261
  ## Endpoints and errors
@@ -261,13 +263,14 @@ Honest limits: token-based caps count what upstreams report — Ollama streams r
261
263
  | Endpoint | Purpose |
262
264
  |---|---|
263
265
  | `POST /v1/chat/completions` · `POST /v1/messages` · `POST /v1/responses` | inference (Bearer or `x-api-key`) |
264
- | `GET /v1/models` | aliases visible to this key, with status |
266
+ | `GET /v1/models` | every alias registered on the hub, with status |
267
+ | `GET /v1/catalog` | every offering on the hub — producer, alias, protocol, status, the per-offering caps (discovery view for `aweshare consumer list`) |
265
268
  | `GET /healthz` | liveness |
266
- | `/admin/v1/*` | token/limit/usage management (admin or producer token) · grants: writes producer-only, admin reads for audit · consumer limit overrides: `GET`/`PUT`/`DELETE /admin/v1/consumers/{name}/limits` (admin only) |
269
+ | `/admin/v1/*` | token/limit/usage management (admin or producer token) · consumer limit overrides: `GET`/`PUT`/`DELETE /admin/v1/consumers/{name}/limits` (admin only) |
267
270
 
268
- Error semantics: `401` invalid key · `401 TOKEN_REVOKED` suspended token (ask the operator to restore it) · `403` not granted or `GRANT_EXPIRED` · `403 HUB_FULL` producer capacity reached · `404` unknown alias · `400 PROTOCOL_MISMATCH` protocol/alias mismatch · `429` rate limit, TPM or producer concurrency cap (`QUOTA_EXCEEDED` = lifetime token budget hit) · `502` upstream/tunnel failure (upstream 4xx/5xx passes through verbatim) · `503` producer offline / backend degraded · `504` timeout. Errors carry `{error:{code,message,requestId}}`; the requestId spans both sides' logs.
271
+ Error semantics: `401` invalid key · `401 TOKEN_REVOKED` suspended token (ask the operator to restore it) · `403 HUB_FULL` producer capacity reached · `404` unknown alias · `400 PROTOCOL_MISMATCH` protocol/alias mismatch · `429` rate limit, TPM or producer concurrency cap (`PRODUCER_MAX_USERS` = distinct-consumer cap; `QUOTA_EXCEEDED` = lifetime or daily token budget hit) · `502` upstream/tunnel failure (upstream 4xx/5xx passes through verbatim) · `503` producer offline / backend degraded · `504` timeout. Errors carry `{error:{code,message,requestId}}`; the requestId spans both sides' logs.
269
272
 
270
- Usage metering: one row per request (alias, real model, status, duration, byte counts, best-effort token counts), **zero content stored**. Producers list grants with `aweshare agent list`; usage is queried with `aweshare hub usage` or `GET /admin/v1/usage` (admin sees everything, producers and consumers their own slice).
273
+ Usage metering: one row per request (alias, real model, status, duration, byte counts, best-effort token counts), **zero content stored**. Usage is queried with `aweshare hub usage` or `GET /admin/v1/usage` (admin sees everything, producers and consumers their own slice).
271
274
 
272
275
  ## Command reference
273
276
 
@@ -285,30 +288,36 @@ Both sides at a glance — details in the sections above.
285
288
  | `aweshare hub usage [--consumer NAME] [--alias ns/model] [--limit N] [--json]` | recent requests, newest first — one row per request, zero content stored |
286
289
  | `aweshare hub revoke --id N` · `aweshare hub restore --id N` | kill an invite / undo — a redeemed code suspends the producer it minted, restore revives both |
287
290
 
288
- Token issuance runs through invites (both roles). `limits` and `usage` are thin wrappers over the admin REST API (`/admin/v1/*`, see Endpoints and errors) — curl works too. Grants are producer-owned and were never the operator's CLI: manage them with `aweshare agent grant`/`revoke`/`list` on the producer machine (the admin API keeps read-only audit access).
291
+ Token issuance runs through invites (both roles). `limits` and `usage` are thin wrappers over the admin REST API (`/admin/v1/*`, see Endpoints and errors) — curl works too.
289
292
 
290
293
  `list` prints an aligned table by default; append `--json` for the raw API response.
291
294
 
292
- **Agent (producer)** — runs on the producer's machine (the one with the backends); consumers run no aweshare commands — they point a standard SDK at the hub (see Consumer tool configuration):
295
+ **Producer** — runs on the producer's machine (the one with the backends):
293
296
 
294
297
  | Command | Purpose |
295
298
  |---|---|
296
- | `aweshare agent init [--hub URL] [--token asp_…]` | write config templates into `~/.aweshare` |
297
- | `aweshare agent join --hub URL --code asi_… [--name NAME --email YOU@EXAMPLE.COM]` | redeem an invite code into a producer token and write it into the config (`--name`/`--email` for unbound codes; probes the hub first — plain HTTP outside the LAN needs `--allow-http`) |
298
- | `aweshare agent config path` · `config show` · `config edit` | locate / inspect (secrets redacted) / edit the config |
299
- | `aweshare agent doctor` | pre-flight checks — fix the first FAIL, re-run |
300
- | `aweshare agent grant --alias ns/model --consumer NAME [--expires-in 7d]` | grant a consumer access |
301
- | `aweshare agent revoke --alias ns/model --consumer NAME` | revoke access |
302
- | `aweshare agent list` | list grants for your namespace |
303
- | `aweshare agent start` | connect and relay (long-running; run it in your own terminal) |
299
+ | `aweshare producer init [--hub URL] [--token asp_…]` | write config templates into `~/.aweshare` |
300
+ | `aweshare producer join --hub URL --code asi_… [--name NAME --email YOU@EXAMPLE.COM]` | redeem an invite code into a producer token and write it into the config (`--name`/`--email` for unbound codes; probes the hub first — plain HTTP outside the LAN needs `--allow-http`) |
301
+ | `aweshare producer config path` · `config show` · `config edit` | locate / inspect (secrets redacted) / edit the config |
302
+ | `aweshare producer doctor` | pre-flight checks — fix the first FAIL, re-run |
303
+ | `aweshare producer start` | connect and relay (long-running; run it in your own terminal) |
304
+
305
+ **Consumer** two commands, on the consumer's machine; day-to-day they point a standard SDK at the hub (see Consumer tool configuration):
306
+
307
+ | Command | Purpose |
308
+ |---|---|
309
+ | `aweshare consumer join --hub URL --code asi_… [--allow-http]` | redeem a consumer invite into an `asc_` token — printed once with ready-to-paste SDK env vars (save it: the hub stores only a hash) |
310
+ | `aweshare consumer list --hub URL --token asc_… [--json]` | discovery view of the hub: every producer, alias, protocol, status, the per-offering caps |
304
311
 
305
312
  CLI maintenance: `aweshare self-update [--check]` updates the npm-installed CLI (`--check` only compares versions).
306
313
 
307
314
  ## Operations
308
315
 
316
+ The hub reads `config.toml` from its data dir (`~/.aweshare-hub/config.toml`; Docker: `/data/config.toml`). `aweshare hub init` writes the template with every key commented out — uncomment to override a default. Keys use the same names as below, camelCase (`consumerRps`, `headTimeoutMs`, …). Precedence: `serve` flags (`--host`/`--port`) > env vars > config.toml > defaults. A broken file (invalid TOML, unknown key, non-positive value) fails fast at startup with the key named; `AWESHARE_HUB_DATA_DIR` itself stays env-only (it locates the file).
317
+
309
318
  | Env var | Default | Purpose |
310
319
  |---|---|---|
311
- | `AWESHARE_HUB_DATA_DIR` | `~/.aweshare-hub` | data dir (SQLite/pepper/admin token; volume-mount = backup) |
320
+ | `AWESHARE_HUB_DATA_DIR` | `~/.aweshare-hub` | data dir (SQLite/pepper/admin token/config.toml; volume-mount = backup) |
312
321
  | `AWESHARE_HUB_PORT` / `HOST` | 8787 / 0.0.0.0 | listen address |
313
322
  | `AWESHARE_CONSUMER_RPS` / `BURST` / `CONCURRENCY` | 10 / 20 / 8 | per-consumer limits |
314
323
  | `AWESHARE_HEAD_TIMEOUT_MS` / `IDLE_TIMEOUT_MS` | 120000 / 300000 | response-head timeout / stream idle timeout |
@@ -332,7 +341,7 @@ Updating a npm install: `aweshare self-update` (asks before installing; `--check
332
341
 
333
342
  ```bash
334
343
  pnpm install
335
- pnpm test # 98 tests: protocol / hub contract (fake agent vs real hub) / agent unit / e2e (real SDKs)
344
+ pnpm test # 197 tests: protocol / hub contract (fake agent vs real hub) / agent unit / e2e (real SDKs)
336
345
  pnpm build # tsc -b, whole monorepo
337
346
  pnpm check # biome
338
347
  ```
@@ -342,7 +351,7 @@ To run the CLIs from a source checkout without `node apps/.../dist/cli.js`, link
342
351
  ```bash
343
352
  npm link # or: pnpm link --global — exposes the single `aweshare` bin
344
353
  aweshare hub serve
345
- aweshare agent doctor
354
+ aweshare producer doctor
346
355
  ```
347
356
 
348
357
  Releasing: push a `v*` tag with a matching `## [x.y.z]` section in `docs/CHANGELOG.md`; CI publishes the `aweshare` package to npm via Trusted Publishing (OIDC, no token secret), pushes the Docker image to `ghcr.io/wehuman01/aweshare`, and mirrors user-facing docs to the public repo (`wehuman01/aweshare`).
@@ -1,6 +1,5 @@
1
1
  #!/usr/bin/env node
2
- // Command set: init, join, config (path|show|edit), doctor, start, grant,
3
- // revoke, list. `config init` remains as a hidden redirect to `init`.
2
+ // Command set: init, join, config (path|show|edit), doctor, start.
4
3
  // Everything that talks to the hub goes through src/hub.ts (one UA, one
5
4
  // timeout policy, one error shape).
6
5
  import { spawn } from 'node:child_process';
@@ -11,11 +10,10 @@ import pino from 'pino';
11
10
  import { agentDir, applyJoinToConfig, CONFIG_TEMPLATE, loadAgentConfig, redactConfig, SECRETS_TEMPLATE, writeFileAtomic, } from './config.js';
12
11
  import { AgentConnection } from './connection.js';
13
12
  import { runDoctor } from './doctor.js';
14
- import { assertWireCompatible, errorMessage, hostIsLocal, plainHttpHost, probeHub, producerApi, redeemInvite, } from './hub.js';
15
- import { renderGrants } from './table.js';
13
+ import { assertWireCompatible, errorMessage, hostIsLocal, plainHttpHost, probeHub, redeemInvite, } from './hub.js';
16
14
  const VERSION = JSON.parse(readFileSync(new URL('../../../package.json', import.meta.url), 'utf8')).version;
17
15
  // One-liners only; flags per command live in their own -h, everything else in README.
18
- const USAGE = `Usage: aweshare agent [OPTIONS] COMMAND [ARGS]...
16
+ const USAGE = `Usage: aweshare producer [OPTIONS] COMMAND [ARGS]...
19
17
 
20
18
  Share local/authorized AI capacity through an aweshare hub.
21
19
 
@@ -28,12 +26,9 @@ Commands:
28
26
  join Redeem an invite code into a producer token.
29
27
  config Show or edit the config (path | show | edit).
30
28
  doctor Pre-flight checks: config, backends, hub.
31
- start Connect, register offerings, relay requests.
32
- grant Allow a consumer to call your offering.
33
- revoke Remove a grant.
34
- list List grants for your namespace.`;
29
+ start Connect, register offerings, relay requests.`;
35
30
  const COMMAND_HELP = {
36
- init: `Usage: aweshare agent init [OPTIONS]
31
+ init: `Usage: aweshare producer init [OPTIONS]
37
32
 
38
33
  Write the config template and empty secrets (kept if they exist).
39
34
 
@@ -41,7 +36,7 @@ Options:
41
36
  --hub URL Pre-fill the hub URL in the template.
42
37
  --token ASP Pre-fill a producer token (asp_...) in the template.
43
38
  -h, --help Show this message and exit.`,
44
- join: `Usage: aweshare agent join [OPTIONS]
39
+ join: `Usage: aweshare producer join [OPTIONS]
45
40
 
46
41
  Redeem an invite code into a producer token and write the config.
47
42
  Probes the hub first (reachable, a real hub, wire-compatible) — the code
@@ -55,7 +50,7 @@ Options:
55
50
  --allow-http Proceed with a plain-HTTP hub outside your LAN (the producer
56
51
  token would cross the network unencrypted).
57
52
  -h, --help Show this message and exit.`,
58
- config: `Usage: aweshare agent config [COMMAND]
53
+ config: `Usage: aweshare producer config [COMMAND]
59
54
 
60
55
  Show or edit the config (default: path).
61
56
 
@@ -63,41 +58,17 @@ Commands:
63
58
  path Print the config path.
64
59
  show Show the config with secrets redacted.
65
60
  edit Open the config in $VISUAL, $EDITOR or vi.`,
66
- doctor: `Usage: aweshare agent doctor
61
+ doctor: `Usage: aweshare producer doctor
67
62
 
68
63
  Pre-flight checks: config validity, backend reachability, hub connectivity.
69
64
 
70
65
  Options:
71
66
  -h, --help Show this message and exit.`,
72
- start: `Usage: aweshare agent start
67
+ start: `Usage: aweshare producer start
73
68
 
74
69
  Connect to the hub, register offerings, relay requests (runs in the foreground).
75
70
 
76
71
  Options:
77
- -h, --help Show this message and exit.`,
78
- grant: `Usage: aweshare agent grant [OPTIONS]
79
-
80
- Allow a consumer to call your offering.
81
-
82
- Options:
83
- --alias ALIAS The offering alias, e.g. your-name/model (required).
84
- --consumer NAME Who may call it (required).
85
- --expires-in D Optional expiry: 90s, 30m, 12h or 7d.
86
- -h, --help Show this message and exit.`,
87
- revoke: `Usage: aweshare agent revoke [OPTIONS]
88
-
89
- Remove a grant.
90
-
91
- Options:
92
- --alias ALIAS The offering alias (required).
93
- --consumer NAME Whose grant to remove (required).
94
- -h, --help Show this message and exit.`,
95
- list: `Usage: aweshare agent list [OPTIONS]
96
-
97
- List grants for your namespace.
98
-
99
- Options:
100
- --json Print the raw API response instead of a table.
101
72
  -h, --help Show this message and exit.`,
102
73
  };
103
74
  function parseFlags(argv) {
@@ -131,15 +102,7 @@ function fail(message) {
131
102
  function noPositionals(cmd, positional) {
132
103
  const arg = positional[0];
133
104
  if (arg)
134
- fail(`unexpected argument '${arg}' — this command takes flags only (see: aweshare agent ${cmd} -h)`);
135
- }
136
- /** Parse a human duration like 90s, 30m, 12h, 7d into milliseconds. */
137
- function parseDuration(raw) {
138
- const m = /^(\d+)([smhd])$/.exec(raw);
139
- if (!m)
140
- fail(`--expires-in must look like 90s, 30m, 12h or 7d, got '${raw}'`);
141
- const unit = { s: 1000, m: 60_000, h: 3_600_000, d: 86_400_000 }[m[2]];
142
- return Number(m[1]) * unit;
105
+ fail(`unexpected argument '${arg}' — this command takes flags only (see: aweshare producer ${cmd} -h)`);
143
106
  }
144
107
  // --- commands (one function each; hub errors bubble to main's catch) ---
145
108
  async function runInit(flags, dir) {
@@ -169,9 +132,8 @@ async function runInit(flags, dir) {
169
132
  console.log('\nnext steps:');
170
133
  console.log(' 1. edit config.toml: backends + offerings (namespace must be your producer name)');
171
134
  console.log(' 2. put upstream keys in secrets.json (they never leave this machine)');
172
- console.log(' 3. aweshare agent doctor # find the first failing link');
173
- console.log(' 4. aweshare agent grant --alias YOU/model --consumer NAME');
174
- console.log(' 5. aweshare agent start');
135
+ console.log(' 3. aweshare producer doctor # find the first failing link');
136
+ console.log(' 4. aweshare producer start');
175
137
  }
176
138
  /** Refuse silent plain-HTTP pairing with a non-local hub: the producer token
177
139
  * would cross the network unencrypted. */
@@ -213,7 +175,8 @@ async function runJoin(flags, dir) {
213
175
  const patched = applyJoinToConfig(readFileSync(configPath, 'utf8'), hub, token);
214
176
  if (patched === null) {
215
177
  // the invite is spent — hand over the token so nothing is lost
216
- fail(`config exists but has no hubUrl/token lines to patch — edit ${configPath} manually; your producer token: ${token}`);
178
+ fail(`config exists but has no hubUrl/token lines to patch — edit ${configPath} manually; your producer token: ${token}\n` +
179
+ 'save that token now: it is printed only here and cannot be recovered from the hub');
217
180
  }
218
181
  writeFileAtomic(configPath, patched, 0o600);
219
182
  console.log(`updated ${configPath}`);
@@ -227,9 +190,8 @@ async function runJoin(flags, dir) {
227
190
  console.log('\nnext steps:');
228
191
  console.log(` 1. edit config.toml: backends + offerings (aliases must start with ${name}/)`);
229
192
  console.log(' 2. put upstream keys in secrets.json (they never leave this machine)');
230
- console.log(' 3. aweshare agent doctor # find the first failing link');
231
- console.log(` 4. aweshare agent grant --alias ${name}/model --consumer NAME`);
232
- console.log(' 5. aweshare agent start');
193
+ console.log(' 3. aweshare producer doctor # find the first failing link');
194
+ console.log(' 4. aweshare producer start');
233
195
  }
234
196
  async function runConfig(dir, positional) {
235
197
  const sub = positional[0] ?? 'path';
@@ -237,19 +199,17 @@ async function runConfig(dir, positional) {
237
199
  const secretsPath = join(dir, 'secrets.json');
238
200
  if (sub === 'path') {
239
201
  console.log(configPath);
202
+ console.log(secretsPath);
240
203
  }
241
204
  else if (sub === 'show') {
242
205
  if (!existsSync(configPath)) {
243
- fail(`no config at ${configPath} — run 'aweshare agent init' first`);
206
+ fail(`no config at ${configPath} — run 'aweshare producer init' first`);
244
207
  }
245
208
  console.log(redactConfig(readFileSync(configPath, 'utf8'), existsSync(secretsPath) ? readFileSync(secretsPath, 'utf8') : undefined));
246
209
  }
247
- else if (sub === 'init') {
248
- fail(`config init is now 'aweshare agent init' (same behavior, plus --hub/--token pre-fill)`);
249
- }
250
210
  else if (sub === 'edit') {
251
211
  if (!existsSync(configPath)) {
252
- fail(`no config at ${configPath} — run 'aweshare agent init' first`);
212
+ fail(`no config at ${configPath} — run 'aweshare producer init' first`);
253
213
  }
254
214
  const editor = process.env.VISUAL ?? process.env.EDITOR ?? 'vi';
255
215
  const child = spawn(editor, [configPath], { stdio: 'inherit' });
@@ -283,33 +243,11 @@ async function runStart(dir) {
283
243
  process.on('SIGTERM', shutdown);
284
244
  await connection.start();
285
245
  }
286
- async function runGrants(cmd, flags) {
287
- const { config } = loadAgentConfig(agentDir());
288
- const api = producerApi(config.hubUrl, config.token);
289
- if (cmd === 'grant' || cmd === 'revoke') {
290
- const alias = flags.get('alias');
291
- const consumer = flags.get('consumer');
292
- if (!alias || !consumer)
293
- fail('--alias and --consumer are required');
294
- const body = { alias, consumer };
295
- const expiresIn = flags.get('expires-in');
296
- if (cmd === 'grant' && expiresIn) {
297
- body.expiresAt = new Date(Date.now() + parseDuration(expiresIn)).toISOString();
298
- }
299
- const data = cmd === 'grant'
300
- ? await api('PUT', '/admin/v1/grants', body)
301
- : await api('DELETE', `/admin/v1/grants?alias=${encodeURIComponent(alias)}&consumer=${encodeURIComponent(consumer)}`);
302
- console.log(JSON.stringify(data));
303
- return;
304
- }
305
- const data = await api('GET', '/admin/v1/grants');
306
- console.log(flags.get('json') === 'true' ? JSON.stringify(data, null, 2) : renderGrants(data));
307
- }
308
246
  async function main() {
309
247
  const [cmd, ...rest] = process.argv.slice(2);
310
248
  const { positional, flags } = parseFlags(rest);
311
249
  if (cmd === '-v' || cmd === '--version') {
312
- console.log(`aweshare agent ${VERSION}`);
250
+ console.log(`aweshare producer ${VERSION}`);
313
251
  return;
314
252
  }
315
253
  if (!cmd || cmd === 'help' || cmd === '--help' || cmd === '-h') {
@@ -338,11 +276,6 @@ async function main() {
338
276
  case 'start':
339
277
  noPositionals(cmd, positional);
340
278
  return await runStart(dir);
341
- case 'grant':
342
- case 'revoke':
343
- case 'list':
344
- noPositionals(cmd, positional);
345
- return await runGrants(cmd, flags);
346
279
  default:
347
280
  fail(`unknown command: ${cmd}\n\n${USAGE}`);
348
281
  }
@@ -1 +1 @@
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AAK,QAAQ,CAAC,CAAC,CAAC;YACd,aAAa,CAAC,GAAG,EAAE,UAAU,CAAC,CAAA;YAC9B,OAAO,MAAM,iBAAiB,CAAC,GAAG,CAAC,CAAA;QACrC,CAAC;QACD,KAAK,OAAO;YACV,aAAa,CAAC,GAAG,EAAE,UAAU,CAAC,CAAA;YAC9B,OAAO,MAAM,QAAQ,CAAC,GAAG,CAAC,CAAA;QAC5B;YACE,IAAI,CAAC,oBAAoB,GAAG,OAAO,KAAK,EAAE,CAAC,CAAA;IAC/C,CAAC;AACH,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA"}
@@ -16,6 +16,10 @@ export interface AgentOffering {
16
16
  backend: string;
17
17
  upstreamModel: string;
18
18
  maxConcurrency: number;
19
+ /** Distinct concurrent consumers the hub admits on this alias; hub default 3. */
20
+ maxConcurrentUsers?: number;
21
+ /** Shared per-alias tokens per UTC day; hub default 1000000, 0 = unlimited. */
22
+ dailyTokens?: number;
19
23
  }
20
24
  export interface AgentConfig {
21
25
  hubUrl: string;
@@ -42,5 +46,5 @@ export declare function redactConfig(configToml: string, secretsJson: string | u
42
46
  export declare function applyJoinToConfig(content: string, hubUrl: string, token: string): string | null;
43
47
  /** tmp+rename atomic write with owner-only permissions. */
44
48
  export declare function writeFileAtomic(path: string, content: string, mode?: number): void;
45
- export declare const CONFIG_TEMPLATE = "# aweshare agent configuration (~/.aweshare/config.toml)\n# Secrets live in ~/.aweshare/secrets.json and never leave this machine.\n\nhubUrl = \"http://127.0.0.1:8787\"\ntoken = \"asp_PASTE_PRODUCER_TOKEN\"\n\n# Backends hold the upstream API. baseUrl follows the SDK convention:\n# openai-style (OpenAI/Ollama/vLLM/LM Studio) includes /v1, e.g. http://127.0.0.1:11434/v1\n# anthropic-style excludes /v1, e.g. https://api.anthropic.com\n# responses-style includes the version path, e.g. https://open.bigmodel.cn/api/v1\n[[backends]]\nid = \"ollama\"\nprotocol = \"openai\"\nbaseUrl = \"http://127.0.0.1:11434/v1\"\n# keyRef = \"ollama-key\" # optional; keys live in secrets.json\n\n[[backends]]\nid = \"openai\"\nprotocol = \"openai\"\nbaseUrl = \"https://api.openai.com/v1\"\nkeyRef = \"openai-key\"\n\n# Offerings map a public alias (namespace/name) to a backend model.\n# The namespace must match your producer name on the hub.\n[[offerings]]\nalias = \"YOUR_NAME/qwen2.5.7b\"\nbackend = \"ollama\"\nupstreamModel = \"qwen2.5:7b\" # must match 'ollama list' exactly, including the tag\nmaxConcurrency = 1 # start at 1 for local models\n\n[[offerings]]\nalias = \"YOUR_NAME/gpt-4o\"\nbackend = \"openai\"\nupstreamModel = \"gpt-4o-2024-11-20\"\nmaxConcurrency = 4\n";
49
+ export declare const CONFIG_TEMPLATE = "# aweshare producer configuration (~/.aweshare/config.toml)\n# Secrets live in ~/.aweshare/secrets.json and never leave this machine.\n\nhubUrl = \"http://127.0.0.1:8787\"\ntoken = \"asp_PASTE_PRODUCER_TOKEN\"\n\n# Backends hold the upstream API. baseUrl follows the SDK convention:\n# openai-style (OpenAI/Ollama/vLLM/LM Studio) includes /v1, e.g. http://127.0.0.1:11434/v1\n# anthropic-style excludes /v1, e.g. https://api.anthropic.com\n# responses-style includes the version path, e.g. https://open.bigmodel.cn/api/v1\n[[backends]]\nid = \"ollama\"\nprotocol = \"openai\"\nbaseUrl = \"http://127.0.0.1:11434/v1\"\n# keyRef = \"ollama-key\" # optional; keys live in secrets.json\n\n[[backends]]\nid = \"openai\"\nprotocol = \"openai\"\nbaseUrl = \"https://api.openai.com/v1\"\nkeyRef = \"openai-key\"\n\n# Offerings map a public alias (namespace/name) to a backend model \u2014 exactly one\n# upstream model per offering; consumers call the alias and can never pick another model.\n# The namespace must match your producer name on the hub.\n[[offerings]]\nalias = \"YOUR_NAME/qwen2.5.7b\"\nbackend = \"ollama\"\nupstreamModel = \"qwen2.5:7b\" # must match 'ollama list' exactly, including the tag\nmaxConcurrency = 1 # start at 1 for local models\n# maxConcurrentUsers = 3 # distinct concurrent consumers on this alias (hub default 3)\n# dailyTokens = 1000000 # shared tokens per UTC day (hub default 1M; 0 = unlimited)\n\n[[offerings]]\nalias = \"YOUR_NAME/gpt-4o\"\nbackend = \"openai\"\nupstreamModel = \"gpt-4o-2024-11-20\"\nmaxConcurrency = 4\n";
46
50
  export declare const SECRETS_TEMPLATE = "{\n \"openai-key\": \"sk-PASTE_YOUR_KEY\"\n}\n";
@@ -17,7 +17,7 @@ export function loadAgentConfig(dir) {
17
17
  const configPath = join(dir, 'config.toml');
18
18
  const secretsPath = join(dir, 'secrets.json');
19
19
  if (!existsSync(configPath)) {
20
- throw new ConfigError(`no config at ${configPath} — run 'aweshare agent init' first`, []);
20
+ throw new ConfigError(`no config at ${configPath} — run 'aweshare producer init' first`, []);
21
21
  }
22
22
  let raw;
23
23
  try {
@@ -93,7 +93,25 @@ export function loadAgentConfig(dir) {
93
93
  problems.push(`offering '${alias}': maxConcurrency must be an integer 1..64`);
94
94
  continue;
95
95
  }
96
- offerings.push({ alias, backend, upstreamModel, maxConcurrency });
96
+ const maxConcurrentUsers = o.maxConcurrentUsers === undefined ? undefined : Number(o.maxConcurrentUsers);
97
+ if (maxConcurrentUsers !== undefined &&
98
+ (!Number.isInteger(maxConcurrentUsers) || maxConcurrentUsers < 1 || maxConcurrentUsers > 64)) {
99
+ problems.push(`offering '${alias}': maxConcurrentUsers must be an integer 1..64`);
100
+ continue;
101
+ }
102
+ const dailyTokens = o.dailyTokens === undefined ? undefined : Number(o.dailyTokens);
103
+ if (dailyTokens !== undefined && (!Number.isInteger(dailyTokens) || dailyTokens < 0)) {
104
+ problems.push(`offering '${alias}': dailyTokens must be an integer >= 0 (0 = unlimited)`);
105
+ continue;
106
+ }
107
+ offerings.push({
108
+ alias,
109
+ backend,
110
+ upstreamModel,
111
+ maxConcurrency,
112
+ maxConcurrentUsers,
113
+ dailyTokens,
114
+ });
97
115
  }
98
116
  if (problems.length > 0) {
99
117
  throw new ConfigError(`config.toml has problems:\n - ${problems.join('\n - ')}`, problems);
@@ -130,7 +148,7 @@ export function writeFileAtomic(path, content, mode = 0o600) {
130
148
  writeFileSync(tmp, content, { mode });
131
149
  renameSync(tmp, path);
132
150
  }
133
- export const CONFIG_TEMPLATE = `# aweshare agent configuration (~/.aweshare/config.toml)
151
+ export const CONFIG_TEMPLATE = `# aweshare producer configuration (~/.aweshare/config.toml)
134
152
  # Secrets live in ~/.aweshare/secrets.json and never leave this machine.
135
153
 
136
154
  hubUrl = "http://127.0.0.1:8787"
@@ -152,13 +170,16 @@ protocol = "openai"
152
170
  baseUrl = "https://api.openai.com/v1"
153
171
  keyRef = "openai-key"
154
172
 
155
- # Offerings map a public alias (namespace/name) to a backend model.
173
+ # Offerings map a public alias (namespace/name) to a backend model — exactly one
174
+ # upstream model per offering; consumers call the alias and can never pick another model.
156
175
  # The namespace must match your producer name on the hub.
157
176
  [[offerings]]
158
177
  alias = "YOUR_NAME/qwen2.5.7b"
159
178
  backend = "ollama"
160
179
  upstreamModel = "qwen2.5:7b" # must match 'ollama list' exactly, including the tag
161
180
  maxConcurrency = 1 # start at 1 for local models
181
+ # maxConcurrentUsers = 3 # distinct concurrent consumers on this alias (hub default 3)
182
+ # dailyTokens = 1000000 # shared tokens per UTC day (hub default 1M; 0 = unlimited)
162
183
 
163
184
  [[offerings]]
164
185
  alias = "YOUR_NAME/gpt-4o"