@haex-space/vault-sdk 4.2.0 → 4.4.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/README.md +69 -0
- package/dist/cli/index.js +2 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/index.mjs +2 -1
- package/dist/cli/index.mjs.map +1 -1
- package/dist/{client-7bZyiRwE.d.mts → client-BCUfRZvU.d.mts} +261 -13
- package/dist/{client-BPwsH1so.d.ts → client-C44dqakd.d.ts} +261 -13
- package/dist/haex_bundle_bg.wasm +0 -0
- package/dist/index.d.mts +45 -6
- package/dist/index.d.ts +45 -6
- package/dist/index.js +342 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +339 -4
- package/dist/index.mjs.map +1 -1
- package/dist/node.d.mts +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/node.js +2 -1
- package/dist/node.js.map +1 -1
- package/dist/node.mjs +2 -1
- package/dist/node.mjs.map +1 -1
- package/dist/nuxt.js +10 -2
- package/dist/nuxt.js.map +1 -1
- package/dist/nuxt.mjs +10 -2
- package/dist/nuxt.mjs.map +1 -1
- package/dist/react.d.mts +2 -2
- package/dist/react.d.ts +2 -2
- package/dist/react.js +318 -3
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +318 -3
- package/dist/react.mjs.map +1 -1
- package/dist/runtime/nuxt.plugin.client.d.mts +2 -2
- package/dist/runtime/nuxt.plugin.client.d.ts +2 -2
- package/dist/runtime/nuxt.plugin.client.js +308 -3
- package/dist/runtime/nuxt.plugin.client.js.map +1 -1
- package/dist/runtime/nuxt.plugin.client.mjs +308 -3
- package/dist/runtime/nuxt.plugin.client.mjs.map +1 -1
- package/dist/svelte.d.mts +2 -2
- package/dist/svelte.d.ts +2 -2
- package/dist/svelte.js +318 -3
- package/dist/svelte.js.map +1 -1
- package/dist/svelte.mjs +318 -3
- package/dist/svelte.mjs.map +1 -1
- package/dist/{types-BwFKGH70.d.mts → types-DoNvKiW_.d.mts} +75 -1
- package/dist/{types-BwFKGH70.d.ts → types-DoNvKiW_.d.ts} +75 -1
- package/dist/vite.js +8 -1
- package/dist/vite.js.map +1 -1
- package/dist/vite.mjs +8 -1
- package/dist/vite.mjs.map +1 -1
- package/dist/vue.d.mts +2 -2
- package/dist/vue.d.ts +2 -2
- package/dist/vue.js +318 -3
- package/dist/vue.js.map +1 -1
- package/dist/vue.mjs +318 -3
- package/dist/vue.mjs.map +1 -1
- package/package.json +1 -1
package/dist/vue.mjs
CHANGED
|
@@ -308,7 +308,14 @@ var HAEXSPACE_MESSAGE_TYPES = {
|
|
|
308
308
|
*
|
|
309
309
|
* Payload: `{ type: PORT_READY }` — no data.
|
|
310
310
|
*/
|
|
311
|
-
PORT_READY: "haexspace:port:ready"
|
|
311
|
+
PORT_READY: "haexspace:port:ready",
|
|
312
|
+
/**
|
|
313
|
+
* One MCP message of the tool connection (holzi spec 018), in both directions over the
|
|
314
|
+
* MessagePort: the host calls the extension's tools, `sdk.tools` answers.
|
|
315
|
+
*
|
|
316
|
+
* Payload: `{ type: MCP, message }`, where `message` is a JSON-RPC 2.0 object.
|
|
317
|
+
*/
|
|
318
|
+
MCP: "haexspace:mcp"
|
|
312
319
|
};
|
|
313
320
|
|
|
314
321
|
// src/polyfills/debug.ts
|
|
@@ -646,6 +653,21 @@ var REMOTE_STORAGE_COMMANDS = {
|
|
|
646
653
|
list: "extension_remote_storage_list"
|
|
647
654
|
};
|
|
648
655
|
|
|
656
|
+
// src/commands/encryptedFolders.ts
|
|
657
|
+
init_esm_shims();
|
|
658
|
+
var ENCRYPTED_FOLDER_COMMANDS = {
|
|
659
|
+
/** Let the user pick an encrypted folder of a storage and grant access to it */
|
|
660
|
+
choose: "extension_encrypted_folder_choose",
|
|
661
|
+
/** List the entries of a folder inside an encrypted folder */
|
|
662
|
+
list: "extension_encrypted_folder_list",
|
|
663
|
+
/** Download and decrypt a file */
|
|
664
|
+
download: "extension_encrypted_folder_download",
|
|
665
|
+
/** Encrypt and upload a file */
|
|
666
|
+
upload: "extension_encrypted_folder_upload",
|
|
667
|
+
/** Delete a file or folder */
|
|
668
|
+
delete: "extension_encrypted_folder_delete"
|
|
669
|
+
};
|
|
670
|
+
|
|
649
671
|
// src/commands/localsend.ts
|
|
650
672
|
init_esm_shims();
|
|
651
673
|
var LOCALSEND_COMMANDS = {
|
|
@@ -1423,6 +1445,85 @@ var BackendManagement = class {
|
|
|
1423
1445
|
}
|
|
1424
1446
|
};
|
|
1425
1447
|
|
|
1448
|
+
// src/api/encryptedFolders.ts
|
|
1449
|
+
init_esm_shims();
|
|
1450
|
+
init_vaultKey();
|
|
1451
|
+
var EncryptedFoldersAPI = class {
|
|
1452
|
+
constructor(client) {
|
|
1453
|
+
this.client = client;
|
|
1454
|
+
}
|
|
1455
|
+
/**
|
|
1456
|
+
* Let the user choose one of the storage's encrypted folders and grant
|
|
1457
|
+
* access to it. The host shows its own window and waits for the answer.
|
|
1458
|
+
* Needs the `remoteStorage` permission for the storage (else 1002 without
|
|
1459
|
+
* asking); 1002 as well when the user refuses.
|
|
1460
|
+
* @param storageId - Storage the folder lies in
|
|
1461
|
+
* @param access - Access the extension asks for
|
|
1462
|
+
* @returns The chosen folder, or `null` when the user closed the chooser without choosing
|
|
1463
|
+
*/
|
|
1464
|
+
async choose(storageId, access) {
|
|
1465
|
+
const choice = await this.client.request(
|
|
1466
|
+
ENCRYPTED_FOLDER_COMMANDS.choose,
|
|
1467
|
+
{ request: { storageId, access } },
|
|
1468
|
+
// No deadline: the host waits for the user's answer in its window.
|
|
1469
|
+
{ timeout: null }
|
|
1470
|
+
);
|
|
1471
|
+
return choice ?? null;
|
|
1472
|
+
}
|
|
1473
|
+
/**
|
|
1474
|
+
* List a folder inside an encrypted folder (permission `read`).
|
|
1475
|
+
* @param storageId - Storage the folder lies in
|
|
1476
|
+
* @param folderId - Folder from {@link EncryptedFoldersAPI.choose}
|
|
1477
|
+
* @param path - Path relative to the encrypted folder; `''` (default) for its root
|
|
1478
|
+
* @returns The entries with their decrypted names
|
|
1479
|
+
*/
|
|
1480
|
+
async list(storageId, folderId, path2 = "") {
|
|
1481
|
+
const result = await this.client.request(
|
|
1482
|
+
ENCRYPTED_FOLDER_COMMANDS.list,
|
|
1483
|
+
{ request: { storageId, folderId, path: path2 } }
|
|
1484
|
+
);
|
|
1485
|
+
return result.entries;
|
|
1486
|
+
}
|
|
1487
|
+
/**
|
|
1488
|
+
* Download and decrypt a file (permission `read`).
|
|
1489
|
+
* @param storageId - Storage the folder lies in
|
|
1490
|
+
* @param folderId - Folder from {@link EncryptedFoldersAPI.choose}
|
|
1491
|
+
* @param path - Path of the file, relative to the encrypted folder
|
|
1492
|
+
* @returns The decrypted content
|
|
1493
|
+
*/
|
|
1494
|
+
async download(storageId, folderId, path2) {
|
|
1495
|
+
const base64 = await this.client.request(
|
|
1496
|
+
ENCRYPTED_FOLDER_COMMANDS.download,
|
|
1497
|
+
{ request: { storageId, folderId, path: path2 } }
|
|
1498
|
+
);
|
|
1499
|
+
return base64ToArrayBuffer(base64);
|
|
1500
|
+
}
|
|
1501
|
+
/**
|
|
1502
|
+
* Encrypt and upload a file (permission `readWrite`). Missing parent
|
|
1503
|
+
* folders are created.
|
|
1504
|
+
* @param storageId - Storage the folder lies in
|
|
1505
|
+
* @param folderId - Folder from {@link EncryptedFoldersAPI.choose}
|
|
1506
|
+
* @param path - Path of the file, relative to the encrypted folder
|
|
1507
|
+
* @param data - Content of the file
|
|
1508
|
+
*/
|
|
1509
|
+
async upload(storageId, folderId, path2, data) {
|
|
1510
|
+
await this.client.request(ENCRYPTED_FOLDER_COMMANDS.upload, {
|
|
1511
|
+
request: { storageId, folderId, path: path2, data: arrayBufferToBase64(data) }
|
|
1512
|
+
});
|
|
1513
|
+
}
|
|
1514
|
+
/**
|
|
1515
|
+
* Delete a file or folder (permission `readWrite`).
|
|
1516
|
+
* @param storageId - Storage the folder lies in
|
|
1517
|
+
* @param folderId - Folder from {@link EncryptedFoldersAPI.choose}
|
|
1518
|
+
* @param path - Path relative to the encrypted folder
|
|
1519
|
+
*/
|
|
1520
|
+
async delete(storageId, folderId, path2) {
|
|
1521
|
+
await this.client.request(ENCRYPTED_FOLDER_COMMANDS.delete, {
|
|
1522
|
+
request: { storageId, folderId, path: path2 }
|
|
1523
|
+
});
|
|
1524
|
+
}
|
|
1525
|
+
};
|
|
1526
|
+
|
|
1426
1527
|
// src/api/localsend.ts
|
|
1427
1528
|
init_esm_shims();
|
|
1428
1529
|
var LOCALSEND_EVENTS = {
|
|
@@ -2029,6 +2130,202 @@ var DialogAPI = class {
|
|
|
2029
2130
|
}
|
|
2030
2131
|
};
|
|
2031
2132
|
|
|
2133
|
+
// src/api/tools/index.ts
|
|
2134
|
+
init_esm_shims();
|
|
2135
|
+
|
|
2136
|
+
// src/api/tools/server.ts
|
|
2137
|
+
init_esm_shims();
|
|
2138
|
+
|
|
2139
|
+
// src/api/tools/schema.ts
|
|
2140
|
+
init_esm_shims();
|
|
2141
|
+
function fail(field, message) {
|
|
2142
|
+
return { ok: false, field, message };
|
|
2143
|
+
}
|
|
2144
|
+
function typeMatches(type, value) {
|
|
2145
|
+
switch (type) {
|
|
2146
|
+
case "object":
|
|
2147
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
2148
|
+
case "array":
|
|
2149
|
+
return Array.isArray(value);
|
|
2150
|
+
case "integer":
|
|
2151
|
+
return Number.isInteger(value);
|
|
2152
|
+
case "number":
|
|
2153
|
+
return typeof value === "number" && Number.isFinite(value);
|
|
2154
|
+
case "string":
|
|
2155
|
+
return typeof value === "string";
|
|
2156
|
+
case "boolean":
|
|
2157
|
+
return typeof value === "boolean";
|
|
2158
|
+
default:
|
|
2159
|
+
return false;
|
|
2160
|
+
}
|
|
2161
|
+
}
|
|
2162
|
+
function validateAt(schema, value, field) {
|
|
2163
|
+
if (!typeMatches(schema.type, value)) return fail(field, `expected ${String(schema.type)}`);
|
|
2164
|
+
if (schema.enum && !schema.enum.includes(value)) {
|
|
2165
|
+
return fail(field, `expected one of ${schema.enum.join(", ")}`);
|
|
2166
|
+
}
|
|
2167
|
+
if (schema.type === "array" && schema.items) {
|
|
2168
|
+
const items = value;
|
|
2169
|
+
for (let i = 0; i < items.length; i++) {
|
|
2170
|
+
const result = validateAt(schema.items, items[i], `${field}[${i}]`);
|
|
2171
|
+
if (!result.ok) return result;
|
|
2172
|
+
}
|
|
2173
|
+
}
|
|
2174
|
+
if (schema.type === "object") {
|
|
2175
|
+
const record = value;
|
|
2176
|
+
const properties = schema.properties ?? {};
|
|
2177
|
+
const prefix = field === "" ? "" : `${field}.`;
|
|
2178
|
+
if (schema.properties) {
|
|
2179
|
+
for (const key of Object.keys(record)) {
|
|
2180
|
+
if (!Object.hasOwn(properties, key)) return fail(`${prefix}${key}`, "unknown property");
|
|
2181
|
+
}
|
|
2182
|
+
}
|
|
2183
|
+
for (const key of schema.required ?? []) {
|
|
2184
|
+
if (record[key] === void 0) return fail(`${prefix}${key}`, "required");
|
|
2185
|
+
}
|
|
2186
|
+
for (const [key, child] of Object.entries(properties)) {
|
|
2187
|
+
if (record[key] === void 0) continue;
|
|
2188
|
+
const result = validateAt(child, record[key], `${prefix}${key}`);
|
|
2189
|
+
if (!result.ok) return result;
|
|
2190
|
+
}
|
|
2191
|
+
}
|
|
2192
|
+
return { ok: true };
|
|
2193
|
+
}
|
|
2194
|
+
function validateInput(schema, value) {
|
|
2195
|
+
return validateAt(schema, value, "");
|
|
2196
|
+
}
|
|
2197
|
+
|
|
2198
|
+
// src/api/tools/server.ts
|
|
2199
|
+
var PROTOCOL_VERSION = "2025-11-25";
|
|
2200
|
+
var METHOD_NOT_FOUND = -32601;
|
|
2201
|
+
var INVALID_PARAMS = -32602;
|
|
2202
|
+
function textResult(text, isError) {
|
|
2203
|
+
return { content: [{ type: "text", text }], isError };
|
|
2204
|
+
}
|
|
2205
|
+
function asText(value) {
|
|
2206
|
+
if (typeof value === "string") return value;
|
|
2207
|
+
if (value === void 0) return "";
|
|
2208
|
+
return JSON.stringify(value);
|
|
2209
|
+
}
|
|
2210
|
+
function isId(value) {
|
|
2211
|
+
return typeof value === "string" || typeof value === "number";
|
|
2212
|
+
}
|
|
2213
|
+
var ToolsServer = class {
|
|
2214
|
+
constructor(options) {
|
|
2215
|
+
this.options = options;
|
|
2216
|
+
this.running = /* @__PURE__ */ new Map();
|
|
2217
|
+
}
|
|
2218
|
+
/**
|
|
2219
|
+
* Handles one JSON-RPC message from the host. A tool call runs on its own and answers when it is
|
|
2220
|
+
* done, so a long call never holds up `ping` or the cancellation of that very call.
|
|
2221
|
+
*/
|
|
2222
|
+
async receive(message) {
|
|
2223
|
+
if (typeof message !== "object" || message === null) return;
|
|
2224
|
+
const { id, method, params } = message;
|
|
2225
|
+
if (typeof method !== "string") return;
|
|
2226
|
+
const args = typeof params === "object" && params !== null ? params : {};
|
|
2227
|
+
if (!isId(id)) {
|
|
2228
|
+
if (method === "notifications/cancelled" && isId(args.requestId)) {
|
|
2229
|
+
this.running.get(args.requestId)?.abort();
|
|
2230
|
+
}
|
|
2231
|
+
return;
|
|
2232
|
+
}
|
|
2233
|
+
switch (method) {
|
|
2234
|
+
case "initialize":
|
|
2235
|
+
return this.reply(id, {
|
|
2236
|
+
protocolVersion: PROTOCOL_VERSION,
|
|
2237
|
+
capabilities: { tools: {} },
|
|
2238
|
+
serverInfo: {
|
|
2239
|
+
name: this.options.manifest?.name ?? "",
|
|
2240
|
+
version: this.options.manifest?.version ?? ""
|
|
2241
|
+
}
|
|
2242
|
+
});
|
|
2243
|
+
case "ping":
|
|
2244
|
+
return this.reply(id, {});
|
|
2245
|
+
case "tools/list": {
|
|
2246
|
+
const tools = this.tools().map(({ name, title, description, inputSchema }) => ({
|
|
2247
|
+
name,
|
|
2248
|
+
title: title.en,
|
|
2249
|
+
description,
|
|
2250
|
+
inputSchema
|
|
2251
|
+
}));
|
|
2252
|
+
return this.reply(id, { tools });
|
|
2253
|
+
}
|
|
2254
|
+
case "tools/call":
|
|
2255
|
+
void this.call(id, args);
|
|
2256
|
+
return;
|
|
2257
|
+
default:
|
|
2258
|
+
return this.error(id, METHOD_NOT_FOUND, method);
|
|
2259
|
+
}
|
|
2260
|
+
}
|
|
2261
|
+
/** The declared tools that have a handler. */
|
|
2262
|
+
tools() {
|
|
2263
|
+
return (this.options.manifest?.tools ?? []).filter((tool) => this.options.handlers.has(tool.name));
|
|
2264
|
+
}
|
|
2265
|
+
async call(id, params) {
|
|
2266
|
+
const tool = this.tools().find((candidate) => candidate.name === params.name);
|
|
2267
|
+
const handler = tool && this.options.handlers.get(tool.name);
|
|
2268
|
+
if (!tool || !handler) return this.error(id, INVALID_PARAMS, `unknown tool ${String(params.name)}`);
|
|
2269
|
+
const input = params.arguments ?? {};
|
|
2270
|
+
const checked = validateInput(tool.inputSchema, input);
|
|
2271
|
+
if (!checked.ok) {
|
|
2272
|
+
return this.reply(id, textResult(`invalid input: ${checked.field}: ${checked.message}`, true));
|
|
2273
|
+
}
|
|
2274
|
+
const controller = new AbortController();
|
|
2275
|
+
this.running.set(id, controller);
|
|
2276
|
+
let result;
|
|
2277
|
+
try {
|
|
2278
|
+
const output = await handler(input, { signal: controller.signal });
|
|
2279
|
+
result = textResult(asText(output), false);
|
|
2280
|
+
} catch (error) {
|
|
2281
|
+
result = textResult(error instanceof Error ? error.message : String(error), true);
|
|
2282
|
+
} finally {
|
|
2283
|
+
this.running.delete(id);
|
|
2284
|
+
}
|
|
2285
|
+
if (!controller.signal.aborted) this.reply(id, result);
|
|
2286
|
+
}
|
|
2287
|
+
reply(id, result) {
|
|
2288
|
+
this.options.send({ jsonrpc: "2.0", id, result });
|
|
2289
|
+
}
|
|
2290
|
+
error(id, code, message) {
|
|
2291
|
+
this.options.send({ jsonrpc: "2.0", id, error: { code, message } });
|
|
2292
|
+
}
|
|
2293
|
+
};
|
|
2294
|
+
|
|
2295
|
+
// src/api/tools/index.ts
|
|
2296
|
+
var ToolsAPI = class {
|
|
2297
|
+
constructor(options) {
|
|
2298
|
+
this.options = options;
|
|
2299
|
+
this.handlers = /* @__PURE__ */ new Map();
|
|
2300
|
+
const manifest = options.manifest;
|
|
2301
|
+
this.server = new ToolsServer({
|
|
2302
|
+
get manifest() {
|
|
2303
|
+
return manifest();
|
|
2304
|
+
},
|
|
2305
|
+
handlers: this.handlers,
|
|
2306
|
+
send: options.send
|
|
2307
|
+
});
|
|
2308
|
+
}
|
|
2309
|
+
/**
|
|
2310
|
+
* Runs `handler` when the host calls the tool `name`. The tool must be declared in the manifest.
|
|
2311
|
+
* Returns a function that unregisters the handler; the host then no longer sees the tool.
|
|
2312
|
+
*/
|
|
2313
|
+
register(name, handler) {
|
|
2314
|
+
const declared = this.options.manifest()?.tools?.some((tool) => tool.name === name) ?? false;
|
|
2315
|
+
if (!declared) {
|
|
2316
|
+
throw new Error(`The tool ${name} is not declared in the manifest's tools`);
|
|
2317
|
+
}
|
|
2318
|
+
this.handlers.set(name, handler);
|
|
2319
|
+
return () => {
|
|
2320
|
+
if (this.handlers.get(name) === handler) this.handlers.delete(name);
|
|
2321
|
+
};
|
|
2322
|
+
}
|
|
2323
|
+
/** Handles one MCP message from the host. Called by the SDK for `haexspace:mcp` port messages. */
|
|
2324
|
+
receive(message) {
|
|
2325
|
+
return this.server.receive(message);
|
|
2326
|
+
}
|
|
2327
|
+
};
|
|
2328
|
+
|
|
2032
2329
|
// src/client/tableName.ts
|
|
2033
2330
|
init_esm_shims();
|
|
2034
2331
|
function validatePublicKey(publicKey) {
|
|
@@ -2410,7 +2707,11 @@ function createMessageHandler(config, pendingRequests, extensionInfo2, onEvent)
|
|
|
2410
2707
|
}
|
|
2411
2708
|
};
|
|
2412
2709
|
}
|
|
2413
|
-
function processEvent(event, log, eventListeners, onContextChanged, onExternalRequest, onActionRequest) {
|
|
2710
|
+
function processEvent(event, log, eventListeners, onContextChanged, onExternalRequest, onActionRequest, onMcpMessage) {
|
|
2711
|
+
if (event.type === HAEXSPACE_MESSAGE_TYPES.MCP) {
|
|
2712
|
+
onMcpMessage?.(event.message);
|
|
2713
|
+
return;
|
|
2714
|
+
}
|
|
2414
2715
|
if (event.type === HAEXTENSION_EVENTS.CONTEXT_CHANGED) {
|
|
2415
2716
|
const contextEvent = event;
|
|
2416
2717
|
onContextChanged(contextEvent.data.context);
|
|
@@ -2682,6 +2983,7 @@ var HaexVaultSdk = class {
|
|
|
2682
2983
|
this.web = new WebAPI(this);
|
|
2683
2984
|
this.permissions = new PermissionsAPI(this);
|
|
2684
2985
|
this.remoteStorage = new RemoteStorageAPI(this);
|
|
2986
|
+
this.encryptedFolders = new EncryptedFoldersAPI(this);
|
|
2685
2987
|
this.localsend = new LocalSendAPI(this);
|
|
2686
2988
|
this.spaces = new SpacesAPI(this);
|
|
2687
2989
|
this.shell = new ShellAPI(this);
|
|
@@ -2690,6 +2992,10 @@ var HaexVaultSdk = class {
|
|
|
2690
2992
|
this.notifications = new NotificationsAPI(this);
|
|
2691
2993
|
this.tab = new TabAPI(this);
|
|
2692
2994
|
this.dialog = new DialogAPI(this);
|
|
2995
|
+
this.tools = new ToolsAPI({
|
|
2996
|
+
manifest: () => this.config.manifest,
|
|
2997
|
+
send: (message) => this.sendMcpMessage(message)
|
|
2998
|
+
});
|
|
2693
2999
|
installConsoleForwarding(this.config.debug);
|
|
2694
3000
|
this.on(HAEXTENSION_EVENTS.PERMISSION_RESOLVED, (event) => {
|
|
2695
3001
|
const data = event.data;
|
|
@@ -2997,9 +3303,18 @@ var HaexVaultSdk = class {
|
|
|
2997
3303
|
this.notifySubscribersInternal();
|
|
2998
3304
|
},
|
|
2999
3305
|
(extEvent) => this.handleExternalRequestInternal(extEvent.data),
|
|
3000
|
-
(actionEvent) => this.handleActionRequestInternal(actionEvent.data)
|
|
3306
|
+
(actionEvent) => this.handleActionRequestInternal(actionEvent.data),
|
|
3307
|
+
(message) => void this.tools.receive(message)
|
|
3001
3308
|
);
|
|
3002
3309
|
}
|
|
3310
|
+
/** Sends one MCP message of the tool connection to the host on the port. */
|
|
3311
|
+
sendMcpMessage(message) {
|
|
3312
|
+
if (!this.hostPort) {
|
|
3313
|
+
this.log("Dropped an MCP message: no host port yet");
|
|
3314
|
+
return;
|
|
3315
|
+
}
|
|
3316
|
+
this.hostPort.postMessage({ type: HAEXSPACE_MESSAGE_TYPES.MCP, message });
|
|
3317
|
+
}
|
|
3003
3318
|
async handleExternalRequestInternal(request) {
|
|
3004
3319
|
await handleExternalRequest(request, this.externalRequestHandlers, this.respondToExternalRequest.bind(this), this.log.bind(this));
|
|
3005
3320
|
}
|