@thinkingai/ae-cli 6.1.25 → 6.1.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 (121) hide show
  1. package/README.md +28 -9
  2. package/README.zh.md +25 -9
  3. package/bin/ae-cli.js +6 -1
  4. package/cli-installation-guide.md +91 -0
  5. package/dist/{auth-LHM7NQPR.js → auth-WA7YGGRT.js} +6 -8
  6. package/dist/automation-VAAQBM7Y.js +459 -0
  7. package/dist/{capability-SJI5KOCK.js → capability-GAAYJ3IQ.js} +6 -6
  8. package/dist/{chunk-KJDOTPYU.js → chunk-3YVEAZUN.js} +59 -26
  9. package/dist/{chunk-KS4DE3MX.js → chunk-5XJYLEVC.js} +4 -4
  10. package/dist/{chunk-BW7JUDEI.js → chunk-6VNIR4AP.js} +514 -213
  11. package/dist/{chunk-5XRQ3CZR.js → chunk-7KU2WNQE.js} +43 -8
  12. package/dist/{chunk-7WZACOAI.js → chunk-AP7YP2NX.js} +2 -2
  13. package/dist/{chunk-XKIW3QMF.js → chunk-AQJPNWZF.js} +3 -3
  14. package/dist/chunk-CI24BDR2.js +43 -0
  15. package/dist/{chunk-SO5LKIWP.js → chunk-CT7QDJS6.js} +2 -2
  16. package/dist/{chunk-DU72X2IO.js → chunk-GHXZK54S.js} +22 -10
  17. package/dist/{chunk-2FJM4HRV.js → chunk-MWIA43UJ.js} +3 -3
  18. package/dist/{chunk-N4BLPJC7.js → chunk-OP44TT4H.js} +1 -1
  19. package/dist/chunk-Q5US7JC5.js +133 -0
  20. package/dist/chunk-RK6GLDGI.js +27 -0
  21. package/dist/chunk-RPBOAQQQ.js +56 -0
  22. package/dist/{chunk-GK7WDY7E.js → chunk-S6M42KND.js} +1 -1
  23. package/dist/{chunk-QYXDJOLA.js → chunk-VZZNLV3I.js} +19 -11
  24. package/dist/{chunk-YVGXGTD6.js → chunk-WNGFSIOB.js} +7 -1
  25. package/dist/{chunk-IG3DYEIR.js → chunk-ZL7SGNIA.js} +5 -3
  26. package/dist/{community-report-client-6VJDDMJJ.js → community-report-client-PEERQCX2.js} +1 -1
  27. package/dist/{config-XQWOPDHN.js → config-JOD5DOPE.js} +4 -4
  28. package/dist/context-NGVFPCBK.js +136 -0
  29. package/dist/{data-integration-XBTCGXQT.js → data-integration-BCLQFTGU.js} +6 -6
  30. package/dist/index.js +123 -46
  31. package/dist/{local-data-upload-client-3P7NIVQ4.js → local-data-upload-client-TWMHFLUA.js} +1 -1
  32. package/dist/memory-CQKH2JAV.js +580 -0
  33. package/dist/{metadata-JRYKNUS5.js → metadata-NR3PHR23.js} +7 -7
  34. package/dist/{model-ZS7HVGKN.js → model-VX5M2CJ6.js} +9 -5
  35. package/dist/{personal-semantic-preference-IDE2GE5T.js → personal-semantic-preference-2RAI36P3.js} +117 -11
  36. package/dist/{project-semantic-36KOCYN7.js → project-semantic-3BUGP3ZM.js} +6 -6
  37. package/dist/{sync-EQLSTUS7.js → sync-RZIAV37C.js} +12 -8
  38. package/dist/{te-agent-Z3HCTKR7.js → te-agent-AORRE2FM.js} +90 -454
  39. package/dist/{te-analysis-5ZZ6YHVH.js → te-analysis-GP7DSQ7Q.js} +297 -20
  40. package/dist/{te-community-Z7JACGF3.js → te-community-42M7ICDO.js} +3 -3
  41. package/dist/{te-dataops-F7GQOIS6.js → te-dataops-BNKNZ4F2.js} +5 -5
  42. package/dist/{te-engage-RNRMYDO3.js → te-engage-2CO6LRCX.js} +6 -6
  43. package/dist/{te-experiment-BTAC2UNK.js → te-experiment-652CLXMU.js} +6 -6
  44. package/dist/{te-kb-QJLJEX5K.js → te-kb-ULATOTQ3.js} +494 -214
  45. package/dist/{te-system-IXC43QHZ.js → te-system-UGHVKBVV.js} +10 -9
  46. package/dist/{te-team-BIZIKIHZ.js → te-team-YA6SNOJ3.js} +6 -6
  47. package/dist/things-DTCOQIQB.js +1091 -0
  48. package/dist/{update-W2SGQNKT.js → update-ESNYKUVR.js} +59 -51
  49. package/dist/workspace-JEOHKFPX.js +554 -0
  50. package/package.json +21 -9
  51. package/skills/ae-agent/SKILL.md +91 -139
  52. package/skills/ae-agent/references/add-model.md +1 -1
  53. package/skills/ae-agent/references/create-agent.md +1 -1
  54. package/skills/ae-agent/references/find-archived-conversations.md +12 -5
  55. package/skills/ae-agent/references/get-agent.md +1 -1
  56. package/skills/ae-agent/references/list-agents.md +2 -2
  57. package/skills/ae-agent/references/list-models.md +2 -2
  58. package/skills/ae-agent/references/restore-conversation.md +3 -1
  59. package/skills/ae-analysis/SKILL.md +15 -6
  60. package/skills/ae-analysis/references/ai_models/funnel.md +5 -3
  61. package/skills/ae-analysis/references/ai_models.md +27 -0
  62. package/skills/ae-analysis/references/command_index.md +12 -4
  63. package/skills/ae-analysis/references/dashboard_move.md +21 -0
  64. package/skills/ae-analysis/references/dashboard_report_add.md +2 -0
  65. package/skills/ae-analysis/references/dashboard_report_get.md +19 -0
  66. package/skills/ae-analysis/references/dashboard_report_update.md +27 -0
  67. package/skills/ae-analysis/references/dashboard_update.md +1 -1
  68. package/skills/ae-analysis/references/event_report_presentation.md +76 -0
  69. package/skills/ae-analysis/references/feedback_submit.md +37 -0
  70. package/skills/ae-analysis/references/metadata_resolution.md +15 -0
  71. package/skills/ae-analysis/references/personal_semantic_preference_review.md +9 -0
  72. package/skills/ae-analysis/references/personal_semantic_preference_review_list.md +7 -0
  73. package/skills/ae-analysis/references/personal_semantic_preference_submit.md +7 -0
  74. package/skills/ae-analysis/references/project_semantic_knowledge_wiki.md +68 -27
  75. package/skills/ae-analysis/references/project_semantic_knowledge_wiki_plan_schema.md +40 -1
  76. package/skills/ae-analysis/references/report_create.md +13 -3
  77. package/skills/ae-analysis/references/report_get.md +5 -1
  78. package/skills/ae-analysis/references/report_update.md +15 -4
  79. package/skills/ae-analysis/references/system_query_monitor_overview.md +2 -0
  80. package/skills/ae-analysis/references/system_query_task_cancel.md +2 -0
  81. package/skills/ae-analysis/references/system_query_task_export.md +6 -2
  82. package/skills/ae-analysis/references/system_query_task_get.md +2 -0
  83. package/skills/ae-analysis/references/system_query_task_list.md +7 -3
  84. package/skills/ae-analysis/references/system_query_task_options.md +2 -2
  85. package/skills/ae-analysis/references/system_query_task_realtime_list.md +15 -0
  86. package/skills/ae-analysis/references/user_tag_models.md +2 -0
  87. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/build-empty-skeleton.mjs +105 -0
  88. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/build-project-semantic-wiki.mjs +337 -22
  89. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/company-kb.mjs +21 -8
  90. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/default-compile-rules.md +24 -11
  91. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/default-compile-schema.md +66 -0
  92. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/generate-build-ir.mjs +1 -0
  93. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/package-wiki-source-zip.mjs +109 -40
  94. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/plan-kb-source-sync.mjs +1 -1
  95. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/prepare-compile-schema.mjs +64 -0
  96. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/refresh-state-parts.mjs +91 -0
  97. package/skills/ae-automation/SKILL.md +16 -0
  98. package/skills/ae-automation/references/cli.md +53 -0
  99. package/skills/ae-automation/references/command_index.md +17 -0
  100. package/skills/ae-capability/SKILL.md +15 -6
  101. package/skills/ae-current-context/SKILL.md +3 -2
  102. package/skills/ae-kb/SKILL.md +62 -12
  103. package/skills/ae-kb/references/analysis-workflow.md +73 -36
  104. package/skills/ae-kb/references/query-workflow.md +67 -33
  105. package/skills/ae-kb/references/schema-import.md +5 -3
  106. package/skills/ae-kb/references/source-mutations.md +6 -4
  107. package/skills/ae-kb/references/text-sources.md +53 -0
  108. package/skills/ae-kb-discovery/SKILL.md +1 -1
  109. package/skills/ae-team/SKILL.md +23 -17
  110. package/skills/ae-things/SKILL.md +85 -0
  111. package/skills/ae-things/references/cli.md +103 -0
  112. package/skills/ae-things-progress/SKILL.md +43 -0
  113. package/skills/ae-things-review/SKILL.md +42 -0
  114. package/skills/ae-workspace/SKILL.md +43 -0
  115. package/skills/ae-workspace/references/commands.md +51 -0
  116. package/dist/chunk-E2JKXMVO.js +0 -29
  117. package/dist/context-M3HDGEIR.js +0 -46
  118. package/dist/memory-6APEB2JB.js +0 -892
  119. package/skills/ae-agent/references/create-automation.md +0 -125
  120. package/skills/ae-agent/references/list-automations.md +0 -56
  121. package/skills/ae-agent/references/update-automation.md +0 -107
@@ -133,15 +133,20 @@ var logger = new Logger();
133
133
 
134
134
  // src/core/errors.ts
135
135
  var PermissionError = class extends Error {
136
- constructor(message, code, hint) {
136
+ constructor(message, code, hint, details) {
137
137
  super(message);
138
138
  this.code = code;
139
139
  this.hint = hint;
140
+ this.details = details;
140
141
  this.name = "PermissionError";
141
142
  }
142
143
  code;
143
144
  hint;
145
+ details;
144
146
  };
147
+ function isApiErrorType(value) {
148
+ return value === "auth" || value === "permission" || value === "validation" || value === "not_found" || value === "api";
149
+ }
145
150
  var CliValidationError = class extends Error {
146
151
  code;
147
152
  hint;
@@ -216,6 +221,7 @@ export {
216
221
  __toCommonJS,
217
222
  logger,
218
223
  PermissionError,
224
+ isApiErrorType,
219
225
  CliValidationError,
220
226
  CliApiError,
221
227
  CommunityReportError,
@@ -1,7 +1,7 @@
1
1
  import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
2
2
  import {
3
3
  logger
4
- } from "./chunk-YVGXGTD6.js";
4
+ } from "./chunk-WNGFSIOB.js";
5
5
 
6
6
  // src/core/url-utils.ts
7
7
  function normalizeUrl(url) {
@@ -15,6 +15,7 @@ function normalizeUrl(url) {
15
15
  // src/core/config.ts
16
16
  import fs3 from "fs";
17
17
  import path from "path";
18
+ import os from "os";
18
19
 
19
20
  // src/core/json-utils.ts
20
21
  import fs from "fs";
@@ -89,11 +90,11 @@ function isAeSandboxRuntime() {
89
90
  }
90
91
 
91
92
  // src/core/config.ts
92
- var CONFIG_DIR = path.join(process.env.HOME || "", ".ae-cli");
93
+ var CONFIG_DIR = path.join(process.env.HOME || os.homedir(), ".ae-cli");
93
94
  var CONFIG_FILE = path.join(CONFIG_DIR, "config.json");
94
95
  function sandboxCliTokenCandidatePaths() {
95
96
  const paths = [getSandboxCliTokenFilePath()];
96
- const homeFallback = path.join(process.env.HOME || "", ".ae-config", "cli-token.json");
97
+ const homeFallback = path.join(process.env.HOME || os.homedir(), ".ae-config", "cli-token.json");
97
98
  if (!paths.includes(homeFallback)) {
98
99
  paths.push(homeFallback);
99
100
  }
@@ -283,6 +284,7 @@ export {
283
284
  normalizeUrl,
284
285
  getSandboxRuntimeRoot,
285
286
  isAeSandboxRuntime,
287
+ readSandboxCliTokenEntry,
286
288
  getFallbackCliToken,
287
289
  loadConfig,
288
290
  saveConfig,
@@ -2,7 +2,7 @@ import { createRequire as __createRequire } from 'node:module'; const require =
2
2
  import {
3
3
  CommunityReportError,
4
4
  logger
5
- } from "./chunk-YVGXGTD6.js";
5
+ } from "./chunk-WNGFSIOB.js";
6
6
 
7
7
  // src/core/community-report-client.ts
8
8
  var DEFAULT_TIMEOUT_MS = 3e4;
@@ -12,10 +12,10 @@ import {
12
12
  printError,
13
13
  printOutput,
14
14
  resolveKbAutoDiscoveryFeature
15
- } from "./chunk-BW7JUDEI.js";
15
+ } from "./chunk-6VNIR4AP.js";
16
16
  import {
17
17
  peekCliToken
18
- } from "./chunk-DU72X2IO.js";
18
+ } from "./chunk-GHXZK54S.js";
19
19
  import {
20
20
  addHost,
21
21
  getActiveHost,
@@ -26,8 +26,8 @@ import {
26
26
  resolveHostSelector,
27
27
  setActiveHost,
28
28
  updateHostLabel
29
- } from "./chunk-IG3DYEIR.js";
30
- import "./chunk-YVGXGTD6.js";
29
+ } from "./chunk-ZL7SGNIA.js";
30
+ import "./chunk-WNGFSIOB.js";
31
31
 
32
32
  // src/commands/config.ts
33
33
  import * as readline2 from "readline";
@@ -0,0 +1,136 @@
1
+ import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
2
+ import {
3
+ TeAgentApiError,
4
+ getFromMainApp
5
+ } from "./chunk-3YVEAZUN.js";
6
+ import "./chunk-Y74WTIKJ.js";
7
+ import "./chunk-GHXZK54S.js";
8
+ import {
9
+ safeJsonParse
10
+ } from "./chunk-ZL7SGNIA.js";
11
+ import {
12
+ CliValidationError
13
+ } from "./chunk-WNGFSIOB.js";
14
+
15
+ // src/core/current-page-context-client.ts
16
+ async function readCurrentPageContext(path) {
17
+ const url = process.env.TE_AGENT_PAGE_CONTEXT_MCP_URL;
18
+ const grant = process.env.TE_AGENT_PAGE_CONTEXT_TOKEN;
19
+ if (url === void 0 && grant === void 0) return getFromMainApp(path);
20
+ let endpoint;
21
+ try {
22
+ endpoint = new URL(url ?? "");
23
+ if (!grant || !["http:", "https:"].includes(endpoint.protocol) || endpoint.username || endpoint.password || endpoint.search || endpoint.hash || !endpoint.pathname.endsWith("/api/internal/dashboard-context/mcp")) throw new Error();
24
+ } catch {
25
+ throw new TeAgentApiError("Current page context Run binding is invalid.", 0, "CURRENT_PAGE_CONTEXT_BINDING_INVALID");
26
+ }
27
+ let response;
28
+ try {
29
+ response = await fetch(endpoint.toString(), {
30
+ method: "POST",
31
+ redirect: "error",
32
+ signal: AbortSignal.timeout(3e4),
33
+ headers: {
34
+ "Content-Type": "application/json",
35
+ Accept: "application/json, text/event-stream",
36
+ "MCP-Protocol-Version": "2025-03-26",
37
+ "X-TE-Page-Context-Token": grant
38
+ },
39
+ body: JSON.stringify({
40
+ jsonrpc: "2.0",
41
+ id: 1,
42
+ method: "tools/call",
43
+ params: { name: "read_current_page_context", arguments: {} }
44
+ })
45
+ });
46
+ } catch {
47
+ throw new TeAgentApiError("Current page context MCP request failed.", 0, "CURRENT_PAGE_CONTEXT_NETWORK_ERROR");
48
+ }
49
+ if (!response.ok) {
50
+ await response.body?.cancel();
51
+ throw new TeAgentApiError(
52
+ `Current page context authorization/request failed (HTTP ${response.status}).`,
53
+ response.status,
54
+ "CURRENT_PAGE_CONTEXT_UNAVAILABLE",
55
+ void 0,
56
+ response.status === 403 ? "permission" : response.status === 401 ? "auth" : "api"
57
+ );
58
+ }
59
+ const reader = response.body?.getReader();
60
+ if (!reader) throw invalidResponse();
61
+ const chunks = [];
62
+ let size = 0;
63
+ try {
64
+ while (true) {
65
+ const { value, done } = await reader.read();
66
+ if (done) break;
67
+ size += value.byteLength;
68
+ if (size > 4 * 1024 * 1024) throw invalidResponse();
69
+ chunks.push(value);
70
+ }
71
+ } catch {
72
+ await reader.cancel().catch(() => void 0);
73
+ throw invalidResponse();
74
+ } finally {
75
+ reader.releaseLock();
76
+ }
77
+ let envelope;
78
+ try {
79
+ envelope = safeJsonParse(Buffer.concat(chunks).toString("utf8"));
80
+ } catch {
81
+ throw invalidResponse();
82
+ }
83
+ if (envelope?.error || envelope?.result?.isError) {
84
+ throw new TeAgentApiError(
85
+ "Current page context is unavailable for this Run; authorization may have expired or been revoked.",
86
+ 403,
87
+ "CURRENT_PAGE_CONTEXT_UNAVAILABLE"
88
+ );
89
+ }
90
+ const content = envelope?.result?.content;
91
+ if (envelope?.jsonrpc !== "2.0" || envelope.id !== 1 || !Array.isArray(content) || content.length !== 1 || content[0]?.type !== "text") throw invalidResponse();
92
+ try {
93
+ return safeJsonParse(content[0].text);
94
+ } catch {
95
+ throw invalidResponse();
96
+ }
97
+ }
98
+ function invalidResponse() {
99
+ return new TeAgentApiError("Invalid current page context MCP response.", 0, "CURRENT_PAGE_CONTEXT_RESPONSE_INVALID");
100
+ }
101
+
102
+ // src/commands/context/current.ts
103
+ var CURRENT_PAGE_CONTEXT_PATH = "/api/sandbox/agent/context/current";
104
+ function createCurrentPageContextCommand(read = readCurrentPageContext, readConversationId = () => process.env.TE_AGENT_CONVERSATION_ID) {
105
+ return {
106
+ service: "context",
107
+ command: "+current",
108
+ description: "Read the current page context bound to the active Agent Run",
109
+ flags: [],
110
+ risk: "read",
111
+ usesAeHost: false,
112
+ execute: async () => {
113
+ const conversationId = readConversationId()?.trim();
114
+ if (!conversationId) {
115
+ throw new CliValidationError(
116
+ "Current page context is available only inside an active Agent Run.",
117
+ {
118
+ code: "CURRENT_PAGE_CONTEXT_RUN_REQUIRED",
119
+ hint: "Open AE Agent from a supported product page and ask about the current page."
120
+ }
121
+ );
122
+ }
123
+ const query = new URLSearchParams({ conversationId });
124
+ return read(`${CURRENT_PAGE_CONTEXT_PATH}?${query.toString()}`);
125
+ }
126
+ };
127
+ }
128
+ var currentPageContext = createCurrentPageContextCommand();
129
+
130
+ // src/commands/context/index.ts
131
+ var commands = [currentPageContext];
132
+ var context_default = commands;
133
+ export {
134
+ currentPageContext,
135
+ context_default as default
136
+ };
@@ -8,20 +8,20 @@ import {
8
8
  utils,
9
9
  validateAndFix,
10
10
  validateDraft
11
- } from "./chunk-KS4DE3MX.js";
12
- import "./chunk-SO5LKIWP.js";
11
+ } from "./chunk-5XJYLEVC.js";
12
+ import "./chunk-CT7QDJS6.js";
13
13
  import {
14
14
  require_archiver
15
- } from "./chunk-7WZACOAI.js";
16
- import "./chunk-GK7WDY7E.js";
15
+ } from "./chunk-AP7YP2NX.js";
16
+ import "./chunk-S6M42KND.js";
17
17
  import {
18
18
  getConfigDir
19
- } from "./chunk-IG3DYEIR.js";
19
+ } from "./chunk-ZL7SGNIA.js";
20
20
  import {
21
21
  CliValidationError,
22
22
  LocalDataUploadError,
23
23
  __toESM
24
- } from "./chunk-YVGXGTD6.js";
24
+ } from "./chunk-WNGFSIOB.js";
25
25
 
26
26
  // src/commands/data-integration/inspect.ts
27
27
  import { basename as basename3 } from "path";
package/dist/index.js CHANGED
@@ -14,49 +14,50 @@ import {
14
14
  validateAndFix,
15
15
  validateDraft,
16
16
  writeDraftXlsx
17
- } from "./chunk-KS4DE3MX.js";
18
- import {
19
- getLocalCliPackageInfo
20
- } from "./chunk-E2JKXMVO.js";
17
+ } from "./chunk-5XJYLEVC.js";
18
+ import "./chunk-CT7QDJS6.js";
21
19
  import {
22
20
  requiresConfirmation
23
21
  } from "./chunk-AMBFK2K3.js";
24
- import "./chunk-SO5LKIWP.js";
25
- import "./chunk-7WZACOAI.js";
26
- import "./chunk-GK7WDY7E.js";
22
+ import "./chunk-AP7YP2NX.js";
23
+ import "./chunk-S6M42KND.js";
27
24
  import {
28
25
  TeAgentApiError,
29
26
  TeAgentCredentialsError
30
- } from "./chunk-KJDOTPYU.js";
27
+ } from "./chunk-3YVEAZUN.js";
31
28
  import {
32
29
  CapabilityGatewayError,
33
30
  executeCapability,
34
31
  uploadInputFileBytes
35
- } from "./chunk-QYXDJOLA.js";
32
+ } from "./chunk-VZZNLV3I.js";
36
33
  import {
37
34
  resolveHost
38
- } from "./chunk-N4BLPJC7.js";
35
+ } from "./chunk-OP44TT4H.js";
39
36
  import {
37
+ failInstallation,
40
38
  fetchCliConfig,
41
39
  formatCapabilityMissCompatHint,
40
+ getLocalCliPackageInfo,
41
+ installVersion,
42
+ newInstallationReport,
42
43
  printError,
43
44
  printOutput,
44
45
  resolveKbAutoDiscoveryFeature,
45
46
  runHostCompatCheck,
46
47
  shouldSkipAutoSync
47
- } from "./chunk-BW7JUDEI.js";
48
+ } from "./chunk-6VNIR4AP.js";
48
49
  import "./chunk-Y74WTIKJ.js";
49
50
  import {
50
51
  CredentialStoreUnreadableError,
51
52
  SecureStoreAuthError,
52
53
  getCliToken,
53
54
  peekCliToken
54
- } from "./chunk-DU72X2IO.js";
55
+ } from "./chunk-GHXZK54S.js";
55
56
  import {
56
57
  getActiveHost,
57
58
  getConfigDir,
58
59
  safeJsonParse
59
- } from "./chunk-IG3DYEIR.js";
60
+ } from "./chunk-ZL7SGNIA.js";
60
61
  import {
61
62
  CliApiError,
62
63
  CliValidationError,
@@ -64,7 +65,7 @@ import {
64
65
  LocalDataUploadError,
65
66
  PermissionError,
66
67
  logger
67
- } from "./chunk-YVGXGTD6.js";
68
+ } from "./chunk-WNGFSIOB.js";
68
69
 
69
70
  // src/index.ts
70
71
  import { Command as CommanderCommand, Option } from "commander";
@@ -79,6 +80,9 @@ function missingRequiredFlagsError(cmdName, missing) {
79
80
  const hint = hintParts.length > 0 ? hintParts.join(" ") : `Usage: ae-cli ${cmdName} ${names.map((name) => `${name} <value>`).join(" ")}`;
80
81
  return { message, hint };
81
82
  }
83
+ function canPromptForConfirmation(input = process.stdin, output = process.stderr) {
84
+ return input.isTTY === true && output.isTTY === true;
85
+ }
82
86
  function readSkillCurrentVersion(body) {
83
87
  if (!body || typeof body !== "object" || Array.isArray(body)) return void 0;
84
88
  const currentVersion = body.currentVersion;
@@ -208,6 +212,15 @@ async function runCommand(cmd, opts, globalOpts) {
208
212
  if (requiresConfirmation(cmd.risk)) {
209
213
  cmd.preflight?.(ctx);
210
214
  if (!globalOpts.yes) {
215
+ if (!canPromptForConfirmation()) {
216
+ throw new CliValidationError(
217
+ "Non-interactive high-risk writes require global --yes.",
218
+ {
219
+ code: "CONFIRMATION_REQUIRED",
220
+ hint: "After explicit authorization, retry with the global --yes flag."
221
+ }
222
+ );
223
+ }
211
224
  const confirmed = await confirm(`This is a high-risk-write operation (${cmdName}). Continue?`);
212
225
  if (!confirmed) {
213
226
  process.stderr.write("Aborted.\n");
@@ -237,7 +250,7 @@ async function runCommand(cmd, opts, globalOpts) {
237
250
  } else if (err instanceof TeAgentCredentialsError) {
238
251
  printError("config", message, err.hint);
239
252
  } else if (err instanceof PermissionError) {
240
- printError("permission", message, err.hint, err.code);
253
+ printError("permission", message, err.hint, err.code, void 0, { details: err.details });
241
254
  } else if (err instanceof CliApiError) {
242
255
  printError("api", message, err.hint, err.code, err.meta);
243
256
  } else if (err instanceof CapabilityGatewayError) {
@@ -249,20 +262,21 @@ async function runCommand(cmd, opts, globalOpts) {
249
262
  } else if (err instanceof CredentialStoreUnreadableError) {
250
263
  printError("config", message, err.hint, err.code);
251
264
  } else if (err instanceof SecureStoreAuthError) {
252
- printError("auth", message, "Run: ae-cli auth login");
265
+ printError("auth", message, "Run: ae-cli auth login", err.code);
253
266
  } else if (err instanceof TeAgentApiError) {
254
267
  if (err.status === 403) {
255
- printError("permission", message);
268
+ printError("permission", message, err.hint, err.code, void 0, { details: err.details });
256
269
  } else if (err.status === 401) {
257
- printError("auth", message, "Run: ae-cli auth login");
270
+ printError("auth", message, err.hint ?? "Run: ae-cli auth login", err.code, void 0, { details: err.details });
258
271
  } else {
259
272
  const presentation = teAgentApiErrorPresentation(err);
260
273
  printError(
261
- "api",
274
+ err.errorType,
262
275
  presentation.message ?? message,
263
- presentation.hint,
276
+ presentation.hint ?? err.hint,
264
277
  presentation.code ?? err.code,
265
- presentation.meta
278
+ presentation.meta,
279
+ { details: err.details }
266
280
  );
267
281
  }
268
282
  } else if (looksLikeAuthFailure(message)) {
@@ -312,14 +326,14 @@ function createRuntimeContext(cmd, opts, globalOpts) {
312
326
  let _communityReportModule = null;
313
327
  async function getCommunityReportClient() {
314
328
  if (!_communityReportModule) {
315
- _communityReportModule = await import("./community-report-client-6VJDDMJJ.js");
329
+ _communityReportModule = await import("./community-report-client-PEERQCX2.js");
316
330
  }
317
331
  return _communityReportModule;
318
332
  }
319
333
  let _localDataUploadModule = null;
320
334
  async function getLocalDataUploadClient() {
321
335
  if (!_localDataUploadModule) {
322
- _localDataUploadModule = await import("./local-data-upload-client-3P7NIVQ4.js");
336
+ _localDataUploadModule = await import("./local-data-upload-client-TWMHFLUA.js");
323
337
  }
324
338
  return _localDataUploadModule;
325
339
  }
@@ -367,6 +381,9 @@ function createRuntimeContext(cmd, opts, globalOpts) {
367
381
  const client = await getLocalDataUploadClient();
368
382
  return client.localDataUpload(endpoint, rawBody, options);
369
383
  },
384
+ hostOverride() {
385
+ return globalOpts.host;
386
+ },
370
387
  host() {
371
388
  if (globalOpts.host) return globalOpts.host;
372
389
  return getActiveHost();
@@ -378,7 +395,7 @@ function createRuntimeContext(cmd, opts, globalOpts) {
378
395
  return cmd.service;
379
396
  },
380
397
  async out(data) {
381
- await printOutput(data, globalOpts.format, globalOpts.jq);
398
+ await printOutput(data, globalOpts.format, globalOpts.jq, { redactErrors: cmd.sensitiveOutput });
382
399
  }
383
400
  };
384
401
  return ctx;
@@ -2348,6 +2365,51 @@ function findOption(command, flag) {
2348
2365
  return void 0;
2349
2366
  }
2350
2367
 
2368
+ // src/commands/install.ts
2369
+ function registerInstall(program2) {
2370
+ program2.command("install").description("Install and verify this CLI distribution and its matching global Skills").option("--host <url>", "Check authentication for this AE host after installation").addHelpText("after", "\nExamples:\n npx @thinkingai/ae-cli@latest install\n ae-cli install --dry-run --format json\n ae-cli install --host https://your-ae-host.example.com\n\nSkills are installed globally in ~/.agents/skills with client adaptation handled automatically.\nGlobal options: --dry-run, --format json|table. Supports macOS, Linux, and native Windows.\n").action(async (opts) => {
2371
+ const pkg2 = getLocalCliPackageInfo();
2372
+ const global = program2.opts();
2373
+ const format = program2.getOptionValueSource("format") === "default" && process.stdout.isTTY ? "table" : global.format;
2374
+ let report = newInstallationReport(pkg2.name, pkg2.version, Boolean(global.dryRun));
2375
+ try {
2376
+ if (!["json", "table"].includes(format) || global.jq || global.validate) {
2377
+ throw new Error("Installation supports --format json|table and --dry-run; --jq and --validate are not supported.");
2378
+ }
2379
+ const result = installVersion(pkg2.version, {
2380
+ packageName: pkg2.name,
2381
+ host: opts.host || global.host,
2382
+ dryRun: global.dryRun,
2383
+ progress: (message) => process.stderr.write(`${message}
2384
+ `)
2385
+ });
2386
+ report = result.report ?? failInstallation(
2387
+ report,
2388
+ result.ok ? "environment" : result.stage,
2389
+ result.ok ? "Installation result is unavailable." : result.message,
2390
+ result.ok ? "unknown" : result.cause
2391
+ );
2392
+ } catch (error) {
2393
+ report = failInstallation(report, "environment", error instanceof Error ? error.message : "Installation failed.");
2394
+ }
2395
+ const output = format === "table" ? [
2396
+ report.dry_run ? "AE CLI installation plan (no changes)" : report.ok ? "AE CLI installation complete" : "AE CLI installation incomplete",
2397
+ `CLI: ${report.cli.package}@${report.cli.version} (${report.cli.verified ? "verified" : "not verified"})`,
2398
+ `Command: ${report.cli.path ?? "pending"}`,
2399
+ `Global Skills: ${report.skills.installed_count}/${report.skills.expected_count} verified in ${report.skills.directory}`,
2400
+ ...report.skills.failures.map((failure) => `- ${failure.skill}: ${failure.reason}`),
2401
+ ...report.cli.warnings,
2402
+ ...report.auth.warnings,
2403
+ ...report.error ? [report.error.message] : [],
2404
+ ...report.commands ?? [],
2405
+ ...report.next_steps
2406
+ ].join("\n") : JSON.stringify(report, null, 2);
2407
+ process.stdout.write(`${output}
2408
+ `);
2409
+ if (!report.ok) process.exitCode = 1;
2410
+ });
2411
+ }
2412
+
2351
2413
  // src/index.ts
2352
2414
  var require2 = createRequire(import.meta.url);
2353
2415
  var pkg = require2("../package.json");
@@ -2373,91 +2435,105 @@ function warnLoadFailure(label, err) {
2373
2435
  async function loadCommands() {
2374
2436
  const commands = [];
2375
2437
  try {
2376
- const teAnalysis = await import("./te-analysis-5ZZ6YHVH.js");
2438
+ const teAnalysis = await import("./te-analysis-GP7DSQ7Q.js");
2377
2439
  commands.push(...teAnalysis.default);
2378
2440
  } catch (err) {
2379
2441
  warnLoadFailure("domain te-analysis", err);
2380
2442
  }
2381
2443
  try {
2382
- const engage = await import("./te-engage-RNRMYDO3.js");
2444
+ const engage = await import("./te-engage-2CO6LRCX.js");
2383
2445
  commands.push(...engage.default);
2384
2446
  } catch (err) {
2385
2447
  warnLoadFailure("domain te-engage", err);
2386
2448
  }
2387
2449
  try {
2388
- const experiment = await import("./te-experiment-BTAC2UNK.js");
2450
+ const experiment = await import("./te-experiment-652CLXMU.js");
2389
2451
  commands.push(...experiment.default);
2390
2452
  } catch (err) {
2391
2453
  warnLoadFailure("domain te-experiment", err);
2392
2454
  }
2393
2455
  try {
2394
- const community = await import("./te-community-Z7JACGF3.js");
2456
+ const community = await import("./te-community-42M7ICDO.js");
2395
2457
  commands.push(...community.default);
2396
2458
  } catch (err) {
2397
2459
  warnLoadFailure("domain te-community", err);
2398
2460
  }
2399
2461
  try {
2400
- const dataops = await import("./te-dataops-F7GQOIS6.js");
2462
+ const dataops = await import("./te-dataops-BNKNZ4F2.js");
2401
2463
  commands.push(...dataops.default);
2402
2464
  } catch (err) {
2403
2465
  warnLoadFailure("domain te-dataops", err);
2404
2466
  }
2405
2467
  try {
2406
- const teKb = await import("./te-kb-QJLJEX5K.js");
2468
+ const teKb = await import("./te-kb-ULATOTQ3.js");
2407
2469
  commands.push(...teKb.default);
2408
2470
  } catch (err) {
2409
2471
  warnLoadFailure("domain te-kb", err);
2410
2472
  }
2411
2473
  try {
2412
- const teTeam = await import("./te-team-BIZIKIHZ.js");
2474
+ const teTeam = await import("./te-team-YA6SNOJ3.js");
2413
2475
  commands.push(...teTeam.default);
2414
2476
  } catch (err) {
2415
2477
  warnLoadFailure("domain te-team", err);
2416
2478
  }
2417
2479
  try {
2418
- const teAgent = await import("./te-agent-Z3HCTKR7.js");
2480
+ const teAgent = await import("./te-agent-AORRE2FM.js");
2419
2481
  commands.push(...teAgent.default);
2420
2482
  } catch (err) {
2421
2483
  warnLoadFailure("domain te-agent", err);
2422
2484
  }
2423
2485
  try {
2424
- const memory = await import("./memory-6APEB2JB.js");
2486
+ const memory = await import("./memory-CQKH2JAV.js");
2425
2487
  commands.push(...memory.default);
2426
2488
  } catch (err) {
2427
2489
  warnLoadFailure("domain memory", err);
2428
2490
  }
2491
+ const automation = await import("./automation-VAAQBM7Y.js");
2492
+ commands.push(...automation.default);
2493
+ try {
2494
+ const things = await import("./things-DTCOQIQB.js");
2495
+ commands.push(...things.default);
2496
+ } catch (err) {
2497
+ warnLoadFailure("domain things", err);
2498
+ }
2499
+ try {
2500
+ const workspace = await import("./workspace-JEOHKFPX.js");
2501
+ commands.push(...workspace.default);
2502
+ } catch (err) {
2503
+ warnLoadFailure("domain workspace", err);
2504
+ }
2429
2505
  try {
2430
- const teSystem = await import("./te-system-IXC43QHZ.js");
2506
+ const teSystem = await import("./te-system-UGHVKBVV.js");
2431
2507
  commands.push(...teSystem.default);
2432
2508
  } catch (err) {
2433
2509
  warnLoadFailure("domain te-system", err);
2434
2510
  }
2435
2511
  try {
2436
- const metadata = await import("./metadata-JRYKNUS5.js");
2512
+ const metadata = await import("./metadata-NR3PHR23.js");
2437
2513
  commands.push(...metadata.default);
2438
2514
  } catch (err) {
2439
2515
  warnLoadFailure("domain metadata", err);
2440
2516
  }
2441
2517
  try {
2442
- const personalSemanticPreference = await import("./personal-semantic-preference-IDE2GE5T.js");
2518
+ const personalSemanticPreference = await import("./personal-semantic-preference-2RAI36P3.js");
2443
2519
  commands.push(...personalSemanticPreference.default);
2444
2520
  } catch (err) {
2445
2521
  warnLoadFailure("domain personal-semantic-preference", err);
2446
2522
  }
2447
2523
  try {
2448
- const projectSemantic = await import("./project-semantic-36KOCYN7.js");
2524
+ const projectSemantic = await import("./project-semantic-3BUGP3ZM.js");
2449
2525
  commands.push(...projectSemantic.default);
2450
2526
  } catch (err) {
2451
2527
  warnLoadFailure("domain project-semantic", err);
2452
2528
  }
2453
2529
  try {
2454
- const dataIntegration = await import("./data-integration-XBTCGXQT.js");
2530
+ const dataIntegration = await import("./data-integration-BCLQFTGU.js");
2455
2531
  commands.push(...dataIntegration.default);
2456
2532
  } catch (err) {
2457
2533
  warnLoadFailure("domain data-integration", err);
2458
2534
  }
2459
2535
  try {
2460
- const context = await import("./context-M3HDGEIR.js");
2536
+ const context = await import("./context-NGVFPCBK.js");
2461
2537
  commands.push(...context.default);
2462
2538
  } catch (err) {
2463
2539
  warnLoadFailure("domain context", err);
@@ -2466,7 +2542,7 @@ async function loadCommands() {
2466
2542
  }
2467
2543
  async function registerAuthCommands() {
2468
2544
  try {
2469
- const { registerAuth } = await import("./auth-LHM7NQPR.js");
2545
+ const { registerAuth } = await import("./auth-WA7YGGRT.js");
2470
2546
  registerAuth(program);
2471
2547
  } catch (err) {
2472
2548
  warnLoadFailure("auth commands", err);
@@ -2474,7 +2550,7 @@ async function registerAuthCommands() {
2474
2550
  }
2475
2551
  async function registerConfigCommands() {
2476
2552
  try {
2477
- const { registerConfig } = await import("./config-XQWOPDHN.js");
2553
+ const { registerConfig } = await import("./config-JOD5DOPE.js");
2478
2554
  registerConfig(program);
2479
2555
  } catch (err) {
2480
2556
  warnLoadFailure("config commands", err);
@@ -2482,7 +2558,7 @@ async function registerConfigCommands() {
2482
2558
  }
2483
2559
  async function registerCapabilityCommands() {
2484
2560
  try {
2485
- const { registerCapability } = await import("./capability-SJI5KOCK.js");
2561
+ const { registerCapability } = await import("./capability-GAAYJ3IQ.js");
2486
2562
  registerCapability(program);
2487
2563
  } catch (err) {
2488
2564
  warnLoadFailure("capability commands", err);
@@ -2490,7 +2566,7 @@ async function registerCapabilityCommands() {
2490
2566
  }
2491
2567
  async function registerSyncCommand() {
2492
2568
  try {
2493
- const { registerSync } = await import("./sync-EQLSTUS7.js");
2569
+ const { registerSync } = await import("./sync-RZIAV37C.js");
2494
2570
  registerSync(program);
2495
2571
  } catch (err) {
2496
2572
  warnLoadFailure("sync commands", err);
@@ -2498,7 +2574,7 @@ async function registerSyncCommand() {
2498
2574
  }
2499
2575
  async function registerModelCommand() {
2500
2576
  try {
2501
- const { registerModel } = await import("./model-ZS7HVGKN.js");
2577
+ const { registerModel } = await import("./model-VX5M2CJ6.js");
2502
2578
  registerModel(program);
2503
2579
  } catch (err) {
2504
2580
  warnLoadFailure("model commands", err);
@@ -2506,7 +2582,7 @@ async function registerModelCommand() {
2506
2582
  }
2507
2583
  async function registerUpdateCommand() {
2508
2584
  try {
2509
- const { registerUpdate } = await import("./update-W2SGQNKT.js");
2585
+ const { registerUpdate } = await import("./update-ESNYKUVR.js");
2510
2586
  registerUpdate(program);
2511
2587
  } catch (err) {
2512
2588
  warnLoadFailure("update commands", err);
@@ -2548,6 +2624,7 @@ async function main() {
2548
2624
  await registerSyncCommand();
2549
2625
  await registerModelCommand();
2550
2626
  await registerUpdateCommand();
2627
+ registerInstall(program);
2551
2628
  registerTracking(program);
2552
2629
  rejectUnknownHelpCommandPath(program, process.argv.slice(2));
2553
2630
  await parseProgram(program);
@@ -2605,7 +2682,7 @@ function isRootUpdateCommand(args) {
2605
2682
  }
2606
2683
  continue;
2607
2684
  }
2608
- return token === "update";
2685
+ return token === "update" || token === "install";
2609
2686
  }
2610
2687
  return false;
2611
2688
  }