@thinkingai/ae-cli 1.0.27 → 1.0.30

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 (90) hide show
  1. package/README.md +1 -16
  2. package/README.zh.md +1 -16
  3. package/dist/auth-H3GJD55A.js +457 -0
  4. package/dist/{auth-TXFJHPXU.js → auth-U25QJU5D.js} +3 -3
  5. package/dist/{chunk-B4UL2VIJ.js → chunk-CLJF7MQA.js} +1 -1
  6. package/dist/{chunk-6T7245YE.js → chunk-EGEIXA2Z.js} +90 -18
  7. package/dist/{chunk-2NGWYMLB.js → chunk-GLNZSDKO.js} +88 -50
  8. package/dist/chunk-GSJGPNKK.js +49 -0
  9. package/dist/{chunk-VT6VC4PA.js → chunk-I42JGQ2J.js} +26 -11
  10. package/dist/chunk-JM34JPCO.js +239 -0
  11. package/dist/chunk-NOO24N7W.js +11 -0
  12. package/dist/chunk-SF3KTPIC.js +98 -0
  13. package/dist/chunk-SRJIAOBN.js +244 -0
  14. package/dist/chunk-U6TKB3IV.js +171 -0
  15. package/dist/{chunk-TG64AQV4.js → chunk-VJFUB3H3.js} +99 -56
  16. package/dist/{client-IU2E5IOL.js → client-IN42F223.js} +4 -4
  17. package/dist/config-64G36TJL.js +130 -0
  18. package/dist/index.js +52 -25
  19. package/dist/{model-CC7U5XOJ.js → model-VZCYNIOG.js} +11 -10
  20. package/dist/{raw-TUHZQ4UB.js → raw-WJIWC6YP.js} +13 -7
  21. package/dist/{sync-EVEDS7YE.js → sync-NVASAISS.js} +146 -47
  22. package/dist/{te-agent-FLTDYV3L.js → te-agent-YV4DXEXK.js} +24 -23
  23. package/dist/{te-analysis-CMXADIJM.js → te-analysis-CB3DA5I5.js} +61 -13
  24. package/dist/{te-audience-LPZFFSXM.js → te-audience-W7SCQFC7.js} +7 -5
  25. package/dist/{te-common-BXQFKTB3.js → te-common-FBXVWBSI.js} +21 -9
  26. package/dist/{te-community-K5S3VOZY.js → te-community-LNVDZSGW.js} +6 -4
  27. package/dist/{te-dataops-567IMCQG.js → te-dataops-IPCSSWYH.js} +29 -27
  28. package/dist/{te-engage-TBUTGW5F.js → te-engage-KARARMIR.js} +6 -4
  29. package/dist/{te-kb-XHVBWP5E.js → te-kb-2Z2CARN3.js} +7 -5
  30. package/dist/{te-meta-NQ4U3VJW.js → te-meta-PDKLMWXN.js} +6 -4
  31. package/dist/{te-team-556APRIU.js → te-team-SW5B7DHO.js} +17 -12
  32. package/package.json +6 -2
  33. package/skills/ae-agent/SKILL.md +2 -1
  34. package/skills/ae-analysis/SKILL.md +1 -1
  35. package/skills/ae-analysis/references/list_clusters.md +4 -2
  36. package/skills/ae-analysis-global/SKILL.md +51 -0
  37. package/skills/ae-analysis-global/references/list_query_clusters.md +67 -0
  38. package/skills/ae-community/SKILL.md +2 -3
  39. package/skills/ae-dataops/SKILL.md +1 -2
  40. package/skills/ae-engage/SKILL.md +1 -0
  41. package/skills/ae-engage/references/add-approver.md +0 -1
  42. package/skills/ae-engage/references/add-channel.md +0 -1
  43. package/skills/ae-engage/references/approver-list.md +0 -1
  44. package/skills/ae-engage/references/cancel-query-by-request-id.md +0 -1
  45. package/skills/ae-engage/references/channel-detail.md +0 -1
  46. package/skills/ae-engage/references/channel-list.md +0 -1
  47. package/skills/ae-engage/references/config-channel-detail.md +0 -1
  48. package/skills/ae-engage/references/config-channel-list.md +0 -1
  49. package/skills/ae-engage/references/config-item-analysis-report.md +0 -1
  50. package/skills/ae-engage/references/config-item-detail.md +0 -1
  51. package/skills/ae-engage/references/config-item-list.md +0 -1
  52. package/skills/ae-engage/references/config-item-strategy-comparison.md +0 -1
  53. package/skills/ae-engage/references/config-item-trigger-report.md +0 -1
  54. package/skills/ae-engage/references/copy-config-template.md +0 -1
  55. package/skills/ae-engage/references/delete-channel.md +0 -1
  56. package/skills/ae-engage/references/delete-config-channel.md +0 -1
  57. package/skills/ae-engage/references/delete-config-item.md +0 -1
  58. package/skills/ae-engage/references/delete-flow.md +0 -1
  59. package/skills/ae-engage/references/flow-ab-split-node-report.md +0 -1
  60. package/skills/ae-engage/references/flow-detail.md +0 -1
  61. package/skills/ae-engage/references/flow-list.md +0 -1
  62. package/skills/ae-engage/references/flow-node-config-schema.md +0 -1
  63. package/skills/ae-engage/references/flow-node-detail-report.md +0 -1
  64. package/skills/ae-engage/references/flow-node-overview-report.md +0 -1
  65. package/skills/ae-engage/references/flow-process-report.md +0 -1
  66. package/skills/ae-engage/references/manage-flow.md +0 -1
  67. package/skills/ae-engage/references/manage-strategy.md +0 -1
  68. package/skills/ae-engage/references/manage-task.md +0 -1
  69. package/skills/ae-engage/references/modify-flow-base-info.md +0 -1
  70. package/skills/ae-engage/references/strategy-detail.md +0 -1
  71. package/skills/ae-engage/references/strategy-list.md +0 -1
  72. package/skills/ae-engage/references/task-data-detail.md +0 -1
  73. package/skills/ae-engage/references/task-data-overview.md +0 -1
  74. package/skills/ae-engage/references/task-detail.md +0 -1
  75. package/skills/ae-engage/references/task-experiment-report.md +0 -1
  76. package/skills/ae-engage/references/task-list.md +0 -1
  77. package/skills/ae-engage/references/task-metric-detail.md +0 -1
  78. package/skills/ae-engage/references/task-stats.md +0 -1
  79. package/skills/ae-engage/references/update-channel-status.md +0 -1
  80. package/skills/ae-engage/references/update-config-channel-status.md +0 -1
  81. package/skills/ae-engage/references/validate-flow-node-config.md +0 -1
  82. package/skills/ae-engage/references/whitelist-list.md +0 -1
  83. package/skills/ae-kb/SKILL.md +1 -0
  84. package/skills/ae-team/SKILL.md +1 -1
  85. package/dist/auth-W2JZ3DKA.js +0 -170
  86. package/dist/chunk-BI5ZVD6T.js +0 -186
  87. package/dist/chunk-MNHE6SSI.js +0 -79
  88. package/dist/chunk-MWWYGZ76.js +0 -130
  89. package/dist/chunk-SRRUNQIM.js +0 -312
  90. package/dist/config-WH3R3IRY.js +0 -258
package/dist/index.js CHANGED
@@ -1,14 +1,22 @@
1
+ import {
2
+ TeAgentApiError,
3
+ TeAgentCredentialsError
4
+ } from "./chunk-VJFUB3H3.js";
1
5
  import {
2
6
  printError,
3
7
  printOutput
4
- } from "./chunk-B4UL2VIJ.js";
8
+ } from "./chunk-CLJF7MQA.js";
9
+ import {
10
+ PermissionError
11
+ } from "./chunk-NOO24N7W.js";
12
+ import {
13
+ SecureStoreAuthError
14
+ } from "./chunk-JM34JPCO.js";
5
15
  import {
6
16
  getActiveHost,
17
+ logger,
7
18
  safeJsonParse
8
- } from "./chunk-BI5ZVD6T.js";
9
- import {
10
- logger
11
- } from "./chunk-MNHE6SSI.js";
19
+ } from "./chunk-SRJIAOBN.js";
12
20
 
13
21
  // src/index.ts
14
22
  import { Command as CommanderCommand } from "commander";
@@ -54,21 +62,38 @@ async function runCommand(cmd, opts, globalOpts) {
54
62
  } catch (err) {
55
63
  const message = err.message || String(err);
56
64
  logger.error(`Command failed: ${message}`);
57
- if (message.includes("token") || message.includes("auth") || message.includes("401") || message.includes("403")) {
65
+ if (err instanceof TeAgentCredentialsError) {
66
+ printError("config", message, err.hint);
67
+ } else if (err instanceof PermissionError) {
68
+ printError("permission", message);
69
+ } else if (err instanceof SecureStoreAuthError) {
70
+ printError("auth", message, "Run: ae-cli auth login");
71
+ } else if (err instanceof TeAgentApiError) {
72
+ if (err.status === 403) {
73
+ printError("permission", message);
74
+ } else if (err.status === 401) {
75
+ printError("auth", message, "Run: ae-cli auth login");
76
+ } else {
77
+ printError("api", message);
78
+ }
79
+ } else if (looksLikeAuthFailure(message)) {
58
80
  printError("auth", message, "Run: ae-cli auth login");
59
- } else if (message.includes("AE API error")) {
60
- printError("api", message);
61
81
  } else {
62
82
  printError("api", message);
63
83
  }
64
84
  process.exit(1);
65
85
  }
66
86
  }
87
+ function looksLikeAuthFailure(message) {
88
+ const m = message.toLowerCase();
89
+ if (m.includes("403") || m.includes("forbidden") || m.includes("permission")) return false;
90
+ return m.includes("401") || m.includes("unauthorized") || m.includes("session expired") || m.includes("invalid access token") || m.includes("-1001") || m.includes("\u767B\u5F55") || m.includes("ae-cli auth login");
91
+ }
67
92
  function createRuntimeContext(cmd, opts, globalOpts) {
68
93
  let _clientModule = null;
69
94
  async function getClient() {
70
95
  if (!_clientModule) {
71
- _clientModule = await import("./client-IU2E5IOL.js");
96
+ _clientModule = await import("./client-IN42F223.js");
72
97
  }
73
98
  return _clientModule;
74
99
  }
@@ -111,7 +136,7 @@ function createRuntimeContext(cmd, opts, globalOpts) {
111
136
  return client.queryReportData(projectId, reportId, qp, eventModel, options, ctx.host());
112
137
  },
113
138
  async token() {
114
- const { getToken } = await import("./auth-TXFJHPXU.js");
139
+ const { getToken } = await import("./auth-U25QJU5D.js");
115
140
  return getToken(ctx.host());
116
141
  },
117
142
  host() {
@@ -168,8 +193,10 @@ function registerCommands(program2, commands) {
168
193
  sub.option(flagStr, flag.desc);
169
194
  }
170
195
  }
196
+ sub.option("--host <url>", "Override active AE host URL for this command");
171
197
  sub.action(async (opts) => {
172
198
  const globalOpts = extractGlobalOptions(program2);
199
+ if (opts.host) globalOpts.host = opts.host;
173
200
  await runCommand(cmd, opts, globalOpts);
174
201
  });
175
202
  }
@@ -358,52 +385,52 @@ program.name("ae-cli").version(version).description("CLI tool for ThinkingAI (AE
358
385
  async function loadCommands() {
359
386
  const commands = [];
360
387
  try {
361
- const teAnalysis = await import("./te-analysis-CMXADIJM.js");
388
+ const teAnalysis = await import("./te-analysis-CB3DA5I5.js");
362
389
  commands.push(...teAnalysis.default);
363
390
  } catch {
364
391
  }
365
392
  try {
366
- const teAudience = await import("./te-audience-LPZFFSXM.js");
393
+ const teAudience = await import("./te-audience-W7SCQFC7.js");
367
394
  commands.push(...teAudience.default);
368
395
  } catch {
369
396
  }
370
397
  try {
371
- const teMeta = await import("./te-meta-NQ4U3VJW.js");
398
+ const teMeta = await import("./te-meta-PDKLMWXN.js");
372
399
  commands.push(...teMeta.default);
373
400
  } catch {
374
401
  }
375
402
  try {
376
- const teCommon = await import("./te-common-BXQFKTB3.js");
403
+ const teCommon = await import("./te-common-FBXVWBSI.js");
377
404
  commands.push(...teCommon.default);
378
405
  } catch {
379
406
  }
380
407
  try {
381
- const engage = await import("./te-engage-TBUTGW5F.js");
408
+ const engage = await import("./te-engage-KARARMIR.js");
382
409
  commands.push(...engage.default);
383
410
  } catch {
384
411
  }
385
412
  try {
386
- const community = await import("./te-community-K5S3VOZY.js");
413
+ const community = await import("./te-community-LNVDZSGW.js");
387
414
  commands.push(...community.default);
388
415
  } catch {
389
416
  }
390
417
  try {
391
- const dataops = await import("./te-dataops-567IMCQG.js");
418
+ const dataops = await import("./te-dataops-IPCSSWYH.js");
392
419
  commands.push(...dataops.default);
393
420
  } catch {
394
421
  }
395
422
  try {
396
- const teKb = await import("./te-kb-XHVBWP5E.js");
423
+ const teKb = await import("./te-kb-2Z2CARN3.js");
397
424
  commands.push(...teKb.default);
398
425
  } catch {
399
426
  }
400
427
  try {
401
- const teTeam = await import("./te-team-556APRIU.js");
428
+ const teTeam = await import("./te-team-SW5B7DHO.js");
402
429
  commands.push(...teTeam.default);
403
430
  } catch {
404
431
  }
405
432
  try {
406
- const teAgent = await import("./te-agent-FLTDYV3L.js");
433
+ const teAgent = await import("./te-agent-YV4DXEXK.js");
407
434
  commands.push(...teAgent.default);
408
435
  } catch {
409
436
  }
@@ -411,35 +438,35 @@ async function loadCommands() {
411
438
  }
412
439
  async function registerAuthCommands() {
413
440
  try {
414
- const { registerAuth } = await import("./auth-W2JZ3DKA.js");
441
+ const { registerAuth } = await import("./auth-H3GJD55A.js");
415
442
  registerAuth(program);
416
443
  } catch {
417
444
  }
418
445
  }
419
446
  async function registerConfigCommands() {
420
447
  try {
421
- const { registerConfig } = await import("./config-WH3R3IRY.js");
448
+ const { registerConfig } = await import("./config-64G36TJL.js");
422
449
  registerConfig(program);
423
450
  } catch {
424
451
  }
425
452
  }
426
453
  async function registerApiCommand() {
427
454
  try {
428
- const { registerApi } = await import("./raw-TUHZQ4UB.js");
455
+ const { registerApi } = await import("./raw-WJIWC6YP.js");
429
456
  registerApi(program);
430
457
  } catch {
431
458
  }
432
459
  }
433
460
  async function registerSyncCommand() {
434
461
  try {
435
- const { registerSync } = await import("./sync-EVEDS7YE.js");
462
+ const { registerSync } = await import("./sync-NVASAISS.js");
436
463
  registerSync(program);
437
464
  } catch {
438
465
  }
439
466
  }
440
467
  async function registerModelCommand() {
441
468
  try {
442
- const { registerModel } = await import("./model-CC7U5XOJ.js");
469
+ const { registerModel } = await import("./model-VZCYNIOG.js");
443
470
  registerModel(program);
444
471
  } catch {
445
472
  }
@@ -2,14 +2,15 @@ import {
2
2
  MultiselectCancelled,
3
3
  getCurrentWorkspace,
4
4
  promptSingleCheckboxSelect
5
- } from "./chunk-6T7245YE.js";
5
+ } from "./chunk-EGEIXA2Z.js";
6
6
  import {
7
7
  TeAgentApiError,
8
8
  TeAgentCredentialsError,
9
9
  getClaudeConfigDir,
10
10
  getSandboxModels,
11
11
  postSandboxModelSelection
12
- } from "./chunk-TG64AQV4.js";
12
+ } from "./chunk-VJFUB3H3.js";
13
+ import "./chunk-SRJIAOBN.js";
13
14
 
14
15
  // src/commands/model/index.ts
15
16
  import { existsSync, readFileSync } from "fs";
@@ -50,7 +51,7 @@ async function runModelPicker() {
50
51
  const current = readCurrentModelSelection();
51
52
  const models = await getSandboxModels();
52
53
  if (models.length === 0) {
53
- process.stderr.write("\u5F53\u524D\u7528\u6237\u65E0\u53EF\u89C1\u6A21\u578B\n");
54
+ process.stderr.write("No models visible to the current user\n");
54
55
  return;
55
56
  }
56
57
  const sorted = models.slice().sort((a, b) => {
@@ -63,32 +64,32 @@ async function runModelPicker() {
63
64
  return scopeDiff !== 0 ? scopeDiff : a.name.localeCompare(b.name);
64
65
  });
65
66
  const picked = await promptSingleCheckboxSelect({
66
- title: "\u9009\u62E9\u8981\u4F7F\u7528\u7684\u6A21\u578B",
67
+ title: "Select a model to use",
67
68
  items: sorted.map((model) => {
68
69
  const isCurrent = isCurrentModel(model, current);
69
70
  return {
70
71
  value: model,
71
72
  label: `${model.name} ${model.scope}`,
72
- hint: isCurrent ? "(\u5F53\u524D)" : void 0,
73
+ hint: isCurrent ? "(current)" : void 0,
73
74
  preselected: isCurrent
74
75
  };
75
76
  })
76
77
  });
77
78
  const workspace = getCurrentWorkspace();
78
79
  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.stderr.write("Please run ae-cli model from within a te-agent workspace directory\n");
80
81
  process.exitCode = 1;
81
82
  return;
82
83
  }
83
84
  if (isCurrentModel(picked, current)) {
84
- process.stdout.write("\u5F53\u524D\u5DF2\u4F7F\u7528\u8BE5\u6A21\u578B\n");
85
+ process.stdout.write("This model is already active\n");
85
86
  return;
86
87
  }
87
88
  await postSandboxModelSelection({
88
89
  workspacePath: workspace.name,
89
90
  modelId: picked.id
90
91
  });
91
- process.stdout.write(`\u5DF2\u5207\u6362\u4E3A ${picked.name}
92
+ process.stdout.write(`Switched to ${picked.name}
92
93
  `);
93
94
  }
94
95
  function registerModel(program) {
@@ -102,7 +103,7 @@ function registerModel(program) {
102
103
  }
103
104
  function handleError(err) {
104
105
  if (err instanceof MultiselectCancelled) {
105
- process.stderr.write("\u5DF2\u53D6\u6D88\n");
106
+ process.stderr.write("Cancelled\n");
106
107
  return;
107
108
  }
108
109
  if (err instanceof TeAgentCredentialsError) {
@@ -114,7 +115,7 @@ function handleError(err) {
114
115
  return;
115
116
  }
116
117
  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
+ process.stderr.write(`\u2717 Main app error (${err.status}${err.code ? " " + err.code : ""}): ${err.message}
118
119
  `);
119
120
  process.exitCode = 1;
120
121
  return;
@@ -1,18 +1,20 @@
1
1
  import {
2
2
  printError,
3
3
  printOutput
4
- } from "./chunk-B4UL2VIJ.js";
4
+ } from "./chunk-CLJF7MQA.js";
5
5
  import {
6
6
  httpGet,
7
7
  httpPost
8
- } from "./chunk-VT6VC4PA.js";
8
+ } from "./chunk-I42JGQ2J.js";
9
9
  import {
10
10
  resolveHost
11
- } from "./chunk-SRRUNQIM.js";
11
+ } from "./chunk-U6TKB3IV.js";
12
+ import {
13
+ SecureStoreAuthError
14
+ } from "./chunk-JM34JPCO.js";
12
15
  import {
13
16
  safeJsonParse
14
- } from "./chunk-BI5ZVD6T.js";
15
- import "./chunk-MNHE6SSI.js";
17
+ } from "./chunk-SRJIAOBN.js";
16
18
 
17
19
  // src/api/raw.ts
18
20
  function registerApi(program) {
@@ -22,7 +24,7 @@ function registerApi(program) {
22
24
  const format = globalOpts.format || "json";
23
25
  const jq = globalOpts.jq;
24
26
  if (!host) {
25
- printError("config", "No AE host configured.", "Run: ae-cli config set-host");
27
+ printError("config", "No AE host configured.", "Run: ae-cli config set-host <url>");
26
28
  process.exit(1);
27
29
  }
28
30
  try {
@@ -52,7 +54,11 @@ function registerApi(program) {
52
54
  }
53
55
  printOutput(result, format, jq);
54
56
  } catch (err) {
55
- printError("api", err.message);
57
+ if (err instanceof SecureStoreAuthError) {
58
+ printError("auth", err.message, "Run: ae-cli auth login");
59
+ } else {
60
+ printError("api", err.message);
61
+ }
56
62
  process.exit(1);
57
63
  }
58
64
  });