aweshare 0.5.6 → 0.5.8
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.ai.md +6 -5
- package/README.md +31 -11
- package/apps/agent/dist/cli.js +124 -53
- package/apps/agent/dist/cli.js.map +1 -1
- package/apps/agent/dist/daemon.d.ts +2 -2
- package/apps/agent/dist/daemon.js +4 -3
- package/apps/agent/dist/daemon.js.map +1 -1
- package/apps/agent/dist/doctor.js +52 -16
- package/apps/agent/dist/doctor.js.map +1 -1
- package/apps/agent/dist/hub.d.ts +27 -0
- package/apps/agent/dist/hub.js +31 -2
- package/apps/agent/dist/hub.js.map +1 -1
- package/apps/agent/dist/table.d.ts +20 -4
- package/apps/agent/dist/table.js +30 -7
- package/apps/agent/dist/table.js.map +1 -1
- package/apps/consumer/dist/table.d.ts +17 -2
- package/apps/consumer/dist/table.js +18 -3
- package/apps/consumer/dist/table.js.map +1 -1
- package/apps/hub/dist/admin.d.ts +5 -1
- package/apps/hub/dist/admin.js +104 -2
- package/apps/hub/dist/admin.js.map +1 -1
- package/apps/hub/dist/auth.js +1 -1
- package/apps/hub/dist/auth.js.map +1 -1
- package/apps/hub/dist/cli.js +202 -87
- package/apps/hub/dist/cli.js.map +1 -1
- package/apps/hub/dist/config.d.ts +9 -2
- package/apps/hub/dist/config.js +48 -5
- package/apps/hub/dist/config.js.map +1 -1
- package/apps/hub/dist/consumer.d.ts +39 -4
- package/apps/hub/dist/consumer.js +132 -19
- package/apps/hub/dist/consumer.js.map +1 -1
- package/apps/hub/dist/db.d.ts +63 -11
- package/apps/hub/dist/db.js +143 -19
- package/apps/hub/dist/db.js.map +1 -1
- package/apps/hub/dist/http.d.ts +6 -2
- package/apps/hub/dist/http.js +8 -3
- package/apps/hub/dist/http.js.map +1 -1
- package/apps/hub/dist/invites.js +2 -2
- package/apps/hub/dist/invites.js.map +1 -1
- package/apps/hub/dist/limiter.d.ts +35 -4
- package/apps/hub/dist/limiter.js +45 -8
- package/apps/hub/dist/limiter.js.map +1 -1
- package/apps/hub/dist/local.js +11 -0
- package/apps/hub/dist/local.js.map +1 -1
- package/apps/hub/dist/meter.d.ts +6 -1
- package/apps/hub/dist/meter.js +14 -0
- package/apps/hub/dist/meter.js.map +1 -1
- package/apps/hub/dist/server.js +7 -3
- package/apps/hub/dist/server.js.map +1 -1
- package/apps/hub/dist/table.d.ts +33 -5
- package/apps/hub/dist/table.js +45 -14
- package/apps/hub/dist/table.js.map +1 -1
- package/apps/hub/dist/tunnel.js +14 -1
- package/apps/hub/dist/tunnel.js.map +1 -1
- package/bin/aweshare.mjs +3 -3
- package/package.json +1 -1
- package/packages/protocol/dist/index.d.ts +2 -0
- package/packages/protocol/dist/index.js +2 -0
- package/packages/protocol/dist/index.js.map +1 -1
- package/packages/protocol/dist/models.d.ts +23 -0
- package/packages/protocol/dist/models.js +72 -0
- package/packages/protocol/dist/models.js.map +1 -0
- package/packages/protocol/dist/time.d.ts +8 -0
- package/packages/protocol/dist/time.js +69 -0
- package/packages/protocol/dist/time.js.map +1 -0
package/apps/hub/dist/admin.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type Database from 'better-sqlite3';
|
|
2
2
|
import type { Logger } from 'pino';
|
|
3
3
|
import type { AuthContext } from './auth.js';
|
|
4
|
+
import { type ModelWatch } from './consumer.js';
|
|
4
5
|
import { type Router } from './http.js';
|
|
5
|
-
import type { AliasSlots, AliasUsers } from './limiter.js';
|
|
6
|
+
import type { AliasSlots, AliasUsers, RejectionCounter } from './limiter.js';
|
|
6
7
|
import type { LocalProducer } from './local.js';
|
|
7
8
|
import type { Tunnel } from './tunnel.js';
|
|
8
9
|
export interface AdminDeps {
|
|
@@ -15,6 +16,9 @@ export interface AdminDeps {
|
|
|
15
16
|
* view reports in-flight occupancy from it. */
|
|
16
17
|
slots: AliasSlots;
|
|
17
18
|
users: AliasUsers;
|
|
19
|
+
/** Admission rejections since process start — the throttling-pressure view. */
|
|
20
|
+
rejections: Pick<RejectionCounter, 'snapshot'>;
|
|
21
|
+
watch: Pick<ModelWatch, 'reset'>;
|
|
18
22
|
}
|
|
19
23
|
/** Audit and governance: rosters, usage, per-consumer limits. Admission is
|
|
20
24
|
* invite-only — see invites.ts; every identity therefore carries an invite
|
package/apps/hub/dist/admin.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { roleForToken } from '../../../packages/protocol/dist/index.js';
|
|
2
2
|
import { requireAdmin, requireConsumer, requireProducer } from './auth.js';
|
|
3
|
-
import { offeringView, serializeOffering } from './consumer.js';
|
|
4
|
-
import { getConsumerByName, getProducerByName, LOCAL_PRODUCER_ID, listOfferings, listTokens, queryUsage, setConsumerConfig, summarizeUsage, } from './db.js';
|
|
3
|
+
import { DEFAULT_DAILY_TOKENS, offeringView, serializeOffering, } from './consumer.js';
|
|
4
|
+
import { blockOffering, dailyBonusOf, dailyWindowStart, getConsumerByName, getProducerByName, LOCAL_PRODUCER_ID, listOfferings, listOfferingsByAlias, listTokens, nextBeijingMidnight, queryUsage, refreshOfferingQuota, restoreOffering, setConsumerConfig, summarizeUsage, sumTokensForAliasSince, } from './db.js';
|
|
5
5
|
import { extractCredential, HttpError, readJson, sendJson } from './http.js';
|
|
6
6
|
import { parseLimits, safeParseLimits } from './limits.js';
|
|
7
7
|
/** Audit and governance: rosters, usage, per-consumer limits. Admission is
|
|
@@ -29,6 +29,18 @@ export function registerAdminRoutes(router, deps) {
|
|
|
29
29
|
throw new HttpError(404, 'ALIAS_NOT_FOUND', `unknown producer: ${name}`);
|
|
30
30
|
return producer.id;
|
|
31
31
|
};
|
|
32
|
+
/** ?alias=ns/model for the block/restore endpoints — required, and it must
|
|
33
|
+
* name a registered offering (0 protocol rows = unknown alias). */
|
|
34
|
+
const offeringAliasFromQuery = (query) => {
|
|
35
|
+
const alias = query.get('alias');
|
|
36
|
+
if (!alias) {
|
|
37
|
+
throw new HttpError(400, 'ALIAS_REQUIRED', 'query parameter alias is required (ns/model)');
|
|
38
|
+
}
|
|
39
|
+
if (listOfferingsByAlias(db, alias).length === 0) {
|
|
40
|
+
throw new HttpError(404, 'ALIAS_NOT_FOUND', `unknown offering alias: ${alias}`);
|
|
41
|
+
}
|
|
42
|
+
return alias;
|
|
43
|
+
};
|
|
32
44
|
router.add('GET', '/admin/v1/tokens', (ctx) => {
|
|
33
45
|
requireAdmin(ctx.req, auth);
|
|
34
46
|
const { producers, consumers } = listTokens(db);
|
|
@@ -60,6 +72,96 @@ export function registerAdminRoutes(router, deps) {
|
|
|
60
72
|
requireAdmin(ctx.req, auth);
|
|
61
73
|
sendJson(ctx.res, 200, offeringsPayload(deps));
|
|
62
74
|
});
|
|
75
|
+
// The per-alias scalpel between "do nothing" and revoking the whole
|
|
76
|
+
// producer: block one offering (every protocol row of the alias) and its
|
|
77
|
+
// requests fail with 503 OFFERING_BLOCKED while the producer's honest
|
|
78
|
+
// offerings keep serving. Reversible. The alias rides the query string —
|
|
79
|
+
// it contains a '/', which path params can't carry.
|
|
80
|
+
router.add('POST', '/admin/v1/offerings/block', (ctx) => {
|
|
81
|
+
requireAdmin(ctx.req, auth);
|
|
82
|
+
const alias = offeringAliasFromQuery(ctx.query);
|
|
83
|
+
const rows = blockOffering(db, alias, 'manual');
|
|
84
|
+
deps.log.info({ alias, rows }, 'offering blocked (operator)');
|
|
85
|
+
sendJson(ctx.res, 200, { alias, blocked: true, offerings: rows });
|
|
86
|
+
});
|
|
87
|
+
router.add('POST', '/admin/v1/offerings/restore', (ctx) => {
|
|
88
|
+
requireAdmin(ctx.req, auth);
|
|
89
|
+
const alias = offeringAliasFromQuery(ctx.query);
|
|
90
|
+
const rows = restoreOffering(db, alias);
|
|
91
|
+
deps.watch.reset(alias);
|
|
92
|
+
deps.log.info({ alias, rows }, 'offering restored (operator)');
|
|
93
|
+
sendJson(ctx.res, 200, { alias, blocked: false, offerings: rows });
|
|
94
|
+
});
|
|
95
|
+
// Owner-side quota refresh, the expand-side counterpart to block: re-anchor
|
|
96
|
+
// today's window at now, raise today's cap by ?add=N until Beijing
|
|
97
|
+
// midnight, or ?clear=true both. Authority follows ownership — the producer
|
|
98
|
+
// key refreshes only its own offerings, the admin key only the hub-hosted
|
|
99
|
+
// ones (the hub may restrict a producer's model, never spend more of its
|
|
100
|
+
// upstream quota for it). The alias rides the query string like block.
|
|
101
|
+
router.add('POST', '/admin/v1/offerings/refresh', (ctx) => {
|
|
102
|
+
const producerCaller = roleForToken(extractCredential(ctx.req) ?? '') === 'producer';
|
|
103
|
+
let owner;
|
|
104
|
+
if (producerCaller) {
|
|
105
|
+
owner = requireProducer(ctx.req, auth).row.id;
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
requireAdmin(ctx.req, auth);
|
|
109
|
+
owner = LOCAL_PRODUCER_ID;
|
|
110
|
+
}
|
|
111
|
+
const alias = offeringAliasFromQuery(ctx.query);
|
|
112
|
+
const rows = listOfferingsByAlias(db, alias);
|
|
113
|
+
if (rows.some((r) => r.producer_id !== owner)) {
|
|
114
|
+
throw new HttpError(403, 'ALIAS_NOT_OWNED', producerCaller
|
|
115
|
+
? `alias ${alias} is not one of your offerings — a producer refreshes only its own models`
|
|
116
|
+
: `alias ${alias} belongs to a producer — the hub side refreshes only its own hub/... models; that producer runs 'aweshare producer refresh ${alias}' itself`);
|
|
117
|
+
}
|
|
118
|
+
const declared = rows[0]?.daily_tokens;
|
|
119
|
+
if (declared === 0) {
|
|
120
|
+
throw new HttpError(400, 'NO_DAILY_CAP', `alias ${alias} sets dailyTokens = 0 (unlimited) — there is no daily budget to refresh`);
|
|
121
|
+
}
|
|
122
|
+
const clear = ctx.query.get('clear') === 'true';
|
|
123
|
+
const rawAdd = ctx.query.get('add');
|
|
124
|
+
if (clear && rawAdd !== null) {
|
|
125
|
+
throw new HttpError(400, 'INVALID_ACTION', 'add and clear are separate actions — pass one');
|
|
126
|
+
}
|
|
127
|
+
let add;
|
|
128
|
+
if (rawAdd !== null) {
|
|
129
|
+
add = Number(rawAdd);
|
|
130
|
+
if (!Number.isSafeInteger(add) || add <= 0) {
|
|
131
|
+
throw new HttpError(400, 'INVALID_BONUS', `add must be a positive integer, got '${rawAdd}'`);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
const offerings = refreshOfferingQuota(db, alias, { add, clear });
|
|
135
|
+
// re-read the row the markers just landed on: the reply reports the
|
|
136
|
+
// resulting effective budget, whichever action ran
|
|
137
|
+
const row = listOfferingsByAlias(db, alias)[0];
|
|
138
|
+
if (!row)
|
|
139
|
+
throw new HttpError(404, 'ALIAS_NOT_FOUND', `unknown offering alias: ${alias}`);
|
|
140
|
+
const cap = (declared ?? DEFAULT_DAILY_TOKENS) + dailyBonusOf(row);
|
|
141
|
+
const used = sumTokensForAliasSince(db, alias, dailyWindowStart(row));
|
|
142
|
+
deps.log.info({ alias, owner, add, clear }, 'offering quota refreshed');
|
|
143
|
+
sendJson(ctx.res, 200, {
|
|
144
|
+
alias,
|
|
145
|
+
reset: add === undefined && !clear,
|
|
146
|
+
bonus: add ?? null,
|
|
147
|
+
bonusUntil: row.quota_bonus_until,
|
|
148
|
+
offerings,
|
|
149
|
+
quota: {
|
|
150
|
+
cap,
|
|
151
|
+
used,
|
|
152
|
+
remaining: Math.max(0, cap - used),
|
|
153
|
+
resetsAt: nextBeijingMidnight(),
|
|
154
|
+
},
|
|
155
|
+
});
|
|
156
|
+
});
|
|
157
|
+
// Throttling pressure since hub start: every admission 429 by code, alias
|
|
158
|
+
// and consumer. In-memory like the limiters it reports on — a restart zeros
|
|
159
|
+
// the view, never any limit. The operator's evidence for tuning
|
|
160
|
+
// maxConcurrentUsers / maxConcurrencyPerUser / consumer rps.
|
|
161
|
+
router.add('GET', '/admin/v1/rejections', (ctx) => {
|
|
162
|
+
requireAdmin(ctx.req, auth);
|
|
163
|
+
sendJson(ctx.res, 200, deps.rejections.snapshot());
|
|
164
|
+
});
|
|
63
165
|
// Detail log and aggregate summary share the same slice semantics: admin
|
|
64
166
|
// sees everything, a producer key its own registrations, a consumer key its
|
|
65
167
|
// own requests. Rows carry joined consumer/producer names so callers never
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin.js","sourceRoot":"","sources":["../src/admin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAIhD,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAC1E,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAC/D,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,aAAa,EACb,UAAU,EACV,UAAU,EACV,iBAAiB,EACjB,cAAc,GACf,MAAM,SAAS,CAAA;AAChB,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAe,QAAQ,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAEzF,OAAO,EAAuB,WAAW,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAgB/E;;qCAEqC;AACrC,MAAM,UAAU,mBAAmB,CAAC,MAAc,EAAE,IAAe;IACjE,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,IAAI,CAAA;IAEzB;4DACwD;IACxD,MAAM,mBAAmB,GAAG,CAAC,KAAsB,EAAsB,EAAE;QACzE,MAAM,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,CAAA;QAClC,IAAI,IAAI,KAAK,IAAI;YAAE,OAAO,SAAS,CAAA;QACnC,MAAM,QAAQ,GAAG,iBAAiB,CAAC,EAAE,EAAE,IAAI,CAAC,CAAA;QAC5C,IAAI,CAAC,QAAQ;YAAE,MAAM,IAAI,SAAS,CAAC,GAAG,EAAE,iBAAiB,EAAE,qBAAqB,IAAI,EAAE,CAAC,CAAA;QACvF,OAAO,QAAQ,CAAC,EAAE,CAAA;IACpB,CAAC,CAAA;IACD,MAAM,mBAAmB,GAAG,CAAC,KAAsB,EAAsB,EA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VALID_KEY', 'invalid producer token');
|
|
17
17
|
if (row.revoked_at) {
|
|
18
|
-
throw new HttpError(401, 'TOKEN_REVOKED', 'producer token was suspended by the operator — ask them to restore it (aweshare hub restore)');
|
|
18
|
+
throw new HttpError(401, 'TOKEN_REVOKED', 'producer token was suspended by the operator — ask them to restore it (aweshare hub invite restore N)');
|
|
19
19
|
}
|
|
20
20
|
if (isExpired(row.expires_at))
|
|
21
21
|
throw expiredError('producer token');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAEA,OAAO,EAAoB,kBAAkB,EAAE,kBAAkB,EAAoB,MAAM,SAAS,CAAA;AACpG,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AACxD,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAQlD,MAAM,UAAU,YAAY,CAAC,GAAoB,EAAE,IAAiB;IAClE,MAAM,KAAK,GAAG,iBAAiB,CAAC,GAAG,CAAC,CAAA;IACpC,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC,UAAU,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;QACrE,MAAM,IAAI,SAAS,CAAC,GAAG,EAAE,aAAa,EAAE,sBAAsB,CAAC,CAAA;IACjE,CAAC;AACH,CAAC;AAED,MAAM,UAAU,eAAe,CAC7B,GAAoB,EACpB,IAAiB;IAEjB,MAAM,KAAK,GAAG,iBAAiB,CAAC,GAAG,CAAC,CAAA;IACpC,IAAI,CAAC,KAAK;QAAE,MAAM,IAAI,SAAS,CAAC,GAAG,EAAE,aAAa,EAAE,yBAAyB,CAAC,CAAA;IAC9E,MAAM,GAAG,GAAG,kBAAkB,CAAC,IAAI,CAAC,EAAE,EAAE,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAA;IAC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AAC"}
|
package/apps/hub/dist/cli.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { existsSync, readFileSync, writeFileSync } from 'node:fs';
|
|
3
|
+
import { fmtDate } from '../../../packages/protocol/dist/index.js';
|
|
3
4
|
import { ensureDataDir, HUB_CONFIG_TEMPLATE, initHubProduceFiles, loadHubConfig, readAdminToken, resolvePaths, } from './config.js';
|
|
4
5
|
import { createHubServer, installConfigReloader } from './server.js';
|
|
5
6
|
import { renderHubStatus, renderInvites, renderUsage, renderUsageSummary, } from './table.js';
|
|
@@ -17,13 +18,13 @@ Options:
|
|
|
17
18
|
Commands:
|
|
18
19
|
init Create the data dir, pepper, and admin token.
|
|
19
20
|
serve Run the hub server.
|
|
20
|
-
produce Run the hub serving its own models too (
|
|
21
|
-
|
|
21
|
+
produce Run the hub serving its own models too (hub/...); 'refresh'
|
|
22
|
+
re-anchors or raises one hub model's daily token budget.
|
|
23
|
+
invite Mint invite codes (default); revoke or restore one by id.
|
|
22
24
|
list Read hub state: invites (the ledger) or usage (consumption).
|
|
23
25
|
limits Show, set or clear one consumer's limit overrides.
|
|
24
|
-
status Live state: capacity,
|
|
25
|
-
|
|
26
|
-
restore Undo a revoke: pending pairs again, redeemed revives its identity.`;
|
|
26
|
+
status Live state: capacity, offering health; rosters print with --all.
|
|
27
|
+
offering Block or restore one offering alias (the per-alias scalpel).`;
|
|
27
28
|
const COMMAND_HELP = {
|
|
28
29
|
init: `Usage: aweshare hub init
|
|
29
30
|
|
|
@@ -43,7 +44,7 @@ Options:
|
|
|
43
44
|
--host ADDR Address to listen on (default from AWESHARE_HUB_HOST, else 0.0.0.0).
|
|
44
45
|
--port N Port to listen on, 1..65535 (default from AWESHARE_HUB_PORT, else 8787).
|
|
45
46
|
-h, --help Show this message and exit.`,
|
|
46
|
-
produce: `Usage: aweshare hub produce [init] [OPTIONS]
|
|
47
|
+
produce: `Usage: aweshare hub produce [init|refresh] [OPTIONS]
|
|
47
48
|
|
|
48
49
|
Run the hub with its own models attached. Identical to 'serve'; the
|
|
49
50
|
difference is intent: define [[backends]] and [[offerings]] in the data
|
|
@@ -58,27 +59,56 @@ Options:
|
|
|
58
59
|
owner-only secrets.json without replacing either existing file. It also
|
|
59
60
|
initializes the Hub data directory, database, pepper and admin token.
|
|
60
61
|
|
|
62
|
+
` +
|
|
63
|
+
'`refresh ALIAS`' +
|
|
64
|
+
` works on a running hub, no restart: re-anchor the daily token
|
|
65
|
+
budget of one hub/... model at this moment (past usage today stops
|
|
66
|
+
counting), or raise it for the rest of today. Producer-registered models
|
|
67
|
+
(ns/...) are not the hub's to refresh — that producer runs
|
|
68
|
+
'aweshare producer refresh' itself. A permanent raise belongs in
|
|
69
|
+
config.produce.toml (dailyTokens), which hot-reloads.
|
|
70
|
+
|
|
71
|
+
Examples:
|
|
72
|
+
aweshare hub produce refresh glm-5.3 # today restarts now
|
|
73
|
+
aweshare hub produce refresh glm-5.3 --add 2000000 # today's cap +2M
|
|
74
|
+
aweshare hub produce refresh glm-5.3 --clear # drop both markers
|
|
75
|
+
|
|
61
76
|
Options:
|
|
62
77
|
--host ADDR Address to listen on (default from AWESHARE_HUB_HOST, else 0.0.0.0).
|
|
63
78
|
--port N Port to listen on, 1..65535 (default from AWESHARE_HUB_PORT, else 8787).
|
|
79
|
+
--add N refresh only: raise today's cap by N tokens until Beijing midnight.
|
|
80
|
+
--clear refresh only: drop the refresh marker and any bonus.
|
|
81
|
+
--json refresh only: print the raw API response.
|
|
64
82
|
-h, --help Show this message and exit.`,
|
|
65
|
-
invite: `Usage: aweshare hub invite [OPTIONS]
|
|
83
|
+
invite: `Usage: aweshare hub invite [mint|revoke|restore] [ARGS] [OPTIONS]
|
|
66
84
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
85
|
+
The invite lifecycle. One code, one identity — and the invite is the
|
|
86
|
+
operator's handle from mint to suspension: revoking a redeemed code
|
|
87
|
+
suspends the producer or consumer it minted (a producer's tunnel closes,
|
|
88
|
+
a consumer's key stops working); restoring brings both back.
|
|
70
89
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
90
|
+
Commands:
|
|
91
|
+
mint Mint one-time invite codes (default). Printed once; recover
|
|
92
|
+
with: aweshare hub list invites --reveal. Listing lives under
|
|
93
|
+
'list invites' on purpose — minting sends real codes, reading
|
|
94
|
+
the ledger never should.
|
|
95
|
+
revoke N Kill invite N: a pending code stops pairing, a redeemed one
|
|
96
|
+
suspends its identity (find ids with: aweshare hub list invites).
|
|
97
|
+
restore N Undo a revoke: pending pairs again, redeemed revives its
|
|
98
|
+
identity. Restoring a redeemed producer needs a free slot
|
|
99
|
+
(403 HUB_FULL at AWESHARE_MAX_PRODUCERS).
|
|
100
|
+
|
|
101
|
+
Options (mint only):
|
|
102
|
+
--role ROLE producer (default) or consumer — a consumer code redeems into
|
|
103
|
+
an asc_ token the consumer pastes into their SDK env vars.
|
|
104
|
+
--name NAME Bind the codes to one name (required for --role consumer;
|
|
105
|
+
producers may leave it for redeem-time name + email).
|
|
106
|
+
--count N Mint N codes, 1..100 (default 1; producer codes only).
|
|
107
|
+
--expires-in D How long codes stay usable: 30m, 12h or 7d (default 7d) —
|
|
108
|
+
since identity expiry landed, this also bounds the minted
|
|
109
|
+
token's lifetime; 'none' mints a code (and identity) that
|
|
110
|
+
never expires.
|
|
111
|
+
-h, --help Show this message and exit.`,
|
|
82
112
|
list: `Usage: aweshare hub list [invites|usage] [OPTIONS]
|
|
83
113
|
|
|
84
114
|
Read hub state (default: invites). The rosters and offering health live in
|
|
@@ -121,32 +151,33 @@ Options:
|
|
|
121
151
|
--clear Drop every override (back to hub-wide defaults).
|
|
122
152
|
--json Print the raw API response instead of text.
|
|
123
153
|
-h, --help Show this message and exit.`,
|
|
124
|
-
status: `Usage: aweshare hub status
|
|
154
|
+
status: `Usage: aweshare hub status [OPTIONS]
|
|
125
155
|
|
|
126
|
-
The hub's live state: capacity,
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
156
|
+
The hub's live state: capacity, offering health and the effective hub-wide
|
|
157
|
+
consumer defaults. No tokens or request contents appear. Offerings are
|
|
158
|
+
counted per deduplicated alias (one alias, several protocols, one verdict —
|
|
159
|
+
the worst); the alias table uses the same columns as 'consumer list' and
|
|
160
|
+
'producer list', sorted worst status first, with live occupancy (IN USE
|
|
161
|
+
n/max) and today's remaining daily tokens. The last-5m health line comes
|
|
162
|
+
from the usage summary — admission 429s are never metered, so it reflects
|
|
163
|
+
relayed outcomes only. The producer/consumer rosters are counts here; pass
|
|
164
|
+
--all to print them in full.
|
|
134
165
|
|
|
135
166
|
Options:
|
|
167
|
+
--all Also print the producer and consumer rosters (name, status,
|
|
168
|
+
online state, last seen).
|
|
136
169
|
-h, --help Show this message and exit.`,
|
|
137
|
-
|
|
170
|
+
offering: `Usage: aweshare hub offering block|restore ALIAS
|
|
138
171
|
|
|
139
|
-
|
|
172
|
+
Block one offering alias (every protocol row of it) or bring it back — the
|
|
173
|
+
scalpel between doing nothing and revoking the whole producer. A block 503s
|
|
174
|
+
new requests with OFFERING_BLOCKED while the producer's other offerings
|
|
175
|
+
keep serving; status shows 'blocked'. Manual blocks survive producer
|
|
176
|
+
re-registers; auto blocks (repeated model mismatch, only when
|
|
177
|
+
autoBlockModelMismatch is enabled) clear once the producer re-declares a
|
|
178
|
+
different upstreamModel.
|
|
140
179
|
|
|
141
180
|
Options:
|
|
142
|
-
--id N The invite id (see: aweshare hub list invites).
|
|
143
|
-
-h, --help Show this message and exit.`,
|
|
144
|
-
restore: `Usage: aweshare hub restore [OPTIONS]
|
|
145
|
-
|
|
146
|
-
Undo a revoke: pending pairs again, redeemed revives its identity.
|
|
147
|
-
|
|
148
|
-
Options:
|
|
149
|
-
--id N The invite id (see: aweshare hub list invites).
|
|
150
181
|
-h, --help Show this message and exit.`,
|
|
151
182
|
};
|
|
152
183
|
function parseArgs(argv) {
|
|
@@ -236,12 +267,6 @@ function noPositionals(cmd, positional) {
|
|
|
236
267
|
if (arg)
|
|
237
268
|
fail(`unexpected argument '${arg}' — this command takes flags only (see: aweshare hub ${cmd} -h)`);
|
|
238
269
|
}
|
|
239
|
-
function requireId(flags) {
|
|
240
|
-
const id = flags.get('id');
|
|
241
|
-
if (!id)
|
|
242
|
-
fail('--id is required (find ids with: aweshare hub list invites)');
|
|
243
|
-
return id;
|
|
244
|
-
}
|
|
245
270
|
/** CLI flag name -> API key of the sparse limit override object. */
|
|
246
271
|
const LIMIT_FLAGS = [
|
|
247
272
|
['rps', 'rps'],
|
|
@@ -325,6 +350,46 @@ async function main() {
|
|
|
325
350
|
console.log('next: add [[backends]] / [[offerings]] to config.produce.toml, fill secrets.json, then run: aweshare hub produce');
|
|
326
351
|
return;
|
|
327
352
|
}
|
|
353
|
+
if (positional[0] === 'refresh') {
|
|
354
|
+
const raw = positional[1];
|
|
355
|
+
if (!raw)
|
|
356
|
+
fail('produce refresh: alias is required (hub/model — the hub/ prefix is optional)');
|
|
357
|
+
if (positional[2])
|
|
358
|
+
fail(`unexpected argument '${positional[2]}' (see: aweshare hub produce -h)`);
|
|
359
|
+
// hub-hosted offerings live in the reserved hub/ namespace — accept
|
|
360
|
+
// the bare name too; anything else the hub rejects as not its own
|
|
361
|
+
const alias = raw.includes('/') ? raw : `hub/${raw}`;
|
|
362
|
+
const params = new URLSearchParams({ alias });
|
|
363
|
+
const add = flags.get('add');
|
|
364
|
+
if (add !== undefined) {
|
|
365
|
+
const n = Number(add);
|
|
366
|
+
if (!Number.isSafeInteger(n) || n <= 0)
|
|
367
|
+
fail(`--add must be a positive integer, got '${add}'`);
|
|
368
|
+
params.set('add', String(n));
|
|
369
|
+
}
|
|
370
|
+
if (flags.get('clear') === 'true') {
|
|
371
|
+
if (add !== undefined)
|
|
372
|
+
fail('--clear drops both markers — drop --add too');
|
|
373
|
+
params.set('clear', 'true');
|
|
374
|
+
}
|
|
375
|
+
const api = adminApi();
|
|
376
|
+
const out = (await api('POST', `/admin/v1/offerings/refresh?${params}`));
|
|
377
|
+
if (flags.get('json') === 'true') {
|
|
378
|
+
console.log(JSON.stringify(out, null, 2));
|
|
379
|
+
return;
|
|
380
|
+
}
|
|
381
|
+
const fmt = (n) => n.toLocaleString('en-US');
|
|
382
|
+
if (out.reset)
|
|
383
|
+
console.log(`✓ ${out.alias} — today's window restarts now`);
|
|
384
|
+
else if (out.bonus !== null)
|
|
385
|
+
console.log(`✓ ${out.alias} — today's cap +${fmt(out.bonus)} until ${out.bonusUntil}`);
|
|
386
|
+
else
|
|
387
|
+
console.log(`✓ ${out.alias} — refresh markers cleared, the declared budget applies`);
|
|
388
|
+
console.log(` today: ${fmt(out.quota.remaining)} of ${fmt(out.quota.cap)} left (${fmt(out.quota.used)} used) — resets ${out.quota.resetsAt}`);
|
|
389
|
+
if (out.reset)
|
|
390
|
+
console.log(` undo: aweshare hub produce refresh ${out.alias} --clear`);
|
|
391
|
+
return;
|
|
392
|
+
}
|
|
328
393
|
// same runner as serve — 'produce' names the intent; the local catalog
|
|
329
394
|
// is config-driven and loads either way.
|
|
330
395
|
noPositionals('produce', positional);
|
|
@@ -339,13 +404,57 @@ async function main() {
|
|
|
339
404
|
return;
|
|
340
405
|
}
|
|
341
406
|
case 'invite': {
|
|
342
|
-
|
|
407
|
+
// the invite lifecycle: mint (default), revoke, restore — one code, one
|
|
408
|
+
// identity, and every suspension travels through the invite that minted it
|
|
409
|
+
const sub = positional[0] ?? 'mint';
|
|
410
|
+
if (sub !== 'mint' && sub !== 'revoke' && sub !== 'restore') {
|
|
411
|
+
fail(`unknown invite action '${sub}' — expected mint, revoke or restore`);
|
|
412
|
+
}
|
|
413
|
+
const api = adminApi();
|
|
414
|
+
if (sub === 'revoke' || sub === 'restore') {
|
|
415
|
+
const id = positional[1];
|
|
416
|
+
if (!id)
|
|
417
|
+
fail(`invite ${sub}: id is required (find ids with: aweshare hub list invites)`);
|
|
418
|
+
if (positional[2])
|
|
419
|
+
fail(`unexpected argument '${positional[2]}' (see: aweshare hub invite -h)`);
|
|
420
|
+
if (sub === 'revoke') {
|
|
421
|
+
const out = (await api('DELETE', `/admin/v1/invites/${id}`));
|
|
422
|
+
if (!out.revoked && !out.suspended) {
|
|
423
|
+
console.log(`invite ${id} was already revoked — nothing to do`);
|
|
424
|
+
return;
|
|
425
|
+
}
|
|
426
|
+
if (out.suspended) {
|
|
427
|
+
console.log(`✓ invite ${id} revoked — ${out.suspended.role} '${out.suspended.name}' suspended, its token no longer works`);
|
|
428
|
+
}
|
|
429
|
+
else {
|
|
430
|
+
console.log(`✓ invite ${id} revoked — the code no longer pairs`);
|
|
431
|
+
}
|
|
432
|
+
console.log(` undo: aweshare hub invite restore ${id}`);
|
|
433
|
+
return;
|
|
434
|
+
}
|
|
435
|
+
const out = (await api('POST', `/admin/v1/invites/${id}/restore`));
|
|
436
|
+
if (!out.restored) {
|
|
437
|
+
console.log(`invite ${id} was not revoked — nothing to restore`);
|
|
438
|
+
return;
|
|
439
|
+
}
|
|
440
|
+
if (out.restoredProducer) {
|
|
441
|
+
console.log(`✓ invite ${id} restored — producer '${out.restoredProducer.name}' is back`);
|
|
442
|
+
}
|
|
443
|
+
else if (out.restoredConsumer) {
|
|
444
|
+
console.log(`✓ invite ${id} restored — consumer '${out.restoredConsumer.name}' is back`);
|
|
445
|
+
}
|
|
446
|
+
else {
|
|
447
|
+
console.log(`✓ invite ${id} restored — the code pairs again (its original expiry still applies)`);
|
|
448
|
+
}
|
|
449
|
+
return;
|
|
450
|
+
}
|
|
451
|
+
if (positional[1])
|
|
452
|
+
fail(`unexpected argument '${positional[1]}' (see: aweshare hub invite -h)`);
|
|
343
453
|
// minting is the one state-changing read-adjacent verb — refuse the old
|
|
344
454
|
// ledger flag loudly instead of silently minting a code
|
|
345
455
|
if (flags.has('list')) {
|
|
346
456
|
fail("'hub invite --list' became its own command — the ledger is: aweshare hub list invites");
|
|
347
457
|
}
|
|
348
|
-
const api = adminApi();
|
|
349
458
|
const body = {};
|
|
350
459
|
const role = flags.get('role') ?? 'producer';
|
|
351
460
|
if (role !== 'producer' && role !== 'consumer')
|
|
@@ -448,7 +557,7 @@ async function main() {
|
|
|
448
557
|
}
|
|
449
558
|
const window = since === 'all'
|
|
450
559
|
? 'all time'
|
|
451
|
-
: `since ${new Date(Date.now() - parseDuration(since))
|
|
560
|
+
: `since ${fmtDate(new Date(Date.now() - parseDuration(since)))} (${since})`;
|
|
452
561
|
const grouping = group === 'alias' ? 'alias' : group === 'consumer' ? 'consumer' : 'consumer × model';
|
|
453
562
|
console.log(`usage ${window} — group: ${grouping}`);
|
|
454
563
|
console.log(renderUsageSummary(rows, group));
|
|
@@ -533,65 +642,71 @@ async function main() {
|
|
|
533
642
|
case 'status': {
|
|
534
643
|
noPositionals(cmd, positional);
|
|
535
644
|
const api = adminApi();
|
|
536
|
-
const [roster, offeringsRes, usageRes] = await Promise.all([
|
|
645
|
+
const [roster, offeringsRes, usageRes, rejectionsRes] = await Promise.all([
|
|
537
646
|
api('GET', '/admin/v1/tokens'),
|
|
538
647
|
// the endpoint wraps its rows: {object: "offerings", offerings: [...]}
|
|
539
648
|
api('GET', '/admin/v1/offerings'),
|
|
540
|
-
// last-5m health:
|
|
541
|
-
//
|
|
542
|
-
|
|
649
|
+
// last-5m health: the usage SUMMARY endpoint (the details endpoint's
|
|
650
|
+
// rows carry no request counts — summing them printed NaN); admission
|
|
651
|
+
// 429s are never metered, so this reflects relayed outcomes only
|
|
652
|
+
api('GET', '/admin/v1/usage/summary?since=5m&group=alias').catch(() => []),
|
|
653
|
+
// throttling pressure since hub start; older hubs lack the endpoint
|
|
654
|
+
api('GET', '/admin/v1/rejections').catch(() => null),
|
|
543
655
|
]);
|
|
544
656
|
const recent = {
|
|
545
|
-
requests: usageRes.reduce((n, r) => n + r.requests, 0),
|
|
546
|
-
errors: usageRes.reduce((n, r) => n + r.errors, 0),
|
|
657
|
+
requests: usageRes.reduce((n, r) => n + (r.requests ?? 0), 0),
|
|
658
|
+
errors: usageRes.reduce((n, r) => n + (r.errors ?? 0), 0),
|
|
547
659
|
};
|
|
660
|
+
const consumerName = new Map(roster.consumers.map((c) => [c.id, c.name]));
|
|
661
|
+
const rejections = rejectionsRes && rejectionsRes.total > 0
|
|
662
|
+
? {
|
|
663
|
+
total: rejectionsRes.total,
|
|
664
|
+
top: rejectionsRes.entries.slice(0, 5).map((e) => ({
|
|
665
|
+
code: e.code,
|
|
666
|
+
alias: e.alias,
|
|
667
|
+
consumer: consumerName.get(e.consumerId) ?? `#${e.consumerId}`,
|
|
668
|
+
count: e.count,
|
|
669
|
+
})),
|
|
670
|
+
}
|
|
671
|
+
: null;
|
|
548
672
|
console.log(renderHubStatus({
|
|
549
673
|
...loadHubConfig(),
|
|
550
674
|
producers: roster.producers,
|
|
551
675
|
consumers: roster.consumers,
|
|
552
676
|
offerings: offeringsRes.offerings,
|
|
553
677
|
recent,
|
|
678
|
+
rejections,
|
|
679
|
+
all: flags.get('all') === 'true',
|
|
554
680
|
}));
|
|
555
681
|
return;
|
|
556
682
|
}
|
|
557
|
-
case '
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
const out = (await api('DELETE', `/admin/v1/invites/${id}`));
|
|
562
|
-
if (!out.revoked && !out.suspended) {
|
|
563
|
-
console.log(`invite ${id} was already revoked — nothing to do`);
|
|
564
|
-
return;
|
|
565
|
-
}
|
|
566
|
-
if (out.suspended) {
|
|
567
|
-
console.log(`✓ invite ${id} revoked — ${out.suspended.role} '${out.suspended.name}' suspended, its token no longer works`);
|
|
568
|
-
}
|
|
569
|
-
else {
|
|
570
|
-
console.log(`✓ invite ${id} revoked — the code no longer pairs`);
|
|
683
|
+
case 'offering': {
|
|
684
|
+
const action = positional[0];
|
|
685
|
+
if (action !== 'block' && action !== 'restore') {
|
|
686
|
+
fail(`expected 'block' or 'restore' (see: aweshare hub offering -h), got '${action ?? ''}'`);
|
|
571
687
|
}
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
688
|
+
const alias = positional[1];
|
|
689
|
+
if (!alias)
|
|
690
|
+
fail(`offering ${action}: alias is required (ns/model)`);
|
|
691
|
+
if (positional[2])
|
|
692
|
+
fail(`unexpected argument '${positional[2]}' (see: aweshare hub offering -h)`);
|
|
577
693
|
const api = adminApi();
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
console.log(`
|
|
694
|
+
if (action === 'block') {
|
|
695
|
+
const out = (await api('POST', `/admin/v1/offerings/block?alias=${encodeURIComponent(alias)}`));
|
|
696
|
+
console.log(`✓ ${alias} blocked (${out.offerings} protocol row(s)) — new requests get 503 OFFERING_BLOCKED`);
|
|
697
|
+
console.log(` undo: aweshare hub offering restore ${alias}`);
|
|
582
698
|
return;
|
|
583
699
|
}
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
}
|
|
587
|
-
else if (out.restoredConsumer) {
|
|
588
|
-
console.log(`✓ invite ${id} restored — consumer '${out.restoredConsumer.name}' is back`);
|
|
589
|
-
}
|
|
590
|
-
else {
|
|
591
|
-
console.log(`✓ invite ${id} restored — the code pairs again (its original expiry still applies)`);
|
|
592
|
-
}
|
|
700
|
+
const out = (await api('POST', `/admin/v1/offerings/restore?alias=${encodeURIComponent(alias)}`));
|
|
701
|
+
console.log(`✓ ${alias} restored (${out.offerings} protocol row(s)) — requests flow again`);
|
|
593
702
|
return;
|
|
594
703
|
}
|
|
704
|
+
case 'revoke':
|
|
705
|
+
// revoke/restore became `invite` subcommands — the invite is the
|
|
706
|
+
// lifecycle handle, same shape as `offering block|restore`
|
|
707
|
+
return fail("'hub revoke --id N' moved — it is 'aweshare hub invite revoke N' now");
|
|
708
|
+
case 'restore':
|
|
709
|
+
return fail("'hub restore --id N' moved — it is 'aweshare hub invite restore N' now");
|
|
595
710
|
default:
|
|
596
711
|
fail(`unknown command: ${cmd}\n\n${USAGE}`);
|
|
597
712
|
}
|