@ethisyscore/extension-runtime 1.135.0 → 1.137.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.
Files changed (34) hide show
  1. package/README.md +2 -2
  2. package/dist/MockPluginStorage-BM3bq99B.d.cts +35 -0
  3. package/dist/MockPluginStorage-BndTX2RR.d.ts +35 -0
  4. package/dist/{bridge-client-RJOl8WlU.d.ts → bridge-client-CkxYcZcm.d.ts} +1 -1
  5. package/dist/{bridge-client-D9EYFq1l.d.cts → bridge-client-DkogtCvn.d.cts} +1 -1
  6. package/dist/{bridge-envelopes-M5a42rAy.d.cts → bridge-envelopes-BcKu-nQm.d.cts} +72 -1
  7. package/dist/{bridge-envelopes-M5a42rAy.d.ts → bridge-envelopes-BcKu-nQm.d.ts} +72 -1
  8. package/dist/host/index.cjs +57 -2
  9. package/dist/host/index.cjs.map +1 -1
  10. package/dist/host/index.d.cts +3 -3
  11. package/dist/host/index.d.ts +3 -3
  12. package/dist/host/index.js +57 -2
  13. package/dist/host/index.js.map +1 -1
  14. package/dist/mock-host/cli.cjs +273 -7
  15. package/dist/mock-host/cli.cjs.map +1 -1
  16. package/dist/mock-host/cli.d.cts +10 -3
  17. package/dist/mock-host/cli.d.ts +10 -3
  18. package/dist/mock-host/cli.js +272 -8
  19. package/dist/mock-host/cli.js.map +1 -1
  20. package/dist/mock-host/index.cjs +236 -1
  21. package/dist/mock-host/index.cjs.map +1 -1
  22. package/dist/mock-host/index.d.cts +14 -4
  23. package/dist/mock-host/index.d.ts +14 -4
  24. package/dist/mock-host/index.js +236 -2
  25. package/dist/mock-host/index.js.map +1 -1
  26. package/dist/plugin/index.cjs +378 -100
  27. package/dist/plugin/index.cjs.map +1 -1
  28. package/dist/plugin/index.d.cts +171 -6
  29. package/dist/plugin/index.d.ts +171 -6
  30. package/dist/plugin/index.js +366 -101
  31. package/dist/plugin/index.js.map +1 -1
  32. package/dist/{transport-UaoDRdm3.d.cts → transport-D1lE-5nt.d.cts} +30 -3
  33. package/dist/{transport-CFzJQiFG.d.ts → transport-INVtDo2s.d.ts} +30 -3
  34. package/package.json +1 -1
@@ -11,7 +11,347 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
11
11
 
12
12
  var ReactReconciler__default = /*#__PURE__*/_interopDefault(ReactReconciler);
13
13
 
14
- // src/plugin/ExtensionRuntimeProvider.tsx
14
+ // src/bridge/mcp-error.ts
15
+ var MCP_ERROR_CODES = [
16
+ "unauthorized",
17
+ "forbidden",
18
+ "not_found",
19
+ "invalid_request",
20
+ "conflict",
21
+ "rate_limited",
22
+ "timeout",
23
+ "unavailable",
24
+ "internal"
25
+ ];
26
+ function isMcpErrorCode(value) {
27
+ return typeof value === "string" && MCP_ERROR_CODES.includes(value);
28
+ }
29
+ var RETRYABLE = ["rate_limited", "timeout", "unavailable"];
30
+ function isRetryableMcpErrorCode(code) {
31
+ return RETRYABLE.includes(code);
32
+ }
33
+ var McpToolError = class extends Error {
34
+ /** Machine-readable classification. `internal` when the host sent none. */
35
+ code;
36
+ /**
37
+ * Marks the instance for {@link isMcpToolError}. A structural marker rather than a prototype
38
+ * check because the error can be constructed in one bundle and inspected in another, where
39
+ * `instanceof` compares two different class objects and answers false.
40
+ */
41
+ isMcpToolError = true;
42
+ constructor(message, code = "internal") {
43
+ super(message);
44
+ this.name = "McpHostError";
45
+ this.code = code;
46
+ }
47
+ /** True when this failure is worth retrying unchanged. */
48
+ get retryable() {
49
+ return isRetryableMcpErrorCode(this.code);
50
+ }
51
+ };
52
+ function isMcpToolError(value) {
53
+ return value instanceof McpToolError || value !== null && typeof value === "object" && value.isMcpToolError === true && isMcpErrorCode(value.code);
54
+ }
55
+ function mcpErrorCodeFromHttpStatus(status) {
56
+ switch (status) {
57
+ case 401:
58
+ return "unauthorized";
59
+ case 403:
60
+ return "forbidden";
61
+ case 404:
62
+ return "not_found";
63
+ case 400:
64
+ case 422:
65
+ return "invalid_request";
66
+ case 409:
67
+ case 412:
68
+ return "conflict";
69
+ case 429:
70
+ return "rate_limited";
71
+ case 408:
72
+ case 504:
73
+ return "timeout";
74
+ case 502:
75
+ case 503:
76
+ return "unavailable";
77
+ default:
78
+ return "internal";
79
+ }
80
+ }
81
+ function classifyHostResponse(response) {
82
+ if (response.ok) {
83
+ return void 0;
84
+ }
85
+ if (isMcpErrorCode(response.mcpErrorCode)) {
86
+ return response.mcpErrorCode;
87
+ }
88
+ return typeof response.status === "number" ? mcpErrorCodeFromHttpStatus(response.status) : "internal";
89
+ }
90
+ function classifyHostError(err) {
91
+ if (err === null || typeof err !== "object") {
92
+ return "internal";
93
+ }
94
+ const candidate = err;
95
+ if (isMcpErrorCode(candidate.mcpErrorCode)) {
96
+ return candidate.mcpErrorCode;
97
+ }
98
+ const status = typeof candidate.status === "number" ? candidate.status : typeof candidate.statusCode === "number" ? candidate.statusCode : void 0;
99
+ if (status !== void 0) {
100
+ return mcpErrorCodeFromHttpStatus(status);
101
+ }
102
+ if (candidate.name === "AbortError" || candidate.name === "TimeoutError") {
103
+ return "timeout";
104
+ }
105
+ return "internal";
106
+ }
107
+
108
+ // src/plugin/pluginStorageUpload.ts
109
+ var PLUGIN_STORAGE_UPLOAD_MAX_BYTES = 30 * 1024 * 1024;
110
+ var PLUGIN_STORAGE_PREFIX_MAX_LENGTH = 84;
111
+ var PLUGIN_STORAGE_PATH_MAX_LENGTH = 128;
112
+ var PluginStorageUploadError = class extends McpToolError {
113
+ /** What went wrong, in terms a caller branches on. */
114
+ reason;
115
+ /** HTTP status from the server, when the host surfaced one. */
116
+ status;
117
+ /** Structural marker for {@link isPluginStorageUploadError}. */
118
+ isPluginStorageUploadError = true;
119
+ constructor(message, reason, options = {}) {
120
+ super(message, options.code ?? codeForReason(reason, options.status));
121
+ this.name = "PluginStorageUploadError";
122
+ this.reason = reason;
123
+ this.status = options.status;
124
+ }
125
+ };
126
+ function isPluginStorageUploadError(value) {
127
+ return value instanceof PluginStorageUploadError || isMcpToolError(value) && value.isPluginStorageUploadError === true;
128
+ }
129
+ function pluginStorageUploadReasonFromStatus(status) {
130
+ switch (status) {
131
+ case 400:
132
+ return "invalid_prefix";
133
+ case 401:
134
+ return "unauthorized";
135
+ case 403:
136
+ return "forbidden";
137
+ case 413:
138
+ return "too_large";
139
+ case 408:
140
+ return "timeout";
141
+ case 415:
142
+ return "unsupported_type";
143
+ case 503:
144
+ return "busy";
145
+ case 507:
146
+ return "quota_exceeded";
147
+ case 500:
148
+ return "storage_failed";
149
+ default:
150
+ return "unknown";
151
+ }
152
+ }
153
+ function toPluginStorageUploadError(err) {
154
+ if (isPluginStorageUploadError(err)) {
155
+ return err;
156
+ }
157
+ const message = err instanceof Error ? err.message : typeof err === "string" ? err : "Plugin storage upload failed";
158
+ const candidate = err !== null && typeof err === "object" ? err : {};
159
+ const status = typeof candidate.status === "number" ? candidate.status : typeof candidate.statusCode === "number" ? candidate.statusCode : void 0;
160
+ if (status !== void 0) {
161
+ return new PluginStorageUploadError(message, pluginStorageUploadReasonFromStatus(status), { status });
162
+ }
163
+ if (candidate.name === "AbortError") {
164
+ return new PluginStorageUploadError(message, "aborted", { code: "timeout" });
165
+ }
166
+ if (isMcpToolError(err)) {
167
+ return new PluginStorageUploadError(message, reasonForCode(err.code), { code: err.code });
168
+ }
169
+ return new PluginStorageUploadError(message, "unknown");
170
+ }
171
+ function validatePluginStoragePrefix(raw) {
172
+ if (typeof raw !== "string" || raw.trim().length === 0) {
173
+ return { ok: false, error: "A storage path prefix is required." };
174
+ }
175
+ if (raw.length > PLUGIN_STORAGE_PREFIX_MAX_LENGTH) {
176
+ return {
177
+ ok: false,
178
+ error: `The storage path prefix must be at most ${PLUGIN_STORAGE_PREFIX_MAX_LENGTH} characters, so the stored path fits ${PLUGIN_STORAGE_PATH_MAX_LENGTH}.`
179
+ };
180
+ }
181
+ if (!/^[A-Za-z0-9_\-/]+$/.test(raw)) {
182
+ return {
183
+ ok: false,
184
+ error: "The storage path prefix may contain only letters, digits, '-', '_' and '/' separators."
185
+ };
186
+ }
187
+ if (raw.split("/").some((segment) => segment.length === 0)) {
188
+ return {
189
+ ok: false,
190
+ error: "The storage path prefix must not start or end with '/' or contain an empty segment."
191
+ };
192
+ }
193
+ return { ok: true, prefix: raw };
194
+ }
195
+ function assertValidPluginStoragePrefix(raw) {
196
+ const result = validatePluginStoragePrefix(raw);
197
+ if (!result.ok) {
198
+ throw new PluginStorageUploadError(result.error, "invalid_prefix");
199
+ }
200
+ return result.prefix;
201
+ }
202
+ var PLUGIN_STORAGE_UPLOAD_CONTENT_TYPES = Object.freeze({
203
+ pdf: ["application/pdf"],
204
+ png: ["image/png"],
205
+ jpg: ["image/jpeg", "image/pjpeg", "image/jpg"],
206
+ jpeg: ["image/jpeg", "image/pjpeg", "image/jpg"],
207
+ gif: ["image/gif"],
208
+ webp: ["image/webp"],
209
+ doc: ["application/msword"],
210
+ docx: ["application/vnd.openxmlformats-officedocument.wordprocessingml.document"],
211
+ xls: ["application/vnd.ms-excel"],
212
+ xlsx: ["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],
213
+ ppt: ["application/vnd.ms-powerpoint"],
214
+ pptx: ["application/vnd.openxmlformats-officedocument.presentationml.presentation"],
215
+ odt: ["application/vnd.oasis.opendocument.text"],
216
+ ods: ["application/vnd.oasis.opendocument.spreadsheet"],
217
+ odp: ["application/vnd.oasis.opendocument.presentation"],
218
+ txt: ["text/plain"],
219
+ csv: ["text/csv", "application/vnd.ms-excel", "application/csv", "text/plain"],
220
+ zip: ["application/zip", "application/x-zip-compressed", "application/x-zip"],
221
+ mp3: ["audio/mpeg", "audio/mp3"],
222
+ m4a: ["audio/mp4", "audio/x-m4a"],
223
+ mp4: ["video/mp4"]
224
+ });
225
+ var OCTET_STREAM = "application/octet-stream";
226
+ function pluginStorageSafeExtension(fileName) {
227
+ if (typeof fileName !== "string" || fileName.trim().length === 0) {
228
+ return "";
229
+ }
230
+ const leaf = fileName.split(/[\\/]/).pop() ?? "";
231
+ const dot = leaf.lastIndexOf(".");
232
+ if (dot < 0) {
233
+ return "";
234
+ }
235
+ const body = leaf.slice(dot + 1);
236
+ return /^[A-Za-z0-9]{1,10}$/.test(body) ? `.${body.toLowerCase()}` : "";
237
+ }
238
+ function resolvePluginStorageContentType(fileName, declaredContentType) {
239
+ const extension = pluginStorageSafeExtension(fileName).slice(1);
240
+ const allowed = extension.length > 0 && Object.prototype.hasOwnProperty.call(PLUGIN_STORAGE_UPLOAD_CONTENT_TYPES, extension) ? PLUGIN_STORAGE_UPLOAD_CONTENT_TYPES[extension] : void 0;
241
+ if (allowed === void 0) {
242
+ return {
243
+ ok: false,
244
+ error: "This file type is not allowed. Allowed: " + Object.keys(PLUGIN_STORAGE_UPLOAD_CONTENT_TYPES).sort().join(", ") + "."
245
+ };
246
+ }
247
+ const declared = mediaTypeOf(declaredContentType);
248
+ if (declared === void 0 || declared === OCTET_STREAM || allowed.includes(declared)) {
249
+ return { ok: true, contentType: allowed[0] };
250
+ }
251
+ return {
252
+ ok: false,
253
+ error: `The declared content type '${declared}' does not match the file extension '.${extension}'.`
254
+ };
255
+ }
256
+ function mediaTypeOf(raw) {
257
+ if (typeof raw !== "string") {
258
+ return void 0;
259
+ }
260
+ const mediaType = raw.split(";")[0].trim().toLowerCase();
261
+ return /^[a-z0-9!#$&^_.+-]+\/[a-z0-9!#$&^_.+-]+$/.test(mediaType) ? mediaType : void 0;
262
+ }
263
+ async function uploadFileToPluginStorage(transport, file, options) {
264
+ if (typeof transport.uploadToStorage !== "function") {
265
+ throw new PluginStorageUploadError(
266
+ "The active McpTransport does not support plugin-storage uploads (no `uploadToStorage`). The host runtime must implement the uploadToStorage request kind.",
267
+ "unsupported"
268
+ );
269
+ }
270
+ const uploadToStorage = transport.uploadToStorage.bind(transport);
271
+ const pathPrefix = assertValidPluginStoragePrefix(options.pathPrefix);
272
+ const maxSizeBytes = Math.min(options.maxSizeBytes ?? PLUGIN_STORAGE_UPLOAD_MAX_BYTES, PLUGIN_STORAGE_UPLOAD_MAX_BYTES);
273
+ const isBuffer = file instanceof ArrayBuffer || Object.prototype.toString.call(file) === "[object ArrayBuffer]";
274
+ const size = isBuffer ? file.byteLength : file.size;
275
+ if (size > maxSizeBytes) {
276
+ throw new PluginStorageUploadError(
277
+ `File is ${size} bytes, which exceeds the ${maxSizeBytes}-byte upload limit.`,
278
+ "too_large"
279
+ );
280
+ }
281
+ const ownName = isBuffer ? void 0 : file.name;
282
+ const fileName = nonEmpty(options.fileName) ?? (typeof ownName === "string" ? nonEmpty(ownName) : void 0) ?? "upload.bin";
283
+ const declaredType = nonEmpty(options.contentType) ?? (isBuffer ? void 0 : nonEmpty(file.type));
284
+ const resolvedType = resolvePluginStorageContentType(fileName, declaredType);
285
+ if (!resolvedType.ok) {
286
+ throw new PluginStorageUploadError(resolvedType.error, "unsupported_type");
287
+ }
288
+ if (options.signal?.aborted === true) {
289
+ throw new PluginStorageUploadError("Aborted", "aborted", { code: "timeout" });
290
+ }
291
+ try {
292
+ const buffer = isBuffer ? file : await readBlob(file);
293
+ const meta = {
294
+ pathPrefix,
295
+ fileName,
296
+ // The canonical type for the extension: always one the server accepts, and the one
297
+ // it stores.
298
+ contentType: resolvedType.contentType,
299
+ sizeBytes: buffer.byteLength
300
+ };
301
+ return await uploadToStorage(meta, buffer, options.signal);
302
+ } catch (err) {
303
+ throw toPluginStorageUploadError(err);
304
+ }
305
+ }
306
+ function readBlob(blob) {
307
+ if (typeof blob.arrayBuffer === "function") {
308
+ return blob.arrayBuffer();
309
+ }
310
+ return new Promise((resolve, reject) => {
311
+ const reader = new FileReader();
312
+ reader.onload = () => resolve(reader.result);
313
+ reader.onerror = () => reject(reader.error ?? new Error("Could not read the file."));
314
+ reader.readAsArrayBuffer(blob);
315
+ });
316
+ }
317
+ function nonEmpty(value) {
318
+ return typeof value === "string" && value.length > 0 ? value : void 0;
319
+ }
320
+ function codeForReason(reason, status) {
321
+ if (status !== void 0) {
322
+ return mcpErrorCodeFromHttpStatus(status);
323
+ }
324
+ switch (reason) {
325
+ case "invalid_prefix":
326
+ case "too_large":
327
+ case "unsupported_type":
328
+ return "invalid_request";
329
+ case "timeout":
330
+ return "timeout";
331
+ case "unauthorized":
332
+ return "unauthorized";
333
+ case "forbidden":
334
+ return "forbidden";
335
+ case "busy":
336
+ return "unavailable";
337
+ case "aborted":
338
+ return "timeout";
339
+ default:
340
+ return "internal";
341
+ }
342
+ }
343
+ function reasonForCode(code) {
344
+ switch (code) {
345
+ case "unauthorized":
346
+ return "unauthorized";
347
+ case "forbidden":
348
+ return "forbidden";
349
+ case "unavailable":
350
+ return "busy";
351
+ default:
352
+ return "unknown";
353
+ }
354
+ }
15
355
  var ClientPushContext = react.createContext(null);
16
356
  function useClientPushSubscription(options) {
17
357
  const { groups, onEvent, onResync, enabled = true } = options;
@@ -568,100 +908,6 @@ function defaultConnectionFactory(port) {
568
908
  };
569
909
  }
570
910
 
571
- // src/bridge/mcp-error.ts
572
- var MCP_ERROR_CODES = [
573
- "unauthorized",
574
- "forbidden",
575
- "not_found",
576
- "invalid_request",
577
- "conflict",
578
- "rate_limited",
579
- "timeout",
580
- "unavailable",
581
- "internal"
582
- ];
583
- function isMcpErrorCode(value) {
584
- return typeof value === "string" && MCP_ERROR_CODES.includes(value);
585
- }
586
- var RETRYABLE = ["rate_limited", "timeout", "unavailable"];
587
- function isRetryableMcpErrorCode(code) {
588
- return RETRYABLE.includes(code);
589
- }
590
- var McpToolError = class extends Error {
591
- /** Machine-readable classification. `internal` when the host sent none. */
592
- code;
593
- /**
594
- * Marks the instance for {@link isMcpToolError}. A structural marker rather than a prototype
595
- * check because the error can be constructed in one bundle and inspected in another, where
596
- * `instanceof` compares two different class objects and answers false.
597
- */
598
- isMcpToolError = true;
599
- constructor(message, code = "internal") {
600
- super(message);
601
- this.name = "McpHostError";
602
- this.code = code;
603
- }
604
- /** True when this failure is worth retrying unchanged. */
605
- get retryable() {
606
- return isRetryableMcpErrorCode(this.code);
607
- }
608
- };
609
- function isMcpToolError(value) {
610
- return value instanceof McpToolError || value !== null && typeof value === "object" && value.isMcpToolError === true && isMcpErrorCode(value.code);
611
- }
612
- function mcpErrorCodeFromHttpStatus(status) {
613
- switch (status) {
614
- case 401:
615
- return "unauthorized";
616
- case 403:
617
- return "forbidden";
618
- case 404:
619
- return "not_found";
620
- case 400:
621
- case 422:
622
- return "invalid_request";
623
- case 409:
624
- case 412:
625
- return "conflict";
626
- case 429:
627
- return "rate_limited";
628
- case 408:
629
- case 504:
630
- return "timeout";
631
- case 502:
632
- case 503:
633
- return "unavailable";
634
- default:
635
- return "internal";
636
- }
637
- }
638
- function classifyHostResponse(response) {
639
- if (response.ok) {
640
- return void 0;
641
- }
642
- if (isMcpErrorCode(response.mcpErrorCode)) {
643
- return response.mcpErrorCode;
644
- }
645
- return typeof response.status === "number" ? mcpErrorCodeFromHttpStatus(response.status) : "internal";
646
- }
647
- function classifyHostError(err) {
648
- if (err === null || typeof err !== "object") {
649
- return "internal";
650
- }
651
- const candidate = err;
652
- if (isMcpErrorCode(candidate.mcpErrorCode)) {
653
- return candidate.mcpErrorCode;
654
- }
655
- const status = typeof candidate.status === "number" ? candidate.status : typeof candidate.statusCode === "number" ? candidate.statusCode : void 0;
656
- if (status !== void 0) {
657
- return mcpErrorCodeFromHttpStatus(status);
658
- }
659
- if (candidate.name === "AbortError" || candidate.name === "TimeoutError") {
660
- return "timeout";
661
- }
662
- return "internal";
663
- }
664
-
665
911
  // src/plugin/createPortMcpTransport.ts
666
912
  var WIRE_INVOKE_TOOL_REQUEST = "ethisys:mcp:invokeTool";
667
913
  var WIRE_INVOKE_TOOL_RESULT = "ethisys:mcp:invokeTool:result";
@@ -671,13 +917,15 @@ var WIRE_GET_RESOURCE_REQUEST = "ethisys:mcp:getResource";
671
917
  var WIRE_GET_RESOURCE_RESULT = "ethisys:mcp:getResource:result";
672
918
  var WIRE_UPLOAD_DOCUMENT_REQUEST = "ethisys:mcp:uploadDocument";
673
919
  var WIRE_UPLOAD_DOCUMENT_RESULT = "ethisys:mcp:uploadDocument:result";
920
+ var WIRE_UPLOAD_TO_STORAGE_REQUEST = "ethisys:mcp:uploadToStorage";
921
+ var WIRE_UPLOAD_TO_STORAGE_RESULT = "ethisys:mcp:uploadToStorage:result";
674
922
  var WIRE_ABORT = "ethisys:mcp:abort";
675
923
  function isMcpResultEnvelope(value) {
676
924
  if (value === null || typeof value !== "object") {
677
925
  return false;
678
926
  }
679
927
  const v = value;
680
- return (v.type === WIRE_INVOKE_TOOL_RESULT || v.type === WIRE_INVOKE_OPERATION_RESULT || v.type === WIRE_GET_RESOURCE_RESULT || v.type === WIRE_UPLOAD_DOCUMENT_RESULT) && typeof v.id === "string";
928
+ return (v.type === WIRE_INVOKE_TOOL_RESULT || v.type === WIRE_INVOKE_OPERATION_RESULT || v.type === WIRE_GET_RESOURCE_RESULT || v.type === WIRE_UPLOAD_DOCUMENT_RESULT || v.type === WIRE_UPLOAD_TO_STORAGE_RESULT) && typeof v.id === "string";
681
929
  }
682
930
  function createPortMcpTransport(port, options = {}) {
683
931
  if (port === void 0 || port === null) {
@@ -701,10 +949,18 @@ function createPortMcpTransport(port, options = {}) {
701
949
  if (reply.ok === true) {
702
950
  resolver.resolve(reply.data);
703
951
  } else {
704
- resolver.reject(new McpToolError(
705
- typeof reply.error === "string" ? reply.error : "Unknown host error",
706
- isMcpErrorCode(reply.code) ? reply.code : "internal"
707
- ));
952
+ const message = typeof reply.error === "string" ? reply.error : "Unknown host error";
953
+ const code = isMcpErrorCode(reply.code) ? reply.code : "internal";
954
+ if (reply.type === WIRE_UPLOAD_TO_STORAGE_RESULT) {
955
+ const status = typeof reply.status === "number" && Number.isInteger(reply.status) ? reply.status : void 0;
956
+ resolver.reject(new PluginStorageUploadError(
957
+ message,
958
+ status !== void 0 ? pluginStorageUploadReasonFromStatus(status) : "unknown",
959
+ { status, code }
960
+ ));
961
+ return;
962
+ }
963
+ resolver.reject(new McpToolError(message, code));
708
964
  }
709
965
  }
710
966
  shim.addEventListener("message", onMessage);
@@ -762,6 +1018,15 @@ function createPortMcpTransport(port, options = {}) {
762
1018
  [buffer]
763
1019
  );
764
1020
  return data;
1021
+ },
1022
+ async uploadToStorage(meta, buffer, signal) {
1023
+ const data = await send(
1024
+ WIRE_UPLOAD_TO_STORAGE_REQUEST,
1025
+ { meta, buffer },
1026
+ signal,
1027
+ [buffer]
1028
+ );
1029
+ return data;
765
1030
  }
766
1031
  };
767
1032
  }
@@ -1022,7 +1287,13 @@ exports.ExtensionRuntimeProvider = ExtensionRuntimeProvider;
1022
1287
  exports.HostIdentityContext = HostIdentityContext;
1023
1288
  exports.MCP_ERROR_CODES = MCP_ERROR_CODES;
1024
1289
  exports.McpToolError = McpToolError;
1290
+ exports.PLUGIN_STORAGE_PATH_MAX_LENGTH = PLUGIN_STORAGE_PATH_MAX_LENGTH;
1291
+ exports.PLUGIN_STORAGE_PREFIX_MAX_LENGTH = PLUGIN_STORAGE_PREFIX_MAX_LENGTH;
1292
+ exports.PLUGIN_STORAGE_UPLOAD_CONTENT_TYPES = PLUGIN_STORAGE_UPLOAD_CONTENT_TYPES;
1293
+ exports.PLUGIN_STORAGE_UPLOAD_MAX_BYTES = PLUGIN_STORAGE_UPLOAD_MAX_BYTES;
1025
1294
  exports.PluginRealtimeContext = PluginRealtimeContext;
1295
+ exports.PluginStorageUploadError = PluginStorageUploadError;
1296
+ exports.assertValidPluginStoragePrefix = assertValidPluginStoragePrefix;
1026
1297
  exports.classifyHostError = classifyHostError;
1027
1298
  exports.classifyHostResponse = classifyHostResponse;
1028
1299
  exports.createPortBridgeClient = createPortBridgeClient;
@@ -1033,9 +1304,15 @@ exports.defineDeclarativePlugin = defineDeclarativePlugin;
1033
1304
  exports.defineEthisysPlugin = defineEthisysPlugin;
1034
1305
  exports.isMcpErrorCode = isMcpErrorCode;
1035
1306
  exports.isMcpToolError = isMcpToolError;
1307
+ exports.isPluginStorageUploadError = isPluginStorageUploadError;
1036
1308
  exports.isRetryableMcpErrorCode = isRetryableMcpErrorCode;
1037
1309
  exports.mcpErrorCodeFromHttpStatus = mcpErrorCodeFromHttpStatus;
1310
+ exports.pluginStorageSafeExtension = pluginStorageSafeExtension;
1311
+ exports.pluginStorageUploadReasonFromStatus = pluginStorageUploadReasonFromStatus;
1312
+ exports.resolvePluginStorageContentType = resolvePluginStorageContentType;
1313
+ exports.toPluginStorageUploadError = toPluginStorageUploadError;
1038
1314
  exports.unwrapItems = unwrapItems;
1315
+ exports.uploadFileToPluginStorage = uploadFileToPluginStorage;
1039
1316
  exports.useAuth = useAuth;
1040
1317
  exports.useBridgeClient = useBridgeClient;
1041
1318
  exports.useBridgeLocale = useBridgeLocale;
@@ -1051,5 +1328,6 @@ exports.useModuleQuery = useModuleQuery;
1051
1328
  exports.useModuleTool = useModuleTool;
1052
1329
  exports.useOptionalExtensionRuntimeTransport = useOptionalExtensionRuntimeTransport;
1053
1330
  exports.usePluginRealtimeSource = usePluginRealtimeSource;
1331
+ exports.validatePluginStoragePrefix = validatePluginStoragePrefix;
1054
1332
  //# sourceMappingURL=index.cjs.map
1055
1333
  //# sourceMappingURL=index.cjs.map