@thinkingai/ae-cli 6.1.28 → 6.1.29
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 -4
- package/README.zh.md +24 -4
- package/bin/ae-cli.js +5 -0
- package/bin/runtime-capabilities.json +5 -0
- package/cli-installation-guide.md +24 -3
- package/dist/{auth-NKD5Z5BQ.js → auth-OBQ5KVQM.js} +30 -12
- package/dist/{automation-K32V2NKP.js → automation-NAR5DDGL.js} +6 -6
- package/dist/{capability-4CGSL7PK.js → capability-LFSVNI5B.js} +54 -26
- package/dist/chunk-2UW3Y463.js +2289 -0
- package/dist/{chunk-QW3R6O7L.js → chunk-3SDHJOCR.js} +57 -15
- package/dist/chunk-6HAUVWOQ.js +132 -0
- package/dist/{chunk-KHS64JZQ.js → chunk-72NJKS7O.js} +4 -4
- package/dist/{chunk-UUD5RB36.js → chunk-7JAVT5TK.js} +3 -3
- package/dist/{chunk-GTPWDLTE.js → chunk-CVCTFLSO.js} +35 -14
- package/dist/{chunk-P7KL7IOH.js → chunk-H3K5UGYC.js} +2 -2
- package/dist/{chunk-P6VFCH3P.js → chunk-IN7KKL6K.js} +2 -2
- package/dist/{chunk-T44M3PLZ.js → chunk-JEUXDY3B.js} +1 -1
- package/dist/{chunk-LMCYSVVA.js → chunk-JNVVJ273.js} +51 -37
- package/dist/{chunk-JJJIP2XQ.js → chunk-N6XBLRB7.js} +2 -2
- package/dist/{chunk-QSAR3GHY.js → chunk-OAWPT7VP.js} +2 -2
- package/dist/{chunk-UF244C5C.js → chunk-PWXDWMCW.js} +7 -7
- package/dist/{chunk-2IYIYSUO.js → chunk-QVRIDN42.js} +2 -2
- package/dist/chunk-QZLRHGVH.js +222 -0
- package/dist/{chunk-GI5BMEZO.js → chunk-QZUVLFNR.js} +1 -1
- package/dist/{chunk-2UWS5CUP.js → chunk-RJHGDWSC.js} +3 -3
- package/dist/{chunk-UJ7UPRXK.js → chunk-VCZE3IWO.js} +10 -8
- package/dist/{chunk-X7DRLE62.js → chunk-YVG6QD3V.js} +1 -1
- package/dist/{chunk-ZW4VMY5H.js → chunk-Z3Q2AEIN.js} +152 -98
- package/dist/{community-report-client-S2K3A3Q6.js → community-report-client-TJVCLZ3K.js} +1 -1
- package/dist/compat-check-CII6B74E.js +32 -0
- package/dist/{config-ASSAAIOI.js → config-YZ6O2UQ2.js} +38 -6
- package/dist/{context-6RWLVOM5.js → context-F6FCGTF3.js} +4 -4
- package/dist/{data-integration-EXSUPUDZ.js → data-integration-6UAZO4GG.js} +207 -24
- package/dist/{evaluation-5YT4QLCL.js → evaluation-4LO2O4AF.js} +4 -4
- package/dist/index.js +297 -70
- package/dist/{local-data-upload-client-7HCPGIS3.js → local-data-upload-client-KCMG6J62.js} +1 -1
- package/dist/{memory-VCYLVPMI.js → memory-HHPX3NF2.js} +6 -6
- package/dist/{metadata-YGI5M6OF.js → metadata-TIFY24LW.js} +16 -8
- package/dist/{model-DPJHSD73.js → model-7UHGWYVR.js} +4 -4
- package/dist/{personal-semantic-preference-76TBKAPY.js → personal-semantic-preference-WKJEGPTM.js} +7 -6
- package/dist/{project-semantic-XOEBO2Q5.js → project-semantic-EIQVZNHW.js} +11 -10
- package/dist/{sync-7PP6KQ75.js → sync-RV3OPCTI.js} +8 -7
- package/dist/{te-agent-PJVAPKBD.js → te-agent-5ENVZJUH.js} +11 -7
- package/dist/{te-analysis-OX62G5VD.js → te-analysis-USIK6ZZG.js} +185 -33
- package/dist/{te-community-QN3WMPNT.js → te-community-WE2UU4XV.js} +720 -228
- package/dist/{te-dataops-UKD2XN3E.js → te-dataops-XNMO7MBF.js} +6 -5
- package/dist/{te-engage-X3DIXPRA.js → te-engage-6C3HCFQR.js} +13 -12
- package/dist/{te-experiment-MEIIK3DP.js → te-experiment-LVTRI3QK.js} +55 -21
- package/dist/{te-kb-73EWDFDF.js → te-kb-TUPGMVBY.js} +409 -85
- package/dist/{te-system-IE7NCKC3.js → te-system-YM657FKO.js} +6 -6
- package/dist/{te-team-MGQ5CNRW.js → te-team-G4VEJJNL.js} +7 -6
- package/dist/{things-4JIBCA55.js → things-22KQWC23.js} +7 -7
- package/dist/{update-AX66IFMJ.js → update-XX4ILU7X.js} +11 -7
- package/dist/{workspace-Q5NMEKEN.js → workspace-LYDAP647.js} +6 -6
- package/package.json +17 -7
- package/skills/ae-agent/references/resource-package.md +4 -0
- package/skills/ae-analysis/SKILL.md +14 -10
- package/skills/ae-analysis/references/agent_review_preflight.md +52 -11
- package/skills/ae-analysis/references/agent_review_priorities_comparisons.md +5 -3
- package/skills/ae-analysis/references/agent_review_submit_to_page.md +57 -25
- package/skills/ae-analysis/references/command_index.md +7 -3
- package/skills/ae-analysis/references/governance_recommendation_export.md +31 -17
- package/skills/ae-analysis/references/governance_recommendation_run_update.md +13 -0
- package/skills/ae-analysis/references/project_semantic_knowledge_wiki.md +9 -1
- package/skills/ae-analysis/references/scenario_append.md +6 -0
- package/skills/ae-analysis/references/scenario_begin.md +11 -0
- package/skills/ae-analysis/references/scenario_collect.md +10 -2
- package/skills/ae-analysis/references/scenario_evaluation.md +6 -18
- package/skills/ae-analysis/references/scenario_get.md +15 -0
- package/skills/ae-analysis/references/scenario_list.md +64 -0
- package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/company-kb.mjs +14 -1
- package/skills/ae-community/SKILL.md +77 -27
- package/skills/ae-community/references/community-analyzing-theme-comment.md +10 -8
- package/skills/ae-community/references/community-data-quality.md +68 -0
- package/skills/ae-community/references/community-query-evidence.md +85 -0
- package/skills/ae-community/references/community-scenario-capabilities.md +137 -0
- package/skills/ae-community/references/community-weekly-report.md +6 -3
- package/skills/ae-community/references/get_channel_info.md +7 -4
- package/skills/ae-community/references/get_comment_tag_analysis.md +3 -3
- package/skills/ae-community/references/get_comments_summary.md +4 -4
- package/skills/ae-community/references/get_corpus_tags.md +3 -3
- package/skills/ae-community/references/get_daily_summary.md +3 -3
- package/skills/ae-community/references/get_hot_topics.md +3 -3
- package/skills/ae-community/references/get_livestream_analysis.md +3 -3
- package/skills/ae-community/references/get_livestream_detail.md +4 -4
- package/skills/ae-community/references/get_livestream_list.md +3 -3
- package/skills/ae-community/references/get_livestream_overview.md +3 -3
- package/skills/ae-community/references/get_livestream_room_metrics.md +3 -3
- package/skills/ae-community/references/get_livestream_rooms.md +3 -3
- package/skills/ae-community/references/get_overview_metrics.md +3 -3
- package/skills/ae-community/references/get_post_detail.md +4 -4
- package/skills/ae-community/references/get_risk_content.md +5 -5
- package/skills/ae-community/references/get_sentiment_overview.md +4 -4
- package/skills/ae-community/references/get_tag_trends.md +3 -3
- package/skills/ae-community/references/get_topic_detail.md +3 -3
- package/skills/ae-community/references/list_sources.md +28 -0
- package/skills/ae-community/references/list_spaces.md +39 -0
- package/skills/ae-community/references/search_posts.md +21 -7
- package/skills/ae-data-integration/SKILL.md +6 -4
- package/skills/ae-data-integration/references/error-handling.md +1 -0
- package/skills/ae-data-integration/references/handoff.md +1 -1
- package/skills/ae-data-integration/references/sink-upload.md +11 -0
- package/skills/ae-data-integration/references/source-inspect.md +2 -1
- package/skills/ae-data-integration/references/transform.md +1 -1
- package/skills/ae-data-integration/references/ue-mapping.md +1 -1
- package/skills/ae-experiment/SKILL.md +7 -1
- package/skills/ae-experiment/references/manage_experiment.md +18 -1
- package/skills/ae-experiment/references/query_experiment_detail.md +7 -0
- package/skills/ae-experiment/references/save_experiment.md +76 -2
- package/skills/ae-experiment/references/save_submit_experiment.md +7 -0
- package/skills/ae-kb/SKILL.md +33 -6
- package/skills/ae-kb/references/publication.md +81 -0
- package/skills/ae-kb/references/query-workflow.md +14 -1
- package/skills/ae-metadata/SKILL.md +2 -2
- package/skills/ae-metadata/references/metadata_data_table_get.md +35 -0
- package/dist/chunk-ELCR235M.js +0 -1429
|
@@ -6,14 +6,15 @@ import {
|
|
|
6
6
|
SecureStoreAuthError,
|
|
7
7
|
clearCliTokenCache,
|
|
8
8
|
getCliToken
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-H3K5UGYC.js";
|
|
10
10
|
import {
|
|
11
|
-
safeJsonParse
|
|
12
|
-
|
|
11
|
+
safeJsonParse,
|
|
12
|
+
stringifyJsonRequest
|
|
13
|
+
} from "./chunk-JNVVJ273.js";
|
|
13
14
|
import {
|
|
14
15
|
PermissionError,
|
|
15
16
|
externalCliTokenRequestOptions
|
|
16
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-Z3Q2AEIN.js";
|
|
17
18
|
|
|
18
19
|
// src/core/cli-agent-context.ts
|
|
19
20
|
import { readFileSync, statSync } from "fs";
|
|
@@ -263,13 +264,14 @@ function isPlainRecord(value) {
|
|
|
263
264
|
import { readFile } from "fs/promises";
|
|
264
265
|
import { basename } from "path";
|
|
265
266
|
var CapabilityGatewayError = class extends Error {
|
|
266
|
-
constructor(message, code, httpStatus, hint, meta, type = "api") {
|
|
267
|
+
constructor(message, code, httpStatus, hint, meta, type = "api", details) {
|
|
267
268
|
super(message);
|
|
268
269
|
this.code = code;
|
|
269
270
|
this.httpStatus = httpStatus;
|
|
270
271
|
this.hint = hint;
|
|
271
272
|
this.meta = meta;
|
|
272
273
|
this.type = type;
|
|
274
|
+
this.details = details;
|
|
273
275
|
this.name = "CapabilityGatewayError";
|
|
274
276
|
}
|
|
275
277
|
code;
|
|
@@ -277,6 +279,7 @@ var CapabilityGatewayError = class extends Error {
|
|
|
277
279
|
hint;
|
|
278
280
|
meta;
|
|
279
281
|
type;
|
|
282
|
+
details;
|
|
280
283
|
};
|
|
281
284
|
function buildCapabilityGatewayUrl(host, domain, pathAfterV1, queryParams = {}, apiVersion = "v1") {
|
|
282
285
|
const base = host.replace(/\/+$/, "");
|
|
@@ -326,7 +329,10 @@ function parseCapabilityResponse(text) {
|
|
|
326
329
|
return text;
|
|
327
330
|
}
|
|
328
331
|
}
|
|
329
|
-
function
|
|
332
|
+
function isCommunityGatewayRequest(domain, pathAfterV1) {
|
|
333
|
+
return domain.replace(/^\/+|\/+$/g, "") === "community" || /^capabilities\/community\./.test(pathAfterV1.replace(/^\/+/, ""));
|
|
334
|
+
}
|
|
335
|
+
function parseCapabilityEnvelope(body, acceptCommunityLegacyEnvelope = false) {
|
|
330
336
|
if (body == null) {
|
|
331
337
|
throw new CapabilityGatewayError("Empty capability gateway response");
|
|
332
338
|
}
|
|
@@ -348,13 +354,36 @@ function parseCapabilityEnvelope(body) {
|
|
|
348
354
|
err.http_status ?? err.httpStatus,
|
|
349
355
|
hint,
|
|
350
356
|
isRecord(body.meta) ? body.meta : void 0,
|
|
351
|
-
err.type === "validation" ? "validation" : "api"
|
|
357
|
+
err.type === "validation" ? "validation" : "api",
|
|
358
|
+
isRecord(err.details) ? err.details : void 0
|
|
352
359
|
);
|
|
353
360
|
}
|
|
361
|
+
const legacyReturnCode = acceptCommunityLegacyEnvelope ? body.return_code ?? body.returnCode : void 0;
|
|
362
|
+
if (legacyReturnCode !== void 0 && Number(legacyReturnCode) !== 0) {
|
|
363
|
+
const code = String(legacyReturnCode);
|
|
364
|
+
const rawMessage = nonEmptyString(body.return_message) ?? nonEmptyString(body.returnMessage) ?? nonEmptyString(body.message);
|
|
365
|
+
const message = safeLegacyErrorMessage(rawMessage, code);
|
|
366
|
+
throw new CapabilityGatewayError(
|
|
367
|
+
message,
|
|
368
|
+
code,
|
|
369
|
+
void 0,
|
|
370
|
+
"The community service returned a legacy error envelope. Verify that the capability gateway route is deployed on the current host.",
|
|
371
|
+
{ legacy_return_code: legacyReturnCode }
|
|
372
|
+
);
|
|
373
|
+
}
|
|
374
|
+
if (legacyReturnCode !== void 0 && Number(legacyReturnCode) === 0 && "data" in body) {
|
|
375
|
+
return { ok: true, data: body.data };
|
|
376
|
+
}
|
|
354
377
|
return { ok: true, data: body };
|
|
355
378
|
}
|
|
356
|
-
function
|
|
357
|
-
|
|
379
|
+
function safeLegacyErrorMessage(message, code) {
|
|
380
|
+
if (!message || /\n\s*at\s|stacktrace|\.java:\d+/i.test(message)) {
|
|
381
|
+
return `Capability service request failed (legacy return code ${code})`;
|
|
382
|
+
}
|
|
383
|
+
return message.slice(0, 500);
|
|
384
|
+
}
|
|
385
|
+
function unwrapCapabilityEnvelope(body, acceptCommunityLegacyEnvelope = false) {
|
|
386
|
+
return parseCapabilityEnvelope(body, acceptCommunityLegacyEnvelope).data;
|
|
358
387
|
}
|
|
359
388
|
function nonEmptyString(value) {
|
|
360
389
|
return typeof value === "string" && value.trim() ? value.trim() : void 0;
|
|
@@ -377,7 +406,8 @@ function buildCapabilityHttpError(resp, body) {
|
|
|
377
406
|
resp.status,
|
|
378
407
|
hint,
|
|
379
408
|
isRecord(body.meta) ? body.meta : void 0,
|
|
380
|
-
err.type === "validation" ? "validation" : "api"
|
|
409
|
+
err.type === "validation" ? "validation" : "api",
|
|
410
|
+
isRecord(err.details) ? err.details : void 0
|
|
381
411
|
);
|
|
382
412
|
}
|
|
383
413
|
}
|
|
@@ -407,7 +437,7 @@ async function requestOnce(url, method, token, body, accept = "application/json"
|
|
|
407
437
|
const init = { method, headers };
|
|
408
438
|
if (body !== void 0 && method !== "GET") {
|
|
409
439
|
headers["Content-Type"] = "application/json";
|
|
410
|
-
init.body =
|
|
440
|
+
init.body = stringifyJsonRequest(includeClientContextInBody ? withCliAgentContextBody(body, agentContext) : body);
|
|
411
441
|
}
|
|
412
442
|
return fetch(url, { ...init, ...externalCliTokenRequestOptions(url) });
|
|
413
443
|
}
|
|
@@ -447,7 +477,10 @@ async function callGatewayWithEnvelope(host, domain, pathAfterV1, method, body,
|
|
|
447
477
|
if (!resp.ok) {
|
|
448
478
|
await throwCapabilityHttpError(resp);
|
|
449
479
|
}
|
|
450
|
-
return parseCapabilityEnvelope(
|
|
480
|
+
return parseCapabilityEnvelope(
|
|
481
|
+
parseCapabilityResponse(await resp.text()),
|
|
482
|
+
isCommunityGatewayRequest(domain, pathAfterV1)
|
|
483
|
+
);
|
|
451
484
|
}
|
|
452
485
|
async function fetchCapabilityGateway(host, domain, pathAfterV1, method = "GET", body, accept = "application/json") {
|
|
453
486
|
const url = buildCapabilityGatewayUrl(host, domain, pathAfterV1);
|
|
@@ -467,11 +500,17 @@ async function fetchCapabilityGateway(host, domain, pathAfterV1, method = "GET",
|
|
|
467
500
|
}
|
|
468
501
|
async function requestCapabilityGateway(host, domain, pathAfterV1, method = "GET", body) {
|
|
469
502
|
const resp = await fetchCapabilityGateway(host, domain, pathAfterV1, method, body);
|
|
470
|
-
return unwrapCapabilityEnvelope(
|
|
503
|
+
return unwrapCapabilityEnvelope(
|
|
504
|
+
parseCapabilityResponse(await resp.text()),
|
|
505
|
+
isCommunityGatewayRequest(domain, pathAfterV1)
|
|
506
|
+
);
|
|
471
507
|
}
|
|
472
508
|
async function requestCapabilityGatewayWithEnvelope(host, domain, pathAfterV1, method = "GET", body) {
|
|
473
509
|
const resp = await fetchCapabilityGateway(host, domain, pathAfterV1, method, body);
|
|
474
|
-
return parseCapabilityEnvelope(
|
|
510
|
+
return parseCapabilityEnvelope(
|
|
511
|
+
parseCapabilityResponse(await resp.text()),
|
|
512
|
+
isCommunityGatewayRequest(domain, pathAfterV1)
|
|
513
|
+
);
|
|
475
514
|
}
|
|
476
515
|
async function listCapabilitiesWithEnvelope(host, domain, projectId) {
|
|
477
516
|
return callGatewayWithEnvelope(host, domain, "capabilities", "GET", void 0, { project_id: projectId });
|
|
@@ -552,7 +591,10 @@ async function uploadInputFileBytes(host, domain, projectId, purpose, bytes, fil
|
|
|
552
591
|
if (!resp.ok) {
|
|
553
592
|
await throwCapabilityHttpError(resp);
|
|
554
593
|
}
|
|
555
|
-
return unwrapCapabilityEnvelope(
|
|
594
|
+
return unwrapCapabilityEnvelope(
|
|
595
|
+
parseCapabilityResponse(await resp.text()),
|
|
596
|
+
isCommunityGatewayRequest(domain, "input-files")
|
|
597
|
+
);
|
|
556
598
|
}
|
|
557
599
|
async function callCapabilityApi(host, domain, action, method = "POST", params = {}, options = {}) {
|
|
558
600
|
const isGet = method === "GET";
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
canManageGlobalSkills,
|
|
4
|
+
fetchCliConfig,
|
|
5
|
+
getLocalCliPackageInfo,
|
|
6
|
+
isBusinessSkillContextCurrent,
|
|
7
|
+
rememberBusinessConfig,
|
|
8
|
+
reserveBusinessSkillContext,
|
|
9
|
+
syncBusinessSkills
|
|
10
|
+
} from "./chunk-2UW3Y463.js";
|
|
11
|
+
import {
|
|
12
|
+
peekCliToken
|
|
13
|
+
} from "./chunk-H3K5UGYC.js";
|
|
14
|
+
import {
|
|
15
|
+
getActiveHost,
|
|
16
|
+
getConfigDir
|
|
17
|
+
} from "./chunk-JNVVJ273.js";
|
|
18
|
+
import {
|
|
19
|
+
normalizeUrl
|
|
20
|
+
} from "./chunk-Z3Q2AEIN.js";
|
|
21
|
+
|
|
22
|
+
// src/core/environment-refresh.ts
|
|
23
|
+
import crypto from "crypto";
|
|
24
|
+
import fs from "fs";
|
|
25
|
+
import path from "path";
|
|
26
|
+
function cliTokenFingerprint(token) {
|
|
27
|
+
return crypto.createHash("sha256").update(token).digest("hex");
|
|
28
|
+
}
|
|
29
|
+
function invalidateBusinessSkillSynchronization() {
|
|
30
|
+
if (canManageGlobalSkills()) reserveBusinessSkillContext({});
|
|
31
|
+
}
|
|
32
|
+
async function refreshEnvironmentConfig(host, options = {}) {
|
|
33
|
+
const normalized = normalizeUrl(host);
|
|
34
|
+
const skipped = (reason) => ({
|
|
35
|
+
host: normalized,
|
|
36
|
+
businesses: {},
|
|
37
|
+
source: "unavailable",
|
|
38
|
+
skills: { status: "skipped", reason }
|
|
39
|
+
});
|
|
40
|
+
let token;
|
|
41
|
+
try {
|
|
42
|
+
token = peekCliToken(normalized);
|
|
43
|
+
} catch {
|
|
44
|
+
return skipped("Credentials could not be read. Sign in before refreshing Skills.");
|
|
45
|
+
}
|
|
46
|
+
if (!token) return skipped("Sign in to this environment before refreshing its business configuration.");
|
|
47
|
+
const fingerprint = cliTokenFingerprint(token);
|
|
48
|
+
const localActiveEnvironment = () => {
|
|
49
|
+
try {
|
|
50
|
+
return canManageGlobalSkills() && normalizeUrl(getActiveHost()) === normalized && cliTokenFingerprint(peekCliToken(normalized) ?? "") === fingerprint;
|
|
51
|
+
} catch {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
const synchronize = options.synchronizeSkills !== false && localActiveEnvironment();
|
|
56
|
+
const generation = synchronize ? reserveBusinessSkillContext({ host: normalized, tokenFingerprint: fingerprint }) : void 0;
|
|
57
|
+
let config;
|
|
58
|
+
try {
|
|
59
|
+
config = await (options.fetchConfig ?? fetchCliConfig)(normalized, token);
|
|
60
|
+
} catch {
|
|
61
|
+
config = null;
|
|
62
|
+
}
|
|
63
|
+
if (!config) return skipped("CLI configuration is unavailable; existing Skills were preserved.");
|
|
64
|
+
if (generation && !isBusinessSkillContextCurrent({
|
|
65
|
+
host: normalized,
|
|
66
|
+
tokenFingerprint: fingerprint,
|
|
67
|
+
generation,
|
|
68
|
+
isCurrentContext: localActiveEnvironment
|
|
69
|
+
})) {
|
|
70
|
+
return {
|
|
71
|
+
host: normalized,
|
|
72
|
+
businesses: {},
|
|
73
|
+
source: "remote",
|
|
74
|
+
skills: { status: "skipped", reason: "A newer environment refresh superseded this response." }
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
rememberBusinessConfig(normalized, token, config.businesses);
|
|
78
|
+
const result = {
|
|
79
|
+
host: normalized,
|
|
80
|
+
businesses: config.businesses ?? {},
|
|
81
|
+
source: "remote",
|
|
82
|
+
skills: { status: "skipped", reason: "Only an explicitly refreshed active local environment changes global Skills." }
|
|
83
|
+
};
|
|
84
|
+
if (config.businesses === void 0) {
|
|
85
|
+
result.skills = { status: "skipped", reason: "This server does not provide business states; existing Skills were preserved." };
|
|
86
|
+
return result;
|
|
87
|
+
}
|
|
88
|
+
if (!synchronize || !localActiveEnvironment()) return result;
|
|
89
|
+
try {
|
|
90
|
+
const syncOptions = {
|
|
91
|
+
skillsDirectory: path.join(getLocalCliPackageInfo().root, "skills"),
|
|
92
|
+
host: normalized,
|
|
93
|
+
tokenFingerprint: fingerprint,
|
|
94
|
+
businesses: config.businesses,
|
|
95
|
+
packageVersion: getLocalCliPackageInfo().version,
|
|
96
|
+
generation,
|
|
97
|
+
isCurrentContext: localActiveEnvironment
|
|
98
|
+
};
|
|
99
|
+
if (!fs.existsSync(path.join(getConfigDir(), "business-skills.json"))) {
|
|
100
|
+
const adoption = syncBusinessSkills({ ...syncOptions, mode: "adopt" });
|
|
101
|
+
if (["failed", "busy", "stale"].includes(adoption.status)) {
|
|
102
|
+
result.skills = adoption;
|
|
103
|
+
return result;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
result.skills = syncBusinessSkills(syncOptions);
|
|
107
|
+
} catch {
|
|
108
|
+
result.skills = { status: "failed", reason: "Skill synchronization could not complete. Retry: ae-cli config refresh" };
|
|
109
|
+
}
|
|
110
|
+
return result;
|
|
111
|
+
}
|
|
112
|
+
async function refreshEnvironmentAfterLogin(host) {
|
|
113
|
+
try {
|
|
114
|
+
const result = await refreshEnvironmentConfig(host);
|
|
115
|
+
if (!["success", "skipped"].includes(result.skills.status)) {
|
|
116
|
+
process.stderr.write("[ae-cli] Some Skills could not be synchronized. Run: ae-cli config refresh\n");
|
|
117
|
+
}
|
|
118
|
+
if (result.source === "unavailable") {
|
|
119
|
+
process.stderr.write("[ae-cli] Business configuration could not be refreshed. Sign in if needed, then run: ae-cli config refresh\n");
|
|
120
|
+
}
|
|
121
|
+
return result;
|
|
122
|
+
} catch {
|
|
123
|
+
process.stderr.write("[ae-cli] Business configuration could not be refreshed. Retry: ae-cli config refresh\n");
|
|
124
|
+
return void 0;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export {
|
|
129
|
+
invalidateBusinessSkillSynchronization,
|
|
130
|
+
refreshEnvironmentConfig,
|
|
131
|
+
refreshEnvironmentAfterLogin
|
|
132
|
+
};
|
|
@@ -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-QVRIDN42.js";
|
|
5
5
|
import {
|
|
6
6
|
require_archiver,
|
|
7
7
|
require_string_decoder
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-OAWPT7VP.js";
|
|
9
9
|
import {
|
|
10
10
|
require_inherits,
|
|
11
11
|
require_node
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-JEUXDY3B.js";
|
|
13
13
|
import {
|
|
14
14
|
__commonJS,
|
|
15
15
|
__require,
|
|
16
16
|
__toESM
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-Z3Q2AEIN.js";
|
|
18
18
|
|
|
19
19
|
// node_modules/exceljs/lib/utils/under-dash.js
|
|
20
20
|
var require_under_dash = __commonJS({
|
|
@@ -9,15 +9,15 @@ import {
|
|
|
9
9
|
postAgentApi,
|
|
10
10
|
putAgentApi,
|
|
11
11
|
uploadAgentApi
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-N6XBLRB7.js";
|
|
13
13
|
import {
|
|
14
14
|
TeAgentApiError,
|
|
15
15
|
createTeAgentApiError
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-RJHGDWSC.js";
|
|
17
17
|
import {
|
|
18
18
|
CliValidationError,
|
|
19
19
|
isApiErrorType
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-Z3Q2AEIN.js";
|
|
21
21
|
|
|
22
22
|
// src/commands/workspace/client.ts
|
|
23
23
|
var DEFAULT_TE_CLAUDE_BASE_PATH = "/agent";
|
|
@@ -1,18 +1,21 @@
|
|
|
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-3SDHJOCR.js";
|
|
5
5
|
import {
|
|
6
6
|
SecureStoreAuthError,
|
|
7
7
|
getCliToken
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-H3K5UGYC.js";
|
|
9
9
|
import {
|
|
10
10
|
safeJsonParse
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-JNVVJ273.js";
|
|
12
12
|
import {
|
|
13
13
|
PermissionError,
|
|
14
|
-
externalCliTokenRequestOptions
|
|
15
|
-
|
|
14
|
+
externalCliTokenRequestOptions,
|
|
15
|
+
isKbQueryPath,
|
|
16
|
+
kbReadHeaders,
|
|
17
|
+
readKbExecutionContext
|
|
18
|
+
} from "./chunk-Z3Q2AEIN.js";
|
|
16
19
|
|
|
17
20
|
// src/core/mcp-access.ts
|
|
18
21
|
function buildUrl(host, path, params = {}) {
|
|
@@ -218,18 +221,36 @@ async function getAuthHeaders(ctx) {
|
|
|
218
221
|
return { "cli-token": cliToken };
|
|
219
222
|
}
|
|
220
223
|
async function kbApi(ctx, method, path, params = {}, body, options = {}) {
|
|
221
|
-
const host = ctx.host();
|
|
222
224
|
const upperMethod = method.toUpperCase();
|
|
225
|
+
const isQuery = isKbQueryPath(upperMethod, path);
|
|
226
|
+
const execution = isQuery ? readKbExecutionContext() : void 0;
|
|
227
|
+
const host = execution ? ctx.hostOverride?.() || execution.origin : ctx.host();
|
|
228
|
+
const selectedHost = execution && !ctx.hostOverride ? ctx.host() : host;
|
|
229
|
+
const url = buildUrl(selectedHost, path, params);
|
|
230
|
+
const queryHeaders = isQuery ? kbReadHeaders(url, ctx.str("read-context")) : void 0;
|
|
231
|
+
const init = {
|
|
232
|
+
method: upperMethod,
|
|
233
|
+
headers: { "Content-Type": "application/json", ...queryHeaders },
|
|
234
|
+
body: upperMethod === "GET" ? void 0 : JSON.stringify(body ?? {})
|
|
235
|
+
};
|
|
236
|
+
if (execution) {
|
|
237
|
+
const response = await fetch(url, { ...init, redirect: "error" });
|
|
238
|
+
const text = await response.text();
|
|
239
|
+
if (!response.ok) {
|
|
240
|
+
let code = "KB_READ_CONTEXT_REQUEST_FAILED";
|
|
241
|
+
try {
|
|
242
|
+
const value = responseErrorMetadata(safeJsonParse(text)).code;
|
|
243
|
+
if (value?.startsWith("KB_READ_CONTEXT_")) code = value;
|
|
244
|
+
} catch {
|
|
245
|
+
}
|
|
246
|
+
throw new KbHttpError(code, code, response.status);
|
|
247
|
+
}
|
|
248
|
+
return parseKbResponse(response, text, { ...options, redactErrorDetails: true });
|
|
249
|
+
}
|
|
223
250
|
return requestWithCliToken(
|
|
224
251
|
host,
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
method: upperMethod,
|
|
228
|
-
headers: {
|
|
229
|
-
"Content-Type": "application/json"
|
|
230
|
-
},
|
|
231
|
-
body: upperMethod === "GET" ? void 0 : JSON.stringify(body ?? {})
|
|
232
|
-
},
|
|
252
|
+
url,
|
|
253
|
+
init,
|
|
233
254
|
options
|
|
234
255
|
);
|
|
235
256
|
}
|
|
@@ -6,14 +6,14 @@ import {
|
|
|
6
6
|
readSandboxCliTokenEntry,
|
|
7
7
|
safeJsonParse,
|
|
8
8
|
safeReadJsonFile
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-JNVVJ273.js";
|
|
10
10
|
import {
|
|
11
11
|
PermissionError,
|
|
12
12
|
externalCliTokenRequestOptions,
|
|
13
13
|
logger,
|
|
14
14
|
normalizeUrl,
|
|
15
15
|
readExternalCliToken
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-Z3Q2AEIN.js";
|
|
17
17
|
|
|
18
18
|
// src/core/secure-store.ts
|
|
19
19
|
import crypto from "crypto";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
getActiveHost
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-JNVVJ273.js";
|
|
5
5
|
import {
|
|
6
6
|
normalizeUrl
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-Z3Q2AEIN.js";
|
|
8
8
|
|
|
9
9
|
// src/core/auth.ts
|
|
10
10
|
function resolveHost(hostOverride) {
|
|
@@ -2,7 +2,7 @@ import { createRequire as __createRequire } from 'node:module'; const require =
|
|
|
2
2
|
import {
|
|
3
3
|
__commonJS,
|
|
4
4
|
__require
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-Z3Q2AEIN.js";
|
|
6
6
|
|
|
7
7
|
// node_modules/process-nextick-args/index.js
|
|
8
8
|
var require_process_nextick_args = __commonJS({
|
|
@@ -3,7 +3,43 @@ import {
|
|
|
3
3
|
logger,
|
|
4
4
|
normalizeUrl,
|
|
5
5
|
readExternalCliToken
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-Z3Q2AEIN.js";
|
|
7
|
+
|
|
8
|
+
// src/core/sandbox-runtime.ts
|
|
9
|
+
import { homedir } from "os";
|
|
10
|
+
import { join } from "path";
|
|
11
|
+
import fs from "fs";
|
|
12
|
+
var LINUX_SANDBOX_RUNTIME_ROOT = "/home/ta/te_agent_ta";
|
|
13
|
+
function getDefaultSandboxRuntimeRoot() {
|
|
14
|
+
if (process.platform === "linux") {
|
|
15
|
+
return LINUX_SANDBOX_RUNTIME_ROOT;
|
|
16
|
+
}
|
|
17
|
+
return homedir();
|
|
18
|
+
}
|
|
19
|
+
function getSandboxRuntimeRoot() {
|
|
20
|
+
return process.env.SANDBOX_RUNTIME_ROOT || getDefaultSandboxRuntimeRoot();
|
|
21
|
+
}
|
|
22
|
+
function getSandboxAeConfigDir() {
|
|
23
|
+
return join(getSandboxRuntimeRoot(), ".ae-config");
|
|
24
|
+
}
|
|
25
|
+
function getSandboxCliTokenFilePath() {
|
|
26
|
+
return join(getSandboxAeConfigDir(), "cli-token.json");
|
|
27
|
+
}
|
|
28
|
+
function isAeSandboxRuntime() {
|
|
29
|
+
if (process.env.SANDBOX_RUNTIME_ROOT) {
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
if (process.platform !== "linux") {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
try {
|
|
36
|
+
if (fs.existsSync(getSandboxCliTokenFilePath())) {
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
} catch {
|
|
40
|
+
}
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
7
43
|
|
|
8
44
|
// src/core/config.ts
|
|
9
45
|
import fs3 from "fs";
|
|
@@ -11,11 +47,17 @@ import path from "path";
|
|
|
11
47
|
import os from "os";
|
|
12
48
|
|
|
13
49
|
// src/core/json-utils.ts
|
|
14
|
-
import
|
|
50
|
+
import fs2 from "fs";
|
|
15
51
|
import { createRequire } from "module";
|
|
16
52
|
var require2 = createRequire(import.meta.url);
|
|
17
53
|
var JSONbig = require2("json-bigint");
|
|
18
54
|
var jsonParser = JSONbig({ storeAsString: true });
|
|
55
|
+
var requestJsonStringifier = JSONbig({ useNativeBigInt: true });
|
|
56
|
+
var requestJsonParser = JSONbig({
|
|
57
|
+
useNativeBigInt: true,
|
|
58
|
+
protoAction: "error",
|
|
59
|
+
constructorAction: "error"
|
|
60
|
+
});
|
|
19
61
|
var INTEGER_TOKEN = /^-?(?:0|[1-9]\d*)$/;
|
|
20
62
|
function normalizeParsedNumbers(lossless, native) {
|
|
21
63
|
if (typeof lossless === "string" && typeof native === "number") {
|
|
@@ -42,44 +84,14 @@ function safeJsonParse(text) {
|
|
|
42
84
|
return normalizeParsedNumbers(lossless, JSON.parse(text));
|
|
43
85
|
}
|
|
44
86
|
function safeReadJsonFile(filePath) {
|
|
45
|
-
const content =
|
|
87
|
+
const content = fs2.readFileSync(filePath, "utf-8");
|
|
46
88
|
return safeJsonParse(content);
|
|
47
89
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
import { homedir } from "os";
|
|
51
|
-
import { join } from "path";
|
|
52
|
-
import fs2 from "fs";
|
|
53
|
-
var LINUX_SANDBOX_RUNTIME_ROOT = "/home/ta/te_agent_ta";
|
|
54
|
-
function getDefaultSandboxRuntimeRoot() {
|
|
55
|
-
if (process.platform === "linux") {
|
|
56
|
-
return LINUX_SANDBOX_RUNTIME_ROOT;
|
|
57
|
-
}
|
|
58
|
-
return homedir();
|
|
59
|
-
}
|
|
60
|
-
function getSandboxRuntimeRoot() {
|
|
61
|
-
return process.env.SANDBOX_RUNTIME_ROOT || getDefaultSandboxRuntimeRoot();
|
|
90
|
+
function stringifyJsonRequest(obj) {
|
|
91
|
+
return requestJsonStringifier.stringify(obj);
|
|
62
92
|
}
|
|
63
|
-
function
|
|
64
|
-
return
|
|
65
|
-
}
|
|
66
|
-
function getSandboxCliTokenFilePath() {
|
|
67
|
-
return join(getSandboxAeConfigDir(), "cli-token.json");
|
|
68
|
-
}
|
|
69
|
-
function isAeSandboxRuntime() {
|
|
70
|
-
if (process.env.SANDBOX_RUNTIME_ROOT) {
|
|
71
|
-
return true;
|
|
72
|
-
}
|
|
73
|
-
if (process.platform !== "linux") {
|
|
74
|
-
return false;
|
|
75
|
-
}
|
|
76
|
-
try {
|
|
77
|
-
if (fs2.existsSync(getSandboxCliTokenFilePath())) {
|
|
78
|
-
return true;
|
|
79
|
-
}
|
|
80
|
-
} catch {
|
|
81
|
-
}
|
|
82
|
-
return false;
|
|
93
|
+
function parseJsonRequest(text) {
|
|
94
|
+
return requestJsonParser.parse(text);
|
|
83
95
|
}
|
|
84
96
|
|
|
85
97
|
// src/core/config.ts
|
|
@@ -280,6 +292,8 @@ function getConfigDir() {
|
|
|
280
292
|
export {
|
|
281
293
|
safeJsonParse,
|
|
282
294
|
safeReadJsonFile,
|
|
295
|
+
stringifyJsonRequest,
|
|
296
|
+
parseJsonRequest,
|
|
283
297
|
getSandboxRuntimeRoot,
|
|
284
298
|
isAeSandboxRuntime,
|
|
285
299
|
readSandboxCliTokenEntry,
|
|
@@ -10,10 +10,10 @@ import {
|
|
|
10
10
|
postToMainApp,
|
|
11
11
|
putToMainApp,
|
|
12
12
|
uploadToMainApp
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-RJHGDWSC.js";
|
|
14
14
|
import {
|
|
15
15
|
clearCliTokenCache
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-H3K5UGYC.js";
|
|
17
17
|
|
|
18
18
|
// src/core/resource-package-client.ts
|
|
19
19
|
function checkPath(path) {
|
|
@@ -5,14 +5,14 @@ import {
|
|
|
5
5
|
require_node,
|
|
6
6
|
require_process_nextick_args,
|
|
7
7
|
require_util
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-JEUXDY3B.js";
|
|
9
9
|
import {
|
|
10
10
|
__commonJS,
|
|
11
11
|
__esm,
|
|
12
12
|
__export,
|
|
13
13
|
__require,
|
|
14
14
|
__toCommonJS
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-Z3Q2AEIN.js";
|
|
16
16
|
|
|
17
17
|
// node_modules/readdir-glob/node_modules/minimatch/lib/path.js
|
|
18
18
|
var require_path = __commonJS({
|
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
CapabilityGatewayError,
|
|
4
|
-
fetchCapabilityGateway,
|
|
5
|
-
requestCapabilityGateway
|
|
6
|
-
} from "./chunk-QW3R6O7L.js";
|
|
7
2
|
import {
|
|
8
3
|
resolveGatewayDomain
|
|
9
4
|
} from "./chunk-KPQY44JQ.js";
|
|
@@ -11,10 +6,15 @@ import {
|
|
|
11
6
|
readOutputMetadata,
|
|
12
7
|
unwrapOutputData,
|
|
13
8
|
withOutputMetadata
|
|
14
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-QZLRHGVH.js";
|
|
10
|
+
import {
|
|
11
|
+
CapabilityGatewayError,
|
|
12
|
+
fetchCapabilityGateway,
|
|
13
|
+
requestCapabilityGateway
|
|
14
|
+
} from "./chunk-3SDHJOCR.js";
|
|
15
15
|
import {
|
|
16
16
|
PermissionError
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-Z3Q2AEIN.js";
|
|
18
18
|
|
|
19
19
|
// src/core/analysis-async-artifact.ts
|
|
20
20
|
import { randomBytes } from "crypto";
|
|
@@ -5,11 +5,11 @@ import {
|
|
|
5
5
|
require_node,
|
|
6
6
|
require_process_nextick_args,
|
|
7
7
|
require_util
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-JEUXDY3B.js";
|
|
9
9
|
import {
|
|
10
10
|
__commonJS,
|
|
11
11
|
__require
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-Z3Q2AEIN.js";
|
|
13
13
|
|
|
14
14
|
// node_modules/jszip/node_modules/readable-stream/lib/internal/streams/stream.js
|
|
15
15
|
var require_stream = __commonJS({
|