@thinkingai/ae-cli 1.0.22 → 1.0.27
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 +39 -1
- package/README.zh.md +40 -1
- package/dist/{auth-YM7OI23X.js → auth-TXFJHPXU.js} +3 -2
- package/dist/{auth-5S7SPPEJ.js → auth-W2JZ3DKA.js} +11 -4
- package/dist/{chunk-MPFTXJFG.js → chunk-2NGWYMLB.js} +14 -2
- package/dist/chunk-6T7245YE.js +478 -0
- package/dist/{chunk-KM57HI5B.js → chunk-B4UL2VIJ.js} +7 -1
- package/dist/{chunk-TMMUBSKW.js → chunk-BI5ZVD6T.js} +8 -1
- package/dist/chunk-MNHE6SSI.js +79 -0
- package/dist/chunk-MWWYGZ76.js +130 -0
- package/dist/{chunk-24ZKQWG2.js → chunk-SRRUNQIM.js} +51 -4
- package/dist/chunk-TG64AQV4.js +262 -0
- package/dist/{chunk-NBFTPIAH.js → chunk-VT6VC4PA.js} +15 -4
- package/dist/{client-7S23DVHH.js → client-IU2E5IOL.js} +6 -3
- package/dist/{config-RVUESJRF.js → config-WH3R3IRY.js} +3 -2
- package/dist/index.js +195 -20
- package/dist/model-CC7U5XOJ.js +131 -0
- package/dist/{raw-5SYAUCJQ.js → raw-TUHZQ4UB.js} +5 -4
- package/dist/sync-EVEDS7YE.js +383 -0
- package/dist/te-agent-FLTDYV3L.js +522 -0
- package/dist/{te-analysis-RQST6AT3.js → te-analysis-CMXADIJM.js} +101 -12
- package/dist/{te-audience-TJ74UJI3.js → te-audience-LPZFFSXM.js} +4 -3
- package/dist/{te-common-W5URM2SH.js → te-common-BXQFKTB3.js} +4 -3
- package/dist/{te-community-YRV2VAD4.js → te-community-K5S3VOZY.js} +4 -3
- package/dist/{te-dataops-ZPH72BCK.js → te-dataops-567IMCQG.js} +4 -3
- package/dist/{te-engage-57UKFV74.js → te-engage-TBUTGW5F.js} +105 -49
- package/dist/{te-kb-GD7SJRYB.js → te-kb-XHVBWP5E.js} +227 -38
- package/dist/{te-meta-25SLZFXJ.js → te-meta-NQ4U3VJW.js} +25 -4
- package/dist/te-team-556APRIU.js +529 -0
- package/package.json +6 -1
- package/skills/ae-agent/SKILL.md +133 -0
- package/skills/ae-analysis/references/create_entity.md +39 -0
- package/skills/ae-analysis/references/create_space.md +34 -0
- package/skills/ae-analysis/references/drilldown_user_events.md +1 -1
- package/skills/ae-analysis/references/drilldown_users.md +2 -2
- package/skills/ae-analysis/references/query_adhoc.md +3 -2
- package/skills/ae-analysis/references/query_entity_details.md +1 -1
- package/skills/ae-engage/SKILL.md +25 -2
- package/skills/ae-engage/references/build-task-save-guide.md +283 -0
- package/skills/ae-engage/references/save-task.md +304 -0
- package/skills/ae-kb/SKILL.md +283 -0
- package/skills/ae-team/SKILL.md +164 -0
- package/skills/ae-team/references/ai-generate.md +39 -0
- package/skills/ae-team/references/create.md +94 -0
- package/skills/ae-team/references/delete.md +39 -0
- package/skills/ae-team/references/list-projects.md +45 -0
- package/skills/ae-team/references/list-templates.md +38 -0
- package/skills/ae-team/references/list.md +39 -0
- package/skills/ae-team/references/run-artifacts.md +51 -0
- package/skills/ae-team/references/run-cancel.md +38 -0
- package/skills/ae-team/references/run-chat.md +57 -0
- package/skills/ae-team/references/run-reply.md +41 -0
- package/skills/ae-team/references/run-result.md +75 -0
- package/skills/ae-team/references/run-start.md +73 -0
- package/skills/ae-team/references/run-watch.md +82 -0
- package/skills/ae-team/references/update.md +47 -0
|
@@ -1,22 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
2
|
+
kbApi,
|
|
3
|
+
kbUpload
|
|
4
|
+
} from "./chunk-MWWYGZ76.js";
|
|
5
|
+
import "./chunk-2NGWYMLB.js";
|
|
6
|
+
import "./chunk-SRRUNQIM.js";
|
|
7
|
+
import "./chunk-BI5ZVD6T.js";
|
|
8
|
+
import "./chunk-MNHE6SSI.js";
|
|
7
9
|
|
|
8
10
|
// src/commands/te-kb/query.ts
|
|
9
11
|
var API_PATH = "/agent/api/external/knowledge-bases/query";
|
|
10
12
|
function buildBody(ctx) {
|
|
11
|
-
|
|
13
|
+
return {
|
|
12
14
|
query: ctx.str("query"),
|
|
13
15
|
sources: ctx.json("sources")
|
|
14
16
|
};
|
|
15
|
-
const modelId = ctx.str("model-id");
|
|
16
|
-
if (modelId) body.modelId = modelId;
|
|
17
|
-
const maxTurnsRaw = ctx.str("max-turns");
|
|
18
|
-
if (maxTurnsRaw !== "") body.maxTurns = ctx.num("max-turns");
|
|
19
|
-
return body;
|
|
20
17
|
}
|
|
21
18
|
var query = {
|
|
22
19
|
service: "kb",
|
|
@@ -24,9 +21,7 @@ var query = {
|
|
|
24
21
|
description: "Query knowledge.",
|
|
25
22
|
flags: [
|
|
26
23
|
{ name: "query", type: "string", required: true, alias: "q", desc: "Natural language question to query against the knowledge bases" },
|
|
27
|
-
{ name: "sources", type: "json", required: true, desc: 'JSON array of knowledge base refs, e.g. [{"scope":"company","name":"engineering-handbook"}]' }
|
|
28
|
-
{ name: "model-id", type: "string", required: false, default: "AE-Auto", desc: "Model identifier (default: AE-Auto)" },
|
|
29
|
-
{ name: "max-turns", type: "number", required: false, default: 6, desc: "Maximum reasoning turns (default: 6)" }
|
|
24
|
+
{ name: "sources", type: "json", required: true, desc: 'JSON array of knowledge base refs, e.g. [{"scope":"company","name":"engineering-handbook"}]' }
|
|
30
25
|
],
|
|
31
26
|
risk: "read",
|
|
32
27
|
dryRun: (ctx) => ({
|
|
@@ -34,7 +29,7 @@ var query = {
|
|
|
34
29
|
url: `${ctx.host().replace(/\/$/, "")}${API_PATH}`,
|
|
35
30
|
body: buildBody(ctx)
|
|
36
31
|
}),
|
|
37
|
-
execute: async (ctx) => ctx
|
|
32
|
+
execute: async (ctx) => kbApi(ctx, "POST", API_PATH, {}, buildBody(ctx))
|
|
38
33
|
};
|
|
39
34
|
|
|
40
35
|
// src/commands/te-kb/add.ts
|
|
@@ -42,7 +37,26 @@ import { promises as fs } from "fs";
|
|
|
42
37
|
import * as path from "path";
|
|
43
38
|
import TurndownService from "turndown";
|
|
44
39
|
var API_PATH2 = "/agent/api/external/knowledge-bases/sources/upload";
|
|
45
|
-
var
|
|
40
|
+
var SUPPORTED_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
41
|
+
".md",
|
|
42
|
+
".markdown",
|
|
43
|
+
".txt",
|
|
44
|
+
".csv",
|
|
45
|
+
".pdf",
|
|
46
|
+
".doc",
|
|
47
|
+
".docx",
|
|
48
|
+
".xls",
|
|
49
|
+
".xlsx",
|
|
50
|
+
".ppt",
|
|
51
|
+
".pptx",
|
|
52
|
+
".jpg",
|
|
53
|
+
".jpeg",
|
|
54
|
+
".png",
|
|
55
|
+
".gif",
|
|
56
|
+
".webp",
|
|
57
|
+
".bmp",
|
|
58
|
+
".svg"
|
|
59
|
+
]);
|
|
46
60
|
function normalizeFilesInput(raw) {
|
|
47
61
|
if (!Array.isArray(raw)) {
|
|
48
62
|
throw new Error(`--files must be a JSON array of strings, e.g. '["./a.md","./docs","https://example.com/page"]'`);
|
|
@@ -67,13 +81,55 @@ function sanitizeFilename(name) {
|
|
|
67
81
|
const cleaned = name.replace(/[\\/:*?"<>|\s]+/g, "-").replace(/^-+|-+$/g, "");
|
|
68
82
|
return cleaned || "document";
|
|
69
83
|
}
|
|
84
|
+
function getMimeType(filename) {
|
|
85
|
+
const ext = path.extname(filename).toLowerCase();
|
|
86
|
+
switch (ext) {
|
|
87
|
+
case ".md":
|
|
88
|
+
case ".markdown":
|
|
89
|
+
return "text/markdown";
|
|
90
|
+
case ".txt":
|
|
91
|
+
return "text/plain";
|
|
92
|
+
case ".csv":
|
|
93
|
+
return "text/csv";
|
|
94
|
+
case ".pdf":
|
|
95
|
+
return "application/pdf";
|
|
96
|
+
case ".doc":
|
|
97
|
+
return "application/msword";
|
|
98
|
+
case ".docx":
|
|
99
|
+
return "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
|
|
100
|
+
case ".xls":
|
|
101
|
+
return "application/vnd.ms-excel";
|
|
102
|
+
case ".xlsx":
|
|
103
|
+
return "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
|
|
104
|
+
case ".ppt":
|
|
105
|
+
return "application/vnd.ms-powerpoint";
|
|
106
|
+
case ".pptx":
|
|
107
|
+
return "application/vnd.openxmlformats-officedocument.presentationml.presentation";
|
|
108
|
+
case ".jpg":
|
|
109
|
+
case ".jpeg":
|
|
110
|
+
return "image/jpeg";
|
|
111
|
+
case ".png":
|
|
112
|
+
return "image/png";
|
|
113
|
+
case ".gif":
|
|
114
|
+
return "image/gif";
|
|
115
|
+
case ".webp":
|
|
116
|
+
return "image/webp";
|
|
117
|
+
case ".bmp":
|
|
118
|
+
return "image/bmp";
|
|
119
|
+
case ".svg":
|
|
120
|
+
return "image/svg+xml";
|
|
121
|
+
default:
|
|
122
|
+
return "application/octet-stream";
|
|
123
|
+
}
|
|
124
|
+
}
|
|
70
125
|
async function readLocalFile(filePath) {
|
|
71
126
|
const ext = path.extname(filePath).toLowerCase();
|
|
72
|
-
if (!
|
|
73
|
-
throw new Error(`
|
|
127
|
+
if (!SUPPORTED_EXTENSIONS.has(ext)) {
|
|
128
|
+
throw new Error(`Unsupported file extension (${ext || "none"}): ${filePath}`);
|
|
74
129
|
}
|
|
75
|
-
const content = await fs.readFile(filePath
|
|
76
|
-
|
|
130
|
+
const content = await fs.readFile(filePath);
|
|
131
|
+
const filename = path.basename(filePath);
|
|
132
|
+
return { filename, content, mimeType: getMimeType(filename), origin: "file", source: filePath };
|
|
77
133
|
}
|
|
78
134
|
async function readDirectory(dir) {
|
|
79
135
|
const entries = await fs.readdir(dir, { withFileTypes: true });
|
|
@@ -81,13 +137,13 @@ async function readDirectory(dir) {
|
|
|
81
137
|
for (const entry of entries) {
|
|
82
138
|
if (!entry.isFile()) continue;
|
|
83
139
|
const ext = path.extname(entry.name).toLowerCase();
|
|
84
|
-
if (!
|
|
140
|
+
if (!SUPPORTED_EXTENSIONS.has(ext)) continue;
|
|
85
141
|
const full = path.join(dir, entry.name);
|
|
86
|
-
const content = await fs.readFile(full
|
|
87
|
-
files.push({ filename: entry.name, content, origin: "dir", source: full });
|
|
142
|
+
const content = await fs.readFile(full);
|
|
143
|
+
files.push({ filename: entry.name, content, mimeType: getMimeType(entry.name), origin: "dir", source: full });
|
|
88
144
|
}
|
|
89
145
|
if (files.length === 0) {
|
|
90
|
-
throw new Error(`No
|
|
146
|
+
throw new Error(`No supported files found in directory: ${dir}`);
|
|
91
147
|
}
|
|
92
148
|
return files;
|
|
93
149
|
}
|
|
@@ -112,6 +168,7 @@ async function fetchAsMarkdown(rawUrl) {
|
|
|
112
168
|
return {
|
|
113
169
|
filename: deriveFilenameFromUrl(rawUrl),
|
|
114
170
|
content: markdown,
|
|
171
|
+
mimeType: "text/markdown",
|
|
115
172
|
origin: "url",
|
|
116
173
|
source: rawUrl
|
|
117
174
|
};
|
|
@@ -146,7 +203,7 @@ async function collectFiles(ctx) {
|
|
|
146
203
|
}
|
|
147
204
|
}
|
|
148
205
|
if (collected.length === 0) {
|
|
149
|
-
throw new Error("No
|
|
206
|
+
throw new Error("No supported files collected from the given inputs");
|
|
150
207
|
}
|
|
151
208
|
return dedupeByFilename(collected);
|
|
152
209
|
}
|
|
@@ -165,21 +222,21 @@ function buildForm(name, files) {
|
|
|
165
222
|
const form = new FormData();
|
|
166
223
|
form.append("name", name);
|
|
167
224
|
for (const f of files) {
|
|
168
|
-
form.append("files", new Blob([f.content], { type:
|
|
225
|
+
form.append("files", new Blob([f.content], { type: f.mimeType }), f.filename);
|
|
169
226
|
}
|
|
170
227
|
return form;
|
|
171
228
|
}
|
|
172
229
|
var add = {
|
|
173
230
|
service: "kb",
|
|
174
231
|
command: "+add",
|
|
175
|
-
description: "Upload
|
|
232
|
+
description: "Upload sources to a knowledge. --files accepts a JSON array; each entry can be a supported file path, a directory path (supported files inside, non-recursive), or an http(s) URL (HTML auto-converted to markdown).",
|
|
176
233
|
flags: [
|
|
177
234
|
{ name: "name", type: "string", required: true, desc: "Knowledge base name" },
|
|
178
235
|
{
|
|
179
236
|
name: "files",
|
|
180
237
|
type: "json",
|
|
181
238
|
required: true,
|
|
182
|
-
desc: `JSON array of strings. Each entry can be a
|
|
239
|
+
desc: `JSON array of strings. Each entry can be a supported file path, a directory path, or an http(s) URL. Example: '["./a.md","./docs","https://example.com/page"]'`
|
|
183
240
|
}
|
|
184
241
|
],
|
|
185
242
|
risk: "write",
|
|
@@ -202,7 +259,7 @@ var add = {
|
|
|
202
259
|
const name = ctx.str("name");
|
|
203
260
|
const files = await collectFiles(ctx);
|
|
204
261
|
const form = buildForm(name, files);
|
|
205
|
-
const result = await
|
|
262
|
+
const result = await kbUpload(ctx, API_PATH2, form);
|
|
206
263
|
return {
|
|
207
264
|
uploaded: files.map((f) => ({ filename: f.filename, origin: f.origin, source: f.source })),
|
|
208
265
|
result
|
|
@@ -243,7 +300,7 @@ var compile = {
|
|
|
243
300
|
url: `${ctx.host().replace(/\/$/, "")}${API_PATH3}`,
|
|
244
301
|
body: buildBody2(ctx)
|
|
245
302
|
}),
|
|
246
|
-
execute: async (ctx) => ctx
|
|
303
|
+
execute: async (ctx) => kbApi(ctx, "POST", API_PATH3, {}, buildBody2(ctx))
|
|
247
304
|
};
|
|
248
305
|
|
|
249
306
|
// src/commands/te-kb/remove.ts
|
|
@@ -264,12 +321,17 @@ var remove = {
|
|
|
264
321
|
url: `${ctx.host().replace(/\/$/, "")}${API_PATH4}`,
|
|
265
322
|
body: buildBody3(ctx)
|
|
266
323
|
}),
|
|
267
|
-
execute: async (ctx) =>
|
|
324
|
+
execute: async (ctx) => kbApi(ctx, "DELETE", API_PATH4, {}, buildBody3(ctx))
|
|
268
325
|
};
|
|
269
326
|
|
|
270
327
|
// src/commands/te-kb/create.ts
|
|
271
328
|
var API_PATH5 = "/agent/api/external/knowledge-bases/create";
|
|
272
329
|
var VALID_SCOPES = /* @__PURE__ */ new Set(["personal", "company"]);
|
|
330
|
+
function getScope(ctx) {
|
|
331
|
+
const scope = ctx.str("scope") || "company";
|
|
332
|
+
validateScope(scope);
|
|
333
|
+
return scope;
|
|
334
|
+
}
|
|
273
335
|
function validateScope(scope) {
|
|
274
336
|
if (!VALID_SCOPES.has(scope)) {
|
|
275
337
|
throw new Error(`Invalid --scope: ${scope}. Must be one of: personal | company`);
|
|
@@ -292,7 +354,7 @@ function normalizeTags(raw) {
|
|
|
292
354
|
}
|
|
293
355
|
function buildBody4(ctx) {
|
|
294
356
|
const body = {
|
|
295
|
-
scope: ctx
|
|
357
|
+
scope: getScope(ctx),
|
|
296
358
|
name: ctx.str("name")
|
|
297
359
|
};
|
|
298
360
|
const description = ctx.str("description");
|
|
@@ -310,7 +372,7 @@ var create = {
|
|
|
310
372
|
command: "+new",
|
|
311
373
|
description: "Create a new knowledge.",
|
|
312
374
|
flags: [
|
|
313
|
-
{ name: "scope", type: "string", required:
|
|
375
|
+
{ name: "scope", type: "string", required: false, default: "company", desc: "Knowledge base scope: personal | company (default: company)" },
|
|
314
376
|
{ name: "name", type: "string", required: true, desc: "Knowledge base name (\u226430 chars, unique per scope)" },
|
|
315
377
|
{ name: "description", type: "string", required: false, desc: "Optional description (\u2264200 chars)" },
|
|
316
378
|
{ name: "tags", type: "json", required: false, desc: `Optional JSON array of tags (max 2, each \u226415 chars). Example: '["t1","t2"]'` },
|
|
@@ -319,7 +381,7 @@ var create = {
|
|
|
319
381
|
],
|
|
320
382
|
risk: "write",
|
|
321
383
|
validate: (ctx) => {
|
|
322
|
-
|
|
384
|
+
getScope(ctx);
|
|
323
385
|
normalizeTags(ctx.json("tags"));
|
|
324
386
|
},
|
|
325
387
|
dryRun: (ctx) => ({
|
|
@@ -327,7 +389,7 @@ var create = {
|
|
|
327
389
|
url: `${ctx.host().replace(/\/$/, "")}${API_PATH5}`,
|
|
328
390
|
body: buildBody4(ctx)
|
|
329
391
|
}),
|
|
330
|
-
execute: async (ctx) => ctx
|
|
392
|
+
execute: async (ctx) => kbApi(ctx, "POST", API_PATH5, {}, buildBody4(ctx))
|
|
331
393
|
};
|
|
332
394
|
|
|
333
395
|
// src/commands/te-kb/rm-source.ts
|
|
@@ -352,7 +414,7 @@ var rmSource = {
|
|
|
352
414
|
url: `${ctx.host().replace(/\/$/, "")}${API_PATH6}`,
|
|
353
415
|
body: buildBody5(ctx)
|
|
354
416
|
}),
|
|
355
|
-
execute: async (ctx) =>
|
|
417
|
+
execute: async (ctx) => kbApi(ctx, "DELETE", API_PATH6, {}, buildBody5(ctx))
|
|
356
418
|
};
|
|
357
419
|
|
|
358
420
|
// src/commands/te-kb/schema.ts
|
|
@@ -381,7 +443,128 @@ var schema = {
|
|
|
381
443
|
url: `${ctx.host().replace(/\/$/, "")}${API_PATH7}`,
|
|
382
444
|
body: buildBody6(ctx)
|
|
383
445
|
}),
|
|
384
|
-
execute: async (ctx) => ctx
|
|
446
|
+
execute: async (ctx) => kbApi(ctx, "POST", API_PATH7, {}, buildBody6(ctx))
|
|
447
|
+
};
|
|
448
|
+
|
|
449
|
+
// src/commands/te-kb/kb-index.ts
|
|
450
|
+
var API_PATH8 = "/agent/api/external/knowledge-bases/index";
|
|
451
|
+
function buildBody7(ctx) {
|
|
452
|
+
const body = {};
|
|
453
|
+
const sources = ctx.json("sources");
|
|
454
|
+
if (sources) body.sources = sources;
|
|
455
|
+
const locale = ctx.str("locale");
|
|
456
|
+
if (locale) body.locale = locale;
|
|
457
|
+
return body;
|
|
458
|
+
}
|
|
459
|
+
var kbIndex = {
|
|
460
|
+
service: "kb",
|
|
461
|
+
command: "+index",
|
|
462
|
+
description: "List accessible knowledge bases and their index.md navigation maps via POST /agent/api/external/knowledge-bases/index. Call this first to see the layout, then use +grep to locate and +read to open pages.",
|
|
463
|
+
flags: [
|
|
464
|
+
{
|
|
465
|
+
name: "sources",
|
|
466
|
+
type: "json",
|
|
467
|
+
required: false,
|
|
468
|
+
desc: 'Optional JSON array of knowledge base refs to scope the index, e.g. [{"scope":"company","name":"engineering-handbook"}]. Omit to list all accessible knowledge bases.'
|
|
469
|
+
},
|
|
470
|
+
{ name: "locale", type: "string", required: false, desc: "Optional locale: zh | en | ja | ko" }
|
|
471
|
+
],
|
|
472
|
+
risk: "read",
|
|
473
|
+
dryRun: (ctx) => ({
|
|
474
|
+
method: "POST",
|
|
475
|
+
url: `${ctx.host().replace(/\/$/, "")}${API_PATH8}`,
|
|
476
|
+
body: buildBody7(ctx)
|
|
477
|
+
}),
|
|
478
|
+
execute: async (ctx) => kbApi(ctx, "POST", API_PATH8, {}, buildBody7(ctx))
|
|
479
|
+
};
|
|
480
|
+
|
|
481
|
+
// src/commands/te-kb/kb-grep.ts
|
|
482
|
+
var API_PATH9 = "/agent/api/external/knowledge-bases/grep";
|
|
483
|
+
function buildBody8(ctx) {
|
|
484
|
+
const body = {
|
|
485
|
+
query: ctx.str("query")
|
|
486
|
+
};
|
|
487
|
+
const sources = ctx.json("sources");
|
|
488
|
+
if (sources) body.sources = sources;
|
|
489
|
+
const topK = ctx.num("top-k");
|
|
490
|
+
if (topK) body.topK = topK;
|
|
491
|
+
const locale = ctx.str("locale");
|
|
492
|
+
if (locale) body.locale = locale;
|
|
493
|
+
return body;
|
|
494
|
+
}
|
|
495
|
+
var kbGrep = {
|
|
496
|
+
service: "kb",
|
|
497
|
+
command: "+grep",
|
|
498
|
+
description: "Keyword-search knowledge base pages via POST /agent/api/external/knowledge-bases/grep. Returns matched lines with path, line number, breadcrumb and context snippet. Use +read to open a page returned here.",
|
|
499
|
+
flags: [
|
|
500
|
+
{
|
|
501
|
+
name: "query",
|
|
502
|
+
type: "string",
|
|
503
|
+
required: true,
|
|
504
|
+
alias: "q",
|
|
505
|
+
desc: "Keywords to search across the knowledge bases"
|
|
506
|
+
},
|
|
507
|
+
{
|
|
508
|
+
name: "sources",
|
|
509
|
+
type: "json",
|
|
510
|
+
required: false,
|
|
511
|
+
desc: 'Optional JSON array of knowledge base refs to scope the search, e.g. [{"scope":"company","name":"engineering-handbook"}]. Omit to search all accessible knowledge bases.'
|
|
512
|
+
},
|
|
513
|
+
{ name: "top-k", type: "number", required: false, desc: "Max number of hits to return (1-50, default 10)" },
|
|
514
|
+
{ name: "locale", type: "string", required: false, desc: "Optional locale: zh | en | ja | ko" }
|
|
515
|
+
],
|
|
516
|
+
risk: "read",
|
|
517
|
+
dryRun: (ctx) => ({
|
|
518
|
+
method: "POST",
|
|
519
|
+
url: `${ctx.host().replace(/\/$/, "")}${API_PATH9}`,
|
|
520
|
+
body: buildBody8(ctx)
|
|
521
|
+
}),
|
|
522
|
+
execute: async (ctx) => kbApi(ctx, "POST", API_PATH9, {}, buildBody8(ctx))
|
|
523
|
+
};
|
|
524
|
+
|
|
525
|
+
// src/commands/te-kb/kb-read.ts
|
|
526
|
+
var API_PATH10 = "/agent/api/external/knowledge-bases/read";
|
|
527
|
+
function buildBody9(ctx) {
|
|
528
|
+
const body = {
|
|
529
|
+
source: ctx.json("source"),
|
|
530
|
+
path: ctx.str("path")
|
|
531
|
+
};
|
|
532
|
+
const offset = ctx.num("offset");
|
|
533
|
+
if (offset) body.offset = offset;
|
|
534
|
+
const limit = ctx.num("limit");
|
|
535
|
+
if (limit) body.limit = limit;
|
|
536
|
+
const locale = ctx.str("locale");
|
|
537
|
+
if (locale) body.locale = locale;
|
|
538
|
+
return body;
|
|
539
|
+
}
|
|
540
|
+
var kbRead = {
|
|
541
|
+
service: "kb",
|
|
542
|
+
command: "+read",
|
|
543
|
+
description: "Read a full knowledge base page (or a line window) via POST /agent/api/external/knowledge-bases/read. Use after +index / +grep locate a candidate page.",
|
|
544
|
+
flags: [
|
|
545
|
+
{
|
|
546
|
+
name: "source",
|
|
547
|
+
type: "json",
|
|
548
|
+
required: true,
|
|
549
|
+
desc: 'Knowledge base ref pointing to exactly one base, e.g. {"scope":"company","name":"engineering-handbook"}'
|
|
550
|
+
},
|
|
551
|
+
{
|
|
552
|
+
name: "path",
|
|
553
|
+
type: "string",
|
|
554
|
+
required: true,
|
|
555
|
+
desc: "Page path relative to the knowledge base root, e.g. wiki/concepts/data-model.md or index.md"
|
|
556
|
+
},
|
|
557
|
+
{ name: "offset", type: "number", required: false, desc: "Start line (1-based). Omit to read from the beginning." },
|
|
558
|
+
{ name: "limit", type: "number", required: false, desc: "Max number of lines to return (1-2000)." },
|
|
559
|
+
{ name: "locale", type: "string", required: false, desc: "Optional locale: zh | en | ja | ko" }
|
|
560
|
+
],
|
|
561
|
+
risk: "read",
|
|
562
|
+
dryRun: (ctx) => ({
|
|
563
|
+
method: "POST",
|
|
564
|
+
url: `${ctx.host().replace(/\/$/, "")}${API_PATH10}`,
|
|
565
|
+
body: buildBody9(ctx)
|
|
566
|
+
}),
|
|
567
|
+
execute: async (ctx) => kbApi(ctx, "POST", API_PATH10, {}, buildBody9(ctx))
|
|
385
568
|
};
|
|
386
569
|
|
|
387
570
|
// src/commands/te-kb/index.ts
|
|
@@ -392,7 +575,10 @@ var commands = [
|
|
|
392
575
|
remove,
|
|
393
576
|
create,
|
|
394
577
|
rmSource,
|
|
395
|
-
schema
|
|
578
|
+
schema,
|
|
579
|
+
kbIndex,
|
|
580
|
+
kbGrep,
|
|
581
|
+
kbRead
|
|
396
582
|
];
|
|
397
583
|
var te_kb_default = commands;
|
|
398
584
|
export {
|
|
@@ -400,6 +586,9 @@ export {
|
|
|
400
586
|
compile,
|
|
401
587
|
create,
|
|
402
588
|
te_kb_default as default,
|
|
589
|
+
kbGrep,
|
|
590
|
+
kbIndex,
|
|
591
|
+
kbRead,
|
|
403
592
|
query,
|
|
404
593
|
remove,
|
|
405
594
|
rmSource,
|
|
@@ -2,9 +2,10 @@ import {
|
|
|
2
2
|
callMcpTool,
|
|
3
3
|
parseMcpResult,
|
|
4
4
|
resolveMcpUrl
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-2NGWYMLB.js";
|
|
6
|
+
import "./chunk-SRRUNQIM.js";
|
|
7
|
+
import "./chunk-BI5ZVD6T.js";
|
|
8
|
+
import "./chunk-MNHE6SSI.js";
|
|
8
9
|
|
|
9
10
|
// src/commands/te-meta/shared.ts
|
|
10
11
|
function createMcpCommand(config) {
|
|
@@ -533,8 +534,28 @@ var listEntities = createMcpCommand({
|
|
|
533
534
|
})
|
|
534
535
|
});
|
|
535
536
|
|
|
537
|
+
// src/commands/te-meta/entity/create-entity.ts
|
|
538
|
+
var createEntity = createMcpCommand({
|
|
539
|
+
command: "+create_entity",
|
|
540
|
+
description: "Create a new entity that links an event or user property as an analysis dimension.",
|
|
541
|
+
flags: [
|
|
542
|
+
{ name: "project_id", type: "number", required: true, desc: "Project ID", alias: "p" },
|
|
543
|
+
{ name: "entity_name", type: "string", required: true, desc: "Entity name" },
|
|
544
|
+
{ name: "column_name", type: "string", required: true, desc: "Property column name to associate with the entity" },
|
|
545
|
+
{ name: "table_type", type: "number", required: true, desc: "Table type: 0 = event property, 1 = user property" }
|
|
546
|
+
],
|
|
547
|
+
risk: "write",
|
|
548
|
+
mcpService: "te_analysis_extend",
|
|
549
|
+
buildArgs: (ctx) => ({
|
|
550
|
+
projectId: ctx.num("project_id"),
|
|
551
|
+
entityName: ctx.str("entity_name"),
|
|
552
|
+
columnName: ctx.str("column_name"),
|
|
553
|
+
tableType: ctx.num("table_type")
|
|
554
|
+
})
|
|
555
|
+
});
|
|
556
|
+
|
|
536
557
|
// src/commands/te-meta/entity/index.ts
|
|
537
|
-
var commands3 = [listEntities];
|
|
558
|
+
var commands3 = [listEntities, createEntity];
|
|
538
559
|
var entity_default = commands3;
|
|
539
560
|
|
|
540
561
|
// src/commands/te-meta/index.ts
|