@thinkingai/ae-cli 6.1.32 → 6.1.34
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.
- package/README.md +8 -5
- package/README.zh.md +10 -9
- package/bin/runtime-capabilities.json +1 -1
- package/cli-installation-guide.md +14 -4
- package/dist/{ai-monitor-MKMHSSNI.js → ai-monitor-TVRFVZBH.js} +11 -9
- package/dist/ai-monitor.js +18 -16
- package/dist/{auth-CZHHPZOQ.js → auth-JAXLMPBB.js} +33 -316
- package/dist/{automation-FLCPFMN4.js → automation-OQ647CSW.js} +7 -7
- package/dist/{capability-64KVJFIA.js → capability-2Z4ZXTPD.js} +19 -16
- package/dist/chunk-2H3SFJE3.js +344 -0
- package/dist/{chunk-TMQGS4TO.js → chunk-3PZNM5KN.js} +3 -3
- package/dist/chunk-3ZQY7SLZ.js +147 -0
- package/dist/chunk-6E6HCTP2.js +60 -0
- package/dist/{local-data-upload-client-KCMG6J62.js → chunk-6IUTXRAD.js} +32 -4
- package/dist/{chunk-5M5LBRR3.js → chunk-CYZV5AXW.js} +18 -9
- package/dist/{chunk-3ULDJJTZ.js → chunk-DE5XHQQ6.js} +2 -2
- package/dist/{chunk-FCAA7I2D.js → chunk-E5CJI7L3.js} +26 -10
- package/dist/{chunk-QVRIDN42.js → chunk-EQMGH32F.js} +2 -2
- package/dist/{chunk-DWBYNGSR.js → chunk-FNACCKQR.js} +372 -194
- package/dist/{chunk-OAWPT7VP.js → chunk-GD5JSAGV.js} +2 -2
- package/dist/{chunk-CF6JTT2U.js → chunk-GYODT7C4.js} +1 -1
- package/dist/chunk-HBI7IQH3.js +1207 -0
- package/dist/{chunk-4PSTYEG5.js → chunk-IGU3R2JD.js} +9 -5
- package/dist/{chunk-IDDWEZ7F.js → chunk-IWMDPHMI.js} +3 -3
- package/dist/{chunk-P7QDCWJ6.js → chunk-L7MT53VM.js} +8 -2
- package/dist/{chunk-F2VFZUGG.js → chunk-LXRALNNA.js} +2 -2
- package/dist/{chunk-6M7ZEDT2.js → chunk-M2OCZRVX.js} +14 -8
- package/dist/{chunk-Z3Q2AEIN.js → chunk-MTK4ZE7W.js} +17 -145
- package/dist/{chunk-T7WF4HYW.js → chunk-NK5PS5X7.js} +3 -3
- package/dist/{chunk-JEUXDY3B.js → chunk-NPH5J65M.js} +1 -1
- package/dist/chunk-PUSFEC6B.js +29 -0
- package/dist/{chunk-BNBCMCYN.js → chunk-Q764EZND.js} +78 -72
- package/dist/chunk-QOJXLXDJ.js +55 -0
- package/dist/{chunk-HVMCPKOZ.js → chunk-QPUPWGZ3.js} +1 -1
- package/dist/{chunk-72NJKS7O.js → chunk-RLPMXKDQ.js} +8921 -10119
- package/dist/{chunk-NLEXY2TM.js → chunk-S74XV3A6.js} +7 -5
- package/dist/{chunk-KTJXD27G.js → chunk-SHB7A2JE.js} +3 -3
- package/dist/{chunk-HTZ2MLYA.js → chunk-UWQXGF44.js} +25 -11
- package/dist/{data-integration-QE37EQ3A.js → chunk-V6UKLIM6.js} +160 -2258
- package/dist/{chunk-4XKTRCRK.js → chunk-VPLRZSMY.js} +22 -13
- package/dist/{chunk-2F64AZYH.js → chunk-Z6WSCIHM.js} +2 -2
- package/dist/{community-report-client-TJVCLZ3K.js → community-report-client-5VNT6HCV.js} +4 -2
- package/dist/{compat-check-ZJNCMNQV.js → compat-check-E7AQ7UCG.js} +6 -4
- package/dist/{config-FSH2NMNZ.js → config-PGSUWIK5.js} +16 -11
- package/dist/{context-YAQG6YQC.js → context-Y2A6QIS3.js} +9 -6
- package/dist/conversion-4FR3RA45.js +16 -0
- package/dist/data-integration-EIF5QHYF.js +2138 -0
- package/dist/{evaluation-2JSF4V47.js → evaluation-OZM54MES.js} +6 -5
- package/dist/index.js +79 -52
- package/dist/local-data-upload-client-2U3LFD7Z.js +16 -0
- package/dist/{memory-VEZZVAAP.js → memory-6QMZS4HF.js} +7 -7
- package/dist/{metadata-3IWHX3V4.js → metadata-7MZ3CJ2N.js} +11 -9
- package/dist/{model-T7H7Q6BG.js → model-LEYRQKOS.js} +8 -8
- package/dist/{personal-semantic-preference-YITU23SA.js → personal-semantic-preference-SWOUNDWJ.js} +46 -14
- package/dist/{project-semantic-MHEXJF3C.js → project-semantic-M2DDPAMD.js} +10 -8
- package/dist/{sync-AQHVCSPI.js → sync-PWC63JCO.js} +17 -16
- package/dist/{te-agent-RXI7WOH4.js → te-agent-S7UH657Z.js} +304 -16
- package/dist/{te-analysis-CZY74HVF.js → te-analysis-BK6PE333.js} +295 -223
- package/dist/{te-community-DKCYUBCM.js → te-community-OLNTKGCW.js} +17 -13
- package/dist/{te-dataops-QEH6VE56.js → te-dataops-XUWRIF5R.js} +18 -14
- package/dist/{te-engage-WK7WKDKF.js → te-engage-I3I4FJOM.js} +10 -8
- package/dist/{te-experiment-LH3RPIOE.js → te-experiment-XSDUL4KH.js} +216 -28
- package/dist/{te-kb-UPORIOVN.js → te-kb-QFH3YLFQ.js} +74 -21
- package/dist/{te-system-AL4B4XZL.js → te-system-DB5Z3LLF.js} +7 -7
- package/dist/{te-team-LLVTO2G4.js → te-team-UADF2HBO.js} +10 -8
- package/dist/{things-XLMLBYQR.js → things-G2QFXDK7.js} +10 -8
- package/dist/{update-7J5UQHSK.js → update-6I366ICW.js} +10 -9
- package/dist/web-runtime-3XFREWRF.js +2367 -0
- package/dist/{workspace-FF2HXJGR.js → workspace-RZESYB6T.js} +7 -7
- package/package.json +9 -5
- package/skills/ae-agent/SKILL.md +19 -5
- package/skills/ae-agent/references/a2a.md +103 -0
- package/skills/ae-agent/references/command_index.md +11 -0
- package/skills/ae-analysis/SKILL.md +35 -23
- package/skills/ae-analysis/references/analysis_data_retrieval.md +1 -1
- package/skills/ae-analysis/references/asset_authentication_export.md +1 -1
- package/skills/ae-analysis/references/asset_authentication_update.md +6 -2
- package/skills/ae-analysis/references/bad_case_review.md +4 -4
- package/skills/ae-analysis/references/command_index.md +7 -7
- package/skills/ae-analysis/references/governance_recommendation_export.md +2 -2
- package/skills/ae-analysis/references/personal_semantic_preference_add.md +9 -1
- package/skills/ae-analysis/references/personal_semantic_preference_delete.md +2 -0
- package/skills/ae-analysis/references/personal_semantic_preference_get.md +2 -0
- package/skills/ae-analysis/references/personal_semantic_preference_list.md +10 -2
- package/skills/ae-analysis/references/personal_semantic_preference_update.md +8 -0
- package/skills/ae-analysis/references/project_owner_update.md +5 -1
- package/skills/ae-analysis/references/scenario_evaluation.md +17 -1
- package/skills/ae-analysis/references/scenario_list.md +5 -6
- package/skills/ae-capability/SKILL.md +8 -4
- package/skills/ae-data-integration/references/ue-mapping.md +2 -0
- package/skills/ae-experiment/SKILL.md +45 -16
- package/skills/ae-experiment/references/experiment_approval.md +87 -29
- package/skills/ae-experiment/references/manage_experiment.md +7 -3
- package/skills/ae-experiment/references/manage_traffic_domains.md +131 -0
- package/skills/ae-experiment/references/query_experiment_detail.md +8 -0
- package/skills/ae-experiment/references/query_experiment_list.md +6 -0
- package/skills/ae-experiment/references/save_experiment.md +39 -13
- package/skills/ae-experiment/references/save_metric.md +29 -2
- package/skills/ae-experiment/references/save_submit_experiment.md +11 -7
- package/skills/ae-experiment/references/save_submit_external_experiment.md +16 -14
- package/skills/ae-experiment/references/save_traffic_layer.md +17 -1
- package/skills/ae-kb/SKILL.md +4 -2
- package/skills/ae-kb/references/publication.md +45 -0
- package/skills/ae-onboarding/SKILL.md +64 -0
- package/skills/ae-onboarding/references/business-sdk.md +8 -0
- package/skills/ae-onboarding/references/demo-operations.md +79 -0
- package/skills/ae-onboarding/references/import.md +19 -0
- package/skills/ae-onboarding/references/onboarding_experiment_launch.md +12 -0
- package/skills/ae-onboarding/references/onboarding_experiment_plan.md +14 -0
- package/skills/ae-onboarding/references/onboarding_growth.md +36 -0
- package/skills/ae-onboarding/references/onboarding_run.md +11 -0
- package/skills/ae-onboarding/references/onboarding_status.md +5 -0
- package/skills/ae-onboarding/scripts/experiment-preset.json +252 -0
- package/skills/ae-onboarding/scripts/experiment-requests.mjs +120 -0
- package/skills/ae-onboarding/scripts/generate.mjs +170 -0
- package/skills/ae-onboarding/scripts/resolve-experiment-preset.mjs +26 -0
- package/skills/ae-onboarding/scripts/web-journey.mjs +39 -0
- package/dist/chunk-6ZIQV5GW.js +0 -26
- package/dist/chunk-Y74WTIKJ.js +0 -10
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
logger,
|
|
4
4
|
normalizeUrl,
|
|
5
5
|
readExternalCliToken
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-MTK4ZE7W.js";
|
|
7
7
|
|
|
8
8
|
// src/core/sandbox-runtime.ts
|
|
9
9
|
import { homedir } from "os";
|
|
@@ -26,19 +26,22 @@ function getSandboxCliTokenFilePath() {
|
|
|
26
26
|
return join(getSandboxAeConfigDir(), "cli-token.json");
|
|
27
27
|
}
|
|
28
28
|
function isAeSandboxRuntime() {
|
|
29
|
+
return getAeSandboxDetectionReason() !== "not_detected";
|
|
30
|
+
}
|
|
31
|
+
function getAeSandboxDetectionReason() {
|
|
29
32
|
if (process.env.SANDBOX_RUNTIME_ROOT) {
|
|
30
|
-
return
|
|
33
|
+
return "runtime_root_env";
|
|
31
34
|
}
|
|
32
35
|
if (process.platform !== "linux") {
|
|
33
|
-
return
|
|
36
|
+
return "not_detected";
|
|
34
37
|
}
|
|
35
38
|
try {
|
|
36
39
|
if (fs.existsSync(getSandboxCliTokenFilePath())) {
|
|
37
|
-
return
|
|
40
|
+
return "cli_token_file";
|
|
38
41
|
}
|
|
39
42
|
} catch {
|
|
40
43
|
}
|
|
41
|
-
return
|
|
44
|
+
return "not_detected";
|
|
42
45
|
}
|
|
43
46
|
|
|
44
47
|
// src/core/config.ts
|
|
@@ -291,6 +294,7 @@ export {
|
|
|
291
294
|
parseJsonRequest,
|
|
292
295
|
getSandboxRuntimeRoot,
|
|
293
296
|
isAeSandboxRuntime,
|
|
297
|
+
getAeSandboxDetectionReason,
|
|
294
298
|
readSandboxCliTokenEntry,
|
|
295
299
|
getFallbackCliToken,
|
|
296
300
|
loadConfig,
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
createCapabilityCommand
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-3PZNM5KN.js";
|
|
5
5
|
import {
|
|
6
6
|
registerCapabilityGatewayRoute
|
|
7
7
|
} from "./chunk-AWW2T2WL.js";
|
|
8
8
|
import {
|
|
9
9
|
executeCapabilityWithEnvelope
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-VPLRZSMY.js";
|
|
11
11
|
import {
|
|
12
12
|
CliApiError,
|
|
13
13
|
CliValidationError
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-3ZQY7SLZ.js";
|
|
15
15
|
|
|
16
16
|
// src/commands/ai-monitor/shared.ts
|
|
17
17
|
function createAiMonitorCapabilityCommand(config) {
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
|
-
|
|
3
|
+
internalCallSourceHeaders
|
|
4
|
+
} from "./chunk-UWQXGF44.js";
|
|
5
|
+
import {
|
|
4
6
|
logger
|
|
5
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-MTK4ZE7W.js";
|
|
8
|
+
import {
|
|
9
|
+
CliValidationError
|
|
10
|
+
} from "./chunk-3ZQY7SLZ.js";
|
|
6
11
|
|
|
7
12
|
// src/core/eval-endpoint.ts
|
|
8
13
|
function resolveEvaluationHost(host) {
|
|
@@ -140,6 +145,7 @@ async function evalRequest(options) {
|
|
|
140
145
|
const timeout = setTimeout(() => controller.abort(), timeoutMs);
|
|
141
146
|
const headers = {
|
|
142
147
|
...options.headers,
|
|
148
|
+
...internalCallSourceHeaders(),
|
|
143
149
|
Accept: options.responseType === "bytes" ? "application/octet-stream, application/json" : "application/json"
|
|
144
150
|
};
|
|
145
151
|
const isMultipart = options.body instanceof FormData;
|
|
@@ -10,10 +10,10 @@ import {
|
|
|
10
10
|
postToMainApp,
|
|
11
11
|
putToMainApp,
|
|
12
12
|
uploadToMainApp
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-CYZV5AXW.js";
|
|
14
14
|
import {
|
|
15
15
|
clearCliTokenCache
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-UWQXGF44.js";
|
|
17
17
|
|
|
18
18
|
// src/core/resource-package-client.ts
|
|
19
19
|
function checkPath(path) {
|
|
@@ -6,17 +6,21 @@ import {
|
|
|
6
6
|
evalRequest,
|
|
7
7
|
evaluationResponseStatus,
|
|
8
8
|
resolveEvaluationHost
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-L7MT53VM.js";
|
|
10
10
|
import {
|
|
11
|
-
getCliToken
|
|
12
|
-
|
|
11
|
+
getCliToken,
|
|
12
|
+
internalCallSourceHeaders
|
|
13
|
+
} from "./chunk-UWQXGF44.js";
|
|
13
14
|
import {
|
|
14
15
|
isAeSandboxRuntime
|
|
15
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-IGU3R2JD.js";
|
|
16
17
|
import {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
} from "./chunk-
|
|
18
|
+
externalCliTokenRequestOptions,
|
|
19
|
+
readExternalCliToken
|
|
20
|
+
} from "./chunk-MTK4ZE7W.js";
|
|
21
|
+
import {
|
|
22
|
+
CliValidationError
|
|
23
|
+
} from "./chunk-3ZQY7SLZ.js";
|
|
20
24
|
|
|
21
25
|
// src/core/eval-session.ts
|
|
22
26
|
var SESSION_PATH = "/api/sandbox/agent/evaluation/session";
|
|
@@ -30,7 +34,7 @@ async function requestSandboxEvaluationSession(host, cliToken, teProjectId, fetc
|
|
|
30
34
|
response = await fetchImpl(url, {
|
|
31
35
|
...credentialOptions,
|
|
32
36
|
method: "POST",
|
|
33
|
-
headers: { Accept: "application/json", "Content-Type": "application/json", "cli-token": cliToken },
|
|
37
|
+
headers: { Accept: "application/json", "Content-Type": "application/json", "cli-token": cliToken, ...internalCallSourceHeaders() },
|
|
34
38
|
body: JSON.stringify(teProjectId ? { te_project_id: teProjectId } : {}),
|
|
35
39
|
redirect: "error",
|
|
36
40
|
signal
|
|
@@ -113,6 +117,8 @@ function evalHeaders(environment = process.env, onboarding) {
|
|
|
113
117
|
return { Authorization: `Bearer ${accessToken}` };
|
|
114
118
|
}
|
|
115
119
|
async function resolveEvalHeaders(ctx, environment = process.env, teProjectId) {
|
|
120
|
+
if (readExternalCliToken(ctx.host())?.taskContext && environment.AE_EVAL_ACCESS_TOKEN?.trim())
|
|
121
|
+
throw new CliValidationError("Managed executions must use the current user evaluation session, not AE_EVAL_ACCESS_TOKEN.", { code: "EVAL_MANAGED_TOKEN_OVERRIDE" });
|
|
116
122
|
if (environment.AE_EVAL_ACCESS_TOKEN?.trim()) return evalHeaders(environment);
|
|
117
123
|
if (!isAeSandboxRuntime()) {
|
|
118
124
|
const baseUrl = resolveEvalBaseUrl(ctx, environment);
|
|
@@ -1,135 +1,7 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
9
|
-
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
10
|
-
}) : x)(function(x) {
|
|
11
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
12
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
13
|
-
});
|
|
14
|
-
var __esm = (fn, res, err) => function __init() {
|
|
15
|
-
if (err) throw err[0];
|
|
16
|
-
try {
|
|
17
|
-
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
18
|
-
} catch (e) {
|
|
19
|
-
throw err = [e], e;
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
var __commonJS = (cb, mod) => function __require2() {
|
|
23
|
-
try {
|
|
24
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
25
|
-
} catch (e) {
|
|
26
|
-
throw mod = 0, e;
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
var __export = (target, all) => {
|
|
30
|
-
for (var name in all)
|
|
31
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
32
|
-
};
|
|
33
|
-
var __copyProps = (to, from, except, desc) => {
|
|
34
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
35
|
-
for (let key of __getOwnPropNames(from))
|
|
36
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
37
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
38
|
-
}
|
|
39
|
-
return to;
|
|
40
|
-
};
|
|
41
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
42
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
43
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
44
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
45
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
46
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
47
|
-
mod
|
|
48
|
-
));
|
|
49
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
50
|
-
|
|
51
|
-
// src/core/errors.ts
|
|
52
|
-
var PermissionError = class extends Error {
|
|
53
|
-
constructor(message, code, hint, details, meta) {
|
|
54
|
-
super(message);
|
|
55
|
-
this.code = code;
|
|
56
|
-
this.hint = hint;
|
|
57
|
-
this.details = details;
|
|
58
|
-
this.meta = meta;
|
|
59
|
-
this.name = "PermissionError";
|
|
60
|
-
}
|
|
61
|
-
code;
|
|
62
|
-
hint;
|
|
63
|
-
details;
|
|
64
|
-
meta;
|
|
65
|
-
};
|
|
66
|
-
function isApiErrorType(value) {
|
|
67
|
-
return value === "auth" || value === "permission" || value === "validation" || value === "not_found" || value === "api";
|
|
68
|
-
}
|
|
69
|
-
var CliValidationError = class extends Error {
|
|
70
|
-
code;
|
|
71
|
-
hint;
|
|
72
|
-
location;
|
|
73
|
-
constructor(message, options = {}) {
|
|
74
|
-
super(message);
|
|
75
|
-
this.name = "CliValidationError";
|
|
76
|
-
this.code = options.code;
|
|
77
|
-
this.hint = options.hint;
|
|
78
|
-
if (options.location) {
|
|
79
|
-
const location = {};
|
|
80
|
-
if (typeof options.location.segment === "number" && Number.isFinite(options.location.segment)) {
|
|
81
|
-
location.segment = options.location.segment;
|
|
82
|
-
}
|
|
83
|
-
if (typeof options.location.record === "number" && Number.isFinite(options.location.record)) {
|
|
84
|
-
location.record = options.location.record;
|
|
85
|
-
}
|
|
86
|
-
if (typeof options.location.field === "string" && options.location.field.length > 0) {
|
|
87
|
-
location.field = options.location.field;
|
|
88
|
-
}
|
|
89
|
-
if (Object.keys(location).length > 0) this.location = location;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
var CliApiError = class extends Error {
|
|
94
|
-
code;
|
|
95
|
-
hint;
|
|
96
|
-
meta;
|
|
97
|
-
constructor(message, options = {}) {
|
|
98
|
-
super(message);
|
|
99
|
-
this.name = "CliApiError";
|
|
100
|
-
this.code = options.code;
|
|
101
|
-
this.hint = options.hint;
|
|
102
|
-
this.meta = options.meta;
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
var CommunityReportError = class extends Error {
|
|
106
|
-
code;
|
|
107
|
-
httpStatus;
|
|
108
|
-
hint;
|
|
109
|
-
meta;
|
|
110
|
-
constructor(message, options = {}) {
|
|
111
|
-
super(message, options.cause === void 0 ? void 0 : { cause: options.cause });
|
|
112
|
-
this.name = "CommunityReportError";
|
|
113
|
-
this.code = options.code;
|
|
114
|
-
this.httpStatus = options.httpStatus;
|
|
115
|
-
this.hint = options.hint;
|
|
116
|
-
this.meta = options.meta;
|
|
117
|
-
}
|
|
118
|
-
};
|
|
119
|
-
var LocalDataUploadError = class extends Error {
|
|
120
|
-
code;
|
|
121
|
-
httpStatus;
|
|
122
|
-
hint;
|
|
123
|
-
meta;
|
|
124
|
-
constructor(message, options = {}) {
|
|
125
|
-
super(message, options.cause === void 0 ? void 0 : { cause: options.cause });
|
|
126
|
-
this.name = "LocalDataUploadError";
|
|
127
|
-
this.code = options.code;
|
|
128
|
-
this.httpStatus = options.httpStatus;
|
|
129
|
-
this.hint = options.hint;
|
|
130
|
-
this.meta = options.meta;
|
|
131
|
-
}
|
|
132
|
-
};
|
|
2
|
+
import {
|
|
3
|
+
CliValidationError
|
|
4
|
+
} from "./chunk-3ZQY7SLZ.js";
|
|
133
5
|
|
|
134
6
|
// src/core/kb-read-context.ts
|
|
135
7
|
import fs from "fs";
|
|
@@ -232,15 +104,27 @@ function readExternalCliToken(hostOverride) {
|
|
|
232
104
|
let data;
|
|
233
105
|
try {
|
|
234
106
|
const stat = fs2.statSync(file);
|
|
235
|
-
if (!stat.isFile() || stat.size >
|
|
107
|
+
if (!stat.isFile() || stat.size > 96 * 1024) throw new Error();
|
|
236
108
|
data = JSON.parse(fs2.readFileSync(file, "utf8"));
|
|
237
109
|
} catch {
|
|
238
|
-
throw new ExternalCliTokenError("The external CLI token file must be a readable JSON file no larger than
|
|
110
|
+
throw new ExternalCliTokenError("The external CLI token file must be a readable JSON file no larger than 96 KiB.");
|
|
239
111
|
}
|
|
240
112
|
if (!data || typeof data !== "object" || Array.isArray(data)) {
|
|
241
113
|
throw new ExternalCliTokenError("The external CLI token file must contain an object with url and token.");
|
|
242
114
|
}
|
|
115
|
+
if (data.blocked !== void 0) {
|
|
116
|
+
const code = ["PI_CLI_NOT_READY", "PI_CLI_AUTH_REQUIRED", "PI_CLI_PERMISSION_DENIED", "PI_CLI_TIMEOUT"].includes(data.blocked) ? data.blocked : "PI_CLI_NOT_READY";
|
|
117
|
+
throw new ExternalCliTokenError("The runtime could not prepare CLI credentials for this execution.", code);
|
|
118
|
+
}
|
|
243
119
|
entry = credential(data.url, data.token ?? data["cli-token"], "file-cli-token");
|
|
120
|
+
if (data.taskContext !== void 0) {
|
|
121
|
+
const context = data.taskContext;
|
|
122
|
+
if (!context || typeof context !== "object" || Array.isArray(context) || context.version !== 1 || typeof context.grant !== "string" || context.grant.length > 65536 || !/^[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+$/.test(context.grant) || ["executionId", "sandboxId", "companyId"].some((key) => typeof context[key] !== "string" || !/^[^\s\x00-\x1f\x7f]{1,191}$/.test(context[key]))) {
|
|
123
|
+
throw new ExternalCliTokenError("The runtime CLI context is invalid.");
|
|
124
|
+
}
|
|
125
|
+
entry.taskContext = { version: 1, grant: context.grant, executionId: context.executionId, sandboxId: context.sandboxId, companyId: context.companyId };
|
|
126
|
+
diagnosticSecrets.add(context.grant);
|
|
127
|
+
}
|
|
244
128
|
} else if (process.env.AE_CLI_TOKEN !== void 0) {
|
|
245
129
|
entry = credential(process.env.AE_CLI_TOKEN_HOST, process.env.AE_CLI_TOKEN, "environment-cli-token");
|
|
246
130
|
} else if (process.env.AE_CLI_TOKEN_HOST !== void 0) {
|
|
@@ -354,18 +238,6 @@ var Logger = class {
|
|
|
354
238
|
var logger = new Logger();
|
|
355
239
|
|
|
356
240
|
export {
|
|
357
|
-
__require,
|
|
358
|
-
__esm,
|
|
359
|
-
__commonJS,
|
|
360
|
-
__export,
|
|
361
|
-
__toESM,
|
|
362
|
-
__toCommonJS,
|
|
363
|
-
PermissionError,
|
|
364
|
-
isApiErrorType,
|
|
365
|
-
CliValidationError,
|
|
366
|
-
CliApiError,
|
|
367
|
-
CommunityReportError,
|
|
368
|
-
LocalDataUploadError,
|
|
369
241
|
kbExecutionContextRequired,
|
|
370
242
|
isKbQueryPath,
|
|
371
243
|
readKbExecutionContext,
|
|
@@ -6,15 +6,15 @@ import {
|
|
|
6
6
|
readOutputMetadata,
|
|
7
7
|
unwrapOutputData,
|
|
8
8
|
withOutputMetadata
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-DE5XHQQ6.js";
|
|
10
10
|
import {
|
|
11
11
|
CapabilityGatewayError,
|
|
12
12
|
fetchCapabilityGateway,
|
|
13
13
|
requestCapabilityGateway
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-VPLRZSMY.js";
|
|
15
15
|
import {
|
|
16
16
|
PermissionError
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-3ZQY7SLZ.js";
|
|
18
18
|
|
|
19
19
|
// src/core/analysis-async-artifact.ts
|
|
20
20
|
import { randomBytes } from "crypto";
|
|
@@ -2,7 +2,7 @@ import { createRequire as __createRequire } from 'node:module'; const require =
|
|
|
2
2
|
import {
|
|
3
3
|
__commonJS,
|
|
4
4
|
__require
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-3ZQY7SLZ.js";
|
|
6
6
|
|
|
7
7
|
// node_modules/process-nextick-args/index.js
|
|
8
8
|
var require_process_nextick_args = __commonJS({
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
|
|
2
|
+
|
|
3
|
+
// src/core/package-info.ts
|
|
4
|
+
import fs from "fs";
|
|
5
|
+
import path from "path";
|
|
6
|
+
import { fileURLToPath } from "url";
|
|
7
|
+
function getLocalCliPackageInfo() {
|
|
8
|
+
let dir = path.dirname(fileURLToPath(import.meta.url));
|
|
9
|
+
for (let i = 0; i < 8; i += 1) {
|
|
10
|
+
const candidate = path.join(dir, "package.json");
|
|
11
|
+
try {
|
|
12
|
+
if (fs.existsSync(candidate)) {
|
|
13
|
+
const pkg = JSON.parse(fs.readFileSync(candidate, "utf8"));
|
|
14
|
+
if (pkg.name && pkg.version && String(pkg.name).includes("ae-cli")) {
|
|
15
|
+
return { name: pkg.name, version: pkg.version, root: dir };
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
} catch {
|
|
19
|
+
}
|
|
20
|
+
const parent = path.dirname(dir);
|
|
21
|
+
if (parent === dir) break;
|
|
22
|
+
dir = parent;
|
|
23
|
+
}
|
|
24
|
+
return { name: "@tant/ae-cli", version: "0.0.0", root: "" };
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export {
|
|
28
|
+
getLocalCliPackageInfo
|
|
29
|
+
};
|
|
@@ -2,98 +2,48 @@ import { createRequire as __createRequire } from 'node:module'; const require =
|
|
|
2
2
|
import {
|
|
3
3
|
confirmHighRiskWrite,
|
|
4
4
|
requiresConfirmation
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import {
|
|
7
|
-
TeAgentApiError,
|
|
8
|
-
TeAgentCredentialsError
|
|
9
|
-
} from "./chunk-5M5LBRR3.js";
|
|
5
|
+
} from "./chunk-GYODT7C4.js";
|
|
10
6
|
import {
|
|
11
7
|
EvalApiError
|
|
12
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-L7MT53VM.js";
|
|
13
9
|
import {
|
|
14
10
|
printError,
|
|
15
11
|
printOutput
|
|
16
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-DE5XHQQ6.js";
|
|
13
|
+
import {
|
|
14
|
+
TeAgentApiError,
|
|
15
|
+
TeAgentCredentialsError
|
|
16
|
+
} from "./chunk-CYZV5AXW.js";
|
|
17
17
|
import {
|
|
18
18
|
CapabilityGatewayError
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-VPLRZSMY.js";
|
|
20
20
|
import {
|
|
21
21
|
BusinessDisabledError,
|
|
22
22
|
assertBusinessEnabled,
|
|
23
23
|
businessForCommand,
|
|
24
24
|
formatCapabilityMissCompatHint,
|
|
25
25
|
readCurrentBusinessConfig
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-FNACCKQR.js";
|
|
27
27
|
import {
|
|
28
28
|
CredentialStoreUnreadableError,
|
|
29
29
|
SecureStoreAuthError
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-UWQXGF44.js";
|
|
31
31
|
import {
|
|
32
32
|
getActiveHost,
|
|
33
33
|
safeJsonParse
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-IGU3R2JD.js";
|
|
35
|
+
import {
|
|
36
|
+
ExternalCliTokenError,
|
|
37
|
+
logger,
|
|
38
|
+
readKbExecutionContext
|
|
39
|
+
} from "./chunk-MTK4ZE7W.js";
|
|
35
40
|
import {
|
|
36
41
|
CliApiError,
|
|
37
42
|
CliValidationError,
|
|
38
43
|
CommunityReportError,
|
|
39
|
-
ExternalCliTokenError,
|
|
40
44
|
LocalDataUploadError,
|
|
41
|
-
PermissionError
|
|
42
|
-
|
|
43
|
-
readKbExecutionContext
|
|
44
|
-
} from "./chunk-Z3Q2AEIN.js";
|
|
45
|
-
|
|
46
|
-
// src/framework/business-filter.ts
|
|
47
|
-
import { Help } from "commander";
|
|
48
|
-
function commandPath(command) {
|
|
49
|
-
const result = [];
|
|
50
|
-
for (let current = command; current?.parent; current = current.parent) {
|
|
51
|
-
result.unshift(current.name());
|
|
52
|
-
}
|
|
53
|
-
return result;
|
|
54
|
-
}
|
|
55
|
-
function configureBusinessCommands(program, options = {}) {
|
|
56
|
-
const readStates = options.readStates ?? (() => readCurrentBusinessConfig(options.hostOverride));
|
|
57
|
-
const commandBusiness = (command) => businessForCommand([...options.commandPrefix ?? [], ...commandPath(command)]);
|
|
58
|
-
const isVisible = (command) => {
|
|
59
|
-
const business = commandBusiness(command);
|
|
60
|
-
return !business || readStates()[business] !== false;
|
|
61
|
-
};
|
|
62
|
-
const helpConfiguration = {
|
|
63
|
-
visibleCommands(command) {
|
|
64
|
-
return Help.prototype.visibleCommands.call(this, command).filter(isVisible);
|
|
65
|
-
},
|
|
66
|
-
formatHelp(command, helper) {
|
|
67
|
-
if (!isVisible(command)) {
|
|
68
|
-
const business = commandBusiness(command);
|
|
69
|
-
return `The '${business}' business is not enabled for the current environment.
|
|
70
|
-
Run: ae-cli config refresh
|
|
71
|
-
`;
|
|
72
|
-
}
|
|
73
|
-
return Help.prototype.formatHelp.call(this, command, helper);
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
const configureHelp = (command) => {
|
|
77
|
-
command.configureHelp(helpConfiguration);
|
|
78
|
-
command.commands.forEach(configureHelp);
|
|
79
|
-
};
|
|
80
|
-
configureHelp(program);
|
|
81
|
-
program.on("beforeAllHelp", (context) => {
|
|
82
|
-
if (isVisible(context.command)) return;
|
|
83
|
-
const business = commandBusiness(context.command);
|
|
84
|
-
context.write(`The '${business}' business is not enabled for the current environment.
|
|
85
|
-
Run: ae-cli config refresh
|
|
86
|
-
`);
|
|
87
|
-
context.write = () => {
|
|
88
|
-
};
|
|
89
|
-
});
|
|
90
|
-
program.hook("preAction", async (_root, actionCommand) => {
|
|
91
|
-
const business = commandBusiness(actionCommand);
|
|
92
|
-
if (!business) return;
|
|
93
|
-
const opts = actionCommand.optsWithGlobals();
|
|
94
|
-
await (options.assertEnabled ?? assertBusinessEnabled)(business, opts.host ?? options.hostOverride);
|
|
95
|
-
});
|
|
96
|
-
}
|
|
45
|
+
PermissionError
|
|
46
|
+
} from "./chunk-3ZQY7SLZ.js";
|
|
97
47
|
|
|
98
48
|
// src/framework/program-lifecycle.ts
|
|
99
49
|
async function parseProgram(program, argv = process.argv) {
|
|
@@ -165,6 +115,58 @@ function findOption(command, flag) {
|
|
|
165
115
|
return void 0;
|
|
166
116
|
}
|
|
167
117
|
|
|
118
|
+
// src/framework/business-filter.ts
|
|
119
|
+
import { Help } from "commander";
|
|
120
|
+
function commandPath(command) {
|
|
121
|
+
const result = [];
|
|
122
|
+
for (let current = command; current?.parent; current = current.parent) {
|
|
123
|
+
result.unshift(current.name());
|
|
124
|
+
}
|
|
125
|
+
return result;
|
|
126
|
+
}
|
|
127
|
+
function configureBusinessCommands(program, options = {}) {
|
|
128
|
+
const readStates = options.readStates ?? (() => readCurrentBusinessConfig(options.hostOverride));
|
|
129
|
+
const commandBusiness = (command) => businessForCommand([...options.commandPrefix ?? [], ...commandPath(command)]);
|
|
130
|
+
const isVisible = (command) => {
|
|
131
|
+
const business = commandBusiness(command);
|
|
132
|
+
return !business || readStates()[business] !== false;
|
|
133
|
+
};
|
|
134
|
+
const helpConfiguration = {
|
|
135
|
+
visibleCommands(command) {
|
|
136
|
+
return Help.prototype.visibleCommands.call(this, command).filter(isVisible);
|
|
137
|
+
},
|
|
138
|
+
formatHelp(command, helper) {
|
|
139
|
+
if (!isVisible(command)) {
|
|
140
|
+
const business = commandBusiness(command);
|
|
141
|
+
return `The '${business}' business is not enabled for the current environment.
|
|
142
|
+
Run: ae-cli config refresh
|
|
143
|
+
`;
|
|
144
|
+
}
|
|
145
|
+
return Help.prototype.formatHelp.call(this, command, helper);
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
const configureHelp = (command) => {
|
|
149
|
+
command.configureHelp(helpConfiguration);
|
|
150
|
+
command.commands.forEach(configureHelp);
|
|
151
|
+
};
|
|
152
|
+
configureHelp(program);
|
|
153
|
+
program.on("beforeAllHelp", (context) => {
|
|
154
|
+
if (isVisible(context.command)) return;
|
|
155
|
+
const business = commandBusiness(context.command);
|
|
156
|
+
context.write(`The '${business}' business is not enabled for the current environment.
|
|
157
|
+
Run: ae-cli config refresh
|
|
158
|
+
`);
|
|
159
|
+
context.write = () => {
|
|
160
|
+
};
|
|
161
|
+
});
|
|
162
|
+
program.hook("preAction", async (_root, actionCommand) => {
|
|
163
|
+
const business = commandBusiness(actionCommand);
|
|
164
|
+
if (!business) return;
|
|
165
|
+
const opts = actionCommand.optsWithGlobals();
|
|
166
|
+
await (options.assertEnabled ?? assertBusinessEnabled)(business, opts.host ?? options.hostOverride);
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
|
|
168
170
|
// src/framework/runner.ts
|
|
169
171
|
function missingRequiredFlagsError(cmdName, missing) {
|
|
170
172
|
const names = missing.map((flag) => `--${flag.name}`);
|
|
@@ -455,18 +457,22 @@ function createRuntimeContext(cmd, opts, globalOpts) {
|
|
|
455
457
|
let _communityReportModule = null;
|
|
456
458
|
async function getCommunityReportClient() {
|
|
457
459
|
if (!_communityReportModule) {
|
|
458
|
-
_communityReportModule = await import("./community-report-client-
|
|
460
|
+
_communityReportModule = await import("./community-report-client-5VNT6HCV.js");
|
|
459
461
|
}
|
|
460
462
|
return _communityReportModule;
|
|
461
463
|
}
|
|
462
464
|
let _localDataUploadModule = null;
|
|
463
465
|
async function getLocalDataUploadClient() {
|
|
464
466
|
if (!_localDataUploadModule) {
|
|
465
|
-
_localDataUploadModule = await import("./local-data-upload-client-
|
|
467
|
+
_localDataUploadModule = await import("./local-data-upload-client-2U3LFD7Z.js");
|
|
466
468
|
}
|
|
467
469
|
return _localDataUploadModule;
|
|
468
470
|
}
|
|
469
471
|
const ctx = {
|
|
472
|
+
async onboarding(action, input) {
|
|
473
|
+
const { invokeOnboarding } = await import("./web-runtime-3XFREWRF.js");
|
|
474
|
+
return invokeOnboarding(action, input);
|
|
475
|
+
},
|
|
470
476
|
has(name) {
|
|
471
477
|
return Object.prototype.hasOwnProperty.call(opts, camelCase(name));
|
|
472
478
|
},
|
|
@@ -558,6 +564,6 @@ function camelCase(str) {
|
|
|
558
564
|
|
|
559
565
|
export {
|
|
560
566
|
runCommand,
|
|
561
|
-
|
|
562
|
-
|
|
567
|
+
parseProgram,
|
|
568
|
+
configureBusinessCommands
|
|
563
569
|
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
|
|
2
|
+
|
|
3
|
+
// src/core/resource-url.ts
|
|
4
|
+
var LOCAL_BACKEND_PORTS = /* @__PURE__ */ new Set(["8992", "8996"]);
|
|
5
|
+
function normalizeResourceUrlFields(node, host, sourceHost = host) {
|
|
6
|
+
if (!node || typeof node !== "object") return;
|
|
7
|
+
const obj = node;
|
|
8
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
9
|
+
if (typeof value === "string") {
|
|
10
|
+
if (/url|link/i.test(key) || value.includes("/#/")) {
|
|
11
|
+
obj[key] = normalizeResourceUrls(value, host, sourceHost);
|
|
12
|
+
}
|
|
13
|
+
} else if (value && typeof value === "object") {
|
|
14
|
+
normalizeResourceUrlFields(value, host, sourceHost);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
function absolutizeRelativeUrls(s, host) {
|
|
19
|
+
return normalizeResourceUrls(s, host);
|
|
20
|
+
}
|
|
21
|
+
function normalizeResourceUrls(s, host, sourceHost = host) {
|
|
22
|
+
const base = host.replace(/\/+$/, "");
|
|
23
|
+
const sourceBase = sourceHost.replace(/\/+$/, "");
|
|
24
|
+
if (sourceBase && sourceBase !== base) {
|
|
25
|
+
s = s.replace(new RegExp(`${escapeRegExp(sourceBase)}/#`, "g"), `${base}/#`);
|
|
26
|
+
}
|
|
27
|
+
s = s.replace(/\]\((\/(?!\/)[^)]*)\)/g, `](${base}$1)`);
|
|
28
|
+
if (/^\/(?!\/)/.test(s)) s = base + s;
|
|
29
|
+
return s;
|
|
30
|
+
}
|
|
31
|
+
function resolvePublicWebHost(host) {
|
|
32
|
+
const override = process.env.AE_CLI_PUBLIC_WEB_URL || process.env.AE_CLI_WEB_HOST;
|
|
33
|
+
if (override?.trim()) {
|
|
34
|
+
return override.trim().replace(/\/+$/, "");
|
|
35
|
+
}
|
|
36
|
+
try {
|
|
37
|
+
const url = new URL(host);
|
|
38
|
+
if ((url.hostname === "127.0.0.1" || url.hostname === "localhost") && LOCAL_BACKEND_PORTS.has(url.port)) {
|
|
39
|
+
url.port = "10010";
|
|
40
|
+
return url.toString().replace(/\/+$/, "");
|
|
41
|
+
}
|
|
42
|
+
} catch {
|
|
43
|
+
}
|
|
44
|
+
return host.replace(/\/+$/, "");
|
|
45
|
+
}
|
|
46
|
+
function escapeRegExp(value) {
|
|
47
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export {
|
|
51
|
+
normalizeResourceUrlFields,
|
|
52
|
+
absolutizeRelativeUrls,
|
|
53
|
+
normalizeResourceUrls,
|
|
54
|
+
resolvePublicWebHost
|
|
55
|
+
};
|