@downcity/plugins 1.0.56 → 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.map +1 -1
- package/bin/BuiltinPlugins.js +0 -4
- 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/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 +2 -0
- package/bin/index.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 +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/package.json +2 -2
- package/src/BuiltinPlugins.ts +0 -4
- package/src/asr/Plugin.ts +264 -483
- package/src/asr/types/AsrPlugin.ts +118 -0
- package/src/image/ImagePlugin.ts +23 -5
- package/src/index.ts +12 -0
- 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 +37 -113
- 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/image/ImagePlugin.ts
CHANGED
|
@@ -177,14 +177,32 @@ export class ImagePlugin extends BasePlugin {
|
|
|
177
177
|
}
|
|
178
178
|
|
|
179
179
|
/**
|
|
180
|
-
*
|
|
180
|
+
* 图片插件给模型的使用说明。
|
|
181
181
|
*/
|
|
182
182
|
system(_context: AgentContext): string {
|
|
183
183
|
return [
|
|
184
|
-
"Image
|
|
185
|
-
|
|
186
|
-
"
|
|
187
|
-
"
|
|
184
|
+
"# Image Plugin",
|
|
185
|
+
"",
|
|
186
|
+
"Use this plugin only when the user asks to generate, create, draw, render, edit, transform, or stylize an image.",
|
|
187
|
+
"Do not call it for ordinary image analysis or questions about an existing image unless the user asks for a new/edited image output.",
|
|
188
|
+
"",
|
|
189
|
+
"Call through `plugin_call`:",
|
|
190
|
+
"",
|
|
191
|
+
"```ts",
|
|
192
|
+
"plugin_call({",
|
|
193
|
+
` plugin: "${this.name}",`,
|
|
194
|
+
' action: "generate",',
|
|
195
|
+
" payload: {",
|
|
196
|
+
' prompt: "...",',
|
|
197
|
+
" },",
|
|
198
|
+
"});",
|
|
199
|
+
"```",
|
|
200
|
+
"",
|
|
201
|
+
"Payload rules:",
|
|
202
|
+
"- `prompt` is required unless `messages` provides the full multimodal image context.",
|
|
203
|
+
"- Optional common fields: `messages`, `size`, `aspect_ratio`, `ratio`, `quality`, `n`, `count`, `seed`, `provider_options`.",
|
|
204
|
+
"- Preserve the user's creative intent; do not over-rewrite the prompt unless clarification is necessary.",
|
|
205
|
+
"- Generated image file parts are saved under project `.downcity/resources` and attached to the final assistant message automatically.",
|
|
188
206
|
].join("\n");
|
|
189
207
|
}
|
|
190
208
|
|
package/src/index.ts
CHANGED
|
@@ -43,6 +43,18 @@ export type {
|
|
|
43
43
|
ChatPluginQqOptions,
|
|
44
44
|
ChatPluginTelegramOptions,
|
|
45
45
|
} from "./chat/ChatPluginTypes.js";
|
|
46
|
+
export type {
|
|
47
|
+
AsrPluginInput,
|
|
48
|
+
AsrPluginOptions,
|
|
49
|
+
AsrPluginResult,
|
|
50
|
+
} from "./asr/types/AsrPlugin.js";
|
|
51
|
+
export type {
|
|
52
|
+
TtsPluginInput,
|
|
53
|
+
TtsPluginOptions,
|
|
54
|
+
TtsPluginResult,
|
|
55
|
+
TtsPluginSimpleAudioResult,
|
|
56
|
+
TtsPluginUiMessageResult,
|
|
57
|
+
} from "./tts/types/TtsPlugin.js";
|
|
46
58
|
export type {
|
|
47
59
|
ImagePluginContent,
|
|
48
60
|
ImagePluginFileContent,
|