@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/mock-host/cli.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SduiNode } from '@ethisyscore/protocol';
|
|
2
|
-
import { h as WorkerCtor, M as McpHttpClient, k as WorkerRemoteDomTransport } from '../transport-
|
|
2
|
+
import { h as WorkerCtor, M as McpHttpClient, k as WorkerRemoteDomTransport } from '../transport-C4xoMWBE.cjs';
|
|
3
3
|
import '../bridge-envelopes-DA6vxbyb.cjs';
|
|
4
4
|
|
|
5
5
|
/**
|
package/dist/mock-host/cli.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SduiNode } from '@ethisyscore/protocol';
|
|
2
|
-
import { h as WorkerCtor, M as McpHttpClient, k as WorkerRemoteDomTransport } from '../transport-
|
|
2
|
+
import { h as WorkerCtor, M as McpHttpClient, k as WorkerRemoteDomTransport } from '../transport-BuX8gzq1.js';
|
|
3
3
|
import '../bridge-envelopes-DA6vxbyb.js';
|
|
4
4
|
|
|
5
5
|
/**
|
package/dist/mock-host/cli.js
CHANGED
|
@@ -32,6 +32,74 @@ function createOffscreenCanvasTransfer(options) {
|
|
|
32
32
|
return { offscreen };
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
// src/bridge/mcp-error.ts
|
|
36
|
+
var MCP_ERROR_CODES = [
|
|
37
|
+
"unauthorized",
|
|
38
|
+
"forbidden",
|
|
39
|
+
"not_found",
|
|
40
|
+
"invalid_request",
|
|
41
|
+
"conflict",
|
|
42
|
+
"rate_limited",
|
|
43
|
+
"timeout",
|
|
44
|
+
"unavailable",
|
|
45
|
+
"internal"
|
|
46
|
+
];
|
|
47
|
+
function isMcpErrorCode(value) {
|
|
48
|
+
return typeof value === "string" && MCP_ERROR_CODES.includes(value);
|
|
49
|
+
}
|
|
50
|
+
function mcpErrorCodeFromHttpStatus(status) {
|
|
51
|
+
switch (status) {
|
|
52
|
+
case 401:
|
|
53
|
+
return "unauthorized";
|
|
54
|
+
case 403:
|
|
55
|
+
return "forbidden";
|
|
56
|
+
case 404:
|
|
57
|
+
return "not_found";
|
|
58
|
+
case 400:
|
|
59
|
+
case 422:
|
|
60
|
+
return "invalid_request";
|
|
61
|
+
case 409:
|
|
62
|
+
case 412:
|
|
63
|
+
return "conflict";
|
|
64
|
+
case 429:
|
|
65
|
+
return "rate_limited";
|
|
66
|
+
case 408:
|
|
67
|
+
case 504:
|
|
68
|
+
return "timeout";
|
|
69
|
+
case 502:
|
|
70
|
+
case 503:
|
|
71
|
+
return "unavailable";
|
|
72
|
+
default:
|
|
73
|
+
return "internal";
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
function classifyHostResponse(response) {
|
|
77
|
+
if (response.ok) {
|
|
78
|
+
return void 0;
|
|
79
|
+
}
|
|
80
|
+
if (isMcpErrorCode(response.mcpErrorCode)) {
|
|
81
|
+
return response.mcpErrorCode;
|
|
82
|
+
}
|
|
83
|
+
return typeof response.status === "number" ? mcpErrorCodeFromHttpStatus(response.status) : "internal";
|
|
84
|
+
}
|
|
85
|
+
function classifyHostError(err) {
|
|
86
|
+
if (err === null || typeof err !== "object") {
|
|
87
|
+
return "internal";
|
|
88
|
+
}
|
|
89
|
+
const candidate = err;
|
|
90
|
+
if (isMcpErrorCode(candidate.mcpErrorCode)) {
|
|
91
|
+
return candidate.mcpErrorCode;
|
|
92
|
+
}
|
|
93
|
+
const status = typeof candidate.status === "number" ? candidate.status : typeof candidate.statusCode === "number" ? candidate.statusCode : void 0;
|
|
94
|
+
if (status !== void 0) {
|
|
95
|
+
return mcpErrorCodeFromHttpStatus(status);
|
|
96
|
+
}
|
|
97
|
+
if (candidate.name === "AbortError" || candidate.name === "TimeoutError") {
|
|
98
|
+
return "timeout";
|
|
99
|
+
}
|
|
100
|
+
return "internal";
|
|
101
|
+
}
|
|
102
|
+
|
|
35
103
|
// src/host/version-skew.ts
|
|
36
104
|
var EXTENSION_VERSION_HEADER = "x-extension-version";
|
|
37
105
|
var EXTENSION_ACTIVE_VERSION_HEADER = "x-extension-active-version";
|
|
@@ -458,7 +526,11 @@ var WorkerRemoteDomTransport = class {
|
|
|
458
526
|
type: "ethisys:mcp:invokeTool:result",
|
|
459
527
|
ok: result.ok,
|
|
460
528
|
data: result.data,
|
|
461
|
-
error: result.error
|
|
529
|
+
error: result.error,
|
|
530
|
+
// A client that REPORTS failure rather than throwing lands here, which is the common
|
|
531
|
+
// shape for anything wrapping HTTP. Classifying only the thrown path left these
|
|
532
|
+
// arriving as `internal`.
|
|
533
|
+
code: classifyHostResponse(result)
|
|
462
534
|
});
|
|
463
535
|
} catch (err) {
|
|
464
536
|
this.replyError(message.id, "ethisys:mcp:invokeTool:result", err);
|
|
@@ -488,7 +560,11 @@ var WorkerRemoteDomTransport = class {
|
|
|
488
560
|
type: "ethisys:mcp:getResource:result",
|
|
489
561
|
ok: result.ok,
|
|
490
562
|
data: result.data,
|
|
491
|
-
error: result.error
|
|
563
|
+
error: result.error,
|
|
564
|
+
// A client that REPORTS failure rather than throwing lands here, which is the common
|
|
565
|
+
// shape for anything wrapping HTTP. Classifying only the thrown path left these
|
|
566
|
+
// arriving as `internal`.
|
|
567
|
+
code: classifyHostResponse(result)
|
|
492
568
|
});
|
|
493
569
|
} catch (err) {
|
|
494
570
|
this.replyError(message.id, "ethisys:mcp:getResource:result", err);
|
|
@@ -519,7 +595,11 @@ var WorkerRemoteDomTransport = class {
|
|
|
519
595
|
type: "ethisys:mcp:uploadDocument:result",
|
|
520
596
|
ok: result.ok,
|
|
521
597
|
data: result.data,
|
|
522
|
-
error: result.error
|
|
598
|
+
error: result.error,
|
|
599
|
+
// A client that REPORTS failure rather than throwing lands here, which is the common
|
|
600
|
+
// shape for anything wrapping HTTP. Classifying only the thrown path left these
|
|
601
|
+
// arriving as `internal`.
|
|
602
|
+
code: classifyHostResponse(result)
|
|
523
603
|
});
|
|
524
604
|
} catch (err) {
|
|
525
605
|
this.replyError(message.id, "ethisys:mcp:uploadDocument:result", err);
|
|
@@ -527,7 +607,7 @@ var WorkerRemoteDomTransport = class {
|
|
|
527
607
|
}
|
|
528
608
|
replyError(id, type, err) {
|
|
529
609
|
const message = err instanceof Error ? err.message : "MCP request failed";
|
|
530
|
-
this.safePostMessage({ id, type, ok: false, error: message });
|
|
610
|
+
this.safePostMessage({ id, type, ok: false, error: message, code: classifyHostError(err) });
|
|
531
611
|
}
|
|
532
612
|
};
|
|
533
613
|
|