@glodon-aiot/bot-client-sdk 3.26.0-alpha.11 → 3.26.0-alpha.13

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.
@@ -1,5 +1,5 @@
1
- import { LOCAL_PYTHON_FUNCTION_CODE as s, WORKSPACE_GRANT_ID as p } from "./constants.mjs";
2
- const t = "只操作用户在当前浏览器里选择的本地文件夹,路径相对该文件夹。云端工作区的文件不要用本工具。", e = {
1
+ import { WORKSPACE_GRANT_ID as p } from "./constants.mjs";
2
+ const e = "只操作用户在当前浏览器里选择的本地文件夹,路径相对该文件夹。云端工作区的文件不要用本工具。", t = {
3
3
  type: "string",
4
4
  enum: [p],
5
5
  description: `工作区 ID。省略时按 ${p} 处理,传其他值会被拒绝。`
@@ -9,16 +9,16 @@ const t = "只操作用户在当前浏览器里选择的本地文件夹,路径
9
9
  }), r = {
10
10
  type: "string",
11
11
  description: "文件当前内容的 hash(sha256:<hex>),来自 read_file 或 stat_file 的返回值。"
12
- }, d = {
12
+ }, o = {
13
13
  list_directory: {
14
14
  functionCode: "list_directory",
15
15
  name: "列出本地目录",
16
- description: `${t}列出某个目录的直接子项(目录在前),支持分页。`,
16
+ description: `${e}列出某个目录的直接子项(目录在前),支持分页。`,
17
17
  parameters: {
18
18
  type: "object",
19
19
  required: ["grantId"],
20
20
  properties: {
21
- grantId: e,
21
+ grantId: t,
22
22
  path: i('要列出的目录,省略或传 "." 表示工作区根目录。'),
23
23
  offset: {
24
24
  type: "integer",
@@ -37,12 +37,12 @@ const t = "只操作用户在当前浏览器里选择的本地文件夹,路径
37
37
  read_file: {
38
38
  functionCode: "read_file",
39
39
  name: "读取本地文件",
40
- description: `${t}按行读取文本文件,单次最多返回 1 MiB,超出部分会被截断(truncated: true)。返回内容的 hash 可用于后续修改。`,
40
+ description: `${e}按行读取文本文件,单次最多返回 1 MiB,超出部分会被截断(truncated: true)。返回内容的 hash 可用于后续修改。`,
41
41
  parameters: {
42
42
  type: "object",
43
43
  required: ["grantId", "path"],
44
44
  properties: {
45
- grantId: e,
45
+ grantId: t,
46
46
  path: i("要读取的文件。"),
47
47
  startLine: {
48
48
  type: "integer",
@@ -70,12 +70,12 @@ const t = "只操作用户在当前浏览器里选择的本地文件夹,路径
70
70
  stat_file: {
71
71
  functionCode: "stat_file",
72
72
  name: "查看本地文件信息",
73
- description: `${t}返回文件或目录的类型、大小、修改时间,可选返回 hash。不返回文件内容。`,
73
+ description: `${e}返回文件或目录的类型、大小、修改时间,可选返回 hash。不返回文件内容。`,
74
74
  parameters: {
75
75
  type: "object",
76
76
  required: ["grantId", "path"],
77
77
  properties: {
78
- grantId: e,
78
+ grantId: t,
79
79
  path: i("要查看的文件或目录。"),
80
80
  includeHash: {
81
81
  type: "boolean",
@@ -87,12 +87,12 @@ const t = "只操作用户在当前浏览器里选择的本地文件夹,路径
87
87
  search_files: {
88
88
  functionCode: "search_files",
89
89
  name: "查找本地文件",
90
- description: `${t}按文件名或 glob(支持 *、?、**)查找文件。不含 / 的模式匹配文件名,含 / 的模式匹配相对 path 的路径。`,
90
+ description: `${e}按文件名或 glob(支持 *、?、**)查找文件。不含 / 的模式匹配文件名,含 / 的模式匹配相对 path 的路径。`,
91
91
  parameters: {
92
92
  type: "object",
93
93
  required: ["grantId", "pattern"],
94
94
  properties: {
95
- grantId: e,
95
+ grantId: t,
96
96
  pattern: {
97
97
  type: "string",
98
98
  minLength: 1,
@@ -117,12 +117,12 @@ const t = "只操作用户在当前浏览器里选择的本地文件夹,路径
117
117
  search_text: {
118
118
  functionCode: "search_text",
119
119
  name: "搜索本地文本",
120
- description: `${t}在指定文件或目录(递归)中搜索普通文本(不支持正则),返回所在文件、行号与该行内容。必须指定 path,不能搜索整个文件夹。`,
120
+ description: `${e}在指定文件或目录(递归)中搜索普通文本(不支持正则),返回所在文件、行号与该行内容。必须指定 path,不能搜索整个文件夹。`,
121
121
  parameters: {
122
122
  type: "object",
123
123
  required: ["grantId", "path", "query"],
124
124
  properties: {
125
- grantId: e,
125
+ grantId: t,
126
126
  path: i("搜索范围,可以是文件或目录。"),
127
127
  query: {
128
128
  type: "string",
@@ -159,12 +159,12 @@ const t = "只操作用户在当前浏览器里选择的本地文件夹,路径
159
159
  apply_patch: {
160
160
  functionCode: "apply_patch",
161
161
  name: "修改本地文件",
162
- description: `${t}以查找替换的方式修改 UTF-8 文本文件。每条修改的 oldText 必须在文件中唯一出现(或设置 replaceAll)。执行前需要用户确认。`,
162
+ description: `${e}以查找替换的方式修改 UTF-8 文本文件。每条修改的 oldText 必须在文件中唯一出现(或设置 replaceAll)。执行前需要用户确认。`,
163
163
  parameters: {
164
164
  type: "object",
165
165
  required: ["grantId", "path", "expectedHash", "edits"],
166
166
  properties: {
167
- grantId: e,
167
+ grantId: t,
168
168
  path: i("要修改的文件。"),
169
169
  expectedHash: r,
170
170
  edits: {
@@ -197,12 +197,12 @@ const t = "只操作用户在当前浏览器里选择的本地文件夹,路径
197
197
  write_file: {
198
198
  functionCode: "write_file",
199
199
  name: "写入本地文件",
200
- description: `${t}新建文件,或整体覆盖已有文件(覆盖时必须提供 expectedHash)。修改已有文件优先使用 apply_patch。执行前需要用户确认。`,
200
+ description: `${e}新建文件,或整体覆盖已有文件(覆盖时必须提供 expectedHash)。修改已有文件优先使用 apply_patch。执行前需要用户确认。`,
201
201
  parameters: {
202
202
  type: "object",
203
203
  required: ["grantId", "path", "content"],
204
204
  properties: {
205
- grantId: e,
205
+ grantId: t,
206
206
  path: i("要写入的文件。"),
207
207
  content: {
208
208
  type: "string",
@@ -219,12 +219,12 @@ const t = "只操作用户在当前浏览器里选择的本地文件夹,路径
219
219
  upload_file: {
220
220
  functionCode: "upload_file",
221
221
  name: "上传本地文件",
222
- description: `${t}把本地文件夹中的文件上传到平台文件服务,返回 fileId、name、size 和 url。url 是文件访问地址,可直接用于后续推理或对话。下载回本地文件夹时使用 download_file,source.type 为 platformFile。单文件不超过 50 MB。执行前需要用户确认。`,
222
+ description: `${e}把本地文件夹中的文件上传到平台文件服务,返回 fileId、name、size 和 url。url 是文件访问地址,可直接用于后续推理或对话。下载回本地文件夹时使用 download_file,source.type 为 platformFile。单文件不超过 50 MB。执行前需要用户确认。`,
223
223
  parameters: {
224
224
  type: "object",
225
225
  required: ["grantId", "path"],
226
226
  properties: {
227
- grantId: e,
227
+ grantId: t,
228
228
  path: i("要上传的文件。"),
229
229
  target: {
230
230
  type: "string",
@@ -240,12 +240,12 @@ const t = "只操作用户在当前浏览器里选择的本地文件夹,路径
240
240
  download_file: {
241
241
  functionCode: "download_file",
242
242
  name: "下载到本地文件夹",
243
- description: `${t}把会话文件、平台文件或 https 地址保存到本地文件夹。source.type 为 url 时必须同时填写 source.url(完整地址),为 sessionFile 或 platformFile 时必须同时填写 source.fileId。不要只传 type。单文件不超过 50 MB。执行前需要用户确认。`,
243
+ description: `${e}把会话文件、平台文件或 https 地址保存到本地文件夹。source.type 为 url 时必须同时填写 source.url(完整地址),为 sessionFile 或 platformFile 时必须同时填写 source.fileId。不要只传 type。单文件不超过 50 MB。执行前需要用户确认。`,
244
244
  parameters: {
245
245
  type: "object",
246
246
  required: ["grantId", "destPath", "source"],
247
247
  properties: {
248
- grantId: e,
248
+ grantId: t,
249
249
  destPath: i("保存位置(文件路径)。"),
250
250
  source: {
251
251
  type: "object",
@@ -275,38 +275,7 @@ const t = "只操作用户在当前浏览器里选择的本地文件夹,路径
275
275
  }
276
276
  }
277
277
  }
278
- }, o = "在已绑定的本地工程目录中运行已有 .py,路径相对该目录。不要用于云端工作区,不要传 shell 或代码,只能传 path 和 args。", c = {
279
- functionCode: s,
280
- name: "运行本地 Python 脚本",
281
- description: `${o}每次运行需用户单独确认,文件读写授权不能代替。确认后脚本可直接读写该目录并使用标准库,改动立即落盘。不能联网,不能在运行中安装包,也不能访问该目录以外的文件。第三方包写在工程根目录 sandbox-requirements.txt。结果打印到标准输出。code 为 0 只表示已结束,成功看 data.exitCode,超时看 data.timedOut。`,
282
- parameters: {
283
- type: "object",
284
- required: ["grantId", "path"],
285
- properties: {
286
- grantId: e,
287
- path: {
288
- type: "string",
289
- description: "要运行的脚本。必须是已存在、以 .py 结尾的相对路径,以 / 分隔,不能包含 .. 、盘符或绝对路径。"
290
- },
291
- args: {
292
- type: "array",
293
- maxItems: 16,
294
- description: "传给脚本的参数,最多 16 个。每个参数单独一项,不能含空格、引号或 shell 语法,只能包含字母、数字、下划线以及 . / : @ = + - , 。",
295
- items: {
296
- type: "string",
297
- description: "一个脚本参数。"
298
- }
299
- },
300
- timeoutMs: {
301
- type: "integer",
302
- minimum: 1e3,
303
- maximum: 12e4,
304
- description: "超时毫秒数。默认 20000,最大 120000。到时脚本会被终止。"
305
- }
306
- }
307
- }
308
278
  };
309
279
  export {
310
- d as LOCAL_FILE_TOOL_SCHEMAS,
311
- c as LOCAL_PYTHON_TOOL_SCHEMA
280
+ o as LOCAL_FILE_TOOL_SCHEMAS
312
281
  };
@@ -1,4 +1,4 @@
1
- const e = "@glodon-aiot/bot-client-sdk", s = "3.26.0-alpha.11", t = "glodoncv", i = "aiot bot client js sdk", n = "module", g = !1, o = [
1
+ const e = "@glodon-aiot/bot-client-sdk", s = "3.26.0-alpha.13", t = "glodoncv", i = "aiot bot client js sdk", n = "module", g = !1, o = [
2
2
  "aiot",
3
3
  "bot",
4
4
  "bot client",
@@ -68,7 +68,7 @@ const e = "@glodon-aiot/bot-client-sdk", s = "3.26.0-alpha.11", t = "glodoncv",
68
68
  access: "public",
69
69
  registry: "https://registry.npmjs.org/"
70
70
  }, y = {
71
- "@glodon-aiot/apis": "^3.26.0-alpha.11",
71
+ "@glodon-aiot/apis": "^3.26.0-alpha.13",
72
72
  axios: "0.24.0",
73
73
  buffer: "^6.0.3",
74
74
  dayjs: "^1.11.13",