@thinkingai/ae-cli 6.1.27 → 6.1.28
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 +29 -3
- package/README.zh.md +29 -3
- package/dist/{auth-WA7YGGRT.js → auth-NKD5Z5BQ.js} +150 -38
- package/dist/{automation-VAAQBM7Y.js → automation-K32V2NKP.js} +94 -38
- package/dist/{capability-GAAYJ3IQ.js → capability-4CGSL7PK.js} +9 -8
- package/dist/{chunk-CT7QDJS6.js → chunk-2IYIYSUO.js} +2 -2
- package/dist/{chunk-3YVEAZUN.js → chunk-2UWS5CUP.js} +32 -21
- package/dist/{chunk-6VNIR4AP.js → chunk-ELCR235M.js} +26 -19
- package/dist/{chunk-RPBOAQQQ.js → chunk-GI5BMEZO.js} +1 -1
- package/dist/{chunk-7KU2WNQE.js → chunk-GTPWDLTE.js} +7 -6
- 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-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-VZZNLV3I.js → chunk-QW3R6O7L.js} +14 -6
- package/dist/{chunk-S6M42KND.js → chunk-T44M3PLZ.js} +1 -1
- package/dist/{chunk-AQJPNWZF.js → chunk-UF244C5C.js} +3 -3
- package/dist/{chunk-MWIA43UJ.js → chunk-UJ7UPRXK.js} +3 -3
- package/dist/{chunk-Q5US7JC5.js → chunk-UUD5RB36.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-JOD5DOPE.js → config-ASSAAIOI.js} +6 -5
- 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 +96 -52
- 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-NR3PHR23.js → metadata-YGI5M6OF.js} +8 -8
- package/dist/{model-VX5M2CJ6.js → model-DPJHSD73.js} +4 -4
- package/dist/{personal-semantic-preference-2RAI36P3.js → personal-semantic-preference-76TBKAPY.js} +6 -6
- package/dist/{project-semantic-3BUGP3ZM.js → project-semantic-XOEBO2Q5.js} +6 -6
- package/dist/{sync-RZIAV37C.js → sync-7PP6KQ75.js} +7 -7
- package/dist/{te-agent-AORRE2FM.js → te-agent-PJVAPKBD.js} +753 -94
- package/dist/{te-analysis-GP7DSQ7Q.js → te-analysis-OX62G5VD.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-2CO6LRCX.js → te-engage-X3DIXPRA.js} +6 -6
- package/dist/{te-experiment-652CLXMU.js → te-experiment-MEIIK3DP.js} +6 -6
- package/dist/{te-kb-ULATOTQ3.js → te-kb-73EWDFDF.js} +7 -7
- package/dist/{te-system-UGHVKBVV.js → te-system-IE7NCKC3.js} +6 -6
- package/dist/{te-team-YA6SNOJ3.js → te-team-MGQ5CNRW.js} +63 -41
- package/dist/{things-DTCOQIQB.js → things-4JIBCA55.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 +13 -8
- package/skills/ae-agent/SKILL.md +22 -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-kb/SKILL.md +1 -2
- 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-system/SKILL.md +1 -1
- 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/skills/ae-workspace/SKILL.md +1 -1
- package/dist/chunk-CI24BDR2.js +0 -43
|
@@ -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,
|
|
@@ -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) {
|
|
@@ -3,14 +3,17 @@ import {
|
|
|
3
3
|
getActiveHost,
|
|
4
4
|
getConfigDir,
|
|
5
5
|
getFallbackCliToken,
|
|
6
|
-
|
|
6
|
+
readSandboxCliTokenEntry,
|
|
7
7
|
safeJsonParse,
|
|
8
8
|
safeReadJsonFile
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-LMCYSVVA.js";
|
|
10
10
|
import {
|
|
11
11
|
PermissionError,
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
externalCliTokenRequestOptions,
|
|
13
|
+
logger,
|
|
14
|
+
normalizeUrl,
|
|
15
|
+
readExternalCliToken
|
|
16
|
+
} from "./chunk-ZW4VMY5H.js";
|
|
14
17
|
|
|
15
18
|
// src/core/secure-store.ts
|
|
16
19
|
import crypto from "crypto";
|
|
@@ -696,7 +699,8 @@ async function validateCliTokenOnServer(hostUrl, cliToken) {
|
|
|
696
699
|
try {
|
|
697
700
|
resp = await fetch(url, {
|
|
698
701
|
method: "GET",
|
|
699
|
-
headers: { Accept: "application/json", "cli-token": cliToken }
|
|
702
|
+
headers: { Accept: "application/json", "cli-token": cliToken },
|
|
703
|
+
...externalCliTokenRequestOptions(url)
|
|
700
704
|
});
|
|
701
705
|
} catch (error) {
|
|
702
706
|
throw new CliTokenValidationUnavailableError(`Unable to validate CLI token for ${hostUrl}: ${error.message}`);
|
|
@@ -734,10 +738,14 @@ async function validateCliTokenOnServer(hostUrl, cliToken) {
|
|
|
734
738
|
...cliTokenExpiresAt ? { cliTokenExpiresAt } : {}
|
|
735
739
|
};
|
|
736
740
|
}
|
|
737
|
-
async function renewCliTokenOnServer(hostUrl, cliToken) {
|
|
741
|
+
async function renewCliTokenOnServer(hostUrl, cliToken, external = false) {
|
|
738
742
|
const url = new URL(`${hostUrl.replace(/\/+$/, "")}${CLI_TOKEN_RENEW_PATH}`);
|
|
739
|
-
url.searchParams.set("cli-token", cliToken);
|
|
740
|
-
const resp = await fetch(url.toString(), {
|
|
743
|
+
if (!external) url.searchParams.set("cli-token", cliToken);
|
|
744
|
+
const resp = await fetch(url.toString(), {
|
|
745
|
+
method: "GET",
|
|
746
|
+
headers: { Accept: "application/json", ...external ? { "cli-token": cliToken } : {} },
|
|
747
|
+
...externalCliTokenRequestOptions(url.toString())
|
|
748
|
+
});
|
|
741
749
|
const text = await resp.text();
|
|
742
750
|
let data;
|
|
743
751
|
try {
|
|
@@ -750,10 +758,10 @@ async function renewCliTokenOnServer(hostUrl, cliToken) {
|
|
|
750
758
|
throw new Error(`CLI token renew error: ${data.return_message || "unknown"} (code: ${data.return_code})`);
|
|
751
759
|
}
|
|
752
760
|
}
|
|
753
|
-
async function maybeRenewCliTokenDaily(hostUrl, cliToken) {
|
|
761
|
+
async function maybeRenewCliTokenDaily(hostUrl, cliToken, external = false) {
|
|
754
762
|
const key = renewKey(hostUrl, cliToken);
|
|
755
763
|
const today = localRenewDate();
|
|
756
|
-
if (renewedLocalDate.get(key) === today || persistedRenewDate(hostUrl, cliToken) === today) {
|
|
764
|
+
if (renewedLocalDate.get(key) === today || !external && persistedRenewDate(hostUrl, cliToken) === today) {
|
|
757
765
|
renewedLocalDate.set(key, today);
|
|
758
766
|
return;
|
|
759
767
|
}
|
|
@@ -761,11 +769,12 @@ async function maybeRenewCliTokenDaily(hostUrl, cliToken) {
|
|
|
761
769
|
if (existing) return existing;
|
|
762
770
|
const attempt = (async () => {
|
|
763
771
|
try {
|
|
764
|
-
await renewCliTokenOnServer(hostUrl, cliToken);
|
|
765
|
-
|
|
772
|
+
await renewCliTokenOnServer(hostUrl, cliToken, external);
|
|
773
|
+
if (external) renewedLocalDate.set(key, today);
|
|
774
|
+
else markRenewSucceeded(hostUrl, cliToken, today);
|
|
766
775
|
logger.info(`cli-token: renewed for ${normalizeUrl(hostUrl)} (local day ${today})`);
|
|
767
776
|
} catch (error) {
|
|
768
|
-
logger.warn(`cli-token: renew failed for ${normalizeUrl(hostUrl)}: ${error?.message || error}; business call proceeds`);
|
|
777
|
+
logger.warn(`cli-token: renew failed for ${normalizeUrl(hostUrl)}${external ? "" : `: ${error?.message || error}`}; business call proceeds`);
|
|
769
778
|
} finally {
|
|
770
779
|
renewInFlight.delete(key);
|
|
771
780
|
}
|
|
@@ -774,6 +783,9 @@ async function maybeRenewCliTokenDaily(hostUrl, cliToken) {
|
|
|
774
783
|
await attempt;
|
|
775
784
|
}
|
|
776
785
|
function peekCliToken(hostOverride) {
|
|
786
|
+
const external = readExternalCliToken(hostOverride);
|
|
787
|
+
if (external) return external.token;
|
|
788
|
+
if (process.env.TE_AGENT_CLI_CONFIG_DIR !== void 0) return sessionCliToken(hostOverride);
|
|
777
789
|
const hostUrl = hostOverride || getActiveHost();
|
|
778
790
|
if (!hostUrl) return void 0;
|
|
779
791
|
const normalizedHost = normalizeUrl(hostUrl);
|
|
@@ -791,6 +803,16 @@ function peekCliToken(hostOverride) {
|
|
|
791
803
|
return cliTokenCache.get(normalizedHost) || getFallbackCliToken(normalizedHost) || void 0;
|
|
792
804
|
}
|
|
793
805
|
async function getCliToken(hostOverride) {
|
|
806
|
+
const external = readExternalCliToken(hostOverride);
|
|
807
|
+
if (external) {
|
|
808
|
+
await maybeRenewCliTokenDaily(external.url, external.token, true);
|
|
809
|
+
return external.token;
|
|
810
|
+
}
|
|
811
|
+
if (process.env.TE_AGENT_CLI_CONFIG_DIR !== void 0) {
|
|
812
|
+
const token2 = sessionCliToken(hostOverride);
|
|
813
|
+
if (!token2) throw new SecureStoreAuthError("Current session CLI credential is unavailable or does not match the requested host.");
|
|
814
|
+
return token2;
|
|
815
|
+
}
|
|
794
816
|
const resolvedHost = hostOverride || getActiveHost();
|
|
795
817
|
if (!resolvedHost) throw new SecureStoreAuthError("No AE host configured. Run: ae-cli auth login --host <url>");
|
|
796
818
|
const hostUrl = normalizeUrl(resolvedHost);
|
|
@@ -803,6 +825,12 @@ async function getCliToken(hostOverride) {
|
|
|
803
825
|
await maybeRenewCliTokenDaily(hostUrl, token);
|
|
804
826
|
return token;
|
|
805
827
|
}
|
|
828
|
+
function sessionCliToken(hostOverride) {
|
|
829
|
+
const entry = readSandboxCliTokenEntry();
|
|
830
|
+
if (!entry?.token.startsWith("cli_")) return void 0;
|
|
831
|
+
if (hostOverride && normalizeUrl(entry.url) !== normalizeUrl(hostOverride)) return void 0;
|
|
832
|
+
return entry.token;
|
|
833
|
+
}
|
|
806
834
|
async function mintCliToken(hostUrl, accessToken) {
|
|
807
835
|
logger.info(`Generating CLI token for ${hostUrl}`);
|
|
808
836
|
const cliToken = await generateCliToken(hostUrl, accessToken);
|
|
@@ -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-T44M3PLZ.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-ZW4VMY5H.js";
|
|
16
16
|
|
|
17
17
|
// node_modules/readdir-glob/node_modules/minimatch/lib/path.js
|
|
18
18
|
var require_path = __commonJS({
|
|
@@ -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) ?? nonEmptyString(body?.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",
|
|
@@ -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-ZW4VMY5H.js";
|
|
6
6
|
|
|
7
7
|
// node_modules/process-nextick-args/index.js
|
|
8
8
|
var require_process_nextick_args = __commonJS({
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
CapabilityGatewayError,
|
|
4
4
|
fetchCapabilityGateway,
|
|
5
5
|
requestCapabilityGateway
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-QW3R6O7L.js";
|
|
7
7
|
import {
|
|
8
8
|
resolveGatewayDomain
|
|
9
9
|
} from "./chunk-KPQY44JQ.js";
|
|
@@ -11,10 +11,10 @@ import {
|
|
|
11
11
|
readOutputMetadata,
|
|
12
12
|
unwrapOutputData,
|
|
13
13
|
withOutputMetadata
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-ELCR235M.js";
|
|
15
15
|
import {
|
|
16
16
|
PermissionError
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-ZW4VMY5H.js";
|
|
18
18
|
|
|
19
19
|
// src/core/analysis-async-artifact.ts
|
|
20
20
|
import { randomBytes } from "crypto";
|
|
@@ -3,16 +3,16 @@ import {
|
|
|
3
3
|
dryRunCapability,
|
|
4
4
|
executeCapabilityWithEnvelope,
|
|
5
5
|
validateCapability
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-QW3R6O7L.js";
|
|
7
7
|
import {
|
|
8
8
|
resolveGatewayDomain
|
|
9
9
|
} from "./chunk-KPQY44JQ.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";
|
|
@@ -9,15 +9,15 @@ import {
|
|
|
9
9
|
postAgentApi,
|
|
10
10
|
putAgentApi,
|
|
11
11
|
uploadAgentApi
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-JJJIP2XQ.js";
|
|
13
13
|
import {
|
|
14
14
|
TeAgentApiError,
|
|
15
15
|
createTeAgentApiError
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-2UWS5CUP.js";
|
|
17
17
|
import {
|
|
18
18
|
CliValidationError,
|
|
19
19
|
isApiErrorType
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-ZW4VMY5H.js";
|
|
21
21
|
|
|
22
22
|
// src/commands/workspace/client.ts
|
|
23
23
|
var DEFAULT_TE_CLAUDE_BASE_PATH = "/agent";
|