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.
git clone --depth 1 https://github.com/NetMindAI-Open/NarraNexusWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/commands/netmindai-open/narranexus/office_watch_scheme.rs)<a href="https://agentmods.dev/commands/netmindai-open/narranexus/office_watch_scheme.rs"><img src="https://agentmods.dev/badge/commands/netmindai-open/narranexus/office_watch_scheme.rs.svg" alt="Measured on agentmods" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00000 | $0.01221 |
| Opus 5 | $0.00000 | $0.00611 |
| Sonnet 5 | $0.00000 | $0.00244 |
| Haiku 4.5 | $0.00000 | $0.00122 |
Grade A, and why
office_watch_scheme.rs 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 8d 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.
How it starts
The opening of the file, as written. The whole thing — 61 lines — stays where its author put it; the contents beside it link to each section on GitHub.
office_watch_scheme.rs — officewatch:// 自定义协议(桌面实时预览)
为什么存在
桌面(dmg)实时 Office 预览要在 iframe 里加载 officecli-watch 页面。webview origin 是
https://tauri.localhost,后端在 http://localhost:8000 → WKWebView 把这个 http iframe 当
active mixed content 静默拦掉(和 artifact 同一个 P0)。
静态 artifact 用 base64 blob 绕过(见 artifact_fetch.rs),但 blob 是静态快照;watch 页面
要拉自己的子资源(assets/字体/katex)还有一个 SSE 端点,blob 一个都带不了。
所以这里换自定义协议:custom scheme 不算混合内容,webview 会加载;页面自己的根相对子请求
经后端注入的 <base> 解析回 officewatch:// 也落到这里,于是每个资源都由 Rust 代理。Rust 自己
发起的 HTTP 不受 WKWebView 约束。
关键设计
- 不能流式 SSE:Tauri 自定义协议的 responder 只应答一次、
respond消费 self,撑不住 SSE 长连 (实测 Windows 不支持、macOS 实验性)。所以对页面的/events请求直接返回空(桌面无 SSE 推送),实时更新改由前端OfficeWatchViewer的 mtime 轮询 → 重载 iframe 驱动(watch 首页 GET 永远渲染当前文档)。这是"稳妥版"取舍:每次内容变化刷新一次(轮询节奏),非逐帧丝滑。 - URL 映射:
officewatch://localhost/api/public/office-watch-proxy/{token}/{port}/...1:1 映到http://localhost:8000/api/public/office-watch-proxy/...。取uri.path()+query拼到 BACKEND。 - SSRF 护栏(两段):
path后面会原样拼进format!("{BACKEND}{path}"),所以先做两道检查再放行。 ①先拒..点段(path.split('/').any(|seg| seg == ".."))——若某平台 webview 不为自定义 scheme 归一化点段,/api/public/office-watch-proxy/../../secret可能通过前缀检查却落到任意后端路由;按 段切分只拦..段、不误伤合法含点文件名。②再查前缀:只代理/api/public/office-watch-proxy/,其它一律 403。token 即鉴权(后端open铸,放在路径里),和浏览器 完全一致;只打 loopback :8000。 - CORS:iframe 用
sandbox="allow-scripts"(不透明源),它对officewatch://的请求是跨源 → 和浏览器代理一样加Access-Control-Allow-Origin: *(auth 是路径里的 token,不是 cookie)。
上下游
- 注册在:
lib.rs::run()的.register_asynchronous_uri_scheme_protocol("officewatch", ...)(spawn 到 async runtime 里跑handle,再responder.respond)。 - 被谁用:
frontend/.../OfficeWatchViewer.tsx——isTauri()时把后端 http open URL 转成officewatch://localhost前缀(toDesktopScheme)当 iframe src。 - 依赖:
reqwest 0.12(loopback http,无 TLS,和 artifact_fetch 同款);tauri::http。
Gotcha
- 只 macOS:NarraNexus 桌面只发 macOS(
targets: ["dmg","app"],CI 只 build-macos),所以 custom-scheme 的跨平台流式限制不影响我们;但也因此这条路只在 WKWebView 里能验,改完必须tauri dev/ dmg 肉眼确认。 - 后端端口硬编 8000:和
artifact_fetch.rs/port_preflight.rs一样。后端若改动态端口,三处 一起改。 - 桌面无 SSE →
OfficeWatchViewer里lastContentSseAt恒为 0 → 每次 mtime 前进都会重载(这正是 桌面期望的行为,不是 bug)。 build()不允许 panic:异步 scheme handler 里若Response::builder().body()返回Err(上游 Content-Type 带非法头字节),旧代码.expect()会 panic;tokio 会静默吞掉该 task →responder.respond永不调用 → webview 无超时地挂起、无可见错误。现在唯一由调用方控制的头 (Content-Type)先用HeaderValue::from_str预校验,失败退回application/octet-stream,其余头是 静态常量、status 恒为合法 u16 → builder 必成功,.expect永不触发。
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.
- 8d ago First seen · 61 lines · 0 tokens per session scan A 60d7fa0cf4fe
office_watch_scheme.rs is a command published in the GitHub repository NetMindAI-Open/NarraNexus (86 stars, last pushed today), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 1,221 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.
Other commands, from other repositories
ui-flow-review
Review menus, HUD, navigation, and player flow from a UX perspective.
responsive-design-specialist
Use when a layout breaks between sizes. Arbitrary breakpoints, type that does not scale, images that blow out the grid, or a desktop design retrofitted onto mobile.
design-form
Design a form with the fewest fields that works, clear labels, and errors that help.
frontend-3d
You are an expert in 3D web development using Three.js, React Three Fiber, WebGL, and WebGPU. You create immersive 3D experiences for the web.
frontend-design
Read and follow the instructions in agents/frontend-design/design-all.md. Also read all referenced files in agents/frontend-design/reference/ as needed for the task.
get-component-source
The full TSX source of a component (append " demo" for its usage example).