@thinkingai/ae-cli 1.0.18 → 1.0.21
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/dist/{auth-ECD46NBA.js → auth-T3ILGJKW.js} +2 -2
- package/dist/{auth-2UTBG5U3.js → auth-ZPA6O5KO.js} +25 -6
- package/dist/{chunk-7QBNU44L.js → chunk-5CCFSPAF.js} +8 -30
- package/dist/{chunk-LAAS6ITR.js → chunk-7G2F7IVO.js} +32 -2
- package/dist/{chunk-4KQ7H7DY.js → chunk-OVMQFFC2.js} +1 -1
- package/dist/{chunk-MR57UIKC.js → chunk-TMMUBSKW.js} +10 -0
- package/dist/{client-O56G2SNJ.js → client-NYAEJDQZ.js} +7 -3
- package/dist/{config-BU5FHGGE.js → config-QZIEYXQZ.js} +2 -2
- package/dist/index.js +18 -13
- package/dist/{raw-A3VN2B6I.js → raw-6ZPW3YII.js} +3 -3
- package/dist/{te-analysis-UGKESPBE.js → te-analysis-CFQBXUCO.js} +93 -7
- package/dist/{te-audience-THZNVHYB.js → te-audience-WPBBWADL.js} +3 -3
- package/dist/{te-common-QZOUME3S.js → te-common-GL3KBZPD.js} +3 -3
- package/dist/{te-community-AZVW3NFX.js → te-community-3XEJNSQL.js} +3 -3
- package/dist/{te-dataops-OE5PX2K6.js → te-dataops-H4WSMCG5.js} +3 -3
- package/dist/{te-engage-RYGEQTYK.js → te-engage-2VFM37ZM.js} +3 -3
- package/dist/te-kb-EHHYPYBN.js +407 -0
- package/dist/{te-meta-MGO5BCMG.js → te-meta-BO45GW32.js} +7 -7
- package/package.json +4 -1
- package/skills/ae-analysis/SKILL.md +69 -37
- package/skills/ae-analysis/references/build_event_analysis_qp.md +132 -0
- package/skills/ae-analysis/references/build_funnel_analysis_qp.md +143 -0
- package/skills/ae-analysis/references/build_prop_analysis_qp.md +122 -0
- package/skills/ae-analysis/references/build_retention_analysis_qp.md +141 -0
- package/skills/ae-analysis/references/get_analysis_query_schema.md +22 -11
- package/skills/ae-analysis/references/get_metric.md +7 -1
- package/skills/ae-analysis/references/get_report_definition.md +4 -0
- package/skills/ae-analysis/references/list_dashboards.md +2 -0
- package/skills/ae-analysis/references/list_events.md +4 -1
- package/skills/ae-analysis/references/list_metrics.md +5 -0
- package/skills/ae-analysis/references/list_properties.md +6 -1
- package/skills/ae-analysis/references/list_reports.md +2 -0
- package/skills/ae-analysis/references/query_adhoc.md +71 -31
- package/skills/ae-community/SKILL.md +14 -101
- package/skills/ae-dataops/SKILL.md +13 -58
- package/skills/ae-engage/SKILL.md +15 -98
|
@@ -4,9 +4,10 @@ import {
|
|
|
4
4
|
} from "./chunk-KM57HI5B.js";
|
|
5
5
|
import {
|
|
6
6
|
clearMcpToken,
|
|
7
|
+
loadMcpTokenStore,
|
|
7
8
|
setMcpTokenManual,
|
|
8
9
|
validateMcpToken
|
|
9
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-5CCFSPAF.js";
|
|
10
11
|
import {
|
|
11
12
|
clearToken,
|
|
12
13
|
getAuthStatus,
|
|
@@ -14,11 +15,11 @@ import {
|
|
|
14
15
|
resolveHost,
|
|
15
16
|
setTokenManual,
|
|
16
17
|
validateToken
|
|
17
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-OVMQFFC2.js";
|
|
18
19
|
import {
|
|
19
20
|
loadConfig,
|
|
20
21
|
saveConfig
|
|
21
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-TMMUBSKW.js";
|
|
22
23
|
|
|
23
24
|
// src/commands/auth.ts
|
|
24
25
|
function registerAuth(program) {
|
|
@@ -29,6 +30,16 @@ function registerAuth(program) {
|
|
|
29
30
|
printError("config", "No AE host configured.", "Run: ae-cli config set-host");
|
|
30
31
|
process.exit(1);
|
|
31
32
|
}
|
|
33
|
+
const config = loadConfig();
|
|
34
|
+
if (!config.hosts[host]) {
|
|
35
|
+
config.hosts[host] = { label: host };
|
|
36
|
+
if (!config.activeHost) {
|
|
37
|
+
config.activeHost = host;
|
|
38
|
+
}
|
|
39
|
+
saveConfig(config);
|
|
40
|
+
process.stderr.write(`[ae-cli] Config saved for ${host}
|
|
41
|
+
`);
|
|
42
|
+
}
|
|
32
43
|
try {
|
|
33
44
|
const token = await getToken(host);
|
|
34
45
|
process.stderr.write(`[ae-cli] Authenticated to ${host}
|
|
@@ -70,14 +81,22 @@ function registerAuth(program) {
|
|
|
70
81
|
`);
|
|
71
82
|
printOutput({ saved: true, host, verified: true }, program.opts().format || "json");
|
|
72
83
|
});
|
|
73
|
-
auth.command("status").description("Show current authentication status").action(() => {
|
|
84
|
+
auth.command("status").description("Show current authentication status").action(async () => {
|
|
74
85
|
const host = resolveHost(program.opts().host);
|
|
75
86
|
if (!host) {
|
|
76
87
|
printOutput({ authenticated: false, host: "(none)", hint: "Run: ae-cli config set-host" }, program.opts().format || "json");
|
|
77
88
|
return;
|
|
78
89
|
}
|
|
79
|
-
const
|
|
80
|
-
|
|
90
|
+
const tokenStatus = getAuthStatus(host);
|
|
91
|
+
const hasValidToken = tokenStatus.authenticated;
|
|
92
|
+
const mcpStore = loadMcpTokenStore();
|
|
93
|
+
const cachedMcpToken = mcpStore[host];
|
|
94
|
+
let hasValidMcpToken = false;
|
|
95
|
+
if (cachedMcpToken) {
|
|
96
|
+
hasValidMcpToken = await validateMcpToken(cachedMcpToken, host);
|
|
97
|
+
}
|
|
98
|
+
const authenticated = hasValidToken || hasValidMcpToken;
|
|
99
|
+
printOutput({ authenticated, host }, program.opts().format || "json");
|
|
81
100
|
});
|
|
82
101
|
auth.command("logout").description("Clear stored token for active host").action(() => {
|
|
83
102
|
const host = resolveHost(program.opts().host);
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getToken
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-OVMQFFC2.js";
|
|
4
4
|
import {
|
|
5
|
+
forceMigrateFromFallback,
|
|
5
6
|
getActiveHost,
|
|
6
7
|
getConfigDir,
|
|
7
8
|
safeJsonParse,
|
|
8
9
|
safeReadJsonFile
|
|
9
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-TMMUBSKW.js";
|
|
10
11
|
|
|
11
12
|
// src/core/mcp.ts
|
|
12
13
|
import fs from "fs";
|
|
@@ -54,7 +55,6 @@ function genRequestId() {
|
|
|
54
55
|
}
|
|
55
56
|
var MCP_TOKEN_FILE = path.join(getConfigDir(), "mcp-tokens.json");
|
|
56
57
|
var MCP_TOKEN_GENERATE_PATH = "/v1/ta/mcp/token/generate";
|
|
57
|
-
var FALLBACK_MCP_TOKEN_FILE = "/data/app/te_agent_ta/.ae-config/mcp-token.json";
|
|
58
58
|
function loadMcpTokenStore() {
|
|
59
59
|
try {
|
|
60
60
|
if (fs.existsSync(MCP_TOKEN_FILE)) {
|
|
@@ -69,23 +69,6 @@ function saveMcpTokenStore(store) {
|
|
|
69
69
|
if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
|
|
70
70
|
fs.writeFileSync(MCP_TOKEN_FILE, JSON.stringify(store, null, 2));
|
|
71
71
|
}
|
|
72
|
-
function getFallbackMcpToken(hostUrl) {
|
|
73
|
-
try {
|
|
74
|
-
if (!fs.existsSync(FALLBACK_MCP_TOKEN_FILE)) {
|
|
75
|
-
return null;
|
|
76
|
-
}
|
|
77
|
-
const fallbackData = safeReadJsonFile(FALLBACK_MCP_TOKEN_FILE);
|
|
78
|
-
if (fallbackData && typeof fallbackData === "object" && !Array.isArray(fallbackData)) {
|
|
79
|
-
const url = fallbackData.url;
|
|
80
|
-
const token = fallbackData["mcp-token"];
|
|
81
|
-
if (url === hostUrl && token) {
|
|
82
|
-
return token;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
} catch {
|
|
86
|
-
}
|
|
87
|
-
return null;
|
|
88
|
-
}
|
|
89
72
|
async function generateMcpToken(hostUrl) {
|
|
90
73
|
const teToken = await getToken(hostUrl);
|
|
91
74
|
const base = hostUrl.replace(/\/+$/, "");
|
|
@@ -196,15 +179,12 @@ async function mcpRequest(url, method, params = {}, hostOverride) {
|
|
|
196
179
|
headers,
|
|
197
180
|
body: JSON.stringify(body)
|
|
198
181
|
});
|
|
199
|
-
if (resp.
|
|
200
|
-
const
|
|
201
|
-
if (
|
|
202
|
-
const store = loadMcpTokenStore();
|
|
203
|
-
store[hostUrl] = fallbackToken;
|
|
204
|
-
saveMcpTokenStore(store);
|
|
182
|
+
if (!resp.ok) {
|
|
183
|
+
const migrated = forceMigrateFromFallback();
|
|
184
|
+
if (migrated && migrated[hostUrl]) {
|
|
205
185
|
process.stderr.write(`[ae-cli] MCP token refreshed from fallback for ${hostUrl}
|
|
206
186
|
`);
|
|
207
|
-
headers["mcp-token"] =
|
|
187
|
+
headers["mcp-token"] = migrated[hostUrl];
|
|
208
188
|
const retryResp = await fetch(url, {
|
|
209
189
|
method: "POST",
|
|
210
190
|
headers,
|
|
@@ -219,9 +199,6 @@ async function mcpRequest(url, method, params = {}, hostOverride) {
|
|
|
219
199
|
}
|
|
220
200
|
return retryData.result;
|
|
221
201
|
}
|
|
222
|
-
throw new Error(`MCP token expired or invalid. Please set a new MCP token: ae-cli auth set-mcp-token <token> --host ${hostUrl}`);
|
|
223
|
-
}
|
|
224
|
-
if (!resp.ok) {
|
|
225
202
|
throw new Error(`MCP HTTP error: ${resp.status} ${resp.statusText}`);
|
|
226
203
|
}
|
|
227
204
|
const data = safeJsonParse(await resp.text());
|
|
@@ -264,6 +241,7 @@ function parseMcpResult(result) {
|
|
|
264
241
|
export {
|
|
265
242
|
registerMcpMappings,
|
|
266
243
|
resolveMcpUrl,
|
|
244
|
+
loadMcpTokenStore,
|
|
267
245
|
clearMcpToken,
|
|
268
246
|
setMcpTokenManual,
|
|
269
247
|
validateMcpToken,
|
|
@@ -2,10 +2,10 @@ import {
|
|
|
2
2
|
clearToken,
|
|
3
3
|
getToken,
|
|
4
4
|
resolveHost
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-OVMQFFC2.js";
|
|
6
6
|
import {
|
|
7
7
|
safeJsonParse
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-TMMUBSKW.js";
|
|
9
9
|
|
|
10
10
|
// src/core/client.ts
|
|
11
11
|
import WebSocket from "ws";
|
|
@@ -59,6 +59,34 @@ async function httpGet(modulePath, params = {}, hostUrl) {
|
|
|
59
59
|
async function httpPost(modulePath, params = {}, body, hostUrl) {
|
|
60
60
|
return request("POST", modulePath, params, body ?? {}, true, hostUrl);
|
|
61
61
|
}
|
|
62
|
+
async function httpDelete(modulePath, params = {}, body, hostUrl) {
|
|
63
|
+
return request("DELETE", modulePath, params, body ?? null, true, hostUrl);
|
|
64
|
+
}
|
|
65
|
+
async function uploadRequest(modulePath, form, params = {}, retry = true, hostUrl) {
|
|
66
|
+
const resolvedHost = resolveHost(hostUrl);
|
|
67
|
+
const token = await getToken(resolvedHost);
|
|
68
|
+
const url = buildUrl(resolvedHost, modulePath, params);
|
|
69
|
+
const headers = {
|
|
70
|
+
"Authorization": `bearer ${token}`
|
|
71
|
+
};
|
|
72
|
+
const resp = await fetch(url, { method: "POST", headers, body: form });
|
|
73
|
+
if ((resp.status === 401 || resp.status === 403) && retry) {
|
|
74
|
+
clearToken(resolvedHost);
|
|
75
|
+
return uploadRequest(modulePath, form, params, false, resolvedHost);
|
|
76
|
+
}
|
|
77
|
+
const data = safeJsonParse(await resp.text());
|
|
78
|
+
if (data.return_code === -1001 && retry) {
|
|
79
|
+
clearToken(resolvedHost);
|
|
80
|
+
return uploadRequest(modulePath, form, params, false, resolvedHost);
|
|
81
|
+
}
|
|
82
|
+
if (data.return_code !== 0 && data.return_code !== void 0) {
|
|
83
|
+
throw new Error(`AE API error: ${data.return_message || "unknown"} (code: ${data.return_code})`);
|
|
84
|
+
}
|
|
85
|
+
return data.data !== void 0 ? data.data : data;
|
|
86
|
+
}
|
|
87
|
+
async function httpUpload(modulePath, form, params = {}, hostUrl) {
|
|
88
|
+
return uploadRequest(modulePath, form, params, true, hostUrl);
|
|
89
|
+
}
|
|
62
90
|
async function wsQueryOnce(projectId, requestId, qp, eventModel, options = {}, token, hostUrl, timeoutMs = 3e4) {
|
|
63
91
|
const wsUrl = buildWsUrl(hostUrl, token);
|
|
64
92
|
return new Promise((resolve, reject) => {
|
|
@@ -142,6 +170,8 @@ async function queryReportData(projectId, reportId, qp, eventModel, options = {}
|
|
|
142
170
|
export {
|
|
143
171
|
httpGet,
|
|
144
172
|
httpPost,
|
|
173
|
+
httpDelete,
|
|
174
|
+
httpUpload,
|
|
145
175
|
wsQuery,
|
|
146
176
|
querySql,
|
|
147
177
|
queryReportData
|
|
@@ -26,6 +26,15 @@ function migrateFromFallback() {
|
|
|
26
26
|
if (!fs2.existsSync(FALLBACK_MCP_TOKEN_FILE) || fs2.existsSync(MCP_TOKENS_FILE)) {
|
|
27
27
|
return null;
|
|
28
28
|
}
|
|
29
|
+
return doMigrateFromFallback();
|
|
30
|
+
}
|
|
31
|
+
function forceMigrateFromFallback() {
|
|
32
|
+
if (!fs2.existsSync(FALLBACK_MCP_TOKEN_FILE)) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
return doMigrateFromFallback();
|
|
36
|
+
}
|
|
37
|
+
function doMigrateFromFallback() {
|
|
29
38
|
try {
|
|
30
39
|
const fallbackData = safeReadJsonFile(FALLBACK_MCP_TOKEN_FILE);
|
|
31
40
|
const tokenStore = {};
|
|
@@ -156,6 +165,7 @@ function extractHostname(fullUrl) {
|
|
|
156
165
|
export {
|
|
157
166
|
safeJsonParse,
|
|
158
167
|
safeReadJsonFile,
|
|
168
|
+
forceMigrateFromFallback,
|
|
159
169
|
loadConfig,
|
|
160
170
|
saveConfig,
|
|
161
171
|
getActiveHost,
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
|
+
httpDelete,
|
|
2
3
|
httpGet,
|
|
3
4
|
httpPost,
|
|
5
|
+
httpUpload,
|
|
4
6
|
queryReportData,
|
|
5
7
|
querySql,
|
|
6
8
|
wsQuery
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-7G2F7IVO.js";
|
|
10
|
+
import "./chunk-OVMQFFC2.js";
|
|
11
|
+
import "./chunk-TMMUBSKW.js";
|
|
10
12
|
export {
|
|
13
|
+
httpDelete,
|
|
11
14
|
httpGet,
|
|
12
15
|
httpPost,
|
|
16
|
+
httpUpload,
|
|
13
17
|
queryReportData,
|
|
14
18
|
querySql,
|
|
15
19
|
wsQuery
|
|
@@ -4,14 +4,14 @@ import {
|
|
|
4
4
|
getToken,
|
|
5
5
|
loadToken,
|
|
6
6
|
validateToken
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-OVMQFFC2.js";
|
|
8
8
|
import {
|
|
9
9
|
addHost,
|
|
10
10
|
listHosts,
|
|
11
11
|
removeHost,
|
|
12
12
|
setActiveHost,
|
|
13
13
|
updateHostLabel
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-TMMUBSKW.js";
|
|
15
15
|
|
|
16
16
|
// src/commands/config.ts
|
|
17
17
|
import * as readline from "readline";
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
getActiveHost,
|
|
7
7
|
safeJsonParse
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-TMMUBSKW.js";
|
|
9
9
|
|
|
10
10
|
// src/index.ts
|
|
11
11
|
import { Command as CommanderCommand } from "commander";
|
|
@@ -62,7 +62,7 @@ function createRuntimeContext(cmd, opts, globalOpts) {
|
|
|
62
62
|
let _clientModule = null;
|
|
63
63
|
async function getClient() {
|
|
64
64
|
if (!_clientModule) {
|
|
65
|
-
_clientModule = await import("./client-
|
|
65
|
+
_clientModule = await import("./client-NYAEJDQZ.js");
|
|
66
66
|
}
|
|
67
67
|
return _clientModule;
|
|
68
68
|
}
|
|
@@ -105,7 +105,7 @@ function createRuntimeContext(cmd, opts, globalOpts) {
|
|
|
105
105
|
return client.queryReportData(projectId, reportId, qp, eventModel, options, ctx.host());
|
|
106
106
|
},
|
|
107
107
|
async token() {
|
|
108
|
-
const { getToken } = await import("./auth-
|
|
108
|
+
const { getToken } = await import("./auth-T3ILGJKW.js");
|
|
109
109
|
return getToken(ctx.host());
|
|
110
110
|
},
|
|
111
111
|
host() {
|
|
@@ -210,59 +210,64 @@ program.name("ae-cli").version(version).description("CLI tool for ThinkingAI (AE
|
|
|
210
210
|
async function loadCommands() {
|
|
211
211
|
const commands = [];
|
|
212
212
|
try {
|
|
213
|
-
const teAnalysis = await import("./te-analysis-
|
|
213
|
+
const teAnalysis = await import("./te-analysis-CFQBXUCO.js");
|
|
214
214
|
commands.push(...teAnalysis.default);
|
|
215
215
|
} catch {
|
|
216
216
|
}
|
|
217
217
|
try {
|
|
218
|
-
const teAudience = await import("./te-audience-
|
|
218
|
+
const teAudience = await import("./te-audience-WPBBWADL.js");
|
|
219
219
|
commands.push(...teAudience.default);
|
|
220
220
|
} catch {
|
|
221
221
|
}
|
|
222
222
|
try {
|
|
223
|
-
const teMeta = await import("./te-meta-
|
|
223
|
+
const teMeta = await import("./te-meta-BO45GW32.js");
|
|
224
224
|
commands.push(...teMeta.default);
|
|
225
225
|
} catch {
|
|
226
226
|
}
|
|
227
227
|
try {
|
|
228
|
-
const teCommon = await import("./te-common-
|
|
228
|
+
const teCommon = await import("./te-common-GL3KBZPD.js");
|
|
229
229
|
commands.push(...teCommon.default);
|
|
230
230
|
} catch {
|
|
231
231
|
}
|
|
232
232
|
try {
|
|
233
|
-
const engage = await import("./te-engage-
|
|
233
|
+
const engage = await import("./te-engage-2VFM37ZM.js");
|
|
234
234
|
commands.push(...engage.default);
|
|
235
235
|
} catch {
|
|
236
236
|
}
|
|
237
237
|
try {
|
|
238
|
-
const community = await import("./te-community-
|
|
238
|
+
const community = await import("./te-community-3XEJNSQL.js");
|
|
239
239
|
commands.push(...community.default);
|
|
240
240
|
} catch {
|
|
241
241
|
}
|
|
242
242
|
try {
|
|
243
|
-
const dataops = await import("./te-dataops-
|
|
243
|
+
const dataops = await import("./te-dataops-H4WSMCG5.js");
|
|
244
244
|
commands.push(...dataops.default);
|
|
245
245
|
} catch {
|
|
246
246
|
}
|
|
247
|
+
try {
|
|
248
|
+
const teKb = await import("./te-kb-EHHYPYBN.js");
|
|
249
|
+
commands.push(...teKb.default);
|
|
250
|
+
} catch {
|
|
251
|
+
}
|
|
247
252
|
return commands;
|
|
248
253
|
}
|
|
249
254
|
async function registerAuthCommands() {
|
|
250
255
|
try {
|
|
251
|
-
const { registerAuth } = await import("./auth-
|
|
256
|
+
const { registerAuth } = await import("./auth-ZPA6O5KO.js");
|
|
252
257
|
registerAuth(program);
|
|
253
258
|
} catch {
|
|
254
259
|
}
|
|
255
260
|
}
|
|
256
261
|
async function registerConfigCommands() {
|
|
257
262
|
try {
|
|
258
|
-
const { registerConfig } = await import("./config-
|
|
263
|
+
const { registerConfig } = await import("./config-QZIEYXQZ.js");
|
|
259
264
|
registerConfig(program);
|
|
260
265
|
} catch {
|
|
261
266
|
}
|
|
262
267
|
}
|
|
263
268
|
async function registerApiCommand() {
|
|
264
269
|
try {
|
|
265
|
-
const { registerApi } = await import("./raw-
|
|
270
|
+
const { registerApi } = await import("./raw-6ZPW3YII.js");
|
|
266
271
|
registerApi(program);
|
|
267
272
|
} catch {
|
|
268
273
|
}
|
|
@@ -5,13 +5,13 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
httpGet,
|
|
7
7
|
httpPost
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-7G2F7IVO.js";
|
|
9
9
|
import {
|
|
10
10
|
resolveHost
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-OVMQFFC2.js";
|
|
12
12
|
import {
|
|
13
13
|
safeJsonParse
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-TMMUBSKW.js";
|
|
15
15
|
|
|
16
16
|
// src/api/raw.ts
|
|
17
17
|
function registerApi(program) {
|
|
@@ -2,9 +2,9 @@ import {
|
|
|
2
2
|
callMcpTool,
|
|
3
3
|
parseMcpResult,
|
|
4
4
|
resolveMcpUrl
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-5CCFSPAF.js";
|
|
6
|
+
import "./chunk-OVMQFFC2.js";
|
|
7
|
+
import "./chunk-TMMUBSKW.js";
|
|
8
8
|
|
|
9
9
|
// src/commands/te-analysis/shared.ts
|
|
10
10
|
function createMcpCommand(config) {
|
|
@@ -476,16 +476,16 @@ var dashboard_default = commands3;
|
|
|
476
476
|
// src/commands/te-analysis/model/query-adhoc.ts
|
|
477
477
|
var queryAdhoc = createMcpCommand({
|
|
478
478
|
command: "+query_adhoc",
|
|
479
|
-
description: "Run ad hoc analysis
|
|
479
|
+
description: "Run ad hoc analysis with an already-built qp. For event, retention, funnel, and prop_analysis, call the matching +build_*_analysis_qp command first and pass its qp; do not handcraft qp or call get_analysis_query_schema/list_events/list_properties/list_metrics/get_metric before the builder. For distribution, attribution, heat_map, interval, path, rank_list, and sql, use the legacy schema/metadata path. Supports fields/limit/offset pagination.",
|
|
480
480
|
flags: [
|
|
481
481
|
{ name: "project_id", type: "number", required: true, desc: "Project ID", alias: "p" },
|
|
482
482
|
{ name: "model_type", type: "string", required: true, desc: "Model type. Supported values: event, retention, funnel, distribution, attribution, heat_map, interval, path, rank_list, prop_analysis, sql." },
|
|
483
|
-
{ name: "qp", type: "json", required: true, desc: "Query parameter JSON.
|
|
483
|
+
{ name: "qp", type: "json", required: true, desc: "Query parameter JSON. For event/retention/funnel/prop_analysis, pass qp returned by the matching +build_*_analysis_qp command. Use +get_analysis_query_schema only for non-builder/manual model types." },
|
|
484
484
|
{ name: "request_id", type: "string", required: false, desc: "Optional unique request ID used for tracking and deduplication. Generated automatically if omitted." },
|
|
485
485
|
{ name: "use_cache", type: "boolean", required: false, desc: "Whether to use result cache. Default: true" },
|
|
486
486
|
{ name: "zone_offset", type: "number", required: false, desc: "Time zone offset in hours. For example, UTC+8 is 8 and UTC-5 is -5" },
|
|
487
487
|
{ name: "is_sort_by_columns", type: "boolean", required: false, desc: "Whether to sort query results by columns. Default: false" },
|
|
488
|
-
{ name: "resolve_recent_day", type: "boolean", required: false, desc: "Whether to resolve relative time expressions such as last 7 days.
|
|
488
|
+
{ name: "resolve_recent_day", type: "boolean", required: false, desc: "Whether to resolve relative time expressions such as last 7 days. If omitted, the service auto-resolves when qp.eventView.recentDay exists and start/end time is incomplete; otherwise it defaults to false." },
|
|
489
489
|
{ name: "fields", type: "json", required: false, desc: "Optional fields to return. Must match column names in result." },
|
|
490
490
|
{ name: "limit", type: "number", required: false, desc: "Optional limit. Default: 20, maximum: 50." },
|
|
491
491
|
{ name: "offset", type: "number", required: false, desc: "Optional offset. Default: 0." },
|
|
@@ -508,6 +508,88 @@ var queryAdhoc = createMcpCommand({
|
|
|
508
508
|
})
|
|
509
509
|
});
|
|
510
510
|
|
|
511
|
+
// src/commands/te-analysis/model/build-event-analysis-qp.ts
|
|
512
|
+
var buildEventAnalysisQp = createMcpCommand({
|
|
513
|
+
command: "+build_event_analysis_qp",
|
|
514
|
+
description: "Build a validated event-analysis QP from structured intent. Call before query_adhoc for event ad-hoc analysis. Do not call get_analysis_query_schema/list_events/list_properties/list_metrics/get_metric first; the builder resolves events, properties, and saved metric names internally. For a saved metric, pass its name in metrics[].event. This command only builds qp and does not execute query_adhoc.",
|
|
515
|
+
flags: [
|
|
516
|
+
{ name: "project_id", type: "number", required: true, desc: "Project ID", alias: "p" },
|
|
517
|
+
{ name: "time_range", type: "json", required: true, desc: "Required time range JSON for event analysis." },
|
|
518
|
+
{ name: "metrics", type: "json", required: true, desc: "Required event metrics JSON array." },
|
|
519
|
+
{ name: "time_particle_size", type: "string", required: false, desc: "Optional time granularity. Default: total." },
|
|
520
|
+
{ name: "groups", type: "json", required: false, desc: "Optional group-by dimensions JSON array." },
|
|
521
|
+
{ name: "filters", type: "json", required: false, desc: "Optional global filters JSON array." },
|
|
522
|
+
{ name: "relation", type: "string", required: false, desc: "Optional filter relation. Supported values: and, or. Default: and." }
|
|
523
|
+
],
|
|
524
|
+
risk: "read",
|
|
525
|
+
buildArgs: (ctx) => ({
|
|
526
|
+
projectId: ctx.num("project_id"),
|
|
527
|
+
timeRange: ctx.json("time_range"),
|
|
528
|
+
metrics: ctx.json("metrics"),
|
|
529
|
+
timeParticleSize: ctx.str("time_particle_size") || void 0,
|
|
530
|
+
groups: optionalJson(ctx, "groups"),
|
|
531
|
+
filters: optionalJson(ctx, "filters"),
|
|
532
|
+
relation: ctx.str("relation") || void 0
|
|
533
|
+
})
|
|
534
|
+
});
|
|
535
|
+
|
|
536
|
+
// src/commands/te-analysis/model/build-retention-analysis-qp.ts
|
|
537
|
+
var buildRetentionAnalysisQp = createMcpCommand({
|
|
538
|
+
command: "+build_retention_analysis_qp",
|
|
539
|
+
description: "Build a validated retention-analysis QP from structured intent. Call before query_adhoc for retention ad-hoc analysis. Do not call get_analysis_query_schema/list_events/list_properties/list_metrics/get_metric first; the builder resolves events and properties internally. This command only builds qp and does not execute query_adhoc.",
|
|
540
|
+
flags: [
|
|
541
|
+
{ name: "project_id", type: "number", required: true, desc: "Project ID", alias: "p" },
|
|
542
|
+
{ name: "time_range", type: "json", required: true, desc: "Required time range JSON for retention analysis." },
|
|
543
|
+
{ name: "retention", type: "json", required: true, desc: "Required retention intent JSON." },
|
|
544
|
+
{ name: "relation", type: "string", required: false, desc: "Optional top-level retention filter relation. Supported values: and, or. Default: and." },
|
|
545
|
+
{ name: "time_particle_size", type: "string", required: false, desc: "Optional time granularity. Supported values: day, week, month." }
|
|
546
|
+
],
|
|
547
|
+
risk: "read",
|
|
548
|
+
buildArgs: (ctx) => ({
|
|
549
|
+
projectId: ctx.num("project_id"),
|
|
550
|
+
timeRange: ctx.json("time_range"),
|
|
551
|
+
retention: ctx.json("retention"),
|
|
552
|
+
relation: ctx.str("relation") || void 0,
|
|
553
|
+
timeParticleSize: ctx.str("time_particle_size") || void 0
|
|
554
|
+
})
|
|
555
|
+
});
|
|
556
|
+
|
|
557
|
+
// src/commands/te-analysis/model/build-funnel-analysis-qp.ts
|
|
558
|
+
var buildFunnelAnalysisQp = createMcpCommand({
|
|
559
|
+
command: "+build_funnel_analysis_qp",
|
|
560
|
+
description: "Build a validated funnel-analysis QP from structured intent. Call before query_adhoc for funnel ad-hoc analysis. Do not call get_analysis_query_schema/list_events/list_properties/list_metrics/get_metric first; the builder resolves events and properties internally. This command only builds qp and does not execute query_adhoc.",
|
|
561
|
+
flags: [
|
|
562
|
+
{ name: "project_id", type: "number", required: true, desc: "Project ID", alias: "p" },
|
|
563
|
+
{ name: "time_range", type: "json", required: true, desc: "Required time range JSON for funnel analysis." },
|
|
564
|
+
{ name: "funnel", type: "json", required: true, desc: "Required funnel intent JSON." },
|
|
565
|
+
{ name: "relation", type: "string", required: false, desc: "Optional top-level funnel filter relation. Supported values: and, or. Default: and." },
|
|
566
|
+
{ name: "time_particle_size", type: "string", required: false, desc: "Optional time granularity. Supported values: day, week, month." }
|
|
567
|
+
],
|
|
568
|
+
risk: "read",
|
|
569
|
+
buildArgs: (ctx) => ({
|
|
570
|
+
projectId: ctx.num("project_id"),
|
|
571
|
+
timeRange: ctx.json("time_range"),
|
|
572
|
+
funnel: ctx.json("funnel"),
|
|
573
|
+
relation: ctx.str("relation") || void 0,
|
|
574
|
+
timeParticleSize: ctx.str("time_particle_size") || void 0
|
|
575
|
+
})
|
|
576
|
+
});
|
|
577
|
+
|
|
578
|
+
// src/commands/te-analysis/model/build-prop-analysis-qp.ts
|
|
579
|
+
var buildPropAnalysisQp = createMcpCommand({
|
|
580
|
+
command: "+build_prop_analysis_qp",
|
|
581
|
+
description: "Build a validated prop-analysis QP from structured intent. Call before query_adhoc for prop_analysis ad-hoc analysis. Do not call get_analysis_query_schema/list_properties/list_metrics/get_metric first; the builder resolves user properties internally. This command only builds qp and does not execute query_adhoc.",
|
|
582
|
+
flags: [
|
|
583
|
+
{ name: "project_id", type: "number", required: true, desc: "Project ID", alias: "p" },
|
|
584
|
+
{ name: "prop_analysis", type: "json", required: true, desc: "Required user property analysis intent JSON." }
|
|
585
|
+
],
|
|
586
|
+
risk: "read",
|
|
587
|
+
buildArgs: (ctx) => ({
|
|
588
|
+
projectId: ctx.num("project_id"),
|
|
589
|
+
propAnalysis: ctx.json("prop_analysis")
|
|
590
|
+
})
|
|
591
|
+
});
|
|
592
|
+
|
|
511
593
|
// src/commands/te-analysis/model/drilldown-users.ts
|
|
512
594
|
var drilldownUsers = createMcpCommand({
|
|
513
595
|
command: "+drilldown_users",
|
|
@@ -709,6 +791,10 @@ var getTableColumns = createMcpCommand({
|
|
|
709
791
|
|
|
710
792
|
// src/commands/te-analysis/model/index.ts
|
|
711
793
|
var commands4 = [
|
|
794
|
+
buildEventAnalysisQp,
|
|
795
|
+
buildRetentionAnalysisQp,
|
|
796
|
+
buildFunnelAnalysisQp,
|
|
797
|
+
buildPropAnalysisQp,
|
|
712
798
|
queryAdhoc,
|
|
713
799
|
drilldownUsers,
|
|
714
800
|
drilldownUserEvents,
|
|
@@ -854,7 +940,7 @@ var entity_default = commands5;
|
|
|
854
940
|
// src/commands/te-analysis/schema/get-analysis-query-schema.ts
|
|
855
941
|
var getAnalysisQuerySchema = createMcpCommand({
|
|
856
942
|
command: "+get_analysis_query_schema",
|
|
857
|
-
description: "Get the analysis query schema for
|
|
943
|
+
description: "Get the analysis query schema for non-builder/manual model paths. Do not use this tool for natural-language event, retention, funnel, or prop_analysis ad-hoc analysis; use the matching +build_*_analysis_qp command then +query_adhoc. Returns field definitions and usage examples for low-level/manual QP construction.",
|
|
858
944
|
flags: [
|
|
859
945
|
{ name: "model_type", type: "string", required: true, desc: "Model type. Supported values: event, retention, funnel, distribution, sql, interval, path, attribution, prop_analysis, rank_list, heat_map" },
|
|
860
946
|
{ name: "segments", type: "string", required: false, desc: "Schema segments to include (comma-separated). Options: core, filter_group, calctype, aggregatetype, examples, full. Empty/null \u2192 core only (recommended)." },
|
|
@@ -2,9 +2,9 @@ import {
|
|
|
2
2
|
callMcpTool,
|
|
3
3
|
parseMcpResult,
|
|
4
4
|
resolveMcpUrl
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-5CCFSPAF.js";
|
|
6
|
+
import "./chunk-OVMQFFC2.js";
|
|
7
|
+
import "./chunk-TMMUBSKW.js";
|
|
8
8
|
|
|
9
9
|
// src/commands/te-audience/shared.ts
|
|
10
10
|
function createMcpCommand(config) {
|
|
@@ -2,9 +2,9 @@ import {
|
|
|
2
2
|
callMcpTool,
|
|
3
3
|
parseMcpResult,
|
|
4
4
|
resolveMcpUrl
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-5CCFSPAF.js";
|
|
6
|
+
import "./chunk-OVMQFFC2.js";
|
|
7
|
+
import "./chunk-TMMUBSKW.js";
|
|
8
8
|
|
|
9
9
|
// src/commands/te-common/shared.ts
|
|
10
10
|
function createMcpCommand(config) {
|
|
@@ -3,9 +3,9 @@ import {
|
|
|
3
3
|
parseMcpResult,
|
|
4
4
|
registerMcpMappings,
|
|
5
5
|
resolveMcpUrl
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-5CCFSPAF.js";
|
|
7
|
+
import "./chunk-OVMQFFC2.js";
|
|
8
|
+
import "./chunk-TMMUBSKW.js";
|
|
9
9
|
|
|
10
10
|
// src/commands/te-community/get_channel_info.ts
|
|
11
11
|
var getChannelInfo = {
|
|
@@ -3,9 +3,9 @@ import {
|
|
|
3
3
|
parseMcpResult,
|
|
4
4
|
registerMcpMappings,
|
|
5
5
|
resolveMcpUrl
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-5CCFSPAF.js";
|
|
7
|
+
import "./chunk-OVMQFFC2.js";
|
|
8
|
+
import "./chunk-TMMUBSKW.js";
|
|
9
9
|
|
|
10
10
|
// src/commands/te-dataops/datatable/list-tables-by-page.ts
|
|
11
11
|
var listTablesByPage = {
|
|
@@ -3,9 +3,9 @@ import {
|
|
|
3
3
|
parseMcpResult,
|
|
4
4
|
registerMcpMappings,
|
|
5
5
|
resolveMcpUrl
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-5CCFSPAF.js";
|
|
7
|
+
import "./chunk-OVMQFFC2.js";
|
|
8
|
+
import "./chunk-TMMUBSKW.js";
|
|
9
9
|
|
|
10
10
|
// src/commands/te-engage/utils.ts
|
|
11
11
|
function buildMcpDryRun(ctx, serviceName44, toolName44, args) {
|