@ebitex/content-mcp 0.1.84 → 0.2.86

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/dist/errors.d.ts CHANGED
@@ -14,6 +14,11 @@
14
14
  * body entirely). Emitting the whole body cannot go stale, because it makes no claim about shape.
15
15
  *
16
16
  * One shaping *is* applied, and only one: the body is pretty-printed. That changes no content.
17
+ *
18
+ * One line is *added*, never substituted: the request's reference (spec 739-request-correlation-id),
19
+ * read from the `X-Request-Id` response header. It goes on its own line between the heading and the
20
+ * body, so the body is still relayed exactly as the server sent it — including its own `requestId`,
21
+ * which an unhandled `500` carries.
17
22
  */
18
23
  /** A non-2xx response, carrying everything the server said about it. */
19
24
  export declare class ContentApiError extends Error {
@@ -22,7 +27,12 @@ export declare class ContentApiError extends Error {
22
27
  readonly code: string | null;
23
28
  /** The parsed body, or the raw text when it was not JSON (a proxy's HTML error page, say). */
24
29
  readonly body: unknown;
25
- constructor(status: number, code: string | null, body: unknown, message: string);
30
+ /**
31
+ * The request's reference — the `X-Request-Id` header, else the body's own `requestId` — or `null`
32
+ * when neither was present (a response something in front of the API generated).
33
+ */
34
+ readonly requestId: string | null;
35
+ constructor(status: number, code: string | null, body: unknown, message: string, requestId?: string | null);
26
36
  }
27
37
  /**
28
38
  * Builds the error from a response, reading the body once.
@@ -36,8 +46,10 @@ export declare function toContentApiError(response: Response): Promise<ContentAp
36
46
  * The text an agent actually reads.
37
47
  *
38
48
  * Line one is the status and the API's own code, so the machine-readable identity is never buried.
49
+ * Line two, when the response carried one, is the request's reference — what support needs to find
50
+ * the request in the logs.
39
51
  * Everything after it is the body, verbatim. No summary, no count, no "and 3 more" — an elision
40
52
  * here would remove exactly the field the next call has to set.
41
53
  */
42
- export declare function describe(status: number, code: string | null, body: unknown): string;
54
+ export declare function describe(status: number, code: string | null, body: unknown, requestId?: string | null): string;
43
55
  //# sourceMappingURL=errors.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file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;AACH,wBAAsB,iBAAiB,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,eAAe,CAAC,CAkBpF;AAaD;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,GAAE,MAAM,GAAG,IAAW,GAAG,MAAM,CAOpH"}
package/dist/errors.js CHANGED
@@ -14,6 +14,11 @@
14
14
  * body entirely). Emitting the whole body cannot go stale, because it makes no claim about shape.
15
15
  *
16
16
  * One shaping *is* applied, and only one: the body is pretty-printed. That changes no content.
17
+ *
18
+ * One line is *added*, never substituted: the request's reference (spec 739-request-correlation-id),
19
+ * read from the `X-Request-Id` response header. It goes on its own line between the heading and the
20
+ * body, so the body is still relayed exactly as the server sent it — including its own `requestId`,
21
+ * which an unhandled `500` carries.
17
22
  */
18
23
  /** A non-2xx response, carrying everything the server said about it. */
19
24
  export class ContentApiError extends Error {
@@ -22,12 +27,18 @@ export class ContentApiError extends Error {
22
27
  code;
23
28
  /** The parsed body, or the raw text when it was not JSON (a proxy's HTML error page, say). */
24
29
  body;
25
- constructor(status, code, body, message) {
30
+ /**
31
+ * The request's reference — the `X-Request-Id` header, else the body's own `requestId` — or `null`
32
+ * when neither was present (a response something in front of the API generated).
33
+ */
34
+ requestId;
35
+ constructor(status, code, body, message, requestId = null) {
26
36
  super(message);
27
37
  this.name = 'ContentApiError';
28
38
  this.status = status;
29
39
  this.code = code;
30
40
  this.body = body;
41
+ this.requestId = requestId;
31
42
  }
32
43
  }
33
44
  /**
@@ -52,17 +63,30 @@ export async function toContentApiError(response) {
52
63
  // Not JSON. `body` stays the raw text.
53
64
  }
54
65
  }
55
- return new ContentApiError(response.status, code, body, describe(response.status, code, body));
66
+ const requestId = readRequestId(response, body);
67
+ return new ContentApiError(response.status, code, body, describe(response.status, code, body, requestId), requestId);
68
+ }
69
+ function readRequestId(response, body) {
70
+ const header = response.headers.get('X-Request-Id');
71
+ if (header)
72
+ return header;
73
+ if (body && typeof body === 'object' && typeof body.requestId === 'string') {
74
+ return body.requestId || null;
75
+ }
76
+ return null;
56
77
  }
57
78
  /**
58
79
  * The text an agent actually reads.
59
80
  *
60
81
  * Line one is the status and the API's own code, so the machine-readable identity is never buried.
82
+ * Line two, when the response carried one, is the request's reference — what support needs to find
83
+ * the request in the logs.
61
84
  * Everything after it is the body, verbatim. No summary, no count, no "and 3 more" — an elision
62
85
  * here would remove exactly the field the next call has to set.
63
86
  */
64
- export function describe(status, code, body) {
65
- const heading = code ? `HTTP ${status} ${code}` : `HTTP ${status}`;
87
+ export function describe(status, code, body, requestId = null) {
88
+ const statusLine = code ? `HTTP ${status} ${code}` : `HTTP ${status}`;
89
+ const heading = requestId ? `${statusLine}\nRequest id: ${requestId}` : statusLine;
66
90
  if (body === undefined || body === null || body === '')
67
91
  return heading;
68
92
  const rendered = typeof body === 'string' ? body : safeStringify(body);
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,wEAAwE;AACxE,MAAM,OAAO,eAAgB,SAAQ,KAAK;IAC/B,MAAM,CAAQ;IACvB,oGAAoG;IAC3F,IAAI,CAAe;IAC5B,8FAA8F;IACrF,IAAI,CAAS;IAEtB,YAAY,MAAc,EAAE,IAAmB,EAAE,IAAa,EAAE,OAAe;QAC7E,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAA;QAC7B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IAClB,CAAC;CACF;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,QAAkB;IACxD,MAAM,IAAI,GAAG,MAAM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AG,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,CAAA;IACtE,OAAO,GAAG,OAAO,KAAK,QAAQ,EAAE,CAAA;AAClC,CAAC;AAED,SAAS,aAAa,CAAC,KAAc;IACnC,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;IACvC,CAAC;IAAC,MAAM,CAAC;QACP,gGAAgG;QAChG,0FAA0F;QAC1F,eAAe;QACf,OAAO,MAAM,CAAC,KAAK,CAAC,CAAA;IACtB,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ebitex/content-mcp",
3
- "version": "0.1.84",
3
+ "version": "0.2.86",
4
4
  "description": "An MCP server for ebitex Content: build and publish a content model from an AI agent.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -35,5 +35,10 @@
35
35
  "oxlint": "^1.71.0",
36
36
  "typescript": "~6.0.2",
37
37
  "vitest": "^4.1.10"
38
+ },
39
+ "ebitex": {
40
+ "extraInputs": [
41
+ "help/content"
42
+ ]
38
43
  }
39
44
  }