@tokagent/tokagentos 2.0.10 → 2.0.12

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tokagent/tokagentos",
3
- "version": "2.0.10",
3
+ "version": "2.0.12",
4
4
  "description": "tokagentOS CLI - Create and upgrade tokagentOS project templates",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tokagent/plugin-tokagent-billing",
3
- "version": "2.0.4",
3
+ "version": "2.0.6",
4
4
  "description": "elizaOS plugin: Web3 credit-billing routes and middleware for the tokagentos LLM gateway.",
5
5
  "type": "module",
6
6
  "publishConfig": { "access": "public" },
@@ -121,30 +121,6 @@
121
121
  </article>
122
122
  </section>
123
123
 
124
- <!-- ---- Faucet (test/fork only) ---- -->
125
- <section class="card section-card">
126
- <header>
127
- <h2>Test PTON faucet</h2>
128
- <span class="card-sub">Mint PTON to your wallet (works only when the deployed PTON has <code>faucetEnabled=true</code>)</span>
129
- </header>
130
- <div class="topup-row">
131
- <div class="topup-amount">
132
- <label for="faucet-amount">Amount</label>
133
- <div class="topup-input">
134
- <input id="faucet-amount" type="number" step="1" min="1" value="100" inputmode="decimal" />
135
- <span class="suffix">PTON</span>
136
- </div>
137
- <p class="muted small">
138
- Calls <code>PTON.faucet(amount)</code> from your wallet. Requires a small amount of native gas.
139
- </p>
140
- </div>
141
- <div class="topup-action">
142
- <button id="faucet-btn" class="btn btn-ghost" type="button">Mint test PTON</button>
143
- <p id="faucet-status" class="status-line" role="status" aria-live="polite"></p>
144
- </div>
145
- </div>
146
- </section>
147
-
148
124
  <!-- ---- Top up ---- -->
149
125
  <section class="card section-card">
150
126
  <header>
@@ -100,6 +100,7 @@ export const creditsRoutes: Route[] = [
100
100
  type: "GET",
101
101
  path: "/v1/credits/me",
102
102
  rawPath: true,
103
+ public: true,
103
104
  name: "billing-credits-me",
104
105
  handler: handleGetCreditsMe,
105
106
  },
@@ -115,6 +116,7 @@ function clientCreditsRoutes(): Route[] {
115
116
  type: "GET",
116
117
  path: "/v1/credits/me",
117
118
  rawPath: true,
119
+ public: true,
118
120
  name: "billing-credits-me",
119
121
  handler: async (req, res) => {
120
122
  if (!ensureClientReady(res)) return;
@@ -89,9 +89,25 @@ function buildConfigJs(runtime: IAgentRuntime): string {
89
89
  10: "https://optimistic.etherscan.io",
90
90
  };
91
91
 
92
+ // In client-mode the dashboard talks to the upstream gateway DIRECTLY via
93
+ // CORS rather than forwarding through the local agent. This sidesteps three
94
+ // bugs in vanilla elizaOS that the scaffolder pins (the auth-gate runs
95
+ // before plugin route resolution and rejects /v1/* with 401 when the
96
+ // operator has TOKAGENT_API_TOKEN set; the runtime-plugin-routes shim
97
+ // historically only exposed res.json on the inline object returned by
98
+ // .status(); the plugin-prefixed mount path drops JSON body parsing). The
99
+ // Railway-hosted gateway has all three patched in its own fork. Server-mode
100
+ // keeps PROXY_BASE="" so same-origin calls hit the plugin's own
101
+ // serverAuthRoutes handlers locally — no upstream needed there.
102
+ const billingMode =
103
+ get("BILLING_MODE").toLowerCase() === "client" ? "client" : "server";
104
+ const proxyBase =
105
+ billingMode === "client"
106
+ ? get("TOKAGENT_GATEWAY_URL").replace(/\/+$/, "")
107
+ : "";
108
+
92
109
  const config = {
93
- // Same-origin: the dashboard is served by the same agent API server.
94
- PROXY_BASE: "",
110
+ PROXY_BASE: proxyBase,
95
111
  CHAIN_ID: chainId,
96
112
  CHAIN_NAME: chainNames[chainId] ?? `chain-${chainId}`,
97
113
  CHAIN_RPC_URL: get("BILLING_CHAIN_RPC_URL"),
@@ -331,6 +331,7 @@ export const estimateRoutes: Route[] = [
331
331
  type: "POST",
332
332
  path: "/v1/estimate",
333
333
  rawPath: true,
334
+ public: true,
334
335
  name: "billing-estimate",
335
336
  handler: handleEstimate,
336
337
  },
@@ -338,6 +339,7 @@ export const estimateRoutes: Route[] = [
338
339
  type: "POST",
339
340
  path: "/v1/messages/count_tokens",
340
341
  rawPath: true,
342
+ public: true,
341
343
  name: "billing-count-tokens",
342
344
  handler: handleCountTokens,
343
345
  },
@@ -345,6 +347,7 @@ export const estimateRoutes: Route[] = [
345
347
  type: "GET",
346
348
  path: "/v1/price",
347
349
  rawPath: true,
350
+ public: true,
348
351
  name: "billing-price-debug",
349
352
  handler: handlePrice,
350
353
  },
@@ -360,6 +363,7 @@ function clientEstimateRoutes(): Route[] {
360
363
  type: "POST",
361
364
  path: "/v1/estimate",
362
365
  rawPath: true,
366
+ public: true,
363
367
  name: "billing-estimate",
364
368
  handler: async (req, res) => {
365
369
  if (!ensureClientReady(res)) return;
@@ -372,6 +376,7 @@ function clientEstimateRoutes(): Route[] {
372
376
  type: "POST",
373
377
  path: "/v1/messages/count_tokens",
374
378
  rawPath: true,
379
+ public: true,
375
380
  name: "billing-count-tokens",
376
381
  handler: async (req, res) => {
377
382
  if (!ensureClientReady(res)) return;
@@ -387,6 +392,7 @@ function clientEstimateRoutes(): Route[] {
387
392
  type: "GET",
388
393
  path: "/v1/price",
389
394
  rawPath: true,
395
+ public: true,
390
396
  name: "billing-price-debug",
391
397
  handler: async (_req, res) => {
392
398
  if (!ensureClientReady(res)) return;
@@ -177,6 +177,7 @@ export const keysRoutes: Route[] = [
177
177
  type: "POST",
178
178
  path: "/v1/keys",
179
179
  rawPath: true,
180
+ public: true,
180
181
  name: "billing-keys-mint",
181
182
  handler: handleMintKey,
182
183
  },
@@ -184,6 +185,7 @@ export const keysRoutes: Route[] = [
184
185
  type: "GET",
185
186
  path: "/v1/keys",
186
187
  rawPath: true,
188
+ public: true,
187
189
  name: "billing-keys-list",
188
190
  handler: handleListKeys,
189
191
  },
@@ -191,6 +193,7 @@ export const keysRoutes: Route[] = [
191
193
  type: "DELETE",
192
194
  path: "/v1/keys/:id",
193
195
  rawPath: true,
196
+ public: true,
194
197
  name: "billing-keys-revoke",
195
198
  handler: handleRevokeKey,
196
199
  },
@@ -206,6 +209,7 @@ function clientKeysRoutes(): Route[] {
206
209
  type: "POST",
207
210
  path: "/v1/keys",
208
211
  rawPath: true,
212
+ public: true,
209
213
  name: "billing-keys-mint",
210
214
  handler: async (req, res) => {
211
215
  if (!ensureClientReady(res)) return;
@@ -219,6 +223,7 @@ function clientKeysRoutes(): Route[] {
219
223
  type: "GET",
220
224
  path: "/v1/keys",
221
225
  rawPath: true,
226
+ public: true,
222
227
  name: "billing-keys-list",
223
228
  handler: async (req, res) => {
224
229
  if (!ensureClientReady(res)) return;
@@ -231,6 +236,7 @@ function clientKeysRoutes(): Route[] {
231
236
  type: "DELETE",
232
237
  path: "/v1/keys/:id",
233
238
  rawPath: true,
239
+ public: true,
234
240
  name: "billing-keys-revoke",
235
241
  handler: async (req, res) => {
236
242
  if (!ensureClientReady(res)) return;
@@ -808,6 +808,7 @@ export const topupRoutes: Route[] = [
808
808
  type: "GET",
809
809
  path: "/v1/topup/info",
810
810
  rawPath: true,
811
+ public: true,
811
812
  name: "billing-topup-info",
812
813
  handler: handleTopupInfo,
813
814
  },
@@ -815,6 +816,7 @@ export const topupRoutes: Route[] = [
815
816
  type: "POST",
816
817
  path: "/v1/topup/quote",
817
818
  rawPath: true,
819
+ public: true,
818
820
  name: "billing-topup-quote",
819
821
  handler: handleTopupQuote,
820
822
  },
@@ -822,6 +824,7 @@ export const topupRoutes: Route[] = [
822
824
  type: "POST",
823
825
  path: "/v1/topup/settle",
824
826
  rawPath: true,
827
+ public: true,
825
828
  name: "billing-topup-settle",
826
829
  handler: handleTopupSettle,
827
830
  },
@@ -829,6 +832,7 @@ export const topupRoutes: Route[] = [
829
832
  type: "POST",
830
833
  path: "/v1/topup/preauth",
831
834
  rawPath: true,
835
+ public: true,
832
836
  name: "billing-topup-preauth",
833
837
  handler: handleTopupPreauth,
834
838
  },
@@ -836,6 +840,7 @@ export const topupRoutes: Route[] = [
836
840
  type: "GET",
837
841
  path: "/v1/topup/status",
838
842
  rawPath: true,
843
+ public: true,
839
844
  name: "billing-topup-status",
840
845
  handler: handleTopupStatus,
841
846
  },
@@ -843,6 +848,7 @@ export const topupRoutes: Route[] = [
843
848
  type: "POST",
844
849
  path: "/v1/topup/revoke",
845
850
  rawPath: true,
851
+ public: true,
846
852
  name: "billing-topup-revoke",
847
853
  handler: handleTopupRevoke,
848
854
  },
@@ -850,6 +856,7 @@ export const topupRoutes: Route[] = [
850
856
  type: "GET",
851
857
  path: "/v1/quote/:id",
852
858
  rawPath: true,
859
+ public: true,
853
860
  name: "billing-quote-debug",
854
861
  handler: handleGetQuote,
855
862
  },
@@ -865,6 +872,7 @@ function clientTopupRoutes(): Route[] {
865
872
  type: "GET",
866
873
  path: "/v1/topup/info",
867
874
  rawPath: true,
875
+ public: true,
868
876
  name: "billing-topup-info",
869
877
  handler: async (req, res) => {
870
878
  if (!ensureClientReady(res)) return;
@@ -877,6 +885,7 @@ function clientTopupRoutes(): Route[] {
877
885
  type: "POST",
878
886
  path: "/v1/topup/quote",
879
887
  rawPath: true,
888
+ public: true,
880
889
  name: "billing-topup-quote",
881
890
  handler: async (req, res) => {
882
891
  if (!ensureClientReady(res)) return;
@@ -889,6 +898,7 @@ function clientTopupRoutes(): Route[] {
889
898
  type: "POST",
890
899
  path: "/v1/topup/settle",
891
900
  rawPath: true,
901
+ public: true,
892
902
  name: "billing-topup-settle",
893
903
  handler: async (req, res) => {
894
904
  if (!ensureClientReady(res)) return;
@@ -901,6 +911,7 @@ function clientTopupRoutes(): Route[] {
901
911
  type: "POST",
902
912
  path: "/v1/topup/preauth",
903
913
  rawPath: true,
914
+ public: true,
904
915
  name: "billing-topup-preauth",
905
916
  handler: async (req, res) => {
906
917
  if (!ensureClientReady(res)) return;
@@ -913,6 +924,7 @@ function clientTopupRoutes(): Route[] {
913
924
  type: "GET",
914
925
  path: "/v1/topup/status",
915
926
  rawPath: true,
927
+ public: true,
916
928
  name: "billing-topup-status",
917
929
  handler: async (req, res) => {
918
930
  if (!ensureClientReady(res)) return;
@@ -925,6 +937,7 @@ function clientTopupRoutes(): Route[] {
925
937
  type: "POST",
926
938
  path: "/v1/topup/revoke",
927
939
  rawPath: true,
940
+ public: true,
928
941
  name: "billing-topup-revoke",
929
942
  handler: async (req, res) => {
930
943
  if (!ensureClientReady(res)) return;
@@ -937,6 +950,7 @@ function clientTopupRoutes(): Route[] {
937
950
  type: "GET",
938
951
  path: "/v1/quote/:id",
939
952
  rawPath: true,
953
+ public: true,
940
954
  name: "billing-quote-debug",
941
955
  handler: async (req, res) => {
942
956
  if (!ensureClientReady(res)) return;
@@ -414,6 +414,7 @@ export const usageRoutes: Route[] = [
414
414
  type: "GET",
415
415
  path: "/v1/usage/summary",
416
416
  rawPath: true,
417
+ public: true,
417
418
  name: "billing-usage-summary",
418
419
  handler: handleUsageSummary,
419
420
  },
@@ -421,6 +422,7 @@ export const usageRoutes: Route[] = [
421
422
  type: "GET",
422
423
  path: "/v1/usage/calls",
423
424
  rawPath: true,
425
+ public: true,
424
426
  name: "billing-usage-calls",
425
427
  handler: handleUsageCalls,
426
428
  },
@@ -428,6 +430,7 @@ export const usageRoutes: Route[] = [
428
430
  type: "GET",
429
431
  path: "/v1/usage/keys",
430
432
  rawPath: true,
433
+ public: true,
431
434
  name: "billing-usage-keys",
432
435
  handler: handleUsageKeys,
433
436
  },
@@ -451,6 +454,7 @@ function clientUsageRoutes(): Route[] {
451
454
  type: "GET",
452
455
  path: "/v1/usage/summary",
453
456
  rawPath: true,
457
+ public: true,
454
458
  name: "billing-usage-summary",
455
459
  handler: async (req, res) => {
456
460
  if (!ensureClientReady(res)) return;
@@ -466,6 +470,7 @@ function clientUsageRoutes(): Route[] {
466
470
  type: "GET",
467
471
  path: "/v1/usage/calls",
468
472
  rawPath: true,
473
+ public: true,
469
474
  name: "billing-usage-calls",
470
475
  handler: async (req, res) => {
471
476
  if (!ensureClientReady(res)) return;
@@ -481,6 +486,7 @@ function clientUsageRoutes(): Route[] {
481
486
  type: "GET",
482
487
  path: "/v1/usage/keys",
483
488
  rawPath: true,
489
+ public: true,
484
490
  name: "billing-usage-keys",
485
491
  handler: async (req, res) => {
486
492
  if (!ensureClientReady(res)) return;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": "1.0.0",
3
- "generatedAt": "2026-05-19T11:38:41.018Z",
3
+ "generatedAt": "2026-05-19T14:06:57.055Z",
4
4
  "repoUrl": "https://github.com/elizaos/eliza",
5
5
  "templates": [
6
6
  {