@thinkingai/ae-cli 1.0.28 → 1.0.30
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 +1 -16
- package/README.zh.md +1 -16
- package/dist/{auth-5NSDQFQB.js → auth-H3GJD55A.js} +8 -5
- package/dist/{auth-H2376DEF.js → auth-U25QJU5D.js} +2 -1
- package/dist/{chunk-IMBKVXKY.js → chunk-EGEIXA2Z.js} +82 -10
- package/dist/{chunk-WCHI7725.js → chunk-GLNZSDKO.js} +48 -5
- package/dist/{chunk-LU7SXK4Q.js → chunk-I42JGQ2J.js} +4 -2
- package/dist/{chunk-CAQYQA4R.js → chunk-JM34JPCO.js} +3 -163
- package/dist/chunk-NOO24N7W.js +11 -0
- package/dist/chunk-SF3KTPIC.js +98 -0
- package/dist/chunk-U6TKB3IV.js +171 -0
- package/dist/{chunk-AD5V3ZPJ.js → chunk-VJFUB3H3.js} +97 -9
- package/dist/{client-FCMK3XEK.js → client-IN42F223.js} +3 -2
- package/dist/index.js +42 -20
- package/dist/{model-EZ6K7FXI.js → model-VZCYNIOG.js} +4 -6
- package/dist/{raw-VEF3D6UD.js → raw-WJIWC6YP.js} +5 -3
- package/dist/{sync-NRODEVNH.js → sync-NVASAISS.js} +118 -21
- package/dist/{te-agent-7U7JLJKU.js → te-agent-YV4DXEXK.js} +1 -2
- package/dist/{te-analysis-A2OSGHQ4.js → te-analysis-CB3DA5I5.js} +4 -2
- package/dist/{te-audience-LI67PPGO.js → te-audience-W7SCQFC7.js} +4 -2
- package/dist/{te-common-35WVU3C5.js → te-common-FBXVWBSI.js} +4 -2
- package/dist/{te-community-LEAP6PWT.js → te-community-LNVDZSGW.js} +4 -2
- package/dist/{te-dataops-N2LGZBOX.js → te-dataops-IPCSSWYH.js} +27 -25
- package/dist/{te-engage-H7C72Z46.js → te-engage-KARARMIR.js} +4 -2
- package/dist/{te-kb-I2OKTBAI.js → te-kb-2Z2CARN3.js} +5 -3
- package/dist/{te-meta-HBTIEDRO.js → te-meta-PDKLMWXN.js} +4 -2
- package/dist/{te-team-EM5OWRQL.js → te-team-SW5B7DHO.js} +14 -9
- package/package.json +1 -1
- package/skills/ae-agent/SKILL.md +1 -1
- package/dist/chunk-KAEZTSXN.js +0 -99
- package/dist/chunk-OJDNO5QY.js +0 -63
package/dist/chunk-KAEZTSXN.js
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getSandboxRuntimeRoot
|
|
3
|
-
} from "./chunk-SRJIAOBN.js";
|
|
4
|
-
|
|
5
|
-
// src/core/te-agent-credentials.ts
|
|
6
|
-
import { readFileSync } from "fs";
|
|
7
|
-
import { homedir } from "os";
|
|
8
|
-
import { join } from "path";
|
|
9
|
-
function getCredentialsPath() {
|
|
10
|
-
return join(process.env.HOME || homedir(), ".te-agent", "credentials.json");
|
|
11
|
-
}
|
|
12
|
-
function getPersistentEnvPath() {
|
|
13
|
-
return join(getSandboxRuntimeRoot(), ".env");
|
|
14
|
-
}
|
|
15
|
-
function parseDotEnv(raw) {
|
|
16
|
-
const result = {};
|
|
17
|
-
for (const line of raw.split("\n")) {
|
|
18
|
-
if (/^\s*#/.test(line) || line.trim() === "") continue;
|
|
19
|
-
const match = /^\s*([^=]+)=(.*)$/.exec(line);
|
|
20
|
-
if (!match) continue;
|
|
21
|
-
const key = match[1].trim();
|
|
22
|
-
let value = match[2].trim();
|
|
23
|
-
if (value.startsWith('"') && value.endsWith('"')) {
|
|
24
|
-
value = value.slice(1, -1).replace(/\\"/g, '"');
|
|
25
|
-
}
|
|
26
|
-
if (value !== "") result[key] = value;
|
|
27
|
-
}
|
|
28
|
-
return result;
|
|
29
|
-
}
|
|
30
|
-
function readPersistentEnv() {
|
|
31
|
-
const envPath = getPersistentEnvPath();
|
|
32
|
-
try {
|
|
33
|
-
const raw = readFileSync(envPath, "utf8");
|
|
34
|
-
return parseDotEnv(raw);
|
|
35
|
-
} catch (err) {
|
|
36
|
-
if (err?.code === "ENOENT") return null;
|
|
37
|
-
throw new TeAgentCredentialsError(
|
|
38
|
-
`Failed to read ${envPath}: ${err?.message ?? err}`,
|
|
39
|
-
"Check file permissions, or inject runtime credentials via TE_CLAUDE_BASE_URL / SANDBOX_ID / SECRET_KEY"
|
|
40
|
-
);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
var TeAgentCredentialsError = class extends Error {
|
|
44
|
-
constructor(message, hint) {
|
|
45
|
-
super(message);
|
|
46
|
-
this.hint = hint;
|
|
47
|
-
this.name = "TeAgentCredentialsError";
|
|
48
|
-
}
|
|
49
|
-
hint;
|
|
50
|
-
};
|
|
51
|
-
function readLegacyCredentials() {
|
|
52
|
-
const credPath = getCredentialsPath();
|
|
53
|
-
try {
|
|
54
|
-
const raw = readFileSync(credPath, "utf8");
|
|
55
|
-
const parsed = JSON.parse(raw);
|
|
56
|
-
const main = parsed?.mainApp;
|
|
57
|
-
return main && typeof main === "object" ? main : null;
|
|
58
|
-
} catch (err) {
|
|
59
|
-
if (err?.code === "ENOENT") return null;
|
|
60
|
-
if (err instanceof SyntaxError) {
|
|
61
|
-
throw new TeAgentCredentialsError(
|
|
62
|
-
`Failed to parse ${credPath}: ${err.message}`,
|
|
63
|
-
"The credentials file may be corrupted; alternatively inject runtime credentials via TE_CLAUDE_BASE_URL / SANDBOX_ID / SECRET_KEY"
|
|
64
|
-
);
|
|
65
|
-
}
|
|
66
|
-
throw new TeAgentCredentialsError(
|
|
67
|
-
`Failed to read ${credPath}: ${err?.message ?? err}`,
|
|
68
|
-
"Check file permissions, or inject runtime credentials via TE_CLAUDE_BASE_URL / SANDBOX_ID / SECRET_KEY"
|
|
69
|
-
);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
function tryLoadTeAgentSandboxCredentials() {
|
|
73
|
-
const legacy = readLegacyCredentials();
|
|
74
|
-
const persistent = readPersistentEnv();
|
|
75
|
-
const url = process.env.TE_CLAUDE_BASE_URL || persistent?.TE_CLAUDE_BASE_URL || legacy?.url;
|
|
76
|
-
if (typeof url !== "string" || !url) {
|
|
77
|
-
return null;
|
|
78
|
-
}
|
|
79
|
-
const sandboxId = process.env.SANDBOX_ID || persistent?.SANDBOX_ID || legacy?.sandboxId || null;
|
|
80
|
-
const sandboxSecretKey = process.env.SECRET_KEY || process.env.SANDBOX_SECRET_KEY || persistent?.SECRET_KEY || persistent?.SANDBOX_SECRET_KEY || legacy?.sandboxSecretKey || legacy?.secretKey || null;
|
|
81
|
-
return {
|
|
82
|
-
url,
|
|
83
|
-
sandboxId: typeof sandboxId === "string" ? sandboxId : null,
|
|
84
|
-
sandboxSecretKey: typeof sandboxSecretKey === "string" ? sandboxSecretKey : null
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
function getClaudeConfigDir() {
|
|
88
|
-
const fromEnv = process.env.CLAUDE_CONFIG_DIR;
|
|
89
|
-
if (typeof fromEnv === "string" && fromEnv.length > 0) {
|
|
90
|
-
return fromEnv;
|
|
91
|
-
}
|
|
92
|
-
return join(homedir(), ".claude");
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
export {
|
|
96
|
-
TeAgentCredentialsError,
|
|
97
|
-
tryLoadTeAgentSandboxCredentials,
|
|
98
|
-
getClaudeConfigDir
|
|
99
|
-
};
|
package/dist/chunk-OJDNO5QY.js
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getMcpToken
|
|
3
|
-
} from "./chunk-WCHI7725.js";
|
|
4
|
-
import {
|
|
5
|
-
safeJsonParse
|
|
6
|
-
} from "./chunk-SRJIAOBN.js";
|
|
7
|
-
|
|
8
|
-
// src/core/mcp-access.ts
|
|
9
|
-
function buildUrl(host, path, params = {}) {
|
|
10
|
-
const base = host.replace(/\/$/, "");
|
|
11
|
-
const p = path.startsWith("/") ? path : `/${path}`;
|
|
12
|
-
const url = new URL(`${base}${p}`);
|
|
13
|
-
for (const [key, value] of Object.entries(params)) {
|
|
14
|
-
if (value !== void 0 && value !== null) {
|
|
15
|
-
url.searchParams.set(key, String(value));
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
return url.toString();
|
|
19
|
-
}
|
|
20
|
-
function parseKbResponse(resp, text) {
|
|
21
|
-
if (resp.status === 401 || resp.status === 403) {
|
|
22
|
-
throw new Error(`KB MCP token auth failed: HTTP ${resp.status} ${resp.statusText}`);
|
|
23
|
-
}
|
|
24
|
-
const data = safeJsonParse(text);
|
|
25
|
-
if (data.return_code === -1001) {
|
|
26
|
-
throw new Error(`KB MCP token auth failed: ${data.return_message || "unauthorized"} (code: ${data.return_code})`);
|
|
27
|
-
}
|
|
28
|
-
if (data.return_code !== 0 && data.return_code !== void 0) {
|
|
29
|
-
throw new Error(`AE API error: ${data.return_message || "unknown"} (code: ${data.return_code})`);
|
|
30
|
-
}
|
|
31
|
-
return data.data !== void 0 ? data.data : data;
|
|
32
|
-
}
|
|
33
|
-
async function fetchWithMcpToken(input, init, mcpToken) {
|
|
34
|
-
const headers = new Headers(init.headers);
|
|
35
|
-
headers.set("mcp-token", mcpToken);
|
|
36
|
-
const resp = await fetch(input, { ...init, headers });
|
|
37
|
-
return parseKbResponse(resp, await resp.text());
|
|
38
|
-
}
|
|
39
|
-
async function kbApi(ctx, method, path, params = {}, body) {
|
|
40
|
-
const host = ctx.host();
|
|
41
|
-
const mcpToken = await getMcpToken(host);
|
|
42
|
-
const upperMethod = method.toUpperCase();
|
|
43
|
-
return fetchWithMcpToken(buildUrl(host, path, params), {
|
|
44
|
-
method: upperMethod,
|
|
45
|
-
headers: {
|
|
46
|
-
"Content-Type": "application/json"
|
|
47
|
-
},
|
|
48
|
-
body: upperMethod === "GET" ? void 0 : JSON.stringify(body ?? {})
|
|
49
|
-
}, mcpToken);
|
|
50
|
-
}
|
|
51
|
-
async function kbUpload(ctx, path, form, params = {}) {
|
|
52
|
-
const host = ctx.host();
|
|
53
|
-
const mcpToken = await getMcpToken(host);
|
|
54
|
-
return fetchWithMcpToken(buildUrl(host, path, params), {
|
|
55
|
-
method: "POST",
|
|
56
|
-
body: form
|
|
57
|
-
}, mcpToken);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export {
|
|
61
|
-
kbApi,
|
|
62
|
-
kbUpload
|
|
63
|
-
};
|