@thinkingai/ae-cli 6.1.32 → 6.1.33
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 +6 -3
- package/README.zh.md +8 -3
- package/bin/runtime-capabilities.json +1 -1
- package/dist/{ai-monitor-MKMHSSNI.js → ai-monitor-OHTSU6SV.js} +10 -9
- package/dist/ai-monitor.js +14 -13
- package/dist/{auth-CZHHPZOQ.js → auth-2MOK4OI6.js} +18 -9
- package/dist/{automation-FLCPFMN4.js → automation-6L6IAYRK.js} +6 -7
- package/dist/{capability-64KVJFIA.js → capability-EMIHQJA3.js} +10 -9
- package/dist/{chunk-OAWPT7VP.js → chunk-2I5SZ5DS.js} +2 -2
- package/dist/{chunk-4XKTRCRK.js → chunk-4IQYPWCX.js} +9 -8
- package/dist/{chunk-T7WF4HYW.js → chunk-7DHSB3FL.js} +3 -3
- package/dist/{chunk-4PSTYEG5.js → chunk-AMURHMS3.js} +11 -7
- package/dist/{chunk-6M7ZEDT2.js → chunk-BQFLABJQ.js} +11 -7
- package/dist/{chunk-KTJXD27G.js → chunk-COOMXFUG.js} +3 -3
- package/dist/{chunk-NLEXY2TM.js → chunk-DWAG2QJM.js} +7 -5
- package/dist/{chunk-DWBYNGSR.js → chunk-E3ONSFUN.js} +165 -186
- package/dist/{chunk-CF6JTT2U.js → chunk-EFGUBGA6.js} +1 -1
- package/dist/{chunk-BNBCMCYN.js → chunk-EWVEAERM.js} +11 -11
- package/dist/{chunk-F2VFZUGG.js → chunk-HIMOBNEY.js} +2 -2
- package/dist/{chunk-JEUXDY3B.js → chunk-HQED4YB4.js} +1 -1
- package/dist/{chunk-2F64AZYH.js → chunk-KA5WKR5P.js} +2 -2
- package/dist/{chunk-FCAA7I2D.js → chunk-KD5UC33N.js} +23 -9
- package/dist/{chunk-P7QDCWJ6.js → chunk-LFJ7N36I.js} +5 -1
- package/dist/chunk-NNK3JBH4.js +60 -0
- package/dist/{chunk-3ULDJJTZ.js → chunk-O45NOIWR.js} +2 -2
- package/dist/{chunk-HTZ2MLYA.js → chunk-PLNS5J33.js} +11 -5
- package/dist/chunk-PUSFEC6B.js +29 -0
- package/dist/{chunk-Z3Q2AEIN.js → chunk-R2SVAO4G.js} +14 -2
- package/dist/{chunk-TMQGS4TO.js → chunk-RC3PPCYD.js} +3 -3
- package/dist/{chunk-HVMCPKOZ.js → chunk-THTROEGD.js} +1 -1
- package/dist/{chunk-QVRIDN42.js → chunk-UCMO4LKL.js} +2 -2
- package/dist/{chunk-5M5LBRR3.js → chunk-VLOGOM7N.js} +13 -7
- package/dist/{chunk-72NJKS7O.js → chunk-XZDKAR4N.js} +4 -4
- package/dist/{chunk-IDDWEZ7F.js → chunk-YE6MJB5V.js} +3 -3
- package/dist/{community-report-client-TJVCLZ3K.js → community-report-client-ULRNXLQV.js} +1 -1
- package/dist/{compat-check-ZJNCMNQV.js → compat-check-CADG7GND.js} +5 -4
- package/dist/{config-FSH2NMNZ.js → config-PFD3KWQG.js} +7 -6
- package/dist/{context-YAQG6YQC.js → context-SOQDFZIB.js} +8 -6
- package/dist/{data-integration-QE37EQ3A.js → data-integration-UNJ7EPW2.js} +6 -6
- package/dist/{evaluation-2JSF4V47.js → evaluation-Q3AIGFOG.js} +5 -5
- package/dist/index.js +47 -43
- package/dist/{local-data-upload-client-KCMG6J62.js → local-data-upload-client-YTWMAAGE.js} +1 -1
- package/dist/{memory-VEZZVAAP.js → memory-HKNGUIPK.js} +6 -7
- package/dist/{metadata-3IWHX3V4.js → metadata-GFWR5ZHC.js} +10 -9
- package/dist/{model-T7H7Q6BG.js → model-NAKQWK4W.js} +4 -5
- package/dist/{personal-semantic-preference-YITU23SA.js → personal-semantic-preference-JCTKXLC3.js} +45 -14
- package/dist/{project-semantic-MHEXJF3C.js → project-semantic-B2NWQOKK.js} +9 -8
- package/dist/{sync-AQHVCSPI.js → sync-UQH4J4BD.js} +9 -9
- package/dist/{te-agent-RXI7WOH4.js → te-agent-L6EYFQCC.js} +303 -17
- package/dist/{te-analysis-CZY74HVF.js → te-analysis-U7NNOY66.js} +25 -20
- package/dist/{te-community-DKCYUBCM.js → te-community-3UQEW3KD.js} +13 -11
- package/dist/{te-dataops-QEH6VE56.js → te-dataops-SUNYXF5G.js} +13 -11
- package/dist/{te-engage-WK7WKDKF.js → te-engage-KMXZJ2KN.js} +9 -8
- package/dist/{te-experiment-LH3RPIOE.js → te-experiment-IEYKP6VC.js} +215 -28
- package/dist/{te-kb-UPORIOVN.js → te-kb-MT3V5ZMH.js} +68 -17
- package/dist/{te-system-AL4B4XZL.js → te-system-F4ZU2HRQ.js} +6 -7
- package/dist/{te-team-LLVTO2G4.js → te-team-M6E6XQ5H.js} +9 -8
- package/dist/{things-XLMLBYQR.js → things-FRLBZV2Z.js} +9 -8
- package/dist/{update-7J5UQHSK.js → update-NULYHVE6.js} +8 -6
- package/dist/{workspace-FF2HXJGR.js → workspace-Z7L33OBQ.js} +6 -7
- package/package.json +6 -3
- package/skills/ae-agent/SKILL.md +19 -5
- package/skills/ae-agent/references/a2a.md +103 -0
- package/skills/ae-agent/references/command_index.md +11 -0
- package/skills/ae-analysis/SKILL.md +35 -23
- package/skills/ae-analysis/references/analysis_data_retrieval.md +1 -1
- package/skills/ae-analysis/references/asset_authentication_export.md +1 -1
- package/skills/ae-analysis/references/asset_authentication_update.md +6 -2
- package/skills/ae-analysis/references/bad_case_review.md +4 -4
- package/skills/ae-analysis/references/command_index.md +7 -7
- package/skills/ae-analysis/references/governance_recommendation_export.md +2 -2
- package/skills/ae-analysis/references/personal_semantic_preference_add.md +9 -1
- package/skills/ae-analysis/references/personal_semantic_preference_delete.md +2 -0
- package/skills/ae-analysis/references/personal_semantic_preference_get.md +2 -0
- package/skills/ae-analysis/references/personal_semantic_preference_list.md +10 -2
- package/skills/ae-analysis/references/personal_semantic_preference_update.md +8 -0
- package/skills/ae-analysis/references/project_owner_update.md +5 -1
- package/skills/ae-analysis/references/scenario_evaluation.md +17 -1
- package/skills/ae-analysis/references/scenario_list.md +5 -6
- package/skills/ae-capability/SKILL.md +8 -4
- package/skills/ae-experiment/SKILL.md +45 -16
- package/skills/ae-experiment/references/experiment_approval.md +87 -29
- package/skills/ae-experiment/references/manage_experiment.md +7 -3
- package/skills/ae-experiment/references/manage_traffic_domains.md +131 -0
- package/skills/ae-experiment/references/query_experiment_detail.md +8 -0
- package/skills/ae-experiment/references/query_experiment_list.md +6 -0
- package/skills/ae-experiment/references/save_experiment.md +39 -13
- package/skills/ae-experiment/references/save_metric.md +29 -2
- package/skills/ae-experiment/references/save_submit_experiment.md +11 -7
- package/skills/ae-experiment/references/save_submit_external_experiment.md +16 -14
- package/skills/ae-experiment/references/save_traffic_layer.md +17 -1
- package/skills/ae-kb/SKILL.md +4 -2
- package/skills/ae-kb/references/publication.md +45 -0
- package/dist/chunk-Y74WTIKJ.js +0 -10
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
CliValidationError
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-R2SVAO4G.js";
|
|
5
5
|
|
|
6
6
|
// src/core/capability-risk.ts
|
|
7
7
|
var HIGH_RISK_LEVELS = /* @__PURE__ */ new Set(["high-risk-write"]);
|
|
@@ -2,36 +2,36 @@ import { createRequire as __createRequire } from 'node:module'; const require =
|
|
|
2
2
|
import {
|
|
3
3
|
confirmHighRiskWrite,
|
|
4
4
|
requiresConfirmation
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-EFGUBGA6.js";
|
|
6
6
|
import {
|
|
7
7
|
TeAgentApiError,
|
|
8
8
|
TeAgentCredentialsError
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-VLOGOM7N.js";
|
|
10
10
|
import {
|
|
11
11
|
EvalApiError
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-LFJ7N36I.js";
|
|
13
13
|
import {
|
|
14
14
|
printError,
|
|
15
15
|
printOutput
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-O45NOIWR.js";
|
|
17
17
|
import {
|
|
18
18
|
CapabilityGatewayError
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-4IQYPWCX.js";
|
|
20
20
|
import {
|
|
21
21
|
BusinessDisabledError,
|
|
22
22
|
assertBusinessEnabled,
|
|
23
23
|
businessForCommand,
|
|
24
24
|
formatCapabilityMissCompatHint,
|
|
25
25
|
readCurrentBusinessConfig
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-E3ONSFUN.js";
|
|
27
27
|
import {
|
|
28
28
|
CredentialStoreUnreadableError,
|
|
29
29
|
SecureStoreAuthError
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-PLNS5J33.js";
|
|
31
31
|
import {
|
|
32
32
|
getActiveHost,
|
|
33
33
|
safeJsonParse
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-AMURHMS3.js";
|
|
35
35
|
import {
|
|
36
36
|
CliApiError,
|
|
37
37
|
CliValidationError,
|
|
@@ -41,7 +41,7 @@ import {
|
|
|
41
41
|
PermissionError,
|
|
42
42
|
logger,
|
|
43
43
|
readKbExecutionContext
|
|
44
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-R2SVAO4G.js";
|
|
45
45
|
|
|
46
46
|
// src/framework/business-filter.ts
|
|
47
47
|
import { Help } from "commander";
|
|
@@ -455,14 +455,14 @@ function createRuntimeContext(cmd, opts, globalOpts) {
|
|
|
455
455
|
let _communityReportModule = null;
|
|
456
456
|
async function getCommunityReportClient() {
|
|
457
457
|
if (!_communityReportModule) {
|
|
458
|
-
_communityReportModule = await import("./community-report-client-
|
|
458
|
+
_communityReportModule = await import("./community-report-client-ULRNXLQV.js");
|
|
459
459
|
}
|
|
460
460
|
return _communityReportModule;
|
|
461
461
|
}
|
|
462
462
|
let _localDataUploadModule = null;
|
|
463
463
|
async function getLocalDataUploadClient() {
|
|
464
464
|
if (!_localDataUploadModule) {
|
|
465
|
-
_localDataUploadModule = await import("./local-data-upload-client-
|
|
465
|
+
_localDataUploadModule = await import("./local-data-upload-client-YTWMAAGE.js");
|
|
466
466
|
}
|
|
467
467
|
return _localDataUploadModule;
|
|
468
468
|
}
|
|
@@ -10,10 +10,10 @@ import {
|
|
|
10
10
|
postToMainApp,
|
|
11
11
|
putToMainApp,
|
|
12
12
|
uploadToMainApp
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-VLOGOM7N.js";
|
|
14
14
|
import {
|
|
15
15
|
clearCliTokenCache
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-PLNS5J33.js";
|
|
17
17
|
|
|
18
18
|
// src/core/resource-package-client.ts
|
|
19
19
|
function checkPath(path) {
|
|
@@ -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-R2SVAO4G.js";
|
|
6
6
|
|
|
7
7
|
// node_modules/process-nextick-args/index.js
|
|
8
8
|
var require_process_nextick_args = __commonJS({
|
|
@@ -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-AMURHMS3.js";
|
|
5
5
|
import {
|
|
6
6
|
normalizeUrl
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-R2SVAO4G.js";
|
|
8
8
|
|
|
9
9
|
// src/core/auth.ts
|
|
10
10
|
function resolveHost(hostOverride) {
|
|
@@ -1,21 +1,23 @@
|
|
|
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-4IQYPWCX.js";
|
|
5
5
|
import {
|
|
6
6
|
SecureStoreAuthError,
|
|
7
|
-
getCliToken
|
|
8
|
-
|
|
7
|
+
getCliToken,
|
|
8
|
+
internalCallSourceHeaders
|
|
9
|
+
} from "./chunk-PLNS5J33.js";
|
|
9
10
|
import {
|
|
10
11
|
safeJsonParse
|
|
11
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-AMURHMS3.js";
|
|
12
13
|
import {
|
|
13
14
|
PermissionError,
|
|
14
15
|
externalCliTokenRequestOptions,
|
|
15
16
|
isKbQueryPath,
|
|
16
17
|
kbReadHeaders,
|
|
18
|
+
readExternalCliToken,
|
|
17
19
|
readKbExecutionContext
|
|
18
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-R2SVAO4G.js";
|
|
19
21
|
|
|
20
22
|
// src/core/mcp-access.ts
|
|
21
23
|
function buildUrl(host, path, params = {}) {
|
|
@@ -174,6 +176,7 @@ function parseKbResponse(resp, text, options = {}) {
|
|
|
174
176
|
async function fetchWithCliToken(input, init, cliToken, options = {}) {
|
|
175
177
|
const headers = new Headers(init.headers);
|
|
176
178
|
headers.set("cli-token", cliToken);
|
|
179
|
+
for (const [name, value] of Object.entries(internalCallSourceHeaders())) headers.set(name, value);
|
|
177
180
|
const resp = await fetch(input, { ...init, headers, ...externalCliTokenRequestOptions(input) });
|
|
178
181
|
if (options.responseType === "empty" && resp.status === 204) return null;
|
|
179
182
|
if (options.responseType === "bytes" && resp.ok) {
|
|
@@ -218,19 +221,20 @@ async function requestWithCliToken(host, input, init, options) {
|
|
|
218
221
|
}
|
|
219
222
|
async function getAuthHeaders(ctx) {
|
|
220
223
|
const cliToken = await getCliToken(ctx.host());
|
|
221
|
-
return { "cli-token": cliToken };
|
|
224
|
+
return { "cli-token": cliToken, ...internalCallSourceHeaders() };
|
|
222
225
|
}
|
|
223
226
|
async function kbApi(ctx, method, path, params = {}, body, options = {}) {
|
|
224
227
|
const upperMethod = method.toUpperCase();
|
|
228
|
+
const isAsk = upperMethod === "POST" && /^\/(?:agent\/)?api\/external\/knowledge-bases\/ask$/.test(path);
|
|
225
229
|
const isQuery = isKbQueryPath(upperMethod, path);
|
|
226
230
|
const execution = isQuery ? readKbExecutionContext() : void 0;
|
|
227
231
|
const host = execution ? ctx.hostOverride?.() || execution.origin : ctx.host();
|
|
228
232
|
const selectedHost = execution && !ctx.hostOverride ? ctx.host() : host;
|
|
229
233
|
const url = buildUrl(selectedHost, path, params);
|
|
230
|
-
const queryHeaders = isQuery ? kbReadHeaders(url, ctx.str("read-context")) : void 0;
|
|
234
|
+
const queryHeaders = isQuery || isAsk && ctx.str("read-context") ? kbReadHeaders(url, ctx.str("read-context")) : void 0;
|
|
231
235
|
const init = {
|
|
232
236
|
method: upperMethod,
|
|
233
|
-
headers: { "Content-Type": "application/json", ...queryHeaders },
|
|
237
|
+
headers: { "Content-Type": "application/json", ...queryHeaders, ...internalCallSourceHeaders() },
|
|
234
238
|
body: upperMethod === "GET" ? void 0 : JSON.stringify(body ?? {})
|
|
235
239
|
};
|
|
236
240
|
if (execution) {
|
|
@@ -240,13 +244,23 @@ async function kbApi(ctx, method, path, params = {}, body, options = {}) {
|
|
|
240
244
|
let code = "KB_READ_CONTEXT_REQUEST_FAILED";
|
|
241
245
|
try {
|
|
242
246
|
const value = responseErrorMetadata(safeJsonParse(text)).code;
|
|
243
|
-
if (value
|
|
247
|
+
if (value && /^KB_(READ_CONTEXT|CANDIDATE)_/.test(value)) code = value;
|
|
244
248
|
} catch {
|
|
245
249
|
}
|
|
246
250
|
throw new KbHttpError(code, code, response.status);
|
|
247
251
|
}
|
|
248
252
|
return parseKbResponse(response, text, { ...options, redactErrorDetails: true });
|
|
249
253
|
}
|
|
254
|
+
if (upperMethod === "POST" && /^\/(?:agent\/)?api\/external\/knowledge-bases\/(read|grep|index)$/.test(path)) {
|
|
255
|
+
const task = readExternalCliToken(host)?.taskContext;
|
|
256
|
+
if (task) init.headers = {
|
|
257
|
+
...init.headers,
|
|
258
|
+
"X-Task-CLI-Grant": task.grant,
|
|
259
|
+
"X-Task-CLI-Execution": task.executionId,
|
|
260
|
+
"X-Task-CLI-Company": task.companyId,
|
|
261
|
+
"X-Task-CLI-Sandbox": task.sandboxId
|
|
262
|
+
};
|
|
263
|
+
}
|
|
250
264
|
return requestWithCliToken(
|
|
251
265
|
host,
|
|
252
266
|
url,
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
internalCallSourceHeaders
|
|
4
|
+
} from "./chunk-PLNS5J33.js";
|
|
2
5
|
import {
|
|
3
6
|
CliValidationError,
|
|
4
7
|
logger
|
|
5
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-R2SVAO4G.js";
|
|
6
9
|
|
|
7
10
|
// src/core/eval-endpoint.ts
|
|
8
11
|
function resolveEvaluationHost(host) {
|
|
@@ -140,6 +143,7 @@ async function evalRequest(options) {
|
|
|
140
143
|
const timeout = setTimeout(() => controller.abort(), timeoutMs);
|
|
141
144
|
const headers = {
|
|
142
145
|
...options.headers,
|
|
146
|
+
...internalCallSourceHeaders(),
|
|
143
147
|
Accept: options.responseType === "bytes" ? "application/octet-stream, application/json" : "application/json"
|
|
144
148
|
};
|
|
145
149
|
const isMultipart = options.body instanceof FormData;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
getLocalCliPackageInfo
|
|
4
|
+
} from "./chunk-PUSFEC6B.js";
|
|
5
|
+
import {
|
|
6
|
+
getAeSandboxDetectionReason
|
|
7
|
+
} from "./chunk-AMURHMS3.js";
|
|
8
|
+
import {
|
|
9
|
+
logger
|
|
10
|
+
} from "./chunk-R2SVAO4G.js";
|
|
11
|
+
|
|
12
|
+
// src/core/source-logged-fetch.ts
|
|
13
|
+
import { randomUUID } from "crypto";
|
|
14
|
+
var CLI_REQUEST_ID_HEADER = "X-TA-CLI-Request-Id";
|
|
15
|
+
var localPackage = getLocalCliPackageInfo();
|
|
16
|
+
var MAX_LOG_VALUE_LENGTH = 256;
|
|
17
|
+
function bounded(value) {
|
|
18
|
+
return value.length > MAX_LOG_VALUE_LENGTH ? `${value.slice(0, MAX_LOG_VALUE_LENGTH)}...[truncated]` : value;
|
|
19
|
+
}
|
|
20
|
+
function sourceLoggedFetch(url, init) {
|
|
21
|
+
const requestId = randomUUID();
|
|
22
|
+
let headers;
|
|
23
|
+
if (init.headers instanceof Headers) {
|
|
24
|
+
headers = new Headers(init.headers);
|
|
25
|
+
headers.set(CLI_REQUEST_ID_HEADER, requestId);
|
|
26
|
+
} else if (Array.isArray(init.headers)) {
|
|
27
|
+
headers = [
|
|
28
|
+
...init.headers.filter(([name]) => name.toLowerCase() !== CLI_REQUEST_ID_HEADER.toLowerCase()),
|
|
29
|
+
[CLI_REQUEST_ID_HEADER, requestId]
|
|
30
|
+
];
|
|
31
|
+
} else {
|
|
32
|
+
headers = Object.fromEntries(Object.entries(init.headers ?? {}).filter(([name]) => name.toLowerCase() !== CLI_REQUEST_ID_HEADER.toLowerCase()));
|
|
33
|
+
headers[CLI_REQUEST_ID_HEADER] = requestId;
|
|
34
|
+
}
|
|
35
|
+
const request = { ...init, headers };
|
|
36
|
+
try {
|
|
37
|
+
const target = new URL(url);
|
|
38
|
+
const actualHeaders = new Headers(headers);
|
|
39
|
+
const source = actualHeaders.get("X-Source");
|
|
40
|
+
const sandboxDetection = getAeSandboxDetectionReason();
|
|
41
|
+
logger.info(`CLI_SOURCE_SEND ${JSON.stringify({
|
|
42
|
+
request_id: requestId,
|
|
43
|
+
method: init.method ?? "GET",
|
|
44
|
+
host: bounded(target.host),
|
|
45
|
+
path: bounded(target.pathname),
|
|
46
|
+
source: source === null ? null : bounded(source),
|
|
47
|
+
source_state: source === null ? "missing" : source === "" ? "empty" : source.includes(",") ? "multiple" : "present",
|
|
48
|
+
cli_package: localPackage.name,
|
|
49
|
+
cli_version: localPackage.version,
|
|
50
|
+
sandbox_detected: sandboxDetection !== "not_detected",
|
|
51
|
+
sandbox_detection: sandboxDetection
|
|
52
|
+
})}`);
|
|
53
|
+
} catch {
|
|
54
|
+
}
|
|
55
|
+
return fetch(url, request);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export {
|
|
59
|
+
sourceLoggedFetch
|
|
60
|
+
};
|
|
@@ -2,11 +2,11 @@ import { createRequire as __createRequire } from 'node:module'; const require =
|
|
|
2
2
|
import {
|
|
3
3
|
getPendingHostCompatNotice,
|
|
4
4
|
getPendingUpdateNotice
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-E3ONSFUN.js";
|
|
6
6
|
import {
|
|
7
7
|
logger,
|
|
8
8
|
redactExternalCliToken
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-R2SVAO4G.js";
|
|
10
10
|
|
|
11
11
|
// src/framework/output.ts
|
|
12
12
|
import Table from "cli-table3";
|
|
@@ -6,14 +6,19 @@ import {
|
|
|
6
6
|
readSandboxCliTokenEntry,
|
|
7
7
|
safeJsonParse,
|
|
8
8
|
safeReadJsonFile
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-AMURHMS3.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-R2SVAO4G.js";
|
|
17
|
+
|
|
18
|
+
// src/core/internal-call-source.ts
|
|
19
|
+
function internalCallSourceHeaders() {
|
|
20
|
+
return {};
|
|
21
|
+
}
|
|
17
22
|
|
|
18
23
|
// src/core/secure-store.ts
|
|
19
24
|
import crypto from "crypto";
|
|
@@ -658,7 +663,7 @@ async function generateCliToken(hostUrl, accessToken) {
|
|
|
658
663
|
const url = `${hostUrl.replace(/\/+$/, "")}${CLI_TOKEN_GENERATE_PATH}`;
|
|
659
664
|
const resp = await fetch(url, {
|
|
660
665
|
method: "GET",
|
|
661
|
-
headers: { Authorization: `bearer ${accessToken}
|
|
666
|
+
headers: { Authorization: `bearer ${accessToken}`, ...internalCallSourceHeaders() }
|
|
662
667
|
});
|
|
663
668
|
if (!resp.ok) {
|
|
664
669
|
if (resp.status === 403) {
|
|
@@ -699,7 +704,7 @@ async function validateCliTokenOnServer(hostUrl, cliToken) {
|
|
|
699
704
|
try {
|
|
700
705
|
resp = await fetch(url, {
|
|
701
706
|
method: "GET",
|
|
702
|
-
headers: { Accept: "application/json", "cli-token": cliToken },
|
|
707
|
+
headers: { Accept: "application/json", "cli-token": cliToken, ...internalCallSourceHeaders() },
|
|
703
708
|
...externalCliTokenRequestOptions(url)
|
|
704
709
|
});
|
|
705
710
|
} catch (error) {
|
|
@@ -743,7 +748,7 @@ async function renewCliTokenOnServer(hostUrl, cliToken, external = false, signal
|
|
|
743
748
|
if (!external) url.searchParams.set("cli-token", cliToken);
|
|
744
749
|
const resp = await fetch(url.toString(), {
|
|
745
750
|
method: "GET",
|
|
746
|
-
headers: { Accept: "application/json", ...external ? { "cli-token": cliToken } : {} },
|
|
751
|
+
headers: { Accept: "application/json", ...external ? { "cli-token": cliToken } : {}, ...internalCallSourceHeaders() },
|
|
747
752
|
...externalCliTokenRequestOptions(url.toString()),
|
|
748
753
|
signal
|
|
749
754
|
});
|
|
@@ -865,6 +870,7 @@ async function mintCliToken(hostUrl, accessToken) {
|
|
|
865
870
|
}
|
|
866
871
|
|
|
867
872
|
export {
|
|
873
|
+
internalCallSourceHeaders,
|
|
868
874
|
assertCredentialsReadable,
|
|
869
875
|
getActiveCredential,
|
|
870
876
|
listCredentials,
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
|
|
2
|
+
|
|
3
|
+
// src/core/package-info.ts
|
|
4
|
+
import fs from "fs";
|
|
5
|
+
import path from "path";
|
|
6
|
+
import { fileURLToPath } from "url";
|
|
7
|
+
function getLocalCliPackageInfo() {
|
|
8
|
+
let dir = path.dirname(fileURLToPath(import.meta.url));
|
|
9
|
+
for (let i = 0; i < 8; i += 1) {
|
|
10
|
+
const candidate = path.join(dir, "package.json");
|
|
11
|
+
try {
|
|
12
|
+
if (fs.existsSync(candidate)) {
|
|
13
|
+
const pkg = JSON.parse(fs.readFileSync(candidate, "utf8"));
|
|
14
|
+
if (pkg.name && pkg.version && String(pkg.name).includes("ae-cli")) {
|
|
15
|
+
return { name: pkg.name, version: pkg.version, root: dir };
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
} catch {
|
|
19
|
+
}
|
|
20
|
+
const parent = path.dirname(dir);
|
|
21
|
+
if (parent === dir) break;
|
|
22
|
+
dir = parent;
|
|
23
|
+
}
|
|
24
|
+
return { name: "@tant/ae-cli", version: "0.0.0", root: "" };
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export {
|
|
28
|
+
getLocalCliPackageInfo
|
|
29
|
+
};
|
|
@@ -232,15 +232,27 @@ function readExternalCliToken(hostOverride) {
|
|
|
232
232
|
let data;
|
|
233
233
|
try {
|
|
234
234
|
const stat = fs2.statSync(file);
|
|
235
|
-
if (!stat.isFile() || stat.size >
|
|
235
|
+
if (!stat.isFile() || stat.size > 96 * 1024) throw new Error();
|
|
236
236
|
data = JSON.parse(fs2.readFileSync(file, "utf8"));
|
|
237
237
|
} catch {
|
|
238
|
-
throw new ExternalCliTokenError("The external CLI token file must be a readable JSON file no larger than
|
|
238
|
+
throw new ExternalCliTokenError("The external CLI token file must be a readable JSON file no larger than 96 KiB.");
|
|
239
239
|
}
|
|
240
240
|
if (!data || typeof data !== "object" || Array.isArray(data)) {
|
|
241
241
|
throw new ExternalCliTokenError("The external CLI token file must contain an object with url and token.");
|
|
242
242
|
}
|
|
243
|
+
if (data.blocked !== void 0) {
|
|
244
|
+
const code = ["PI_CLI_NOT_READY", "PI_CLI_AUTH_REQUIRED", "PI_CLI_PERMISSION_DENIED", "PI_CLI_TIMEOUT"].includes(data.blocked) ? data.blocked : "PI_CLI_NOT_READY";
|
|
245
|
+
throw new ExternalCliTokenError("The runtime could not prepare CLI credentials for this execution.", code);
|
|
246
|
+
}
|
|
243
247
|
entry = credential(data.url, data.token ?? data["cli-token"], "file-cli-token");
|
|
248
|
+
if (data.taskContext !== void 0) {
|
|
249
|
+
const context = data.taskContext;
|
|
250
|
+
if (!context || typeof context !== "object" || Array.isArray(context) || context.version !== 1 || typeof context.grant !== "string" || context.grant.length > 65536 || !/^[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+$/.test(context.grant) || ["executionId", "sandboxId", "companyId"].some((key) => typeof context[key] !== "string" || !/^[^\s\x00-\x1f\x7f]{1,191}$/.test(context[key]))) {
|
|
251
|
+
throw new ExternalCliTokenError("The runtime CLI context is invalid.");
|
|
252
|
+
}
|
|
253
|
+
entry.taskContext = { version: 1, grant: context.grant, executionId: context.executionId, sandboxId: context.sandboxId, companyId: context.companyId };
|
|
254
|
+
diagnosticSecrets.add(context.grant);
|
|
255
|
+
}
|
|
244
256
|
} else if (process.env.AE_CLI_TOKEN !== void 0) {
|
|
245
257
|
entry = credential(process.env.AE_CLI_TOKEN_HOST, process.env.AE_CLI_TOKEN, "environment-cli-token");
|
|
246
258
|
} else if (process.env.AE_CLI_TOKEN_HOST !== void 0) {
|
|
@@ -4,15 +4,15 @@ import {
|
|
|
4
4
|
} from "./chunk-AWW2T2WL.js";
|
|
5
5
|
import {
|
|
6
6
|
withOutputMetadata
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-O45NOIWR.js";
|
|
8
8
|
import {
|
|
9
9
|
dryRunCapabilityWithEnvelope,
|
|
10
10
|
executeCapabilityWithEnvelope,
|
|
11
11
|
validateCapabilityWithEnvelope
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-4IQYPWCX.js";
|
|
13
13
|
import {
|
|
14
14
|
CliValidationError
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-R2SVAO4G.js";
|
|
16
16
|
|
|
17
17
|
// src/core/capability-command.ts
|
|
18
18
|
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-HQED4YB4.js";
|
|
9
9
|
import {
|
|
10
10
|
__commonJS,
|
|
11
11
|
__require
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-R2SVAO4G.js";
|
|
13
13
|
|
|
14
14
|
// node_modules/jszip/node_modules/readable-stream/lib/internal/streams/stream.js
|
|
15
15
|
var require_stream = __commonJS({
|
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
|
+
getCliToken,
|
|
3
4
|
internalCallSourceHeaders
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import {
|
|
6
|
-
getCliToken
|
|
7
|
-
} from "./chunk-HTZ2MLYA.js";
|
|
5
|
+
} from "./chunk-PLNS5J33.js";
|
|
8
6
|
import {
|
|
9
7
|
getActiveHost,
|
|
10
8
|
getSandboxRuntimeRoot
|
|
11
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-AMURHMS3.js";
|
|
12
10
|
import {
|
|
13
11
|
PermissionError,
|
|
14
12
|
externalCliTokenRequestOptions,
|
|
15
13
|
isApiErrorType,
|
|
16
14
|
readExternalCliToken
|
|
17
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-R2SVAO4G.js";
|
|
18
16
|
|
|
19
17
|
// src/core/te-agent-credentials.ts
|
|
20
18
|
import { readFileSync } from "fs";
|
|
@@ -202,7 +200,7 @@ function teClaudeBaseFromActiveHost(hostOverride) {
|
|
|
202
200
|
async function signRequest(method, path2, hostOverride, includeJsonContentType = true, authMode = "auto") {
|
|
203
201
|
const external = readExternalCliToken(hostOverride);
|
|
204
202
|
const configuredHost = hostOverride || getActiveHost();
|
|
205
|
-
const
|
|
203
|
+
const sandboxEndpoint = (/* @__PURE__ */ new Set([
|
|
206
204
|
"/api/sandbox/models",
|
|
207
205
|
"/api/sandbox/models/select",
|
|
208
206
|
"/api/sandbox/sync/push",
|
|
@@ -210,9 +208,11 @@ async function signRequest(method, path2, hostOverride, includeJsonContentType =
|
|
|
210
208
|
"/api/sandbox/sync/pull",
|
|
211
209
|
"/api/sandbox/sync/pull/candidates"
|
|
212
210
|
])).has(path2.split("?")[0]);
|
|
211
|
+
const sandboxOnly = !hostOverride && sandboxEndpoint;
|
|
213
212
|
const sandboxCred = external || configuredHost && !sandboxOnly ? null : tryLoadTeAgentSandboxCredentials();
|
|
214
213
|
if (authMode === "auto" && !hostOverride && sandboxCred && sandboxCred.sandboxId && sandboxCred.sandboxSecretKey) {
|
|
215
214
|
const headers = {
|
|
215
|
+
...internalCallSourceHeaders(),
|
|
216
216
|
"X-Sandbox-Id": sandboxCred.sandboxId,
|
|
217
217
|
"X-Sandbox-Secret-Key": sandboxCred.sandboxSecretKey
|
|
218
218
|
};
|
|
@@ -239,6 +239,12 @@ async function signRequest(method, path2, hostOverride, includeJsonContentType =
|
|
|
239
239
|
url: `${baseUrl.replace(/\/$/, "")}${path2}`,
|
|
240
240
|
headers: {
|
|
241
241
|
"cli-token": cliToken,
|
|
242
|
+
...sandboxEndpoint && external?.taskContext ? {
|
|
243
|
+
"X-Task-CLI-Grant": external.taskContext.grant,
|
|
244
|
+
"X-Task-CLI-Execution": external.taskContext.executionId,
|
|
245
|
+
"X-Task-CLI-Company": external.taskContext.companyId,
|
|
246
|
+
"X-Task-CLI-Sandbox": external.taskContext.sandboxId
|
|
247
|
+
} : {},
|
|
242
248
|
...internalCallSourceHeaders(),
|
|
243
249
|
...contentTypeHeader
|
|
244
250
|
},
|
|
@@ -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-UCMO4LKL.js";
|
|
5
5
|
import {
|
|
6
6
|
require_archiver,
|
|
7
7
|
require_string_decoder
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-2I5SZ5DS.js";
|
|
9
9
|
import {
|
|
10
10
|
require_inherits,
|
|
11
11
|
require_node
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-HQED4YB4.js";
|
|
13
13
|
import {
|
|
14
14
|
__commonJS,
|
|
15
15
|
__require,
|
|
16
16
|
__toESM
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-R2SVAO4G.js";
|
|
18
18
|
|
|
19
19
|
// node_modules/exceljs/lib/utils/under-dash.js
|
|
20
20
|
var require_under_dash = __commonJS({
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
createCapabilityCommand
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-RC3PPCYD.js";
|
|
5
5
|
import {
|
|
6
6
|
registerCapabilityGatewayRoute
|
|
7
7
|
} from "./chunk-AWW2T2WL.js";
|
|
8
8
|
import {
|
|
9
9
|
executeCapabilityWithEnvelope
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-4IQYPWCX.js";
|
|
11
11
|
import {
|
|
12
12
|
CliApiError,
|
|
13
13
|
CliValidationError
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-R2SVAO4G.js";
|
|
15
15
|
|
|
16
16
|
// src/commands/ai-monitor/shared.ts
|
|
17
17
|
function createAiMonitorCapabilityCommand(config) {
|
|
@@ -12,10 +12,11 @@ import {
|
|
|
12
12
|
shouldNotifyCompat,
|
|
13
13
|
shouldSkipAutoSync,
|
|
14
14
|
shouldSkipCompatCheck
|
|
15
|
-
} from "./chunk-
|
|
16
|
-
import "./chunk-
|
|
17
|
-
import "./chunk-
|
|
18
|
-
import "./chunk-
|
|
15
|
+
} from "./chunk-E3ONSFUN.js";
|
|
16
|
+
import "./chunk-PUSFEC6B.js";
|
|
17
|
+
import "./chunk-PLNS5J33.js";
|
|
18
|
+
import "./chunk-AMURHMS3.js";
|
|
19
|
+
import "./chunk-R2SVAO4G.js";
|
|
19
20
|
export {
|
|
20
21
|
fetchCliConfig,
|
|
21
22
|
formatCapabilityMissCompatHint,
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
invalidateBusinessSkillSynchronization,
|
|
5
5
|
refreshEnvironmentAfterLogin,
|
|
6
6
|
refreshEnvironmentConfig
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-DWAG2QJM.js";
|
|
8
8
|
import {
|
|
9
9
|
MultiselectCancelled,
|
|
10
10
|
promptSingleSelect
|
|
@@ -16,15 +16,16 @@ import {
|
|
|
16
16
|
import {
|
|
17
17
|
printError,
|
|
18
18
|
printOutput
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-O45NOIWR.js";
|
|
20
20
|
import {
|
|
21
21
|
fetchCliConfig,
|
|
22
22
|
readCurrentBusinessConfig,
|
|
23
23
|
resolveKbAutoDiscoveryFeature
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-E3ONSFUN.js";
|
|
25
|
+
import "./chunk-PUSFEC6B.js";
|
|
25
26
|
import {
|
|
26
27
|
peekCliToken
|
|
27
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-PLNS5J33.js";
|
|
28
29
|
import {
|
|
29
30
|
addHost,
|
|
30
31
|
getActiveHost,
|
|
@@ -34,10 +35,10 @@ import {
|
|
|
34
35
|
resolveHostSelector,
|
|
35
36
|
setActiveHost,
|
|
36
37
|
updateHostLabel
|
|
37
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-AMURHMS3.js";
|
|
38
39
|
import {
|
|
39
40
|
normalizeUrl
|
|
40
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-R2SVAO4G.js";
|
|
41
42
|
|
|
42
43
|
// src/commands/config.ts
|
|
43
44
|
import * as readline2 from "readline";
|