tray

A desktop tray command that changes the badge count shown by the app's menu-bar or system-tray icon. The count represents how many agents are currently running.

In plain words
What is it for?
Use it when the running-agent count changes, to update the tray badge safely and keep displayed values within the supported range.
Why use it?
It gives users a quick status signal without opening the dashboard, while keeping a tray update failure from stopping the dashboard.

Command

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/netmindai-open/narranexus/tray
Clone the repo
git clone --depth 1 https://github.com/NetMindAI-Open/NarraNexus
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 387 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.00387
Opus 5 $0.00000 $0.00193
Sonnet 5 $0.00000 $0.00077
Haiku 4.5 $0.00000 $0.00039

Measured 3d ago against content hash fa774ba862c2, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

tray scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.mindflow/mirror/tauri/src-tauri/src/commands/tray.md · 25 lines

What it actually says

commands/tray.rs

为什么存在

Tauri IPC 命令 set_tray_badge(count)。前端 dashboard store 检测 running count 变化时 invoke;Rust 端更新 TrayIcon.set_title 让用户在桌面右上角/右下角一眼看到"有几个 agent 在跑"。

设计决策

  • std::sync::Mutex(不是 tokio):tray ops 是 sync,不跨 await。setup 闭包也是 sync。tokio Mutex 在此无意义
  • try_lock + best-effort:lock 争用时 skip 这次更新;tray 是 cosmetic,不能为更新等
  • clamp [0, 999] + "999+":macOS menubar 长数字撑破 layout(security M-4)。u32::MAX 不会 panic 是因为 Rust u32 + format! 天然安全
  • state.rs 持句柄AppState::tray_handle: Arc<StdMutex<Option<TrayIcon>>>lib.rs::setupcreate_tray() 返回值存入

Gotcha

  • 永远不要 unwrap() / panic;任何错误转成 log + Ok(())。tray 挂了 dashboard 不能挂
  • tray_handle 为 None(setup 时 tray 未成功创建),silently skip
  • 注册处:lib.rs::invoke_handler!commands::tray::set_tray_badge

测试

cargo test commands::tray::tests —— 5 个 clamp 单测(0 / 1 / 999 / 1000 / u32::MAX)

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 25 lines · 0 tokens per session scan A fa774ba862c2

Subscribe to this mod's changes

tray is a command published in the GitHub repository NetMindAI-Open/NarraNexus (84 stars, last pushed 9d ago), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 387 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.