cosmos-platform 1.6.0.dev1__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.
- cosmos_platform-1.6.0.dev1.dist-info/METADATA +150 -0
- cosmos_platform-1.6.0.dev1.dist-info/RECORD +541 -0
- cosmos_platform-1.6.0.dev1.dist-info/WHEEL +5 -0
- cosmos_platform-1.6.0.dev1.dist-info/entry_points.txt +2 -0
- cosmos_platform-1.6.0.dev1.dist-info/licenses/LICENSE +202 -0
- cosmos_platform-1.6.0.dev1.dist-info/top_level.txt +2 -0
- runtime/__init__.py +1 -0
- runtime/candidate/__init__.py +8 -0
- runtime/candidate/admission_gate.py +1776 -0
- runtime/certification/test_certify_opencode_identity.py +71 -0
- runtime/certification/test_certify_w304_windows_silence.py +888 -0
- runtime/certification/test_cosmos15_empirical.py +60 -0
- runtime/certification/test_cosmos_control_center.py +490 -0
- runtime/certification/test_cosmos_dogfood.py +143 -0
- runtime/certification/test_enforcement_census_lc16.py +1112 -0
- runtime/certification/test_eol_byte_stability_p001.py +394 -0
- runtime/certification/test_lc113_adapter_terminal_proofs.py +414 -0
- runtime/certification/test_live_certification_k3.py +622 -0
- runtime/certification/test_mcp_live_c4b.py +1210 -0
- runtime/certification/test_phase9_closeout.py +19 -0
- runtime/certification/test_preservation_census_lc17.py +1039 -0
- runtime/certification/test_self_hosting_cold_reconstruction.py +158 -0
- runtime/certification/test_self_hosting_conformance.py +18 -0
- runtime/certification/test_self_hosting_continuity.py +50 -0
- runtime/certification/test_self_hosting_environment.py +329 -0
- runtime/certification/test_self_hosting_learning.py +56 -0
- runtime/certification/test_self_hosting_two_generation.py +21 -0
- runtime/certification/test_truth_drift_lc18.py +557 -0
- runtime/certification/test_universal_binding_c3.py +770 -0
- runtime/certification/test_w101_attempt2.py +698 -0
- runtime/certification/test_w101_preservation.py +425 -0
- runtime/certification/test_w304_option_a_startup_liveness.py +1093 -0
- runtime/certification/test_w304_wedge_log_flood.py +468 -0
- runtime/certification/test_w304_wedge_recovery.py +258 -0
- runtime/cosmos_runtime/__init__.py +169 -0
- runtime/cosmos_runtime/__main__.py +3 -0
- runtime/cosmos_runtime/actors.py +363 -0
- runtime/cosmos_runtime/adaptive_reasoning.py +242 -0
- runtime/cosmos_runtime/authorization.py +567 -0
- runtime/cosmos_runtime/cli.py +61 -0
- runtime/cosmos_runtime/config.py +21 -0
- runtime/cosmos_runtime/context.py +347 -0
- runtime/cosmos_runtime/continuation.py +548 -0
- runtime/cosmos_runtime/continuity/__init__.py +16 -0
- runtime/cosmos_runtime/continuity/handoff.py +208 -0
- runtime/cosmos_runtime/controller.py +218 -0
- runtime/cosmos_runtime/effects.py +546 -0
- runtime/cosmos_runtime/execution.py +725 -0
- runtime/cosmos_runtime/execution_shim.py +428 -0
- runtime/cosmos_runtime/governance/__init__.py +60 -0
- runtime/cosmos_runtime/governance/completion.py +434 -0
- runtime/cosmos_runtime/governance/gates.py +952 -0
- runtime/cosmos_runtime/governance/scope_types.py +150 -0
- runtime/cosmos_runtime/ids.py +25 -0
- runtime/cosmos_runtime/intake.py +170 -0
- runtime/cosmos_runtime/learning.py +294 -0
- runtime/cosmos_runtime/model.py +240 -0
- runtime/cosmos_runtime/resilience.py +298 -0
- runtime/cosmos_runtime/security/__init__.py +72 -0
- runtime/cosmos_runtime/security/audit.py +139 -0
- runtime/cosmos_runtime/security/consent.py +153 -0
- runtime/cosmos_runtime/security/encryption.py +158 -0
- runtime/cosmos_runtime/security/enterprise_fence.py +169 -0
- runtime/cosmos_runtime/security/injection_detector.py +123 -0
- runtime/cosmos_runtime/security/microphone.py +145 -0
- runtime/cosmos_runtime/security/retention.py +168 -0
- runtime/cosmos_runtime/security/tenant.py +108 -0
- runtime/cosmos_runtime/services.py +187 -0
- runtime/cosmos_runtime/store.py +802 -0
- runtime/cosmos_runtime/telemetry/__init__.py +42 -0
- runtime/cosmos_runtime/telemetry/bus.py +198 -0
- runtime/cosmos_runtime/telemetry/events.py +187 -0
- runtime/cosmos_runtime/telemetry/scrubber.py +119 -0
- runtime/tests/__init__.py +11 -0
- runtime/tests/_pollution_guard.py +311 -0
- runtime/tests/_retrieval_fixtures.py +102 -0
- runtime/tests/_world_isolation.py +138 -0
- runtime/tests/conftest.py +56 -0
- runtime/tests/gate_local_support.py +234 -0
- runtime/tests/test_aaa_pollution_guard.py +218 -0
- runtime/tests/test_actor_routing.py +187 -0
- runtime/tests/test_adapter_family_agent_frameworks_activation.py +883 -0
- runtime/tests/test_adapter_family_cloud_coding_activation.py +1090 -0
- runtime/tests/test_adapter_family_core_cli_activation.py +2039 -0
- runtime/tests/test_adapter_family_emacs_activation.py +769 -0
- runtime/tests/test_adapter_family_ide_rules_activation.py +1016 -0
- runtime/tests/test_adapter_family_jetbrains_eclipse_activation.py +990 -0
- runtime/tests/test_adapter_family_neovim_activation.py +830 -0
- runtime/tests/test_adaptive_reasoning.py +115 -0
- runtime/tests/test_ar4_self_hosting_decoupling.py +49 -0
- runtime/tests/test_assurance_spine_c2.py +411 -0
- runtime/tests/test_authorization_gateway.py +203 -0
- runtime/tests/test_capability_reconciliation_lc14.py +257 -0
- runtime/tests/test_carrier_flow_k3.py +326 -0
- runtime/tests/test_cert_invalidation_k4.py +764 -0
- runtime/tests/test_certification_adversarial_v1.py +882 -0
- runtime/tests/test_claims_matrix_lc15.py +551 -0
- runtime/tests/test_completion.py +306 -0
- runtime/tests/test_context_binding.py +160 -0
- runtime/tests/test_continuation.py +269 -0
- runtime/tests/test_cosmos15_baseline.py +31 -0
- runtime/tests/test_cosmos15_claude_door.py +108 -0
- runtime/tests/test_cosmos15_developer_world.py +194 -0
- runtime/tests/test_cosmos15_observatory.py +286 -0
- runtime/tests/test_cosmos15_operator.py +329 -0
- runtime/tests/test_cosmos_admin.py +221 -0
- runtime/tests/test_cosmos_agent_directory_boundary.py +32 -0
- runtime/tests/test_cosmos_ask.py +119 -0
- runtime/tests/test_cosmos_blocker_gate.py +192 -0
- runtime/tests/test_cosmos_branch_audit.py +227 -0
- runtime/tests/test_cosmos_by_path.py +557 -0
- runtime/tests/test_cosmos_capability_health.py +651 -0
- runtime/tests/test_cosmos_certification.py +98 -0
- runtime/tests/test_cosmos_check_proposal.py +584 -0
- runtime/tests/test_cosmos_check_runner.py +578 -0
- runtime/tests/test_cosmos_check_runner_shard_s1.py +765 -0
- runtime/tests/test_cosmos_cloud_bundle.py +33 -0
- runtime/tests/test_cosmos_cold_clone_binding.py +106 -0
- runtime/tests/test_cosmos_context_authority.py +276 -0
- runtime/tests/test_cosmos_continuation.py +210 -0
- runtime/tests/test_cosmos_continuity.py +147 -0
- runtime/tests/test_cosmos_continuity_demo.py +93 -0
- runtime/tests/test_cosmos_continuity_hook.py +453 -0
- runtime/tests/test_cosmos_controller.py +125 -0
- runtime/tests/test_cosmos_cross_harness_handoff.py +93 -0
- runtime/tests/test_cosmos_current_task_derivation.py +202 -0
- runtime/tests/test_cosmos_decision_guard.py +179 -0
- runtime/tests/test_cosmos_decisions.py +161 -0
- runtime/tests/test_cosmos_defensibility_qualification.py +135 -0
- runtime/tests/test_cosmos_delta.py +512 -0
- runtime/tests/test_cosmos_delta_cli.py +196 -0
- runtime/tests/test_cosmos_dependency_graph.py +94 -0
- runtime/tests/test_cosmos_dependency_graph_scope.py +67 -0
- runtime/tests/test_cosmos_deployment_reconciler.py +213 -0
- runtime/tests/test_cosmos_doctor_command_shadowing.py +61 -0
- runtime/tests/test_cosmos_doorway_validator.py +139 -0
- runtime/tests/test_cosmos_enforce.py +222 -0
- runtime/tests/test_cosmos_events.py +77 -0
- runtime/tests/test_cosmos_evidence.py +122 -0
- runtime/tests/test_cosmos_execution_shim.py +254 -0
- runtime/tests/test_cosmos_feedback.py +97 -0
- runtime/tests/test_cosmos_gate.py +3007 -0
- runtime/tests/test_cosmos_gate_backlog.py +218 -0
- runtime/tests/test_cosmos_gate_categories.py +240 -0
- runtime/tests/test_cosmos_gate_f008.py +386 -0
- runtime/tests/test_cosmos_gate_fast.py +3527 -0
- runtime/tests/test_cosmos_gate_governance.py +196 -0
- runtime/tests/test_cosmos_gate_lessons.py +113 -0
- runtime/tests/test_cosmos_gate_load.py +283 -0
- runtime/tests/test_cosmos_gate_multi.py +357 -0
- runtime/tests/test_cosmos_gate_override.py +114 -0
- runtime/tests/test_cosmos_gate_profile.py +271 -0
- runtime/tests/test_cosmos_gate_recheck.py +134 -0
- runtime/tests/test_cosmos_gate_runtime.py +304 -0
- runtime/tests/test_cosmos_gate_selfcheck.py +27 -0
- runtime/tests/test_cosmos_gate_skip.py +95 -0
- runtime/tests/test_cosmos_git_hooks.py +117 -0
- runtime/tests/test_cosmos_guard.py +938 -0
- runtime/tests/test_cosmos_harness_doors.py +50 -0
- runtime/tests/test_cosmos_hygiene.py +76 -0
- runtime/tests/test_cosmos_hypothesis.py +106 -0
- runtime/tests/test_cosmos_index_hot_journal.py +108 -0
- runtime/tests/test_cosmos_landing_board.py +228 -0
- runtime/tests/test_cosmos_learn.py +92 -0
- runtime/tests/test_cosmos_levels_of_done.py +67 -0
- runtime/tests/test_cosmos_lineage.py +157 -0
- runtime/tests/test_cosmos_mcp_binding.py +182 -0
- runtime/tests/test_cosmos_mcp_governed_tools.py +185 -0
- runtime/tests/test_cosmos_mcp_registration.py +430 -0
- runtime/tests/test_cosmos_memory_maintenance.py +81 -0
- runtime/tests/test_cosmos_modality_registry.py +52 -0
- runtime/tests/test_cosmos_narrative.py +189 -0
- runtime/tests/test_cosmos_navigator_product_path.py +56 -0
- runtime/tests/test_cosmos_next.py +669 -0
- runtime/tests/test_cosmos_no_raw_process_start.py +92 -0
- runtime/tests/test_cosmos_objective_convergence.py +86 -0
- runtime/tests/test_cosmos_obligation_lc03.py +745 -0
- runtime/tests/test_cosmos_obligations.py +302 -0
- runtime/tests/test_cosmos_observe.py +100 -0
- runtime/tests/test_cosmos_onboarding.py +224 -0
- runtime/tests/test_cosmos_override_gate.py +288 -0
- runtime/tests/test_cosmos_packaging_billing_gate.py +396 -0
- runtime/tests/test_cosmos_pilot.py +165 -0
- runtime/tests/test_cosmos_popup_check.py +75 -0
- runtime/tests/test_cosmos_proc_owned_tree.py +249 -0
- runtime/tests/test_cosmos_project_adapters.py +158 -0
- runtime/tests/test_cosmos_push.py +178 -0
- runtime/tests/test_cosmos_qualification.py +94 -0
- runtime/tests/test_cosmos_remediation.py +67 -0
- runtime/tests/test_cosmos_report.py +99 -0
- runtime/tests/test_cosmos_retrieval.py +512 -0
- runtime/tests/test_cosmos_retrieval_cli_mcp.py +198 -0
- runtime/tests/test_cosmos_retrieval_model_fetch.py +40 -0
- runtime/tests/test_cosmos_safety.py +528 -0
- runtime/tests/test_cosmos_security_package.py +417 -0
- runtime/tests/test_cosmos_security_qualification.py +59 -0
- runtime/tests/test_cosmos_self_repair.py +504 -0
- runtime/tests/test_cosmos_serving.py +153 -0
- runtime/tests/test_cosmos_session_lifecycle.py +181 -0
- runtime/tests/test_cosmos_session_start.py +493 -0
- runtime/tests/test_cosmos_settings_hooks.py +36 -0
- runtime/tests/test_cosmos_speed_limits.py +36 -0
- runtime/tests/test_cosmos_staging_qualification.py +117 -0
- runtime/tests/test_cosmos_stop_guard.py +84 -0
- runtime/tests/test_cosmos_studio.py +1102 -0
- runtime/tests/test_cosmos_substrate_liveness.py +111 -0
- runtime/tests/test_cosmos_supply_chain_gate.py +238 -0
- runtime/tests/test_cosmos_synthetic_pilot.py +46 -0
- runtime/tests/test_cosmos_telemetry.py +65 -0
- runtime/tests/test_cosmos_telemetry_bus.py +157 -0
- runtime/tests/test_cosmos_telemetry_scrubber.py +124 -0
- runtime/tests/test_cosmos_tracker_render.py +95 -0
- runtime/tests/test_cosmos_trigger_records.py +198 -0
- runtime/tests/test_cosmos_tripartite_delta.py +154 -0
- runtime/tests/test_cosmos_tripartite_events.py +103 -0
- runtime/tests/test_cosmos_trust_readiness.py +375 -0
- runtime/tests/test_cosmos_vault.py +3524 -0
- runtime/tests/test_cosmos_vault_entry_points.py +920 -0
- runtime/tests/test_cosmos_vault_worker.py +1450 -0
- runtime/tests/test_cosmos_visibility_policy.py +187 -0
- runtime/tests/test_cosmos_wake.py +43 -0
- runtime/tests/test_cosmos_watchdog.py +1318 -0
- runtime/tests/test_cosmos_world_refresh_and_capture.py +711 -0
- runtime/tests/test_cosmos_wrong_direction.py +214 -0
- runtime/tests/test_cosmos_zero_step.py +245 -0
- runtime/tests/test_daemon_supervisor_c5b.py +845 -0
- runtime/tests/test_enforcement_live_c4.py +485 -0
- runtime/tests/test_execution_loop.py +216 -0
- runtime/tests/test_foundation.py +145 -0
- runtime/tests/test_governance_gates.py +327 -0
- runtime/tests/test_intake.py +107 -0
- runtime/tests/test_invalidationscan_k4.py +776 -0
- runtime/tests/test_lc112_live_attestation_commission.py +292 -0
- runtime/tests/test_lc133_lp2_entry_points.py +268 -0
- runtime/tests/test_lc1_baseline_lc19.py +702 -0
- runtime/tests/test_levels_of_done_k1.py +474 -0
- runtime/tests/test_live_attestation_k2.py +521 -0
- runtime/tests/test_live_attestation_k2_regressions.py +442 -0
- runtime/tests/test_live_certification_k3_regressions.py +623 -0
- runtime/tests/test_lp7_studio_trigger.py +191 -0
- runtime/tests/test_master_plan_revision_identity.py +123 -0
- runtime/tests/test_multi_harness_acceptance.py +292 -0
- runtime/tests/test_multi_harness_stress.py +188 -0
- runtime/tests/test_objective_live_c1.py +437 -0
- runtime/tests/test_obligation_reconciliation_lc13.py +351 -0
- runtime/tests/test_observation_projection.py +156 -0
- runtime/tests/test_observation_wiring.py +100 -0
- runtime/tests/test_one_active_wave_lc06.py +629 -0
- runtime/tests/test_operational_sandbox_harness.py +111 -0
- runtime/tests/test_p002_canonical_engine.py +275 -0
- runtime/tests/test_p003_watcher_failure_attribution.py +933 -0
- runtime/tests/test_phase8_closeout.py +89 -0
- runtime/tests/test_phase8_company_environment.py +84 -0
- runtime/tests/test_phase8_company_proof.py +278 -0
- runtime/tests/test_phase8_cross_environment_audit.py +89 -0
- runtime/tests/test_phase8_developer_environment.py +59 -0
- runtime/tests/test_phase8_developer_proof.py +204 -0
- runtime/tests/test_phase8_harness.py +66 -0
- runtime/tests/test_phase8_personal_environment.py +62 -0
- runtime/tests/test_phase8_personal_proof.py +105 -0
- runtime/tests/test_phase8_protocol.py +180 -0
- runtime/tests/test_plan_before_code_lc04.py +830 -0
- runtime/tests/test_plan_census_lc12.py +243 -0
- runtime/tests/test_repo_census_lc11.py +230 -0
- runtime/tests/test_resilience.py +182 -0
- runtime/tests/test_retrieval_live_c5.py +270 -0
- runtime/tests/test_run_monitor_s2.py +587 -0
- runtime/tests/test_runtime_conformance.py +389 -0
- runtime/tests/test_sandbox_adapters.py +238 -0
- runtime/tests/test_scale_acceptance.py +114 -0
- runtime/tests/test_scope_freeze_lc05.py +638 -0
- runtime/tests/test_self_hosting_first_change.py +69 -0
- runtime/tests/test_self_hosting_projection.py +145 -0
- runtime/tests/test_self_hosting_protocol.py +87 -0
- runtime/tests/test_siem_integration_harness.py +98 -0
- runtime/tests/test_sign_release_archive.py +141 -0
- runtime/tests/test_store_concurrency.py +118 -0
- runtime/tests/test_studio_broker_integration.py +147 -0
- runtime/tests/test_tiers_doc.py +54 -0
- runtime/tests/test_trigger_firing_c1.py +342 -0
- runtime/tests/test_verify_tripartite_observability.py +120 -0
- runtime/tests/test_w102_branch_audit_equivalence.py +334 -0
- runtime/tests/test_w102_git_timeout_hang.py +233 -0
- runtime/tests/test_w103_identity.py +378 -0
- runtime/tests/test_w103_real_harness_identity.py +159 -0
- runtime/tests/test_w103_review_correction.py +224 -0
- runtime/tests/test_w103_round2_consumption.py +304 -0
- runtime/tests/test_w304_silent_background.py +713 -0
- runtime/tests/test_wave_report_lc07.py +332 -0
- tools/__init__.py +5 -0
- tools/adapter_families/agent_frameworks.py +1418 -0
- tools/adapter_families/cloud_coding.py +875 -0
- tools/adapter_families/core_cli.py +2519 -0
- tools/adapter_families/emacs.py +1247 -0
- tools/adapter_families/ide_rules.py +1105 -0
- tools/adapter_families/jetbrains_eclipse.py +1381 -0
- tools/adapter_families/neovim.py +995 -0
- tools/build_cosmos15_release_archive.py +110 -0
- tools/catalogs/model-modalities.json +84 -0
- tools/catalogs/ui-ux-catalog.json +173 -0
- tools/control_center/app.js +78 -0
- tools/control_center/index.html +35 -0
- tools/control_center/styles.css +4 -0
- tools/cosmos.py +1018 -0
- tools/cosmos15_operator.py +980 -0
- tools/cosmos15_world_recovery.py +292 -0
- tools/cosmos_adapter_health.py +311 -0
- tools/cosmos_ask.py +102 -0
- tools/cosmos_attach.py +237 -0
- tools/cosmos_background.py +258 -0
- tools/cosmos_bind.py +764 -0
- tools/cosmos_binding.py +130 -0
- tools/cosmos_blocker_gate.py +285 -0
- tools/cosmos_branch_audit.py +315 -0
- tools/cosmos_capability_health.py +4202 -0
- tools/cosmos_capability_reconciliation.py +419 -0
- tools/cosmos_capture_hook.py +644 -0
- tools/cosmos_cert_invalidation.py +1673 -0
- tools/cosmos_certification.py +506 -0
- tools/cosmos_check_proposal.py +483 -0
- tools/cosmos_check_runner.py +2480 -0
- tools/cosmos_claims_matrix.py +851 -0
- tools/cosmos_claude_door.py +268 -0
- tools/cosmos_cloud_bundle.py +73 -0
- tools/cosmos_context_authority.py +515 -0
- tools/cosmos_continuation.py +315 -0
- tools/cosmos_continuity_demo.py +180 -0
- tools/cosmos_continuity_wrapper.py +194 -0
- tools/cosmos_control_center.py +476 -0
- tools/cosmos_curator.py +175 -0
- tools/cosmos_daemon_supervisor.py +3082 -0
- tools/cosmos_decision_guard.py +206 -0
- tools/cosmos_decision_rank.py +103 -0
- tools/cosmos_decisions.py +343 -0
- tools/cosmos_defensibility_qualification.py +322 -0
- tools/cosmos_delta.py +887 -0
- tools/cosmos_dependency_graph.py +235 -0
- tools/cosmos_deployment_reconciler.py +393 -0
- tools/cosmos_design_dna.py +377 -0
- tools/cosmos_developer_world.py +1233 -0
- tools/cosmos_doctor.py +427 -0
- tools/cosmos_door_common.py +16 -0
- tools/cosmos_door_helpers.py +54 -0
- tools/cosmos_doorway_validator.py +152 -0
- tools/cosmos_enforce.py +527 -0
- tools/cosmos_enforcement_census.py +2657 -0
- tools/cosmos_eval.py +310 -0
- tools/cosmos_events.py +123 -0
- tools/cosmos_evidence.py +135 -0
- tools/cosmos_feedback.py +252 -0
- tools/cosmos_forge_adapters.py +190 -0
- tools/cosmos_forge_protection.py +154 -0
- tools/cosmos_fs_watcher.py +1378 -0
- tools/cosmos_gate.py +3172 -0
- tools/cosmos_gate_backlog.py +294 -0
- tools/cosmos_gate_carry.py +122 -0
- tools/cosmos_gate_categories.py +159 -0
- tools/cosmos_gate_closure.py +56 -0
- tools/cosmos_gate_fast.py +2592 -0
- tools/cosmos_gate_governance.py +282 -0
- tools/cosmos_gate_holdout.py +704 -0
- tools/cosmos_gate_linux.py +203 -0
- tools/cosmos_gate_load.py +205 -0
- tools/cosmos_gate_override.py +82 -0
- tools/cosmos_gate_profile.py +169 -0
- tools/cosmos_gate_protect.py +79 -0
- tools/cosmos_gate_replacements.py +66 -0
- tools/cosmos_gate_runtime.py +123 -0
- tools/cosmos_gate_scope.py +110 -0
- tools/cosmos_gate_selfcheck.py +79 -0
- tools/cosmos_gate_service.py +591 -0
- tools/cosmos_gate_union.py +108 -0
- tools/cosmos_git_hooks.py +59 -0
- tools/cosmos_githooks.py +94 -0
- tools/cosmos_guard.py +1887 -0
- tools/cosmos_harness_doors.py +350 -0
- tools/cosmos_home_guard.py +199 -0
- tools/cosmos_hygiene.py +251 -0
- tools/cosmos_hypothesis.py +124 -0
- tools/cosmos_identity.py +295 -0
- tools/cosmos_invariants.py +212 -0
- tools/cosmos_landing_board.py +394 -0
- tools/cosmos_launch.py +432 -0
- tools/cosmos_launcher.py +177 -0
- tools/cosmos_lc1_baseline.py +776 -0
- tools/cosmos_learn.py +319 -0
- tools/cosmos_levels_of_done.py +740 -0
- tools/cosmos_lineage.py +201 -0
- tools/cosmos_live_attestation.py +1559 -0
- tools/cosmos_mcp_registration.py +625 -0
- tools/cosmos_mcp_server.py +2253 -0
- tools/cosmos_memory.py +273 -0
- tools/cosmos_memory_check.py +97 -0
- tools/cosmos_modality_registry.py +113 -0
- tools/cosmos_narrative.py +225 -0
- tools/cosmos_next.py +659 -0
- tools/cosmos_objective_convergence.py +167 -0
- tools/cosmos_obligations.py +2809 -0
- tools/cosmos_observation_projection.py +144 -0
- tools/cosmos_observe.py +353 -0
- tools/cosmos_opencode_push.js +164 -0
- tools/cosmos_overlay_injector.py +44 -0
- tools/cosmos_override_gate.py +550 -0
- tools/cosmos_packaging_billing_gate.py +314 -0
- tools/cosmos_packet.py +973 -0
- tools/cosmos_pilot.py +731 -0
- tools/cosmos_plan_census.py +634 -0
- tools/cosmos_popup_check.py +260 -0
- tools/cosmos_premise.py +327 -0
- tools/cosmos_preservation_census.py +2185 -0
- tools/cosmos_proc.py +639 -0
- tools/cosmos_project_adapters.py +2773 -0
- tools/cosmos_push.py +138 -0
- tools/cosmos_qualification.py +291 -0
- tools/cosmos_reachability.py +345 -0
- tools/cosmos_reconciliation.py +451 -0
- tools/cosmos_refresh_adapters.py +80 -0
- tools/cosmos_remediation.py +166 -0
- tools/cosmos_repo_census.py +640 -0
- tools/cosmos_repo_finder.py +217 -0
- tools/cosmos_report.py +134 -0
- tools/cosmos_retrieval/__init__.py +41 -0
- tools/cosmos_retrieval/__main__.py +4 -0
- tools/cosmos_retrieval/activation.py +564 -0
- tools/cosmos_retrieval/cli.py +274 -0
- tools/cosmos_retrieval/embedders.py +214 -0
- tools/cosmos_retrieval/index.py +884 -0
- tools/cosmos_retrieval/model_fetch.py +122 -0
- tools/cosmos_retrieval/text.py +243 -0
- tools/cosmos_retrieval/vectors.py +101 -0
- tools/cosmos_rollback.py +453 -0
- tools/cosmos_run_monitor.py +1198 -0
- tools/cosmos_safety.py +350 -0
- tools/cosmos_scorecard.py +466 -0
- tools/cosmos_security_qualification.py +202 -0
- tools/cosmos_self_repair.py +192 -0
- tools/cosmos_serving.py +339 -0
- tools/cosmos_session_brief.py +302 -0
- tools/cosmos_session_lifecycle.py +389 -0
- tools/cosmos_session_start.py +1894 -0
- tools/cosmos_setup.py +585 -0
- tools/cosmos_staging_qualification.py +252 -0
- tools/cosmos_stop_guard.py +111 -0
- tools/cosmos_studio_app.py +2225 -0
- tools/cosmos_supply_chain_gate.py +454 -0
- tools/cosmos_synthetic_pilot.py +215 -0
- tools/cosmos_telemetry.py +153 -0
- tools/cosmos_tracker_render.py +196 -0
- tools/cosmos_trust_readiness.py +607 -0
- tools/cosmos_truth_drift.py +1573 -0
- tools/cosmos_vault.py +2023 -0
- tools/cosmos_vault_acl.py +715 -0
- tools/cosmos_vault_bundle.py +438 -0
- tools/cosmos_vault_install.py +471 -0
- tools/cosmos_vault_service.py +345 -0
- tools/cosmos_vault_worker.py +745 -0
- tools/cosmos_visibility_policy.py +134 -0
- tools/cosmos_wake.py +262 -0
- tools/cosmos_watchdog.py +1775 -0
- tools/cosmos_watchdog_timing.py +100 -0
- tools/cosmos_wave_report.py +357 -0
- tools/cosmos_wrong_direction.py +217 -0
- tools/evaluate_assurance_risk.py +302 -0
- tools/generate_execution_stack_conformance_fixtures.py +122 -0
- tools/generate_execution_stack_envelope_fixtures.py +122 -0
- tools/generate_model_route_receipt_fixtures.py +320 -0
- tools/observatory/README.md +64 -0
- tools/observatory/app.js +486 -0
- tools/observatory/index.html +82 -0
- tools/observatory/launcher.css +249 -0
- tools/observatory/launcher.html +80 -0
- tools/observatory/launcher.js +173 -0
- tools/observatory/styles.css +83 -0
- tools/operational_sandbox_harness.py +481 -0
- tools/owner_requeue.py +402 -0
- tools/reference_authorization.py +427 -0
- tools/reference_cold_reconstruction.py +264 -0
- tools/reference_context_binder.py +570 -0
- tools/reference_cosmos15_empirical.py +208 -0
- tools/reference_dogfood_runner.py +166 -0
- tools/reference_environment_audit.py +332 -0
- tools/reference_environment_harness.py +764 -0
- tools/reference_environment_proof.py +206 -0
- tools/reference_first_self_change.py +342 -0
- tools/reference_generation_a_continuation.py +111 -0
- tools/reference_generation_b_continuation.py +102 -0
- tools/reference_knowledge_lifecycle.py +318 -0
- tools/reference_maintenance.py +399 -0
- tools/reference_observatory.py +848 -0
- tools/reference_phase8_closeout.py +249 -0
- tools/reference_phase9_closeout.py +138 -0
- tools/reference_repository_projection.py +689 -0
- tools/reference_self_hosting.py +245 -0
- tools/reference_self_hosting_conformance.py +118 -0
- tools/reference_self_hosting_continuity.py +227 -0
- tools/reference_self_hosting_environment.py +411 -0
- tools/reference_self_learning.py +284 -0
- tools/run_execution_stack_conformance.py +195 -0
- tools/schemas/cosmos-certification.schema.json +65 -0
- tools/schemas/cosmos-record.schema.json +2918 -0
- tools/schemas/enterprise-audit-export.schema.json +255 -0
- tools/schemas/enterprise-durability-recovery.schema.json +282 -0
- tools/schemas/enterprise-execution-sandbox.schema.json +241 -0
- tools/schemas/enterprise-identity-policy.schema.json +222 -0
- tools/schemas/enterprise-secrets.schema.json +243 -0
- tools/schemas/environment-pack.schema.json +184 -0
- tools/schemas/environment-proof-case.schema.json +131 -0
- tools/schemas/execution-stack-conformance.schema.json +132 -0
- tools/schemas/execution-stack-envelope.schema.json +161 -0
- tools/schemas/model-modality-profile.schema.json +66 -0
- tools/schemas/model-route-receipt.schema.json +71 -0
- tools/schemas/relation-type.schema.json +76 -0
- tools/schemas/release-manifest.schema.json +58 -0
- tools/schemas/self-hosting-contract.schema.json +143 -0
- tools/siem_integration_harness.py +413 -0
- tools/sign_release_archive.py +357 -0
- tools/spec/reveal-register.json +65 -0
- tools/spec/reveal-register.schema.json +41 -0
- tools/stitch_design_bridge.py +593 -0
- tools/studio/byom_router.js +101 -0
- tools/studio/ide.html +109 -0
- tools/studio/ide.js +62 -0
- tools/studio/index.html +23 -0
- tools/studio/modality_guard.js +101 -0
- tools/studio/observatory_dock.js +60 -0
- tools/studio/studio.css +489 -0
- tools/studio/studio.js +50 -0
- tools/studio/studio_concentric_live.png +0 -0
- tools/studio/studio_cosmos_canvas.png +0 -0
- tools/studio/studio_hero_live.png +0 -0
- tools/studio/studio_live.png +0 -0
- tools/studio/studio_preview.png +0 -0
- tools/studio/studio_refined_platform.png +0 -0
- tools/studio/subatomic_sidecar.js +57 -0
- tools/validate_environment_proof.py +39 -0
- tools/validate_execution_stack_envelopes.py +157 -0
- tools/validate_model_route_receipts.py +183 -0
- tools/validate_ontology.py +121 -0
- tools/verify_cosmos15_baseline.py +104 -0
- tools/verify_cosmos15_release_archive.py +225 -0
- tools/verify_tripartite_observability.py +136 -0
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"""Unit tests for the Enterprise Defensibility Qualification Suite (QUAL-002 / Track DEF).
|
|
2
|
+
|
|
3
|
+
Each track is checked against the actual backing module's real behavior, not
|
|
4
|
+
a description of intended behavior: Track 2 against tools.cosmos_binding's
|
|
5
|
+
real return shape, Track 3 against tools.cosmos_override_gate's real replay
|
|
6
|
+
defense, Track 5 against genuinely computed (not asserted) metrics. See the
|
|
7
|
+
module docstring in tools/cosmos_defensibility_qualification.py for why the
|
|
8
|
+
snapshot's original Track 2/3/5 checks were defective (fabricated or
|
|
9
|
+
mismatched against main) and had to be rewritten rather than imported as-is.
|
|
10
|
+
"""
|
|
11
|
+
from __future__ import annotations
|
|
12
|
+
|
|
13
|
+
import io
|
|
14
|
+
import json
|
|
15
|
+
import unittest
|
|
16
|
+
from contextlib import redirect_stdout
|
|
17
|
+
from pathlib import Path
|
|
18
|
+
from tempfile import TemporaryDirectory
|
|
19
|
+
|
|
20
|
+
from tools.cosmos_defensibility_qualification import (
|
|
21
|
+
EnterpriseDefensibilityQualifier,
|
|
22
|
+
EnterpriseDefensibilityReport,
|
|
23
|
+
run_cli,
|
|
24
|
+
write_defensibility_package,
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
try: # unittest discover -s runtime/tests
|
|
28
|
+
from _world_isolation import isolate_world, replace_defaults
|
|
29
|
+
except ImportError: # dotted / pytest import
|
|
30
|
+
from runtime.tests._world_isolation import isolate_world, replace_defaults
|
|
31
|
+
|
|
32
|
+
REPO_ROOT = Path(__file__).resolve().parents[2]
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class DefensibilityQualifierTests(unittest.TestCase):
|
|
36
|
+
def setUp(self):
|
|
37
|
+
tmp = TemporaryDirectory(prefix="cosmos-defensibility-test-")
|
|
38
|
+
self.addCleanup(tmp.cleanup)
|
|
39
|
+
self.root = Path(tmp.name)
|
|
40
|
+
isolate_world(self, self.root)
|
|
41
|
+
replace_defaults(self, EnterpriseDefensibilityQualifier.__init__, (self.root,))
|
|
42
|
+
self.qualifier = EnterpriseDefensibilityQualifier(self.root)
|
|
43
|
+
|
|
44
|
+
def test_track_1_sandbox_probes_pass(self):
|
|
45
|
+
results = self.qualifier.audit_track_1_sandbox()
|
|
46
|
+
self.assertEqual(len(results), 1)
|
|
47
|
+
self.assertTrue(results[0].passed)
|
|
48
|
+
self.assertEqual(results[0].check_id, "DEF-T1-PROBES")
|
|
49
|
+
|
|
50
|
+
def test_track_2_mcp_binds_against_real_return_shape(self):
|
|
51
|
+
results = self.qualifier.audit_track_2_mcp()
|
|
52
|
+
self.assertEqual(len(results), 1)
|
|
53
|
+
result = results[0]
|
|
54
|
+
self.assertTrue(result.passed, result.details)
|
|
55
|
+
self.assertGreaterEqual(result.metrics["tools_registered"], 8)
|
|
56
|
+
|
|
57
|
+
def test_track_3_override_gate_replay_defense_is_real(self):
|
|
58
|
+
results = self.qualifier.audit_track_3_override_gate()
|
|
59
|
+
self.assertEqual(len(results), 1)
|
|
60
|
+
result = results[0]
|
|
61
|
+
self.assertTrue(result.passed, result.details)
|
|
62
|
+
self.assertTrue(result.metrics["bound_ok"])
|
|
63
|
+
self.assertTrue(result.metrics["replay_rejected"])
|
|
64
|
+
self.assertTrue(result.metrics["garbage_rejected"])
|
|
65
|
+
|
|
66
|
+
def test_track_4_scale_concurrency(self):
|
|
67
|
+
results = self.qualifier.audit_track_4_scale()
|
|
68
|
+
self.assertEqual(len(results), 1)
|
|
69
|
+
self.assertTrue(results[0].passed)
|
|
70
|
+
self.assertEqual(results[0].metrics["records_committed"], 50)
|
|
71
|
+
|
|
72
|
+
def test_track_5_visibility_reports_computed_not_fabricated_metrics(self):
|
|
73
|
+
results = self.qualifier.audit_track_5_visibility()
|
|
74
|
+
self.assertEqual(len(results), 1)
|
|
75
|
+
result = results[0]
|
|
76
|
+
self.assertTrue(result.passed, result.details)
|
|
77
|
+
# An empty scratch World has no graph yet: ground_truth_nodes must be
|
|
78
|
+
# the real (zero) count, never a hardcoded "looks healthy" constant.
|
|
79
|
+
self.assertEqual(result.metrics["ground_truth_nodes"], 0)
|
|
80
|
+
|
|
81
|
+
def test_run_qualification_produces_full_report(self):
|
|
82
|
+
report = self.qualifier.run_qualification()
|
|
83
|
+
self.assertIsInstance(report, EnterpriseDefensibilityReport)
|
|
84
|
+
self.assertEqual(report.total_checks, 5)
|
|
85
|
+
self.assertTrue(report.all_passed, [c.details for c in report.checks if not c.passed])
|
|
86
|
+
self.assertEqual(report.overall_verdict, "ENTERPRISE QUALIFIED")
|
|
87
|
+
self.assertIn("epistemic_moat", report.defensibility_summary)
|
|
88
|
+
|
|
89
|
+
def test_write_defensibility_package_round_trips(self):
|
|
90
|
+
report = self.qualifier.run_qualification()
|
|
91
|
+
out = self.root / "custom-report.json"
|
|
92
|
+
target = write_defensibility_package(report, out)
|
|
93
|
+
self.assertEqual(target, out)
|
|
94
|
+
loaded = json.loads(out.read_text(encoding="utf-8"))
|
|
95
|
+
self.assertEqual(loaded["overall_verdict"], report.overall_verdict)
|
|
96
|
+
self.assertEqual(len(loaded["checks"]), 5)
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
class DefensibilityQualifierCliTests(unittest.TestCase):
|
|
100
|
+
def setUp(self):
|
|
101
|
+
tmp = TemporaryDirectory(prefix="cosmos-defensibility-cli-test-")
|
|
102
|
+
self.addCleanup(tmp.cleanup)
|
|
103
|
+
self.root = Path(tmp.name)
|
|
104
|
+
isolate_world(self, self.root)
|
|
105
|
+
replace_defaults(self, EnterpriseDefensibilityQualifier.__init__, (self.root,))
|
|
106
|
+
|
|
107
|
+
def test_cli_json_output_is_well_formed(self):
|
|
108
|
+
out = self.root / "cli-report.json"
|
|
109
|
+
buf = io.StringIO()
|
|
110
|
+
with redirect_stdout(buf):
|
|
111
|
+
code = run_cli(["--json", "--output", str(out)])
|
|
112
|
+
self.assertEqual(code, 0)
|
|
113
|
+
payload = json.loads(buf.getvalue())
|
|
114
|
+
self.assertEqual(payload["overall_verdict"], "ENTERPRISE QUALIFIED")
|
|
115
|
+
self.assertTrue(out.is_file())
|
|
116
|
+
|
|
117
|
+
def test_cli_text_output_lists_every_track(self):
|
|
118
|
+
out = self.root / "cli-report-text.json"
|
|
119
|
+
buf = io.StringIO()
|
|
120
|
+
with redirect_stdout(buf):
|
|
121
|
+
code = run_cli(["--output", str(out)])
|
|
122
|
+
self.assertEqual(code, 0)
|
|
123
|
+
text = buf.getvalue()
|
|
124
|
+
for track_name in (
|
|
125
|
+
"Track 1: Sandbox Hardening",
|
|
126
|
+
"Track 2: Governed MCP Mutations",
|
|
127
|
+
"Track 3: Operator Override Gate",
|
|
128
|
+
"Track 4: Durability & Concurrency",
|
|
129
|
+
"Track 5: Defensibility Visibility",
|
|
130
|
+
):
|
|
131
|
+
self.assertIn(track_name, text)
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
if __name__ == "__main__":
|
|
135
|
+
unittest.main()
|
|
@@ -0,0 +1,512 @@
|
|
|
1
|
+
"""PV-C1: Cosmos Delta projection tests (cosmos.delta-report/1).
|
|
2
|
+
|
|
3
|
+
Contract: spec/delta/COSMOS-DELTA-CONTRACT.md.
|
|
4
|
+
CD-001 reconciliation (1-to-1 with durable sources), CD-002 read-only,
|
|
5
|
+
CD-003 no fabrication, plus actor-switch and model-dispatch attribution.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
import json
|
|
11
|
+
import os
|
|
12
|
+
import tempfile
|
|
13
|
+
import unittest
|
|
14
|
+
from pathlib import Path
|
|
15
|
+
|
|
16
|
+
from tools import cosmos_studio_app
|
|
17
|
+
from tools.cosmos_delta import (
|
|
18
|
+
DELTA_REPORT_SCHEMA,
|
|
19
|
+
build_delta_report,
|
|
20
|
+
compare_model_performance,
|
|
21
|
+
load_effect_log,
|
|
22
|
+
load_graph_knowledge,
|
|
23
|
+
query_events,
|
|
24
|
+
derive_sessions,
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def _knowledge(lifecycle_state: str) -> dict:
|
|
29
|
+
return {
|
|
30
|
+
"schema": "cosmos.knowledge/1",
|
|
31
|
+
"lifecycle_state": lifecycle_state,
|
|
32
|
+
"display_name": "k",
|
|
33
|
+
"statement": "s",
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class TestCosmosDeltaProjection(unittest.TestCase):
|
|
38
|
+
def setUp(self) -> None:
|
|
39
|
+
fd, self._log_path = tempfile.mkstemp(
|
|
40
|
+
prefix="delta-fixture-", suffix=".jsonl")
|
|
41
|
+
os.close(fd)
|
|
42
|
+
os.environ["COSMOS_STUDIO_EFFECT_LOG"] = self._log_path
|
|
43
|
+
self._graph_path = self._log_path + ".graph.json"
|
|
44
|
+
cosmos_studio_app._EFFECT_LOG_CHAIN_STATE["loaded"] = False
|
|
45
|
+
|
|
46
|
+
def tearDown(self) -> None:
|
|
47
|
+
cosmos_studio_app._EFFECT_LOG_CHAIN_STATE["loaded"] = False
|
|
48
|
+
os.environ.pop("COSMOS_STUDIO_EFFECT_LOG", None)
|
|
49
|
+
for candidate in (self._log_path, self._graph_path):
|
|
50
|
+
if os.path.exists(candidate):
|
|
51
|
+
os.remove(candidate)
|
|
52
|
+
|
|
53
|
+
def _emit(self, action: str, effect_id: str, scope: dict,
|
|
54
|
+
actor: str) -> None:
|
|
55
|
+
from tools.cosmos_studio_app import _now_iso
|
|
56
|
+
cosmos_studio_app._append_effect_event(
|
|
57
|
+
action, effect_id, scope, _now_iso(), actor)
|
|
58
|
+
|
|
59
|
+
def _write_graph(self, records: list[dict]) -> None:
|
|
60
|
+
with open(self._graph_path, "w", encoding="utf-8") as handle:
|
|
61
|
+
json.dump({"nodes": records}, handle)
|
|
62
|
+
|
|
63
|
+
def test_reconciliation_counts_match_sources_1to1(self) -> None:
|
|
64
|
+
"""CD-001: every counter equals direct counts over the sources."""
|
|
65
|
+
self._emit("submitted", "fx:1",
|
|
66
|
+
{"action": "terminal.exec", "command": "x"}, "cosmos:actor:A")
|
|
67
|
+
self._emit("approved", "fx:1",
|
|
68
|
+
{"action": "terminal.exec", "command": "x"}, "cosmos:user")
|
|
69
|
+
self._emit("completed", "fx:1",
|
|
70
|
+
{"action": "terminal.exec", "command": "x"}, "cosmos:studio")
|
|
71
|
+
self._emit("submitted", "fx:2",
|
|
72
|
+
{"action": "workspace.patch", "path": "p"}, "cosmos:actor:B")
|
|
73
|
+
self._emit("denied", "fx:2",
|
|
74
|
+
{"action": "workspace.patch", "path": "p"}, "cosmos:user")
|
|
75
|
+
self._emit("chat.dispatch", "chat:1",
|
|
76
|
+
{"action": "chat.dispatch", "model": "m1"}, "cosmos:studio")
|
|
77
|
+
self._emit("chat.dispatch", "chat:2",
|
|
78
|
+
{"action": "chat.dispatch", "model": "m2"}, "cosmos:studio")
|
|
79
|
+
# PV-D4 epistemic fixture: claims, invalidation, rejected approach,
|
|
80
|
+
# decision (durable actions from the PV-D1/D2/D3 modules).
|
|
81
|
+
self._emit("claim.recorded", "claim:1",
|
|
82
|
+
{"action": "claim.recorded", "claim": "docs-backed claim",
|
|
83
|
+
"claim_type": "provider_api_behavior",
|
|
84
|
+
"task_ref": "cosmos:task:t", "admitted": True,
|
|
85
|
+
"required_class": "A", "best_class": "A"},
|
|
86
|
+
"cosmos:studio")
|
|
87
|
+
self._emit("claim.recorded", "claim:2",
|
|
88
|
+
{"action": "claim.recorded", "claim": "inference-backed claim",
|
|
89
|
+
"claim_type": "provider_api_behavior",
|
|
90
|
+
"task_ref": "cosmos:task:t", "admitted": False,
|
|
91
|
+
"required_class": "A", "best_class": "D"},
|
|
92
|
+
"cosmos:studio")
|
|
93
|
+
self._emit("claim.invalidated", "claim:1",
|
|
94
|
+
{"action": "claim.invalidated", "claim_ref": "claim:1",
|
|
95
|
+
"reason": "provider removed the flag"},
|
|
96
|
+
"cosmos:user")
|
|
97
|
+
self._emit("hypothesis.rejected", "hyp:1",
|
|
98
|
+
{"action": "hypothesis.rejected", "hypothesis": "implicit flow",
|
|
99
|
+
"failure_reason": "no redirect URI", "task_ref": "cosmos:task:t"},
|
|
100
|
+
"cosmos:actor:A")
|
|
101
|
+
self._emit("decision.recorded", "dec:1",
|
|
102
|
+
{"action": "decision.recorded", "decision": "use auth flow B",
|
|
103
|
+
"task_ref": "cosmos:task:t", "claim_refs": ["claim:1"]},
|
|
104
|
+
"cosmos:actor:B")
|
|
105
|
+
self._write_graph([_knowledge("active"), _knowledge("active"),
|
|
106
|
+
_knowledge("stale"), _knowledge("superseded")])
|
|
107
|
+
|
|
108
|
+
report = build_delta_report(
|
|
109
|
+
effect_log=load_effect_log(self._log_path),
|
|
110
|
+
knowledge=load_graph_knowledge(self._graph_path),
|
|
111
|
+
subject={"note": "fixture source"},
|
|
112
|
+
)
|
|
113
|
+
|
|
114
|
+
events = load_effect_log(self._log_path)
|
|
115
|
+
knowledge = load_graph_knowledge(self._graph_path)
|
|
116
|
+
a = report["attribution"]
|
|
117
|
+
self.assertEqual(a["effects_submitted"]["count"],
|
|
118
|
+
len([e for e in events if e["action"] == "submitted"]))
|
|
119
|
+
self.assertEqual(a["effects_denied"]["count"],
|
|
120
|
+
len([e for e in events if e["action"] == "denied"]))
|
|
121
|
+
self.assertEqual(a["effects_executed"]["count"],
|
|
122
|
+
len([e for e in events if e["action"] == "completed"]))
|
|
123
|
+
self.assertEqual(a["effects_failed"]["count"], 0)
|
|
124
|
+
self.assertEqual(a["model_dispatches_attributed"]["count"],
|
|
125
|
+
len([e for e in events
|
|
126
|
+
if e["action"] == "chat.dispatch"]))
|
|
127
|
+
self.assertEqual(a["stale_knowledge_records"]["count"],
|
|
128
|
+
len([k for k in knowledge
|
|
129
|
+
if k["lifecycle_state"]
|
|
130
|
+
in ("stale", "superseded")]))
|
|
131
|
+
self.assertEqual(a["active_knowledge_records"]["count"],
|
|
132
|
+
len([k for k in knowledge
|
|
133
|
+
if k["lifecycle_state"] == "active"]))
|
|
134
|
+
self.assertEqual(report["schema"], DELTA_REPORT_SCHEMA)
|
|
135
|
+
self.assertIn("studio.durable_effect_log", report["sources"])
|
|
136
|
+
self.assertIn("cosmos.world_graph.knowledge", report["sources"])
|
|
137
|
+
# PV-D4: epistemic counters reconcile 1-to-1 with durable records.
|
|
138
|
+
ep = report["epistemic"]
|
|
139
|
+
self.assertEqual(ep["claims_recorded"]["count"],
|
|
140
|
+
len([e for e in events if e["action"] == "claim.recorded"]))
|
|
141
|
+
self.assertEqual(ep["claims_admitted"]["count"], 1)
|
|
142
|
+
self.assertEqual(ep["claims_not_admitted"]["count"], 1)
|
|
143
|
+
self.assertEqual(ep["claims_invalidated"]["count"],
|
|
144
|
+
len([e for e in events
|
|
145
|
+
if e["action"] == "claim.invalidated"]))
|
|
146
|
+
self.assertEqual(ep["rejected_approaches_recorded"]["count"],
|
|
147
|
+
len([e for e in events
|
|
148
|
+
if e["action"] == "hypothesis.rejected"]))
|
|
149
|
+
self.assertIsNone(ep["rejected_approaches_recalled"]["count"])
|
|
150
|
+
self.assertEqual(ep["rejected_approaches_recalled"]["status"], "not_observed")
|
|
151
|
+
self.assertEqual(ep["decisions_recorded"]["count"],
|
|
152
|
+
len([e for e in events
|
|
153
|
+
if e["action"] == "decision.recorded"]))
|
|
154
|
+
|
|
155
|
+
def test_projection_is_read_only(self) -> None:
|
|
156
|
+
"""CD-002: building a report must not modify any source."""
|
|
157
|
+
self._emit("submitted", "fx:1",
|
|
158
|
+
{"action": "terminal.exec", "command": "x"}, "cosmos:actor:A")
|
|
159
|
+
self._write_graph([_knowledge("active"), _knowledge("stale")])
|
|
160
|
+
before_log = Path(self._log_path).read_bytes()
|
|
161
|
+
before_graph = Path(self._graph_path).read_bytes()
|
|
162
|
+
|
|
163
|
+
build_delta_report(
|
|
164
|
+
effect_log=load_effect_log(self._log_path),
|
|
165
|
+
knowledge=load_graph_knowledge(self._graph_path),
|
|
166
|
+
)
|
|
167
|
+
build_delta_report(
|
|
168
|
+
effect_log=load_effect_log(self._log_path),
|
|
169
|
+
knowledge=load_graph_knowledge(self._graph_path),
|
|
170
|
+
)
|
|
171
|
+
|
|
172
|
+
self.assertEqual(Path(self._log_path).read_bytes(), before_log)
|
|
173
|
+
self.assertEqual(Path(self._graph_path).read_bytes(), before_graph)
|
|
174
|
+
|
|
175
|
+
def test_no_fabrication_on_empty_sources(self) -> None:
|
|
176
|
+
"""CD-003: absence of evidence yields zeros and nulls, never filler."""
|
|
177
|
+
report = build_delta_report()
|
|
178
|
+
self.assertEqual(report["schema"], DELTA_REPORT_SCHEMA)
|
|
179
|
+
for counter in report["attribution"].values():
|
|
180
|
+
self.assertEqual(counter["count"], 0)
|
|
181
|
+
for key, counter in report["epistemic"].items():
|
|
182
|
+
self.assertEqual(counter["count"], None if key == "rejected_approaches_recalled" else 0)
|
|
183
|
+
self.assertEqual(report["actor_contribution"]["actors"], [])
|
|
184
|
+
self.assertEqual(report["actor_contribution"]["agent_switches"], [])
|
|
185
|
+
self.assertEqual(report["actor_contribution"]["model_dispatch_share"], {})
|
|
186
|
+
self.assertEqual(report["sources"], [])
|
|
187
|
+
|
|
188
|
+
def test_agent_switches_and_model_dispatch_share(self) -> None:
|
|
189
|
+
self._emit("submitted", "fx:1", {"action": "terminal.exec"}, "actor:a")
|
|
190
|
+
self._emit("submitted", "fx:2", {"action": "terminal.exec"}, "actor:a")
|
|
191
|
+
self._emit("submitted", "fx:3", {"action": "terminal.exec"}, "actor:b")
|
|
192
|
+
self._emit("submitted", "fx:4", {"action": "terminal.exec"}, "actor:b")
|
|
193
|
+
self._emit("chat.dispatch", "chat:1",
|
|
194
|
+
{"action": "chat.dispatch", "model": "model-x"}, "actor:b")
|
|
195
|
+
self._emit("chat.dispatch", "chat:2",
|
|
196
|
+
{"action": "chat.dispatch", "model": "model-x"}, "actor:b")
|
|
197
|
+
self._emit("chat.dispatch", "chat:3",
|
|
198
|
+
{"action": "chat.dispatch", "model": "model-y"}, "actor:b")
|
|
199
|
+
|
|
200
|
+
report = build_delta_report(effect_log=load_effect_log(self._log_path))
|
|
201
|
+
|
|
202
|
+
switches = report["actor_contribution"]["agent_switches"]
|
|
203
|
+
self.assertEqual(switches, [])
|
|
204
|
+
self.assertEqual(report["actor_contribution"]["handoff_status"], "not_observed")
|
|
205
|
+
self.assertEqual(report["actor_contribution"]["observed_agent_transitions"], [])
|
|
206
|
+
share = report["actor_contribution"]["model_dispatch_share"]
|
|
207
|
+
self.assertEqual(share, {"model-x": 2, "model-y": 1})
|
|
208
|
+
actors = {a["actor_ref"]: a
|
|
209
|
+
for a in report["actor_contribution"]["actors"]}
|
|
210
|
+
self.assertEqual(actors["actor:a"]["events"], 2)
|
|
211
|
+
self.assertEqual(actors["actor:b"]["events"], 5)
|
|
212
|
+
self.assertIsNone(actors["actor:a"]["error_rate"]) # no outcomes yet
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
def event(event_id: str, timestamp: str, **scope) -> dict:
|
|
216
|
+
return {"event_id": event_id, "timestamp": timestamp,
|
|
217
|
+
"action": "submitted", "actor": "harness:codex", "scope": scope}
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
class TestScopedVisibility(unittest.TestCase):
|
|
221
|
+
def test_subject_is_a_real_filter_and_unknown_scope_does_not_match(self):
|
|
222
|
+
events = [event("a", "2026-09-08T12:00:00Z", task_ref="a"),
|
|
223
|
+
event("b", "2026-09-08T12:01:00Z", task_ref="b"),
|
|
224
|
+
event("unknown", "2026-09-08T12:02:00Z")]
|
|
225
|
+
report = build_delta_report(effect_log=events, subject={"task_ref": "a"})
|
|
226
|
+
self.assertEqual(report["attribution"]["effects_submitted"]["count"], 1)
|
|
227
|
+
self.assertEqual(report["filters"], {"task_ref": "a"})
|
|
228
|
+
self.assertEqual(build_delta_report(effect_log=events, subject={"task_ref": "missing"})
|
|
229
|
+
["attribution"]["effects_submitted"]["count"], 0)
|
|
230
|
+
with self.assertRaises(ValueError):
|
|
231
|
+
build_delta_report(effect_log=events, subject={"task_ref": "a"}, filters={"task_ref": "b"})
|
|
232
|
+
|
|
233
|
+
def test_human_system_events_and_cross_task_activity_are_not_handoffs(self):
|
|
234
|
+
events = [event("a", "2026-09-08T12:00:00Z", task_ref="a"),
|
|
235
|
+
event("b", "2026-09-08T12:01:00Z", task_ref="b"),
|
|
236
|
+
event("human", "2026-09-08T12:02:00Z", task_ref="a"),
|
|
237
|
+
event("system", "2026-09-08T12:03:00Z", task_ref="a"),
|
|
238
|
+
event("c", "2026-09-08T12:04:00Z", task_ref="a")]
|
|
239
|
+
events[1]["actor"] = "harness:cline"
|
|
240
|
+
events[2]["actor"] = "cosmos:user"
|
|
241
|
+
events[3]["actor"] = "cosmos:studio"
|
|
242
|
+
events[4]["actor"] = "harness:cline"
|
|
243
|
+
contribution = build_delta_report(effect_log=events)["actor_contribution"]
|
|
244
|
+
self.assertEqual(contribution["agent_switches"], [])
|
|
245
|
+
transitions = contribution["observed_agent_transitions"]
|
|
246
|
+
self.assertEqual(len(transitions), 1)
|
|
247
|
+
self.assertEqual((transitions[0]["from"], transitions[0]["to"], transitions[0]["task_ref"]),
|
|
248
|
+
("harness:codex", "harness:cline", "a"))
|
|
249
|
+
self.assertTrue(transitions[0]["derived"])
|
|
250
|
+
|
|
251
|
+
def test_outcome_denominator_and_inventory_are_explicit(self):
|
|
252
|
+
events = [{"action": "failed", "actor": "cosmos:studio"},
|
|
253
|
+
{"action": "completed", "actor": "cosmos:studio"},
|
|
254
|
+
{"action": "submitted", "actor": "cosmos:studio"}]
|
|
255
|
+
report = build_delta_report(effect_log=events, knowledge=[_knowledge("stale")])
|
|
256
|
+
actor = report["actor_contribution"]["actors"][0]
|
|
257
|
+
self.assertEqual(actor["outcomes_recorded"], 2)
|
|
258
|
+
self.assertEqual(actor["error_rate"], 0.5)
|
|
259
|
+
self.assertIn("not task binding", report["metric_semantics"]["knowledge_records"])
|
|
260
|
+
|
|
261
|
+
def test_filter_matrix_groups_and_pagination_cover_all_matches(self):
|
|
262
|
+
base = {"task_ref": "t", "project_ref": "p", "world_ref": "w", "session_id": "s", "model": "m"}
|
|
263
|
+
events = [event(str(i), "2026-09-08T12:00:00Z", **base) for i in range(5)]
|
|
264
|
+
for key in base:
|
|
265
|
+
other = {**base, key: "other"}
|
|
266
|
+
events.append(event(key, "2026-09-08T12:00:00Z", **other))
|
|
267
|
+
original = json.dumps(events, sort_keys=True)
|
|
268
|
+
page = query_events(list(reversed(events)), **base, group_by="model", limit=2)
|
|
269
|
+
self.assertEqual(page["count"], 5)
|
|
270
|
+
self.assertEqual(page["total"], 5)
|
|
271
|
+
self.assertEqual(page["groups"], {"m": 5})
|
|
272
|
+
self.assertEqual([e["event_id"] for e in page["events"]], ["4", "3"])
|
|
273
|
+
pages = list(page["events"])
|
|
274
|
+
while page["next_offset"] is not None:
|
|
275
|
+
page = query_events(events, **base, limit=2, offset=page["next_offset"])
|
|
276
|
+
pages.extend(page["events"])
|
|
277
|
+
self.assertEqual([e["event_id"] for e in pages], ["4", "3", "2", "1", "0"])
|
|
278
|
+
self.assertEqual(json.dumps(events, sort_keys=True), original)
|
|
279
|
+
self.assertEqual(query_events(events, **base, group_by="project_ref")["groups"], {"p": 5})
|
|
280
|
+
|
|
281
|
+
def test_timezones_date_bounds_and_unknown_timestamps(self):
|
|
282
|
+
events = [event("outside", "2026-09-08T01:00:00+02:00"),
|
|
283
|
+
event("inside", "2026-09-08T23:45:00-00:00"),
|
|
284
|
+
event("next", "2026-09-09T00:00:00Z"),
|
|
285
|
+
event("bad", "bad"), event("naive", "2026-09-08T00:00:00")]
|
|
286
|
+
result = query_events(events, since="2026-09-08", until="2026-09-08", group_by="day")
|
|
287
|
+
self.assertEqual([e["event_id"] for e in result["events"]], ["inside", "naive"])
|
|
288
|
+
self.assertEqual(result["groups"], {"2026-09-08": 2})
|
|
289
|
+
self.assertEqual(query_events(events, group_by="day")["groups"]["?"], 1)
|
|
290
|
+
self.assertTrue(derive_sessions(events)) # mixed naive/aware no crash
|
|
291
|
+
|
|
292
|
+
def test_invalid_query_is_an_error_not_an_unfiltered_result(self):
|
|
293
|
+
for params in ({"offset": -1}, {"limit": 0}, {"limit": True},
|
|
294
|
+
{"since": "garbage"}, {"until": "garbage"},
|
|
295
|
+
{"since": "2026-09-09", "until": "2026-09-08"}, {"order": "random"}):
|
|
296
|
+
with self.subTest(params=params), self.assertRaises(ValueError):
|
|
297
|
+
query_events([], **params)
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
class TestModelComparisonAuditEngine(unittest.TestCase):
|
|
301
|
+
def test_model_comparison_matrix_and_resumption_breakdown(self) -> None:
|
|
302
|
+
events = [
|
|
303
|
+
{
|
|
304
|
+
"event_id": "e1",
|
|
305
|
+
"timestamp": "2026-09-08T12:00:00Z",
|
|
306
|
+
"action": "chat.dispatch",
|
|
307
|
+
"actor": "user:alice",
|
|
308
|
+
"scope": {"model": "gpt-4o-mini", "status_code": 200, "resumption": "bound_resume"},
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
"event_id": "e2",
|
|
312
|
+
"timestamp": "2026-09-08T12:01:00Z",
|
|
313
|
+
"action": "chat.dispatch",
|
|
314
|
+
"actor": "user:bob",
|
|
315
|
+
"scope": {"model": "gpt-4o-mini", "status_code": 200, "cold_start": True},
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
"event_id": "e3",
|
|
319
|
+
"timestamp": "2026-09-08T12:02:00Z",
|
|
320
|
+
"action": "chat.dispatch",
|
|
321
|
+
"actor": "user:alice",
|
|
322
|
+
"scope": {"model": "deepseek-v3", "status_code": 200},
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
"event_id": "e4",
|
|
326
|
+
"timestamp": "2026-09-08T12:03:00Z",
|
|
327
|
+
"action": "chat.dispatch",
|
|
328
|
+
"actor": "user:alice",
|
|
329
|
+
"scope": {"model": "deepseek-v3", "status_code": 500},
|
|
330
|
+
},
|
|
331
|
+
]
|
|
332
|
+
report = build_delta_report(effect_log=events)
|
|
333
|
+
contribution = report["actor_contribution"]
|
|
334
|
+
self.assertIn("model_comparison", contribution)
|
|
335
|
+
self.assertIn("resumption_summary", contribution)
|
|
336
|
+
|
|
337
|
+
mc = {m["model"]: m for m in contribution["model_comparison"]}
|
|
338
|
+
self.assertIn("gpt-4o-mini", mc)
|
|
339
|
+
self.assertIn("deepseek-v3", mc)
|
|
340
|
+
|
|
341
|
+
gpt = mc["gpt-4o-mini"]
|
|
342
|
+
self.assertEqual(gpt["total_dispatches"], 2)
|
|
343
|
+
self.assertEqual(gpt["successful_dispatches"], 2)
|
|
344
|
+
self.assertEqual(gpt["failed_dispatches"], 0)
|
|
345
|
+
self.assertEqual(gpt["success_rate"], 1.0)
|
|
346
|
+
self.assertEqual(gpt["error_rate"], 0.0)
|
|
347
|
+
self.assertEqual(gpt["resumption_breakdown"]["bound_resume"], 1)
|
|
348
|
+
self.assertEqual(gpt["resumption_breakdown"]["cold_start"], 1)
|
|
349
|
+
self.assertEqual(gpt["resumption_breakdown"]["unclassified"], 0)
|
|
350
|
+
|
|
351
|
+
ds = mc["deepseek-v3"]
|
|
352
|
+
self.assertEqual(ds["total_dispatches"], 2)
|
|
353
|
+
self.assertEqual(ds["successful_dispatches"], 1)
|
|
354
|
+
self.assertEqual(ds["failed_dispatches"], 1)
|
|
355
|
+
self.assertEqual(ds["success_rate"], 0.5)
|
|
356
|
+
self.assertEqual(ds["error_rate"], 0.5)
|
|
357
|
+
self.assertEqual(ds["resumption_breakdown"]["unclassified"], 2)
|
|
358
|
+
|
|
359
|
+
summary = contribution["resumption_summary"]
|
|
360
|
+
self.assertEqual(summary["bound_resume"], 1)
|
|
361
|
+
self.assertEqual(summary["cold_start"], 1)
|
|
362
|
+
self.assertEqual(summary["unclassified"], 2)
|
|
363
|
+
|
|
364
|
+
def test_observed_agent_transitions_resumption_classification(self) -> None:
|
|
365
|
+
events = [
|
|
366
|
+
{
|
|
367
|
+
"event_id": "t1",
|
|
368
|
+
"timestamp": "2026-09-08T12:00:00Z",
|
|
369
|
+
"action": "submitted",
|
|
370
|
+
"actor": "harness:codex",
|
|
371
|
+
"scope": {"task_ref": "task:resume-1"},
|
|
372
|
+
},
|
|
373
|
+
{
|
|
374
|
+
"event_id": "t2",
|
|
375
|
+
"timestamp": "2026-09-08T12:01:00Z",
|
|
376
|
+
"action": "submitted",
|
|
377
|
+
"actor": "harness:cline",
|
|
378
|
+
"scope": {"task_ref": "task:resume-1", "binding_ref": "bind:999"},
|
|
379
|
+
},
|
|
380
|
+
{
|
|
381
|
+
"event_id": "t3",
|
|
382
|
+
"timestamp": "2026-09-08T12:02:00Z",
|
|
383
|
+
"action": "submitted",
|
|
384
|
+
"actor": "harness:opencode",
|
|
385
|
+
"scope": {"task_ref": "task:resume-1", "cold_start": True},
|
|
386
|
+
},
|
|
387
|
+
]
|
|
388
|
+
report = build_delta_report(effect_log=events)
|
|
389
|
+
transitions = report["actor_contribution"]["observed_agent_transitions"]
|
|
390
|
+
self.assertEqual(len(transitions), 2)
|
|
391
|
+
self.assertEqual(transitions[0]["from"], "harness:codex")
|
|
392
|
+
self.assertEqual(transitions[0]["to"], "harness:cline")
|
|
393
|
+
self.assertEqual(transitions[0]["resumption"], "bound_resume")
|
|
394
|
+
|
|
395
|
+
self.assertEqual(transitions[1]["from"], "harness:cline")
|
|
396
|
+
self.assertEqual(transitions[1]["to"], "harness:opencode")
|
|
397
|
+
self.assertEqual(transitions[1]["resumption"], "cold_start")
|
|
398
|
+
|
|
399
|
+
def test_compare_model_performance_audit_engine(self) -> None:
|
|
400
|
+
events = [
|
|
401
|
+
{
|
|
402
|
+
"event_id": "c1",
|
|
403
|
+
"timestamp": "2026-09-08T12:00:00Z",
|
|
404
|
+
"action": "chat.dispatch",
|
|
405
|
+
"actor": "operator:primary",
|
|
406
|
+
"scope": {"model": "gpt-4o", "status_code": 200, "resumption": "bound_resume"},
|
|
407
|
+
},
|
|
408
|
+
{
|
|
409
|
+
"event_id": "c2",
|
|
410
|
+
"timestamp": "2026-09-08T12:01:00Z",
|
|
411
|
+
"action": "chat.dispatch",
|
|
412
|
+
"actor": "operator:primary",
|
|
413
|
+
"scope": {"model": "claude-3-5-sonnet", "status_code": 500},
|
|
414
|
+
},
|
|
415
|
+
]
|
|
416
|
+
audit = compare_model_performance(events)
|
|
417
|
+
self.assertEqual(audit["schema"], "cosmos.model-comparison-audit/1")
|
|
418
|
+
self.assertEqual(audit["models_evaluated"], 2)
|
|
419
|
+
self.assertIn("gpt-4o", audit["model_matrix"])
|
|
420
|
+
self.assertIn("claude-3-5-sonnet", audit["model_matrix"])
|
|
421
|
+
self.assertEqual(audit["constant_measuring_plane"], "Cosmos Platform")
|
|
422
|
+
|
|
423
|
+
head_to_head = audit["head_to_head"]
|
|
424
|
+
self.assertTrue(head_to_head)
|
|
425
|
+
self.assertIn("baseline_model", head_to_head)
|
|
426
|
+
self.assertIn("comparison_model", head_to_head)
|
|
427
|
+
self.assertIn("success_rate_delta", head_to_head)
|
|
428
|
+
|
|
429
|
+
|
|
430
|
+
class LoadLiveEventsTests(unittest.TestCase):
|
|
431
|
+
def setUp(self):
|
|
432
|
+
from runtime.cosmos_runtime.telemetry import bus as bus_module
|
|
433
|
+
bus_module.reset_telemetry_bus()
|
|
434
|
+
self.addCleanup(bus_module.reset_telemetry_bus)
|
|
435
|
+
|
|
436
|
+
def test_combines_effect_log_and_telemetry_bus_deduplicated(self):
|
|
437
|
+
from tools.cosmos_delta import load_live_events
|
|
438
|
+
from runtime.cosmos_runtime.telemetry.bus import get_telemetry_bus
|
|
439
|
+
from runtime.cosmos_runtime.telemetry.events import CorrelationContext, TripartiteComponent
|
|
440
|
+
|
|
441
|
+
with tempfile.TemporaryDirectory() as tmp:
|
|
442
|
+
root = Path(tmp)
|
|
443
|
+
studio_dir = root / ".cosmos" / "studio"
|
|
444
|
+
studio_dir.mkdir(parents=True)
|
|
445
|
+
(studio_dir / "effect-log.jsonl").write_text(
|
|
446
|
+
json.dumps({"event_id": "eff:disk-1", "action": "completed", "timestamp": "2026-09-09T20:00:00Z", "actor": "harness:cline", "scope": {}}) + "\n",
|
|
447
|
+
encoding="utf-8",
|
|
448
|
+
)
|
|
449
|
+
|
|
450
|
+
bus = get_telemetry_bus(root)
|
|
451
|
+
bus.emit(
|
|
452
|
+
component=TripartiteComponent.MODEL,
|
|
453
|
+
category="dispatch",
|
|
454
|
+
action="chat.dispatch",
|
|
455
|
+
payload={},
|
|
456
|
+
correlation=CorrelationContext(session_id="s1", task_ref="task:1", harness_id="cline", model_id="gpt-4o"),
|
|
457
|
+
)
|
|
458
|
+
|
|
459
|
+
events = load_live_events(root)
|
|
460
|
+
event_ids = {e["event_id"] for e in events}
|
|
461
|
+
self.assertIn("eff:disk-1", event_ids)
|
|
462
|
+
bus_events = [e for e in events if e.get("action") == "chat.dispatch"]
|
|
463
|
+
self.assertEqual(len(bus_events), 1)
|
|
464
|
+
self.assertEqual(bus_events[0]["scope"]["harness"], "cline")
|
|
465
|
+
self.assertEqual(bus_events[0]["scope"]["model"], "gpt-4o")
|
|
466
|
+
self.assertEqual(bus_events[0]["scope"]["task_ref"], "task:1")
|
|
467
|
+
|
|
468
|
+
def test_deduplicates_by_event_id_when_present_in_both_sources(self):
|
|
469
|
+
from tools.cosmos_delta import load_live_events
|
|
470
|
+
from runtime.cosmos_runtime.telemetry.bus import get_telemetry_bus
|
|
471
|
+
from runtime.cosmos_runtime.telemetry.events import CorrelationContext, TripartiteComponent
|
|
472
|
+
|
|
473
|
+
with tempfile.TemporaryDirectory() as tmp:
|
|
474
|
+
root = Path(tmp)
|
|
475
|
+
bus = get_telemetry_bus(root)
|
|
476
|
+
event = bus.emit(
|
|
477
|
+
component=TripartiteComponent.MODEL,
|
|
478
|
+
category="dispatch",
|
|
479
|
+
action="chat.dispatch",
|
|
480
|
+
payload={},
|
|
481
|
+
correlation=CorrelationContext(session_id="s1"),
|
|
482
|
+
)
|
|
483
|
+
|
|
484
|
+
studio_dir = root / ".cosmos" / "studio"
|
|
485
|
+
studio_dir.mkdir(parents=True)
|
|
486
|
+
(studio_dir / "effect-log.jsonl").write_text(
|
|
487
|
+
json.dumps({"event_id": event.event_id, "action": "duplicate-on-disk", "timestamp": "2026-09-09T20:00:00Z", "actor": "harness:cline", "scope": {}}) + "\n",
|
|
488
|
+
encoding="utf-8",
|
|
489
|
+
)
|
|
490
|
+
|
|
491
|
+
events = load_live_events(root)
|
|
492
|
+
matching = [e for e in events if e["event_id"] == event.event_id]
|
|
493
|
+
self.assertEqual(len(matching), 1)
|
|
494
|
+
|
|
495
|
+
def test_include_bus_false_reads_only_effect_log(self):
|
|
496
|
+
from tools.cosmos_delta import load_live_events
|
|
497
|
+
|
|
498
|
+
with tempfile.TemporaryDirectory() as tmp:
|
|
499
|
+
root = Path(tmp)
|
|
500
|
+
studio_dir = root / ".cosmos" / "studio"
|
|
501
|
+
studio_dir.mkdir(parents=True)
|
|
502
|
+
(studio_dir / "effect-log.jsonl").write_text(
|
|
503
|
+
json.dumps({"event_id": "eff:only", "action": "completed", "timestamp": "2026-09-09T20:00:00Z", "actor": "harness:cline", "scope": {}}) + "\n",
|
|
504
|
+
encoding="utf-8",
|
|
505
|
+
)
|
|
506
|
+
events = load_live_events(root, include_bus=False)
|
|
507
|
+
self.assertEqual([e["event_id"] for e in events], ["eff:only"])
|
|
508
|
+
|
|
509
|
+
|
|
510
|
+
if __name__ == "__main__":
|
|
511
|
+
unittest.main()
|
|
512
|
+
|