@lvce-editor/chat-tool-worker 7.2.0 → 7.3.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.
@@ -909,7 +909,7 @@ const createMockRpc = ({
909
909
  };
910
910
 
911
911
  const rpcs = Object.create(null);
912
- const set = (id, rpc) => {
912
+ const set$1 = (id, rpc) => {
913
913
  rpcs[id] = rpc;
914
914
  };
915
915
  const get = id => {
@@ -942,7 +942,7 @@ const create = rpcId => {
942
942
  const mockRpc = createMockRpc({
943
943
  commandMap
944
944
  });
945
- set(rpcId, mockRpc);
945
+ set$1(rpcId, mockRpc);
946
946
  // @ts-ignore
947
947
  mockRpc[Symbol.dispose] = () => {
948
948
  remove(rpcId);
@@ -951,7 +951,7 @@ const create = rpcId => {
951
951
  return mockRpc;
952
952
  },
953
953
  set(rpc) {
954
- set(rpcId, rpc);
954
+ set$1(rpcId, rpc);
955
955
  }
956
956
  };
957
957
  };
@@ -959,7 +959,9 @@ const create = rpcId => {
959
959
  const RendererWorker = 1;
960
960
 
961
961
  const {
962
- invoke} = create(RendererWorker);
962
+ invoke,
963
+ set
964
+ } = create(RendererWorker);
963
965
  const readFile = async uri => {
964
966
  return invoke('FileSystem.readFile', uri);
965
967
  };
@@ -1015,6 +1017,12 @@ const executeListFilesTool = async (args, _options) => {
1015
1017
  error: 'Invalid argument: uri must be an absolute URI.'
1016
1018
  };
1017
1019
  }
1020
+ if (uri === 'file:///workspace' || uri.startsWith('file:///workspace/')) {
1021
+ return {
1022
+ error: 'Invalid argument: uri must be a real workspace folder URI. Call getWorkspaceUri first and use the returned workspaceUri value.',
1023
+ uri
1024
+ };
1025
+ }
1018
1026
  try {
1019
1027
  const entries = await invoke('FileSystem.readDirWithFileTypes', uri);
1020
1028
  return {
@@ -1213,7 +1221,7 @@ const getReadFileTool = () => {
1213
1221
  const getWriteFileTool = () => {
1214
1222
  return {
1215
1223
  function: {
1216
- description: 'Write UTF-8 text content to a file inside the currently open workspace folder. Only pass an absolute URI.',
1224
+ description: 'Write UTF-8 text content to a file for an absolute URI (for example `file://...`, `memfs://...`, or extension-provided file system URIs). Do not pass a relative path and do not use a `path` argument.',
1217
1225
  name: 'write_file',
1218
1226
  parameters: {
1219
1227
  additionalProperties: false,
@@ -1223,7 +1231,7 @@ const getWriteFileTool = () => {
1223
1231
  type: 'string'
1224
1232
  },
1225
1233
  uri: {
1226
- description: 'Absolute file URI for a real path inside the currently open workspace folder. Do not use placeholder URIs.',
1234
+ description: 'Absolute URI for the target file (for example `file://...`, `memfs://...`, or extension-provided file system URIs). Relative paths are not allowed.',
1227
1235
  type: 'string'
1228
1236
  }
1229
1237
  },
@@ -1237,13 +1245,13 @@ const getWriteFileTool = () => {
1237
1245
  const getListFilesTool = () => {
1238
1246
  return {
1239
1247
  function: {
1240
- description: 'List direct children (files and folders) for a folder URI inside the currently open workspace folder. Only pass an absolute URI.',
1248
+ description: 'List direct children (files and folders) for a folder URI inside the currently open workspace folder. If you do not already have a real workspace URI, call getWorkspaceUri first and then use that returned URI. Do not use placeholder URIs like file:///workspace.',
1241
1249
  name: 'list_files',
1242
1250
  parameters: {
1243
1251
  additionalProperties: false,
1244
1252
  properties: {
1245
1253
  uri: {
1246
- description: 'Absolute folder URI for a real path inside the currently open workspace folder. Do not use placeholder URIs.',
1254
+ description: 'Absolute folder URI for a real path inside the currently open workspace folder. If unknown, call getWorkspaceUri first and pass the returned workspaceUri value. Do not use placeholder URIs.',
1247
1255
  type: 'string'
1248
1256
  }
1249
1257
  },
@@ -1257,7 +1265,7 @@ const getListFilesTool = () => {
1257
1265
  const getGetWorkspaceUriTool = () => {
1258
1266
  return {
1259
1267
  function: {
1260
- description: 'Get the URI of the currently open workspace folder.',
1268
+ description: 'Get the URI of the currently open workspace folder. Call this first before using list_files, read_file, write_file, open_preview, or openEditor when you do not already have a concrete workspace URI.',
1261
1269
  name: 'getWorkspaceUri',
1262
1270
  parameters: {
1263
1271
  additionalProperties: false,
@@ -1368,9 +1376,10 @@ const commandMap = {
1368
1376
  };
1369
1377
 
1370
1378
  const listen = async () => {
1371
- await create$1({
1379
+ const rpc = await create$1({
1372
1380
  commandMap: commandMap
1373
1381
  });
1382
+ set(rpc);
1374
1383
  };
1375
1384
 
1376
1385
  const main = async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/chat-tool-worker",
3
- "version": "7.2.0",
3
+ "version": "7.3.0",
4
4
  "description": "Chat Tool Worker",
5
5
  "repository": {
6
6
  "type": "git",