@thinkingai/ae-cli 1.0.24 → 1.0.28

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 (106) hide show
  1. package/README.md +17 -2
  2. package/README.zh.md +18 -2
  3. package/dist/auth-5NSDQFQB.js +454 -0
  4. package/dist/{auth-4OPL4YWG.js → auth-H2376DEF.js} +2 -2
  5. package/dist/chunk-AD5V3ZPJ.js +217 -0
  6. package/dist/chunk-CAQYQA4R.js +399 -0
  7. package/dist/{chunk-JJCRURTR.js → chunk-CLJF7MQA.js} +1 -1
  8. package/dist/chunk-GSJGPNKK.js +49 -0
  9. package/dist/chunk-IMBKVXKY.js +478 -0
  10. package/dist/chunk-KAEZTSXN.js +99 -0
  11. package/dist/{chunk-MZW6NOVS.js → chunk-LU7SXK4Q.js} +27 -8
  12. package/dist/chunk-OJDNO5QY.js +63 -0
  13. package/dist/{chunk-DC66L5AM.js → chunk-SRJIAOBN.js} +76 -91
  14. package/dist/{chunk-OVHL4JAC.js → chunk-WCHI7725.js} +44 -47
  15. package/dist/{client-TDH6MUWM.js → client-FCMK3XEK.js} +5 -3
  16. package/dist/config-64G36TJL.js +130 -0
  17. package/dist/index.js +50 -17
  18. package/dist/model-EZ6K7FXI.js +134 -0
  19. package/dist/{raw-EM7AP3RT.js → raw-VEF3D6UD.js} +11 -6
  20. package/dist/sync-NRODEVNH.js +385 -0
  21. package/dist/te-agent-7U7JLJKU.js +524 -0
  22. package/dist/{te-analysis-3KFSNUCJ.js → te-analysis-A2OSGHQ4.js} +136 -20
  23. package/dist/{te-audience-GMYJFCSC.js → te-audience-LI67PPGO.js} +5 -4
  24. package/dist/{te-common-YLERCMQI.js → te-common-35WVU3C5.js} +19 -8
  25. package/dist/{te-community-PYDN5A6B.js → te-community-LEAP6PWT.js} +4 -3
  26. package/dist/{te-dataops-ETWS5O3X.js → te-dataops-N2LGZBOX.js} +4 -3
  27. package/dist/{te-engage-ROJVZHDA.js → te-engage-H7C72Z46.js} +105 -49
  28. package/dist/{te-kb-VUNS2CC7.js → te-kb-I2OKTBAI.js} +225 -29
  29. package/dist/{te-meta-3EFWLM3A.js → te-meta-HBTIEDRO.js} +4 -3
  30. package/dist/te-team-EM5OWRQL.js +529 -0
  31. package/package.json +10 -2
  32. package/skills/ae-agent/SKILL.md +134 -0
  33. package/skills/ae-analysis/SKILL.md +1 -1
  34. package/skills/ae-analysis/references/drilldown_user_events.md +1 -1
  35. package/skills/ae-analysis/references/drilldown_users.md +2 -2
  36. package/skills/ae-analysis/references/list_clusters.md +4 -2
  37. package/skills/ae-analysis/references/query_adhoc.md +3 -2
  38. package/skills/ae-analysis/references/query_entity_details.md +1 -1
  39. package/skills/ae-analysis-global/SKILL.md +51 -0
  40. package/skills/ae-analysis-global/references/list_query_clusters.md +67 -0
  41. package/skills/ae-community/SKILL.md +2 -3
  42. package/skills/ae-dataops/SKILL.md +1 -2
  43. package/skills/ae-engage/SKILL.md +26 -2
  44. package/skills/ae-engage/references/add-approver.md +0 -1
  45. package/skills/ae-engage/references/add-channel.md +0 -1
  46. package/skills/ae-engage/references/approver-list.md +0 -1
  47. package/skills/ae-engage/references/build-task-save-guide.md +283 -0
  48. package/skills/ae-engage/references/cancel-query-by-request-id.md +0 -1
  49. package/skills/ae-engage/references/channel-detail.md +0 -1
  50. package/skills/ae-engage/references/channel-list.md +0 -1
  51. package/skills/ae-engage/references/config-channel-detail.md +0 -1
  52. package/skills/ae-engage/references/config-channel-list.md +0 -1
  53. package/skills/ae-engage/references/config-item-analysis-report.md +0 -1
  54. package/skills/ae-engage/references/config-item-detail.md +0 -1
  55. package/skills/ae-engage/references/config-item-list.md +0 -1
  56. package/skills/ae-engage/references/config-item-strategy-comparison.md +0 -1
  57. package/skills/ae-engage/references/config-item-trigger-report.md +0 -1
  58. package/skills/ae-engage/references/copy-config-template.md +0 -1
  59. package/skills/ae-engage/references/delete-channel.md +0 -1
  60. package/skills/ae-engage/references/delete-config-channel.md +0 -1
  61. package/skills/ae-engage/references/delete-config-item.md +0 -1
  62. package/skills/ae-engage/references/delete-flow.md +0 -1
  63. package/skills/ae-engage/references/flow-ab-split-node-report.md +0 -1
  64. package/skills/ae-engage/references/flow-detail.md +0 -1
  65. package/skills/ae-engage/references/flow-list.md +0 -1
  66. package/skills/ae-engage/references/flow-node-config-schema.md +0 -1
  67. package/skills/ae-engage/references/flow-node-detail-report.md +0 -1
  68. package/skills/ae-engage/references/flow-node-overview-report.md +0 -1
  69. package/skills/ae-engage/references/flow-process-report.md +0 -1
  70. package/skills/ae-engage/references/manage-flow.md +0 -1
  71. package/skills/ae-engage/references/manage-strategy.md +0 -1
  72. package/skills/ae-engage/references/manage-task.md +0 -1
  73. package/skills/ae-engage/references/modify-flow-base-info.md +0 -1
  74. package/skills/ae-engage/references/save-task.md +304 -0
  75. package/skills/ae-engage/references/strategy-detail.md +0 -1
  76. package/skills/ae-engage/references/strategy-list.md +0 -1
  77. package/skills/ae-engage/references/task-data-detail.md +0 -1
  78. package/skills/ae-engage/references/task-data-overview.md +0 -1
  79. package/skills/ae-engage/references/task-detail.md +0 -1
  80. package/skills/ae-engage/references/task-experiment-report.md +0 -1
  81. package/skills/ae-engage/references/task-list.md +0 -1
  82. package/skills/ae-engage/references/task-metric-detail.md +0 -1
  83. package/skills/ae-engage/references/task-stats.md +0 -1
  84. package/skills/ae-engage/references/update-channel-status.md +0 -1
  85. package/skills/ae-engage/references/update-config-channel-status.md +0 -1
  86. package/skills/ae-engage/references/validate-flow-node-config.md +0 -1
  87. package/skills/ae-engage/references/whitelist-list.md +0 -1
  88. package/skills/ae-kb/SKILL.md +284 -0
  89. package/skills/ae-team/SKILL.md +164 -0
  90. package/skills/ae-team/references/ai-generate.md +39 -0
  91. package/skills/ae-team/references/create.md +94 -0
  92. package/skills/ae-team/references/delete.md +39 -0
  93. package/skills/ae-team/references/list-projects.md +45 -0
  94. package/skills/ae-team/references/list-templates.md +38 -0
  95. package/skills/ae-team/references/list.md +39 -0
  96. package/skills/ae-team/references/run-artifacts.md +51 -0
  97. package/skills/ae-team/references/run-cancel.md +38 -0
  98. package/skills/ae-team/references/run-chat.md +57 -0
  99. package/skills/ae-team/references/run-reply.md +41 -0
  100. package/skills/ae-team/references/run-result.md +75 -0
  101. package/skills/ae-team/references/run-start.md +73 -0
  102. package/skills/ae-team/references/run-watch.md +82 -0
  103. package/skills/ae-team/references/update.md +47 -0
  104. package/dist/auth-PBPAZQWP.js +0 -168
  105. package/dist/chunk-47MTN54I.js +0 -285
  106. package/dist/config-5ELRYAIH.js +0 -257
package/dist/index.js CHANGED
@@ -1,12 +1,15 @@
1
+ import {
2
+ TeAgentCredentialsError
3
+ } from "./chunk-KAEZTSXN.js";
1
4
  import {
2
5
  printError,
3
6
  printOutput
4
- } from "./chunk-JJCRURTR.js";
7
+ } from "./chunk-CLJF7MQA.js";
5
8
  import {
6
9
  getActiveHost,
7
10
  logger,
8
11
  safeJsonParse
9
- } from "./chunk-DC66L5AM.js";
12
+ } from "./chunk-SRJIAOBN.js";
10
13
 
11
14
  // src/index.ts
12
15
  import { Command as CommanderCommand } from "commander";
@@ -52,7 +55,9 @@ async function runCommand(cmd, opts, globalOpts) {
52
55
  } catch (err) {
53
56
  const message = err.message || String(err);
54
57
  logger.error(`Command failed: ${message}`);
55
- if (message.includes("token") || message.includes("auth") || message.includes("401") || message.includes("403")) {
58
+ if (err instanceof TeAgentCredentialsError) {
59
+ printError("config", message, err.hint);
60
+ } else if (message.includes("token") || message.includes("auth") || message.includes("401") || message.includes("403")) {
56
61
  printError("auth", message, "Run: ae-cli auth login");
57
62
  } else if (message.includes("AE API error")) {
58
63
  printError("api", message);
@@ -66,7 +71,7 @@ function createRuntimeContext(cmd, opts, globalOpts) {
66
71
  let _clientModule = null;
67
72
  async function getClient() {
68
73
  if (!_clientModule) {
69
- _clientModule = await import("./client-TDH6MUWM.js");
74
+ _clientModule = await import("./client-FCMK3XEK.js");
70
75
  }
71
76
  return _clientModule;
72
77
  }
@@ -97,7 +102,7 @@ function createRuntimeContext(cmd, opts, globalOpts) {
97
102
  if (method.toUpperCase() === "GET") {
98
103
  return client.httpGet(path2, params, ctx.host());
99
104
  } else {
100
- return client.httpPost(path2, params, data, ctx.host());
105
+ return client.httpRequest(method, path2, params, data, ctx.host());
101
106
  }
102
107
  },
103
108
  async querySql(projectId, sql) {
@@ -109,7 +114,7 @@ function createRuntimeContext(cmd, opts, globalOpts) {
109
114
  return client.queryReportData(projectId, reportId, qp, eventModel, options, ctx.host());
110
115
  },
111
116
  async token() {
112
- const { getToken } = await import("./auth-4OPL4YWG.js");
117
+ const { getToken } = await import("./auth-H2376DEF.js");
113
118
  return getToken(ctx.host());
114
119
  },
115
120
  host() {
@@ -166,8 +171,10 @@ function registerCommands(program2, commands) {
166
171
  sub.option(flagStr, flag.desc);
167
172
  }
168
173
  }
174
+ sub.option("--host <url>", "Override active AE host URL for this command");
169
175
  sub.action(async (opts) => {
170
176
  const globalOpts = extractGlobalOptions(program2);
177
+ if (opts.host) globalOpts.host = opts.host;
171
178
  await runCommand(cmd, opts, globalOpts);
172
179
  });
173
180
  }
@@ -356,68 +363,92 @@ program.name("ae-cli").version(version).description("CLI tool for ThinkingAI (AE
356
363
  async function loadCommands() {
357
364
  const commands = [];
358
365
  try {
359
- const teAnalysis = await import("./te-analysis-3KFSNUCJ.js");
366
+ const teAnalysis = await import("./te-analysis-A2OSGHQ4.js");
360
367
  commands.push(...teAnalysis.default);
361
368
  } catch {
362
369
  }
363
370
  try {
364
- const teAudience = await import("./te-audience-GMYJFCSC.js");
371
+ const teAudience = await import("./te-audience-LI67PPGO.js");
365
372
  commands.push(...teAudience.default);
366
373
  } catch {
367
374
  }
368
375
  try {
369
- const teMeta = await import("./te-meta-3EFWLM3A.js");
376
+ const teMeta = await import("./te-meta-HBTIEDRO.js");
370
377
  commands.push(...teMeta.default);
371
378
  } catch {
372
379
  }
373
380
  try {
374
- const teCommon = await import("./te-common-YLERCMQI.js");
381
+ const teCommon = await import("./te-common-35WVU3C5.js");
375
382
  commands.push(...teCommon.default);
376
383
  } catch {
377
384
  }
378
385
  try {
379
- const engage = await import("./te-engage-ROJVZHDA.js");
386
+ const engage = await import("./te-engage-H7C72Z46.js");
380
387
  commands.push(...engage.default);
381
388
  } catch {
382
389
  }
383
390
  try {
384
- const community = await import("./te-community-PYDN5A6B.js");
391
+ const community = await import("./te-community-LEAP6PWT.js");
385
392
  commands.push(...community.default);
386
393
  } catch {
387
394
  }
388
395
  try {
389
- const dataops = await import("./te-dataops-ETWS5O3X.js");
396
+ const dataops = await import("./te-dataops-N2LGZBOX.js");
390
397
  commands.push(...dataops.default);
391
398
  } catch {
392
399
  }
393
400
  try {
394
- const teKb = await import("./te-kb-VUNS2CC7.js");
401
+ const teKb = await import("./te-kb-I2OKTBAI.js");
395
402
  commands.push(...teKb.default);
396
403
  } catch {
397
404
  }
405
+ try {
406
+ const teTeam = await import("./te-team-EM5OWRQL.js");
407
+ commands.push(...teTeam.default);
408
+ } catch {
409
+ }
410
+ try {
411
+ const teAgent = await import("./te-agent-7U7JLJKU.js");
412
+ commands.push(...teAgent.default);
413
+ } catch {
414
+ }
398
415
  return commands;
399
416
  }
400
417
  async function registerAuthCommands() {
401
418
  try {
402
- const { registerAuth } = await import("./auth-PBPAZQWP.js");
419
+ const { registerAuth } = await import("./auth-5NSDQFQB.js");
403
420
  registerAuth(program);
404
421
  } catch {
405
422
  }
406
423
  }
407
424
  async function registerConfigCommands() {
408
425
  try {
409
- const { registerConfig } = await import("./config-5ELRYAIH.js");
426
+ const { registerConfig } = await import("./config-64G36TJL.js");
410
427
  registerConfig(program);
411
428
  } catch {
412
429
  }
413
430
  }
414
431
  async function registerApiCommand() {
415
432
  try {
416
- const { registerApi } = await import("./raw-EM7AP3RT.js");
433
+ const { registerApi } = await import("./raw-VEF3D6UD.js");
417
434
  registerApi(program);
418
435
  } catch {
419
436
  }
420
437
  }
438
+ async function registerSyncCommand() {
439
+ try {
440
+ const { registerSync } = await import("./sync-NRODEVNH.js");
441
+ registerSync(program);
442
+ } catch {
443
+ }
444
+ }
445
+ async function registerModelCommand() {
446
+ try {
447
+ const { registerModel } = await import("./model-EZ6K7FXI.js");
448
+ registerModel(program);
449
+ } catch {
450
+ }
451
+ }
421
452
  async function main() {
422
453
  notifyIfUpdateAvailable({ name: pkg.name, version: pkg.version });
423
454
  const commands = await loadCommands();
@@ -425,6 +456,8 @@ async function main() {
425
456
  await registerAuthCommands();
426
457
  await registerConfigCommands();
427
458
  await registerApiCommand();
459
+ await registerSyncCommand();
460
+ await registerModelCommand();
428
461
  program.parse();
429
462
  }
430
463
  main();
@@ -0,0 +1,134 @@
1
+ import {
2
+ MultiselectCancelled,
3
+ getCurrentWorkspace,
4
+ promptSingleCheckboxSelect
5
+ } from "./chunk-IMBKVXKY.js";
6
+ import {
7
+ TeAgentApiError,
8
+ getSandboxModels,
9
+ postSandboxModelSelection
10
+ } from "./chunk-AD5V3ZPJ.js";
11
+ import {
12
+ TeAgentCredentialsError,
13
+ getClaudeConfigDir
14
+ } from "./chunk-KAEZTSXN.js";
15
+ import "./chunk-SRJIAOBN.js";
16
+
17
+ // src/commands/model/index.ts
18
+ import { existsSync, readFileSync } from "fs";
19
+ import { join } from "path";
20
+ function readCurrentModelSelection() {
21
+ const settingsPath = join(getClaudeConfigDir(), "settings.json");
22
+ if (!existsSync(settingsPath)) return { routingModelId: null, providerModelId: null };
23
+ try {
24
+ const raw = readFileSync(settingsPath, "utf8");
25
+ const parsed = JSON.parse(raw);
26
+ if (!parsed || typeof parsed !== "object") {
27
+ return { routingModelId: null, providerModelId: null };
28
+ }
29
+ const env = parsed.env && typeof parsed.env === "object" ? parsed.env : {};
30
+ const headers = typeof env.ANTHROPIC_CUSTOM_HEADERS === "string" ? env.ANTHROPIC_CUSTOM_HEADERS : void 0;
31
+ const routingModelId = extractModelIdHeader(headers);
32
+ const providerModelId = typeof parsed.model === "string" && parsed.model ? parsed.model : typeof env.ANTHROPIC_MODEL === "string" && env.ANTHROPIC_MODEL ? env.ANTHROPIC_MODEL : null;
33
+ return { routingModelId, providerModelId };
34
+ } catch {
35
+ return { routingModelId: null, providerModelId: null };
36
+ }
37
+ }
38
+ function extractModelIdHeader(headers) {
39
+ if (!headers) return null;
40
+ for (const line of headers.split(/\r?\n/)) {
41
+ const match = line.match(/^\s*model-id\s*:\s*(.+?)\s*$/);
42
+ if (match?.[1]) {
43
+ return match[1];
44
+ }
45
+ }
46
+ return null;
47
+ }
48
+ function isCurrentModel(model, current) {
49
+ if (current.routingModelId) return model.id === current.routingModelId;
50
+ return model.scope === "system" && Boolean(current.providerModelId) && model.modelId === current.providerModelId;
51
+ }
52
+ async function runModelPicker() {
53
+ const current = readCurrentModelSelection();
54
+ const models = await getSandboxModels();
55
+ if (models.length === 0) {
56
+ process.stderr.write("No models visible to the current user\n");
57
+ return;
58
+ }
59
+ const sorted = models.slice().sort((a, b) => {
60
+ const scopeOrder = {
61
+ system: 0,
62
+ company: 1,
63
+ personal: 2
64
+ };
65
+ const scopeDiff = scopeOrder[a.scope] - scopeOrder[b.scope];
66
+ return scopeDiff !== 0 ? scopeDiff : a.name.localeCompare(b.name);
67
+ });
68
+ const picked = await promptSingleCheckboxSelect({
69
+ title: "Select a model to use",
70
+ items: sorted.map((model) => {
71
+ const isCurrent = isCurrentModel(model, current);
72
+ return {
73
+ value: model,
74
+ label: `${model.name} ${model.scope}`,
75
+ hint: isCurrent ? "(current)" : void 0,
76
+ preselected: isCurrent
77
+ };
78
+ })
79
+ });
80
+ const workspace = getCurrentWorkspace();
81
+ if (!workspace) {
82
+ process.stderr.write("Please run ae-cli model from within a te-agent workspace directory\n");
83
+ process.exitCode = 1;
84
+ return;
85
+ }
86
+ if (isCurrentModel(picked, current)) {
87
+ process.stdout.write("This model is already active\n");
88
+ return;
89
+ }
90
+ await postSandboxModelSelection({
91
+ workspacePath: workspace.name,
92
+ modelId: picked.id
93
+ });
94
+ process.stdout.write(`Switched to ${picked.name}
95
+ `);
96
+ }
97
+ function registerModel(program) {
98
+ program.command("model").description("Choose and switch the current workspace model (te-agent sandbox only)").action(async () => {
99
+ try {
100
+ await runModelPicker();
101
+ } catch (err) {
102
+ handleError(err);
103
+ }
104
+ });
105
+ }
106
+ function handleError(err) {
107
+ if (err instanceof MultiselectCancelled) {
108
+ process.stderr.write("Cancelled\n");
109
+ return;
110
+ }
111
+ if (err instanceof TeAgentCredentialsError) {
112
+ process.stderr.write(`\u2717 ${err.message}
113
+ `);
114
+ if (err.hint) process.stderr.write(` ${err.hint}
115
+ `);
116
+ process.exitCode = 1;
117
+ return;
118
+ }
119
+ if (err instanceof TeAgentApiError) {
120
+ process.stderr.write(`\u2717 Main app error (${err.status}${err.code ? " " + err.code : ""}): ${err.message}
121
+ `);
122
+ process.exitCode = 1;
123
+ return;
124
+ }
125
+ const msg = err instanceof Error ? err.message : String(err);
126
+ process.stderr.write(`\u2717 ${msg}
127
+ `);
128
+ process.exitCode = 1;
129
+ }
130
+ export {
131
+ extractModelIdHeader,
132
+ readCurrentModelSelection,
133
+ registerModel
134
+ };
@@ -1,17 +1,18 @@
1
1
  import {
2
2
  printError,
3
3
  printOutput
4
- } from "./chunk-JJCRURTR.js";
4
+ } from "./chunk-CLJF7MQA.js";
5
5
  import {
6
6
  httpGet,
7
7
  httpPost
8
- } from "./chunk-MZW6NOVS.js";
8
+ } from "./chunk-LU7SXK4Q.js";
9
9
  import {
10
+ SecureStoreAuthError,
10
11
  resolveHost
11
- } from "./chunk-47MTN54I.js";
12
+ } from "./chunk-CAQYQA4R.js";
12
13
  import {
13
14
  safeJsonParse
14
- } from "./chunk-DC66L5AM.js";
15
+ } from "./chunk-SRJIAOBN.js";
15
16
 
16
17
  // src/api/raw.ts
17
18
  function registerApi(program) {
@@ -21,7 +22,7 @@ function registerApi(program) {
21
22
  const format = globalOpts.format || "json";
22
23
  const jq = globalOpts.jq;
23
24
  if (!host) {
24
- printError("config", "No AE host configured.", "Run: ae-cli config set-host");
25
+ printError("config", "No AE host configured.", "Run: ae-cli config set-host <url>");
25
26
  process.exit(1);
26
27
  }
27
28
  try {
@@ -51,7 +52,11 @@ function registerApi(program) {
51
52
  }
52
53
  printOutput(result, format, jq);
53
54
  } catch (err) {
54
- printError("api", err.message);
55
+ if (err instanceof SecureStoreAuthError) {
56
+ printError("auth", err.message, "Run: ae-cli auth login");
57
+ } else {
58
+ printError("api", err.message);
59
+ }
55
60
  process.exit(1);
56
61
  }
57
62
  });