bugx-cli 0.1.0 → 0.1.2
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 +193 -185
- package/core/README.md +2 -2
- package/core/agent/README.md +2 -1
- package/core/agent/agent_artifacts.py +8 -6
- package/core/agent/agent_eval.py +136 -54
- package/core/agent/agent_execution.py +218 -52
- package/core/agent/agent_orchestrator.py +14 -8
- package/core/agent/agent_targets.py +8 -2
- package/core/agent/feature_baseline.py +150 -0
- package/core/assets/README.md +3 -2
- package/core/assets/axe-core/LICENSE-3RD-PARTY.txt +66 -0
- package/core/assets/axe-core/LICENSE.txt +362 -0
- package/core/assets/axe-core/UPSTREAM.md +10 -0
- package/core/assets/axe-core/axe.min.js +12 -0
- package/core/assets/bugx-hero-en.svg +74 -0
- package/core/assets/bugx-hero-zh.svg +74 -0
- package/core/assets/bugx-social-preview.svg +71 -0
- package/core/assets/bugx-wechat-group.png +0 -0
- package/core/assets/codex.png +0 -0
- package/core/assets/dsh.png +0 -0
- package/core/assets/webui-chatgpt.jpg +0 -0
- package/core/assets/webui-session.jpg +0 -0
- package/core/assets/webui-skills.jpg +0 -0
- package/core/assets/webui-studio.jpg +0 -0
- package/core/assets/webui-zcode.jpg +0 -0
- package/core/assets/zcode.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/autonomous_cve/SPEC.md +1 -1
- package/core/autonomous_cve/attack_graph_store.py +152 -106
- package/core/autonomous_cve/behavior_graph.py +8 -2
- package/core/autonomous_cve/verifier.py +4 -1
- package/core/bugx.md +1 -1
- package/core/bugx_paths.py +43 -8
- package/core/cli-help.txt +66 -0
- package/core/cloud_sync/SPEC.md +1 -1
- package/core/cloud_sync/cloud_client.py +81 -11
- package/core/cloud_sync/cloud_onboard.py +42 -1
- package/core/cloud_sync/consent.py +33 -3
- package/core/cloud_sync/flywheel_client.py +186 -15
- package/core/cloud_sync/network_transport.py +24 -3
- package/core/cloud_sync/sensitive_filter.py +2 -2
- package/core/cloud_sync/sync_push.py +12 -10
- package/core/contracts/AGENT_GUIDE.md +6 -9
- package/core/contracts/README.md +2 -2
- package/core/contracts/bugx-runtime-contract.md +1 -1
- package/core/contracts/bugx-worker.md +1 -1
- package/core/contracts/engine_gap_contracts.py +86 -3
- package/core/coverage/coverage_discovery.py +599 -29
- package/core/coverage/coverage_evidence.py +47 -0
- package/core/coverage/coverage_forensics.py +9 -0
- package/core/coverage/coverage_validate.py +6 -1
- package/core/dev_harness/SPEC.md +1 -1
- package/core/engine-integrity.json +670 -442
- package/core/fuzzing/concurrency_fuzzer.py +53 -0
- package/core/fuzzing/differential_oracle.py +562 -27
- package/core/fuzzing/fuzz_input.py +109 -6
- package/core/fuzzing/stateful_fuzzer.py +72 -0
- package/core/governance/secret_redactor.py +22 -10
- package/core/host_acp/SPEC.md +1 -1
- package/core/host_acp/__init__.py +4 -4
- package/core/host_acp/claude.py +59 -1
- package/core/host_acp/cline.py +64 -1
- package/core/host_acp/codex.py +56 -1
- package/core/host_acp/dsh.py +59 -1
- package/core/host_acp/opencode.py +56 -1
- package/core/host_acp/pi.py +59 -1
- package/core/host_acp/zcode.py +59 -1
- package/core/host_runtime/SPEC.md +1 -1
- package/core/host_runtime/adapters.py +1 -1
- package/core/host_runtime/cline.py +13 -0
- package/core/host_runtime/host_evaluators.py +44 -4
- package/core/host_runtime/host_probe.py +1 -1
- package/core/host_runtime/host_provider_arbitrator.py +116 -62
- package/core/host_runtime/host_registry.py +15 -8
- package/core/host_runtime/mcp_registry_gate.py +12 -1
- package/core/host_runtime/pi.py +102 -0
- package/core/host_runtime/provider_facts.py +66 -0
- package/core/hosts/SPEC.md +1 -1
- package/core/hosts/__init__.py +6 -2
- package/core/hosts/_dsh_usage.py +1 -1
- package/core/hosts/base.py +32 -4
- package/core/hosts/claude.py +55 -0
- package/core/hosts/cline.py +6 -2
- package/core/hosts/codex.py +58 -0
- package/core/hosts/dsh.py +9 -1
- package/core/hosts/opencode.py +6 -6
- package/core/hosts/pi.py +159 -2
- package/core/infra/README.md +4 -2
- package/core/infra/__init__.py +2 -0
- package/core/infra/build_info.py +22 -3
- package/core/infra/client_metadata.py +1 -1
- package/core/infra/json_utils.py +22 -0
- package/core/launch_phases/README.md +6 -3
- package/core/launch_phases/SPEC.md +1 -1
- package/core/launch_phases/common.py +21 -2
- package/core/launch_phases/finding_confirm_phase.py +170 -5
- package/core/launch_phases/finding_settlement.py +188 -1
- package/core/launch_phases/judge_phase.py +69 -12
- package/core/launch_phases/orchestrator_controls.py +11 -7
- package/core/launch_phases/post_coverage_sync.py +9 -2
- package/core/launch_phases/post_phase.py +144 -8
- package/core/launch_phases/post_receipt.py +12 -1
- package/core/launch_phases/pre_phase.py +3 -3
- package/core/launch_phases/pre_recon_scout.py +66 -36
- package/core/launch_phases/pre_state_builder.py +23 -176
- package/core/launch_phases/report_sharing.py +3 -7
- package/core/launch_phases/round_orchestrator.py +129 -58
- package/core/launch_phases/semantic_recon.py +545 -0
- package/core/launch_phases/session_runtime.py +56 -9
- package/core/launch_phases/startup_gates.py +36 -8
- package/core/launch_phases/startup_interaction.py +68 -12
- package/core/launch_phases/startup_version_gate.py +13 -3
- package/core/launch_phases/supervisor_bridge.py +46 -17
- package/core/launch_phases/supervisor_coverage.py +8 -2
- package/core/launch_phases/supervisor_degraded.py +1 -9
- package/core/launch_phases/verify_loop.py +767 -0
- package/core/launch_phases/worker_barriers.py +15 -5
- package/core/launch_phases/worker_orchestrator.py +105 -25
- package/core/launch_phases/worker_prior.py +115 -0
- package/core/ledger/README.md +2 -1
- package/core/ledger/SPEC.md +1 -1
- package/core/ledger/_facade.py +2 -1
- package/core/ledger/archive_ops.py +60 -2
- package/core/ledger/cli.py +6 -1
- package/core/ledger/export_ops.py +6 -1
- package/core/ledger/finding_confirmation.py +48 -6
- package/core/ledger/finding_lifecycle.py +428 -5
- package/core/ledger/finding_verification.py +555 -10
- package/core/ledger/fp_ledger.py +255 -0
- package/core/ledger/incidents.py +10 -4
- package/core/ledger/patterns.py +10 -7
- package/core/ledger/receipt_contract.py +17 -1
- package/core/ledger/sync_ops.py +21 -16
- package/core/ledger/tool_experience.py +2 -1
- package/core/ledger/verify_life.py +88 -17
- package/core/locales/en-US.json +2 -2
- package/core/locales/zh-CN.json +2 -2
- package/core/mcp_handlers/SPEC.md +1 -1
- package/core/mcp_handlers/base.py +23 -3
- package/core/mcp_handlers/channel_lifecycle.py +85 -30
- package/core/mcp_handlers/retrieval_handlers.py +11 -1
- package/core/mcp_handlers/rpc_server.py +6 -1
- package/core/mcp_handlers/supervisor_handlers.py +32 -6
- package/core/mcp_handlers/tool_table.py +15 -0
- package/core/mcp_runtime_support/environment.py +0 -38
- package/core/mcp_runtime_support/verifier.py +0 -52
- package/core/metadata.txt +2 -3
- package/core/planning/README.md +2 -1
- package/core/planning/domain_router.py +4 -2
- package/core/planning/dynamic_flow_analyzer.py +219 -14
- package/core/planning/judge_pipeline.py +87 -4
- package/core/planning/prompt_harness.py +57 -15
- package/core/planning/prompt_policy_engine.py +386 -0
- package/core/planning/spec_harvester.py +4 -4
- package/core/probes/INTERFACE.md +11 -1
- package/core/probes/SPEC.md +11 -1
- package/core/probes/__init__.py +46 -40
- package/core/probes/android_probe.py +177 -9
- package/core/probes/codebase_memory_probe.py +57 -0
- package/core/probes/desktop_probe.py +104 -0
- package/core/probes/differential_probe.py +99 -21
- package/core/probes/efficiency_probe.py +64 -0
- package/core/probes/ios_binary_probe.py +105 -1
- package/core/probes/memory_probe.py +66 -0
- package/core/probes/miniprogram_probe.py +75 -13
- package/core/probes/mobile_probe.py +215 -30
- package/core/probes/native_probe.py +88 -0
- package/core/probes/openwiki_probe.py +70 -0
- package/core/probes/pattern_probe.py +106 -0
- package/core/probes/platform_probe.py +81 -0
- package/core/probes/probe_registry.py +108 -7
- package/core/probes/sast_fixture_corpus.py +340 -0
- package/core/probes/sast_probe.py +553 -52
- package/core/probes/sast_rules.py +668 -28
- package/core/probes/sca_scanner.py +48 -0
- package/core/probes/ui_accessibility.py +149 -0
- package/core/probes/ui_audit.py +513 -0
- package/core/probes/ui_contract.py +273 -0
- package/core/probes/ui_evidence.py +212 -0
- package/core/probes/ui_measurements.py +314 -0
- package/core/probes/ui_repair.py +250 -0
- package/core/probes/ui_review.py +133 -0
- package/core/probes/ui_storybook.py +107 -0
- package/core/probes/ui_tokens.py +185 -0
- package/core/probes/ui_visual_diff.py +131 -0
- package/core/probes/web_probe.py +373 -18
- package/core/project_profiler/SPEC.md +1 -1
- package/core/project_profiler/arbitrator.py +6 -1
- package/core/project_profiler/detector.py +8 -1
- package/core/project_profiler/strategy.py +51 -15
- package/core/prompts/README.md +4 -2
- package/core/prompts/command_routing_en.md +2 -2
- package/core/prompts/command_routing_zh.md +2 -2
- package/core/prompts/policies/prompt_policies.json +101 -0
- package/core/prompts/stages/stage_repair.md +1 -1
- package/core/prompts/stages/stage_verify.defensive.md +42 -0
- package/core/prompts/stages/stage_verify.md +44 -0
- package/core/repair/README.md +1 -1
- package/core/repair/l7_repair_loop.py +1 -4
- package/core/repair/rsi_fixer.py +4 -4
- package/core/repair/rsi_loop.py +1 -3
- package/core/repair/rsi_repair.py +7 -7
- package/core/repair/rsi_scope.py +27 -8
- package/core/report_engine/SPEC.md +1 -1
- package/core/report_engine/attestation.py +8 -4
- package/core/report_engine/finding_report.py +2 -1
- package/core/report_engine/models.py +7 -9
- package/core/report_engine/report_share.py +0 -8
- package/core/report_engine/sast_bridge.py +2 -2
- package/core/report_engine/server.py +18 -8
- package/core/report_engine/web-conformance.md +123 -18
- package/core/report_engine/web_conformance.py +21 -52
- package/core/retrieval/README.md +2 -1
- package/core/retrieval/SPEC.md +1 -1
- package/core/retrieval/code_analyzer.py +50 -14
- package/core/retrieval/context_assembler.py +7 -1
- package/core/retrieval/knowledge_sync.py +108 -14
- package/core/retrieval/pitfall_packs.py +277 -0
- package/core/retrieval/symbol_index.py +25 -6
- package/core/retrieval/universal_code_matcher.py +234 -49
- package/core/runtime/README.md +1 -1
- package/core/runtime/bugx_logging.py +78 -7
- package/core/runtime/fixture_solidify.py +5 -10
- package/core/runtime/global_telemetry.py +20 -0
- package/core/runtime/incident_eval.py +1 -1
- package/core/runtime/model_runner.py +4 -41
- package/core/runtime/platform_adapter.py +2 -2
- package/core/runtime/prep_validate.py +4 -2
- package/core/runtime/project_settings.py +2 -1
- package/core/runtime/scenario_eval.py +50 -8
- package/core/skills/bugx_docs_mcp_server.py +3 -1
- package/core/skills/bugx_mcp_server.py +29 -2
- package/core/skills/tools_kb.py +1 -1
- package/core/supervisor/README.md +1 -1
- package/core/supervisor/SPEC.md +1 -1
- package/core/supervisor/budget_governor.py +503 -9
- package/core/supervisor/checkpoint_pipeline.py +248 -6
- package/core/supervisor/checkpoint_sync.py +13 -0
- package/core/supervisor/claim_events.py +1 -1
- package/core/supervisor/finding_workflow.py +22 -5
- package/core/supervisor/lease_manager.py +1 -1
- package/core/supervisor/lifecycle_blocks.py +6 -1
- package/core/supervisor/rejection_remedies.py +52 -5
- package/core/supervisor/serial_authorization.py +48 -4
- package/core/supervisor/task_scheduler.py +2 -2
- package/core/supervisor/worker_checkpoint.py +8 -1
- package/core/supervisor/worker_runtime.py +8 -2
- package/core/supervisor_types/worker_claim.py +9 -0
- package/core/webui/README.md +1 -1
- package/core/webui/SPEC.md +2 -1
- package/core/webui/adapters/claude.py +5 -1
- package/core/webui/adapters/cline.py +10 -2
- package/core/webui/adapters/codex.py +5 -1
- package/core/webui/adapters/dsh.py +5 -1
- package/core/webui/docs_session_service.py +2 -2
- package/core/webui/mcp_inspector.py +11 -7
- package/core/webui/static/00-base.css +1060 -0
- package/core/webui/static/01-monitoring.css +802 -0
- package/core/webui/static/02-header-actions.css +321 -0
- package/core/webui/static/03-trigger-popover.css +697 -0
- package/core/webui/static/04-composer.css +628 -0
- package/core/webui/static/05-skills-center.css +878 -0
- package/core/webui/static/06-mcp-center.css +623 -0
- package/core/webui/static/07-skill-detail.css +265 -0
- package/core/webui/static/08-files-management.css +167 -0
- package/core/webui/static/09-files-center.css +386 -0
- package/core/webui/static/10-icons.css +105 -0
- package/core/webui/static/11-project-options.css +185 -0
- package/core/webui/static/12-profile-tab.css +383 -0
- package/core/webui/static/design-tokens.css +113 -0
- package/core/webui/static/index.html +14 -1
- package/core/webui/workspace_service.py +1 -1
- package/docs/07_distribution/01_README_NPM.md +193 -185
- package/ecosystem/integrations/README.md +1 -1
- package/ecosystem/integrations/dsh/mcp/package.json +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 +4 -4
- package/ecosystem/integrations/opencode/mcp-lock.json +14 -6
- package/ecosystem/integrations/opencode/opencode.json +23 -12
- package/ecosystem/integrations/pi/extensions/bugx/manifest.json +1 -1
- package/ecosystem/integrations/qoder/connector-meta.json +1 -1
- package/ecosystem/integrations/workbuddy/connector-meta.json +1 -1
- package/ecosystem/integrations/workbuddy/skills/bugx/SKILL.md +1 -1
- package/ecosystem/plugins/bugx/.claude-plugin/plugin.json +1 -1
- package/ecosystem/plugins/bugx/.codex-plugin/plugin.json +1 -1
- package/ecosystem/plugins/bugx/.zcode-plugin/plugin.json +1 -1
- package/ecosystem/plugins/bugx/skills/bugx/SKILL.md +2 -2
- 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 +37 -0
- package/interfaces/cli/bugx_cli/__init__.py +4 -2
- package/interfaces/cli/bugx_cli/cli.py +172 -69
- package/interfaces/cli/bugx_cli/commands/advisory.py +1 -1
- package/interfaces/cli/bugx_cli/commands/agent.py +461 -134
- package/interfaces/cli/bugx_cli/commands/audit.py +10 -9
- package/interfaces/cli/bugx_cli/commands/autonomous.py +1 -1
- package/interfaces/cli/bugx_cli/commands/cloud.py +31 -22
- package/interfaces/cli/bugx_cli/commands/doctor.py +449 -204
- package/interfaces/cli/bugx_cli/commands/interaction.py +5 -1
- package/interfaces/cli/bugx_cli/commands/knowledge.py +5 -4
- package/interfaces/cli/bugx_cli/commands/lifecycle.py +3 -3
- package/interfaces/cli/bugx_cli/commands/plugin.py +58 -23
- package/interfaces/cli/bugx_cli/commands/plugin_claude.py +7 -7
- package/interfaces/cli/bugx_cli/commands/plugin_funide.py +2 -1
- package/interfaces/cli/bugx_cli/commands/plugin_zcode.py +1 -1
- package/interfaces/cli/bugx_cli/commands/project.py +6 -13
- package/interfaces/cli/bugx_cli/commands/report.py +2 -6
- package/interfaces/cli/bugx_cli/commands/system.py +524 -169
- package/interfaces/cli/bugx_cli/common.py +21 -15
- package/interfaces/cli/bugx_cli/host_adapters.py +29 -54
- package/interfaces/cli/bugx_cli/hosts/registry.py +8 -6
- package/interfaces/cli/bugx_cli/infra/ai_advisor.py +157 -27
- package/interfaces/cli/bugx_cli/infra/engine_installer.py +35 -16
- package/interfaces/cli/bugx_cli/infra/host_sync.py +11 -8
- package/interfaces/cli/bugx_cli/infra/mcp_advisor.py +76 -5
- package/interfaces/cli/bugx_cli/infra/security.py +13 -6
- package/package.json +30 -15
- package/pyproject.toml +60 -9
- package/scripts/ensure-python.mjs +7 -7
- package/scripts/sync-version.mjs +10 -21
- package/scripts/test-npm-wrapper.mjs +1 -1
- package/core/assets/bugx-hero-cn.png +0 -0
- package/core/assets/bugx-hero-en.png +0 -0
- package/core/webui/static/project-settings.css +0 -6458
- package/docs/07_distribution/README.md +0 -16
- package/docs/README.md +0 -121
- package/interfaces/README.md +0 -143
- package/interfaces/bin/README.md +0 -35
- package/interfaces/cli/README.md +0 -90
- package/scripts/README.md +0 -118
|
@@ -34,12 +34,14 @@ _TOOL_COUNT_CLAMP = 10 ** 6
|
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
def _tool_experience_level_for(lifecycles: int) -> str:
|
|
37
|
-
"""独立 lifecycle 数 →
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
37
|
+
"""独立 lifecycle 数 → 经验等级(单源委托)。
|
|
38
|
+
|
|
39
|
+
F-RSI-20261115-194 二次修正:F-138 修正时误判「ledger 无同名阈值函数」
|
|
40
|
+
——实际 core.ledger.tool_experience.tool_experience_level(hit_lifecycles)
|
|
41
|
+
真实存在且阈值一致(≥2 active / 1 candidate / else unproven)。此处直接
|
|
42
|
+
委托单源实现,消除双源漂移风险。"""
|
|
43
|
+
from core.ledger.tool_experience import tool_experience_level
|
|
44
|
+
return tool_experience_level(lifecycles)
|
|
43
45
|
|
|
44
46
|
|
|
45
47
|
def _tool_state_version(sync_states: Mapping[tuple[str, str], Mapping[str, Any]],
|
|
@@ -135,7 +137,7 @@ def _merge_tool_experience(tools: list[dict[str, Any]],
|
|
|
135
137
|
def _private_v2_records(ns, ledger: Path, *, detail_mode: str,
|
|
136
138
|
sync_states: dict[tuple[str, str], dict[str, Any]] | None = None,
|
|
137
139
|
layer: str | None = None,
|
|
138
|
-
policy: str = "
|
|
140
|
+
policy: str = "redact") -> dict[str, Any]:
|
|
139
141
|
"""Apply private-sync policy, then fill the strict V2 wire fields.
|
|
140
142
|
|
|
141
143
|
DOC-211:policy 三档(block/redact/allow)。redact 的 span 脱敏必须在
|
|
@@ -304,7 +306,7 @@ def replay_local_pending_outbox(root: Path, client: Any, ns, account_id: str) ->
|
|
|
304
306
|
result = push_layer(
|
|
305
307
|
client, ns, root, layer, proj_id, account_id,
|
|
306
308
|
detail_mode=sync_cfg.get("sync_detail_mode"),
|
|
307
|
-
sensitive_policy=sync_cfg.get("sensitive_policy") or "
|
|
309
|
+
sensitive_policy=sync_cfg.get("sensitive_policy") or "redact",
|
|
308
310
|
_conflict_retried=False, _allow_rebase=False,
|
|
309
311
|
)
|
|
310
312
|
if result.get("ok"):
|
|
@@ -392,7 +394,7 @@ def _chunk_records(records: Mapping[str, list]) -> list[dict[str, list]]:
|
|
|
392
394
|
|
|
393
395
|
def push_layer(client, ns, root: Path, layer: str, project_id: str,
|
|
394
396
|
account_id: str, *, detail_mode: str,
|
|
395
|
-
sensitive_policy: str = "
|
|
397
|
+
sensitive_policy: str = "redact",
|
|
396
398
|
_conflict_retried: bool = False,
|
|
397
399
|
_allow_rebase: bool = True) -> dict[str, Any]:
|
|
398
400
|
# F1 通用硬闸门:任何入口(sync_layers / onboarding outbox 重放 / 未来新增调用)
|
|
@@ -559,7 +561,7 @@ def push_layer(client, ns, root: Path, layer: str, project_id: str,
|
|
|
559
561
|
upgrade_hint = (
|
|
560
562
|
f"请升级 BugX 客户端至 {err.min_client_version or '0.6.1'}+ 并重建全局引擎。\n"
|
|
561
563
|
f" 推荐执行:bugx update\n"
|
|
562
|
-
f" 或手动执行:pip install --upgrade bugx-
|
|
564
|
+
f" 或手动执行:pip install --upgrade bugx-cli && bugx install --force"
|
|
563
565
|
)
|
|
564
566
|
store.record_scope_error(account_id, layer, project_id,
|
|
565
567
|
error_code=err.code or "SYNC_PROTOCOL_UPGRADE_REQUIRED",
|
|
@@ -142,7 +142,8 @@ Worker stdio 通道可补齐遗漏的 `caller_role`,但显式错误角色仍
|
|
|
142
142
|
5. 在覆盖清单中记录负责人、工具、证据和状态。
|
|
143
143
|
|
|
144
144
|
Web 项目必须额外加入 `web-standards` 审计轨道,先运行
|
|
145
|
-
`web_conformance.py check --root <dir>`,再用
|
|
145
|
+
`web_conformance.py check --root <dir>`,再用 `bugx probe ui --root <dir> --url <URL>`
|
|
146
|
+
或项目浏览器测试补动态证据。
|
|
146
147
|
该轨道的 Oracle 是 WCAG 2.2 AA、WAI-ARIA 1.2 和 HTML/WHATWG 语义;缺少动态环境只能
|
|
147
148
|
标记 `BLOCKED/UNVERIFIED`,不能声称 Web 标准完整通过。具体规则见
|
|
148
149
|
全局引擎 `web-conformance.md`(用 `bugx engine path --name web-conformance.md` 定位)。
|
|
@@ -215,15 +216,11 @@ lease 返回独立 `artifact_root`,Worker 只能向该目录写证据,超出
|
|
|
215
216
|
|
|
216
217
|
Worker 内按 `IntentHypothesis → LogicChain → OracleSpec → EvidencePacket` 建立并校验逻辑分析包(`logic_analysis.py validate` / `bugx logic-analysis bind`),包状态仅作任务绑定,不改变租约或结算;最终 Finding 仍由 `finding_confirmation` 裁决。`checkpoint` 提交前对照 `core/schemas/worker-checkpoint.schema.json` 自检(`findings[].fingerprint` / `covered[].evidence` / `signatures≤10`),`budget` 类失败不得伪造 `fixed`。
|
|
217
218
|
|
|
218
|
-
## 6.
|
|
219
|
+
## 6. 验证策略
|
|
219
220
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
- 定向测试:`python3 -m unittest tests.test_x` 或 `bugx test --affected`(只运行受影响模块);
|
|
225
|
-
- `--mode quick`:编译检查和关键模块,适合每次修改后的快速反馈;
|
|
226
|
-
- **全量测试职责归属**:全量测试套件(`--mode all-units` / `bash tests/run_tests.sh`)**仅由宿主在所有修复落盘、发版发布门禁或用户明确要求时集中统一跑一次**,任何 Worker、修复 Agent 或日常单点验证绝对禁止自行触发!
|
|
221
|
+
验证优先使用最小、可审计的静态检查、协议检查或仓库外临时测试。临时测试只服务当前
|
|
222
|
+
变更,验证结束后必须物理删除;本仓库不保留 `tests/` 套件、测试注册表或仓库级测试执行器。
|
|
223
|
+
目标项目自带的 `tests/` 仍是 BugX 的被测输入,不属于本仓库过程文件。
|
|
227
224
|
|
|
228
225
|
- 纯函数/转换:边界、属性、类型、空值、异常和变异测试。
|
|
229
226
|
- 状态机/生命周期:合法与非法迁移、重复操作、取消、超时、恢复和幂等。
|
package/core/contracts/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# BugX 智能体执行协议与交互契约子系统 (Agent Runtime Contracts & Protocols)
|
|
2
2
|
|
|
3
|
-
> **版本契约**: `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
|
-
> **守卫机制**: `scripts/verify_directory_indices.py`
|
|
5
|
+
> **守卫机制**: `scripts/verify_directory_indices.py` (100% 索引对齐防漂移)
|
|
6
6
|
|
|
7
7
|
本文档定义 BugX 运行于各大主流宿主(Claude, Cline, OpenCode, Codex, Pi, Qoder 等)以及并发 Worker 执行时的核心提示词契约、生命周期控制协议与人机交互规范。
|
|
8
8
|
|
|
@@ -382,9 +382,92 @@ def oracle_suggest(root: Path, query: str, *, limit: int = MAX_ORACLE_RESULTS) -
|
|
|
382
382
|
return result
|
|
383
383
|
|
|
384
384
|
|
|
385
|
+
def is_available(root: Path | None = None) -> tuple[bool, str]:
|
|
386
|
+
"""降级契约:机械探活契约状态前提(项目根存在且可写,零子进程)。
|
|
387
|
+
|
|
388
|
+
本模块只用标准库、不执行命令;唯一的落盘前提是项目根存在且可写,
|
|
389
|
+
使 ``.bugx/state`` 下的 harness/oracle 契约工件可创建。前提不满足时
|
|
390
|
+
调用方必须走 ``run_static_degraded``,禁止伪装契约工件已持久化。
|
|
391
|
+
"""
|
|
392
|
+
base = (Path(root) if root is not None else Path.cwd()).resolve()
|
|
393
|
+
if not base.is_dir():
|
|
394
|
+
return False, f"项目根不存在: {base}"
|
|
395
|
+
if not os.access(base, os.W_OK):
|
|
396
|
+
return False, f"项目根不可写,契约状态({_state_root(base)})无法落盘"
|
|
397
|
+
return True, f"契约状态根可用: {_state_root(base)}"
|
|
398
|
+
|
|
399
|
+
|
|
400
|
+
def run_static_degraded(
|
|
401
|
+
bundle: Mapping[str, object] | None = None,
|
|
402
|
+
*,
|
|
403
|
+
root: Path | None = None,
|
|
404
|
+
) -> dict[str, object]:
|
|
405
|
+
"""降级契约:bundle 缺失或校验失败时返回结构化降级裁决,不抛 ContractError。
|
|
406
|
+
|
|
407
|
+
输出与成功路径(``validate_evidence_bundle`` 的校验通过产物)字段级可区分:
|
|
408
|
+
``status="degraded"`` + ``degraded=True`` + ``degraded_reason``;调用方
|
|
409
|
+
拿到机器可读的裁决而非异常,且任何失败原因都显式落字段,绝不静默吞错。
|
|
410
|
+
"""
|
|
411
|
+
available, availability_detail = is_available(root)
|
|
412
|
+
if bundle is None:
|
|
413
|
+
return {
|
|
414
|
+
"schema_version": SCHEMA_VERSION,
|
|
415
|
+
"success": False,
|
|
416
|
+
"status": "degraded",
|
|
417
|
+
"degraded": True,
|
|
418
|
+
"degraded_reason": "evidence_bundle_missing",
|
|
419
|
+
"probe_mode": "static_degraded",
|
|
420
|
+
"findings": [],
|
|
421
|
+
"evidence": {"availability_detail": availability_detail},
|
|
422
|
+
"metadata": {
|
|
423
|
+
"degraded_mode": "contract_metadata_only",
|
|
424
|
+
"validator": "validate_evidence_bundle",
|
|
425
|
+
},
|
|
426
|
+
}
|
|
427
|
+
try:
|
|
428
|
+
verdict = validate_evidence_bundle(bundle, root=root)
|
|
429
|
+
except (ContractError, TypeError, ValueError) as exc:
|
|
430
|
+
return {
|
|
431
|
+
"schema_version": SCHEMA_VERSION,
|
|
432
|
+
"success": False,
|
|
433
|
+
"status": "degraded",
|
|
434
|
+
"degraded": True,
|
|
435
|
+
"degraded_reason": "contract_validation_failed",
|
|
436
|
+
"probe_mode": "static_degraded",
|
|
437
|
+
"findings": [],
|
|
438
|
+
"evidence": {
|
|
439
|
+
"availability_detail": availability_detail,
|
|
440
|
+
"error": str(exc),
|
|
441
|
+
"error_type": exc.__class__.__name__,
|
|
442
|
+
},
|
|
443
|
+
"metadata": {
|
|
444
|
+
"degraded_mode": "contract_metadata_only",
|
|
445
|
+
"validator": "validate_evidence_bundle",
|
|
446
|
+
},
|
|
447
|
+
}
|
|
448
|
+
return {
|
|
449
|
+
"schema_version": SCHEMA_VERSION,
|
|
450
|
+
"success": True,
|
|
451
|
+
"status": "degraded",
|
|
452
|
+
"degraded": True,
|
|
453
|
+
"degraded_reason": (
|
|
454
|
+
"static_mode_forced" if available else "state_root_unwritable"
|
|
455
|
+
),
|
|
456
|
+
"probe_mode": "static_degraded",
|
|
457
|
+
"validated": True,
|
|
458
|
+
"verdict": verdict,
|
|
459
|
+
"findings": [],
|
|
460
|
+
"evidence": {"availability_detail": availability_detail},
|
|
461
|
+
"metadata": {
|
|
462
|
+
"degraded_mode": "static_validation_only",
|
|
463
|
+
"state_persisted": bool(available),
|
|
464
|
+
},
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
|
|
385
468
|
__all__ = [
|
|
386
469
|
"ContractError", "discover_test_assets", "ensure_harness_registry",
|
|
387
|
-
"extract_oracle_candidates", "harness_snapshot", "
|
|
388
|
-
"oracle_suggest", "record_oracle",
|
|
389
|
-
"static_hit_contract", "validate_evidence_bundle",
|
|
470
|
+
"extract_oracle_candidates", "harness_snapshot", "is_available",
|
|
471
|
+
"mark_semantic_duplicates", "oracle_suggest", "record_oracle",
|
|
472
|
+
"run_static_degraded", "static_hit_contract", "validate_evidence_bundle",
|
|
390
473
|
]
|