@downcity/plugins 1.0.52 → 1.0.57
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/bin/BuiltinPlugins.d.ts +2 -3
- package/bin/BuiltinPlugins.d.ts.map +1 -1
- package/bin/BuiltinPlugins.js +2 -6
- package/bin/BuiltinPlugins.js.map +1 -1
- package/bin/asr/Plugin.d.ts +67 -8
- package/bin/asr/Plugin.d.ts.map +1 -1
- package/bin/asr/Plugin.js +229 -461
- package/bin/asr/Plugin.js.map +1 -1
- package/bin/asr/types/AsrPlugin.d.ts +114 -0
- package/bin/asr/types/AsrPlugin.d.ts.map +1 -0
- package/bin/asr/types/AsrPlugin.js +10 -0
- package/bin/asr/types/AsrPlugin.js.map +1 -0
- package/bin/auth/Plugin.d.ts +1 -2
- package/bin/auth/Plugin.d.ts.map +1 -1
- package/bin/auth/Plugin.js +2 -2
- package/bin/auth/Plugin.js.map +1 -1
- package/bin/chat/ChatPlugin.d.ts +1 -2
- package/bin/chat/ChatPlugin.d.ts.map +1 -1
- package/bin/chat/ChatPlugin.js +3 -12
- package/bin/chat/ChatPlugin.js.map +1 -1
- package/bin/chat/PROMPT.direct.d.ts +1 -1
- package/bin/chat/PROMPT.direct.d.ts.map +1 -1
- package/bin/chat/PROMPT.direct.js +1 -1
- package/bin/chat/PROMPT.direct.js.map +1 -1
- package/bin/chat/channels/qq/PROMPT.direct.d.ts +1 -1
- package/bin/chat/channels/qq/PROMPT.direct.d.ts.map +1 -1
- package/bin/chat/channels/qq/PROMPT.direct.js +1 -1
- package/bin/chat/channels/qq/PROMPT.direct.js.map +1 -1
- package/bin/chat/channels/telegram/Bot.d.ts +6 -0
- package/bin/chat/channels/telegram/Bot.d.ts.map +1 -1
- package/bin/chat/channels/telegram/Bot.js +24 -0
- package/bin/chat/channels/telegram/Bot.js.map +1 -1
- package/bin/chat/channels/telegram/TelegramPlatformClient.d.ts +14 -0
- package/bin/chat/channels/telegram/TelegramPlatformClient.d.ts.map +1 -1
- package/bin/chat/channels/telegram/TelegramPlatformClient.js +39 -5
- package/bin/chat/channels/telegram/TelegramPlatformClient.js.map +1 -1
- package/bin/contact/ContactPlugin.d.ts +1 -2
- package/bin/contact/ContactPlugin.d.ts.map +1 -1
- package/bin/contact/ContactPlugin.js +2 -2
- package/bin/contact/ContactPlugin.js.map +1 -1
- package/bin/contact/PROMPT.d.ts +1 -1
- package/bin/contact/PROMPT.d.ts.map +1 -1
- package/bin/contact/PROMPT.js +1 -1
- package/bin/contact/PROMPT.js.map +1 -1
- package/bin/image/ImagePlugin.d.ts +61 -0
- package/bin/image/ImagePlugin.d.ts.map +1 -0
- package/bin/image/ImagePlugin.js +207 -0
- package/bin/image/ImagePlugin.js.map +1 -0
- package/bin/image/types/ImagePlugin.d.ts +136 -0
- package/bin/image/types/ImagePlugin.d.ts.map +1 -0
- package/bin/image/types/ImagePlugin.js +10 -0
- package/bin/image/types/ImagePlugin.js.map +1 -0
- package/bin/index.d.ts +4 -0
- package/bin/index.d.ts.map +1 -1
- package/bin/index.js +1 -0
- package/bin/index.js.map +1 -1
- package/bin/shell/ShellPlugin.d.ts +1 -2
- package/bin/shell/ShellPlugin.d.ts.map +1 -1
- package/bin/shell/ShellPlugin.js +2 -2
- package/bin/shell/ShellPlugin.js.map +1 -1
- package/bin/skill/Action.d.ts +8 -3
- package/bin/skill/Action.d.ts.map +1 -1
- package/bin/skill/Action.js +9 -11
- package/bin/skill/Action.js.map +1 -1
- package/bin/skill/Command.d.ts +1 -1
- package/bin/skill/Command.d.ts.map +1 -1
- package/bin/skill/Command.js +3 -10
- package/bin/skill/Command.js.map +1 -1
- package/bin/skill/Config.d.ts +9 -9
- package/bin/skill/Config.d.ts.map +1 -1
- package/bin/skill/Config.js +36 -24
- package/bin/skill/Config.js.map +1 -1
- package/bin/skill/PROMPT.d.ts +1 -1
- package/bin/skill/PROMPT.d.ts.map +1 -1
- package/bin/skill/PROMPT.js +1 -1
- package/bin/skill/PROMPT.js.map +1 -1
- package/bin/skill/Plugin.d.ts +2 -2
- package/bin/skill/Plugin.d.ts.map +1 -1
- package/bin/skill/Plugin.js +20 -37
- package/bin/skill/Plugin.js.map +1 -1
- package/bin/skill/runtime/Discovery.d.ts +3 -3
- package/bin/skill/runtime/Discovery.d.ts.map +1 -1
- package/bin/skill/runtime/Discovery.js +37 -14
- package/bin/skill/runtime/Discovery.js.map +1 -1
- package/bin/skill/runtime/Paths.d.ts +5 -5
- package/bin/skill/runtime/Paths.d.ts.map +1 -1
- package/bin/skill/runtime/Paths.js +23 -33
- package/bin/skill/runtime/Paths.js.map +1 -1
- package/bin/skill/runtime/Prompt.d.ts +2 -2
- package/bin/skill/runtime/Prompt.d.ts.map +1 -1
- package/bin/skill/runtime/Prompt.js +3 -8
- package/bin/skill/runtime/Prompt.js.map +1 -1
- package/bin/skill/runtime/SystemProvider.d.ts +2 -2
- package/bin/skill/runtime/SystemProvider.d.ts.map +1 -1
- package/bin/skill/runtime/SystemProvider.js +2 -2
- package/bin/skill/runtime/SystemProvider.js.map +1 -1
- package/bin/skill/types/SkillPlugin.d.ts +34 -12
- package/bin/skill/types/SkillPlugin.d.ts.map +1 -1
- package/bin/skill/types/SkillPlugin.js +2 -1
- package/bin/skill/types/SkillPlugin.js.map +1 -1
- package/bin/skill/types/SkillRoot.d.ts +1 -1
- package/bin/task/Action.js +2 -2
- package/bin/task/Action.js.map +1 -1
- package/bin/task/PROMPT.d.ts +1 -1
- package/bin/task/PROMPT.d.ts.map +1 -1
- package/bin/task/PROMPT.js +1 -1
- package/bin/task/PROMPT.js.map +1 -1
- package/bin/task/TaskPlugin.d.ts +1 -2
- package/bin/task/TaskPlugin.d.ts.map +1 -1
- package/bin/task/TaskPlugin.js +2 -2
- package/bin/task/TaskPlugin.js.map +1 -1
- package/bin/tts/Plugin.d.ts +53 -7
- package/bin/tts/Plugin.d.ts.map +1 -1
- package/bin/tts/Plugin.js +197 -474
- package/bin/tts/Plugin.js.map +1 -1
- package/bin/tts/types/TtsPlugin.d.ts +63 -102
- package/bin/tts/types/TtsPlugin.d.ts.map +1 -1
- package/bin/tts/types/TtsPlugin.js +4 -3
- package/bin/tts/types/TtsPlugin.js.map +1 -1
- package/bin/web/PROMPT.d.ts +1 -1
- package/bin/web/PROMPT.d.ts.map +1 -1
- package/bin/web/PROMPT.js +1 -1
- package/bin/web/PROMPT.js.map +1 -1
- package/bin/web/Plugin.d.ts +66 -6
- package/bin/web/Plugin.d.ts.map +1 -1
- package/bin/web/Plugin.js +130 -447
- package/bin/web/Plugin.js.map +1 -1
- package/bin/web/WebPromptAssets.d.ts +1 -9
- package/bin/web/WebPromptAssets.d.ts.map +1 -1
- package/bin/web/WebPromptAssets.js +1 -11
- package/bin/web/WebPromptAssets.js.map +1 -1
- package/bin/web/runtime/Install.d.ts +19 -0
- package/bin/web/runtime/Install.d.ts.map +1 -0
- package/bin/web/runtime/Install.js +178 -0
- package/bin/web/runtime/Install.js.map +1 -0
- package/bin/web/types/WebPlugin.d.ts +37 -109
- package/bin/web/types/WebPlugin.d.ts.map +1 -1
- package/bin/web/types/WebPlugin.js +5 -7
- package/bin/web/types/WebPlugin.js.map +1 -1
- package/bin/workboard/Plugin.d.ts +1 -2
- package/bin/workboard/Plugin.d.ts.map +1 -1
- package/bin/workboard/Plugin.js +2 -2
- package/bin/workboard/Plugin.js.map +1 -1
- package/package.json +2 -2
- package/src/BuiltinPlugins.ts +3 -10
- package/src/asr/Plugin.ts +264 -484
- package/src/asr/types/AsrPlugin.ts +118 -0
- package/src/auth/Plugin.ts +2 -3
- package/src/chat/ChatPlugin.ts +3 -14
- package/src/chat/PROMPT.direct.ts +1 -1
- package/src/chat/PROMPT.direct.ts.txt +5 -7
- package/src/chat/channels/qq/PROMPT.direct.ts +1 -1
- package/src/chat/channels/qq/PROMPT.direct.ts.txt +1 -1
- package/src/chat/channels/telegram/Bot.ts +22 -0
- package/src/chat/channels/telegram/TelegramPlatformClient.ts +42 -6
- package/src/contact/ContactPlugin.ts +2 -3
- package/src/contact/PROMPT.ts +1 -1
- package/src/contact/PROMPT.ts.txt +12 -12
- package/src/image/ImagePlugin.ts +268 -0
- package/src/image/types/ImagePlugin.ts +157 -0
- package/src/index.ts +25 -0
- package/src/shell/ShellPlugin.ts +2 -3
- package/src/skill/Action.ts +20 -9
- package/src/skill/Command.ts +3 -13
- package/src/skill/Config.ts +41 -34
- package/src/skill/PROMPT.ts +1 -1
- package/src/skill/PROMPT.ts.txt +14 -2
- package/src/skill/Plugin.ts +205 -214
- package/src/skill/runtime/Discovery.ts +43 -17
- package/src/skill/runtime/Paths.ts +24 -35
- package/src/skill/runtime/Prompt.ts +4 -10
- package/src/skill/runtime/SystemProvider.ts +4 -4
- package/src/skill/types/SkillPlugin.ts +39 -12
- package/src/skill/types/SkillRoot.ts +1 -1
- package/src/task/Action.ts +2 -2
- package/src/task/PROMPT.ts +1 -1
- package/src/task/PROMPT.ts.txt +10 -10
- package/src/task/TaskPlugin.ts +2 -3
- package/src/tts/Plugin.ts +225 -493
- package/src/tts/types/TtsPlugin.ts +67 -102
- package/src/web/PROMPT.ts +1 -1
- package/src/web/PROMPT.ts.txt +32 -6
- package/src/web/Plugin.ts +119 -454
- package/src/web/WebPromptAssets.ts +1 -13
- package/src/web/runtime/Install.ts +241 -0
- package/src/web/types/WebPlugin.ts +37 -113
- package/src/workboard/Plugin.ts +2 -3
- package/bin/asr/Config.d.ts +0 -43
- package/bin/asr/Config.d.ts.map +0 -1
- package/bin/asr/Config.js +0 -107
- package/bin/asr/Config.js.map +0 -1
- package/bin/asr/Dependency.d.ts +0 -77
- package/bin/asr/Dependency.d.ts.map +0 -1
- package/bin/asr/Dependency.js +0 -238
- package/bin/asr/Dependency.js.map +0 -1
- package/bin/asr/InboundAugment.d.ts +0 -17
- package/bin/asr/InboundAugment.d.ts.map +0 -1
- package/bin/asr/InboundAugment.js +0 -47
- package/bin/asr/InboundAugment.js.map +0 -1
- package/bin/asr/ModelCatalog.d.ts +0 -29
- package/bin/asr/ModelCatalog.d.ts.map +0 -1
- package/bin/asr/ModelCatalog.js +0 -25
- package/bin/asr/ModelCatalog.js.map +0 -1
- package/bin/tts/Dependency.d.ts +0 -90
- package/bin/tts/Dependency.d.ts.map +0 -1
- package/bin/tts/Dependency.js +0 -344
- package/bin/tts/Dependency.js.map +0 -1
- package/bin/tts/PluginSupport.d.ts +0 -25
- package/bin/tts/PluginSupport.d.ts.map +0 -1
- package/bin/tts/PluginSupport.js +0 -72
- package/bin/tts/PluginSupport.js.map +0 -1
- package/bin/tts/runtime/Catalog.d.ts +0 -21
- package/bin/tts/runtime/Catalog.d.ts.map +0 -1
- package/bin/tts/runtime/Catalog.js +0 -90
- package/bin/tts/runtime/Catalog.js.map +0 -1
- package/bin/tts/runtime/DependencyInstaller.d.ts +0 -143
- package/bin/tts/runtime/DependencyInstaller.d.ts.map +0 -1
- package/bin/tts/runtime/DependencyInstaller.js +0 -261
- package/bin/tts/runtime/DependencyInstaller.js.map +0 -1
- package/bin/tts/runtime/Installer.d.ts +0 -89
- package/bin/tts/runtime/Installer.d.ts.map +0 -1
- package/bin/tts/runtime/Installer.js +0 -188
- package/bin/tts/runtime/Installer.js.map +0 -1
- package/bin/tts/runtime/Paths.d.ts +0 -20
- package/bin/tts/runtime/Paths.d.ts.map +0 -1
- package/bin/tts/runtime/Paths.js +0 -32
- package/bin/tts/runtime/Paths.js.map +0 -1
- package/bin/tts/runtime/Synthesizer.d.ts +0 -44
- package/bin/tts/runtime/Synthesizer.d.ts.map +0 -1
- package/bin/tts/runtime/Synthesizer.js +0 -363
- package/bin/tts/runtime/Synthesizer.js.map +0 -1
- package/bin/tts/types/Tts.d.ts +0 -91
- package/bin/tts/types/Tts.d.ts.map +0 -1
- package/bin/tts/types/Tts.js +0 -9
- package/bin/tts/types/Tts.js.map +0 -1
- package/bin/voice/Config.d.ts +0 -43
- package/bin/voice/Config.d.ts.map +0 -1
- package/bin/voice/Config.js +0 -104
- package/bin/voice/Config.js.map +0 -1
- package/bin/voice/Dependency.d.ts +0 -77
- package/bin/voice/Dependency.d.ts.map +0 -1
- package/bin/voice/Dependency.js +0 -237
- package/bin/voice/Dependency.js.map +0 -1
- package/bin/voice/InboundAugment.d.ts +0 -17
- package/bin/voice/InboundAugment.d.ts.map +0 -1
- package/bin/voice/InboundAugment.js +0 -47
- package/bin/voice/InboundAugment.js.map +0 -1
- package/bin/voice/ModelCatalog.d.ts +0 -29
- package/bin/voice/ModelCatalog.d.ts.map +0 -1
- package/bin/voice/ModelCatalog.js +0 -25
- package/bin/voice/ModelCatalog.js.map +0 -1
- package/bin/voice/runtime/Catalog.d.ts +0 -18
- package/bin/voice/runtime/Catalog.d.ts.map +0 -1
- package/bin/voice/runtime/Catalog.js +0 -61
- package/bin/voice/runtime/Catalog.js.map +0 -1
- package/bin/voice/runtime/DependencyInstaller.d.ts +0 -145
- package/bin/voice/runtime/DependencyInstaller.d.ts.map +0 -1
- package/bin/voice/runtime/DependencyInstaller.js +0 -309
- package/bin/voice/runtime/DependencyInstaller.js.map +0 -1
- package/bin/voice/runtime/Installer.d.ts +0 -94
- package/bin/voice/runtime/Installer.d.ts.map +0 -1
- package/bin/voice/runtime/Installer.js +0 -200
- package/bin/voice/runtime/Installer.js.map +0 -1
- package/bin/voice/runtime/Paths.d.ts +0 -8
- package/bin/voice/runtime/Paths.d.ts.map +0 -1
- package/bin/voice/runtime/Paths.js +0 -26
- package/bin/voice/runtime/Paths.js.map +0 -1
- package/bin/voice/runtime/Transcriber.d.ts +0 -57
- package/bin/voice/runtime/Transcriber.d.ts.map +0 -1
- package/bin/voice/runtime/Transcriber.js +0 -329
- package/bin/voice/runtime/Transcriber.js.map +0 -1
- package/bin/voice/types/Voice.d.ts +0 -58
- package/bin/voice/types/Voice.d.ts.map +0 -1
- package/bin/voice/types/Voice.js +0 -9
- package/bin/voice/types/Voice.js.map +0 -1
- package/bin/voice/types/VoicePlugin.d.ts +0 -190
- package/bin/voice/types/VoicePlugin.d.ts.map +0 -1
- package/bin/voice/types/VoicePlugin.js +0 -9
- package/bin/voice/types/VoicePlugin.js.map +0 -1
- package/bin/web/Dependency.d.ts +0 -10
- package/bin/web/Dependency.d.ts.map +0 -1
- package/bin/web/Dependency.js +0 -10
- package/bin/web/Dependency.js.map +0 -1
- package/bin/web/PROMPT.agent-browser.d.ts +0 -7
- package/bin/web/PROMPT.agent-browser.d.ts.map +0 -1
- package/bin/web/PROMPT.agent-browser.js +0 -8
- package/bin/web/PROMPT.agent-browser.js.map +0 -1
- package/bin/web/PROMPT.web-access.d.ts +0 -7
- package/bin/web/PROMPT.web-access.d.ts.map +0 -1
- package/bin/web/PROMPT.web-access.js +0 -8
- package/bin/web/PROMPT.web-access.js.map +0 -1
- package/bin/web/runtime/Config.d.ts +0 -21
- package/bin/web/runtime/Config.d.ts.map +0 -1
- package/bin/web/runtime/Config.js +0 -79
- package/bin/web/runtime/Config.js.map +0 -1
- package/bin/web/runtime/Source.d.ts +0 -29
- package/bin/web/runtime/Source.d.ts.map +0 -1
- package/bin/web/runtime/Source.js +0 -209
- package/bin/web/runtime/Source.js.map +0 -1
- package/src/asr/Config.ts +0 -138
- package/src/asr/Dependency.ts +0 -336
- package/src/asr/InboundAugment.ts +0 -59
- package/src/asr/ModelCatalog.ts +0 -43
- package/src/tts/Dependency.ts +0 -473
- package/src/tts/PluginSupport.ts +0 -85
- package/src/tts/runtime/Catalog.ts +0 -97
- package/src/tts/runtime/DependencyInstaller.ts +0 -436
- package/src/tts/runtime/Installer.ts +0 -297
- package/src/tts/runtime/Paths.ts +0 -39
- package/src/tts/runtime/Synthesizer.ts +0 -480
- package/src/tts/types/Tts.ts +0 -99
- package/src/voice/Config.ts +0 -135
- package/src/voice/Dependency.ts +0 -329
- package/src/voice/InboundAugment.ts +0 -59
- package/src/voice/ModelCatalog.ts +0 -43
- package/src/voice/runtime/Catalog.ts +0 -68
- package/src/voice/runtime/DependencyInstaller.ts +0 -505
- package/src/voice/runtime/Installer.ts +0 -324
- package/src/voice/runtime/Paths.ts +0 -26
- package/src/voice/runtime/Transcriber.ts +0 -467
- package/src/voice/types/Voice.ts +0 -68
- package/src/voice/types/VoicePlugin.ts +0 -194
- package/src/web/Dependency.ts +0 -17
- package/src/web/PROMPT.agent-browser.ts +0 -9
- package/src/web/PROMPT.agent-browser.ts.txt +0 -17
- package/src/web/PROMPT.web-access.ts +0 -9
- package/src/web/PROMPT.web-access.ts.txt +0 -13
- package/src/web/runtime/Config.ts +0 -105
- package/src/web/runtime/Source.ts +0 -257
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AsrPlugin 类型定义。
|
|
3
|
+
*
|
|
4
|
+
* 关键点(中文)
|
|
5
|
+
* - ASR plugin 只定义 agent 侧协议,不绑定本地模型、Python 或 City 具体实现。
|
|
6
|
+
* - 真实转写能力通过 constructor 的 `asr` 函数注入,推荐传入 `city.ai.asr`。
|
|
7
|
+
* - `auto` 只表示是否在 chat 入站时自动转写语音附件。
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import type { JsonObject, JsonValue } from "@downcity/agent/internal/types/common/Json.js";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* ASR 输入。
|
|
14
|
+
*/
|
|
15
|
+
export interface AsrPluginInput {
|
|
16
|
+
/**
|
|
17
|
+
* 本地音频文件路径。
|
|
18
|
+
*
|
|
19
|
+
* 说明(中文)
|
|
20
|
+
* - chat runtime 下载附件后会传入本地路径。
|
|
21
|
+
* - 显式 action 调用时也优先使用该字段。
|
|
22
|
+
*/
|
|
23
|
+
audio_path?: string;
|
|
24
|
+
/**
|
|
25
|
+
* 远程音频 URL。
|
|
26
|
+
*/
|
|
27
|
+
url?: string;
|
|
28
|
+
/**
|
|
29
|
+
* data URL 音频内容。
|
|
30
|
+
*/
|
|
31
|
+
data_url?: string;
|
|
32
|
+
/**
|
|
33
|
+
* 语言提示,例如 `auto`、`zh`、`en`。
|
|
34
|
+
*/
|
|
35
|
+
language?: string;
|
|
36
|
+
/**
|
|
37
|
+
* 音频 MIME 类型,例如 `audio/ogg`。
|
|
38
|
+
*/
|
|
39
|
+
media_type?: string;
|
|
40
|
+
/**
|
|
41
|
+
* 原始文件名。
|
|
42
|
+
*/
|
|
43
|
+
file_name?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Provider 私有参数。
|
|
46
|
+
*/
|
|
47
|
+
provider_options?: JsonObject;
|
|
48
|
+
/**
|
|
49
|
+
* 允许外部 asr 函数接收其他 JSON 可序列化参数。
|
|
50
|
+
*/
|
|
51
|
+
[key: string]: JsonValue | undefined;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* ASR 输出。
|
|
56
|
+
*/
|
|
57
|
+
export interface AsrPluginResult {
|
|
58
|
+
/**
|
|
59
|
+
* 转写文本。
|
|
60
|
+
*/
|
|
61
|
+
text: string;
|
|
62
|
+
/**
|
|
63
|
+
* 识别到的语言(可选)。
|
|
64
|
+
*/
|
|
65
|
+
language?: string;
|
|
66
|
+
/**
|
|
67
|
+
* 结果置信度(可选)。
|
|
68
|
+
*/
|
|
69
|
+
confidence?: number;
|
|
70
|
+
/**
|
|
71
|
+
* Provider 原始元信息(可选)。
|
|
72
|
+
*/
|
|
73
|
+
metadata?: JsonObject;
|
|
74
|
+
/**
|
|
75
|
+
* 允许外部 asr 函数返回其他 JSON 可序列化字段。
|
|
76
|
+
*/
|
|
77
|
+
[key: string]: JsonValue | undefined;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* AsrPlugin 构造参数。
|
|
82
|
+
*/
|
|
83
|
+
export interface AsrPluginOptions {
|
|
84
|
+
/**
|
|
85
|
+
* Plugin 稳定名称,默认 `asr`。
|
|
86
|
+
*/
|
|
87
|
+
name?: string;
|
|
88
|
+
/**
|
|
89
|
+
* Plugin 展示标题,默认 `ASR`。
|
|
90
|
+
*/
|
|
91
|
+
title?: string;
|
|
92
|
+
/**
|
|
93
|
+
* Plugin 用途说明。
|
|
94
|
+
*/
|
|
95
|
+
description?: string;
|
|
96
|
+
/**
|
|
97
|
+
* 真实 ASR 能力函数。
|
|
98
|
+
*
|
|
99
|
+
* 说明(中文)
|
|
100
|
+
* - 推荐传入 `(input) => city.ai.asr(input)`。
|
|
101
|
+
* - plugin 只负责调用该函数,不关心模型、provider、鉴权或运行依赖。
|
|
102
|
+
*/
|
|
103
|
+
asr: (input: AsrPluginInput) => Promise<AsrPluginResult> | AsrPluginResult;
|
|
104
|
+
/**
|
|
105
|
+
* 是否自动转写 chat 入站语音附件。
|
|
106
|
+
*
|
|
107
|
+
* 说明(中文)
|
|
108
|
+
* - `true`:遇到 voice/audio 附件时自动调用 `asr`。
|
|
109
|
+
* - `false`:仅保留显式 `transcribe` action。
|
|
110
|
+
* - 默认 `false`,避免 agent 隐式调用外部 ASR 成本。
|
|
111
|
+
*/
|
|
112
|
+
auto?: boolean;
|
|
113
|
+
/**
|
|
114
|
+
* 默认语言提示。
|
|
115
|
+
*/
|
|
116
|
+
language?: string;
|
|
117
|
+
}
|
|
118
|
+
|
package/src/auth/Plugin.ts
CHANGED
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
* - 它只负责聊天主体授权,不负责 Town HTTP Bearer token 或路由访问鉴权。
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import type { AgentRuntime } from "@downcity/agent/internal/types/runtime/agent/AgentRuntime.js";
|
|
11
10
|
import { BasePlugin } from "@downcity/agent/internal/plugin/core/BasePlugin.js";
|
|
12
11
|
import type { Plugin } from "@downcity/agent/internal/plugin/types/Plugin.js";
|
|
13
12
|
import type { JsonValue } from "@downcity/agent/internal/types/common/Json.js";
|
|
@@ -231,8 +230,8 @@ function createChatAuthorizationPluginDefinition(): Plugin {
|
|
|
231
230
|
export class ChatAuthorizationPlugin extends BasePlugin {
|
|
232
231
|
readonly name = CHAT_AUTHORIZATION_PLUGIN_NAME;
|
|
233
232
|
|
|
234
|
-
constructor(
|
|
235
|
-
super(
|
|
233
|
+
constructor() {
|
|
234
|
+
super();
|
|
236
235
|
Object.assign(this, createChatAuthorizationPluginDefinition());
|
|
237
236
|
}
|
|
238
237
|
}
|
package/src/chat/ChatPlugin.ts
CHANGED
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
* - action 注册表已经拆到独立模块,当前文件只保留实例骨架。
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import type { AgentRuntime } from "@downcity/agent/internal/types/runtime/agent/AgentRuntime.js";
|
|
12
11
|
import { BasePlugin } from "@downcity/agent/internal/plugin/core/BasePlugin.js";
|
|
13
12
|
import type { PluginActions } from "@downcity/agent/internal/plugin/types/Plugin.js";
|
|
14
13
|
import type { AgentContext } from "@downcity/agent/internal/types/runtime/agent/AgentContext.js";
|
|
@@ -107,11 +106,9 @@ export class ChatPlugin extends BasePlugin {
|
|
|
107
106
|
worker.stop();
|
|
108
107
|
}
|
|
109
108
|
|
|
110
|
-
constructor(
|
|
111
|
-
super(
|
|
112
|
-
this.options =
|
|
113
|
-
? {}
|
|
114
|
-
: (optionsOrAgent || {});
|
|
109
|
+
constructor(options?: ChatPluginOptions) {
|
|
110
|
+
super();
|
|
111
|
+
this.options = options || {};
|
|
115
112
|
this.actions = createChatPluginActions({
|
|
116
113
|
channelState: this.channelState,
|
|
117
114
|
});
|
|
@@ -239,11 +236,3 @@ export class ChatPlugin extends BasePlugin {
|
|
|
239
236
|
};
|
|
240
237
|
}
|
|
241
238
|
}
|
|
242
|
-
|
|
243
|
-
function isAgentRuntimeInput(
|
|
244
|
-
input: ChatPluginOptions | AgentRuntime | null | undefined,
|
|
245
|
-
): input is AgentRuntime | null {
|
|
246
|
-
if (input === null) return true;
|
|
247
|
-
if (!input || typeof input !== "object") return false;
|
|
248
|
-
return typeof (input as AgentRuntime).getSession === "function";
|
|
249
|
-
}
|
|
@@ -4,6 +4,6 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
// Source: src/chat/PROMPT.direct.ts.txt
|
|
7
|
-
const TEXT_MODULE_CONTENT = "# Chat Plugin 使用说明\n\n## 用户可见回复规则\n\n- 当前模式下,直接输出,即会发送消息给到用户对应的channel\n\n## 输出协议\n\n- 需要普通回复时,直接输出文本即可。文本顶部可用 frontmatter metadata (optional),字段语义与
|
|
7
|
+
const TEXT_MODULE_CONTENT = "# Chat Plugin 使用说明\n\n## 用户可见回复规则\n\n- 当前模式下,直接输出,即会发送消息给到用户对应的channel\n\n## 输出协议\n\n- 需要普通回复时,直接输出文本即可。文本顶部可用 frontmatter metadata (optional),字段语义与 chat plugin 的 direct send 协议保持一致:\n\n- `delay` / `delayMs`:延迟发送毫秒数。\n- `time` / `sendAt` / `sendAtMs`:定时发送时间。\n- `reply`:是否使用 reply 语义发送。\n- `messageId`:目标 `message_id`(群聊推荐)。\n- `react`:发送表情反应。\n - 单个字符串:`react: \"👍\"`\n - 或对象/数组:`emoji/big`\n - 设置 `messageId` 时,`react` 会优先复用该消息作为目标消息。\n- 附件使用 `<file type=\"...\">path</file>`(支持 `document/photo/voice/audio/video`)。\n- 附件路径必须是项目内可访问的相对路径。多附件可输出多个 `<file>` 标签。\n\n### 示例\n\n```text\n---\nreply: true\nmessageId: \"128\"\nreact:\n - emoji: \"✅\"\n---\n这是今天的报告。\n<file type=\"document\">reports/daily.md</file>\n```\n\n### 协议约束\n\n- frontmatter 必须位于文本最开头(`---` 包裹)。\n- 除 `<file>` 附件标签外,不要使用尖括号格式做控制参数。\n\n## 跨协议/跨平台操作\n\n- 当前会话内回复优先直接输出文本,系统会自动发送到当前 channel。\n- 当任务需要跨会话、跨平台或复杂路由,使用 chat plugin action。\n- 如果当前工具集中存在 `plugin_call`,可通过 `plugin_call({ plugin: \"chat\", action: \"send\", payload })` 或 `plugin_call({ plugin: \"chat\", action: \"react\", payload })` 触发。\n- metadata 只适用于当前会话内的 direct 出站,不要拿 metadata 做跨 chat 路由。\n- 如果不清楚跨 chat 路由参数,应先读取当前 chat context 或调用 chat plugin 的查询类 action,而不是猜测。\n\n## 入站消息结构(仅供内部理解)\n\n- 每条入队用户消息包含 `<info>...</info>` 元信息块 + 用户正文。\n- `<info>` 仅保留 user/request 元信息,例如 `user_id`、`username`、`message_id`、`permissions`、`received_at`。\n- 当前 chat 路由环境(例如 `channel`、`session_id`、`chat_key`、`chat_id`)会通过 system prompt 单独注入,不再混在 `<info>` 里。\n- `<info>` 不要原样回传给用户。\n";
|
|
8
8
|
|
|
9
9
|
export default TEXT_MODULE_CONTENT;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
## 输出协议
|
|
8
8
|
|
|
9
|
-
- 需要普通回复时,直接输出文本即可。文本顶部可用 frontmatter metadata (optional),字段语义与
|
|
9
|
+
- 需要普通回复时,直接输出文本即可。文本顶部可用 frontmatter metadata (optional),字段语义与 chat plugin 的 direct send 协议保持一致:
|
|
10
10
|
|
|
11
11
|
- `delay` / `delayMs`:延迟发送毫秒数。
|
|
12
12
|
- `time` / `sendAt` / `sendAtMs`:定时发送时间。
|
|
@@ -39,13 +39,11 @@ react:
|
|
|
39
39
|
|
|
40
40
|
## 跨协议/跨平台操作
|
|
41
41
|
|
|
42
|
-
-
|
|
42
|
+
- 当前会话内回复优先直接输出文本,系统会自动发送到当前 channel。
|
|
43
|
+
- 当任务需要跨会话、跨平台或复杂路由,使用 chat plugin action。
|
|
44
|
+
- 如果当前工具集中存在 `plugin_call`,可通过 `plugin_call({ plugin: "chat", action: "send", payload })` 或 `plugin_call({ plugin: "chat", action: "react", payload })` 触发。
|
|
43
45
|
- metadata 只适用于当前会话内的 direct 出站,不要拿 metadata 做跨 chat 路由。
|
|
44
|
-
-
|
|
45
|
-
- 如不确定参数或正文协议,先自行调用:
|
|
46
|
-
- `town chat --help`
|
|
47
|
-
- `town chat send --help`
|
|
48
|
-
- `town chat react --help`
|
|
46
|
+
- 如果不清楚跨 chat 路由参数,应先读取当前 chat context 或调用 chat plugin 的查询类 action,而不是猜测。
|
|
49
47
|
|
|
50
48
|
## 入站消息结构(仅供内部理解)
|
|
51
49
|
|
|
@@ -4,6 +4,6 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
// Source: src/chat/channels/qq/PROMPT.direct.ts.txt
|
|
7
|
-
const TEXT_MODULE_CONTENT = "# QQ Adapter 使用说明(direct 模式)\n\n## 能力范围\n- 负责 QQ 官方机器人网关(WebSocket)消息接入与发送。\n- 入站消息会由 chat plugin runtime 映射到内部 `sessionId`(随机分配并持久化)。\n\n## 使用约束\n- 在 direct 模式下,你输出的 assistant 文本会自动发送到当前 QQ 会话。\n- QQ 出站回复依赖入站消息上下文(如 `chatType` 与 `messageId`);跨会话发送请使用
|
|
7
|
+
const TEXT_MODULE_CONTENT = "# QQ Adapter 使用说明(direct 模式)\n\n## 能力范围\n- 负责 QQ 官方机器人网关(WebSocket)消息接入与发送。\n- 入站消息会由 chat plugin runtime 映射到内部 `sessionId`(随机分配并持久化)。\n\n## 使用约束\n- 在 direct 模式下,你输出的 assistant 文本会自动发送到当前 QQ 会话。\n- QQ 出站回复依赖入站消息上下文(如 `chatType` 与 `messageId`);跨会话发送请使用 chat plugin action,不要在 direct metadata 中写 `chatKey`。\n- 群聊消息默认全量接入,不需要 `@` 触发。\n- 适配器会过滤机器人自回环消息并做入站去重,避免“自己回复自己”的循环。\n";
|
|
8
8
|
|
|
9
9
|
export default TEXT_MODULE_CONTENT;
|
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
|
|
7
7
|
## 使用约束
|
|
8
8
|
- 在 direct 模式下,你输出的 assistant 文本会自动发送到当前 QQ 会话。
|
|
9
|
-
- QQ 出站回复依赖入站消息上下文(如 `chatType` 与 `messageId`);跨会话发送请使用
|
|
9
|
+
- QQ 出站回复依赖入站消息上下文(如 `chatType` 与 `messageId`);跨会话发送请使用 chat plugin action,不要在 direct metadata 中写 `chatKey`。
|
|
10
10
|
- 群聊消息默认全量接入,不需要 `@` 触发。
|
|
11
11
|
- 适配器会过滤机器人自回环消息并做入站去重,避免“自己回复自己”的循环。
|
|
@@ -47,6 +47,8 @@ export class TelegramBot extends BaseChatChannel {
|
|
|
47
47
|
|
|
48
48
|
private readonly botToken: string;
|
|
49
49
|
private readonly platform: TelegramPlatformClient;
|
|
50
|
+
private startTask: Promise<void> | null = null;
|
|
51
|
+
private startupGeneration = 0;
|
|
50
52
|
|
|
51
53
|
constructor(context: AgentContext, botToken: string) {
|
|
52
54
|
super({ channel: "telegram", context });
|
|
@@ -143,17 +145,36 @@ export class TelegramBot extends BaseChatChannel {
|
|
|
143
145
|
this.logger.warn("Telegram Bot Token not configured, skipping startup");
|
|
144
146
|
return;
|
|
145
147
|
}
|
|
148
|
+
if (this.startTask) return;
|
|
146
149
|
|
|
147
150
|
this.logger.info("🤖 Starting Telegram Bot...");
|
|
151
|
+
this.platform.markStartupStarted();
|
|
152
|
+
const startupGeneration = ++this.startupGeneration;
|
|
153
|
+
// 关键点(中文):Telegram 网络初始化不能阻塞 Agent RPC/gateway ready。
|
|
154
|
+
this.startTask = this.startInBackground(startupGeneration);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* 后台启动 Telegram polling。
|
|
159
|
+
*/
|
|
160
|
+
private async startInBackground(startupGeneration: number): Promise<void> {
|
|
148
161
|
try {
|
|
149
162
|
await this.platform.preparePolling();
|
|
150
163
|
await this.drainPendingUpdatesToHistory({ reason: "startup" });
|
|
164
|
+
if (startupGeneration !== this.startupGeneration) {
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
151
167
|
this.platform.startPollingLoop();
|
|
168
|
+
this.platform.markStartupSucceeded();
|
|
152
169
|
} catch (error) {
|
|
170
|
+
if (startupGeneration !== this.startupGeneration) return;
|
|
171
|
+
this.platform.markStartupFailed(error);
|
|
153
172
|
this.logger.error("Failed to start Telegram Bot", {
|
|
154
173
|
error: String(error),
|
|
155
174
|
});
|
|
156
175
|
await this.platform.stop();
|
|
176
|
+
} finally {
|
|
177
|
+
this.startTask = null;
|
|
157
178
|
}
|
|
158
179
|
}
|
|
159
180
|
|
|
@@ -342,6 +363,7 @@ export class TelegramBot extends BaseChatChannel {
|
|
|
342
363
|
* 停止 Telegram bot。
|
|
343
364
|
*/
|
|
344
365
|
async stop(): Promise<void> {
|
|
366
|
+
this.startupGeneration += 1;
|
|
345
367
|
await this.platform.stop();
|
|
346
368
|
}
|
|
347
369
|
}
|
|
@@ -66,6 +66,8 @@ export class TelegramPlatformClient {
|
|
|
66
66
|
private botUsername?: string;
|
|
67
67
|
private botId?: number;
|
|
68
68
|
private clearedWebhookOnce = false;
|
|
69
|
+
private isStarting = false;
|
|
70
|
+
private lastStartupError: string | null = null;
|
|
69
71
|
|
|
70
72
|
constructor(options: TelegramPlatformClientOptions) {
|
|
71
73
|
this.logger = options.context.logger;
|
|
@@ -97,26 +99,58 @@ export class TelegramPlatformClient {
|
|
|
97
99
|
: running
|
|
98
100
|
? "unknown"
|
|
99
101
|
: "disconnected";
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
linkState === "connected"
|
|
102
|
+
const statusText = this.lastStartupError
|
|
103
|
+
? "start_failed"
|
|
104
|
+
: this.isStarting
|
|
105
|
+
? "starting"
|
|
106
|
+
: linkState === "connected"
|
|
105
107
|
? "polling"
|
|
106
108
|
: linkState === "unknown"
|
|
107
109
|
? "starting"
|
|
108
|
-
: "stopped"
|
|
110
|
+
: "stopped";
|
|
111
|
+
return {
|
|
112
|
+
running,
|
|
113
|
+
linkState,
|
|
114
|
+
statusText,
|
|
109
115
|
detail: {
|
|
116
|
+
isStarting: this.isStarting,
|
|
110
117
|
pollInFlight: this.pollInFlight,
|
|
111
118
|
lastUpdateId: this.lastUpdateId,
|
|
112
119
|
consecutivePollErrors: this.consecutivePollErrors,
|
|
113
120
|
nextPollAllowedAt: this.nextPollAllowedAt || null,
|
|
114
121
|
botUsername: this.botUsername || null,
|
|
115
122
|
botId: typeof this.botId === "number" ? this.botId : null,
|
|
123
|
+
lastStartupError: this.lastStartupError,
|
|
116
124
|
},
|
|
117
125
|
};
|
|
118
126
|
}
|
|
119
127
|
|
|
128
|
+
/**
|
|
129
|
+
* 标记 Telegram 后台启动开始。
|
|
130
|
+
*/
|
|
131
|
+
markStartupStarted(): void {
|
|
132
|
+
this.isStarting = true;
|
|
133
|
+
this.isRunning = true;
|
|
134
|
+
this.lastStartupError = null;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* 标记 Telegram 后台启动完成。
|
|
139
|
+
*/
|
|
140
|
+
markStartupSucceeded(): void {
|
|
141
|
+
this.isStarting = false;
|
|
142
|
+
this.lastStartupError = null;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* 标记 Telegram 后台启动失败。
|
|
147
|
+
*/
|
|
148
|
+
markStartupFailed(error: unknown): void {
|
|
149
|
+
this.isStarting = false;
|
|
150
|
+
this.isRunning = false;
|
|
151
|
+
this.lastStartupError = String(error);
|
|
152
|
+
}
|
|
153
|
+
|
|
120
154
|
/**
|
|
121
155
|
* 获取 bot 用户名。
|
|
122
156
|
*/
|
|
@@ -340,9 +374,11 @@ export class TelegramPlatformClient {
|
|
|
340
374
|
* 停止平台运行时。
|
|
341
375
|
*/
|
|
342
376
|
async stop(): Promise<void> {
|
|
377
|
+
this.isStarting = false;
|
|
343
378
|
this.isRunning = false;
|
|
344
379
|
if (this.pollingInterval) {
|
|
345
380
|
clearInterval(this.pollingInterval);
|
|
381
|
+
this.pollingInterval = null;
|
|
346
382
|
}
|
|
347
383
|
this.consecutivePollErrors = 0;
|
|
348
384
|
this.nextPollAllowedAt = 0;
|
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
* - `share` 分享文本、链接、文件和目录,并进入对方 inbox。
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import type { AgentRuntime } from "@downcity/agent/internal/types/runtime/agent/AgentRuntime.js";
|
|
11
10
|
import type { AgentContext } from "@downcity/agent/internal/types/runtime/agent/AgentContext.js";
|
|
12
11
|
import type { JsonValue } from "@downcity/agent/internal/types/common/Json.js";
|
|
13
12
|
import type { PluginActions } from "@downcity/agent/internal/plugin/types/Plugin.js";
|
|
@@ -146,8 +145,8 @@ export class ContactPlugin extends BasePlugin {
|
|
|
146
145
|
*/
|
|
147
146
|
readonly actions: PluginActions;
|
|
148
147
|
|
|
149
|
-
constructor(
|
|
150
|
-
super(
|
|
148
|
+
constructor() {
|
|
149
|
+
super();
|
|
151
150
|
this.actions = createContactActions({
|
|
152
151
|
link: async (context, payload) =>
|
|
153
152
|
(await this.link(context, payload)) as unknown as JsonValue,
|
package/src/contact/PROMPT.ts
CHANGED
|
@@ -4,6 +4,6 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
// Source: src/contact/PROMPT.ts.txt
|
|
7
|
-
const TEXT_MODULE_CONTENT = "Contact plugin\n\ncontact plugin 用来管理和其他 agent 的联系方式。一个 contact 代表一个已建立联系的远端 agent,并固定拥有一条长期对话历史。contact 可以是单向的:只要本 agent 能访问对方,就可以 check、chat、share。\n\n
|
|
7
|
+
const TEXT_MODULE_CONTENT = "Contact plugin\n\ncontact plugin 用来管理和其他 agent 的联系方式。一个 contact 代表一个已建立联系的远端 agent,并固定拥有一条长期对话历史。contact 可以是单向的:只要本 agent 能访问对方,就可以 check、chat、share。\n\n可用 action:\n- `link`:生成一次性联系码,交给另一个 agent。\n- `approve`:使用对方给的联系码建立 contact。\n- `list`:查看已保存的 agent 联系方式。\n- `check`:检查对方是否在线可用。\n- `chat`:和某个 agent 对话。\n- `share`:分享文本、链接、文件或目录。\n- `inbox`:查看收到的分享。\n- `receive`:接收某条分享。\n\n边界:\n- chat 用于对话,share 用于资料交接。\n- `link` action 返回中的 notes 会说明联系码适合本机、局域网还是公网 agent 使用;本地 localhost 联系码不能交给 server agent approve。\n- public-looking endpoint 仍可能被防火墙/NAT 阻断;以返回的 notes 为准,不要承诺公网一定可达。\n- Agent runtime 会在可用时写入 `DOWNCITY_PUBLIC_HOST` 供 contact link 使用;这不是要求用户手动配置的 token 或 endpoint。\n- `approve` action 会先建立单向关系,再由对方主动 ping 回本 agent,ping 成功才升级为 bidirectional。\n- local/private agent 连接 public agent 时通常只能 outbound-only,不要说成双向。\n- contact token 由 link/approve 自动交换;不要要求用户手动配置 token 环境变量。\n- `Contact link not found` 表示请求打到的 agent runtime 没有这条 link 记录,优先检查 endpoint/端口/agent 是否一致;过期会明确返回 `Contact link expired`。\n- receive 只接收内容,不自动执行、不安装 skill、不修改项目业务文件。\n- 不自动 approve 或 receive,除非用户明确要求。\n";
|
|
8
8
|
|
|
9
9
|
export default TEXT_MODULE_CONTENT;
|
|
@@ -2,22 +2,22 @@ Contact plugin
|
|
|
2
2
|
|
|
3
3
|
contact plugin 用来管理和其他 agent 的联系方式。一个 contact 代表一个已建立联系的远端 agent,并固定拥有一条长期对话历史。contact 可以是单向的:只要本 agent 能访问对方,就可以 check、chat、share。
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
- `
|
|
7
|
-
- `
|
|
8
|
-
- `
|
|
9
|
-
- `
|
|
10
|
-
- `
|
|
11
|
-
- `
|
|
12
|
-
- `
|
|
13
|
-
- `
|
|
5
|
+
可用 action:
|
|
6
|
+
- `link`:生成一次性联系码,交给另一个 agent。
|
|
7
|
+
- `approve`:使用对方给的联系码建立 contact。
|
|
8
|
+
- `list`:查看已保存的 agent 联系方式。
|
|
9
|
+
- `check`:检查对方是否在线可用。
|
|
10
|
+
- `chat`:和某个 agent 对话。
|
|
11
|
+
- `share`:分享文本、链接、文件或目录。
|
|
12
|
+
- `inbox`:查看收到的分享。
|
|
13
|
+
- `receive`:接收某条分享。
|
|
14
14
|
|
|
15
15
|
边界:
|
|
16
16
|
- chat 用于对话,share 用于资料交接。
|
|
17
|
-
- `
|
|
17
|
+
- `link` action 返回中的 notes 会说明联系码适合本机、局域网还是公网 agent 使用;本地 localhost 联系码不能交给 server agent approve。
|
|
18
18
|
- public-looking endpoint 仍可能被防火墙/NAT 阻断;以返回的 notes 为准,不要承诺公网一定可达。
|
|
19
|
-
-
|
|
20
|
-
- `
|
|
19
|
+
- Agent runtime 会在可用时写入 `DOWNCITY_PUBLIC_HOST` 供 contact link 使用;这不是要求用户手动配置的 token 或 endpoint。
|
|
20
|
+
- `approve` action 会先建立单向关系,再由对方主动 ping 回本 agent,ping 成功才升级为 bidirectional。
|
|
21
21
|
- local/private agent 连接 public agent 时通常只能 outbound-only,不要说成双向。
|
|
22
22
|
- contact token 由 link/approve 自动交换;不要要求用户手动配置 token 环境变量。
|
|
23
23
|
- `Contact link not found` 表示请求打到的 agent runtime 没有这条 link 记录,优先检查 endpoint/端口/agent 是否一致;过期会明确返回 `Contact link expired`。
|