@team-agent/installer 0.5.127 → 0.6.0
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 +15 -4
- package/README.zh.md +1 -1
- package/package.json +4 -8
- package/skills/team-agent/SKILL.md +41 -26
- package/skills/team-agent/command-coverage.json +170 -184
- package/skills/team-agent/docs/reference/team-agent-operator.md +66 -32
- package/skills/team-agent/references/recovery-runbook.md +1 -1
- package/skills/team-agent/references/team-agent-operator.md +66 -32
- package/templates/team_state.md +1 -1
- package/Cargo.lock +0 -1063
- package/Cargo.toml +0 -36
- package/crates/team-agent/Cargo.toml +0 -69
- package/crates/team-agent/src/app_server_test_support.rs +0 -258
- package/crates/team-agent/src/cli/adapters.rs +0 -1298
- package/crates/team-agent/src/cli/arguments.rs +0 -401
- package/crates/team-agent/src/cli/attach_app_server_leader.rs +0 -98
- package/crates/team-agent/src/cli/diagnose.rs +0 -1675
- package/crates/team-agent/src/cli/emit.rs +0 -2898
- package/crates/team-agent/src/cli/grok_slot.rs +0 -384
- package/crates/team-agent/src/cli/helpers.rs +0 -91
- package/crates/team-agent/src/cli/intent/runtime.rs +0 -1189
- package/crates/team-agent/src/cli/intent/runtime_tests.rs +0 -821
- package/crates/team-agent/src/cli/intent/tests.rs +0 -691
- package/crates/team-agent/src/cli/intent.rs +0 -664
- package/crates/team-agent/src/cli/leader.rs +0 -300
- package/crates/team-agent/src/cli/leader_prompt.rs +0 -261
- package/crates/team-agent/src/cli/leaders.rs +0 -418
- package/crates/team-agent/src/cli/mod.rs +0 -6528
- package/crates/team-agent/src/cli/models.rs +0 -449
- package/crates/team-agent/src/cli/named_address.rs +0 -1651
- package/crates/team-agent/src/cli/profile.rs +0 -342
- package/crates/team-agent/src/cli/route.rs +0 -212
- package/crates/team-agent/src/cli/send/coordinator.rs +0 -164
- package/crates/team-agent/src/cli/send/mailbox.rs +0 -145
- package/crates/team-agent/src/cli/send/persist.rs +0 -192
- package/crates/team-agent/src/cli/send/presentation.rs +0 -370
- package/crates/team-agent/src/cli/send/resolve.rs +0 -573
- package/crates/team-agent/src/cli/send.rs +0 -201
- package/crates/team-agent/src/cli/shutdown_socket.rs +0 -288
- package/crates/team-agent/src/cli/spec.rs +0 -159
- package/crates/team-agent/src/cli/status.rs +0 -280
- package/crates/team-agent/src/cli/status_port/agents.rs +0 -358
- package/crates/team-agent/src/cli/status_port/approvals.rs +0 -79
- package/crates/team-agent/src/cli/status_port/brief.rs +0 -2043
- package/crates/team-agent/src/cli/status_port/compact.rs +0 -240
- package/crates/team-agent/src/cli/status_port/format.rs +0 -146
- package/crates/team-agent/src/cli/status_port/inbox.rs +0 -62
- package/crates/team-agent/src/cli/status_port/runtime.rs +0 -197
- package/crates/team-agent/src/cli/status_port/snapshot.rs +0 -208
- package/crates/team-agent/src/cli/status_port/store.rs +0 -416
- package/crates/team-agent/src/cli/status_port/tests.rs +0 -90
- package/crates/team-agent/src/cli/status_port.rs +0 -92
- package/crates/team-agent/src/cli/tests/base.rs +0 -885
- package/crates/team-agent/src/cli/tests/divergence.rs +0 -518
- package/crates/team-agent/src/cli/tests/lane_c.rs +0 -453
- package/crates/team-agent/src/cli/tests/leader_watch.rs +0 -372
- package/crates/team-agent/src/cli/tests/main_preserved.rs +0 -430
- package/crates/team-agent/src/cli/tests/missing_subcommands.rs +0 -336
- package/crates/team-agent/src/cli/tests/mod.rs +0 -137
- package/crates/team-agent/src/cli/tests/named_address.rs +0 -760
- package/crates/team-agent/src/cli/tests/parser_safety.rs +0 -383
- package/crates/team-agent/src/cli/tests/run_delegation.rs +0 -481
- package/crates/team-agent/src/cli/tests/shutdown_kill_plan.rs +0 -2179
- package/crates/team-agent/src/cli/tests/status_brief.rs +0 -1514
- package/crates/team-agent/src/cli/tests/status_send.rs +0 -1091
- package/crates/team-agent/src/cli/tests/verb_install_skill.rs +0 -93
- package/crates/team-agent/src/cli/tests/verb_profile.rs +0 -392
- package/crates/team-agent/src/cli/triage.rs +0 -234
- package/crates/team-agent/src/cli/types.rs +0 -591
- package/crates/team-agent/src/codex_app_server.rs +0 -546
- package/crates/team-agent/src/communication_mode/mod.rs +0 -56
- package/crates/team-agent/src/compiler/tests.rs +0 -842
- package/crates/team-agent/src/compiler.rs +0 -691
- package/crates/team-agent/src/conpty/backend.rs +0 -829
- package/crates/team-agent/src/conpty/mod.rs +0 -33
- package/crates/team-agent/src/contract_runtime/backend.rs +0 -1610
- package/crates/team-agent/src/contract_runtime/commands.rs +0 -671
- package/crates/team-agent/src/contract_runtime/config.rs +0 -354
- package/crates/team-agent/src/contract_runtime/config_tests.rs +0 -56
- package/crates/team-agent/src/contract_runtime/discovery.rs +0 -438
- package/crates/team-agent/src/contract_runtime/fork.rs +0 -368
- package/crates/team-agent/src/contract_runtime/forward.rs +0 -288
- package/crates/team-agent/src/contract_runtime/framework.rs +0 -350
- package/crates/team-agent/src/contract_runtime/mcp.rs +0 -399
- package/crates/team-agent/src/contract_runtime/mod.rs +0 -17
- package/crates/team-agent/src/contract_runtime/prompt.rs +0 -216
- package/crates/team-agent/src/contract_runtime/pump.rs +0 -271
- package/crates/team-agent/src/contract_runtime/registry.rs +0 -589
- package/crates/team-agent/src/contract_runtime/workspace.rs +0 -228
- package/crates/team-agent/src/coordinator/backoff.rs +0 -741
- package/crates/team-agent/src/coordinator/conpty_shim.rs +0 -805
- package/crates/team-agent/src/coordinator/health.rs +0 -1185
- package/crates/team-agent/src/coordinator/mod.rs +0 -119
- package/crates/team-agent/src/coordinator/orphan.rs +0 -110
- package/crates/team-agent/src/coordinator/runtime_detectors.rs +0 -798
- package/crates/team-agent/src/coordinator/runtime_observation.rs +0 -84
- package/crates/team-agent/src/coordinator/steps/abnormal.rs +0 -2309
- package/crates/team-agent/src/coordinator/steps/delivery.rs +0 -15
- package/crates/team-agent/src/coordinator/steps/health_sync.rs +0 -15
- package/crates/team-agent/src/coordinator/steps/mod.rs +0 -126
- package/crates/team-agent/src/coordinator/steps/persist.rs +0 -15
- package/crates/team-agent/src/coordinator/steps/runtime_prompts.rs +0 -15
- package/crates/team-agent/src/coordinator/steps/session_gate.rs +0 -16
- package/crates/team-agent/src/coordinator/tests/a0_lostupdate.rs +0 -158
- package/crates/team-agent/src/coordinator/tests/abnormal.rs +0 -312
- package/crates/team-agent/src/coordinator/tests/api_error_recovery.rs +0 -338
- package/crates/team-agent/src/coordinator/tests/basics.rs +0 -211
- package/crates/team-agent/src/coordinator/tests/daemon.rs +0 -514
- package/crates/team-agent/src/coordinator/tests/energy.rs +0 -549
- package/crates/team-agent/src/coordinator/tests/health_sync.rs +0 -461
- package/crates/team-agent/src/coordinator/tests/main_preserved.rs +0 -186
- package/crates/team-agent/src/coordinator/tests/mod.rs +0 -295
- package/crates/team-agent/src/coordinator/tests/s3_bounded.rs +0 -207
- package/crates/team-agent/src/coordinator/tests/spine.rs +0 -308
- package/crates/team-agent/src/coordinator/tests/takeover.rs +0 -286
- package/crates/team-agent/src/coordinator/tests/tick_core.rs +0 -237
- package/crates/team-agent/src/coordinator/tick.rs +0 -3112
- package/crates/team-agent/src/coordinator/types.rs +0 -540
- package/crates/team-agent/src/db/agent_health_capture.rs +0 -126
- package/crates/team-agent/src/db/message_store.rs +0 -1585
- package/crates/team-agent/src/db/migration.rs +0 -984
- package/crates/team-agent/src/db/mod.rs +0 -26
- package/crates/team-agent/src/db/schema.rs +0 -663
- package/crates/team-agent/src/diagnose/comms.rs +0 -242
- package/crates/team-agent/src/diagnose/mod.rs +0 -44
- package/crates/team-agent/src/diagnose/orphans.rs +0 -889
- package/crates/team-agent/src/event_log.rs +0 -502
- package/crates/team-agent/src/fake_worker.rs +0 -303
- package/crates/team-agent/src/kill_audit.rs +0 -106
- package/crates/team-agent/src/layout/manager.rs +0 -248
- package/crates/team-agent/src/layout/mod.rs +0 -36
- package/crates/team-agent/src/layout/overlay.rs +0 -134
- package/crates/team-agent/src/layout/placement.rs +0 -52
- package/crates/team-agent/src/layout/recovery.rs +0 -106
- package/crates/team-agent/src/layout/runtime_sessions.rs +0 -317
- package/crates/team-agent/src/layout/sessions.rs +0 -294
- package/crates/team-agent/src/layout/tmux_endpoint.rs +0 -165
- package/crates/team-agent/src/layout/worker_env.rs +0 -721
- package/crates/team-agent/src/layout/worker_window_helpers.rs +0 -37
- package/crates/team-agent/src/leader/helpers.rs +0 -178
- package/crates/team-agent/src/leader/incident.rs +0 -6
- package/crates/team-agent/src/leader/lease.rs +0 -3356
- package/crates/team-agent/src/leader/mod.rs +0 -104
- package/crates/team-agent/src/leader/owner_bind.rs +0 -400
- package/crates/team-agent/src/leader/prompt.rs +0 -905
- package/crates/team-agent/src/leader/provider_attribution.rs +0 -247
- package/crates/team-agent/src/leader/rediscover/tests.rs +0 -689
- package/crates/team-agent/src/leader/rediscover.rs +0 -1192
- package/crates/team-agent/src/leader/registry.rs +0 -883
- package/crates/team-agent/src/leader/start.rs +0 -4500
- package/crates/team-agent/src/leader/takeover.rs +0 -65
- package/crates/team-agent/src/leader/tests/basics.rs +0 -337
- package/crates/team-agent/src/leader/tests/byte_findings.rs +0 -355
- package/crates/team-agent/src/leader/tests/claim_leader_mailbox_flush_contract.rs +0 -544
- package/crates/team-agent/src/leader/tests/historical_inventory_upgrade_gate_red.rs +0 -624
- package/crates/team-agent/src/leader/tests/identity.rs +0 -465
- package/crates/team-agent/src/leader/tests/identity_session_names.rs +0 -42
- package/crates/team-agent/src/leader/tests/idle.rs +0 -113
- package/crates/team-agent/src/leader/tests/lease_api.rs +0 -520
- package/crates/team-agent/src/leader/tests/lease_claim.rs +0 -629
- package/crates/team-agent/src/leader/tests/mod.rs +0 -106
- package/crates/team-agent/src/leader/tests/prompt_contract.rs +0 -267
- package/crates/team-agent/src/leader/tests/rediscover.rs +0 -403
- package/crates/team-agent/src/leader/tests/rehomed_env.rs +0 -83
- package/crates/team-agent/src/leader/tests/team_in_team_state_scope_red.rs +0 -1273
- package/crates/team-agent/src/leader/tests/terminal_and_replay_vs_rerender_invariants_red.rs +0 -417
- package/crates/team-agent/src/leader/tests/wake_start_owner.rs +0 -168
- package/crates/team-agent/src/leader/types.rs +0 -534
- package/crates/team-agent/src/lib.rs +0 -145
- package/crates/team-agent/src/lifecycle/helpers.rs +0 -212
- package/crates/team-agent/src/lifecycle/launch/add_agent.rs +0 -848
- package/crates/team-agent/src/lifecycle/launch/add_agent_state.rs +0 -393
- package/crates/team-agent/src/lifecycle/launch/agent_state.rs +0 -332
- package/crates/team-agent/src/lifecycle/launch/clone_agent.rs +0 -178
- package/crates/team-agent/src/lifecycle/launch/fork_agent.rs +0 -82
- package/crates/team-agent/src/lifecycle/launch/fork_entry.rs +0 -63
- package/crates/team-agent/src/lifecycle/launch/identity.rs +0 -674
- package/crates/team-agent/src/lifecycle/launch/layout.rs +0 -350
- package/crates/team-agent/src/lifecycle/launch/leader_context.rs +0 -589
- package/crates/team-agent/src/lifecycle/launch/mcp_config.rs +0 -152
- package/crates/team-agent/src/lifecycle/launch/ownership.rs +0 -105
- package/crates/team-agent/src/lifecycle/launch/pi_mcp.rs +0 -629
- package/crates/team-agent/src/lifecycle/launch/pi_mcp_extension.js +0 -226
- package/crates/team-agent/src/lifecycle/launch/plan.rs +0 -269
- package/crates/team-agent/src/lifecycle/launch/quick_start.rs +0 -5176
- package/crates/team-agent/src/lifecycle/launch/quick_start_transport.rs +0 -368
- package/crates/team-agent/src/lifecycle/launch/readiness.rs +0 -519
- package/crates/team-agent/src/lifecycle/launch/role_source.rs +0 -287
- package/crates/team-agent/src/lifecycle/launch/spawn.rs +0 -450
- package/crates/team-agent/src/lifecycle/launch/spec_state.rs +0 -801
- package/crates/team-agent/src/lifecycle/launch/state_projection.rs +0 -624
- package/crates/team-agent/src/lifecycle/launch/worker_env.rs +0 -558
- package/crates/team-agent/src/lifecycle/launch.rs +0 -534
- package/crates/team-agent/src/lifecycle/lock.rs +0 -350
- package/crates/team-agent/src/lifecycle/mod.rs +0 -79
- package/crates/team-agent/src/lifecycle/pane_input_lock.rs +0 -239
- package/crates/team-agent/src/lifecycle/profile_launch.rs +0 -757
- package/crates/team-agent/src/lifecycle/profile_smoke.rs +0 -557
- package/crates/team-agent/src/lifecycle/restart/agent.rs +0 -2198
- package/crates/team-agent/src/lifecycle/restart/common.rs +0 -2052
- package/crates/team-agent/src/lifecycle/restart/orchestrator.rs +0 -65
- package/crates/team-agent/src/lifecycle/restart/preflight.rs +0 -113
- package/crates/team-agent/src/lifecycle/restart/rebuild.rs +0 -5135
- package/crates/team-agent/src/lifecycle/restart/remove.rs +0 -1504
- package/crates/team-agent/src/lifecycle/restart/selection.rs +0 -559
- package/crates/team-agent/src/lifecycle/restart/team_state.rs +0 -329
- package/crates/team-agent/src/lifecycle/restart.rs +0 -223
- package/crates/team-agent/src/lifecycle/role_config.rs +0 -1205
- package/crates/team-agent/src/lifecycle/tests/acceptance_b_batch_red.rs +0 -1021
- package/crates/team-agent/src/lifecycle/tests/agent_ops.rs +0 -1205
- package/crates/team-agent/src/lifecycle/tests/b0_legacy_snapshot_nonauthority_contract.rs +0 -265
- package/crates/team-agent/src/lifecycle/tests/b0_reader_hideone_audit_contract.rs +0 -490
- package/crates/team-agent/src/lifecycle/tests/behavioral_diff_264_red.rs +0 -656
- package/crates/team-agent/src/lifecycle/tests/claude_profile_launch_red.rs +0 -135
- package/crates/team-agent/src/lifecycle/tests/cli_argv_routing_red.rs +0 -1415
- package/crates/team-agent/src/lifecycle/tests/clone_agent_preserves_source_tools.rs +0 -427
- package/crates/team-agent/src/lifecycle/tests/clone_fork_copilot_perms_red.rs +0 -396
- package/crates/team-agent/src/lifecycle/tests/communication_mode_runtime_contract_red.rs +0 -418
- package/crates/team-agent/src/lifecycle/tests/copilot_provider_red.rs +0 -2039
- package/crates/team-agent/src/lifecycle/tests/core.rs +0 -1298
- package/crates/team-agent/src/lifecycle/tests/f032_startup_prompt_best_effort_red.rs +0 -315
- package/crates/team-agent/src/lifecycle/tests/fixtures/pi_list_models_g0.stdout.txt +0 -222
- package/crates/team-agent/src/lifecycle/tests/fixtures/pi_list_models_spaced_ids.stdout.txt +0 -9
- package/crates/team-agent/src/lifecycle/tests/fixtures/pi_native_mcp_host.mjs +0 -71
- package/crates/team-agent/src/lifecycle/tests/gate_fixtures.rs +0 -562
- package/crates/team-agent/src/lifecycle/tests/grok_require_explicit_model_red.rs +0 -110
- package/crates/team-agent/src/lifecycle/tests/harvest2_a_batch_red.rs +0 -472
- package/crates/team-agent/src/lifecycle/tests/host_cotenant_death_p0_contract.rs +0 -921
- package/crates/team-agent/src/lifecycle/tests/issue238_codex_effort_contract.rs +0 -68
- package/crates/team-agent/src/lifecycle/tests/lane_ops.rs +0 -1851
- package/crates/team-agent/src/lifecycle/tests/launch_spawn.rs +0 -3981
- package/crates/team-agent/src/lifecycle/tests/lifecycle_lock.rs +0 -339
- package/crates/team-agent/src/lifecycle/tests/lifecycle_rollback_red.rs +0 -596
- package/crates/team-agent/src/lifecycle/tests/main_preserved.rs +0 -513
- package/crates/team-agent/src/lifecycle/tests/mcp_tool_name_format_red.rs +0 -69
- package/crates/team-agent/src/lifecycle/tests/phase_b_contracts.rs +0 -824
- package/crates/team-agent/src/lifecycle/tests/phase_golden.rs +0 -723
- package/crates/team-agent/src/lifecycle/tests/pi_catalog_red.rs +0 -152
- package/crates/team-agent/src/lifecycle/tests/pi_command_red.rs +0 -182
- package/crates/team-agent/src/lifecycle/tests/pi_dual_entry_red.rs +0 -374
- package/crates/team-agent/src/lifecycle/tests/pi_executable_mcp_red.rs +0 -546
- package/crates/team-agent/src/lifecycle/tests/pi_lifecycle_doctor_red.rs +0 -31
- package/crates/team-agent/src/lifecycle/tests/pi_native_mcp_capability_red.rs +0 -528
- package/crates/team-agent/src/lifecycle/tests/pi_session_delivery_red.rs +0 -134
- package/crates/team-agent/src/lifecycle/tests/quick_start_worker_readiness_red.rs +0 -333
- package/crates/team-agent/src/lifecycle/tests/realmachine_clusters_1_6_red.rs +0 -786
- package/crates/team-agent/src/lifecycle/tests/realmachine_residual_g1_g4_red.rs +0 -648
- package/crates/team-agent/src/lifecycle/tests/restart.rs +0 -185
- package/crates/team-agent/src/lifecycle/tests/restart_build_before_destroy_0540_contract.rs +0 -1053
- package/crates/team-agent/src/lifecycle/tests/restart_liveness_red.rs +0 -679
- package/crates/team-agent/src/lifecycle/tests/restart_rebind_hotfix_252_red.rs +0 -1126
- package/crates/team-agent/src/lifecycle/tests/restart_session_capture_red.rs +0 -153
- package/crates/team-agent/src/lifecycle/tests/resume_recover_red.rs +0 -427
- package/crates/team-agent/src/lifecycle/tests/stale_team_saveconflict_contract.rs +0 -431
- package/crates/team-agent/src/lifecycle/tests/startup_latency_contract.rs +0 -1066
- package/crates/team-agent/src/lifecycle/tests/status_credential_redaction_contract.rs +0 -876
- package/crates/team-agent/src/lifecycle/tests/subprep_codex_trust_roundtrip_red.rs +0 -1026
- package/crates/team-agent/src/lifecycle/tests/swallow_batch4_semantics_red.rs +0 -90
- package/crates/team-agent/src/lifecycle/tests/team_in_team_identity_scope_red.rs +0 -543
- package/crates/team-agent/src/lifecycle/tests/team_in_team_sibling_quick_start_red.rs +0 -1103
- package/crates/team-agent/src/lifecycle/tests/team_in_team_state_scope_red.rs +0 -1276
- package/crates/team-agent/src/lifecycle/tests/team_key_retirement_roster_red.rs +0 -145
- package/crates/team-agent/src/lifecycle/tests/team_key_retirement_txn_red.rs +0 -603
- package/crates/team-agent/src/lifecycle/tests/test_isolation_escape_contract.rs +0 -936
- package/crates/team-agent/src/lifecycle/tests/upgrade_compat_0211_red.rs +0 -970
- package/crates/team-agent/src/lifecycle/tests/verify_rs031_window_consistency_red.rs +0 -996
- package/crates/team-agent/src/lifecycle/tests/worker_spawn_env_red.rs +0 -827
- package/crates/team-agent/src/lifecycle/tests.rs +0 -102
- package/crates/team-agent/src/lifecycle/types.rs +0 -861
- package/crates/team-agent/src/lifecycle/worker_command_context.rs +0 -370
- package/crates/team-agent/src/main.rs +0 -52
- package/crates/team-agent/src/mcp_server/helpers.rs +0 -510
- package/crates/team-agent/src/mcp_server/lifecycle_tools/mod.rs +0 -6
- package/crates/team-agent/src/mcp_server/lifecycle_tools/state_status.rs +0 -43
- package/crates/team-agent/src/mcp_server/mod.rs +0 -119
- package/crates/team-agent/src/mcp_server/normalize.rs +0 -485
- package/crates/team-agent/src/mcp_server/readiness.rs +0 -546
- package/crates/team-agent/src/mcp_server/readiness_tests.rs +0 -369
- package/crates/team-agent/src/mcp_server/tests/golden.rs +0 -285
- package/crates/team-agent/src/mcp_server/tests/normalize.rs +0 -247
- package/crates/team-agent/src/mcp_server/tests/scoped.rs +0 -168
- package/crates/team-agent/src/mcp_server/tests/send.rs +0 -388
- package/crates/team-agent/src/mcp_server/tests/tools.rs +0 -343
- package/crates/team-agent/src/mcp_server/tests/wire.rs +0 -254
- package/crates/team-agent/src/mcp_server/tests.rs +0 -43
- package/crates/team-agent/src/mcp_server/tools.rs +0 -1015
- package/crates/team-agent/src/mcp_server/types.rs +0 -396
- package/crates/team-agent/src/mcp_server/wire.rs +0 -867
- package/crates/team-agent/src/messaging/activity.rs +0 -461
- package/crates/team-agent/src/messaging/address.rs +0 -87
- package/crates/team-agent/src/messaging/delivery.rs +0 -3785
- package/crates/team-agent/src/messaging/delivery_consumption_tests.rs +0 -234
- package/crates/team-agent/src/messaging/enter_rescue.rs +0 -362
- package/crates/team-agent/src/messaging/enter_rescue_tests.rs +0 -633
- package/crates/team-agent/src/messaging/helpers.rs +0 -354
- package/crates/team-agent/src/messaging/leader_channel.rs +0 -287
- package/crates/team-agent/src/messaging/leader_receiver.rs +0 -786
- package/crates/team-agent/src/messaging/mod.rs +0 -166
- package/crates/team-agent/src/messaging/persist.rs +0 -377
- package/crates/team-agent/src/messaging/presentation.rs +0 -417
- package/crates/team-agent/src/messaging/results/collection_tests.rs +0 -719
- package/crates/team-agent/src/messaging/results.rs +0 -1415
- package/crates/team-agent/src/messaging/scheduler.rs +0 -217
- package/crates/team-agent/src/messaging/selftest.rs +0 -315
- package/crates/team-agent/src/messaging/send.rs +0 -981
- package/crates/team-agent/src/messaging/tests/basic.rs +0 -346
- package/crates/team-agent/src/messaging/tests/dup_inject.rs +0 -551
- package/crates/team-agent/src/messaging/tests/e23.rs +0 -49
- package/crates/team-agent/src/messaging/tests/leader_channel.rs +0 -169
- package/crates/team-agent/src/messaging/tests/leader_inject_acceptance.rs +0 -817
- package/crates/team-agent/src/messaging/tests/main_preserved.rs +0 -85
- package/crates/team-agent/src/messaging/tests/mod.rs +0 -306
- package/crates/team-agent/src/messaging/tests/runtime.rs +0 -3655
- package/crates/team-agent/src/messaging/tests/spine.rs +0 -837
- package/crates/team-agent/src/messaging/tests/wave2.rs +0 -381
- package/crates/team-agent/src/messaging/trust.rs +0 -215
- package/crates/team-agent/src/messaging/types.rs +0 -471
- package/crates/team-agent/src/messaging/wait.rs +0 -366
- package/crates/team-agent/src/messaging/watchers.rs +0 -916
- package/crates/team-agent/src/model/enums.rs +0 -356
- package/crates/team-agent/src/model/errors.rs +0 -18
- package/crates/team-agent/src/model/ids.rs +0 -165
- package/crates/team-agent/src/model/mod.rs +0 -29
- package/crates/team-agent/src/model/name_similarity.rs +0 -252
- package/crates/team-agent/src/model/pane_authority_refusal.rs +0 -359
- package/crates/team-agent/src/model/paths.rs +0 -257
- package/crates/team-agent/src/model/routing.rs +0 -387
- package/crates/team-agent/src/model/spec.rs +0 -1184
- package/crates/team-agent/src/model/task_graph.rs +0 -321
- package/crates/team-agent/src/model/testdata/fuzz.golden.yaml +0 -43
- package/crates/team-agent/src/model/testdata/fuzz.yaml +0 -43
- package/crates/team-agent/src/model/testdata/spec_invalid_a.yaml +0 -209
- package/crates/team-agent/src/model/testdata/team.spec.golden.yaml +0 -208
- package/crates/team-agent/src/model/testdata/team.spec.yaml +0 -208
- package/crates/team-agent/src/model/yaml/tests.rs +0 -188
- package/crates/team-agent/src/model/yaml.rs +0 -802
- package/crates/team-agent/src/os_probe.rs +0 -280
- package/crates/team-agent/src/packaging/install.rs +0 -219
- package/crates/team-agent/src/packaging/migrate.rs +0 -38
- package/crates/team-agent/src/packaging/mod.rs +0 -91
- package/crates/team-agent/src/packaging/repair.rs +0 -33
- package/crates/team-agent/src/packaging/tests.rs +0 -822
- package/crates/team-agent/src/packaging/types.rs +0 -417
- package/crates/team-agent/src/platform/argv.rs +0 -331
- package/crates/team-agent/src/platform/errors.rs +0 -104
- package/crates/team-agent/src/platform/file_lock.rs +0 -279
- package/crates/team-agent/src/platform/mod.rs +0 -5
- package/crates/team-agent/src/platform/process.rs +0 -545
- package/crates/team-agent/src/provider/adapter.rs +0 -898
- package/crates/team-agent/src/provider/adapters/copilot.rs +0 -75
- package/crates/team-agent/src/provider/adapters/copilot_fork.rs +0 -307
- package/crates/team-agent/src/provider/adapters/fake.rs +0 -18
- package/crates/team-agent/src/provider/adapters/mod.rs +0 -28
- package/crates/team-agent/src/provider/approvals/mod.rs +0 -3
- package/crates/team-agent/src/provider/approvals/parsing.rs +0 -586
- package/crates/team-agent/src/provider/approvals/runtime_prompts.rs +0 -205
- package/crates/team-agent/src/provider/argv_route.rs +0 -405
- package/crates/team-agent/src/provider/bypass_flags.rs +0 -116
- package/crates/team-agent/src/provider/classify.rs +0 -773
- package/crates/team-agent/src/provider/command_helpers.rs +0 -45
- package/crates/team-agent/src/provider/faults.rs +0 -165
- package/crates/team-agent/src/provider/helpers.rs +0 -52
- package/crates/team-agent/src/provider/mod.rs +0 -78
- package/crates/team-agent/src/provider/model_catalog.rs +0 -722
- package/crates/team-agent/src/provider/session/capture.rs +0 -2631
- package/crates/team-agent/src/provider/session/context_fork/outcome.rs +0 -168
- package/crates/team-agent/src/provider/session/context_fork.rs +0 -264
- package/crates/team-agent/src/provider/session/mod.rs +0 -36
- package/crates/team-agent/src/provider/session/resume.rs +0 -269
- package/crates/team-agent/src/provider/session_scan/common/tests.rs +0 -316
- package/crates/team-agent/src/provider/session_scan/common.rs +0 -618
- package/crates/team-agent/src/provider/session_scan/copilot.rs +0 -280
- package/crates/team-agent/src/provider/session_scan/pi.rs +0 -152
- package/crates/team-agent/src/provider/session_scan.rs +0 -61
- package/crates/team-agent/src/provider/startup_prompt.rs +0 -757
- package/crates/team-agent/src/provider/submit_now.rs +0 -71
- package/crates/team-agent/src/provider/testdata/copilot-ready-marker.txt +0 -5
- package/crates/team-agent/src/provider/testdata/copilot-trust-prompt.txt +0 -19
- package/crates/team-agent/src/provider/testdata/grok-models-authenticated.stdout +0 -9
- package/crates/team-agent/src/provider/testdata/grok-models-unauthenticated.stdout +0 -7
- package/crates/team-agent/src/provider/tests/adapter.rs +0 -354
- package/crates/team-agent/src/provider/tests/classify.rs +0 -201
- package/crates/team-agent/src/provider/tests/command_helpers.rs +0 -26
- package/crates/team-agent/src/provider/tests/copilot_fork.rs +0 -191
- package/crates/team-agent/src/provider/tests/faults.rs +0 -200
- package/crates/team-agent/src/provider/tests/idle.rs +0 -140
- package/crates/team-agent/src/provider/tests/wire.rs +0 -213
- package/crates/team-agent/src/provider/tests.rs +0 -32
- package/crates/team-agent/src/provider/types.rs +0 -529
- package/crates/team-agent/src/provider/wire.rs +0 -406
- package/crates/team-agent/src/redaction.rs +0 -259
- package/crates/team-agent/src/state/abnormal_watch/tests/mod.rs +0 -248
- package/crates/team-agent/src/state/abnormal_watch.rs +0 -144
- package/crates/team-agent/src/state/identity.rs +0 -914
- package/crates/team-agent/src/state/identity_keys.rs +0 -132
- package/crates/team-agent/src/state/mod.rs +0 -74
- package/crates/team-agent/src/state/owner_gate.rs +0 -482
- package/crates/team-agent/src/state/ownership.rs +0 -563
- package/crates/team-agent/src/state/paths.rs +0 -395
- package/crates/team-agent/src/state/persist.rs +0 -3811
- package/crates/team-agent/src/state/projection.rs +0 -1508
- package/crates/team-agent/src/state/repository/intent.rs +0 -14
- package/crates/team-agent/src/state/repository/tests.rs +0 -184
- package/crates/team-agent/src/state/repository.rs +0 -866
- package/crates/team-agent/src/state/selector.rs +0 -160
- package/crates/team-agent/src/state/testdata/state-rich.canonical.json +0 -133
- package/crates/team-agent/src/tmux_backend/enter_rescue.rs +0 -325
- package/crates/team-agent/src/tmux_backend/enter_rescue_tests.rs +0 -432
- package/crates/team-agent/src/tmux_backend/native_input.rs +0 -513
- package/crates/team-agent/src/tmux_backend/native_input_tests.rs +0 -742
- package/crates/team-agent/src/tmux_backend/tests.rs +0 -4254
- package/crates/team-agent/src/tmux_backend.rs +0 -4527
- package/crates/team-agent/src/topology.rs +0 -537
- package/crates/team-agent/src/transport/enter_rescue.rs +0 -166
- package/crates/team-agent/src/transport/native_input.rs +0 -491
- package/crates/team-agent/src/transport/test_support.rs +0 -743
- package/crates/team-agent/src/transport/tests/behavior.rs +0 -326
- package/crates/team-agent/src/transport/tests/mod.rs +0 -194
- package/crates/team-agent/src/transport/tests/wire.rs +0 -574
- package/crates/team-agent/src/transport.rs +0 -1655
- package/crates/team-agent/src/transport_factory.rs +0 -819
package/crates/team-agent/src/leader/tests/terminal_and_replay_vs_rerender_invariants_red.rs
DELETED
|
@@ -1,417 +0,0 @@
|
|
|
1
|
-
//! RED contract — 0.5.57 typed-state car · batch F
|
|
2
|
-
//! Terminal-state immutability + framework-replay vs provider-re-render
|
|
3
|
-
//! diagnostic separation.
|
|
4
|
-
//!
|
|
5
|
-
//! LINEAGE:
|
|
6
|
-
//! - Baseline: 5b847e4 (0.5.56 tested tip).
|
|
7
|
-
//! - Distillation §1.4 "两种历史消息重现必须分诊" and §3.3#5
|
|
8
|
-
//! "Submitted→Delivered 后任何 claim/attach/restart 都不可逆".
|
|
9
|
-
//! - Storm remote-control export proved that `delivered` was never
|
|
10
|
-
//! re-injected (attempts / delivered_at unchanged); the provider
|
|
11
|
-
//! re-rendered the historical transcript on `codex resume`. Any
|
|
12
|
-
//! diagnostic that conflates the two will misattribute
|
|
13
|
-
//! provider-side redraw as a framework replay.
|
|
14
|
-
//!
|
|
15
|
-
//! TEETH (RED at 5b847e4):
|
|
16
|
-
//! 1. `delivered_row_immutable_under_any_transition`
|
|
17
|
-
//! — a `delivered` row's `delivered_at`, `delivery_attempts`,
|
|
18
|
-
//! `status` and delivery token must be BYTE-STABLE across any
|
|
19
|
-
//! claim/attach/requeue call from the typed-state surface.
|
|
20
|
-
//! Baseline: passes (invariant lock) → green.
|
|
21
|
-
//! 2. `acknowledged_row_immutable_under_generic_mark`
|
|
22
|
-
//! — an `acknowledged` row must not be overwritten by a generic
|
|
23
|
-
//! `store.mark` call that could regress it to a delivery status.
|
|
24
|
-
//! Baseline: distillation §1.2 acknowledged row notes "current
|
|
25
|
-
//! guard still allows other status to overwrite; typed car needs
|
|
26
|
-
//! to tighten." → red.
|
|
27
|
-
//! 3. `consumed_row_immutable_under_any_transition`
|
|
28
|
-
//! — a `consumed` row must not re-enter any recovery arm.
|
|
29
|
-
//! Baseline: source scan — no explicit exclusion. → red.
|
|
30
|
-
//! 4. `typed_event_carries_replay_vs_rerender_kind`
|
|
31
|
-
//! — the framework must emit a typed marker distinguishing
|
|
32
|
-
//! `framework_replay` (new attempt) from `provider_rerender`
|
|
33
|
-
//! (transcript redraw, no new attempt). Baseline: no such
|
|
34
|
-
//! marker; every `send.injected` looks the same regardless of
|
|
35
|
-
//! whether it is a fresh submit or a resume redraw. → red.
|
|
36
|
-
//! 5. `restart_never_marks_delivered_as_accepted`
|
|
37
|
-
//! — a restart / resume path must not translate a re-rendered
|
|
38
|
-
//! transcript token into a new `messages.status = 'accepted'`
|
|
39
|
-
//! write for an already-`delivered` row. Baseline (invariant
|
|
40
|
-
//! lock, storm proved): green.
|
|
41
|
-
//!
|
|
42
|
-
//! POSITIVE CONTROL:
|
|
43
|
-
//! 6. `delivered_to_acknowledged_transition_still_allowed` — the
|
|
44
|
-
//! legitimate business terminal transition (delivered →
|
|
45
|
-
//! acknowledged via the ack API) must remain functional.
|
|
46
|
-
//!
|
|
47
|
-
//! NEGATIVE CONTROL:
|
|
48
|
-
//! 7. `stray_ack_call_does_not_promote_pending_row_to_acknowledged`
|
|
49
|
-
//! — a mis-scoped ack call must not skip a row's delivery lifecycle
|
|
50
|
-
//! and jump straight from `accepted` to `acknowledged`.
|
|
51
|
-
//!
|
|
52
|
-
//! FROZEN by verifier — do NOT modify without a new SHA256 signature.
|
|
53
|
-
|
|
54
|
-
#![cfg(unix)]
|
|
55
|
-
#![allow(clippy::expect_used, clippy::panic, clippy::unwrap_used)]
|
|
56
|
-
|
|
57
|
-
use crate as team_agent;
|
|
58
|
-
|
|
59
|
-
#[path = "rehomed_env.rs"]
|
|
60
|
-
mod rehomed_env;
|
|
61
|
-
|
|
62
|
-
use std::path::PathBuf;
|
|
63
|
-
use std::sync::atomic::{AtomicU64, Ordering};
|
|
64
|
-
|
|
65
|
-
use rusqlite::params;
|
|
66
|
-
use serial_test::serial;
|
|
67
|
-
use team_agent::event_log::EventLog;
|
|
68
|
-
use team_agent::leader::{claim_lease_no_incident, LeaseStatus};
|
|
69
|
-
use team_agent::message_store::MessageStore;
|
|
70
|
-
use team_agent::messaging::enqueue_leader_mailbox_until_attach;
|
|
71
|
-
use team_agent::messaging::watchers::requeue_after_claim_leader;
|
|
72
|
-
use team_agent::model::enums::PaneLiveness;
|
|
73
|
-
use team_agent::model::ids::TeamKey;
|
|
74
|
-
use team_agent::state::owner_gate::PaneLivenessProbe;
|
|
75
|
-
use team_agent::transport::PaneId;
|
|
76
|
-
|
|
77
|
-
const TEAM: &str = "current";
|
|
78
|
-
const PANE: &str = "%leader";
|
|
79
|
-
|
|
80
|
-
struct LiveCaller;
|
|
81
|
-
impl PaneLivenessProbe for LiveCaller {
|
|
82
|
-
fn liveness(&self, pane_id: &str) -> PaneLiveness {
|
|
83
|
-
if pane_id == PANE {
|
|
84
|
-
PaneLiveness::Live
|
|
85
|
-
} else {
|
|
86
|
-
PaneLiveness::Dead
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
fn bound_state() -> serde_json::Value {
|
|
92
|
-
serde_json::json!({
|
|
93
|
-
"session_name": "team-terminal-inv",
|
|
94
|
-
"team_owner": {
|
|
95
|
-
"pane_id": PANE, "provider": "codex", "owner_epoch": 7,
|
|
96
|
-
"claimed_at": "2026-07-24T00:00:00Z", "claimed_via": "claim-leader"
|
|
97
|
-
},
|
|
98
|
-
"leader_receiver": {
|
|
99
|
-
"pane_id": PANE, "provider": "codex", "owner_epoch": 7, "status": "attached"
|
|
100
|
-
}
|
|
101
|
-
})
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
struct TermCase {
|
|
105
|
-
_env: rehomed_env::RehomedTestEnv,
|
|
106
|
-
workspace: PathBuf,
|
|
107
|
-
store: MessageStore,
|
|
108
|
-
event_log: EventLog,
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
impl TermCase {
|
|
112
|
-
fn new(tag: &str) -> Self {
|
|
113
|
-
static N: AtomicU64 = AtomicU64::new(0);
|
|
114
|
-
let env = rehomed_env::RehomedTestEnv::enter(tag);
|
|
115
|
-
let workspace = env.workspace(&format!(
|
|
116
|
-
"057f-term-{tag}-{}",
|
|
117
|
-
N.fetch_add(1, Ordering::Relaxed)
|
|
118
|
-
));
|
|
119
|
-
let store = MessageStore::open(&workspace).unwrap();
|
|
120
|
-
let event_log = EventLog::new(&workspace);
|
|
121
|
-
Self {
|
|
122
|
-
_env: env,
|
|
123
|
-
workspace,
|
|
124
|
-
store,
|
|
125
|
-
event_log,
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
fn seed(&self, content: &str, status: &str, delivered_at: Option<&str>) -> String {
|
|
130
|
-
let mid = enqueue_leader_mailbox_until_attach(
|
|
131
|
-
&self.workspace,
|
|
132
|
-
TEAM,
|
|
133
|
-
content,
|
|
134
|
-
None,
|
|
135
|
-
"leader",
|
|
136
|
-
&self.event_log,
|
|
137
|
-
)
|
|
138
|
-
.unwrap()
|
|
139
|
-
.message_id
|
|
140
|
-
.expect("mailbox enqueue");
|
|
141
|
-
let conn = team_agent::db::schema::open_db(self.store.db_path()).unwrap();
|
|
142
|
-
conn.execute(
|
|
143
|
-
"update messages set status = ?2, delivered_at = ?3, delivery_attempts = 1
|
|
144
|
-
where message_id = ?1",
|
|
145
|
-
params![mid, status, delivered_at],
|
|
146
|
-
)
|
|
147
|
-
.unwrap();
|
|
148
|
-
mid
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
fn full(&self, mid: &str) -> (String, Option<String>, i64) {
|
|
152
|
-
let conn = team_agent::db::schema::open_db(self.store.db_path()).unwrap();
|
|
153
|
-
conn.query_row(
|
|
154
|
-
"select status, delivered_at, delivery_attempts from messages where message_id = ?1",
|
|
155
|
-
params![mid],
|
|
156
|
-
|row| Ok((row.get(0)?, row.get(1)?, row.get(2)?)),
|
|
157
|
-
)
|
|
158
|
-
.unwrap()
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
fn claim_and_requeue(&self) -> LeaseStatus {
|
|
162
|
-
let team = TeamKey::new(TEAM.to_string());
|
|
163
|
-
let pane = PaneId::new(PANE);
|
|
164
|
-
let mut state = bound_state();
|
|
165
|
-
let result = claim_lease_no_incident(
|
|
166
|
-
&self.workspace,
|
|
167
|
-
&mut state,
|
|
168
|
-
None,
|
|
169
|
-
&team,
|
|
170
|
-
&pane,
|
|
171
|
-
true,
|
|
172
|
-
&self.event_log,
|
|
173
|
-
&LiveCaller,
|
|
174
|
-
)
|
|
175
|
-
.unwrap();
|
|
176
|
-
if result.ok {
|
|
177
|
-
let _ = requeue_after_claim_leader(
|
|
178
|
-
&self.workspace,
|
|
179
|
-
&self.store,
|
|
180
|
-
&self.event_log,
|
|
181
|
-
&team,
|
|
182
|
-
result.bound_pane_id.as_ref().expect("pane"),
|
|
183
|
-
None,
|
|
184
|
-
)
|
|
185
|
-
.unwrap();
|
|
186
|
-
}
|
|
187
|
-
result.status
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
// ---------------------------------------------------------------------------
|
|
192
|
-
// Tooth 1 — delivered row is byte-stable across claim (invariant lock)
|
|
193
|
-
// ---------------------------------------------------------------------------
|
|
194
|
-
|
|
195
|
-
#[test]
|
|
196
|
-
#[serial(env)]
|
|
197
|
-
fn delivered_row_immutable_under_any_transition() {
|
|
198
|
-
let case = TermCase::new("delivered-lock");
|
|
199
|
-
let mid = case.seed(
|
|
200
|
-
"delivered canary",
|
|
201
|
-
"delivered",
|
|
202
|
-
Some("2026-07-21T12:00:00Z"),
|
|
203
|
-
);
|
|
204
|
-
let before = case.full(&mid);
|
|
205
|
-
let _ = case.claim_and_requeue();
|
|
206
|
-
let after = case.full(&mid);
|
|
207
|
-
assert_eq!(
|
|
208
|
-
before, after,
|
|
209
|
-
"delivered row must be byte-stable across any typed-state transition; \
|
|
210
|
-
a re-enqueue would create a second physical submit for a message the \
|
|
211
|
-
framework already saw succeed. §3.3#5 + storm proof."
|
|
212
|
-
);
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
// ---------------------------------------------------------------------------
|
|
216
|
-
// Tooth 2 — acknowledged row cannot be regressed by generic mark
|
|
217
|
-
// ---------------------------------------------------------------------------
|
|
218
|
-
|
|
219
|
-
#[test]
|
|
220
|
-
#[serial(env)]
|
|
221
|
-
fn acknowledged_row_immutable_under_generic_mark() {
|
|
222
|
-
let case = TermCase::new("ack-lock");
|
|
223
|
-
let mid = case.seed("acked canary", "acknowledged", Some("2026-07-21T12:00:00Z"));
|
|
224
|
-
let before = case.full(&mid);
|
|
225
|
-
// Baseline weakness (distillation §1.2 acknowledged note): a generic
|
|
226
|
-
// `store.mark(mid, "target_resolved", None)` currently succeeds and
|
|
227
|
-
// silently regresses the row. Typed refactor MUST make this a
|
|
228
|
-
// hard-refused transition (typed error).
|
|
229
|
-
let mark_result = case.store.mark(&mid, "target_resolved", None);
|
|
230
|
-
let after = case.full(&mid);
|
|
231
|
-
assert!(
|
|
232
|
-
mark_result.is_err() || after == before,
|
|
233
|
-
"acknowledged row was regressed by a generic mark call: before={:?} \
|
|
234
|
-
after={:?} mark_result={:?}. §1.2 requires terminal states to refuse \
|
|
235
|
-
any downgrade from a non-ack API; typed refactor must return a typed \
|
|
236
|
-
error rather than silently overwrite.",
|
|
237
|
-
before,
|
|
238
|
-
after,
|
|
239
|
-
mark_result
|
|
240
|
-
);
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
// ---------------------------------------------------------------------------
|
|
244
|
-
// Tooth 3 — consumed row is untouchable by any recovery arm
|
|
245
|
-
// ---------------------------------------------------------------------------
|
|
246
|
-
|
|
247
|
-
#[test]
|
|
248
|
-
#[serial(env)]
|
|
249
|
-
fn consumed_row_immutable_under_any_transition() {
|
|
250
|
-
let case = TermCase::new("consumed-lock");
|
|
251
|
-
let mid = case.seed("consumed canary", "consumed", None);
|
|
252
|
-
let before = case.full(&mid);
|
|
253
|
-
// A generic mark attempt should also refuse to regress a `consumed`
|
|
254
|
-
// row. Baseline: the same generic mark path applies, distillation
|
|
255
|
-
// §1.2 already flags this. Also verify claim/requeue does not touch
|
|
256
|
-
// it.
|
|
257
|
-
let mark_result = case.store.mark(&mid, "accepted", None);
|
|
258
|
-
let _ = case.claim_and_requeue();
|
|
259
|
-
let after = case.full(&mid);
|
|
260
|
-
assert!(
|
|
261
|
-
(mark_result.is_err() || after.0 == "consumed") && after.0 == "consumed",
|
|
262
|
-
"consumed row was affected: before={:?} after={:?} mark_result={:?}. \
|
|
263
|
-
§1.2 consumed is a terminal disposition; typed refactor must refuse \
|
|
264
|
-
any downgrade or requeue.",
|
|
265
|
-
before,
|
|
266
|
-
after,
|
|
267
|
-
mark_result
|
|
268
|
-
);
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
// ---------------------------------------------------------------------------
|
|
272
|
-
// Tooth 4 — typed event carries framework_replay vs provider_rerender kind
|
|
273
|
-
// ---------------------------------------------------------------------------
|
|
274
|
-
|
|
275
|
-
#[test]
|
|
276
|
-
#[serial(env)]
|
|
277
|
-
fn typed_event_carries_replay_vs_rerender_kind() {
|
|
278
|
-
// Source-shape probe: the delivery + acceptance event schemas must
|
|
279
|
-
// include a typed `redisplay_kind` (or equivalent) enum with at
|
|
280
|
-
// least the two values.
|
|
281
|
-
let manifest = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
|
|
282
|
-
let src = manifest.join("src");
|
|
283
|
-
let mut has_marker = false;
|
|
284
|
-
fn walk(dir: &std::path::Path, has_marker: &mut bool) {
|
|
285
|
-
let Ok(es) = std::fs::read_dir(dir) else {
|
|
286
|
-
return;
|
|
287
|
-
};
|
|
288
|
-
for e in es.flatten() {
|
|
289
|
-
let p = e.path();
|
|
290
|
-
if p.is_dir() {
|
|
291
|
-
walk(&p, has_marker);
|
|
292
|
-
} else if p.extension().and_then(|s| s.to_str()) == Some("rs") {
|
|
293
|
-
if let Ok(t) = std::fs::read_to_string(&p) {
|
|
294
|
-
if (t.contains("framework_replay") && t.contains("provider_rerender"))
|
|
295
|
-
|| t.contains("RedisplayKind::FrameworkReplay")
|
|
296
|
-
|| t.contains("RedisplayKind::ProviderRerender")
|
|
297
|
-
{
|
|
298
|
-
*has_marker = true;
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
walk(&src, &mut has_marker);
|
|
305
|
-
assert!(
|
|
306
|
-
has_marker,
|
|
307
|
-
"no typed redisplay-kind marker found (framework_replay / provider_rerender). \
|
|
308
|
-
§1.4 requires diagnostics to distinguish framework replay (new attempt) from \
|
|
309
|
-
provider re-render (transcript redraw, no new attempt). Baseline: every \
|
|
310
|
-
'send.injected' event looks identical."
|
|
311
|
-
);
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
// ---------------------------------------------------------------------------
|
|
315
|
-
// Tooth 5 — restart never marks delivered as accepted (invariant lock)
|
|
316
|
-
// ---------------------------------------------------------------------------
|
|
317
|
-
|
|
318
|
-
#[test]
|
|
319
|
-
#[serial(env)]
|
|
320
|
-
fn restart_never_marks_delivered_as_accepted() {
|
|
321
|
-
// Source-scan: no file may contain a SQL literal that translates a
|
|
322
|
-
// `delivered` row to `accepted`. We check for the substring
|
|
323
|
-
// `set status = 'accepted'` inside any block that also mentions
|
|
324
|
-
// `delivered`. This is a coarse guard; the more precise test lives
|
|
325
|
-
// in tooth 1 (behavioral). Both are cheap and complementary.
|
|
326
|
-
let manifest = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
|
|
327
|
-
let src = manifest.join("src");
|
|
328
|
-
let mut violations: Vec<PathBuf> = Vec::new();
|
|
329
|
-
fn walk(dir: &std::path::Path, out: &mut Vec<PathBuf>) {
|
|
330
|
-
let Ok(es) = std::fs::read_dir(dir) else {
|
|
331
|
-
return;
|
|
332
|
-
};
|
|
333
|
-
for e in es.flatten() {
|
|
334
|
-
let p = e.path();
|
|
335
|
-
if p.is_dir() {
|
|
336
|
-
if p.file_name().and_then(|s| s.to_str()) == Some("tests") {
|
|
337
|
-
continue;
|
|
338
|
-
}
|
|
339
|
-
walk(&p, out);
|
|
340
|
-
} else if p.extension().and_then(|s| s.to_str()) == Some("rs") {
|
|
341
|
-
if let Ok(t) = std::fs::read_to_string(&p) {
|
|
342
|
-
let lines: Vec<&str> = t.lines().collect();
|
|
343
|
-
for (i, l) in lines.iter().enumerate() {
|
|
344
|
-
if l.contains("set status = 'accepted'") {
|
|
345
|
-
let start = i.saturating_sub(20);
|
|
346
|
-
let end = (i + 20).min(lines.len());
|
|
347
|
-
let window = lines[start..end].join("\n");
|
|
348
|
-
// Trigger only if `delivered` (not
|
|
349
|
-
// `delivered_at` alone) is treated as
|
|
350
|
-
// eligible.
|
|
351
|
-
if window.contains("status = 'delivered'")
|
|
352
|
-
|| window.contains("'delivered'")
|
|
353
|
-
{
|
|
354
|
-
out.push(p.clone());
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
walk(&src, &mut violations);
|
|
363
|
-
// 0.5.55 storm proved this invariant held (delivered was untouched).
|
|
364
|
-
// Green at baseline; locked here.
|
|
365
|
-
assert!(
|
|
366
|
-
violations.is_empty(),
|
|
367
|
-
"regression: SQL that flips a `delivered` row to `accepted` found: {:?}. \
|
|
368
|
-
§3.3#5 storm proof — delivered must be irreversibly terminal.",
|
|
369
|
-
violations
|
|
370
|
-
);
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
// ---------------------------------------------------------------------------
|
|
374
|
-
// Tooth 6 — positive control: delivered→acknowledged is still supported
|
|
375
|
-
// ---------------------------------------------------------------------------
|
|
376
|
-
|
|
377
|
-
#[test]
|
|
378
|
-
#[serial(env)]
|
|
379
|
-
fn delivered_to_acknowledged_transition_still_allowed() {
|
|
380
|
-
let case = TermCase::new("pos-ack");
|
|
381
|
-
let mid = case.seed("business ack", "delivered", Some("2026-07-24T00:01:00Z"));
|
|
382
|
-
// Business ack path: mark the row acknowledged via the store API.
|
|
383
|
-
let r = case.store.mark(&mid, "acknowledged", None);
|
|
384
|
-
let (status, _, _) = case.full(&mid);
|
|
385
|
-
assert!(
|
|
386
|
-
r.is_ok() && status == "acknowledged",
|
|
387
|
-
"delivered → acknowledged legitimate business transition must remain \
|
|
388
|
-
functional (mark_result={:?}, status={})",
|
|
389
|
-
r,
|
|
390
|
-
status
|
|
391
|
-
);
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
// ---------------------------------------------------------------------------
|
|
395
|
-
// Tooth 7 — negative control: stray ack cannot leapfrog delivery
|
|
396
|
-
// ---------------------------------------------------------------------------
|
|
397
|
-
|
|
398
|
-
#[test]
|
|
399
|
-
#[serial(env)]
|
|
400
|
-
fn stray_ack_call_does_not_promote_pending_row_to_acknowledged() {
|
|
401
|
-
let case = TermCase::new("neg-stray-ack");
|
|
402
|
-
let mid = case.seed("pending row", "accepted", None);
|
|
403
|
-
let mark_result = case.store.mark(&mid, "acknowledged", None);
|
|
404
|
-
let (status, _, _) = case.full(&mid);
|
|
405
|
-
// Baseline weakness: generic mark permits a jump. Typed refactor
|
|
406
|
-
// must refuse. If mark succeeds today, this tooth is red; if it
|
|
407
|
-
// refuses, tooth stays green.
|
|
408
|
-
assert!(
|
|
409
|
-
mark_result.is_err() || status != "acknowledged",
|
|
410
|
-
"generic mark leap-frogged an accepted row directly to acknowledged \
|
|
411
|
-
(mark_result={:?}, status={}). §1.2 acknowledged transition must be \
|
|
412
|
-
enforced through the ack API's lifecycle guard, not permitted by \
|
|
413
|
-
any writer.",
|
|
414
|
-
mark_result,
|
|
415
|
-
status
|
|
416
|
-
);
|
|
417
|
-
}
|
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
use super::*;
|
|
2
|
-
|
|
3
|
-
#[path = "../../../tests/support/hermetic.rs"]
|
|
4
|
-
mod hermetic;
|
|
5
|
-
|
|
6
|
-
// =====================================================================
|
|
7
|
-
// 5. leader_session_name — sha1 派生 + 文件夹消毒(unimplemented → RED)
|
|
8
|
-
// =====================================================================
|
|
9
|
-
|
|
10
|
-
// 公式:team-agent-leader-<provider>-<sanitized folder[:48]>-<sha1(resolve(ws))[:8]>。
|
|
11
|
-
// 用真实 temp 目录,sha1/sanitize 在测试内复算后断言函数输出与之一致(probe 已验证公式)。
|
|
12
|
-
#[test]
|
|
13
|
-
fn leader_session_name_formula_and_sanitization() {
|
|
14
|
-
// 公式 = team-agent-leader-<provider>-<sanitized folder>-<sha1(resolve(ws))[:8]>。
|
|
15
|
-
// sha1 复算需 sha1 crate(本测试不引);改为断言格式不变量(provider/消毒/8-hex 后缀),
|
|
16
|
-
// 字节级 sha1 由 golden probe_leader.py 已验证公式正确。
|
|
17
|
-
let base = std::env::temp_dir().join(format!("ta_rs_lsn_{}", std::process::id()));
|
|
18
|
-
let weird = base.join("My Proj!@#name");
|
|
19
|
-
std::fs::create_dir_all(&weird).unwrap();
|
|
20
|
-
let got = leader_session_name(Provider::Codex, &weird);
|
|
21
|
-
// 前缀 + provider + 消毒后的 folder(非字母数字_.- → '_')。
|
|
22
|
-
let s = got.as_str();
|
|
23
|
-
assert!(
|
|
24
|
-
s.starts_with("team-agent-leader-codex-My_Proj___name-"),
|
|
25
|
-
"got {s}"
|
|
26
|
-
);
|
|
27
|
-
// sha1[:8] 后缀:8 个 hex。
|
|
28
|
-
let suffix = s.rsplit('-').next().unwrap();
|
|
29
|
-
assert_eq!(suffix.len(), 8, "sha1 前缀须 8 hex,got {suffix}");
|
|
30
|
-
assert!(suffix.chars().all(|c| c.is_ascii_hexdigit()));
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// folder 名消毒成空 → 回退 "workspace"(probe_leader.py allsym 用例)。
|
|
34
|
-
#[test]
|
|
35
|
-
fn leader_session_name_empty_sanitized_folder_falls_back_to_workspace() {
|
|
36
|
-
let base = std::env::temp_dir().join(format!("ta_rs_lsn2_{}", std::process::id()));
|
|
37
|
-
// 全符号目录名 → 消毒后 strip('._-') 为空 → "workspace"。
|
|
38
|
-
let allsym = base.join("@@@");
|
|
39
|
-
std::fs::create_dir_all(&allsym).unwrap();
|
|
40
|
-
let got = leader_session_name(Provider::Codex, &allsym);
|
|
41
|
-
assert!(
|
|
42
|
-
got.as_str().contains("-workspace-"),
|
|
43
|
-
"全符号 folder 应回退 'workspace',got {}",
|
|
44
|
-
got.as_str()
|
|
45
|
-
);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
// claude_code provider 出现在 session 名里(probe:team-agent-leader-claude_code-...)。
|
|
49
|
-
#[test]
|
|
50
|
-
fn leader_session_name_uses_claude_code_provider_string() {
|
|
51
|
-
let base = std::env::temp_dir().join(format!("ta_rs_lsn3_{}", std::process::id()));
|
|
52
|
-
let dir = base.join("proj");
|
|
53
|
-
std::fs::create_dir_all(&dir).unwrap();
|
|
54
|
-
let got = leader_session_name(Provider::ClaudeCode, &dir);
|
|
55
|
-
assert!(
|
|
56
|
-
got.as_str()
|
|
57
|
-
.starts_with("team-agent-leader-claude_code-proj-"),
|
|
58
|
-
"got {}",
|
|
59
|
-
got.as_str()
|
|
60
|
-
);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
#[test]
|
|
64
|
-
fn leader_session_name_uses_copilot_provider_string() {
|
|
65
|
-
let base = std::env::temp_dir().join(format!("ta_rs_lsn_copilot_{}", std::process::id()));
|
|
66
|
-
let dir = base.join("proj");
|
|
67
|
-
std::fs::create_dir_all(&dir).unwrap();
|
|
68
|
-
let got = leader_session_name(Provider::Copilot, &dir);
|
|
69
|
-
assert!(
|
|
70
|
-
got.as_str().starts_with("team-agent-leader-copilot-proj-"),
|
|
71
|
-
"got {}",
|
|
72
|
-
got.as_str()
|
|
73
|
-
);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// =====================================================================
|
|
77
|
-
// 6. Family A 正源 owner 绑定 — bind_owner_from_caller_pane(unimplemented → RED)
|
|
78
|
-
// =====================================================================
|
|
79
|
-
|
|
80
|
-
// $TMUX_PANE 缺 → refuse + reason=caller_pane_missing(leader_binding.py:79-95)。
|
|
81
|
-
// 此处只能在 $TMUX_PANE 缺失环境下断言(测试进程通常无 TMUX_PANE)。
|
|
82
|
-
#[test]
|
|
83
|
-
fn bind_owner_refuses_when_caller_pane_missing() {
|
|
84
|
-
// 防御:确保本测试看到的环境无 TMUX_PANE(若 CI 在 tmux 内跑,跳过断言形态)。
|
|
85
|
-
if std::env::var_os("TMUX_PANE").is_some() {
|
|
86
|
-
// 在 tmux 内:正源存在,不该走 refuse 分支;此用例只验缺失分支,直接返回。
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
let ws = std::env::temp_dir().join(format!("ta_rs_bind_{}", std::process::id()));
|
|
90
|
-
std::fs::create_dir_all(&ws).unwrap();
|
|
91
|
-
let team = TeamKey::new("default");
|
|
92
|
-
let res = bind_owner_from_caller_pane(&ws, &team, None).unwrap();
|
|
93
|
-
assert!(!res.ok);
|
|
94
|
-
assert_eq!(res.reason, Some(LeaseReason::CallerPaneMissing));
|
|
95
|
-
// caller_pane_id 为空(probe:""),hint 为 _HINT_RUN_FROM_LEADER_PANE。
|
|
96
|
-
assert_eq!(res.caller_pane_id, PaneId::new(""));
|
|
97
|
-
assert_eq!(res.caller_current_command, "");
|
|
98
|
-
assert_eq!(
|
|
99
|
-
res.hint.as_deref(),
|
|
100
|
-
Some("run team-agent from inside your leader pane (the tmux pane you want to own this team).")
|
|
101
|
-
);
|
|
102
|
-
assert_eq!(res.team_id, team);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
// owner.bind_refused 事件名字节锁(LeaderEvent::name unimplemented → RED;与 #5 重叠但锁 binding 路径)。
|
|
106
|
-
#[test]
|
|
107
|
-
fn owner_bind_refused_event_name_is_owner_bind_refused() {
|
|
108
|
-
assert_eq!(LeaderEvent::OwnerBindRefused.name(), "owner.bind_refused");
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
// bind_owner_from_caller_pane:成功绑定后调用 owner.bound_from_caller_pane 审计 hook
|
|
112
|
-
// (leader_binding.py:162-183)。
|
|
113
|
-
// 强化(no-full-uuid-leak 命门):事件只写 derived_uuid_prefix == derived[:12](12 hex),
|
|
114
|
-
// old uuid 为 None → old_uuid_prefix == ""(空串,非缺省);全 32 hex uuid 绝不出现在任何字段。
|
|
115
|
-
// unimplemented → RED。
|
|
116
|
-
#[test]
|
|
117
|
-
#[serial_test::serial(env)]
|
|
118
|
-
fn emit_owner_bound_event_logs_prefix_only_never_full_uuid() {
|
|
119
|
-
let _lock = ENV_LOCK.lock().unwrap();
|
|
120
|
-
let hermetic = hermetic::HermeticTestEnv::enter("owner-bound-uuid");
|
|
121
|
-
let ws = hermetic.workspace("emit");
|
|
122
|
-
let _pane = hermetic.with_env("TMUX_PANE", "%7");
|
|
123
|
-
let _fingerprint = hermetic.with_env("TEAM_AGENT_MACHINE_FINGERPRINT", "fp");
|
|
124
|
-
let _provider = hermetic.with_env("TEAM_AGENT_LEADER_PROVIDER", "codex");
|
|
125
|
-
let result = bind_owner_from_caller_pane(&ws, &TeamKey::new("default"), None).unwrap();
|
|
126
|
-
assert!(
|
|
127
|
-
result.ok,
|
|
128
|
-
"caller pane must produce an owner binding; reason={:?} hint={:?}",
|
|
129
|
-
result.reason,
|
|
130
|
-
result.hint
|
|
131
|
-
);
|
|
132
|
-
let owner = result.owner.as_ref().expect("successful bind has owner");
|
|
133
|
-
let full = owner
|
|
134
|
-
.leader_session_uuid
|
|
135
|
-
.as_ref()
|
|
136
|
-
.expect("successful bind has leader session uuid")
|
|
137
|
-
.as_str()
|
|
138
|
-
.to_string();
|
|
139
|
-
assert_eq!(full.len(), 32, "derive 产 32 hex");
|
|
140
|
-
let prefix12 = full[..12].to_string();
|
|
141
|
-
// 读回审计事件:恰一条 owner.bound_from_caller_pane。
|
|
142
|
-
let events = crate::event_log::EventLog::new(&ws).tail(50).unwrap();
|
|
143
|
-
let ev = events
|
|
144
|
-
.iter()
|
|
145
|
-
.find(|e| e["event"] == serde_json::json!("owner.bound_from_caller_pane"))
|
|
146
|
-
.expect("必写 owner.bound_from_caller_pane");
|
|
147
|
-
assert_eq!(ev["caller_pane_id"], serde_json::json!("%7"));
|
|
148
|
-
assert_eq!(
|
|
149
|
-
ev["caller_current_command"],
|
|
150
|
-
serde_json::json!(result.caller_current_command)
|
|
151
|
-
);
|
|
152
|
-
assert_eq!(ev["team_id"], serde_json::json!("default"));
|
|
153
|
-
// derived_uuid_prefix == derived[:12](只前缀,12 hex)。
|
|
154
|
-
assert_eq!(ev["derived_uuid_prefix"], serde_json::json!(prefix12));
|
|
155
|
-
// old uuid=None → old_uuid_prefix == ""(空串,非 null/缺省;golden probe 已验)。
|
|
156
|
-
assert_eq!(ev["old_uuid_prefix"], serde_json::json!(""));
|
|
157
|
-
// no-full-uuid-leak:整条事件序列化文本里绝不出现完整 32-hex uuid。
|
|
158
|
-
let raw = serde_json::to_string(ev).unwrap();
|
|
159
|
-
assert!(
|
|
160
|
-
!raw.contains(&full),
|
|
161
|
-
"审计事件绝不泄露完整 leader_session_uuid"
|
|
162
|
-
);
|
|
163
|
-
// 审计事件名字节锁。
|
|
164
|
-
assert_eq!(
|
|
165
|
-
LeaderEvent::OwnerBoundFromCallerPane.name(),
|
|
166
|
-
"owner.bound_from_caller_pane"
|
|
167
|
-
);
|
|
168
|
-
}
|