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.
npx agentmods add rules/loonghao/auroraview/07-event-systemgit clone --depth 1 https://github.com/loonghao/auroraviewWrote 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/rules/loonghao/auroraview/07-event-system)<a href="https://agentmods.dev/rules/loonghao/auroraview/07-event-system"><img src="https://agentmods.dev/badge/rules/loonghao/auroraview/07-event-system.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 | $0.00787 | $0.00787 |
| Opus 5 | $0.00394 | $0.00394 |
| Sonnet 5 | $0.00157 | $0.00157 |
| Haiku 4.5 | $0.00079 | $0.00079 |
Grade A, and why
07-event-system 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 5d 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 — 77 lines — stays where its author put it; the contents beside it link to each section on GitHub.
事件分发机制(Python → JavaScript)
关键设计决策(2025-01):统一使用 window.auroraview.trigger() 进行事件分发
-
Rust 层实现:
- 所有
WebViewMessage::EmitEvent处理统一使用window.auroraview.trigger(event, data) - 替代原有的
window.dispatchEvent(new CustomEvent(...)) - 涉及文件:
src/webview/backend/native.rssrc/webview/event_loop.rs(两处)src/webview/webview_inner.rssrc/webview/backend/mod.rssrc/webview/backend/custom.rs
- 所有
-
标准模式:
(function() { if (window.auroraview && window.auroraview.trigger) { window.auroraview.trigger('event_name', data); } else { console.error('[AuroraView] Event bridge not ready, cannot emit event: event_name'); } })(); -
前端接收:
- 使用
window.auroraview.on(event, handler)订阅事件 - 与 Rust 层的
trigger()完全匹配 - 形成完整的事件流:
Python emit()→Rust trigger()→JS on()
- 使用
-
架构优势:
- API 一致性:统一使用 AuroraView 事件系统,不混用浏览器原生 API
- 错误处理:事件桥接未就绪时有明确错误提示
- 可维护性:所有事件分发逻辑集中在
window.auroraview命名空间
最小端到端示例(当前实现)
注意:当前实现中,
auroraview.call()在桥接层还是 fire-and-forget,Promise 会立即 resolve 为undefined; 最推荐的模式是:前端通过auroraview.api.*触发 Python 逻辑,Python 再通过emit向前端推事件。
-
前端(JS):
// 等待 bridge 就绪 window.addEventListener('auroraviewready', () => { // 订阅来自 Python 的 echo 结果 auroraview.on('echo_result', (payload) => { console.log('[AuroraView] echo_result from Python:', payload); }); // 通过 api 调用 Python 方法(fire-and-forget) auroraview.api.echo({ message: 'hello from JS' }); }); -
Python(概念示例,基于 AuroraView 基类):
from auroraview import AuroraView class MyTool(AuroraView): def __init__(self, **kwargs): super().__init__(api=self, **kwargs) # JS 侧调用:auroraview.api.echo({ message: "..." }) def echo(self, message: str) -> None: # 当前实现:通过事件把结果推回前端 self.emit("echo_result", {"message": message})
后续在 call 的 request/response 协议补全后,可以把 echo 设计为真正返回值的函数,
前端直接使用 await auroraview.api.echo("hello") 获取结果。
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.
- 5d ago First seen · 77 lines · 787 tokens per session scan A 3344b1d483db
07-event-system is a cursor rule published in the GitHub repository loonghao/auroraview (44 stars, last pushed 1mo ago), licensed MIT. It adds 787 tokens to every session, about $0.0039 per session on Opus 5. 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 cursor rules, from other repositories
ponytail
Ponytail, lazy senior dev mode. Always pick the simplest solution that works.
angular-20
This rule provides comprehensive best practices and coding standards for Angular development, focusing on modern TypeScript, standalone components, signals, and performance optimizations.
dev-standard
Apache Superset development standards and guidelines for Cursor IDE.
cli-error-handling
CLI command error handling patterns.
prefer-assertions-over-defensive-checks
Prefer assertions over defensive checks when data is guaranteed to be valid.
prefer-direct-imports-over-module-mocks
Prefer extracting a testable core over vi.mock / vi.resetModules when unit tests need to reach production logic entangled with config, env, or singletons.