@lvce-editor/chat-tool-worker 8.4.0 → 8.5.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/chatToolWorkerMain.js +207 -50
- package/package.json +1 -1
|
@@ -407,6 +407,9 @@ const IpcChildWithModuleWorkerAndMessagePort$1 = {
|
|
|
407
407
|
listen: listen$6,
|
|
408
408
|
wrap: wrap$e
|
|
409
409
|
};
|
|
410
|
+
const Error$3 = 1;
|
|
411
|
+
const Open = 2;
|
|
412
|
+
const Close = 3;
|
|
410
413
|
const addListener = (emitter, type, callback) => {
|
|
411
414
|
if ('addEventListener' in emitter) {
|
|
412
415
|
emitter.addEventListener(type, callback);
|
|
@@ -501,6 +504,66 @@ const IpcParentWithMessagePort$1 = {
|
|
|
501
504
|
signal: signal$1,
|
|
502
505
|
wrap: wrap$5
|
|
503
506
|
};
|
|
507
|
+
const stringifyCompact = value => {
|
|
508
|
+
return JSON.stringify(value);
|
|
509
|
+
};
|
|
510
|
+
const parse = content => {
|
|
511
|
+
if (content === 'undefined') {
|
|
512
|
+
return null;
|
|
513
|
+
}
|
|
514
|
+
try {
|
|
515
|
+
return JSON.parse(content);
|
|
516
|
+
} catch (error) {
|
|
517
|
+
throw new VError(error, 'failed to parse json');
|
|
518
|
+
}
|
|
519
|
+
};
|
|
520
|
+
const waitForWebSocketToBeOpen = webSocket => {
|
|
521
|
+
return getFirstEvent(webSocket, {
|
|
522
|
+
close: Close,
|
|
523
|
+
error: Error$3,
|
|
524
|
+
open: Open
|
|
525
|
+
});
|
|
526
|
+
};
|
|
527
|
+
const create$c = async ({
|
|
528
|
+
webSocket
|
|
529
|
+
}) => {
|
|
530
|
+
const firstWebSocketEvent = await waitForWebSocketToBeOpen(webSocket);
|
|
531
|
+
if (firstWebSocketEvent.type === Error$3) {
|
|
532
|
+
throw new IpcError(`WebSocket connection error`);
|
|
533
|
+
}
|
|
534
|
+
if (firstWebSocketEvent.type === Close) {
|
|
535
|
+
throw new IpcError('Websocket connection was immediately closed');
|
|
536
|
+
}
|
|
537
|
+
return webSocket;
|
|
538
|
+
};
|
|
539
|
+
class IpcParentWithWebSocket extends Ipc {
|
|
540
|
+
getData(event) {
|
|
541
|
+
return parse(event.data);
|
|
542
|
+
}
|
|
543
|
+
send(message) {
|
|
544
|
+
this._rawIpc.send(stringifyCompact(message));
|
|
545
|
+
}
|
|
546
|
+
sendAndTransfer(message) {
|
|
547
|
+
throw new Error('sendAndTransfer not supported');
|
|
548
|
+
}
|
|
549
|
+
dispose() {
|
|
550
|
+
this._rawIpc.close();
|
|
551
|
+
}
|
|
552
|
+
onClose(callback) {
|
|
553
|
+
this._rawIpc.addEventListener('close', callback);
|
|
554
|
+
}
|
|
555
|
+
onMessage(callback) {
|
|
556
|
+
this._rawIpc.addEventListener('message', callback);
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
const wrap = webSocket => {
|
|
560
|
+
return new IpcParentWithWebSocket(webSocket);
|
|
561
|
+
};
|
|
562
|
+
const IpcParentWithWebSocket$1 = {
|
|
563
|
+
__proto__: null,
|
|
564
|
+
create: create$c,
|
|
565
|
+
wrap
|
|
566
|
+
};
|
|
504
567
|
|
|
505
568
|
class CommandNotFoundError extends Error {
|
|
506
569
|
constructor(command) {
|
|
@@ -737,7 +800,7 @@ const getErrorResponse = (id, error, preparePrettyError, logError) => {
|
|
|
737
800
|
const errorProperty = getErrorProperty(error, prettyError);
|
|
738
801
|
return create$1$1(id, errorProperty);
|
|
739
802
|
};
|
|
740
|
-
const create$
|
|
803
|
+
const create$b = (message, result) => {
|
|
741
804
|
return {
|
|
742
805
|
id: message.id,
|
|
743
806
|
jsonrpc: Two$1,
|
|
@@ -746,7 +809,7 @@ const create$9 = (message, result) => {
|
|
|
746
809
|
};
|
|
747
810
|
const getSuccessResponse = (message, result) => {
|
|
748
811
|
const resultProperty = result ?? null;
|
|
749
|
-
return create$
|
|
812
|
+
return create$b(message, resultProperty);
|
|
750
813
|
};
|
|
751
814
|
const getErrorResponseSimple = (id, error) => {
|
|
752
815
|
return {
|
|
@@ -840,7 +903,7 @@ const handleJsonRpcMessage = async (...args) => {
|
|
|
840
903
|
|
|
841
904
|
const Two = '2.0';
|
|
842
905
|
|
|
843
|
-
const create$
|
|
906
|
+
const create$a = (method, params) => {
|
|
844
907
|
return {
|
|
845
908
|
jsonrpc: Two,
|
|
846
909
|
method,
|
|
@@ -848,7 +911,7 @@ const create$8 = (method, params) => {
|
|
|
848
911
|
};
|
|
849
912
|
};
|
|
850
913
|
|
|
851
|
-
const create$
|
|
914
|
+
const create$9 = (id, method, params) => {
|
|
852
915
|
const message = {
|
|
853
916
|
id,
|
|
854
917
|
jsonrpc: Two,
|
|
@@ -859,12 +922,12 @@ const create$7 = (id, method, params) => {
|
|
|
859
922
|
};
|
|
860
923
|
|
|
861
924
|
let id = 0;
|
|
862
|
-
const create$
|
|
925
|
+
const create$8 = () => {
|
|
863
926
|
return ++id;
|
|
864
927
|
};
|
|
865
928
|
|
|
866
929
|
const registerPromise = map => {
|
|
867
|
-
const id = create$
|
|
930
|
+
const id = create$8();
|
|
868
931
|
const {
|
|
869
932
|
promise,
|
|
870
933
|
resolve
|
|
@@ -881,7 +944,7 @@ const invokeHelper = async (callbacks, ipc, method, params, useSendAndTransfer)
|
|
|
881
944
|
id,
|
|
882
945
|
promise
|
|
883
946
|
} = registerPromise(callbacks);
|
|
884
|
-
const message = create$
|
|
947
|
+
const message = create$9(id, method, params);
|
|
885
948
|
if (useSendAndTransfer && ipc.sendAndTransfer) {
|
|
886
949
|
ipc.sendAndTransfer(message);
|
|
887
950
|
} else {
|
|
@@ -917,7 +980,7 @@ const createRpc = ipc => {
|
|
|
917
980
|
* @deprecated
|
|
918
981
|
*/
|
|
919
982
|
send(method, ...params) {
|
|
920
|
-
const message = create$
|
|
983
|
+
const message = create$a(method, params);
|
|
921
984
|
ipc.send(message);
|
|
922
985
|
}
|
|
923
986
|
};
|
|
@@ -957,7 +1020,7 @@ const listen$1 = async (module, options) => {
|
|
|
957
1020
|
return ipc;
|
|
958
1021
|
};
|
|
959
1022
|
|
|
960
|
-
const create$
|
|
1023
|
+
const create$7 = async ({
|
|
961
1024
|
commandMap,
|
|
962
1025
|
isMessagePortOpen = true,
|
|
963
1026
|
messagePort
|
|
@@ -975,7 +1038,7 @@ const create$5 = async ({
|
|
|
975
1038
|
return rpc;
|
|
976
1039
|
};
|
|
977
1040
|
|
|
978
|
-
const create$
|
|
1041
|
+
const create$6 = async ({
|
|
979
1042
|
commandMap,
|
|
980
1043
|
isMessagePortOpen,
|
|
981
1044
|
send
|
|
@@ -985,7 +1048,7 @@ const create$4 = async ({
|
|
|
985
1048
|
port2
|
|
986
1049
|
} = new MessageChannel();
|
|
987
1050
|
await send(port1);
|
|
988
|
-
return create$
|
|
1051
|
+
return create$7({
|
|
989
1052
|
commandMap,
|
|
990
1053
|
isMessagePortOpen,
|
|
991
1054
|
messagePort: port2
|
|
@@ -1020,13 +1083,13 @@ const createSharedLazyRpc = factory => {
|
|
|
1020
1083
|
};
|
|
1021
1084
|
};
|
|
1022
1085
|
|
|
1023
|
-
const create$
|
|
1086
|
+
const create$5 = async ({
|
|
1024
1087
|
commandMap,
|
|
1025
1088
|
isMessagePortOpen,
|
|
1026
1089
|
send
|
|
1027
1090
|
}) => {
|
|
1028
1091
|
return createSharedLazyRpc(() => {
|
|
1029
|
-
return create$
|
|
1092
|
+
return create$6({
|
|
1030
1093
|
commandMap,
|
|
1031
1094
|
isMessagePortOpen,
|
|
1032
1095
|
send
|
|
@@ -1034,6 +1097,56 @@ const create$3 = async ({
|
|
|
1034
1097
|
});
|
|
1035
1098
|
};
|
|
1036
1099
|
|
|
1100
|
+
const Https = 'https:';
|
|
1101
|
+
const Ws = 'ws:';
|
|
1102
|
+
const Wss = 'wss:';
|
|
1103
|
+
|
|
1104
|
+
const getWebSocketProtocol = locationProtocol => {
|
|
1105
|
+
return locationProtocol === Https ? Wss : Ws;
|
|
1106
|
+
};
|
|
1107
|
+
|
|
1108
|
+
const getWebSocketUrl = (type, host, locationProtocol) => {
|
|
1109
|
+
const wsProtocol = getWebSocketProtocol(locationProtocol);
|
|
1110
|
+
return `${wsProtocol}//${host}/websocket/${type}`;
|
|
1111
|
+
};
|
|
1112
|
+
|
|
1113
|
+
const getHost = () => {
|
|
1114
|
+
return location.host;
|
|
1115
|
+
};
|
|
1116
|
+
const getProtocol = () => {
|
|
1117
|
+
return location.protocol;
|
|
1118
|
+
};
|
|
1119
|
+
|
|
1120
|
+
const create$4 = async ({
|
|
1121
|
+
commandMap,
|
|
1122
|
+
webSocket
|
|
1123
|
+
}) => {
|
|
1124
|
+
// TODO create a commandMap per rpc instance
|
|
1125
|
+
register(commandMap);
|
|
1126
|
+
const rawIpc = await IpcParentWithWebSocket$1.create({
|
|
1127
|
+
webSocket
|
|
1128
|
+
});
|
|
1129
|
+
const ipc = IpcParentWithWebSocket$1.wrap(rawIpc);
|
|
1130
|
+
handleIpc(ipc);
|
|
1131
|
+
const rpc = createRpc(ipc);
|
|
1132
|
+
return rpc;
|
|
1133
|
+
};
|
|
1134
|
+
|
|
1135
|
+
const create$3 = async ({
|
|
1136
|
+
commandMap,
|
|
1137
|
+
type
|
|
1138
|
+
}) => {
|
|
1139
|
+
const host = getHost();
|
|
1140
|
+
const protocol = getProtocol();
|
|
1141
|
+
const wsUrl = getWebSocketUrl(type, host, protocol);
|
|
1142
|
+
const webSocket = new WebSocket(wsUrl);
|
|
1143
|
+
const rpc = await create$4({
|
|
1144
|
+
commandMap,
|
|
1145
|
+
webSocket
|
|
1146
|
+
});
|
|
1147
|
+
return rpc;
|
|
1148
|
+
};
|
|
1149
|
+
|
|
1037
1150
|
const create$2 = async ({
|
|
1038
1151
|
commandMap,
|
|
1039
1152
|
messagePort
|
|
@@ -1080,7 +1193,7 @@ const createMockRpc = ({
|
|
|
1080
1193
|
};
|
|
1081
1194
|
|
|
1082
1195
|
const rpcs = Object.create(null);
|
|
1083
|
-
const set$
|
|
1196
|
+
const set$4 = (id, rpc) => {
|
|
1084
1197
|
rpcs[id] = rpc;
|
|
1085
1198
|
};
|
|
1086
1199
|
const get = id => {
|
|
@@ -1113,7 +1226,7 @@ const create = rpcId => {
|
|
|
1113
1226
|
const mockRpc = createMockRpc({
|
|
1114
1227
|
commandMap
|
|
1115
1228
|
});
|
|
1116
|
-
set$
|
|
1229
|
+
set$4(rpcId, mockRpc);
|
|
1117
1230
|
// @ts-ignore
|
|
1118
1231
|
mockRpc[Symbol.dispose] = () => {
|
|
1119
1232
|
remove(rpcId);
|
|
@@ -1122,7 +1235,7 @@ const create = rpcId => {
|
|
|
1122
1235
|
return mockRpc;
|
|
1123
1236
|
},
|
|
1124
1237
|
set(rpc) {
|
|
1125
|
-
set$
|
|
1238
|
+
set$4(rpcId, rpc);
|
|
1126
1239
|
}
|
|
1127
1240
|
};
|
|
1128
1241
|
};
|
|
@@ -1131,53 +1244,66 @@ const Directory = 3;
|
|
|
1131
1244
|
const File = 7;
|
|
1132
1245
|
const Symlink = 9;
|
|
1133
1246
|
|
|
1247
|
+
const Electron = 2;
|
|
1248
|
+
const Remote = 3;
|
|
1249
|
+
|
|
1134
1250
|
const ChatStorageWorker = 6003;
|
|
1135
1251
|
const FileSystemWorker = 209;
|
|
1136
1252
|
const RendererWorker = 1;
|
|
1253
|
+
const TerminalProcess = 7;
|
|
1137
1254
|
|
|
1138
1255
|
const {
|
|
1139
|
-
set: set$
|
|
1256
|
+
set: set$3
|
|
1140
1257
|
} = create(ChatStorageWorker);
|
|
1141
1258
|
|
|
1142
1259
|
const {
|
|
1143
|
-
invoke: invoke$
|
|
1144
|
-
set: set$
|
|
1260
|
+
invoke: invoke$2,
|
|
1261
|
+
set: set$2
|
|
1145
1262
|
} = create(FileSystemWorker);
|
|
1146
1263
|
const readDirWithFileTypes = async uri => {
|
|
1147
|
-
return invoke$
|
|
1264
|
+
return invoke$2('FileSystem.readDirWithFileTypes', uri);
|
|
1148
1265
|
};
|
|
1149
1266
|
const readFile$1 = async uri => {
|
|
1150
|
-
return invoke$
|
|
1267
|
+
return invoke$2('FileSystem.readFile', uri);
|
|
1151
1268
|
};
|
|
1152
1269
|
const writeFile$1 = async (uri, content) => {
|
|
1153
|
-
return invoke$
|
|
1270
|
+
return invoke$2('FileSystem.writeFile', uri, content);
|
|
1154
1271
|
};
|
|
1155
1272
|
const exists = async uri => {
|
|
1156
|
-
return invoke$
|
|
1273
|
+
return invoke$2('FileSystem.exists', uri);
|
|
1157
1274
|
};
|
|
1158
1275
|
|
|
1159
1276
|
const {
|
|
1160
|
-
invoke,
|
|
1277
|
+
invoke: invoke$1,
|
|
1161
1278
|
invokeAndTransfer,
|
|
1162
|
-
set
|
|
1279
|
+
set: set$1
|
|
1163
1280
|
} = create(RendererWorker);
|
|
1281
|
+
const sendMessagePortToTerminalProcess = async (port, rpcId) => {
|
|
1282
|
+
const command = 'HandleMessagePortForTerminalProcess.handleMessagePortForTerminalProcess';
|
|
1283
|
+
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToTerminalProcess', port, command, rpcId);
|
|
1284
|
+
};
|
|
1164
1285
|
const sendMessagePortToFileSystemWorker = async (port, rpcId) => {
|
|
1165
1286
|
const command = 'FileSystem.handleMessagePort';
|
|
1166
1287
|
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToFileSystemWorker', port, command, rpcId);
|
|
1167
1288
|
};
|
|
1168
1289
|
const readFile = async uri => {
|
|
1169
|
-
return invoke('FileSystem.readFile', uri);
|
|
1290
|
+
return invoke$1('FileSystem.readFile', uri);
|
|
1170
1291
|
};
|
|
1171
1292
|
const sendMessagePortToChatStorageWorker = async port => {
|
|
1172
1293
|
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToChatStorageWorker', port, 'HandleMessagePort.handleMessagePort');
|
|
1173
1294
|
};
|
|
1174
1295
|
const writeFile = async (uri, text) => {
|
|
1175
|
-
await invoke('FileSystem.writeFile', uri, text);
|
|
1296
|
+
await invoke$1('FileSystem.writeFile', uri, text);
|
|
1176
1297
|
};
|
|
1177
1298
|
const getWorkspacePath = () => {
|
|
1178
|
-
return invoke('Workspace.getPath');
|
|
1299
|
+
return invoke$1('Workspace.getPath');
|
|
1179
1300
|
};
|
|
1180
1301
|
|
|
1302
|
+
const {
|
|
1303
|
+
invoke,
|
|
1304
|
+
set
|
|
1305
|
+
} = create(TerminalProcess);
|
|
1306
|
+
|
|
1181
1307
|
const getToolErrorPayload = error => {
|
|
1182
1308
|
const rawStack = error && typeof error === 'object' ? Reflect.get(error, 'stack') : undefined;
|
|
1183
1309
|
return {
|
|
@@ -1191,7 +1317,7 @@ const getToolErrorPayload = error => {
|
|
|
1191
1317
|
|
|
1192
1318
|
const executeClosePreviewTool = async (_args, _options) => {
|
|
1193
1319
|
try {
|
|
1194
|
-
await invoke('Preview.close');
|
|
1320
|
+
await invoke$1('Preview.close');
|
|
1195
1321
|
return {
|
|
1196
1322
|
ok: true
|
|
1197
1323
|
};
|
|
@@ -1220,7 +1346,7 @@ const executeCreateDirectoryTool = async (args, _options) => {
|
|
|
1220
1346
|
};
|
|
1221
1347
|
}
|
|
1222
1348
|
try {
|
|
1223
|
-
await invoke('FileSystem.mkdir', uri);
|
|
1349
|
+
await invoke$1('FileSystem.mkdir', uri);
|
|
1224
1350
|
return {
|
|
1225
1351
|
ok: true,
|
|
1226
1352
|
uri
|
|
@@ -1705,7 +1831,7 @@ const getSearchDir = (workspaceUri, includePattern) => {
|
|
|
1705
1831
|
};
|
|
1706
1832
|
|
|
1707
1833
|
const executeFileGrepSearch = async (workspaceUri, grepSearchArgs) => {
|
|
1708
|
-
const result = await invoke('SearchProcess.invoke', 'TextSearch.search', {
|
|
1834
|
+
const result = await invoke$1('SearchProcess.invoke', 'TextSearch.search', {
|
|
1709
1835
|
maxSearchResults: grepSearchArgs.maxResults,
|
|
1710
1836
|
ripGrepArgs: getRipGrepArgs(grepSearchArgs),
|
|
1711
1837
|
searchDir: getSearchDir(workspaceUri, grepSearchArgs.includePattern)
|
|
@@ -1757,7 +1883,7 @@ const executeMemoryGrepSearch = async (workspaceUri, grepSearchArgs, options) =>
|
|
|
1757
1883
|
useRegularExpression: grepSearchArgs.isRegexp
|
|
1758
1884
|
};
|
|
1759
1885
|
try {
|
|
1760
|
-
const result = await invoke('ExtensionHostTextSearch.textSearchMemory2', searchOptions.scheme, workspaceUri, grepSearchArgs.query, searchOptions, options.assetDir);
|
|
1886
|
+
const result = await invoke$1('ExtensionHostTextSearch.textSearchMemory2', searchOptions.scheme, workspaceUri, grepSearchArgs.query, searchOptions, options.assetDir);
|
|
1761
1887
|
return {
|
|
1762
1888
|
arguments: grepSearchArgs,
|
|
1763
1889
|
result: formatLegacyMemorySearchResults(result.results || [], grepSearchArgs.outputFormat),
|
|
@@ -1767,7 +1893,7 @@ const executeMemoryGrepSearch = async (workspaceUri, grepSearchArgs, options) =>
|
|
|
1767
1893
|
} : {})
|
|
1768
1894
|
};
|
|
1769
1895
|
} catch {
|
|
1770
|
-
const legacyResults = await invoke('ExtensionHostTextSearch.textSearchMemory', searchOptions.scheme, workspaceUri, grepSearchArgs.query, searchOptions, options.assetDir);
|
|
1896
|
+
const legacyResults = await invoke$1('ExtensionHostTextSearch.textSearchMemory', searchOptions.scheme, workspaceUri, grepSearchArgs.query, searchOptions, options.assetDir);
|
|
1771
1897
|
return {
|
|
1772
1898
|
arguments: grepSearchArgs,
|
|
1773
1899
|
result: isLegacyMemorySearchResult(legacyResults) ? formatLegacyMemorySearchResults(legacyResults, grepSearchArgs.outputFormat) : 'No matches found.',
|
|
@@ -1872,7 +1998,7 @@ const executeListFilesTool = async (args, _options) => {
|
|
|
1872
1998
|
};
|
|
1873
1999
|
}
|
|
1874
2000
|
try {
|
|
1875
|
-
const entries = await invoke('FileSystem.readDirWithFileTypes', uri);
|
|
2001
|
+
const entries = await invoke$1('FileSystem.readDirWithFileTypes', uri);
|
|
1876
2002
|
return {
|
|
1877
2003
|
entries: entries.map(mapEntry),
|
|
1878
2004
|
uri
|
|
@@ -1893,7 +2019,7 @@ const executeOpenEditorTool = async (args, _options) => {
|
|
|
1893
2019
|
};
|
|
1894
2020
|
}
|
|
1895
2021
|
try {
|
|
1896
|
-
await invoke('Main.openUri', uri);
|
|
2022
|
+
await invoke$1('Main.openUri', uri);
|
|
1897
2023
|
return {
|
|
1898
2024
|
ok: true,
|
|
1899
2025
|
uri
|
|
@@ -1914,7 +2040,7 @@ const executeOpenPreviewTool = async (args, _options) => {
|
|
|
1914
2040
|
};
|
|
1915
2041
|
}
|
|
1916
2042
|
try {
|
|
1917
|
-
await invoke('Preview.open', uri);
|
|
2043
|
+
await invoke$1('Preview.open', uri);
|
|
1918
2044
|
return {
|
|
1919
2045
|
ok: true,
|
|
1920
2046
|
uri
|
|
@@ -1969,7 +2095,7 @@ const executeRenameTool = async (args, _options) => {
|
|
|
1969
2095
|
const oldUrl = new URL(oldUri);
|
|
1970
2096
|
const newUrl = new URL(newUri);
|
|
1971
2097
|
try {
|
|
1972
|
-
await invoke('FileSystem.rename', oldUrl.toString(), newUrl.toString());
|
|
2098
|
+
await invoke$1('FileSystem.rename', oldUrl.toString(), newUrl.toString());
|
|
1973
2099
|
return {
|
|
1974
2100
|
newUri: newUrl.toString(),
|
|
1975
2101
|
ok: true,
|
|
@@ -2079,13 +2205,17 @@ const executeRunInTerminalTool = async (args, _options) => {
|
|
|
2079
2205
|
error: 'Invalid argument: options must include shell (string) and command (string).'
|
|
2080
2206
|
};
|
|
2081
2207
|
}
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2208
|
+
try {
|
|
2209
|
+
const workspaceUri = await getWorkspacePath();
|
|
2210
|
+
const result = await invoke('Terminal.executeShellCommand', {
|
|
2211
|
+
args: ['-c', runInTerminalOptions.command],
|
|
2212
|
+
cwd: workspaceUri,
|
|
2213
|
+
toSpawn: runInTerminalOptions.shell
|
|
2214
|
+
});
|
|
2215
|
+
return result;
|
|
2216
|
+
} catch (error) {
|
|
2217
|
+
return getToolErrorPayload(error);
|
|
2218
|
+
}
|
|
2089
2219
|
};
|
|
2090
2220
|
|
|
2091
2221
|
const getSearchOptions = args => {
|
|
@@ -2860,8 +2990,35 @@ const handleMessagePort = async port => {
|
|
|
2860
2990
|
});
|
|
2861
2991
|
};
|
|
2862
2992
|
|
|
2863
|
-
const
|
|
2993
|
+
const send$2 = async port => {
|
|
2994
|
+
await sendMessagePortToTerminalProcess(port, 0);
|
|
2995
|
+
};
|
|
2996
|
+
const initializeTerminalProcessElectron = async () => {
|
|
2997
|
+
const rpc = await create$5({
|
|
2998
|
+
commandMap: commandMap,
|
|
2999
|
+
send: send$2
|
|
3000
|
+
});
|
|
3001
|
+
set(rpc);
|
|
3002
|
+
};
|
|
3003
|
+
const initializeTerminalProcessRemote = async () => {
|
|
3004
|
+
const rpc = await create$3({
|
|
3005
|
+
commandMap: commandMap,
|
|
3006
|
+
type: 'terminal-process'
|
|
3007
|
+
});
|
|
3008
|
+
set(rpc);
|
|
3009
|
+
};
|
|
3010
|
+
const initializeTerminalProcess = async platform => {
|
|
3011
|
+
if (platform === Electron) {
|
|
3012
|
+
return initializeTerminalProcessElectron();
|
|
3013
|
+
}
|
|
3014
|
+
if (platform === Remote) {
|
|
3015
|
+
return initializeTerminalProcessRemote();
|
|
3016
|
+
}
|
|
3017
|
+
};
|
|
3018
|
+
|
|
3019
|
+
const initialize = async platform => {
|
|
2864
3020
|
// TODO
|
|
3021
|
+
await initializeTerminalProcess(platform);
|
|
2865
3022
|
};
|
|
2866
3023
|
|
|
2867
3024
|
const commandMap = {
|
|
@@ -2875,29 +3032,29 @@ const send$1 = async port => {
|
|
|
2875
3032
|
await sendMessagePortToChatStorageWorker(port);
|
|
2876
3033
|
};
|
|
2877
3034
|
const initializeChatStorageWorker = async () => {
|
|
2878
|
-
const rpc = await create$
|
|
3035
|
+
const rpc = await create$5({
|
|
2879
3036
|
commandMap: commandMap,
|
|
2880
3037
|
send: send$1
|
|
2881
3038
|
});
|
|
2882
|
-
set$
|
|
3039
|
+
set$3(rpc);
|
|
2883
3040
|
};
|
|
2884
3041
|
|
|
2885
3042
|
const send = async port => {
|
|
2886
3043
|
await sendMessagePortToFileSystemWorker(port, 0);
|
|
2887
3044
|
};
|
|
2888
3045
|
const initializeFileSystemWorker = async () => {
|
|
2889
|
-
const rpc = await create$
|
|
3046
|
+
const rpc = await create$5({
|
|
2890
3047
|
commandMap: commandMap,
|
|
2891
3048
|
send: send
|
|
2892
3049
|
});
|
|
2893
|
-
set$
|
|
3050
|
+
set$2(rpc);
|
|
2894
3051
|
};
|
|
2895
3052
|
|
|
2896
3053
|
const initializeRendererWorker = async () => {
|
|
2897
3054
|
const rpc = await create$1({
|
|
2898
3055
|
commandMap: commandMap
|
|
2899
3056
|
});
|
|
2900
|
-
set(rpc);
|
|
3057
|
+
set$1(rpc);
|
|
2901
3058
|
};
|
|
2902
3059
|
|
|
2903
3060
|
const listen = async () => {
|