@thinkingai/ae-cli 6.1.26 → 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-YHMC3GDH.js → auth-NKD5Z5BQ.js} +150 -38
- package/dist/{automation-NWWVLWG2.js → automation-K32V2NKP.js} +94 -38
- package/dist/{capability-3QLLIVFB.js → capability-4CGSL7PK.js} +9 -8
- package/dist/{chunk-CT7QDJS6.js → chunk-2IYIYSUO.js} +2 -2
- package/dist/{chunk-PLE722AJ.js → chunk-2UWS5CUP.js} +62 -35
- package/dist/{chunk-KFNMQTZI.js → chunk-ELCR235M.js} +26 -19
- package/dist/{chunk-D6ACFILC.js → chunk-GI5BMEZO.js} +1 -1
- package/dist/{chunk-FMNNGNYO.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-UQ77JXYH.js → chunk-LMCYSVVA.js} +12 -13
- package/dist/{chunk-7QXISROD.js → chunk-P6VFCH3P.js} +4 -2
- package/dist/{chunk-GIK6EDUG.js → chunk-P7KL7IOH.js} +41 -13
- package/dist/{chunk-AP7YP2NX.js → chunk-QSAR3GHY.js} +2 -2
- package/dist/{chunk-EOYSKMXN.js → chunk-QW3R6O7L.js} +14 -6
- package/dist/{chunk-S6M42KND.js → chunk-T44M3PLZ.js} +1 -1
- package/dist/{chunk-XCHAYMSF.js → chunk-UF244C5C.js} +3 -3
- package/dist/{chunk-KAEHZZH4.js → chunk-UJ7UPRXK.js} +3 -3
- package/dist/{chunk-HVHR4SCP.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-AHPMEW5A.js → config-ASSAAIOI.js} +6 -5
- package/dist/{context-YAE3QXP3.js → context-6RWLVOM5.js} +4 -4
- package/dist/{data-integration-HESZET7E.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-62BJOULV.js → memory-VCYLVPMI.js} +6 -6
- package/dist/{metadata-C7CEDHOJ.js → metadata-YGI5M6OF.js} +8 -8
- package/dist/{model-SBV2JFJI.js → model-DPJHSD73.js} +4 -4
- package/dist/{personal-semantic-preference-QECDPHND.js → personal-semantic-preference-76TBKAPY.js} +6 -6
- package/dist/{project-semantic-Z4QAMBWF.js → project-semantic-XOEBO2Q5.js} +6 -6
- package/dist/{sync-SU33KYX7.js → sync-7PP6KQ75.js} +7 -7
- package/dist/{te-agent-F5QBZSQA.js → te-agent-PJVAPKBD.js} +753 -94
- package/dist/{te-analysis-2ECAAIFK.js → te-analysis-OX62G5VD.js} +411 -79
- package/dist/{te-community-PFLDLPP4.js → te-community-QN3WMPNT.js} +6 -4
- package/dist/{te-dataops-FOQSRIAZ.js → te-dataops-UKD2XN3E.js} +8 -6
- package/dist/{te-engage-QKUGIWSR.js → te-engage-X3DIXPRA.js} +6 -6
- package/dist/{te-experiment-26PXR2UO.js → te-experiment-MEIIK3DP.js} +6 -6
- package/dist/{te-kb-MHDOST62.js → te-kb-73EWDFDF.js} +7 -7
- package/dist/{te-system-J2FQF5ER.js → te-system-IE7NCKC3.js} +10 -9
- package/dist/{te-team-5UOZPTU3.js → te-team-MGQ5CNRW.js} +63 -41
- package/dist/{things-VPPXXLHB.js → things-4JIBCA55.js} +7 -7
- package/dist/{update-EEUTEI6R.js → update-AX66IFMJ.js} +4 -4
- package/dist/{workspace-O3EEIYQM.js → workspace-Q5NMEKEN.js} +6 -6
- package/package.json +13 -8
- package/skills/ae-agent/SKILL.md +24 -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-4655PUNX.js +0 -43
|
@@ -1,15 +1,22 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
resolveWorkspaceTarget
|
|
4
|
+
} from "./chunk-UUD5RB36.js";
|
|
5
|
+
import {
|
|
6
|
+
currentAgentSpaceId
|
|
7
|
+
} from "./chunk-RK6GLDGI.js";
|
|
8
|
+
import "./chunk-JJJIP2XQ.js";
|
|
2
9
|
import {
|
|
3
10
|
TeAgentApiError,
|
|
4
11
|
deleteFromMainApp,
|
|
5
12
|
getFromMainApp,
|
|
6
13
|
patchToMainApp,
|
|
7
14
|
postToMainApp
|
|
8
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-2UWS5CUP.js";
|
|
9
16
|
import "./chunk-Y74WTIKJ.js";
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
17
|
+
import "./chunk-P7KL7IOH.js";
|
|
18
|
+
import "./chunk-LMCYSVVA.js";
|
|
19
|
+
import "./chunk-ZW4VMY5H.js";
|
|
13
20
|
|
|
14
21
|
// src/commands/automation/index.ts
|
|
15
22
|
import { randomUUID } from "crypto";
|
|
@@ -24,7 +31,7 @@ var typeFlag = flag(
|
|
|
24
31
|
);
|
|
25
32
|
var scopeFlag = flag(
|
|
26
33
|
"agent-space-id",
|
|
27
|
-
"Explicit space; otherwise
|
|
34
|
+
"Explicit space; otherwise current AgentSpace, then personal space"
|
|
28
35
|
);
|
|
29
36
|
var runFlag = flag(
|
|
30
37
|
"run-id",
|
|
@@ -62,7 +69,21 @@ var configFlags = [
|
|
|
62
69
|
flag("time", "HH:mm in server timezone"),
|
|
63
70
|
flag("minute", "Hourly minute, 0-59", "number"),
|
|
64
71
|
flag("weekday", "Weekly day, 0=Sunday through 6=Saturday", "number"),
|
|
65
|
-
flag(
|
|
72
|
+
flag(
|
|
73
|
+
"weekdays",
|
|
74
|
+
"Weekly days as JSON array, 0=Sunday through 6=Saturday",
|
|
75
|
+
"json"
|
|
76
|
+
),
|
|
77
|
+
flag(
|
|
78
|
+
"day-of-month",
|
|
79
|
+
"Monthly day, 1-31; missing dates are skipped",
|
|
80
|
+
"number"
|
|
81
|
+
),
|
|
82
|
+
flag(
|
|
83
|
+
"days-of-month",
|
|
84
|
+
'Monthly days as JSON array: integers 1-31 or "L" for last day; missing dates are skipped',
|
|
85
|
+
"json"
|
|
86
|
+
),
|
|
66
87
|
flag("model", "Agent model configuration ID; null clears the override"),
|
|
67
88
|
flag("reuse-conversation", "Agent: true | false", "json"),
|
|
68
89
|
{
|
|
@@ -71,12 +92,12 @@ var configFlags = [
|
|
|
71
92
|
},
|
|
72
93
|
flag(
|
|
73
94
|
"channels",
|
|
74
|
-
"Team notification channel array; [] clears
|
|
95
|
+
"Agent or Team notification channel array; [] clears external notifications",
|
|
75
96
|
"json"
|
|
76
97
|
),
|
|
77
|
-
flag("feishu-chat-id", "
|
|
78
|
-
flag("lark-chat-id", "
|
|
79
|
-
flag("slack-channel-id", "
|
|
98
|
+
flag("feishu-chat-id", "Feishu destination; null clears it"),
|
|
99
|
+
flag("lark-chat-id", "Lark destination; null clears it"),
|
|
100
|
+
flag("slack-channel-id", "Slack destination; null clears it"),
|
|
80
101
|
flag(
|
|
81
102
|
"save-to-knowledge-base-id",
|
|
82
103
|
"Team output knowledge base ID; null clears it"
|
|
@@ -133,11 +154,33 @@ function configuration(ctx, create) {
|
|
|
133
154
|
const kind = ctx.str("scheduleKind"), cron = ctx.str("cronExpression");
|
|
134
155
|
enumValue(kind, ["hourly", "daily", "weekly", "monthly"], "schedule-kind");
|
|
135
156
|
if (kind && cron) throw new Error("Use --schedule-kind or --cron-expression");
|
|
136
|
-
if (!kind && ["time", "minute", "weekday", "dayOfMonth"].some(
|
|
157
|
+
if (!kind && (["time", "minute", "weekday", "dayOfMonth"].some(
|
|
158
|
+
(name2) => ctx.str(name2)
|
|
159
|
+
) || ctx.json("weekdays") !== void 0 || ctx.json("daysOfMonth") !== void 0))
|
|
137
160
|
throw new Error("Schedule details require --schedule-kind");
|
|
138
|
-
if (kind && ctx.str("weekday") && kind !== "weekly" || kind && ctx.str("dayOfMonth") && kind !== "monthly" || kind && ctx.str("minute") && kind !== "hourly")
|
|
161
|
+
if (kind && (ctx.str("weekday") || ctx.json("weekdays") !== void 0) && kind !== "weekly" || kind && (ctx.str("dayOfMonth") || ctx.json("daysOfMonth") !== void 0) && kind !== "monthly" || kind && ctx.str("minute") && kind !== "hourly")
|
|
139
162
|
throw new Error("Schedule field is not applicable to this frequency");
|
|
140
163
|
if (kind) {
|
|
164
|
+
const dateSelection = (single, multiple, min, max, label, allowLastDay = false) => {
|
|
165
|
+
const values = ctx.json(multiple);
|
|
166
|
+
if (values === void 0)
|
|
167
|
+
return {
|
|
168
|
+
[single]: range(ctx.optionalNum(single) ?? NaN, min, max, label)
|
|
169
|
+
};
|
|
170
|
+
if (ctx.optionalNum(single) !== void 0)
|
|
171
|
+
throw new Error(`Use --${label} or its plural array, not both`);
|
|
172
|
+
if (!Array.isArray(values) || !values.length || values.length > max - min + 1 + Number(allowLastDay) || values.some(
|
|
173
|
+
(value) => !(allowLastDay && value === "L") && (!Number.isInteger(value) || value < min || value > max)
|
|
174
|
+
))
|
|
175
|
+
throw new Error(
|
|
176
|
+
`${multiple} must be a non-empty JSON array of integers from ${min} to ${max}${allowLastDay ? ' or "L" for last day' : ""}`
|
|
177
|
+
);
|
|
178
|
+
return {
|
|
179
|
+
[multiple]: [...new Set(values)].sort(
|
|
180
|
+
(a, b) => (a === "L" ? 32 : a) - (b === "L" ? 32 : b)
|
|
181
|
+
)
|
|
182
|
+
};
|
|
183
|
+
};
|
|
141
184
|
const schedule = { kind };
|
|
142
185
|
if (kind === "hourly")
|
|
143
186
|
schedule.minute = range(ctx.optionalNum("minute") ?? 0, 0, 59, "minute");
|
|
@@ -146,18 +189,21 @@ function configuration(ctx, create) {
|
|
|
146
189
|
throw new Error("--time must use HH:mm");
|
|
147
190
|
schedule.time = ctx.str("time");
|
|
148
191
|
if (kind === "weekly")
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
0,
|
|
152
|
-
6,
|
|
153
|
-
"weekday"
|
|
192
|
+
Object.assign(
|
|
193
|
+
schedule,
|
|
194
|
+
dateSelection("weekday", "weekdays", 0, 6, "weekday")
|
|
154
195
|
);
|
|
155
196
|
if (kind === "monthly")
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
197
|
+
Object.assign(
|
|
198
|
+
schedule,
|
|
199
|
+
dateSelection(
|
|
200
|
+
"dayOfMonth",
|
|
201
|
+
"daysOfMonth",
|
|
202
|
+
1,
|
|
203
|
+
31,
|
|
204
|
+
"day-of-month",
|
|
205
|
+
true
|
|
206
|
+
)
|
|
161
207
|
);
|
|
162
208
|
}
|
|
163
209
|
result.schedule = schedule;
|
|
@@ -165,8 +211,11 @@ function configuration(ctx, create) {
|
|
|
165
211
|
if (cron) {
|
|
166
212
|
const parts = cron.trim().split(/\s+/);
|
|
167
213
|
const validNumber = (v, a, b) => /^\d+$/.test(v) && Number(v) >= a && Number(v) <= b;
|
|
214
|
+
const validDays = (v, a, b, allowLastDay = false) => v.split(",").length <= b - a + 1 + Number(allowLastDay) && v.split(",").every(
|
|
215
|
+
(day) => allowLastDay && day === "L" || validNumber(day, a, b)
|
|
216
|
+
);
|
|
168
217
|
const [m, h, d, mo, w] = parts;
|
|
169
|
-
if (parts.length !== 5 || !validNumber(m, 0, 59) || !(h === "*" || validNumber(h, 0, 23)) || mo !== "*" || !(d === "*" ||
|
|
218
|
+
if (parts.length !== 5 || !validNumber(m, 0, 59) || !(h === "*" || validNumber(h, 0, 23)) || mo !== "*" || !(d === "*" || validDays(d, 1, 31, true)) || !(w === "*" || validDays(w, 0, 6)) || d !== "*" && w !== "*" || h === "*" && (d !== "*" || w !== "*"))
|
|
170
219
|
throw new Error(
|
|
171
220
|
"--cron-expression must specify an hourly, daily, weekly or monthly schedule"
|
|
172
221
|
);
|
|
@@ -175,19 +224,18 @@ function configuration(ctx, create) {
|
|
|
175
224
|
if (create && (ctx.str("triggerType") || "scheduled") === "scheduled" && !kind && !cron)
|
|
176
225
|
throw new Error("Scheduled automation requires a schedule");
|
|
177
226
|
const agentNames = ["model", "reuseConversation"];
|
|
178
|
-
const teamNames = [
|
|
179
|
-
|
|
227
|
+
const teamNames = ["scope", "saveToKnowledgeBaseId"];
|
|
228
|
+
const notificationNames = [
|
|
180
229
|
"channels",
|
|
181
230
|
"feishuChatId",
|
|
182
231
|
"larkChatId",
|
|
183
|
-
"slackChannelId"
|
|
184
|
-
"saveToKnowledgeBaseId"
|
|
232
|
+
"slackChannelId"
|
|
185
233
|
];
|
|
186
|
-
for (const name2 of [...agentNames, ...teamNames]) {
|
|
234
|
+
for (const name2 of [...agentNames, ...teamNames, ...notificationNames]) {
|
|
187
235
|
const json = ["scope", "channels", "reuseConversation"].includes(name2);
|
|
188
236
|
const value = json ? ctx.json(name2) : ctx.str(name2) || void 0;
|
|
189
237
|
if (value === void 0) continue;
|
|
190
|
-
if ((agentNames.includes(name2) ? "agent" : "team") !== targetType)
|
|
238
|
+
if (!notificationNames.includes(name2) && (agentNames.includes(name2) ? "agent" : "team") !== targetType)
|
|
191
239
|
throw new Error(`${name2} is not applicable to ${targetType} automations`);
|
|
192
240
|
if (name2 === "reuseConversation" && typeof value !== "boolean")
|
|
193
241
|
throw new Error("--reuse-conversation must be true or false");
|
|
@@ -217,9 +265,13 @@ function configuration(ctx, create) {
|
|
|
217
265
|
if (create) result.triggerImmediately = ctx.bool("triggerImmediately");
|
|
218
266
|
return result;
|
|
219
267
|
}
|
|
220
|
-
function query(ctx, list = false, typed = false) {
|
|
268
|
+
async function query(ctx, list = false, typed = false) {
|
|
221
269
|
const p = new URLSearchParams();
|
|
222
|
-
|
|
270
|
+
let spaceId = ctx.str("agentSpaceId").trim() || currentAgentSpaceId();
|
|
271
|
+
if (!spaceId && process.env.TE_AGENT_CONVERSATION_ID?.trim()) {
|
|
272
|
+
spaceId = (await resolveWorkspaceTarget(ctx)).agentSpaceId;
|
|
273
|
+
}
|
|
274
|
+
if (spaceId) p.set("agentSpaceId", spaceId);
|
|
223
275
|
if (typed && ctx.str("targetType"))
|
|
224
276
|
p.set("targetType", ctx.str("targetType"));
|
|
225
277
|
if (list) {
|
|
@@ -232,23 +284,27 @@ async function request(ctx, method, path, body) {
|
|
|
232
284
|
if (method === "GET")
|
|
233
285
|
return getFromMainApp(
|
|
234
286
|
path,
|
|
235
|
-
ctx.hostOverride ? ctx.hostOverride() : ctx.host()
|
|
287
|
+
ctx.hostOverride ? ctx.hostOverride() : ctx.host(),
|
|
288
|
+
"cli-token"
|
|
236
289
|
);
|
|
237
290
|
if (method === "POST")
|
|
238
291
|
return postToMainApp(
|
|
239
292
|
path,
|
|
240
293
|
body,
|
|
241
|
-
ctx.hostOverride ? ctx.hostOverride() : ctx.host()
|
|
294
|
+
ctx.hostOverride ? ctx.hostOverride() : ctx.host(),
|
|
295
|
+
"cli-token"
|
|
242
296
|
);
|
|
243
297
|
if (method === "PATCH")
|
|
244
298
|
return patchToMainApp(
|
|
245
299
|
path,
|
|
246
300
|
body,
|
|
247
|
-
ctx.hostOverride ? ctx.hostOverride() : ctx.host()
|
|
301
|
+
ctx.hostOverride ? ctx.hostOverride() : ctx.host(),
|
|
302
|
+
"cli-token"
|
|
248
303
|
);
|
|
249
304
|
return deleteFromMainApp(
|
|
250
305
|
path,
|
|
251
|
-
ctx.hostOverride ? ctx.hostOverride() : ctx.host()
|
|
306
|
+
ctx.hostOverride ? ctx.hostOverride() : ctx.host(),
|
|
307
|
+
"cli-token"
|
|
252
308
|
);
|
|
253
309
|
}
|
|
254
310
|
function withDryRun(path) {
|
|
@@ -267,7 +323,7 @@ async function waitForRun(ctx, id, runId) {
|
|
|
267
323
|
const result = await request(
|
|
268
324
|
ctx,
|
|
269
325
|
"GET",
|
|
270
|
-
`${base}/${encodeURIComponent(id)}/runs/${encodeURIComponent(runId)}/result${query(ctx)}`
|
|
326
|
+
`${base}/${encodeURIComponent(id)}/runs/${encodeURIComponent(runId)}/result${await query(ctx)}`
|
|
271
327
|
);
|
|
272
328
|
if (result.status !== "running")
|
|
273
329
|
return { ...result, executionCompleted: true, timedOut: false };
|
|
@@ -397,7 +453,7 @@ var automationCommands = actions.map((a) => ({
|
|
|
397
453
|
...body,
|
|
398
454
|
...a.wait ? { commandId } : {}
|
|
399
455
|
};
|
|
400
|
-
const path = base + a.suffix(ctx) + query(ctx, a.list, a.typed);
|
|
456
|
+
const path = base + a.suffix(ctx) + await query(ctx, a.list, a.typed);
|
|
401
457
|
return {
|
|
402
458
|
request: redactedPreview(a.method, path, requestBody),
|
|
403
459
|
validation: await request(ctx, a.method, withDryRun(path), requestBody)
|
|
@@ -410,7 +466,7 @@ var automationCommands = actions.map((a) => ({
|
|
|
410
466
|
output = await request(
|
|
411
467
|
ctx,
|
|
412
468
|
a.method,
|
|
413
|
-
base + a.suffix(ctx) + query(ctx, a.list, a.typed),
|
|
469
|
+
base + a.suffix(ctx) + await query(ctx, a.list, a.typed),
|
|
414
470
|
body && { ...body, ...a.wait ? { commandId } : {} }
|
|
415
471
|
);
|
|
416
472
|
} catch (error) {
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
inspectCapabilityWithEnvelope,
|
|
12
12
|
listCapabilitiesWithEnvelope,
|
|
13
13
|
validateCapabilityWithEnvelope
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-QW3R6O7L.js";
|
|
15
15
|
import {
|
|
16
16
|
findGatewayDomain,
|
|
17
17
|
listCapabilityDiscoveryPrefixes,
|
|
@@ -20,24 +20,25 @@ import {
|
|
|
20
20
|
} from "./chunk-KPQY44JQ.js";
|
|
21
21
|
import {
|
|
22
22
|
resolveHost
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-P6VFCH3P.js";
|
|
24
24
|
import {
|
|
25
25
|
printError,
|
|
26
26
|
printOutput,
|
|
27
27
|
withOutputMetadata
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-ELCR235M.js";
|
|
29
29
|
import "./chunk-Y74WTIKJ.js";
|
|
30
30
|
import {
|
|
31
31
|
CredentialStoreUnreadableError,
|
|
32
32
|
SecureStoreAuthError
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-P7KL7IOH.js";
|
|
34
34
|
import {
|
|
35
35
|
safeJsonParse
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-LMCYSVVA.js";
|
|
37
37
|
import {
|
|
38
38
|
CliValidationError,
|
|
39
|
+
ExternalCliTokenError,
|
|
39
40
|
PermissionError
|
|
40
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-ZW4VMY5H.js";
|
|
41
42
|
|
|
42
43
|
// src/commands/capability/index.ts
|
|
43
44
|
import * as readline from "readline";
|
|
@@ -368,7 +369,7 @@ function printCapabilityError(error, host) {
|
|
|
368
369
|
);
|
|
369
370
|
return;
|
|
370
371
|
}
|
|
371
|
-
if (error instanceof CredentialStoreUnreadableError) {
|
|
372
|
+
if (error instanceof CredentialStoreUnreadableError || error instanceof ExternalCliTokenError) {
|
|
372
373
|
printError("config", error.message, error.hint, error.code);
|
|
373
374
|
return;
|
|
374
375
|
}
|
|
@@ -377,7 +378,7 @@ function printCapabilityError(error, host) {
|
|
|
377
378
|
return;
|
|
378
379
|
}
|
|
379
380
|
if (error instanceof PermissionError) {
|
|
380
|
-
printError("permission", error.message,
|
|
381
|
+
printError("permission", error.message, error.hint, error.code);
|
|
381
382
|
return;
|
|
382
383
|
}
|
|
383
384
|
if (error instanceof CapabilityGatewayError) {
|
|
@@ -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-T44M3PLZ.js";
|
|
9
9
|
import {
|
|
10
10
|
__commonJS,
|
|
11
11
|
__require
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-ZW4VMY5H.js";
|
|
13
13
|
|
|
14
14
|
// node_modules/jszip/node_modules/readable-stream/lib/internal/streams/stream.js
|
|
15
15
|
var require_stream = __commonJS({
|
|
@@ -4,15 +4,17 @@ import {
|
|
|
4
4
|
} from "./chunk-Y74WTIKJ.js";
|
|
5
5
|
import {
|
|
6
6
|
getCliToken
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-P7KL7IOH.js";
|
|
8
8
|
import {
|
|
9
9
|
getActiveHost,
|
|
10
10
|
getSandboxRuntimeRoot
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-LMCYSVVA.js";
|
|
12
12
|
import {
|
|
13
13
|
PermissionError,
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
externalCliTokenRequestOptions,
|
|
15
|
+
isApiErrorType,
|
|
16
|
+
readExternalCliToken
|
|
17
|
+
} from "./chunk-ZW4VMY5H.js";
|
|
16
18
|
|
|
17
19
|
// src/core/te-agent-credentials.ts
|
|
18
20
|
import { readFileSync } from "fs";
|
|
@@ -82,19 +84,27 @@ function readLegacyCredentials() {
|
|
|
82
84
|
}
|
|
83
85
|
}
|
|
84
86
|
function tryLoadTeAgentSandboxCredentials() {
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
87
|
+
const credentials = readSandboxCredentials();
|
|
88
|
+
return credentials.url ? { ...credentials, url: credentials.url } : null;
|
|
89
|
+
}
|
|
90
|
+
function readSandboxCredentials() {
|
|
91
|
+
let url = process.env.TE_CLAUDE_BASE_URL || null;
|
|
92
|
+
let sandboxId = process.env.SANDBOX_ID || null;
|
|
93
|
+
let sandboxSecretKey = process.env.SECRET_KEY || process.env.SANDBOX_SECRET_KEY || null;
|
|
94
|
+
if (!url || !sandboxId || !sandboxSecretKey) {
|
|
95
|
+
const persistent = readPersistentEnv();
|
|
96
|
+
url ||= persistent?.TE_CLAUDE_BASE_URL || null;
|
|
97
|
+
sandboxId ||= persistent?.SANDBOX_ID || null;
|
|
98
|
+
sandboxSecretKey ||= persistent?.SECRET_KEY || persistent?.SANDBOX_SECRET_KEY || null;
|
|
90
99
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
sandboxSecretKey
|
|
97
|
-
}
|
|
100
|
+
if (!url || !sandboxId || !sandboxSecretKey) {
|
|
101
|
+
const legacy = readLegacyCredentials();
|
|
102
|
+
url ||= typeof legacy?.url === "string" ? legacy.url : null;
|
|
103
|
+
sandboxId ||= typeof legacy?.sandboxId === "string" ? legacy.sandboxId : null;
|
|
104
|
+
const legacySecret = legacy?.sandboxSecretKey || legacy?.secretKey;
|
|
105
|
+
sandboxSecretKey ||= typeof legacySecret === "string" ? legacySecret : null;
|
|
106
|
+
}
|
|
107
|
+
return { url, sandboxId, sandboxSecretKey };
|
|
98
108
|
}
|
|
99
109
|
function getClaudeConfigDir() {
|
|
100
110
|
const fromEnv = process.env.CLAUDE_CONFIG_DIR;
|
|
@@ -145,7 +155,7 @@ async function fetchWithTimeout(url, init, timeoutMs = DEFAULT_TIMEOUT_MS) {
|
|
|
145
155
|
const controller = new AbortController();
|
|
146
156
|
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
147
157
|
try {
|
|
148
|
-
return await fetch(url, { ...init, signal: controller.signal });
|
|
158
|
+
return await fetch(url, { ...init, signal: controller.signal, ...externalCliTokenRequestOptions(url) });
|
|
149
159
|
} catch (err) {
|
|
150
160
|
if (err?.name === "AbortError") {
|
|
151
161
|
throw new TeAgentApiError(
|
|
@@ -189,9 +199,19 @@ function teClaudeBaseFromActiveHost(hostOverride) {
|
|
|
189
199
|
if (!h) return void 0;
|
|
190
200
|
return resolveTeClaudeBaseUrl(h);
|
|
191
201
|
}
|
|
192
|
-
async function signRequest(method, path2, hostOverride, includeJsonContentType = true) {
|
|
193
|
-
const
|
|
194
|
-
|
|
202
|
+
async function signRequest(method, path2, hostOverride, includeJsonContentType = true, authMode = "auto") {
|
|
203
|
+
const external = readExternalCliToken(hostOverride);
|
|
204
|
+
const configuredHost = hostOverride || getActiveHost();
|
|
205
|
+
const sandboxOnly = !hostOverride && (/* @__PURE__ */ new Set([
|
|
206
|
+
"/api/sandbox/models",
|
|
207
|
+
"/api/sandbox/models/select",
|
|
208
|
+
"/api/sandbox/sync/push",
|
|
209
|
+
"/api/sandbox/sync/push/skill",
|
|
210
|
+
"/api/sandbox/sync/pull",
|
|
211
|
+
"/api/sandbox/sync/pull/candidates"
|
|
212
|
+
])).has(path2.split("?")[0]);
|
|
213
|
+
const sandboxCred = external || configuredHost && !sandboxOnly ? null : tryLoadTeAgentSandboxCredentials();
|
|
214
|
+
if (authMode === "auto" && !hostOverride && sandboxCred && sandboxCred.sandboxId && sandboxCred.sandboxSecretKey) {
|
|
195
215
|
const headers = {
|
|
196
216
|
"X-Sandbox-Id": sandboxCred.sandboxId,
|
|
197
217
|
"X-Sandbox-Secret-Key": sandboxCred.sandboxSecretKey
|
|
@@ -205,14 +225,14 @@ async function signRequest(method, path2, hostOverride, includeJsonContentType =
|
|
|
205
225
|
authKind: "sandbox"
|
|
206
226
|
};
|
|
207
227
|
}
|
|
208
|
-
const baseUrl = hostOverride ? teClaudeBaseFromActiveHost(hostOverride) : sandboxCred?.url || teClaudeBaseFromActiveHost();
|
|
228
|
+
const baseUrl = hostOverride || external ? teClaudeBaseFromActiveHost(hostOverride || external?.url) : sandboxCred?.url || teClaudeBaseFromActiveHost();
|
|
209
229
|
if (!baseUrl) {
|
|
210
230
|
throw new TeAgentCredentialsError(
|
|
211
231
|
"Cannot determine the te-claude service URL",
|
|
212
232
|
"Run ae-cli config set-host <url> to configure the service URL, or execute inside a te-agent sandbox"
|
|
213
233
|
);
|
|
214
234
|
}
|
|
215
|
-
const hostForToken =
|
|
235
|
+
const hostForToken = configuredHost || baseUrl;
|
|
216
236
|
const contentTypeHeader = includeJsonContentType && (method === "POST" || method === "PATCH" || method === "PUT") ? { "Content-Type": "application/json" } : {};
|
|
217
237
|
const cliToken = await getCliToken(hostForToken);
|
|
218
238
|
return {
|
|
@@ -231,13 +251,14 @@ async function fetchSigned(options) {
|
|
|
231
251
|
options.method,
|
|
232
252
|
options.path,
|
|
233
253
|
options.hostOverride,
|
|
234
|
-
options.includeJsonContentType
|
|
254
|
+
options.includeJsonContentType,
|
|
255
|
+
options.authMode
|
|
235
256
|
);
|
|
236
257
|
return fetchWithTimeout(
|
|
237
258
|
signed.url,
|
|
238
259
|
{
|
|
239
260
|
method: options.method,
|
|
240
|
-
headers: signed.headers,
|
|
261
|
+
headers: { ...Object.fromEntries(new Headers(options.headers).entries()), ...signed.headers },
|
|
241
262
|
body: options.body
|
|
242
263
|
},
|
|
243
264
|
options.timeoutMs
|
|
@@ -246,7 +267,7 @@ async function fetchSigned(options) {
|
|
|
246
267
|
function errorDetails(parsed, defaultErrorPrefix, status) {
|
|
247
268
|
const nested = parsed && typeof parsed === "object" && parsed.error && typeof parsed.error === "object" ? parsed.error : parsed;
|
|
248
269
|
const message = typeof parsed?.error === "string" ? parsed.error : typeof nested?.message === "string" ? nested.message : typeof parsed?.message === "string" ? parsed.message : typeof parsed?.return_message === "string" ? parsed.return_message : `${defaultErrorPrefix} ${status}`;
|
|
249
|
-
const code = typeof nested?.code === "string" ? nested.code : typeof parsed?.code === "string" ? parsed.code : void 0;
|
|
270
|
+
const code = typeof nested?.code === "string" ? nested.code : typeof parsed?.code === "string" ? parsed.code : typeof parsed?.errorCode === "string" ? parsed.errorCode : void 0;
|
|
250
271
|
const hint = typeof nested?.hint === "string" ? nested.hint : typeof parsed?.hint === "string" ? parsed.hint : void 0;
|
|
251
272
|
const declaredType = isApiErrorType(nested?.type) ? nested.type : void 0;
|
|
252
273
|
const type = status === 401 ? "auth" : status === 403 ? "permission" : declaredType ?? ([400, 413, 422].includes(status) ? "validation" : status === 404 ? "not_found" : "api");
|
|
@@ -286,21 +307,23 @@ async function parseResponse(response, defaultErrorPrefix) {
|
|
|
286
307
|
}
|
|
287
308
|
return parsed;
|
|
288
309
|
}
|
|
289
|
-
async function postToMainApp(path2, body, hostOverride) {
|
|
310
|
+
async function postToMainApp(path2, body, hostOverride, authMode = "auto") {
|
|
290
311
|
const rawBody = JSON.stringify(body);
|
|
291
312
|
const response = await fetchSigned({
|
|
292
313
|
method: "POST",
|
|
293
314
|
path: path2,
|
|
294
315
|
body: rawBody,
|
|
295
|
-
hostOverride
|
|
316
|
+
hostOverride,
|
|
317
|
+
authMode
|
|
296
318
|
});
|
|
297
319
|
return parseResponse(response, "Main app returned");
|
|
298
320
|
}
|
|
299
|
-
async function getFromMainApp(path2, hostOverride) {
|
|
321
|
+
async function getFromMainApp(path2, hostOverride, authMode = "auto") {
|
|
300
322
|
const response = await fetchSigned({
|
|
301
323
|
method: "GET",
|
|
302
324
|
path: path2,
|
|
303
|
-
hostOverride
|
|
325
|
+
hostOverride,
|
|
326
|
+
authMode
|
|
304
327
|
});
|
|
305
328
|
return parseResponse(response, "Main app returned");
|
|
306
329
|
}
|
|
@@ -330,21 +353,23 @@ async function postSandboxSyncPull(args) {
|
|
|
330
353
|
mode: "merge"
|
|
331
354
|
});
|
|
332
355
|
}
|
|
333
|
-
async function deleteFromMainApp(path2, hostOverride) {
|
|
356
|
+
async function deleteFromMainApp(path2, hostOverride, authMode = "auto") {
|
|
334
357
|
const response = await fetchSigned({
|
|
335
358
|
method: "DELETE",
|
|
336
359
|
path: path2,
|
|
337
|
-
hostOverride
|
|
360
|
+
hostOverride,
|
|
361
|
+
authMode
|
|
338
362
|
});
|
|
339
363
|
return parseResponse(response, "Main app returned");
|
|
340
364
|
}
|
|
341
|
-
async function patchToMainApp(path2, body, hostOverride) {
|
|
365
|
+
async function patchToMainApp(path2, body, hostOverride, authMode = "auto") {
|
|
342
366
|
const rawBody = JSON.stringify(body);
|
|
343
367
|
const response = await fetchSigned({
|
|
344
368
|
method: "PATCH",
|
|
345
369
|
path: path2,
|
|
346
370
|
body: rawBody,
|
|
347
|
-
hostOverride
|
|
371
|
+
hostOverride,
|
|
372
|
+
authMode
|
|
348
373
|
});
|
|
349
374
|
return parseResponse(response, "Main app returned");
|
|
350
375
|
}
|
|
@@ -430,7 +455,8 @@ async function downloadFromMainApp(requestPath, outputPath, hostOverride) {
|
|
|
430
455
|
return await fetch(requestToSend.url, {
|
|
431
456
|
method: "GET",
|
|
432
457
|
headers: requestToSend.headers,
|
|
433
|
-
signal: controller.signal
|
|
458
|
+
signal: controller.signal,
|
|
459
|
+
...externalCliTokenRequestOptions(requestToSend.url)
|
|
434
460
|
});
|
|
435
461
|
} catch (error) {
|
|
436
462
|
if (error?.name === "AbortError") {
|
|
@@ -499,11 +525,12 @@ async function uploadToMainApp(path2, formData, hostOverride) {
|
|
|
499
525
|
|
|
500
526
|
export {
|
|
501
527
|
TeAgentCredentialsError,
|
|
502
|
-
tryLoadTeAgentSandboxCredentials,
|
|
503
528
|
getClaudeConfigDir,
|
|
504
529
|
resolveTeClaudeBaseUrl,
|
|
505
530
|
TeAgentApiError,
|
|
531
|
+
fetchSigned,
|
|
506
532
|
createTeAgentApiError,
|
|
533
|
+
parseResponse,
|
|
507
534
|
postToMainApp,
|
|
508
535
|
getFromMainApp,
|
|
509
536
|
getSandboxModels,
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
peekCliToken
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-P7KL7IOH.js";
|
|
5
5
|
import {
|
|
6
6
|
getActiveHost,
|
|
7
7
|
getConfigDir,
|
|
8
|
-
isAeSandboxRuntime
|
|
9
|
-
|
|
10
|
-
} from "./chunk-UQ77JXYH.js";
|
|
8
|
+
isAeSandboxRuntime
|
|
9
|
+
} from "./chunk-LMCYSVVA.js";
|
|
11
10
|
import {
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
externalCliTokenRequestOptions,
|
|
12
|
+
logger,
|
|
13
|
+
normalizeUrl,
|
|
14
|
+
readExternalCliToken,
|
|
15
|
+
redactExternalCliToken
|
|
16
|
+
} from "./chunk-ZW4VMY5H.js";
|
|
14
17
|
|
|
15
18
|
// src/core/install-process.ts
|
|
16
19
|
import spawn from "cross-spawn";
|
|
@@ -725,11 +728,13 @@ function recordVersionSyncResult(host, target, result) {
|
|
|
725
728
|
store.hosts[key] = entry;
|
|
726
729
|
writeSyncStore(store);
|
|
727
730
|
}
|
|
728
|
-
function
|
|
731
|
+
function isRegularCliVersion(version) {
|
|
729
732
|
const normalized = normalizeCliVersion(version);
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
+
return /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/.test(normalized) && normalized.split(".").every((part) => Number.isSafeInteger(Number(part)));
|
|
734
|
+
}
|
|
735
|
+
function isAutoSyncTargetEligible(version) {
|
|
736
|
+
if (!isRegularCliVersion(version)) return false;
|
|
737
|
+
const [major, minor, patch] = normalizeCliVersion(version).split(".").map(Number);
|
|
733
738
|
if (major > 6) return true;
|
|
734
739
|
if (major !== 6) return false;
|
|
735
740
|
if (minor > 1) return true;
|
|
@@ -966,7 +971,7 @@ function rootCommand(argv) {
|
|
|
966
971
|
const token = args[i];
|
|
967
972
|
if (token === "--") return void 0;
|
|
968
973
|
if (token.startsWith("-")) {
|
|
969
|
-
if (!token.includes("=") && ["--host", "--mcp-url", "--format", "--jq"].includes(token)) {
|
|
974
|
+
if (!token.includes("=") && ["--host", "--cli-token-file", "--mcp-url", "--format", "--jq"].includes(token)) {
|
|
970
975
|
i += 1;
|
|
971
976
|
}
|
|
972
977
|
continue;
|
|
@@ -981,13 +986,15 @@ function shouldSkipAutoSync(argv = process.argv) {
|
|
|
981
986
|
}
|
|
982
987
|
async function fetchCliConfig(host, cliToken) {
|
|
983
988
|
const url = new URL(CLI_CONFIG_PATH, host.endsWith("/") ? host : `${host}/`);
|
|
984
|
-
|
|
989
|
+
const external = readExternalCliToken(host)?.token === cliToken;
|
|
990
|
+
if (!external) url.searchParams.set("cli-token", cliToken);
|
|
985
991
|
const controller = new AbortController();
|
|
986
992
|
const timer = setTimeout(() => controller.abort(), FETCH_TIMEOUT_MS);
|
|
987
993
|
try {
|
|
988
994
|
const resp = await fetch(url.toString(), {
|
|
989
995
|
signal: controller.signal,
|
|
990
|
-
headers: { Accept: "application/json" }
|
|
996
|
+
headers: { Accept: "application/json", ...external ? { "cli-token": cliToken } : {} },
|
|
997
|
+
...externalCliTokenRequestOptions(url.toString())
|
|
991
998
|
});
|
|
992
999
|
if (!resp.ok) return null;
|
|
993
1000
|
const body = await resp.json();
|
|
@@ -1104,7 +1111,7 @@ async function refreshAndMaybeNotify(host, pkg, allowAutoSync) {
|
|
|
1104
1111
|
entry.localVersion = pkg.version;
|
|
1105
1112
|
entry.expectedVersion = expected;
|
|
1106
1113
|
entry.clusterVersion = cluster || entry.clusterVersion;
|
|
1107
|
-
const canAutoSync = allowAutoSync && isPublicAeCliPackage(pkg.name) && isAutoSyncTargetEligible(expected);
|
|
1114
|
+
const canAutoSync = allowAutoSync && isPublicAeCliPackage(pkg.name) && isRegularCliVersion(pkg.version) && isAutoSyncTargetEligible(expected);
|
|
1108
1115
|
if (canAutoSync) {
|
|
1109
1116
|
const confirmed = await fetchCliConfig(host, token);
|
|
1110
1117
|
if (confirmed) rememberKbAutoDiscoveryFeature(host, token, confirmed.projectSemanticKbAutoDiscovery ?? false);
|
|
@@ -1307,7 +1314,7 @@ async function applyJq(data, expr) {
|
|
|
1307
1314
|
if (!trimmed) return data;
|
|
1308
1315
|
let results;
|
|
1309
1316
|
try {
|
|
1310
|
-
results = await jqJson(data, trimmed);
|
|
1317
|
+
results = await jqJson(data ?? null, trimmed);
|
|
1311
1318
|
} catch (err) {
|
|
1312
1319
|
const message = err instanceof JqError ? err.message : err?.message || String(err);
|
|
1313
1320
|
const error = new Error(`Invalid --jq expression: ${message}`);
|
|
@@ -1328,7 +1335,7 @@ async function formatOutput(data, format, jqExpr) {
|
|
|
1328
1335
|
processed = await applyJq(outputData, jqExpr);
|
|
1329
1336
|
}
|
|
1330
1337
|
if (format === "table") {
|
|
1331
|
-
return formatTable(processed);
|
|
1338
|
+
return redactExternalCliToken(formatTable(processed));
|
|
1332
1339
|
}
|
|
1333
1340
|
const hostCompat = getPendingHostCompatNotice();
|
|
1334
1341
|
const updateNotice = getPendingUpdateNotice();
|
|
@@ -1343,7 +1350,7 @@ async function formatOutput(data, format, jqExpr) {
|
|
|
1343
1350
|
// Soft tip lives only under _notice (not mirrored into meta) to avoid duplicate fields.
|
|
1344
1351
|
...Object.keys(notices).length > 0 ? { _notice: notices } : {}
|
|
1345
1352
|
};
|
|
1346
|
-
return JSON.stringify(envelope, null, 2);
|
|
1353
|
+
return redactExternalCliToken(JSON.stringify(envelope, null, 2));
|
|
1347
1354
|
}
|
|
1348
1355
|
function formatError(type, message, hint, code, meta, details) {
|
|
1349
1356
|
const envelope = {
|
|
@@ -1351,7 +1358,7 @@ function formatError(type, message, hint, code, meta, details) {
|
|
|
1351
1358
|
error: { type, message, hint, code, ...details === void 0 ? {} : { details } },
|
|
1352
1359
|
...meta && Object.keys(meta).length > 0 ? { meta } : {}
|
|
1353
1360
|
};
|
|
1354
|
-
return JSON.stringify(envelope, null, 2);
|
|
1361
|
+
return redactExternalCliToken(JSON.stringify(envelope, null, 2));
|
|
1355
1362
|
}
|
|
1356
1363
|
function printError(type, message, hint, code, meta, options = {}) {
|
|
1357
1364
|
const formatted = formatError(type, message, hint, code, meta, options.details);
|
|
@@ -1389,7 +1396,7 @@ async function printOutput(data, format, jqExpr, options = {}) {
|
|
|
1389
1396
|
const recoveryData = options.redactErrors ? sensitiveRecoveryData(unwrapOutputData(data)) : unwrapOutputData(data);
|
|
1390
1397
|
await new Promise((resolve, reject) => {
|
|
1391
1398
|
process.stdout.write(
|
|
1392
|
-
JSON.stringify({ ...recovery, data: recoveryData }, null, 2) + "\n",
|
|
1399
|
+
redactExternalCliToken(JSON.stringify({ ...recovery, data: recoveryData }, null, 2)) + "\n",
|
|
1393
1400
|
(error2) => error2 ? reject(error2) : resolve()
|
|
1394
1401
|
);
|
|
1395
1402
|
});
|