diff --git a/com.streamdock.ai-monitor.sdPlugin/manifest.json b/com.streamdock.ai-monitor.sdPlugin/manifest.json index eed5056..ef17825 100644 --- a/com.streamdock.ai-monitor.sdPlugin/manifest.json +++ b/com.streamdock.ai-monitor.sdPlugin/manifest.json @@ -2,13 +2,22 @@ "Actions": [ { "UUID": "com.streamdock.ai-monitor.codex", - "Icon": "static/img/codex-icon.svg", + "Icon": "static/img/codex.png", "Name": "Codex Desktop", "States": [ - { "Image": "static/img/codex-icon.svg", "TitleAlignment": "center", "FontSize": "11" } + { + "Image": "static/img/codex.png", + "TitleAlignment": "center", + "FontSize": "11" + } + ], + "Settings": { + "pollInterval": 1000 + }, + "Controllers": [ + "Keypad", + "Information" ], - "Settings": { "pollInterval": 1000 }, - "Controllers": ["Keypad", "Information"], "UserTitleEnabled": true, "SupportedInMultiActions": true, "Tooltip": "Codex Desktop 工作流状态监控", @@ -16,13 +25,22 @@ }, { "UUID": "com.streamdock.ai-monitor.claude", - "Icon": "static/img/claude-icon.svg", + "Icon": "static/img/claude.png", "Name": "Claude Desktop", "States": [ - { "Image": "static/img/claude-icon.svg", "TitleAlignment": "center", "FontSize": "11" } + { + "Image": "static/img/claude.png", + "TitleAlignment": "center", + "FontSize": "11" + } + ], + "Settings": { + "pollInterval": 1000 + }, + "Controllers": [ + "Keypad", + "Information" ], - "Settings": { "pollInterval": 1000 }, - "Controllers": ["Keypad", "Information"], "UserTitleEnabled": true, "SupportedInMultiActions": true, "Tooltip": "Claude Desktop 工作流状态监控", @@ -30,13 +48,22 @@ }, { "UUID": "com.streamdock.ai-monitor.opencode", - "Icon": "static/img/opencode-icon.svg", + "Icon": "static/img/opencode.png", "Name": "opencode", "States": [ - { "Image": "static/img/opencode-icon.svg", "TitleAlignment": "center", "FontSize": "11" } + { + "Image": "static/img/opencode.png", + "TitleAlignment": "center", + "FontSize": "11" + } + ], + "Settings": { + "pollInterval": 1000 + }, + "Controllers": [ + "Keypad", + "Information" ], - "Settings": { "pollInterval": 1000 }, - "Controllers": ["Keypad", "Information"], "UserTitleEnabled": true, "SupportedInMultiActions": true, "Tooltip": "opencode 工作流状态监控", @@ -46,18 +73,28 @@ "SDKVersion": 1, "Author": "StreamDock", "Name": "AI Monitor", - "Icon": "static/img/codex-icon.svg", + "Icon": "static/img/ai.png", "Category": "AI Monitor", - "CategoryIcon": "static/img/codex-icon.svg", + "CategoryIcon": "static/img/ai.png", "CodePathWin": "plugin/index.js", "CodePathMac": "plugin/index.js", "Description": "监控 Codex / Claude / opencode AI 工作流状态", "Version": "2.0.0", "URL": "http://10.10.10.14:18003/v6ole/streamdock-ai-monitor", "OS": [ - { "Platform": "windows", "MinimumVersion": "7" }, - { "Platform": "mac", "MinimumVersion": "10.11" } + { + "Platform": "windows", + "MinimumVersion": "7" + }, + { + "Platform": "mac", + "MinimumVersion": "10.11" + } ], - "Software": { "MinimumVersion": "3.10.188.226" }, - "Nodejs": { "Version": "20" } + "Software": { + "MinimumVersion": "3.10.188.226" + }, + "Nodejs": { + "Version": "20" + } } \ No newline at end of file diff --git a/com.streamdock.ai-monitor.sdPlugin/plugin/index.js b/com.streamdock.ai-monitor.sdPlugin/plugin/index.js index e152f2e..a111226 100644 --- a/com.streamdock.ai-monitor.sdPlugin/plugin/index.js +++ b/com.streamdock.ai-monitor.sdPlugin/plugin/index.js @@ -13,7 +13,7 @@ var AGENTS = { codex: { label: 'Codex', scanDir: path.join(HOME, '.codex', 'sessions'), - logoFile: 'codex-icon.svg', + logoFile: 'codex.png', normalize: function(obj) { var t = obj.type || '', pt = (obj.payload || {}).type || '', it = ((obj.payload || {}).item || {}).type || ''; if (t === 'event_msg') { @@ -40,7 +40,7 @@ var AGENTS = { claude: { label: 'Claude', scanDir: path.join(HOME, '.claude', 'projects'), - logoFile: 'claude-icon.svg', + logoFile: 'claude.png', normalize: function(obj) { var t = obj.type || ''; if (t === 'user') return 'prompt'; @@ -61,7 +61,7 @@ var AGENTS = { opencode: { label: 'opencode', scanDir: path.join(HOME, '.opencode', 'sessions'), - logoFile: 'opencode-icon.svg', + logoFile: 'opencode.png', normalize: function(obj) { var t = obj.type || ''; if (t === 'user') return 'prompt'; @@ -75,13 +75,6 @@ var AGENTS = { } }; -// Load logos as data URIs -var LOGOS = {}; -function loadLogo(filename) { - try { return 'data:image/svg+xml;charset=utf-8,' + encodeURIComponent(fs.readFileSync(path.join(__dirname, '..', 'static', 'img', filename), 'utf-8')); } - catch (_) { return ''; } -} -Object.keys(AGENTS).forEach(function(k) { LOGOS[k] = loadLogo(AGENTS[k].logoFile); }); // Shared display machinery var STATUS = { @@ -100,15 +93,26 @@ function makeSvg(fill, label, blink, breathe) { var anim = ''; if (blink) anim = ''; else if (breathe) anim = ''; - return '' + anim + '' + label + ''; + return '' + anim + '' + label + ''; } function setDisplay(ctx, state) { var d = STATUS[state] || STATUS['idle']; var ss = states[ctx]; - plugin.setTitle(ctx, d.title); - if (state === 'idle' && ss && ss.logoUri) { plugin.setTitle(ctx, ''); plugin.setImage(ctx, ss.logoUri); } - else plugin.setImage(ctx, 'data:image/svg+xml;charset=utf-8,' + makeSvg(d.fill, d.title, d.blink, d.breathe)); + if (state === 'idle' && ss && ss.agent) { + // Use relative PNG path for idle + plugin.setTitle(ctx, ''); + plugin.setImage(ctx, 'static/img/' + ss.agent.logoFile); + } else { + plugin.setTitle(ctx, d.title); + var svg = ''; + var anim = ''; + if (d.blink) anim = ''; + else if (d.breathe) anim = ''; + svg += '' + anim + ''; + svg += '' + d.title + ''; + plugin.setImage(ctx, 'data:image/svg+xml;charset=utf-8,' + svg); + } } function setState(ctx, state) { @@ -174,8 +178,7 @@ function makeActionFn(agentKey) { default: { pollInterval: POLL_INTERVAL }, _willAppear: function(data) { var ctx = data.context; - var logoUri = LOGOS[agentKey] || ''; - states[ctx] = { agent: agent, currentState: 'idle', lastActivity: Date.now(), offsets: {}, timer: null, logoUri: logoUri }; + states[ctx] = { agent: agent, currentState: 'idle', lastActivity: Date.now(), offsets: {}, timer: null }; setDisplay(ctx, 'idle'); poll(ctx); states[ctx].timer = setInterval(function() { poll(ctx); }, POLL_INTERVAL); diff --git a/com.streamdock.ai-monitor.sdPlugin/static/img/ai.png b/com.streamdock.ai-monitor.sdPlugin/static/img/ai.png new file mode 100644 index 0000000..0a530e8 Binary files /dev/null and b/com.streamdock.ai-monitor.sdPlugin/static/img/ai.png differ diff --git a/com.streamdock.ai-monitor.sdPlugin/static/img/claude.png b/com.streamdock.ai-monitor.sdPlugin/static/img/claude.png new file mode 100644 index 0000000..690ea14 Binary files /dev/null and b/com.streamdock.ai-monitor.sdPlugin/static/img/claude.png differ diff --git a/com.streamdock.ai-monitor.sdPlugin/static/img/codex.png b/com.streamdock.ai-monitor.sdPlugin/static/img/codex.png new file mode 100644 index 0000000..7e4ddb8 Binary files /dev/null and b/com.streamdock.ai-monitor.sdPlugin/static/img/codex.png differ diff --git a/com.streamdock.ai-monitor.sdPlugin/static/img/opencode.png b/com.streamdock.ai-monitor.sdPlugin/static/img/opencode.png new file mode 100644 index 0000000..fb62860 Binary files /dev/null and b/com.streamdock.ai-monitor.sdPlugin/static/img/opencode.png differ