@tokenoftrust/cli 2.2.1 → 2.2.3
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": "@tokenoftrust/cli",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.3",
|
|
4
4
|
"description": "Token of Trust developer CLI — clone a tenant store, run it locally with save→reload, and submit it for preview. Installs the `tot` command.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Token of Trust",
|
package/src/mcp.mjs
CHANGED
|
@@ -12,6 +12,10 @@ import { randomUUID } from "node:crypto";
|
|
|
12
12
|
import os from "node:os";
|
|
13
13
|
import { CliDiagnosticError, recordDiagnostic, sanitizeDiagnosticText } from "./diagnostics.mjs";
|
|
14
14
|
|
|
15
|
+
// A server's refusal is written for the person reading it and usually ends with what to do,
|
|
16
|
+
// so it is shown whole. The cap only bounds a runaway body; sanitizing still applies.
|
|
17
|
+
export const MAX_SERVER_MESSAGE = 4000;
|
|
18
|
+
|
|
15
19
|
const TRACE_HEADER = "X-Trace-Id";
|
|
16
20
|
const REQUEST_ID_HEADERS = ["x-request-id", "x-amzn-trace-id", "x-correlation-id"];
|
|
17
21
|
const DEFAULT_REQUEST_TIMEOUT_MS = 120_000;
|
|
@@ -188,7 +192,7 @@ export function createMcpClient(baseUrl, opts = {}) {
|
|
|
188
192
|
const category = signal.aborted ? "timeout" : "network";
|
|
189
193
|
const message = signal.aborted
|
|
190
194
|
? `${method} timed out after ${timeoutMs}ms`
|
|
191
|
-
: `${method} failed before a response arrived: ${sanitizeDiagnosticText(cause?.message || cause,
|
|
195
|
+
: `${method} failed before a response arrived: ${sanitizeDiagnosticText(cause?.message || cause, MAX_SERVER_MESSAGE)}`;
|
|
192
196
|
throw diagnosticError(message, { operation: method, category, message, traceId }, cause);
|
|
193
197
|
}
|
|
194
198
|
const sid = res.headers.get("Mcp-Session-Id");
|
|
@@ -229,7 +233,7 @@ export function createMcpClient(baseUrl, opts = {}) {
|
|
|
229
233
|
const category = oauth ? "oauth" : res.status === 413 ? "http_413" : `http_${res.status}`;
|
|
230
234
|
const message = sanitizeDiagnosticText(
|
|
231
235
|
failure.message || parsed?.error_description || `${res.status} ${res.statusText}`,
|
|
232
|
-
|
|
236
|
+
MAX_SERVER_MESSAGE,
|
|
233
237
|
);
|
|
234
238
|
throw diagnosticError(`${method} failed: HTTP ${res.status}${message ? ` — ${message}` : ""}`, {
|
|
235
239
|
operation: method, category, httpStatus: res.status, statusText: res.statusText,
|
|
@@ -249,7 +253,7 @@ export function createMcpClient(baseUrl, opts = {}) {
|
|
|
249
253
|
|
|
250
254
|
if (parsed?.error) {
|
|
251
255
|
const failure = safeServerFailure(parsed);
|
|
252
|
-
const message = sanitizeDiagnosticText(failure.message || "JSON-RPC error",
|
|
256
|
+
const message = sanitizeDiagnosticText(failure.message || "JSON-RPC error", MAX_SERVER_MESSAGE);
|
|
253
257
|
throw diagnosticError(`${method} failed: ${message}`, {
|
|
254
258
|
operation: method, category: "json_rpc", httpStatus: res.status,
|
|
255
259
|
statusText: res.statusText, serverCode: failure.serverCode, message,
|
|
@@ -310,7 +314,7 @@ export function createMcpClient(baseUrl, opts = {}) {
|
|
|
310
314
|
}
|
|
311
315
|
const message = sanitizeDiagnosticText(
|
|
312
316
|
payload?.message || payload?.error?.message || tb?.text || `${name} failed`,
|
|
313
|
-
|
|
317
|
+
MAX_SERVER_MESSAGE,
|
|
314
318
|
);
|
|
315
319
|
throw diagnosticError(`${name} failed: ${message}`, {
|
|
316
320
|
operation: name, category: "tool_error",
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
<p>A fictional demo store for the Token of Trust local dev loop.<br>Not a real merchant — sample content only.</p>
|
|
85
85
|
</div>
|
|
86
86
|
<div class="footer-col">
|
|
87
|
-
<
|
|
87
|
+
<p class="footer-col-title">Shop</p>
|
|
88
88
|
<ul>
|
|
89
89
|
<li><a href="/collections/e-liquid">E-Liquid</a></li>
|
|
90
90
|
<li><a href="/collections/salt-nic">Salt Nic</a></li>
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
</ul>
|
|
95
95
|
</div>
|
|
96
96
|
<div class="footer-col">
|
|
97
|
-
<
|
|
97
|
+
<p class="footer-col-title">Support</p>
|
|
98
98
|
<ul>
|
|
99
99
|
<li><a href="/search">Search</a></li>
|
|
100
100
|
<li><a href="/pages/about-us">About Us</a></li>
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
</ul>
|
|
104
104
|
</div>
|
|
105
105
|
<div class="footer-col">
|
|
106
|
-
<
|
|
106
|
+
<p class="footer-col-title">Company</p>
|
|
107
107
|
<ul>
|
|
108
108
|
<li><a href="/pages/shipping-returns">Shipping & Returns</a></li>
|
|
109
109
|
<li><a href="/pages/privacy-policy">Privacy Policy</a></li>
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
.footer-news input { flex: 1; border: 1px solid rgba(255,255,255,.3); background: transparent; color: #fff; border-radius: 999px; padding: 10px 16px; font-size: .9rem; }
|
|
61
61
|
.footer-news input::placeholder { color: #a9b8e6; }
|
|
62
62
|
.footer-news button { background: #fff; color: var(--navy-ink); border: 0; border-radius: 999px; width: 42px; font-size: 1.1rem; font-weight: 700; cursor: pointer; }
|
|
63
|
-
.footer-col > p { color: #a9b8e6; font-size: .88rem; margin-top: 4px; }
|
|
63
|
+
.footer-col > p:not(.footer-col-title) { color: #a9b8e6; font-size: .88rem; margin-top: 4px; }
|
|
64
64
|
|
|
65
65
|
/* --- Payment badges ------------------------------------------------------- */
|
|
66
66
|
.pay-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
|
|
@@ -147,7 +147,7 @@
|
|
|
147
147
|
.footer-grid { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: clamp(24px, 4vw, 56px); }
|
|
148
148
|
.footer-brand img { height: 40px; filter: brightness(0) invert(1); opacity: .95; }
|
|
149
149
|
.footer-brand p { color: #a9b8e6; margin-top: 14px; font-size: .9rem; max-width: 34ch; }
|
|
150
|
-
.footer-col
|
|
150
|
+
.footer-col .footer-col-title { color: #fff; font-size: .82rem; font-weight: bold; letter-spacing: .1em; text-transform: uppercase; margin: 0 0 14px; }
|
|
151
151
|
.footer-col ul { display: flex; flex-direction: column; gap: 9px; }
|
|
152
152
|
.footer-col a { color: #c3cff0; font-size: .92rem; }
|
|
153
153
|
.footer-col a:hover { color: #fff; text-decoration: underline; }
|