@thinkingai/ae-cli 6.0.55 → 6.0.56
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 +24 -3
- package/README.zh.md +24 -3
- package/dist/{auth-RQBO6MTY.js → auth-U7MNUUEF.js} +37 -13
- package/dist/{automation-VAAQBM7Y.js → automation-K32V2NKP.js} +94 -38
- package/dist/{capability-JRIFC4AJ.js → capability-VV7RHB3B.js} +8 -7
- package/dist/{chunk-CT7QDJS6.js → chunk-2IYIYSUO.js} +2 -2
- package/dist/{chunk-3YVEAZUN.js → chunk-2UWS5CUP.js} +32 -21
- package/dist/{chunk-374V5R6N.js → chunk-3TQA5RXE.js} +3 -3
- package/dist/{chunk-6VNIR4AP.js → chunk-ELCR235M.js} +26 -19
- package/dist/{chunk-7KU2WNQE.js → chunk-F6NIPIT5.js} +7 -6
- package/dist/{chunk-RPBOAQQQ.js → chunk-GI5BMEZO.js} +1 -1
- package/dist/chunk-JJJIP2XQ.js +105 -0
- package/dist/{chunk-5XJYLEVC.js → chunk-KHS64JZQ.js} +4 -4
- package/dist/{chunk-ZL7SGNIA.js → chunk-LMCYSVVA.js} +11 -13
- package/dist/{chunk-VZZNLV3I.js → chunk-MXV3PYC3.js} +14 -6
- package/dist/{chunk-OP44TT4H.js → chunk-P6VFCH3P.js} +4 -2
- package/dist/{chunk-GHXZK54S.js → chunk-P7KL7IOH.js} +41 -13
- package/dist/{chunk-AP7YP2NX.js → chunk-QSAR3GHY.js} +2 -2
- package/dist/{chunk-S6M42KND.js → chunk-T44M3PLZ.js} +1 -1
- package/dist/{chunk-Q5US7JC5.js → chunk-UUD5RB36.js} +3 -3
- package/dist/{chunk-RGYPSEYD.js → chunk-W2PTY5NN.js} +3 -3
- package/dist/chunk-X7DRLE62.js +233 -0
- package/dist/{chunk-WNGFSIOB.js → chunk-ZW4VMY5H.js} +103 -6
- package/dist/{community-report-client-PEERQCX2.js → community-report-client-S2K3A3Q6.js} +1 -1
- package/dist/{config-SICKWZ2A.js → config-ASSAAIOI.js} +10 -9
- package/dist/{context-NGVFPCBK.js → context-6RWLVOM5.js} +4 -4
- package/dist/{data-integration-BCLQFTGU.js → data-integration-EXSUPUDZ.js} +6 -6
- package/dist/evaluation-5YT4QLCL.js +3714 -0
- package/dist/index.js +93 -49
- package/dist/{local-data-upload-client-TWMHFLUA.js → local-data-upload-client-7HCPGIS3.js} +1 -1
- package/dist/{memory-CQKH2JAV.js → memory-VCYLVPMI.js} +6 -6
- package/dist/{metadata-EMFGUI2W.js → metadata-TIWIOFTU.js} +8 -8
- package/dist/{model-VX5M2CJ6.js → model-DPJHSD73.js} +4 -4
- package/dist/{personal-semantic-preference-SLWVVYZ4.js → personal-semantic-preference-SBKU2LOK.js} +6 -6
- package/dist/{project-semantic-DPSZBKQD.js → project-semantic-SKNWLH3I.js} +6 -6
- package/dist/{sync-RZIAV37C.js → sync-7PP6KQ75.js} +7 -7
- package/dist/{te-agent-AORRE2FM.js → te-agent-L2BYNPHM.js} +753 -94
- package/dist/{te-analysis-ISXKJKRT.js → te-analysis-RJB6VJC4.js} +411 -79
- package/dist/{te-community-42M7ICDO.js → te-community-QN3WMPNT.js} +6 -4
- package/dist/{te-dataops-BNKNZ4F2.js → te-dataops-UKD2XN3E.js} +8 -6
- package/dist/{te-engage-BZE3MBKT.js → te-engage-KPTN4N2U.js} +6 -6
- package/dist/{te-kb-ULATOTQ3.js → te-kb-SFZI3W5T.js} +7 -7
- package/dist/{te-system-UGHVKBVV.js → te-system-IE7NCKC3.js} +6 -6
- package/dist/{te-team-YA6SNOJ3.js → te-team-4KHCFM2I.js} +63 -41
- package/dist/{things-DTCOQIQB.js → things-7JJUVAWL.js} +7 -7
- package/dist/{update-ESNYKUVR.js → update-AX66IFMJ.js} +4 -4
- package/dist/{workspace-JEOHKFPX.js → workspace-Q5NMEKEN.js} +6 -6
- package/package.json +11 -7
- package/skills/ae-agent/SKILL.md +20 -3
- package/skills/ae-agent/references/command_index.md +8 -0
- package/skills/ae-agent/references/resource-package.md +53 -0
- package/skills/ae-analysis/SKILL.md +12 -3
- package/skills/ae-analysis/references/adhoc_export.md +1 -1
- package/skills/ae-analysis/references/agent_review_preflight.md +4 -0
- package/skills/ae-analysis/references/agent_review_submit_to_page.md +4 -0
- package/skills/ae-analysis/references/ai_models/event.md +58 -2
- package/skills/ae-analysis/references/ai_models/rank_list.md +1 -0
- package/skills/ae-analysis/references/ai_models/retention.md +2 -0
- package/skills/ae-analysis/references/ai_models/revenue.md +2 -0
- package/skills/ae-analysis/references/analysis_data_export.md +11 -1
- package/skills/ae-analysis/references/asset_batch_info_export.md +2 -2
- package/skills/ae-analysis/references/asset_batch_sql_export.md +2 -2
- package/skills/ae-analysis/references/asset_export.md +1 -1
- package/skills/ae-analysis/references/bi_panel_page_data_export.md +1 -1
- package/skills/ae-analysis/references/check_export.md +1 -1
- package/skills/ae-analysis/references/command_index.md +34 -25
- package/skills/ae-analysis/references/dashboard_report_data_export.md +2 -0
- package/skills/ae-analysis/references/dashboard_report_get.md +6 -2
- package/skills/ae-analysis/references/dashboard_report_update.md +24 -5
- package/skills/ae-analysis/references/feedback_submit.md +1 -1
- package/skills/ae-analysis/references/governance_recommendation_export.md +10 -2
- package/skills/ae-analysis/references/live_data_export.md +1 -1
- package/skills/ae-analysis/references/metric_create.md +29 -0
- package/skills/ae-analysis/references/metric_get.md +2 -0
- package/skills/ae-analysis/references/metric_update.md +2 -0
- package/skills/ae-analysis/references/operation_record_export.md +1 -1
- package/skills/ae-analysis/references/plan_change_log_export.md +1 -1
- package/skills/ae-analysis/references/plan_export.md +1 -1
- package/skills/ae-analysis/references/project_info_get.md +4 -0
- package/skills/ae-analysis/references/project_member_group_add_members.md +35 -0
- package/skills/ae-analysis/references/project_member_group_create.md +25 -0
- package/skills/ae-analysis/references/project_member_group_delete.md +34 -0
- package/skills/ae-analysis/references/project_member_group_list.md +29 -0
- package/skills/ae-analysis/references/project_member_group_members.md +28 -0
- package/skills/ae-analysis/references/project_member_group_remove_members.md +35 -0
- package/skills/ae-analysis/references/project_member_group_rename.md +26 -0
- package/skills/ae-analysis/references/project_semantic_knowledge_wiki_plan_schema.md +6 -1
- package/skills/ae-analysis/references/report_data_export.md +1 -1
- package/skills/ae-analysis/references/scenario_append.md +25 -0
- package/skills/ae-analysis/references/scenario_collect.md +35 -0
- package/skills/ae-analysis/references/scenario_evaluation.md +30 -0
- package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/build-project-semantic-wiki.mjs +73 -4
- package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/default-compile-schema.md +5 -1
- package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/execution-contract.mjs +173 -0
- package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/generate-build-ir.mjs +109 -64
- package/skills/ae-automation/SKILL.md +2 -2
- package/skills/ae-automation/references/cli.md +18 -1
- package/skills/ae-capability/SKILL.md +7 -3
- package/skills/ae-evaluation/SKILL.md +83 -0
- package/skills/ae-evaluation/references/access-and-members.md +55 -0
- package/skills/ae-evaluation/references/connections.md +78 -0
- package/skills/ae-evaluation/references/datasets.md +57 -0
- package/skills/ae-evaluation/references/evaluators.md +81 -0
- package/skills/ae-evaluation/references/files.md +33 -0
- package/skills/ae-evaluation/references/integrations.md +39 -0
- package/skills/ae-evaluation/references/runs.md +160 -0
- package/skills/ae-evaluation/references/schedules.md +31 -0
- package/skills/ae-metadata/SKILL.md +2 -1
- package/skills/ae-metadata/references/metadata_data_table_download.md +7 -1
- package/skills/ae-metadata/references/metadata_data_table_get.md +2 -0
- package/skills/ae-team/SKILL.md +2 -2
- package/skills/ae-team/references/run-start.md +1 -0
- package/skills/ae-team/references/run-watch.md +7 -5
- package/skills/ae-things/SKILL.md +53 -51
- package/skills/ae-things/references/cli.md +56 -54
- package/skills/ae-things-progress/SKILL.md +20 -20
- package/skills/ae-things-review/SKILL.md +19 -19
- package/dist/chunk-CI24BDR2.js +0 -43
|
@@ -4,15 +4,17 @@ import {
|
|
|
4
4
|
} from "./chunk-Y74WTIKJ.js";
|
|
5
5
|
import {
|
|
6
6
|
getCliToken
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-P7KL7IOH.js";
|
|
8
8
|
import {
|
|
9
9
|
getActiveHost,
|
|
10
10
|
getSandboxRuntimeRoot
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-LMCYSVVA.js";
|
|
12
12
|
import {
|
|
13
13
|
PermissionError,
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
externalCliTokenRequestOptions,
|
|
15
|
+
isApiErrorType,
|
|
16
|
+
readExternalCliToken
|
|
17
|
+
} from "./chunk-ZW4VMY5H.js";
|
|
16
18
|
|
|
17
19
|
// src/core/te-agent-credentials.ts
|
|
18
20
|
import { readFileSync } from "fs";
|
|
@@ -153,7 +155,7 @@ async function fetchWithTimeout(url, init, timeoutMs = DEFAULT_TIMEOUT_MS) {
|
|
|
153
155
|
const controller = new AbortController();
|
|
154
156
|
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
155
157
|
try {
|
|
156
|
-
return await fetch(url, { ...init, signal: controller.signal });
|
|
158
|
+
return await fetch(url, { ...init, signal: controller.signal, ...externalCliTokenRequestOptions(url) });
|
|
157
159
|
} catch (err) {
|
|
158
160
|
if (err?.name === "AbortError") {
|
|
159
161
|
throw new TeAgentApiError(
|
|
@@ -197,7 +199,8 @@ function teClaudeBaseFromActiveHost(hostOverride) {
|
|
|
197
199
|
if (!h) return void 0;
|
|
198
200
|
return resolveTeClaudeBaseUrl(h);
|
|
199
201
|
}
|
|
200
|
-
async function signRequest(method, path2, hostOverride, includeJsonContentType = true) {
|
|
202
|
+
async function signRequest(method, path2, hostOverride, includeJsonContentType = true, authMode = "auto") {
|
|
203
|
+
const external = readExternalCliToken(hostOverride);
|
|
201
204
|
const configuredHost = hostOverride || getActiveHost();
|
|
202
205
|
const sandboxOnly = !hostOverride && (/* @__PURE__ */ new Set([
|
|
203
206
|
"/api/sandbox/models",
|
|
@@ -207,8 +210,8 @@ async function signRequest(method, path2, hostOverride, includeJsonContentType =
|
|
|
207
210
|
"/api/sandbox/sync/pull",
|
|
208
211
|
"/api/sandbox/sync/pull/candidates"
|
|
209
212
|
])).has(path2.split("?")[0]);
|
|
210
|
-
const sandboxCred = configuredHost && !sandboxOnly ? null : tryLoadTeAgentSandboxCredentials();
|
|
211
|
-
if (!hostOverride && sandboxCred && sandboxCred.sandboxId && sandboxCred.sandboxSecretKey) {
|
|
213
|
+
const sandboxCred = external || configuredHost && !sandboxOnly ? null : tryLoadTeAgentSandboxCredentials();
|
|
214
|
+
if (authMode === "auto" && !hostOverride && sandboxCred && sandboxCred.sandboxId && sandboxCred.sandboxSecretKey) {
|
|
212
215
|
const headers = {
|
|
213
216
|
"X-Sandbox-Id": sandboxCred.sandboxId,
|
|
214
217
|
"X-Sandbox-Secret-Key": sandboxCred.sandboxSecretKey
|
|
@@ -222,7 +225,7 @@ async function signRequest(method, path2, hostOverride, includeJsonContentType =
|
|
|
222
225
|
authKind: "sandbox"
|
|
223
226
|
};
|
|
224
227
|
}
|
|
225
|
-
const baseUrl = hostOverride ? teClaudeBaseFromActiveHost(hostOverride) : sandboxCred?.url || teClaudeBaseFromActiveHost();
|
|
228
|
+
const baseUrl = hostOverride || external ? teClaudeBaseFromActiveHost(hostOverride || external?.url) : sandboxCred?.url || teClaudeBaseFromActiveHost();
|
|
226
229
|
if (!baseUrl) {
|
|
227
230
|
throw new TeAgentCredentialsError(
|
|
228
231
|
"Cannot determine the te-claude service URL",
|
|
@@ -248,13 +251,14 @@ async function fetchSigned(options) {
|
|
|
248
251
|
options.method,
|
|
249
252
|
options.path,
|
|
250
253
|
options.hostOverride,
|
|
251
|
-
options.includeJsonContentType
|
|
254
|
+
options.includeJsonContentType,
|
|
255
|
+
options.authMode
|
|
252
256
|
);
|
|
253
257
|
return fetchWithTimeout(
|
|
254
258
|
signed.url,
|
|
255
259
|
{
|
|
256
260
|
method: options.method,
|
|
257
|
-
headers: signed.headers,
|
|
261
|
+
headers: { ...Object.fromEntries(new Headers(options.headers).entries()), ...signed.headers },
|
|
258
262
|
body: options.body
|
|
259
263
|
},
|
|
260
264
|
options.timeoutMs
|
|
@@ -263,7 +267,7 @@ async function fetchSigned(options) {
|
|
|
263
267
|
function errorDetails(parsed, defaultErrorPrefix, status) {
|
|
264
268
|
const nested = parsed && typeof parsed === "object" && parsed.error && typeof parsed.error === "object" ? parsed.error : parsed;
|
|
265
269
|
const message = typeof parsed?.error === "string" ? parsed.error : typeof nested?.message === "string" ? nested.message : typeof parsed?.message === "string" ? parsed.message : typeof parsed?.return_message === "string" ? parsed.return_message : `${defaultErrorPrefix} ${status}`;
|
|
266
|
-
const code = typeof nested?.code === "string" ? nested.code : typeof parsed?.code === "string" ? parsed.code : void 0;
|
|
270
|
+
const code = typeof nested?.code === "string" ? nested.code : typeof parsed?.code === "string" ? parsed.code : typeof parsed?.errorCode === "string" ? parsed.errorCode : void 0;
|
|
267
271
|
const hint = typeof nested?.hint === "string" ? nested.hint : typeof parsed?.hint === "string" ? parsed.hint : void 0;
|
|
268
272
|
const declaredType = isApiErrorType(nested?.type) ? nested.type : void 0;
|
|
269
273
|
const type = status === 401 ? "auth" : status === 403 ? "permission" : declaredType ?? ([400, 413, 422].includes(status) ? "validation" : status === 404 ? "not_found" : "api");
|
|
@@ -303,21 +307,23 @@ async function parseResponse(response, defaultErrorPrefix) {
|
|
|
303
307
|
}
|
|
304
308
|
return parsed;
|
|
305
309
|
}
|
|
306
|
-
async function postToMainApp(path2, body, hostOverride) {
|
|
310
|
+
async function postToMainApp(path2, body, hostOverride, authMode = "auto") {
|
|
307
311
|
const rawBody = JSON.stringify(body);
|
|
308
312
|
const response = await fetchSigned({
|
|
309
313
|
method: "POST",
|
|
310
314
|
path: path2,
|
|
311
315
|
body: rawBody,
|
|
312
|
-
hostOverride
|
|
316
|
+
hostOverride,
|
|
317
|
+
authMode
|
|
313
318
|
});
|
|
314
319
|
return parseResponse(response, "Main app returned");
|
|
315
320
|
}
|
|
316
|
-
async function getFromMainApp(path2, hostOverride) {
|
|
321
|
+
async function getFromMainApp(path2, hostOverride, authMode = "auto") {
|
|
317
322
|
const response = await fetchSigned({
|
|
318
323
|
method: "GET",
|
|
319
324
|
path: path2,
|
|
320
|
-
hostOverride
|
|
325
|
+
hostOverride,
|
|
326
|
+
authMode
|
|
321
327
|
});
|
|
322
328
|
return parseResponse(response, "Main app returned");
|
|
323
329
|
}
|
|
@@ -347,21 +353,23 @@ async function postSandboxSyncPull(args) {
|
|
|
347
353
|
mode: "merge"
|
|
348
354
|
});
|
|
349
355
|
}
|
|
350
|
-
async function deleteFromMainApp(path2, hostOverride) {
|
|
356
|
+
async function deleteFromMainApp(path2, hostOverride, authMode = "auto") {
|
|
351
357
|
const response = await fetchSigned({
|
|
352
358
|
method: "DELETE",
|
|
353
359
|
path: path2,
|
|
354
|
-
hostOverride
|
|
360
|
+
hostOverride,
|
|
361
|
+
authMode
|
|
355
362
|
});
|
|
356
363
|
return parseResponse(response, "Main app returned");
|
|
357
364
|
}
|
|
358
|
-
async function patchToMainApp(path2, body, hostOverride) {
|
|
365
|
+
async function patchToMainApp(path2, body, hostOverride, authMode = "auto") {
|
|
359
366
|
const rawBody = JSON.stringify(body);
|
|
360
367
|
const response = await fetchSigned({
|
|
361
368
|
method: "PATCH",
|
|
362
369
|
path: path2,
|
|
363
370
|
body: rawBody,
|
|
364
|
-
hostOverride
|
|
371
|
+
hostOverride,
|
|
372
|
+
authMode
|
|
365
373
|
});
|
|
366
374
|
return parseResponse(response, "Main app returned");
|
|
367
375
|
}
|
|
@@ -447,7 +455,8 @@ async function downloadFromMainApp(requestPath, outputPath, hostOverride) {
|
|
|
447
455
|
return await fetch(requestToSend.url, {
|
|
448
456
|
method: "GET",
|
|
449
457
|
headers: requestToSend.headers,
|
|
450
|
-
signal: controller.signal
|
|
458
|
+
signal: controller.signal,
|
|
459
|
+
...externalCliTokenRequestOptions(requestToSend.url)
|
|
451
460
|
});
|
|
452
461
|
} catch (error) {
|
|
453
462
|
if (error?.name === "AbortError") {
|
|
@@ -519,7 +528,9 @@ export {
|
|
|
519
528
|
getClaudeConfigDir,
|
|
520
529
|
resolveTeClaudeBaseUrl,
|
|
521
530
|
TeAgentApiError,
|
|
531
|
+
fetchSigned,
|
|
522
532
|
createTeAgentApiError,
|
|
533
|
+
parseResponse,
|
|
523
534
|
postToMainApp,
|
|
524
535
|
getFromMainApp,
|
|
525
536
|
getSandboxModels,
|
|
@@ -6,13 +6,13 @@ import {
|
|
|
6
6
|
dryRunCapability,
|
|
7
7
|
executeCapabilityWithEnvelope,
|
|
8
8
|
validateCapability
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-MXV3PYC3.js";
|
|
10
10
|
import {
|
|
11
11
|
withOutputMetadata
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-ELCR235M.js";
|
|
13
13
|
import {
|
|
14
14
|
CliValidationError
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-ZW4VMY5H.js";
|
|
16
16
|
|
|
17
17
|
// src/core/definition-intent.ts
|
|
18
18
|
import { createHash } from "crypto";
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
peekCliToken
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-P7KL7IOH.js";
|
|
5
5
|
import {
|
|
6
6
|
getActiveHost,
|
|
7
7
|
getConfigDir,
|
|
8
|
-
isAeSandboxRuntime
|
|
9
|
-
|
|
10
|
-
} from "./chunk-ZL7SGNIA.js";
|
|
8
|
+
isAeSandboxRuntime
|
|
9
|
+
} from "./chunk-LMCYSVVA.js";
|
|
11
10
|
import {
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
externalCliTokenRequestOptions,
|
|
12
|
+
logger,
|
|
13
|
+
normalizeUrl,
|
|
14
|
+
readExternalCliToken,
|
|
15
|
+
redactExternalCliToken
|
|
16
|
+
} from "./chunk-ZW4VMY5H.js";
|
|
14
17
|
|
|
15
18
|
// src/core/install-process.ts
|
|
16
19
|
import spawn from "cross-spawn";
|
|
@@ -725,11 +728,13 @@ function recordVersionSyncResult(host, target, result) {
|
|
|
725
728
|
store.hosts[key] = entry;
|
|
726
729
|
writeSyncStore(store);
|
|
727
730
|
}
|
|
728
|
-
function
|
|
731
|
+
function isRegularCliVersion(version) {
|
|
729
732
|
const normalized = normalizeCliVersion(version);
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
+
return /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/.test(normalized) && normalized.split(".").every((part) => Number.isSafeInteger(Number(part)));
|
|
734
|
+
}
|
|
735
|
+
function isAutoSyncTargetEligible(version) {
|
|
736
|
+
if (!isRegularCliVersion(version)) return false;
|
|
737
|
+
const [major, minor, patch] = normalizeCliVersion(version).split(".").map(Number);
|
|
733
738
|
if (major > 6) return true;
|
|
734
739
|
if (major !== 6) return false;
|
|
735
740
|
if (minor > 1) return true;
|
|
@@ -966,7 +971,7 @@ function rootCommand(argv) {
|
|
|
966
971
|
const token = args[i];
|
|
967
972
|
if (token === "--") return void 0;
|
|
968
973
|
if (token.startsWith("-")) {
|
|
969
|
-
if (!token.includes("=") && ["--host", "--mcp-url", "--format", "--jq"].includes(token)) {
|
|
974
|
+
if (!token.includes("=") && ["--host", "--cli-token-file", "--mcp-url", "--format", "--jq"].includes(token)) {
|
|
970
975
|
i += 1;
|
|
971
976
|
}
|
|
972
977
|
continue;
|
|
@@ -981,13 +986,15 @@ function shouldSkipAutoSync(argv = process.argv) {
|
|
|
981
986
|
}
|
|
982
987
|
async function fetchCliConfig(host, cliToken) {
|
|
983
988
|
const url = new URL(CLI_CONFIG_PATH, host.endsWith("/") ? host : `${host}/`);
|
|
984
|
-
|
|
989
|
+
const external = readExternalCliToken(host)?.token === cliToken;
|
|
990
|
+
if (!external) url.searchParams.set("cli-token", cliToken);
|
|
985
991
|
const controller = new AbortController();
|
|
986
992
|
const timer = setTimeout(() => controller.abort(), FETCH_TIMEOUT_MS);
|
|
987
993
|
try {
|
|
988
994
|
const resp = await fetch(url.toString(), {
|
|
989
995
|
signal: controller.signal,
|
|
990
|
-
headers: { Accept: "application/json" }
|
|
996
|
+
headers: { Accept: "application/json", ...external ? { "cli-token": cliToken } : {} },
|
|
997
|
+
...externalCliTokenRequestOptions(url.toString())
|
|
991
998
|
});
|
|
992
999
|
if (!resp.ok) return null;
|
|
993
1000
|
const body = await resp.json();
|
|
@@ -1104,7 +1111,7 @@ async function refreshAndMaybeNotify(host, pkg, allowAutoSync) {
|
|
|
1104
1111
|
entry.localVersion = pkg.version;
|
|
1105
1112
|
entry.expectedVersion = expected;
|
|
1106
1113
|
entry.clusterVersion = cluster || entry.clusterVersion;
|
|
1107
|
-
const canAutoSync = allowAutoSync && isPublicAeCliPackage(pkg.name) && isAutoSyncTargetEligible(expected);
|
|
1114
|
+
const canAutoSync = allowAutoSync && isPublicAeCliPackage(pkg.name) && isRegularCliVersion(pkg.version) && isAutoSyncTargetEligible(expected);
|
|
1108
1115
|
if (canAutoSync) {
|
|
1109
1116
|
const confirmed = await fetchCliConfig(host, token);
|
|
1110
1117
|
if (confirmed) rememberKbAutoDiscoveryFeature(host, token, confirmed.projectSemanticKbAutoDiscovery ?? false);
|
|
@@ -1307,7 +1314,7 @@ async function applyJq(data, expr) {
|
|
|
1307
1314
|
if (!trimmed) return data;
|
|
1308
1315
|
let results;
|
|
1309
1316
|
try {
|
|
1310
|
-
results = await jqJson(data, trimmed);
|
|
1317
|
+
results = await jqJson(data ?? null, trimmed);
|
|
1311
1318
|
} catch (err) {
|
|
1312
1319
|
const message = err instanceof JqError ? err.message : err?.message || String(err);
|
|
1313
1320
|
const error = new Error(`Invalid --jq expression: ${message}`);
|
|
@@ -1328,7 +1335,7 @@ async function formatOutput(data, format, jqExpr) {
|
|
|
1328
1335
|
processed = await applyJq(outputData, jqExpr);
|
|
1329
1336
|
}
|
|
1330
1337
|
if (format === "table") {
|
|
1331
|
-
return formatTable(processed);
|
|
1338
|
+
return redactExternalCliToken(formatTable(processed));
|
|
1332
1339
|
}
|
|
1333
1340
|
const hostCompat = getPendingHostCompatNotice();
|
|
1334
1341
|
const updateNotice = getPendingUpdateNotice();
|
|
@@ -1343,7 +1350,7 @@ async function formatOutput(data, format, jqExpr) {
|
|
|
1343
1350
|
// Soft tip lives only under _notice (not mirrored into meta) to avoid duplicate fields.
|
|
1344
1351
|
...Object.keys(notices).length > 0 ? { _notice: notices } : {}
|
|
1345
1352
|
};
|
|
1346
|
-
return JSON.stringify(envelope, null, 2);
|
|
1353
|
+
return redactExternalCliToken(JSON.stringify(envelope, null, 2));
|
|
1347
1354
|
}
|
|
1348
1355
|
function formatError(type, message, hint, code, meta, details) {
|
|
1349
1356
|
const envelope = {
|
|
@@ -1351,7 +1358,7 @@ function formatError(type, message, hint, code, meta, details) {
|
|
|
1351
1358
|
error: { type, message, hint, code, ...details === void 0 ? {} : { details } },
|
|
1352
1359
|
...meta && Object.keys(meta).length > 0 ? { meta } : {}
|
|
1353
1360
|
};
|
|
1354
|
-
return JSON.stringify(envelope, null, 2);
|
|
1361
|
+
return redactExternalCliToken(JSON.stringify(envelope, null, 2));
|
|
1355
1362
|
}
|
|
1356
1363
|
function printError(type, message, hint, code, meta, options = {}) {
|
|
1357
1364
|
const formatted = formatError(type, message, hint, code, meta, options.details);
|
|
@@ -1389,7 +1396,7 @@ async function printOutput(data, format, jqExpr, options = {}) {
|
|
|
1389
1396
|
const recoveryData = options.redactErrors ? sensitiveRecoveryData(unwrapOutputData(data)) : unwrapOutputData(data);
|
|
1390
1397
|
await new Promise((resolve, reject) => {
|
|
1391
1398
|
process.stdout.write(
|
|
1392
|
-
JSON.stringify({ ...recovery, data: recoveryData }, null, 2) + "\n",
|
|
1399
|
+
redactExternalCliToken(JSON.stringify({ ...recovery, data: recoveryData }, null, 2)) + "\n",
|
|
1393
1400
|
(error2) => error2 ? reject(error2) : resolve()
|
|
1394
1401
|
);
|
|
1395
1402
|
});
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
CapabilityGatewayError
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-MXV3PYC3.js";
|
|
5
5
|
import {
|
|
6
6
|
SecureStoreAuthError,
|
|
7
7
|
getCliToken
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-P7KL7IOH.js";
|
|
9
9
|
import {
|
|
10
10
|
safeJsonParse
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-LMCYSVVA.js";
|
|
12
12
|
import {
|
|
13
|
-
PermissionError
|
|
14
|
-
|
|
13
|
+
PermissionError,
|
|
14
|
+
externalCliTokenRequestOptions
|
|
15
|
+
} from "./chunk-ZW4VMY5H.js";
|
|
15
16
|
|
|
16
17
|
// src/core/mcp-access.ts
|
|
17
18
|
function buildUrl(host, path, params = {}) {
|
|
@@ -170,7 +171,7 @@ function parseKbResponse(resp, text, options = {}) {
|
|
|
170
171
|
async function fetchWithCliToken(input, init, cliToken, options = {}) {
|
|
171
172
|
const headers = new Headers(init.headers);
|
|
172
173
|
headers.set("cli-token", cliToken);
|
|
173
|
-
const resp = await fetch(input, { ...init, headers });
|
|
174
|
+
const resp = await fetch(input, { ...init, headers, ...externalCliTokenRequestOptions(input) });
|
|
174
175
|
if (options.responseType === "empty" && resp.status === 204) return null;
|
|
175
176
|
if (options.responseType === "bytes" && resp.ok) {
|
|
176
177
|
if (resp.headers.get("content-type")?.includes("application/json")) {
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
TeAgentApiError,
|
|
4
|
+
deleteFromMainApp,
|
|
5
|
+
fetchSigned,
|
|
6
|
+
getBufferFromMainApp,
|
|
7
|
+
getFromMainApp,
|
|
8
|
+
parseResponse,
|
|
9
|
+
patchToMainApp,
|
|
10
|
+
postToMainApp,
|
|
11
|
+
putToMainApp,
|
|
12
|
+
uploadToMainApp
|
|
13
|
+
} from "./chunk-2UWS5CUP.js";
|
|
14
|
+
import {
|
|
15
|
+
clearCliTokenCache
|
|
16
|
+
} from "./chunk-P7KL7IOH.js";
|
|
17
|
+
|
|
18
|
+
// src/core/resource-package-client.ts
|
|
19
|
+
function checkPath(path) {
|
|
20
|
+
if (!path.startsWith("/api/resource-packages/")) {
|
|
21
|
+
throw new TypeError("Resource package requests must use /api/resource-packages/");
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
async function fetchResourcePackage(input) {
|
|
25
|
+
const request = () => fetchSigned({ ...input, hostOverride: input.host });
|
|
26
|
+
let response = await request();
|
|
27
|
+
if (response.status === 401) {
|
|
28
|
+
await response.body?.cancel();
|
|
29
|
+
clearCliTokenCache(input.host);
|
|
30
|
+
response = await request();
|
|
31
|
+
}
|
|
32
|
+
return response;
|
|
33
|
+
}
|
|
34
|
+
async function resourcePackageJson(input) {
|
|
35
|
+
checkPath(input.path);
|
|
36
|
+
const response = await fetchResourcePackage({
|
|
37
|
+
method: input.method,
|
|
38
|
+
path: input.path,
|
|
39
|
+
host: input.host,
|
|
40
|
+
includeJsonContentType: true,
|
|
41
|
+
body: input.body === void 0 ? void 0 : JSON.stringify(input.body)
|
|
42
|
+
});
|
|
43
|
+
return parseResponse(response, "Resource package service returned");
|
|
44
|
+
}
|
|
45
|
+
async function resourcePackageRaw(input) {
|
|
46
|
+
checkPath(input.path);
|
|
47
|
+
const response = await fetchResourcePackage({
|
|
48
|
+
...input,
|
|
49
|
+
includeJsonContentType: false
|
|
50
|
+
});
|
|
51
|
+
if (!response.ok) await parseResponse(response, "Resource package service returned");
|
|
52
|
+
return response;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// src/commands/te-agent/api-client.ts
|
|
56
|
+
function getAgentApi(ctx, path) {
|
|
57
|
+
return getFromMainApp(path, ctx.host());
|
|
58
|
+
}
|
|
59
|
+
function postAgentApi(ctx, path, body) {
|
|
60
|
+
return postToMainApp(path, body, ctx.host());
|
|
61
|
+
}
|
|
62
|
+
function patchAgentApi(ctx, path, body) {
|
|
63
|
+
return patchToMainApp(path, body, ctx.host());
|
|
64
|
+
}
|
|
65
|
+
function putAgentApi(ctx, path, body) {
|
|
66
|
+
return putToMainApp(path, body, ctx.host());
|
|
67
|
+
}
|
|
68
|
+
function deleteAgentApi(ctx, path) {
|
|
69
|
+
return deleteFromMainApp(path, ctx.host());
|
|
70
|
+
}
|
|
71
|
+
function uploadAgentApi(ctx, path, formData) {
|
|
72
|
+
return uploadToMainApp(path, formData, ctx.host());
|
|
73
|
+
}
|
|
74
|
+
function getAgentBuffer(ctx, path) {
|
|
75
|
+
return getBufferFromMainApp(path, ctx.host());
|
|
76
|
+
}
|
|
77
|
+
function requestResourcePackageApi(ctx, method, path, body) {
|
|
78
|
+
return resourcePackageJson({ host: ctx.host(), method, path, body });
|
|
79
|
+
}
|
|
80
|
+
function requestResourcePackageRaw(ctx, method, path, options = {}) {
|
|
81
|
+
return resourcePackageRaw({ host: ctx.host(), method, path, ...options });
|
|
82
|
+
}
|
|
83
|
+
function isTransientResourcePackageError(error) {
|
|
84
|
+
return error instanceof TeAgentApiError && (error.status === 0 || error.status === 429 || error.status >= 500);
|
|
85
|
+
}
|
|
86
|
+
function resourcePackagePreflightChange(error) {
|
|
87
|
+
if (!(error instanceof TeAgentApiError) || error.code !== "PREFLIGHT_CHANGED") return void 0;
|
|
88
|
+
const body = error.body;
|
|
89
|
+
if (!body || typeof body !== "object" || !("preflight" in body)) return void 0;
|
|
90
|
+
return body.preflight;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export {
|
|
94
|
+
getAgentApi,
|
|
95
|
+
postAgentApi,
|
|
96
|
+
patchAgentApi,
|
|
97
|
+
putAgentApi,
|
|
98
|
+
deleteAgentApi,
|
|
99
|
+
uploadAgentApi,
|
|
100
|
+
getAgentBuffer,
|
|
101
|
+
requestResourcePackageApi,
|
|
102
|
+
requestResourcePackageRaw,
|
|
103
|
+
isTransientResourcePackageError,
|
|
104
|
+
resourcePackagePreflightChange
|
|
105
|
+
};
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
require_lib
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-2IYIYSUO.js";
|
|
5
5
|
import {
|
|
6
6
|
require_archiver,
|
|
7
7
|
require_string_decoder
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-QSAR3GHY.js";
|
|
9
9
|
import {
|
|
10
10
|
require_inherits,
|
|
11
11
|
require_node
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-T44M3PLZ.js";
|
|
13
13
|
import {
|
|
14
14
|
__commonJS,
|
|
15
15
|
__require,
|
|
16
16
|
__toESM
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-ZW4VMY5H.js";
|
|
18
18
|
|
|
19
19
|
// node_modules/exceljs/lib/utils/under-dash.js
|
|
20
20
|
var require_under_dash = __commonJS({
|
|
@@ -1,16 +1,9 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
|
-
logger
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
function normalizeUrl(url) {
|
|
8
|
-
if (!url) return url;
|
|
9
|
-
if (!url.startsWith("http://") && !url.startsWith("https://")) {
|
|
10
|
-
url = `https://${url}`;
|
|
11
|
-
}
|
|
12
|
-
return url.replace(/\/$/, "");
|
|
13
|
-
}
|
|
3
|
+
logger,
|
|
4
|
+
normalizeUrl,
|
|
5
|
+
readExternalCliToken
|
|
6
|
+
} from "./chunk-ZW4VMY5H.js";
|
|
14
7
|
|
|
15
8
|
// src/core/config.ts
|
|
16
9
|
import fs3 from "fs";
|
|
@@ -93,6 +86,10 @@ function isAeSandboxRuntime() {
|
|
|
93
86
|
var CONFIG_DIR = path.join(process.env.HOME || os.homedir(), ".ae-cli");
|
|
94
87
|
var CONFIG_FILE = path.join(CONFIG_DIR, "config.json");
|
|
95
88
|
function sandboxCliTokenCandidatePaths() {
|
|
89
|
+
if (process.env.TE_AGENT_CLI_CONFIG_DIR !== void 0) {
|
|
90
|
+
const directory = process.env.TE_AGENT_CLI_CONFIG_DIR;
|
|
91
|
+
return path.isAbsolute(directory) ? [path.join(directory, "cli-token.json")] : [];
|
|
92
|
+
}
|
|
96
93
|
const paths = [getSandboxCliTokenFilePath()];
|
|
97
94
|
const homeFallback = path.join(process.env.HOME || os.homedir(), ".ae-config", "cli-token.json");
|
|
98
95
|
if (!paths.includes(homeFallback)) {
|
|
@@ -108,7 +105,7 @@ function readSandboxCliTokenEntry() {
|
|
|
108
105
|
if (data && typeof data === "object" && !Array.isArray(data)) {
|
|
109
106
|
const url = data.url;
|
|
110
107
|
const token = data.token ?? data["cli-token"];
|
|
111
|
-
if (url && token) {
|
|
108
|
+
if (typeof url === "string" && url && typeof token === "string" && token) {
|
|
112
109
|
return { url, token };
|
|
113
110
|
}
|
|
114
111
|
}
|
|
@@ -196,6 +193,8 @@ function saveConfig(config) {
|
|
|
196
193
|
logger.info(`Config saved: activeHost=${config.activeHost}, hosts=${Object.keys(config.hosts).length}`);
|
|
197
194
|
}
|
|
198
195
|
function getActiveHost() {
|
|
196
|
+
const externalHost = readExternalCliToken()?.url;
|
|
197
|
+
if (externalHost) return externalHost;
|
|
199
198
|
const sandboxHost = readSandboxCliTokenEntry()?.url;
|
|
200
199
|
if (sandboxHost) return sandboxHost;
|
|
201
200
|
const config = loadConfig();
|
|
@@ -281,7 +280,6 @@ function getConfigDir() {
|
|
|
281
280
|
export {
|
|
282
281
|
safeJsonParse,
|
|
283
282
|
safeReadJsonFile,
|
|
284
|
-
normalizeUrl,
|
|
285
283
|
getSandboxRuntimeRoot,
|
|
286
284
|
isAeSandboxRuntime,
|
|
287
285
|
readSandboxCliTokenEntry,
|
|
@@ -6,13 +6,14 @@ import {
|
|
|
6
6
|
SecureStoreAuthError,
|
|
7
7
|
clearCliTokenCache,
|
|
8
8
|
getCliToken
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-P7KL7IOH.js";
|
|
10
10
|
import {
|
|
11
11
|
safeJsonParse
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-LMCYSVVA.js";
|
|
13
13
|
import {
|
|
14
|
-
PermissionError
|
|
15
|
-
|
|
14
|
+
PermissionError,
|
|
15
|
+
externalCliTokenRequestOptions
|
|
16
|
+
} from "./chunk-ZW4VMY5H.js";
|
|
16
17
|
|
|
17
18
|
// src/core/cli-agent-context.ts
|
|
18
19
|
import { readFileSync, statSync } from "fs";
|
|
@@ -306,7 +307,13 @@ async function permissionError(resp) {
|
|
|
306
307
|
const body = safeJsonParse(await codeResponse.text());
|
|
307
308
|
const error = isRecord(body?.error) ? body.error : void 0;
|
|
308
309
|
const code = nonEmptyString(error?.code) ?? nonEmptyString(body?.code);
|
|
309
|
-
return new PermissionError(
|
|
310
|
+
return new PermissionError(
|
|
311
|
+
message,
|
|
312
|
+
code,
|
|
313
|
+
nonEmptyString(error?.hint),
|
|
314
|
+
void 0,
|
|
315
|
+
isRecord(body?.meta) ? body.meta : void 0
|
|
316
|
+
);
|
|
310
317
|
}
|
|
311
318
|
function isInvalidCliTokenMessage(message) {
|
|
312
319
|
return /\byour token is invalid\b/i.test(message) || /\bcli[-_\s]?token\b.*\binvalid\b/i.test(message) || /\binvalid\b.*\bcli[-_\s]?token\b/i.test(message);
|
|
@@ -402,11 +409,12 @@ async function requestOnce(url, method, token, body, accept = "application/json"
|
|
|
402
409
|
headers["Content-Type"] = "application/json";
|
|
403
410
|
init.body = JSON.stringify(includeClientContextInBody ? withCliAgentContextBody(body, agentContext) : body);
|
|
404
411
|
}
|
|
405
|
-
return fetch(url, init);
|
|
412
|
+
return fetch(url, { ...init, ...externalCliTokenRequestOptions(url) });
|
|
406
413
|
}
|
|
407
414
|
async function requestMultipartOnce(url, token, form) {
|
|
408
415
|
return fetch(url, {
|
|
409
416
|
method: "POST",
|
|
417
|
+
...externalCliTokenRequestOptions(url),
|
|
410
418
|
headers: {
|
|
411
419
|
"cli-token": token,
|
|
412
420
|
"Accept": "application/json",
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
|
-
getActiveHost
|
|
3
|
+
getActiveHost
|
|
4
|
+
} from "./chunk-LMCYSVVA.js";
|
|
5
|
+
import {
|
|
4
6
|
normalizeUrl
|
|
5
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-ZW4VMY5H.js";
|
|
6
8
|
|
|
7
9
|
// src/core/auth.ts
|
|
8
10
|
function resolveHost(hostOverride) {
|