@team-agent/installer 0.5.127 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -4
- package/README.zh.md +1 -1
- package/package.json +4 -8
- package/skills/team-agent/SKILL.md +41 -26
- package/skills/team-agent/command-coverage.json +170 -184
- package/skills/team-agent/docs/reference/team-agent-operator.md +66 -32
- package/skills/team-agent/references/recovery-runbook.md +1 -1
- package/skills/team-agent/references/team-agent-operator.md +66 -32
- package/templates/team_state.md +1 -1
- package/Cargo.lock +0 -1063
- package/Cargo.toml +0 -36
- package/crates/team-agent/Cargo.toml +0 -69
- package/crates/team-agent/src/app_server_test_support.rs +0 -258
- package/crates/team-agent/src/cli/adapters.rs +0 -1298
- package/crates/team-agent/src/cli/arguments.rs +0 -401
- package/crates/team-agent/src/cli/attach_app_server_leader.rs +0 -98
- package/crates/team-agent/src/cli/diagnose.rs +0 -1675
- package/crates/team-agent/src/cli/emit.rs +0 -2898
- package/crates/team-agent/src/cli/grok_slot.rs +0 -384
- package/crates/team-agent/src/cli/helpers.rs +0 -91
- package/crates/team-agent/src/cli/intent/runtime.rs +0 -1189
- package/crates/team-agent/src/cli/intent/runtime_tests.rs +0 -821
- package/crates/team-agent/src/cli/intent/tests.rs +0 -691
- package/crates/team-agent/src/cli/intent.rs +0 -664
- package/crates/team-agent/src/cli/leader.rs +0 -300
- package/crates/team-agent/src/cli/leader_prompt.rs +0 -261
- package/crates/team-agent/src/cli/leaders.rs +0 -418
- package/crates/team-agent/src/cli/mod.rs +0 -6528
- package/crates/team-agent/src/cli/models.rs +0 -449
- package/crates/team-agent/src/cli/named_address.rs +0 -1651
- package/crates/team-agent/src/cli/profile.rs +0 -342
- package/crates/team-agent/src/cli/route.rs +0 -212
- package/crates/team-agent/src/cli/send/coordinator.rs +0 -164
- package/crates/team-agent/src/cli/send/mailbox.rs +0 -145
- package/crates/team-agent/src/cli/send/persist.rs +0 -192
- package/crates/team-agent/src/cli/send/presentation.rs +0 -370
- package/crates/team-agent/src/cli/send/resolve.rs +0 -573
- package/crates/team-agent/src/cli/send.rs +0 -201
- package/crates/team-agent/src/cli/shutdown_socket.rs +0 -288
- package/crates/team-agent/src/cli/spec.rs +0 -159
- package/crates/team-agent/src/cli/status.rs +0 -280
- package/crates/team-agent/src/cli/status_port/agents.rs +0 -358
- package/crates/team-agent/src/cli/status_port/approvals.rs +0 -79
- package/crates/team-agent/src/cli/status_port/brief.rs +0 -2043
- package/crates/team-agent/src/cli/status_port/compact.rs +0 -240
- package/crates/team-agent/src/cli/status_port/format.rs +0 -146
- package/crates/team-agent/src/cli/status_port/inbox.rs +0 -62
- package/crates/team-agent/src/cli/status_port/runtime.rs +0 -197
- package/crates/team-agent/src/cli/status_port/snapshot.rs +0 -208
- package/crates/team-agent/src/cli/status_port/store.rs +0 -416
- package/crates/team-agent/src/cli/status_port/tests.rs +0 -90
- package/crates/team-agent/src/cli/status_port.rs +0 -92
- package/crates/team-agent/src/cli/tests/base.rs +0 -885
- package/crates/team-agent/src/cli/tests/divergence.rs +0 -518
- package/crates/team-agent/src/cli/tests/lane_c.rs +0 -453
- package/crates/team-agent/src/cli/tests/leader_watch.rs +0 -372
- package/crates/team-agent/src/cli/tests/main_preserved.rs +0 -430
- package/crates/team-agent/src/cli/tests/missing_subcommands.rs +0 -336
- package/crates/team-agent/src/cli/tests/mod.rs +0 -137
- package/crates/team-agent/src/cli/tests/named_address.rs +0 -760
- package/crates/team-agent/src/cli/tests/parser_safety.rs +0 -383
- package/crates/team-agent/src/cli/tests/run_delegation.rs +0 -481
- package/crates/team-agent/src/cli/tests/shutdown_kill_plan.rs +0 -2179
- package/crates/team-agent/src/cli/tests/status_brief.rs +0 -1514
- package/crates/team-agent/src/cli/tests/status_send.rs +0 -1091
- package/crates/team-agent/src/cli/tests/verb_install_skill.rs +0 -93
- package/crates/team-agent/src/cli/tests/verb_profile.rs +0 -392
- package/crates/team-agent/src/cli/triage.rs +0 -234
- package/crates/team-agent/src/cli/types.rs +0 -591
- package/crates/team-agent/src/codex_app_server.rs +0 -546
- package/crates/team-agent/src/communication_mode/mod.rs +0 -56
- package/crates/team-agent/src/compiler/tests.rs +0 -842
- package/crates/team-agent/src/compiler.rs +0 -691
- package/crates/team-agent/src/conpty/backend.rs +0 -829
- package/crates/team-agent/src/conpty/mod.rs +0 -33
- package/crates/team-agent/src/contract_runtime/backend.rs +0 -1610
- package/crates/team-agent/src/contract_runtime/commands.rs +0 -671
- package/crates/team-agent/src/contract_runtime/config.rs +0 -354
- package/crates/team-agent/src/contract_runtime/config_tests.rs +0 -56
- package/crates/team-agent/src/contract_runtime/discovery.rs +0 -438
- package/crates/team-agent/src/contract_runtime/fork.rs +0 -368
- package/crates/team-agent/src/contract_runtime/forward.rs +0 -288
- package/crates/team-agent/src/contract_runtime/framework.rs +0 -350
- package/crates/team-agent/src/contract_runtime/mcp.rs +0 -399
- package/crates/team-agent/src/contract_runtime/mod.rs +0 -17
- package/crates/team-agent/src/contract_runtime/prompt.rs +0 -216
- package/crates/team-agent/src/contract_runtime/pump.rs +0 -271
- package/crates/team-agent/src/contract_runtime/registry.rs +0 -589
- package/crates/team-agent/src/contract_runtime/workspace.rs +0 -228
- package/crates/team-agent/src/coordinator/backoff.rs +0 -741
- package/crates/team-agent/src/coordinator/conpty_shim.rs +0 -805
- package/crates/team-agent/src/coordinator/health.rs +0 -1185
- package/crates/team-agent/src/coordinator/mod.rs +0 -119
- package/crates/team-agent/src/coordinator/orphan.rs +0 -110
- package/crates/team-agent/src/coordinator/runtime_detectors.rs +0 -798
- package/crates/team-agent/src/coordinator/runtime_observation.rs +0 -84
- package/crates/team-agent/src/coordinator/steps/abnormal.rs +0 -2309
- package/crates/team-agent/src/coordinator/steps/delivery.rs +0 -15
- package/crates/team-agent/src/coordinator/steps/health_sync.rs +0 -15
- package/crates/team-agent/src/coordinator/steps/mod.rs +0 -126
- package/crates/team-agent/src/coordinator/steps/persist.rs +0 -15
- package/crates/team-agent/src/coordinator/steps/runtime_prompts.rs +0 -15
- package/crates/team-agent/src/coordinator/steps/session_gate.rs +0 -16
- package/crates/team-agent/src/coordinator/tests/a0_lostupdate.rs +0 -158
- package/crates/team-agent/src/coordinator/tests/abnormal.rs +0 -312
- package/crates/team-agent/src/coordinator/tests/api_error_recovery.rs +0 -338
- package/crates/team-agent/src/coordinator/tests/basics.rs +0 -211
- package/crates/team-agent/src/coordinator/tests/daemon.rs +0 -514
- package/crates/team-agent/src/coordinator/tests/energy.rs +0 -549
- package/crates/team-agent/src/coordinator/tests/health_sync.rs +0 -461
- package/crates/team-agent/src/coordinator/tests/main_preserved.rs +0 -186
- package/crates/team-agent/src/coordinator/tests/mod.rs +0 -295
- package/crates/team-agent/src/coordinator/tests/s3_bounded.rs +0 -207
- package/crates/team-agent/src/coordinator/tests/spine.rs +0 -308
- package/crates/team-agent/src/coordinator/tests/takeover.rs +0 -286
- package/crates/team-agent/src/coordinator/tests/tick_core.rs +0 -237
- package/crates/team-agent/src/coordinator/tick.rs +0 -3112
- package/crates/team-agent/src/coordinator/types.rs +0 -540
- package/crates/team-agent/src/db/agent_health_capture.rs +0 -126
- package/crates/team-agent/src/db/message_store.rs +0 -1585
- package/crates/team-agent/src/db/migration.rs +0 -984
- package/crates/team-agent/src/db/mod.rs +0 -26
- package/crates/team-agent/src/db/schema.rs +0 -663
- package/crates/team-agent/src/diagnose/comms.rs +0 -242
- package/crates/team-agent/src/diagnose/mod.rs +0 -44
- package/crates/team-agent/src/diagnose/orphans.rs +0 -889
- package/crates/team-agent/src/event_log.rs +0 -502
- package/crates/team-agent/src/fake_worker.rs +0 -303
- package/crates/team-agent/src/kill_audit.rs +0 -106
- package/crates/team-agent/src/layout/manager.rs +0 -248
- package/crates/team-agent/src/layout/mod.rs +0 -36
- package/crates/team-agent/src/layout/overlay.rs +0 -134
- package/crates/team-agent/src/layout/placement.rs +0 -52
- package/crates/team-agent/src/layout/recovery.rs +0 -106
- package/crates/team-agent/src/layout/runtime_sessions.rs +0 -317
- package/crates/team-agent/src/layout/sessions.rs +0 -294
- package/crates/team-agent/src/layout/tmux_endpoint.rs +0 -165
- package/crates/team-agent/src/layout/worker_env.rs +0 -721
- package/crates/team-agent/src/layout/worker_window_helpers.rs +0 -37
- package/crates/team-agent/src/leader/helpers.rs +0 -178
- package/crates/team-agent/src/leader/incident.rs +0 -6
- package/crates/team-agent/src/leader/lease.rs +0 -3356
- package/crates/team-agent/src/leader/mod.rs +0 -104
- package/crates/team-agent/src/leader/owner_bind.rs +0 -400
- package/crates/team-agent/src/leader/prompt.rs +0 -905
- package/crates/team-agent/src/leader/provider_attribution.rs +0 -247
- package/crates/team-agent/src/leader/rediscover/tests.rs +0 -689
- package/crates/team-agent/src/leader/rediscover.rs +0 -1192
- package/crates/team-agent/src/leader/registry.rs +0 -883
- package/crates/team-agent/src/leader/start.rs +0 -4500
- package/crates/team-agent/src/leader/takeover.rs +0 -65
- package/crates/team-agent/src/leader/tests/basics.rs +0 -337
- package/crates/team-agent/src/leader/tests/byte_findings.rs +0 -355
- package/crates/team-agent/src/leader/tests/claim_leader_mailbox_flush_contract.rs +0 -544
- package/crates/team-agent/src/leader/tests/historical_inventory_upgrade_gate_red.rs +0 -624
- package/crates/team-agent/src/leader/tests/identity.rs +0 -465
- package/crates/team-agent/src/leader/tests/identity_session_names.rs +0 -42
- package/crates/team-agent/src/leader/tests/idle.rs +0 -113
- package/crates/team-agent/src/leader/tests/lease_api.rs +0 -520
- package/crates/team-agent/src/leader/tests/lease_claim.rs +0 -629
- package/crates/team-agent/src/leader/tests/mod.rs +0 -106
- package/crates/team-agent/src/leader/tests/prompt_contract.rs +0 -267
- package/crates/team-agent/src/leader/tests/rediscover.rs +0 -403
- package/crates/team-agent/src/leader/tests/rehomed_env.rs +0 -83
- package/crates/team-agent/src/leader/tests/team_in_team_state_scope_red.rs +0 -1273
- package/crates/team-agent/src/leader/tests/terminal_and_replay_vs_rerender_invariants_red.rs +0 -417
- package/crates/team-agent/src/leader/tests/wake_start_owner.rs +0 -168
- package/crates/team-agent/src/leader/types.rs +0 -534
- package/crates/team-agent/src/lib.rs +0 -145
- package/crates/team-agent/src/lifecycle/helpers.rs +0 -212
- package/crates/team-agent/src/lifecycle/launch/add_agent.rs +0 -848
- package/crates/team-agent/src/lifecycle/launch/add_agent_state.rs +0 -393
- package/crates/team-agent/src/lifecycle/launch/agent_state.rs +0 -332
- package/crates/team-agent/src/lifecycle/launch/clone_agent.rs +0 -178
- package/crates/team-agent/src/lifecycle/launch/fork_agent.rs +0 -82
- package/crates/team-agent/src/lifecycle/launch/fork_entry.rs +0 -63
- package/crates/team-agent/src/lifecycle/launch/identity.rs +0 -674
- package/crates/team-agent/src/lifecycle/launch/layout.rs +0 -350
- package/crates/team-agent/src/lifecycle/launch/leader_context.rs +0 -589
- package/crates/team-agent/src/lifecycle/launch/mcp_config.rs +0 -152
- package/crates/team-agent/src/lifecycle/launch/ownership.rs +0 -105
- package/crates/team-agent/src/lifecycle/launch/pi_mcp.rs +0 -629
- package/crates/team-agent/src/lifecycle/launch/pi_mcp_extension.js +0 -226
- package/crates/team-agent/src/lifecycle/launch/plan.rs +0 -269
- package/crates/team-agent/src/lifecycle/launch/quick_start.rs +0 -5176
- package/crates/team-agent/src/lifecycle/launch/quick_start_transport.rs +0 -368
- package/crates/team-agent/src/lifecycle/launch/readiness.rs +0 -519
- package/crates/team-agent/src/lifecycle/launch/role_source.rs +0 -287
- package/crates/team-agent/src/lifecycle/launch/spawn.rs +0 -450
- package/crates/team-agent/src/lifecycle/launch/spec_state.rs +0 -801
- package/crates/team-agent/src/lifecycle/launch/state_projection.rs +0 -624
- package/crates/team-agent/src/lifecycle/launch/worker_env.rs +0 -558
- package/crates/team-agent/src/lifecycle/launch.rs +0 -534
- package/crates/team-agent/src/lifecycle/lock.rs +0 -350
- package/crates/team-agent/src/lifecycle/mod.rs +0 -79
- package/crates/team-agent/src/lifecycle/pane_input_lock.rs +0 -239
- package/crates/team-agent/src/lifecycle/profile_launch.rs +0 -757
- package/crates/team-agent/src/lifecycle/profile_smoke.rs +0 -557
- package/crates/team-agent/src/lifecycle/restart/agent.rs +0 -2198
- package/crates/team-agent/src/lifecycle/restart/common.rs +0 -2052
- package/crates/team-agent/src/lifecycle/restart/orchestrator.rs +0 -65
- package/crates/team-agent/src/lifecycle/restart/preflight.rs +0 -113
- package/crates/team-agent/src/lifecycle/restart/rebuild.rs +0 -5135
- package/crates/team-agent/src/lifecycle/restart/remove.rs +0 -1504
- package/crates/team-agent/src/lifecycle/restart/selection.rs +0 -559
- package/crates/team-agent/src/lifecycle/restart/team_state.rs +0 -329
- package/crates/team-agent/src/lifecycle/restart.rs +0 -223
- package/crates/team-agent/src/lifecycle/role_config.rs +0 -1205
- package/crates/team-agent/src/lifecycle/tests/acceptance_b_batch_red.rs +0 -1021
- package/crates/team-agent/src/lifecycle/tests/agent_ops.rs +0 -1205
- package/crates/team-agent/src/lifecycle/tests/b0_legacy_snapshot_nonauthority_contract.rs +0 -265
- package/crates/team-agent/src/lifecycle/tests/b0_reader_hideone_audit_contract.rs +0 -490
- package/crates/team-agent/src/lifecycle/tests/behavioral_diff_264_red.rs +0 -656
- package/crates/team-agent/src/lifecycle/tests/claude_profile_launch_red.rs +0 -135
- package/crates/team-agent/src/lifecycle/tests/cli_argv_routing_red.rs +0 -1415
- package/crates/team-agent/src/lifecycle/tests/clone_agent_preserves_source_tools.rs +0 -427
- package/crates/team-agent/src/lifecycle/tests/clone_fork_copilot_perms_red.rs +0 -396
- package/crates/team-agent/src/lifecycle/tests/communication_mode_runtime_contract_red.rs +0 -418
- package/crates/team-agent/src/lifecycle/tests/copilot_provider_red.rs +0 -2039
- package/crates/team-agent/src/lifecycle/tests/core.rs +0 -1298
- package/crates/team-agent/src/lifecycle/tests/f032_startup_prompt_best_effort_red.rs +0 -315
- package/crates/team-agent/src/lifecycle/tests/fixtures/pi_list_models_g0.stdout.txt +0 -222
- package/crates/team-agent/src/lifecycle/tests/fixtures/pi_list_models_spaced_ids.stdout.txt +0 -9
- package/crates/team-agent/src/lifecycle/tests/fixtures/pi_native_mcp_host.mjs +0 -71
- package/crates/team-agent/src/lifecycle/tests/gate_fixtures.rs +0 -562
- package/crates/team-agent/src/lifecycle/tests/grok_require_explicit_model_red.rs +0 -110
- package/crates/team-agent/src/lifecycle/tests/harvest2_a_batch_red.rs +0 -472
- package/crates/team-agent/src/lifecycle/tests/host_cotenant_death_p0_contract.rs +0 -921
- package/crates/team-agent/src/lifecycle/tests/issue238_codex_effort_contract.rs +0 -68
- package/crates/team-agent/src/lifecycle/tests/lane_ops.rs +0 -1851
- package/crates/team-agent/src/lifecycle/tests/launch_spawn.rs +0 -3981
- package/crates/team-agent/src/lifecycle/tests/lifecycle_lock.rs +0 -339
- package/crates/team-agent/src/lifecycle/tests/lifecycle_rollback_red.rs +0 -596
- package/crates/team-agent/src/lifecycle/tests/main_preserved.rs +0 -513
- package/crates/team-agent/src/lifecycle/tests/mcp_tool_name_format_red.rs +0 -69
- package/crates/team-agent/src/lifecycle/tests/phase_b_contracts.rs +0 -824
- package/crates/team-agent/src/lifecycle/tests/phase_golden.rs +0 -723
- package/crates/team-agent/src/lifecycle/tests/pi_catalog_red.rs +0 -152
- package/crates/team-agent/src/lifecycle/tests/pi_command_red.rs +0 -182
- package/crates/team-agent/src/lifecycle/tests/pi_dual_entry_red.rs +0 -374
- package/crates/team-agent/src/lifecycle/tests/pi_executable_mcp_red.rs +0 -546
- package/crates/team-agent/src/lifecycle/tests/pi_lifecycle_doctor_red.rs +0 -31
- package/crates/team-agent/src/lifecycle/tests/pi_native_mcp_capability_red.rs +0 -528
- package/crates/team-agent/src/lifecycle/tests/pi_session_delivery_red.rs +0 -134
- package/crates/team-agent/src/lifecycle/tests/quick_start_worker_readiness_red.rs +0 -333
- package/crates/team-agent/src/lifecycle/tests/realmachine_clusters_1_6_red.rs +0 -786
- package/crates/team-agent/src/lifecycle/tests/realmachine_residual_g1_g4_red.rs +0 -648
- package/crates/team-agent/src/lifecycle/tests/restart.rs +0 -185
- package/crates/team-agent/src/lifecycle/tests/restart_build_before_destroy_0540_contract.rs +0 -1053
- package/crates/team-agent/src/lifecycle/tests/restart_liveness_red.rs +0 -679
- package/crates/team-agent/src/lifecycle/tests/restart_rebind_hotfix_252_red.rs +0 -1126
- package/crates/team-agent/src/lifecycle/tests/restart_session_capture_red.rs +0 -153
- package/crates/team-agent/src/lifecycle/tests/resume_recover_red.rs +0 -427
- package/crates/team-agent/src/lifecycle/tests/stale_team_saveconflict_contract.rs +0 -431
- package/crates/team-agent/src/lifecycle/tests/startup_latency_contract.rs +0 -1066
- package/crates/team-agent/src/lifecycle/tests/status_credential_redaction_contract.rs +0 -876
- package/crates/team-agent/src/lifecycle/tests/subprep_codex_trust_roundtrip_red.rs +0 -1026
- package/crates/team-agent/src/lifecycle/tests/swallow_batch4_semantics_red.rs +0 -90
- package/crates/team-agent/src/lifecycle/tests/team_in_team_identity_scope_red.rs +0 -543
- package/crates/team-agent/src/lifecycle/tests/team_in_team_sibling_quick_start_red.rs +0 -1103
- package/crates/team-agent/src/lifecycle/tests/team_in_team_state_scope_red.rs +0 -1276
- package/crates/team-agent/src/lifecycle/tests/team_key_retirement_roster_red.rs +0 -145
- package/crates/team-agent/src/lifecycle/tests/team_key_retirement_txn_red.rs +0 -603
- package/crates/team-agent/src/lifecycle/tests/test_isolation_escape_contract.rs +0 -936
- package/crates/team-agent/src/lifecycle/tests/upgrade_compat_0211_red.rs +0 -970
- package/crates/team-agent/src/lifecycle/tests/verify_rs031_window_consistency_red.rs +0 -996
- package/crates/team-agent/src/lifecycle/tests/worker_spawn_env_red.rs +0 -827
- package/crates/team-agent/src/lifecycle/tests.rs +0 -102
- package/crates/team-agent/src/lifecycle/types.rs +0 -861
- package/crates/team-agent/src/lifecycle/worker_command_context.rs +0 -370
- package/crates/team-agent/src/main.rs +0 -52
- package/crates/team-agent/src/mcp_server/helpers.rs +0 -510
- package/crates/team-agent/src/mcp_server/lifecycle_tools/mod.rs +0 -6
- package/crates/team-agent/src/mcp_server/lifecycle_tools/state_status.rs +0 -43
- package/crates/team-agent/src/mcp_server/mod.rs +0 -119
- package/crates/team-agent/src/mcp_server/normalize.rs +0 -485
- package/crates/team-agent/src/mcp_server/readiness.rs +0 -546
- package/crates/team-agent/src/mcp_server/readiness_tests.rs +0 -369
- package/crates/team-agent/src/mcp_server/tests/golden.rs +0 -285
- package/crates/team-agent/src/mcp_server/tests/normalize.rs +0 -247
- package/crates/team-agent/src/mcp_server/tests/scoped.rs +0 -168
- package/crates/team-agent/src/mcp_server/tests/send.rs +0 -388
- package/crates/team-agent/src/mcp_server/tests/tools.rs +0 -343
- package/crates/team-agent/src/mcp_server/tests/wire.rs +0 -254
- package/crates/team-agent/src/mcp_server/tests.rs +0 -43
- package/crates/team-agent/src/mcp_server/tools.rs +0 -1015
- package/crates/team-agent/src/mcp_server/types.rs +0 -396
- package/crates/team-agent/src/mcp_server/wire.rs +0 -867
- package/crates/team-agent/src/messaging/activity.rs +0 -461
- package/crates/team-agent/src/messaging/address.rs +0 -87
- package/crates/team-agent/src/messaging/delivery.rs +0 -3785
- package/crates/team-agent/src/messaging/delivery_consumption_tests.rs +0 -234
- package/crates/team-agent/src/messaging/enter_rescue.rs +0 -362
- package/crates/team-agent/src/messaging/enter_rescue_tests.rs +0 -633
- package/crates/team-agent/src/messaging/helpers.rs +0 -354
- package/crates/team-agent/src/messaging/leader_channel.rs +0 -287
- package/crates/team-agent/src/messaging/leader_receiver.rs +0 -786
- package/crates/team-agent/src/messaging/mod.rs +0 -166
- package/crates/team-agent/src/messaging/persist.rs +0 -377
- package/crates/team-agent/src/messaging/presentation.rs +0 -417
- package/crates/team-agent/src/messaging/results/collection_tests.rs +0 -719
- package/crates/team-agent/src/messaging/results.rs +0 -1415
- package/crates/team-agent/src/messaging/scheduler.rs +0 -217
- package/crates/team-agent/src/messaging/selftest.rs +0 -315
- package/crates/team-agent/src/messaging/send.rs +0 -981
- package/crates/team-agent/src/messaging/tests/basic.rs +0 -346
- package/crates/team-agent/src/messaging/tests/dup_inject.rs +0 -551
- package/crates/team-agent/src/messaging/tests/e23.rs +0 -49
- package/crates/team-agent/src/messaging/tests/leader_channel.rs +0 -169
- package/crates/team-agent/src/messaging/tests/leader_inject_acceptance.rs +0 -817
- package/crates/team-agent/src/messaging/tests/main_preserved.rs +0 -85
- package/crates/team-agent/src/messaging/tests/mod.rs +0 -306
- package/crates/team-agent/src/messaging/tests/runtime.rs +0 -3655
- package/crates/team-agent/src/messaging/tests/spine.rs +0 -837
- package/crates/team-agent/src/messaging/tests/wave2.rs +0 -381
- package/crates/team-agent/src/messaging/trust.rs +0 -215
- package/crates/team-agent/src/messaging/types.rs +0 -471
- package/crates/team-agent/src/messaging/wait.rs +0 -366
- package/crates/team-agent/src/messaging/watchers.rs +0 -916
- package/crates/team-agent/src/model/enums.rs +0 -356
- package/crates/team-agent/src/model/errors.rs +0 -18
- package/crates/team-agent/src/model/ids.rs +0 -165
- package/crates/team-agent/src/model/mod.rs +0 -29
- package/crates/team-agent/src/model/name_similarity.rs +0 -252
- package/crates/team-agent/src/model/pane_authority_refusal.rs +0 -359
- package/crates/team-agent/src/model/paths.rs +0 -257
- package/crates/team-agent/src/model/routing.rs +0 -387
- package/crates/team-agent/src/model/spec.rs +0 -1184
- package/crates/team-agent/src/model/task_graph.rs +0 -321
- package/crates/team-agent/src/model/testdata/fuzz.golden.yaml +0 -43
- package/crates/team-agent/src/model/testdata/fuzz.yaml +0 -43
- package/crates/team-agent/src/model/testdata/spec_invalid_a.yaml +0 -209
- package/crates/team-agent/src/model/testdata/team.spec.golden.yaml +0 -208
- package/crates/team-agent/src/model/testdata/team.spec.yaml +0 -208
- package/crates/team-agent/src/model/yaml/tests.rs +0 -188
- package/crates/team-agent/src/model/yaml.rs +0 -802
- package/crates/team-agent/src/os_probe.rs +0 -280
- package/crates/team-agent/src/packaging/install.rs +0 -219
- package/crates/team-agent/src/packaging/migrate.rs +0 -38
- package/crates/team-agent/src/packaging/mod.rs +0 -91
- package/crates/team-agent/src/packaging/repair.rs +0 -33
- package/crates/team-agent/src/packaging/tests.rs +0 -822
- package/crates/team-agent/src/packaging/types.rs +0 -417
- package/crates/team-agent/src/platform/argv.rs +0 -331
- package/crates/team-agent/src/platform/errors.rs +0 -104
- package/crates/team-agent/src/platform/file_lock.rs +0 -279
- package/crates/team-agent/src/platform/mod.rs +0 -5
- package/crates/team-agent/src/platform/process.rs +0 -545
- package/crates/team-agent/src/provider/adapter.rs +0 -898
- package/crates/team-agent/src/provider/adapters/copilot.rs +0 -75
- package/crates/team-agent/src/provider/adapters/copilot_fork.rs +0 -307
- package/crates/team-agent/src/provider/adapters/fake.rs +0 -18
- package/crates/team-agent/src/provider/adapters/mod.rs +0 -28
- package/crates/team-agent/src/provider/approvals/mod.rs +0 -3
- package/crates/team-agent/src/provider/approvals/parsing.rs +0 -586
- package/crates/team-agent/src/provider/approvals/runtime_prompts.rs +0 -205
- package/crates/team-agent/src/provider/argv_route.rs +0 -405
- package/crates/team-agent/src/provider/bypass_flags.rs +0 -116
- package/crates/team-agent/src/provider/classify.rs +0 -773
- package/crates/team-agent/src/provider/command_helpers.rs +0 -45
- package/crates/team-agent/src/provider/faults.rs +0 -165
- package/crates/team-agent/src/provider/helpers.rs +0 -52
- package/crates/team-agent/src/provider/mod.rs +0 -78
- package/crates/team-agent/src/provider/model_catalog.rs +0 -722
- package/crates/team-agent/src/provider/session/capture.rs +0 -2631
- package/crates/team-agent/src/provider/session/context_fork/outcome.rs +0 -168
- package/crates/team-agent/src/provider/session/context_fork.rs +0 -264
- package/crates/team-agent/src/provider/session/mod.rs +0 -36
- package/crates/team-agent/src/provider/session/resume.rs +0 -269
- package/crates/team-agent/src/provider/session_scan/common/tests.rs +0 -316
- package/crates/team-agent/src/provider/session_scan/common.rs +0 -618
- package/crates/team-agent/src/provider/session_scan/copilot.rs +0 -280
- package/crates/team-agent/src/provider/session_scan/pi.rs +0 -152
- package/crates/team-agent/src/provider/session_scan.rs +0 -61
- package/crates/team-agent/src/provider/startup_prompt.rs +0 -757
- package/crates/team-agent/src/provider/submit_now.rs +0 -71
- package/crates/team-agent/src/provider/testdata/copilot-ready-marker.txt +0 -5
- package/crates/team-agent/src/provider/testdata/copilot-trust-prompt.txt +0 -19
- package/crates/team-agent/src/provider/testdata/grok-models-authenticated.stdout +0 -9
- package/crates/team-agent/src/provider/testdata/grok-models-unauthenticated.stdout +0 -7
- package/crates/team-agent/src/provider/tests/adapter.rs +0 -354
- package/crates/team-agent/src/provider/tests/classify.rs +0 -201
- package/crates/team-agent/src/provider/tests/command_helpers.rs +0 -26
- package/crates/team-agent/src/provider/tests/copilot_fork.rs +0 -191
- package/crates/team-agent/src/provider/tests/faults.rs +0 -200
- package/crates/team-agent/src/provider/tests/idle.rs +0 -140
- package/crates/team-agent/src/provider/tests/wire.rs +0 -213
- package/crates/team-agent/src/provider/tests.rs +0 -32
- package/crates/team-agent/src/provider/types.rs +0 -529
- package/crates/team-agent/src/provider/wire.rs +0 -406
- package/crates/team-agent/src/redaction.rs +0 -259
- package/crates/team-agent/src/state/abnormal_watch/tests/mod.rs +0 -248
- package/crates/team-agent/src/state/abnormal_watch.rs +0 -144
- package/crates/team-agent/src/state/identity.rs +0 -914
- package/crates/team-agent/src/state/identity_keys.rs +0 -132
- package/crates/team-agent/src/state/mod.rs +0 -74
- package/crates/team-agent/src/state/owner_gate.rs +0 -482
- package/crates/team-agent/src/state/ownership.rs +0 -563
- package/crates/team-agent/src/state/paths.rs +0 -395
- package/crates/team-agent/src/state/persist.rs +0 -3811
- package/crates/team-agent/src/state/projection.rs +0 -1508
- package/crates/team-agent/src/state/repository/intent.rs +0 -14
- package/crates/team-agent/src/state/repository/tests.rs +0 -184
- package/crates/team-agent/src/state/repository.rs +0 -866
- package/crates/team-agent/src/state/selector.rs +0 -160
- package/crates/team-agent/src/state/testdata/state-rich.canonical.json +0 -133
- package/crates/team-agent/src/tmux_backend/enter_rescue.rs +0 -325
- package/crates/team-agent/src/tmux_backend/enter_rescue_tests.rs +0 -432
- package/crates/team-agent/src/tmux_backend/native_input.rs +0 -513
- package/crates/team-agent/src/tmux_backend/native_input_tests.rs +0 -742
- package/crates/team-agent/src/tmux_backend/tests.rs +0 -4254
- package/crates/team-agent/src/tmux_backend.rs +0 -4527
- package/crates/team-agent/src/topology.rs +0 -537
- package/crates/team-agent/src/transport/enter_rescue.rs +0 -166
- package/crates/team-agent/src/transport/native_input.rs +0 -491
- package/crates/team-agent/src/transport/test_support.rs +0 -743
- package/crates/team-agent/src/transport/tests/behavior.rs +0 -326
- package/crates/team-agent/src/transport/tests/mod.rs +0 -194
- package/crates/team-agent/src/transport/tests/wire.rs +0 -574
- package/crates/team-agent/src/transport.rs +0 -1655
- package/crates/team-agent/src/transport_factory.rs +0 -819
|
@@ -1,280 +0,0 @@
|
|
|
1
|
-
//!
|
|
2
|
-
//! cli · status — 五行 triage summary 渲染 + agent 分类计数(commands.py
|
|
3
|
-
//! `_format_status_summary` / `_agent_summary_counts` / `_interaction_counts` /
|
|
4
|
-
//! `_latest_result_line` + `cmd_status` 的 compact 不变量)。
|
|
5
|
-
|
|
6
|
-
use super::*;
|
|
7
|
-
|
|
8
|
-
/// 单 agent 双信号(`status` × `agent_health.status`)→ 桶分类(`_agent_summary_counts` 内层)。
|
|
9
|
-
/// **穷尽 match,禁默认 idle 臂**(§11)。`raw`/`hstatus` 已 lowercase。
|
|
10
|
-
pub fn classify_agent_bucket(raw_status: &str, health_status: &str) -> SummaryBucket {
|
|
11
|
-
let raw = raw_status.to_ascii_lowercase();
|
|
12
|
-
let health = health_status.to_ascii_lowercase();
|
|
13
|
-
if matches!(raw.as_str(), "failed" | "error") || matches!(health.as_str(), "failed" | "error") {
|
|
14
|
-
SummaryBucket::Failed
|
|
15
|
-
} else if matches!(raw.as_str(), "stopped" | "done") || health == "done" {
|
|
16
|
-
SummaryBucket::Stopped
|
|
17
|
-
} else if raw == "busy" || matches!(health.as_str(), "running" | "working") {
|
|
18
|
-
SummaryBucket::Busy
|
|
19
|
-
} else if health == "idle" {
|
|
20
|
-
SummaryBucket::Idle
|
|
21
|
-
} else if raw == "running" {
|
|
22
|
-
SummaryBucket::Running
|
|
23
|
-
} else {
|
|
24
|
-
SummaryBucket::Unknown
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/// `_agent_summary_counts`(`commands.py:309-330`):遍历 agents×health → [`SummaryCounts`]。
|
|
29
|
-
pub fn agent_summary_counts(agents: &Value, health: &Value) -> SummaryCounts {
|
|
30
|
-
let mut counts = SummaryCounts::default();
|
|
31
|
-
let Some(agent_map) = agents.as_object() else {
|
|
32
|
-
return counts;
|
|
33
|
-
};
|
|
34
|
-
for (agent_id, agent) in agent_map {
|
|
35
|
-
if let Some(bucket) = stale_agent_bucket(agent) {
|
|
36
|
-
match bucket {
|
|
37
|
-
SummaryBucket::Stopped => counts.stopped += 1,
|
|
38
|
-
SummaryBucket::Unknown => counts.unknown += 1,
|
|
39
|
-
SummaryBucket::Running
|
|
40
|
-
| SummaryBucket::Busy
|
|
41
|
-
| SummaryBucket::Idle
|
|
42
|
-
| SummaryBucket::Failed => {}
|
|
43
|
-
}
|
|
44
|
-
continue;
|
|
45
|
-
}
|
|
46
|
-
let raw = agent.get("status").and_then(Value::as_str).unwrap_or("");
|
|
47
|
-
let hstatus = health
|
|
48
|
-
.get(agent_id)
|
|
49
|
-
.and_then(|v| v.get("status"))
|
|
50
|
-
.and_then(Value::as_str)
|
|
51
|
-
.unwrap_or("");
|
|
52
|
-
// 0.5.35 R4 (`.team/artifacts/managed-leader-provider-reentry-locate.md`):
|
|
53
|
-
// canonical `worker_state=UNKNOWN` / `activity.status=uncertain`
|
|
54
|
-
// beats legacy `agent_health.status=WORKING` so the five-line
|
|
55
|
-
// summary stops counting a runtime-honestly-UNKNOWN agent as busy.
|
|
56
|
-
if canonical_worker_state_is_unknown(agent) {
|
|
57
|
-
counts.unknown += 1;
|
|
58
|
-
continue;
|
|
59
|
-
}
|
|
60
|
-
match classify_agent_bucket(raw, hstatus) {
|
|
61
|
-
SummaryBucket::Running => counts.running += 1,
|
|
62
|
-
SummaryBucket::Busy => counts.busy += 1,
|
|
63
|
-
SummaryBucket::Idle => counts.idle += 1,
|
|
64
|
-
SummaryBucket::Stopped => counts.stopped += 1,
|
|
65
|
-
SummaryBucket::Failed => counts.failed += 1,
|
|
66
|
-
SummaryBucket::Unknown => counts.unknown += 1,
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
counts
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/// 0.5.35 R4: return true when the runtime classifier has written a
|
|
73
|
-
/// canonical non-decisive observation onto the agent row. Used by
|
|
74
|
-
/// `agent_summary_counts` and `csv_agent_status` so the "UNKNOWN-first"
|
|
75
|
-
/// signal beats legacy `agent_health.status`.
|
|
76
|
-
fn canonical_worker_state_is_unknown(agent: &Value) -> bool {
|
|
77
|
-
let worker_state_unknown = agent
|
|
78
|
-
.get("worker_state")
|
|
79
|
-
.and_then(Value::as_str)
|
|
80
|
-
.is_some_and(|value| value.eq_ignore_ascii_case("UNKNOWN"));
|
|
81
|
-
let activity_uncertain = agent
|
|
82
|
-
.pointer("/activity/status")
|
|
83
|
-
.and_then(Value::as_str)
|
|
84
|
-
.is_some_and(|value| value.eq_ignore_ascii_case("uncertain"));
|
|
85
|
-
worker_state_unknown || activity_uncertain
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
fn stale_agent_bucket(agent: &Value) -> Option<SummaryBucket> {
|
|
89
|
-
if agent.get("stale").and_then(Value::as_bool) != Some(true) {
|
|
90
|
-
return None;
|
|
91
|
-
}
|
|
92
|
-
if agent
|
|
93
|
-
.get("stale_reason")
|
|
94
|
-
.and_then(Value::as_str)
|
|
95
|
-
.is_some_and(|reason| !reason.is_empty())
|
|
96
|
-
{
|
|
97
|
-
Some(SummaryBucket::Stopped)
|
|
98
|
-
} else {
|
|
99
|
-
Some(SummaryBucket::Unknown)
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/// `_interaction_counts`(`commands.py:292-306`):遍历 agents 的 `interacted` 字段。
|
|
104
|
-
pub(super) fn interaction_counts(agents: &Value) -> InteractionCounts {
|
|
105
|
-
let mut counts = InteractionCounts::default();
|
|
106
|
-
let Some(agent_map) = agents.as_object() else {
|
|
107
|
-
return counts;
|
|
108
|
-
};
|
|
109
|
-
for agent in agent_map.values() {
|
|
110
|
-
let interacted = agent
|
|
111
|
-
.get("interacted")
|
|
112
|
-
.and_then(Value::as_str)
|
|
113
|
-
.unwrap_or("");
|
|
114
|
-
if !interacted.is_empty() && interacted != "never" {
|
|
115
|
-
counts.interacted += 1;
|
|
116
|
-
} else {
|
|
117
|
-
counts.never += 1;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
counts
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
/// `_format_status_summary`(`commands.py:263-289`):把 status `Value` 渲染成五行 triage 文本。
|
|
124
|
-
/// **Gap 18a 字节锁(§11)**:line[2] 精确串
|
|
125
|
-
/// `agents: N — running=.. busy=.. idle=.. stopped=.. failed=.. unknown=..`,
|
|
126
|
-
/// `(N interacted, M never)` 仅当 interacted>0 才追加(`commands.py:280-282`)。
|
|
127
|
-
/// 五行:coordinator / receiver / agents / queued / latest result。空格/破折号/顺序禁改。
|
|
128
|
-
pub fn format_status_summary(data: &Value) -> String {
|
|
129
|
-
let coordinator = non_empty_str(
|
|
130
|
-
data.get("coordinator")
|
|
131
|
-
.and_then(|v| v.get("status"))
|
|
132
|
-
.and_then(Value::as_str),
|
|
133
|
-
"stopped",
|
|
134
|
-
);
|
|
135
|
-
let schema_ok = python_truthy(
|
|
136
|
-
data.get("coordinator")
|
|
137
|
-
.and_then(|v| v.get("schema_ok"))
|
|
138
|
-
.unwrap_or(&Value::Null),
|
|
139
|
-
);
|
|
140
|
-
let tmux = python_truthy(data.get("tmux_session_present").unwrap_or(&Value::Null));
|
|
141
|
-
let receiver = data.get("leader_receiver").unwrap_or(&Value::Null);
|
|
142
|
-
let pane = non_empty_str(receiver.get("pane_id").and_then(Value::as_str), "-");
|
|
143
|
-
let cmd = first_non_empty_str(
|
|
144
|
-
&[
|
|
145
|
-
receiver.get("pane_current_command").and_then(Value::as_str),
|
|
146
|
-
receiver.get("current_command").and_then(Value::as_str),
|
|
147
|
-
],
|
|
148
|
-
"-",
|
|
149
|
-
);
|
|
150
|
-
let topology = non_empty_str(
|
|
151
|
-
data.get("leader_topology").and_then(Value::as_str),
|
|
152
|
-
"external",
|
|
153
|
-
);
|
|
154
|
-
let agents = data.get("agents").unwrap_or(&Value::Null);
|
|
155
|
-
let health = data.get("agent_health").unwrap_or(&Value::Null);
|
|
156
|
-
let counts = agent_summary_counts(agents, health);
|
|
157
|
-
let interactions = interaction_counts(agents);
|
|
158
|
-
let mut agent_line = format!(
|
|
159
|
-
"agents: {} — running={} busy={} idle={} stopped={} failed={} unknown={}",
|
|
160
|
-
counts.total(),
|
|
161
|
-
counts.running,
|
|
162
|
-
counts.busy,
|
|
163
|
-
counts.idle,
|
|
164
|
-
counts.stopped,
|
|
165
|
-
counts.failed,
|
|
166
|
-
counts.unknown
|
|
167
|
-
);
|
|
168
|
-
if interactions.interacted > 0 {
|
|
169
|
-
agent_line.push_str(&format!(
|
|
170
|
-
" ({} interacted, {} never)",
|
|
171
|
-
interactions.interacted, interactions.never
|
|
172
|
-
));
|
|
173
|
-
}
|
|
174
|
-
let queued = data
|
|
175
|
-
.get("queued_messages")
|
|
176
|
-
.and_then(Value::as_array)
|
|
177
|
-
.map(Vec::len)
|
|
178
|
-
.unwrap_or(0);
|
|
179
|
-
let latest = data
|
|
180
|
-
.get("latest_results")
|
|
181
|
-
.and_then(Value::as_array)
|
|
182
|
-
.and_then(|arr| arr.first())
|
|
183
|
-
.filter(|v| python_truthy(v))
|
|
184
|
-
.map(format_latest_result)
|
|
185
|
-
.unwrap_or_else(|| "none".to_string());
|
|
186
|
-
format!(
|
|
187
|
-
"coordinator: {coordinator} schema_ok={schema_ok} tmux={tmux}\nreceiver: {pane} cmd={cmd} topology={topology}\n{agent_line}\nqueued: {queued} mailbox messages awaiting delivery\nlatest result: {latest}"
|
|
188
|
-
)
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
pub fn format_status_csv(data: &Value) -> String {
|
|
192
|
-
let Some(agents) = data.get("agents").and_then(Value::as_object) else {
|
|
193
|
-
return String::new();
|
|
194
|
-
};
|
|
195
|
-
let health = data.get("agent_health").and_then(Value::as_object);
|
|
196
|
-
agents
|
|
197
|
-
.iter()
|
|
198
|
-
.map(|(agent_id, agent)| {
|
|
199
|
-
let status = csv_agent_status(agent_id, agent, health);
|
|
200
|
-
format!("{agent_id},{status}")
|
|
201
|
-
})
|
|
202
|
-
.collect::<Vec<_>>()
|
|
203
|
-
.join("\n")
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
fn csv_agent_status(
|
|
207
|
-
agent_id: &str,
|
|
208
|
-
agent: &Value,
|
|
209
|
-
health: Option<&serde_json::Map<String, Value>>,
|
|
210
|
-
) -> &'static str {
|
|
211
|
-
if stale_agent_bucket(agent).is_some() {
|
|
212
|
-
return "error";
|
|
213
|
-
}
|
|
214
|
-
let raw = agent
|
|
215
|
-
.get("status")
|
|
216
|
-
.and_then(Value::as_str)
|
|
217
|
-
.unwrap_or("")
|
|
218
|
-
.to_ascii_lowercase();
|
|
219
|
-
let hstatus = health
|
|
220
|
-
.and_then(|map| map.get(agent_id))
|
|
221
|
-
.and_then(|v| v.get("status"))
|
|
222
|
-
.and_then(Value::as_str)
|
|
223
|
-
.unwrap_or("")
|
|
224
|
-
.to_ascii_lowercase();
|
|
225
|
-
if matches!(raw.as_str(), "failed" | "error" | "spawn_failed")
|
|
226
|
-
|| matches!(hstatus.as_str(), "failed" | "error" | "spawn_failed")
|
|
227
|
-
|| matches!(raw.as_str(), "stopped" | "done")
|
|
228
|
-
{
|
|
229
|
-
return "error";
|
|
230
|
-
}
|
|
231
|
-
let pane_present = agent
|
|
232
|
-
.get("pane_id")
|
|
233
|
-
.and_then(Value::as_str)
|
|
234
|
-
.filter(|pane| !pane.is_empty())
|
|
235
|
-
.is_some()
|
|
236
|
-
|| agent
|
|
237
|
-
.pointer("/display/pane_id")
|
|
238
|
-
.and_then(Value::as_str)
|
|
239
|
-
.filter(|pane| !pane.is_empty())
|
|
240
|
-
.is_some();
|
|
241
|
-
if matches!(raw.as_str(), "running" | "busy" | "working") && !pane_present {
|
|
242
|
-
return "error";
|
|
243
|
-
}
|
|
244
|
-
// 0.5.35 R4: canonical UNKNOWN beats legacy WORKING in human CSV too.
|
|
245
|
-
if canonical_worker_state_is_unknown(agent) {
|
|
246
|
-
return "unknown";
|
|
247
|
-
}
|
|
248
|
-
if raw == "idle" || hstatus == "idle" {
|
|
249
|
-
return "idle";
|
|
250
|
-
}
|
|
251
|
-
if matches!(raw.as_str(), "running" | "busy" | "working")
|
|
252
|
-
|| matches!(hstatus.as_str(), "running" | "working" | "busy")
|
|
253
|
-
{
|
|
254
|
-
return "working";
|
|
255
|
-
}
|
|
256
|
-
"error"
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
/// `_latest_result_line`(`commands.py:333-337`):agent_id/summary/created_at 渲染单行。
|
|
260
|
-
/// summary `\n`→` ` 后 [:80] 截断、空 → `-`;agent_id 空 → `-`;created_at 经 age_text。
|
|
261
|
-
pub(crate) fn format_latest_result(value: &Value) -> String {
|
|
262
|
-
let agent = non_empty_str(value.get("agent_id").and_then(Value::as_str), "-");
|
|
263
|
-
let raw_summary = value.get("summary").and_then(Value::as_str).unwrap_or("");
|
|
264
|
-
let summary_flat = raw_summary.replace('\n', " ");
|
|
265
|
-
let summary = prefix_chars(&summary_flat, 80);
|
|
266
|
-
let summary = if summary.is_empty() {
|
|
267
|
-
"-".to_string()
|
|
268
|
-
} else {
|
|
269
|
-
summary
|
|
270
|
-
};
|
|
271
|
-
let created = age_text(value.get("created_at").and_then(Value::as_str));
|
|
272
|
-
format!("{agent} -> {summary} @ {created}")
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
/// `cmd_status` 的 `--json` 分支 CLI **独占**的不变量(`commands.py:99`):
|
|
276
|
-
/// `compact = not (detail is True)`。即 `detail=false ⇒ compact=true`(默认压缩),
|
|
277
|
-
/// `detail=true ⇒ compact=false`(全量)。这是 CLI 在 status 委派之上唯一拥有的字节级映射。
|
|
278
|
-
pub fn status_compact_flag(detail: bool) -> bool {
|
|
279
|
-
!detail
|
|
280
|
-
}
|
|
@@ -1,358 +0,0 @@
|
|
|
1
|
-
use super::*;
|
|
2
|
-
|
|
3
|
-
pub(super) fn agent_window(agent_id: &str, agent_state: &Value) -> String {
|
|
4
|
-
["window", "window_name"]
|
|
5
|
-
.iter()
|
|
6
|
-
.find_map(|key| {
|
|
7
|
-
agent_state
|
|
8
|
-
.get(*key)
|
|
9
|
-
.and_then(Value::as_str)
|
|
10
|
-
.filter(|s| !s.is_empty())
|
|
11
|
-
})
|
|
12
|
-
.unwrap_or(agent_id)
|
|
13
|
-
.to_string()
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
pub(super) fn enrich_agents(
|
|
17
|
-
workspace: &Path,
|
|
18
|
-
state: &Value,
|
|
19
|
-
tmux_session_present: bool,
|
|
20
|
-
freshness: &RuntimeFreshness,
|
|
21
|
-
) -> Value {
|
|
22
|
-
let agents = state.get("agents");
|
|
23
|
-
let Some(Value::Object(input)) = agents else {
|
|
24
|
-
return json!({});
|
|
25
|
-
};
|
|
26
|
-
let team_dir = state
|
|
27
|
-
.get("team_dir")
|
|
28
|
-
.and_then(Value::as_str)
|
|
29
|
-
.filter(|value| !value.is_empty())
|
|
30
|
-
.map(PathBuf::from)
|
|
31
|
-
.unwrap_or_else(|| workspace.to_path_buf());
|
|
32
|
-
let mut out = Map::new();
|
|
33
|
-
for (agent_id, value) in input {
|
|
34
|
-
match value {
|
|
35
|
-
Value::Object(obj) => {
|
|
36
|
-
let mut enriched = obj.clone();
|
|
37
|
-
apply_effective_role_projection(&team_dir, agent_id, &mut enriched);
|
|
38
|
-
enriched.insert(
|
|
39
|
-
"interacted".to_string(),
|
|
40
|
-
Value::String(interacted_marker(obj.get("first_send_at"))),
|
|
41
|
-
);
|
|
42
|
-
// 0.5.41 Slice 3: order stale sources most-authoritative-first.
|
|
43
|
-
// Host boot mismatch wins because it invalidates all cached
|
|
44
|
-
// pane/pid/session facts. Provider-exit marker wins over
|
|
45
|
-
// pane liveness because the wrapper leaves an interactive
|
|
46
|
-
// shell live. Coordinator unavailability without stronger
|
|
47
|
-
// live provider proof means DB agent_health rows are stale.
|
|
48
|
-
// Tmux session missing keeps its existing legacy path so
|
|
49
|
-
// pre-0.5.41 tests remain byte-identical when no new
|
|
50
|
-
// signal fires.
|
|
51
|
-
let has_pane_binding = agent_has_pane_fact(&Value::Object(obj.clone()));
|
|
52
|
-
// 0.5.41 Slice 3 (fault-invisibility-locate.md §5 point 3
|
|
53
|
-
// + §9 RED4 live-provider guard): the wrapper-era pane
|
|
54
|
-
// liveness cannot prove provider liveness — but a state
|
|
55
|
-
// `pane_current_command` that MATCHES the agent's provider
|
|
56
|
-
// IS positive proof (the abnormal.rs classifier writes it
|
|
57
|
-
// when the pane's foreground command is the provider CLI).
|
|
58
|
-
// When that positive proof is present, no stale downgrade
|
|
59
|
-
// fires here so the agent renders as working.
|
|
60
|
-
let provider_command_positive_proof = provider_current_command_matches(obj);
|
|
61
|
-
// 0.5.41 Slice 3 (0.5.35 R4 regression guard): when the
|
|
62
|
-
// runtime classifier has already written canonical
|
|
63
|
-
// `worker_state=UNKNOWN` / `activity.status=uncertain`,
|
|
64
|
-
// that is the authoritative honest observation — do NOT
|
|
65
|
-
// reclassify it as `coordinator_unavailable` stale (which
|
|
66
|
-
// would land it in the Stopped bucket instead of Unknown).
|
|
67
|
-
// Host-boot mismatch and provider-exited marker are
|
|
68
|
-
// stronger, more specific signals and still win.
|
|
69
|
-
let canonical_unknown = agent_canonical_worker_state_is_unknown(obj);
|
|
70
|
-
let new_reason = if freshness.host_boot_stale && has_pane_binding {
|
|
71
|
-
freshness.host_boot_stale_reason()
|
|
72
|
-
} else if freshness.provider_exited_agents.contains(agent_id) {
|
|
73
|
-
Some("worker_provider_exited")
|
|
74
|
-
} else if !freshness.coordinator_service_available
|
|
75
|
-
&& has_pane_binding
|
|
76
|
-
&& !provider_command_positive_proof
|
|
77
|
-
&& !canonical_unknown
|
|
78
|
-
{
|
|
79
|
-
Some("coordinator_unavailable")
|
|
80
|
-
} else {
|
|
81
|
-
None
|
|
82
|
-
};
|
|
83
|
-
let legacy_reason = if provider_command_positive_proof {
|
|
84
|
-
None
|
|
85
|
-
} else {
|
|
86
|
-
stale_reason_for_agent(&Value::Object(obj.clone()), tmux_session_present)
|
|
87
|
-
};
|
|
88
|
-
let reason = new_reason.or(legacy_reason);
|
|
89
|
-
if let Some(reason) = reason {
|
|
90
|
-
enriched.insert("stale".to_string(), Value::Bool(true));
|
|
91
|
-
enriched.insert(
|
|
92
|
-
"stale_reason".to_string(),
|
|
93
|
-
Value::String(reason.to_string()),
|
|
94
|
-
);
|
|
95
|
-
// Downgrade cached BUSY/working when the stale source is
|
|
96
|
-
// one of the new authoritative signals OR the pre-existing
|
|
97
|
-
// session-missing signal. Legacy code only downgraded on
|
|
98
|
-
// !tmux_session_present; that let host_boot / provider-
|
|
99
|
-
// exit / coord-unavailable stale rows keep raw=running.
|
|
100
|
-
let is_new_signal = matches!(
|
|
101
|
-
reason,
|
|
102
|
-
"host_boot_mismatch" | "worker_provider_exited" | "coordinator_unavailable"
|
|
103
|
-
);
|
|
104
|
-
if !tmux_session_present || is_new_signal {
|
|
105
|
-
downgrade_stale_agent(&mut enriched);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
out.insert(agent_id.clone(), Value::Object(enriched));
|
|
109
|
-
}
|
|
110
|
-
_ => {
|
|
111
|
-
out.insert(agent_id.clone(), value.clone());
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
Value::Object(out)
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
pub(super) fn apply_effective_role_projection(
|
|
119
|
-
team_dir: &Path,
|
|
120
|
-
agent_id: &str,
|
|
121
|
-
agent: &mut Map<String, Value>,
|
|
122
|
-
) {
|
|
123
|
-
let role_file = agent
|
|
124
|
-
.get("dynamic_role_file")
|
|
125
|
-
.and_then(Value::as_str)
|
|
126
|
-
.filter(|value| !value.is_empty())
|
|
127
|
-
.map(PathBuf::from)
|
|
128
|
-
.unwrap_or_else(|| team_dir.join("agents").join(format!("{agent_id}.md")));
|
|
129
|
-
let Ok((meta, _)) = crate::compiler::read_front_matter(&role_file) else {
|
|
130
|
-
return;
|
|
131
|
-
};
|
|
132
|
-
let Some(meta) = yaml_map(&meta) else {
|
|
133
|
-
return;
|
|
134
|
-
};
|
|
135
|
-
if let Some(provider) = yaml_str(meta, "provider").filter(|value| !value.is_empty()) {
|
|
136
|
-
agent.insert("provider".to_string(), Value::String(provider.to_string()));
|
|
137
|
-
agent.insert(
|
|
138
|
-
"provider_source".to_string(),
|
|
139
|
-
Value::String("role".to_string()),
|
|
140
|
-
);
|
|
141
|
-
}
|
|
142
|
-
if let Some(model) = yaml_str(meta, "model").filter(|value| !value.is_empty()) {
|
|
143
|
-
if agent.get("model").and_then(Value::as_str) != Some(model) {
|
|
144
|
-
agent.insert("model_stale".to_string(), Value::Bool(true));
|
|
145
|
-
}
|
|
146
|
-
agent.insert("model".to_string(), Value::String(model.to_string()));
|
|
147
|
-
agent.insert(
|
|
148
|
-
"model_source".to_string(),
|
|
149
|
-
Value::String("role".to_string()),
|
|
150
|
-
);
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
pub(super) fn yaml_map(
|
|
155
|
-
value: &crate::model::yaml::Value,
|
|
156
|
-
) -> Option<&Vec<(String, crate::model::yaml::Value)>> {
|
|
157
|
-
match value {
|
|
158
|
-
crate::model::yaml::Value::Map(items) => Some(items),
|
|
159
|
-
_ => None,
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
pub(super) fn yaml_str<'a>(
|
|
164
|
-
items: &'a [(String, crate::model::yaml::Value)],
|
|
165
|
-
key: &str,
|
|
166
|
-
) -> Option<&'a str> {
|
|
167
|
-
items.iter().find_map(|(name, value)| {
|
|
168
|
-
if name == key {
|
|
169
|
-
match value {
|
|
170
|
-
crate::model::yaml::Value::Str(value) => Some(value.as_str()),
|
|
171
|
-
_ => None,
|
|
172
|
-
}
|
|
173
|
-
} else {
|
|
174
|
-
None
|
|
175
|
-
}
|
|
176
|
-
})
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
pub(super) fn downgrade_stale_agent(agent: &mut Map<String, Value>) {
|
|
180
|
-
let raw = agent
|
|
181
|
-
.get("status")
|
|
182
|
-
.and_then(Value::as_str)
|
|
183
|
-
.unwrap_or("")
|
|
184
|
-
.to_ascii_lowercase();
|
|
185
|
-
if matches!(raw.as_str(), "running" | "busy" | "working" | "idle") {
|
|
186
|
-
agent.insert("status".to_string(), Value::String("stopped".to_string()));
|
|
187
|
-
}
|
|
188
|
-
let worker_state = agent
|
|
189
|
-
.get("worker_state")
|
|
190
|
-
.and_then(Value::as_str)
|
|
191
|
-
.unwrap_or("")
|
|
192
|
-
.to_ascii_uppercase();
|
|
193
|
-
if matches!(worker_state.as_str(), "RUNNING" | "BUSY" | "PROBABLY_IDLE") {
|
|
194
|
-
agent.insert(
|
|
195
|
-
"worker_state".to_string(),
|
|
196
|
-
Value::String("DEAD".to_string()),
|
|
197
|
-
);
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
pub(super) fn stale_reason_for_agent(
|
|
202
|
-
agent: &Value,
|
|
203
|
-
tmux_session_present: bool,
|
|
204
|
-
) -> Option<&'static str> {
|
|
205
|
-
let pane_dead = !tmux_session_present && agent_has_pane_fact(agent);
|
|
206
|
-
let process_dead =
|
|
207
|
-
agent_process_dead(agent) || (!tmux_session_present && agent_has_process_fact(agent));
|
|
208
|
-
match (pane_dead, process_dead) {
|
|
209
|
-
(true, true) => Some("both"),
|
|
210
|
-
(false, true) => Some("process_dead"),
|
|
211
|
-
(true, false) => Some("pane_dead"),
|
|
212
|
-
(false, false) => None,
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
/// 0.5.41 Slice 3 (0.5.35 R4 regression guard): true when the agent
|
|
217
|
-
/// row carries the canonical `worker_state=UNKNOWN` OR
|
|
218
|
-
/// `activity.status=uncertain` observation the runtime classifier
|
|
219
|
-
/// writes. Used to skip the coordinator-unavailable stale mark
|
|
220
|
-
/// (see `enrich_agents`) so the pre-existing R4 rendering (UNKNOWN
|
|
221
|
-
/// beats WORKING) is preserved.
|
|
222
|
-
pub(super) fn agent_canonical_worker_state_is_unknown(
|
|
223
|
-
agent: &serde_json::Map<String, Value>,
|
|
224
|
-
) -> bool {
|
|
225
|
-
let worker_state_unknown = agent
|
|
226
|
-
.get("worker_state")
|
|
227
|
-
.and_then(Value::as_str)
|
|
228
|
-
.is_some_and(|value| value.eq_ignore_ascii_case("UNKNOWN"));
|
|
229
|
-
let activity_uncertain = agent
|
|
230
|
-
.get("activity")
|
|
231
|
-
.and_then(|v| v.get("status"))
|
|
232
|
-
.and_then(Value::as_str)
|
|
233
|
-
.is_some_and(|value| value.eq_ignore_ascii_case("uncertain"));
|
|
234
|
-
worker_state_unknown || activity_uncertain
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
/// 0.5.41 Slice 3 (fault-invisibility-locate.md §9 RED4 live-provider
|
|
238
|
-
/// guard): true when the agent row carries a `pane_current_command`
|
|
239
|
-
/// that matches the agent's provider CLI. This is positive proof
|
|
240
|
-
/// the provider is the pane's foreground process — the abnormal.rs
|
|
241
|
-
/// classifier writes this field after the marker/current-command
|
|
242
|
-
/// check clears. When true, stale-downgrade paths in
|
|
243
|
-
/// `enrich_agents` skip so the row keeps its BUSY/working state.
|
|
244
|
-
pub(super) fn provider_current_command_matches(agent: &serde_json::Map<String, Value>) -> bool {
|
|
245
|
-
let Some(command) = agent
|
|
246
|
-
.get("pane_current_command")
|
|
247
|
-
.and_then(Value::as_str)
|
|
248
|
-
.filter(|s| !s.is_empty())
|
|
249
|
-
else {
|
|
250
|
-
return false;
|
|
251
|
-
};
|
|
252
|
-
let Some(provider_wire) = agent.get("provider").and_then(Value::as_str) else {
|
|
253
|
-
return false;
|
|
254
|
-
};
|
|
255
|
-
let Some(provider) = crate::provider::wire::parse_provider(provider_wire) else {
|
|
256
|
-
return false;
|
|
257
|
-
};
|
|
258
|
-
crate::leader::command_matches_provider(provider, command)
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
pub(super) fn agent_has_pane_fact(agent: &Value) -> bool {
|
|
262
|
-
["pane_id", "window", "window_name"].iter().any(|key| {
|
|
263
|
-
agent
|
|
264
|
-
.get(*key)
|
|
265
|
-
.and_then(Value::as_str)
|
|
266
|
-
.is_some_and(|value| !value.is_empty())
|
|
267
|
-
})
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
pub(super) fn agent_has_process_fact(agent: &Value) -> bool {
|
|
271
|
-
agent.get("pid").and_then(Value::as_i64).is_some()
|
|
272
|
-
|| agent.get("process_started").and_then(Value::as_bool) == Some(true)
|
|
273
|
-
|| agent
|
|
274
|
-
.get("provider_process_dead")
|
|
275
|
-
.and_then(Value::as_bool)
|
|
276
|
-
.is_some()
|
|
277
|
-
|| agent
|
|
278
|
-
.get("process_liveness")
|
|
279
|
-
.and_then(Value::as_str)
|
|
280
|
-
.is_some()
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
pub(super) fn agent_process_dead(agent: &Value) -> bool {
|
|
284
|
-
if agent.get("provider_process_dead").and_then(Value::as_bool) == Some(true) {
|
|
285
|
-
return true;
|
|
286
|
-
}
|
|
287
|
-
["process_liveness", "worker_state"].iter().any(|key| {
|
|
288
|
-
agent
|
|
289
|
-
.get(*key)
|
|
290
|
-
.and_then(Value::as_str)
|
|
291
|
-
.is_some_and(is_dead_process_state)
|
|
292
|
-
})
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
pub(super) fn is_dead_process_state(value: &str) -> bool {
|
|
296
|
-
matches!(
|
|
297
|
-
value,
|
|
298
|
-
"dead" | "missing" | "stopped" | "exited" | "terminated"
|
|
299
|
-
)
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
pub(super) fn interacted_marker(value: Option<&Value>) -> String {
|
|
303
|
-
let Some(raw) = value.and_then(Value::as_str) else {
|
|
304
|
-
return "never".to_string();
|
|
305
|
-
};
|
|
306
|
-
if raw.is_empty() {
|
|
307
|
-
return "never".to_string();
|
|
308
|
-
}
|
|
309
|
-
if chrono::DateTime::parse_from_rfc3339(raw).is_ok() {
|
|
310
|
-
raw.to_string()
|
|
311
|
-
} else {
|
|
312
|
-
"never".to_string()
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
pub(super) fn tmux_session_present(
|
|
317
|
-
workspace: &Path,
|
|
318
|
-
state: &Value,
|
|
319
|
-
session_name: Option<&str>,
|
|
320
|
-
) -> bool {
|
|
321
|
-
// Bug #7 (prerelease 0.4.0 gate review §6): probe the SAME endpoint
|
|
322
|
-
// the runtime actually uses (state.tmux_endpoint / tmux_socket), not
|
|
323
|
-
// the workspace-hash socket. When state has no persisted endpoint,
|
|
324
|
-
// fall back to workspace — preserves legacy behavior. wait_readiness
|
|
325
|
-
// formula unchanged per 不可改项; only the input signal is fixed.
|
|
326
|
-
let Some(name) = session_name else {
|
|
327
|
-
return false;
|
|
328
|
-
};
|
|
329
|
-
if name.is_empty() {
|
|
330
|
-
return false;
|
|
331
|
-
}
|
|
332
|
-
let run_ws = crate::model::paths::canonical_run_workspace(workspace)
|
|
333
|
-
.unwrap_or_else(|_| workspace.to_path_buf());
|
|
334
|
-
// 0.5.x Phase 1d Batch 3: route through the factory so a
|
|
335
|
-
// conpty team does NOT get its `has_session` probe served by a
|
|
336
|
-
// tmux backend (which would always return false and drive the
|
|
337
|
-
// reader into a false `tmux_session_missing` state — design
|
|
338
|
-
// §Batch 3 Verification anchor). Tmux teams see byte-equivalent
|
|
339
|
-
// behavior because factory Layer 3 (legacy tmux endpoint) uses
|
|
340
|
-
// the same `tmux_backend_for_runtime_state_or_workspace` shape.
|
|
341
|
-
let resolved = crate::transport_factory::resolve_read_only_transport(
|
|
342
|
-
&run_ws,
|
|
343
|
-
Some(state),
|
|
344
|
-
crate::transport_factory::TransportPurpose::Status,
|
|
345
|
-
);
|
|
346
|
-
match resolved {
|
|
347
|
-
Ok(r) => r
|
|
348
|
-
.backend
|
|
349
|
-
.has_session(&crate::transport::SessionName::new(name))
|
|
350
|
-
.unwrap_or(false),
|
|
351
|
-
Err(_) => {
|
|
352
|
-
// Factory refused (e.g. explicit conpty without a
|
|
353
|
-
// resolvable team_key). Honest: return false rather
|
|
354
|
-
// than pretend a tmux session exists.
|
|
355
|
-
false
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
}
|