Skip to main content
ErisPulse GovReport

ErisPulse GovReport

治理观测模块 —— 命令执行、事件拦截与配额消耗的统计报表。

基于 ErisPulse 2.9 命令治理与生命周期事件的观测模块,使用内置 ORM 持久化记录,报表经 Takumi 渲染为卡片。

PyPI Python License Stars Downloads ErisPulse

简体中文 | English


简介

GovReport 是基于 ErisPulse 架构开发的治理观测模块:

  • 采集 command.executed 命令执行记录(成功/失败/废弃)
  • 采集 adapter.event.blocked(中间件否决)与 scope.blocked(作用域拦截)记录
  • 读取 usage_limit 配额计数(erispulse.usage 存储键),对照声明上限展示消耗
  • 枚举全部命令的治理声明(cooldown / rate_limit / usage_limit / deprecated)
  • 记录用内置 ORM(Model / Field)持久化,按保留天数自动清理
  • 报表经 Takumi 渲染为图片卡片,不可用时降级文本

要求 ErisPulse >= 2.9.0。


效果展示

/gov stats /gov blocked
stats blocked
/gov usage /gov list
usage list


安装

epsdk install ErisPulse-GovReport

命令

命令 说明
/gov 显示用法
/gov stats [窗口] 命令执行统计(调用 Top / 成功率 / 废弃使用),窗口如 24h、7d,默认 24h
/gov user <用户ID> [窗口] 单用户调用统计
/gov blocked [窗口] 拦截统计(中间件否决 / 作用域拦截)
/gov usage 配额消耗报表(used/limit + 周期 + 作用域)
/gov list [命令] 治理声明清单(可按命令名过滤)
/gov purge <天数> 清理指定天数之前的记录

全部命令需要框架主人权限。


使用示例

# 给命令声明治理规则(本模块负责观测这些规则的运行效果)
[ErisPulse.event.command]
prefix = "/"

# Python 侧
# @command("translate", usage_limit="100/day", usage_limit_key="user")
from ErisPulse.Core.Event import command

@command("translate", cooldown="30s", rate_limit="5/minute",
         usage_limit="100/day", usage_limit_key="user", help="翻译")
async def translate_handler(event):
    await event.reply("结果")

@command("oldcmd", deprecated="请用 /translate", deprecated_reject=True)
async def old_handler(event):
    ...

配置说明

[GovReport]
enabled = true                  # 是否启用模块
collect_command_calls = true    # 采集命令执行记录
collect_blocked = true          # 采集拦截记录
retention_days = 30             # 记录保留天数(0 永久保留)
top_n = 10                      # 报表单次展示条目数
render_card = true              # 报表用 Takumi 渲染为卡片
theme = "doodle"                  # 卡片风格 (doodle/editorial)
配置项 类型 默认值 说明
enabled bool true 是否启用模块
collect_command_calls bool true 采集 command.executed
collect_blocked bool true 采集中间件否决与作用域拦截
retention_days int 30 保留天数(0 永久,启动与每日清理)
top_n int 10 报表单次展示条目数
render_card bool true 报表渲染为图片卡片
theme str doodle 卡片风格 (doodle/editorial)

注意事项

  1. 配额消耗读取自治理系统的存储键(erispulse.usage),重启不丢
  2. 冷却/限流命中默认静默,不在采集范围内(可用 ErisPulse-Testing 的 DispatchTrace 排查单条命令)
  3. 记录写入框架存储后端(SQLite / MySQL / PostgreSQL 由存储配置决定)

参考链接

Metadata

Release files for ErisPulse-GovReport 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ErisPulse-GovReport 0.1.1
File Size Uploaded Provenance Actions
erispulse_govreport-0.1.1.tar.gz 20.8 kB With provenance Details for erispulse_govreport-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ErisPulse-GovReport 0.1.1
File Interpreter ABI Platform Actions
erispulse_govreport-0.1.1-py3-none-any.whl Python 3 none any Details for erispulse_govreport-0.1.1-py3-none-any.whl

Total release size: 39.6 kB

Release files / erispulse_govreport-0.1.1.tar.gz

Download URL erispulse_govreport-0.1.1.tar.gz
Size 20.8 kB
Tags Source
SHA-256 checksum
How to use checksums
8aaee822801d8e389f703ded760f5fc2cf0fe29bfd2341d60a536e17545ad7c1
BLAKE2b-256 checksum
How to use checksums
c595b2523b9c77e9e57da0be5cae20db208e43ae2bc857c4802a69a103fc71a6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.

Transparency log

Release files / erispulse_govreport-0.1.1-py3-none-any.whl

Download URL erispulse_govreport-0.1.1-py3-none-any.whl
Size 18.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0d572a2584843e2e4dbc7f0693de2c0bfd20dba60fb80914c6397c9176e486bb
BLAKE2b-256 checksum
How to use checksums
4905e5d9273dedd6466e0bc44f8fbf12ee03f7785fc1bab26e8738d929897b61
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.

Transparency log

Security for ErisPulse-GovReport 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for erispulse_govreport-0.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page