@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
|
@@ -1,1091 +0,0 @@
|
|
|
1
|
-
use super::*;
|
|
2
|
-
|
|
3
|
-
// =========================================================================
|
|
4
|
-
// status_compact_flag (commands.py:99): compact = !detail — CLI 独占不变量
|
|
5
|
-
// gate: 'detail=false => compact=true mapping, the one byte-level invariant CLI owns'.
|
|
6
|
-
// =========================================================================
|
|
7
|
-
|
|
8
|
-
#[test]
|
|
9
|
-
fn status_compact_flag_default_is_compact() {
|
|
10
|
-
// golden: cmd_status without --detail -> runtime.status(compact=not(False)) == compact=True.
|
|
11
|
-
assert!(
|
|
12
|
-
status_compact_flag(false),
|
|
13
|
-
"detail=false MUST map to compact=true (commands.py:99)"
|
|
14
|
-
);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
#[test]
|
|
18
|
-
fn status_compact_flag_detail_is_full() {
|
|
19
|
-
// golden: cmd_status --detail -> runtime.status(compact=not(True)) == compact=False.
|
|
20
|
-
assert!(
|
|
21
|
-
!status_compact_flag(true),
|
|
22
|
-
"detail=true MUST map to compact=false (full projection)"
|
|
23
|
-
);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
// =========================================================================
|
|
27
|
-
// status_port::status — REAL caller against SEEDED fixture (gate: 'zero callers').
|
|
28
|
-
// Asserts the --json projection shape that the compact-vs-detail wiring selects.
|
|
29
|
-
// RED: status_port::status is unimplemented!() so the call panics until ported.
|
|
30
|
-
// =========================================================================
|
|
31
|
-
|
|
32
|
-
// =========================================================================
|
|
33
|
-
// RM-039-STAT-001 regression guard (real-machine evidence 2026-06-22).
|
|
34
|
-
//
|
|
35
|
-
// Architect verdict (bugs-stat001-sess001-architecture-analysis.md §root-cause):
|
|
36
|
-
// the coordinator-tick activity classifier writes
|
|
37
|
-
// `activity {status, confidence, rationale}` to the top-level
|
|
38
|
-
// `agents.<id>` slot of state.json (T1 invariant 60/61); the compact
|
|
39
|
-
// `status --json` projection MUST preserve it, last_output_at, and
|
|
40
|
-
// the enrich_agents-injected `interacted` marker. Lifecycle `status`
|
|
41
|
-
// and turn `activity.status` are separate fields per T1; the
|
|
42
|
-
// projection MUST NOT collapse them.
|
|
43
|
-
// =========================================================================
|
|
44
|
-
#[test]
|
|
45
|
-
fn rm039_stat001_compact_status_preserves_activity_and_last_output() {
|
|
46
|
-
let ws = seed_status_workspace();
|
|
47
|
-
let mut state = crate::state::persist::load_runtime_state(&ws).unwrap();
|
|
48
|
-
if let Some(agents) = state
|
|
49
|
-
.pointer_mut("/agents")
|
|
50
|
-
.and_then(serde_json::Value::as_object_mut)
|
|
51
|
-
{
|
|
52
|
-
if let Some(agent) = agents
|
|
53
|
-
.get_mut("a1")
|
|
54
|
-
.and_then(serde_json::Value::as_object_mut)
|
|
55
|
-
{
|
|
56
|
-
agent.insert(
|
|
57
|
-
"activity".to_string(),
|
|
58
|
-
json!({
|
|
59
|
-
"status": "working",
|
|
60
|
-
"confidence": 0.95,
|
|
61
|
-
"rationale": "provider_jsonl:open_turn",
|
|
62
|
-
}),
|
|
63
|
-
);
|
|
64
|
-
agent.insert(
|
|
65
|
-
"last_output_at".to_string(),
|
|
66
|
-
json!("2026-06-22T02:52:30+00:00"),
|
|
67
|
-
);
|
|
68
|
-
// first_send_at is already set by seed_status_workspace so
|
|
69
|
-
// enrich_agents will inject `interacted` with the same ISO value.
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
crate::state::persist::save_runtime_state(&ws, &state).unwrap();
|
|
73
|
-
|
|
74
|
-
let v = status_port::status(&ws, /*compact=*/ true, /*detail=*/ false)
|
|
75
|
-
.expect("compact status should project a value");
|
|
76
|
-
let agent = v
|
|
77
|
-
.pointer("/agents/a1")
|
|
78
|
-
.and_then(serde_json::Value::as_object)
|
|
79
|
-
.expect("seeded agent a1 must appear in compact projection");
|
|
80
|
-
|
|
81
|
-
// T1 split: lifecycle `status` stays unchanged.
|
|
82
|
-
assert_eq!(
|
|
83
|
-
agent.get("status").and_then(serde_json::Value::as_str),
|
|
84
|
-
Some("running"),
|
|
85
|
-
"RM-039-STAT-001: compact projection must NOT collapse `status` into `activity.status`"
|
|
86
|
-
);
|
|
87
|
-
// Turn activity preserved (the field that was historically dropped).
|
|
88
|
-
let activity = agent
|
|
89
|
-
.get("activity")
|
|
90
|
-
.expect("RM-039-STAT-001: compact projection must preserve `activity`");
|
|
91
|
-
assert_eq!(
|
|
92
|
-
activity
|
|
93
|
-
.pointer("/status")
|
|
94
|
-
.and_then(serde_json::Value::as_str),
|
|
95
|
-
Some("working"),
|
|
96
|
-
"compact activity.status must survive the projection"
|
|
97
|
-
);
|
|
98
|
-
assert_eq!(
|
|
99
|
-
activity
|
|
100
|
-
.pointer("/rationale")
|
|
101
|
-
.and_then(serde_json::Value::as_str),
|
|
102
|
-
Some("provider_jsonl:open_turn"),
|
|
103
|
-
"compact activity.rationale must survive the projection"
|
|
104
|
-
);
|
|
105
|
-
// last_output_at is the timestamp the classifier advances when
|
|
106
|
-
// scrollback digest changes; operators read it alongside activity.
|
|
107
|
-
assert_eq!(
|
|
108
|
-
agent
|
|
109
|
-
.get("last_output_at")
|
|
110
|
-
.and_then(serde_json::Value::as_str),
|
|
111
|
-
Some("2026-06-22T02:52:30+00:00"),
|
|
112
|
-
"compact projection must preserve `last_output_at` for the \"is something moving\" view"
|
|
113
|
-
);
|
|
114
|
-
// 0.4.x compact slim: `interacted` moves to --detail; the 4-field
|
|
115
|
-
// compact agent row keeps only status/provider/activity/last_output_at.
|
|
116
|
-
assert!(
|
|
117
|
-
agent.get("interacted").is_none(),
|
|
118
|
-
"0.4.x: compact projection drops `interacted` (moved to --detail)"
|
|
119
|
-
);
|
|
120
|
-
let _ = std::fs::remove_dir_all(&ws);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
// =========================================================================
|
|
124
|
-
// RM-039-STAT-001 second-round regression (architect verdict 2026-06-22).
|
|
125
|
-
//
|
|
126
|
-
// Real failure shape: tick wrote `activity` to root .agents.coder and
|
|
127
|
-
// .teams.current.agents.coder because `team_state_key` cascaded to the
|
|
128
|
-
// `team_dir = "./.team/current"` basename. But status's selector reads
|
|
129
|
-
// the `active_team_key = "rm039-status-working-891"` projection, which
|
|
130
|
-
// was stale. The compact whitelist alone cannot fix this — by the time
|
|
131
|
-
// compact_agent_state runs, the selected team slot already lacks activity.
|
|
132
|
-
//
|
|
133
|
-
// Fix expected at the projection/state-key layer: when load_runtime_state
|
|
134
|
-
// sees `active_team_key` naming an existing teams entry and no root
|
|
135
|
-
// `team_key`, it must promote `team_key = active_team_key` so subsequent
|
|
136
|
-
// tick writes and status reads agree on which teams entry to use. The
|
|
137
|
-
// assertion here drives the real CLI path through `status_port::status`.
|
|
138
|
-
// =========================================================================
|
|
139
|
-
#[test]
|
|
140
|
-
fn rm039_stat001_status_resolves_active_team_when_root_team_key_missing() {
|
|
141
|
-
let ws = seed_status_workspace();
|
|
142
|
-
// Seed the exact dirty shape from the evidence: active_team_key
|
|
143
|
-
// disagrees with team_dir basename; root team_key absent; the
|
|
144
|
-
// teams.<active> entry is stale (no activity); root + teams.current
|
|
145
|
-
// carry activity that the tick had already written there.
|
|
146
|
-
let active = "rm039-status-working-891";
|
|
147
|
-
let activity = json!({
|
|
148
|
-
"status": "working",
|
|
149
|
-
"confidence": 0.95,
|
|
150
|
-
"rationale": "provider_jsonl:open_turn",
|
|
151
|
-
});
|
|
152
|
-
let state = json!({
|
|
153
|
-
"session_name": "team-rm039-status-working",
|
|
154
|
-
"team_dir": "./.team/current",
|
|
155
|
-
"active_team_key": active,
|
|
156
|
-
// intentionally no top-level "team_key" — that is the bug shape.
|
|
157
|
-
"leader": {"id": "leader"},
|
|
158
|
-
"leader_receiver": {"pane_id": "%3", "status": "running"},
|
|
159
|
-
"agents": {
|
|
160
|
-
"coder": {
|
|
161
|
-
"status": "running",
|
|
162
|
-
"first_send_at": "2026-01-01T00:00:00Z",
|
|
163
|
-
"activity": activity.clone(),
|
|
164
|
-
"last_output_at": "2026-06-22T02:52:30+00:00",
|
|
165
|
-
}
|
|
166
|
-
},
|
|
167
|
-
"teams": {
|
|
168
|
-
"current": {
|
|
169
|
-
"active_team_key": active,
|
|
170
|
-
"session_name": "team-rm039-status-working",
|
|
171
|
-
"agents": {
|
|
172
|
-
"coder": {
|
|
173
|
-
"status": "running",
|
|
174
|
-
"first_send_at": "2026-01-01T00:00:00Z",
|
|
175
|
-
"activity": activity.clone(),
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
},
|
|
179
|
-
active: {
|
|
180
|
-
"active_team_key": active,
|
|
181
|
-
"session_name": "team-rm039-status-working",
|
|
182
|
-
"agents": {
|
|
183
|
-
"coder": {
|
|
184
|
-
"status": "running",
|
|
185
|
-
"first_send_at": "2026-01-01T00:00:00Z",
|
|
186
|
-
// NO `activity` here — this is the stale entry
|
|
187
|
-
// that the selector landed on pre-fix.
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
});
|
|
193
|
-
std::fs::write(
|
|
194
|
-
ws.join(".team").join("runtime").join("state.json"),
|
|
195
|
-
serde_json::to_vec_pretty(&state).unwrap(),
|
|
196
|
-
)
|
|
197
|
-
.unwrap();
|
|
198
|
-
|
|
199
|
-
let v = status_port::status(&ws, /*compact=*/ true, /*detail=*/ false)
|
|
200
|
-
.expect("compact status should project a value");
|
|
201
|
-
let agent = v
|
|
202
|
-
.pointer("/agents/coder")
|
|
203
|
-
.and_then(serde_json::Value::as_object)
|
|
204
|
-
.expect("coder agent must appear in compact projection");
|
|
205
|
-
let got_activity = agent.get("activity").expect(
|
|
206
|
-
"RM-039-STAT-001 second-round: activity must reach the compact projection \
|
|
207
|
-
even when active_team_key disagrees with team_dir basename",
|
|
208
|
-
);
|
|
209
|
-
assert_eq!(
|
|
210
|
-
got_activity
|
|
211
|
-
.pointer("/status")
|
|
212
|
-
.and_then(serde_json::Value::as_str),
|
|
213
|
-
Some("working"),
|
|
214
|
-
"RM-039-STAT-001 second-round: compact status.agents.coder.activity.status must \
|
|
215
|
-
be `working` when state.active_team_key names an existing teams entry, \
|
|
216
|
-
regardless of team_dir basename"
|
|
217
|
-
);
|
|
218
|
-
// Lifecycle status unchanged — T1 split invariant.
|
|
219
|
-
assert_eq!(
|
|
220
|
-
agent.get("status").and_then(serde_json::Value::as_str),
|
|
221
|
-
Some("running"),
|
|
222
|
-
"lifecycle status must NOT collapse into activity.status"
|
|
223
|
-
);
|
|
224
|
-
let _ = std::fs::remove_dir_all(&ws);
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
#[test]
|
|
228
|
-
fn status_port_status_compact_json_shape_against_seeded_fixture() {
|
|
229
|
-
// cmd_status json branch (detail=false) delegates status_port::status(compact=true).
|
|
230
|
-
// Compact slim is the original 7 keys plus `grok_slot` and
|
|
231
|
-
// `grok_identity_slot_ok`. `ok` is command success (always true here).
|
|
232
|
-
let ws = seed_status_workspace();
|
|
233
|
-
let v = status_port::status(&ws, /*compact=*/ true, /*detail=*/ false)
|
|
234
|
-
.expect("seeded fixture status should project a value");
|
|
235
|
-
let obj = v.as_object().expect("--json status is a dict");
|
|
236
|
-
let expected: std::collections::BTreeSet<&str> = [
|
|
237
|
-
"ok",
|
|
238
|
-
"team",
|
|
239
|
-
"session_name",
|
|
240
|
-
"leader_attach_command",
|
|
241
|
-
"ready",
|
|
242
|
-
"not_ready",
|
|
243
|
-
"agents",
|
|
244
|
-
"grok_slot",
|
|
245
|
-
"grok_identity_slot_ok",
|
|
246
|
-
]
|
|
247
|
-
.iter()
|
|
248
|
-
.copied()
|
|
249
|
-
.collect();
|
|
250
|
-
let actual: std::collections::BTreeSet<&str> = obj.keys().map(String::as_str).collect();
|
|
251
|
-
assert_eq!(
|
|
252
|
-
actual, expected,
|
|
253
|
-
"compact must expose the original 7 keys plus grok_slot and grok_identity_slot_ok (9); got {actual:?}"
|
|
254
|
-
);
|
|
255
|
-
let grok_slot = obj
|
|
256
|
-
.get("grok_slot")
|
|
257
|
-
.and_then(serde_json::Value::as_object)
|
|
258
|
-
.expect("compact must carry grok_slot");
|
|
259
|
-
let grok_ok = grok_slot
|
|
260
|
-
.get("consistent")
|
|
261
|
-
.and_then(serde_json::Value::as_bool)
|
|
262
|
-
== Some(true)
|
|
263
|
-
&& grok_slot
|
|
264
|
-
.get("readable")
|
|
265
|
-
.and_then(serde_json::Value::as_bool)
|
|
266
|
-
== Some(true);
|
|
267
|
-
assert_eq!(
|
|
268
|
-
obj.get("ok").and_then(serde_json::Value::as_bool),
|
|
269
|
-
Some(true),
|
|
270
|
-
"compact ok is command success and must stay true; grok_slot={grok_slot:?}"
|
|
271
|
-
);
|
|
272
|
-
assert_eq!(
|
|
273
|
-
obj.get("grok_identity_slot_ok")
|
|
274
|
-
.and_then(serde_json::Value::as_bool),
|
|
275
|
-
Some(grok_ok),
|
|
276
|
-
"grok_identity_slot_ok must follow readable∧consistent; grok_slot={grok_slot:?}"
|
|
277
|
-
);
|
|
278
|
-
// Diagnostic keys must NOT leak into the default compact payload.
|
|
279
|
-
for forbidden in [
|
|
280
|
-
"leader_topology",
|
|
281
|
-
"is_external_leader",
|
|
282
|
-
"leader_client",
|
|
283
|
-
"tmux_session_present",
|
|
284
|
-
"leader_receiver",
|
|
285
|
-
"agent_health",
|
|
286
|
-
"tasks",
|
|
287
|
-
"messages",
|
|
288
|
-
"queued_messages",
|
|
289
|
-
"results",
|
|
290
|
-
"latest_results",
|
|
291
|
-
"coordinator",
|
|
292
|
-
"readiness",
|
|
293
|
-
"reminder",
|
|
294
|
-
"last_events",
|
|
295
|
-
] {
|
|
296
|
-
assert!(
|
|
297
|
-
!obj.contains_key(forbidden),
|
|
298
|
-
"0.4.x: compact must NOT contain diagnostic key `{forbidden}` (--detail only)"
|
|
299
|
-
);
|
|
300
|
-
}
|
|
301
|
-
// seeded agent surfaces through the projection.
|
|
302
|
-
assert!(
|
|
303
|
-
obj["agents"].as_object().unwrap().contains_key("a1"),
|
|
304
|
-
"seeded agent a1 must appear in compact agents projection"
|
|
305
|
-
);
|
|
306
|
-
let _ = std::fs::remove_dir_all(&ws);
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
#[test]
|
|
310
|
-
fn status_compact_reports_identity_slot_health_on_grok_identity_slot_ok() {
|
|
311
|
-
// 已废除的行为:旧实现看不见 grok 身份槽。此墓碑留下槽健康断言。
|
|
312
|
-
// 2026-08-18 裁定:`ok` 是命令成功标志,成功投影必须恒真;身份槽健康
|
|
313
|
-
// 走顶层 `grok_identity_slot_ok`,不再重载 `ok`。
|
|
314
|
-
// 2026-08-18 身份串台:judge-g 的产出从 developer-d61 的通道报出并占掉
|
|
315
|
-
// 后者 exactly-once report_result。那时若完全不报槽健康才是一句谎。
|
|
316
|
-
let ws = seed_status_workspace();
|
|
317
|
-
let grok = ws.join(".grok");
|
|
318
|
-
std::fs::create_dir_all(&grok).unwrap();
|
|
319
|
-
std::fs::write(
|
|
320
|
-
grok.join("config.toml"),
|
|
321
|
-
"[mcp_servers.team_orchestrator.env]\nTEAM_AGENT_ID = \"impostor-seat\"\n",
|
|
322
|
-
)
|
|
323
|
-
.unwrap();
|
|
324
|
-
|
|
325
|
-
let v = status_port::status(&ws, /*compact=*/ true, /*detail=*/ false)
|
|
326
|
-
.expect("mismatched grok slot must still project compact status");
|
|
327
|
-
assert_eq!(
|
|
328
|
-
v.get("ok").and_then(serde_json::Value::as_bool),
|
|
329
|
-
Some(true),
|
|
330
|
-
"successful status must keep ok=true; slot health is a sibling key; got {v}"
|
|
331
|
-
);
|
|
332
|
-
assert_eq!(
|
|
333
|
-
v.get("grok_identity_slot_ok")
|
|
334
|
-
.and_then(serde_json::Value::as_bool),
|
|
335
|
-
Some(false),
|
|
336
|
-
"identity-slot mismatch must force grok_identity_slot_ok=false; got {v}"
|
|
337
|
-
);
|
|
338
|
-
assert_eq!(
|
|
339
|
-
v.pointer("/grok_slot/consistent")
|
|
340
|
-
.and_then(serde_json::Value::as_bool),
|
|
341
|
-
Some(false),
|
|
342
|
-
"fixture must actually be a slot mismatch; got {v}"
|
|
343
|
-
);
|
|
344
|
-
let _ = std::fs::remove_dir_all(&ws);
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
#[test]
|
|
348
|
-
fn cmd_status_human_is_nine_field_brief_without_diagnostics() {
|
|
349
|
-
let ws = seed_status_workspace();
|
|
350
|
-
let args = StatusArgs {
|
|
351
|
-
agent: None,
|
|
352
|
-
workspace: ws.clone(),
|
|
353
|
-
detail: false,
|
|
354
|
-
summary: false,
|
|
355
|
-
json: false,
|
|
356
|
-
team: None,
|
|
357
|
-
};
|
|
358
|
-
|
|
359
|
-
let r = cmd_status_for_team(&args, None).expect("status");
|
|
360
|
-
let text = match r.output {
|
|
361
|
-
CmdOutput::Human(text) => text,
|
|
362
|
-
other => panic!("expected human status output, got {other:?}"),
|
|
363
|
-
};
|
|
364
|
-
|
|
365
|
-
assert!(
|
|
366
|
-
text.contains(
|
|
367
|
-
"name: a1 provider: unknown model: null effort: null runtime_status: unknown activity: unknown health: unknown session_name: null tmux_command: null"
|
|
368
|
-
),
|
|
369
|
-
"{text}"
|
|
370
|
-
);
|
|
371
|
-
assert!(!text.contains(crate::cli::STATUS_REMINDER));
|
|
372
|
-
let _ = std::fs::remove_dir_all(&ws);
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
#[test]
|
|
376
|
-
fn status_port_status_reports_managed_leader_topology_and_attach_command() {
|
|
377
|
-
let ws = seed_status_workspace();
|
|
378
|
-
let mut state = crate::state::persist::load_runtime_state(&ws).unwrap();
|
|
379
|
-
if let Some(obj) = state.as_object_mut() {
|
|
380
|
-
obj.insert("is_external_leader".to_string(), json!(false));
|
|
381
|
-
obj.insert("session_name".to_string(), json!("team-current"));
|
|
382
|
-
}
|
|
383
|
-
crate::state::persist::save_runtime_state(&ws, &state).unwrap();
|
|
384
|
-
|
|
385
|
-
// 0.4.x: leader_topology / is_external_leader moved to --detail.
|
|
386
|
-
// leader_attach_command stays in the slim compact payload.
|
|
387
|
-
let slim = status_port::status(&ws, /*compact=*/ true, /*detail=*/ false).expect("status");
|
|
388
|
-
let attach = slim["leader_attach_command"]
|
|
389
|
-
.as_str()
|
|
390
|
-
.expect("compact still includes leader_attach_command");
|
|
391
|
-
assert!(attach.contains("attach -t team-current:leader"), "{attach}");
|
|
392
|
-
|
|
393
|
-
let detail =
|
|
394
|
-
status_port::status(&ws, /*compact=*/ false, /*detail=*/ true).expect("status detail");
|
|
395
|
-
assert_eq!(detail["leader_topology"], json!("managed"));
|
|
396
|
-
assert_eq!(detail["is_external_leader"], json!(false));
|
|
397
|
-
let _ = std::fs::remove_dir_all(&ws);
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
#[test]
|
|
401
|
-
fn status_port_managed_attach_command_uses_receiver_window_name() {
|
|
402
|
-
let ws = seed_status_workspace();
|
|
403
|
-
let mut state = crate::state::persist::load_runtime_state(&ws).unwrap();
|
|
404
|
-
if let Some(obj) = state.as_object_mut() {
|
|
405
|
-
obj.insert("is_external_leader".to_string(), json!(false));
|
|
406
|
-
obj.insert("session_name".to_string(), json!("team-current"));
|
|
407
|
-
obj.insert(
|
|
408
|
-
"leader_receiver".to_string(),
|
|
409
|
-
json!({"pane_id": "%3", "window_name": "claude_code", "status": "attached"}),
|
|
410
|
-
);
|
|
411
|
-
}
|
|
412
|
-
crate::state::persist::save_runtime_state(&ws, &state).unwrap();
|
|
413
|
-
|
|
414
|
-
let v = status_port::status(&ws, /*compact=*/ true, /*detail=*/ false).expect("status");
|
|
415
|
-
|
|
416
|
-
let attach = v["leader_attach_command"]
|
|
417
|
-
.as_str()
|
|
418
|
-
.expect("managed status includes attach command");
|
|
419
|
-
assert!(
|
|
420
|
-
attach.contains("attach -t team-current:claude_code"),
|
|
421
|
-
"{attach}"
|
|
422
|
-
);
|
|
423
|
-
let _ = std::fs::remove_dir_all(&ws);
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
#[test]
|
|
427
|
-
fn leader_attach_command_for_plan_uses_plan_leader_window() {
|
|
428
|
-
let ws = tmp_workspace();
|
|
429
|
-
let plan = crate::leader::LeaderStartPlan {
|
|
430
|
-
mode: crate::leader::LeaderStartMode::ManagedTmuxClient,
|
|
431
|
-
provider: crate::provider::Provider::ClaudeCode,
|
|
432
|
-
workspace: ws.clone(),
|
|
433
|
-
socket: crate::leader::LeaderLaunchSocket::Workspace,
|
|
434
|
-
session_name: Some(crate::transport::SessionName::new(
|
|
435
|
-
"team-agent-leader-claude_code-demo".to_string(),
|
|
436
|
-
)),
|
|
437
|
-
argv: Vec::new(),
|
|
438
|
-
provider_argv: Vec::new(),
|
|
439
|
-
leader_prompt: None,
|
|
440
|
-
session_capture: None,
|
|
441
|
-
leader_window: Some(crate::transport::WindowName::new("claude_code")),
|
|
442
|
-
is_external_leader: false,
|
|
443
|
-
leader_env: std::collections::BTreeMap::new(),
|
|
444
|
-
identity: None,
|
|
445
|
-
detached: false,
|
|
446
|
-
};
|
|
447
|
-
|
|
448
|
-
let attach = lifecycle_port::leader_attach_command_for_plan(&ws, &plan)
|
|
449
|
-
.expect("managed plan has attach command");
|
|
450
|
-
|
|
451
|
-
assert!(
|
|
452
|
-
attach.contains("attach -t team-agent-leader-claude_code-demo:claude_code"),
|
|
453
|
-
"{attach}"
|
|
454
|
-
);
|
|
455
|
-
let _ = std::fs::remove_dir_all(&ws);
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
#[test]
|
|
459
|
-
fn status_port_missing_topology_marker_defaults_to_managed() {
|
|
460
|
-
let ws = seed_status_workspace();
|
|
461
|
-
let mut state = crate::state::persist::load_runtime_state(&ws).unwrap();
|
|
462
|
-
if let Some(obj) = state.as_object_mut() {
|
|
463
|
-
obj.remove("is_external_leader");
|
|
464
|
-
obj.insert("session_name".to_string(), json!("team-current"));
|
|
465
|
-
}
|
|
466
|
-
crate::state::persist::save_runtime_state(&ws, &state).unwrap();
|
|
467
|
-
|
|
468
|
-
// 0.4.x: topology/external markers moved to --detail; compact keeps attach.
|
|
469
|
-
let slim = status_port::status(&ws, /*compact=*/ true, /*detail=*/ false).expect("status");
|
|
470
|
-
let attach = slim["leader_attach_command"]
|
|
471
|
-
.as_str()
|
|
472
|
-
.expect("missing marker defaults to managed attach command");
|
|
473
|
-
assert!(attach.contains("attach -t team-current:leader"), "{attach}");
|
|
474
|
-
|
|
475
|
-
let detail =
|
|
476
|
-
status_port::status(&ws, /*compact=*/ false, /*detail=*/ true).expect("status detail");
|
|
477
|
-
assert_eq!(detail["leader_topology"], json!("managed"));
|
|
478
|
-
assert_eq!(detail["is_external_leader"], json!(false));
|
|
479
|
-
let _ = std::fs::remove_dir_all(&ws);
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
#[test]
|
|
483
|
-
fn status_port_status_detail_full_keeps_uncompacted_events() {
|
|
484
|
-
// 0.4.x: --detail (compact=false) preserves ALL diagnostic fields the
|
|
485
|
-
// compact slim payload drops. Pin the must-keep set so future
|
|
486
|
-
// refactors can't accidentally strip detail diagnostics.
|
|
487
|
-
let ws = seed_status_workspace();
|
|
488
|
-
let full = status_port::status(&ws, /*compact=*/ false, /*detail=*/ true)
|
|
489
|
-
.expect("seeded fixture full status should project a value");
|
|
490
|
-
let compact = status_port::status(&ws, /*compact=*/ true, /*detail=*/ false)
|
|
491
|
-
.expect("seeded fixture compact status should project a value");
|
|
492
|
-
assert_ne!(
|
|
493
|
-
full, compact,
|
|
494
|
-
"detail (full) and default (compact) projections must differ"
|
|
495
|
-
);
|
|
496
|
-
let full_obj = full.as_object().expect("full status is a dict");
|
|
497
|
-
for key in [
|
|
498
|
-
"coordinator",
|
|
499
|
-
"readiness",
|
|
500
|
-
"leader_receiver",
|
|
501
|
-
"agent_health",
|
|
502
|
-
"tasks",
|
|
503
|
-
"messages",
|
|
504
|
-
"queued_messages",
|
|
505
|
-
"results",
|
|
506
|
-
"latest_results",
|
|
507
|
-
"last_events",
|
|
508
|
-
] {
|
|
509
|
-
assert!(
|
|
510
|
-
full_obj.contains_key(key),
|
|
511
|
-
"0.4.x: --detail must preserve `{key}` (compact slimming escape hatch)"
|
|
512
|
-
);
|
|
513
|
-
}
|
|
514
|
-
assert_eq!(full_obj["agents"].as_object().unwrap().len(), 1);
|
|
515
|
-
let _ = std::fs::remove_dir_all(&ws);
|
|
516
|
-
}
|
|
517
|
-
|
|
518
|
-
// =========================================================================
|
|
519
|
-
// send_options_from_args (commands.py:170-177): SendArgs->SendOptions 旗标取反
|
|
520
|
-
// gate: 'no_ack:true => requires_ack:false and no_wait:true => wait_visible:false';
|
|
521
|
-
// watch_result flag maps into SendOptions.
|
|
522
|
-
// RED: send_options_from_args is unimplemented!() until ported.
|
|
523
|
-
// =========================================================================
|
|
524
|
-
|
|
525
|
-
fn send_args_fixture() -> SendArgs {
|
|
526
|
-
let workspace = seed_send_workspace();
|
|
527
|
-
let _ = crate::message_store::MessageStore::open(&workspace).unwrap();
|
|
528
|
-
SendArgs {
|
|
529
|
-
target: Some("alice".into()),
|
|
530
|
-
message: vec!["hello".into(), "world".into(), "foo".into()],
|
|
531
|
-
targets: None,
|
|
532
|
-
workspace,
|
|
533
|
-
team: Some("teamA".into()),
|
|
534
|
-
task: Some("t-1".into()),
|
|
535
|
-
sender: TrustedSender::leader(),
|
|
536
|
-
no_ack: true,
|
|
537
|
-
no_wait: true,
|
|
538
|
-
watch_result: true,
|
|
539
|
-
timeout: 12.5,
|
|
540
|
-
confirm_human: false,
|
|
541
|
-
json: false,
|
|
542
|
-
message_id: None,
|
|
543
|
-
presentation: crate::messaging::presentation::PresentationRequest::default(),
|
|
544
|
-
pane: None,
|
|
545
|
-
to_name: None,
|
|
546
|
-
to_leader: None,
|
|
547
|
-
}
|
|
548
|
-
}
|
|
549
|
-
|
|
550
|
-
fn queued_send_args_fixture(json: bool) -> SendArgs {
|
|
551
|
-
let ws = deleg_uniq_dir("send-human");
|
|
552
|
-
let _ = crate::message_store::MessageStore::open(&ws).unwrap();
|
|
553
|
-
crate::state::persist::save_runtime_state(
|
|
554
|
-
&ws,
|
|
555
|
-
&json!({
|
|
556
|
-
"active_team_key": "current",
|
|
557
|
-
"teams": {"current": {"agents": {"w1": {"provider": "copilot"}}}}
|
|
558
|
-
}),
|
|
559
|
-
)
|
|
560
|
-
.unwrap();
|
|
561
|
-
SendArgs {
|
|
562
|
-
workspace: ws,
|
|
563
|
-
target: Some("w1".into()),
|
|
564
|
-
team: None,
|
|
565
|
-
task: None,
|
|
566
|
-
watch_result: false,
|
|
567
|
-
json,
|
|
568
|
-
..send_args_fixture()
|
|
569
|
-
}
|
|
570
|
-
}
|
|
571
|
-
|
|
572
|
-
#[test]
|
|
573
|
-
fn send_options_negates_no_ack_and_no_wait_and_carries_watch() {
|
|
574
|
-
// golden (commands.py:172,174,176): requires_ack=not no_ack; wait_visible=not no_wait;
|
|
575
|
-
// watch_result passthrough. With no_ack=true,no_wait=true,watch_result=true:
|
|
576
|
-
// requires_ack=false, wait_visible=false, watch_result=true.
|
|
577
|
-
let opts = send_options_from_args(&send_args_fixture());
|
|
578
|
-
assert!(
|
|
579
|
-
!opts.requires_ack,
|
|
580
|
-
"no_ack:true MUST map to requires_ack:false (off-by-inversion guard)"
|
|
581
|
-
);
|
|
582
|
-
assert!(
|
|
583
|
-
!opts.wait_visible,
|
|
584
|
-
"no_wait:true MUST map to wait_visible:false"
|
|
585
|
-
);
|
|
586
|
-
assert!(
|
|
587
|
-
opts.watch_result,
|
|
588
|
-
"watch_result flag MUST pass through into SendOptions"
|
|
589
|
-
);
|
|
590
|
-
assert!(!opts.confirm_human);
|
|
591
|
-
assert_eq!(opts.sender.as_str(), "leader");
|
|
592
|
-
assert_eq!(opts.timeout, 12.5);
|
|
593
|
-
}
|
|
594
|
-
|
|
595
|
-
#[test]
|
|
596
|
-
fn send_options_default_flags_are_acked_and_waited() {
|
|
597
|
-
// golden: no_ack=false,no_wait=false,watch_result=false ->
|
|
598
|
-
// requires_ack=true, wait_visible=true, watch_result=false (Python defaults inverted back).
|
|
599
|
-
let args = SendArgs {
|
|
600
|
-
no_ack: false,
|
|
601
|
-
no_wait: false,
|
|
602
|
-
watch_result: false,
|
|
603
|
-
..send_args_fixture()
|
|
604
|
-
};
|
|
605
|
-
let opts = send_options_from_args(&args);
|
|
606
|
-
assert!(
|
|
607
|
-
opts.requires_ack,
|
|
608
|
-
"no_ack:false MUST map to requires_ack:true"
|
|
609
|
-
);
|
|
610
|
-
assert!(
|
|
611
|
-
opts.wait_visible,
|
|
612
|
-
"no_wait:false MUST map to wait_visible:true"
|
|
613
|
-
);
|
|
614
|
-
assert!(!opts.watch_result);
|
|
615
|
-
}
|
|
616
|
-
|
|
617
|
-
// =========================================================================
|
|
618
|
-
// cmd_send — REAL caller (gate: 'cmd_send has NO test beyond send_target').
|
|
619
|
-
// Asserts (1) message Vec joined by single space surfaces to send_message,
|
|
620
|
-
// (2) the registered-watcher notice ({status:'registered',...} -> result['watch'],
|
|
621
|
-
// send.py:326-337) survives into CmdResult Json output,
|
|
622
|
-
// (3) DeliveryOutcome->exit-code derivation (ok=true -> ExitCode::Ok).
|
|
623
|
-
// RED: cmd_send is unimplemented!() so it panics until ported.
|
|
624
|
-
// =========================================================================
|
|
625
|
-
|
|
626
|
-
#[test]
|
|
627
|
-
fn cmd_send_joins_message_with_single_space() {
|
|
628
|
-
// golden (commands.py:169): " ".join(["hello","world","foo"]) == "hello world foo".
|
|
629
|
-
// Drive cmd_send; the joined content must reach send_message (RED until ported).
|
|
630
|
-
let args = SendArgs {
|
|
631
|
-
json: true,
|
|
632
|
-
..send_args_fixture()
|
|
633
|
-
};
|
|
634
|
-
let r = cmd_send(&args).expect("cmd_send returns CmdResult");
|
|
635
|
-
// The delegate's DeliveryOutcome -> Json must carry an `ok` key feeding exit-code.
|
|
636
|
-
match r.output {
|
|
637
|
-
CmdOutput::Json(ref v) => {
|
|
638
|
-
assert!(v.get("ok").is_some(), "send result Json must carry `ok`");
|
|
639
|
-
if v.get("ok").and_then(|ok| ok.as_bool()) == Some(true) {
|
|
640
|
-
let delivered = v.get("delivered").and_then(|x| x.as_bool()) == Some(true);
|
|
641
|
-
// hermetic tier 假设:此 fixture 无法产生真实 tmux Delivered。
|
|
642
|
-
// 若 delivered=true 命中说明 tier 前提变了(例如 seed 开了 Delivered 通路),
|
|
643
|
-
// 应立即失败以强制重新审视,而不是悄悄跑一条从未验过的分支。
|
|
644
|
-
assert!(
|
|
645
|
-
!delivered,
|
|
646
|
-
"hermetic seed must not produce delivered=true; the fixture assumption changed"
|
|
647
|
-
);
|
|
648
|
-
assert_eq!(
|
|
649
|
-
v.get("reminder").and_then(|reminder| reminder.as_str()),
|
|
650
|
-
Some("Task accepted, but delivery is unconfirmed. Check team-agent status/doctor; wait for an actual reply without repeated sends.")
|
|
651
|
-
);
|
|
652
|
-
}
|
|
653
|
-
}
|
|
654
|
-
other => panic!("cmd_send must emit Json DeliveryOutcome, got {other:?}"),
|
|
655
|
-
}
|
|
656
|
-
}
|
|
657
|
-
|
|
658
|
-
#[test]
|
|
659
|
-
fn cmd_send_default_human_output_is_brief_without_false_delivered() {
|
|
660
|
-
let r = cmd_send(&queued_send_args_fixture(false)).expect("cmd_send returns CmdResult");
|
|
661
|
-
assert!(!r.as_json);
|
|
662
|
-
let text = emit(&r.output, r.as_json).expect("send should render human text");
|
|
663
|
-
let lines: Vec<_> = text.lines().collect();
|
|
664
|
-
assert_eq!(
|
|
665
|
-
lines.len(),
|
|
666
|
-
2,
|
|
667
|
-
"send must separate outcome and next action: {text}"
|
|
668
|
-
);
|
|
669
|
-
assert!(
|
|
670
|
-
lines[0].contains("Task accepted") && lines[0].contains("delivery to the agent's conversation is still pending"),
|
|
671
|
-
"queued send must report its true pending outcome: {text}"
|
|
672
|
-
);
|
|
673
|
-
assert!(
|
|
674
|
-
lines[1].contains("Next:")
|
|
675
|
-
&& lines[1].contains("team-agent status")
|
|
676
|
-
&& lines[1].contains("doctor")
|
|
677
|
-
&& lines[1].contains("wait for an actual reply")
|
|
678
|
-
&& lines[1].contains("without repeated sends"),
|
|
679
|
-
"queued send must give honest next steps: {text}"
|
|
680
|
-
);
|
|
681
|
-
assert!(
|
|
682
|
-
!text.contains("delivered"),
|
|
683
|
-
"queued send output must not claim or mention delivered; got {text}"
|
|
684
|
-
);
|
|
685
|
-
for hidden in [
|
|
686
|
-
"agent_id:",
|
|
687
|
-
"sender:",
|
|
688
|
-
"message_status:",
|
|
689
|
-
"verification:",
|
|
690
|
-
"stage:",
|
|
691
|
-
"reason:",
|
|
692
|
-
"channel:",
|
|
693
|
-
"reminder:",
|
|
694
|
-
] {
|
|
695
|
-
// 字段级匹配,⛔ 不用裸 contains:人类输出以 " " 连接 `"{key}: {value}"`
|
|
696
|
-
// (send/presentation.rs 的 `parts.join(" ")` / `send_human_field`),
|
|
697
|
-
// 所以一个字段只可能出现在行首或某个空格之后。裸子串会让
|
|
698
|
-
// `turn_verification:` 误命中名单里的 `verification:`(该键由 ab2134c0
|
|
699
|
-
// 有意加进人类输出名单)——那是判据误伤,不是产品缺陷。
|
|
700
|
-
let present = text.starts_with(hidden) || text.contains(&format!(" {hidden}"));
|
|
701
|
-
assert!(
|
|
702
|
-
!present,
|
|
703
|
-
"default send output should hide {hidden} unless needed; got {text}"
|
|
704
|
-
);
|
|
705
|
-
}
|
|
706
|
-
}
|
|
707
|
-
|
|
708
|
-
#[test]
|
|
709
|
-
#[cfg(unix)]
|
|
710
|
-
fn issue372_queued_send_names_the_mcp_handshake_it_waits_on() {
|
|
711
|
-
let r = cmd_send(&queued_send_args_fixture(true)).expect("cmd_send returns CmdResult");
|
|
712
|
-
let CmdOutput::Json(v) = r.output else {
|
|
713
|
-
panic!("--json send must emit Json");
|
|
714
|
-
};
|
|
715
|
-
assert_eq!(v["deferred_reason"], json!("mcp_handshake_config_missing"), "{v}");
|
|
716
|
-
let r = cmd_send(&queued_send_args_fixture(false)).expect("cmd_send returns CmdResult");
|
|
717
|
-
let text = emit(&r.output, r.as_json).expect("send should render human text");
|
|
718
|
-
assert!(
|
|
719
|
-
text.contains("w1's MCP server has not completed its handshake (mcp_handshake_config_missing)")
|
|
720
|
-
&& text.contains("after 5 minutes the message is parked"),
|
|
721
|
-
"{text}"
|
|
722
|
-
);
|
|
723
|
-
}
|
|
724
|
-
|
|
725
|
-
#[test]
|
|
726
|
-
fn cmd_send_json_shape_keeps_056_fields() {
|
|
727
|
-
let args = queued_send_args_fixture(true);
|
|
728
|
-
let r = cmd_send(&args).expect("cmd_send returns CmdResult");
|
|
729
|
-
let v = match r.output {
|
|
730
|
-
CmdOutput::Json(v) => v,
|
|
731
|
-
other => panic!("--json send must emit Json, got {other:?}"),
|
|
732
|
-
};
|
|
733
|
-
let obj = v.as_object().expect("--json send output must be object");
|
|
734
|
-
for key in [
|
|
735
|
-
"ok",
|
|
736
|
-
"status",
|
|
737
|
-
"delivery_status",
|
|
738
|
-
"delivered",
|
|
739
|
-
"target",
|
|
740
|
-
"agent_id",
|
|
741
|
-
"content_length_bytes",
|
|
742
|
-
"sender",
|
|
743
|
-
"message_id",
|
|
744
|
-
"message_status",
|
|
745
|
-
"verification",
|
|
746
|
-
"stage",
|
|
747
|
-
"reason",
|
|
748
|
-
"channel",
|
|
749
|
-
"reminder",
|
|
750
|
-
] {
|
|
751
|
-
assert!(obj.contains_key(key), "--json send shape lost {key}: {v}");
|
|
752
|
-
}
|
|
753
|
-
assert_eq!(v.get("verification"), Some(&serde_json::Value::Null));
|
|
754
|
-
assert_eq!(v.get("stage"), Some(&serde_json::Value::Null));
|
|
755
|
-
assert_eq!(v.get("reason"), Some(&serde_json::Value::Null));
|
|
756
|
-
assert_eq!(v.get("channel"), Some(&serde_json::Value::Null));
|
|
757
|
-
assert_eq!(v.get("delivered").and_then(|d| d.as_bool()), Some(false));
|
|
758
|
-
assert!(
|
|
759
|
-
!v.get("reminder")
|
|
760
|
-
.and_then(|reminder| reminder.as_str())
|
|
761
|
-
.unwrap_or_default()
|
|
762
|
-
.contains("Message delivered."),
|
|
763
|
-
"queued JSON reminder must not contradict delivered:false: {v}"
|
|
764
|
-
);
|
|
765
|
-
}
|
|
766
|
-
|
|
767
|
-
#[test]
|
|
768
|
-
fn cmd_send_watch_result_does_not_register_before_delivery() {
|
|
769
|
-
// 0.5.x send contract: --watch-result may only advertise a watcher after
|
|
770
|
-
// initial worker delivery is physically proven.
|
|
771
|
-
let args = SendArgs {
|
|
772
|
-
json: true,
|
|
773
|
-
..send_args_fixture()
|
|
774
|
-
};
|
|
775
|
-
let r = cmd_send(&args).expect("cmd_send returns CmdResult");
|
|
776
|
-
let v = match r.output {
|
|
777
|
-
CmdOutput::Json(v) => v,
|
|
778
|
-
other => panic!("expected Json, got {other:?}"),
|
|
779
|
-
};
|
|
780
|
-
assert!(
|
|
781
|
-
v.get("delivery_status").and_then(|s| s.as_str()).is_some(),
|
|
782
|
-
"send output must expose delivery_status; got {v}"
|
|
783
|
-
);
|
|
784
|
-
assert_eq!(
|
|
785
|
-
v.get("delivered").and_then(|s| s.as_bool()),
|
|
786
|
-
Some(false),
|
|
787
|
-
"undelivered send outcome must not look delivered"
|
|
788
|
-
);
|
|
789
|
-
assert!(
|
|
790
|
-
!v.as_object().unwrap().contains_key("watch"),
|
|
791
|
-
"watch_result:true must not attach result['watch'] before delivery; got {v}"
|
|
792
|
-
);
|
|
793
|
-
}
|
|
794
|
-
|
|
795
|
-
#[test]
|
|
796
|
-
fn cmd_send_failed_outcome_yields_error_exit() {
|
|
797
|
-
// DeliveryOutcome ok=false (e.g. refused) -> from_json -> ExitCode::Error (parser.py:507).
|
|
798
|
-
// A failed send to a target must propagate non-zero exit reporting through CmdResult.
|
|
799
|
-
let args = SendArgs {
|
|
800
|
-
target: Some("drifted".into()),
|
|
801
|
-
no_ack: false,
|
|
802
|
-
no_wait: false,
|
|
803
|
-
watch_result: false,
|
|
804
|
-
..send_args_fixture()
|
|
805
|
-
};
|
|
806
|
-
let r = cmd_send(&args).expect("cmd_send returns CmdResult even on delivery failure");
|
|
807
|
-
if let CmdOutput::Json(ref v) = r.output {
|
|
808
|
-
if v.get("ok").and_then(|b| b.as_bool()) == Some(false) {
|
|
809
|
-
assert_eq!(
|
|
810
|
-
r.exit,
|
|
811
|
-
ExitCode::Error,
|
|
812
|
-
"ok:false DeliveryOutcome MUST derive ExitCode::Error (non-zero exit)"
|
|
813
|
-
);
|
|
814
|
-
}
|
|
815
|
-
}
|
|
816
|
-
}
|
|
817
|
-
|
|
818
|
-
#[test]
|
|
819
|
-
fn cmd_send_canonicalizes_legacy_session_alias_before_membership_projection() {
|
|
820
|
-
let ws = deleg_uniq_dir("send-team-alias");
|
|
821
|
-
let _ = crate::message_store::MessageStore::open(&ws).unwrap();
|
|
822
|
-
crate::state::persist::save_runtime_state(
|
|
823
|
-
&ws,
|
|
824
|
-
&json!({
|
|
825
|
-
"active_team_key": "teamdir",
|
|
826
|
-
"team_key": "teamdir",
|
|
827
|
-
"teams": {
|
|
828
|
-
"teamdir": {
|
|
829
|
-
"status": "alive",
|
|
830
|
-
"session_name": "team-displayname",
|
|
831
|
-
"agents": {"w1": {"provider": "copilot", "status": "running"}}
|
|
832
|
-
}
|
|
833
|
-
}
|
|
834
|
-
}),
|
|
835
|
-
)
|
|
836
|
-
.unwrap();
|
|
837
|
-
let args = SendArgs {
|
|
838
|
-
workspace: ws,
|
|
839
|
-
target: Some("w1".into()),
|
|
840
|
-
team: Some("displayname".into()),
|
|
841
|
-
task: None,
|
|
842
|
-
no_wait: true,
|
|
843
|
-
watch_result: false,
|
|
844
|
-
json: true,
|
|
845
|
-
..send_args_fixture()
|
|
846
|
-
};
|
|
847
|
-
|
|
848
|
-
let result = cmd_send(&args).expect("alias selection should reach canonical team send");
|
|
849
|
-
let value = match result.output {
|
|
850
|
-
CmdOutput::Json(value) => value,
|
|
851
|
-
other => panic!("expected JSON send outcome, got {other:?}"),
|
|
852
|
-
};
|
|
853
|
-
assert_ne!(
|
|
854
|
-
value.get("reason").and_then(serde_json::Value::as_str),
|
|
855
|
-
Some("target_not_in_team"),
|
|
856
|
-
"selector accepted the alias, so membership must use its canonical team key: {value}"
|
|
857
|
-
);
|
|
858
|
-
}
|
|
859
|
-
|
|
860
|
-
// ═══════════════════════════════════════════════════════════════════════════
|
|
861
|
-
// coordinator.ok — non-compact status carries the FULL coordinator_health (incl. `ok`); compact
|
|
862
|
-
// strips to {status,pid,metadata_ok,schema_ok} (golden queries.py:77 + compact.py:35; ok =
|
|
863
|
-
// running∧metadata_ok∧schema_ok, coordinator/lifecycle.py:26-46). Deterministic missing-coordinator
|
|
864
|
-
// fixture (no pid → ok:false, status:"missing"). Dual-assertion catches both branch directions.
|
|
865
|
-
// ═══════════════════════════════════════════════════════════════════════════
|
|
866
|
-
#[test]
|
|
867
|
-
fn status_noncompact_coordinator_includes_ok() {
|
|
868
|
-
let ws = seed_status_workspace();
|
|
869
|
-
let v = status_port::status(&ws, /*compact=*/ false, /*detail=*/ true).expect("status");
|
|
870
|
-
let coord = v
|
|
871
|
-
.get("coordinator")
|
|
872
|
-
.and_then(|c| c.as_object())
|
|
873
|
-
.expect("coordinator object");
|
|
874
|
-
assert!(
|
|
875
|
-
coord.contains_key("ok"),
|
|
876
|
-
"non-compact coordinator MUST carry `ok` (golden queries.py:77 full coordinator_health); got keys {:?}",
|
|
877
|
-
coord.keys().collect::<Vec<_>>()
|
|
878
|
-
);
|
|
879
|
-
for key in [
|
|
880
|
-
"ok",
|
|
881
|
-
"status",
|
|
882
|
-
"pid",
|
|
883
|
-
"metadata",
|
|
884
|
-
"metadata_ok",
|
|
885
|
-
"schema_ok",
|
|
886
|
-
] {
|
|
887
|
-
assert!(
|
|
888
|
-
coord.contains_key(key),
|
|
889
|
-
"non-compact coordinator missing `{key}`"
|
|
890
|
-
);
|
|
891
|
-
}
|
|
892
|
-
assert_eq!(
|
|
893
|
-
coord.get("ok").and_then(|v| v.as_bool()),
|
|
894
|
-
Some(false),
|
|
895
|
-
"missing-coordinator fixture → ok:false (running∧metadata_ok∧schema_ok)"
|
|
896
|
-
);
|
|
897
|
-
let _ = std::fs::remove_dir_all(&ws);
|
|
898
|
-
}
|
|
899
|
-
|
|
900
|
-
#[test]
|
|
901
|
-
fn status_compact_omits_coordinator_entirely() {
|
|
902
|
-
// 0.4.x compact slim: the entire `coordinator` block moved to --detail.
|
|
903
|
-
// Compact folds coordinator health into the top-level `ready`/`not_ready`
|
|
904
|
-
// synthesis (`coordinator_not_running` / `coordinator_schema_not_ok`).
|
|
905
|
-
let ws = seed_status_workspace();
|
|
906
|
-
let v = status_port::status(&ws, /*compact=*/ true, /*detail=*/ false).expect("status");
|
|
907
|
-
assert!(
|
|
908
|
-
v.as_object().unwrap().get("coordinator").is_none(),
|
|
909
|
-
"0.4.x: compact must NOT include `coordinator`; reasons fold into not_ready"
|
|
910
|
-
);
|
|
911
|
-
let _ = std::fs::remove_dir_all(&ws);
|
|
912
|
-
}
|
|
913
|
-
|
|
914
|
-
// ═══════════════════════════════════════════════════════════════════════════
|
|
915
|
-
// P0 (b) — CLI `send --task <unknown>` (route_task_id=true default = routing) MUST surface the
|
|
916
|
-
// golden error envelope {ok:false, error:"unknown task id:<id>", action, log} + exit 1 — NOT a
|
|
917
|
-
// silent 0-byte swallow (rt-host-b), and NO "validation:" prefix. Lock.
|
|
918
|
-
// ═══════════════════════════════════════════════════════════════════════════
|
|
919
|
-
// OLD seed: flat `{session_name, agents:{w1}, tasks:[]}`.
|
|
920
|
-
// NEW seed (Bug 1/2 — team-in-team state scope, see tests/team_in_team_state_scope_red.rs):
|
|
921
|
-
// cmd_send projects state through the active team_key before reaching the unknown-task
|
|
922
|
-
// gate, so agents/tasks must live under `teams[<key>].*` to be visible at projection
|
|
923
|
-
// time. The "unknown task -> golden envelope" behavior being asserted is unchanged.
|
|
924
|
-
#[test]
|
|
925
|
-
fn cmd_send_unknown_task_surfaces_golden_error_envelope_not_silent() {
|
|
926
|
-
let ws = std::env::temp_dir().join(format!(
|
|
927
|
-
"ta-cli-sendunk-{}-{}",
|
|
928
|
-
std::process::id(),
|
|
929
|
-
std::time::SystemTime::now()
|
|
930
|
-
.duration_since(std::time::UNIX_EPOCH)
|
|
931
|
-
.unwrap()
|
|
932
|
-
.as_nanos()
|
|
933
|
-
));
|
|
934
|
-
std::fs::create_dir_all(ws.join(".team").join("runtime")).unwrap();
|
|
935
|
-
std::fs::write(
|
|
936
|
-
ws.join(".team").join("runtime").join("state.json"),
|
|
937
|
-
serde_json::to_vec_pretty(&json!({
|
|
938
|
-
"session_name": "team-x",
|
|
939
|
-
"active_team_key": "current",
|
|
940
|
-
"teams": {"current": {
|
|
941
|
-
"session_name": "team-x",
|
|
942
|
-
"agents": { "w1": { "status": "running" } },
|
|
943
|
-
"tasks": []
|
|
944
|
-
}}
|
|
945
|
-
}))
|
|
946
|
-
.unwrap(),
|
|
947
|
-
)
|
|
948
|
-
.unwrap();
|
|
949
|
-
let _ = crate::message_store::MessageStore::open(&ws);
|
|
950
|
-
let args = SendArgs {
|
|
951
|
-
target: Some("w1".into()),
|
|
952
|
-
targets: None,
|
|
953
|
-
task: Some("t-unknown".into()),
|
|
954
|
-
message: vec!["go".into()],
|
|
955
|
-
workspace: ws.clone(),
|
|
956
|
-
team: None,
|
|
957
|
-
watch_result: false,
|
|
958
|
-
json: true,
|
|
959
|
-
..send_args_fixture()
|
|
960
|
-
};
|
|
961
|
-
// route_task_id defaults true (CLI routing path) → the error MUST surface, not silently swallow.
|
|
962
|
-
let err = cmd_send(&args).expect_err(
|
|
963
|
-
"CLI send --task <unknown> must surface an error (route_task_id=true routing), not a silent 0-byte send"
|
|
964
|
-
);
|
|
965
|
-
let payload = err.to_payload(std::path::Path::new("/tmp/ta-cli-err.log"), "send");
|
|
966
|
-
assert!(!payload.ok, "error envelope ok must be false");
|
|
967
|
-
assert_eq!(
|
|
968
|
-
payload.error, "unknown task id: t-unknown",
|
|
969
|
-
"CLI error field == golden bare message (golden runtime.py:1032 str(exc)); NO 'validation:' prefix"
|
|
970
|
-
);
|
|
971
|
-
assert_eq!(
|
|
972
|
-
payload.action,
|
|
973
|
-
"Run team-agent doctor --workspace . for the selected team, or inspect the error log shown here."
|
|
974
|
-
);
|
|
975
|
-
let _ = std::fs::remove_dir_all(&ws);
|
|
976
|
-
}
|
|
977
|
-
|
|
978
|
-
#[test]
|
|
979
|
-
fn run_send_legacy_task_flag_is_internalized_before_persistence() {
|
|
980
|
-
let ws = std::env::temp_dir().join(format!(
|
|
981
|
-
"ta-run-sendunk-{}-{}",
|
|
982
|
-
std::process::id(),
|
|
983
|
-
std::time::SystemTime::now()
|
|
984
|
-
.duration_since(std::time::UNIX_EPOCH)
|
|
985
|
-
.unwrap()
|
|
986
|
-
.as_nanos()
|
|
987
|
-
));
|
|
988
|
-
std::fs::create_dir_all(ws.join(".team").join("runtime")).unwrap();
|
|
989
|
-
std::fs::write(
|
|
990
|
-
ws.join(".team").join("runtime").join("state.json"),
|
|
991
|
-
serde_json::to_vec_pretty(&json!({
|
|
992
|
-
"session_name": "team-x",
|
|
993
|
-
"active_team_key": "current",
|
|
994
|
-
"teams": {"current": {
|
|
995
|
-
"session_name": "team-x",
|
|
996
|
-
"agents": { "w1": { "status": "running" } },
|
|
997
|
-
"tasks": []
|
|
998
|
-
}}
|
|
999
|
-
}))
|
|
1000
|
-
.unwrap(),
|
|
1001
|
-
)
|
|
1002
|
-
.unwrap();
|
|
1003
|
-
let _ = crate::message_store::MessageStore::open(&ws);
|
|
1004
|
-
let argv: Vec<String> = ["send", "w1", "--task", "t-unknown", "go", "--json"]
|
|
1005
|
-
.iter()
|
|
1006
|
-
.map(ToString::to_string)
|
|
1007
|
-
.collect();
|
|
1008
|
-
let code = run(&argv, &ws);
|
|
1009
|
-
assert_eq!(
|
|
1010
|
-
code,
|
|
1011
|
-
ExitCode::Ok,
|
|
1012
|
-
"legacy --task is sunset-noticed and ignored; public send persists without caller binding"
|
|
1013
|
-
);
|
|
1014
|
-
let connection =
|
|
1015
|
-
rusqlite::Connection::open(ws.join(".team").join("runtime").join("team.db")).unwrap();
|
|
1016
|
-
let task_id: Option<String> = connection
|
|
1017
|
-
.query_row(
|
|
1018
|
-
"SELECT task_id FROM messages WHERE content = 'go' ORDER BY rowid DESC LIMIT 1",
|
|
1019
|
-
[],
|
|
1020
|
-
|row| row.get(0),
|
|
1021
|
-
)
|
|
1022
|
-
.unwrap();
|
|
1023
|
-
assert_eq!(
|
|
1024
|
-
task_id, None,
|
|
1025
|
-
"caller-supplied task ids must not reach storage"
|
|
1026
|
-
);
|
|
1027
|
-
let _ = std::fs::remove_dir_all(&ws);
|
|
1028
|
-
}
|
|
1029
|
-
|
|
1030
|
-
#[test]
|
|
1031
|
-
fn run_leader_passthrough_flag_after_dashdash_renders_error_not_silent_swallow() {
|
|
1032
|
-
let ws = std::env::temp_dir().join(format!(
|
|
1033
|
-
"ta-run-leaderflag-{}-{}",
|
|
1034
|
-
std::process::id(),
|
|
1035
|
-
std::time::SystemTime::now()
|
|
1036
|
-
.duration_since(std::time::UNIX_EPOCH)
|
|
1037
|
-
.unwrap()
|
|
1038
|
-
.as_nanos()
|
|
1039
|
-
));
|
|
1040
|
-
std::fs::create_dir_all(&ws).unwrap();
|
|
1041
|
-
let argv: Vec<String> = ["codex", "--", "--external-leader"]
|
|
1042
|
-
.iter()
|
|
1043
|
-
.map(ToString::to_string)
|
|
1044
|
-
.collect();
|
|
1045
|
-
|
|
1046
|
-
let code = run(&argv, &ws);
|
|
1047
|
-
|
|
1048
|
-
assert_eq!(
|
|
1049
|
-
code,
|
|
1050
|
-
ExitCode::Error,
|
|
1051
|
-
"misplaced leader flag must fail before provider exec"
|
|
1052
|
-
);
|
|
1053
|
-
let logs_dir = ws.join(".team").join("logs");
|
|
1054
|
-
let mut found = String::new();
|
|
1055
|
-
if let Ok(entries) = std::fs::read_dir(&logs_dir) {
|
|
1056
|
-
for entry in entries.flatten() {
|
|
1057
|
-
let name = entry.file_name().to_string_lossy().to_string();
|
|
1058
|
-
if name.starts_with("cli-error-") {
|
|
1059
|
-
found = std::fs::read_to_string(entry.path()).unwrap_or_default();
|
|
1060
|
-
break;
|
|
1061
|
-
}
|
|
1062
|
-
}
|
|
1063
|
-
}
|
|
1064
|
-
assert!(
|
|
1065
|
-
found.contains("Team Agent launcher flag --external-leader must appear before --"),
|
|
1066
|
-
"leader passthrough run() must render the misplaced flag error; a silent swallow leaves no \
|
|
1067
|
-
cli-error log. got log body: {found:?}"
|
|
1068
|
-
);
|
|
1069
|
-
let _ = std::fs::remove_dir_all(&ws);
|
|
1070
|
-
}
|
|
1071
|
-
|
|
1072
|
-
// R8 D6 (c-lite offline byte-lock): the CLI requeued_exhausted_watchers return projection, extracted
|
|
1073
|
-
// into a pure helper, must project the golden event's watcher_ids STRING list (leader/__init__.py:56) —
|
|
1074
|
-
// NOT the Rust `requeued` Vec<WatcherNotice> objects.
|
|
1075
|
-
#[test]
|
|
1076
|
-
fn r8_project_requeued_exhausted_watchers_golden_string_list() {
|
|
1077
|
-
// golden attach event shape (what D4 emits): {watcher_ids:[str], count, trigger}.
|
|
1078
|
-
let golden_event =
|
|
1079
|
-
serde_json::json!({"watcher_ids": ["w1", "w2"], "count": 2, "trigger": "attach_leader"});
|
|
1080
|
-
let projected = crate::cli::leader_port::project_requeued_exhausted_watchers(&golden_event);
|
|
1081
|
-
let list = projected
|
|
1082
|
-
.as_array()
|
|
1083
|
-
.expect("requeued_exhausted_watchers must be a JSON array");
|
|
1084
|
-
let ids: Vec<&str> = list.iter().filter_map(|v| v.as_str()).collect();
|
|
1085
|
-
assert_eq!(
|
|
1086
|
-
ids,
|
|
1087
|
-
vec!["w1", "w2"],
|
|
1088
|
-
"D6: CLI requeued_exhausted_watchers must project the golden watcher_ids STRING list \
|
|
1089
|
-
(leader/__init__.py:56), not the `requeued` Vec<WatcherNotice> objects; got {projected:?}"
|
|
1090
|
-
);
|
|
1091
|
-
}
|