Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 10 additions & 16 deletions crates/tw-control/tests/plugin_defaults.rs
Original file line number Diff line number Diff line change
Expand Up @@ -703,10 +703,6 @@ async fn the_shipped_defaults_go_in_turned_off_without_starting_the_sandbox() {
let a = b.gw.runtime().plugins.get(id).unwrap().clone();
assert!(a.ready().unwrap().dormant(), "{id}");
}
assert_eq!(
b.entry("deepseek-flags").unwrap().scope.models,
["deepseek*"]
);
assert_eq!(
b.plugin("reply-language").await["settings"],
json!({"language": "简体中文"})
Expand Down Expand Up @@ -898,38 +894,36 @@ async fn a_cache_entry_that_does_not_match_is_ignored() {
}
}

/// `deepseek-flags` 改得了回答里的工具调用:网页那条路打不开它,确认过的那条打得开
/// `wsl-paths` 改得了回答里的工具调用:网页那条路打不开它,确认过的那条打得开
#[tokio::test]
async fn deepseek_flags_turns_on_only_with_a_confirmation() {
async fn wsl_paths_turns_on_only_with_a_confirmation() {
let b = bed_in("real", false);
Seeder::shipped().seed(&b.mgr).await;
// 只是打开:范围和设置都是装上时的那样
let body = |base: String| {
json!({"enabled": true, "on_error": "reject",
"scope": {"clients": [], "models": ["deepseek*"], "upstreams": []},
"settings": {}, "base_version": base})
"scope": {"clients": [], "models": [], "upstreams": []},
"settings": {"windows_client": false}, "base_version": base})
};
let (st, v) = call(
&b.app,
"PUT",
"/plugins/deepseek-flags",
"/plugins/wsl-paths",
Some(body(b.version().await)),
)
.await;
assert_eq!(st, StatusCode::FORBIDDEN, "{v}");
assert_eq!(v["code"], "control.plugin.needs_confirmation");
assert!(!b.entry("deepseek-flags").unwrap().enabled);
assert!(!b.entry("wsl-paths").unwrap().enabled);

let (st, v) = call(
&b.app,
"PUT",
"/plugins/deepseek-flags/confirmed",
"/plugins/wsl-paths/confirmed",
Some(body(b.version().await)),
)
.await;
assert_eq!(st, StatusCode::OK, "{v}");
assert!(b.entry("deepseek-flags").unwrap().enabled);
assert_eq!(
b.plugin("deepseek-flags").await["status"],
json!({"kind": "ok"})
);
assert!(b.entry("wsl-paths").unwrap().enabled);
assert_eq!(b.plugin("wsl-paths").await["status"], json!({"kind": "ok"}));
}
118 changes: 0 additions & 118 deletions crates/tw-gateway/src/plugin/defaults/deepseek-flags.js

This file was deleted.

32 changes: 0 additions & 32 deletions crates/tw-gateway/src/plugin/defaults/manifests.json
Original file line number Diff line number Diff line change
@@ -1,36 +1,4 @@
{
"deepseek-flags": {
"manifest": {
"api": 1,
"description": "DeepSeek's API rejects requests that contain a certain regional flag emoji with 400 Content Exists Risk, and the whole conversation then stays stuck. This plugin replaces such emoji with placeholder text before sending and puts them back in answers and tool calls.",
"hooks": {
"reply_text": true,
"reply_text_end": true,
"request": true,
"tool_call": true
},
"name": "Avoid DeepSeek request rejections",
"permissions": [
"system",
"messages",
"reply_text",
"reply_tool_calls"
],
"reply_mode": "stream",
"requests": [
"conversation"
],
"scope": {
"clients": [],
"models": [
"deepseek*"
],
"upstreams": []
},
"settings": []
},
"sha256": "96a1069558726008bb19f39b09288585634570af55e02eec6194d4a50bee4327"
},
"reply-language": {
"manifest": {
"api": 1,
Expand Down
3 changes: 1 addition & 2 deletions crates/tw-gateway/src/plugin/defaults/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
pub const ALL: &[(&str, &str)] = &[
("reply-language", include_str!("reply-language.js")),
("wsl-paths", include_str!("wsl-paths.js")),
("deepseek-flags", include_str!("deepseek-flags.js")),
];

/// 每个默认插件预先算好的 manifest:id → `{ sha256, manifest }`,`sha256` 是生成时那份
Expand Down Expand Up @@ -52,7 +51,7 @@ mod tests {
#[test]
fn the_list_is_the_agreed_set() {
let ids: Vec<&str> = ALL.iter().map(|(id, _)| *id).collect();
assert_eq!(ids, ["reply-language", "wsl-paths", "deepseek-flags"]);
assert_eq!(ids, ["reply-language", "wsl-paths"]);
}

/// 每个 id 都装得进配置:写法对、不是控制面占用的词、不重复
Expand Down
11 changes: 0 additions & 11 deletions crates/tw-gateway/tests/plugin_harness/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -639,17 +639,6 @@ impl Gateway {
.collect()
}

/// 这个插件在某一种钩子(`request` / `reply`)上每次运行的结局,按先后
pub fn outcomes_of(&self, id: &str, hook: &str) -> Vec<String> {
self.runs
.lock()
.unwrap()
.iter()
.filter(|r| r.run.plugin_id == id && r.run.hook.slug() == hook)
.map(|r| r.run.outcome.slug().to_string())
.collect()
}

/// 这个插件每次出错、被拒时记下的消息码,按先后
pub fn error_codes(&self, id: &str) -> Vec<String> {
self.runs
Expand Down
Loading
Loading