@thinkingai/ae-cli 6.1.12 → 6.1.14
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 +0 -2
- package/README.zh.md +0 -2
- package/dist/{auth-NN55553T.js → auth-GBMV6TEJ.js} +2 -2
- package/dist/{auth-GDV3H5I4.js → auth-NDSXE54J.js} +4 -4
- package/dist/{capability-DRLGDVS4.js → capability-TAMDRZYV.js} +18 -8
- package/dist/{capability-P6GK3AQH.js → capability-U7TDEEEG.js} +18 -8
- package/dist/{chunk-GJJA4CQZ.js → chunk-3FY3RJ26.js} +0 -4
- package/dist/{chunk-GS2P7LFD.js → chunk-5XUSIK27.js} +2 -2
- package/dist/{chunk-7KQWSBSL.js → chunk-753BUTNZ.js} +3 -3
- package/dist/{chunk-VTXHDCBW.js → chunk-AFXA7BRK.js} +2 -2
- package/dist/chunk-IBH3LDAH.js +556 -0
- package/dist/{chunk-RBNKI5ZW.js → chunk-JUW4AJXN.js} +2 -2
- package/dist/{chunk-TS6BUGUY.js → chunk-QATA32VR.js} +3 -3
- package/dist/{chunk-Z3OXWCIA.js → chunk-S5NTSDBS.js} +2 -2
- package/dist/chunk-UIHQJK5E.js +556 -0
- package/dist/{chunk-VKD5WQKN.js → chunk-VLWOLBGZ.js} +142 -24
- package/dist/{chunk-YTG6Q75E.js → chunk-WZRX4KOH.js} +25 -3
- package/dist/{chunk-YV52FB5G.js → chunk-ZQKDZXDO.js} +1 -1
- package/dist/{cli-token-GL5MS5FK.js → cli-token-4UPER74P.js} +3 -3
- package/dist/{chunk-6A2FUCIS.js → client-L2YDMHQ6.js} +5 -6
- package/dist/{config-4VZNLBKF.js → config-OL2LWGBV.js} +4 -33
- package/dist/index.js +25 -38
- package/dist/{memory-RWJW4XFO.js → memory-MUP7PPL7.js} +4 -4
- package/dist/{memory-VO2ZJCRT.js → memory-U4O5PMXH.js} +4 -4
- package/dist/{metadata-ZRN2GHPN.js → metadata-5MIMNIMT.js} +33 -20
- package/dist/{metadata-YGTHR2XJ.js → metadata-LERKDJN6.js} +33 -20
- package/dist/{model-CLUIK3K5.js → model-JTUEO5M4.js} +2 -2
- package/dist/{sync-3REDHGY6.js → sync-MOSFNBVR.js} +5 -5
- package/dist/{te-agent-XNPELAKX.js → te-agent-IFKZDHZI.js} +25 -18
- package/dist/{te-analysis-GJI5FZUL.js → te-analysis-FCHRTNIY.js} +1267 -492
- package/dist/{te-analysis-N2BRDJZ5.js → te-analysis-QG7UKGDA.js} +1267 -492
- package/dist/{te-community-SQXKE5OO.js → te-community-HNKVTERD.js} +207 -12
- package/dist/{te-community-TYSNU3NQ.js → te-community-IWE5B7W6.js} +208 -12
- package/dist/{te-dataops-OWIADNSM.js → te-dataops-KQPYNAE3.js} +262 -145
- package/dist/{te-dataops-5TM7WZDI.js → te-dataops-KXCEB4CS.js} +262 -145
- package/dist/{te-engage-L72HWRGO.js → te-engage-D6EG3NOR.js} +951 -17
- package/dist/{te-engage-QWM4GFS7.js → te-engage-ZSMIJLUW.js} +951 -17
- package/dist/{te-experiment-2T2HEZML.js → te-experiment-K5US7RMG.js} +6 -6
- package/dist/{te-experiment-PVEY7AEZ.js → te-experiment-WA7TFMEL.js} +6 -6
- package/dist/{te-kb-VRMEY3D4.js → te-kb-OIH3T6CS.js} +4 -4
- package/dist/{te-system-XGS5EQIQ.js → te-system-AZ3URMUO.js} +515 -11
- package/dist/{te-team-BZRDV2CM.js → te-team-GZPU6UWA.js} +5 -5
- package/dist/{update-HEDXGOJH.js → update-TOBFXF2V.js} +4 -4
- package/package.json +5 -5
- package/skills/ae-agent/SKILL.md +3 -3
- package/skills/ae-agent/references/list-skill-references.md +4 -4
- package/skills/ae-agent/references/read-skill-reference.md +10 -7
- package/skills/ae-agent/references/upload-skill-reference.md +11 -9
- package/skills/ae-analysis/SKILL.md +15 -12
- package/skills/ae-analysis/metadata_resolution.md +150 -0
- package/skills/ae-analysis/references/adhoc_export.md +17 -2
- package/skills/ae-analysis/references/adhoc_run.md +12 -8
- package/skills/ae-analysis/references/ai_models.md +35 -6
- package/skills/ae-analysis/references/alert_list.md +2 -3
- package/skills/ae-analysis/references/analysis_data_retrieval.md +104 -16
- package/skills/ae-analysis/references/analysis_drilldown_contract.md +4 -4
- package/skills/ae-analysis/references/analysis_gateway_assets.md +17 -15
- package/skills/ae-analysis/references/artifact_download.md +4 -3
- package/skills/ae-analysis/references/asset_abnormal_list.md +5 -3
- package/skills/ae-analysis/references/asset_authentication_list.md +5 -3
- package/skills/ae-analysis/references/asset_search.md +5 -3
- package/skills/ae-analysis/references/bi_panel_list.md +2 -2
- package/skills/ae-analysis/references/bi_panel_page_data_export.md +1 -1
- package/skills/ae-analysis/references/bi_panel_page_data_run.md +4 -4
- package/skills/ae-analysis/references/catalog_export.md +28 -0
- package/skills/ae-analysis/references/catalog_list.md +44 -0
- package/skills/ae-analysis/references/command_index.md +78 -69
- package/skills/ae-analysis/references/dashboard_list.md +2 -2
- package/skills/ae-analysis/references/dashboard_report_data_run.md +11 -4
- package/skills/ae-analysis/references/datatable_version_list.md +5 -3
- package/skills/ae-analysis/references/drilldown_entities_run.md +4 -4
- package/skills/ae-analysis/references/drilldown_events_run.md +2 -2
- package/skills/ae-analysis/references/drilldown_user_events_export.md +1 -1
- package/skills/ae-analysis/references/drilldown_user_events_run.md +2 -2
- package/skills/ae-analysis/references/entity_detail_run.md +4 -4
- package/skills/ae-analysis/references/entity_id_import_options.md +1 -1
- package/skills/ae-analysis/references/event_detail_run.md +4 -4
- package/skills/ae-analysis/references/event_export.md +21 -0
- package/skills/ae-analysis/references/event_list.md +7 -6
- package/skills/ae-analysis/references/exchange_rule_list.md +5 -3
- package/skills/ae-analysis/references/favorite_add.md +2 -2
- package/skills/ae-analysis/references/favorite_remove.md +2 -2
- package/skills/ae-analysis/references/history_tag_data_drilldown_export.md +4 -2
- package/skills/ae-analysis/references/history_tag_data_drilldown_run.md +2 -2
- package/skills/ae-analysis/references/history_tag_data_run.md +2 -2
- package/skills/ae-analysis/references/metric_create.md +7 -8
- package/skills/ae-analysis/references/metric_export.md +21 -0
- package/skills/ae-analysis/references/metric_list.md +8 -7
- package/skills/ae-analysis/references/project_space_list.md +2 -2
- package/skills/ae-analysis/references/property_export.md +21 -0
- package/skills/ae-analysis/references/property_list.md +9 -8
- package/skills/ae-analysis/references/public_link_list.md +2 -2
- package/skills/ae-analysis/references/query_context_get.md +20 -0
- package/skills/ae-analysis/references/query_create_result_cluster.md +1 -1
- package/skills/ae-analysis/references/report_change_log_list.md +1 -1
- package/skills/ae-analysis/references/report_create.md +3 -3
- package/skills/ae-analysis/references/report_data_run.md +8 -8
- package/skills/ae-analysis/references/report_list.md +3 -3
- package/skills/ae-analysis/references/report_list_export.md +2 -2
- package/skills/ae-analysis/references/report_update.md +3 -3
- package/skills/ae-analysis/references/report_version_rollback.md +1 -1
- package/skills/ae-analysis/references/rule_list.md +6 -4
- package/skills/ae-analysis/references/run_inspect.md +8 -5
- package/skills/ae-analysis/references/run_wait.md +37 -0
- package/skills/ae-analysis/references/sql_table_list.md +3 -2
- package/skills/ae-analysis/references/user_cluster_export.md +13 -0
- package/skills/ae-analysis/references/user_cluster_list.md +6 -2
- package/skills/ae-analysis/references/user_cluster_member_export.md +5 -3
- package/skills/ae-analysis/references/user_cluster_member_list.md +4 -4
- package/skills/ae-analysis/references/user_cluster_update.md +4 -2
- package/skills/ae-analysis/references/user_tag_export.md +13 -0
- package/skills/ae-analysis/references/user_tag_list.md +6 -2
- package/skills/ae-analysis/references/user_tag_member_export.md +5 -3
- package/skills/ae-analysis/references/user_tag_member_list.md +4 -4
- package/skills/ae-analysis/references/user_tag_update.md +4 -2
- package/skills/ae-analysis/references/virtual_property_create.md +2 -2
- package/skills/ae-analysis/references/virtual_property_sql_rule_update.md +3 -3
- package/skills/ae-community/SKILL.md +2 -2
- package/skills/ae-dataops/SKILL.md +4 -3
- package/skills/ae-dataops/references/dataops-flow-create.md +47 -3
- package/skills/ae-engage/SKILL.md +55 -7
- package/skills/ae-engage/references/build-task-save-guide.md +12 -0
- package/skills/ae-engage/references/cancel-query-run.md +31 -0
- package/skills/ae-engage/references/config-item-analysis-report.md +14 -1
- package/skills/ae-engage/references/config-item-strategy-comparison.md +11 -1
- package/skills/ae-engage/references/config-item-trigger-report.md +15 -1
- package/skills/ae-engage/references/flow-metric-detail-report.md +134 -0
- package/skills/ae-engage/references/flow-metric-update.md +77 -0
- package/skills/ae-engage/references/flow-metric-user.md +119 -0
- package/skills/ae-engage/references/flow-node-metric-user.md +123 -0
- package/skills/ae-engage/references/flow-node-user.md +123 -0
- package/skills/ae-engage/references/push-record-query.md +32 -1
- package/skills/ae-engage/references/save-task.md +9 -0
- package/skills/ae-engage/references/task-data-detail.md +9 -2
- package/skills/ae-engage/references/task-indicator-user.md +104 -0
- package/skills/ae-engage/references/task-metric-detail.md +9 -2
- package/skills/ae-engage/references/task-submit-approval.md +3 -0
- package/skills/ae-engage/references/task-user-detail-export.md +31 -0
- package/skills/ae-experiment/references/save_experiment.md +4 -0
- package/skills/ae-experiment-design/SKILL.md +1 -1
- package/skills/ae-experiment-design/references/platform-operations.md +1 -1
- package/skills/ae-experiment-insight/references/platform-operations.md +1 -1
- package/skills/ae-metadata/SKILL.md +2 -1
- package/skills/ae-metadata/references/metadata_data_table_download.md +10 -2
- package/skills/ae-metadata/references/metadata_data_table_list.md +5 -2
- package/skills/ae-metadata/references/metadata_property_dimension_table_bind_existing.md +1 -1
- package/skills/ae-system/SKILL.md +66 -3
- package/dist/chunk-DT6Y3TD7.js +0 -232
- package/dist/chunk-MVDZ7DBQ.js +0 -231
- package/dist/chunk-NBPKWKRA.js +0 -51
- package/dist/client-DAIPF7XN.js +0 -23
- package/dist/raw-52B4UKO4.js +0 -71
- package/dist/te-meta-53BVXPFI.js +0 -95
- package/dist/te-meta-TOCBPBXI.js +0 -95
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getActiveHost,
|
|
3
3
|
getSandboxRuntimeRoot
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-3FY3RJ26.js";
|
|
5
5
|
|
|
6
6
|
// src/core/te-agent-credentials.ts
|
|
7
7
|
import { readFileSync } from "fs";
|
|
@@ -94,6 +94,10 @@ function getClaudeConfigDir() {
|
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
// src/core/te-agent-client.ts
|
|
97
|
+
import { open, unlink } from "fs/promises";
|
|
98
|
+
import path from "path";
|
|
99
|
+
import { Readable } from "stream";
|
|
100
|
+
import { pipeline } from "stream/promises";
|
|
97
101
|
var TeAgentApiError = class extends Error {
|
|
98
102
|
constructor(message, status, code, body) {
|
|
99
103
|
super(message);
|
|
@@ -108,6 +112,7 @@ var TeAgentApiError = class extends Error {
|
|
|
108
112
|
};
|
|
109
113
|
var DEFAULT_TIMEOUT_MS = 3e4;
|
|
110
114
|
var UPLOAD_TIMEOUT_MS = 12e4;
|
|
115
|
+
var DOWNLOAD_TIMEOUT_MS = 12e4;
|
|
111
116
|
async function fetchWithTimeout(url, init, timeoutMs = DEFAULT_TIMEOUT_MS) {
|
|
112
117
|
const controller = new AbortController();
|
|
113
118
|
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
@@ -131,7 +136,7 @@ function teClaudeBaseFromActiveHost(hostOverride) {
|
|
|
131
136
|
const bp = process.env.TE_CLAUDE_BASE_PATH || "/agent";
|
|
132
137
|
return base.endsWith(bp) ? base : base + bp;
|
|
133
138
|
}
|
|
134
|
-
async function signRequest(method,
|
|
139
|
+
async function signRequest(method, path2, rawBody, hostOverride) {
|
|
135
140
|
const sandboxCred = tryLoadTeAgentSandboxCredentials();
|
|
136
141
|
if (!hostOverride && sandboxCred && sandboxCred.sandboxId && sandboxCred.sandboxSecretKey) {
|
|
137
142
|
const headers = {
|
|
@@ -142,13 +147,13 @@ async function signRequest(method, path, rawBody, hostOverride) {
|
|
|
142
147
|
headers["Content-Type"] = "application/json";
|
|
143
148
|
}
|
|
144
149
|
return {
|
|
145
|
-
url: `${sandboxCred.url.replace(/\/$/, "")}${
|
|
150
|
+
url: `${sandboxCred.url.replace(/\/$/, "")}${path2}`,
|
|
146
151
|
headers,
|
|
147
152
|
rawBody
|
|
148
153
|
};
|
|
149
154
|
}
|
|
150
|
-
const { getToken } = await import("./auth-
|
|
151
|
-
const { getCliToken } = await import("./cli-token-
|
|
155
|
+
const { getToken } = await import("./auth-GBMV6TEJ.js");
|
|
156
|
+
const { getCliToken } = await import("./cli-token-4UPER74P.js");
|
|
152
157
|
const baseUrl = hostOverride ? teClaudeBaseFromActiveHost(hostOverride) : sandboxCred?.url || teClaudeBaseFromActiveHost();
|
|
153
158
|
if (!baseUrl) {
|
|
154
159
|
throw new TeAgentCredentialsError(
|
|
@@ -166,7 +171,7 @@ async function signRequest(method, path, rawBody, hostOverride) {
|
|
|
166
171
|
}
|
|
167
172
|
if (accessToken) {
|
|
168
173
|
return {
|
|
169
|
-
url: `${baseUrl.replace(/\/$/, "")}${
|
|
174
|
+
url: `${baseUrl.replace(/\/$/, "")}${path2}`,
|
|
170
175
|
headers: {
|
|
171
176
|
"Authorization": `bearer ${accessToken}`,
|
|
172
177
|
...contentTypeHeader
|
|
@@ -182,7 +187,7 @@ async function signRequest(method, path, rawBody, hostOverride) {
|
|
|
182
187
|
}
|
|
183
188
|
if (cliToken) {
|
|
184
189
|
return {
|
|
185
|
-
url: `${baseUrl.replace(/\/$/, "")}${
|
|
190
|
+
url: `${baseUrl.replace(/\/$/, "")}${path2}`,
|
|
186
191
|
headers: {
|
|
187
192
|
"cli-token": cliToken,
|
|
188
193
|
...contentTypeHeader
|
|
@@ -220,9 +225,9 @@ async function parseResponse(response, defaultErrorPrefix) {
|
|
|
220
225
|
}
|
|
221
226
|
return parsed;
|
|
222
227
|
}
|
|
223
|
-
async function postToMainApp(
|
|
228
|
+
async function postToMainApp(path2, body, hostOverride) {
|
|
224
229
|
const rawBody = JSON.stringify(body);
|
|
225
|
-
const signed = await signRequest("POST",
|
|
230
|
+
const signed = await signRequest("POST", path2, rawBody, hostOverride);
|
|
226
231
|
const response = await fetchWithTimeout(signed.url, {
|
|
227
232
|
method: "POST",
|
|
228
233
|
headers: signed.headers,
|
|
@@ -230,8 +235,8 @@ async function postToMainApp(path, body, hostOverride) {
|
|
|
230
235
|
});
|
|
231
236
|
return parseResponse(response, "Main app returned");
|
|
232
237
|
}
|
|
233
|
-
async function getFromMainApp(
|
|
234
|
-
const signed = await signRequest("GET",
|
|
238
|
+
async function getFromMainApp(path2, hostOverride) {
|
|
239
|
+
const signed = await signRequest("GET", path2, "", hostOverride);
|
|
235
240
|
const response = await fetchWithTimeout(signed.url, {
|
|
236
241
|
method: "GET",
|
|
237
242
|
headers: signed.headers
|
|
@@ -264,17 +269,17 @@ async function postSandboxSyncPull(args) {
|
|
|
264
269
|
mode: "merge"
|
|
265
270
|
});
|
|
266
271
|
}
|
|
267
|
-
async function deleteFromMainApp(
|
|
268
|
-
const signed = await signRequest("DELETE",
|
|
272
|
+
async function deleteFromMainApp(path2, hostOverride) {
|
|
273
|
+
const signed = await signRequest("DELETE", path2, "", hostOverride);
|
|
269
274
|
const response = await fetchWithTimeout(signed.url, {
|
|
270
275
|
method: "DELETE",
|
|
271
276
|
headers: signed.headers
|
|
272
277
|
});
|
|
273
278
|
return parseResponse(response, "Main app returned");
|
|
274
279
|
}
|
|
275
|
-
async function patchToMainApp(
|
|
280
|
+
async function patchToMainApp(path2, body, hostOverride) {
|
|
276
281
|
const rawBody = JSON.stringify(body);
|
|
277
|
-
const signed = await signRequest("PATCH",
|
|
282
|
+
const signed = await signRequest("PATCH", path2, rawBody, hostOverride);
|
|
278
283
|
const response = await fetchWithTimeout(signed.url, {
|
|
279
284
|
method: "PATCH",
|
|
280
285
|
headers: signed.headers,
|
|
@@ -282,9 +287,9 @@ async function patchToMainApp(path, body, hostOverride) {
|
|
|
282
287
|
});
|
|
283
288
|
return parseResponse(response, "Main app returned");
|
|
284
289
|
}
|
|
285
|
-
async function putToMainApp(
|
|
290
|
+
async function putToMainApp(path2, body, hostOverride) {
|
|
286
291
|
const rawBody = JSON.stringify(body);
|
|
287
|
-
const signed = await signRequest("PUT",
|
|
292
|
+
const signed = await signRequest("PUT", path2, rawBody, hostOverride);
|
|
288
293
|
const response = await fetchWithTimeout(signed.url, {
|
|
289
294
|
method: "PUT",
|
|
290
295
|
headers: signed.headers,
|
|
@@ -292,8 +297,8 @@ async function putToMainApp(path, body, hostOverride) {
|
|
|
292
297
|
});
|
|
293
298
|
return parseResponse(response, "Main app returned");
|
|
294
299
|
}
|
|
295
|
-
async function getBufferFromMainApp(
|
|
296
|
-
const signed = await signRequest("GET",
|
|
300
|
+
async function getBufferFromMainApp(path2, hostOverride) {
|
|
301
|
+
const signed = await signRequest("GET", path2, "", hostOverride);
|
|
297
302
|
const response = await fetchWithTimeout(signed.url, {
|
|
298
303
|
method: "GET",
|
|
299
304
|
headers: signed.headers
|
|
@@ -325,9 +330,121 @@ async function getBufferFromMainApp(path, hostOverride) {
|
|
|
325
330
|
const cd = response.headers.get("Content-Disposition") || "";
|
|
326
331
|
const match = cd.match(/filename\*=UTF-8''([^;]+)/);
|
|
327
332
|
const fileName = match ? decodeURIComponent(match[1]) : null;
|
|
328
|
-
|
|
333
|
+
const contentType = response.headers.get("Content-Type");
|
|
334
|
+
return { buffer, fileName, contentType };
|
|
329
335
|
}
|
|
330
|
-
|
|
336
|
+
function responseFileName(response) {
|
|
337
|
+
const disposition = response.headers.get("Content-Disposition") ?? "";
|
|
338
|
+
const encoded = disposition.match(/filename\*=UTF-8''([^;]+)/i)?.[1];
|
|
339
|
+
if (encoded) {
|
|
340
|
+
try {
|
|
341
|
+
return decodeURIComponent(encoded.trim());
|
|
342
|
+
} catch {
|
|
343
|
+
return encoded.trim();
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
return disposition.match(/filename="([^"]+)"/i)?.[1] ?? disposition.match(/filename=([^;]+)/i)?.[1]?.trim() ?? null;
|
|
347
|
+
}
|
|
348
|
+
async function* responseBodyChunks(body) {
|
|
349
|
+
const reader = body.getReader();
|
|
350
|
+
try {
|
|
351
|
+
while (true) {
|
|
352
|
+
const chunk = await reader.read();
|
|
353
|
+
if (chunk.done) return;
|
|
354
|
+
yield chunk.value;
|
|
355
|
+
}
|
|
356
|
+
} finally {
|
|
357
|
+
reader.releaseLock();
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
async function downloadFromMainApp(requestPath, outputPath, hostOverride) {
|
|
361
|
+
const absolutePath = path.resolve(outputPath);
|
|
362
|
+
let fileHandle;
|
|
363
|
+
let created = false;
|
|
364
|
+
const controller = new AbortController();
|
|
365
|
+
const timer = setTimeout(() => controller.abort(), DOWNLOAD_TIMEOUT_MS);
|
|
366
|
+
try {
|
|
367
|
+
try {
|
|
368
|
+
fileHandle = await open(absolutePath, "wx");
|
|
369
|
+
created = true;
|
|
370
|
+
} catch (error) {
|
|
371
|
+
if (error.code === "EEXIST") {
|
|
372
|
+
throw new TeAgentApiError(
|
|
373
|
+
`Output file already exists: ${absolutePath}`,
|
|
374
|
+
0,
|
|
375
|
+
"OUTPUT_EXISTS"
|
|
376
|
+
);
|
|
377
|
+
}
|
|
378
|
+
throw new TeAgentApiError(
|
|
379
|
+
`Unable to create output file: ${absolutePath}`,
|
|
380
|
+
0,
|
|
381
|
+
"OUTPUT_ERROR"
|
|
382
|
+
);
|
|
383
|
+
}
|
|
384
|
+
const signed = await signRequest("GET", requestPath, "", hostOverride);
|
|
385
|
+
let response;
|
|
386
|
+
try {
|
|
387
|
+
response = await fetch(signed.url, {
|
|
388
|
+
method: "GET",
|
|
389
|
+
headers: signed.headers,
|
|
390
|
+
signal: controller.signal
|
|
391
|
+
});
|
|
392
|
+
} catch (error) {
|
|
393
|
+
if (error?.name === "AbortError") {
|
|
394
|
+
throw new TeAgentApiError(
|
|
395
|
+
`Request timed out (${DOWNLOAD_TIMEOUT_MS}ms): ${signed.url}`,
|
|
396
|
+
0,
|
|
397
|
+
"TIMEOUT"
|
|
398
|
+
);
|
|
399
|
+
}
|
|
400
|
+
throw new TeAgentApiError(
|
|
401
|
+
`Network request failed: ${error instanceof Error ? error.message : String(error)}`,
|
|
402
|
+
0,
|
|
403
|
+
"NETWORK_ERROR"
|
|
404
|
+
);
|
|
405
|
+
}
|
|
406
|
+
if (!response.ok) {
|
|
407
|
+
await parseResponse(response, "Main app returned");
|
|
408
|
+
}
|
|
409
|
+
if (!response.body) {
|
|
410
|
+
throw new TeAgentApiError("Main app returned an empty download stream", 0, "EMPTY_BODY");
|
|
411
|
+
}
|
|
412
|
+
const output = fileHandle.createWriteStream();
|
|
413
|
+
try {
|
|
414
|
+
await pipeline(
|
|
415
|
+
Readable.from(responseBodyChunks(response.body)),
|
|
416
|
+
output
|
|
417
|
+
);
|
|
418
|
+
} catch (error) {
|
|
419
|
+
if (error?.name === "AbortError") {
|
|
420
|
+
throw new TeAgentApiError(
|
|
421
|
+
`Request timed out (${DOWNLOAD_TIMEOUT_MS}ms): ${signed.url}`,
|
|
422
|
+
0,
|
|
423
|
+
"TIMEOUT"
|
|
424
|
+
);
|
|
425
|
+
}
|
|
426
|
+
throw new TeAgentApiError(
|
|
427
|
+
`Download failed: ${error instanceof Error ? error.message : String(error)}`,
|
|
428
|
+
0,
|
|
429
|
+
"DOWNLOAD_ERROR"
|
|
430
|
+
);
|
|
431
|
+
}
|
|
432
|
+
return {
|
|
433
|
+
path: absolutePath,
|
|
434
|
+
bytes: output.bytesWritten,
|
|
435
|
+
fileName: responseFileName(response),
|
|
436
|
+
contentType: response.headers.get("Content-Type")
|
|
437
|
+
};
|
|
438
|
+
} catch (error) {
|
|
439
|
+
if (fileHandle) await fileHandle.close().catch(() => void 0);
|
|
440
|
+
if (created) await unlink(absolutePath).catch(() => void 0);
|
|
441
|
+
throw error;
|
|
442
|
+
} finally {
|
|
443
|
+
clearTimeout(timer);
|
|
444
|
+
controller.abort();
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
async function uploadToMainApp(path2, formData, hostOverride) {
|
|
331
448
|
const sandboxCred = tryLoadTeAgentSandboxCredentials();
|
|
332
449
|
let baseUrl;
|
|
333
450
|
let authHeaders;
|
|
@@ -338,8 +455,8 @@ async function uploadToMainApp(path, formData, hostOverride) {
|
|
|
338
455
|
"X-Sandbox-Secret-Key": sandboxCred.sandboxSecretKey
|
|
339
456
|
};
|
|
340
457
|
} else {
|
|
341
|
-
const { getToken } = await import("./auth-
|
|
342
|
-
const { getCliToken } = await import("./cli-token-
|
|
458
|
+
const { getToken } = await import("./auth-GBMV6TEJ.js");
|
|
459
|
+
const { getCliToken } = await import("./cli-token-4UPER74P.js");
|
|
343
460
|
baseUrl = (hostOverride ? teClaudeBaseFromActiveHost(hostOverride) : sandboxCred?.url || teClaudeBaseFromActiveHost())?.replace(/\/$/, "") || "";
|
|
344
461
|
if (!baseUrl) {
|
|
345
462
|
throw new TeAgentCredentialsError(
|
|
@@ -373,7 +490,7 @@ async function uploadToMainApp(path, formData, hostOverride) {
|
|
|
373
490
|
}
|
|
374
491
|
}
|
|
375
492
|
const response = await fetchWithTimeout(
|
|
376
|
-
`${baseUrl}${
|
|
493
|
+
`${baseUrl}${path2}`,
|
|
377
494
|
{
|
|
378
495
|
method: "POST",
|
|
379
496
|
headers: authHeaders,
|
|
@@ -399,5 +516,6 @@ export {
|
|
|
399
516
|
patchToMainApp,
|
|
400
517
|
putToMainApp,
|
|
401
518
|
getBufferFromMainApp,
|
|
519
|
+
downloadFromMainApp,
|
|
402
520
|
uploadToMainApp
|
|
403
521
|
};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
peekCliToken
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-S5NTSDBS.js";
|
|
4
4
|
import {
|
|
5
5
|
getToken
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-ZQKDZXDO.js";
|
|
7
7
|
import {
|
|
8
8
|
getActiveHost,
|
|
9
9
|
getConfigDir,
|
|
10
10
|
isAeSandboxRuntime,
|
|
11
11
|
normalizeUrl
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-3FY3RJ26.js";
|
|
13
13
|
import {
|
|
14
14
|
logger
|
|
15
15
|
} from "./chunk-JHENBQ5B.js";
|
|
@@ -905,6 +905,12 @@ function withOutputMetadata(data, meta) {
|
|
|
905
905
|
function isOutputWithMetadata(value) {
|
|
906
906
|
return Boolean(value?.[OUTPUT_METADATA]);
|
|
907
907
|
}
|
|
908
|
+
function unwrapOutputData(value) {
|
|
909
|
+
return isOutputWithMetadata(value) ? value.data : value;
|
|
910
|
+
}
|
|
911
|
+
function readOutputMetadata(value) {
|
|
912
|
+
return isOutputWithMetadata(value) ? value.meta : void 0;
|
|
913
|
+
}
|
|
908
914
|
function findArrayField(data) {
|
|
909
915
|
if (Array.isArray(data)) return data;
|
|
910
916
|
if (typeof data !== "object" || data === null) return null;
|
|
@@ -917,6 +923,20 @@ function findArrayField(data) {
|
|
|
917
923
|
return null;
|
|
918
924
|
}
|
|
919
925
|
function formatTable(data) {
|
|
926
|
+
if (Array.isArray(data?.title) && data.title.length > 0 && Array.isArray(data?.rows)) {
|
|
927
|
+
const headers = data.title.map((value) => String(value));
|
|
928
|
+
const table2 = new Table({ head: headers, wordWrap: true });
|
|
929
|
+
for (const row of data.rows) {
|
|
930
|
+
const values = Array.isArray(row) ? row : [row];
|
|
931
|
+
table2.push(headers.map((_, index) => {
|
|
932
|
+
const value = values[index];
|
|
933
|
+
if (value === void 0 || value === null) return "";
|
|
934
|
+
if (typeof value === "object") return JSON.stringify(value);
|
|
935
|
+
return String(value);
|
|
936
|
+
}));
|
|
937
|
+
}
|
|
938
|
+
return table2.toString();
|
|
939
|
+
}
|
|
920
940
|
const rows = findArrayField(data);
|
|
921
941
|
if (!rows || rows.length === 0) {
|
|
922
942
|
return JSON.stringify(data, null, 2);
|
|
@@ -1011,6 +1031,8 @@ export {
|
|
|
1011
1031
|
formatCapabilityMissCompatHint,
|
|
1012
1032
|
runHostCompatCheck,
|
|
1013
1033
|
withOutputMetadata,
|
|
1034
|
+
unwrapOutputData,
|
|
1035
|
+
readOutputMetadata,
|
|
1014
1036
|
printError,
|
|
1015
1037
|
printOutput
|
|
1016
1038
|
};
|
|
@@ -6,9 +6,9 @@ import {
|
|
|
6
6
|
mintCliToken,
|
|
7
7
|
peekCliToken,
|
|
8
8
|
setCliTokenManual
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-S5NTSDBS.js";
|
|
10
|
+
import "./chunk-ZQKDZXDO.js";
|
|
11
|
+
import "./chunk-3FY3RJ26.js";
|
|
12
12
|
import "./chunk-JHENBQ5B.js";
|
|
13
13
|
export {
|
|
14
14
|
_resetRenewMemoryForTest,
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
getToken,
|
|
4
4
|
invalidateAccessTokenForRetry,
|
|
5
5
|
resolveHost
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-ZQKDZXDO.js";
|
|
7
7
|
import {
|
|
8
8
|
safeJsonParse
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-3FY3RJ26.js";
|
|
10
10
|
import {
|
|
11
11
|
logger
|
|
12
12
|
} from "./chunk-JHENBQ5B.js";
|
|
@@ -191,14 +191,13 @@ async function queryReportData(projectId, reportId, qp, eventModel, options = {}
|
|
|
191
191
|
...options
|
|
192
192
|
}, hostUrl);
|
|
193
193
|
}
|
|
194
|
-
|
|
195
194
|
export {
|
|
195
|
+
httpDelete,
|
|
196
196
|
httpGet,
|
|
197
197
|
httpPost,
|
|
198
198
|
httpRequest,
|
|
199
|
-
httpDelete,
|
|
200
199
|
httpUpload,
|
|
201
|
-
|
|
200
|
+
queryReportData,
|
|
202
201
|
querySql,
|
|
203
|
-
|
|
202
|
+
wsQuery
|
|
204
203
|
};
|
|
@@ -2,22 +2,15 @@ import {
|
|
|
2
2
|
MultiselectCancelled,
|
|
3
3
|
promptSingleSelect
|
|
4
4
|
} from "./chunk-TUKQZTMI.js";
|
|
5
|
-
import {
|
|
6
|
-
GLOBAL_QUERY_CONFIG_KEY,
|
|
7
|
-
getAnalysisMappingPathForClusterMode,
|
|
8
|
-
getClusterInfoFilePath,
|
|
9
|
-
isGlobalQueryModeEnabled,
|
|
10
|
-
setGlobalQueryModeEnabled
|
|
11
|
-
} from "./chunk-NBPKWKRA.js";
|
|
12
5
|
import {
|
|
13
6
|
printError,
|
|
14
7
|
printOutput
|
|
15
|
-
} from "./chunk-
|
|
16
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-WZRX4KOH.js";
|
|
9
|
+
import "./chunk-S5NTSDBS.js";
|
|
17
10
|
import {
|
|
18
11
|
AE_TRIAL_URL,
|
|
19
12
|
missingAeHostHint
|
|
20
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-ZQKDZXDO.js";
|
|
21
14
|
import {
|
|
22
15
|
addHost,
|
|
23
16
|
listHosts,
|
|
@@ -27,7 +20,7 @@ import {
|
|
|
27
20
|
resolveHostSelector,
|
|
28
21
|
setActiveHost,
|
|
29
22
|
updateHostLabel
|
|
30
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-3FY3RJ26.js";
|
|
31
24
|
import "./chunk-JHENBQ5B.js";
|
|
32
25
|
|
|
33
26
|
// src/commands/config.ts
|
|
@@ -301,28 +294,6 @@ function registerConfig(program) {
|
|
|
301
294
|
failConfig(err.message, "Run: ae-cli config list");
|
|
302
295
|
}
|
|
303
296
|
});
|
|
304
|
-
const clusterMode = configCmd.command("cluster-mode").description("Manage local multi-cluster analysis MCP mode").action(async () => {
|
|
305
|
-
await printClusterModeStatus(program);
|
|
306
|
-
});
|
|
307
|
-
clusterMode.command("status").description("Show local multi-cluster analysis MCP mode").action(async () => {
|
|
308
|
-
await printClusterModeStatus(program);
|
|
309
|
-
});
|
|
310
|
-
clusterMode.command("enable").description("Enable local multi-cluster analysis MCP mode").action(async () => {
|
|
311
|
-
setGlobalQueryModeEnabled(true);
|
|
312
|
-
await printClusterModeStatus(program);
|
|
313
|
-
});
|
|
314
|
-
clusterMode.command("disable").description("Disable local multi-cluster analysis MCP mode").action(async () => {
|
|
315
|
-
setGlobalQueryModeEnabled(false);
|
|
316
|
-
await printClusterModeStatus(program);
|
|
317
|
-
});
|
|
318
|
-
}
|
|
319
|
-
async function printClusterModeStatus(program) {
|
|
320
|
-
const enabled = isGlobalQueryModeEnabled();
|
|
321
|
-
await printOutput({
|
|
322
|
-
[GLOBAL_QUERY_CONFIG_KEY]: enabled,
|
|
323
|
-
path: getClusterInfoFilePath(),
|
|
324
|
-
analysisMappingPath: getAnalysisMappingPathForClusterMode(enabled)
|
|
325
|
-
}, program.opts().format || "json", program.opts().jq);
|
|
326
297
|
}
|
|
327
298
|
function readHostViews() {
|
|
328
299
|
const config = loadConfig();
|
package/dist/index.js
CHANGED
|
@@ -7,31 +7,31 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
TeAgentApiError,
|
|
9
9
|
TeAgentCredentialsError
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-VLWOLBGZ.js";
|
|
11
11
|
import {
|
|
12
12
|
formatCapabilityMissCompatHint,
|
|
13
13
|
printError,
|
|
14
14
|
printOutput,
|
|
15
15
|
runHostCompatCheck
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-WZRX4KOH.js";
|
|
17
17
|
import {
|
|
18
18
|
CapabilityGatewayError,
|
|
19
19
|
executeCapability,
|
|
20
20
|
uploadInputFileBytes
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-JUW4AJXN.js";
|
|
22
22
|
import {
|
|
23
23
|
clearCliToken,
|
|
24
24
|
getCliToken
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-S5NTSDBS.js";
|
|
26
26
|
import {
|
|
27
27
|
SecureStoreAuthError,
|
|
28
28
|
resolveHost
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-ZQKDZXDO.js";
|
|
30
30
|
import {
|
|
31
31
|
getActiveHost,
|
|
32
32
|
getConfigDir,
|
|
33
33
|
safeJsonParse
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-3FY3RJ26.js";
|
|
35
35
|
import {
|
|
36
36
|
CliValidationError,
|
|
37
37
|
CommunityReportError,
|
|
@@ -245,7 +245,7 @@ function createRuntimeContext(cmd, opts, globalOpts) {
|
|
|
245
245
|
let _clientModule = null;
|
|
246
246
|
async function getClient() {
|
|
247
247
|
if (!_clientModule) {
|
|
248
|
-
_clientModule = await import("./client-
|
|
248
|
+
_clientModule = await import("./client-L2YDMHQ6.js");
|
|
249
249
|
}
|
|
250
250
|
return _clientModule;
|
|
251
251
|
}
|
|
@@ -304,7 +304,7 @@ function createRuntimeContext(cmd, opts, globalOpts) {
|
|
|
304
304
|
return client.queryReportData(projectId, reportId, qp, eventModel, options, ctx.host());
|
|
305
305
|
},
|
|
306
306
|
async token() {
|
|
307
|
-
const { getToken } = await import("./auth-
|
|
307
|
+
const { getToken } = await import("./auth-GBMV6TEJ.js");
|
|
308
308
|
return getToken(ctx.host());
|
|
309
309
|
},
|
|
310
310
|
host() {
|
|
@@ -3442,62 +3442,57 @@ program.name("ae-cli").version(version).description("CLI tool for ThinkingAI (AE
|
|
|
3442
3442
|
async function loadCommands() {
|
|
3443
3443
|
const commands = [];
|
|
3444
3444
|
try {
|
|
3445
|
-
const teAnalysis = await import("./te-analysis-
|
|
3445
|
+
const teAnalysis = await import("./te-analysis-QG7UKGDA.js");
|
|
3446
3446
|
commands.push(...teAnalysis.default);
|
|
3447
3447
|
} catch {
|
|
3448
3448
|
}
|
|
3449
3449
|
try {
|
|
3450
|
-
const
|
|
3451
|
-
commands.push(...teMeta.default);
|
|
3452
|
-
} catch {
|
|
3453
|
-
}
|
|
3454
|
-
try {
|
|
3455
|
-
const engage = await import("./te-engage-QWM4GFS7.js");
|
|
3450
|
+
const engage = await import("./te-engage-D6EG3NOR.js");
|
|
3456
3451
|
commands.push(...engage.default);
|
|
3457
3452
|
} catch {
|
|
3458
3453
|
}
|
|
3459
3454
|
try {
|
|
3460
|
-
const experiment = await import("./te-experiment-
|
|
3455
|
+
const experiment = await import("./te-experiment-WA7TFMEL.js");
|
|
3461
3456
|
commands.push(...experiment.default);
|
|
3462
3457
|
} catch {
|
|
3463
3458
|
}
|
|
3464
3459
|
try {
|
|
3465
|
-
const community = await import("./te-community-
|
|
3460
|
+
const community = await import("./te-community-HNKVTERD.js");
|
|
3466
3461
|
commands.push(...community.default);
|
|
3467
3462
|
} catch {
|
|
3468
3463
|
}
|
|
3469
3464
|
try {
|
|
3470
|
-
const dataops = await import("./te-dataops-
|
|
3465
|
+
const dataops = await import("./te-dataops-KQPYNAE3.js");
|
|
3471
3466
|
commands.push(...dataops.default);
|
|
3472
3467
|
} catch {
|
|
3473
3468
|
}
|
|
3474
3469
|
try {
|
|
3475
|
-
const teKb = await import("./te-kb-
|
|
3470
|
+
const teKb = await import("./te-kb-OIH3T6CS.js");
|
|
3476
3471
|
commands.push(...teKb.default);
|
|
3477
3472
|
} catch {
|
|
3478
3473
|
}
|
|
3479
3474
|
try {
|
|
3480
|
-
const teTeam = await import("./te-team-
|
|
3475
|
+
const teTeam = await import("./te-team-GZPU6UWA.js");
|
|
3481
3476
|
commands.push(...teTeam.default);
|
|
3482
3477
|
} catch {
|
|
3483
3478
|
}
|
|
3484
3479
|
try {
|
|
3485
|
-
const teAgent = await import("./te-agent-
|
|
3480
|
+
const teAgent = await import("./te-agent-IFKZDHZI.js");
|
|
3486
3481
|
commands.push(...teAgent.default);
|
|
3487
3482
|
} catch {
|
|
3488
3483
|
}
|
|
3489
3484
|
try {
|
|
3490
|
-
const memory = await import("./memory-
|
|
3485
|
+
const memory = await import("./memory-MUP7PPL7.js");
|
|
3491
3486
|
commands.push(...memory.default);
|
|
3492
3487
|
} catch {
|
|
3493
3488
|
}
|
|
3494
3489
|
try {
|
|
3495
|
-
const teSystem = await import("./te-system-
|
|
3490
|
+
const teSystem = await import("./te-system-AZ3URMUO.js");
|
|
3496
3491
|
commands.push(...teSystem.default);
|
|
3497
3492
|
} catch {
|
|
3498
3493
|
}
|
|
3499
3494
|
try {
|
|
3500
|
-
const metadata = await import("./metadata-
|
|
3495
|
+
const metadata = await import("./metadata-LERKDJN6.js");
|
|
3501
3496
|
commands.push(...metadata.default);
|
|
3502
3497
|
} catch {
|
|
3503
3498
|
}
|
|
@@ -3505,49 +3500,42 @@ async function loadCommands() {
|
|
|
3505
3500
|
}
|
|
3506
3501
|
async function registerAuthCommands() {
|
|
3507
3502
|
try {
|
|
3508
|
-
const { registerAuth } = await import("./auth-
|
|
3503
|
+
const { registerAuth } = await import("./auth-NDSXE54J.js");
|
|
3509
3504
|
registerAuth(program);
|
|
3510
3505
|
} catch {
|
|
3511
3506
|
}
|
|
3512
3507
|
}
|
|
3513
3508
|
async function registerConfigCommands() {
|
|
3514
3509
|
try {
|
|
3515
|
-
const { registerConfig } = await import("./config-
|
|
3510
|
+
const { registerConfig } = await import("./config-OL2LWGBV.js");
|
|
3516
3511
|
registerConfig(program);
|
|
3517
3512
|
} catch {
|
|
3518
3513
|
}
|
|
3519
3514
|
}
|
|
3520
|
-
async function registerApiCommand() {
|
|
3521
|
-
try {
|
|
3522
|
-
const { registerApi } = await import("./raw-52B4UKO4.js");
|
|
3523
|
-
registerApi(program);
|
|
3524
|
-
} catch {
|
|
3525
|
-
}
|
|
3526
|
-
}
|
|
3527
3515
|
async function registerCapabilityCommands() {
|
|
3528
3516
|
try {
|
|
3529
|
-
const { registerCapability } = await import("./capability-
|
|
3517
|
+
const { registerCapability } = await import("./capability-TAMDRZYV.js");
|
|
3530
3518
|
registerCapability(program);
|
|
3531
3519
|
} catch {
|
|
3532
3520
|
}
|
|
3533
3521
|
}
|
|
3534
3522
|
async function registerSyncCommand() {
|
|
3535
3523
|
try {
|
|
3536
|
-
const { registerSync } = await import("./sync-
|
|
3524
|
+
const { registerSync } = await import("./sync-MOSFNBVR.js");
|
|
3537
3525
|
registerSync(program);
|
|
3538
3526
|
} catch {
|
|
3539
3527
|
}
|
|
3540
3528
|
}
|
|
3541
3529
|
async function registerModelCommand() {
|
|
3542
3530
|
try {
|
|
3543
|
-
const { registerModel } = await import("./model-
|
|
3531
|
+
const { registerModel } = await import("./model-JTUEO5M4.js");
|
|
3544
3532
|
registerModel(program);
|
|
3545
3533
|
} catch {
|
|
3546
3534
|
}
|
|
3547
3535
|
}
|
|
3548
3536
|
async function registerUpdateCommand() {
|
|
3549
3537
|
try {
|
|
3550
|
-
const { registerUpdate } = await import("./update-
|
|
3538
|
+
const { registerUpdate } = await import("./update-TOBFXF2V.js");
|
|
3551
3539
|
registerUpdate(program);
|
|
3552
3540
|
} catch {
|
|
3553
3541
|
}
|
|
@@ -3583,7 +3571,6 @@ async function main() {
|
|
|
3583
3571
|
registerCommands(program, commands);
|
|
3584
3572
|
await registerAuthCommands();
|
|
3585
3573
|
await registerConfigCommands();
|
|
3586
|
-
await registerApiCommand();
|
|
3587
3574
|
await registerCapabilityCommands();
|
|
3588
3575
|
await registerSyncCommand();
|
|
3589
3576
|
await registerModelCommand();
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
buildCapabilityGatewayUrl,
|
|
3
3
|
callCapabilityApi
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-JUW4AJXN.js";
|
|
5
|
+
import "./chunk-S5NTSDBS.js";
|
|
6
|
+
import "./chunk-ZQKDZXDO.js";
|
|
7
|
+
import "./chunk-3FY3RJ26.js";
|
|
8
8
|
import "./chunk-AXDXJTPC.js";
|
|
9
9
|
import "./chunk-JHENBQ5B.js";
|
|
10
10
|
|