@thinkingai/ae-cli 1.0.24 → 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.
Files changed (54) hide show
  1. package/README.md +17 -2
  2. package/README.zh.md +18 -2
  3. package/dist/{auth-4OPL4YWG.js → auth-TXFJHPXU.js} +3 -2
  4. package/dist/{auth-PBPAZQWP.js → auth-W2JZ3DKA.js} +7 -5
  5. package/dist/{chunk-OVHL4JAC.js → chunk-2NGWYMLB.js} +5 -3
  6. package/dist/chunk-6T7245YE.js +478 -0
  7. package/dist/{chunk-JJCRURTR.js → chunk-B4UL2VIJ.js} +1 -1
  8. package/dist/{chunk-DC66L5AM.js → chunk-BI5ZVD6T.js} +17 -90
  9. package/dist/chunk-MNHE6SSI.js +79 -0
  10. package/dist/chunk-MWWYGZ76.js +130 -0
  11. package/dist/{chunk-47MTN54I.js → chunk-SRRUNQIM.js} +29 -2
  12. package/dist/chunk-TG64AQV4.js +262 -0
  13. package/dist/{chunk-MZW6NOVS.js → chunk-VT6VC4PA.js} +9 -3
  14. package/dist/{client-TDH6MUWM.js → client-IU2E5IOL.js} +6 -3
  15. package/dist/{config-5ELRYAIH.js → config-WH3R3IRY.js} +3 -2
  16. package/dist/index.js +45 -17
  17. package/dist/model-CC7U5XOJ.js +131 -0
  18. package/dist/{raw-EM7AP3RT.js → raw-TUHZQ4UB.js} +5 -4
  19. package/dist/sync-EVEDS7YE.js +383 -0
  20. package/dist/te-agent-FLTDYV3L.js +522 -0
  21. package/dist/{te-analysis-3KFSNUCJ.js → te-analysis-CMXADIJM.js} +81 -11
  22. package/dist/{te-audience-GMYJFCSC.js → te-audience-LPZFFSXM.js} +4 -3
  23. package/dist/{te-common-YLERCMQI.js → te-common-BXQFKTB3.js} +4 -3
  24. package/dist/{te-community-PYDN5A6B.js → te-community-K5S3VOZY.js} +4 -3
  25. package/dist/{te-dataops-ETWS5O3X.js → te-dataops-567IMCQG.js} +4 -3
  26. package/dist/{te-engage-ROJVZHDA.js → te-engage-TBUTGW5F.js} +105 -49
  27. package/dist/{te-kb-VUNS2CC7.js → te-kb-XHVBWP5E.js} +225 -29
  28. package/dist/{te-meta-3EFWLM3A.js → te-meta-NQ4U3VJW.js} +4 -3
  29. package/dist/te-team-556APRIU.js +529 -0
  30. package/package.json +5 -1
  31. package/skills/ae-agent/SKILL.md +133 -0
  32. package/skills/ae-analysis/references/drilldown_user_events.md +1 -1
  33. package/skills/ae-analysis/references/drilldown_users.md +2 -2
  34. package/skills/ae-analysis/references/query_adhoc.md +3 -2
  35. package/skills/ae-analysis/references/query_entity_details.md +1 -1
  36. package/skills/ae-engage/SKILL.md +25 -2
  37. package/skills/ae-engage/references/build-task-save-guide.md +283 -0
  38. package/skills/ae-engage/references/save-task.md +304 -0
  39. package/skills/ae-kb/SKILL.md +283 -0
  40. package/skills/ae-team/SKILL.md +164 -0
  41. package/skills/ae-team/references/ai-generate.md +39 -0
  42. package/skills/ae-team/references/create.md +94 -0
  43. package/skills/ae-team/references/delete.md +39 -0
  44. package/skills/ae-team/references/list-projects.md +45 -0
  45. package/skills/ae-team/references/list-templates.md +38 -0
  46. package/skills/ae-team/references/list.md +39 -0
  47. package/skills/ae-team/references/run-artifacts.md +51 -0
  48. package/skills/ae-team/references/run-cancel.md +38 -0
  49. package/skills/ae-team/references/run-chat.md +57 -0
  50. package/skills/ae-team/references/run-reply.md +41 -0
  51. package/skills/ae-team/references/run-result.md +75 -0
  52. package/skills/ae-team/references/run-start.md +73 -0
  53. package/skills/ae-team/references/run-watch.md +82 -0
  54. package/skills/ae-team/references/update.md +47 -0
@@ -1,9 +1,11 @@
1
1
  import {
2
- httpDelete,
3
- httpUpload
4
- } from "./chunk-MZW6NOVS.js";
5
- import "./chunk-47MTN54I.js";
6
- import "./chunk-DC66L5AM.js";
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";
@@ -27,7 +29,7 @@ var query = {
27
29
  url: `${ctx.host().replace(/\/$/, "")}${API_PATH}`,
28
30
  body: buildBody(ctx)
29
31
  }),
30
- execute: async (ctx) => ctx.api("POST", API_PATH, {}, buildBody(ctx))
32
+ execute: async (ctx) => kbApi(ctx, "POST", API_PATH, {}, buildBody(ctx))
31
33
  };
32
34
 
33
35
  // src/commands/te-kb/add.ts
@@ -35,7 +37,26 @@ import { promises as fs } from "fs";
35
37
  import * as path from "path";
36
38
  import TurndownService from "turndown";
37
39
  var API_PATH2 = "/agent/api/external/knowledge-bases/sources/upload";
38
- var MD_EXT = /* @__PURE__ */ new Set([".md", ".markdown"]);
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
+ ]);
39
60
  function normalizeFilesInput(raw) {
40
61
  if (!Array.isArray(raw)) {
41
62
  throw new Error(`--files must be a JSON array of strings, e.g. '["./a.md","./docs","https://example.com/page"]'`);
@@ -60,13 +81,55 @@ function sanitizeFilename(name) {
60
81
  const cleaned = name.replace(/[\\/:*?"<>|\s]+/g, "-").replace(/^-+|-+$/g, "");
61
82
  return cleaned || "document";
62
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
+ }
63
125
  async function readLocalFile(filePath) {
64
126
  const ext = path.extname(filePath).toLowerCase();
65
- if (!MD_EXT.has(ext)) {
66
- throw new Error(`Not a markdown file (only .md / .markdown allowed): ${filePath}`);
127
+ if (!SUPPORTED_EXTENSIONS.has(ext)) {
128
+ throw new Error(`Unsupported file extension (${ext || "none"}): ${filePath}`);
67
129
  }
68
- const content = await fs.readFile(filePath, "utf8");
69
- return { filename: path.basename(filePath), content, origin: "file", source: filePath };
130
+ const content = await fs.readFile(filePath);
131
+ const filename = path.basename(filePath);
132
+ return { filename, content, mimeType: getMimeType(filename), origin: "file", source: filePath };
70
133
  }
71
134
  async function readDirectory(dir) {
72
135
  const entries = await fs.readdir(dir, { withFileTypes: true });
@@ -74,13 +137,13 @@ async function readDirectory(dir) {
74
137
  for (const entry of entries) {
75
138
  if (!entry.isFile()) continue;
76
139
  const ext = path.extname(entry.name).toLowerCase();
77
- if (!MD_EXT.has(ext)) continue;
140
+ if (!SUPPORTED_EXTENSIONS.has(ext)) continue;
78
141
  const full = path.join(dir, entry.name);
79
- const content = await fs.readFile(full, "utf8");
80
- 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 });
81
144
  }
82
145
  if (files.length === 0) {
83
- throw new Error(`No .md / .markdown files found in directory: ${dir}`);
146
+ throw new Error(`No supported files found in directory: ${dir}`);
84
147
  }
85
148
  return files;
86
149
  }
@@ -105,6 +168,7 @@ async function fetchAsMarkdown(rawUrl) {
105
168
  return {
106
169
  filename: deriveFilenameFromUrl(rawUrl),
107
170
  content: markdown,
171
+ mimeType: "text/markdown",
108
172
  origin: "url",
109
173
  source: rawUrl
110
174
  };
@@ -139,7 +203,7 @@ async function collectFiles(ctx) {
139
203
  }
140
204
  }
141
205
  if (collected.length === 0) {
142
- throw new Error("No markdown files collected from the given inputs");
206
+ throw new Error("No supported files collected from the given inputs");
143
207
  }
144
208
  return dedupeByFilename(collected);
145
209
  }
@@ -158,21 +222,21 @@ function buildForm(name, files) {
158
222
  const form = new FormData();
159
223
  form.append("name", name);
160
224
  for (const f of files) {
161
- form.append("files", new Blob([f.content], { type: "text/markdown" }), f.filename);
225
+ form.append("files", new Blob([f.content], { type: f.mimeType }), f.filename);
162
226
  }
163
227
  return form;
164
228
  }
165
229
  var add = {
166
230
  service: "kb",
167
231
  command: "+add",
168
- description: "Upload markdown sources to a knowledge. --files accepts a JSON array; each entry can be a .md/.markdown file path, a directory path (all .md/.markdown inside, non-recursive), or an http(s) URL (HTML auto-converted to markdown).",
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).",
169
233
  flags: [
170
234
  { name: "name", type: "string", required: true, desc: "Knowledge base name" },
171
235
  {
172
236
  name: "files",
173
237
  type: "json",
174
238
  required: true,
175
- desc: `JSON array of strings. Each entry can be a .md/.markdown file path, a directory path, or an http(s) URL. Example: '["./a.md","./docs","https://example.com/page"]'`
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"]'`
176
240
  }
177
241
  ],
178
242
  risk: "write",
@@ -195,7 +259,7 @@ var add = {
195
259
  const name = ctx.str("name");
196
260
  const files = await collectFiles(ctx);
197
261
  const form = buildForm(name, files);
198
- const result = await httpUpload(API_PATH2, form, {}, ctx.host());
262
+ const result = await kbUpload(ctx, API_PATH2, form);
199
263
  return {
200
264
  uploaded: files.map((f) => ({ filename: f.filename, origin: f.origin, source: f.source })),
201
265
  result
@@ -236,7 +300,7 @@ var compile = {
236
300
  url: `${ctx.host().replace(/\/$/, "")}${API_PATH3}`,
237
301
  body: buildBody2(ctx)
238
302
  }),
239
- execute: async (ctx) => ctx.api("POST", API_PATH3, {}, buildBody2(ctx))
303
+ execute: async (ctx) => kbApi(ctx, "POST", API_PATH3, {}, buildBody2(ctx))
240
304
  };
241
305
 
242
306
  // src/commands/te-kb/remove.ts
@@ -257,12 +321,17 @@ var remove = {
257
321
  url: `${ctx.host().replace(/\/$/, "")}${API_PATH4}`,
258
322
  body: buildBody3(ctx)
259
323
  }),
260
- execute: async (ctx) => httpDelete(API_PATH4, {}, buildBody3(ctx), ctx.host())
324
+ execute: async (ctx) => kbApi(ctx, "DELETE", API_PATH4, {}, buildBody3(ctx))
261
325
  };
262
326
 
263
327
  // src/commands/te-kb/create.ts
264
328
  var API_PATH5 = "/agent/api/external/knowledge-bases/create";
265
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
+ }
266
335
  function validateScope(scope) {
267
336
  if (!VALID_SCOPES.has(scope)) {
268
337
  throw new Error(`Invalid --scope: ${scope}. Must be one of: personal | company`);
@@ -285,7 +354,7 @@ function normalizeTags(raw) {
285
354
  }
286
355
  function buildBody4(ctx) {
287
356
  const body = {
288
- scope: ctx.str("scope"),
357
+ scope: getScope(ctx),
289
358
  name: ctx.str("name")
290
359
  };
291
360
  const description = ctx.str("description");
@@ -303,7 +372,7 @@ var create = {
303
372
  command: "+new",
304
373
  description: "Create a new knowledge.",
305
374
  flags: [
306
- { name: "scope", type: "string", required: true, desc: "Knowledge base scope: personal | company" },
375
+ { name: "scope", type: "string", required: false, default: "company", desc: "Knowledge base scope: personal | company (default: company)" },
307
376
  { name: "name", type: "string", required: true, desc: "Knowledge base name (\u226430 chars, unique per scope)" },
308
377
  { name: "description", type: "string", required: false, desc: "Optional description (\u2264200 chars)" },
309
378
  { name: "tags", type: "json", required: false, desc: `Optional JSON array of tags (max 2, each \u226415 chars). Example: '["t1","t2"]'` },
@@ -312,7 +381,7 @@ var create = {
312
381
  ],
313
382
  risk: "write",
314
383
  validate: (ctx) => {
315
- validateScope(ctx.str("scope"));
384
+ getScope(ctx);
316
385
  normalizeTags(ctx.json("tags"));
317
386
  },
318
387
  dryRun: (ctx) => ({
@@ -320,7 +389,7 @@ var create = {
320
389
  url: `${ctx.host().replace(/\/$/, "")}${API_PATH5}`,
321
390
  body: buildBody4(ctx)
322
391
  }),
323
- execute: async (ctx) => ctx.api("POST", API_PATH5, {}, buildBody4(ctx))
392
+ execute: async (ctx) => kbApi(ctx, "POST", API_PATH5, {}, buildBody4(ctx))
324
393
  };
325
394
 
326
395
  // src/commands/te-kb/rm-source.ts
@@ -345,7 +414,7 @@ var rmSource = {
345
414
  url: `${ctx.host().replace(/\/$/, "")}${API_PATH6}`,
346
415
  body: buildBody5(ctx)
347
416
  }),
348
- execute: async (ctx) => httpDelete(API_PATH6, {}, buildBody5(ctx), ctx.host())
417
+ execute: async (ctx) => kbApi(ctx, "DELETE", API_PATH6, {}, buildBody5(ctx))
349
418
  };
350
419
 
351
420
  // src/commands/te-kb/schema.ts
@@ -374,7 +443,128 @@ var schema = {
374
443
  url: `${ctx.host().replace(/\/$/, "")}${API_PATH7}`,
375
444
  body: buildBody6(ctx)
376
445
  }),
377
- execute: async (ctx) => ctx.api("POST", API_PATH7, {}, buildBody6(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))
378
568
  };
379
569
 
380
570
  // src/commands/te-kb/index.ts
@@ -385,7 +575,10 @@ var commands = [
385
575
  remove,
386
576
  create,
387
577
  rmSource,
388
- schema
578
+ schema,
579
+ kbIndex,
580
+ kbGrep,
581
+ kbRead
389
582
  ];
390
583
  var te_kb_default = commands;
391
584
  export {
@@ -393,6 +586,9 @@ export {
393
586
  compile,
394
587
  create,
395
588
  te_kb_default as default,
589
+ kbGrep,
590
+ kbIndex,
591
+ kbRead,
396
592
  query,
397
593
  remove,
398
594
  rmSource,
@@ -2,9 +2,10 @@ import {
2
2
  callMcpTool,
3
3
  parseMcpResult,
4
4
  resolveMcpUrl
5
- } from "./chunk-OVHL4JAC.js";
6
- import "./chunk-47MTN54I.js";
7
- import "./chunk-DC66L5AM.js";
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) {