@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,15 +0,0 @@
|
|
|
1
|
-
//! ---
|
|
2
|
-
//! purpose: coordinator tick delivery 步骤组的占位命名空间——实现仍在 tick.rs
|
|
3
|
-
//! contract:
|
|
4
|
-
//! provides: []
|
|
5
|
-
//! depends: []
|
|
6
|
-
//! boundary:
|
|
7
|
-
//! - 本文件当前不含任何 item:消息投递 FSM 的 tick 步骤未来迁入处
|
|
8
|
-
//! - 迁移落地前不要在此新增逻辑,否则步骤顺序会分裂成两处
|
|
9
|
-
//! maturity: signature_only
|
|
10
|
-
//! ---
|
|
11
|
-
//!
|
|
12
|
-
//! unit-11 (Stage 4) — coordinator tick `delivery` step group.
|
|
13
|
-
//!
|
|
14
|
-
//! Future home for the message-delivery FSM ticks from
|
|
15
|
-
//! `coordinator/tick.rs`.
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
//! ---
|
|
2
|
-
//! purpose: coordinator tick health_sync 步骤组的占位命名空间——实现仍在 tick.rs
|
|
3
|
-
//! contract:
|
|
4
|
-
//! provides: []
|
|
5
|
-
//! depends: []
|
|
6
|
-
//! boundary:
|
|
7
|
-
//! - 本文件当前不含任何 item:worker 存活对账步骤未来迁入处
|
|
8
|
-
//! - 迁移落地前不要在此新增逻辑,否则步骤顺序会分裂成两处
|
|
9
|
-
//! maturity: signature_only
|
|
10
|
-
//! ---
|
|
11
|
-
//!
|
|
12
|
-
//! unit-11 (Stage 4) — coordinator tick `health_sync` step group.
|
|
13
|
-
//!
|
|
14
|
-
//! Future home for worker-liveness reconciliation steps from
|
|
15
|
-
//! `coordinator/tick.rs`.
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
//! ---
|
|
2
|
-
//! purpose: tick 步骤组的命名空间与规范顺序——给每个步骤组一个稳定标签与固定次序,供编排器与事件日志共用
|
|
3
|
-
//! contract:
|
|
4
|
-
//! provides:
|
|
5
|
-
//! - name: ordered
|
|
6
|
-
//! what: 步骤组的规范顺序(穷尽枚举),编排器必须按此序调用
|
|
7
|
-
//! - name: as_str
|
|
8
|
-
//! what: 步骤组的稳定标签(tick.<group>),进事件与指标字段
|
|
9
|
-
//! depends: []
|
|
10
|
-
//! boundary:
|
|
11
|
-
//! - 不含任何步骤的实现,只定义分组身份与顺序
|
|
12
|
-
//! - persist 必须排最后、session_gate 必须排最前,这是顺序本身承载的约束
|
|
13
|
-
//! maturity: wired
|
|
14
|
-
//! ---
|
|
15
|
-
//!
|
|
16
|
-
//! unit-11 (Stage 4) — coordinator tick steps namespace.
|
|
17
|
-
//!
|
|
18
|
-
//! The 3083 LOC `coordinator/tick.rs` orchestrator runs an ordered
|
|
19
|
-
//! sequence of step groups per tick. This module establishes a named
|
|
20
|
-
//! home for each group so future commits migrate them in small,
|
|
21
|
-
//! reviewable pieces. The orchestrator stays in `tick.rs`; this is the
|
|
22
|
-
//! boundary for the upcoming step relocations.
|
|
23
|
-
//!
|
|
24
|
-
//! Step groups (canonical order):
|
|
25
|
-
//! 1. `session_gate` — provider session capture + readiness gates
|
|
26
|
-
//! 2. `health_sync` — worker liveness + reconciliation
|
|
27
|
-
//! 3. `delivery` — message delivery FSM ticks
|
|
28
|
-
//! 4. `runtime_prompts` — startup / approval / abnormal-exit prompts
|
|
29
|
-
//! 5. `abnormal` — abnormal-exit detection + classification
|
|
30
|
-
//! 6. `persist` — durable state persistence at tick end
|
|
31
|
-
|
|
32
|
-
pub mod abnormal;
|
|
33
|
-
pub mod delivery;
|
|
34
|
-
pub mod health_sync;
|
|
35
|
-
pub mod persist;
|
|
36
|
-
pub mod runtime_prompts;
|
|
37
|
-
pub mod session_gate;
|
|
38
|
-
|
|
39
|
-
/// Canonical ordering of tick step groups. The orchestrator must invoke
|
|
40
|
-
/// steps in this order so persisted state reflects every earlier step's
|
|
41
|
-
/// outcome.
|
|
42
|
-
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
|
43
|
-
pub enum TickStepGroup {
|
|
44
|
-
SessionGate,
|
|
45
|
-
HealthSync,
|
|
46
|
-
Delivery,
|
|
47
|
-
RuntimePrompts,
|
|
48
|
-
Abnormal,
|
|
49
|
-
Persist,
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
impl TickStepGroup {
|
|
53
|
-
/// Stable label used in event-log and metric fields.
|
|
54
|
-
/// ---
|
|
55
|
-
/// purpose: 给步骤组一个稳定标签,供事件日志与指标字段使用
|
|
56
|
-
/// returns: 形如 tick.<group> 的稳定串;已发布的取值不可改写,只可新增
|
|
57
|
-
/// ---
|
|
58
|
-
pub fn as_str(self) -> &'static str {
|
|
59
|
-
match self {
|
|
60
|
-
Self::SessionGate => "tick.session_gate",
|
|
61
|
-
Self::HealthSync => "tick.health_sync",
|
|
62
|
-
Self::Delivery => "tick.delivery",
|
|
63
|
-
Self::RuntimePrompts => "tick.runtime_prompts",
|
|
64
|
-
Self::Abnormal => "tick.abnormal",
|
|
65
|
-
Self::Persist => "tick.persist",
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
///
|
|
70
|
-
/// Canonical ordering as a const slice — exhaustive over the enum.
|
|
71
|
-
/// ---
|
|
72
|
-
/// purpose: 给出步骤组的规范调用顺序
|
|
73
|
-
/// returns: 穷尽覆盖本 enum 全部变体的静态切片,session_gate 在首、persist 在尾;编排器按此序调用,持久化才能反映之前每一步的结果
|
|
74
|
-
/// ---
|
|
75
|
-
pub fn ordered() -> &'static [TickStepGroup] {
|
|
76
|
-
&[
|
|
77
|
-
TickStepGroup::SessionGate,
|
|
78
|
-
TickStepGroup::HealthSync,
|
|
79
|
-
TickStepGroup::Delivery,
|
|
80
|
-
TickStepGroup::RuntimePrompts,
|
|
81
|
-
TickStepGroup::Abnormal,
|
|
82
|
-
TickStepGroup::Persist,
|
|
83
|
-
]
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
#[cfg(test)]
|
|
88
|
-
mod tests {
|
|
89
|
-
use super::*;
|
|
90
|
-
|
|
91
|
-
#[test]
|
|
92
|
-
fn ordered_groups_cover_every_variant() {
|
|
93
|
-
let ordered = TickStepGroup::ordered();
|
|
94
|
-
assert_eq!(ordered.len(), 6);
|
|
95
|
-
// Persist is last (state writes follow every other step).
|
|
96
|
-
assert_eq!(*ordered.last().unwrap(), TickStepGroup::Persist);
|
|
97
|
-
// SessionGate is first (downstream steps depend on it).
|
|
98
|
-
assert_eq!(*ordered.first().unwrap(), TickStepGroup::SessionGate);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
#[test]
|
|
102
|
-
fn labels_are_dotted_paths_under_tick() {
|
|
103
|
-
for g in TickStepGroup::ordered() {
|
|
104
|
-
assert!(g.as_str().starts_with("tick."));
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
#[test]
|
|
109
|
-
fn ordered_group_labels_are_byte_stable() {
|
|
110
|
-
let labels = TickStepGroup::ordered()
|
|
111
|
-
.iter()
|
|
112
|
-
.map(|group| group.as_str())
|
|
113
|
-
.collect::<Vec<_>>();
|
|
114
|
-
assert_eq!(
|
|
115
|
-
labels,
|
|
116
|
-
vec![
|
|
117
|
-
"tick.session_gate",
|
|
118
|
-
"tick.health_sync",
|
|
119
|
-
"tick.delivery",
|
|
120
|
-
"tick.runtime_prompts",
|
|
121
|
-
"tick.abnormal",
|
|
122
|
-
"tick.persist",
|
|
123
|
-
]
|
|
124
|
-
);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
//! ---
|
|
2
|
-
//! purpose: coordinator tick persist 步骤组的占位命名空间——实现仍在 tick.rs
|
|
3
|
-
//! contract:
|
|
4
|
-
//! provides: []
|
|
5
|
-
//! depends: []
|
|
6
|
-
//! boundary:
|
|
7
|
-
//! - 本文件当前不含任何 item:tick 末尾的持久化步骤未来迁入处
|
|
8
|
-
//! - 迁移落地前不要在此新增逻辑,否则步骤顺序会分裂成两处
|
|
9
|
-
//! maturity: signature_only
|
|
10
|
-
//! ---
|
|
11
|
-
//!
|
|
12
|
-
//! unit-11 (Stage 4) — coordinator tick `persist` step group.
|
|
13
|
-
//!
|
|
14
|
-
//! Future home for the durable state-persistence step at the end of each
|
|
15
|
-
//! tick (currently inlined in `coordinator/tick.rs`).
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
//! ---
|
|
2
|
-
//! purpose: coordinator tick runtime_prompts 步骤组的占位命名空间——实现仍在 tick.rs
|
|
3
|
-
//! contract:
|
|
4
|
-
//! provides: []
|
|
5
|
-
//! depends: []
|
|
6
|
-
//! boundary:
|
|
7
|
-
//! - 本文件当前不含任何 item:startup / approval / abnormal-exit 提示步骤未来迁入处
|
|
8
|
-
//! - 迁移落地前不要在此新增逻辑,否则步骤顺序会分裂成两处
|
|
9
|
-
//! maturity: signature_only
|
|
10
|
-
//! ---
|
|
11
|
-
//!
|
|
12
|
-
//! unit-11 (Stage 4) — coordinator tick `runtime_prompts` step group.
|
|
13
|
-
//!
|
|
14
|
-
//! Future home for the startup / approval / abnormal-exit prompt steps
|
|
15
|
-
//! from `coordinator/tick.rs`.
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
//! ---
|
|
2
|
-
//! purpose: coordinator tick session_gate 步骤组的占位命名空间——实现仍在 tick.rs
|
|
3
|
-
//! contract:
|
|
4
|
-
//! provides: []
|
|
5
|
-
//! depends: []
|
|
6
|
-
//! boundary:
|
|
7
|
-
//! - 本文件当前不含任何 item:provider session 捕获与就绪门步骤未来迁入处
|
|
8
|
-
//! - 迁移落地前不要在此新增逻辑,否则步骤顺序会分裂成两处
|
|
9
|
-
//! maturity: signature_only
|
|
10
|
-
//! ---
|
|
11
|
-
//!
|
|
12
|
-
//! unit-11 (Stage 4) — coordinator tick `session_gate` step group.
|
|
13
|
-
//!
|
|
14
|
-
//! Future home for the provider session-capture + readiness-gate steps
|
|
15
|
-
//! currently inlined in `coordinator/tick.rs`. Boundary established by
|
|
16
|
-
//! unit-11; actual relocation lands in follow-up commits.
|
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
use super::*;
|
|
2
|
-
|
|
3
|
-
// ═════════════════════════════════════════════════════════════════════════
|
|
4
|
-
// Phase C stale-save contract, integration tier (save_hook window injection).
|
|
5
|
-
// Locate doc: .team/artifacts/a0-rs-lostupdate-locate.md §5.4.
|
|
6
|
-
//
|
|
7
|
-
// Python 0.2.11 A0: the coordinator tick loads state (tick window opens), mutates in
|
|
8
|
-
// memory for seconds, then whole-file-saves with no merge — an add-agent registration
|
|
9
|
-
// landing inside that window is permanently overwritten (state.py:493). Phase C keeps
|
|
10
|
-
// the no-corruption guarantee by refusing stale live topology instead of cloning rows.
|
|
11
|
-
//
|
|
12
|
-
// This test pins the END-TO-END guard through the REAL tick: the `save_hook` seam
|
|
13
|
-
// (tick.rs save point) lets us deterministically land a concurrent registration on disk
|
|
14
|
-
// AFTER tick's load and BEFORE tick's save, then delegate to the real
|
|
15
|
-
// `save_team_scoped_state`. Zero sleeps, zero real races — ordering is fixed by the
|
|
16
|
-
// hook call order.
|
|
17
|
-
// ═════════════════════════════════════════════════════════════════════════
|
|
18
|
-
|
|
19
|
-
#[test]
|
|
20
|
-
fn a0_phase_c_tick_save_degrades_on_live_topology_landed_after_tick_load() {
|
|
21
|
-
let dir = std::env::temp_dir().join(format!(
|
|
22
|
-
"team-agent-coord-a0-{}-{}",
|
|
23
|
-
std::process::id(),
|
|
24
|
-
std::time::SystemTime::now()
|
|
25
|
-
.duration_since(std::time::UNIX_EPOCH)
|
|
26
|
-
.unwrap()
|
|
27
|
-
.as_nanos()
|
|
28
|
-
));
|
|
29
|
-
std::fs::create_dir_all(&dir).unwrap();
|
|
30
|
-
crate::state::persist::save_runtime_state(
|
|
31
|
-
&dir,
|
|
32
|
-
&serde_json::json!({
|
|
33
|
-
"session_name": "team-a0",
|
|
34
|
-
"active_team_key": "team-a0",
|
|
35
|
-
"agents": { "w1": { "provider": "codex", "status": "running", "agent_id": "w1", "window": "w1" } },
|
|
36
|
-
}),
|
|
37
|
-
)
|
|
38
|
-
.unwrap();
|
|
39
|
-
|
|
40
|
-
// The hook runs at tick's atomic-save point: first simulate the concurrent
|
|
41
|
-
// add-agent registration landing on disk (raw write, as another process would),
|
|
42
|
-
// then run the REAL save path with tick's stale in-memory state.
|
|
43
|
-
let hook: SaveHook = Box::new(|ws, tick_state| {
|
|
44
|
-
let path = crate::state::persist::runtime_state_path(ws.as_path());
|
|
45
|
-
let mut latest: serde_json::Value =
|
|
46
|
-
serde_json::from_str(&std::fs::read_to_string(&path).unwrap()).unwrap();
|
|
47
|
-
latest["agents"]["joiner"] = serde_json::json!({
|
|
48
|
-
"provider": "codex", "status": "running", "agent_id": "joiner", "window": "joiner",
|
|
49
|
-
"pane_id": "%9", "spawned_at": "2026-06-01T00:00:00Z", "spawn_epoch": 1,
|
|
50
|
-
});
|
|
51
|
-
std::fs::write(&path, serde_json::to_string_pretty(&latest).unwrap()).unwrap();
|
|
52
|
-
crate::state::projection::save_team_scoped_state(ws.as_path(), tick_state)
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
let ws = WorkspacePath::new(dir.clone());
|
|
56
|
-
let reg: Box<dyn ProviderRegistry> = Box::new(MockRegistry::new(&[], &[]));
|
|
57
|
-
let transport = MockTransport::new(true);
|
|
58
|
-
let coord = Coordinator::for_test(ws, reg, Box::new(transport), Some(hook), None);
|
|
59
|
-
let report = coord.tick().expect("tick should complete");
|
|
60
|
-
assert!(
|
|
61
|
-
!report.ok && matches!(report.reason, Some(TickStopReason::PersistenceDegraded)),
|
|
62
|
-
"stale live topology must degrade this tick and retry from fresh state later; report={report:?}"
|
|
63
|
-
);
|
|
64
|
-
|
|
65
|
-
let saved: serde_json::Value = serde_json::from_str(
|
|
66
|
-
&std::fs::read_to_string(crate::state::persist::runtime_state_path(&dir)).unwrap(),
|
|
67
|
-
)
|
|
68
|
-
.unwrap();
|
|
69
|
-
assert!(
|
|
70
|
-
saved
|
|
71
|
-
.pointer("/agents/joiner")
|
|
72
|
-
.is_some_and(serde_json::Value::is_object),
|
|
73
|
-
"Phase C: concurrent live registration stays on disk; stale tick must not overwrite it; saved={saved}"
|
|
74
|
-
);
|
|
75
|
-
// 0.3.5 integration re-anchor (P3 / perf C-P3-1): the tick iteration counter moved
|
|
76
|
-
// OUT of persistent state into .team/runtime/coordinator_tick.json — state.json is
|
|
77
|
-
// counter-free BY DESIGN (p3_steady_tick_no_state_write). The original proxy
|
|
78
|
-
// ("tick's save really happened") is preserved via the counter metadata file.
|
|
79
|
-
let tick_meta: serde_json::Value = serde_json::from_str(
|
|
80
|
-
&std::fs::read_to_string(dir.join(".team/runtime/coordinator_tick.json")).unwrap(),
|
|
81
|
-
)
|
|
82
|
-
.unwrap();
|
|
83
|
-
assert!(
|
|
84
|
-
tick_meta
|
|
85
|
-
.get("coordinator_tick_iteration_count")
|
|
86
|
-
.and_then(serde_json::Value::as_u64)
|
|
87
|
-
.is_some_and(|count| count >= 1),
|
|
88
|
-
"the tick really ran (its iteration counter metadata landed); tick_meta={tick_meta}"
|
|
89
|
-
);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
#[test]
|
|
93
|
-
fn a0_phase_c_tick_preserves_typed_non_live_roster_stub_only() {
|
|
94
|
-
let dir = std::env::temp_dir().join(format!(
|
|
95
|
-
"team-agent-coord-a0-roster-{}-{}",
|
|
96
|
-
std::process::id(),
|
|
97
|
-
std::time::SystemTime::now()
|
|
98
|
-
.duration_since(std::time::UNIX_EPOCH)
|
|
99
|
-
.unwrap()
|
|
100
|
-
.as_nanos()
|
|
101
|
-
));
|
|
102
|
-
std::fs::create_dir_all(&dir).unwrap();
|
|
103
|
-
crate::state::persist::save_runtime_state(
|
|
104
|
-
&dir,
|
|
105
|
-
&serde_json::json!({
|
|
106
|
-
"session_name": "team-a0",
|
|
107
|
-
"active_team_key": "team-a0",
|
|
108
|
-
"agents": { "w1": { "provider": "codex", "status": "running", "agent_id": "w1", "window": "w1" } },
|
|
109
|
-
}),
|
|
110
|
-
)
|
|
111
|
-
.unwrap();
|
|
112
|
-
|
|
113
|
-
let hook: SaveHook = Box::new(|ws, tick_state| {
|
|
114
|
-
let path = crate::state::persist::runtime_state_path(ws.as_path());
|
|
115
|
-
let mut latest: serde_json::Value =
|
|
116
|
-
serde_json::from_str(&std::fs::read_to_string(&path).unwrap()).unwrap();
|
|
117
|
-
latest["agents"]["typed"] = serde_json::json!({
|
|
118
|
-
"provider": "codex",
|
|
119
|
-
"role": "Developer",
|
|
120
|
-
"agent_id": "typed",
|
|
121
|
-
"status": "running",
|
|
122
|
-
"spawn_cwd": "/tmp/stale",
|
|
123
|
-
"session_id": "old-session"
|
|
124
|
-
});
|
|
125
|
-
std::fs::write(&path, serde_json::to_string_pretty(&latest).unwrap()).unwrap();
|
|
126
|
-
crate::state::projection::save_team_scoped_state(ws.as_path(), tick_state)
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
let ws = WorkspacePath::new(dir.clone());
|
|
130
|
-
let reg: Box<dyn ProviderRegistry> = Box::new(MockRegistry::new(&[], &[]));
|
|
131
|
-
let transport = MockTransport::new(true);
|
|
132
|
-
let coord = Coordinator::for_test(ws, reg, Box::new(transport), Some(hook), None);
|
|
133
|
-
let report = coord.tick().expect("tick should complete");
|
|
134
|
-
assert!(
|
|
135
|
-
report.ok,
|
|
136
|
-
"non-live roster stub must not degrade tick; report={report:?}"
|
|
137
|
-
);
|
|
138
|
-
|
|
139
|
-
let saved: serde_json::Value = serde_json::from_str(
|
|
140
|
-
&std::fs::read_to_string(crate::state::persist::runtime_state_path(&dir)).unwrap(),
|
|
141
|
-
)
|
|
142
|
-
.unwrap();
|
|
143
|
-
let typed = saved.pointer("/agents/typed").expect("typed roster stub");
|
|
144
|
-
assert_eq!(
|
|
145
|
-
typed.get("provider").and_then(serde_json::Value::as_str),
|
|
146
|
-
Some("codex")
|
|
147
|
-
);
|
|
148
|
-
assert_eq!(
|
|
149
|
-
typed.get("role").and_then(serde_json::Value::as_str),
|
|
150
|
-
Some("Developer")
|
|
151
|
-
);
|
|
152
|
-
for forbidden in ["status", "spawn_cwd", "session_id"] {
|
|
153
|
-
assert!(
|
|
154
|
-
typed.get(forbidden).is_none(),
|
|
155
|
-
"typed roster stub must not preserve forbidden field {forbidden}; typed={typed}"
|
|
156
|
-
);
|
|
157
|
-
}
|
|
158
|
-
}
|
|
@@ -1,312 +0,0 @@
|
|
|
1
|
-
use super::*;
|
|
2
|
-
|
|
3
|
-
#[test]
|
|
4
|
-
fn abnormal_explicit_error_classifier_boundaries_stay_stable() {
|
|
5
|
-
let claude_api = line(serde_json::json!({
|
|
6
|
-
"type": "system",
|
|
7
|
-
"subtype": "api_error",
|
|
8
|
-
"level": "error",
|
|
9
|
-
"sessionId": "sess-1"
|
|
10
|
-
}));
|
|
11
|
-
let claude_api_fact =
|
|
12
|
-
crate::provider::latest_explicit_error_fact(Provider::ClaudeCode, &claude_api)
|
|
13
|
-
.expect("Claude system api_error level=error counts as explicit");
|
|
14
|
-
assert_eq!(claude_api_fact.signature.as_str(), "api_error");
|
|
15
|
-
assert_eq!(
|
|
16
|
-
claude_api_fact.turn_id.as_ref().map(|id| id.as_str()),
|
|
17
|
-
Some("sess-1")
|
|
18
|
-
);
|
|
19
|
-
assert_eq!(claude_api_fact.api_error_status, None);
|
|
20
|
-
assert_eq!(claude_api_fact.error.as_deref(), None);
|
|
21
|
-
assert_eq!(claude_api_fact.request_id.as_deref(), None);
|
|
22
|
-
assert_eq!(claude_api_fact.assistant_uuid.as_deref(), None);
|
|
23
|
-
|
|
24
|
-
let claude_400 = line(serde_json::json!({
|
|
25
|
-
"type": "assistant",
|
|
26
|
-
"parentUuid": "parent-400",
|
|
27
|
-
"uuid": "assistant-400",
|
|
28
|
-
"message": {"role": "assistant", "content": [
|
|
29
|
-
{"type": "text", "text": "API Error: 400 Team Agent truthsource forced invalid_request_error"}
|
|
30
|
-
]},
|
|
31
|
-
"error": "unknown",
|
|
32
|
-
"isApiErrorMessage": true,
|
|
33
|
-
"apiErrorStatus": 400,
|
|
34
|
-
"sessionId": "session-400",
|
|
35
|
-
"version": "2.1.181"
|
|
36
|
-
}));
|
|
37
|
-
let claude_400_fact =
|
|
38
|
-
crate::provider::latest_explicit_error_fact(Provider::ClaudeCode, &claude_400)
|
|
39
|
-
.expect("Claude assistant api error counts as explicit");
|
|
40
|
-
assert_claude_api_error_fact(
|
|
41
|
-
&claude_400_fact,
|
|
42
|
-
"assistant-400",
|
|
43
|
-
Some(400),
|
|
44
|
-
Some("unknown"),
|
|
45
|
-
None,
|
|
46
|
-
Some("assistant-400"),
|
|
47
|
-
);
|
|
48
|
-
|
|
49
|
-
let claude_404 = line(serde_json::json!({
|
|
50
|
-
"type": "assistant",
|
|
51
|
-
"parentUuid": "parent-404",
|
|
52
|
-
"uuid": "assistant-404",
|
|
53
|
-
"message": {"role": "assistant", "content": [
|
|
54
|
-
{"type": "text", "text": "There's an issue with the selected model."}
|
|
55
|
-
]},
|
|
56
|
-
"error": "model_not_found",
|
|
57
|
-
"isApiErrorMessage": true,
|
|
58
|
-
"apiErrorStatus": 404,
|
|
59
|
-
"sessionId": "session-404",
|
|
60
|
-
"version": "2.1.181"
|
|
61
|
-
}));
|
|
62
|
-
let claude_404_fact =
|
|
63
|
-
crate::provider::latest_explicit_error_fact(Provider::ClaudeCode, &claude_404)
|
|
64
|
-
.expect("Claude assistant model_not_found counts as explicit");
|
|
65
|
-
assert_claude_api_error_fact(
|
|
66
|
-
&claude_404_fact,
|
|
67
|
-
"assistant-404",
|
|
68
|
-
Some(404),
|
|
69
|
-
Some("model_not_found"),
|
|
70
|
-
None,
|
|
71
|
-
Some("assistant-404"),
|
|
72
|
-
);
|
|
73
|
-
|
|
74
|
-
let claude_real_request = line(serde_json::json!({
|
|
75
|
-
"type": "assistant",
|
|
76
|
-
"parentUuid": "parent-real",
|
|
77
|
-
"uuid": "assistant-real",
|
|
78
|
-
"requestId": "req_011CceNfWj2aPY5gtCdakULt",
|
|
79
|
-
"message": {"role": "assistant", "content": [
|
|
80
|
-
{"type": "text", "text": "There's an issue with the selected model."}
|
|
81
|
-
]},
|
|
82
|
-
"error": "model_not_found",
|
|
83
|
-
"isApiErrorMessage": true,
|
|
84
|
-
"apiErrorStatus": 404,
|
|
85
|
-
"sessionId": "session-real",
|
|
86
|
-
"version": "2.1.181"
|
|
87
|
-
}));
|
|
88
|
-
let claude_real_fact =
|
|
89
|
-
crate::provider::latest_explicit_error_fact(Provider::ClaudeCode, &claude_real_request)
|
|
90
|
-
.expect("Claude assistant api error with requestId counts as explicit");
|
|
91
|
-
assert_claude_api_error_fact(
|
|
92
|
-
&claude_real_fact,
|
|
93
|
-
"assistant-real",
|
|
94
|
-
Some(404),
|
|
95
|
-
Some("model_not_found"),
|
|
96
|
-
Some("req_011CceNfWj2aPY5gtCdakULt"),
|
|
97
|
-
Some("assistant-real"),
|
|
98
|
-
);
|
|
99
|
-
|
|
100
|
-
let claude_tool_result = line(serde_json::json!({
|
|
101
|
-
"type": "user",
|
|
102
|
-
"message": {
|
|
103
|
-
"content": [
|
|
104
|
-
{"type": "tool_result", "is_error": true, "content": "permission denied"}
|
|
105
|
-
]
|
|
106
|
-
}
|
|
107
|
-
}));
|
|
108
|
-
assert!(
|
|
109
|
-
crate::provider::latest_explicit_error_fact(Provider::ClaudeCode, &claude_tool_result)
|
|
110
|
-
.is_none(),
|
|
111
|
-
"Claude tool_result is_error is an abnormal fact, but not an explicit provider-exit error"
|
|
112
|
-
);
|
|
113
|
-
|
|
114
|
-
let ordinary_assistant_text = line(serde_json::json!({
|
|
115
|
-
"type": "assistant",
|
|
116
|
-
"uuid": "assistant-text",
|
|
117
|
-
"message": {"role": "assistant", "content": [
|
|
118
|
-
{"type": "text", "text": "The command returned an error string."}
|
|
119
|
-
]},
|
|
120
|
-
"sessionId": "session-text"
|
|
121
|
-
}));
|
|
122
|
-
assert!(
|
|
123
|
-
crate::provider::latest_explicit_error_fact(Provider::ClaudeCode, &ordinary_assistant_text)
|
|
124
|
-
.is_none(),
|
|
125
|
-
"ordinary assistant text containing error is not a structured API error"
|
|
126
|
-
);
|
|
127
|
-
|
|
128
|
-
let interrupted = line(serde_json::json!({
|
|
129
|
-
"type": "user",
|
|
130
|
-
"uuid": "user-interrupt",
|
|
131
|
-
"message": {"content": [{"type": "text", "text": "[Request interrupted by user]"}]}
|
|
132
|
-
}));
|
|
133
|
-
assert!(
|
|
134
|
-
crate::provider::latest_explicit_error_fact(Provider::ClaudeCode, &interrupted).is_none(),
|
|
135
|
-
"user interruption is not a provider API error"
|
|
136
|
-
);
|
|
137
|
-
|
|
138
|
-
let empty_api_error_shape = line(serde_json::json!({
|
|
139
|
-
"type": "assistant",
|
|
140
|
-
"uuid": "assistant-empty",
|
|
141
|
-
"message": {"role": "assistant", "content": [
|
|
142
|
-
{"type": "text", "text": "API Error:"}
|
|
143
|
-
]},
|
|
144
|
-
"isApiErrorMessage": true,
|
|
145
|
-
"sessionId": "session-empty"
|
|
146
|
-
}));
|
|
147
|
-
assert!(
|
|
148
|
-
crate::provider::latest_explicit_error_fact(Provider::ClaudeCode, &empty_api_error_shape)
|
|
149
|
-
.is_none(),
|
|
150
|
-
"isApiErrorMessage without status/error/requestId is not enough"
|
|
151
|
-
);
|
|
152
|
-
|
|
153
|
-
let codex_failed = line(serde_json::json!({
|
|
154
|
-
"jsonrpc": "2.0",
|
|
155
|
-
"method": "turn/completed",
|
|
156
|
-
"params": {"turn": {"id": "turn-1", "status": "failed"}}
|
|
157
|
-
}));
|
|
158
|
-
let codex_fact = crate::provider::latest_explicit_error_fact(Provider::Codex, &codex_failed)
|
|
159
|
-
.expect("Codex failed turn/completed counts as explicit");
|
|
160
|
-
assert_eq!(codex_fact.signature.as_str(), "turn_failed");
|
|
161
|
-
assert_eq!(
|
|
162
|
-
codex_fact.turn_id.as_ref().map(|id| id.as_str()),
|
|
163
|
-
Some("turn-1")
|
|
164
|
-
);
|
|
165
|
-
|
|
166
|
-
let non_error = line(serde_json::json!({
|
|
167
|
-
"jsonrpc": "2.0",
|
|
168
|
-
"method": "turn/completed",
|
|
169
|
-
"params": {"turn": {"id": "turn-2", "status": "completed"}}
|
|
170
|
-
}));
|
|
171
|
-
assert!(
|
|
172
|
-
crate::provider::latest_explicit_error_fact(Provider::Codex, &non_error).is_none(),
|
|
173
|
-
"non-error tail must not count as latest explicit error"
|
|
174
|
-
);
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
fn line(value: serde_json::Value) -> String {
|
|
178
|
-
format!("{value}\n")
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
fn assert_claude_api_error_fact(
|
|
182
|
-
fact: &crate::provider::FaultFact,
|
|
183
|
-
turn_id: &str,
|
|
184
|
-
status: Option<i64>,
|
|
185
|
-
error: Option<&str>,
|
|
186
|
-
request_id: Option<&str>,
|
|
187
|
-
assistant_uuid: Option<&str>,
|
|
188
|
-
) {
|
|
189
|
-
assert_eq!(fact.signature.as_str(), "api_error");
|
|
190
|
-
assert_eq!(fact.kind, crate::provider::FactKind::Error);
|
|
191
|
-
assert_eq!(fact.turn_id.as_ref().map(|id| id.as_str()), Some(turn_id));
|
|
192
|
-
assert_eq!(fact.api_error_status, status);
|
|
193
|
-
assert_eq!(fact.error.as_deref(), error);
|
|
194
|
-
assert_eq!(fact.request_id.as_deref(), request_id);
|
|
195
|
-
assert_eq!(fact.assistant_uuid.as_deref(), assistant_uuid);
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
// ═════════════════════════════════════════════════════════════════════════
|
|
199
|
-
// GROUP F — detect_whole_team_gone (abnormal_track.py:91) — clean vs unexpected — RED
|
|
200
|
-
// ═════════════════════════════════════════════════════════════════════════
|
|
201
|
-
|
|
202
|
-
#[test]
|
|
203
|
-
fn whole_team_gone_alive_when_any_present() {
|
|
204
|
-
// abnormal_track.py:117-127 — any alive → not whole_gone, silent.
|
|
205
|
-
let snap = TeamPresenceSnapshot {
|
|
206
|
-
coordinator_alive: true,
|
|
207
|
-
leader_alive: false,
|
|
208
|
-
provider_processes_alive: vec![false],
|
|
209
|
-
tmux_sessions_present: false,
|
|
210
|
-
clean_shutdown: false,
|
|
211
|
-
restart_in_progress: false,
|
|
212
|
-
};
|
|
213
|
-
let mut ms = MapMarkerStore::ok();
|
|
214
|
-
let r = detect_whole_team_gone(&snap, &mut ms);
|
|
215
|
-
assert!(!r.whole_team_gone);
|
|
216
|
-
assert_eq!(r.classification, WholeTeamGoneClass::Alive);
|
|
217
|
-
assert!(!r.notify);
|
|
218
|
-
assert!(!r.marker_written);
|
|
219
|
-
assert!(ms.markers.is_empty());
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
#[test]
|
|
223
|
-
fn whole_team_gone_clean_shutdown_is_silent() {
|
|
224
|
-
// abnormal_track.py:129-130 — clean_shutdown → silent, NO marker.
|
|
225
|
-
let snap = TeamPresenceSnapshot {
|
|
226
|
-
coordinator_alive: false,
|
|
227
|
-
leader_alive: false,
|
|
228
|
-
provider_processes_alive: vec![false],
|
|
229
|
-
tmux_sessions_present: false,
|
|
230
|
-
clean_shutdown: true,
|
|
231
|
-
restart_in_progress: false,
|
|
232
|
-
};
|
|
233
|
-
let mut ms = MapMarkerStore::ok();
|
|
234
|
-
let r = detect_whole_team_gone(&snap, &mut ms);
|
|
235
|
-
assert!(r.whole_team_gone);
|
|
236
|
-
assert_eq!(r.classification, WholeTeamGoneClass::CleanShutdown);
|
|
237
|
-
assert!(!r.notify);
|
|
238
|
-
assert!(!r.escalate_user_on_next_leader_command);
|
|
239
|
-
assert!(!r.marker_written);
|
|
240
|
-
assert!(
|
|
241
|
-
ms.markers.is_empty(),
|
|
242
|
-
"clean shutdown writes NO durable marker"
|
|
243
|
-
);
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
#[test]
|
|
247
|
-
fn whole_team_gone_restart_in_progress_is_silent() {
|
|
248
|
-
// abnormal_track.py:131-132 — restart_in_progress → silent.
|
|
249
|
-
let snap = TeamPresenceSnapshot {
|
|
250
|
-
coordinator_alive: false,
|
|
251
|
-
leader_alive: false,
|
|
252
|
-
provider_processes_alive: vec![false],
|
|
253
|
-
tmux_sessions_present: false,
|
|
254
|
-
clean_shutdown: false,
|
|
255
|
-
restart_in_progress: true,
|
|
256
|
-
};
|
|
257
|
-
let mut ms = MapMarkerStore::ok();
|
|
258
|
-
let r = detect_whole_team_gone(&snap, &mut ms);
|
|
259
|
-
assert!(r.whole_team_gone);
|
|
260
|
-
assert_eq!(r.classification, WholeTeamGoneClass::RestartInProgress);
|
|
261
|
-
assert!(!r.notify);
|
|
262
|
-
assert!(!r.marker_written);
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
#[test]
|
|
266
|
-
fn whole_team_gone_unexpected_writes_marker_and_defers_escalation() {
|
|
267
|
-
// abnormal_track.py:134-147 — 闪退: durable marker + deferred escalation, notify.
|
|
268
|
-
let snap = TeamPresenceSnapshot {
|
|
269
|
-
coordinator_alive: false,
|
|
270
|
-
leader_alive: false,
|
|
271
|
-
provider_processes_alive: vec![false, false],
|
|
272
|
-
tmux_sessions_present: false,
|
|
273
|
-
clean_shutdown: false,
|
|
274
|
-
restart_in_progress: false,
|
|
275
|
-
};
|
|
276
|
-
let mut ms = MapMarkerStore::ok();
|
|
277
|
-
let r = detect_whole_team_gone(&snap, &mut ms);
|
|
278
|
-
assert!(r.whole_team_gone);
|
|
279
|
-
assert_eq!(r.classification, WholeTeamGoneClass::UnexpectedExit);
|
|
280
|
-
assert!(r.notify);
|
|
281
|
-
assert!(
|
|
282
|
-
r.escalate_user_on_next_leader_command,
|
|
283
|
-
"defer to next leader command"
|
|
284
|
-
);
|
|
285
|
-
assert!(r.marker_written);
|
|
286
|
-
assert!(
|
|
287
|
-
ms.markers.contains_key("whole_team_gone"),
|
|
288
|
-
"durable marker named whole_team_gone"
|
|
289
|
-
);
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
#[test]
|
|
293
|
-
fn whole_team_gone_unexpected_marker_failure_reflected() {
|
|
294
|
-
// abnormal_track.py:146 — marker_written = bool(_marker_set(...)); 落盘失败 → false,
|
|
295
|
-
// 但仍 notify + escalate(分类不变)。
|
|
296
|
-
let snap = TeamPresenceSnapshot {
|
|
297
|
-
coordinator_alive: false,
|
|
298
|
-
leader_alive: false,
|
|
299
|
-
provider_processes_alive: vec![false],
|
|
300
|
-
tmux_sessions_present: false,
|
|
301
|
-
clean_shutdown: false,
|
|
302
|
-
restart_in_progress: false,
|
|
303
|
-
};
|
|
304
|
-
let mut ms = MapMarkerStore::failing();
|
|
305
|
-
let r = detect_whole_team_gone(&snap, &mut ms);
|
|
306
|
-
assert_eq!(r.classification, WholeTeamGoneClass::UnexpectedExit);
|
|
307
|
-
assert!(r.notify);
|
|
308
|
-
assert!(
|
|
309
|
-
!r.marker_written,
|
|
310
|
-
"marker set failed → marker_written false"
|
|
311
|
-
);
|
|
312
|
-
}
|