@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,269 +0,0 @@
|
|
|
1
|
-
//! ---
|
|
2
|
-
//! purpose: 把 restart resume 门的「为什么拒绝」从两个不透明字符串升级成闭合枚举,并携带操作者可用的恢复线索
|
|
3
|
-
//! contract:
|
|
4
|
-
//! provides:
|
|
5
|
-
//! - name: ResumeRefusalReason
|
|
6
|
-
//! what: resume 拒绝原因闭合枚举(7 变体),新原因必须改代码才能加
|
|
7
|
-
//! - name: wire
|
|
8
|
-
//! what: 枚举 → 历史 UnresumableWorker.reason 稳定串,供 JSON/日志沿用旧形状
|
|
9
|
-
//! - name: from_legacy
|
|
10
|
-
//! what: 历史字符串 → 枚举的逆映射,未识别串一律落进 Other{legacy_reason}
|
|
11
|
-
//! - name: RecoveryHint
|
|
12
|
-
//! what: 缺 backing 时给操作者的 provider/name/cwd 三元线索
|
|
13
|
-
//! - name: picker_hint
|
|
14
|
-
//! what: 把 RecoveryHint 渲染成一行人读文本
|
|
15
|
-
//! requires:
|
|
16
|
-
//! - name: std::path::PathBuf
|
|
17
|
-
//! what: checked_paths 与 spawn_cwd 的载体
|
|
18
|
-
//! boundary:
|
|
19
|
-
//! - 只做「原因的分类与措辞」:不探测 backing 是否存在,不读磁盘,不发事件
|
|
20
|
-
//! - RecoveryHint 只呈现给人,绝不被自动 resume 消费(自动恢复需 Layer 3 多键过滤+backing 复验)
|
|
21
|
-
//! - 判定 resume 是否可行的调用点在 lifecycle/restart,不在本文件
|
|
22
|
-
//! maturity: wired
|
|
23
|
-
//! ---
|
|
24
|
-
//!
|
|
25
|
-
//! unit-5 (Stage 2) — closed `ResumeRefusalReason` enum and recovery hints.
|
|
26
|
-
//!
|
|
27
|
-
//! Today the restart resume gate flattens every refusal into one of two
|
|
28
|
-
//! opaque strings:
|
|
29
|
-
//!
|
|
30
|
-
//! * `"no_persisted_session_id"` — no `session_id` in state
|
|
31
|
-
//! * `"session_unresumable"` — `session_id` set but backing missing
|
|
32
|
-
//! OR provider can't resume OR session
|
|
33
|
-
//! ambiguous (all collapsed to one string)
|
|
34
|
-
//!
|
|
35
|
-
//! That string is the user-facing diagnostic, so debugging "why did restart
|
|
36
|
-
//! refuse?" requires reading source. This unit replaces the catch-all
|
|
37
|
-
//! `session_unresumable` with a closed enum carrying the structured
|
|
38
|
-
//! distinction.
|
|
39
|
-
//!
|
|
40
|
-
//! Migration strategy: ADDITIVE. `UnresumableWorker.reason: String` stays
|
|
41
|
-
//! (every CLI/JSON caller already reads it). A new optional
|
|
42
|
-
//! `refusal_reason: Option<ResumeRefusalReason>` carries the structured
|
|
43
|
-
//! value alongside. Callers that need actionable diagnostics flip to the
|
|
44
|
-
//! enum; legacy callers see the same string they always saw.
|
|
45
|
-
|
|
46
|
-
use std::path::PathBuf;
|
|
47
|
-
|
|
48
|
-
/// Layer 2 self-healing hint (architect probe 2026-06-22, §Recommended
|
|
49
|
-
/// design): operator-facing diagnostic that names the agent / cwd /
|
|
50
|
-
/// provider for a missing-backing refusal so the operator can manually
|
|
51
|
-
/// find / repair the dropped session. Carried alongside the refusal —
|
|
52
|
-
/// NEVER consumed for automatic resume. Auto-recovery requires multi-key
|
|
53
|
-
/// filtering + backing revalidation (Layer 3 follow-up, see
|
|
54
|
-
/// `session.recovery.candidate_promoted` event design).
|
|
55
|
-
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
56
|
-
pub struct RecoveryHint {
|
|
57
|
-
/// Agent role label that was passed at launch as `--name` / `-n`
|
|
58
|
-
/// (Claude / Copilot). Codex has no launch-time name flag, so this
|
|
59
|
-
/// is `None` for Codex workers (probe verdict 2026-06-22).
|
|
60
|
-
pub provider_session_name_hint: Option<String>,
|
|
61
|
-
/// Spawn cwd recorded for the worker — the second key in the
|
|
62
|
-
/// "provider+cwd+name+updated_at" filter Layer 3 will require.
|
|
63
|
-
pub spawn_cwd: Option<PathBuf>,
|
|
64
|
-
/// Wire provider name (`codex` / `claude` / `claude_code` /
|
|
65
|
-
/// `copilot`). Used for picker hint string only.
|
|
66
|
-
pub provider: String,
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
impl RecoveryHint {
|
|
70
|
-
/// Build a human-readable picker hint (one line). Layer 2 surfaces
|
|
71
|
-
/// this in the CLI refusal message and in the
|
|
72
|
-
/// `session.recovery.candidate_hint` event payload.
|
|
73
|
-
/// ---
|
|
74
|
-
/// purpose: 把 provider/name/cwd 三元线索拼成一行人读文本,供 CLI 拒绝信息与事件载荷使用
|
|
75
|
-
/// returns: 四种措辞之一,按 name/cwd 各自是否存在退化;两者都缺时退到 "<provider> session"
|
|
76
|
-
/// contract:
|
|
77
|
-
/// provides:
|
|
78
|
-
/// - name: picker_hint
|
|
79
|
-
/// what: 纯格式化,不查磁盘、不校验 cwd 是否还在
|
|
80
|
-
/// boundary:
|
|
81
|
-
/// - 输出只给人看,不做机器解析的契约,调用方不得据此自动 resume
|
|
82
|
-
/// ---
|
|
83
|
-
pub fn picker_hint(&self) -> String {
|
|
84
|
-
match (&self.provider_session_name_hint, &self.spawn_cwd) {
|
|
85
|
-
(Some(name), Some(cwd)) => format!(
|
|
86
|
-
"{} session named '{}' under cwd {}",
|
|
87
|
-
self.provider,
|
|
88
|
-
name,
|
|
89
|
-
cwd.display()
|
|
90
|
-
),
|
|
91
|
-
(Some(name), None) => {
|
|
92
|
-
format!("{} session named '{}'", self.provider, name)
|
|
93
|
-
}
|
|
94
|
-
(None, Some(cwd)) => format!("{} session under cwd {}", self.provider, cwd.display()),
|
|
95
|
-
(None, None) => format!("{} session", self.provider),
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
/// Structured reason a worker is unresumable. Closed enum — future
|
|
101
|
-
/// reasons require a code change, which is the point.
|
|
102
|
-
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
103
|
-
pub enum ResumeRefusalReason {
|
|
104
|
-
/// State has no `session_id` for this worker. Fresh start would be
|
|
105
|
-
/// safe iff `--allow-fresh` is set.
|
|
106
|
-
NoSessionId,
|
|
107
|
-
/// State has `session_id` but the provider backing file (Codex rollout
|
|
108
|
-
/// JSONL / Claude transcript) is missing on disk. Distinct from
|
|
109
|
-
/// "no session" because it implies provider lost the backing.
|
|
110
|
-
SessionBackingStoreMissing {
|
|
111
|
-
/// Paths the runtime probed for the backing file.
|
|
112
|
-
checked_paths: Vec<PathBuf>,
|
|
113
|
-
/// Layer 2 self-healing diagnostic (architect probe 2026-06-22):
|
|
114
|
-
/// agent / cwd / provider hint the operator can use to find or
|
|
115
|
-
/// repair the dropped session via the provider's own picker
|
|
116
|
-
/// (`claude --resume <name>`, `copilot --resume=<name>`).
|
|
117
|
-
/// **Never auto-consumed for resume** — auto-recovery requires
|
|
118
|
-
/// the Layer 3 multi-key filter + backing revalidation contract.
|
|
119
|
-
recovery_hint: Option<RecoveryHint>,
|
|
120
|
-
},
|
|
121
|
-
/// Provider does not support resume at the protocol level (e.g.
|
|
122
|
-
/// some auth modes).
|
|
123
|
-
ProviderResumeUnsupported {
|
|
124
|
-
/// Provider name (`codex` / `claude` / `copilot` / `fake`).
|
|
125
|
-
provider: String,
|
|
126
|
-
},
|
|
127
|
-
/// Session capture polling did not converge before the deadline
|
|
128
|
-
/// (the existing `RefusedResumeNotReady` shape).
|
|
129
|
-
SessionCaptureIncomplete,
|
|
130
|
-
/// State session_id differs from the provider's observed session
|
|
131
|
-
/// (T6 L5.5 drift). Caller should reconcile before resuming.
|
|
132
|
-
SessionDrift { expected: String, actual: String },
|
|
133
|
-
/// The persisted provider backing exists, but the transcript itself
|
|
134
|
-
/// declares a different Team Agent worker identity.
|
|
135
|
-
SessionIdentityMismatch {
|
|
136
|
-
expected_agent_id: String,
|
|
137
|
-
embedded_agent_id: String,
|
|
138
|
-
session_id: String,
|
|
139
|
-
rollout_path: Option<PathBuf>,
|
|
140
|
-
},
|
|
141
|
-
/// Catch-all for refusals the structured shape hasn't taxonomized
|
|
142
|
-
/// yet. Carries the legacy free-form string. This variant exists so
|
|
143
|
-
/// the enum is BACKWARD-COMPATIBLE with the historical
|
|
144
|
-
/// `session_unresumable` string — every value the old code emitted
|
|
145
|
-
/// can be lifted into the enum without losing fidelity.
|
|
146
|
-
Other { legacy_reason: String },
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
impl ResumeRefusalReason {
|
|
150
|
-
/// Stable wire string mirroring the historical
|
|
151
|
-
/// `UnresumableWorker.reason` values. Use this when emitting JSON or
|
|
152
|
-
/// log fields so downstream consumers see the same strings they
|
|
153
|
-
/// always have.
|
|
154
|
-
/// ---
|
|
155
|
-
/// purpose: 把结构化拒绝原因压回历史 UnresumableWorker.reason 稳定串
|
|
156
|
-
/// returns: 六个 canonical 串之一;Other 一律折回 "session_unresumable"——未 taxonomize 的新失败类型对外与历史大杂烩不可区分
|
|
157
|
-
/// contract:
|
|
158
|
-
/// provides:
|
|
159
|
-
/// - name: wire
|
|
160
|
-
/// what: 枚举 → 稳定串的全函数映射,不丢字段但丢细节
|
|
161
|
-
/// boundary:
|
|
162
|
-
/// - 不携带 checked_paths / recovery_hint / drift 的 expected-actual 等负载,只给分类名
|
|
163
|
-
/// - 与 from_legacy 只在五个 canonical 串上互逆;SessionDrift 有 wire 串但 from_legacy 无对应臂,"session_drift" 会落进 Other,该变体不可往返
|
|
164
|
-
/// ---
|
|
165
|
-
pub fn wire(&self) -> &'static str {
|
|
166
|
-
match self {
|
|
167
|
-
ResumeRefusalReason::NoSessionId => "no_persisted_session_id",
|
|
168
|
-
ResumeRefusalReason::SessionBackingStoreMissing { .. } => {
|
|
169
|
-
"session_backing_store_missing"
|
|
170
|
-
}
|
|
171
|
-
ResumeRefusalReason::ProviderResumeUnsupported { .. } => "provider_resume_unsupported",
|
|
172
|
-
ResumeRefusalReason::SessionCaptureIncomplete => "session_capture_incomplete",
|
|
173
|
-
ResumeRefusalReason::SessionDrift { .. } => "session_drift",
|
|
174
|
-
ResumeRefusalReason::SessionIdentityMismatch { .. } => "session_identity_mismatch",
|
|
175
|
-
// For Other we still report the legacy wire so the existing
|
|
176
|
-
// `session_unresumable` JSON shape is preserved end-to-end.
|
|
177
|
-
ResumeRefusalReason::Other { .. } => "session_unresumable",
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
/// Lift a legacy free-form `reason` string into the structured enum.
|
|
182
|
-
/// Round-trip-safe with `wire()` for the canonical names.
|
|
183
|
-
/// ---
|
|
184
|
-
/// purpose: 把历史自由串抬升成结构化枚举,保证旧持久化数据不丢分类
|
|
185
|
-
/// params:
|
|
186
|
-
/// reason: 历史 UnresumableWorker.reason 串;不在识别表内的任意值都合法
|
|
187
|
-
/// returns: 匹配到的变体(负载字段一律填空,因为串里没有这些事实);未匹配则 Other{legacy_reason=原串}
|
|
188
|
-
/// contract:
|
|
189
|
-
/// provides:
|
|
190
|
-
/// - name: from_legacy
|
|
191
|
-
/// what: 全函数、不失败、不 panic 的逆映射
|
|
192
|
-
/// boundary:
|
|
193
|
-
/// - 不还原 checked_paths / recovery_hint / provider 名等负载——它们在串里本就不存在
|
|
194
|
-
/// - 识别表缺 "session_drift" 臂,该串会落到 Other 而非 SessionDrift
|
|
195
|
-
/// ---
|
|
196
|
-
pub fn from_legacy(reason: &str) -> Self {
|
|
197
|
-
match reason {
|
|
198
|
-
"no_persisted_session_id" => ResumeRefusalReason::NoSessionId,
|
|
199
|
-
"session_backing_store_missing" => ResumeRefusalReason::SessionBackingStoreMissing {
|
|
200
|
-
checked_paths: Vec::new(),
|
|
201
|
-
recovery_hint: None,
|
|
202
|
-
},
|
|
203
|
-
"provider_resume_unsupported" => ResumeRefusalReason::ProviderResumeUnsupported {
|
|
204
|
-
provider: String::new(),
|
|
205
|
-
},
|
|
206
|
-
"session_capture_incomplete" => ResumeRefusalReason::SessionCaptureIncomplete,
|
|
207
|
-
"session_identity_mismatch" => ResumeRefusalReason::SessionIdentityMismatch {
|
|
208
|
-
expected_agent_id: String::new(),
|
|
209
|
-
embedded_agent_id: String::new(),
|
|
210
|
-
session_id: String::new(),
|
|
211
|
-
rollout_path: None,
|
|
212
|
-
},
|
|
213
|
-
other => ResumeRefusalReason::Other {
|
|
214
|
-
legacy_reason: other.to_string(),
|
|
215
|
-
},
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
#[cfg(test)]
|
|
221
|
-
mod tests {
|
|
222
|
-
use super::*;
|
|
223
|
-
|
|
224
|
-
#[test]
|
|
225
|
-
fn wire_round_trip_canonical_strings() {
|
|
226
|
-
for wire in [
|
|
227
|
-
"no_persisted_session_id",
|
|
228
|
-
"session_backing_store_missing",
|
|
229
|
-
"provider_resume_unsupported",
|
|
230
|
-
"session_capture_incomplete",
|
|
231
|
-
"session_identity_mismatch",
|
|
232
|
-
] {
|
|
233
|
-
assert_eq!(ResumeRefusalReason::from_legacy(wire).wire(), wire);
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
#[test]
|
|
238
|
-
fn other_preserves_legacy_session_unresumable_wire() {
|
|
239
|
-
let r = ResumeRefusalReason::from_legacy("session_unresumable");
|
|
240
|
-
assert_eq!(r.wire(), "session_unresumable");
|
|
241
|
-
assert!(matches!(r, ResumeRefusalReason::Other { .. }));
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
// Layer 2 self-healing tests ────────────────────────────────────────────
|
|
245
|
-
|
|
246
|
-
#[test]
|
|
247
|
-
fn recovery_hint_picker_string_with_all_fields() {
|
|
248
|
-
let hint = RecoveryHint {
|
|
249
|
-
provider_session_name_hint: Some("coder".to_string()),
|
|
250
|
-
spawn_cwd: Some(PathBuf::from("/repo/team-a")),
|
|
251
|
-
provider: "claude".to_string(),
|
|
252
|
-
};
|
|
253
|
-
assert_eq!(
|
|
254
|
-
hint.picker_hint(),
|
|
255
|
-
"claude session named 'coder' under cwd /repo/team-a"
|
|
256
|
-
);
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
#[test]
|
|
260
|
-
fn recovery_hint_picker_string_no_name_no_cwd() {
|
|
261
|
-
// Codex worker — no launch-time name, spawn_cwd missing.
|
|
262
|
-
let hint = RecoveryHint {
|
|
263
|
-
provider_session_name_hint: None,
|
|
264
|
-
spawn_cwd: None,
|
|
265
|
-
provider: "codex".to_string(),
|
|
266
|
-
};
|
|
267
|
-
assert_eq!(hint.picker_hint(), "codex session");
|
|
268
|
-
}
|
|
269
|
-
}
|
|
@@ -1,316 +0,0 @@
|
|
|
1
|
-
use super::*;
|
|
2
|
-
|
|
3
|
-
#[derive(Default, Debug)]
|
|
4
|
-
struct EnumerationCounts {
|
|
5
|
-
directories: Vec<PathBuf>,
|
|
6
|
-
entries: usize,
|
|
7
|
-
following_metadata: usize,
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
thread_local! {
|
|
11
|
-
static ENUMERATION: std::cell::RefCell<EnumerationCounts> =
|
|
12
|
-
std::cell::RefCell::new(EnumerationCounts::default());
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
pub(super) fn record_directory_read(path: &Path) {
|
|
16
|
-
ENUMERATION.with(|counts| counts.borrow_mut().directories.push(path.to_path_buf()));
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
pub(super) fn record_entry() {
|
|
20
|
-
ENUMERATION.with(|counts| counts.borrow_mut().entries += 1);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
pub(super) fn record_following_metadata() {
|
|
24
|
-
ENUMERATION.with(|counts| counts.borrow_mut().following_metadata += 1);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
fn take_counts() -> EnumerationCounts {
|
|
28
|
-
ENUMERATION.with(|counts| std::mem::take(&mut *counts.borrow_mut()))
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// The previous traversal boundary, run only on the synthetic fixture. Count
|
|
32
|
-
// explicit metadata calls, not inferred OS syscalls or elapsed-time thresholds.
|
|
33
|
-
fn legacy_enumeration_counts(dir: &Path, depth: usize, counts: &mut EnumerationCounts) {
|
|
34
|
-
if depth > 4 {
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
counts.directories.push(dir.to_path_buf());
|
|
38
|
-
for entry in std::fs::read_dir(dir).unwrap() {
|
|
39
|
-
let path = entry.unwrap().path();
|
|
40
|
-
counts.entries += 1;
|
|
41
|
-
counts.following_metadata += 1;
|
|
42
|
-
if path.is_dir() {
|
|
43
|
-
legacy_enumeration_counts(&path, depth + 1, counts);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
fn temp_dir(name: &str) -> PathBuf {
|
|
49
|
-
static N: std::sync::atomic::AtomicU64 = std::sync::atomic::AtomicU64::new(0);
|
|
50
|
-
let n = N.fetch_add(1, std::sync::atomic::Ordering::Relaxed);
|
|
51
|
-
let dir =
|
|
52
|
-
std::env::temp_dir().join(format!("ta-session-scan-{name}-{}-{n}", std::process::id()));
|
|
53
|
-
std::fs::create_dir_all(&dir).expect("create temp dir");
|
|
54
|
-
dir
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
fn write_codex_rollout(path: &Path, cwd: &Path, session_id: &str, embedded_agent_id: &str) {
|
|
58
|
-
let text = format!(
|
|
59
|
-
"{{\"session_meta\":{{\"payload\":{{\"id\":\"{session_id}\",\"cwd\":\"{}\"}}}}}}\n\
|
|
60
|
-
{{\"type\":\"turn_context\",\"payload\":{{}}}}\n\
|
|
61
|
-
{{\"type\":\"response_item\",\"payload\":{{\"content\":[{{\"type\":\"input_text\",\"text\":\"You are Team Agent worker `{embedded_agent_id}` with role `fixture`.\"}}]}}}}\n",
|
|
62
|
-
cwd.to_string_lossy()
|
|
63
|
-
);
|
|
64
|
-
std::fs::write(path, text).expect("write codex rollout");
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
#[test]
|
|
68
|
-
fn codex_prompt_worker_identity_is_a_positive_match() {
|
|
69
|
-
let dir = temp_dir("positive");
|
|
70
|
-
let rollout = dir.join("rollout-frontend.jsonl");
|
|
71
|
-
write_codex_rollout(&rollout, &dir, "sess-frontend", "frontend");
|
|
72
|
-
let context = CaptureSessionContext {
|
|
73
|
-
agent_id: "frontend".to_string(),
|
|
74
|
-
spawn_cwd: dir.clone(),
|
|
75
|
-
pane_id: None,
|
|
76
|
-
pane_pid: None,
|
|
77
|
-
spawned_at: None,
|
|
78
|
-
expected_session_id: None,
|
|
79
|
-
provider_projects_root: None,
|
|
80
|
-
};
|
|
81
|
-
let candidates = parse_candidate_files(
|
|
82
|
-
Provider::Codex,
|
|
83
|
-
&context,
|
|
84
|
-
vec![SessionCandidate {
|
|
85
|
-
path: rollout.clone(),
|
|
86
|
-
requires_cwd_match: false,
|
|
87
|
-
}],
|
|
88
|
-
);
|
|
89
|
-
assert_eq!(candidates.len(), 1);
|
|
90
|
-
assert!(candidates[0].positive_agent_id_match);
|
|
91
|
-
let _ = std::fs::remove_dir_all(&dir);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
#[test]
|
|
95
|
-
fn codex_identity_in_incomplete_final_head_record_is_positive() {
|
|
96
|
-
let dir = temp_dir("cross-cap-positive");
|
|
97
|
-
let rollout = dir.join("rollout-worker-a.jsonl");
|
|
98
|
-
let meta = format!(
|
|
99
|
-
"{{\"session_meta\":{{\"payload\":{{\"id\":\"sess-worker-a\",\"cwd\":\"{}\"}}}}}}\n",
|
|
100
|
-
dir.to_string_lossy()
|
|
101
|
-
);
|
|
102
|
-
let marker = "You are Team Agent worker `worker-a` with role `fixture`.";
|
|
103
|
-
let body = format!("{meta}{{\"text\":\"{marker}{}\"}}\n", "x".repeat(70_000));
|
|
104
|
-
std::fs::write(&rollout, body).expect("write cross-cap rollout");
|
|
105
|
-
assert!(!read_head_text(&rollout, CAPTURE_HEAD_BYTES)
|
|
106
|
-
.expect("read complete records")
|
|
107
|
-
.contains(marker));
|
|
108
|
-
let context = CaptureSessionContext {
|
|
109
|
-
agent_id: "worker-a".to_string(),
|
|
110
|
-
spawn_cwd: dir.clone(),
|
|
111
|
-
pane_id: None,
|
|
112
|
-
pane_pid: None,
|
|
113
|
-
spawned_at: None,
|
|
114
|
-
expected_session_id: None,
|
|
115
|
-
provider_projects_root: None,
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
let candidates = parse_candidate_files(
|
|
119
|
-
Provider::Codex,
|
|
120
|
-
&context,
|
|
121
|
-
vec![SessionCandidate {
|
|
122
|
-
path: rollout,
|
|
123
|
-
requires_cwd_match: false,
|
|
124
|
-
}],
|
|
125
|
-
);
|
|
126
|
-
|
|
127
|
-
assert_eq!(candidates.len(), 1);
|
|
128
|
-
assert_eq!(candidates[0].embedded_agent_id.as_deref(), Some("worker-a"));
|
|
129
|
-
assert!(candidates[0].positive_agent_id_match);
|
|
130
|
-
let _ = std::fs::remove_dir_all(&dir);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
#[test]
|
|
134
|
-
fn codex_prompt_worker_identity_mismatch_is_rejected_for_that_agent() {
|
|
135
|
-
let dir = temp_dir("mismatch");
|
|
136
|
-
let rollout = dir.join("rollout-ios-dev.jsonl");
|
|
137
|
-
write_codex_rollout(&rollout, &dir, "sess-ios-dev", "ios-dev");
|
|
138
|
-
let context = CaptureSessionContext {
|
|
139
|
-
agent_id: "frontend".to_string(),
|
|
140
|
-
spawn_cwd: dir.clone(),
|
|
141
|
-
pane_id: None,
|
|
142
|
-
pane_pid: None,
|
|
143
|
-
spawned_at: None,
|
|
144
|
-
expected_session_id: None,
|
|
145
|
-
provider_projects_root: None,
|
|
146
|
-
};
|
|
147
|
-
let candidates = parse_candidate_files(
|
|
148
|
-
Provider::Codex,
|
|
149
|
-
&context,
|
|
150
|
-
vec![SessionCandidate {
|
|
151
|
-
path: rollout,
|
|
152
|
-
requires_cwd_match: false,
|
|
153
|
-
}],
|
|
154
|
-
);
|
|
155
|
-
assert!(candidates.is_empty());
|
|
156
|
-
let _ = std::fs::remove_dir_all(&dir);
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
#[test]
|
|
160
|
-
fn repeated_wide_directory_scans_remove_leaf_metadata_without_hiding_new_files() {
|
|
161
|
-
let dir = temp_dir("wide-discovery");
|
|
162
|
-
for group in 0..4 {
|
|
163
|
-
let child = dir.join("source").join(format!("group-{group}"));
|
|
164
|
-
std::fs::create_dir_all(&child).unwrap();
|
|
165
|
-
for index in 0..128 {
|
|
166
|
-
std::fs::write(child.join(format!("code-{index}.rs")), "").unwrap();
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
for _ in 0..2 {
|
|
170
|
-
let mut before = EnumerationCounts::default();
|
|
171
|
-
legacy_enumeration_counts(&dir, 0, &mut before);
|
|
172
|
-
assert_eq!((before.directories.len(), before.entries), (6, 517));
|
|
173
|
-
assert_eq!(before.following_metadata, 517);
|
|
174
|
-
|
|
175
|
-
take_counts();
|
|
176
|
-
let mut candidates = Vec::new();
|
|
177
|
-
collect_candidate_files(&dir, "worker", 0, false, None, &mut candidates).unwrap();
|
|
178
|
-
let after = take_counts();
|
|
179
|
-
assert!(candidates.is_empty());
|
|
180
|
-
assert_eq!((after.directories.len(), after.entries), (6, 517));
|
|
181
|
-
assert_eq!(after.following_metadata, 0);
|
|
182
|
-
}
|
|
183
|
-
// No .team subtree is needed to reproduce the redundant metadata work.
|
|
184
|
-
// A negative scan must not suppress a later file in the same nested cwd.
|
|
185
|
-
let rollout = dir.join("source/group-3/rollout-worker.jsonl");
|
|
186
|
-
write_codex_rollout(&rollout, &dir, "late-worker", "worker");
|
|
187
|
-
let mut candidates = Vec::new();
|
|
188
|
-
collect_candidate_files(&dir, "worker", 0, false, None, &mut candidates).unwrap();
|
|
189
|
-
let after = take_counts();
|
|
190
|
-
assert_eq!((after.directories.len(), after.entries), (6, 518));
|
|
191
|
-
assert_eq!(after.following_metadata, 0);
|
|
192
|
-
assert_eq!(candidates.len(), 1);
|
|
193
|
-
assert_eq!(candidates[0].path, rollout);
|
|
194
|
-
assert!(!candidates[0].requires_cwd_match);
|
|
195
|
-
std::fs::remove_dir_all(dir).unwrap();
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
#[test]
|
|
199
|
-
fn team_subtrees_are_pruned_before_enumeration_but_claude_root_and_ancestors_survive() {
|
|
200
|
-
let dir = temp_dir("team-pruning");
|
|
201
|
-
let allowed = dir.join(".team/runtime/claude/projects");
|
|
202
|
-
let owned = allowed.join("cwd/owned.jsonl");
|
|
203
|
-
let unrelated = dir.join(".team/artifacts/deep/ignored.jsonl");
|
|
204
|
-
let sibling = dir.join(".team/runtime/other/ignored.jsonl");
|
|
205
|
-
for path in [&owned, &unrelated, &sibling] {
|
|
206
|
-
std::fs::create_dir_all(path.parent().unwrap()).unwrap();
|
|
207
|
-
std::fs::write(path, "{}").unwrap();
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
let mut before = EnumerationCounts::default();
|
|
211
|
-
legacy_enumeration_counts(&dir, 0, &mut before);
|
|
212
|
-
assert_eq!((before.directories.len(), before.entries), (8, 10));
|
|
213
|
-
assert_eq!(before.following_metadata, 10);
|
|
214
|
-
|
|
215
|
-
take_counts();
|
|
216
|
-
let mut candidates = Vec::new();
|
|
217
|
-
collect_candidate_files(&dir, "worker", 0, false, None, &mut candidates).unwrap();
|
|
218
|
-
let counts = take_counts();
|
|
219
|
-
assert!(candidates.is_empty());
|
|
220
|
-
assert_eq!(counts.directories, vec![dir.clone()]);
|
|
221
|
-
assert_eq!((counts.entries, counts.following_metadata), (1, 0));
|
|
222
|
-
|
|
223
|
-
// Starting at the runtime ancestor must reach the explicit Claude root,
|
|
224
|
-
// while siblings inside .team remain excluded before read_dir.
|
|
225
|
-
let ancestor = dir.join(".team");
|
|
226
|
-
collect_candidate_files(&ancestor, "worker", 0, true, Some(&allowed), &mut candidates)
|
|
227
|
-
.unwrap();
|
|
228
|
-
let counts = take_counts();
|
|
229
|
-
assert_eq!(counts.directories.len(), 5);
|
|
230
|
-
assert_eq!((counts.entries, counts.following_metadata), (7, 0));
|
|
231
|
-
assert!(!counts
|
|
232
|
-
.directories
|
|
233
|
-
.iter()
|
|
234
|
-
.any(|path| path.starts_with(dir.join(".team/artifacts"))));
|
|
235
|
-
assert!(!counts
|
|
236
|
-
.directories
|
|
237
|
-
.iter()
|
|
238
|
-
.any(|path| path.starts_with(dir.join(".team/runtime/other"))));
|
|
239
|
-
assert_eq!(candidates.len(), 1);
|
|
240
|
-
assert_eq!(candidates[0].path, owned);
|
|
241
|
-
assert!(candidates[0].requires_cwd_match);
|
|
242
|
-
|
|
243
|
-
candidates.clear();
|
|
244
|
-
collect_optional_candidate_files(&allowed, "worker", Some(&allowed), &mut candidates)
|
|
245
|
-
.unwrap();
|
|
246
|
-
assert_eq!(take_counts().directories.len(), 2);
|
|
247
|
-
assert_eq!(candidates.len(), 1);
|
|
248
|
-
std::fs::remove_dir_all(dir).unwrap();
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
#[test]
|
|
252
|
-
fn traversal_keeps_depth_limit_and_required_root_errors() {
|
|
253
|
-
let dir = temp_dir("depth-limit");
|
|
254
|
-
let at_limit = dir.join("one/two/three/four/at-limit.jsonl");
|
|
255
|
-
let beyond = dir.join("one/two/three/four/five/beyond.jsonl");
|
|
256
|
-
std::fs::create_dir_all(beyond.parent().unwrap()).unwrap();
|
|
257
|
-
std::fs::write(&at_limit, "{}").unwrap();
|
|
258
|
-
std::fs::write(&beyond, "{}").unwrap();
|
|
259
|
-
take_counts();
|
|
260
|
-
let mut candidates = Vec::new();
|
|
261
|
-
collect_candidate_files(&dir, "worker", 0, false, None, &mut candidates).unwrap();
|
|
262
|
-
let counts = take_counts();
|
|
263
|
-
assert_eq!(counts.directories.len(), 5);
|
|
264
|
-
assert_eq!(counts.following_metadata, 0);
|
|
265
|
-
assert_eq!(candidates.len(), 1);
|
|
266
|
-
assert_eq!(candidates[0].path, at_limit);
|
|
267
|
-
assert!(collect_candidate_files(
|
|
268
|
-
&dir.join("missing"),
|
|
269
|
-
"worker",
|
|
270
|
-
0,
|
|
271
|
-
false,
|
|
272
|
-
None,
|
|
273
|
-
&mut Vec::new()
|
|
274
|
-
)
|
|
275
|
-
.is_err());
|
|
276
|
-
assert!(collect_optional_candidate_files(
|
|
277
|
-
&dir.join("missing"),
|
|
278
|
-
"worker",
|
|
279
|
-
None,
|
|
280
|
-
&mut Vec::new()
|
|
281
|
-
)
|
|
282
|
-
.is_ok());
|
|
283
|
-
std::fs::remove_dir_all(dir).unwrap();
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
#[test]
|
|
287
|
-
#[cfg(unix)]
|
|
288
|
-
fn symlink_files_directories_and_cycles_keep_following_metadata_and_depth_semantics() {
|
|
289
|
-
use std::os::unix::fs::symlink;
|
|
290
|
-
let dir = temp_dir("symlink-discovery");
|
|
291
|
-
let target = dir.join("target");
|
|
292
|
-
std::fs::create_dir(&target).unwrap();
|
|
293
|
-
std::fs::write(target.join("session.jsonl"), "{}").unwrap();
|
|
294
|
-
symlink(&target, dir.join("linked-dir")).unwrap();
|
|
295
|
-
symlink(target.join("session.jsonl"), dir.join("linked-file.jsonl")).unwrap();
|
|
296
|
-
symlink(dir.join("absent"), dir.join("dangling.jsonl")).unwrap();
|
|
297
|
-
symlink(&target, target.join("cycle")).unwrap();
|
|
298
|
-
take_counts();
|
|
299
|
-
let mut candidates = Vec::new();
|
|
300
|
-
collect_candidate_files(&dir, "worker", 0, false, None, &mut candidates).unwrap();
|
|
301
|
-
let counts = take_counts();
|
|
302
|
-
assert_eq!(counts.directories.len(), 9);
|
|
303
|
-
assert_eq!(counts.entries, 20);
|
|
304
|
-
assert_eq!(counts.following_metadata, 11);
|
|
305
|
-
assert_eq!(candidates.len(), 10);
|
|
306
|
-
assert!(candidates
|
|
307
|
-
.iter()
|
|
308
|
-
.any(|item| item.path == dir.join("linked-file.jsonl")));
|
|
309
|
-
assert!(candidates
|
|
310
|
-
.iter()
|
|
311
|
-
.any(|item| item.path == dir.join("linked-dir/session.jsonl")));
|
|
312
|
-
assert!(candidates
|
|
313
|
-
.iter()
|
|
314
|
-
.any(|item| item.path == dir.join("dangling.jsonl")));
|
|
315
|
-
std::fs::remove_dir_all(dir).unwrap();
|
|
316
|
-
}
|