openclaw-openagent 1.0.3 → 1.0.4
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/dist/src/app/download-file-tool.js +1 -1
- package/dist/src/app/remote-agent-tool.js +1 -1
- package/dist/src/plugin-ui/assets/openagent-override.js +1 -1
- package/package.json +1 -1
- package/src/app/download-file-tool.ts +1 -1
- package/src/app/remote-agent-tool.ts +1 -1
- package/src/plugin-ui/assets/openagent-override.js +1 -1
- package/src/plugin-ui/modules/agent-book/panel/theme-adapter.js +86 -0
|
@@ -71,7 +71,7 @@ export function createDownloadFileTool() {
|
|
|
71
71
|
return fail('OASN transport not ready');
|
|
72
72
|
}
|
|
73
73
|
// ② Resolve download URL
|
|
74
|
-
const accessBase = rt.config?.accessApiBase;
|
|
74
|
+
const accessBase = rt.config?.accessApiBase || rt.config?.apiBase;
|
|
75
75
|
const downloadUrl = resolveOasnAccessUrl(accessBase, contentUrl);
|
|
76
76
|
logger.info(`[download-tool] Downloading artifact: url=${downloadUrl} saveTo=${savePath}`);
|
|
77
77
|
// ③ Download
|
|
@@ -290,7 +290,7 @@ export function createCallRemoteAgentTool() {
|
|
|
290
290
|
// 在 visible_result.webui_continuation 里返回可继续交互的入口。
|
|
291
291
|
if (result.webuiContinuation?.launchUrl) {
|
|
292
292
|
const rawLink = result.webuiContinuation.launchUrl;
|
|
293
|
-
const accessBase = rt.config?.accessApiBase;
|
|
293
|
+
const accessBase = rt.config?.accessApiBase || rt.config?.apiBase;
|
|
294
294
|
const link = resolveOasnAccessUrl(accessBase, rawLink);
|
|
295
295
|
const label = result.webuiContinuation.displayName || 'Open WebUI';
|
|
296
296
|
content = content.trim()
|
package/package.json
CHANGED
|
@@ -93,7 +93,7 @@ export function createDownloadFileTool(): ToolDescriptor {
|
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
// ② Resolve download URL
|
|
96
|
-
const accessBase = rt.config?.accessApiBase;
|
|
96
|
+
const accessBase = rt.config?.accessApiBase || rt.config?.apiBase;
|
|
97
97
|
const downloadUrl = resolveOasnAccessUrl(accessBase, contentUrl);
|
|
98
98
|
|
|
99
99
|
logger.info(
|
|
@@ -349,7 +349,7 @@ export function createCallRemoteAgentTool(): ToolDescriptor {
|
|
|
349
349
|
// 在 visible_result.webui_continuation 里返回可继续交互的入口。
|
|
350
350
|
if (result.webuiContinuation?.launchUrl) {
|
|
351
351
|
const rawLink = result.webuiContinuation.launchUrl;
|
|
352
|
-
const accessBase = rt.config?.accessApiBase;
|
|
352
|
+
const accessBase = rt.config?.accessApiBase || rt.config?.apiBase;
|
|
353
353
|
const link = resolveOasnAccessUrl(accessBase, rawLink);
|
|
354
354
|
const label = result.webuiContinuation.displayName || 'Open WebUI';
|
|
355
355
|
content = content.trim()
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
// ── OpenAgent Theme Adapter ──
|
|
2
|
+
//
|
|
3
|
+
// 运行时检测 OpenClaw Control UI 主题系统(v4.x vscode tokens / v5.x glassmorphism),
|
|
4
|
+
// 注入 --oa-* CSS 变量供 styles.js 中的 var() fallback 消费。
|
|
5
|
+
//
|
|
6
|
+
// 必须早于 styles.js 加载(由 build.cjs MANIFEST 顺序保证)。
|
|
7
|
+
|
|
8
|
+
(function _clInitThemeAdapter() {
|
|
9
|
+
if (window.__openagentThemeAdapterInstalled) return;
|
|
10
|
+
window.__openagentThemeAdapterInstalled = true;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* 检测当前 OC 主题系统类型。
|
|
14
|
+
* @returns {{ hasGlass: boolean, hasVscode: boolean, isDark: boolean }}
|
|
15
|
+
*/
|
|
16
|
+
function detectThemeSystem() {
|
|
17
|
+
var cs = getComputedStyle(document.documentElement);
|
|
18
|
+
var hasGlass = !!(cs.getPropertyValue('--glass-surface').trim());
|
|
19
|
+
var hasKn = !!(cs.getPropertyValue('--kn-bg-primary').trim());
|
|
20
|
+
var hasVscode = !!(cs.getPropertyValue('--vscode-editor-background').trim());
|
|
21
|
+
|
|
22
|
+
// 多策略暗色检测:v4 data-theme-mode / v5 data-theme / prefers-color-scheme
|
|
23
|
+
var themeMode = document.documentElement.getAttribute('data-theme-mode') // v4.x
|
|
24
|
+
|| document.documentElement.getAttribute('data-theme') // v5.x
|
|
25
|
+
|| '';
|
|
26
|
+
var isDark = themeMode.indexOf('dark') >= 0
|
|
27
|
+
|| window.matchMedia('(prefers-color-scheme: dark)').matches;
|
|
28
|
+
|
|
29
|
+
return {
|
|
30
|
+
hasGlass: hasGlass || hasKn,
|
|
31
|
+
hasVscode: hasVscode,
|
|
32
|
+
isDark: isDark
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* 注入 --oa-* CSS 变量到 :root。
|
|
38
|
+
* styles.js 中的 var(--oa-xxx, fallback) 会优先取这些值。
|
|
39
|
+
*/
|
|
40
|
+
function setupThemeVariables() {
|
|
41
|
+
var system = detectThemeSystem();
|
|
42
|
+
var root = document.documentElement;
|
|
43
|
+
|
|
44
|
+
if (system.hasGlass) {
|
|
45
|
+
// v5.x Glassmorphism: 使用 --glass-* / --kn-* token 族
|
|
46
|
+
root.style.setProperty('--oa-panel-bg', 'var(--glass-surface, var(--card))');
|
|
47
|
+
root.style.setProperty('--oa-panel-text', 'var(--kn-text-primary, var(--text, #e0e0e0))');
|
|
48
|
+
root.style.setProperty('--oa-card-bg', 'var(--glass-card, var(--card, #f5f5f5))');
|
|
49
|
+
root.style.setProperty('--oa-card-hover-bg', 'var(--glass-card-hover, var(--card-hover))');
|
|
50
|
+
root.style.setProperty('--oa-border', 'var(--glass-border, var(--border, #e5e5e5))');
|
|
51
|
+
root.style.setProperty('--oa-shadow-color', 'rgba(0, 0, 0, 0.08)');
|
|
52
|
+
root.style.setProperty('--oa-divider', 'var(--glass-divider, var(--border, #eee))');
|
|
53
|
+
root.style.setProperty('--oa-muted-text', 'var(--kn-text-secondary, var(--text-secondary, #999))');
|
|
54
|
+
} else if (system.hasVscode) {
|
|
55
|
+
// v4.x VSCode tokens: 使用 --vscode-* 变量
|
|
56
|
+
root.style.setProperty('--oa-panel-bg', 'var(--vscode-editor-background, #fff)');
|
|
57
|
+
root.style.setProperty('--oa-panel-text', 'var(--vscode-editor-foreground, #2F2F33)');
|
|
58
|
+
root.style.setProperty('--oa-card-bg', 'var(--vscode-sideBar-background, #f5f5f5)');
|
|
59
|
+
root.style.setProperty('--oa-card-hover-bg', 'var(--vscode-list-hoverBackground, #f0f0f0)');
|
|
60
|
+
root.style.setProperty('--oa-border', 'var(--vscode-panel-border, #e5e5e5)');
|
|
61
|
+
root.style.setProperty('--oa-shadow-color', 'rgba(0, 0, 0, 0.10)');
|
|
62
|
+
root.style.setProperty('--oa-divider', 'var(--vscode-sideBar-border, #eee)');
|
|
63
|
+
root.style.setProperty('--oa-muted-text', 'var(--vscode-descriptionForeground, #999)');
|
|
64
|
+
}
|
|
65
|
+
// 无特征 → 不注入变量,styles.js 中的 var() 会 fallback 到硬编码值
|
|
66
|
+
|
|
67
|
+
// 注入暗色 class 标记供 styles.js 选择器使用
|
|
68
|
+
if (system.isDark) {
|
|
69
|
+
root.style.setProperty('--oa-is-dark', '1');
|
|
70
|
+
} else {
|
|
71
|
+
root.style.setProperty('--oa-is-dark', '0');
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// 立即执行 + 监听主题变更(v5.x 可能运行时切换主题)
|
|
76
|
+
setupThemeVariables();
|
|
77
|
+
|
|
78
|
+
// 监听 data-theme / data-theme-mode 属性变更
|
|
79
|
+
var themeObserver = new MutationObserver(function () {
|
|
80
|
+
setupThemeVariables();
|
|
81
|
+
});
|
|
82
|
+
themeObserver.observe(document.documentElement, {
|
|
83
|
+
attributes: true,
|
|
84
|
+
attributeFilter: ['data-theme', 'data-theme-mode', 'class']
|
|
85
|
+
});
|
|
86
|
+
})();
|