@thinkingai/ae-cli 6.1.18 → 6.1.19
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-DKMYUTLC.js → capability-ASI62I4A.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-Y3LOALAV.js → chunk-DKEXH6Q5.js} +4 -3
- 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-ZQKDZXDO.js → chunk-O6K2ODUE.js} +3 -2
- package/dist/chunk-QL6R6TSK.js +25215 -0
- package/dist/{chunk-J2DEBMRF.js → chunk-RWXIXOZG.js} +22 -9
- package/dist/{chunk-QZ3AS4KK.js → chunk-S5PONFBM.js} +5 -4
- 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-4NZGZ45E.js} +913 -92
- package/dist/index.js +38 -36
- package/dist/{local-data-upload-client-4YYHSYD6.js → local-data-upload-client-EFHDLXFG.js} +3 -2
- package/dist/{memory-I2WXDTV2.js → memory-HBJQ2GC5.js} +8 -7
- package/dist/{metadata-I4C2EWUN.js → metadata-62EWBEIG.js} +12 -11
- package/dist/{model-HLHIEFMU.js → model-BHLJ2QMT.js} +10 -9
- package/dist/{personal-semantic-preference-LIPACBDX.js → personal-semantic-preference-JBVMAI7L.js} +11 -10
- package/dist/{project-semantic-RT3R2VQD.js → project-semantic-BQ4MPUS5.js} +12 -11
- package/dist/sync-MUWPRM5I.js +522 -0
- package/dist/{te-agent-BR6VDBNX.js → te-agent-WQZTMEK4.js} +10 -9
- package/dist/{te-analysis-7VUNUYWZ.js → te-analysis-MNCG65LU.js} +107 -20
- package/dist/{te-community-5DMNKJWY.js → te-community-BNE6KREL.js} +8 -7
- package/dist/{te-dataops-6P5IKWNJ.js → te-dataops-TXLKM2W6.js} +467 -67
- package/dist/{te-engage-KZPR5R22.js → te-engage-TPKLRVTL.js} +84 -10
- package/dist/{te-experiment-6BITX4RD.js → te-experiment-6BYKTCY7.js} +85 -12
- 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/transform.md +3 -1
- 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 +5 -0
- package/skills/ae-engage/references/build-task-save-guide.md +5 -1
- package/skills/ae-engage/references/save-flow.md +37 -1
- package/skills/ae-engage/references/save-task.md +6 -0
- package/skills/ae-experiment/SKILL.md +6 -2
- package/skills/ae-experiment/references/save_metric.md +20 -8
- 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-HYVVPG25.js +0 -352
- package/dist/chunk-EFH4XWYC.js +0 -556
- package/dist/chunk-JRJY5DMJ.js +0 -71
- 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/memory-3ORCR7JH.js +0 -893
- package/dist/metadata-VUOQJE26.js +0 -339
- package/dist/model-UGRDX4MW.js +0 -139
- package/dist/personal-semantic-preference-OEISBRHM.js +0 -239
- package/dist/project-semantic-FFPWFPIW.js +0 -1114
- package/dist/sync-TFHU2UTG.js +0 -10261
- package/dist/te-agent-VLYOV7S4.js +0 -3894
- package/dist/te-analysis-4YGQL5RC.js +0 -9357
- package/dist/te-community-ISDQWJU7.js +0 -1859
- package/dist/te-dataops-CVULXNVB.js +0 -2209
- package/dist/te-engage-N5WI32H6.js +0 -4898
- package/dist/te-experiment-UVR4HLND.js +0 -988
- package/dist/te-system-K2GYMCTB.js +0 -2213
|
@@ -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,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";
|