ops-onehit 1.0.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ops_onehit/__init__.py +73 -0
- ops_onehit/__main__.py +19 -0
- ops_onehit/admin/__init__.py +27 -0
- ops_onehit/admin/cli.py +631 -0
- ops_onehit/admin/service.py +1103 -0
- ops_onehit/agent/__init__.py +34 -0
- ops_onehit/agent/react.py +392 -0
- ops_onehit/agent/tools.py +1031 -0
- ops_onehit/agent_server/__init__.py +17 -0
- ops_onehit/agent_server/cert_authority.py +130 -0
- ops_onehit/agent_server/router.py +512 -0
- ops_onehit/agents/__init__.py +8 -0
- ops_onehit/alerts/__init__.py +33 -0
- ops_onehit/alerts/action_scenarios.py +264 -0
- ops_onehit/alerts/confidence.py +314 -0
- ops_onehit/alerts/correlator.py +420 -0
- ops_onehit/alerts/episodic.py +450 -0
- ops_onehit/alerts/manager.py +327 -0
- ops_onehit/alerts/prompts/__init__.py +1 -0
- ops_onehit/alerts/prompts/rca_prompt.txt +53 -0
- ops_onehit/alerts/rca_context.py +695 -0
- ops_onehit/alerts/rca_engine.py +738 -0
- ops_onehit/alerts/rca_runner.py +295 -0
- ops_onehit/alerts/rules.py +294 -0
- ops_onehit/api/__init__.py +25 -0
- ops_onehit/api/admin.py +563 -0
- ops_onehit/api/auth.py +381 -0
- ops_onehit/api/auth_jwt.py +1104 -0
- ops_onehit/api/auth_saml.py +420 -0
- ops_onehit/api/dashboard.py +1102 -0
- ops_onehit/api/dashboard_auth.py +114 -0
- ops_onehit/api/errors.py +273 -0
- ops_onehit/api/finops_api.py +527 -0
- ops_onehit/api/ha.py +105 -0
- ops_onehit/api/incidents.py +744 -0
- ops_onehit/api/onboarding.py +286 -0
- ops_onehit/api/orgs.py +604 -0
- ops_onehit/api/reports.py +251 -0
- ops_onehit/api/runbooks.py +458 -0
- ops_onehit/api/server.py +3366 -0
- ops_onehit/api/static/dashboard/assets/AccuracyView-Cq-v-7B3.js +1 -0
- ops_onehit/api/static/dashboard/assets/AccuracyView-DY5ZPOEk.css +1 -0
- ops_onehit/api/static/dashboard/assets/AdminDashboardView-CzxheHhV.js +1 -0
- ops_onehit/api/static/dashboard/assets/AuditLogView-CswiKa9N.js +1 -0
- ops_onehit/api/static/dashboard/assets/ChartWrapper.vue_vue_type_script_setup_true_lang-Ct88f_mA.js +1 -0
- ops_onehit/api/static/dashboard/assets/CmdbView-6KQla_P_.js +1 -0
- ops_onehit/api/static/dashboard/assets/DataTable.vue_vue_type_script_setup_true_lang-C-atII5O.js +1 -0
- ops_onehit/api/static/dashboard/assets/FinopsView-Dz8CJBFY.js +1 -0
- ops_onehit/api/static/dashboard/assets/FinopsView-UyVl5PSP.css +1 -0
- ops_onehit/api/static/dashboard/assets/HomeView-yiz7G0ww.js +1 -0
- ops_onehit/api/static/dashboard/assets/KgTopology.vue_vue_type_script_setup_true_lang-Bgwljw2K.js +1 -0
- ops_onehit/api/static/dashboard/assets/KpiCard.vue_vue_type_script_setup_true_lang-B01Dt3B8.js +1 -0
- ops_onehit/api/static/dashboard/assets/LoginView-hAH_DSbQ.js +1 -0
- ops_onehit/api/static/dashboard/assets/NotFoundView-Dqq68OQD.js +1 -0
- ops_onehit/api/static/dashboard/assets/NotificationPrefsView-JORVuOzq.js +1 -0
- ops_onehit/api/static/dashboard/assets/NotificationsView-BXNkNoja.js +1 -0
- ops_onehit/api/static/dashboard/assets/OrgDetailView-Cpm7dIAZ.js +1 -0
- ops_onehit/api/static/dashboard/assets/OrgListView-BxvPlMl8.js +1 -0
- ops_onehit/api/static/dashboard/assets/OverviewView-BCtyx16y.js +1 -0
- ops_onehit/api/static/dashboard/assets/RoleManagerView-DnKfFGf0.js +1 -0
- ops_onehit/api/static/dashboard/assets/RunbookEditorView-CSqbeTUQ.js +1 -0
- ops_onehit/api/static/dashboard/assets/RunbookListView-BiaNFgD4.js +1 -0
- ops_onehit/api/static/dashboard/assets/TokenManagerView-4fDztipO.js +1 -0
- ops_onehit/api/static/dashboard/assets/UserDetailView-BCZqTLiO.js +1 -0
- ops_onehit/api/static/dashboard/assets/UserListView-C_SMNvHn.js +1 -0
- ops_onehit/api/static/dashboard/assets/_plugin-vue_export-helper-DlAUqK2U.js +1 -0
- ops_onehit/api/static/dashboard/assets/admin-DEttt-Ui.js +1 -0
- ops_onehit/api/static/dashboard/assets/chart-B1X4VPrN.js +18 -0
- ops_onehit/api/static/dashboard/assets/cytoscape-C5JX3QLV.js +331 -0
- ops_onehit/api/static/dashboard/assets/datatables-l0sNRNKZ.js +1 -0
- ops_onehit/api/static/dashboard/assets/index-Cao5u-jj.css +1 -0
- ops_onehit/api/static/dashboard/assets/index-PCCFbuay.js +28 -0
- ops_onehit/api/static/dashboard/assets/labels-jzRZhRwT.js +1 -0
- ops_onehit/api/static/dashboard/assets/notifications-C2mAOFH1.js +1 -0
- ops_onehit/api/static/dashboard/assets/runbooks-B5M6vXeS.js +1 -0
- ops_onehit/api/static/dashboard/assets/useFocusTrap-Cmy-5_l5.js +1 -0
- ops_onehit/api/static/dashboard/assets/vue-C5ZAxC57.js +30 -0
- ops_onehit/api/static/dashboard/index.html +15 -0
- ops_onehit/api/static/index.html +232 -0
- ops_onehit/api/static/onboarding/index.html +445 -0
- ops_onehit/api/websocket.py +190 -0
- ops_onehit/auth/__init__.py +12 -0
- ops_onehit/auth/saml/__init__.py +170 -0
- ops_onehit/auth/saml/metadata.py +252 -0
- ops_onehit/auth/saml/provider.py +406 -0
- ops_onehit/auth/saml/request.py +471 -0
- ops_onehit/auth/saml/response.py +585 -0
- ops_onehit/auth/saml/settings.py +570 -0
- ops_onehit/backup/__init__.py +92 -0
- ops_onehit/backup/archive.py +458 -0
- ops_onehit/backup/cli.py +216 -0
- ops_onehit/backup/core.py +554 -0
- ops_onehit/backup/crypto.py +228 -0
- ops_onehit/backup/scheduler.py +499 -0
- ops_onehit/billing/__init__.py +44 -0
- ops_onehit/billing/api.py +737 -0
- ops_onehit/billing/cli.py +374 -0
- ops_onehit/billing/dashboard.py +347 -0
- ops_onehit/billing/limits.py +648 -0
- ops_onehit/billing/middleware.py +242 -0
- ops_onehit/billing/plans.py +265 -0
- ops_onehit/billing/static/billing/index.html +294 -0
- ops_onehit/billing/store.py +732 -0
- ops_onehit/billing/stripe/__init__.py +94 -0
- ops_onehit/billing/stripe/checkout.py +303 -0
- ops_onehit/billing/stripe/client.py +295 -0
- ops_onehit/billing/stripe/endpoints.py +380 -0
- ops_onehit/billing/stripe/portal.py +129 -0
- ops_onehit/billing/stripe/proration.py +159 -0
- ops_onehit/billing/stripe/sync_plans.py +247 -0
- ops_onehit/billing/stripe/webhook.py +765 -0
- ops_onehit/cli.py +155 -0
- ops_onehit/cmdb/__init__.py +23 -0
- ops_onehit/cmdb/cli.py +532 -0
- ops_onehit/cmdb/discoverer/__init__.py +33 -0
- ops_onehit/cmdb/discoverer/aws.py +323 -0
- ops_onehit/cmdb/discoverer/base.py +207 -0
- ops_onehit/cmdb/discoverer/k8s.py +330 -0
- ops_onehit/cmdb/discoverer/vmware.py +422 -0
- ops_onehit/cmdb/drift.py +292 -0
- ops_onehit/cmdb/sync.py +248 -0
- ops_onehit/cmdb/topology.py +206 -0
- ops_onehit/core/__init__.py +7 -0
- ops_onehit/core/config.py +254 -0
- ops_onehit/data/__init__.py +27 -0
- ops_onehit/data/cli.py +203 -0
- ops_onehit/data/collector_runner.py +428 -0
- ops_onehit/data/collectors/__init__.py +60 -0
- ops_onehit/data/collectors/docker.py +282 -0
- ops_onehit/data/collectors/http_endpoint.py +366 -0
- ops_onehit/data/collectors/k8s.py +736 -0
- ops_onehit/data/collectors/k8s_cli.py +354 -0
- ops_onehit/data/collectors/prometheus.py +324 -0
- ops_onehit/data/collectors/system.py +448 -0
- ops_onehit/data/db.py +5187 -0
- ops_onehit/data/db_engine.py +491 -0
- ops_onehit/data/schema.py +1109 -0
- ops_onehit/data/tenant.py +132 -0
- ops_onehit/data/types.py +105 -0
- ops_onehit/deployment/__init__.py +22 -0
- ops_onehit/deployment/models.py +307 -0
- ops_onehit/detection/__init__.py +54 -0
- ops_onehit/detection/base.py +170 -0
- ops_onehit/detection/cli.py +360 -0
- ops_onehit/detection/engine.py +529 -0
- ops_onehit/detection/iforest.py +282 -0
- ops_onehit/detection/prophet.py +316 -0
- ops_onehit/discovery/__init__.py +59 -0
- ops_onehit/discovery/cli.py +331 -0
- ops_onehit/discovery/discoverer.py +599 -0
- ops_onehit/discovery/health.py +157 -0
- ops_onehit/discovery/inference_rules.py +497 -0
- ops_onehit/discovery/models.py +163 -0
- ops_onehit/discovery/scanners/__init__.py +21 -0
- ops_onehit/discovery/scanners/base.py +58 -0
- ops_onehit/discovery/scanners/container.py +277 -0
- ops_onehit/discovery/scanners/port.py +191 -0
- ops_onehit/discovery/scanners/process.py +222 -0
- ops_onehit/discovery/scheduler.py +144 -0
- ops_onehit/events/__init__.py +233 -0
- ops_onehit/finops/__init__.py +150 -0
- ops_onehit/finops/aggregator.py +241 -0
- ops_onehit/finops/alerter.py +357 -0
- ops_onehit/finops/aliyun.py +252 -0
- ops_onehit/finops/aws.py +239 -0
- ops_onehit/finops/azure.py +232 -0
- ops_onehit/finops/budget.py +366 -0
- ops_onehit/finops/cli.py +457 -0
- ops_onehit/finops/predictor.py +257 -0
- ops_onehit/finops/store.py +156 -0
- ops_onehit/ha/__init__.py +79 -0
- ops_onehit/ha/_redis.py +54 -0
- ops_onehit/ha/cli.py +353 -0
- ops_onehit/ha/health.py +366 -0
- ops_onehit/ha/leader.py +710 -0
- ops_onehit/ha/region_state.py +402 -0
- ops_onehit/incidents/__init__.py +76 -0
- ops_onehit/incidents/bus.py +137 -0
- ops_onehit/incidents/cli.py +659 -0
- ops_onehit/incidents/workflow.py +483 -0
- ops_onehit/kg/__init__.py +57 -0
- ops_onehit/kg/cli.py +494 -0
- ops_onehit/kg/infer.py +646 -0
- ops_onehit/kg/models.py +497 -0
- ops_onehit/kg/store.py +346 -0
- ops_onehit/learning/__init__.py +20 -0
- ops_onehit/learning/feedback.py +349 -0
- ops_onehit/llm/__init__.py +68 -0
- ops_onehit/llm/cloud_client.py +916 -0
- ops_onehit/llm/ollama_client.py +779 -0
- ops_onehit/llm/unified_client.py +399 -0
- ops_onehit/log_aggregator/__init__.py +463 -0
- ops_onehit/log_aggregator/anonymizer.py +184 -0
- ops_onehit/log_aggregator/buffer.py +193 -0
- ops_onehit/log_aggregator/cli.py +477 -0
- ops_onehit/log_aggregator/elk_config.py +346 -0
- ops_onehit/log_aggregator/loki_client.py +229 -0
- ops_onehit/log_aggregator/splunk_client.py +197 -0
- ops_onehit/main.py +2002 -0
- ops_onehit/multi_host_agent/__init__.py +34 -0
- ops_onehit/multi_host_agent/buffer.py +301 -0
- ops_onehit/multi_host_agent/certs/__init__.py +279 -0
- ops_onehit/multi_host_agent/cli.py +421 -0
- ops_onehit/multi_host_agent/config.py +226 -0
- ops_onehit/multi_host_agent/crypto.py +83 -0
- ops_onehit/multi_host_agent/db.py +92 -0
- ops_onehit/multi_host_agent/heartbeat.py +111 -0
- ops_onehit/multi_host_agent/runner.py +300 -0
- ops_onehit/multi_host_agent/uploader.py +206 -0
- ops_onehit/multimodal/__init__.py +54 -0
- ops_onehit/multimodal/processors.py +519 -0
- ops_onehit/multimodal/router.py +180 -0
- ops_onehit/multimodal/types.py +126 -0
- ops_onehit/multimodal/vlm_real.py +381 -0
- ops_onehit/multimodal/whisper_real.py +267 -0
- ops_onehit/notifications/__init__.py +111 -0
- ops_onehit/notifications/api.py +426 -0
- ops_onehit/notifications/channels.py +428 -0
- ops_onehit/notifications/cli.py +598 -0
- ops_onehit/notifications/crypto_helper.py +165 -0
- ops_onehit/notifications/router.py +505 -0
- ops_onehit/notifications/store.py +585 -0
- ops_onehit/notifications/templates.py +457 -0
- ops_onehit/onboarding/__init__.py +12 -0
- ops_onehit/onboarding/autosetup.py +349 -0
- ops_onehit/onboarding/cli.py +407 -0
- ops_onehit/onboarding/seed.py +512 -0
- ops_onehit/onboarding/trial/__init__.py +111 -0
- ops_onehit/onboarding/trial/cli.py +252 -0
- ops_onehit/onboarding/trial/signup.py +842 -0
- ops_onehit/onboarding/trial/social_login.py +344 -0
- ops_onehit/onboarding/trial/spam_filter.py +579 -0
- ops_onehit/onboarding/trial/trial_period.py +523 -0
- ops_onehit/onboarding/trial/verify.py +504 -0
- ops_onehit/onboarding/trial/welcome_email.py +511 -0
- ops_onehit/org/__init__.py +14 -0
- ops_onehit/org/cli.py +442 -0
- ops_onehit/rag/__init__.py +66 -0
- ops_onehit/rag/embeddings.py +336 -0
- ops_onehit/rag/seed.py +228 -0
- ops_onehit/rag/store.py +758 -0
- ops_onehit/rbac/__init__.py +133 -0
- ops_onehit/rbac/audit.py +432 -0
- ops_onehit/rbac/cli.py +322 -0
- ops_onehit/rbac/cli_auth.py +511 -0
- ops_onehit/rbac/jwt_utils.py +307 -0
- ops_onehit/rbac/mfa.py +348 -0
- ops_onehit/rbac/models.py +270 -0
- ops_onehit/rbac/oidc.py +528 -0
- ops_onehit/rbac/org_store.py +743 -0
- ops_onehit/rbac/passwords.py +178 -0
- ops_onehit/rbac/permissions.py +210 -0
- ops_onehit/rbac/sessions.py +521 -0
- ops_onehit/rbac/store.py +436 -0
- ops_onehit/repairs/__init__.py +64 -0
- ops_onehit/repairs/actions.py +287 -0
- ops_onehit/repairs/executor.py +327 -0
- ops_onehit/repairs/k8s_actions.py +462 -0
- ops_onehit/repairs/permissions.py +62 -0
- ops_onehit/reports/__init__.py +46 -0
- ops_onehit/reports/cli.py +345 -0
- ops_onehit/reports/pdf.py +185 -0
- ops_onehit/reports/render_html.py +307 -0
- ops_onehit/reports/scheduler.py +260 -0
- ops_onehit/reports/sla_report.py +569 -0
- ops_onehit/reports/templates/sla_report.html.j2 +116 -0
- ops_onehit/runbook/__init__.py +94 -0
- ops_onehit/runbook/actions.py +350 -0
- ops_onehit/runbook/cli.py +394 -0
- ops_onehit/runbook/db.py +742 -0
- ops_onehit/runbook/executor.py +400 -0
- ops_onehit/runbook/models.py +129 -0
- ops_onehit/runbook/templates.py +237 -0
- ops_onehit/siem/__init__.py +188 -0
- ops_onehit/siem/cli.py +429 -0
- ops_onehit/siem/elk_client.py +322 -0
- ops_onehit/siem/event.py +570 -0
- ops_onehit/siem/router.py +546 -0
- ops_onehit/siem/sentinel_client.py +329 -0
- ops_onehit/siem/splunk_client.py +285 -0
- ops_onehit/sop/__init__.py +46 -0
- ops_onehit/sop/runner.py +494 -0
- ops_onehit/sop/templates.py +337 -0
- ops_onehit/telemetry/__init__.py +56 -0
- ops_onehit/telemetry/anonymizer.py +311 -0
- ops_onehit/telemetry/collector.py +564 -0
- ops_onehit/telemetry/consent.py +275 -0
- ops_onehit/telemetry/storage.py +431 -0
- ops_onehit/telemetry/store.py +461 -0
- ops_onehit/tools/__init__.py +8 -0
- ops_onehit/ui/__init__.py +53 -0
- ops_onehit/ui/notifier.py +457 -0
- ops_onehit/ui/tray.py +245 -0
- ops_onehit/ui/widget.py +918 -0
- ops_onehit-1.0.2.dist-info/METADATA +1180 -0
- ops_onehit-1.0.2.dist-info/RECORD +299 -0
- ops_onehit-1.0.2.dist-info/WHEEL +4 -0
- ops_onehit-1.0.2.dist-info/entry_points.txt +2 -0
- ops_onehit-1.0.2.dist-info/licenses/LICENSE +21 -0
ops_onehit/__init__.py
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"""ops-onehit · 端到端 AI SRE / Ops Agent.
|
|
2
|
+
|
|
3
|
+
本包是项目根包。
|
|
4
|
+
子模块:
|
|
5
|
+
agents — LangGraph 节点(Phase 2)
|
|
6
|
+
tools — 系统工具封装(Phase 2)
|
|
7
|
+
llm — LLM 客户端(Ollama / LiteLLM)
|
|
8
|
+
core — 配置与基础服务
|
|
9
|
+
data — 持久化(SQLite)
|
|
10
|
+
|
|
11
|
+
T7.5 性能优化: ``__version__`` 直接导出;重模块(rag / multimodal / rbac /
|
|
12
|
+
kg / agent / api)走 :pep:`562` 模块级 ``__getattr__`` lazy import,
|
|
13
|
+
避免 ``import ops_onehit`` 触发 chromadb / sentence-transformers / VLM /
|
|
14
|
+
Whisper / FastAPI 等重依赖。``from ops_onehit.rag import ChromaRAGStore``
|
|
15
|
+
这种子模块访问仍然走正常导入;只有顶层属性才走 lazy 路径。
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
from __future__ import annotations
|
|
19
|
+
|
|
20
|
+
__version__ = "1.0.2"
|
|
21
|
+
|
|
22
|
+
# T7.5:重模块的 lazy import 映射。
|
|
23
|
+
# ``from ops_onehit import ChromaRAGStore`` 这种顶层属性访问会触发
|
|
24
|
+
# :func:`__getattr__` 并在首次使用时真正 import 对应子模块。后续访问
|
|
25
|
+
# 会命中 ``sys.modules`` 缓存,O(1) 查表无开销。
|
|
26
|
+
_LAZY_EXPORTS: dict[str, str] = {
|
|
27
|
+
# RAG (T6.5+)
|
|
28
|
+
"ChromaRAGStore": "ops_onehit.rag.store",
|
|
29
|
+
"ChromaRAGStoreUnavailable": "ops_onehit.rag.store",
|
|
30
|
+
"KnowledgeStore": "ops_onehit.rag.store",
|
|
31
|
+
"InMemoryRAGStore": "ops_onehit.rag.store",
|
|
32
|
+
"SearchResult": "ops_onehit.rag.store",
|
|
33
|
+
# Embeddings
|
|
34
|
+
"MockEmbeddingProvider": "ops_onehit.rag.embeddings",
|
|
35
|
+
"SentenceTransformerProvider": "ops_onehit.rag.embeddings",
|
|
36
|
+
"BgeEmbeddingProvider": "ops_onehit.rag.embeddings",
|
|
37
|
+
# Multimodal (T5.6)
|
|
38
|
+
"Qwen2VLProcessor": "ops_onehit.multimodal.vlm_real",
|
|
39
|
+
"FasterWhisperProcessor": "ops_onehit.multimodal.whisper_real",
|
|
40
|
+
"MultimodalRouter": "ops_onehit.multimodal.router",
|
|
41
|
+
# KG (T7.2)
|
|
42
|
+
"KnowledgeGraph": "ops_onehit.kg.graph",
|
|
43
|
+
# RBAC (T7.4)
|
|
44
|
+
"UserStore": "ops_onehit.rbac.store",
|
|
45
|
+
# Agent
|
|
46
|
+
"ReActAgent": "ops_onehit.agent.react",
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def __getattr__(name: str) -> object:
|
|
51
|
+
"""PEP 562 lazy attribute access for heavy submodules.
|
|
52
|
+
|
|
53
|
+
只有在 ``_LAZY_EXPORTS`` 里的名字才会触发 lazy import;其他属性走
|
|
54
|
+
Python 默认 ``AttributeError``。这样 ``ops_onehit.__version__`` 等
|
|
55
|
+
轻量属性仍然 O(1),而重模块按需加载。
|
|
56
|
+
"""
|
|
57
|
+
module_name = _LAZY_EXPORTS.get(name)
|
|
58
|
+
if module_name is None:
|
|
59
|
+
raise AttributeError(f"module 'ops_onehit' has no attribute {name!r}")
|
|
60
|
+
import importlib
|
|
61
|
+
|
|
62
|
+
module = importlib.import_module(module_name)
|
|
63
|
+
value = getattr(module, name)
|
|
64
|
+
globals()[name] = value # cache for subsequent lookups
|
|
65
|
+
return value
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def __dir__() -> list[str]:
|
|
69
|
+
"""让 dir(ops_onehit) 能看到 lazy 导出名,IDE 自动补全友好。"""
|
|
70
|
+
return sorted(set(globals().keys()) | _LAZY_EXPORTS.keys())
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
__all__ = ["__version__", *_LAZY_EXPORTS.keys()]
|
ops_onehit/__main__.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"""T7.5: ``python -m ops_onehit --help`` 入口。
|
|
2
|
+
|
|
3
|
+
让 ``python -m ops_onehit`` 和 ``ops-onehit`` 脚本入口行为一致(都调
|
|
4
|
+
:func:`ops_onehit.main.cli_main`)。这个文件是 T7.5 性能优化时新增的,
|
|
5
|
+
T7.3 之前没有 — 当时只有 ``pyproject.toml [project.scripts]`` 的
|
|
6
|
+
``ops-onehit`` 命令,没有 ``-m`` 入口。
|
|
7
|
+
|
|
8
|
+
冷启动路径:Python 解释器 → ``__main__.py`` 顶层 0 import → 调
|
|
9
|
+
:func:`cli_main` → :func:`main` → lazy import 业务模块。``--help`` 不
|
|
10
|
+
触发任何业务 import,~400ms 完成。
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
from __future__ import annotations
|
|
14
|
+
|
|
15
|
+
from ops_onehit.main import cli_main
|
|
16
|
+
|
|
17
|
+
if __name__ == "__main__":
|
|
18
|
+
cli_main()
|
|
19
|
+
raise SystemExit(0)
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"""C2.8 — Admin 控制台服务层 (User / Org / Role / Token / Audit 管理)。
|
|
2
|
+
|
|
3
|
+
4 维度产品原则(可商业化 / 准确 / 高效 / 交互友好):
|
|
4
|
+
|
|
5
|
+
- :class:`AdminService` 集中所有 admin 业务逻辑,API / CLI / Vue 共用
|
|
6
|
+
- 全部写操作自动落 :class:`AuditLogger` 留痕(可商业化合规要求)
|
|
7
|
+
- 分页 / 过滤 / 搜索 内置(高效)
|
|
8
|
+
- :class:`AdminError` / :class:`PermissionDeniedError` 提供友好错误信息
|
|
9
|
+
|
|
10
|
+
模块清单:
|
|
11
|
+
|
|
12
|
+
- :mod:`ops_onehit.admin.service` — AdminService 业务封装
|
|
13
|
+
- :mod:`ops_onehit.admin.cli` — ``ops-onehit admin`` 子命令
|
|
14
|
+
- :mod:`ops_onehit.api.admin` — FastAPI router(15+ 端点)
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
from __future__ import annotations
|
|
18
|
+
|
|
19
|
+
__all__: list[str] = [
|
|
20
|
+
"AdminError",
|
|
21
|
+
"AdminService",
|
|
22
|
+
"DashboardKPI",
|
|
23
|
+
"NotFoundError",
|
|
24
|
+
"PermissionDeniedError",
|
|
25
|
+
"TokenStatus",
|
|
26
|
+
"ValidationError",
|
|
27
|
+
]
|