bugx-cli 0.1.1 → 0.1.3
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.
- package/README.md +36 -35
- package/core/README.md +1 -1
- package/core/agent/agent_orchestrator.py +3 -0
- package/core/agent/agent_workspace.py +14 -2
- package/core/assets/README.md +3 -2
- package/core/assets/bugx-social-preview.svg +71 -0
- package/core/assets/bugx-wechat-group.png +0 -0
- package/core/assets/twitter_promo_art.jpg +0 -0
- package/core/assets/twitter_promo_card.svg +166 -0
- package/core/assets/twitter_promo_clean.jpg +0 -0
- package/core/assets/twitter_terminal_real.png +0 -0
- package/core/audit_packs/README.md +2 -0
- package/core/audit_packs/pitfalls/auth_crypto.json +64 -0
- package/core/audit_packs/pitfalls/file_ssrf_cmd.json +64 -0
- package/core/audit_packs/pitfalls/go_backend.json +66 -0
- package/core/audit_packs/pitfalls/java_spring.json +64 -0
- package/core/audit_packs/pitfalls/js_ts_web.json +67 -0
- package/core/audit_packs/pitfalls/python_web.json +82 -0
- package/core/bugx.md +2 -2
- package/core/bugx_paths.py +2 -2
- package/core/cli-help.txt +1 -1
- package/core/cloud_sync/cloud_client.py +56 -5
- package/core/cloud_sync/consent.py +33 -3
- package/core/cloud_sync/flywheel_client.py +186 -24
- package/core/contracts/README.md +1 -1
- package/core/contracts/bugx-opencode.md +1 -1
- package/core/contracts/bugx-runtime-contract.md +1 -1
- package/core/contracts/bugx-worker.md +1 -1
- package/core/engine-integrity.json +191 -95
- package/core/host_acp/kimi.py +175 -0
- package/core/host_acp/minimax.py +28 -0
- package/core/host_runtime/host_registry.py +23 -3
- package/core/hosts/dsh.py +1 -1
- package/core/hosts/kimi.py +293 -0
- package/core/hosts/minimax.py +248 -0
- package/core/hosts/zcode.py +5 -0
- package/core/infra/README.md +1 -1
- package/core/infra/build_info.py +30 -5
- package/core/launch_phases/README.md +6 -3
- package/core/launch_phases/finding_confirm_phase.py +168 -7
- package/core/launch_phases/post_phase.py +5 -5
- package/core/launch_phases/pre_recon_scout.py +13 -0
- package/core/launch_phases/report_sharing.py +3 -7
- package/core/launch_phases/round_orchestrator.py +114 -26
- package/core/launch_phases/semantic_recon.py +545 -0
- package/core/launch_phases/startup_version_gate.py +6 -2
- package/core/launch_phases/supervisor_bridge.py +14 -23
- package/core/launch_phases/verify_loop.py +767 -0
- package/core/launch_phases/worker_prior.py +115 -0
- package/core/ledger/README.md +2 -1
- package/core/ledger/finding_verification.py +511 -2
- package/core/ledger/fp_ledger.py +255 -0
- package/core/metadata.txt +2 -2
- package/core/planning/README.md +2 -1
- package/core/planning/prompt_harness.py +50 -10
- package/core/planning/prompt_policy_engine.py +386 -0
- package/core/prompts/README.md +4 -2
- package/core/prompts/policies/prompt_policies.json +101 -0
- package/core/prompts/stages/stage_verify.defensive.md +42 -0
- package/core/prompts/stages/stage_verify.md +44 -0
- package/core/report_engine/report_share.py +0 -8
- package/core/retrieval/README.md +2 -1
- package/core/retrieval/pitfall_packs.py +277 -0
- package/core/runtime/README.md +1 -1
- package/core/runtime/global_telemetry.py +20 -0
- package/core/runtime/scenario_eval.py +1 -1
- package/core/runtime/setup_ui_env.py +4 -7
- package/core/supervisor/README.md +1 -1
- package/core/supervisor/cli.py +2 -2
- package/core/webui/mcp_inspector.py +6 -0
- package/core/webui/static/index.html +51 -3
- package/core/webui/static/manifest.webmanifest +1 -1
- package/core/webui/static/project-settings.js +18 -3
- package/core/webui/static/robots.txt +36 -0
- package/core/webui/static/sitemap.xml +15 -0
- package/docs/07_distribution/01_README_NPM.md +36 -35
- package/ecosystem/integrations/cline/skills/bugx/SKILL.md +1 -1
- package/ecosystem/integrations/dsh/agents/bugx.md +1 -1
- package/ecosystem/integrations/dsh/dsh-patch.yml +2 -2
- package/ecosystem/integrations/dsh/mcp/package.json +1 -1
- package/ecosystem/integrations/dsh/skills/bugx/SKILL.md +1 -1
- package/ecosystem/integrations/dsh/skills/bugx-dsh/SKILL.md +1 -1
- package/ecosystem/integrations/dsh/ui/package.json +1 -1
- package/ecosystem/integrations/opencode/bugx-mcp-manifest.json +1 -1
- package/ecosystem/integrations/pi/extensions/bugx/manifest.json +1 -1
- package/ecosystem/integrations/pi/skills/bugx/SKILL.md +1 -1
- package/ecosystem/integrations/qoder/connector-meta.json +9 -9
- package/ecosystem/integrations/workbuddy/connector-meta.json +9 -9
- package/ecosystem/integrations/workbuddy/skills/bugx/SKILL.md +2 -2
- package/ecosystem/plugins/bugx/.claude-plugin/marketplace.json +2 -2
- package/ecosystem/plugins/bugx/.claude-plugin/plugin.json +2 -2
- package/ecosystem/plugins/bugx/.codex-plugin/plugin.json +4 -4
- package/ecosystem/plugins/bugx/.zcode-plugin/plugin.json +2 -2
- package/ecosystem/plugins/bugx/agents/bugx-worker.md +1 -1
- package/ecosystem/plugins/bugx/agents/bugx.md +1 -1
- package/ecosystem/plugins/bugx/skills/bugx/SKILL.md +3 -3
- package/ecosystem/plugins/bugx/skills/bugx-claude/SKILL.md +1 -1
- package/ecosystem/plugins/bugx/skills/bugx-dsh/SKILL.md +1 -1
- package/ecosystem/plugins/bugx/skills/bugx-opencode/SKILL.md +1 -1
- package/ecosystem/plugins/bugx/skills/bugx-zcode/SKILL.md +1 -1
- package/interfaces/bin/bugx.js +9 -7
- package/interfaces/cli/bugx_cli/__init__.py +2 -2
- package/interfaces/cli/bugx_cli/cli.py +178 -67
- package/interfaces/cli/bugx_cli/commands/agent.py +313 -127
- package/interfaces/cli/bugx_cli/commands/audit.py +8 -7
- package/interfaces/cli/bugx_cli/commands/cloud.py +27 -19
- package/interfaces/cli/bugx_cli/commands/doctor.py +18 -0
- package/interfaces/cli/bugx_cli/commands/knowledge.py +3 -4
- package/interfaces/cli/bugx_cli/commands/lifecycle.py +54 -47
- package/interfaces/cli/bugx_cli/commands/plugin.py +9 -9
- package/interfaces/cli/bugx_cli/commands/plugin_claude.py +27 -13
- package/interfaces/cli/bugx_cli/commands/plugin_kimi.py +348 -0
- package/interfaces/cli/bugx_cli/commands/plugin_minimax.py +322 -0
- package/interfaces/cli/bugx_cli/commands/plugin_qoder.py +3 -4
- package/interfaces/cli/bugx_cli/commands/plugin_zcode.py +4 -5
- package/interfaces/cli/bugx_cli/commands/project.py +6 -13
- package/interfaces/cli/bugx_cli/commands/system.py +577 -162
- package/interfaces/cli/bugx_cli/common.py +102 -15
- package/interfaces/cli/bugx_cli/host_adapters.py +150 -4
- package/interfaces/cli/bugx_cli/hosts/registry.py +4 -2
- package/interfaces/cli/bugx_cli/hosts/template_engine.py +10 -9
- package/interfaces/cli/bugx_cli/infra/engine_installer.py +21 -10
- package/interfaces/cli/bugx_cli/infra/host_sync.py +1 -1
- package/interfaces/cli/bugx_cli/infra/mcp_advisor.py +2 -2
- package/package.json +54 -16
- package/pyproject.toml +64 -1
- package/scripts/sync-version.mjs +1 -1
- package/skills/README.md +25 -0
- package/skills/platform/bugx-user/SKILL.md +92 -0
- package/core/assets/bugx-hero-cn.png +0 -0
- package/core/assets/bugx-hero-en.png +0 -0
|
@@ -13,6 +13,7 @@ import gzip
|
|
|
13
13
|
import hashlib
|
|
14
14
|
import json
|
|
15
15
|
import os
|
|
16
|
+
import platform
|
|
16
17
|
import shutil
|
|
17
18
|
import sqlite3
|
|
18
19
|
import tarfile
|
|
@@ -28,17 +29,30 @@ from typing import Any, Callable, Iterable, Mapping
|
|
|
28
29
|
from core.governance.secret_redactor import SecretRedactor
|
|
29
30
|
|
|
30
31
|
try:
|
|
31
|
-
from core.infra.client_metadata import
|
|
32
|
+
from core.infra.client_metadata import (
|
|
33
|
+
client_headers,
|
|
34
|
+
client_marker,
|
|
35
|
+
client_version,
|
|
36
|
+
release_channel,
|
|
37
|
+
tls_context,
|
|
38
|
+
)
|
|
32
39
|
except ImportError:
|
|
33
40
|
import sys
|
|
34
41
|
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
|
|
35
|
-
from core.infra.client_metadata import
|
|
42
|
+
from core.infra.client_metadata import (
|
|
43
|
+
client_headers,
|
|
44
|
+
client_marker,
|
|
45
|
+
client_version,
|
|
46
|
+
release_channel,
|
|
47
|
+
tls_context,
|
|
48
|
+
)
|
|
36
49
|
|
|
37
50
|
MAX_OUTBOX_RECORDS = 1000
|
|
38
51
|
MAX_OUTBOX_BYTES = 50 * 1024 * 1024
|
|
39
52
|
MAX_AUDIT_BYTES = 10 * 1024 * 1024
|
|
40
53
|
AUDIT_BACKUPS = 3
|
|
41
54
|
FLYWHEEL_PATH = "/api/v1/agent/telemetry/flywheel"
|
|
55
|
+
INSTALLATION_HEARTBEAT_INTERVAL = 24 * 60 * 60
|
|
42
56
|
QUALITY_TIERS = {"tier-1": 3, "tier-2": 2, "tier-3": 1, "TIER-1": 3, "TIER-2": 2, "TIER-3": 1}
|
|
43
57
|
|
|
44
58
|
|
|
@@ -54,14 +68,6 @@ def default_audit_path() -> Path:
|
|
|
54
68
|
return Path(os.environ.get("BUGX_FLYWHEEL_AUDIT", str(_bugx_root() / "telemetry" / "egress_audit.log"))).expanduser()
|
|
55
69
|
|
|
56
70
|
|
|
57
|
-
def _stored_data_sharing() -> bool | None:
|
|
58
|
-
# 单一真源:与 cloud_onboard.sync_layers / auto_sync 共用 consent 判定,
|
|
59
|
-
# 禁止在这里另写一套读取逻辑(双轨实现会让撤销在两处产生不同结论)。
|
|
60
|
-
# 必须保留三态:撤销(False)要压过 BUGX_ACCEPT_DATA_SHARING 预同意入口。
|
|
61
|
-
from core.cloud_sync.consent import data_sharing_flag
|
|
62
|
-
return data_sharing_flag()
|
|
63
|
-
|
|
64
|
-
|
|
65
71
|
def _stored_base_url() -> str | None:
|
|
66
72
|
path = Path(os.environ.get("BUGX_CLOUD_CONFIG", str(_bugx_root() / "cloud-config.json"))).expanduser()
|
|
67
73
|
try:
|
|
@@ -88,6 +94,64 @@ def _stored_auth_token() -> str | None:
|
|
|
88
94
|
return None
|
|
89
95
|
|
|
90
96
|
|
|
97
|
+
def _client_kind() -> str:
|
|
98
|
+
value = str(os.environ.get("BUGX_CLIENT_KIND") or os.environ.get("BUGX_CLI_SOURCE") or "pip").strip().lower()
|
|
99
|
+
return value if value in {"pip", "npm", "source", "editable", "unknown"} else "unknown"
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
def _artifact_kind() -> str:
|
|
103
|
+
return "npm-package" if _client_kind() == "npm" else "python-wheel"
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
def _telemetry_context(base_url: str) -> dict[str, Any]:
|
|
107
|
+
"""Build only stable, scoped client metadata for remote attribution.
|
|
108
|
+
|
|
109
|
+
The installation identity is an HMAC of the local installation secret and
|
|
110
|
+
server origin. No hostname, username, project path, credential, or secret
|
|
111
|
+
value is included in the payload.
|
|
112
|
+
"""
|
|
113
|
+
from core.cloud_sync.device_identity import get_device_id
|
|
114
|
+
from core.report_engine.report_client import installation_identity
|
|
115
|
+
|
|
116
|
+
return {
|
|
117
|
+
"installation_id": installation_identity(base_url, account_id=""),
|
|
118
|
+
"device_id": get_device_id(),
|
|
119
|
+
"client_version": client_version(),
|
|
120
|
+
"client_marker": client_marker(),
|
|
121
|
+
"release_channel": release_channel(),
|
|
122
|
+
"client_kind": _client_kind(),
|
|
123
|
+
"artifact_kind": _artifact_kind(),
|
|
124
|
+
"platform": platform.system().lower() or "unknown",
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
def _installation_state_path() -> Path:
|
|
129
|
+
return _bugx_root() / "telemetry" / "installation-state.json"
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
def _load_installation_state() -> dict[str, Any]:
|
|
133
|
+
path = _installation_state_path()
|
|
134
|
+
try:
|
|
135
|
+
if path.is_symlink() or not path.is_file():
|
|
136
|
+
return {}
|
|
137
|
+
value = json.loads(path.read_text(encoding="utf-8"))
|
|
138
|
+
return value if isinstance(value, dict) else {}
|
|
139
|
+
except (OSError, UnicodeError, json.JSONDecodeError):
|
|
140
|
+
return {}
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
def _save_installation_state(state: Mapping[str, Any]) -> None:
|
|
144
|
+
path = _installation_state_path()
|
|
145
|
+
from core.report_engine.report_client import atomic_write_nofollow
|
|
146
|
+
|
|
147
|
+
atomic_write_nofollow(
|
|
148
|
+
path,
|
|
149
|
+
_canonical(dict(state)),
|
|
150
|
+
mode=0o600,
|
|
151
|
+
parent_mode=0o700,
|
|
152
|
+
)
|
|
153
|
+
|
|
154
|
+
|
|
91
155
|
def _canonical(value: Any) -> bytes:
|
|
92
156
|
return json.dumps(value, ensure_ascii=False, sort_keys=True, separators=(",", ":")).encode("utf-8")
|
|
93
157
|
|
|
@@ -407,18 +471,11 @@ class FlywheelUploader:
|
|
|
407
471
|
self.audit_path = Path(audit_path or default_audit_path()).expanduser()
|
|
408
472
|
self._urlopen = urlopen or urllib.request.urlopen
|
|
409
473
|
self.auth_token = auth_token if auth_token is not None else _stored_auth_token()
|
|
410
|
-
#
|
|
411
|
-
#
|
|
412
|
-
#
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
elif _stored_data_sharing() is False:
|
|
416
|
-
self.data_sharing = False
|
|
417
|
-
else:
|
|
418
|
-
self.data_sharing = (
|
|
419
|
-
os.environ.get("BUGX_ACCEPT_DATA_SHARING") == "1"
|
|
420
|
-
or _stored_data_sharing() is True
|
|
421
|
-
)
|
|
474
|
+
# 统一门禁:显式 false 只能进一步关闭,不能用显式 true 绕过用户
|
|
475
|
+
# 配置或 BUGX_TELEMETRY_ENABLED=0。未配置时由 consent.py 的产品默认值
|
|
476
|
+
# 开启远程遥测,满足“默认开启、可关闭”的契约。
|
|
477
|
+
self._requested_data_sharing = data_sharing
|
|
478
|
+
self.data_sharing = self._sharing_enabled()
|
|
422
479
|
self.privacy_strict = (os.environ.get("BUGX_PRIVACY_STRICT") == "1") if privacy_strict is None else privacy_strict
|
|
423
480
|
self.sleep = sleep
|
|
424
481
|
self.timeout = timeout
|
|
@@ -427,6 +484,16 @@ class FlywheelUploader:
|
|
|
427
484
|
self._circuit_until = 0.0
|
|
428
485
|
self._redactor = SecretRedactor(test_context=bool(os.environ.get("BUGX_TEST_CONTEXT") == "1"))
|
|
429
486
|
|
|
487
|
+
def _sharing_enabled(self) -> bool:
|
|
488
|
+
if self._requested_data_sharing is False:
|
|
489
|
+
return False
|
|
490
|
+
try:
|
|
491
|
+
from core.cloud_sync.consent import telemetry_enabled
|
|
492
|
+
|
|
493
|
+
return bool(telemetry_enabled())
|
|
494
|
+
except Exception: # noqa: BLE001 - privacy gate fails closed
|
|
495
|
+
return False
|
|
496
|
+
|
|
430
497
|
def close(self) -> None:
|
|
431
498
|
if getattr(self, "_redactor", None):
|
|
432
499
|
self._redactor.close()
|
|
@@ -441,6 +508,19 @@ class FlywheelUploader:
|
|
|
441
508
|
clean = self._redactor.redact_records(dict(payload))
|
|
442
509
|
if self.privacy_strict:
|
|
443
510
|
metrics = clean.get("metrics") if isinstance(clean, dict) else None
|
|
511
|
+
safe_context = {
|
|
512
|
+
key: clean.get(key)
|
|
513
|
+
for key in (
|
|
514
|
+
"installation_id",
|
|
515
|
+
"client_version",
|
|
516
|
+
"release_channel",
|
|
517
|
+
"client_kind",
|
|
518
|
+
"artifact_kind",
|
|
519
|
+
"platform",
|
|
520
|
+
"installation_event",
|
|
521
|
+
)
|
|
522
|
+
if isinstance(clean, dict) and isinstance(clean.get(key), str) and clean.get(key)
|
|
523
|
+
}
|
|
444
524
|
clean = {
|
|
445
525
|
"schema_version": 1,
|
|
446
526
|
"event_type": clean.get("event_type", "flywheel") if isinstance(clean, dict) else "flywheel",
|
|
@@ -448,13 +528,18 @@ class FlywheelUploader:
|
|
|
448
528
|
"topology_hash": clean.get("topology_hash") if isinstance(clean, dict) else None,
|
|
449
529
|
"metrics": metrics if isinstance(metrics, dict) else {},
|
|
450
530
|
"privacy": "strict",
|
|
531
|
+
**safe_context,
|
|
451
532
|
}
|
|
452
533
|
return clean
|
|
453
534
|
|
|
454
535
|
def enqueue(self, payload: Mapping[str, Any], *, tier: str | int | None = None) -> int | None:
|
|
536
|
+
self.data_sharing = self._sharing_enabled()
|
|
455
537
|
if not self.data_sharing:
|
|
456
538
|
return None
|
|
457
|
-
|
|
539
|
+
enriched = dict(payload)
|
|
540
|
+
for key, value in _telemetry_context(self.base_url).items():
|
|
541
|
+
enriched.setdefault(key, value)
|
|
542
|
+
clean = self._redact(enriched)
|
|
458
543
|
return self.outbox.enqueue(clean, tier=tier or clean.get("quality_tier"))
|
|
459
544
|
|
|
460
545
|
queue = enqueue
|
|
@@ -487,6 +572,26 @@ class FlywheelUploader:
|
|
|
487
572
|
payload["dpo_preference"] = dpo_pair.as_dict() if isinstance(dpo_pair, DPOPreferencePair) else dict(dpo_pair)
|
|
488
573
|
return self.enqueue(payload, tier=quality)
|
|
489
574
|
|
|
575
|
+
def enqueue_installation(self, event: str = "heartbeat") -> int | None:
|
|
576
|
+
"""Queue an install/heartbeat identity event in the existing outbox.
|
|
577
|
+
|
|
578
|
+
The server treats this event as an upsert into its installation table,
|
|
579
|
+
while retaining the normal Flywheel event receipt for auditability.
|
|
580
|
+
"""
|
|
581
|
+
normalized = str(event or "heartbeat").strip().lower()
|
|
582
|
+
if normalized not in {"installed", "heartbeat"}:
|
|
583
|
+
raise ValueError("installation event must be installed or heartbeat")
|
|
584
|
+
return self.enqueue(
|
|
585
|
+
{
|
|
586
|
+
"schema_version": 2,
|
|
587
|
+
"event_type": "installation",
|
|
588
|
+
"installation_event": normalized,
|
|
589
|
+
"quality_tier": "tier-3",
|
|
590
|
+
"metrics": {},
|
|
591
|
+
},
|
|
592
|
+
tier="tier-3",
|
|
593
|
+
)
|
|
594
|
+
|
|
490
595
|
def _url(self) -> str:
|
|
491
596
|
return self._endpoint
|
|
492
597
|
|
|
@@ -584,6 +689,7 @@ class FlywheelUploader:
|
|
|
584
689
|
|
|
585
690
|
def flush(self, *, limit: int = 100, batch_size: int = 1) -> dict[str, Any]:
|
|
586
691
|
"""Flush queued records to the telemetry flywheel (DES-06, DES-18)."""
|
|
692
|
+
self.data_sharing = self._sharing_enabled()
|
|
587
693
|
if not self.data_sharing or time.monotonic() < self._circuit_until:
|
|
588
694
|
return {"sent": 0, "remaining": self.outbox.count(), "circuit_open": True}
|
|
589
695
|
sent = 0
|
|
@@ -729,6 +835,61 @@ class FlywheelUploader:
|
|
|
729
835
|
return len([line for line in records if line.strip()])
|
|
730
836
|
|
|
731
837
|
|
|
838
|
+
def maybe_report_installation(*, force: bool = False) -> dict[str, Any]:
|
|
839
|
+
"""Queue and opportunistically flush one install/heartbeat event.
|
|
840
|
+
|
|
841
|
+
The CLI calls this at most once per day. It is deliberately best effort:
|
|
842
|
+
a network failure leaves the normal bounded outbox intact and cannot block
|
|
843
|
+
the requested local command. ``force`` is reserved for an explicit
|
|
844
|
+
diagnostic/verification caller and still cannot bypass the privacy gate.
|
|
845
|
+
"""
|
|
846
|
+
try:
|
|
847
|
+
from core.cloud_sync.consent import telemetry_enabled
|
|
848
|
+
|
|
849
|
+
if not telemetry_enabled():
|
|
850
|
+
return {"enabled": False, "status": "disabled", "sent": 0}
|
|
851
|
+
state = _load_installation_state()
|
|
852
|
+
now = time.time()
|
|
853
|
+
last_attempt = float(state.get("last_attempt_at") or 0.0)
|
|
854
|
+
if not force and last_attempt > 0 and now - last_attempt < INSTALLATION_HEARTBEAT_INTERVAL:
|
|
855
|
+
return {"enabled": True, "status": "not_due", "sent": 0}
|
|
856
|
+
|
|
857
|
+
event = "installed" if not bool(state.get("installed_reported")) else "heartbeat"
|
|
858
|
+
with FlywheelUploader() as uploader:
|
|
859
|
+
if not uploader.data_sharing:
|
|
860
|
+
return {"enabled": False, "status": "disabled", "sent": 0}
|
|
861
|
+
record_id = uploader.enqueue_installation(event)
|
|
862
|
+
if record_id is None:
|
|
863
|
+
return {"enabled": False, "status": "disabled", "sent": 0}
|
|
864
|
+
flushed = uploader.flush(limit=20, batch_size=20)
|
|
865
|
+
remaining_ids = {
|
|
866
|
+
int(item["id"])
|
|
867
|
+
for item in uploader.outbox.items(limit=uploader.outbox.max_records)
|
|
868
|
+
}
|
|
869
|
+
delivered = record_id not in remaining_ids
|
|
870
|
+
|
|
871
|
+
state.update({
|
|
872
|
+
"schema_version": 1,
|
|
873
|
+
"last_attempt_at": now,
|
|
874
|
+
"last_event": event,
|
|
875
|
+
"installed_reported": bool(state.get("installed_reported")) or delivered,
|
|
876
|
+
})
|
|
877
|
+
try:
|
|
878
|
+
_save_installation_state(state)
|
|
879
|
+
except (OSError, ValueError):
|
|
880
|
+
# The telemetry event itself has already been queued/sent. State
|
|
881
|
+
# persistence failure only causes a bounded duplicate next time.
|
|
882
|
+
pass
|
|
883
|
+
return {
|
|
884
|
+
"enabled": True,
|
|
885
|
+
"status": "sent" if delivered else "queued",
|
|
886
|
+
"event": event,
|
|
887
|
+
"sent": int(flushed.get("sent", 0)) if isinstance(flushed, dict) else 0,
|
|
888
|
+
}
|
|
889
|
+
except Exception as exc: # noqa: BLE001 - telemetry must not block CLI work
|
|
890
|
+
return {"enabled": True, "status": "error", "error": str(exc), "sent": 0}
|
|
891
|
+
|
|
892
|
+
|
|
732
893
|
def _encrypt(data: bytes, passphrase: str) -> bytes:
|
|
733
894
|
try:
|
|
734
895
|
from cryptography.hazmat.primitives.ciphers.aead import AESGCM
|
|
@@ -763,7 +924,8 @@ def _decrypt(data: bytes, passphrase: str) -> bytes:
|
|
|
763
924
|
|
|
764
925
|
__all__ = [
|
|
765
926
|
"AUDIT_BACKUPS", "DPOPreferencePair", "FLYWHEEL_PATH", "FlywheelOutbox", "FlywheelUploader",
|
|
927
|
+
"INSTALLATION_HEARTBEAT_INTERVAL",
|
|
766
928
|
"MAX_AUDIT_BYTES", "MAX_OUTBOX_BYTES", "MAX_OUTBOX_RECORDS", "OutboxFullError",
|
|
767
929
|
"build_dpo_preference_pair", "default_audit_path", "default_outbox_path",
|
|
768
|
-
"merkle_root", "quality_tier", "quality_tier_name",
|
|
930
|
+
"maybe_report_installation", "merkle_root", "quality_tier", "quality_tier_name",
|
|
769
931
|
]
|
package/core/contracts/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# BugX 智能体执行协议与交互契约子系统 (Agent Runtime Contracts & Protocols)
|
|
2
2
|
|
|
3
|
-
> **版本契约**: `0.1.
|
|
3
|
+
> **版本契约**: `0.1.2` | **父系统**: `core/`
|
|
4
4
|
> **工程规范**: 参见 [`docs/02_architecture/05_ARCH_NOMENCLATURE_GUIDE.md`](../../docs/02_architecture/05_ARCH_NOMENCLATURE_GUIDE.md) 与 [`docs/02_architecture/06_MODULE_GOVERNANCE_SPEC.md`](../../docs/02_architecture/06_MODULE_GOVERNANCE_SPEC.md)
|
|
5
5
|
> **守卫机制**: `scripts/verify_directory_indices.py` (100% 索引对齐防漂移)
|
|
6
6
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
description:
|
|
2
|
+
description: BugX 是一个具备自主代码审查与测试能力的智能体,严把代码交付关:它帮助开发人员在写完代码后自动排查隐藏的深层 Bug,减少反复排错与返工;帮助测试人员自动化运行黑盒测试、功能验证与性能测试,自动覆盖手工盲测难以覆盖的极端场景;确保代码功能符合要求、具备良好的健壮性和稳定性。让开发和测试在繁琐的工作中解放双手,大幅提高工作效率、全面提升代码质量、显著降低后期维护成本,实现科技服务于人。
|
|
3
3
|
mode: all
|
|
4
4
|
permissions:
|
|
5
5
|
- action: '*'
|