@ethisyscore/extension-runtime 1.116.1 → 1.118.0
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 +90 -1
- package/dist/host/index.cjs.map +1 -1
- package/dist/host/index.d.cts +10 -2
- package/dist/host/index.d.ts +10 -2
- package/dist/host/index.js +90 -1
- package/dist/host/index.js.map +1 -1
- package/dist/mock-host/cli.cjs +50 -1
- 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 +50 -1
- package/dist/mock-host/cli.js.map +1 -1
- package/dist/plugin/index.cjs +11 -1
- package/dist/plugin/index.cjs.map +1 -1
- package/dist/plugin/index.js +11 -1
- package/dist/plugin/index.js.map +1 -1
- package/dist/{transport-Cjpb_qPo.d.cts → transport-DDPhdaXn.d.cts} +28 -0
- package/dist/{transport-B9mwIXYs.d.ts → transport-pNTjXJ3R.d.ts} +28 -0
- package/package.json +2 -2
package/dist/host/index.cjs
CHANGED
|
@@ -685,6 +685,9 @@ var WorkerRemoteDomTransport = class {
|
|
|
685
685
|
case "ethisys:mcp:invokeTool":
|
|
686
686
|
this.dispatchMcp(message, "ethisys:mcp:invokeTool:result", (m) => this.handleInvokeTool(m));
|
|
687
687
|
return;
|
|
688
|
+
case "ethisys:mcp:invokeOperation":
|
|
689
|
+
this.dispatchMcp(message, "ethisys:mcp:invokeOperation:result", (m) => this.handleInvokeOperation(m));
|
|
690
|
+
return;
|
|
688
691
|
case "ethisys:mcp:getResource":
|
|
689
692
|
this.dispatchMcp(message, "ethisys:mcp:getResource:result", (m) => this.handleGetResource(m));
|
|
690
693
|
return;
|
|
@@ -782,6 +785,47 @@ var WorkerRemoteDomTransport = class {
|
|
|
782
785
|
} catch {
|
|
783
786
|
}
|
|
784
787
|
}
|
|
788
|
+
/**
|
|
789
|
+
* The module-address twin of {@link handleInvokeTool}. Identical in every respect a reader
|
|
790
|
+
* should care about - same token mint, same disposed-before-token short circuit, same
|
|
791
|
+
* token-never-crosses-the-port rule - and deliberately NOT folded into one method with a
|
|
792
|
+
* branch: the two differ only in the request kind they build, and a shared method would put
|
|
793
|
+
* that branch inside the one place where getting the token handling wrong is unrecoverable.
|
|
794
|
+
*/
|
|
795
|
+
async handleInvokeOperation(message) {
|
|
796
|
+
let token;
|
|
797
|
+
try {
|
|
798
|
+
token = await this.capabilityTokenProvider();
|
|
799
|
+
} catch (err) {
|
|
800
|
+
this.replyError(message.id, "ethisys:mcp:invokeOperation:result", err);
|
|
801
|
+
return;
|
|
802
|
+
}
|
|
803
|
+
if (this.disposed) {
|
|
804
|
+
return;
|
|
805
|
+
}
|
|
806
|
+
try {
|
|
807
|
+
const result = await this.mcpClient.fetch({
|
|
808
|
+
kind: "invokeOperation",
|
|
809
|
+
moduleKey: message.moduleKey,
|
|
810
|
+
operationKey: message.operationKey,
|
|
811
|
+
fallbackToolName: message.fallbackToolName,
|
|
812
|
+
args: message.args,
|
|
813
|
+
capabilityToken: token,
|
|
814
|
+
signal: this.requestSignal(message.id)
|
|
815
|
+
});
|
|
816
|
+
this.reportVersionSkew(result);
|
|
817
|
+
this.safePostMessage({
|
|
818
|
+
id: message.id,
|
|
819
|
+
type: "ethisys:mcp:invokeOperation:result",
|
|
820
|
+
ok: result.ok,
|
|
821
|
+
data: result.data,
|
|
822
|
+
error: result.error,
|
|
823
|
+
code: classifyHostResponse(result)
|
|
824
|
+
});
|
|
825
|
+
} catch (err) {
|
|
826
|
+
this.replyError(message.id, "ethisys:mcp:invokeOperation:result", err);
|
|
827
|
+
}
|
|
828
|
+
}
|
|
785
829
|
async handleInvokeTool(message) {
|
|
786
830
|
let token;
|
|
787
831
|
try {
|
|
@@ -894,6 +938,7 @@ var WorkerRemoteDomTransport = class {
|
|
|
894
938
|
var IFRAME_BRIDGE_PROTOCOL = "ethisys.iframe.bridge.v1";
|
|
895
939
|
var InboundEnvelope = zod.z.discriminatedUnion("type", [
|
|
896
940
|
zod.z.object({ type: zod.z.literal("ethisys:mcp:invokeTool"), id: zod.z.string().min(1), name: zod.z.string().min(1), args: zod.z.unknown(), nonce: zod.z.string() }),
|
|
941
|
+
zod.z.object({ type: zod.z.literal("ethisys:mcp:invokeOperation"), id: zod.z.string().min(1), moduleKey: zod.z.string().min(1), operationKey: zod.z.string().min(1), fallbackToolName: zod.z.string().min(1), args: zod.z.unknown(), nonce: zod.z.string() }),
|
|
897
942
|
zod.z.object({ type: zod.z.literal("ethisys:mcp:getResource"), id: zod.z.string().min(1), uri: zod.z.string().min(1), nonce: zod.z.string() }),
|
|
898
943
|
zod.z.object({ type: zod.z.literal("ethisys:event"), name: zod.z.string().min(1), payload: zod.z.unknown(), nonce: zod.z.string() })
|
|
899
944
|
]);
|
|
@@ -1021,7 +1066,7 @@ var IframeBridgeTransport = class {
|
|
|
1021
1066
|
}
|
|
1022
1067
|
if (this.isRateLimited()) {
|
|
1023
1068
|
this.onSecurityEvent?.({ reason: "rate-limit-exceeded", type: message.type });
|
|
1024
|
-
if (message.type === "ethisys:mcp:invokeTool" || message.type === "ethisys:mcp:getResource") {
|
|
1069
|
+
if (message.type === "ethisys:mcp:invokeTool" || message.type === "ethisys:mcp:invokeOperation" || message.type === "ethisys:mcp:getResource") {
|
|
1025
1070
|
this.safePostMessage({
|
|
1026
1071
|
id: message.id,
|
|
1027
1072
|
type: `${message.type}:result`,
|
|
@@ -1035,6 +1080,9 @@ var IframeBridgeTransport = class {
|
|
|
1035
1080
|
case "ethisys:mcp:invokeTool":
|
|
1036
1081
|
this.dispatchMcp(message, "ethisys:mcp:invokeTool:result", (m) => this.handleInvokeTool(m));
|
|
1037
1082
|
return;
|
|
1083
|
+
case "ethisys:mcp:invokeOperation":
|
|
1084
|
+
this.dispatchMcp(message, "ethisys:mcp:invokeOperation:result", (m) => this.handleInvokeOperation(m));
|
|
1085
|
+
return;
|
|
1038
1086
|
case "ethisys:mcp:getResource":
|
|
1039
1087
|
this.dispatchMcp(message, "ethisys:mcp:getResource:result", (m) => this.handleGetResource(m));
|
|
1040
1088
|
return;
|
|
@@ -1069,6 +1117,47 @@ var IframeBridgeTransport = class {
|
|
|
1069
1117
|
this.inFlightMcpRequests = Math.max(0, this.inFlightMcpRequests - 1);
|
|
1070
1118
|
});
|
|
1071
1119
|
}
|
|
1120
|
+
/**
|
|
1121
|
+
* The module-address twin of {@link handleInvokeTool}: same token mint, same
|
|
1122
|
+
* disposed-before-token short circuit, same rule that no token ever rides the reply. Kept as its
|
|
1123
|
+
* own method rather than a branch inside invokeTool, because the two differ only in the request
|
|
1124
|
+
* they build and a shared body would put that branch in the one place where mishandling the
|
|
1125
|
+
* token is unrecoverable.
|
|
1126
|
+
*/
|
|
1127
|
+
async handleInvokeOperation(message) {
|
|
1128
|
+
let token;
|
|
1129
|
+
try {
|
|
1130
|
+
token = await this.capabilityTokenProvider();
|
|
1131
|
+
} catch (err) {
|
|
1132
|
+
this.replyError(message.id, "ethisys:mcp:invokeOperation:result", err);
|
|
1133
|
+
return;
|
|
1134
|
+
}
|
|
1135
|
+
if (this.disposed) {
|
|
1136
|
+
return;
|
|
1137
|
+
}
|
|
1138
|
+
try {
|
|
1139
|
+
const result = await this.mcpClient.fetch({
|
|
1140
|
+
kind: "invokeOperation",
|
|
1141
|
+
moduleKey: message.moduleKey,
|
|
1142
|
+
operationKey: message.operationKey,
|
|
1143
|
+
fallbackToolName: message.fallbackToolName,
|
|
1144
|
+
args: message.args,
|
|
1145
|
+
capabilityToken: token,
|
|
1146
|
+
signal: this.abortController.signal
|
|
1147
|
+
});
|
|
1148
|
+
this.reportVersionSkew(result);
|
|
1149
|
+
this.safePostMessage({
|
|
1150
|
+
id: message.id,
|
|
1151
|
+
type: "ethisys:mcp:invokeOperation:result",
|
|
1152
|
+
ok: result.ok,
|
|
1153
|
+
data: result.data,
|
|
1154
|
+
error: result.error,
|
|
1155
|
+
code: classifyHostResponse(result)
|
|
1156
|
+
});
|
|
1157
|
+
} catch (err) {
|
|
1158
|
+
this.replyError(message.id, "ethisys:mcp:invokeOperation:result", err);
|
|
1159
|
+
}
|
|
1160
|
+
}
|
|
1072
1161
|
async handleInvokeTool(message) {
|
|
1073
1162
|
let token;
|
|
1074
1163
|
try {
|