@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
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WebPlugin 安装器。
|
|
3
|
+
*
|
|
4
|
+
* 关键点(中文)
|
|
5
|
+
* - install 只负责准备联网相关 skill / CLI 依赖,不写 provider 配置。
|
|
6
|
+
* - skill 安装复用 SkillPlugin 的 `npx skills` 通道,避免 web 自建 registry。
|
|
7
|
+
* - agent-browser 额外准备 npm CLI 包,因为其 skill 需要 `agent-browser` 命令可用。
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { execa } from "execa";
|
|
11
|
+
import fs from "node:fs";
|
|
12
|
+
import path from "node:path";
|
|
13
|
+
import type {
|
|
14
|
+
JsonObject,
|
|
15
|
+
JsonValue,
|
|
16
|
+
} from "@downcity/agent/internal/types/common/Json.js";
|
|
17
|
+
import type { AgentContext } from "@downcity/agent/internal/types/runtime/agent/AgentContext.js";
|
|
18
|
+
import { skillInstallCommand } from "@/skill/Command.js";
|
|
19
|
+
import type {
|
|
20
|
+
WebPluginInstallPayload,
|
|
21
|
+
WebPluginInstallScope,
|
|
22
|
+
WebPluginInstallTarget,
|
|
23
|
+
} from "@/web/types/WebPlugin.js";
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* 单个安装步骤结果。
|
|
27
|
+
*/
|
|
28
|
+
interface WebPluginInstallStep {
|
|
29
|
+
/**
|
|
30
|
+
* 步骤名称。
|
|
31
|
+
*/
|
|
32
|
+
name: string;
|
|
33
|
+
/**
|
|
34
|
+
* 步骤是否成功。
|
|
35
|
+
*/
|
|
36
|
+
success: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* 人类可读说明。
|
|
39
|
+
*/
|
|
40
|
+
message: string;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* 读取字符串字段。
|
|
45
|
+
*/
|
|
46
|
+
function read_string(value: JsonValue | undefined): string | undefined {
|
|
47
|
+
if (typeof value !== "string") return undefined;
|
|
48
|
+
const trimmed = value.trim();
|
|
49
|
+
return trimmed || undefined;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* 读取布尔字段。
|
|
54
|
+
*/
|
|
55
|
+
function read_boolean(value: JsonValue | undefined): boolean | undefined {
|
|
56
|
+
return typeof value === "boolean" ? value : undefined;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* 归一化安装目标。
|
|
61
|
+
*/
|
|
62
|
+
function resolve_install_target(value: JsonValue | undefined): WebPluginInstallTarget {
|
|
63
|
+
const target = read_string(value);
|
|
64
|
+
if (target === "web-access" || target === "agent-browser" || target === "all") {
|
|
65
|
+
return target;
|
|
66
|
+
}
|
|
67
|
+
return "web-access";
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* 归一化安装作用域。
|
|
72
|
+
*/
|
|
73
|
+
function resolve_install_scope(value: JsonValue | undefined): WebPluginInstallScope {
|
|
74
|
+
const scope = read_string(value);
|
|
75
|
+
return scope === "project" ? "project" : "user";
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* 判断命令是否已经可用。
|
|
80
|
+
*/
|
|
81
|
+
async function command_exists(command: string): Promise<boolean> {
|
|
82
|
+
try {
|
|
83
|
+
const result = await execa(command, ["--help"], {
|
|
84
|
+
reject: false,
|
|
85
|
+
timeout: 15_000,
|
|
86
|
+
});
|
|
87
|
+
return (result.exitCode ?? 1) === 0;
|
|
88
|
+
} catch {
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* 执行 npm 包安装。
|
|
95
|
+
*/
|
|
96
|
+
async function install_npm_package(params: {
|
|
97
|
+
root_path: string;
|
|
98
|
+
package_name: string;
|
|
99
|
+
scope: WebPluginInstallScope;
|
|
100
|
+
}): Promise<void> {
|
|
101
|
+
if (params.scope === "project") {
|
|
102
|
+
const package_manager = resolve_project_package_manager(params.root_path);
|
|
103
|
+
const args =
|
|
104
|
+
package_manager === "pnpm"
|
|
105
|
+
? ["add", "-D", params.package_name]
|
|
106
|
+
: package_manager === "yarn"
|
|
107
|
+
? ["add", "-D", params.package_name]
|
|
108
|
+
: ["install", "--save-dev", params.package_name];
|
|
109
|
+
await execa(package_manager, args, {
|
|
110
|
+
cwd: params.root_path,
|
|
111
|
+
stdio: "inherit",
|
|
112
|
+
});
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
await execa("npm", ["install", "-g", params.package_name], {
|
|
117
|
+
stdio: "inherit",
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* 根据锁文件推断项目包管理器。
|
|
123
|
+
*/
|
|
124
|
+
function resolve_project_package_manager(root_path: string): "pnpm" | "yarn" | "npm" {
|
|
125
|
+
if (fs.existsSync(path.join(root_path, "pnpm-lock.yaml"))) return "pnpm";
|
|
126
|
+
if (fs.existsSync(path.join(root_path, "yarn.lock"))) return "yarn";
|
|
127
|
+
return "npm";
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* 将步骤列表转成 JSON。
|
|
132
|
+
*/
|
|
133
|
+
function serialize_steps(steps: WebPluginInstallStep[]): JsonValue[] {
|
|
134
|
+
return steps.map((step) => ({
|
|
135
|
+
name: step.name,
|
|
136
|
+
success: step.success,
|
|
137
|
+
message: step.message,
|
|
138
|
+
}));
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* 安装 skill。
|
|
143
|
+
*/
|
|
144
|
+
async function install_skill(params: {
|
|
145
|
+
spec: string;
|
|
146
|
+
scope: WebPluginInstallScope;
|
|
147
|
+
yes: boolean;
|
|
148
|
+
agent?: string;
|
|
149
|
+
steps: WebPluginInstallStep[];
|
|
150
|
+
}): Promise<void> {
|
|
151
|
+
await skillInstallCommand(params.spec, {
|
|
152
|
+
global: params.scope === "user",
|
|
153
|
+
yes: params.yes,
|
|
154
|
+
agent: params.agent,
|
|
155
|
+
});
|
|
156
|
+
params.steps.push({
|
|
157
|
+
name: `${params.spec}:skill`,
|
|
158
|
+
success: true,
|
|
159
|
+
message:
|
|
160
|
+
params.scope === "user"
|
|
161
|
+
? `Installed ${params.spec} skill in user scope.`
|
|
162
|
+
: `Installed ${params.spec} skill in project scope.`,
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* 准备 agent-browser CLI。
|
|
168
|
+
*/
|
|
169
|
+
async function install_agent_browser_cli(params: {
|
|
170
|
+
context: AgentContext;
|
|
171
|
+
scope: WebPluginInstallScope;
|
|
172
|
+
steps: WebPluginInstallStep[];
|
|
173
|
+
}): Promise<void> {
|
|
174
|
+
if (await command_exists("agent-browser")) {
|
|
175
|
+
params.steps.push({
|
|
176
|
+
name: "agent-browser:cli",
|
|
177
|
+
success: true,
|
|
178
|
+
message: "agent-browser CLI is already available.",
|
|
179
|
+
});
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
await install_npm_package({
|
|
184
|
+
root_path: params.context.rootPath,
|
|
185
|
+
package_name: "agent-browser",
|
|
186
|
+
scope: params.scope,
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
params.steps.push({
|
|
190
|
+
name: "agent-browser:cli",
|
|
191
|
+
success: true,
|
|
192
|
+
message:
|
|
193
|
+
params.scope === "user"
|
|
194
|
+
? "Installed agent-browser CLI globally with npm."
|
|
195
|
+
: "Installed agent-browser as a project devDependency.",
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* 执行 WebPlugin install action。
|
|
201
|
+
*/
|
|
202
|
+
export async function installWebPluginTargets(params: {
|
|
203
|
+
context: AgentContext;
|
|
204
|
+
payload?: WebPluginInstallPayload | null;
|
|
205
|
+
}): Promise<JsonObject> {
|
|
206
|
+
const payload = params.payload || {};
|
|
207
|
+
const target = resolve_install_target(payload.target);
|
|
208
|
+
const scope = resolve_install_scope(payload.scope);
|
|
209
|
+
const yes = read_boolean(payload.yes) ?? true;
|
|
210
|
+
const agent = read_string(payload.agent);
|
|
211
|
+
const targets =
|
|
212
|
+
target === "all" ? (["web-access", "agent-browser"] as const) : ([target] as const);
|
|
213
|
+
const steps: WebPluginInstallStep[] = [];
|
|
214
|
+
|
|
215
|
+
for (const item of targets) {
|
|
216
|
+
await install_skill({
|
|
217
|
+
spec: item,
|
|
218
|
+
scope,
|
|
219
|
+
yes,
|
|
220
|
+
agent,
|
|
221
|
+
steps,
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
if (item === "agent-browser") {
|
|
225
|
+
await install_agent_browser_cli({
|
|
226
|
+
context: params.context,
|
|
227
|
+
scope,
|
|
228
|
+
steps,
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
return {
|
|
234
|
+
target,
|
|
235
|
+
scope,
|
|
236
|
+
...(agent ? { agent } : {}),
|
|
237
|
+
steps: serialize_steps(steps),
|
|
238
|
+
nextAction:
|
|
239
|
+
"Use SkillPlugin lookup/list to inspect installed skills, then let the agent choose the concrete web path during task execution.",
|
|
240
|
+
};
|
|
241
|
+
}
|
|
@@ -1,141 +1,65 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* WebPlugin 协议类型。
|
|
3
3
|
*
|
|
4
4
|
* 关键点(中文)
|
|
5
|
-
* -
|
|
6
|
-
* -
|
|
5
|
+
* - web plugin 只注入联网方法论,不维护 provider 运行态。
|
|
6
|
+
* - install action 仅用于准备联网相关 skill 与工具依赖。
|
|
7
|
+
* - target 表示要准备的联网能力,不表示 agent 运行时默认选择。
|
|
7
8
|
*/
|
|
8
9
|
|
|
9
10
|
import type { JsonValue } from "@downcity/agent/internal/types/common/Json.js";
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
|
-
*
|
|
13
|
+
* WebPlugin 可安装目标。
|
|
13
14
|
*/
|
|
14
|
-
export
|
|
15
|
-
"https://github.com/eze-is/web-access";
|
|
15
|
+
export type WebPluginInstallTarget = "web-access" | "agent-browser" | "all";
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
|
-
*
|
|
19
|
-
*/
|
|
20
|
-
export type WebPluginProvider = "web-access" | "agent-browser";
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Web plugin 安装作用域。
|
|
18
|
+
* WebPlugin 安装作用域。
|
|
24
19
|
*/
|
|
25
20
|
export type WebPluginInstallScope = "user" | "project";
|
|
26
21
|
|
|
27
22
|
/**
|
|
28
|
-
*
|
|
23
|
+
* WebPlugin install action 输入。
|
|
29
24
|
*/
|
|
30
|
-
export interface
|
|
31
|
-
/**
|
|
32
|
-
* 兼容统一结构化配置约束的索引签名。
|
|
33
|
-
*/
|
|
34
|
-
[key: string]: JsonValue | undefined;
|
|
35
|
-
/**
|
|
36
|
-
* 当前使用的 provider。
|
|
37
|
-
*/
|
|
38
|
-
provider?: WebPluginProvider;
|
|
39
|
-
/**
|
|
40
|
-
* 是否向 agent 注入 provider 提示词。
|
|
41
|
-
*/
|
|
42
|
-
injectPrompt?: boolean;
|
|
25
|
+
export interface WebPluginInstallPayload {
|
|
43
26
|
/**
|
|
44
|
-
*
|
|
27
|
+
* 要准备的联网能力。
|
|
28
|
+
*
|
|
29
|
+
* 说明(中文)
|
|
30
|
+
* - `web-access`:安装 web-access skill。
|
|
31
|
+
* - `agent-browser`:安装 agent-browser skill,并准备 agent-browser CLI 包。
|
|
32
|
+
* - `all`:同时准备以上能力。
|
|
33
|
+
* - 默认值为 `web-access`,避免默认安装额外 CLI。
|
|
45
34
|
*/
|
|
46
|
-
|
|
35
|
+
target?: WebPluginInstallTarget;
|
|
47
36
|
/**
|
|
48
|
-
*
|
|
37
|
+
* 安装作用域。
|
|
38
|
+
*
|
|
39
|
+
* 说明(中文)
|
|
40
|
+
* - `user`:安装到用户级 skill / npm 全局环境。
|
|
41
|
+
* - `project`:安装到当前项目级 skill / devDependency。
|
|
42
|
+
* - 默认值为 `user`,避免默认修改项目依赖。
|
|
49
43
|
*/
|
|
50
|
-
|
|
44
|
+
scope?: WebPluginInstallScope;
|
|
51
45
|
/**
|
|
52
|
-
*
|
|
46
|
+
* 是否跳过安装确认。
|
|
47
|
+
*
|
|
48
|
+
* 说明(中文)
|
|
49
|
+
* - 会透传给底层 skill installer。
|
|
50
|
+
* - 默认值为 `true`,适合 agent 自动执行。
|
|
53
51
|
*/
|
|
54
|
-
|
|
52
|
+
yes?: boolean;
|
|
55
53
|
/**
|
|
56
|
-
* skill
|
|
54
|
+
* skill installer 的目标 agent 名称。
|
|
55
|
+
*
|
|
56
|
+
* 说明(中文)
|
|
57
|
+
* - 留空时不向底层 skill installer 传递 `--agent`。
|
|
58
|
+
* - 只有需要显式指定 installer 目标时才传入。
|
|
57
59
|
*/
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* 归一化后的 web plugin 配置。
|
|
63
|
-
*/
|
|
64
|
-
export interface ResolvedWebPluginConfig {
|
|
60
|
+
agent?: string;
|
|
65
61
|
/**
|
|
66
|
-
*
|
|
62
|
+
* 允许保留额外 JSON 字段,便于未来扩展安装器参数。
|
|
67
63
|
*/
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* 是否注入 prompt。
|
|
71
|
-
*/
|
|
72
|
-
injectPrompt: boolean;
|
|
73
|
-
/**
|
|
74
|
-
* 仓库地址。
|
|
75
|
-
*/
|
|
76
|
-
repositoryUrl: string;
|
|
77
|
-
/**
|
|
78
|
-
* provider 版本标签(可选)。
|
|
79
|
-
*/
|
|
80
|
-
sourceVersion?: string;
|
|
81
|
-
/**
|
|
82
|
-
* 浏览器命令。
|
|
83
|
-
*/
|
|
84
|
-
browserCommand: string;
|
|
85
|
-
/**
|
|
86
|
-
* skill 安装作用域。
|
|
87
|
-
*/
|
|
88
|
-
installScope: WebPluginInstallScope;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* web plugin setup/install 输入。
|
|
93
|
-
*/
|
|
94
|
-
export interface WebPluginInstallInput {
|
|
95
|
-
/**
|
|
96
|
-
* provider。
|
|
97
|
-
*/
|
|
98
|
-
provider?: WebPluginProvider;
|
|
99
|
-
/**
|
|
100
|
-
* 是否注入 prompt。
|
|
101
|
-
*/
|
|
102
|
-
injectPrompt?: boolean;
|
|
103
|
-
/**
|
|
104
|
-
* 来源仓库地址。
|
|
105
|
-
*/
|
|
106
|
-
repositoryUrl?: string;
|
|
107
|
-
/**
|
|
108
|
-
* 版本标签。
|
|
109
|
-
*/
|
|
110
|
-
sourceVersion?: string;
|
|
111
|
-
/**
|
|
112
|
-
* 浏览器命令(可选)。
|
|
113
|
-
*/
|
|
114
|
-
browserCommand?: string;
|
|
115
|
-
/**
|
|
116
|
-
* 安装作用域(可选)。
|
|
117
|
-
*/
|
|
118
|
-
installScope?: WebPluginInstallScope;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* web plugin 依赖检查结果。
|
|
123
|
-
*/
|
|
124
|
-
export interface WebPluginDependencyCheckResult {
|
|
125
|
-
/**
|
|
126
|
-
* 当前 provider 是否可用。
|
|
127
|
-
*/
|
|
128
|
-
available: boolean;
|
|
129
|
-
/**
|
|
130
|
-
* 当前 provider 是否已就绪。
|
|
131
|
-
*/
|
|
132
|
-
installed: boolean;
|
|
133
|
-
/**
|
|
134
|
-
* 不可用原因列表。
|
|
135
|
-
*/
|
|
136
|
-
reasons: string[];
|
|
137
|
-
/**
|
|
138
|
-
* 结构化详情(可选)。
|
|
139
|
-
*/
|
|
140
|
-
details?: JsonValue;
|
|
64
|
+
[key: string]: JsonValue | undefined;
|
|
141
65
|
}
|
package/src/workboard/Plugin.ts
CHANGED
|
@@ -2,105 +2,33 @@
|
|
|
2
2
|
* Workboard Plugin。
|
|
3
3
|
*
|
|
4
4
|
* 关键点(中文)
|
|
5
|
-
* - workboard
|
|
6
|
-
* -
|
|
5
|
+
* - workboard 是 runtime 观测面板插件,负责提供结构化工作快照。
|
|
6
|
+
* - plugin action 与 HTTP route 共享同一份快照读取逻辑。
|
|
7
|
+
* - 是否启用由是否注册该 plugin 决定,不再读取项目配置做二次开关。
|
|
7
8
|
*/
|
|
8
9
|
|
|
9
10
|
import { BasePlugin } from "@downcity/agent/internal/plugin/core/BasePlugin.js";
|
|
10
|
-
import type {
|
|
11
|
+
import type {
|
|
12
|
+
PluginActions,
|
|
13
|
+
PluginHttpDefinition,
|
|
14
|
+
} from "@downcity/agent/internal/plugin/types/Plugin.js";
|
|
15
|
+
import type { AgentContext } from "@downcity/agent/internal/types/runtime/agent/AgentContext.js";
|
|
11
16
|
import type { JsonValue } from "@downcity/agent/internal/types/common/Json.js";
|
|
12
|
-
import { isPluginEnabled } from "@downcity/agent/internal/plugin/core/Activation.js";
|
|
13
17
|
import { getWorkboardSnapshotStore } from "@/workboard/runtime/Store.js";
|
|
14
18
|
import type { WorkboardSnapshotResponse } from "@/workboard/types/Workboard.js";
|
|
15
19
|
|
|
16
|
-
|
|
20
|
+
/**
|
|
21
|
+
* 读取 workboard 快照。
|
|
22
|
+
*/
|
|
23
|
+
async function readWorkboardSnapshot(
|
|
24
|
+
context: AgentContext,
|
|
25
|
+
): Promise<WorkboardSnapshotResponse> {
|
|
26
|
+
const snapshot = await getWorkboardSnapshotStore({
|
|
27
|
+
contextResolver: () => context,
|
|
28
|
+
}).readSnapshot();
|
|
17
29
|
return {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
description:
|
|
21
|
-
"Collects structured runtime activity snapshots so console surfaces can show what the current agent is doing now and what it recently worked on.",
|
|
22
|
-
availability(context) {
|
|
23
|
-
if (!isPluginEnabled({ plugin, context })) {
|
|
24
|
-
return {
|
|
25
|
-
enabled: false,
|
|
26
|
-
available: false,
|
|
27
|
-
reasons: ["workboard plugin disabled in project config"],
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
return {
|
|
31
|
-
enabled: true,
|
|
32
|
-
available: true,
|
|
33
|
-
reasons: [],
|
|
34
|
-
};
|
|
35
|
-
},
|
|
36
|
-
actions: {
|
|
37
|
-
snapshot: {
|
|
38
|
-
execute: async ({ context }) => {
|
|
39
|
-
const availability = await plugin.availability?.(context);
|
|
40
|
-
if (availability && availability.available !== true) {
|
|
41
|
-
return {
|
|
42
|
-
success: false,
|
|
43
|
-
error: availability.reasons.join("; ") || "workboard unavailable",
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
const snapshot = await getWorkboardSnapshotStore({
|
|
48
|
-
contextResolver: () => context,
|
|
49
|
-
}).readSnapshot();
|
|
50
|
-
return {
|
|
51
|
-
success: true,
|
|
52
|
-
data: {
|
|
53
|
-
snapshot,
|
|
54
|
-
} as unknown as JsonValue,
|
|
55
|
-
};
|
|
56
|
-
},
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
|
-
http: {
|
|
60
|
-
server: {
|
|
61
|
-
authPolicies: [
|
|
62
|
-
{
|
|
63
|
-
path: "/api/workboard/*",
|
|
64
|
-
method: "GET",
|
|
65
|
-
requireAuth: true,
|
|
66
|
-
anyPermissions: ["agent.read"],
|
|
67
|
-
},
|
|
68
|
-
],
|
|
69
|
-
register({ app, getContext }) {
|
|
70
|
-
app.get("/api/workboard/snapshot", async (c) => {
|
|
71
|
-
try {
|
|
72
|
-
const availability = await plugin.availability?.(getContext());
|
|
73
|
-
if (availability && availability.available !== true) {
|
|
74
|
-
return c.json(
|
|
75
|
-
{
|
|
76
|
-
success: false,
|
|
77
|
-
error: availability.reasons.join("; ") || "workboard unavailable",
|
|
78
|
-
},
|
|
79
|
-
503,
|
|
80
|
-
);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
const snapshot = await getWorkboardSnapshotStore({
|
|
84
|
-
contextResolver: getContext,
|
|
85
|
-
}).readSnapshot();
|
|
86
|
-
const payload: WorkboardSnapshotResponse = {
|
|
87
|
-
success: true,
|
|
88
|
-
snapshot,
|
|
89
|
-
};
|
|
90
|
-
return c.json(payload);
|
|
91
|
-
} catch (error) {
|
|
92
|
-
return c.json(
|
|
93
|
-
{
|
|
94
|
-
success: false,
|
|
95
|
-
error: error instanceof Error ? error.message : String(error),
|
|
96
|
-
},
|
|
97
|
-
500,
|
|
98
|
-
);
|
|
99
|
-
}
|
|
100
|
-
});
|
|
101
|
-
},
|
|
102
|
-
},
|
|
103
|
-
},
|
|
30
|
+
success: true,
|
|
31
|
+
snapshot,
|
|
104
32
|
};
|
|
105
33
|
}
|
|
106
34
|
|
|
@@ -108,10 +36,67 @@ function createWorkboardPluginDefinition(plugin: Plugin): Plugin {
|
|
|
108
36
|
* WorkboardPlugin:运行态观测面板插件。
|
|
109
37
|
*/
|
|
110
38
|
export class WorkboardPlugin extends BasePlugin {
|
|
39
|
+
/**
|
|
40
|
+
* 当前 plugin 稳定名称。
|
|
41
|
+
*/
|
|
111
42
|
readonly name = "workboard";
|
|
112
43
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
44
|
+
/**
|
|
45
|
+
* 插件标题。
|
|
46
|
+
*/
|
|
47
|
+
readonly title = "Workboard Snapshot";
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* 插件说明。
|
|
51
|
+
*/
|
|
52
|
+
readonly description =
|
|
53
|
+
"Collects structured runtime activity snapshots so console surfaces can show what the current agent is doing now and what it recently worked on.";
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Workboard 对外 action。
|
|
57
|
+
*/
|
|
58
|
+
readonly actions: PluginActions = {
|
|
59
|
+
snapshot: {
|
|
60
|
+
execute: async ({ context }) => {
|
|
61
|
+
const response = await readWorkboardSnapshot(context);
|
|
62
|
+
return {
|
|
63
|
+
success: true,
|
|
64
|
+
data: {
|
|
65
|
+
snapshot: response.snapshot,
|
|
66
|
+
} as unknown as JsonValue,
|
|
67
|
+
};
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Workboard HTTP route。
|
|
74
|
+
*/
|
|
75
|
+
readonly http: PluginHttpDefinition = {
|
|
76
|
+
server: {
|
|
77
|
+
authPolicies: [
|
|
78
|
+
{
|
|
79
|
+
path: "/api/workboard/*",
|
|
80
|
+
method: "GET",
|
|
81
|
+
requireAuth: true,
|
|
82
|
+
anyPermissions: ["agent.read"],
|
|
83
|
+
},
|
|
84
|
+
],
|
|
85
|
+
register({ app, getContext }) {
|
|
86
|
+
app.get("/api/workboard/snapshot", async (c) => {
|
|
87
|
+
try {
|
|
88
|
+
return c.json(await readWorkboardSnapshot(getContext()));
|
|
89
|
+
} catch (error) {
|
|
90
|
+
return c.json(
|
|
91
|
+
{
|
|
92
|
+
success: false,
|
|
93
|
+
error: error instanceof Error ? error.message : String(error),
|
|
94
|
+
},
|
|
95
|
+
500,
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
};
|
|
117
102
|
}
|
package/bin/asr/Config.d.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ASR plugin 配置读写工具。
|
|
3
|
-
*
|
|
4
|
-
* 关键点(中文)
|
|
5
|
-
* - 行为配置与转写依赖配置统一收敛到 `plugins.asr`。
|
|
6
|
-
* - 写入前将输入规范化为 JSON object,避免 undefined 进入项目配置。
|
|
7
|
-
*/
|
|
8
|
-
import type { VoicePluginConfig } from "../voice/types/VoicePlugin.js";
|
|
9
|
-
import type { AgentPluginConfigRuntime } from "@downcity/agent/internal/types/agent/AgentRuntimeAssembly.js";
|
|
10
|
-
import type { JsonObject, JsonValue } from "@downcity/agent/internal/types/common/Json.js";
|
|
11
|
-
/**
|
|
12
|
-
* 将普通对象转为可持久化 JSON object。
|
|
13
|
-
*/
|
|
14
|
-
export declare function toJsonObject(input: Record<string, unknown> | null | undefined): JsonObject | null;
|
|
15
|
-
/**
|
|
16
|
-
* 读取字符串选项。
|
|
17
|
-
*/
|
|
18
|
-
export declare function getStringOpt(opts: Record<string, JsonValue>, key: string): string | undefined;
|
|
19
|
-
/**
|
|
20
|
-
* 读取布尔选项。
|
|
21
|
-
*/
|
|
22
|
-
export declare function getBooleanOpt(opts: Record<string, JsonValue>, key: string, defaultValue: boolean): boolean;
|
|
23
|
-
/**
|
|
24
|
-
* 读取 ASR Plugin 配置。
|
|
25
|
-
*/
|
|
26
|
-
export declare function readVoicePluginConfig(runtime: {
|
|
27
|
-
config: {
|
|
28
|
-
plugins?: Record<string, unknown>;
|
|
29
|
-
};
|
|
30
|
-
}): VoicePluginConfig;
|
|
31
|
-
/**
|
|
32
|
-
* 写入完整 ASR plugin 配置。
|
|
33
|
-
*/
|
|
34
|
-
export declare function writeVoicePluginConfig(params: {
|
|
35
|
-
agentState: {
|
|
36
|
-
config: {
|
|
37
|
-
plugins?: Record<string, unknown>;
|
|
38
|
-
};
|
|
39
|
-
pluginConfig: AgentPluginConfigRuntime;
|
|
40
|
-
};
|
|
41
|
-
value: VoicePluginConfig;
|
|
42
|
-
}): Promise<void>;
|
|
43
|
-
//# sourceMappingURL=Config.d.ts.map
|
package/bin/asr/Config.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Config.d.ts","sourceRoot":"","sources":["../../src/asr/Config.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,8DAA8D,CAAC;AAC7G,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,+CAA+C,CAAC;AAE3F;;GAEG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,GAAG,SAAS,GAChD,UAAU,GAAG,IAAI,CAyBnB;AAED;;GAEG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,EAC/B,GAAG,EAAE,MAAM,GACV,MAAM,GAAG,SAAS,CAKpB;AAED;;GAEG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,EAC/B,GAAG,EAAE,MAAM,EACX,YAAY,EAAE,OAAO,GACpB,OAAO,CAST;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE;IAC7C,MAAM,EAAE;QACN,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACnC,CAAC;CACH,GAAG,iBAAiB,CA8BpB;AAED;;GAEG;AACH,wBAAsB,sBAAsB,CAAC,MAAM,EAAE;IACnD,UAAU,EAAE;QACV,MAAM,EAAE;YACN,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;SACnC,CAAC;QACF,YAAY,EAAE,wBAAwB,CAAC;KACxC,CAAC;IACF,KAAK,EAAE,iBAAiB,CAAC;CAC1B,GAAG,OAAO,CAAC,IAAI,CAAC,CAYhB"}
|