@thinkingai/ae-cli 6.0.46 → 6.0.48-customer.1
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 +2 -0
- package/README.zh.md +6 -0
- package/dist/{auth-ROB2EDYV.js → auth-QPEVVBKT.js} +13 -7
- package/dist/auth-UMJAA72O.js +15 -0
- package/dist/{capability-GQ47BCFI.js → capability-RUSV77CO.js} +11 -10
- package/dist/{chunk-UW5UN47B.js → chunk-533JK3YX.js} +2 -0
- package/dist/{chunk-4XXOWOTA.js → chunk-6QK7SYYY.js} +5 -4
- package/dist/{chunk-TUKQZTMI.js → chunk-7K24F7T2.js} +2 -0
- package/dist/{chunk-OO6XR6LK.js → chunk-AMBFK2K3.js} +2 -0
- package/dist/{sync-HKIOZXQE.js → chunk-B5HMQAOM.js} +31 -540
- package/dist/chunk-BE73PUFX.js +25216 -0
- package/dist/{chunk-DQRPU6EE.js → chunk-BVDST5YT.js} +5 -4
- package/dist/{chunk-VTWMIC5L.js → chunk-E2JKXMVO.js} +2 -0
- package/dist/{chunk-JHENBQ5B.js → chunk-FR2EDAQM.js} +1 -0
- package/dist/{chunk-ZQ47LWTI.js → chunk-GJXRF7Y6.js} +6 -5
- package/dist/{chunk-DWO43OIB.js → chunk-JQ3ENZZH.js} +2 -0
- package/dist/chunk-JYMGHGCE.js +191 -0
- package/dist/{chunk-BYYS3ANB.js → chunk-KEWVSO64.js} +5 -4
- package/dist/{chunk-3FY3RJ26.js → chunk-KZ6ZHF5J.js} +2 -1
- package/dist/{chunk-2MN54X6H.js → chunk-NSIVXKJH.js} +4 -3
- package/dist/{chunk-ZQKDZXDO.js → chunk-O6K2ODUE.js} +3 -2
- package/dist/{chunk-J2DEBMRF.js → chunk-RWXIXOZG.js} +22 -9
- package/dist/{chunk-4NN5IWVN.js → chunk-T6OSFQZD.js} +2 -0
- package/dist/{chunk-3KWQYGYI.js → chunk-TKHSULJT.js} +2 -0
- package/dist/{chunk-6EIJSNBD.js → chunk-Y74WTIKJ.js} +2 -0
- package/dist/{client-L2YDMHQ6.js → client-N7NGZUNI.js} +4 -3
- package/dist/{community-report-client-C7WDGET3.js → community-report-client-6OL6GBQW.js} +3 -2
- package/dist/{config-BMYZX2UE.js → config-XNMACCKX.js} +8 -7
- package/dist/{data-integration-QEKDWQDY.js → data-integration-FZQQC3KW.js} +923 -98
- package/dist/index.js +36 -34
- package/dist/{local-data-upload-client-4YYHSYD6.js → local-data-upload-client-EFHDLXFG.js} +3 -2
- package/dist/{memory-3ORCR7JH.js → memory-HBJQ2GC5.js} +8 -7
- package/dist/{metadata-A6QLH3IS.js → metadata-PGDJE5RQ.js} +12 -11
- package/dist/{model-UGRDX4MW.js → model-BHLJ2QMT.js} +10 -9
- package/dist/{personal-semantic-preference-QZFAJWGE.js → personal-semantic-preference-E5NZ56DN.js} +11 -10
- package/dist/sync-MUWPRM5I.js +522 -0
- package/dist/{te-agent-BR6VDBNX.js → te-agent-WQZTMEK4.js} +10 -9
- package/dist/{te-analysis-MUKUXJL4.js → te-analysis-YWCSSLYL.js} +107 -20
- package/dist/{te-community-ISDQWJU7.js → te-community-BNE6KREL.js} +8 -7
- package/dist/{te-dataops-6P5IKWNJ.js → te-dataops-TXLKM2W6.js} +467 -67
- package/dist/{te-engage-ELA3C5BM.js → te-engage-VEW4CJHK.js} +26 -10
- package/dist/{te-kb-RCLSSH2Q.js → te-kb-BUD6N3NI.js} +311 -24
- package/dist/{te-system-FXITO2JG.js → te-system-44LZJDTQ.js} +573 -37
- package/dist/{te-team-ADOC2ROP.js → te-team-XMP47YXE.js} +10 -7
- package/dist/{update-YCYCKJOO.js → update-UODFOZ4P.js} +7 -6
- package/package.json +18 -9
- package/skills/ae-analysis/references/analysis_gateway_assets.md +1 -1
- package/skills/ae-analysis/references/audience_models.md +18 -0
- package/skills/ae-analysis/references/command_index.md +2 -2
- package/skills/ae-analysis/references/project_timezone_update.md +13 -4
- package/skills/ae-analysis/references/property_create.md +2 -0
- package/skills/ae-analysis/references/super_metadata_batch_create.md +2 -0
- package/skills/ae-analysis/references/user_cluster_models.md +2 -0
- package/skills/ae-analysis/references/user_cluster_update.md +8 -4
- package/skills/ae-analysis/references/user_tag_create.md +7 -1
- package/skills/ae-analysis/references/user_tag_models.md +8 -2
- package/skills/ae-data-integration/SKILL.md +1 -0
- package/skills/ae-data-integration/references/error-handling.md +54 -1
- package/skills/ae-data-integration/references/source-inspect.md +18 -2
- package/skills/ae-data-integration/references/tracking-plan.md +1 -1
- package/skills/ae-data-integration/references/transform.md +4 -2
- package/skills/ae-data-integration/references/ue-mapping.md +5 -2
- package/skills/ae-data-integration/references/ue-routing.md +23 -0
- package/skills/ae-dataops/SKILL.md +11 -1
- package/skills/ae-dataops/references/dataops-backfill.md +135 -0
- package/skills/ae-engage/SKILL.md +3 -0
- package/skills/ae-engage/references/build-task-save-guide.md +5 -1
- package/skills/ae-engage/references/save-task.md +6 -0
- package/skills/ae-generate-tracking-plan/SKILL.md +9 -8
- package/skills/ae-generate-tracking-plan/references/business-dimension-mapping.md +1 -1
- package/skills/ae-kb/SKILL.md +120 -9
- package/skills/ae-system/SKILL.md +28 -30
- package/skills/ae-system/references/channel-management.md +303 -0
- package/dist/auth-GBMV6TEJ.js +0 -14
- package/dist/capability-IINANQJA.js +0 -349
- package/dist/chunk-GJLGIMAO.js +0 -556
- package/dist/chunk-OMPRXM3V.js +0 -349
- package/dist/chunk-QNOLN2LJ.js +0 -509
- package/dist/chunk-RJDU7NYP.js +0 -1198
- package/dist/chunk-RNAALWJK.js +0 -98
- package/dist/chunk-SERWF6G5.js +0 -13
- package/dist/chunk-XNVMVIUI.js +0 -71
- package/dist/memory-I2WXDTV2.js +0 -893
- package/dist/metadata-HC7GBTTD.js +0 -339
- package/dist/model-HLHIEFMU.js +0 -139
- package/dist/personal-semantic-preference-YXAZBFVW.js +0 -239
- package/dist/sync-TFHU2UTG.js +0 -10261
- package/dist/te-agent-VLYOV7S4.js +0 -3894
- package/dist/te-analysis-JECYCV6K.js +0 -9357
- package/dist/te-community-5DMNKJWY.js +0 -1859
- package/dist/te-dataops-CVULXNVB.js +0 -2209
- package/dist/te-engage-MC5IQZIU.js +0 -4898
- package/dist/te-system-K2GYMCTB.js +0 -2213
|
@@ -1,19 +1,20 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
|
|
1
2
|
import {
|
|
2
3
|
readOutputMetadata,
|
|
3
4
|
unwrapOutputData,
|
|
4
5
|
withOutputMetadata
|
|
5
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-KEWVSO64.js";
|
|
6
7
|
import {
|
|
7
8
|
CapabilityGatewayError,
|
|
8
9
|
fetchCapabilityGateway,
|
|
9
10
|
requestCapabilityGateway
|
|
10
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-GJXRF7Y6.js";
|
|
11
12
|
import {
|
|
12
13
|
resolveGatewayDomain
|
|
13
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-TKHSULJT.js";
|
|
14
15
|
import {
|
|
15
16
|
PermissionError
|
|
16
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-533JK3YX.js";
|
|
17
18
|
|
|
18
19
|
// src/core/analysis-async-artifact.ts
|
|
19
20
|
import { randomBytes } from "crypto";
|
|
@@ -1,19 +1,20 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
|
|
1
2
|
import {
|
|
2
3
|
internalCallSourceHeaders
|
|
3
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-Y74WTIKJ.js";
|
|
4
5
|
import {
|
|
5
6
|
clearCliToken,
|
|
6
7
|
getCliToken
|
|
7
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-RWXIXOZG.js";
|
|
8
9
|
import {
|
|
9
10
|
safeJsonParse
|
|
10
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-KZ6ZHF5J.js";
|
|
11
12
|
import {
|
|
12
13
|
PermissionError
|
|
13
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-533JK3YX.js";
|
|
14
15
|
import {
|
|
15
16
|
logger
|
|
16
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-FR2EDAQM.js";
|
|
17
18
|
|
|
18
19
|
// src/core/capability-api.ts
|
|
19
20
|
import { readFile } from "fs/promises";
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
|
|
2
|
+
|
|
1
3
|
// src/commands/sync/scanners.ts
|
|
2
4
|
import { createHash } from "crypto";
|
|
3
5
|
import { readdirSync, readFileSync as readFileSync2, statSync, lstatSync, existsSync as existsSync2, realpathSync } from "fs";
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
CapabilityGatewayError
|
|
4
|
+
} from "./chunk-GJXRF7Y6.js";
|
|
5
|
+
import {
|
|
6
|
+
clearCliToken,
|
|
7
|
+
getCliToken
|
|
8
|
+
} from "./chunk-RWXIXOZG.js";
|
|
9
|
+
import {
|
|
10
|
+
safeJsonParse
|
|
11
|
+
} from "./chunk-KZ6ZHF5J.js";
|
|
12
|
+
import {
|
|
13
|
+
PermissionError
|
|
14
|
+
} from "./chunk-533JK3YX.js";
|
|
15
|
+
|
|
16
|
+
// src/core/mcp-access.ts
|
|
17
|
+
function buildUrl(host, path, params = {}) {
|
|
18
|
+
const base = host.replace(/\/$/, "");
|
|
19
|
+
const p = path.startsWith("/") ? path : `/${path}`;
|
|
20
|
+
const url = new URL(`${base}${p}`);
|
|
21
|
+
for (const [key, value] of Object.entries(params)) {
|
|
22
|
+
if (value !== void 0 && value !== null) {
|
|
23
|
+
url.searchParams.set(key, String(value));
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return url.toString();
|
|
27
|
+
}
|
|
28
|
+
var KbUnauthorizedError = class extends Error {
|
|
29
|
+
};
|
|
30
|
+
function optionalString(value) {
|
|
31
|
+
return typeof value === "string" && value.trim() ? value.trim() : void 0;
|
|
32
|
+
}
|
|
33
|
+
function responseReturnCode(data) {
|
|
34
|
+
const value = data?.return_code;
|
|
35
|
+
if (value === void 0 || value === null || value === 0 || value === "0") {
|
|
36
|
+
return void 0;
|
|
37
|
+
}
|
|
38
|
+
if (typeof value === "number" && Number.isFinite(value)) return String(value);
|
|
39
|
+
return optionalString(value);
|
|
40
|
+
}
|
|
41
|
+
function responseErrorMetadata(data) {
|
|
42
|
+
const nestedError = data?.error && typeof data.error === "object" ? data.error : void 0;
|
|
43
|
+
return {
|
|
44
|
+
code: optionalString(data?.errorCode) ?? optionalString(data?.error_code) ?? optionalString(data?.code) ?? optionalString(nestedError?.code) ?? responseReturnCode(data),
|
|
45
|
+
hint: optionalString(data?.hint) ?? optionalString(nestedError?.hint)
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
function responseErrorMessage(data) {
|
|
49
|
+
const nestedError = data?.error && typeof data.error === "object" ? data.error : void 0;
|
|
50
|
+
return optionalString(typeof data?.error === "string" ? data.error : void 0) ?? optionalString(nestedError?.message) ?? optionalString(data?.message) ?? optionalString(data?.return_message);
|
|
51
|
+
}
|
|
52
|
+
function responseStatus(resp) {
|
|
53
|
+
const statusText = optionalString(resp.statusText);
|
|
54
|
+
return statusText ? `${resp.status} ${statusText}` : String(resp.status);
|
|
55
|
+
}
|
|
56
|
+
function malformedResponseError(resp, detail) {
|
|
57
|
+
if (!resp.ok) {
|
|
58
|
+
return new Error(`KB API HTTP error: ${responseStatus(resp)} (${detail})`);
|
|
59
|
+
}
|
|
60
|
+
return new Error(
|
|
61
|
+
`KB API protocol error: HTTP ${responseStatus(resp)} (${detail})`
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
var KbHttpError = class extends CapabilityGatewayError {
|
|
65
|
+
constructor(message, code, status, hint) {
|
|
66
|
+
super(message, code, status, hint);
|
|
67
|
+
this.name = "Error";
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
function nonOkResponseError(resp, data, options) {
|
|
71
|
+
const metadata = responseErrorMetadata(data);
|
|
72
|
+
const serverMessage = responseErrorMessage(data);
|
|
73
|
+
const fallbackMessage = `KB API HTTP error: ${responseStatus(resp)}`;
|
|
74
|
+
const businessCode = options.preserveBusinessErrorCode && typeof data?.error === "string" && metadata.code ? metadata.code : void 0;
|
|
75
|
+
const message = businessCode ? `${businessCode}: ${serverMessage ?? fallbackMessage}` : serverMessage ?? fallbackMessage;
|
|
76
|
+
if (metadata.code || metadata.hint) {
|
|
77
|
+
return new KbHttpError(message, metadata.code, resp.status, metadata.hint);
|
|
78
|
+
}
|
|
79
|
+
return new Error(message);
|
|
80
|
+
}
|
|
81
|
+
function parseKbResponse(resp, text, options = {}) {
|
|
82
|
+
if (resp.status === 403) {
|
|
83
|
+
let msg = "Permission denied for this resource (HTTP 403)";
|
|
84
|
+
let metadata = {};
|
|
85
|
+
try {
|
|
86
|
+
const d = safeJsonParse(text);
|
|
87
|
+
const m = d && (typeof d.error === "string" ? d.error : d.error?.message || d.message);
|
|
88
|
+
if (m && typeof m === "string") msg = m;
|
|
89
|
+
if (options.preserveErrorMetadata) metadata = responseErrorMetadata(d);
|
|
90
|
+
} catch {
|
|
91
|
+
}
|
|
92
|
+
throw new PermissionError(msg, metadata.code, metadata.hint);
|
|
93
|
+
}
|
|
94
|
+
if (resp.status === 401) {
|
|
95
|
+
throw new KbUnauthorizedError(
|
|
96
|
+
`KB API token auth failed: HTTP ${resp.status} ${resp.statusText}`
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
if (!text.trim()) {
|
|
100
|
+
throw malformedResponseError(resp, "empty response body");
|
|
101
|
+
}
|
|
102
|
+
let data;
|
|
103
|
+
try {
|
|
104
|
+
data = safeJsonParse(text);
|
|
105
|
+
} catch {
|
|
106
|
+
throw malformedResponseError(resp, "non-JSON response");
|
|
107
|
+
}
|
|
108
|
+
if (data?.return_code === -1001) {
|
|
109
|
+
throw new KbUnauthorizedError(
|
|
110
|
+
`KB API token auth failed: ${data.return_message || "unauthorized"} (code: ${data.return_code})`
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
if (!resp.ok) {
|
|
114
|
+
throw nonOkResponseError(resp, data, options);
|
|
115
|
+
}
|
|
116
|
+
if (data?.return_code !== 0 && data?.return_code !== void 0) {
|
|
117
|
+
throw new Error(
|
|
118
|
+
`AE API error: ${data.return_message || "unknown"} (code: ${data.return_code})`
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
if (data && typeof data === "object" && typeof data.error === "string" && data.error.trim() && data.return_code === void 0 && data.success === void 0) {
|
|
122
|
+
if (options.preserveErrorMetadata) {
|
|
123
|
+
const metadata = responseErrorMetadata(data);
|
|
124
|
+
throw new CapabilityGatewayError(
|
|
125
|
+
data.error,
|
|
126
|
+
metadata.code,
|
|
127
|
+
resp.status,
|
|
128
|
+
metadata.hint
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
const businessCode = options.preserveBusinessErrorCode && typeof data.code === "string" && data.code.trim() ? data.code.trim() : "";
|
|
132
|
+
throw new Error(businessCode ? `${businessCode}: ${data.error}` : data.error);
|
|
133
|
+
}
|
|
134
|
+
return data?.data !== void 0 ? data.data : data;
|
|
135
|
+
}
|
|
136
|
+
async function fetchWithCliToken(input, init, cliToken, options = {}) {
|
|
137
|
+
const headers = new Headers(init.headers);
|
|
138
|
+
headers.set("cli-token", cliToken);
|
|
139
|
+
const resp = await fetch(input, { ...init, headers });
|
|
140
|
+
return parseKbResponse(resp, await resp.text(), options);
|
|
141
|
+
}
|
|
142
|
+
async function requestWithCliToken(host, input, init, options) {
|
|
143
|
+
const request = async () => fetchWithCliToken(input, init, await getCliToken(host), options);
|
|
144
|
+
try {
|
|
145
|
+
return await request();
|
|
146
|
+
} catch (error) {
|
|
147
|
+
if (!(error instanceof KbUnauthorizedError) || !options.retryUnauthorized) {
|
|
148
|
+
throw error;
|
|
149
|
+
}
|
|
150
|
+
clearCliToken(host);
|
|
151
|
+
return request();
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
async function getAuthHeaders(ctx) {
|
|
155
|
+
const cliToken = await getCliToken(ctx.host());
|
|
156
|
+
return { "cli-token": cliToken };
|
|
157
|
+
}
|
|
158
|
+
async function kbApi(ctx, method, path, params = {}, body, options = {}) {
|
|
159
|
+
const host = ctx.host();
|
|
160
|
+
const upperMethod = method.toUpperCase();
|
|
161
|
+
return requestWithCliToken(
|
|
162
|
+
host,
|
|
163
|
+
buildUrl(host, path, params),
|
|
164
|
+
{
|
|
165
|
+
method: upperMethod,
|
|
166
|
+
headers: {
|
|
167
|
+
"Content-Type": "application/json"
|
|
168
|
+
},
|
|
169
|
+
body: upperMethod === "GET" ? void 0 : JSON.stringify(body ?? {})
|
|
170
|
+
},
|
|
171
|
+
options
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
async function kbUpload(ctx, path, form, params = {}, options = {}) {
|
|
175
|
+
const host = ctx.host();
|
|
176
|
+
return requestWithCliToken(
|
|
177
|
+
host,
|
|
178
|
+
buildUrl(host, path, params),
|
|
179
|
+
{
|
|
180
|
+
method: "POST",
|
|
181
|
+
body: form
|
|
182
|
+
},
|
|
183
|
+
options
|
|
184
|
+
);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
export {
|
|
188
|
+
getAuthHeaders,
|
|
189
|
+
kbApi,
|
|
190
|
+
kbUpload
|
|
191
|
+
};
|
|
@@ -1,18 +1,19 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
|
|
1
2
|
import {
|
|
2
3
|
peekCliToken
|
|
3
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-RWXIXOZG.js";
|
|
4
5
|
import {
|
|
5
6
|
getToken
|
|
6
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-O6K2ODUE.js";
|
|
7
8
|
import {
|
|
8
9
|
getActiveHost,
|
|
9
10
|
getConfigDir,
|
|
10
11
|
isAeSandboxRuntime,
|
|
11
12
|
normalizeUrl
|
|
12
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-KZ6ZHF5J.js";
|
|
13
14
|
import {
|
|
14
15
|
logger
|
|
15
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-FR2EDAQM.js";
|
|
16
17
|
|
|
17
18
|
// src/core/version-sync.ts
|
|
18
19
|
import { spawnSync } from "child_process";
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
|
|
1
2
|
import {
|
|
2
3
|
withOutputMetadata
|
|
3
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-KEWVSO64.js";
|
|
4
5
|
import {
|
|
5
6
|
dryRunCapability,
|
|
6
7
|
executeCapabilityWithEnvelope,
|
|
7
8
|
validateCapability
|
|
8
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-GJXRF7Y6.js";
|
|
9
10
|
import {
|
|
10
11
|
resolveGatewayDomain
|
|
11
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-TKHSULJT.js";
|
|
12
13
|
|
|
13
14
|
// src/core/capability-command.ts
|
|
14
15
|
import { randomBytes } from "crypto";
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
|
|
1
2
|
import {
|
|
2
3
|
getActiveHost,
|
|
3
4
|
getConfigDir,
|
|
4
5
|
normalizeUrl,
|
|
5
6
|
safeJsonParse
|
|
6
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-KZ6ZHF5J.js";
|
|
7
8
|
import {
|
|
8
9
|
logger
|
|
9
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-FR2EDAQM.js";
|
|
10
11
|
|
|
11
12
|
// src/core/secure-store.ts
|
|
12
13
|
import crypto from "crypto";
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
|
|
1
2
|
import {
|
|
2
3
|
SecureStoreAuthError,
|
|
3
4
|
getToken,
|
|
4
5
|
load,
|
|
5
6
|
loadCliToken,
|
|
6
7
|
save
|
|
7
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-O6K2ODUE.js";
|
|
8
9
|
import {
|
|
9
10
|
getActiveHost,
|
|
10
11
|
getConfigDir,
|
|
@@ -13,13 +14,13 @@ import {
|
|
|
13
14
|
normalizeUrl,
|
|
14
15
|
safeJsonParse,
|
|
15
16
|
safeReadJsonFile
|
|
16
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-KZ6ZHF5J.js";
|
|
17
18
|
import {
|
|
18
19
|
PermissionError
|
|
19
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-533JK3YX.js";
|
|
20
21
|
import {
|
|
21
22
|
logger
|
|
22
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-FR2EDAQM.js";
|
|
23
24
|
|
|
24
25
|
// src/core/cli-token.ts
|
|
25
26
|
import fs from "fs";
|
|
@@ -27,6 +28,17 @@ import path from "path";
|
|
|
27
28
|
var CLI_TOKEN_GENERATE_PATH = "/v1/ta/cli/token/generate";
|
|
28
29
|
var CLI_TOKEN_RENEW_PATH = "/v1/ta/cli/token/renew";
|
|
29
30
|
var CLI_TOKEN_VALIDATE_PATH = "/v1/ta/cli/token/validate";
|
|
31
|
+
var CliTokenValidationUnavailableError = class extends Error {
|
|
32
|
+
constructor(message) {
|
|
33
|
+
super(message);
|
|
34
|
+
this.name = "CliTokenValidationUnavailableError";
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
function isExplicitCliTokenRejection(data, responseText) {
|
|
38
|
+
const code = String(data?.code ?? data?.error?.code ?? "");
|
|
39
|
+
const message = String(data?.return_message ?? data?.message ?? data?.error?.message ?? responseText);
|
|
40
|
+
return /cli[_-]?token[_-]?(invalid|expired)/i.test(code) || /cli[-_\s]?token.*\b(invalid|expired)\b/i.test(message) || /\b(invalid|expired)\b.*cli[-_\s]?token/i.test(message);
|
|
41
|
+
}
|
|
30
42
|
var _cliTokenCache = /* @__PURE__ */ new Map();
|
|
31
43
|
var _renewedLocalDateByHost = /* @__PURE__ */ new Map();
|
|
32
44
|
var _renewInFlightByHost = /* @__PURE__ */ new Map();
|
|
@@ -162,7 +174,7 @@ async function validateCliTokenOnServer(hostUrl, cliToken) {
|
|
|
162
174
|
}
|
|
163
175
|
});
|
|
164
176
|
} catch (e) {
|
|
165
|
-
throw new
|
|
177
|
+
throw new CliTokenValidationUnavailableError(`Unable to validate CLI token for ${hostUrl}: ${e.message}`);
|
|
166
178
|
}
|
|
167
179
|
const responseText = await resp.text();
|
|
168
180
|
let data;
|
|
@@ -171,18 +183,18 @@ async function validateCliTokenOnServer(hostUrl, cliToken) {
|
|
|
171
183
|
} catch {
|
|
172
184
|
data = void 0;
|
|
173
185
|
}
|
|
174
|
-
if (
|
|
186
|
+
if (isExplicitCliTokenRejection(data, responseText)) {
|
|
175
187
|
throw new SecureStoreAuthError(
|
|
176
188
|
`CLI token is invalid or expired for ${hostUrl}. Run: ae-cli auth logout --host ${hostUrl}, then ae-cli auth login --host ${hostUrl}`
|
|
177
189
|
);
|
|
178
190
|
}
|
|
179
191
|
if (!resp.ok) {
|
|
180
|
-
throw new
|
|
181
|
-
`CLI token validation
|
|
192
|
+
throw new CliTokenValidationUnavailableError(
|
|
193
|
+
`CLI token validation is unavailable for ${hostUrl} (HTTP ${resp.status} ${resp.statusText})`
|
|
182
194
|
);
|
|
183
195
|
}
|
|
184
196
|
if (data?.return_code !== 0) {
|
|
185
|
-
throw new
|
|
197
|
+
throw new CliTokenValidationUnavailableError(`CLI token validation returned an unsupported response for ${hostUrl}`);
|
|
186
198
|
}
|
|
187
199
|
}
|
|
188
200
|
async function renewCliTokenOnServer(hostUrl, cliToken) {
|
|
@@ -305,6 +317,7 @@ function clearCliToken(hostUrl) {
|
|
|
305
317
|
}
|
|
306
318
|
|
|
307
319
|
export {
|
|
320
|
+
CliTokenValidationUnavailableError,
|
|
308
321
|
validateCliTokenOnServer,
|
|
309
322
|
peekCliToken,
|
|
310
323
|
getCliToken,
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
|
|
1
2
|
import {
|
|
2
3
|
SecureStoreAuthError,
|
|
3
4
|
getToken,
|
|
4
5
|
invalidateAccessTokenForRetry,
|
|
5
6
|
resolveHost
|
|
6
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-O6K2ODUE.js";
|
|
7
8
|
import {
|
|
8
9
|
safeJsonParse
|
|
9
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-KZ6ZHF5J.js";
|
|
10
11
|
import {
|
|
11
12
|
logger
|
|
12
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-FR2EDAQM.js";
|
|
13
14
|
|
|
14
15
|
// src/core/client.ts
|
|
15
16
|
import WebSocket from "ws";
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
|
|
1
2
|
import {
|
|
2
3
|
CommunityReportError
|
|
3
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-533JK3YX.js";
|
|
4
5
|
import {
|
|
5
6
|
logger
|
|
6
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-FR2EDAQM.js";
|
|
7
8
|
|
|
8
9
|
// src/core/community-report-client.ts
|
|
9
10
|
var DEFAULT_TIMEOUT_MS = 3e4;
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
|
|
1
2
|
import {
|
|
2
3
|
MultiselectCancelled,
|
|
3
4
|
promptSingleSelect
|
|
4
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-7K24F7T2.js";
|
|
5
6
|
import {
|
|
6
7
|
printError,
|
|
7
8
|
printOutput
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-KEWVSO64.js";
|
|
10
|
+
import "./chunk-RWXIXOZG.js";
|
|
10
11
|
import {
|
|
11
12
|
AE_TRIAL_URL,
|
|
12
13
|
missingAeHostHint
|
|
13
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-O6K2ODUE.js";
|
|
14
15
|
import {
|
|
15
16
|
addHost,
|
|
16
17
|
listHosts,
|
|
@@ -20,9 +21,9 @@ import {
|
|
|
20
21
|
resolveHostSelector,
|
|
21
22
|
setActiveHost,
|
|
22
23
|
updateHostLabel
|
|
23
|
-
} from "./chunk-
|
|
24
|
-
import "./chunk-
|
|
25
|
-
import "./chunk-
|
|
24
|
+
} from "./chunk-KZ6ZHF5J.js";
|
|
25
|
+
import "./chunk-533JK3YX.js";
|
|
26
|
+
import "./chunk-FR2EDAQM.js";
|
|
26
27
|
|
|
27
28
|
// src/commands/config.ts
|
|
28
29
|
import * as readline2 from "readline";
|