@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
@@ -2,11 +2,13 @@ import {
2
2
  clearToken,
3
3
  getToken,
4
4
  resolveHost
5
- } from "./chunk-47MTN54I.js";
5
+ } from "./chunk-SRRUNQIM.js";
6
6
  import {
7
- logger,
8
7
  safeJsonParse
9
- } from "./chunk-DC66L5AM.js";
8
+ } from "./chunk-BI5ZVD6T.js";
9
+ import {
10
+ logger
11
+ } from "./chunk-MNHE6SSI.js";
10
12
 
11
13
  // src/core/client.ts
12
14
  import WebSocket from "ws";
@@ -62,6 +64,9 @@ async function httpGet(modulePath, params = {}, hostUrl) {
62
64
  async function httpPost(modulePath, params = {}, body, hostUrl) {
63
65
  return request("POST", modulePath, params, body ?? {}, true, hostUrl);
64
66
  }
67
+ async function httpRequest(method, modulePath, params = {}, body, hostUrl) {
68
+ return request(method.toUpperCase(), modulePath, params, body ?? {}, true, hostUrl);
69
+ }
65
70
  async function httpDelete(modulePath, params = {}, body, hostUrl) {
66
71
  return request("DELETE", modulePath, params, body ?? null, true, hostUrl);
67
72
  }
@@ -175,6 +180,7 @@ async function queryReportData(projectId, reportId, qp, eventModel, options = {}
175
180
  export {
176
181
  httpGet,
177
182
  httpPost,
183
+ httpRequest,
178
184
  httpDelete,
179
185
  httpUpload,
180
186
  wsQuery,
@@ -2,17 +2,20 @@ import {
2
2
  httpDelete,
3
3
  httpGet,
4
4
  httpPost,
5
+ httpRequest,
5
6
  httpUpload,
6
7
  queryReportData,
7
8
  querySql,
8
9
  wsQuery
9
- } from "./chunk-MZW6NOVS.js";
10
- import "./chunk-47MTN54I.js";
11
- import "./chunk-DC66L5AM.js";
10
+ } from "./chunk-VT6VC4PA.js";
11
+ import "./chunk-SRRUNQIM.js";
12
+ import "./chunk-BI5ZVD6T.js";
13
+ import "./chunk-MNHE6SSI.js";
12
14
  export {
13
15
  httpDelete,
14
16
  httpGet,
15
17
  httpPost,
18
+ httpRequest,
16
19
  httpUpload,
17
20
  queryReportData,
18
21
  querySql,
@@ -4,14 +4,15 @@ import {
4
4
  getToken,
5
5
  loadToken,
6
6
  validateToken
7
- } from "./chunk-47MTN54I.js";
7
+ } from "./chunk-SRRUNQIM.js";
8
8
  import {
9
9
  addHost,
10
10
  listHosts,
11
11
  removeHost,
12
12
  setActiveHost,
13
13
  updateHostLabel
14
- } from "./chunk-DC66L5AM.js";
14
+ } from "./chunk-BI5ZVD6T.js";
15
+ import "./chunk-MNHE6SSI.js";
15
16
 
16
17
  // src/commands/config.ts
17
18
  import * as readline from "readline";
package/dist/index.js CHANGED
@@ -1,12 +1,14 @@
1
1
  import {
2
2
  printError,
3
3
  printOutput
4
- } from "./chunk-JJCRURTR.js";
4
+ } from "./chunk-B4UL2VIJ.js";
5
5
  import {
6
6
  getActiveHost,
7
- logger,
8
7
  safeJsonParse
9
- } from "./chunk-DC66L5AM.js";
8
+ } from "./chunk-BI5ZVD6T.js";
9
+ import {
10
+ logger
11
+ } from "./chunk-MNHE6SSI.js";
10
12
 
11
13
  // src/index.ts
12
14
  import { Command as CommanderCommand } from "commander";
@@ -66,7 +68,7 @@ function createRuntimeContext(cmd, opts, globalOpts) {
66
68
  let _clientModule = null;
67
69
  async function getClient() {
68
70
  if (!_clientModule) {
69
- _clientModule = await import("./client-TDH6MUWM.js");
71
+ _clientModule = await import("./client-IU2E5IOL.js");
70
72
  }
71
73
  return _clientModule;
72
74
  }
@@ -97,7 +99,7 @@ function createRuntimeContext(cmd, opts, globalOpts) {
97
99
  if (method.toUpperCase() === "GET") {
98
100
  return client.httpGet(path2, params, ctx.host());
99
101
  } else {
100
- return client.httpPost(path2, params, data, ctx.host());
102
+ return client.httpRequest(method, path2, params, data, ctx.host());
101
103
  }
102
104
  },
103
105
  async querySql(projectId, sql) {
@@ -109,7 +111,7 @@ function createRuntimeContext(cmd, opts, globalOpts) {
109
111
  return client.queryReportData(projectId, reportId, qp, eventModel, options, ctx.host());
110
112
  },
111
113
  async token() {
112
- const { getToken } = await import("./auth-4OPL4YWG.js");
114
+ const { getToken } = await import("./auth-TXFJHPXU.js");
113
115
  return getToken(ctx.host());
114
116
  },
115
117
  host() {
@@ -356,68 +358,92 @@ program.name("ae-cli").version(version).description("CLI tool for ThinkingAI (AE
356
358
  async function loadCommands() {
357
359
  const commands = [];
358
360
  try {
359
- const teAnalysis = await import("./te-analysis-3KFSNUCJ.js");
361
+ const teAnalysis = await import("./te-analysis-CMXADIJM.js");
360
362
  commands.push(...teAnalysis.default);
361
363
  } catch {
362
364
  }
363
365
  try {
364
- const teAudience = await import("./te-audience-GMYJFCSC.js");
366
+ const teAudience = await import("./te-audience-LPZFFSXM.js");
365
367
  commands.push(...teAudience.default);
366
368
  } catch {
367
369
  }
368
370
  try {
369
- const teMeta = await import("./te-meta-3EFWLM3A.js");
371
+ const teMeta = await import("./te-meta-NQ4U3VJW.js");
370
372
  commands.push(...teMeta.default);
371
373
  } catch {
372
374
  }
373
375
  try {
374
- const teCommon = await import("./te-common-YLERCMQI.js");
376
+ const teCommon = await import("./te-common-BXQFKTB3.js");
375
377
  commands.push(...teCommon.default);
376
378
  } catch {
377
379
  }
378
380
  try {
379
- const engage = await import("./te-engage-ROJVZHDA.js");
381
+ const engage = await import("./te-engage-TBUTGW5F.js");
380
382
  commands.push(...engage.default);
381
383
  } catch {
382
384
  }
383
385
  try {
384
- const community = await import("./te-community-PYDN5A6B.js");
386
+ const community = await import("./te-community-K5S3VOZY.js");
385
387
  commands.push(...community.default);
386
388
  } catch {
387
389
  }
388
390
  try {
389
- const dataops = await import("./te-dataops-ETWS5O3X.js");
391
+ const dataops = await import("./te-dataops-567IMCQG.js");
390
392
  commands.push(...dataops.default);
391
393
  } catch {
392
394
  }
393
395
  try {
394
- const teKb = await import("./te-kb-VUNS2CC7.js");
396
+ const teKb = await import("./te-kb-XHVBWP5E.js");
395
397
  commands.push(...teKb.default);
396
398
  } catch {
397
399
  }
400
+ try {
401
+ const teTeam = await import("./te-team-556APRIU.js");
402
+ commands.push(...teTeam.default);
403
+ } catch {
404
+ }
405
+ try {
406
+ const teAgent = await import("./te-agent-FLTDYV3L.js");
407
+ commands.push(...teAgent.default);
408
+ } catch {
409
+ }
398
410
  return commands;
399
411
  }
400
412
  async function registerAuthCommands() {
401
413
  try {
402
- const { registerAuth } = await import("./auth-PBPAZQWP.js");
414
+ const { registerAuth } = await import("./auth-W2JZ3DKA.js");
403
415
  registerAuth(program);
404
416
  } catch {
405
417
  }
406
418
  }
407
419
  async function registerConfigCommands() {
408
420
  try {
409
- const { registerConfig } = await import("./config-5ELRYAIH.js");
421
+ const { registerConfig } = await import("./config-WH3R3IRY.js");
410
422
  registerConfig(program);
411
423
  } catch {
412
424
  }
413
425
  }
414
426
  async function registerApiCommand() {
415
427
  try {
416
- const { registerApi } = await import("./raw-EM7AP3RT.js");
428
+ const { registerApi } = await import("./raw-TUHZQ4UB.js");
417
429
  registerApi(program);
418
430
  } catch {
419
431
  }
420
432
  }
433
+ async function registerSyncCommand() {
434
+ try {
435
+ const { registerSync } = await import("./sync-EVEDS7YE.js");
436
+ registerSync(program);
437
+ } catch {
438
+ }
439
+ }
440
+ async function registerModelCommand() {
441
+ try {
442
+ const { registerModel } = await import("./model-CC7U5XOJ.js");
443
+ registerModel(program);
444
+ } catch {
445
+ }
446
+ }
421
447
  async function main() {
422
448
  notifyIfUpdateAvailable({ name: pkg.name, version: pkg.version });
423
449
  const commands = await loadCommands();
@@ -425,6 +451,8 @@ async function main() {
425
451
  await registerAuthCommands();
426
452
  await registerConfigCommands();
427
453
  await registerApiCommand();
454
+ await registerSyncCommand();
455
+ await registerModelCommand();
428
456
  program.parse();
429
457
  }
430
458
  main();
@@ -0,0 +1,131 @@
1
+ import {
2
+ MultiselectCancelled,
3
+ getCurrentWorkspace,
4
+ promptSingleCheckboxSelect
5
+ } from "./chunk-6T7245YE.js";
6
+ import {
7
+ TeAgentApiError,
8
+ TeAgentCredentialsError,
9
+ getClaudeConfigDir,
10
+ getSandboxModels,
11
+ postSandboxModelSelection
12
+ } from "./chunk-TG64AQV4.js";
13
+
14
+ // src/commands/model/index.ts
15
+ import { existsSync, readFileSync } from "fs";
16
+ import { join } from "path";
17
+ function readCurrentModelSelection() {
18
+ const settingsPath = join(getClaudeConfigDir(), "settings.json");
19
+ if (!existsSync(settingsPath)) return { routingModelId: null, providerModelId: null };
20
+ try {
21
+ const raw = readFileSync(settingsPath, "utf8");
22
+ const parsed = JSON.parse(raw);
23
+ if (!parsed || typeof parsed !== "object") {
24
+ return { routingModelId: null, providerModelId: null };
25
+ }
26
+ const env = parsed.env && typeof parsed.env === "object" ? parsed.env : {};
27
+ const headers = typeof env.ANTHROPIC_CUSTOM_HEADERS === "string" ? env.ANTHROPIC_CUSTOM_HEADERS : void 0;
28
+ const routingModelId = extractModelIdHeader(headers);
29
+ const providerModelId = typeof parsed.model === "string" && parsed.model ? parsed.model : typeof env.ANTHROPIC_MODEL === "string" && env.ANTHROPIC_MODEL ? env.ANTHROPIC_MODEL : null;
30
+ return { routingModelId, providerModelId };
31
+ } catch {
32
+ return { routingModelId: null, providerModelId: null };
33
+ }
34
+ }
35
+ function extractModelIdHeader(headers) {
36
+ if (!headers) return null;
37
+ for (const line of headers.split(/\r?\n/)) {
38
+ const match = line.match(/^\s*model-id\s*:\s*(.+?)\s*$/);
39
+ if (match?.[1]) {
40
+ return match[1];
41
+ }
42
+ }
43
+ return null;
44
+ }
45
+ function isCurrentModel(model, current) {
46
+ if (current.routingModelId) return model.id === current.routingModelId;
47
+ return model.scope === "system" && Boolean(current.providerModelId) && model.modelId === current.providerModelId;
48
+ }
49
+ async function runModelPicker() {
50
+ const current = readCurrentModelSelection();
51
+ const models = await getSandboxModels();
52
+ if (models.length === 0) {
53
+ process.stderr.write("\u5F53\u524D\u7528\u6237\u65E0\u53EF\u89C1\u6A21\u578B\n");
54
+ return;
55
+ }
56
+ const sorted = models.slice().sort((a, b) => {
57
+ const scopeOrder = {
58
+ system: 0,
59
+ company: 1,
60
+ personal: 2
61
+ };
62
+ const scopeDiff = scopeOrder[a.scope] - scopeOrder[b.scope];
63
+ return scopeDiff !== 0 ? scopeDiff : a.name.localeCompare(b.name);
64
+ });
65
+ const picked = await promptSingleCheckboxSelect({
66
+ title: "\u9009\u62E9\u8981\u4F7F\u7528\u7684\u6A21\u578B",
67
+ items: sorted.map((model) => {
68
+ const isCurrent = isCurrentModel(model, current);
69
+ return {
70
+ value: model,
71
+ label: `${model.name} ${model.scope}`,
72
+ hint: isCurrent ? "(\u5F53\u524D)" : void 0,
73
+ preselected: isCurrent
74
+ };
75
+ })
76
+ });
77
+ const workspace = getCurrentWorkspace();
78
+ if (!workspace) {
79
+ process.stderr.write("\u8BF7\u5728 te-agent \u5DE5\u4F5C\u7A7A\u95F4\u76EE\u5F55\u5185\u6267\u884C ae-cli model\n");
80
+ process.exitCode = 1;
81
+ return;
82
+ }
83
+ if (isCurrentModel(picked, current)) {
84
+ process.stdout.write("\u5F53\u524D\u5DF2\u4F7F\u7528\u8BE5\u6A21\u578B\n");
85
+ return;
86
+ }
87
+ await postSandboxModelSelection({
88
+ workspacePath: workspace.name,
89
+ modelId: picked.id
90
+ });
91
+ process.stdout.write(`\u5DF2\u5207\u6362\u4E3A ${picked.name}
92
+ `);
93
+ }
94
+ function registerModel(program) {
95
+ program.command("model").description("Choose and switch the current workspace model (te-agent sandbox only)").action(async () => {
96
+ try {
97
+ await runModelPicker();
98
+ } catch (err) {
99
+ handleError(err);
100
+ }
101
+ });
102
+ }
103
+ function handleError(err) {
104
+ if (err instanceof MultiselectCancelled) {
105
+ process.stderr.write("\u5DF2\u53D6\u6D88\n");
106
+ return;
107
+ }
108
+ if (err instanceof TeAgentCredentialsError) {
109
+ process.stderr.write(`\u2717 ${err.message}
110
+ `);
111
+ if (err.hint) process.stderr.write(` ${err.hint}
112
+ `);
113
+ process.exitCode = 1;
114
+ return;
115
+ }
116
+ if (err instanceof TeAgentApiError) {
117
+ process.stderr.write(`\u2717 \u4E3B\u5E94\u7528\u9519\u8BEF\uFF08${err.status}${err.code ? " " + err.code : ""}\uFF09\uFF1A${err.message}
118
+ `);
119
+ process.exitCode = 1;
120
+ return;
121
+ }
122
+ const msg = err instanceof Error ? err.message : String(err);
123
+ process.stderr.write(`\u2717 ${msg}
124
+ `);
125
+ process.exitCode = 1;
126
+ }
127
+ export {
128
+ extractModelIdHeader,
129
+ readCurrentModelSelection,
130
+ registerModel
131
+ };
@@ -1,17 +1,18 @@
1
1
  import {
2
2
  printError,
3
3
  printOutput
4
- } from "./chunk-JJCRURTR.js";
4
+ } from "./chunk-B4UL2VIJ.js";
5
5
  import {
6
6
  httpGet,
7
7
  httpPost
8
- } from "./chunk-MZW6NOVS.js";
8
+ } from "./chunk-VT6VC4PA.js";
9
9
  import {
10
10
  resolveHost
11
- } from "./chunk-47MTN54I.js";
11
+ } from "./chunk-SRRUNQIM.js";
12
12
  import {
13
13
  safeJsonParse
14
- } from "./chunk-DC66L5AM.js";
14
+ } from "./chunk-BI5ZVD6T.js";
15
+ import "./chunk-MNHE6SSI.js";
15
16
 
16
17
  // src/api/raw.ts
17
18
  function registerApi(program) {