@team-agent/installer 0.5.128 → 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 +4 -4
- package/README.zh.md +1 -1
- package/package.json +4 -8
- package/skills/team-agent/SKILL.md +37 -20
- package/skills/team-agent/command-coverage.json +169 -183
- package/skills/team-agent/docs/reference/team-agent-operator.md +64 -30
- package/skills/team-agent/references/recovery-runbook.md +1 -1
- package/skills/team-agent/references/team-agent-operator.md +64 -30
- 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 -1288
- package/crates/team-agent/src/cli/arguments.rs +0 -405
- package/crates/team-agent/src/cli/attach_app_server_leader.rs +0 -98
- package/crates/team-agent/src/cli/diagnose.rs +0 -1721
- package/crates/team-agent/src/cli/emit.rs +0 -2930
- 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 -1216
- package/crates/team-agent/src/cli/intent/runtime_tests.rs +0 -912
- package/crates/team-agent/src/cli/intent/tests.rs +0 -689
- 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 -6545
- package/crates/team-agent/src/cli/models.rs +0 -1206
- 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/schedule.rs +0 -175
- 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 -156
- 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 -199
- package/crates/team-agent/src/cli/shutdown_socket.rs +0 -288
- package/crates/team-agent/src/cli/spec.rs +0 -165
- 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 -1981
- 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 -322
- 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 -761
- package/crates/team-agent/src/cli/tests/parser_safety.rs +0 -383
- package/crates/team-agent/src/cli/tests/run_delegation.rs +0 -484
- 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 -888
- 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 -827
- package/crates/team-agent/src/compiler.rs +0 -890
- 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 -1744
- package/crates/team-agent/src/contract_runtime/commands.rs +0 -671
- package/crates/team-agent/src/contract_runtime/config.rs +0 -364
- package/crates/team-agent/src/contract_runtime/config_tests.rs +0 -76
- package/crates/team-agent/src/contract_runtime/discovery.rs +0 -449
- package/crates/team-agent/src/contract_runtime/fork.rs +0 -361
- package/crates/team-agent/src/contract_runtime/forward.rs +0 -288
- package/crates/team-agent/src/contract_runtime/framework.rs +0 -367
- package/crates/team-agent/src/contract_runtime/mcp.rs +0 -394
- 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 -553
- 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 -300
- 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 -503
- 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 -3024
- 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 -1527
- 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/direct_delivery.rs +0 -368
- 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/inbox_store.rs +0 -169
- 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 -888
- package/crates/team-agent/src/leader/start.rs +0 -4501
- 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 -268
- 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 -147
- package/crates/team-agent/src/lifecycle/helpers.rs +0 -212
- package/crates/team-agent/src/lifecycle/launch/add_agent.rs +0 -881
- package/crates/team-agent/src/lifecycle/launch/add_agent_state.rs +0 -598
- package/crates/team-agent/src/lifecycle/launch/agent_state.rs +0 -332
- package/crates/team-agent/src/lifecycle/launch/clone_agent.rs +0 -204
- package/crates/team-agent/src/lifecycle/launch/fork_agent.rs +0 -107
- package/crates/team-agent/src/lifecycle/launch/fork_entry.rs +0 -144
- 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 -160
- package/crates/team-agent/src/lifecycle/launch/ownership.rs +0 -105
- package/crates/team-agent/src/lifecycle/launch/pi_mcp.rs +0 -899
- package/crates/team-agent/src/lifecycle/launch/pi_mcp_extension.js +0 -225
- package/crates/team-agent/src/lifecycle/launch/plan.rs +0 -269
- package/crates/team-agent/src/lifecycle/launch/quick_start.rs +0 -5200
- 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 -473
- 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 -557
- 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 -1067
- package/crates/team-agent/src/lifecycle/profile_smoke.rs +0 -557
- package/crates/team-agent/src/lifecycle/restart/agent.rs +0 -2199
- package/crates/team-agent/src/lifecycle/restart/avatar.rs +0 -1798
- package/crates/team-agent/src/lifecycle/restart/claude_fork.rs +0 -163
- package/crates/team-agent/src/lifecycle/restart/common.rs +0 -2362
- 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 -227
- package/crates/team-agent/src/lifecycle/role_config.rs +0 -1230
- 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_compatible_config_red.rs +0 -325
- package/crates/team-agent/src/lifecycle/tests/claude_profile_launch_red.rs +0 -447
- package/crates/team-agent/src/lifecycle/tests/cli_argv_routing_red.rs +0 -1638
- 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 -770
- package/crates/team-agent/src/lifecycle/tests/communication_mode_runtime_contract_red.rs +0 -419
- package/crates/team-agent/src/lifecycle/tests/copilot_provider_red.rs +0 -2035
- package/crates/team-agent/src/lifecycle/tests/core.rs +0 -1327
- 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 -72
- 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 -512
- 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 -3983
- 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 -164
- package/crates/team-agent/src/lifecycle/tests/pi_command_red.rs +0 -200
- package/crates/team-agent/src/lifecycle/tests/pi_compiler_red.rs +0 -210
- package/crates/team-agent/src/lifecycle/tests/pi_dual_entry_red.rs +0 -527
- package/crates/team-agent/src/lifecycle/tests/pi_executable_mcp_red.rs +0 -1062
- package/crates/team-agent/src/lifecycle/tests/pi_fork_session_inheritance_red.rs +0 -1419
- package/crates/team-agent/src/lifecycle/tests/pi_lifecycle_doctor_red.rs +0 -98
- package/crates/team-agent/src/lifecycle/tests/pi_native_mcp_capability_red.rs +0 -550
- package/crates/team-agent/src/lifecycle/tests/pi_session_delivery_red.rs +0 -226
- package/crates/team-agent/src/lifecycle/tests/quick_start_worker_readiness_red.rs +0 -332
- 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 -342
- 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 -995
- package/crates/team-agent/src/lifecycle/tests/worker_spawn_env_red.rs +0 -836
- package/crates/team-agent/src/lifecycle/tests.rs +0 -105
- package/crates/team-agent/src/lifecycle/types.rs +0 -877
- package/crates/team-agent/src/lifecycle/worker_command_context.rs +0 -363
- 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 -527
- package/crates/team-agent/src/mcp_server/readiness_tests.rs +0 -348
- 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 -158
- package/crates/team-agent/src/mcp_server/tests/send.rs +0 -353
- package/crates/team-agent/src/mcp_server/tests/tools.rs +0 -341
- 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 -889
- 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 -3727
- 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 -336
- 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 -167
- 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/reminders.rs +0 -316
- 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 -223
- 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 -657
- 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 -3549
- package/crates/team-agent/src/messaging/tests/spine.rs +0 -853
- 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 -472
- 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 -1150
- package/crates/team-agent/src/provider/adapters/claude.rs +0 -78
- package/crates/team-agent/src/provider/adapters/claude_fork.rs +0 -131
- 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 -30
- package/crates/team-agent/src/provider/adapters/pi.rs +0 -106
- 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 -708
- 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 -910
- package/crates/team-agent/src/provider/session/capture.rs +0 -2731
- package/crates/team-agent/src/provider/session/context_fork/claude.rs +0 -123
- package/crates/team-agent/src/provider/session/context_fork/outcome.rs +0 -172
- package/crates/team-agent/src/provider/session/context_fork.rs +0 -396
- 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/claude.rs +0 -523
- package/crates/team-agent/src/provider/session_scan/common/tests.rs +0 -316
- package/crates/team-agent/src/provider/session_scan/common.rs +0 -654
- package/crates/team-agent/src/provider/session_scan/copilot.rs +0 -280
- package/crates/team-agent/src/provider/session_scan/pi.rs +0 -185
- package/crates/team-agent/src/provider/session_scan.rs +0 -71
- 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 -441
- package/crates/team-agent/src/provider/tests/classify.rs +0 -148
- package/crates/team-agent/src/provider/tests/command_helpers.rs +0 -35
- 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 -177
- 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 -394
- 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/test_support/models_timeout_fixture.rs +0 -144
- 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 -4103
- package/crates/team-agent/src/tmux_backend.rs +0 -4492
- 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,888 +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 { sink: crate::messaging::presentation::PresentationSink::Silent, ..Default::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
|
-
let args = send_args_fixture();
|
|
629
|
-
let result = cmd_send(&args).expect("mailbox append");
|
|
630
|
-
assert_eq!(result.exit, ExitCode::Ok);
|
|
631
|
-
let inbox = crate::inbox_store::read(&args.workspace, "alice", 3, None).unwrap();
|
|
632
|
-
assert_eq!(inbox["messages"][0]["content"], "hello world foo");
|
|
633
|
-
assert_eq!(inbox["messages"][0]["sender"], "leader");
|
|
634
|
-
let conn = rusqlite::Connection::open(args.workspace.join(".team/runtime/team.db")).unwrap();
|
|
635
|
-
let count: i64 = conn.query_row("SELECT count(*) FROM messages", [], |row| row.get(0)).unwrap();
|
|
636
|
-
assert_eq!(count, 0, "public send must not enter the coordinator queue");
|
|
637
|
-
}
|
|
638
|
-
|
|
639
|
-
#[test]
|
|
640
|
-
fn cmd_send_mailbox_output_names_storage_without_claiming_delivery() {
|
|
641
|
-
let args = queued_send_args_fixture(false);
|
|
642
|
-
let result = cmd_send(&args).expect("mailbox append without a live pane");
|
|
643
|
-
let text = emit(&result.output, result.as_json).unwrap();
|
|
644
|
-
assert!(text.contains("stored") && text.contains("w1"), "{text}");
|
|
645
|
-
assert!(!text.contains("Delivered") && !text.contains("parked") && !text.contains("still pending"), "{text}");
|
|
646
|
-
}
|
|
647
|
-
|
|
648
|
-
#[test]
|
|
649
|
-
#[cfg(unix)]
|
|
650
|
-
fn issue372_send_never_reports_a_handshake_parking_gate() {
|
|
651
|
-
let args = queued_send_args_fixture(true);
|
|
652
|
-
let result = cmd_send(&args).unwrap();
|
|
653
|
-
let CmdOutput::Json(value) = result.output else { panic!("JSON result expected") };
|
|
654
|
-
assert_eq!(value["status"], "stored");
|
|
655
|
-
assert!(value.get("deferred_reason").is_none());
|
|
656
|
-
let direct = SendArgs { presentation: crate::messaging::presentation::PresentationRequest::default(), ..args };
|
|
657
|
-
let error = cmd_send(&direct).unwrap_err().to_string();
|
|
658
|
-
assert!(error.contains("no tmux pane"), "{error}");
|
|
659
|
-
assert!(!error.contains("mcp_handshake") && !error.contains("parked"), "{error}");
|
|
660
|
-
}
|
|
661
|
-
|
|
662
|
-
#[test]
|
|
663
|
-
fn cmd_send_json_shape_describes_the_decoupled_operation() {
|
|
664
|
-
let args = queued_send_args_fixture(true);
|
|
665
|
-
let result = cmd_send(&args).unwrap();
|
|
666
|
-
let CmdOutput::Json(value) = result.output else { panic!("JSON result expected") };
|
|
667
|
-
let inbox = crate::inbox_store::read(&args.workspace, "w1", 10, None).unwrap();
|
|
668
|
-
assert_eq!(inbox["messages"][0]["message_id"], value["message_id"]);
|
|
669
|
-
assert_eq!(value, json!({"ok": true, "status": "stored", "recipient": "w1", "mailbox": true, "message_id": inbox["messages"][0]["message_id"]}));
|
|
670
|
-
for key in ["delivery_attempts", "message_status", "verification", "watch", "deferred_reason"] {
|
|
671
|
-
assert!(value.get(key).is_none(), "no coordinator delivery fiction: {value}");
|
|
672
|
-
}
|
|
673
|
-
}
|
|
674
|
-
|
|
675
|
-
#[test]
|
|
676
|
-
fn cmd_send_legacy_watch_flag_does_not_create_a_watcher_or_delivery_row() {
|
|
677
|
-
let args = SendArgs { json: true, ..send_args_fixture() };
|
|
678
|
-
let db = args.workspace.join(".team/runtime/team.db");
|
|
679
|
-
let before = std::fs::read(&db).unwrap();
|
|
680
|
-
let result = cmd_send(&args).unwrap();
|
|
681
|
-
let CmdOutput::Json(value) = result.output else { panic!("JSON result expected") };
|
|
682
|
-
assert_eq!(value["status"], "stored");
|
|
683
|
-
assert!(value.get("watch").is_none());
|
|
684
|
-
assert_eq!(std::fs::read(db).unwrap(), before, "send must not mutate the coordinator database");
|
|
685
|
-
}
|
|
686
|
-
|
|
687
|
-
#[test]
|
|
688
|
-
fn cmd_send_unknown_recipient_is_an_immediate_error_without_queueing() {
|
|
689
|
-
let args = SendArgs { target: Some("absent-worker".into()), json: true, ..send_args_fixture() };
|
|
690
|
-
let refusal = cmd_send(&args).unwrap();
|
|
691
|
-
assert_eq!(refusal.exit, ExitCode::Error);
|
|
692
|
-
let CmdOutput::Json(value) = refusal.output else { panic!("JSON refusal expected") };
|
|
693
|
-
assert_eq!(value["ok"], false);
|
|
694
|
-
assert!(value.to_string().contains("absent-worker"), "{value}");
|
|
695
|
-
assert!(crate::inbox_store::read(&args.workspace, "absent-worker", 3, None).unwrap()["messages"].as_array().unwrap().is_empty());
|
|
696
|
-
}
|
|
697
|
-
|
|
698
|
-
#[test]
|
|
699
|
-
fn cmd_send_canonicalizes_legacy_session_alias_before_membership_projection() {
|
|
700
|
-
let ws = deleg_uniq_dir("send-team-alias");
|
|
701
|
-
let _ = crate::message_store::MessageStore::open(&ws).unwrap();
|
|
702
|
-
crate::state::persist::save_runtime_state(
|
|
703
|
-
&ws,
|
|
704
|
-
&json!({
|
|
705
|
-
"active_team_key": "teamdir",
|
|
706
|
-
"team_key": "teamdir",
|
|
707
|
-
"teams": {
|
|
708
|
-
"teamdir": {
|
|
709
|
-
"status": "alive",
|
|
710
|
-
"session_name": "team-displayname",
|
|
711
|
-
"agents": {"w1": {"provider": "copilot", "status": "running"}}
|
|
712
|
-
}
|
|
713
|
-
}
|
|
714
|
-
}),
|
|
715
|
-
)
|
|
716
|
-
.unwrap();
|
|
717
|
-
let args = SendArgs {
|
|
718
|
-
workspace: ws,
|
|
719
|
-
target: Some("w1".into()),
|
|
720
|
-
team: Some("displayname".into()),
|
|
721
|
-
task: None,
|
|
722
|
-
no_wait: true,
|
|
723
|
-
watch_result: false,
|
|
724
|
-
json: true,
|
|
725
|
-
..send_args_fixture()
|
|
726
|
-
};
|
|
727
|
-
|
|
728
|
-
let result = cmd_send(&args).expect("alias selection should reach canonical team send");
|
|
729
|
-
let value = match result.output {
|
|
730
|
-
CmdOutput::Json(value) => value,
|
|
731
|
-
other => panic!("expected JSON send outcome, got {other:?}"),
|
|
732
|
-
};
|
|
733
|
-
assert_ne!(
|
|
734
|
-
value.get("reason").and_then(serde_json::Value::as_str),
|
|
735
|
-
Some("target_not_in_team"),
|
|
736
|
-
"selector accepted the alias, so membership must use its canonical team key: {value}"
|
|
737
|
-
);
|
|
738
|
-
}
|
|
739
|
-
|
|
740
|
-
// ═══════════════════════════════════════════════════════════════════════════
|
|
741
|
-
// coordinator.ok — non-compact status carries the FULL coordinator_health (incl. `ok`); compact
|
|
742
|
-
// strips to {status,pid,metadata_ok,schema_ok} (golden queries.py:77 + compact.py:35; ok =
|
|
743
|
-
// running∧metadata_ok∧schema_ok, coordinator/lifecycle.py:26-46). Deterministic missing-coordinator
|
|
744
|
-
// fixture (no pid → ok:false, status:"missing"). Dual-assertion catches both branch directions.
|
|
745
|
-
// ═══════════════════════════════════════════════════════════════════════════
|
|
746
|
-
#[test]
|
|
747
|
-
fn status_noncompact_coordinator_includes_ok() {
|
|
748
|
-
let ws = seed_status_workspace();
|
|
749
|
-
let v = status_port::status(&ws, /*compact=*/ false, /*detail=*/ true).expect("status");
|
|
750
|
-
let coord = v
|
|
751
|
-
.get("coordinator")
|
|
752
|
-
.and_then(|c| c.as_object())
|
|
753
|
-
.expect("coordinator object");
|
|
754
|
-
assert!(
|
|
755
|
-
coord.contains_key("ok"),
|
|
756
|
-
"non-compact coordinator MUST carry `ok` (golden queries.py:77 full coordinator_health); got keys {:?}",
|
|
757
|
-
coord.keys().collect::<Vec<_>>()
|
|
758
|
-
);
|
|
759
|
-
for key in [
|
|
760
|
-
"ok",
|
|
761
|
-
"status",
|
|
762
|
-
"pid",
|
|
763
|
-
"metadata",
|
|
764
|
-
"metadata_ok",
|
|
765
|
-
"schema_ok",
|
|
766
|
-
] {
|
|
767
|
-
assert!(
|
|
768
|
-
coord.contains_key(key),
|
|
769
|
-
"non-compact coordinator missing `{key}`"
|
|
770
|
-
);
|
|
771
|
-
}
|
|
772
|
-
assert_eq!(
|
|
773
|
-
coord.get("ok").and_then(|v| v.as_bool()),
|
|
774
|
-
Some(false),
|
|
775
|
-
"missing-coordinator fixture → ok:false (running∧metadata_ok∧schema_ok)"
|
|
776
|
-
);
|
|
777
|
-
let _ = std::fs::remove_dir_all(&ws);
|
|
778
|
-
}
|
|
779
|
-
|
|
780
|
-
#[test]
|
|
781
|
-
fn status_compact_omits_coordinator_entirely() {
|
|
782
|
-
// 0.4.x compact slim: the entire `coordinator` block moved to --detail.
|
|
783
|
-
// Compact folds coordinator health into the top-level `ready`/`not_ready`
|
|
784
|
-
// synthesis (`coordinator_not_running` / `coordinator_schema_not_ok`).
|
|
785
|
-
let ws = seed_status_workspace();
|
|
786
|
-
let v = status_port::status(&ws, /*compact=*/ true, /*detail=*/ false).expect("status");
|
|
787
|
-
assert!(
|
|
788
|
-
v.as_object().unwrap().get("coordinator").is_none(),
|
|
789
|
-
"0.4.x: compact must NOT include `coordinator`; reasons fold into not_ready"
|
|
790
|
-
);
|
|
791
|
-
let _ = std::fs::remove_dir_all(&ws);
|
|
792
|
-
}
|
|
793
|
-
|
|
794
|
-
// ═══════════════════════════════════════════════════════════════════════════
|
|
795
|
-
// P0 (b) — CLI `send --task <unknown>` (route_task_id=true default = routing) MUST surface the
|
|
796
|
-
// golden error envelope {ok:false, error:"unknown task id:<id>", action, log} + exit 1 — NOT a
|
|
797
|
-
// silent 0-byte swallow (rt-host-b), and NO "validation:" prefix. Lock.
|
|
798
|
-
// ═══════════════════════════════════════════════════════════════════════════
|
|
799
|
-
// OLD seed: flat `{session_name, agents:{w1}, tasks:[]}`.
|
|
800
|
-
// NEW seed (Bug 1/2 — team-in-team state scope, see tests/team_in_team_state_scope_red.rs):
|
|
801
|
-
// cmd_send projects state through the active team_key before reaching the unknown-task
|
|
802
|
-
// gate, so agents/tasks must live under `teams[<key>].*` to be visible at projection
|
|
803
|
-
// time. The "unknown task -> golden envelope" behavior being asserted is unchanged.
|
|
804
|
-
#[test]
|
|
805
|
-
fn cmd_send_legacy_task_flag_does_not_require_a_coordinator_task() {
|
|
806
|
-
let args = SendArgs { task: Some("t-unknown".into()), ..send_args_fixture() };
|
|
807
|
-
let result = cmd_send(&args).expect("legacy task metadata cannot gate physical/inbox delivery");
|
|
808
|
-
assert_eq!(result.exit, ExitCode::Ok);
|
|
809
|
-
let inbox = crate::inbox_store::read(&args.workspace, "alice", 3, None).unwrap();
|
|
810
|
-
assert_eq!(inbox["messages"][0]["content"], "hello world foo");
|
|
811
|
-
assert!(inbox["messages"][0].get("task_id").is_none());
|
|
812
|
-
}
|
|
813
|
-
|
|
814
|
-
#[test]
|
|
815
|
-
fn run_send_legacy_task_flag_is_not_persisted_in_the_delivery_database() {
|
|
816
|
-
let args = send_args_fixture();
|
|
817
|
-
let argv = ["send", "alice", "--team", "teamA", "--task", "t-unknown", "go", "--mailbox", "--json"].map(str::to_string);
|
|
818
|
-
assert_eq!(run(&argv, &args.workspace), ExitCode::Ok);
|
|
819
|
-
let inbox = crate::inbox_store::read(&args.workspace, "alice", 3, None).unwrap();
|
|
820
|
-
assert_eq!(inbox["messages"][0]["content"], "go");
|
|
821
|
-
assert!(inbox["messages"][0].get("task_id").is_none());
|
|
822
|
-
let conn = rusqlite::Connection::open(args.workspace.join(".team/runtime/team.db")).unwrap();
|
|
823
|
-
let count: i64 = conn.query_row("SELECT count(*) FROM messages", [], |row| row.get(0)).unwrap();
|
|
824
|
-
assert_eq!(count, 0);
|
|
825
|
-
}
|
|
826
|
-
|
|
827
|
-
#[test]
|
|
828
|
-
fn run_leader_passthrough_flag_after_dashdash_renders_error_not_silent_swallow() {
|
|
829
|
-
let ws = std::env::temp_dir().join(format!(
|
|
830
|
-
"ta-run-leaderflag-{}-{}",
|
|
831
|
-
std::process::id(),
|
|
832
|
-
std::time::SystemTime::now()
|
|
833
|
-
.duration_since(std::time::UNIX_EPOCH)
|
|
834
|
-
.unwrap()
|
|
835
|
-
.as_nanos()
|
|
836
|
-
));
|
|
837
|
-
std::fs::create_dir_all(&ws).unwrap();
|
|
838
|
-
let argv: Vec<String> = ["codex", "--", "--external-leader"]
|
|
839
|
-
.iter()
|
|
840
|
-
.map(ToString::to_string)
|
|
841
|
-
.collect();
|
|
842
|
-
|
|
843
|
-
let code = run(&argv, &ws);
|
|
844
|
-
|
|
845
|
-
assert_eq!(
|
|
846
|
-
code,
|
|
847
|
-
ExitCode::Error,
|
|
848
|
-
"misplaced leader flag must fail before provider exec"
|
|
849
|
-
);
|
|
850
|
-
let logs_dir = ws.join(".team").join("logs");
|
|
851
|
-
let mut found = String::new();
|
|
852
|
-
if let Ok(entries) = std::fs::read_dir(&logs_dir) {
|
|
853
|
-
for entry in entries.flatten() {
|
|
854
|
-
let name = entry.file_name().to_string_lossy().to_string();
|
|
855
|
-
if name.starts_with("cli-error-") {
|
|
856
|
-
found = std::fs::read_to_string(entry.path()).unwrap_or_default();
|
|
857
|
-
break;
|
|
858
|
-
}
|
|
859
|
-
}
|
|
860
|
-
}
|
|
861
|
-
assert!(
|
|
862
|
-
found.contains("Team Agent launcher flag --external-leader must appear before --"),
|
|
863
|
-
"leader passthrough run() must render the misplaced flag error; a silent swallow leaves no \
|
|
864
|
-
cli-error log. got log body: {found:?}"
|
|
865
|
-
);
|
|
866
|
-
let _ = std::fs::remove_dir_all(&ws);
|
|
867
|
-
}
|
|
868
|
-
|
|
869
|
-
// R8 D6 (c-lite offline byte-lock): the CLI requeued_exhausted_watchers return projection, extracted
|
|
870
|
-
// into a pure helper, must project the golden event's watcher_ids STRING list (leader/__init__.py:56) —
|
|
871
|
-
// NOT the Rust `requeued` Vec<WatcherNotice> objects.
|
|
872
|
-
#[test]
|
|
873
|
-
fn r8_project_requeued_exhausted_watchers_golden_string_list() {
|
|
874
|
-
// golden attach event shape (what D4 emits): {watcher_ids:[str], count, trigger}.
|
|
875
|
-
let golden_event =
|
|
876
|
-
serde_json::json!({"watcher_ids": ["w1", "w2"], "count": 2, "trigger": "attach_leader"});
|
|
877
|
-
let projected = crate::cli::leader_port::project_requeued_exhausted_watchers(&golden_event);
|
|
878
|
-
let list = projected
|
|
879
|
-
.as_array()
|
|
880
|
-
.expect("requeued_exhausted_watchers must be a JSON array");
|
|
881
|
-
let ids: Vec<&str> = list.iter().filter_map(|v| v.as_str()).collect();
|
|
882
|
-
assert_eq!(
|
|
883
|
-
ids,
|
|
884
|
-
vec!["w1", "w2"],
|
|
885
|
-
"D6: CLI requeued_exhausted_watchers must project the golden watcher_ids STRING list \
|
|
886
|
-
(leader/__init__.py:56), not the `requeued` Vec<WatcherNotice> objects; got {projected:?}"
|
|
887
|
-
);
|
|
888
|
-
}
|