@thinkingai/ae-cli 1.0.24 → 1.0.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 +17 -2
- package/README.zh.md +18 -2
- package/dist/auth-5NSDQFQB.js +454 -0
- package/dist/{auth-4OPL4YWG.js → auth-H2376DEF.js} +2 -2
- package/dist/chunk-AD5V3ZPJ.js +217 -0
- package/dist/chunk-CAQYQA4R.js +399 -0
- package/dist/{chunk-JJCRURTR.js → chunk-CLJF7MQA.js} +1 -1
- package/dist/chunk-GSJGPNKK.js +49 -0
- package/dist/chunk-IMBKVXKY.js +478 -0
- package/dist/chunk-KAEZTSXN.js +99 -0
- package/dist/{chunk-MZW6NOVS.js → chunk-LU7SXK4Q.js} +27 -8
- package/dist/chunk-OJDNO5QY.js +63 -0
- package/dist/{chunk-DC66L5AM.js → chunk-SRJIAOBN.js} +76 -91
- package/dist/{chunk-OVHL4JAC.js → chunk-WCHI7725.js} +44 -47
- package/dist/{client-TDH6MUWM.js → client-FCMK3XEK.js} +5 -3
- package/dist/config-64G36TJL.js +130 -0
- package/dist/index.js +50 -17
- package/dist/model-EZ6K7FXI.js +134 -0
- package/dist/{raw-EM7AP3RT.js → raw-VEF3D6UD.js} +11 -6
- package/dist/sync-NRODEVNH.js +385 -0
- package/dist/te-agent-7U7JLJKU.js +524 -0
- package/dist/{te-analysis-3KFSNUCJ.js → te-analysis-A2OSGHQ4.js} +136 -20
- package/dist/{te-audience-GMYJFCSC.js → te-audience-LI67PPGO.js} +5 -4
- package/dist/{te-common-YLERCMQI.js → te-common-35WVU3C5.js} +19 -8
- package/dist/{te-community-PYDN5A6B.js → te-community-LEAP6PWT.js} +4 -3
- package/dist/{te-dataops-ETWS5O3X.js → te-dataops-N2LGZBOX.js} +4 -3
- package/dist/{te-engage-ROJVZHDA.js → te-engage-H7C72Z46.js} +105 -49
- package/dist/{te-kb-VUNS2CC7.js → te-kb-I2OKTBAI.js} +225 -29
- package/dist/{te-meta-3EFWLM3A.js → te-meta-HBTIEDRO.js} +4 -3
- package/dist/te-team-EM5OWRQL.js +529 -0
- package/package.json +10 -2
- package/skills/ae-agent/SKILL.md +134 -0
- package/skills/ae-analysis/SKILL.md +1 -1
- package/skills/ae-analysis/references/drilldown_user_events.md +1 -1
- package/skills/ae-analysis/references/drilldown_users.md +2 -2
- package/skills/ae-analysis/references/list_clusters.md +4 -2
- package/skills/ae-analysis/references/query_adhoc.md +3 -2
- package/skills/ae-analysis/references/query_entity_details.md +1 -1
- package/skills/ae-analysis-global/SKILL.md +51 -0
- package/skills/ae-analysis-global/references/list_query_clusters.md +67 -0
- package/skills/ae-community/SKILL.md +2 -3
- package/skills/ae-dataops/SKILL.md +1 -2
- package/skills/ae-engage/SKILL.md +26 -2
- package/skills/ae-engage/references/add-approver.md +0 -1
- package/skills/ae-engage/references/add-channel.md +0 -1
- package/skills/ae-engage/references/approver-list.md +0 -1
- package/skills/ae-engage/references/build-task-save-guide.md +283 -0
- package/skills/ae-engage/references/cancel-query-by-request-id.md +0 -1
- package/skills/ae-engage/references/channel-detail.md +0 -1
- package/skills/ae-engage/references/channel-list.md +0 -1
- package/skills/ae-engage/references/config-channel-detail.md +0 -1
- package/skills/ae-engage/references/config-channel-list.md +0 -1
- package/skills/ae-engage/references/config-item-analysis-report.md +0 -1
- package/skills/ae-engage/references/config-item-detail.md +0 -1
- package/skills/ae-engage/references/config-item-list.md +0 -1
- package/skills/ae-engage/references/config-item-strategy-comparison.md +0 -1
- package/skills/ae-engage/references/config-item-trigger-report.md +0 -1
- package/skills/ae-engage/references/copy-config-template.md +0 -1
- package/skills/ae-engage/references/delete-channel.md +0 -1
- package/skills/ae-engage/references/delete-config-channel.md +0 -1
- package/skills/ae-engage/references/delete-config-item.md +0 -1
- package/skills/ae-engage/references/delete-flow.md +0 -1
- package/skills/ae-engage/references/flow-ab-split-node-report.md +0 -1
- package/skills/ae-engage/references/flow-detail.md +0 -1
- package/skills/ae-engage/references/flow-list.md +0 -1
- package/skills/ae-engage/references/flow-node-config-schema.md +0 -1
- package/skills/ae-engage/references/flow-node-detail-report.md +0 -1
- package/skills/ae-engage/references/flow-node-overview-report.md +0 -1
- package/skills/ae-engage/references/flow-process-report.md +0 -1
- package/skills/ae-engage/references/manage-flow.md +0 -1
- package/skills/ae-engage/references/manage-strategy.md +0 -1
- package/skills/ae-engage/references/manage-task.md +0 -1
- package/skills/ae-engage/references/modify-flow-base-info.md +0 -1
- package/skills/ae-engage/references/save-task.md +304 -0
- package/skills/ae-engage/references/strategy-detail.md +0 -1
- package/skills/ae-engage/references/strategy-list.md +0 -1
- package/skills/ae-engage/references/task-data-detail.md +0 -1
- package/skills/ae-engage/references/task-data-overview.md +0 -1
- package/skills/ae-engage/references/task-detail.md +0 -1
- package/skills/ae-engage/references/task-experiment-report.md +0 -1
- package/skills/ae-engage/references/task-list.md +0 -1
- package/skills/ae-engage/references/task-metric-detail.md +0 -1
- package/skills/ae-engage/references/task-stats.md +0 -1
- package/skills/ae-engage/references/update-channel-status.md +0 -1
- package/skills/ae-engage/references/update-config-channel-status.md +0 -1
- package/skills/ae-engage/references/validate-flow-node-config.md +0 -1
- package/skills/ae-engage/references/whitelist-list.md +0 -1
- package/skills/ae-kb/SKILL.md +284 -0
- package/skills/ae-team/SKILL.md +164 -0
- package/skills/ae-team/references/ai-generate.md +39 -0
- package/skills/ae-team/references/create.md +94 -0
- package/skills/ae-team/references/delete.md +39 -0
- package/skills/ae-team/references/list-projects.md +45 -0
- package/skills/ae-team/references/list-templates.md +38 -0
- package/skills/ae-team/references/list.md +39 -0
- package/skills/ae-team/references/run-artifacts.md +51 -0
- package/skills/ae-team/references/run-cancel.md +38 -0
- package/skills/ae-team/references/run-chat.md +57 -0
- package/skills/ae-team/references/run-reply.md +41 -0
- package/skills/ae-team/references/run-result.md +75 -0
- package/skills/ae-team/references/run-start.md +73 -0
- package/skills/ae-team/references/run-watch.md +82 -0
- package/skills/ae-team/references/update.md +47 -0
- package/dist/auth-PBPAZQWP.js +0 -168
- package/dist/chunk-47MTN54I.js +0 -285
- package/dist/config-5ELRYAIH.js +0 -257
|
@@ -0,0 +1,529 @@
|
|
|
1
|
+
import {
|
|
2
|
+
kbApi
|
|
3
|
+
} from "./chunk-OJDNO5QY.js";
|
|
4
|
+
import {
|
|
5
|
+
printError,
|
|
6
|
+
printOutput
|
|
7
|
+
} from "./chunk-CLJF7MQA.js";
|
|
8
|
+
import "./chunk-WCHI7725.js";
|
|
9
|
+
import "./chunk-GSJGPNKK.js";
|
|
10
|
+
import "./chunk-CAQYQA4R.js";
|
|
11
|
+
import "./chunk-SRJIAOBN.js";
|
|
12
|
+
|
|
13
|
+
// src/commands/te-team/shared.ts
|
|
14
|
+
var API_PREFIX = process.env.AE_API_PREFIX ?? "/agent";
|
|
15
|
+
var BASE_TEAM_PATH = `${API_PREFIX}/api/external/team/teams`;
|
|
16
|
+
var BASE_RUN_PATH = `${API_PREFIX}/api/external/team/teamrun`;
|
|
17
|
+
var BASE_TPL_PATH = `${API_PREFIX}/api/external/team/team-templates`;
|
|
18
|
+
|
|
19
|
+
// src/commands/te-team/team/list-teams.ts
|
|
20
|
+
var listTeams = {
|
|
21
|
+
service: "team",
|
|
22
|
+
command: "+list",
|
|
23
|
+
description: "List all teams visible to the current user.",
|
|
24
|
+
flags: [],
|
|
25
|
+
risk: "read",
|
|
26
|
+
dryRun: (ctx) => ({ method: "GET", url: `${ctx.host().replace(/\/$/, "")}${BASE_TEAM_PATH}` }),
|
|
27
|
+
execute: async (ctx) => kbApi(ctx, "GET", BASE_TEAM_PATH)
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
// src/commands/te-team/team/create-team.ts
|
|
31
|
+
var VALID_SCOPES = /* @__PURE__ */ new Set(["personal", "company"]);
|
|
32
|
+
function buildBody(ctx) {
|
|
33
|
+
const body = {
|
|
34
|
+
name: ctx.str("name"),
|
|
35
|
+
config: ctx.json("config")
|
|
36
|
+
};
|
|
37
|
+
const description = ctx.str("description");
|
|
38
|
+
if (description) body.description = description;
|
|
39
|
+
const scope = ctx.str("scope");
|
|
40
|
+
if (scope) body.scope = scope;
|
|
41
|
+
const enabled = ctx.json("enabled");
|
|
42
|
+
if (enabled !== void 0) body.enabled = enabled;
|
|
43
|
+
return body;
|
|
44
|
+
}
|
|
45
|
+
var createTeam = {
|
|
46
|
+
service: "team",
|
|
47
|
+
command: "+create",
|
|
48
|
+
description: "Create a new AI agent team.",
|
|
49
|
+
flags: [
|
|
50
|
+
{ name: "name", type: "string", required: true, desc: "Team name (1\u2013100 chars)" },
|
|
51
|
+
{ name: "config", type: "json", required: true, desc: "TeamConfig JSON object" },
|
|
52
|
+
{ name: "description", type: "string", required: false, desc: "Team description (\u22642000 chars)" },
|
|
53
|
+
{ name: "scope", type: "string", required: false, desc: "personal (default) | company" },
|
|
54
|
+
{ name: "enabled", type: "boolean", required: false, desc: "Whether enabled, default true" }
|
|
55
|
+
],
|
|
56
|
+
risk: "write",
|
|
57
|
+
validate: (ctx) => {
|
|
58
|
+
const scope = ctx.str("scope");
|
|
59
|
+
if (scope && !VALID_SCOPES.has(scope)) {
|
|
60
|
+
throw new Error(`Invalid --scope: ${scope}. Must be personal | company`);
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
dryRun: (ctx) => ({
|
|
64
|
+
method: "POST",
|
|
65
|
+
url: `${ctx.host().replace(/\/$/, "")}${BASE_TEAM_PATH}`,
|
|
66
|
+
body: buildBody(ctx)
|
|
67
|
+
}),
|
|
68
|
+
execute: async (ctx) => kbApi(ctx, "POST", BASE_TEAM_PATH, {}, buildBody(ctx))
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
// src/commands/te-team/team/update-team.ts
|
|
72
|
+
var VALID_SCOPES2 = /* @__PURE__ */ new Set(["personal", "company"]);
|
|
73
|
+
function buildBody2(ctx) {
|
|
74
|
+
const body = {};
|
|
75
|
+
const name = ctx.str("name");
|
|
76
|
+
if (name) body.name = name;
|
|
77
|
+
const config = ctx.json("config");
|
|
78
|
+
if (config !== void 0) body.config = config;
|
|
79
|
+
const description = ctx.str("description");
|
|
80
|
+
if (description) body.description = description;
|
|
81
|
+
const scope = ctx.str("scope");
|
|
82
|
+
if (scope) body.scope = scope;
|
|
83
|
+
const enabled = ctx.json("enabled");
|
|
84
|
+
if (enabled !== void 0) body.enabled = enabled;
|
|
85
|
+
return body;
|
|
86
|
+
}
|
|
87
|
+
var updateTeam = {
|
|
88
|
+
service: "team",
|
|
89
|
+
command: "+update",
|
|
90
|
+
description: "Update an existing team (PATCH \u2014 only provided fields are changed).",
|
|
91
|
+
flags: [
|
|
92
|
+
{ name: "id", type: "string", required: true, desc: "Team ID" },
|
|
93
|
+
{ name: "name", type: "string", required: false, desc: "New team name" },
|
|
94
|
+
{ name: "config", type: "json", required: false, desc: "New TeamConfig JSON" },
|
|
95
|
+
{ name: "description", type: "string", required: false, desc: "New description" },
|
|
96
|
+
{ name: "scope", type: "string", required: false, desc: "personal | company" },
|
|
97
|
+
{ name: "enabled", type: "boolean", required: false, desc: "Whether enabled" }
|
|
98
|
+
],
|
|
99
|
+
risk: "write",
|
|
100
|
+
validate: (ctx) => {
|
|
101
|
+
const scope = ctx.str("scope");
|
|
102
|
+
if (scope && !VALID_SCOPES2.has(scope)) {
|
|
103
|
+
throw new Error(`Invalid --scope: ${scope}. Must be personal | company`);
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
dryRun: (ctx) => ({
|
|
107
|
+
method: "PATCH",
|
|
108
|
+
url: `${ctx.host().replace(/\/$/, "")}${BASE_TEAM_PATH}/${ctx.str("id")}`,
|
|
109
|
+
body: buildBody2(ctx)
|
|
110
|
+
}),
|
|
111
|
+
execute: async (ctx) => kbApi(ctx, "PATCH", `${BASE_TEAM_PATH}/${ctx.str("id")}`, {}, buildBody2(ctx))
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
// src/commands/te-team/team/delete-team.ts
|
|
115
|
+
var deleteTeam = {
|
|
116
|
+
service: "team",
|
|
117
|
+
command: "+delete",
|
|
118
|
+
description: "Delete a team by ID. Returns 409 if there are running tasks.",
|
|
119
|
+
flags: [
|
|
120
|
+
{ name: "id", type: "string", required: true, desc: "Team ID" }
|
|
121
|
+
],
|
|
122
|
+
risk: "write",
|
|
123
|
+
dryRun: (ctx) => ({
|
|
124
|
+
method: "DELETE",
|
|
125
|
+
url: `${ctx.host().replace(/\/$/, "")}${BASE_TEAM_PATH}/${ctx.str("id")}`
|
|
126
|
+
}),
|
|
127
|
+
execute: async (ctx) => kbApi(ctx, "DELETE", `${BASE_TEAM_PATH}/${ctx.str("id")}`)
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
// src/commands/te-team/team/ai-generate.ts
|
|
131
|
+
var AI_GEN_PATH = `${BASE_TEAM_PATH}/ai-generate`;
|
|
132
|
+
function buildBody3(ctx) {
|
|
133
|
+
const body = { prompt: ctx.str("prompt") };
|
|
134
|
+
const model = ctx.str("model");
|
|
135
|
+
if (model) body.model = model;
|
|
136
|
+
return body;
|
|
137
|
+
}
|
|
138
|
+
var aiGenerate = {
|
|
139
|
+
service: "team",
|
|
140
|
+
command: "+ai-generate",
|
|
141
|
+
description: "Use AI to generate a team config draft from a goal description.",
|
|
142
|
+
flags: [
|
|
143
|
+
{ name: "prompt", type: "string", required: true, desc: "Team goal description (1\u20132000 chars)" },
|
|
144
|
+
{ name: "model", type: "string", required: false, desc: "Model ID to use for generation" }
|
|
145
|
+
],
|
|
146
|
+
risk: "read",
|
|
147
|
+
dryRun: (ctx) => ({
|
|
148
|
+
method: "POST",
|
|
149
|
+
url: `${ctx.host().replace(/\/$/, "")}${AI_GEN_PATH}`,
|
|
150
|
+
body: buildBody3(ctx)
|
|
151
|
+
}),
|
|
152
|
+
execute: async (ctx) => kbApi(ctx, "POST", AI_GEN_PATH, {}, buildBody3(ctx))
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
// src/commands/te-team/team/list-templates.ts
|
|
156
|
+
var listTemplates = {
|
|
157
|
+
service: "team",
|
|
158
|
+
command: "+list-templates",
|
|
159
|
+
description: "List available team templates.",
|
|
160
|
+
flags: [
|
|
161
|
+
{ name: "locale", type: "string", required: false, desc: "Locale: zh (default) | en | ja | ko" }
|
|
162
|
+
],
|
|
163
|
+
risk: "read",
|
|
164
|
+
dryRun: (ctx) => {
|
|
165
|
+
const params = {};
|
|
166
|
+
const locale = ctx.str("locale");
|
|
167
|
+
if (locale) params.locale = locale;
|
|
168
|
+
return { method: "GET", url: `${ctx.host().replace(/\/$/, "")}${BASE_TPL_PATH}`, params };
|
|
169
|
+
},
|
|
170
|
+
execute: async (ctx) => {
|
|
171
|
+
const params = {};
|
|
172
|
+
const locale = ctx.str("locale");
|
|
173
|
+
if (locale) params.locale = locale;
|
|
174
|
+
return kbApi(ctx, "GET", BASE_TPL_PATH, params);
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
// src/commands/te-team/team/list-projects.ts
|
|
179
|
+
var OAUTH_CHECK_PATH = `${API_PREFIX}/api/oauth/check`;
|
|
180
|
+
var listProjects = {
|
|
181
|
+
service: "team",
|
|
182
|
+
command: "+list-projects",
|
|
183
|
+
description: "List all projects available to the current user (from /api/oauth/check).",
|
|
184
|
+
flags: [],
|
|
185
|
+
risk: "read",
|
|
186
|
+
dryRun: (ctx) => ({ method: "POST", url: `${ctx.host().replace(/\/$/, "")}${OAUTH_CHECK_PATH}` }),
|
|
187
|
+
execute: async (ctx) => {
|
|
188
|
+
const accessToken = await ctx.token();
|
|
189
|
+
const data = await kbApi(ctx, "POST", OAUTH_CHECK_PATH, {}, { accessToken });
|
|
190
|
+
return data?.projectInfoList ?? data;
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
// src/commands/te-team/team/index.ts
|
|
195
|
+
var commands = [
|
|
196
|
+
listTeams,
|
|
197
|
+
createTeam,
|
|
198
|
+
updateTeam,
|
|
199
|
+
deleteTeam,
|
|
200
|
+
aiGenerate,
|
|
201
|
+
listTemplates,
|
|
202
|
+
listProjects
|
|
203
|
+
];
|
|
204
|
+
var team_default = commands;
|
|
205
|
+
|
|
206
|
+
// src/commands/te-team/run/start-run.ts
|
|
207
|
+
var START_PATH = `${BASE_RUN_PATH}/start`;
|
|
208
|
+
function buildBody4(ctx) {
|
|
209
|
+
const body = {
|
|
210
|
+
teamId: ctx.str("team-id"),
|
|
211
|
+
input: ctx.str("input")
|
|
212
|
+
};
|
|
213
|
+
const conversationId = ctx.str("conversation-id");
|
|
214
|
+
if (conversationId) body.conversationId = conversationId;
|
|
215
|
+
const notification = ctx.json("notification");
|
|
216
|
+
if (notification) body.notification = notification;
|
|
217
|
+
const saveToKbId = ctx.str("save-to-kb-id");
|
|
218
|
+
if (saveToKbId) body.saveToKbId = saveToKbId;
|
|
219
|
+
const projectIds = ctx.json("project-ids");
|
|
220
|
+
if (projectIds) body.projectIds = projectIds;
|
|
221
|
+
const projectNames = ctx.json("project-names");
|
|
222
|
+
if (projectNames) body.projectNames = projectNames;
|
|
223
|
+
const spaceIds = ctx.json("space-ids");
|
|
224
|
+
if (spaceIds) body.spaceIds = spaceIds;
|
|
225
|
+
const spaceNames = ctx.json("space-names");
|
|
226
|
+
if (spaceNames) body.spaceNames = spaceNames;
|
|
227
|
+
const dwSpaceCodes = ctx.json("dw-space-codes");
|
|
228
|
+
if (dwSpaceCodes) body.dwSpaceCodes = dwSpaceCodes;
|
|
229
|
+
const dwSpaceNames = ctx.json("dw-space-names");
|
|
230
|
+
if (dwSpaceNames) body.dwSpaceNames = dwSpaceNames;
|
|
231
|
+
return body;
|
|
232
|
+
}
|
|
233
|
+
var startRun = {
|
|
234
|
+
service: "team",
|
|
235
|
+
command: "+run-start",
|
|
236
|
+
description: "Start a new TeamRun for the given team.",
|
|
237
|
+
flags: [
|
|
238
|
+
{ name: "team-id", type: "string", required: true, desc: "Team ID" },
|
|
239
|
+
{ name: "input", type: "string", required: true, desc: "Task input (1\u201350000 chars)" },
|
|
240
|
+
{ name: "conversation-id", type: "string", required: false, desc: "Associated conversation ID" },
|
|
241
|
+
{ name: "notification", type: "json", required: false, desc: 'Notification config JSON, e.g. {"channels":["feishu"],"feishuChatId":"..."}' },
|
|
242
|
+
{ name: "save-to-kb-id", type: "string", required: false, desc: "Knowledge base ID to save result to on completion" },
|
|
243
|
+
{ name: "project-ids", type: "json", required: false, desc: 'Associated project ID list, e.g. ["id1"]' },
|
|
244
|
+
{ name: "project-names", type: "json", required: false, desc: "Associated project name list JSON" },
|
|
245
|
+
{ name: "space-ids", type: "json", required: false, desc: "Associated space ID list JSON" },
|
|
246
|
+
{ name: "space-names", type: "json", required: false, desc: "Associated space name list JSON" },
|
|
247
|
+
{ name: "dw-space-codes", type: "json", required: false, desc: "Associated DW space code list JSON" },
|
|
248
|
+
{ name: "dw-space-names", type: "json", required: false, desc: "Associated DW space name list JSON" }
|
|
249
|
+
],
|
|
250
|
+
risk: "write",
|
|
251
|
+
dryRun: (ctx) => ({
|
|
252
|
+
method: "POST",
|
|
253
|
+
url: `${ctx.host().replace(/\/$/, "")}${START_PATH}`,
|
|
254
|
+
body: buildBody4(ctx)
|
|
255
|
+
}),
|
|
256
|
+
execute: async (ctx) => kbApi(ctx, "POST", START_PATH, {}, buildBody4(ctx))
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
// src/commands/te-team/run/chat-run.ts
|
|
260
|
+
var CHAT_PATH = `${BASE_RUN_PATH}/chat`;
|
|
261
|
+
function buildBody5(ctx) {
|
|
262
|
+
const body = {
|
|
263
|
+
teamId: ctx.str("team-id"),
|
|
264
|
+
input: ctx.str("input")
|
|
265
|
+
};
|
|
266
|
+
const sessionId = ctx.str("session-id");
|
|
267
|
+
if (sessionId) body.sessionId = sessionId;
|
|
268
|
+
return body;
|
|
269
|
+
}
|
|
270
|
+
var chatRun = {
|
|
271
|
+
service: "team",
|
|
272
|
+
command: "+run-chat",
|
|
273
|
+
description: "Chat with a team in multi-turn mode. Auto-resumes if a run is in waiting_user state.",
|
|
274
|
+
flags: [
|
|
275
|
+
{ name: "team-id", type: "string", required: true, desc: "Team ID" },
|
|
276
|
+
{ name: "input", type: "string", required: true, desc: "User input" },
|
|
277
|
+
{ name: "session-id", type: "string", required: false, desc: "Existing session ID for continuing a conversation" }
|
|
278
|
+
],
|
|
279
|
+
risk: "write",
|
|
280
|
+
dryRun: (ctx) => ({
|
|
281
|
+
method: "POST",
|
|
282
|
+
url: `${ctx.host().replace(/\/$/, "")}${CHAT_PATH}`,
|
|
283
|
+
body: buildBody5(ctx)
|
|
284
|
+
}),
|
|
285
|
+
execute: async (ctx) => kbApi(ctx, "POST", CHAT_PATH, {}, buildBody5(ctx))
|
|
286
|
+
};
|
|
287
|
+
|
|
288
|
+
// src/commands/te-team/run/cancel-run.ts
|
|
289
|
+
var cancelRun = {
|
|
290
|
+
service: "team",
|
|
291
|
+
command: "+run-cancel",
|
|
292
|
+
description: "Cancel a TeamRun.",
|
|
293
|
+
flags: [
|
|
294
|
+
{ name: "id", type: "string", required: true, desc: "TeamRun ID" }
|
|
295
|
+
],
|
|
296
|
+
risk: "write",
|
|
297
|
+
dryRun: (ctx) => ({
|
|
298
|
+
method: "POST",
|
|
299
|
+
url: `${ctx.host().replace(/\/$/, "")}${BASE_RUN_PATH}/${ctx.str("id")}/cancel`
|
|
300
|
+
}),
|
|
301
|
+
execute: async (ctx) => kbApi(ctx, "POST", `${BASE_RUN_PATH}/${ctx.str("id")}/cancel`, {}, {})
|
|
302
|
+
};
|
|
303
|
+
|
|
304
|
+
// src/commands/te-team/run/reply-run.ts
|
|
305
|
+
function buildBody6(ctx) {
|
|
306
|
+
return { input: ctx.str("input") };
|
|
307
|
+
}
|
|
308
|
+
var replyRun = {
|
|
309
|
+
service: "team",
|
|
310
|
+
command: "+run-reply",
|
|
311
|
+
description: "Reply to a TeamRun that is in waiting_user state.",
|
|
312
|
+
flags: [
|
|
313
|
+
{ name: "id", type: "string", required: true, desc: "TeamRun ID (must be in waiting_user state)" },
|
|
314
|
+
{ name: "input", type: "string", required: true, desc: "User reply content (1\u201350000 chars)" }
|
|
315
|
+
],
|
|
316
|
+
risk: "write",
|
|
317
|
+
dryRun: (ctx) => ({
|
|
318
|
+
method: "POST",
|
|
319
|
+
url: `${ctx.host().replace(/\/$/, "")}${BASE_RUN_PATH}/${ctx.str("id")}/reply`,
|
|
320
|
+
body: buildBody6(ctx)
|
|
321
|
+
}),
|
|
322
|
+
execute: async (ctx) => kbApi(ctx, "POST", `${BASE_RUN_PATH}/${ctx.str("id")}/reply`, {}, buildBody6(ctx))
|
|
323
|
+
};
|
|
324
|
+
|
|
325
|
+
// src/commands/te-team/run/get-result.ts
|
|
326
|
+
var getResult = {
|
|
327
|
+
service: "team",
|
|
328
|
+
command: "+run-result",
|
|
329
|
+
description: "Get the full result of a TeamRun (all steps and events).",
|
|
330
|
+
flags: [
|
|
331
|
+
{ name: "id", type: "string", required: true, desc: "TeamRun ID" }
|
|
332
|
+
],
|
|
333
|
+
risk: "read",
|
|
334
|
+
dryRun: (ctx) => ({
|
|
335
|
+
method: "GET",
|
|
336
|
+
url: `${ctx.host().replace(/\/$/, "")}${BASE_RUN_PATH}/${ctx.str("id")}/result`
|
|
337
|
+
}),
|
|
338
|
+
execute: async (ctx) => kbApi(ctx, "GET", `${BASE_RUN_PATH}/${ctx.str("id")}/result`)
|
|
339
|
+
};
|
|
340
|
+
|
|
341
|
+
// src/commands/te-team/run/list-artifacts.ts
|
|
342
|
+
var listArtifacts = {
|
|
343
|
+
service: "team",
|
|
344
|
+
command: "+run-artifacts",
|
|
345
|
+
description: "List artifacts produced by a TeamRun.",
|
|
346
|
+
flags: [
|
|
347
|
+
{ name: "id", type: "string", required: true, desc: "TeamRun ID" },
|
|
348
|
+
{ name: "artifact-type", type: "string", required: false, desc: "Filter by artifact type" },
|
|
349
|
+
{ name: "include-content", type: "boolean", required: false, desc: "Include full artifact content (default false)" }
|
|
350
|
+
],
|
|
351
|
+
risk: "read",
|
|
352
|
+
dryRun: (ctx) => {
|
|
353
|
+
const params = {};
|
|
354
|
+
const artifactType = ctx.str("artifact-type");
|
|
355
|
+
if (artifactType) params.artifactType = artifactType;
|
|
356
|
+
const includeContent = ctx.json("include-content");
|
|
357
|
+
if (includeContent !== void 0) params.includeContent = includeContent;
|
|
358
|
+
return {
|
|
359
|
+
method: "GET",
|
|
360
|
+
url: `${ctx.host().replace(/\/$/, "")}${BASE_RUN_PATH}/${ctx.str("id")}/artifacts`,
|
|
361
|
+
params
|
|
362
|
+
};
|
|
363
|
+
},
|
|
364
|
+
execute: async (ctx) => {
|
|
365
|
+
const params = {};
|
|
366
|
+
const artifactType = ctx.str("artifact-type");
|
|
367
|
+
if (artifactType) params.artifactType = artifactType;
|
|
368
|
+
const includeContent = ctx.json("include-content");
|
|
369
|
+
if (includeContent !== void 0) params.includeContent = includeContent;
|
|
370
|
+
return kbApi(ctx, "GET", `${BASE_RUN_PATH}/${ctx.str("id")}/artifacts`, params);
|
|
371
|
+
}
|
|
372
|
+
};
|
|
373
|
+
|
|
374
|
+
// src/commands/te-team/run/watch-run.ts
|
|
375
|
+
var STREAM_PATH = (id) => `${BASE_RUN_PATH}/stream/${id}`;
|
|
376
|
+
var SUCCESS_STATUSES = /* @__PURE__ */ new Set(["completed", "partial_success"]);
|
|
377
|
+
var MAX_RECONNECTS = 10;
|
|
378
|
+
var RECONNECT_DELAY_MS = 2e3;
|
|
379
|
+
var watchRun = {
|
|
380
|
+
service: "team",
|
|
381
|
+
command: "+run-watch",
|
|
382
|
+
description: "Stream a TeamRun via SSE. Exits 0 on success, 1 on failure, 2 on waiting_user.",
|
|
383
|
+
flags: [
|
|
384
|
+
{ name: "id", type: "string", required: true, desc: "TeamRun ID" },
|
|
385
|
+
{ name: "after-log", type: "number", required: false, desc: "Reconnect: replay only logs after this timestamp" },
|
|
386
|
+
{ name: "quiet", type: "boolean", required: false, desc: "Suppress log/status lines on stderr" }
|
|
387
|
+
],
|
|
388
|
+
risk: "read",
|
|
389
|
+
dryRun: (ctx) => ({
|
|
390
|
+
method: "GET",
|
|
391
|
+
url: `${ctx.host().replace(/\/$/, "")}${STREAM_PATH(ctx.str("id"))}`
|
|
392
|
+
}),
|
|
393
|
+
execute: async (ctx) => {
|
|
394
|
+
const runId = ctx.str("id");
|
|
395
|
+
const quiet = ctx.bool("quiet");
|
|
396
|
+
const token = await ctx.token();
|
|
397
|
+
const host = ctx.host().replace(/\/$/, "");
|
|
398
|
+
let lastLogTs = ctx.num("after-log") || void 0;
|
|
399
|
+
let reconnects = 0;
|
|
400
|
+
while (reconnects <= MAX_RECONNECTS) {
|
|
401
|
+
const url = new URL(`${host}${STREAM_PATH(runId)}`);
|
|
402
|
+
if (lastLogTs !== void 0) url.searchParams.set("afterLog", String(lastLogTs));
|
|
403
|
+
let resp;
|
|
404
|
+
try {
|
|
405
|
+
resp = await fetch(url.toString(), {
|
|
406
|
+
headers: {
|
|
407
|
+
Authorization: `bearer ${token}`,
|
|
408
|
+
Accept: "text/event-stream",
|
|
409
|
+
"Cache-Control": "no-cache"
|
|
410
|
+
}
|
|
411
|
+
});
|
|
412
|
+
} catch (err) {
|
|
413
|
+
if (!quiet) process.stderr.write(`[reconnect] network error: ${err.message}
|
|
414
|
+
`);
|
|
415
|
+
reconnects++;
|
|
416
|
+
await delay(RECONNECT_DELAY_MS);
|
|
417
|
+
continue;
|
|
418
|
+
}
|
|
419
|
+
if (!resp.ok || !resp.body) {
|
|
420
|
+
printError("api", `Stream connection failed: ${resp.status} ${resp.statusText}`);
|
|
421
|
+
process.exit(1);
|
|
422
|
+
}
|
|
423
|
+
const reader = resp.body.getReader();
|
|
424
|
+
const decoder = new TextDecoder();
|
|
425
|
+
let buf = "";
|
|
426
|
+
let evtName = "";
|
|
427
|
+
let evtData = "";
|
|
428
|
+
const flush = () => {
|
|
429
|
+
if (!evtName || !evtData) {
|
|
430
|
+
evtName = evtData = "";
|
|
431
|
+
return;
|
|
432
|
+
}
|
|
433
|
+
let payload;
|
|
434
|
+
try {
|
|
435
|
+
payload = JSON.parse(evtData);
|
|
436
|
+
} catch {
|
|
437
|
+
process.stderr.write(`[warn] unparseable SSE data for event "${evtName}"
|
|
438
|
+
`);
|
|
439
|
+
evtName = evtData = "";
|
|
440
|
+
return;
|
|
441
|
+
}
|
|
442
|
+
switch (evtName) {
|
|
443
|
+
case "log": {
|
|
444
|
+
if (payload.timestamp) lastLogTs = payload.timestamp;
|
|
445
|
+
if (!quiet) {
|
|
446
|
+
const { type, stepId, content } = payload;
|
|
447
|
+
process.stderr.write(`[${type}] ${stepId}: ${content}
|
|
448
|
+
`);
|
|
449
|
+
}
|
|
450
|
+
break;
|
|
451
|
+
}
|
|
452
|
+
case "error": {
|
|
453
|
+
printError("api", payload.error || "stream error");
|
|
454
|
+
process.exit(1);
|
|
455
|
+
break;
|
|
456
|
+
}
|
|
457
|
+
case "snapshot":
|
|
458
|
+
case "update": {
|
|
459
|
+
const { status } = payload;
|
|
460
|
+
if (!quiet) process.stderr.write(`[status] ${status}
|
|
461
|
+
`);
|
|
462
|
+
if (status === "waiting_user") {
|
|
463
|
+
printOutput(payload, "json");
|
|
464
|
+
process.exit(2);
|
|
465
|
+
}
|
|
466
|
+
break;
|
|
467
|
+
}
|
|
468
|
+
case "final": {
|
|
469
|
+
printOutput(payload, "json");
|
|
470
|
+
process.exit(SUCCESS_STATUSES.has(payload.status) ? 0 : 1);
|
|
471
|
+
break;
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
evtName = evtData = "";
|
|
475
|
+
};
|
|
476
|
+
let streamDone = false;
|
|
477
|
+
while (!streamDone) {
|
|
478
|
+
const { done, value } = await reader.read();
|
|
479
|
+
if (done) {
|
|
480
|
+
streamDone = true;
|
|
481
|
+
break;
|
|
482
|
+
}
|
|
483
|
+
buf += decoder.decode(value, { stream: true });
|
|
484
|
+
const lines = buf.split(/\r?\n/);
|
|
485
|
+
buf = lines.pop() ?? "";
|
|
486
|
+
for (const line of lines) {
|
|
487
|
+
if (line.startsWith("event:")) {
|
|
488
|
+
evtName = line.slice(6).trim();
|
|
489
|
+
} else if (line.startsWith("data:")) {
|
|
490
|
+
evtData = line.slice(5).trim();
|
|
491
|
+
} else if (line === "") {
|
|
492
|
+
flush();
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
reconnects++;
|
|
497
|
+
if (!quiet) process.stderr.write(`[reconnect] stream closed (${reconnects}/${MAX_RECONNECTS}), retrying...
|
|
498
|
+
`);
|
|
499
|
+
await delay(RECONNECT_DELAY_MS);
|
|
500
|
+
}
|
|
501
|
+
printError("api", `Stream closed after ${MAX_RECONNECTS} reconnect attempts`);
|
|
502
|
+
process.exit(1);
|
|
503
|
+
}
|
|
504
|
+
};
|
|
505
|
+
function delay(ms) {
|
|
506
|
+
return new Promise((r) => setTimeout(r, ms));
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
// src/commands/te-team/run/index.ts
|
|
510
|
+
var commands2 = [
|
|
511
|
+
startRun,
|
|
512
|
+
chatRun,
|
|
513
|
+
cancelRun,
|
|
514
|
+
replyRun,
|
|
515
|
+
getResult,
|
|
516
|
+
listArtifacts,
|
|
517
|
+
watchRun
|
|
518
|
+
];
|
|
519
|
+
var run_default = commands2;
|
|
520
|
+
|
|
521
|
+
// src/commands/te-team/index.ts
|
|
522
|
+
var commands3 = [
|
|
523
|
+
...team_default,
|
|
524
|
+
...run_default
|
|
525
|
+
];
|
|
526
|
+
var te_team_default = commands3;
|
|
527
|
+
export {
|
|
528
|
+
te_team_default as default
|
|
529
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thinkingai/ae-cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.28",
|
|
4
4
|
"description": "CLI tool for ThinkingAI (AE) analytics platform",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -16,12 +16,20 @@
|
|
|
16
16
|
"scripts": {
|
|
17
17
|
"dev": "tsx src/index.ts",
|
|
18
18
|
"build": "tsup src/index.ts --format esm --outDir dist",
|
|
19
|
-
"verify:
|
|
19
|
+
"verify:config": "node test/config-commands.test.mjs",
|
|
20
|
+
"verify:analysis-tools": "tsx scripts/verify-te-analysis-tools.mjs",
|
|
21
|
+
"verify:analysis-cluster-routing": "node scripts/verify-analysis-cluster-routing.mjs",
|
|
22
|
+
"verify:multi-cluster-mode": "node test/multi-cluster-mode.test.mjs",
|
|
20
23
|
"verify:analysis-builder-dry-run": "node scripts/verify-te-analysis-builder-dry-run.mjs",
|
|
21
24
|
"verify:analysis-audience-tools": "node scripts/verify-te-audience-tools.mjs",
|
|
22
25
|
"verify:analysis-meta-tools": "node scripts/verify-te-meta-tools.mjs",
|
|
23
26
|
"verify:analysis-common-tools": "node scripts/verify-te-common-tools.mjs",
|
|
27
|
+
"verify:team-tools": "node scripts/verify-te-team-tools.mjs",
|
|
28
|
+
"verify:agent-tools": "node scripts/verify-agent-tools.mjs",
|
|
29
|
+
"verify:self-check-overlay": "node test/self-check-overlay.test.mjs",
|
|
24
30
|
"verify:update-check": "npx tsx test/update-check.test.mjs",
|
|
31
|
+
"self-check": "node self-check/scan.mjs",
|
|
32
|
+
"check:agents-docs": "node scripts/check-agents-docs-sync.mjs",
|
|
25
33
|
"prepublishOnly": "npm run build",
|
|
26
34
|
"start": "node dist/index.js",
|
|
27
35
|
"test": "npx tsx src/index.ts --help"
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ae-agent
|
|
3
|
+
version: 1.0.0
|
|
4
|
+
description: "AE Agent platform resource management CLI for adding/removing/listing/toggling custom models, MCP servers, Skills, and uploading sandbox files to the attachment library. Use when the user asks to manage Agent platform resources: add a custom model, configure an MCP server, create or toggle a Skill, or upload generated files to the attachment library for download. Must use ae-cli agent commands."
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# ae-agent
|
|
8
|
+
|
|
9
|
+
AE CLI (`ae-cli`) agent platform resource commands are invoked through:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
ae-cli agent +<command> [options]
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Global Rules
|
|
16
|
+
|
|
17
|
+
- Use this skill for Agent platform resource management: models, MCP servers, Skills, and attachments.
|
|
18
|
+
- Read operations can run directly. Write operations require explicit user intent and normally keep the confirmation prompt unless `--yes` is passed.
|
|
19
|
+
- Prefer `--dry-run` before destructive writes.
|
|
20
|
+
- Only personal scope resources can be created or deleted; company/system resources are read-only in the CLI.
|
|
21
|
+
- Toggle operations on company/system resources only affect the current user's preference, not the global state.
|
|
22
|
+
- JSON flags must be valid JSON strings, usually wrapped in single quotes in shell.
|
|
23
|
+
- Successful commands return JSON by default. Use `--format table` when a table is easier to scan.
|
|
24
|
+
- `--host <url>` overrides the active AE host. It is available on every command and may be placed after the subcommand, e.g. `ae-cli agent +<command> --host <url>`.
|
|
25
|
+
|
|
26
|
+
## Commands
|
|
27
|
+
|
|
28
|
+
### Models
|
|
29
|
+
|
|
30
|
+
| Command | Risk | Purpose |
|
|
31
|
+
|---|---:|---|
|
|
32
|
+
| `+list-models` | read | List models visible to current user (personal/company/system). |
|
|
33
|
+
| `+add-model` | write | Add a custom model (personal scope). |
|
|
34
|
+
| `+del-model` | write | Delete a personal model. |
|
|
35
|
+
| `+toggle-model` | write | Enable or disable a model. |
|
|
36
|
+
|
|
37
|
+
### MCP Servers
|
|
38
|
+
|
|
39
|
+
| Command | Risk | Purpose |
|
|
40
|
+
|---|---:|---|
|
|
41
|
+
| `+list-mcps` | read | List MCP servers visible to current user. |
|
|
42
|
+
| `+add-mcp` | write | Add an MCP server (personal scope). |
|
|
43
|
+
| `+del-mcp` | write | Delete a personal MCP server. |
|
|
44
|
+
| `+toggle-mcp` | write | Enable or disable an MCP server. |
|
|
45
|
+
|
|
46
|
+
### Skills
|
|
47
|
+
|
|
48
|
+
| Command | Risk | Purpose |
|
|
49
|
+
|---|---:|---|
|
|
50
|
+
| `+list-skills` | read | List Skills visible to current user. |
|
|
51
|
+
| `+add-skill` | write | Create a custom Skill (personal scope). |
|
|
52
|
+
| `+del-skill` | write | Delete a personal Skill (physical delete). |
|
|
53
|
+
| `+toggle-skill` | write | Enable or disable a Skill. |
|
|
54
|
+
|
|
55
|
+
### Attachments
|
|
56
|
+
|
|
57
|
+
| Command | Risk | Purpose |
|
|
58
|
+
|---|---:|---|
|
|
59
|
+
| `+list-attachments` | read | List user attachments (paginated). |
|
|
60
|
+
| `+add-attachment` | write | Upload sandbox file(s) to attachment library. |
|
|
61
|
+
| `+del-attachment` | write | Soft-delete an attachment. |
|
|
62
|
+
|
|
63
|
+
## Usage Examples
|
|
64
|
+
|
|
65
|
+
### List all visible models
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
ae-cli agent +list-models
|
|
69
|
+
ae-cli agent +list-models --scope personal --format table
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Add a custom model
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
ae-cli agent +add-model \
|
|
76
|
+
--model-id gpt-4o \
|
|
77
|
+
--name "GPT-4o" \
|
|
78
|
+
--base-url "https://api.openai.com/v1" \
|
|
79
|
+
--api-key "sk-xxx" \
|
|
80
|
+
--provider openai
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Add an MCP server
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
ae-cli agent +add-mcp \
|
|
87
|
+
--name my-mcp \
|
|
88
|
+
--url "https://mcp.example.com/mcp" \
|
|
89
|
+
--transport http \
|
|
90
|
+
--headers '{"Authorization":"Bearer token"}'
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Create a Skill with inline instructions
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
ae-cli agent +add-skill \
|
|
97
|
+
--name code-reviewer \
|
|
98
|
+
--description "Reviews code for best practices" \
|
|
99
|
+
--instructions "You are a code reviewer. Analyze the code for..."
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Create a Skill with instructions from stdin
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
echo "You are a helpful assistant that..." | \
|
|
106
|
+
ae-cli agent +add-skill --name helper --description "Helper skill" --instructions @-
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Upload a single file to attachment library
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
ae-cli agent +add-attachment --file ./output/report.png
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Upload multiple files
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
ae-cli agent +add-attachment --files '["./report.png", "./data.csv", "./chart.pdf"]'
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Toggle a model on/off
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
ae-cli agent +toggle-model --id <model-cuid> --enabled true
|
|
125
|
+
ae-cli agent +toggle-model --id <model-cuid> --enabled false
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Notes
|
|
129
|
+
|
|
130
|
+
- Only `personal` scope resources can be created or deleted via CLI.
|
|
131
|
+
- MCP creation automatically validates server connectivity.
|
|
132
|
+
- Attachment upload supports files up to 50MB each, with a 1GB user quota.
|
|
133
|
+
- Batch attachment uploads support partial success — individual file failures don't affect others.
|
|
134
|
+
- Skill `--instructions @-` reads from stdin, useful for piping long instruction text.
|