@thinkingai/ae-cli 6.1.16 → 6.1.18

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 (103) hide show
  1. package/README.md +5 -2
  2. package/README.zh.md +5 -2
  3. package/dist/{auth-2WTQOP77.js → auth-GBMV6TEJ.js} +3 -3
  4. package/dist/{auth-77BUFLGC.js → auth-ROB2EDYV.js} +12 -13
  5. package/dist/{capability-72DTW5M2.js → capability-DKMYUTLC.js} +50 -13
  6. package/dist/{capability-PJHNI4GJ.js → capability-HYVVPG25.js} +49 -12
  7. package/dist/chunk-3FY3RJ26.js +293 -0
  8. package/dist/{chunk-PTE56QPL.js → chunk-3KWQYGYI.js} +4 -0
  9. package/dist/{chunk-UOUS37JQ.js → chunk-4XXOWOTA.js} +3 -3
  10. package/dist/{chunk-GT46FPXN.js → chunk-BYYS3ANB.js} +17 -8
  11. package/dist/{chunk-YA6SMTXG.js → chunk-EFH4XWYC.js} +3 -3
  12. package/dist/{chunk-4SGZG4XY.js → chunk-J2DEBMRF.js} +9 -7
  13. package/dist/{chunk-LYVNONC4.js → chunk-JHENBQ5B.js} +35 -0
  14. package/dist/{chunk-VR3LCBHW.js → chunk-JRJY5DMJ.js} +5 -5
  15. package/dist/{chunk-ILIU36SU.js → chunk-OMPRXM3V.js} +3 -3
  16. package/dist/{chunk-VPKZ7I72.js → chunk-QNOLN2LJ.js} +2 -2
  17. package/dist/{chunk-SAU3QFIQ.js → chunk-QZ3AS4KK.js} +3 -3
  18. package/dist/chunk-RJDU7NYP.js +1198 -0
  19. package/dist/{chunk-4KVPKXFX.js → chunk-RNAALWJK.js} +2 -2
  20. package/dist/{chunk-C4MGVGJW.js → chunk-SERWF6G5.js} +1 -1
  21. package/dist/{chunk-RGKJGKT7.js → chunk-Y3LOALAV.js} +5 -5
  22. package/dist/{chunk-P3FGXJTU.js → chunk-ZQ47LWTI.js} +4 -4
  23. package/dist/chunk-ZQKDZXDO.js +317 -0
  24. package/dist/{client-TKG4WBHN.js → client-L2YDMHQ6.js} +5 -4
  25. package/dist/{community-report-client-FI4LNVYS.js → community-report-client-C7WDGET3.js} +1 -2
  26. package/dist/{config-RE6CMGPK.js → config-BMYZX2UE.js} +7 -6
  27. package/dist/{data-integration-2MYMANJI.js → data-integration-QEKDWQDY.js} +1741 -212
  28. package/dist/index.js +131 -1241
  29. package/dist/{local-data-upload-client-BWHSUQQK.js → local-data-upload-client-4YYHSYD6.js} +1 -2
  30. package/dist/{memory-CHRU2F7W.js → memory-3ORCR7JH.js} +6 -6
  31. package/dist/{memory-YK33G4T7.js → memory-I2WXDTV2.js} +5 -5
  32. package/dist/{metadata-XXR34N5P.js → metadata-I4C2EWUN.js} +10 -10
  33. package/dist/{metadata-UILXHBWF.js → metadata-VUOQJE26.js} +9 -9
  34. package/dist/{model-NR3JHFSJ.js → model-HLHIEFMU.js} +5 -5
  35. package/dist/{model-K3KLWIW6.js → model-UGRDX4MW.js} +6 -6
  36. package/dist/personal-semantic-preference-LIPACBDX.js +239 -0
  37. package/dist/personal-semantic-preference-OEISBRHM.js +239 -0
  38. package/dist/project-semantic-FFPWFPIW.js +1114 -0
  39. package/dist/project-semantic-RT3R2VQD.js +1114 -0
  40. package/dist/{sync-FCKOVWWS.js → sync-HKIOZXQE.js} +6 -6
  41. package/dist/{sync-DAVKYVMW.js → sync-TFHU2UTG.js} +7 -7
  42. package/dist/{te-agent-HLW4VTQK.js → te-agent-BR6VDBNX.js} +9 -8
  43. package/dist/{te-agent-4BKBODMF.js → te-agent-VLYOV7S4.js} +8 -7
  44. package/dist/{te-analysis-ZMNGOVNW.js → te-analysis-4YGQL5RC.js} +437 -38
  45. package/dist/{te-analysis-O6DCO6BS.js → te-analysis-7VUNUYWZ.js} +436 -37
  46. package/dist/{te-community-HLC43QKH.js → te-community-5DMNKJWY.js} +5 -5
  47. package/dist/{te-community-6HPBWJUZ.js → te-community-ISDQWJU7.js} +6 -6
  48. package/dist/{te-dataops-HDRUXY4K.js → te-dataops-6P5IKWNJ.js} +8 -7
  49. package/dist/{te-dataops-EJP56W3K.js → te-dataops-CVULXNVB.js} +7 -6
  50. package/dist/{te-engage-RAK5PESW.js → te-engage-KZPR5R22.js} +9 -9
  51. package/dist/{te-engage-FGBGQ4IY.js → te-engage-N5WI32H6.js} +8 -8
  52. package/dist/{te-experiment-SO5MPDMJ.js → te-experiment-6BITX4RD.js} +226 -8
  53. package/dist/{te-experiment-VZF7BT6G.js → te-experiment-UVR4HLND.js} +227 -9
  54. package/dist/{te-kb-APXBWBDY.js → te-kb-RCLSSH2Q.js} +251 -127
  55. package/dist/{te-system-Z77IKZFN.js → te-system-FXITO2JG.js} +5 -5
  56. package/dist/{te-system-YARIK4S5.js → te-system-K2GYMCTB.js} +6 -6
  57. package/dist/{te-team-EFKWYKMK.js → te-team-ADOC2ROP.js} +6 -6
  58. package/dist/{update-OGPSZM5A.js → update-YCYCKJOO.js} +7 -6
  59. package/package.json +2 -1
  60. package/skills/ae-agent/SKILL.md +3 -4
  61. package/skills/ae-agent/references/edit-skill.md +3 -0
  62. package/skills/ae-agent/references/get-skill-content.md +1 -1
  63. package/skills/ae-agent/references/rescan-skills.md +15 -13
  64. package/skills/ae-agent/references/upload-skill.md +7 -4
  65. package/skills/ae-analysis/SKILL.md +45 -4
  66. package/skills/ae-analysis/metadata_resolution.md +38 -4
  67. package/skills/ae-analysis/references/analysis_data_retrieval.md +29 -0
  68. package/skills/ae-analysis/references/asset_authentication_export.md +22 -0
  69. package/skills/ae-analysis/references/asset_authentication_list.md +18 -14
  70. package/skills/ae-analysis/references/asset_authentication_update.md +29 -14
  71. package/skills/ae-analysis/references/command_index.md +17 -9
  72. package/skills/ae-analysis/references/dashboard_get.md +18 -1
  73. package/skills/ae-analysis/references/dashboard_update.md +3 -0
  74. package/skills/ae-analysis/references/personal_semantic_preference_add.md +23 -0
  75. package/skills/ae-analysis/references/personal_semantic_preference_delete.md +17 -0
  76. package/skills/ae-analysis/references/personal_semantic_preference_get.md +19 -0
  77. package/skills/ae-analysis/references/personal_semantic_preference_list.md +21 -0
  78. package/skills/ae-analysis/references/personal_semantic_preference_update.md +19 -0
  79. package/skills/ae-data-integration/SKILL.md +23 -4
  80. package/skills/ae-data-integration/references/custom-layer.md +93 -0
  81. package/skills/ae-data-integration/references/error-handling.md +92 -0
  82. package/skills/ae-data-integration/references/handoff.md +77 -18
  83. package/skills/ae-data-integration/references/local-analysis.md +1 -1
  84. package/skills/ae-data-integration/references/reuse.md +9 -5
  85. package/skills/ae-data-integration/references/sink-upload.md +1 -1
  86. package/skills/ae-data-integration/references/source-inspect.md +32 -13
  87. package/skills/ae-data-integration/references/tracking-plan.md +7 -5
  88. package/skills/ae-data-integration/references/transform.md +10 -10
  89. package/skills/ae-data-integration/references/ue-mapping.md +33 -11
  90. package/skills/ae-engage/references/build-task-save-guide.md +9 -0
  91. package/skills/ae-engage/references/save-task.md +82 -0
  92. package/skills/ae-experiment/SKILL.md +8 -2
  93. package/skills/ae-experiment/references/manage_feature_whitelist.md +66 -0
  94. package/skills/ae-experiment/references/manage_guardrail_metrics.md +26 -0
  95. package/skills/ae-experiment/references/save_experiment.md +1 -1
  96. package/skills/ae-kb/SKILL.md +56 -51
  97. package/skills/ae-kb/references/query-workflow.md +112 -0
  98. package/skills/ae-kb-discovery/SKILL.md +105 -0
  99. package/skills/ae-project-semantic/SKILL.md +193 -0
  100. package/skills/ae-project-semantic/references/query-routing-v5.md +165 -0
  101. package/skills/ae-project-semantic/references/recommendation-quality.md +68 -0
  102. package/dist/chunk-QGM4M3NI.js +0 -37
  103. package/dist/chunk-ZZUOD757.js +0 -598
package/README.md CHANGED
@@ -200,7 +200,10 @@ ae-cli kb +add --name engineering-handbook --files '["./docs/guide.md","https://
200
200
  ae-cli kb +schema --name engineering-handbook
201
201
  ae-cli kb +compile --name engineering-handbook
202
202
  ae-cli kb +status --name engineering-handbook
203
- ae-cli kb +query -q "How is the sandbox configured?" --top-k 10
203
+ ae-cli kb +ask -q "How is the sandbox configured?"
204
+ # Submit only, poll later:
205
+ ae-cli kb +ask -q "Another question" --no-wait
206
+ ae-cli kb +ask-status --execution-id <id>
204
207
  ```
205
208
 
206
209
  External Agents can use deterministic retrieval without a server-side LLM:
@@ -208,7 +211,7 @@ External Agents can use deterministic retrieval without a server-side LLM:
208
211
  ```bash
209
212
  ae-cli kb +list
210
213
  ae-cli kb +index --sources '[{"scope":"company","name":"engineering-handbook"}]'
211
- ae-cli kb +grep -q "sandbox config" --sources '[{"scope":"company","name":"engineering-handbook"}]'
214
+ ae-cli kb +grep -q "sandbox config" --sources '[{"scope":"company","name":"engineering-handbook"}]' --paths '["wiki/sandbox.md"]'
212
215
  ae-cli kb +read --source '{"scope":"company","name":"engineering-handbook"}' --path "wiki/sandbox.md"
213
216
  ```
214
217
 
package/README.zh.md CHANGED
@@ -200,7 +200,10 @@ ae-cli kb +add --name engineering-handbook --files '["./docs/guide.md","https://
200
200
  ae-cli kb +schema --name engineering-handbook
201
201
  ae-cli kb +compile --name engineering-handbook
202
202
  ae-cli kb +status --name engineering-handbook
203
- ae-cli kb +query -q "如何配置沙盒?" --top-k 10
203
+ ae-cli kb +ask -q "如何配置沙盒?"
204
+ # 仅提交,后续轮询:
205
+ ae-cli kb +ask -q "另一个问题" --no-wait
206
+ ae-cli kb +ask-status --execution-id <id>
204
207
  ```
205
208
 
206
209
  外部 Agent 可以使用不依赖服务端 LLM 的确定性检索:
@@ -208,7 +211,7 @@ ae-cli kb +query -q "如何配置沙盒?" --top-k 10
208
211
  ```bash
209
212
  ae-cli kb +list
210
213
  ae-cli kb +index --sources '[{"scope":"company","name":"engineering-handbook"}]'
211
- ae-cli kb +grep -q "沙盒配置" --sources '[{"scope":"company","name":"engineering-handbook"}]'
214
+ ae-cli kb +grep -q "沙盒配置" --sources '[{"scope":"company","name":"engineering-handbook"}]' --paths '["wiki/sandbox.md"]'
212
215
  ae-cli kb +read --source '{"scope":"company","name":"engineering-handbook"}' --path "wiki/sandbox.md"
213
216
  ```
214
217
 
@@ -3,9 +3,9 @@ import {
3
3
  invalidateAccessTokenForRetry,
4
4
  resolveHost,
5
5
  validateToken
6
- } from "./chunk-ZZUOD757.js";
7
- import "./chunk-LYVNONC4.js";
8
- import "./chunk-QGM4M3NI.js";
6
+ } from "./chunk-ZQKDZXDO.js";
7
+ import "./chunk-3FY3RJ26.js";
8
+ import "./chunk-JHENBQ5B.js";
9
9
  export {
10
10
  getToken,
11
11
  invalidateAccessTokenForRetry,
@@ -5,33 +5,33 @@ import {
5
5
  printError,
6
6
  printOutput,
7
7
  runHostCompatCheck
8
- } from "./chunk-GT46FPXN.js";
8
+ } from "./chunk-BYYS3ANB.js";
9
9
  import {
10
10
  clearCliToken,
11
11
  mintCliToken,
12
12
  validateCliTokenOnServer
13
- } from "./chunk-4SGZG4XY.js";
13
+ } from "./chunk-J2DEBMRF.js";
14
14
  import {
15
15
  SecureStoreAuthError,
16
16
  clear,
17
- getFallbackCliToken,
18
17
  load,
19
- loadConfig,
20
18
  missingAeHostGuidance,
21
19
  missingAeHostHint,
22
- normalizeUrl,
23
- removeHost,
24
20
  resolveHost,
25
- save,
21
+ save
22
+ } from "./chunk-ZQKDZXDO.js";
23
+ import {
24
+ getFallbackCliToken,
25
+ loadConfig,
26
+ normalizeUrl,
26
27
  saveConfig
27
- } from "./chunk-ZZUOD757.js";
28
+ } from "./chunk-3FY3RJ26.js";
28
29
  import {
29
30
  PermissionError
30
31
  } from "./chunk-UW5UN47B.js";
31
32
  import {
32
33
  logger
33
- } from "./chunk-LYVNONC4.js";
34
- import "./chunk-QGM4M3NI.js";
34
+ } from "./chunk-JHENBQ5B.js";
35
35
 
36
36
  // src/core/device-auth.ts
37
37
  import { execFileSync } from "child_process";
@@ -439,7 +439,7 @@ function registerAuth(program) {
439
439
  }
440
440
  await printOutput({ authenticated: false, host, source: "none" }, program.opts().format || "json");
441
441
  });
442
- auth.command("logout").description("Clear stored credentials (access token, CLI token, and host config) for a host (--host or active host)").option("--host <url>", HOST_OPTION_DESC).action(async (opts) => {
442
+ auth.command("logout").description("Clear stored credentials (access token, refresh token, and CLI token) for a host (--host or active host)").option("--host <url>", HOST_OPTION_DESC).action(async (opts) => {
443
443
  const host = resolveAuthHost(program, opts);
444
444
  if (!host) {
445
445
  printError("config", "No AE host configured.", missingAeHostHint());
@@ -447,8 +447,7 @@ function registerAuth(program) {
447
447
  }
448
448
  clearCliToken(host);
449
449
  clear(host);
450
- removeHost(host);
451
- process.stderr.write(`[ae-cli] Credentials and config cleared for ${host}
450
+ process.stderr.write(`[ae-cli] Credentials cleared for ${host}
452
451
  `);
453
452
  await printOutput({ cleared: true, host }, program.opts().format || "json");
454
453
  });
@@ -4,12 +4,13 @@ import {
4
4
  } from "./chunk-OO6XR6LK.js";
5
5
  import {
6
6
  findGatewayDomain,
7
+ listRegisteredCapabilityDomains,
7
8
  resolveGatewayDomain
8
- } from "./chunk-PTE56QPL.js";
9
+ } from "./chunk-3KWQYGYI.js";
9
10
  import {
10
11
  printError,
11
12
  printOutput
12
- } from "./chunk-GT46FPXN.js";
13
+ } from "./chunk-BYYS3ANB.js";
13
14
  import {
14
15
  CapabilityGatewayError,
15
16
  dryRunCapability,
@@ -17,19 +18,20 @@ import {
17
18
  inspectCapability,
18
19
  listCapabilities,
19
20
  validateCapability
20
- } from "./chunk-P3FGXJTU.js";
21
- import "./chunk-C4MGVGJW.js";
22
- import "./chunk-4SGZG4XY.js";
21
+ } from "./chunk-ZQ47LWTI.js";
22
+ import "./chunk-SERWF6G5.js";
23
+ import "./chunk-J2DEBMRF.js";
23
24
  import {
24
25
  SecureStoreAuthError,
25
- resolveHost,
26
+ resolveHost
27
+ } from "./chunk-ZQKDZXDO.js";
28
+ import {
26
29
  safeJsonParse
27
- } from "./chunk-ZZUOD757.js";
30
+ } from "./chunk-3FY3RJ26.js";
28
31
  import {
29
32
  PermissionError
30
33
  } from "./chunk-UW5UN47B.js";
31
- import "./chunk-LYVNONC4.js";
32
- import "./chunk-QGM4M3NI.js";
34
+ import "./chunk-JHENBQ5B.js";
33
35
 
34
36
  // src/commands/capability/index.ts
35
37
  import * as readline from "readline";
@@ -51,7 +53,13 @@ function capabilityNamespace(capabilityId) {
51
53
  }
52
54
  function resolveCapabilityGatewayDomain(capabilityId, domainOverride) {
53
55
  const cliDomain = domainOverride?.trim() || capabilityNamespace(capabilityId);
54
- return resolveCapabilityListDomain(cliDomain);
56
+ if (!cliDomain) {
57
+ throw new CapabilityCommandValidationError(
58
+ "Cannot determine the capability domain.",
59
+ "Pass --domain <domain>."
60
+ );
61
+ }
62
+ return resolveGatewayDomain(cliDomain, findGatewayDomain(cliDomain) ?? cliDomain);
55
63
  }
56
64
  function resolveCapabilityListDomain(cliDomain) {
57
65
  if (!cliDomain) {
@@ -60,7 +68,23 @@ function resolveCapabilityListDomain(cliDomain) {
60
68
  "Pass --domain <domain>."
61
69
  );
62
70
  }
63
- return resolveGatewayDomain(cliDomain, findGatewayDomain(cliDomain) ?? cliDomain);
71
+ const gatewayDomain = findGatewayDomain(cliDomain);
72
+ if (gatewayDomain === void 0) {
73
+ const registeredDomains = listRegisteredCapabilityDomains();
74
+ const registeredHint = registeredDomains.length > 0 ? `Registered domains: ${registeredDomains.join(", ")}.` : "No capability domains are registered in this ae-cli process.";
75
+ throw new CapabilityCommandValidationError(
76
+ `Capability domain '${cliDomain}' is not registered.`,
77
+ `${registeredHint} Do not guess domain names.`,
78
+ "CAPABILITY_DOMAIN_NOT_REGISTERED"
79
+ );
80
+ }
81
+ return resolveGatewayDomain(cliDomain, gatewayDomain);
82
+ }
83
+ function emptyCapabilityCatalogWarning(capabilities) {
84
+ if (capabilities.length > 0) {
85
+ return void 0;
86
+ }
87
+ return "No capabilities were returned. This does not prove that the project permission is missing. Stop discovery instead of guessing other domains or retrying. If capabilities are expected, verify the capability deployment, enabled features, and permissions.";
64
88
  }
65
89
  function parseOptionalProjectId(raw) {
66
90
  if (raw === void 0) {
@@ -155,7 +179,13 @@ function registerCapability(program) {
155
179
  const projectId = parseOptionalProjectId(opts.projectId);
156
180
  const catalog = normalizeCapabilityList(await listCapabilities(host, gatewayDomain, projectId));
157
181
  const capabilities = filterCapabilities(catalog, opts.domain);
158
- return { domain: opts.domain, count: capabilities.length, capabilities };
182
+ const warning = emptyCapabilityCatalogWarning(catalog);
183
+ return {
184
+ domain: opts.domain,
185
+ count: capabilities.length,
186
+ capabilities,
187
+ ...warning ? { warning } : {}
188
+ };
159
189
  });
160
190
  }).addHelpText(
161
191
  "after",
@@ -170,7 +200,14 @@ function registerCapability(program) {
170
200
  const projectId = parseOptionalProjectId(opts.projectId);
171
201
  const catalog = normalizeCapabilityList(await listCapabilities(host, gatewayDomain, projectId));
172
202
  const capabilities = filterCapabilities(catalog, opts.domain, query);
173
- return { domain: opts.domain, query, count: capabilities.length, capabilities };
203
+ const warning = emptyCapabilityCatalogWarning(catalog);
204
+ return {
205
+ domain: opts.domain,
206
+ query,
207
+ count: capabilities.length,
208
+ capabilities,
209
+ ...warning ? { warning } : {}
210
+ };
174
211
  });
175
212
  }).addHelpText(
176
213
  "after",
@@ -4,12 +4,13 @@ import {
4
4
  } from "./chunk-OO6XR6LK.js";
5
5
  import {
6
6
  findGatewayDomain,
7
+ listRegisteredCapabilityDomains,
7
8
  resolveGatewayDomain
8
- } from "./chunk-PTE56QPL.js";
9
+ } from "./chunk-3KWQYGYI.js";
9
10
  import {
10
11
  printError,
11
12
  printOutput
12
- } from "./chunk-GT46FPXN.js";
13
+ } from "./chunk-BYYS3ANB.js";
13
14
  import {
14
15
  CapabilityGatewayError,
15
16
  dryRunCapability,
@@ -17,19 +18,20 @@ import {
17
18
  inspectCapability,
18
19
  listCapabilities,
19
20
  validateCapability
20
- } from "./chunk-ILIU36SU.js";
21
+ } from "./chunk-OMPRXM3V.js";
21
22
  import "./chunk-6EIJSNBD.js";
22
- import "./chunk-4SGZG4XY.js";
23
+ import "./chunk-J2DEBMRF.js";
23
24
  import {
24
25
  SecureStoreAuthError,
25
- resolveHost,
26
+ resolveHost
27
+ } from "./chunk-ZQKDZXDO.js";
28
+ import {
26
29
  safeJsonParse
27
- } from "./chunk-ZZUOD757.js";
30
+ } from "./chunk-3FY3RJ26.js";
28
31
  import {
29
32
  PermissionError
30
33
  } from "./chunk-UW5UN47B.js";
31
- import "./chunk-LYVNONC4.js";
32
- import "./chunk-QGM4M3NI.js";
34
+ import "./chunk-JHENBQ5B.js";
33
35
 
34
36
  // src/commands/capability/index.ts
35
37
  import * as readline from "readline";
@@ -51,7 +53,13 @@ function capabilityNamespace(capabilityId) {
51
53
  }
52
54
  function resolveCapabilityGatewayDomain(capabilityId, domainOverride) {
53
55
  const cliDomain = domainOverride?.trim() || capabilityNamespace(capabilityId);
54
- return resolveCapabilityListDomain(cliDomain);
56
+ if (!cliDomain) {
57
+ throw new CapabilityCommandValidationError(
58
+ "Cannot determine the capability domain.",
59
+ "Pass --domain <domain>."
60
+ );
61
+ }
62
+ return resolveGatewayDomain(cliDomain, findGatewayDomain(cliDomain) ?? cliDomain);
55
63
  }
56
64
  function resolveCapabilityListDomain(cliDomain) {
57
65
  if (!cliDomain) {
@@ -60,7 +68,23 @@ function resolveCapabilityListDomain(cliDomain) {
60
68
  "Pass --domain <domain>."
61
69
  );
62
70
  }
63
- return resolveGatewayDomain(cliDomain, findGatewayDomain(cliDomain) ?? cliDomain);
71
+ const gatewayDomain = findGatewayDomain(cliDomain);
72
+ if (gatewayDomain === void 0) {
73
+ const registeredDomains = listRegisteredCapabilityDomains();
74
+ const registeredHint = registeredDomains.length > 0 ? `Registered domains: ${registeredDomains.join(", ")}.` : "No capability domains are registered in this ae-cli process.";
75
+ throw new CapabilityCommandValidationError(
76
+ `Capability domain '${cliDomain}' is not registered.`,
77
+ `${registeredHint} Do not guess domain names.`,
78
+ "CAPABILITY_DOMAIN_NOT_REGISTERED"
79
+ );
80
+ }
81
+ return resolveGatewayDomain(cliDomain, gatewayDomain);
82
+ }
83
+ function emptyCapabilityCatalogWarning(capabilities) {
84
+ if (capabilities.length > 0) {
85
+ return void 0;
86
+ }
87
+ return "No capabilities were returned. This does not prove that the project permission is missing. Stop discovery instead of guessing other domains or retrying. If capabilities are expected, verify the capability deployment, enabled features, and permissions.";
64
88
  }
65
89
  function parseOptionalProjectId(raw) {
66
90
  if (raw === void 0) {
@@ -155,7 +179,13 @@ function registerCapability(program) {
155
179
  const projectId = parseOptionalProjectId(opts.projectId);
156
180
  const catalog = normalizeCapabilityList(await listCapabilities(host, gatewayDomain, projectId));
157
181
  const capabilities = filterCapabilities(catalog, opts.domain);
158
- return { domain: opts.domain, count: capabilities.length, capabilities };
182
+ const warning = emptyCapabilityCatalogWarning(catalog);
183
+ return {
184
+ domain: opts.domain,
185
+ count: capabilities.length,
186
+ capabilities,
187
+ ...warning ? { warning } : {}
188
+ };
159
189
  });
160
190
  }).addHelpText(
161
191
  "after",
@@ -170,7 +200,14 @@ function registerCapability(program) {
170
200
  const projectId = parseOptionalProjectId(opts.projectId);
171
201
  const catalog = normalizeCapabilityList(await listCapabilities(host, gatewayDomain, projectId));
172
202
  const capabilities = filterCapabilities(catalog, opts.domain, query);
173
- return { domain: opts.domain, query, count: capabilities.length, capabilities };
203
+ const warning = emptyCapabilityCatalogWarning(catalog);
204
+ return {
205
+ domain: opts.domain,
206
+ query,
207
+ count: capabilities.length,
208
+ capabilities,
209
+ ...warning ? { warning } : {}
210
+ };
174
211
  });
175
212
  }).addHelpText(
176
213
  "after",
@@ -0,0 +1,293 @@
1
+ import {
2
+ logger
3
+ } from "./chunk-JHENBQ5B.js";
4
+
5
+ // src/core/json-utils.ts
6
+ import fs from "fs";
7
+ import { createRequire } from "module";
8
+ var require2 = createRequire(import.meta.url);
9
+ var JSONbig = require2("json-bigint");
10
+ var jsonParser = JSONbig({ storeAsString: true });
11
+ var INTEGER_TOKEN = /^-?(?:0|[1-9]\d*)$/;
12
+ function normalizeParsedNumbers(lossless, native) {
13
+ if (typeof lossless === "string" && typeof native === "number") {
14
+ if (INTEGER_TOKEN.test(lossless) && !Number.isSafeInteger(native)) {
15
+ return lossless;
16
+ }
17
+ return native;
18
+ }
19
+ if (Array.isArray(lossless) && Array.isArray(native)) {
20
+ for (let index = 0; index < lossless.length; index++) {
21
+ lossless[index] = normalizeParsedNumbers(lossless[index], native[index]);
22
+ }
23
+ return lossless;
24
+ }
25
+ if (lossless !== null && native !== null && typeof lossless === "object" && typeof native === "object") {
26
+ for (const key of Object.keys(lossless)) {
27
+ lossless[key] = normalizeParsedNumbers(lossless[key], native[key]);
28
+ }
29
+ }
30
+ return lossless;
31
+ }
32
+ function safeJsonParse(text) {
33
+ const lossless = jsonParser.parse(text);
34
+ return normalizeParsedNumbers(lossless, JSON.parse(text));
35
+ }
36
+ function safeReadJsonFile(filePath) {
37
+ const content = fs.readFileSync(filePath, "utf-8");
38
+ return safeJsonParse(content);
39
+ }
40
+
41
+ // src/core/url-utils.ts
42
+ function normalizeUrl(url) {
43
+ if (!url) return url;
44
+ if (!url.startsWith("http://") && !url.startsWith("https://")) {
45
+ url = `https://${url}`;
46
+ }
47
+ return url.replace(/\/$/, "");
48
+ }
49
+
50
+ // src/core/config.ts
51
+ import fs3 from "fs";
52
+ import path from "path";
53
+
54
+ // src/core/sandbox-runtime.ts
55
+ import { homedir } from "os";
56
+ import { join } from "path";
57
+ import fs2 from "fs";
58
+ var LINUX_SANDBOX_RUNTIME_ROOT = "/home/ta/te_agent_ta";
59
+ function getDefaultSandboxRuntimeRoot() {
60
+ if (process.platform === "linux") {
61
+ return LINUX_SANDBOX_RUNTIME_ROOT;
62
+ }
63
+ return homedir();
64
+ }
65
+ function getSandboxRuntimeRoot() {
66
+ return process.env.SANDBOX_RUNTIME_ROOT || getDefaultSandboxRuntimeRoot();
67
+ }
68
+ function getSandboxAeConfigDir() {
69
+ return join(getSandboxRuntimeRoot(), ".ae-config");
70
+ }
71
+ function getSandboxCliTokenFilePath() {
72
+ return join(getSandboxAeConfigDir(), "cli-token.json");
73
+ }
74
+ function isAeSandboxRuntime() {
75
+ if (process.env.SANDBOX_RUNTIME_ROOT) {
76
+ return true;
77
+ }
78
+ try {
79
+ if (fs2.existsSync(getSandboxCliTokenFilePath())) {
80
+ return true;
81
+ }
82
+ } catch {
83
+ }
84
+ return false;
85
+ }
86
+
87
+ // src/core/config.ts
88
+ var CONFIG_DIR = path.join(process.env.HOME || "", ".ae-cli");
89
+ var CONFIG_FILE = path.join(CONFIG_DIR, "config.json");
90
+ function sandboxCliTokenCandidatePaths() {
91
+ const paths = [getSandboxCliTokenFilePath()];
92
+ const homeFallback = path.join(process.env.HOME || "", ".ae-config", "cli-token.json");
93
+ if (!paths.includes(homeFallback)) {
94
+ paths.push(homeFallback);
95
+ }
96
+ return paths;
97
+ }
98
+ function readSandboxCliTokenEntry() {
99
+ for (const file of sandboxCliTokenCandidatePaths()) {
100
+ if (!fs3.existsSync(file)) continue;
101
+ try {
102
+ const data = safeReadJsonFile(file);
103
+ if (data && typeof data === "object" && !Array.isArray(data)) {
104
+ const url = data.url;
105
+ const token = data.token ?? data["cli-token"];
106
+ if (url && token) {
107
+ return { url, token };
108
+ }
109
+ }
110
+ } catch {
111
+ }
112
+ }
113
+ return null;
114
+ }
115
+ function forceMigrateFromFallback() {
116
+ const entry = readSandboxCliTokenEntry();
117
+ if (!entry) return null;
118
+ return { [entry.url]: entry.token };
119
+ }
120
+ function getFallbackCliToken(hostUrl) {
121
+ const store = forceMigrateFromFallback();
122
+ if (!store) return null;
123
+ if (hostUrl && store[hostUrl]) return store[hostUrl];
124
+ const entries = Object.values(store);
125
+ if (entries.length === 1) return entries[0];
126
+ return null;
127
+ }
128
+ function ensureDir() {
129
+ if (!fs3.existsSync(CONFIG_DIR)) fs3.mkdirSync(CONFIG_DIR, { recursive: true });
130
+ }
131
+ function dedupeNormalizedHosts(config) {
132
+ const hosts = {};
133
+ for (const [url, entry] of Object.entries(config.hosts)) {
134
+ const key = normalizeUrl(url);
135
+ if (!hosts[key]) {
136
+ hosts[key] = entry;
137
+ }
138
+ }
139
+ return {
140
+ activeHost: config.activeHost ? normalizeUrl(config.activeHost) : "",
141
+ hosts
142
+ };
143
+ }
144
+ function configNeedsNormalization(config) {
145
+ if (config.activeHost && normalizeUrl(config.activeHost) !== config.activeHost) return true;
146
+ const keys = Object.keys(config.hosts);
147
+ if (keys.some((url) => normalizeUrl(url) !== url)) return true;
148
+ return new Set(keys.map(normalizeUrl)).size !== keys.length;
149
+ }
150
+ function loadConfig() {
151
+ try {
152
+ if (fs3.existsSync(CONFIG_FILE)) {
153
+ const raw = safeReadJsonFile(CONFIG_FILE);
154
+ if (raw.defaultHost && !raw.activeHost) {
155
+ const migrated = dedupeNormalizedHosts(migrateConfig(raw));
156
+ saveConfig(migrated);
157
+ return migrated;
158
+ }
159
+ const rawConfig = raw;
160
+ if (configNeedsNormalization(rawConfig)) {
161
+ const config = dedupeNormalizedHosts(rawConfig);
162
+ saveConfig(config);
163
+ return config;
164
+ }
165
+ return rawConfig;
166
+ }
167
+ } catch (err) {
168
+ logger.error(`Error loading config: ${err.message}`);
169
+ console.error(`Error loading config: ${err.message}`);
170
+ }
171
+ return { activeHost: "", hosts: {} };
172
+ }
173
+ function migrateConfig(old) {
174
+ const hosts = {};
175
+ const oldHost = old.defaultHost;
176
+ if (old.hosts) {
177
+ for (const [key, val] of Object.entries(old.hosts)) {
178
+ const url = normalizeUrl(key.startsWith("http") ? key : `https://${key}`);
179
+ hosts[url] = val;
180
+ }
181
+ }
182
+ const activeHost = normalizeUrl(oldHost.startsWith("http") ? oldHost : `https://${oldHost}`);
183
+ if (!hosts[activeHost]) {
184
+ hosts[activeHost] = { label: "default" };
185
+ }
186
+ return { activeHost, hosts };
187
+ }
188
+ function saveConfig(config) {
189
+ ensureDir();
190
+ fs3.writeFileSync(CONFIG_FILE, JSON.stringify(config, null, 2));
191
+ logger.info(`Config saved: activeHost=${config.activeHost}, hosts=${Object.keys(config.hosts).length}`);
192
+ }
193
+ function getActiveHost() {
194
+ const sandboxHost = readSandboxCliTokenEntry()?.url;
195
+ if (sandboxHost) return sandboxHost;
196
+ const config = loadConfig();
197
+ return config.activeHost || "";
198
+ }
199
+ function setActiveHost(url) {
200
+ url = normalizeUrl(url);
201
+ const config = loadConfig();
202
+ if (!config.hosts[url]) {
203
+ throw new Error(`Host ${url} is not in the configured hosts list. Add it first.`);
204
+ }
205
+ config.activeHost = url;
206
+ saveConfig(config);
207
+ }
208
+ function addHost(url, label) {
209
+ url = normalizeUrl(url);
210
+ label = normalizeLabel(label);
211
+ const config = loadConfig();
212
+ assertUniqueHostLabel(config, label, url);
213
+ config.hosts[url] = { label };
214
+ if (!config.activeHost) {
215
+ config.activeHost = url;
216
+ }
217
+ saveConfig(config);
218
+ }
219
+ function updateHostLabel(url, label) {
220
+ url = normalizeUrl(url);
221
+ label = normalizeLabel(label);
222
+ const config = loadConfig();
223
+ if (!config.hosts[url]) {
224
+ throw new Error(`Host is not configured: ${url}`);
225
+ }
226
+ assertUniqueHostLabel(config, label, url);
227
+ config.hosts[url].label = label;
228
+ saveConfig(config);
229
+ }
230
+ function normalizeLabel(label) {
231
+ const normalized = label.trim();
232
+ if (!normalized) {
233
+ throw new Error("Label cannot be empty.");
234
+ }
235
+ return normalized;
236
+ }
237
+ function assertUniqueHostLabel(config, label, excludeUrl) {
238
+ const duplicate = Object.entries(config.hosts).find(([url, entry]) => url !== excludeUrl && entry.label === label);
239
+ if (duplicate) {
240
+ throw new Error(`Label already exists: ${label}. Rename the existing label first: ${duplicate[0]}`);
241
+ }
242
+ }
243
+ function removeHost(url) {
244
+ url = normalizeUrl(url);
245
+ const config = loadConfig();
246
+ delete config.hosts[url];
247
+ if (config.activeHost === url) {
248
+ const remaining = Object.keys(config.hosts);
249
+ config.activeHost = remaining.length > 0 ? remaining[0] : "";
250
+ }
251
+ saveConfig(config);
252
+ }
253
+ function listHosts() {
254
+ const config = loadConfig();
255
+ return Object.entries(config.hosts).map(([url, entry]) => ({
256
+ url,
257
+ label: entry.label,
258
+ active: url === config.activeHost
259
+ }));
260
+ }
261
+ function resolveHostSelector(env) {
262
+ const raw = env.trim();
263
+ const selector = raw.startsWith("http://") || raw.startsWith("https://") ? normalizeUrl(raw) : raw;
264
+ const hosts = listHosts();
265
+ const byUrl = hosts.find((host) => host.url === selector);
266
+ if (byUrl) return { status: "found", host: byUrl };
267
+ const byLabel = hosts.filter((host) => host.label === raw);
268
+ if (byLabel.length === 1) return { status: "found", host: byLabel[0] };
269
+ if (byLabel.length > 1) return { status: "duplicate-label", matches: byLabel };
270
+ return { status: "not-found", hosts };
271
+ }
272
+ function getConfigDir() {
273
+ return CONFIG_DIR;
274
+ }
275
+
276
+ export {
277
+ safeJsonParse,
278
+ safeReadJsonFile,
279
+ normalizeUrl,
280
+ getSandboxRuntimeRoot,
281
+ isAeSandboxRuntime,
282
+ getFallbackCliToken,
283
+ loadConfig,
284
+ saveConfig,
285
+ getActiveHost,
286
+ setActiveHost,
287
+ addHost,
288
+ updateHostLabel,
289
+ removeHost,
290
+ listHosts,
291
+ resolveHostSelector,
292
+ getConfigDir
293
+ };
@@ -17,6 +17,9 @@ function registerCapabilityGatewayRoute(cliService, route) {
17
17
  function findGatewayDomain(cliService) {
18
18
  return cliServiceRoutes.get(cliService)?.gatewayDomain;
19
19
  }
20
+ function listRegisteredCapabilityDomains() {
21
+ return [...cliServiceRoutes.keys()].sort();
22
+ }
20
23
  function resolveGatewayDomain(cliService, override) {
21
24
  const envDomain = envGatewayDomain(cliService);
22
25
  if (envDomain !== void 0) {
@@ -37,5 +40,6 @@ function resolveGatewayDomain(cliService, override) {
37
40
  export {
38
41
  registerCapabilityGatewayRoute,
39
42
  findGatewayDomain,
43
+ listRegisteredCapabilityDomains,
40
44
  resolveGatewayDomain
41
45
  };
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  internalCallSourceHeaders
3
- } from "./chunk-C4MGVGJW.js";
3
+ } from "./chunk-SERWF6G5.js";
4
4
  import {
5
5
  clearCliToken,
6
6
  getCliToken
7
- } from "./chunk-4SGZG4XY.js";
7
+ } from "./chunk-J2DEBMRF.js";
8
8
  import {
9
9
  getActiveHost,
10
10
  getSandboxRuntimeRoot
11
- } from "./chunk-ZZUOD757.js";
11
+ } from "./chunk-3FY3RJ26.js";
12
12
  import {
13
13
  PermissionError
14
14
  } from "./chunk-UW5UN47B.js";