@keyou007/agent-bot 0.1.14-alpha.1 → 0.1.14-alpha.2
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/CHANGELOG.md +14 -1
- package/README.md +42 -12
- package/README.zh.md +42 -12
- package/config.example.yaml +1 -1
- package/dist/cli/AutostartManager.js +431 -0
- package/dist/cli/AutostartManager.js.map +1 -0
- package/dist/cli/FeishuAppConfiguration.js +17 -13
- package/dist/cli/FeishuAppConfiguration.js.map +1 -1
- package/dist/cli/Initializer.js +35 -0
- package/dist/cli/Initializer.js.map +1 -1
- package/dist/cli/SelfUpdateRunner.js +552 -0
- package/dist/cli/SelfUpdateRunner.js.map +1 -0
- package/dist/cli/SelfUpdater.js +431 -0
- package/dist/cli/SelfUpdater.js.map +1 -0
- package/dist/cli/autostartOutput.js +63 -0
- package/dist/cli/autostartOutput.js.map +1 -0
- package/dist/cli/controlProtocol.js.map +1 -1
- package/dist/cli/help.js +92 -18
- package/dist/cli/help.js.map +1 -1
- package/dist/cli/taskGroupOptions.js +14 -11
- package/dist/cli/taskGroupOptions.js.map +1 -1
- package/dist/cli/taskListOutput.js +3 -0
- package/dist/cli/taskListOutput.js.map +1 -1
- package/dist/cli/taskTarget.js +99 -0
- package/dist/cli/taskTarget.js.map +1 -0
- package/dist/cli.js +643 -58
- package/dist/cli.js.map +1 -1
- package/dist/codex/CodexRuntime.js +8 -2
- package/dist/codex/CodexRuntime.js.map +1 -1
- package/dist/commands/CommandRouter.js +7 -1
- package/dist/commands/CommandRouter.js.map +1 -1
- package/dist/feishu/CardRenderer.js +172 -23
- package/dist/feishu/CardRenderer.js.map +1 -1
- package/dist/feishu/FeishuMarkdown.js +25 -1
- package/dist/feishu/FeishuMarkdown.js.map +1 -1
- package/dist/index.js +134 -2
- package/dist/index.js.map +1 -1
- package/dist/proxy/ProxySessionController.js +436 -12
- package/dist/proxy/ProxySessionController.js.map +1 -1
- package/dist/state/StateStore.js +18 -0
- package/dist/state/StateStore.js.map +1 -1
- package/docs/technical-reference.md +17 -7
- package/docs/technical-reference.zh.md +17 -7
- package/npm-shrinkwrap.json +2 -2
- package/package.json +2 -2
- package/skills/agent-bot/SKILL.md +107 -188
- package/src/cli/AutostartManager.ts +579 -0
- package/src/cli/FeishuAppConfiguration.ts +22 -7
- package/src/cli/Initializer.ts +57 -0
- package/src/cli/SelfUpdateRunner.ts +817 -0
- package/src/cli/SelfUpdater.ts +688 -0
- package/src/cli/autostartOutput.ts +75 -0
- package/src/cli/controlProtocol.ts +111 -1
- package/src/cli/help.ts +92 -18
- package/src/cli/taskGroupOptions.ts +27 -17
- package/src/cli/taskListOutput.ts +10 -0
- package/src/cli/taskTarget.ts +168 -0
- package/src/cli.ts +781 -65
- package/src/codex/CodexRuntime.ts +8 -2
- package/src/commands/CommandRouter.ts +6 -1
- package/src/commands/commandTypes.ts +1 -0
- package/src/feishu/CardRenderer.ts +199 -23
- package/src/feishu/FeishuMarkdown.ts +27 -1
- package/src/index.ts +172 -2
- package/src/proxy/ProxySessionController.ts +532 -15
- package/src/runtime/types.ts +1 -0
- package/src/state/StateStore.ts +19 -0
package/src/cli/Initializer.ts
CHANGED
|
@@ -43,6 +43,12 @@ export function shouldConfigureAgentsDuringInitialization(status: Initialization
|
|
|
43
43
|
return status === "created" || status === "reset";
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
export function shouldConfigureGroupMessagesDuringInitialization(status: InitializationStatus): boolean {
|
|
47
|
+
return status === "created" || status === "reset";
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export type GroupMessageResponseMode = "all" | "mention-only";
|
|
51
|
+
|
|
46
52
|
export interface ConfiguredAgentOption {
|
|
47
53
|
name: string;
|
|
48
54
|
title: string;
|
|
@@ -238,6 +244,57 @@ export function writeConfiguredAgentSelection(
|
|
|
238
244
|
return true;
|
|
239
245
|
}
|
|
240
246
|
|
|
247
|
+
export function readGroupMessageResponseMode(configPath: string): GroupMessageResponseMode {
|
|
248
|
+
const document = parseConfigurationDocument(fs.readFileSync(configPath, "utf8"), configPath);
|
|
249
|
+
if (!isMap(document.contents)) {
|
|
250
|
+
throw new Error(cliText(
|
|
251
|
+
`Configuration file must contain a YAML mapping: ${configPath}`,
|
|
252
|
+
`配置文件必须包含 YAML 映射:${configPath}`,
|
|
253
|
+
));
|
|
254
|
+
}
|
|
255
|
+
const feishu = document.contents.get("feishu", true);
|
|
256
|
+
if (!isMap(feishu)) {
|
|
257
|
+
throw new Error(cliText(
|
|
258
|
+
`Configuration feishu must contain a YAML mapping: ${configPath}`,
|
|
259
|
+
`配置文件的 feishu 必须是 YAML 映射:${configPath}`,
|
|
260
|
+
));
|
|
261
|
+
}
|
|
262
|
+
const enabled = document.getIn(["feishu", "respondToAllGroupMessages"]);
|
|
263
|
+
if (typeof enabled !== "boolean") {
|
|
264
|
+
throw new Error(cliText(
|
|
265
|
+
`Configuration feishu.respondToAllGroupMessages must be a boolean: ${configPath}`,
|
|
266
|
+
`配置项 feishu.respondToAllGroupMessages 必须是布尔值:${configPath}`,
|
|
267
|
+
));
|
|
268
|
+
}
|
|
269
|
+
return enabled ? "all" : "mention-only";
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
export function writeGroupMessageResponseMode(
|
|
273
|
+
configPath: string,
|
|
274
|
+
mode: GroupMessageResponseMode,
|
|
275
|
+
): boolean {
|
|
276
|
+
const original = fs.readFileSync(configPath, "utf8");
|
|
277
|
+
const document = parseConfigurationDocument(original, configPath);
|
|
278
|
+
if (!isMap(document.contents)) {
|
|
279
|
+
throw new Error(cliText(
|
|
280
|
+
`Configuration file must contain a YAML mapping: ${configPath}`,
|
|
281
|
+
`配置文件必须包含 YAML 映射:${configPath}`,
|
|
282
|
+
));
|
|
283
|
+
}
|
|
284
|
+
const feishu = document.contents.get("feishu", true);
|
|
285
|
+
if (!isMap(feishu)) {
|
|
286
|
+
throw new Error(cliText(
|
|
287
|
+
`Configuration feishu must contain a YAML mapping: ${configPath}`,
|
|
288
|
+
`配置文件的 feishu 必须是 YAML 映射:${configPath}`,
|
|
289
|
+
));
|
|
290
|
+
}
|
|
291
|
+
const enabled = mode === "all";
|
|
292
|
+
if (document.getIn(["feishu", "respondToAllGroupMessages"]) === enabled) return false;
|
|
293
|
+
feishu.set("respondToAllGroupMessages", enabled);
|
|
294
|
+
writeFileAtomically(configPath, document.toString());
|
|
295
|
+
return true;
|
|
296
|
+
}
|
|
297
|
+
|
|
241
298
|
export function readFeishuCredentials(envPath: string, env: NodeJS.ProcessEnv = process.env): FeishuCredentialState {
|
|
242
299
|
const fileValues = fs.existsSync(envPath) ? parseDotEnv(fs.readFileSync(envPath, "utf8")) : {};
|
|
243
300
|
const appId = firstNonBlank(env.FEISHU_APP_ID, fileValues.FEISHU_APP_ID);
|