@ethisyscore/extension-runtime 1.70.0 → 1.71.1
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/host/index.cjs +129 -7
- package/dist/host/index.cjs.map +1 -1
- package/dist/host/index.d.cts +3 -2
- package/dist/host/index.d.ts +3 -2
- package/dist/host/index.js +122 -8
- package/dist/host/index.js.map +1 -1
- package/dist/index.cjs +104 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +97 -1
- package/dist/index.js.map +1 -1
- package/dist/mcp-error-CCZQd8Xl.d.cts +118 -0
- package/dist/mcp-error-CCZQd8Xl.d.ts +118 -0
- package/dist/mock-host/cli.cjs +84 -4
- package/dist/mock-host/cli.cjs.map +1 -1
- package/dist/mock-host/cli.d.cts +1 -1
- package/dist/mock-host/cli.d.ts +1 -1
- package/dist/mock-host/cli.js +84 -4
- package/dist/mock-host/cli.js.map +1 -1
- package/dist/plugin/index.cjs +106 -5
- package/dist/plugin/index.cjs.map +1 -1
- package/dist/plugin/index.d.cts +1 -0
- package/dist/plugin/index.d.ts +1 -0
- package/dist/plugin/index.js +99 -6
- package/dist/plugin/index.js.map +1 -1
- package/dist/{transport-BPwasdNz.d.ts → transport-BuX8gzq1.d.ts} +7 -0
- package/dist/{transport-BbSPAS_N.d.cts → transport-C4xoMWBE.d.cts} +7 -0
- package/package.json +2 -2
package/dist/host/index.d.cts
CHANGED
|
@@ -3,10 +3,11 @@ import { C as ComponentRegistry } from '../registry-DpCx_LxF.cjs';
|
|
|
3
3
|
export { P as PrimitiveProps } from '../registry-DpCx_LxF.cjs';
|
|
4
4
|
import { SduiNode } from '@ethisyscore/protocol';
|
|
5
5
|
export { PrimitiveName, SduiNode } from '@ethisyscore/protocol';
|
|
6
|
-
import { M as McpHttpClient, f as VersionSkew } from '../transport-
|
|
7
|
-
export { C as CAPABILITY_REJECTION_REASON_HEADER, D as DEFAULT_MAX_CONCURRENT_MCP_REQUESTS, E as EXTENSION_ACTIVE_VERSION_HEADER, a as EXTENSION_VERSION_HEADER, I as InputEventPayload, b as McpHttpRequest, c as McpHttpResponse, d as McpResponseMetadata, e as McpUploadRequest, V as VERSION_MISMATCH_REASON, g as VersionSkewSource, W as WORKER_TRANSPORT_PROTOCOL, h as WorkerCtor, i as WorkerHandshakePayload, j as WorkerLike, k as WorkerRemoteDomTransport, l as WorkerRemoteDomTransportOptions, m as detectVersionSkew } from '../transport-
|
|
6
|
+
import { M as McpHttpClient, f as VersionSkew } from '../transport-C4xoMWBE.cjs';
|
|
7
|
+
export { C as CAPABILITY_REJECTION_REASON_HEADER, D as DEFAULT_MAX_CONCURRENT_MCP_REQUESTS, E as EXTENSION_ACTIVE_VERSION_HEADER, a as EXTENSION_VERSION_HEADER, I as InputEventPayload, b as McpHttpRequest, c as McpHttpResponse, d as McpResponseMetadata, e as McpUploadRequest, V as VERSION_MISMATCH_REASON, g as VersionSkewSource, W as WORKER_TRANSPORT_PROTOCOL, h as WorkerCtor, i as WorkerHandshakePayload, j as WorkerLike, k as WorkerRemoteDomTransport, l as WorkerRemoteDomTransportOptions, m as detectVersionSkew } from '../transport-C4xoMWBE.cjs';
|
|
8
8
|
export { RemoteReceiver, RemoteReceiverComment, RemoteReceiverElement, RemoteReceiverNode, RemoteReceiverParent, RemoteReceiverRoot, RemoteReceiverText } from '@remote-dom/core/receivers';
|
|
9
9
|
export { RemoteComponentRendererMap, RemoteComponentRendererProps, RemoteRootRenderer, RemoteRootRendererProps, createRemoteComponentRenderer } from '@remote-dom/react/host';
|
|
10
|
+
export { M as MCP_ERROR_CODES, a as McpErrorCode, b as McpToolError, c as classifyHostError, d as classifyHostResponse, i as isMcpErrorCode, e as isMcpToolError, f as isRetryableMcpErrorCode, m as mcpErrorCodeFromHttpStatus } from '../mcp-error-CCZQd8Xl.cjs';
|
|
10
11
|
import '../bridge-envelopes-DA6vxbyb.cjs';
|
|
11
12
|
|
|
12
13
|
/**
|
package/dist/host/index.d.ts
CHANGED
|
@@ -3,10 +3,11 @@ import { C as ComponentRegistry } from '../registry-DpCx_LxF.js';
|
|
|
3
3
|
export { P as PrimitiveProps } from '../registry-DpCx_LxF.js';
|
|
4
4
|
import { SduiNode } from '@ethisyscore/protocol';
|
|
5
5
|
export { PrimitiveName, SduiNode } from '@ethisyscore/protocol';
|
|
6
|
-
import { M as McpHttpClient, f as VersionSkew } from '../transport-
|
|
7
|
-
export { C as CAPABILITY_REJECTION_REASON_HEADER, D as DEFAULT_MAX_CONCURRENT_MCP_REQUESTS, E as EXTENSION_ACTIVE_VERSION_HEADER, a as EXTENSION_VERSION_HEADER, I as InputEventPayload, b as McpHttpRequest, c as McpHttpResponse, d as McpResponseMetadata, e as McpUploadRequest, V as VERSION_MISMATCH_REASON, g as VersionSkewSource, W as WORKER_TRANSPORT_PROTOCOL, h as WorkerCtor, i as WorkerHandshakePayload, j as WorkerLike, k as WorkerRemoteDomTransport, l as WorkerRemoteDomTransportOptions, m as detectVersionSkew } from '../transport-
|
|
6
|
+
import { M as McpHttpClient, f as VersionSkew } from '../transport-BuX8gzq1.js';
|
|
7
|
+
export { C as CAPABILITY_REJECTION_REASON_HEADER, D as DEFAULT_MAX_CONCURRENT_MCP_REQUESTS, E as EXTENSION_ACTIVE_VERSION_HEADER, a as EXTENSION_VERSION_HEADER, I as InputEventPayload, b as McpHttpRequest, c as McpHttpResponse, d as McpResponseMetadata, e as McpUploadRequest, V as VERSION_MISMATCH_REASON, g as VersionSkewSource, W as WORKER_TRANSPORT_PROTOCOL, h as WorkerCtor, i as WorkerHandshakePayload, j as WorkerLike, k as WorkerRemoteDomTransport, l as WorkerRemoteDomTransportOptions, m as detectVersionSkew } from '../transport-BuX8gzq1.js';
|
|
8
8
|
export { RemoteReceiver, RemoteReceiverComment, RemoteReceiverElement, RemoteReceiverNode, RemoteReceiverParent, RemoteReceiverRoot, RemoteReceiverText } from '@remote-dom/core/receivers';
|
|
9
9
|
export { RemoteComponentRendererMap, RemoteComponentRendererProps, RemoteRootRenderer, RemoteRootRendererProps, createRemoteComponentRenderer } from '@remote-dom/react/host';
|
|
10
|
+
export { M as MCP_ERROR_CODES, a as McpErrorCode, b as McpToolError, c as classifyHostError, d as classifyHostResponse, i as isMcpErrorCode, e as isMcpToolError, f as isRetryableMcpErrorCode, m as mcpErrorCodeFromHttpStatus } from '../mcp-error-CCZQd8Xl.js';
|
|
10
11
|
import '../bridge-envelopes-DA6vxbyb.js';
|
|
11
12
|
|
|
12
13
|
/**
|
package/dist/host/index.js
CHANGED
|
@@ -285,6 +285,100 @@ function createInputEventCoalescer(sink, options = {}) {
|
|
|
285
285
|
};
|
|
286
286
|
}
|
|
287
287
|
|
|
288
|
+
// src/bridge/mcp-error.ts
|
|
289
|
+
var MCP_ERROR_CODES = [
|
|
290
|
+
"unauthorized",
|
|
291
|
+
"forbidden",
|
|
292
|
+
"not_found",
|
|
293
|
+
"invalid_request",
|
|
294
|
+
"conflict",
|
|
295
|
+
"rate_limited",
|
|
296
|
+
"timeout",
|
|
297
|
+
"unavailable",
|
|
298
|
+
"internal"
|
|
299
|
+
];
|
|
300
|
+
function isMcpErrorCode(value) {
|
|
301
|
+
return typeof value === "string" && MCP_ERROR_CODES.includes(value);
|
|
302
|
+
}
|
|
303
|
+
var RETRYABLE = ["rate_limited", "timeout", "unavailable"];
|
|
304
|
+
function isRetryableMcpErrorCode(code) {
|
|
305
|
+
return RETRYABLE.includes(code);
|
|
306
|
+
}
|
|
307
|
+
var McpToolError = class extends Error {
|
|
308
|
+
/** Machine-readable classification. `internal` when the host sent none. */
|
|
309
|
+
code;
|
|
310
|
+
/**
|
|
311
|
+
* Marks the instance for {@link isMcpToolError}. A structural marker rather than a prototype
|
|
312
|
+
* check because the error can be constructed in one bundle and inspected in another, where
|
|
313
|
+
* `instanceof` compares two different class objects and answers false.
|
|
314
|
+
*/
|
|
315
|
+
isMcpToolError = true;
|
|
316
|
+
constructor(message, code = "internal") {
|
|
317
|
+
super(message);
|
|
318
|
+
this.name = "McpHostError";
|
|
319
|
+
this.code = code;
|
|
320
|
+
}
|
|
321
|
+
/** True when this failure is worth retrying unchanged. */
|
|
322
|
+
get retryable() {
|
|
323
|
+
return isRetryableMcpErrorCode(this.code);
|
|
324
|
+
}
|
|
325
|
+
};
|
|
326
|
+
function isMcpToolError(value) {
|
|
327
|
+
return value instanceof McpToolError || value !== null && typeof value === "object" && value.isMcpToolError === true && isMcpErrorCode(value.code);
|
|
328
|
+
}
|
|
329
|
+
function mcpErrorCodeFromHttpStatus(status) {
|
|
330
|
+
switch (status) {
|
|
331
|
+
case 401:
|
|
332
|
+
return "unauthorized";
|
|
333
|
+
case 403:
|
|
334
|
+
return "forbidden";
|
|
335
|
+
case 404:
|
|
336
|
+
return "not_found";
|
|
337
|
+
case 400:
|
|
338
|
+
case 422:
|
|
339
|
+
return "invalid_request";
|
|
340
|
+
case 409:
|
|
341
|
+
case 412:
|
|
342
|
+
return "conflict";
|
|
343
|
+
case 429:
|
|
344
|
+
return "rate_limited";
|
|
345
|
+
case 408:
|
|
346
|
+
case 504:
|
|
347
|
+
return "timeout";
|
|
348
|
+
case 502:
|
|
349
|
+
case 503:
|
|
350
|
+
return "unavailable";
|
|
351
|
+
default:
|
|
352
|
+
return "internal";
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
function classifyHostResponse(response) {
|
|
356
|
+
if (response.ok) {
|
|
357
|
+
return void 0;
|
|
358
|
+
}
|
|
359
|
+
if (isMcpErrorCode(response.mcpErrorCode)) {
|
|
360
|
+
return response.mcpErrorCode;
|
|
361
|
+
}
|
|
362
|
+
return typeof response.status === "number" ? mcpErrorCodeFromHttpStatus(response.status) : "internal";
|
|
363
|
+
}
|
|
364
|
+
function classifyHostError(err) {
|
|
365
|
+
if (err === null || typeof err !== "object") {
|
|
366
|
+
return "internal";
|
|
367
|
+
}
|
|
368
|
+
const candidate = err;
|
|
369
|
+
if (isMcpErrorCode(candidate.mcpErrorCode)) {
|
|
370
|
+
return candidate.mcpErrorCode;
|
|
371
|
+
}
|
|
372
|
+
const status = typeof candidate.status === "number" ? candidate.status : typeof candidate.statusCode === "number" ? candidate.statusCode : void 0;
|
|
373
|
+
if (status !== void 0) {
|
|
374
|
+
return mcpErrorCodeFromHttpStatus(status);
|
|
375
|
+
}
|
|
376
|
+
if (candidate.name === "AbortError" || candidate.name === "TimeoutError") {
|
|
377
|
+
return "timeout";
|
|
378
|
+
}
|
|
379
|
+
return "internal";
|
|
380
|
+
}
|
|
381
|
+
|
|
288
382
|
// src/host/version-skew.ts
|
|
289
383
|
var EXTENSION_VERSION_HEADER = "x-extension-version";
|
|
290
384
|
var EXTENSION_ACTIVE_VERSION_HEADER = "x-extension-active-version";
|
|
@@ -711,7 +805,11 @@ var WorkerRemoteDomTransport = class {
|
|
|
711
805
|
type: "ethisys:mcp:invokeTool:result",
|
|
712
806
|
ok: result.ok,
|
|
713
807
|
data: result.data,
|
|
714
|
-
error: result.error
|
|
808
|
+
error: result.error,
|
|
809
|
+
// A client that REPORTS failure rather than throwing lands here, which is the common
|
|
810
|
+
// shape for anything wrapping HTTP. Classifying only the thrown path left these
|
|
811
|
+
// arriving as `internal`.
|
|
812
|
+
code: classifyHostResponse(result)
|
|
715
813
|
});
|
|
716
814
|
} catch (err) {
|
|
717
815
|
this.replyError(message.id, "ethisys:mcp:invokeTool:result", err);
|
|
@@ -741,7 +839,11 @@ var WorkerRemoteDomTransport = class {
|
|
|
741
839
|
type: "ethisys:mcp:getResource:result",
|
|
742
840
|
ok: result.ok,
|
|
743
841
|
data: result.data,
|
|
744
|
-
error: result.error
|
|
842
|
+
error: result.error,
|
|
843
|
+
// A client that REPORTS failure rather than throwing lands here, which is the common
|
|
844
|
+
// shape for anything wrapping HTTP. Classifying only the thrown path left these
|
|
845
|
+
// arriving as `internal`.
|
|
846
|
+
code: classifyHostResponse(result)
|
|
745
847
|
});
|
|
746
848
|
} catch (err) {
|
|
747
849
|
this.replyError(message.id, "ethisys:mcp:getResource:result", err);
|
|
@@ -772,7 +874,11 @@ var WorkerRemoteDomTransport = class {
|
|
|
772
874
|
type: "ethisys:mcp:uploadDocument:result",
|
|
773
875
|
ok: result.ok,
|
|
774
876
|
data: result.data,
|
|
775
|
-
error: result.error
|
|
877
|
+
error: result.error,
|
|
878
|
+
// A client that REPORTS failure rather than throwing lands here, which is the common
|
|
879
|
+
// shape for anything wrapping HTTP. Classifying only the thrown path left these
|
|
880
|
+
// arriving as `internal`.
|
|
881
|
+
code: classifyHostResponse(result)
|
|
776
882
|
});
|
|
777
883
|
} catch (err) {
|
|
778
884
|
this.replyError(message.id, "ethisys:mcp:uploadDocument:result", err);
|
|
@@ -780,7 +886,7 @@ var WorkerRemoteDomTransport = class {
|
|
|
780
886
|
}
|
|
781
887
|
replyError(id, type, err) {
|
|
782
888
|
const message = err instanceof Error ? err.message : "MCP request failed";
|
|
783
|
-
this.safePostMessage({ id, type, ok: false, error: message });
|
|
889
|
+
this.safePostMessage({ id, type, ok: false, error: message, code: classifyHostError(err) });
|
|
784
890
|
}
|
|
785
891
|
};
|
|
786
892
|
var IFRAME_BRIDGE_PROTOCOL = "ethisys.iframe.bridge.v1";
|
|
@@ -986,7 +1092,11 @@ var IframeBridgeTransport = class {
|
|
|
986
1092
|
type: "ethisys:mcp:invokeTool:result",
|
|
987
1093
|
ok: result.ok,
|
|
988
1094
|
data: result.data,
|
|
989
|
-
error: result.error
|
|
1095
|
+
error: result.error,
|
|
1096
|
+
// A client that REPORTS failure rather than throwing lands here, which is the common shape
|
|
1097
|
+
// for anything wrapping HTTP. Classifying only the thrown path left these arriving as
|
|
1098
|
+
// `internal`.
|
|
1099
|
+
code: classifyHostResponse(result)
|
|
990
1100
|
});
|
|
991
1101
|
} catch (err) {
|
|
992
1102
|
this.replyError(message.id, "ethisys:mcp:invokeTool:result", err);
|
|
@@ -1040,7 +1150,11 @@ var IframeBridgeTransport = class {
|
|
|
1040
1150
|
type: "ethisys:mcp:getResource:result",
|
|
1041
1151
|
ok: result.ok,
|
|
1042
1152
|
data: result.data,
|
|
1043
|
-
error: result.error
|
|
1153
|
+
error: result.error,
|
|
1154
|
+
// A client that REPORTS failure rather than throwing lands here, which is the common shape
|
|
1155
|
+
// for anything wrapping HTTP. Classifying only the thrown path left these arriving as
|
|
1156
|
+
// `internal`.
|
|
1157
|
+
code: classifyHostResponse(result)
|
|
1044
1158
|
});
|
|
1045
1159
|
} catch (err) {
|
|
1046
1160
|
this.replyError(message.id, "ethisys:mcp:getResource:result", err);
|
|
@@ -1048,7 +1162,7 @@ var IframeBridgeTransport = class {
|
|
|
1048
1162
|
}
|
|
1049
1163
|
replyError(id, type, err) {
|
|
1050
1164
|
const message = err instanceof Error ? err.message : "MCP request failed";
|
|
1051
|
-
this.safePostMessage({ id, type, ok: false, error: message });
|
|
1165
|
+
this.safePostMessage({ id, type, ok: false, error: message, code: classifyHostError(err) });
|
|
1052
1166
|
}
|
|
1053
1167
|
/** Best-effort reply over the host port; tolerates post-dispose races. */
|
|
1054
1168
|
safePostMessage(message) {
|
|
@@ -1062,6 +1176,6 @@ var IframeBridgeTransport = class {
|
|
|
1062
1176
|
}
|
|
1063
1177
|
};
|
|
1064
1178
|
|
|
1065
|
-
export { CAPABILITY_REJECTION_REASON_HEADER, CONTRACT_B_PRIMITIVES, DEFAULT_MAX_CONCURRENT_MCP_REQUESTS, DEFAULT_OFFSCREEN_COALESCE_MS, EXTENSION_ACTIVE_VERSION_HEADER, EXTENSION_VERSION_HEADER, IFRAME_BRIDGE_PROTOCOL, IframeBridgeTransport, SemanticComponentRegistry, VERSION_MISMATCH_REASON, WORKER_TRANSPORT_PROTOCOL, WorkerRemoteDomTransport, createInputEventCoalescer, createOffscreenCanvasTransfer, detectVersionSkew, evaluate, interpret };
|
|
1179
|
+
export { CAPABILITY_REJECTION_REASON_HEADER, CONTRACT_B_PRIMITIVES, DEFAULT_MAX_CONCURRENT_MCP_REQUESTS, DEFAULT_OFFSCREEN_COALESCE_MS, EXTENSION_ACTIVE_VERSION_HEADER, EXTENSION_VERSION_HEADER, IFRAME_BRIDGE_PROTOCOL, IframeBridgeTransport, MCP_ERROR_CODES, McpToolError, SemanticComponentRegistry, VERSION_MISMATCH_REASON, WORKER_TRANSPORT_PROTOCOL, WorkerRemoteDomTransport, classifyHostError, classifyHostResponse, createInputEventCoalescer, createOffscreenCanvasTransfer, detectVersionSkew, evaluate, interpret, isMcpErrorCode, isMcpToolError, isRetryableMcpErrorCode, mcpErrorCodeFromHttpStatus };
|
|
1066
1180
|
//# sourceMappingURL=index.js.map
|
|
1067
1181
|
//# sourceMappingURL=index.js.map
|