@team-agent/installer 0.5.128 → 0.6.1
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,885 +0,0 @@
|
|
|
1
|
-
use super::*;
|
|
2
|
-
|
|
3
|
-
// RED 契约 lane:argv→run 端到端、五行 summary 字节锁(Gap 18a)、
|
|
4
|
-
// classify_agent_bucket(unknown≠idle)、cli-error 信封字节锁、leader_launcher_args 解析、
|
|
5
|
-
// consume_leader_inbox_summary 游标+预算截断、send_target fanout 解析。
|
|
6
|
-
// Python golden 来源:cli/{parser,commands,helpers}.py @ v0.2.11(439bef8)。
|
|
7
|
-
// 所有期望值用 `PYTHONPATH=.../src python3` 实跑 Python 实现抓取的字节级 golden。
|
|
8
|
-
use super::*;
|
|
9
|
-
use serde_json::json;
|
|
10
|
-
|
|
11
|
-
// =========================================================================
|
|
12
|
-
// provider_args(helpers.py:190-193):values[0]=='--' ? values[1..] : values
|
|
13
|
-
// =========================================================================
|
|
14
|
-
|
|
15
|
-
#[test]
|
|
16
|
-
fn provider_args_cases() {
|
|
17
|
-
// (old case-id, input, Python golden); values[1:] of a lone "--" is empty.
|
|
18
|
-
const CASES: &[(&str, &[&str], &[&str])] = &[
|
|
19
|
-
(
|
|
20
|
-
"provider_args_strips_leading_dashdash",
|
|
21
|
-
&["--", "-x"],
|
|
22
|
-
&["-x"],
|
|
23
|
-
),
|
|
24
|
-
(
|
|
25
|
-
"provider_args_keeps_when_no_leading_dashdash",
|
|
26
|
-
&["-x", "-y"],
|
|
27
|
-
&["-x", "-y"],
|
|
28
|
-
),
|
|
29
|
-
("provider_args_empty_is_empty", &[], &[]),
|
|
30
|
-
("provider_args_lone_dashdash_yields_empty", &["--"], &[]),
|
|
31
|
-
];
|
|
32
|
-
for (id, input, expected) in CASES {
|
|
33
|
-
let argv: Vec<String> = input.iter().map(|arg| (*arg).to_string()).collect();
|
|
34
|
-
let expected: Vec<String> = expected.iter().map(|arg| (*arg).to_string()).collect();
|
|
35
|
-
assert_eq!(provider_args(&argv), expected, "{id}");
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// =========================================================================
|
|
40
|
-
// leader_launcher_args(helpers.py:196-226):attach 旗标解析 + 缺值 Err
|
|
41
|
-
// =========================================================================
|
|
42
|
-
|
|
43
|
-
#[test]
|
|
44
|
-
fn leader_launcher_args_success_cases() {
|
|
45
|
-
// (old case-id, argv, complete expected structure), including default false flags.
|
|
46
|
-
let cases: &[(&str, &[&str], LeaderLauncherArgs)] = &[
|
|
47
|
-
(
|
|
48
|
-
"leader_launcher_args_empty_all_default",
|
|
49
|
-
&[],
|
|
50
|
-
LeaderLauncherArgs::default(),
|
|
51
|
-
),
|
|
52
|
-
(
|
|
53
|
-
"leader_launcher_args_attach_and_confirm",
|
|
54
|
-
&["--attach", "--confirm"],
|
|
55
|
-
LeaderLauncherArgs {
|
|
56
|
-
attach_existing: true,
|
|
57
|
-
confirm_attach: true,
|
|
58
|
-
..Default::default()
|
|
59
|
-
},
|
|
60
|
-
),
|
|
61
|
-
// --attach-existing is an alias of --attach.
|
|
62
|
-
(
|
|
63
|
-
"leader_launcher_args_attach_existing_alias",
|
|
64
|
-
&["--attach-existing"],
|
|
65
|
-
LeaderLauncherArgs {
|
|
66
|
-
attach_existing: true,
|
|
67
|
-
..Default::default()
|
|
68
|
-
},
|
|
69
|
-
),
|
|
70
|
-
(
|
|
71
|
-
"leader_launcher_args_external_leader_opt_out",
|
|
72
|
-
&["--external-leader", "--", "--model", "opus"],
|
|
73
|
-
LeaderLauncherArgs {
|
|
74
|
-
provider_args: vec!["--model".to_string(), "opus".to_string()],
|
|
75
|
-
external_leader: true,
|
|
76
|
-
..Default::default()
|
|
77
|
-
},
|
|
78
|
-
),
|
|
79
|
-
(
|
|
80
|
-
"leader_launcher_args_attach_session_spaced",
|
|
81
|
-
&["--attach-session", "mysess"],
|
|
82
|
-
LeaderLauncherArgs {
|
|
83
|
-
attach_session: Some("mysess".to_string()),
|
|
84
|
-
..Default::default()
|
|
85
|
-
},
|
|
86
|
-
),
|
|
87
|
-
(
|
|
88
|
-
"leader_launcher_args_attach_session_equals",
|
|
89
|
-
&["--attach-session=mysess"],
|
|
90
|
-
LeaderLauncherArgs {
|
|
91
|
-
attach_session: Some("mysess".to_string()),
|
|
92
|
-
..Default::default()
|
|
93
|
-
},
|
|
94
|
-
),
|
|
95
|
-
// Known Team Agent launcher flags after `--` are rejected by the error table.
|
|
96
|
-
(
|
|
97
|
-
"leader_launcher_args_dashdash_passthrough_strips_separator",
|
|
98
|
-
&["--attach", "--", "-x", "--provider-confirm"],
|
|
99
|
-
LeaderLauncherArgs {
|
|
100
|
-
provider_args: vec!["-x".to_string(), "--provider-confirm".to_string()],
|
|
101
|
-
attach_existing: true,
|
|
102
|
-
..Default::default()
|
|
103
|
-
},
|
|
104
|
-
),
|
|
105
|
-
(
|
|
106
|
-
"leader_launcher_args_unknown_tokens_collect_as_provider_args",
|
|
107
|
-
&["foo", "--attach", "bar"],
|
|
108
|
-
LeaderLauncherArgs {
|
|
109
|
-
provider_args: vec!["foo".to_string(), "bar".to_string()],
|
|
110
|
-
attach_existing: true,
|
|
111
|
-
..Default::default()
|
|
112
|
-
},
|
|
113
|
-
),
|
|
114
|
-
];
|
|
115
|
-
for (id, input, expected) in cases {
|
|
116
|
-
let argv: Vec<String> = input.iter().map(|arg| (*arg).to_string()).collect();
|
|
117
|
-
let got = leader_launcher_args(&argv).unwrap_or_else(|err| panic!("{id}: {err}"));
|
|
118
|
-
assert_eq!(got, *expected, "{id}");
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
#[test]
|
|
123
|
-
fn leader_launcher_args_error_cases() {
|
|
124
|
-
// Preserve the original error-substring contract, rather than requiring exact equality.
|
|
125
|
-
const CASES: &[(&str, &[&str], &str)] = &[
|
|
126
|
-
(
|
|
127
|
-
"leader_launcher_args_external_leader_after_dashdash_errors",
|
|
128
|
-
&["--", "--external-leader"],
|
|
129
|
-
"Team Agent launcher flag --external-leader must appear before --",
|
|
130
|
-
),
|
|
131
|
-
(
|
|
132
|
-
"leader_launcher_args_attach_session_missing_value_errors",
|
|
133
|
-
&["--attach-session"],
|
|
134
|
-
"--attach-session requires a tmux session name",
|
|
135
|
-
),
|
|
136
|
-
];
|
|
137
|
-
for (id, input, expected) in CASES {
|
|
138
|
-
let argv: Vec<String> = input.iter().map(|arg| (*arg).to_string()).collect();
|
|
139
|
-
let err = leader_launcher_args(&argv).expect_err(id);
|
|
140
|
-
assert!(
|
|
141
|
-
err.to_string().contains(*expected),
|
|
142
|
-
"{id}: unexpected error: {err}"
|
|
143
|
-
);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
// =========================================================================
|
|
148
|
-
// send_target(commands.py:181-184):--to split / target / None
|
|
149
|
-
// =========================================================================
|
|
150
|
-
|
|
151
|
-
#[test]
|
|
152
|
-
fn send_target_cases() {
|
|
153
|
-
// (old case-id, targets, target, complete expected enum).
|
|
154
|
-
let cases: &[(&str, Option<&str>, Option<&str>, MessageTarget)] = &[
|
|
155
|
-
(
|
|
156
|
-
"send_target_fanout_strips_and_filters_empty",
|
|
157
|
-
Some("a, b ,,c"),
|
|
158
|
-
None,
|
|
159
|
-
MessageTarget::Fanout(vec!["a".to_string(), "b".to_string(), "c".to_string()]),
|
|
160
|
-
),
|
|
161
|
-
(
|
|
162
|
-
"send_target_single_target",
|
|
163
|
-
None,
|
|
164
|
-
Some("agent_x"),
|
|
165
|
-
MessageTarget::Single("agent_x".to_string()),
|
|
166
|
-
),
|
|
167
|
-
// A bare "*" means broadcast to the whole team.
|
|
168
|
-
(
|
|
169
|
-
"send_target_broadcast_star",
|
|
170
|
-
None,
|
|
171
|
-
Some("*"),
|
|
172
|
-
MessageTarget::Broadcast,
|
|
173
|
-
),
|
|
174
|
-
// targets="" is falsy in Python, so it falls through to args.target.
|
|
175
|
-
(
|
|
176
|
-
"send_target_empty_targets_falls_through_to_target",
|
|
177
|
-
Some(""),
|
|
178
|
-
Some("fallback"),
|
|
179
|
-
MessageTarget::Single("fallback".to_string()),
|
|
180
|
-
),
|
|
181
|
-
];
|
|
182
|
-
for (id, targets, target, expected) in cases {
|
|
183
|
-
assert_eq!(send_target(*targets, *target), *expected, "{id}");
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
// =========================================================================
|
|
188
|
-
// classify_agent_bucket / agent_summary_counts(commands.py:309-330)
|
|
189
|
-
// bug-071/077/085 铁律:unknown ≠ idle,无匹配态显式落 Unknown
|
|
190
|
-
// =========================================================================
|
|
191
|
-
|
|
192
|
-
#[test]
|
|
193
|
-
fn classify_agent_bucket_cases() {
|
|
194
|
-
// (old case-id, all original (raw, health) inputs, expected bucket).
|
|
195
|
-
const CASES: &[(&str, &[(&str, &str)], SummaryBucket)] = &[
|
|
196
|
-
(
|
|
197
|
-
"classify_failed_takes_priority",
|
|
198
|
-
&[("failed", ""), ("error", ""), ("running", "error")],
|
|
199
|
-
SummaryBucket::Failed,
|
|
200
|
-
),
|
|
201
|
-
(
|
|
202
|
-
"classify_stopped",
|
|
203
|
-
&[("stopped", ""), ("done", ""), ("running", "done")],
|
|
204
|
-
SummaryBucket::Stopped,
|
|
205
|
-
),
|
|
206
|
-
(
|
|
207
|
-
"classify_busy",
|
|
208
|
-
&[("busy", ""), ("", "running"), ("", "working")],
|
|
209
|
-
SummaryBucket::Busy,
|
|
210
|
-
),
|
|
211
|
-
// hstatus==idle precedes the raw==running branch.
|
|
212
|
-
(
|
|
213
|
-
"classify_hstatus_idle_beats_raw_running",
|
|
214
|
-
&[("running", "idle")],
|
|
215
|
-
SummaryBucket::Idle,
|
|
216
|
-
),
|
|
217
|
-
(
|
|
218
|
-
"classify_pure_running",
|
|
219
|
-
&[("running", "")],
|
|
220
|
-
SummaryBucket::Running,
|
|
221
|
-
),
|
|
222
|
-
// bug-071/077/085: unmatched and blocked/stuck/missing are Unknown, NEVER idle.
|
|
223
|
-
(
|
|
224
|
-
"classify_blocked_and_unmatched_are_unknown_never_idle",
|
|
225
|
-
&[
|
|
226
|
-
("blocked", ""),
|
|
227
|
-
("stuck", ""),
|
|
228
|
-
("", "missing"),
|
|
229
|
-
("weird_value", ""),
|
|
230
|
-
("", ""),
|
|
231
|
-
],
|
|
232
|
-
SummaryBucket::Unknown,
|
|
233
|
-
),
|
|
234
|
-
];
|
|
235
|
-
for (id, inputs, expected) in CASES {
|
|
236
|
-
for &(raw, health) in inputs.iter() {
|
|
237
|
-
assert_eq!(
|
|
238
|
-
classify_agent_bucket(raw, health),
|
|
239
|
-
*expected,
|
|
240
|
-
"{id}: raw={raw:?}, health={health:?}"
|
|
241
|
-
);
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
#[test]
|
|
247
|
-
fn agent_summary_counts_mixed_golden() {
|
|
248
|
-
// golden (empty health): a1 running->Running; a2 busy->Busy; a3 failed->Failed;
|
|
249
|
-
// a4 stopped->Stopped; a5 blocked->Unknown; a6 ""->Unknown; a7 weird->Unknown.
|
|
250
|
-
// => running=1 busy=1 idle=0 stopped=1 failed=1 unknown=3
|
|
251
|
-
let agents = json!({
|
|
252
|
-
"a1": {"status": "running"},
|
|
253
|
-
"a2": {"status": "busy"},
|
|
254
|
-
"a3": {"status": "failed"},
|
|
255
|
-
"a4": {"status": "stopped"},
|
|
256
|
-
"a5": {"status": "blocked"},
|
|
257
|
-
"a6": {"status": ""},
|
|
258
|
-
"a7": {"status": "weird_value"},
|
|
259
|
-
});
|
|
260
|
-
let got = agent_summary_counts(&agents, &json!({}));
|
|
261
|
-
assert_eq!(
|
|
262
|
-
got,
|
|
263
|
-
SummaryCounts {
|
|
264
|
-
running: 1,
|
|
265
|
-
busy: 1,
|
|
266
|
-
idle: 0,
|
|
267
|
-
stopped: 1,
|
|
268
|
-
failed: 1,
|
|
269
|
-
unknown: 3
|
|
270
|
-
}
|
|
271
|
-
);
|
|
272
|
-
assert_eq!(got.total(), 7);
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
#[test]
|
|
276
|
-
fn agent_summary_counts_none_agent_is_unknown() {
|
|
277
|
-
// golden: {"x": None} -> unknown=1
|
|
278
|
-
let got = agent_summary_counts(&json!({"x": Value::Null}), &json!({}));
|
|
279
|
-
assert_eq!(
|
|
280
|
-
got,
|
|
281
|
-
SummaryCounts {
|
|
282
|
-
unknown: 1,
|
|
283
|
-
..Default::default()
|
|
284
|
-
}
|
|
285
|
-
);
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
#[test]
|
|
289
|
-
fn agent_summary_counts_uppercase_status_lowercased() {
|
|
290
|
-
// golden: {"x":{"status":"RUNNING"}} -> running=1 (str(...).lower())
|
|
291
|
-
let got = agent_summary_counts(&json!({"x": {"status": "RUNNING"}}), &json!({}));
|
|
292
|
-
assert_eq!(
|
|
293
|
-
got,
|
|
294
|
-
SummaryCounts {
|
|
295
|
-
running: 1,
|
|
296
|
-
..Default::default()
|
|
297
|
-
}
|
|
298
|
-
);
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
// =========================================================================
|
|
302
|
-
// interaction_counts(commands.py:292-306):interacted 非空且≠"never"
|
|
303
|
-
// =========================================================================
|
|
304
|
-
|
|
305
|
-
#[test]
|
|
306
|
-
fn interaction_counts_mixed_golden() {
|
|
307
|
-
// golden: a:"5m ago"->interacted; b:"never"->never; c:""->never; d:{}->never; e:None->never
|
|
308
|
-
// result (1, 4)
|
|
309
|
-
let agents = json!({
|
|
310
|
-
"a": {"interacted": "5m ago"},
|
|
311
|
-
"b": {"interacted": "never"},
|
|
312
|
-
"c": {"interacted": ""},
|
|
313
|
-
"d": {},
|
|
314
|
-
"e": Value::Null,
|
|
315
|
-
});
|
|
316
|
-
let got = interaction_counts(&agents);
|
|
317
|
-
assert_eq!(
|
|
318
|
-
got,
|
|
319
|
-
InteractionCounts {
|
|
320
|
-
interacted: 1,
|
|
321
|
-
never: 4
|
|
322
|
-
}
|
|
323
|
-
);
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
// =========================================================================
|
|
327
|
-
// format_status_summary(commands.py:263-289):五行 triage 字节锁(Gap 18a)
|
|
328
|
-
// =========================================================================
|
|
329
|
-
|
|
330
|
-
#[test]
|
|
331
|
-
fn format_status_summary_full_byte_lock() {
|
|
332
|
-
// golden:
|
|
333
|
-
// coordinator: running schema_ok=True tmux=True
|
|
334
|
-
// receiver: %3 cmd=codex topology=external
|
|
335
|
-
// agents: 2 — running=1 busy=1 idle=0 stopped=0 failed=0 unknown=0
|
|
336
|
-
// queued: 2 mailbox messages awaiting delivery
|
|
337
|
-
// latest result: a1 -> did the thing @ -
|
|
338
|
-
let data = json!({
|
|
339
|
-
"coordinator": {"status": "running", "schema_ok": true},
|
|
340
|
-
"leader_receiver": {"pane_id": "%3", "pane_current_command": "codex"},
|
|
341
|
-
"agents": {"a1": {"status": "running"}, "a2": {"status": "busy"}},
|
|
342
|
-
"agent_health": {},
|
|
343
|
-
"tmux_session_present": true,
|
|
344
|
-
"queued_messages": [1, 2],
|
|
345
|
-
"latest_results": [{"agent_id": "a1", "summary": "did the thing", "created_at": Value::Null}],
|
|
346
|
-
});
|
|
347
|
-
let got = format_status_summary(&data);
|
|
348
|
-
let expected = "coordinator: running schema_ok=true tmux=true\n\
|
|
349
|
-
receiver: %3 cmd=codex topology=external\n\
|
|
350
|
-
agents: 2 — running=1 busy=1 idle=0 stopped=0 failed=0 unknown=0\n\
|
|
351
|
-
queued: 2 mailbox messages awaiting delivery\n\
|
|
352
|
-
latest result: a1 -> did the thing @ -";
|
|
353
|
-
assert_eq!(got, expected);
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
#[test]
|
|
357
|
-
fn format_status_summary_empty_byte_lock() {
|
|
358
|
-
// golden empty data: stopped/false/false, dashes, 0 counts, none latest.
|
|
359
|
-
let got = format_status_summary(&json!({}));
|
|
360
|
-
let expected = "coordinator: stopped schema_ok=false tmux=false\n\
|
|
361
|
-
receiver: - cmd=- topology=external\n\
|
|
362
|
-
agents: 0 — running=0 busy=0 idle=0 stopped=0 failed=0 unknown=0\n\
|
|
363
|
-
queued: 0 mailbox messages awaiting delivery\n\
|
|
364
|
-
latest result: none";
|
|
365
|
-
assert_eq!(got, expected);
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
#[test]
|
|
369
|
-
fn format_status_summary_interacted_marker_appended() {
|
|
370
|
-
// golden: when interacted>0, agents line gets " (1 interacted, 1 never)" suffix.
|
|
371
|
-
let data = json!({
|
|
372
|
-
"coordinator": {},
|
|
373
|
-
"agents": {"a1": {"status": "running", "interacted": "3m"}, "a2": {"status": "idle"}},
|
|
374
|
-
"agent_health": {"a2": {"status": "idle"}},
|
|
375
|
-
});
|
|
376
|
-
let got = format_status_summary(&data);
|
|
377
|
-
let line2 = got.lines().nth(2).unwrap();
|
|
378
|
-
assert_eq!(
|
|
379
|
-
line2,
|
|
380
|
-
"agents: 2 — running=1 busy=0 idle=1 stopped=0 failed=0 unknown=0 (1 interacted, 1 never)"
|
|
381
|
-
);
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
#[test]
|
|
385
|
-
fn format_status_summary_no_interacted_marker_when_zero() {
|
|
386
|
-
// Gap 18a contract: interacted==0 -> line[2] stays byte-identical with NO marker suffix.
|
|
387
|
-
let data = json!({
|
|
388
|
-
"agents": {"a1": {"status": "running"}},
|
|
389
|
-
"agent_health": {},
|
|
390
|
-
});
|
|
391
|
-
let line2 = format_status_summary(&data)
|
|
392
|
-
.lines()
|
|
393
|
-
.nth(2)
|
|
394
|
-
.unwrap()
|
|
395
|
-
.to_string();
|
|
396
|
-
assert_eq!(
|
|
397
|
-
line2,
|
|
398
|
-
"agents: 1 — running=1 busy=0 idle=0 stopped=0 failed=0 unknown=0"
|
|
399
|
-
);
|
|
400
|
-
assert!(
|
|
401
|
-
!line2.contains("interacted"),
|
|
402
|
-
"no marker when interacted==0"
|
|
403
|
-
);
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
#[test]
|
|
407
|
-
fn format_status_csv_preserves_agent_order_and_collapses_errors() {
|
|
408
|
-
let data = json!({
|
|
409
|
-
"agents": {
|
|
410
|
-
"zeta": {"status": "idle", "pane_id": "%1"},
|
|
411
|
-
"alpha": {"status": "running", "pane_id": "%2"},
|
|
412
|
-
"err_failed": {"status": "failed", "pane_id": "%3"},
|
|
413
|
-
"err_missing_pane": {"status": "running"},
|
|
414
|
-
"err_unknown": {"status": "mystery", "pane_id": "%4"},
|
|
415
|
-
"err_stopped": {"status": "stopped", "pane_id": "%5"}
|
|
416
|
-
},
|
|
417
|
-
"agent_health": {
|
|
418
|
-
"alpha": {"status": "working"}
|
|
419
|
-
}
|
|
420
|
-
});
|
|
421
|
-
assert_eq!(
|
|
422
|
-
format_status_csv(&data),
|
|
423
|
-
"zeta,idle\nalpha,working\nerr_failed,error\nerr_missing_pane,error\nerr_unknown,error\nerr_stopped,error"
|
|
424
|
-
);
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
#[test]
|
|
428
|
-
fn format_status_csv_zero_workers_is_empty() {
|
|
429
|
-
assert_eq!(
|
|
430
|
-
format_status_csv(&json!({"agents": {}, "agent_health": {}})),
|
|
431
|
-
""
|
|
432
|
-
);
|
|
433
|
-
}
|
|
434
|
-
|
|
435
|
-
// =========================================================================
|
|
436
|
-
// emit(helpers.py:12-23):--json sort_keys+indent=2 | dict 逐键 | 非 dict
|
|
437
|
-
// =========================================================================
|
|
438
|
-
|
|
439
|
-
#[test]
|
|
440
|
-
fn emit_json_sorted_indented() {
|
|
441
|
-
// golden json.dumps(indent=2, sort_keys=True): keys sorted a,b,nested; nested list expanded.
|
|
442
|
-
let out = emit(
|
|
443
|
-
&CmdOutput::Json(json!({"b": 2, "a": 1, "nested": {"x": [1, 2]}})),
|
|
444
|
-
true,
|
|
445
|
-
)
|
|
446
|
-
.expect("json emit returns Some");
|
|
447
|
-
let expected = "{\n \"a\": 1,\n \"b\": 2,\n \"nested\": {\n \"x\": [\n 1,\n 2\n ]\n }\n}";
|
|
448
|
-
assert_eq!(out, expected);
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
#[test]
|
|
452
|
-
fn emit_dict_human_per_key() {
|
|
453
|
-
// golden human dict: scalar -> "key: value"; dict/list -> compact json value.
|
|
454
|
-
// KEY INSERTION ORDER preserved (NOT sorted) in non-json path.
|
|
455
|
-
let out = emit(
|
|
456
|
-
&CmdOutput::Json(json!({"key1": "val1", "nested": {"a": 1}, "lst": [1, 2]})),
|
|
457
|
-
false,
|
|
458
|
-
)
|
|
459
|
-
.expect("dict human emit returns Some");
|
|
460
|
-
let expected = "key1: val1\nnested: {\"a\": 1}\nlst: [1, 2]";
|
|
461
|
-
assert_eq!(out, expected);
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
#[test]
|
|
465
|
-
fn emit_human_non_dict_passthrough() {
|
|
466
|
-
// golden: non-dict (Human string) printed raw.
|
|
467
|
-
let out =
|
|
468
|
-
emit(&CmdOutput::Human("just a string".into()), false).expect("human emit returns Some");
|
|
469
|
-
assert_eq!(out, "just a string");
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
#[test]
|
|
473
|
-
fn emit_none_output_produces_nothing() {
|
|
474
|
-
// passthrough/watch: CmdOutput::None never reaches emit -> None (no stdout line).
|
|
475
|
-
assert_eq!(emit(&CmdOutput::None, false), None);
|
|
476
|
-
assert_eq!(emit(&CmdOutput::None, true), None);
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
// =========================================================================
|
|
480
|
-
// CliError::to_payload(helpers.py:137-187):稳定信封 + tmux 冲突富化
|
|
481
|
-
// =========================================================================
|
|
482
|
-
|
|
483
|
-
#[test]
|
|
484
|
-
fn cli_error_payload_plain_runtime() {
|
|
485
|
-
// golden plain: ok=false, error=str(exc), action=generic, log=path, NO reason/session/next.
|
|
486
|
-
let err = CliError::Runtime("some other error".into());
|
|
487
|
-
let payload = err.to_payload(Path::new("/tmp/y.log"), "status");
|
|
488
|
-
assert!(!payload.ok);
|
|
489
|
-
assert_eq!(payload.error, "some other error");
|
|
490
|
-
assert_eq!(
|
|
491
|
-
payload.action,
|
|
492
|
-
"Run team-agent doctor --workspace . for the selected team, or inspect the error log shown here."
|
|
493
|
-
);
|
|
494
|
-
assert_eq!(payload.log, "/tmp/y.log");
|
|
495
|
-
assert_eq!(payload.reason, None);
|
|
496
|
-
assert_eq!(payload.session_name, None);
|
|
497
|
-
assert_eq!(payload.next_actions, None);
|
|
498
|
-
}
|
|
499
|
-
|
|
500
|
-
#[test]
|
|
501
|
-
fn cli_error_payload_tmux_conflict_quick_start_enrichment() {
|
|
502
|
-
// golden quick-start enrichment (exact bytes):
|
|
503
|
-
let err = CliError::Runtime("tmux session already exists: my-team. Startup aborted".into());
|
|
504
|
-
let payload = err.to_payload(Path::new("/tmp/cli-error-123.log"), "quick-start");
|
|
505
|
-
assert_eq!(
|
|
506
|
-
payload.reason.as_deref(),
|
|
507
|
-
Some("tmux_session_name_conflict")
|
|
508
|
-
);
|
|
509
|
-
assert_eq!(payload.session_name.as_deref(), Some("my-team"));
|
|
510
|
-
// E8 (N38): quick-start 撞已有 runtime 引导到 restart(resume);
|
|
511
|
-
// context reset is only through restart --allow-fresh with explicit consent.
|
|
512
|
-
assert_eq!(
|
|
513
|
-
payload.action,
|
|
514
|
-
"Terminal session `my-team` already exists and may belong to your existing team. Resume with team-agent restart; use --allow-fresh only after explicitly accepting loss of saved context. To create another team, change the name in TEAM.md before quick-start. Do not shut down an existing team to bypass this refusal."
|
|
515
|
-
);
|
|
516
|
-
let next = payload.next_actions.as_ref().unwrap();
|
|
517
|
-
assert_eq!(next.len(), 2);
|
|
518
|
-
assert!(next[0].contains("team-agent restart"));
|
|
519
|
-
assert!(
|
|
520
|
-
next[1].contains("TEAM.md") && next[1].contains("name") && next[1].contains("quick-start")
|
|
521
|
-
);
|
|
522
|
-
}
|
|
523
|
-
|
|
524
|
-
#[test]
|
|
525
|
-
fn cli_error_payload_tmux_conflict_non_quick_start_enrichment() {
|
|
526
|
-
// golden non-quick-start (command="restart") enrichment uses generic startup wording.
|
|
527
|
-
let err = CliError::Runtime("tmux session already exists: my-team. Startup aborted".into());
|
|
528
|
-
let payload = err.to_payload(Path::new("/tmp/x.log"), "restart");
|
|
529
|
-
assert_eq!(payload.session_name.as_deref(), Some("my-team"));
|
|
530
|
-
assert_eq!(
|
|
531
|
-
payload.action,
|
|
532
|
-
"Terminal session `my-team` already exists and may belong to a running team. Do not shut it down; choose another team name before starting."
|
|
533
|
-
);
|
|
534
|
-
let next = payload.next_actions.as_ref().unwrap();
|
|
535
|
-
assert_eq!(next.len(), 1);
|
|
536
|
-
assert!(next[0].contains("team") && next[0].contains("name"));
|
|
537
|
-
}
|
|
538
|
-
|
|
539
|
-
#[test]
|
|
540
|
-
fn cli_error_payload_json_shape_serializes_optional_fields_skipped() {
|
|
541
|
-
// skip_serializing_if for reason/session_name/next_actions: plain payload omits them.
|
|
542
|
-
let err = CliError::Runtime("boom".into());
|
|
543
|
-
let payload = err.to_payload(Path::new("/tmp/z.log"), "status");
|
|
544
|
-
let v = serde_json::to_value(&payload).unwrap();
|
|
545
|
-
let obj = v.as_object().unwrap();
|
|
546
|
-
assert!(!obj.contains_key("reason"), "reason omitted on plain error");
|
|
547
|
-
assert!(!obj.contains_key("session_name"));
|
|
548
|
-
assert!(!obj.contains_key("next_actions"));
|
|
549
|
-
assert_eq!(obj.get("ok"), Some(&json!(false)));
|
|
550
|
-
}
|
|
551
|
-
|
|
552
|
-
#[test]
|
|
553
|
-
fn consume_inbox_missing_file_returns_none() {
|
|
554
|
-
// helpers.py:30-31: inbox_path absent -> None (no crash).
|
|
555
|
-
let ws = tmp_workspace();
|
|
556
|
-
assert_eq!(consume_leader_inbox_summary(&ws, 500), None);
|
|
557
|
-
let _ = std::fs::remove_dir_all(&ws);
|
|
558
|
-
}
|
|
559
|
-
|
|
560
|
-
#[test]
|
|
561
|
-
fn consume_inbox_single_entry_summary_and_cursor_advance() {
|
|
562
|
-
// golden _leader_inbox_summary single entry:
|
|
563
|
-
// "Leader inbox: 1 new fallback entry\n- Hello world message\nHint: team-agent inbox leader"
|
|
564
|
-
let ws = tmp_workspace();
|
|
565
|
-
let inbox = ws.join(".team").join("runtime").join("leader-inbox.log");
|
|
566
|
-
std::fs::write(&inbox, "[x fallback]\nHello world message").unwrap();
|
|
567
|
-
let summary = consume_leader_inbox_summary(&ws, 500).expect("new entry -> Some");
|
|
568
|
-
assert_eq!(
|
|
569
|
-
summary,
|
|
570
|
-
"Leader inbox: 1 new fallback entry\n- Hello world message\nHint: team-agent inbox leader"
|
|
571
|
-
);
|
|
572
|
-
// cursor advanced: a second call with no new bytes -> None (offset==size).
|
|
573
|
-
assert_eq!(consume_leader_inbox_summary(&ws, 500), None);
|
|
574
|
-
let _ = std::fs::remove_dir_all(&ws);
|
|
575
|
-
}
|
|
576
|
-
|
|
577
|
-
#[test]
|
|
578
|
-
fn consume_inbox_two_entries_plural() {
|
|
579
|
-
// golden two-entry summary uses plural "entries".
|
|
580
|
-
let ws = tmp_workspace();
|
|
581
|
-
let inbox = ws.join(".team").join("runtime").join("leader-inbox.log");
|
|
582
|
-
std::fs::write(&inbox, "[a fallback]\nFirst msg\n[b fallback]\nSecond msg").unwrap();
|
|
583
|
-
let summary = consume_leader_inbox_summary(&ws, 500).expect("Some");
|
|
584
|
-
assert_eq!(
|
|
585
|
-
summary,
|
|
586
|
-
"Leader inbox: 2 new fallback entries\n- First msg\n- Second msg\nHint: team-agent inbox leader"
|
|
587
|
-
);
|
|
588
|
-
let _ = std::fs::remove_dir_all(&ws);
|
|
589
|
-
}
|
|
590
|
-
|
|
591
|
-
#[test]
|
|
592
|
-
fn consume_inbox_budget_truncation_footer() {
|
|
593
|
-
// golden budget=200: header + 2 lines then truncation footer (exact bytes from Python).
|
|
594
|
-
let ws = tmp_workspace();
|
|
595
|
-
let inbox = ws.join(".team").join("runtime").join("leader-inbox.log");
|
|
596
|
-
let many: String = (0..20)
|
|
597
|
-
.map(|i| format!("[e{i} fallback]\nMessage number {i} with some text padding here"))
|
|
598
|
-
.collect::<Vec<_>>()
|
|
599
|
-
.join("\n");
|
|
600
|
-
std::fs::write(&inbox, &many).unwrap();
|
|
601
|
-
let summary = consume_leader_inbox_summary(&ws, 200).expect("Some");
|
|
602
|
-
let expected = "Leader inbox: 20 new fallback entries\n\
|
|
603
|
-
- Message number 0 with some text padding here\n\
|
|
604
|
-
- Message number 1 with some text padd ...\n\
|
|
605
|
-
Truncated: more fallback entries available; run team-agent inbox leader";
|
|
606
|
-
assert_eq!(summary, expected);
|
|
607
|
-
let _ = std::fs::remove_dir_all(&ws);
|
|
608
|
-
}
|
|
609
|
-
|
|
610
|
-
// =========================================================================
|
|
611
|
-
// CmdResult::from_json(parser.py:507-508):ok is False -> ExitCode::Error
|
|
612
|
-
// =========================================================================
|
|
613
|
-
|
|
614
|
-
#[test]
|
|
615
|
-
fn cmd_result_from_json_ok_true_exits_ok() {
|
|
616
|
-
let r = CmdResult::from_json(json!({"ok": true, "x": 1}), true);
|
|
617
|
-
assert_eq!(r.exit, ExitCode::Ok);
|
|
618
|
-
assert!(r.as_json);
|
|
619
|
-
assert_eq!(r.output, CmdOutput::Json(json!({"ok": true, "x": 1})));
|
|
620
|
-
}
|
|
621
|
-
|
|
622
|
-
#[test]
|
|
623
|
-
fn cmd_result_from_json_ok_false_exits_error() {
|
|
624
|
-
// parser.py:507: result.get("ok") is False -> SystemExit(1)
|
|
625
|
-
let r = CmdResult::from_json(json!({"ok": false, "error": "x"}), false);
|
|
626
|
-
assert_eq!(r.exit, ExitCode::Error);
|
|
627
|
-
assert!(!r.as_json);
|
|
628
|
-
}
|
|
629
|
-
|
|
630
|
-
#[test]
|
|
631
|
-
fn cmd_result_from_json_missing_ok_exits_ok() {
|
|
632
|
-
// result with NO "ok" key: `result.get("ok") is False` is False -> NOT an error (exit Ok).
|
|
633
|
-
// None-vs-missing: absence of ok != ok:false.
|
|
634
|
-
let r = CmdResult::from_json(json!({"summary": "fine"}), false);
|
|
635
|
-
assert_eq!(r.exit, ExitCode::Ok);
|
|
636
|
-
}
|
|
637
|
-
|
|
638
|
-
#[test]
|
|
639
|
-
fn exit_code_numeric() {
|
|
640
|
-
assert_eq!(ExitCode::Ok.code(), 0);
|
|
641
|
-
assert_eq!(ExitCode::Error.code(), 1);
|
|
642
|
-
}
|
|
643
|
-
|
|
644
|
-
// =========================================================================
|
|
645
|
-
// cmd_doctor: --fix without --gate is a structured failure in both renderers.
|
|
646
|
-
// =========================================================================
|
|
647
|
-
|
|
648
|
-
#[test]
|
|
649
|
-
fn cmd_doctor_fix_without_gate_reports_usage_failure() {
|
|
650
|
-
let mut args = DoctorArgs {
|
|
651
|
-
spec: None,
|
|
652
|
-
workspace: PathBuf::from("."),
|
|
653
|
-
gate: None,
|
|
654
|
-
comms: false,
|
|
655
|
-
team: None,
|
|
656
|
-
fix: true,
|
|
657
|
-
fix_schema: false,
|
|
658
|
-
cleanup_orphans: false,
|
|
659
|
-
confirm: false,
|
|
660
|
-
json: false,
|
|
661
|
-
};
|
|
662
|
-
let human = cmd_doctor(&args).expect("structured usage failure");
|
|
663
|
-
assert_eq!(human.exit, ExitCode::Error);
|
|
664
|
-
let CmdOutput::Human(text) = human.output else {
|
|
665
|
-
panic!("expected human triage");
|
|
666
|
-
};
|
|
667
|
-
assert!(text.contains("fix_requires_gate"), "{text}");
|
|
668
|
-
assert!(text.contains("add --gate orphans|comms"), "{text}");
|
|
669
|
-
|
|
670
|
-
args.json = true;
|
|
671
|
-
let result = cmd_doctor(&args).expect("structured JSON usage failure");
|
|
672
|
-
assert_eq!(result.exit, ExitCode::Error);
|
|
673
|
-
let CmdOutput::Json(value) = result.output else {
|
|
674
|
-
panic!("expected JSON usage failure");
|
|
675
|
-
};
|
|
676
|
-
assert_eq!(value["ok"], false);
|
|
677
|
-
assert_eq!(value["error"], "--fix requires --gate");
|
|
678
|
-
assert_eq!(value["issues"], json!(["fix_requires_gate"]));
|
|
679
|
-
}
|
|
680
|
-
|
|
681
|
-
// =========================================================================
|
|
682
|
-
// cmd_status 三态互斥(commands.py:90-100)
|
|
683
|
-
// =========================================================================
|
|
684
|
-
|
|
685
|
-
#[test]
|
|
686
|
-
fn cmd_status_summary_with_json_is_mutually_exclusive() {
|
|
687
|
-
// commands.py:92-93: --summary and --json -> TeamAgentError(mutually exclusive)
|
|
688
|
-
let args = StatusArgs {
|
|
689
|
-
agent: None,
|
|
690
|
-
workspace: PathBuf::from("."),
|
|
691
|
-
detail: false,
|
|
692
|
-
summary: true,
|
|
693
|
-
json: true,
|
|
694
|
-
team: None,
|
|
695
|
-
};
|
|
696
|
-
let err = cmd_status(&args).unwrap_err();
|
|
697
|
-
assert!(
|
|
698
|
-
err.to_string()
|
|
699
|
-
.contains("--summary and --json are mutually exclusive"),
|
|
700
|
-
"got: {err}"
|
|
701
|
-
);
|
|
702
|
-
}
|
|
703
|
-
|
|
704
|
-
#[test]
|
|
705
|
-
fn cmd_status_summary_with_agent_rejected() {
|
|
706
|
-
// commands.py:94-95: --summary + agent -> TeamAgentError(does not accept an agent argument)
|
|
707
|
-
let args = StatusArgs {
|
|
708
|
-
agent: Some("a1".into()),
|
|
709
|
-
workspace: PathBuf::from("."),
|
|
710
|
-
detail: false,
|
|
711
|
-
summary: true,
|
|
712
|
-
json: false,
|
|
713
|
-
team: None,
|
|
714
|
-
};
|
|
715
|
-
let err = cmd_status(&args).unwrap_err();
|
|
716
|
-
assert!(
|
|
717
|
-
err.to_string()
|
|
718
|
-
.contains("status --summary does not accept an agent argument"),
|
|
719
|
-
"got: {err}"
|
|
720
|
-
);
|
|
721
|
-
}
|
|
722
|
-
|
|
723
|
-
// =========================================================================
|
|
724
|
-
// cmd_leader_passthrough(parser.py:515-522):-h/--help 早返回 CmdResult::none
|
|
725
|
-
// =========================================================================
|
|
726
|
-
|
|
727
|
-
#[test]
|
|
728
|
-
#[serial_test::serial(env)]
|
|
729
|
-
fn cmd_leader_passthrough_help_is_pure_human_guidance() {
|
|
730
|
-
let env = crate::cli::hermetic_test_support::HermeticTestEnv::enter("launcher-help-unit");
|
|
731
|
-
let cwd = env.workspace("empty");
|
|
732
|
-
let tools = [
|
|
733
|
-
"pi", "codex", "claude", "copilot", "grok",
|
|
734
|
-
];
|
|
735
|
-
let bin = env.root().join("canaries");
|
|
736
|
-
std::fs::create_dir(&bin).unwrap();
|
|
737
|
-
#[cfg(unix)]
|
|
738
|
-
let _path = {
|
|
739
|
-
use std::os::unix::fs::PermissionsExt;
|
|
740
|
-
for tool in tools {
|
|
741
|
-
let path = bin.join(tool);
|
|
742
|
-
std::fs::write(&path, "#!/bin/sh\nprintf called > \"$0.called\"\nexit 0\n").unwrap();
|
|
743
|
-
std::fs::set_permissions(path, std::fs::Permissions::from_mode(0o755)).unwrap();
|
|
744
|
-
}
|
|
745
|
-
env.with_env("PATH", &bin.to_string_lossy())
|
|
746
|
-
};
|
|
747
|
-
for provider in ["pi", "codex", "claude", "copilot", "grok"] {
|
|
748
|
-
for alias in ["-h", "--help"] {
|
|
749
|
-
let result = cmd_leader_passthrough(provider, &[alias.into()], &cwd).unwrap();
|
|
750
|
-
assert_eq!(result.exit, ExitCode::Ok);
|
|
751
|
-
assert!(
|
|
752
|
-
matches!(&result.output, CmdOutput::Human(text) if text.contains(provider) && text.contains("Usage") && text.contains("Examples") && text.contains("Next Action"))
|
|
753
|
-
);
|
|
754
|
-
}
|
|
755
|
-
}
|
|
756
|
-
assert_eq!(std::fs::read_dir(&cwd).unwrap().count(), 0);
|
|
757
|
-
assert!(env.registry_entries().is_empty());
|
|
758
|
-
for tool in tools {
|
|
759
|
-
assert!(
|
|
760
|
-
!bin.join(format!("{tool}.called")).exists(),
|
|
761
|
-
"native tool invoked"
|
|
762
|
-
);
|
|
763
|
-
}
|
|
764
|
-
}
|
|
765
|
-
|
|
766
|
-
#[test]
|
|
767
|
-
fn cmd_leader_passthrough_maps_copilot_provider() {
|
|
768
|
-
assert_eq!(
|
|
769
|
-
leader_passthrough_provider("codex"),
|
|
770
|
-
Some(crate::model::enums::Provider::Codex)
|
|
771
|
-
);
|
|
772
|
-
assert_eq!(
|
|
773
|
-
leader_passthrough_provider("claude"),
|
|
774
|
-
Some(crate::model::enums::Provider::ClaudeCode)
|
|
775
|
-
);
|
|
776
|
-
assert_eq!(
|
|
777
|
-
leader_passthrough_provider("copilot"),
|
|
778
|
-
Some(crate::model::enums::Provider::Copilot)
|
|
779
|
-
);
|
|
780
|
-
}
|
|
781
|
-
|
|
782
|
-
#[test]
|
|
783
|
-
fn cmd_leader_passthrough_maps_grok_and_rejects_retired_cursor_names() {
|
|
784
|
-
assert_eq!(
|
|
785
|
-
leader_passthrough_provider("grok"),
|
|
786
|
-
Some(crate::model::enums::Provider::Grok)
|
|
787
|
-
);
|
|
788
|
-
assert_eq!(leader_passthrough_provider("cursor"), None);
|
|
789
|
-
assert_eq!(leader_passthrough_provider("agent"), None);
|
|
790
|
-
assert_eq!(leader_passthrough_provider("cursor_agent"), None);
|
|
791
|
-
assert_eq!(leader_passthrough_provider("not-a-passthrough"), None);
|
|
792
|
-
}
|
|
793
|
-
|
|
794
|
-
#[cfg(unix)]
|
|
795
|
-
#[test]
|
|
796
|
-
#[serial_test::serial(env)]
|
|
797
|
-
fn kiro_doctor_inventory_is_read_only_and_does_not_claim_native_readiness() {
|
|
798
|
-
use std::os::unix::fs::PermissionsExt;
|
|
799
|
-
let env = crate::cli::hermetic_test_support::HermeticTestEnv::enter("kiro-inventory");
|
|
800
|
-
let bin = env.workspace("bin");
|
|
801
|
-
let _path = env.with_env("PATH", &bin.to_string_lossy());
|
|
802
|
-
let inventory = provider_doctor_checks();
|
|
803
|
-
assert_eq!(inventory["kiro"]["installed"], false);
|
|
804
|
-
assert_eq!(inventory["codex"]["command"], "codex");
|
|
805
|
-
let launcher = bin.join("kiro-cli");
|
|
806
|
-
std::fs::write(
|
|
807
|
-
&launcher,
|
|
808
|
-
"#!/bin/sh\nprintf called > \"$0.called\"\nexit 0\n",
|
|
809
|
-
)
|
|
810
|
-
.unwrap();
|
|
811
|
-
for (mode, installed) in [(0o600, false), (0o700, true)] {
|
|
812
|
-
std::fs::set_permissions(&launcher, std::fs::Permissions::from_mode(mode)).unwrap();
|
|
813
|
-
assert_eq!(
|
|
814
|
-
provider_doctor_checks()["kiro"],
|
|
815
|
-
json!({
|
|
816
|
-
"auth": "unknown",
|
|
817
|
-
"command": "kiro-cli",
|
|
818
|
-
"installed": installed,
|
|
819
|
-
"version": "unknown",
|
|
820
|
-
"probe_status": "not_run",
|
|
821
|
-
"provider_probe_status": "not_run",
|
|
822
|
-
})
|
|
823
|
-
);
|
|
824
|
-
}
|
|
825
|
-
assert!(!bin.join("kiro-cli.called").exists());
|
|
826
|
-
assert!(env.registry_entries().is_empty());
|
|
827
|
-
}
|
|
828
|
-
|
|
829
|
-
#[cfg(unix)]
|
|
830
|
-
#[test]
|
|
831
|
-
#[serial_test::serial(env)]
|
|
832
|
-
fn kiro_leader_entry_has_help_and_typed_refusal_without_native_or_fallback_effects() {
|
|
833
|
-
use std::os::unix::fs::PermissionsExt;
|
|
834
|
-
let env = crate::cli::hermetic_test_support::HermeticTestEnv::enter("kiro-leader-gate");
|
|
835
|
-
let cwd = env.workspace("empty");
|
|
836
|
-
let bin = env.workspace("bin");
|
|
837
|
-
for tool in ["kiro-cli", "kiro-cli-chat", "codex", "pi", "tmux"] {
|
|
838
|
-
let path = bin.join(tool);
|
|
839
|
-
std::fs::write(&path, "#!/bin/sh\nprintf called > \"$0.called\"\nexit 0\n").unwrap();
|
|
840
|
-
std::fs::set_permissions(path, std::fs::Permissions::from_mode(0o700)).unwrap();
|
|
841
|
-
}
|
|
842
|
-
let _path = env.with_env("PATH", &bin.to_string_lossy());
|
|
843
|
-
assert!(!crate::cli::emit::is_leader_passthrough_command("kiro"));
|
|
844
|
-
assert_eq!(leader_passthrough_provider("kiro"), None);
|
|
845
|
-
let help = crate::cli::emit::command_help(Some("kiro"));
|
|
846
|
-
assert!(help.contains("team-agent kiro [--json]"));
|
|
847
|
-
assert!(help.contains("kiro_leader_not_admitted"));
|
|
848
|
-
assert!(crate::cli::emit::default_help().contains("Check Kiro leader launch admission"));
|
|
849
|
-
for alias in ["-h", "--help"] {
|
|
850
|
-
assert_eq!(
|
|
851
|
-
crate::cli::run(&["kiro".into(), alias.into()], &cwd),
|
|
852
|
-
ExitCode::Ok
|
|
853
|
-
);
|
|
854
|
-
}
|
|
855
|
-
let cases: &[&[&str]] = &[&[], &["--json"], &["--attach-existing", "--confirm"]];
|
|
856
|
-
for values in cases {
|
|
857
|
-
let args: Vec<String> = values.iter().map(|arg| (*arg).into()).collect();
|
|
858
|
-
let result = cmd_kiro_leader(&args);
|
|
859
|
-
assert_eq!(result.exit, ExitCode::Error);
|
|
860
|
-
assert_eq!(result.as_json, values.contains(&"--json"));
|
|
861
|
-
let CmdOutput::Json(value) = result.output else {
|
|
862
|
-
panic!("expected structured capability refusal");
|
|
863
|
-
};
|
|
864
|
-
assert_eq!(value["schema_version"], "leader_launch.v1");
|
|
865
|
-
assert_eq!(value["ok"], false);
|
|
866
|
-
assert_eq!(value["provider"], "kiro");
|
|
867
|
-
assert_eq!(value["capability"], "leader_launch");
|
|
868
|
-
assert_eq!(value["reason"], "kiro_leader_not_admitted");
|
|
869
|
-
let mut argv = vec!["kiro".into()];
|
|
870
|
-
argv.extend(args);
|
|
871
|
-
let expected = if values.contains(&"--attach-existing") {
|
|
872
|
-
ExitCode::Usage // Unknown controls fail before capability dispatch.
|
|
873
|
-
} else {
|
|
874
|
-
ExitCode::Error // Supported syntax retains the typed refusal.
|
|
875
|
-
};
|
|
876
|
-
assert_eq!(crate::cli::run(&argv, &cwd), expected);
|
|
877
|
-
}
|
|
878
|
-
assert_eq!(std::fs::read_dir(&cwd).unwrap().count(), 0);
|
|
879
|
-
assert_eq!(
|
|
880
|
-
std::fs::read_dir(&bin).unwrap().count(),
|
|
881
|
-
5,
|
|
882
|
-
"no tool invoked"
|
|
883
|
-
);
|
|
884
|
-
assert!(env.registry_entries().is_empty());
|
|
885
|
-
}
|