@downcity/plugins 1.0.56 → 1.0.59
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.map +1 -1
- package/bin/BuiltinPlugins.js +0 -6
- package/bin/BuiltinPlugins.js.map +1 -1
- package/bin/asr/Plugin.d.ts +67 -7
- 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/types/AuthPlugin.d.ts +12 -16
- package/bin/auth/types/AuthPlugin.d.ts.map +1 -1
- package/bin/auth/types/AuthPlugin.js +9 -13
- package/bin/auth/types/AuthPlugin.js.map +1 -1
- package/bin/chat/ChatPlugin.d.ts +37 -6
- package/bin/chat/ChatPlugin.d.ts.map +1 -1
- package/bin/chat/ChatPlugin.js +58 -80
- package/bin/chat/ChatPlugin.js.map +1 -1
- package/bin/chat/Index.d.ts +4 -1
- package/bin/chat/Index.d.ts.map +1 -1
- package/bin/chat/Index.js +2 -1
- package/bin/chat/Index.js.map +1 -1
- package/bin/chat/channels/Configuration.d.ts +1 -1
- package/bin/chat/channels/Configuration.js +1 -1
- package/bin/chat/channels/RuntimeChannel.d.ts +145 -0
- package/bin/chat/channels/RuntimeChannel.d.ts.map +1 -0
- package/bin/chat/channels/RuntimeChannel.js +148 -0
- package/bin/chat/channels/RuntimeChannel.js.map +1 -0
- package/bin/chat/runtime/ChatAuthorizationRuntime.d.ts +22 -0
- package/bin/chat/runtime/ChatAuthorizationRuntime.d.ts.map +1 -0
- package/bin/chat/runtime/ChatAuthorizationRuntime.js +189 -0
- package/bin/chat/runtime/ChatAuthorizationRuntime.js.map +1 -0
- package/bin/chat/runtime/ChatChannelActions.d.ts.map +1 -1
- package/bin/chat/runtime/ChatChannelActions.js +19 -9
- package/bin/chat/runtime/ChatChannelActions.js.map +1 -1
- package/bin/chat/runtime/ChatChannelConfig.d.ts +2 -18
- package/bin/chat/runtime/ChatChannelConfig.d.ts.map +1 -1
- package/bin/chat/runtime/ChatChannelConfig.js +2 -73
- package/bin/chat/runtime/ChatChannelConfig.js.map +1 -1
- package/bin/chat/runtime/ChatChannelCore.d.ts +22 -1
- package/bin/chat/runtime/ChatChannelCore.d.ts.map +1 -1
- package/bin/chat/runtime/ChatChannelCore.js +5 -5
- package/bin/chat/runtime/ChatChannelCore.js.map +1 -1
- package/bin/chat/runtime/ChatPluginActionRegistry.js +1 -1
- package/bin/chat/runtime/ChatPluginActionRegistry.js.map +1 -1
- package/bin/chat/runtime/PluginPoints.d.ts +3 -3
- package/bin/chat/runtime/PluginPoints.js +3 -3
- package/bin/chat/types/ChannelStatus.d.ts +1 -1
- package/bin/chat/types/ChatPluginOptions.d.ts +76 -0
- package/bin/chat/types/ChatPluginOptions.d.ts.map +1 -0
- package/bin/chat/types/ChatPluginOptions.js +10 -0
- package/bin/chat/types/ChatPluginOptions.js.map +1 -0
- package/bin/image/ImagePlugin.d.ts +1 -1
- package/bin/image/ImagePlugin.d.ts.map +1 -1
- package/bin/image/ImagePlugin.js +23 -5
- package/bin/image/ImagePlugin.js.map +1 -1
- package/bin/index.d.ts +6 -3
- package/bin/index.d.ts.map +1 -1
- package/bin/index.js +2 -2
- package/bin/index.js.map +1 -1
- package/bin/skill/Action.d.ts.map +1 -1
- package/bin/skill/Action.js +2 -2
- package/bin/skill/Action.js.map +1 -1
- package/bin/skill/Command.js +5 -5
- package/bin/skill/Command.js.map +1 -1
- package/bin/skill/Plugin.js +1 -1
- package/bin/skill/Plugin.js.map +1 -1
- package/bin/skill/runtime/Discovery.d.ts +4 -4
- package/bin/skill/runtime/Discovery.d.ts.map +1 -1
- package/bin/skill/runtime/Discovery.js +5 -5
- package/bin/skill/runtime/Discovery.js.map +1 -1
- package/bin/skill/runtime/Paths.d.ts +1 -5
- package/bin/skill/runtime/Paths.d.ts.map +1 -1
- package/bin/skill/runtime/Paths.js +1 -9
- 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 -3
- package/bin/skill/runtime/Prompt.js.map +1 -1
- package/bin/skill/runtime/Store.d.ts +2 -2
- package/bin/skill/runtime/Store.d.ts.map +1 -1
- package/bin/skill/runtime/Store.js.map +1 -1
- package/bin/skill/runtime/SystemProvider.js +4 -4
- package/bin/skill/runtime/SystemProvider.js.map +1 -1
- package/bin/skill/runtime/Types.d.ts +3 -3
- package/bin/skill/runtime/Types.d.ts.map +1 -1
- package/bin/skill/types/{ClaudeSkill.d.ts → SkillDefinition.d.ts} +4 -4
- package/bin/skill/types/SkillDefinition.d.ts.map +1 -0
- package/bin/skill/types/{ClaudeSkill.js → SkillDefinition.js} +2 -2
- package/bin/skill/types/SkillDefinition.js.map +1 -0
- package/bin/skill/types/SkillPlugin.d.ts +2 -2
- package/bin/skill/types/SkillPlugin.d.ts.map +1 -1
- package/bin/tts/Plugin.d.ts +53 -6
- 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 -5
- package/bin/web/Plugin.d.ts.map +1 -1
- package/bin/web/Plugin.js +126 -450
- 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 +38 -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 +23 -3
- package/bin/workboard/Plugin.d.ts.map +1 -1
- package/bin/workboard/Plugin.js +66 -85
- package/bin/workboard/Plugin.js.map +1 -1
- package/package.json +2 -2
- package/src/BuiltinPlugins.ts +0 -6
- package/src/asr/Plugin.ts +264 -483
- package/src/asr/types/AsrPlugin.ts +118 -0
- package/src/auth/types/AuthPlugin.ts +12 -17
- package/src/chat/ChatPlugin.ts +92 -89
- package/src/chat/Index.ts +18 -1
- package/src/chat/channels/Configuration.ts +1 -1
- package/src/chat/channels/RuntimeChannel.ts +264 -0
- package/src/chat/runtime/ChatAuthorizationRuntime.ts +229 -0
- package/src/chat/runtime/ChatChannelActions.ts +24 -9
- package/src/chat/runtime/ChatChannelConfig.ts +2 -100
- package/src/chat/runtime/ChatChannelCore.ts +20 -8
- package/src/chat/runtime/ChatPluginActionRegistry.ts +1 -1
- package/src/chat/runtime/PluginPoints.ts +3 -3
- package/src/chat/types/ChannelStatus.ts +1 -1
- package/src/chat/types/ChatPluginOptions.ts +79 -0
- package/src/image/ImagePlugin.ts +23 -5
- package/src/index.ts +29 -6
- package/src/skill/Action.ts +10 -7
- package/src/skill/Command.ts +5 -5
- package/src/skill/Plugin.ts +1 -1
- package/src/skill/runtime/Discovery.ts +14 -11
- package/src/skill/runtime/Paths.ts +1 -13
- package/src/skill/runtime/Prompt.ts +5 -5
- package/src/skill/runtime/Store.ts +6 -3
- package/src/skill/runtime/SystemProvider.ts +4 -4
- package/src/skill/runtime/Types.ts +3 -3
- package/src/skill/types/{ClaudeSkill.ts → SkillDefinition.ts} +3 -3
- package/src/skill/types/SkillPlugin.ts +2 -2
- package/src/tts/Plugin.ts +225 -492
- 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 -453
- package/src/web/WebPromptAssets.ts +1 -13
- package/src/web/runtime/Install.ts +241 -0
- package/src/web/types/WebPlugin.ts +38 -114
- package/src/workboard/Plugin.ts +80 -95
- 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/auth/Plugin.d.ts +0 -17
- package/bin/auth/Plugin.d.ts.map +0 -1
- package/bin/auth/Plugin.js +0 -199
- package/bin/auth/Plugin.js.map +0 -1
- package/bin/chat/ChatPluginTypes.d.ts +0 -122
- package/bin/chat/ChatPluginTypes.d.ts.map +0 -1
- package/bin/chat/ChatPluginTypes.js +0 -10
- package/bin/chat/ChatPluginTypes.js.map +0 -1
- package/bin/skill/types/ClaudeSkill.d.ts.map +0 -1
- package/bin/skill/types/ClaudeSkill.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/auth/Plugin.ts +0 -237
- package/src/chat/ChatPluginTypes.ts +0 -126
- 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
|
@@ -1,194 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Voice Plugin 类型定义。
|
|
3
|
-
*
|
|
4
|
-
* 关键点(中文)
|
|
5
|
-
* - Voice 的行为配置与转写依赖配置统一收敛到 `plugins.asr`。
|
|
6
|
-
* - 这里的类型名直接反映 plugin 自身能力,不再保留 asset 心智。
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import type { JsonValue } from "@downcity/agent/internal/types/common/Json.js";
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Voice Plugin 行为配置。
|
|
13
|
-
*/
|
|
14
|
-
export interface VoicePluginConfig {
|
|
15
|
-
/**
|
|
16
|
-
* 兼容统一结构化配置约束的索引签名。
|
|
17
|
-
*/
|
|
18
|
-
[key: string]: JsonValue | undefined;
|
|
19
|
-
/**
|
|
20
|
-
* 是否把转写结果注入 system/prompt 行为链。
|
|
21
|
-
*/
|
|
22
|
-
injectPrompt?: boolean;
|
|
23
|
-
/**
|
|
24
|
-
* 是否在消息进入 Agent 前自动增强语音内容。
|
|
25
|
-
*/
|
|
26
|
-
augmentMessage?: boolean;
|
|
27
|
-
/**
|
|
28
|
-
* 转写提供者类型。
|
|
29
|
-
*/
|
|
30
|
-
provider?: "local" | "command";
|
|
31
|
-
/**
|
|
32
|
-
* 当前激活模型 ID(可选)。
|
|
33
|
-
*/
|
|
34
|
-
modelId?: string;
|
|
35
|
-
/**
|
|
36
|
-
* 模型根目录(可选)。
|
|
37
|
-
*/
|
|
38
|
-
modelsDir?: string;
|
|
39
|
-
/**
|
|
40
|
-
* Python 可执行文件(可选)。
|
|
41
|
-
*/
|
|
42
|
-
pythonBin?: string;
|
|
43
|
-
/**
|
|
44
|
-
* 自定义命令模板(可选)。
|
|
45
|
-
*/
|
|
46
|
-
command?: string;
|
|
47
|
-
/**
|
|
48
|
-
* 默认语言提示(可选)。
|
|
49
|
-
*/
|
|
50
|
-
language?: string;
|
|
51
|
-
/**
|
|
52
|
-
* 转写超时时间(毫秒,可选)。
|
|
53
|
-
*/
|
|
54
|
-
timeoutMs?: number;
|
|
55
|
-
/**
|
|
56
|
-
* 本地推理策略(可选)。
|
|
57
|
-
*/
|
|
58
|
-
strategy?: "auto" | "funasr" | "transformers-whisper" | "command";
|
|
59
|
-
/**
|
|
60
|
-
* 已安装模型列表(可选)。
|
|
61
|
-
*/
|
|
62
|
-
installedModels?: string[];
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Voice 转写配置。
|
|
67
|
-
*/
|
|
68
|
-
export interface VoiceTranscriberConfig {
|
|
69
|
-
/**
|
|
70
|
-
* 兼容统一结构化配置约束的索引签名。
|
|
71
|
-
*/
|
|
72
|
-
[key: string]: JsonValue | undefined;
|
|
73
|
-
/**
|
|
74
|
-
* 转写提供者类型。
|
|
75
|
-
*
|
|
76
|
-
* 说明(中文)
|
|
77
|
-
* - `local`:使用内建本地模型与 Python Runner。
|
|
78
|
-
* - `command`:使用用户自定义命令模板。
|
|
79
|
-
*/
|
|
80
|
-
provider?: "local" | "command";
|
|
81
|
-
/**
|
|
82
|
-
* 本地模型 ID(可选)。
|
|
83
|
-
*
|
|
84
|
-
* 说明(中文)
|
|
85
|
-
* - 这是 asr plugin 内部依赖字段,不要求其他 service 直接感知。
|
|
86
|
-
*/
|
|
87
|
-
modelId?: string;
|
|
88
|
-
/**
|
|
89
|
-
* 模型根目录(可选)。
|
|
90
|
-
*/
|
|
91
|
-
modelsDir?: string;
|
|
92
|
-
/**
|
|
93
|
-
* Python 可执行文件(可选)。
|
|
94
|
-
*/
|
|
95
|
-
pythonBin?: string;
|
|
96
|
-
/**
|
|
97
|
-
* 自定义命令模板(可选)。
|
|
98
|
-
*/
|
|
99
|
-
command?: string;
|
|
100
|
-
/**
|
|
101
|
-
* 默认语言提示(可选)。
|
|
102
|
-
*/
|
|
103
|
-
language?: string;
|
|
104
|
-
/**
|
|
105
|
-
* 转写超时时间(毫秒,可选)。
|
|
106
|
-
*/
|
|
107
|
-
timeoutMs?: number;
|
|
108
|
-
/**
|
|
109
|
-
* 本地推理策略(可选)。
|
|
110
|
-
*
|
|
111
|
-
* 说明(中文)
|
|
112
|
-
* - `auto`:按模型自动选择 runner。
|
|
113
|
-
* - `funasr` / `transformers-whisper`:固定使用对应 runner。
|
|
114
|
-
* - `command`:使用自定义命令模板。
|
|
115
|
-
*/
|
|
116
|
-
strategy?: "auto" | "funasr" | "transformers-whisper" | "command";
|
|
117
|
-
/**
|
|
118
|
-
* 已安装模型列表(可选)。
|
|
119
|
-
*
|
|
120
|
-
* 说明(中文)
|
|
121
|
-
* - 仅作为状态快照使用,不应被 plugin 直接依赖。
|
|
122
|
-
*/
|
|
123
|
-
installedModels?: string[];
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* Voice 转写安装输入。
|
|
128
|
-
*/
|
|
129
|
-
export interface VoiceTranscriberInstallInput {
|
|
130
|
-
/**
|
|
131
|
-
* 兼容统一结构化配置约束的索引签名。
|
|
132
|
-
*/
|
|
133
|
-
[key: string]: JsonValue | undefined;
|
|
134
|
-
/**
|
|
135
|
-
* 需要安装的模型 ID 列表(可选)。
|
|
136
|
-
*/
|
|
137
|
-
modelIds?: string[];
|
|
138
|
-
/**
|
|
139
|
-
* 安装完成后激活的模型 ID(可选)。
|
|
140
|
-
*/
|
|
141
|
-
activeModel?: string;
|
|
142
|
-
/**
|
|
143
|
-
* 是否强制覆盖已存在资源。
|
|
144
|
-
*/
|
|
145
|
-
force?: boolean;
|
|
146
|
-
/**
|
|
147
|
-
* 模型目录(可选)。
|
|
148
|
-
*/
|
|
149
|
-
modelsDir?: string;
|
|
150
|
-
/**
|
|
151
|
-
* Python 可执行文件(可选)。
|
|
152
|
-
*/
|
|
153
|
-
pythonBin?: string;
|
|
154
|
-
/**
|
|
155
|
-
* 是否同时安装转写依赖。
|
|
156
|
-
*/
|
|
157
|
-
installDeps?: boolean;
|
|
158
|
-
/**
|
|
159
|
-
* HuggingFace Token(可选)。
|
|
160
|
-
*/
|
|
161
|
-
hfToken?: string;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* Voice 转写句柄。
|
|
166
|
-
*/
|
|
167
|
-
export interface VoiceTranscriberHandle {
|
|
168
|
-
/**
|
|
169
|
-
* 执行音频转写。
|
|
170
|
-
*/
|
|
171
|
-
transcribe(input: {
|
|
172
|
-
/**
|
|
173
|
-
* 待转写音频路径。
|
|
174
|
-
*/
|
|
175
|
-
audioPath: string;
|
|
176
|
-
/**
|
|
177
|
-
* 语言提示(可选)。
|
|
178
|
-
*/
|
|
179
|
-
language?: string;
|
|
180
|
-
}): Promise<{
|
|
181
|
-
/**
|
|
182
|
-
* 转写是否成功。
|
|
183
|
-
*/
|
|
184
|
-
success: boolean;
|
|
185
|
-
/**
|
|
186
|
-
* 转写文本(可选)。
|
|
187
|
-
*/
|
|
188
|
-
text?: string;
|
|
189
|
-
/**
|
|
190
|
-
* 错误信息(可选)。
|
|
191
|
-
*/
|
|
192
|
-
error?: string;
|
|
193
|
-
}>;
|
|
194
|
-
}
|
package/src/web/Dependency.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Web Plugin 兼容导出层。
|
|
3
|
-
*
|
|
4
|
-
* 关键点(中文)
|
|
5
|
-
* - `web` plugin 只保留薄适配层。
|
|
6
|
-
* - 真正的联网/浏览器能力由外部 provider 项目负责。
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
export {
|
|
10
|
-
readWebPluginConfig,
|
|
11
|
-
writeWebPluginConfig,
|
|
12
|
-
} from "@/web/runtime/Config.js";
|
|
13
|
-
export {
|
|
14
|
-
inspectWebPluginDependency,
|
|
15
|
-
installWebPluginDependency,
|
|
16
|
-
doctorWebPluginDependency,
|
|
17
|
-
} from "@/web/runtime/Source.js";
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 自动生成文件,请勿手改。
|
|
3
|
-
* 源文件:由同路径 `*.ts.txt` 生成。
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
// Source: src/web/PROMPT.agent-browser.ts.txt
|
|
7
|
-
const TEXT_MODULE_CONTENT = "# Web Plugin / agent-browser\n\n当前 provider 是 `agent-browser`。\n\n你应直接使用 `agent-browser` 项目的浏览器自动化方法,而不是在本项目里自己实现浏览器交互。\n\n工作原则:\n\n- 浏览器交互、打开页面、点击、填写、截图、滚动等操作优先交给 `agent-browser`\n- 严格遵循 `agent-browser` 的基本工作流:\n 1. `open`\n 2. `snapshot -i`\n 3. 使用元素引用交互\n 4. 页面变化后重新 snapshot\n- 如果 `agent-browser` provider 不可用,应先报告依赖缺失\n\n你在处理需要浏览器操作的任务时,应以外部 `agent-browser` 项目为准。\n";
|
|
8
|
-
|
|
9
|
-
export default TEXT_MODULE_CONTENT;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
# Web Plugin / agent-browser
|
|
2
|
-
|
|
3
|
-
当前 provider 是 `agent-browser`。
|
|
4
|
-
|
|
5
|
-
你应直接使用 `agent-browser` 项目的浏览器自动化方法,而不是在本项目里自己实现浏览器交互。
|
|
6
|
-
|
|
7
|
-
工作原则:
|
|
8
|
-
|
|
9
|
-
- 浏览器交互、打开页面、点击、填写、截图、滚动等操作优先交给 `agent-browser`
|
|
10
|
-
- 严格遵循 `agent-browser` 的基本工作流:
|
|
11
|
-
1. `open`
|
|
12
|
-
2. `snapshot -i`
|
|
13
|
-
3. 使用元素引用交互
|
|
14
|
-
4. 页面变化后重新 snapshot
|
|
15
|
-
- 如果 `agent-browser` provider 不可用,应先报告依赖缺失
|
|
16
|
-
|
|
17
|
-
你在处理需要浏览器操作的任务时,应以外部 `agent-browser` 项目为准。
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 自动生成文件,请勿手改。
|
|
3
|
-
* 源文件:由同路径 `*.ts.txt` 生成。
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
// Source: src/web/PROMPT.web-access.ts.txt
|
|
7
|
-
const TEXT_MODULE_CONTENT = "# Web Plugin / web-access\n\n当前 provider 是 `web-access`。\n\n你应直接遵循已安装的 `web-access` skill/project 逻辑,而不是在本项目里重新实现一套联网框架。\n\n工作原则:\n\n- 优先沿用 `web-access` 自己的联网策略、工具选择和浏览哲学\n- 把 Downcity 的 `web` plugin 视为 provider 选择器与接入层\n- 如果 `web-access` 不可用,先指出依赖缺失,而不是自行退回到本项目里的临时实现\n\n你在处理联网任务时,应以外部 `web-access` 项目为准。\n";
|
|
8
|
-
|
|
9
|
-
export default TEXT_MODULE_CONTENT;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
# Web Plugin / web-access
|
|
2
|
-
|
|
3
|
-
当前 provider 是 `web-access`。
|
|
4
|
-
|
|
5
|
-
你应直接遵循已安装的 `web-access` skill/project 逻辑,而不是在本项目里重新实现一套联网框架。
|
|
6
|
-
|
|
7
|
-
工作原则:
|
|
8
|
-
|
|
9
|
-
- 优先沿用 `web-access` 自己的联网策略、工具选择和浏览哲学
|
|
10
|
-
- 把 Downcity 的 `web` plugin 视为 provider 选择器与接入层
|
|
11
|
-
- 如果 `web-access` 不可用,先指出依赖缺失,而不是自行退回到本项目里的临时实现
|
|
12
|
-
|
|
13
|
-
你在处理联网任务时,应以外部 `web-access` 项目为准。
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Web Plugin 配置读写。
|
|
3
|
-
*
|
|
4
|
-
* 关键点(中文)
|
|
5
|
-
* - `web` 默认启用,不要求用户先在 `downcity.json` 写配置。
|
|
6
|
-
* - 只有当用户显式改动时,才把 `plugins.web` 持久化到项目配置。
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import type { JsonObject } from "@downcity/agent/internal/types/common/Json.js";
|
|
10
|
-
import type { PluginCommandContext } from "@downcity/agent/internal/plugin/types/Plugin.js";
|
|
11
|
-
import type { ResolvedWebPluginConfig, WebPluginConfig } from "@/web/types/WebPlugin.js";
|
|
12
|
-
import { WEB_PLUGIN_DEFAULT_REPOSITORY_URL } from "@/web/types/WebPlugin.js";
|
|
13
|
-
|
|
14
|
-
function toJsonObject(input: Record<string, unknown> | null | undefined): JsonObject {
|
|
15
|
-
const out: JsonObject = {};
|
|
16
|
-
if (!input) return out;
|
|
17
|
-
for (const [key, value] of Object.entries(input)) {
|
|
18
|
-
if (
|
|
19
|
-
value === null ||
|
|
20
|
-
typeof value === "string" ||
|
|
21
|
-
typeof value === "number" ||
|
|
22
|
-
typeof value === "boolean"
|
|
23
|
-
) {
|
|
24
|
-
out[key] = value;
|
|
25
|
-
continue;
|
|
26
|
-
}
|
|
27
|
-
if (Array.isArray(value)) {
|
|
28
|
-
out[key] = value.filter((item) => item !== undefined) as never;
|
|
29
|
-
continue;
|
|
30
|
-
}
|
|
31
|
-
if (value && typeof value === "object") {
|
|
32
|
-
out[key] = toJsonObject(value as Record<string, unknown>);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
return out;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function readWebPluginRecord(context: PluginCommandContext): Record<string, unknown> {
|
|
39
|
-
const current = context.config.plugins?.web;
|
|
40
|
-
if (!current || typeof current !== "object" || Array.isArray(current)) {
|
|
41
|
-
return {};
|
|
42
|
-
}
|
|
43
|
-
return current as Record<string, unknown>;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* 读取并归一化 web plugin 配置。
|
|
48
|
-
*/
|
|
49
|
-
export function readWebPluginConfig(
|
|
50
|
-
context: PluginCommandContext,
|
|
51
|
-
): ResolvedWebPluginConfig {
|
|
52
|
-
const { enabled: _ignoredEnabled, ...current } = readWebPluginRecord(
|
|
53
|
-
context,
|
|
54
|
-
) as WebPluginConfig & {
|
|
55
|
-
enabled?: boolean;
|
|
56
|
-
};
|
|
57
|
-
return {
|
|
58
|
-
provider:
|
|
59
|
-
current.provider === "agent-browser" || current.provider === "web-access"
|
|
60
|
-
? current.provider
|
|
61
|
-
: "web-access",
|
|
62
|
-
injectPrompt:
|
|
63
|
-
typeof current.injectPrompt === "boolean" ? current.injectPrompt : true,
|
|
64
|
-
repositoryUrl:
|
|
65
|
-
typeof current.repositoryUrl === "string" && current.repositoryUrl.trim()
|
|
66
|
-
? current.repositoryUrl.trim()
|
|
67
|
-
: WEB_PLUGIN_DEFAULT_REPOSITORY_URL,
|
|
68
|
-
...(typeof current.sourceVersion === "string" && current.sourceVersion.trim()
|
|
69
|
-
? { sourceVersion: current.sourceVersion.trim() }
|
|
70
|
-
: {}),
|
|
71
|
-
browserCommand:
|
|
72
|
-
typeof current.browserCommand === "string" && current.browserCommand.trim()
|
|
73
|
-
? current.browserCommand.trim()
|
|
74
|
-
: "agent-browser",
|
|
75
|
-
installScope:
|
|
76
|
-
current.installScope === "project" || current.installScope === "user"
|
|
77
|
-
? current.installScope
|
|
78
|
-
: "user",
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* 写入 web plugin 配置。
|
|
84
|
-
*/
|
|
85
|
-
export async function writeWebPluginConfig(params: {
|
|
86
|
-
context: PluginCommandContext;
|
|
87
|
-
value: Partial<WebPluginConfig>;
|
|
88
|
-
}): Promise<ResolvedWebPluginConfig> {
|
|
89
|
-
if (!params.context.config.plugins) {
|
|
90
|
-
params.context.config.plugins = {};
|
|
91
|
-
}
|
|
92
|
-
const current = readWebPluginConfig(params.context);
|
|
93
|
-
const next: WebPluginConfig & {
|
|
94
|
-
enabled?: boolean;
|
|
95
|
-
} = {
|
|
96
|
-
...current,
|
|
97
|
-
...params.value,
|
|
98
|
-
};
|
|
99
|
-
delete next.enabled;
|
|
100
|
-
params.context.config.plugins.web = toJsonObject(
|
|
101
|
-
next as unknown as Record<string, unknown>,
|
|
102
|
-
);
|
|
103
|
-
await params.context.pluginConfig.persistProjectPlugins(params.context.config.plugins);
|
|
104
|
-
return readWebPluginConfig(params.context);
|
|
105
|
-
}
|
|
@@ -1,257 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Web Plugin 来源信息与兼容安装动作。
|
|
3
|
-
*
|
|
4
|
-
* 关键点(中文)
|
|
5
|
-
* - 这里不自建联网实现,只检查外部 provider 是否就绪,并记录少量配置。
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import fs from "node:fs";
|
|
9
|
-
import path from "node:path";
|
|
10
|
-
import os from "node:os";
|
|
11
|
-
import fsp from "node:fs/promises";
|
|
12
|
-
import { execa } from "execa";
|
|
13
|
-
import fse from "fs-extra";
|
|
14
|
-
import type { JsonObject } from "@downcity/agent/internal/types/common/Json.js";
|
|
15
|
-
import type { PluginCommandContext } from "@downcity/agent/internal/plugin/types/Plugin.js";
|
|
16
|
-
import type {
|
|
17
|
-
WebPluginDependencyCheckResult,
|
|
18
|
-
WebPluginInstallInput,
|
|
19
|
-
} from "@/web/types/WebPlugin.js";
|
|
20
|
-
import { readWebPluginConfig, writeWebPluginConfig } from "@/web/runtime/Config.js";
|
|
21
|
-
import { AGENT_BROWSER_PROMPT } from "@/web/WebPromptAssets.js";
|
|
22
|
-
|
|
23
|
-
function toJsonObject(input: Record<string, unknown> | null | undefined): JsonObject {
|
|
24
|
-
const out: JsonObject = {};
|
|
25
|
-
if (!input) return out;
|
|
26
|
-
for (const [key, value] of Object.entries(input)) {
|
|
27
|
-
if (
|
|
28
|
-
value === null ||
|
|
29
|
-
typeof value === "string" ||
|
|
30
|
-
typeof value === "number" ||
|
|
31
|
-
typeof value === "boolean"
|
|
32
|
-
) {
|
|
33
|
-
out[key] = value;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
return out;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function resolveWebAccessSkillCandidates(projectRoot: string): string[] {
|
|
40
|
-
const home = process.env.HOME || "";
|
|
41
|
-
return [
|
|
42
|
-
path.join(projectRoot, ".agents", "skills", "web-access", "SKILL.md"),
|
|
43
|
-
path.join(home, ".agents", "skills", "web-access", "SKILL.md"),
|
|
44
|
-
path.join(projectRoot, ".claude", "skills", "web-access", "SKILL.md"),
|
|
45
|
-
path.join(home, ".claude", "skills", "web-access", "SKILL.md"),
|
|
46
|
-
].filter(Boolean);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
function resolveManagedSkillRoot(projectRoot: string, scope: "user" | "project"): string {
|
|
50
|
-
if (scope === "project") {
|
|
51
|
-
return path.join(projectRoot, ".agents", "skills");
|
|
52
|
-
}
|
|
53
|
-
return path.join(process.env.HOME || os.homedir(), ".agents", "skills");
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function resolveManagedSkillDir(params: {
|
|
57
|
-
projectRoot: string;
|
|
58
|
-
scope: "user" | "project";
|
|
59
|
-
provider: "web-access" | "agent-browser";
|
|
60
|
-
}): string {
|
|
61
|
-
return path.join(resolveManagedSkillRoot(params.projectRoot, params.scope), params.provider);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
function loadBundledAgentBrowserSkillText(): string {
|
|
65
|
-
return AGENT_BROWSER_PROMPT || "# agent-browser";
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
async function ensureAgentBrowserSkillInstalled(params: {
|
|
69
|
-
projectRoot: string;
|
|
70
|
-
scope: "user" | "project";
|
|
71
|
-
}): Promise<string> {
|
|
72
|
-
const targetDir = resolveManagedSkillDir({
|
|
73
|
-
projectRoot: params.projectRoot,
|
|
74
|
-
scope: params.scope,
|
|
75
|
-
provider: "agent-browser",
|
|
76
|
-
});
|
|
77
|
-
const skillPath = path.join(targetDir, "SKILL.md");
|
|
78
|
-
if (fs.existsSync(skillPath)) {
|
|
79
|
-
return skillPath;
|
|
80
|
-
}
|
|
81
|
-
await fsp.mkdir(targetDir, { recursive: true });
|
|
82
|
-
await fsp.writeFile(`${skillPath}`, `${loadBundledAgentBrowserSkillText()}\n`, "utf-8");
|
|
83
|
-
return skillPath;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
async function ensureWebAccessSkillInstalled(params: {
|
|
87
|
-
projectRoot: string;
|
|
88
|
-
scope: "user" | "project";
|
|
89
|
-
source?: string;
|
|
90
|
-
}): Promise<string> {
|
|
91
|
-
const targetDir = resolveManagedSkillDir({
|
|
92
|
-
projectRoot: params.projectRoot,
|
|
93
|
-
scope: params.scope,
|
|
94
|
-
provider: "web-access",
|
|
95
|
-
});
|
|
96
|
-
const skillPath = path.join(targetDir, "SKILL.md");
|
|
97
|
-
if (fs.existsSync(skillPath)) {
|
|
98
|
-
return skillPath;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
const source = String(params.source || "").trim();
|
|
102
|
-
if (source && fs.existsSync(source)) {
|
|
103
|
-
await fse.copy(path.resolve(source), targetDir, {
|
|
104
|
-
overwrite: true,
|
|
105
|
-
errorOnExist: false,
|
|
106
|
-
});
|
|
107
|
-
return skillPath;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
await fsp.mkdir(path.dirname(targetDir), { recursive: true });
|
|
111
|
-
await execa("git", ["clone", "--depth=1", "https://github.com/eze-is/web-access", targetDir], {
|
|
112
|
-
reject: true,
|
|
113
|
-
});
|
|
114
|
-
return skillPath;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
async function checkAgentBrowserCommand(command: string): Promise<boolean> {
|
|
118
|
-
try {
|
|
119
|
-
await execa(command, ["--help"], {
|
|
120
|
-
reject: false,
|
|
121
|
-
timeout: 15_000,
|
|
122
|
-
});
|
|
123
|
-
return true;
|
|
124
|
-
} catch {
|
|
125
|
-
return false;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* 返回当前来源快照。
|
|
131
|
-
*/
|
|
132
|
-
export async function inspectWebPluginDependency(
|
|
133
|
-
context: PluginCommandContext,
|
|
134
|
-
): Promise<WebPluginDependencyCheckResult> {
|
|
135
|
-
const config = readWebPluginConfig(context);
|
|
136
|
-
if (config.provider === "agent-browser") {
|
|
137
|
-
const available = await checkAgentBrowserCommand(config.browserCommand);
|
|
138
|
-
return {
|
|
139
|
-
available,
|
|
140
|
-
installed: available,
|
|
141
|
-
reasons: available
|
|
142
|
-
? []
|
|
143
|
-
: [
|
|
144
|
-
`agent-browser command is not available: ${config.browserCommand}`,
|
|
145
|
-
"Install or expose the agent-browser CLI before using this provider.",
|
|
146
|
-
],
|
|
147
|
-
details: {
|
|
148
|
-
provider: config.provider,
|
|
149
|
-
browserCommand: config.browserCommand,
|
|
150
|
-
source: "external-project",
|
|
151
|
-
installScope: config.installScope,
|
|
152
|
-
},
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
const candidates = resolveWebAccessSkillCandidates(context.rootPath);
|
|
157
|
-
const skillPath = candidates.find((item) => fs.existsSync(item));
|
|
158
|
-
const available = Boolean(skillPath);
|
|
159
|
-
return {
|
|
160
|
-
available,
|
|
161
|
-
installed: available,
|
|
162
|
-
reasons: available
|
|
163
|
-
? []
|
|
164
|
-
: [
|
|
165
|
-
"web-access skill is not found.",
|
|
166
|
-
"Install https://github.com/eze-is/web-access into ~/.agents/skills/web-access or project .agents/skills/web-access.",
|
|
167
|
-
],
|
|
168
|
-
details: {
|
|
169
|
-
provider: config.provider,
|
|
170
|
-
source: "external-project",
|
|
171
|
-
repositoryUrl: config.repositoryUrl,
|
|
172
|
-
installScope: config.installScope,
|
|
173
|
-
...(config.sourceVersion ? { sourceVersion: config.sourceVersion } : {}),
|
|
174
|
-
...(skillPath ? { skillPath } : { checkedPaths: candidates }),
|
|
175
|
-
},
|
|
176
|
-
};
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
/**
|
|
180
|
-
* 兼容 install 动作。
|
|
181
|
-
*/
|
|
182
|
-
export async function installWebPluginDependency(params: {
|
|
183
|
-
context: PluginCommandContext;
|
|
184
|
-
input?: WebPluginInstallInput;
|
|
185
|
-
}): Promise<{
|
|
186
|
-
success: boolean;
|
|
187
|
-
message?: string;
|
|
188
|
-
details?: JsonObject;
|
|
189
|
-
}> {
|
|
190
|
-
const currentConfig = readWebPluginConfig(params.context);
|
|
191
|
-
const installScope =
|
|
192
|
-
params.input?.installScope === "project" || params.input?.installScope === "user"
|
|
193
|
-
? params.input.installScope
|
|
194
|
-
: currentConfig.installScope;
|
|
195
|
-
const provider =
|
|
196
|
-
params.input?.provider === "agent-browser" || params.input?.provider === "web-access"
|
|
197
|
-
? params.input.provider
|
|
198
|
-
: currentConfig.provider;
|
|
199
|
-
|
|
200
|
-
const installedSkillPath =
|
|
201
|
-
provider === "agent-browser"
|
|
202
|
-
? await ensureAgentBrowserSkillInstalled({
|
|
203
|
-
projectRoot: params.context.rootPath,
|
|
204
|
-
scope: installScope,
|
|
205
|
-
})
|
|
206
|
-
: await ensureWebAccessSkillInstalled({
|
|
207
|
-
projectRoot: params.context.rootPath,
|
|
208
|
-
scope: installScope,
|
|
209
|
-
source: params.input?.repositoryUrl,
|
|
210
|
-
});
|
|
211
|
-
|
|
212
|
-
const nextConfig = await writeWebPluginConfig({
|
|
213
|
-
context: params.context,
|
|
214
|
-
value: {
|
|
215
|
-
provider,
|
|
216
|
-
injectPrompt:
|
|
217
|
-
typeof params.input?.injectPrompt === "boolean"
|
|
218
|
-
? params.input.injectPrompt
|
|
219
|
-
: true,
|
|
220
|
-
...(typeof params.input?.repositoryUrl === "string" &&
|
|
221
|
-
params.input.repositoryUrl.trim()
|
|
222
|
-
? { repositoryUrl: params.input.repositoryUrl.trim() }
|
|
223
|
-
: {}),
|
|
224
|
-
...(typeof params.input?.sourceVersion === "string" &&
|
|
225
|
-
params.input.sourceVersion.trim()
|
|
226
|
-
? { sourceVersion: params.input.sourceVersion.trim() }
|
|
227
|
-
: {}),
|
|
228
|
-
...(typeof params.input?.browserCommand === "string" &&
|
|
229
|
-
params.input.browserCommand.trim()
|
|
230
|
-
? { browserCommand: params.input.browserCommand.trim() }
|
|
231
|
-
: {}),
|
|
232
|
-
installScope,
|
|
233
|
-
},
|
|
234
|
-
});
|
|
235
|
-
return {
|
|
236
|
-
success: true,
|
|
237
|
-
message: "web provider installed and configured",
|
|
238
|
-
details: toJsonObject({
|
|
239
|
-
provider: nextConfig.provider,
|
|
240
|
-
injectPrompt: nextConfig.injectPrompt,
|
|
241
|
-
repositoryUrl: nextConfig.repositoryUrl,
|
|
242
|
-
sourceVersion: nextConfig.sourceVersion || "",
|
|
243
|
-
browserCommand: nextConfig.browserCommand,
|
|
244
|
-
installScope: nextConfig.installScope,
|
|
245
|
-
skillPath: installedSkillPath,
|
|
246
|
-
}),
|
|
247
|
-
};
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
/**
|
|
251
|
-
* doctor 结果与 inspect 一致。
|
|
252
|
-
*/
|
|
253
|
-
export async function doctorWebPluginDependency(
|
|
254
|
-
context: PluginCommandContext,
|
|
255
|
-
): Promise<WebPluginDependencyCheckResult> {
|
|
256
|
-
return inspectWebPluginDependency(context);
|
|
257
|
-
}
|