@team-agent/installer 0.5.128 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/README.zh.md +1 -1
- package/package.json +4 -8
- package/skills/team-agent/SKILL.md +37 -20
- package/skills/team-agent/command-coverage.json +169 -183
- package/skills/team-agent/docs/reference/team-agent-operator.md +64 -30
- package/skills/team-agent/references/recovery-runbook.md +1 -1
- package/skills/team-agent/references/team-agent-operator.md +64 -30
- package/templates/team_state.md +1 -1
- package/Cargo.lock +0 -1063
- package/Cargo.toml +0 -36
- package/crates/team-agent/Cargo.toml +0 -69
- package/crates/team-agent/src/app_server_test_support.rs +0 -258
- package/crates/team-agent/src/cli/adapters.rs +0 -1288
- package/crates/team-agent/src/cli/arguments.rs +0 -405
- package/crates/team-agent/src/cli/attach_app_server_leader.rs +0 -98
- package/crates/team-agent/src/cli/diagnose.rs +0 -1721
- package/crates/team-agent/src/cli/emit.rs +0 -2930
- package/crates/team-agent/src/cli/grok_slot.rs +0 -384
- package/crates/team-agent/src/cli/helpers.rs +0 -91
- package/crates/team-agent/src/cli/intent/runtime.rs +0 -1216
- package/crates/team-agent/src/cli/intent/runtime_tests.rs +0 -912
- package/crates/team-agent/src/cli/intent/tests.rs +0 -689
- package/crates/team-agent/src/cli/intent.rs +0 -664
- package/crates/team-agent/src/cli/leader.rs +0 -300
- package/crates/team-agent/src/cli/leader_prompt.rs +0 -261
- package/crates/team-agent/src/cli/leaders.rs +0 -418
- package/crates/team-agent/src/cli/mod.rs +0 -6545
- package/crates/team-agent/src/cli/models.rs +0 -1206
- package/crates/team-agent/src/cli/named_address.rs +0 -1651
- package/crates/team-agent/src/cli/profile.rs +0 -342
- package/crates/team-agent/src/cli/route.rs +0 -212
- package/crates/team-agent/src/cli/schedule.rs +0 -175
- package/crates/team-agent/src/cli/send/coordinator.rs +0 -164
- package/crates/team-agent/src/cli/send/mailbox.rs +0 -145
- package/crates/team-agent/src/cli/send/persist.rs +0 -156
- package/crates/team-agent/src/cli/send/presentation.rs +0 -370
- package/crates/team-agent/src/cli/send/resolve.rs +0 -573
- package/crates/team-agent/src/cli/send.rs +0 -199
- package/crates/team-agent/src/cli/shutdown_socket.rs +0 -288
- package/crates/team-agent/src/cli/spec.rs +0 -165
- package/crates/team-agent/src/cli/status.rs +0 -280
- package/crates/team-agent/src/cli/status_port/agents.rs +0 -358
- package/crates/team-agent/src/cli/status_port/approvals.rs +0 -79
- package/crates/team-agent/src/cli/status_port/brief.rs +0 -1981
- package/crates/team-agent/src/cli/status_port/compact.rs +0 -240
- package/crates/team-agent/src/cli/status_port/format.rs +0 -146
- package/crates/team-agent/src/cli/status_port/inbox.rs +0 -62
- package/crates/team-agent/src/cli/status_port/runtime.rs +0 -197
- package/crates/team-agent/src/cli/status_port/snapshot.rs +0 -208
- package/crates/team-agent/src/cli/status_port/store.rs +0 -416
- package/crates/team-agent/src/cli/status_port/tests.rs +0 -90
- package/crates/team-agent/src/cli/status_port.rs +0 -92
- package/crates/team-agent/src/cli/tests/base.rs +0 -885
- package/crates/team-agent/src/cli/tests/divergence.rs +0 -518
- package/crates/team-agent/src/cli/tests/lane_c.rs +0 -453
- package/crates/team-agent/src/cli/tests/leader_watch.rs +0 -322
- package/crates/team-agent/src/cli/tests/main_preserved.rs +0 -430
- package/crates/team-agent/src/cli/tests/missing_subcommands.rs +0 -336
- package/crates/team-agent/src/cli/tests/mod.rs +0 -137
- package/crates/team-agent/src/cli/tests/named_address.rs +0 -761
- package/crates/team-agent/src/cli/tests/parser_safety.rs +0 -383
- package/crates/team-agent/src/cli/tests/run_delegation.rs +0 -484
- package/crates/team-agent/src/cli/tests/shutdown_kill_plan.rs +0 -2179
- package/crates/team-agent/src/cli/tests/status_brief.rs +0 -1514
- package/crates/team-agent/src/cli/tests/status_send.rs +0 -888
- package/crates/team-agent/src/cli/tests/verb_install_skill.rs +0 -93
- package/crates/team-agent/src/cli/tests/verb_profile.rs +0 -392
- package/crates/team-agent/src/cli/triage.rs +0 -234
- package/crates/team-agent/src/cli/types.rs +0 -591
- package/crates/team-agent/src/codex_app_server.rs +0 -546
- package/crates/team-agent/src/communication_mode/mod.rs +0 -56
- package/crates/team-agent/src/compiler/tests.rs +0 -827
- package/crates/team-agent/src/compiler.rs +0 -890
- package/crates/team-agent/src/conpty/backend.rs +0 -829
- package/crates/team-agent/src/conpty/mod.rs +0 -33
- package/crates/team-agent/src/contract_runtime/backend.rs +0 -1744
- package/crates/team-agent/src/contract_runtime/commands.rs +0 -671
- package/crates/team-agent/src/contract_runtime/config.rs +0 -364
- package/crates/team-agent/src/contract_runtime/config_tests.rs +0 -76
- package/crates/team-agent/src/contract_runtime/discovery.rs +0 -449
- package/crates/team-agent/src/contract_runtime/fork.rs +0 -361
- package/crates/team-agent/src/contract_runtime/forward.rs +0 -288
- package/crates/team-agent/src/contract_runtime/framework.rs +0 -367
- package/crates/team-agent/src/contract_runtime/mcp.rs +0 -394
- package/crates/team-agent/src/contract_runtime/mod.rs +0 -17
- package/crates/team-agent/src/contract_runtime/prompt.rs +0 -216
- package/crates/team-agent/src/contract_runtime/pump.rs +0 -271
- package/crates/team-agent/src/contract_runtime/registry.rs +0 -553
- package/crates/team-agent/src/contract_runtime/workspace.rs +0 -228
- package/crates/team-agent/src/coordinator/backoff.rs +0 -741
- package/crates/team-agent/src/coordinator/conpty_shim.rs +0 -805
- package/crates/team-agent/src/coordinator/health.rs +0 -1185
- package/crates/team-agent/src/coordinator/mod.rs +0 -119
- package/crates/team-agent/src/coordinator/orphan.rs +0 -110
- package/crates/team-agent/src/coordinator/runtime_detectors.rs +0 -798
- package/crates/team-agent/src/coordinator/runtime_observation.rs +0 -84
- package/crates/team-agent/src/coordinator/steps/abnormal.rs +0 -2309
- package/crates/team-agent/src/coordinator/steps/delivery.rs +0 -15
- package/crates/team-agent/src/coordinator/steps/health_sync.rs +0 -15
- package/crates/team-agent/src/coordinator/steps/mod.rs +0 -126
- package/crates/team-agent/src/coordinator/steps/persist.rs +0 -15
- package/crates/team-agent/src/coordinator/steps/runtime_prompts.rs +0 -15
- package/crates/team-agent/src/coordinator/steps/session_gate.rs +0 -16
- package/crates/team-agent/src/coordinator/tests/a0_lostupdate.rs +0 -158
- package/crates/team-agent/src/coordinator/tests/abnormal.rs +0 -312
- package/crates/team-agent/src/coordinator/tests/api_error_recovery.rs +0 -300
- package/crates/team-agent/src/coordinator/tests/basics.rs +0 -211
- package/crates/team-agent/src/coordinator/tests/daemon.rs +0 -514
- package/crates/team-agent/src/coordinator/tests/energy.rs +0 -549
- package/crates/team-agent/src/coordinator/tests/health_sync.rs +0 -503
- package/crates/team-agent/src/coordinator/tests/main_preserved.rs +0 -186
- package/crates/team-agent/src/coordinator/tests/mod.rs +0 -295
- package/crates/team-agent/src/coordinator/tests/s3_bounded.rs +0 -207
- package/crates/team-agent/src/coordinator/tests/spine.rs +0 -308
- package/crates/team-agent/src/coordinator/tests/takeover.rs +0 -286
- package/crates/team-agent/src/coordinator/tests/tick_core.rs +0 -237
- package/crates/team-agent/src/coordinator/tick.rs +0 -3024
- package/crates/team-agent/src/coordinator/types.rs +0 -540
- package/crates/team-agent/src/db/agent_health_capture.rs +0 -126
- package/crates/team-agent/src/db/message_store.rs +0 -1527
- package/crates/team-agent/src/db/migration.rs +0 -984
- package/crates/team-agent/src/db/mod.rs +0 -26
- package/crates/team-agent/src/db/schema.rs +0 -663
- package/crates/team-agent/src/diagnose/comms.rs +0 -242
- package/crates/team-agent/src/diagnose/mod.rs +0 -44
- package/crates/team-agent/src/diagnose/orphans.rs +0 -889
- package/crates/team-agent/src/direct_delivery.rs +0 -368
- package/crates/team-agent/src/event_log.rs +0 -502
- package/crates/team-agent/src/fake_worker.rs +0 -303
- package/crates/team-agent/src/inbox_store.rs +0 -169
- package/crates/team-agent/src/kill_audit.rs +0 -106
- package/crates/team-agent/src/layout/manager.rs +0 -248
- package/crates/team-agent/src/layout/mod.rs +0 -36
- package/crates/team-agent/src/layout/overlay.rs +0 -134
- package/crates/team-agent/src/layout/placement.rs +0 -52
- package/crates/team-agent/src/layout/recovery.rs +0 -106
- package/crates/team-agent/src/layout/runtime_sessions.rs +0 -317
- package/crates/team-agent/src/layout/sessions.rs +0 -294
- package/crates/team-agent/src/layout/tmux_endpoint.rs +0 -165
- package/crates/team-agent/src/layout/worker_env.rs +0 -721
- package/crates/team-agent/src/layout/worker_window_helpers.rs +0 -37
- package/crates/team-agent/src/leader/helpers.rs +0 -178
- package/crates/team-agent/src/leader/incident.rs +0 -6
- package/crates/team-agent/src/leader/lease.rs +0 -3356
- package/crates/team-agent/src/leader/mod.rs +0 -104
- package/crates/team-agent/src/leader/owner_bind.rs +0 -400
- package/crates/team-agent/src/leader/prompt.rs +0 -905
- package/crates/team-agent/src/leader/provider_attribution.rs +0 -247
- package/crates/team-agent/src/leader/rediscover/tests.rs +0 -689
- package/crates/team-agent/src/leader/rediscover.rs +0 -1192
- package/crates/team-agent/src/leader/registry.rs +0 -888
- package/crates/team-agent/src/leader/start.rs +0 -4501
- package/crates/team-agent/src/leader/takeover.rs +0 -65
- package/crates/team-agent/src/leader/tests/basics.rs +0 -337
- package/crates/team-agent/src/leader/tests/byte_findings.rs +0 -355
- package/crates/team-agent/src/leader/tests/claim_leader_mailbox_flush_contract.rs +0 -544
- package/crates/team-agent/src/leader/tests/historical_inventory_upgrade_gate_red.rs +0 -624
- package/crates/team-agent/src/leader/tests/identity.rs +0 -465
- package/crates/team-agent/src/leader/tests/identity_session_names.rs +0 -42
- package/crates/team-agent/src/leader/tests/idle.rs +0 -113
- package/crates/team-agent/src/leader/tests/lease_api.rs +0 -520
- package/crates/team-agent/src/leader/tests/lease_claim.rs +0 -629
- package/crates/team-agent/src/leader/tests/mod.rs +0 -106
- package/crates/team-agent/src/leader/tests/prompt_contract.rs +0 -268
- package/crates/team-agent/src/leader/tests/rediscover.rs +0 -403
- package/crates/team-agent/src/leader/tests/rehomed_env.rs +0 -83
- package/crates/team-agent/src/leader/tests/team_in_team_state_scope_red.rs +0 -1273
- package/crates/team-agent/src/leader/tests/terminal_and_replay_vs_rerender_invariants_red.rs +0 -417
- package/crates/team-agent/src/leader/tests/wake_start_owner.rs +0 -168
- package/crates/team-agent/src/leader/types.rs +0 -534
- package/crates/team-agent/src/lib.rs +0 -147
- package/crates/team-agent/src/lifecycle/helpers.rs +0 -212
- package/crates/team-agent/src/lifecycle/launch/add_agent.rs +0 -881
- package/crates/team-agent/src/lifecycle/launch/add_agent_state.rs +0 -598
- package/crates/team-agent/src/lifecycle/launch/agent_state.rs +0 -332
- package/crates/team-agent/src/lifecycle/launch/clone_agent.rs +0 -204
- package/crates/team-agent/src/lifecycle/launch/fork_agent.rs +0 -107
- package/crates/team-agent/src/lifecycle/launch/fork_entry.rs +0 -144
- package/crates/team-agent/src/lifecycle/launch/identity.rs +0 -674
- package/crates/team-agent/src/lifecycle/launch/layout.rs +0 -350
- package/crates/team-agent/src/lifecycle/launch/leader_context.rs +0 -589
- package/crates/team-agent/src/lifecycle/launch/mcp_config.rs +0 -160
- package/crates/team-agent/src/lifecycle/launch/ownership.rs +0 -105
- package/crates/team-agent/src/lifecycle/launch/pi_mcp.rs +0 -899
- package/crates/team-agent/src/lifecycle/launch/pi_mcp_extension.js +0 -225
- package/crates/team-agent/src/lifecycle/launch/plan.rs +0 -269
- package/crates/team-agent/src/lifecycle/launch/quick_start.rs +0 -5200
- package/crates/team-agent/src/lifecycle/launch/quick_start_transport.rs +0 -368
- package/crates/team-agent/src/lifecycle/launch/readiness.rs +0 -519
- package/crates/team-agent/src/lifecycle/launch/role_source.rs +0 -287
- package/crates/team-agent/src/lifecycle/launch/spawn.rs +0 -473
- package/crates/team-agent/src/lifecycle/launch/spec_state.rs +0 -801
- package/crates/team-agent/src/lifecycle/launch/state_projection.rs +0 -624
- package/crates/team-agent/src/lifecycle/launch/worker_env.rs +0 -558
- package/crates/team-agent/src/lifecycle/launch.rs +0 -557
- package/crates/team-agent/src/lifecycle/lock.rs +0 -350
- package/crates/team-agent/src/lifecycle/mod.rs +0 -79
- package/crates/team-agent/src/lifecycle/pane_input_lock.rs +0 -239
- package/crates/team-agent/src/lifecycle/profile_launch.rs +0 -1067
- package/crates/team-agent/src/lifecycle/profile_smoke.rs +0 -557
- package/crates/team-agent/src/lifecycle/restart/agent.rs +0 -2199
- package/crates/team-agent/src/lifecycle/restart/avatar.rs +0 -1798
- package/crates/team-agent/src/lifecycle/restart/claude_fork.rs +0 -163
- package/crates/team-agent/src/lifecycle/restart/common.rs +0 -2362
- package/crates/team-agent/src/lifecycle/restart/orchestrator.rs +0 -65
- package/crates/team-agent/src/lifecycle/restart/preflight.rs +0 -113
- package/crates/team-agent/src/lifecycle/restart/rebuild.rs +0 -5135
- package/crates/team-agent/src/lifecycle/restart/remove.rs +0 -1504
- package/crates/team-agent/src/lifecycle/restart/selection.rs +0 -559
- package/crates/team-agent/src/lifecycle/restart/team_state.rs +0 -329
- package/crates/team-agent/src/lifecycle/restart.rs +0 -227
- package/crates/team-agent/src/lifecycle/role_config.rs +0 -1230
- package/crates/team-agent/src/lifecycle/tests/acceptance_b_batch_red.rs +0 -1021
- package/crates/team-agent/src/lifecycle/tests/agent_ops.rs +0 -1205
- package/crates/team-agent/src/lifecycle/tests/b0_legacy_snapshot_nonauthority_contract.rs +0 -265
- package/crates/team-agent/src/lifecycle/tests/b0_reader_hideone_audit_contract.rs +0 -490
- package/crates/team-agent/src/lifecycle/tests/behavioral_diff_264_red.rs +0 -656
- package/crates/team-agent/src/lifecycle/tests/claude_compatible_config_red.rs +0 -325
- package/crates/team-agent/src/lifecycle/tests/claude_profile_launch_red.rs +0 -447
- package/crates/team-agent/src/lifecycle/tests/cli_argv_routing_red.rs +0 -1638
- package/crates/team-agent/src/lifecycle/tests/clone_agent_preserves_source_tools.rs +0 -427
- package/crates/team-agent/src/lifecycle/tests/clone_fork_copilot_perms_red.rs +0 -770
- package/crates/team-agent/src/lifecycle/tests/communication_mode_runtime_contract_red.rs +0 -419
- package/crates/team-agent/src/lifecycle/tests/copilot_provider_red.rs +0 -2035
- package/crates/team-agent/src/lifecycle/tests/core.rs +0 -1327
- package/crates/team-agent/src/lifecycle/tests/f032_startup_prompt_best_effort_red.rs +0 -315
- package/crates/team-agent/src/lifecycle/tests/fixtures/pi_list_models_g0.stdout.txt +0 -222
- package/crates/team-agent/src/lifecycle/tests/fixtures/pi_list_models_spaced_ids.stdout.txt +0 -9
- package/crates/team-agent/src/lifecycle/tests/fixtures/pi_native_mcp_host.mjs +0 -72
- package/crates/team-agent/src/lifecycle/tests/gate_fixtures.rs +0 -562
- package/crates/team-agent/src/lifecycle/tests/grok_require_explicit_model_red.rs +0 -110
- package/crates/team-agent/src/lifecycle/tests/harvest2_a_batch_red.rs +0 -512
- package/crates/team-agent/src/lifecycle/tests/host_cotenant_death_p0_contract.rs +0 -921
- package/crates/team-agent/src/lifecycle/tests/issue238_codex_effort_contract.rs +0 -68
- package/crates/team-agent/src/lifecycle/tests/lane_ops.rs +0 -1851
- package/crates/team-agent/src/lifecycle/tests/launch_spawn.rs +0 -3983
- package/crates/team-agent/src/lifecycle/tests/lifecycle_lock.rs +0 -339
- package/crates/team-agent/src/lifecycle/tests/lifecycle_rollback_red.rs +0 -596
- package/crates/team-agent/src/lifecycle/tests/main_preserved.rs +0 -513
- package/crates/team-agent/src/lifecycle/tests/mcp_tool_name_format_red.rs +0 -69
- package/crates/team-agent/src/lifecycle/tests/phase_b_contracts.rs +0 -824
- package/crates/team-agent/src/lifecycle/tests/phase_golden.rs +0 -723
- package/crates/team-agent/src/lifecycle/tests/pi_catalog_red.rs +0 -164
- package/crates/team-agent/src/lifecycle/tests/pi_command_red.rs +0 -200
- package/crates/team-agent/src/lifecycle/tests/pi_compiler_red.rs +0 -210
- package/crates/team-agent/src/lifecycle/tests/pi_dual_entry_red.rs +0 -527
- package/crates/team-agent/src/lifecycle/tests/pi_executable_mcp_red.rs +0 -1062
- package/crates/team-agent/src/lifecycle/tests/pi_fork_session_inheritance_red.rs +0 -1419
- package/crates/team-agent/src/lifecycle/tests/pi_lifecycle_doctor_red.rs +0 -98
- package/crates/team-agent/src/lifecycle/tests/pi_native_mcp_capability_red.rs +0 -550
- package/crates/team-agent/src/lifecycle/tests/pi_session_delivery_red.rs +0 -226
- package/crates/team-agent/src/lifecycle/tests/quick_start_worker_readiness_red.rs +0 -332
- package/crates/team-agent/src/lifecycle/tests/realmachine_clusters_1_6_red.rs +0 -786
- package/crates/team-agent/src/lifecycle/tests/realmachine_residual_g1_g4_red.rs +0 -648
- package/crates/team-agent/src/lifecycle/tests/restart.rs +0 -185
- package/crates/team-agent/src/lifecycle/tests/restart_build_before_destroy_0540_contract.rs +0 -1053
- package/crates/team-agent/src/lifecycle/tests/restart_liveness_red.rs +0 -679
- package/crates/team-agent/src/lifecycle/tests/restart_rebind_hotfix_252_red.rs +0 -1126
- package/crates/team-agent/src/lifecycle/tests/restart_session_capture_red.rs +0 -153
- package/crates/team-agent/src/lifecycle/tests/resume_recover_red.rs +0 -427
- package/crates/team-agent/src/lifecycle/tests/stale_team_saveconflict_contract.rs +0 -431
- package/crates/team-agent/src/lifecycle/tests/startup_latency_contract.rs +0 -1066
- package/crates/team-agent/src/lifecycle/tests/status_credential_redaction_contract.rs +0 -876
- package/crates/team-agent/src/lifecycle/tests/subprep_codex_trust_roundtrip_red.rs +0 -1026
- package/crates/team-agent/src/lifecycle/tests/swallow_batch4_semantics_red.rs +0 -342
- package/crates/team-agent/src/lifecycle/tests/team_in_team_identity_scope_red.rs +0 -543
- package/crates/team-agent/src/lifecycle/tests/team_in_team_sibling_quick_start_red.rs +0 -1103
- package/crates/team-agent/src/lifecycle/tests/team_in_team_state_scope_red.rs +0 -1276
- package/crates/team-agent/src/lifecycle/tests/team_key_retirement_roster_red.rs +0 -145
- package/crates/team-agent/src/lifecycle/tests/team_key_retirement_txn_red.rs +0 -603
- package/crates/team-agent/src/lifecycle/tests/test_isolation_escape_contract.rs +0 -936
- package/crates/team-agent/src/lifecycle/tests/upgrade_compat_0211_red.rs +0 -970
- package/crates/team-agent/src/lifecycle/tests/verify_rs031_window_consistency_red.rs +0 -995
- package/crates/team-agent/src/lifecycle/tests/worker_spawn_env_red.rs +0 -836
- package/crates/team-agent/src/lifecycle/tests.rs +0 -105
- package/crates/team-agent/src/lifecycle/types.rs +0 -877
- package/crates/team-agent/src/lifecycle/worker_command_context.rs +0 -363
- package/crates/team-agent/src/main.rs +0 -52
- package/crates/team-agent/src/mcp_server/helpers.rs +0 -510
- package/crates/team-agent/src/mcp_server/lifecycle_tools/mod.rs +0 -6
- package/crates/team-agent/src/mcp_server/lifecycle_tools/state_status.rs +0 -43
- package/crates/team-agent/src/mcp_server/mod.rs +0 -119
- package/crates/team-agent/src/mcp_server/normalize.rs +0 -485
- package/crates/team-agent/src/mcp_server/readiness.rs +0 -527
- package/crates/team-agent/src/mcp_server/readiness_tests.rs +0 -348
- package/crates/team-agent/src/mcp_server/tests/golden.rs +0 -285
- package/crates/team-agent/src/mcp_server/tests/normalize.rs +0 -247
- package/crates/team-agent/src/mcp_server/tests/scoped.rs +0 -158
- package/crates/team-agent/src/mcp_server/tests/send.rs +0 -353
- package/crates/team-agent/src/mcp_server/tests/tools.rs +0 -341
- package/crates/team-agent/src/mcp_server/tests/wire.rs +0 -254
- package/crates/team-agent/src/mcp_server/tests.rs +0 -43
- package/crates/team-agent/src/mcp_server/tools.rs +0 -889
- package/crates/team-agent/src/mcp_server/types.rs +0 -396
- package/crates/team-agent/src/mcp_server/wire.rs +0 -867
- package/crates/team-agent/src/messaging/activity.rs +0 -461
- package/crates/team-agent/src/messaging/address.rs +0 -87
- package/crates/team-agent/src/messaging/delivery.rs +0 -3727
- package/crates/team-agent/src/messaging/delivery_consumption_tests.rs +0 -234
- package/crates/team-agent/src/messaging/enter_rescue.rs +0 -362
- package/crates/team-agent/src/messaging/enter_rescue_tests.rs +0 -633
- package/crates/team-agent/src/messaging/helpers.rs +0 -336
- package/crates/team-agent/src/messaging/leader_channel.rs +0 -287
- package/crates/team-agent/src/messaging/leader_receiver.rs +0 -786
- package/crates/team-agent/src/messaging/mod.rs +0 -167
- package/crates/team-agent/src/messaging/persist.rs +0 -377
- package/crates/team-agent/src/messaging/presentation.rs +0 -417
- package/crates/team-agent/src/messaging/reminders.rs +0 -316
- package/crates/team-agent/src/messaging/results/collection_tests.rs +0 -719
- package/crates/team-agent/src/messaging/results.rs +0 -1415
- package/crates/team-agent/src/messaging/scheduler.rs +0 -223
- package/crates/team-agent/src/messaging/selftest.rs +0 -315
- package/crates/team-agent/src/messaging/send.rs +0 -981
- package/crates/team-agent/src/messaging/tests/basic.rs +0 -346
- package/crates/team-agent/src/messaging/tests/dup_inject.rs +0 -657
- package/crates/team-agent/src/messaging/tests/e23.rs +0 -49
- package/crates/team-agent/src/messaging/tests/leader_channel.rs +0 -169
- package/crates/team-agent/src/messaging/tests/leader_inject_acceptance.rs +0 -817
- package/crates/team-agent/src/messaging/tests/main_preserved.rs +0 -85
- package/crates/team-agent/src/messaging/tests/mod.rs +0 -306
- package/crates/team-agent/src/messaging/tests/runtime.rs +0 -3549
- package/crates/team-agent/src/messaging/tests/spine.rs +0 -853
- package/crates/team-agent/src/messaging/tests/wave2.rs +0 -381
- package/crates/team-agent/src/messaging/trust.rs +0 -215
- package/crates/team-agent/src/messaging/types.rs +0 -472
- package/crates/team-agent/src/messaging/wait.rs +0 -366
- package/crates/team-agent/src/messaging/watchers.rs +0 -916
- package/crates/team-agent/src/model/enums.rs +0 -356
- package/crates/team-agent/src/model/errors.rs +0 -18
- package/crates/team-agent/src/model/ids.rs +0 -165
- package/crates/team-agent/src/model/mod.rs +0 -29
- package/crates/team-agent/src/model/name_similarity.rs +0 -252
- package/crates/team-agent/src/model/pane_authority_refusal.rs +0 -359
- package/crates/team-agent/src/model/paths.rs +0 -257
- package/crates/team-agent/src/model/routing.rs +0 -387
- package/crates/team-agent/src/model/spec.rs +0 -1184
- package/crates/team-agent/src/model/task_graph.rs +0 -321
- package/crates/team-agent/src/model/testdata/fuzz.golden.yaml +0 -43
- package/crates/team-agent/src/model/testdata/fuzz.yaml +0 -43
- package/crates/team-agent/src/model/testdata/spec_invalid_a.yaml +0 -209
- package/crates/team-agent/src/model/testdata/team.spec.golden.yaml +0 -208
- package/crates/team-agent/src/model/testdata/team.spec.yaml +0 -208
- package/crates/team-agent/src/model/yaml/tests.rs +0 -188
- package/crates/team-agent/src/model/yaml.rs +0 -802
- package/crates/team-agent/src/os_probe.rs +0 -280
- package/crates/team-agent/src/packaging/install.rs +0 -219
- package/crates/team-agent/src/packaging/migrate.rs +0 -38
- package/crates/team-agent/src/packaging/mod.rs +0 -91
- package/crates/team-agent/src/packaging/repair.rs +0 -33
- package/crates/team-agent/src/packaging/tests.rs +0 -822
- package/crates/team-agent/src/packaging/types.rs +0 -417
- package/crates/team-agent/src/platform/argv.rs +0 -331
- package/crates/team-agent/src/platform/errors.rs +0 -104
- package/crates/team-agent/src/platform/file_lock.rs +0 -279
- package/crates/team-agent/src/platform/mod.rs +0 -5
- package/crates/team-agent/src/platform/process.rs +0 -545
- package/crates/team-agent/src/provider/adapter.rs +0 -1150
- package/crates/team-agent/src/provider/adapters/claude.rs +0 -78
- package/crates/team-agent/src/provider/adapters/claude_fork.rs +0 -131
- package/crates/team-agent/src/provider/adapters/copilot.rs +0 -75
- package/crates/team-agent/src/provider/adapters/copilot_fork.rs +0 -307
- package/crates/team-agent/src/provider/adapters/fake.rs +0 -18
- package/crates/team-agent/src/provider/adapters/mod.rs +0 -30
- package/crates/team-agent/src/provider/adapters/pi.rs +0 -106
- package/crates/team-agent/src/provider/approvals/mod.rs +0 -3
- package/crates/team-agent/src/provider/approvals/parsing.rs +0 -586
- package/crates/team-agent/src/provider/approvals/runtime_prompts.rs +0 -205
- package/crates/team-agent/src/provider/argv_route.rs +0 -405
- package/crates/team-agent/src/provider/bypass_flags.rs +0 -116
- package/crates/team-agent/src/provider/classify.rs +0 -708
- package/crates/team-agent/src/provider/command_helpers.rs +0 -45
- package/crates/team-agent/src/provider/faults.rs +0 -165
- package/crates/team-agent/src/provider/helpers.rs +0 -52
- package/crates/team-agent/src/provider/mod.rs +0 -78
- package/crates/team-agent/src/provider/model_catalog.rs +0 -910
- package/crates/team-agent/src/provider/session/capture.rs +0 -2731
- package/crates/team-agent/src/provider/session/context_fork/claude.rs +0 -123
- package/crates/team-agent/src/provider/session/context_fork/outcome.rs +0 -172
- package/crates/team-agent/src/provider/session/context_fork.rs +0 -396
- package/crates/team-agent/src/provider/session/mod.rs +0 -36
- package/crates/team-agent/src/provider/session/resume.rs +0 -269
- package/crates/team-agent/src/provider/session_scan/claude.rs +0 -523
- package/crates/team-agent/src/provider/session_scan/common/tests.rs +0 -316
- package/crates/team-agent/src/provider/session_scan/common.rs +0 -654
- package/crates/team-agent/src/provider/session_scan/copilot.rs +0 -280
- package/crates/team-agent/src/provider/session_scan/pi.rs +0 -185
- package/crates/team-agent/src/provider/session_scan.rs +0 -71
- package/crates/team-agent/src/provider/startup_prompt.rs +0 -757
- package/crates/team-agent/src/provider/submit_now.rs +0 -71
- package/crates/team-agent/src/provider/testdata/copilot-ready-marker.txt +0 -5
- package/crates/team-agent/src/provider/testdata/copilot-trust-prompt.txt +0 -19
- package/crates/team-agent/src/provider/testdata/grok-models-authenticated.stdout +0 -9
- package/crates/team-agent/src/provider/testdata/grok-models-unauthenticated.stdout +0 -7
- package/crates/team-agent/src/provider/tests/adapter.rs +0 -441
- package/crates/team-agent/src/provider/tests/classify.rs +0 -148
- package/crates/team-agent/src/provider/tests/command_helpers.rs +0 -35
- package/crates/team-agent/src/provider/tests/copilot_fork.rs +0 -191
- package/crates/team-agent/src/provider/tests/faults.rs +0 -200
- package/crates/team-agent/src/provider/tests/idle.rs +0 -177
- package/crates/team-agent/src/provider/tests/wire.rs +0 -213
- package/crates/team-agent/src/provider/tests.rs +0 -32
- package/crates/team-agent/src/provider/types.rs +0 -529
- package/crates/team-agent/src/provider/wire.rs +0 -394
- package/crates/team-agent/src/redaction.rs +0 -259
- package/crates/team-agent/src/state/abnormal_watch/tests/mod.rs +0 -248
- package/crates/team-agent/src/state/abnormal_watch.rs +0 -144
- package/crates/team-agent/src/state/identity.rs +0 -914
- package/crates/team-agent/src/state/identity_keys.rs +0 -132
- package/crates/team-agent/src/state/mod.rs +0 -74
- package/crates/team-agent/src/state/owner_gate.rs +0 -482
- package/crates/team-agent/src/state/ownership.rs +0 -563
- package/crates/team-agent/src/state/paths.rs +0 -395
- package/crates/team-agent/src/state/persist.rs +0 -3811
- package/crates/team-agent/src/state/projection.rs +0 -1508
- package/crates/team-agent/src/state/repository/intent.rs +0 -14
- package/crates/team-agent/src/state/repository/tests.rs +0 -184
- package/crates/team-agent/src/state/repository.rs +0 -866
- package/crates/team-agent/src/state/selector.rs +0 -160
- package/crates/team-agent/src/state/testdata/state-rich.canonical.json +0 -133
- package/crates/team-agent/src/test_support/models_timeout_fixture.rs +0 -144
- package/crates/team-agent/src/tmux_backend/enter_rescue.rs +0 -325
- package/crates/team-agent/src/tmux_backend/enter_rescue_tests.rs +0 -432
- package/crates/team-agent/src/tmux_backend/native_input.rs +0 -513
- package/crates/team-agent/src/tmux_backend/native_input_tests.rs +0 -742
- package/crates/team-agent/src/tmux_backend/tests.rs +0 -4103
- package/crates/team-agent/src/tmux_backend.rs +0 -4492
- package/crates/team-agent/src/topology.rs +0 -537
- package/crates/team-agent/src/transport/enter_rescue.rs +0 -166
- package/crates/team-agent/src/transport/native_input.rs +0 -491
- package/crates/team-agent/src/transport/test_support.rs +0 -743
- package/crates/team-agent/src/transport/tests/behavior.rs +0 -326
- package/crates/team-agent/src/transport/tests/mod.rs +0 -194
- package/crates/team-agent/src/transport/tests/wire.rs +0 -574
- package/crates/team-agent/src/transport.rs +0 -1655
- package/crates/team-agent/src/transport_factory.rs +0 -819
|
@@ -1,280 +0,0 @@
|
|
|
1
|
-
//! ---
|
|
2
|
-
//! purpose: 为运行时提供有界的进程输出读取与前台进程组探测
|
|
3
|
-
//! contract:
|
|
4
|
-
//! provides:
|
|
5
|
-
//! - name: bounded_command_output_with_probe
|
|
6
|
-
//! what: 在固定超时内执行命令并读取 stdout,超时后终止子进程
|
|
7
|
-
//! - name: pane_foreground_and_root_pgrp
|
|
8
|
-
//! what: 读取 pane PID 的前台与根进程组 ID,无法判定时返回 None
|
|
9
|
-
//! depends:
|
|
10
|
-
//! - std
|
|
11
|
-
//! boundary:
|
|
12
|
-
//! - 只负责有界探测、临时 stdout 文件的独占创建与清理
|
|
13
|
-
//! - 不决定 shutdown 状态,不重试探测,不修改调用方行为
|
|
14
|
-
//! arch:
|
|
15
|
-
//! allowed_dependencies:
|
|
16
|
-
//! - std
|
|
17
|
-
//! maturity: wired
|
|
18
|
-
//! ---
|
|
19
|
-
|
|
20
|
-
use std::cell::RefCell;
|
|
21
|
-
use std::fs::OpenOptions;
|
|
22
|
-
use std::io::{self, Read};
|
|
23
|
-
use std::process::{Command, ExitStatus, Stdio};
|
|
24
|
-
use std::sync::atomic::{AtomicU64, Ordering};
|
|
25
|
-
use std::time::{Duration, Instant, SystemTime, UNIX_EPOCH};
|
|
26
|
-
|
|
27
|
-
const DEFAULT_TIMEOUT: Duration = Duration::from_millis(900);
|
|
28
|
-
static NEXT_TEMP_OUTPUT_ID: AtomicU64 = AtomicU64::new(0);
|
|
29
|
-
|
|
30
|
-
thread_local! {
|
|
31
|
-
static PROBE_TIMEOUT: RefCell<Option<ProbeTimeout>> = const { RefCell::new(None) };
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
#[derive(Clone, Debug)]
|
|
35
|
-
pub(crate) struct ProbeTimeout {
|
|
36
|
-
pub(crate) probe: &'static str,
|
|
37
|
-
pub(crate) pid: Option<u32>,
|
|
38
|
-
pub(crate) timeout_ms: u64,
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
#[derive(Debug)]
|
|
42
|
-
pub(crate) struct BoundedCommandOutput {
|
|
43
|
-
pub(crate) status: ExitStatus,
|
|
44
|
-
pub(crate) stdout: Vec<u8>,
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/// ---
|
|
48
|
-
/// purpose: 清除当前线程记录的探测超时
|
|
49
|
-
/// ---
|
|
50
|
-
pub(crate) fn clear_probe_timeout() {
|
|
51
|
-
PROBE_TIMEOUT.with(|timeout| *timeout.borrow_mut() = None);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/// ---
|
|
55
|
-
/// purpose: 判断当前线程是否记录了探测超时
|
|
56
|
-
/// ---
|
|
57
|
-
pub(crate) fn probe_timed_out() -> bool {
|
|
58
|
-
PROBE_TIMEOUT.with(|timeout| timeout.borrow().is_some())
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/// ---
|
|
62
|
-
/// purpose: 获取当前线程记录的探测超时详情
|
|
63
|
-
/// ---
|
|
64
|
-
pub(crate) fn probe_timeout() -> Option<ProbeTimeout> {
|
|
65
|
-
PROBE_TIMEOUT.with(|timeout| timeout.borrow().clone())
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
#[cfg(test)]
|
|
69
|
-
/// ---
|
|
70
|
-
/// purpose: 为单元测试设置探测超时详情
|
|
71
|
-
/// ---
|
|
72
|
-
pub(crate) fn set_probe_timeout_for_test(probe: &'static str, pid: Option<u32>, timeout_ms: u64) {
|
|
73
|
-
PROBE_TIMEOUT.with(|current| {
|
|
74
|
-
*current.borrow_mut() = Some(ProbeTimeout {
|
|
75
|
-
probe,
|
|
76
|
-
pid,
|
|
77
|
-
timeout_ms,
|
|
78
|
-
});
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/// ---
|
|
83
|
-
/// purpose: 执行一个带默认超时与探测标识的命令并读取 stdout
|
|
84
|
-
/// ---
|
|
85
|
-
pub(crate) fn bounded_command_output_with_probe(
|
|
86
|
-
command: &mut Command,
|
|
87
|
-
probe: &'static str,
|
|
88
|
-
pid: Option<u32>,
|
|
89
|
-
) -> io::Result<BoundedCommandOutput> {
|
|
90
|
-
bounded_command_output_with_timeout(command, DEFAULT_TIMEOUT, probe, pid)
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
fn bounded_command_output_with_timeout(
|
|
94
|
-
command: &mut Command,
|
|
95
|
-
timeout: Duration,
|
|
96
|
-
probe: &'static str,
|
|
97
|
-
pid: Option<u32>,
|
|
98
|
-
) -> io::Result<BoundedCommandOutput> {
|
|
99
|
-
let stdout_path = temp_output_path("stdout");
|
|
100
|
-
let stdout_file = OpenOptions::new()
|
|
101
|
-
.create_new(true)
|
|
102
|
-
.read(true)
|
|
103
|
-
.write(true)
|
|
104
|
-
.open(&stdout_path)?;
|
|
105
|
-
let child = command
|
|
106
|
-
.stdout(Stdio::from(stdout_file.try_clone()?))
|
|
107
|
-
.stderr(Stdio::null())
|
|
108
|
-
.spawn()?;
|
|
109
|
-
wait_for_bounded_child(child, stdout_file, stdout_path, timeout, probe, pid)
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
fn wait_for_bounded_child(
|
|
113
|
-
mut child: std::process::Child,
|
|
114
|
-
stdout_file: std::fs::File,
|
|
115
|
-
stdout_path: std::path::PathBuf,
|
|
116
|
-
timeout: Duration,
|
|
117
|
-
probe: &'static str,
|
|
118
|
-
pid: Option<u32>,
|
|
119
|
-
) -> io::Result<BoundedCommandOutput> {
|
|
120
|
-
let start = Instant::now();
|
|
121
|
-
loop {
|
|
122
|
-
if let Some(status) = child.try_wait()? {
|
|
123
|
-
drop(stdout_file);
|
|
124
|
-
let stdout = read_and_remove(&stdout_path);
|
|
125
|
-
return Ok(BoundedCommandOutput { status, stdout });
|
|
126
|
-
}
|
|
127
|
-
if start.elapsed() >= timeout {
|
|
128
|
-
PROBE_TIMEOUT.with(|current| {
|
|
129
|
-
let mut current = current.borrow_mut();
|
|
130
|
-
if current.is_none() {
|
|
131
|
-
*current = Some(ProbeTimeout {
|
|
132
|
-
probe,
|
|
133
|
-
pid,
|
|
134
|
-
timeout_ms: timeout.as_millis() as u64,
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
});
|
|
138
|
-
let _ = child.kill();
|
|
139
|
-
let status = child.wait()?;
|
|
140
|
-
drop(stdout_file);
|
|
141
|
-
let stdout = read_and_remove(&stdout_path);
|
|
142
|
-
return Ok(BoundedCommandOutput { status, stdout });
|
|
143
|
-
}
|
|
144
|
-
std::thread::sleep(Duration::from_millis(10));
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
fn temp_output_path(kind: &str) -> std::path::PathBuf {
|
|
149
|
-
let nanos = SystemTime::now()
|
|
150
|
-
.duration_since(UNIX_EPOCH)
|
|
151
|
-
.map(|duration| duration.as_nanos())
|
|
152
|
-
.unwrap_or(0);
|
|
153
|
-
temp_output_path_with_nanos(kind, nanos)
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
fn temp_output_path_with_nanos(kind: &str, nanos: u128) -> std::path::PathBuf {
|
|
157
|
-
let unique_id = NEXT_TEMP_OUTPUT_ID.fetch_add(1, Ordering::Relaxed);
|
|
158
|
-
std::env::temp_dir().join(format!(
|
|
159
|
-
"team-agent-os-probe-{}-{nanos}-{unique_id}.{kind}",
|
|
160
|
-
std::process::id(),
|
|
161
|
-
))
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
fn read_and_remove(path: &std::path::Path) -> Vec<u8> {
|
|
165
|
-
let mut stdout = Vec::new();
|
|
166
|
-
if let Ok(mut file) = std::fs::File::open(path) {
|
|
167
|
-
let _ = file.read_to_end(&mut stdout);
|
|
168
|
-
}
|
|
169
|
-
let _ = std::fs::remove_file(path);
|
|
170
|
-
stdout
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
/// 0.4.x Phase 1 (fg-pgrp): terminal foreground process-group probe.
|
|
174
|
-
///
|
|
175
|
-
/// macOS probe confirmed (2026-06-29, .team/artifacts/fg-pgrp-probe.md):
|
|
176
|
-
/// `TIOCGPGRP` ioctl returns Errno 25 on tmux slave PTYs opened from a
|
|
177
|
-
/// non-controlling process. We use `ps -o tpgid,pgid -p <pid>` instead —
|
|
178
|
-
/// reliable on macOS AND Linux, no platform-specific cfg needed.
|
|
179
|
-
///
|
|
180
|
-
/// Returns `Ok(Some((tpgid, pgid)))` on success, `Ok(None)` when the PID
|
|
181
|
-
/// is gone / ps returned no row / values unparseable. The caller maps
|
|
182
|
-
/// `None` to `WorkerRuntimeState::Unknown` (never to idle — Iron Law).
|
|
183
|
-
///
|
|
184
|
-
/// `tpgid` = terminal foreground process group ID.
|
|
185
|
-
/// `pgid` = the agent root's own process group ID.
|
|
186
|
-
/// `tpgid != pgid` means a child process owns the foreground (BUSY signal).
|
|
187
|
-
///
|
|
188
|
-
/// Bounded via [`run_bounded_command`] so a wedged ps cannot stall the
|
|
189
|
-
/// coordinator tick.
|
|
190
|
-
/// ---
|
|
191
|
-
/// purpose: 读取 pane PID 的前台与根进程组 ID,无法判定时返回 None
|
|
192
|
-
/// ---
|
|
193
|
-
pub(crate) fn pane_foreground_and_root_pgrp(pane_pid: u32) -> io::Result<Option<(u32, u32)>> {
|
|
194
|
-
let mut command = Command::new("ps");
|
|
195
|
-
command.args(["-o", "tpgid=,pgid=", "-p", &pane_pid.to_string()]);
|
|
196
|
-
let output = bounded_command_output_with_probe(
|
|
197
|
-
&mut command,
|
|
198
|
-
"pane_foreground_and_root_pgrp",
|
|
199
|
-
Some(pane_pid),
|
|
200
|
-
)?;
|
|
201
|
-
if probe_timed_out() {
|
|
202
|
-
return Ok(None);
|
|
203
|
-
}
|
|
204
|
-
if !output.status.success() {
|
|
205
|
-
return Ok(None);
|
|
206
|
-
}
|
|
207
|
-
let text = String::from_utf8_lossy(&output.stdout);
|
|
208
|
-
let first_line = text.lines().next().unwrap_or("").trim();
|
|
209
|
-
if first_line.is_empty() {
|
|
210
|
-
return Ok(None);
|
|
211
|
-
}
|
|
212
|
-
let parts: Vec<&str> = first_line.split_whitespace().collect();
|
|
213
|
-
if parts.len() < 2 {
|
|
214
|
-
return Ok(None);
|
|
215
|
-
}
|
|
216
|
-
let tpgid = parts[0].parse::<i64>().ok();
|
|
217
|
-
let pgid = parts[1].parse::<i64>().ok();
|
|
218
|
-
match (tpgid, pgid) {
|
|
219
|
-
// ps prints `-1` for tpgid when there is no controlling terminal —
|
|
220
|
-
// treat as unknown rather than fabricating a u32.
|
|
221
|
-
(Some(t), Some(p)) if t > 0 && p > 0 => Ok(Some((t as u32, p as u32))),
|
|
222
|
-
_ => Ok(None),
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
#[cfg(test)]
|
|
227
|
-
mod fg_pgrp_tests {
|
|
228
|
-
use super::*;
|
|
229
|
-
|
|
230
|
-
#[test]
|
|
231
|
-
fn pane_foreground_and_root_pgrp_self_returns_some_or_none() {
|
|
232
|
-
// The current test process is not necessarily attached to a
|
|
233
|
-
// controlling terminal (CI runs detached), so we accept Some OR
|
|
234
|
-
// None. The contract is: never panic, return io::Result.
|
|
235
|
-
let pid = std::process::id();
|
|
236
|
-
match pane_foreground_and_root_pgrp(pid) {
|
|
237
|
-
Ok(Some((tpgid, pgid))) => {
|
|
238
|
-
assert!(tpgid > 0 && pgid > 0, "positive pgid/tpgid");
|
|
239
|
-
}
|
|
240
|
-
Ok(None) => {} // headless / no tty — acceptable
|
|
241
|
-
Err(e) => panic!("probe must not error in normal env: {e}"),
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
#[test]
|
|
246
|
-
fn pane_foreground_and_root_pgrp_missing_pid_returns_none() {
|
|
247
|
-
// PID 1 is init/launchd — exists but we read fields; non-existent
|
|
248
|
-
// PIDs return Ok(None) (ps exits non-zero).
|
|
249
|
-
let result =
|
|
250
|
-
pane_foreground_and_root_pgrp(0xFFFF_FFFE).expect("must not error on missing pid");
|
|
251
|
-
assert!(result.is_none(), "missing pid → None");
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
#[test]
|
|
255
|
-
fn temp_output_create_new_requires_atomic_discriminator() {
|
|
256
|
-
let fixed_nanos = 0x5eed_u128;
|
|
257
|
-
let first_path = temp_output_path_with_nanos("stdout", fixed_nanos);
|
|
258
|
-
let second_path = temp_output_path_with_nanos("stdout", fixed_nanos);
|
|
259
|
-
let _ = std::fs::remove_file(&first_path);
|
|
260
|
-
let _ = std::fs::remove_file(&second_path);
|
|
261
|
-
|
|
262
|
-
let first = OpenOptions::new()
|
|
263
|
-
.create_new(true)
|
|
264
|
-
.read(true)
|
|
265
|
-
.write(true)
|
|
266
|
-
.open(&first_path)
|
|
267
|
-
.expect("first atomic path create");
|
|
268
|
-
let second = OpenOptions::new()
|
|
269
|
-
.create_new(true)
|
|
270
|
-
.read(true)
|
|
271
|
-
.write(true)
|
|
272
|
-
.open(&second_path)
|
|
273
|
-
.expect("second atomic path create");
|
|
274
|
-
assert_ne!(first_path, second_path, "atomic discriminator must advance");
|
|
275
|
-
drop(first);
|
|
276
|
-
drop(second);
|
|
277
|
-
let _ = std::fs::remove_file(first_path);
|
|
278
|
-
let _ = std::fs::remove_file(second_path);
|
|
279
|
-
}
|
|
280
|
-
}
|
|
@@ -1,219 +0,0 @@
|
|
|
1
|
-
//!
|
|
2
|
-
//! installer 行为入口:`install` / `install_skill` / `diagnose_path`
|
|
3
|
-
//! + 文件系统副作用 helper(copytree / stale diff)。
|
|
4
|
-
|
|
5
|
-
use std::path::{Path, PathBuf};
|
|
6
|
-
|
|
7
|
-
use super::types::{
|
|
8
|
-
BinDir, DoctorStatus, InstallOptions, InstallReport, PackagingError, PathDiagnostic, PathHint,
|
|
9
|
-
Prefix, SkillDestDir, SkillInstallOptions, SkillInstallOutcome, SkillTarget, Version,
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
///
|
|
13
|
-
/// installer `install`(首装,`install.mjs:48`)。写 bin/wrapper + 装 skill(`--target all`)+ 跑 doctor。
|
|
14
|
-
/// **首装无二进制替换**(`InstallReport.replace == None`)。
|
|
15
|
-
/// // REAL-MACHINE-E2E:全副作用(写 bin / 拷 skill / 探 PATH / 跑 doctor)只能真机/容器 clean-install 验。
|
|
16
|
-
pub fn install(opts: &InstallOptions) -> Result<InstallReport, PackagingError> {
|
|
17
|
-
let bin_dir = BinDir(opts.prefix.0.join("bin"));
|
|
18
|
-
let installed_bin = bin_dir.0.join("team-agent");
|
|
19
|
-
let skills = install_skill(&SkillInstallOptions {
|
|
20
|
-
target: opts.skill_target,
|
|
21
|
-
dest: None,
|
|
22
|
-
dry_run: true,
|
|
23
|
-
source: default_skill_source(),
|
|
24
|
-
})?;
|
|
25
|
-
// T3-6 (harvest §1): never a hardcoded DoctorStatus::Ok with no check behind it —
|
|
26
|
-
// run the real packaging doctor (schema diagnosis + gates) for the invoking
|
|
27
|
-
// workspace so the report reflects an actual result.
|
|
28
|
-
let doctor = super::migrate::doctor(&super::types::DoctorOptions {
|
|
29
|
-
workspace: std::env::current_dir().unwrap_or_else(|_| PathBuf::from(".")),
|
|
30
|
-
gate: None,
|
|
31
|
-
fix: false,
|
|
32
|
-
cleanup_orphans: false,
|
|
33
|
-
confirm: false,
|
|
34
|
-
})?;
|
|
35
|
-
Ok(InstallReport {
|
|
36
|
-
installed_bin,
|
|
37
|
-
version: Version::current(),
|
|
38
|
-
replace: None,
|
|
39
|
-
skills,
|
|
40
|
-
doctor,
|
|
41
|
-
path_hint: diagnose_path(&bin_dir)?,
|
|
42
|
-
})
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
///
|
|
46
|
-
/// `team-agent install-skill`(`commands.py:451`)。repo `skills/team-agent/` → `~/.codex|.claude`。
|
|
47
|
-
/// `--target all` fan-out 两者;`--dest` 不能与 `--target all` 组合(`commands.py:453` → Err)。
|
|
48
|
-
/// 拷前清陈旧残留(修 `dirs_exist_ok` 残留);`--dry-run` 只报告不落地。
|
|
49
|
-
/// // REAL-MACHINE-E2E:真拷 / removed_stale 需文件系统;dry-run 与 plan 可单测。
|
|
50
|
-
pub fn install_skill(
|
|
51
|
-
opts: &SkillInstallOptions,
|
|
52
|
-
) -> Result<Vec<SkillInstallOutcome>, PackagingError> {
|
|
53
|
-
if opts.target == SkillTarget::All && opts.dest.is_some() {
|
|
54
|
-
return Err(PackagingError::InvalidOptions(
|
|
55
|
-
"--dest cannot be combined with --target all".to_string(),
|
|
56
|
-
));
|
|
57
|
-
}
|
|
58
|
-
let targets: Vec<SkillTarget> = match opts.target {
|
|
59
|
-
SkillTarget::All => SkillTarget::SINGLE_TARGETS.to_vec(),
|
|
60
|
-
target => vec![target],
|
|
61
|
-
};
|
|
62
|
-
let home = home_dir();
|
|
63
|
-
let mut out = Vec::new();
|
|
64
|
-
for target in targets {
|
|
65
|
-
let dest = match &opts.dest {
|
|
66
|
-
Some(dest) => SkillDestDir(dest.clone()),
|
|
67
|
-
None => target.dest_dir(&home).ok_or_else(|| {
|
|
68
|
-
PackagingError::InvalidOptions("target all has no single dest".to_string())
|
|
69
|
-
})?,
|
|
70
|
-
};
|
|
71
|
-
let mut removed_stale = Vec::new();
|
|
72
|
-
if !opts.dry_run {
|
|
73
|
-
// T2-1 (harvest §1): NEVER pre-wipe the user's existing skill dir — stage
|
|
74
|
-
// the copy into a sibling temp dir and only swap after the copy succeeded
|
|
75
|
-
// (write_worker_mcp_config tmp+rename 范式). A failed copy leaves the
|
|
76
|
-
// user's dir byte-identical.
|
|
77
|
-
let staging = staging_dir_for(&dest.0)?;
|
|
78
|
-
let _ = std::fs::remove_dir_all(&staging);
|
|
79
|
-
if let Err(error) = copy_tree(&opts.source, &staging) {
|
|
80
|
-
let _ = std::fs::remove_dir_all(&staging);
|
|
81
|
-
return Err(error);
|
|
82
|
-
}
|
|
83
|
-
if dest.0.exists() {
|
|
84
|
-
removed_stale = collect_files(&dest.0)?;
|
|
85
|
-
std::fs::remove_dir_all(&dest.0)?;
|
|
86
|
-
}
|
|
87
|
-
if let Err(error) = std::fs::rename(&staging, &dest.0) {
|
|
88
|
-
let _ = std::fs::remove_dir_all(&staging);
|
|
89
|
-
return Err(PackagingError::Io(std::io::Error::other(format!(
|
|
90
|
-
"swap staged skill dir into {}: {error}",
|
|
91
|
-
dest.0.display()
|
|
92
|
-
))));
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
out.push(SkillInstallOutcome {
|
|
96
|
-
target,
|
|
97
|
-
source: opts.source.clone(),
|
|
98
|
-
dest,
|
|
99
|
-
dry_run: opts.dry_run,
|
|
100
|
-
removed_stale,
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
Ok(out)
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
///
|
|
107
|
-
/// 「bin 不在 PATH」诊断(`bincheck.mjs` 等价;下载即跑也要提示 PATH/可执行位)。
|
|
108
|
-
/// 纯诊断(无副作用,可单测除真探 PATH 外的逻辑)。
|
|
109
|
-
fn diagnose_path(bin_dir: &BinDir) -> Result<PathHint, PackagingError> {
|
|
110
|
-
let path_var = std::env::var("PATH").unwrap_or_default();
|
|
111
|
-
let entries: Vec<PathBuf> = path_var
|
|
112
|
-
.split(':')
|
|
113
|
-
.filter(|p| !p.is_empty())
|
|
114
|
-
.map(PathBuf::from)
|
|
115
|
-
.collect();
|
|
116
|
-
if entries.iter().any(|p| p == &bin_dir.0) {
|
|
117
|
-
return Ok(PathHint::OnPath {
|
|
118
|
-
bin_dir: bin_dir.0.clone(),
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
let executable_bit_set = bin_dir.0.join("team-agent").metadata().is_ok_and(|m| {
|
|
122
|
-
#[cfg(unix)]
|
|
123
|
-
{
|
|
124
|
-
use std::os::unix::fs::PermissionsExt;
|
|
125
|
-
m.permissions().mode() & 0o111 != 0
|
|
126
|
-
}
|
|
127
|
-
#[cfg(not(unix))]
|
|
128
|
-
{
|
|
129
|
-
!m.permissions().readonly()
|
|
130
|
-
}
|
|
131
|
-
});
|
|
132
|
-
Ok(PathHint::NotOnPath {
|
|
133
|
-
bin_dir: bin_dir.0.clone(),
|
|
134
|
-
diagnostic: PathDiagnostic {
|
|
135
|
-
init_cwd: std::env::current_dir().unwrap_or_else(|_| PathBuf::new()),
|
|
136
|
-
wsl_mnt_c: std::env::current_dir()
|
|
137
|
-
.ok()
|
|
138
|
-
.is_some_and(|p| p.to_string_lossy().starts_with("/mnt/c/")),
|
|
139
|
-
npmrc_prefix: None,
|
|
140
|
-
path_entries: entries.len(),
|
|
141
|
-
executable_bit_set,
|
|
142
|
-
},
|
|
143
|
-
})
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
fn home_dir() -> PathBuf {
|
|
147
|
-
std::env::var_os("HOME")
|
|
148
|
-
.map(PathBuf::from)
|
|
149
|
-
.unwrap_or_else(|| PathBuf::from("."))
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
fn default_skill_source() -> PathBuf {
|
|
153
|
-
PathBuf::from(env!("CARGO_MANIFEST_DIR"))
|
|
154
|
-
.join("skills")
|
|
155
|
-
.join("team-agent")
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
fn collect_files(path: &Path) -> Result<Vec<PathBuf>, PackagingError> {
|
|
159
|
-
let mut out = Vec::new();
|
|
160
|
-
if !path.exists() {
|
|
161
|
-
return Ok(out);
|
|
162
|
-
}
|
|
163
|
-
collect_files_inner(path, &mut out)?;
|
|
164
|
-
Ok(out)
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
fn collect_files_inner(path: &Path, out: &mut Vec<PathBuf>) -> Result<(), PackagingError> {
|
|
168
|
-
for entry in std::fs::read_dir(path)? {
|
|
169
|
-
let entry = entry?;
|
|
170
|
-
let p = entry.path();
|
|
171
|
-
if p.is_dir() {
|
|
172
|
-
collect_files_inner(&p, out)?;
|
|
173
|
-
} else {
|
|
174
|
-
out.push(p);
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
Ok(())
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
/// T2-1: a sibling staging path for the atomic skill-dir swap (same parent so the
|
|
181
|
-
/// final rename never crosses filesystems).
|
|
182
|
-
fn staging_dir_for(dest: &Path) -> Result<PathBuf, PackagingError> {
|
|
183
|
-
let name = dest
|
|
184
|
-
.file_name()
|
|
185
|
-
.and_then(|name| name.to_str())
|
|
186
|
-
.unwrap_or("skill");
|
|
187
|
-
let parent = dest
|
|
188
|
-
.parent()
|
|
189
|
-
.map(Path::to_path_buf)
|
|
190
|
-
.unwrap_or_else(|| PathBuf::from("."));
|
|
191
|
-
std::fs::create_dir_all(&parent)?;
|
|
192
|
-
Ok(parent.join(format!(".{name}.ta-staging-{}", std::process::id())))
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
fn copy_tree(source: &Path, dest: &Path) -> Result<(), PackagingError> {
|
|
196
|
-
if !source.exists() {
|
|
197
|
-
return Err(PackagingError::Io(std::io::Error::new(
|
|
198
|
-
std::io::ErrorKind::NotFound,
|
|
199
|
-
format!("skill source not found: {}", source.display()),
|
|
200
|
-
)));
|
|
201
|
-
}
|
|
202
|
-
std::fs::create_dir_all(dest)?;
|
|
203
|
-
copy_tree_inner(source, dest)
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
fn copy_tree_inner(source: &Path, dest: &Path) -> Result<(), PackagingError> {
|
|
207
|
-
for entry in std::fs::read_dir(source)? {
|
|
208
|
-
let entry = entry?;
|
|
209
|
-
let src = entry.path();
|
|
210
|
-
let dst = dest.join(entry.file_name());
|
|
211
|
-
if src.is_dir() {
|
|
212
|
-
std::fs::create_dir_all(&dst)?;
|
|
213
|
-
copy_tree_inner(&src, &dst)?;
|
|
214
|
-
} else {
|
|
215
|
-
std::fs::copy(&src, &dst)?;
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
Ok(())
|
|
219
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
//!
|
|
2
|
-
//! `doctor` 自检入口:把 step 3 schema_diagnosis +(placeholder)step 11/12 gate 结论归一成
|
|
3
|
-
//! typed [`DoctorStatus`]。
|
|
4
|
-
|
|
5
|
-
use super::types::{
|
|
6
|
-
Blocker, BlockerSource, DoctorGate, DoctorOptions, DoctorStatus, PackagingError,
|
|
7
|
-
};
|
|
8
|
-
use crate::db::migration::schema_diagnosis_workspace;
|
|
9
|
-
|
|
10
|
-
///
|
|
11
|
-
/// `team-agent doctor`(`commands.py:218`)。packaging 的自检入口:把 step 3 schema_diagnosis +
|
|
12
|
-
/// (placeholder)step 11 comms / step 12 orphan gate 结论归一成 typed [`DoctorStatus`]。
|
|
13
|
-
/// **§84**:只调 step 3/11/12 的 trait 入口,注入 mock 时 provider 调用计数 = 0;绝不触发 prompt/token。
|
|
14
|
-
pub fn doctor(opts: &DoctorOptions) -> Result<DoctorStatus, PackagingError> {
|
|
15
|
-
if opts.fix && opts.gate.is_none() {
|
|
16
|
-
return Err(PackagingError::InvalidOptions(
|
|
17
|
-
"--fix requires --gate".to_string(),
|
|
18
|
-
));
|
|
19
|
-
}
|
|
20
|
-
let gate_blockers =
|
|
21
|
-
crate::diagnose::doctor_gate_blockers(&opts.workspace, opts.gate, opts.fix, opts.confirm)?;
|
|
22
|
-
if !gate_blockers.is_empty() {
|
|
23
|
-
return Ok(DoctorStatus::HasBlockers {
|
|
24
|
-
blockers: gate_blockers,
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
let diagnosis = schema_diagnosis_workspace(&opts.workspace)?;
|
|
28
|
-
if diagnosis.layout_diffs.is_empty() {
|
|
29
|
-
Ok(DoctorStatus::Ok)
|
|
30
|
-
} else {
|
|
31
|
-
Ok(DoctorStatus::HasBlockers {
|
|
32
|
-
blockers: vec![Blocker {
|
|
33
|
-
source: BlockerSource::SchemaLayoutDrift,
|
|
34
|
-
detail: "team.db physical layout drift detected".to_string(),
|
|
35
|
-
}],
|
|
36
|
-
})
|
|
37
|
-
}
|
|
38
|
-
}
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
//!
|
|
2
|
-
//! step 15 · packaging — release 产物布局 / 薄 self-install / migration·repair SKELETON (ROUND-0).
|
|
3
|
-
//!
|
|
4
|
-
//! Card: `docs/phase0/subsystems/15-packaging.md`.
|
|
5
|
-
//! Truth source (READ-ONLY snapshot `team-agent-public` @ v0.2.11 / `439bef8`):
|
|
6
|
-
//! - `npm/install.mjs` (npx installer 主体:install/update/doctor/uninstall
|
|
7
|
-
//! 四子命令;原子升级 `copyTree→tmp` / `dest→.previous` rename / `tmp→dest` rename;写三个 sh
|
|
8
|
-
//! wrapper;跑 `install-skill --target all`;跑 `doctor --json` 自检)
|
|
9
|
-
//! - `npm/bincheck.mjs` (npm postinstall 钩子:bin 不在 PATH 时打印 WSL
|
|
10
|
-
//! `/mnt/c` + 项目级 `.npmrc prefix` 诊断 —— Rust 版无 npm,但 PATH-not-found 诊断保留)
|
|
11
|
-
//! - `scripts/install.py` (纯 Python 后备 installer:只写三个 sh wrapper,
|
|
12
|
-
//! 是 install.mjs 的子集)
|
|
13
|
-
//! - `src/team_agent/rust_core.py` (**前车之鉴**:engine `rust`/`rust_failed`/
|
|
14
|
-
//! `python_fallback` 三态 + 静默 Python 回退 —— Rust 全量后整座桥删除,无此散字符串态)
|
|
15
|
-
//! - `src/team_agent/cli/commands.py:451` (`cmd_install_skill`:repo `skills/team-agent/`
|
|
16
|
-
//! copytree 到 `~/.codex|.claude/skills/team-agent/`;`--dry-run`/`--dest`/`--target` 矩阵)
|
|
17
|
-
//! - `src/team_agent/cli/commands.py:218` (`cmd_doctor`:packaging 的自检入口;实体逻辑在
|
|
18
|
-
//! step 3 schema_migration / step 11 comms selftest / step 12 coordinator·orphan gate —
|
|
19
|
-
//! packaging 只「装完跑一次」并把结论转成 typed DoctorStatus)
|
|
20
|
-
//! - `pyproject.toml` / `package.json` (**版本号双源漂移** 0.1.4 vs 0.2.11 —— Rust 用
|
|
21
|
-
//! `CARGO_PKG_VERSION` 单一真相源,禁手抄第二处)
|
|
22
|
-
//!
|
|
23
|
-
//! 职责(card §职责):把 1-14 的产物打包(各平台静态二进制)+ 落地(极薄 self-install:SKILL 拷贝 +
|
|
24
|
-
//! PATH 提示 + 跑 doctor)+ self-check + schema/state migration·repair 转调。**产品逻辑全在 step 1-14**
|
|
25
|
-
//! (§8 薄 shim 纪律);packaging 是最末步(15),几乎依赖全链但只调它们的「装/检」面。
|
|
26
|
-
//!
|
|
27
|
-
//! 铁律(card §bug/陷阱):
|
|
28
|
-
//! - **bug-084 同源:rename 在 Windows/跨卷/占用时抛 PermissionError/EXDEV 没人接**。Rust 版
|
|
29
|
-
//! 原子替换二进制(`AtomicReplacePlan{dest,tmp,backup}`)必须 `Result` 强制处理 + 跨卷 fallback
|
|
30
|
-
//! (copy+fsync+rename)+ 失败回滚到 `.previous`,**绝不裸 unwrap/rename**(本 module 的原子替换 /
|
|
31
|
-
//! migration·repair 路径建议局部纪律等同 daemon 门,见 lib.rs §10 锁)。
|
|
32
|
-
//! - **版本号双源漂移**:[`Version`] 单一真相源 = `env!("CARGO_PKG_VERSION")`,禁手抄第二处。
|
|
33
|
-
//! - **engine 三态 + python_fallback 是反例**:Rust 全量后无双引擎、无 fallback;此 module **不存在**
|
|
34
|
-
//! `engine`/`fallback`/`fallback_reason` 字段(§19 散字符串态打地鼠 + §10 不假绿要根除的)。
|
|
35
|
-
//! - **`copytree(dirs_exist_ok=True)` 残留**:install-skill 叠拷使旧 SKILL 被删文件残留;Rust 版拷
|
|
36
|
-
//! skill 前先清目标目录(或 diff 删除)—— [`SkillInstallOutcome`] 记录 removed_stale。
|
|
37
|
-
//! - **uninstall 默认保留 runtime/workspace**:有 team 在跑时勿 purge;[`UninstallOutcome`] 默认
|
|
38
|
-
//! `purged_runtime:false`,且**绝不**默认删 workspace/`.team`。
|
|
39
|
-
//! - **§84 provider-client 规则**:packaging **绝不依赖任何 provider client crate**;`install-skill`
|
|
40
|
-
//! 只拷文件、`doctor` 只调 step 3/11/12 的 trait 入口(注入 mock 时 provider 调用计数 = 0);
|
|
41
|
-
//! installer 路径**绝不触发任何 prompt/token 消耗**。
|
|
42
|
-
//! - **平台能力如实声明**(§8):Windows 仅 tmux backend 时显式标 WSL+tmux 要求或「不支持原生」,
|
|
43
|
-
//! 不假装兼容(能力门归 step 9,packaging 只如实声明 release 矩阵覆盖面)。
|
|
44
|
-
//!
|
|
45
|
-
//! **real-machine / clean-install E2E 标注**:本 module 是 15 步中最薄、最平台门控的一层。下列入口的
|
|
46
|
-
//! 真实落地(文件系统副作用、跨卷 rename、SKILL 真拷、PATH 真探测、二进制原子替换)只能在 §9 验收阶梯的
|
|
47
|
-
//! **真机/容器 clean-install E2E**(`fixture_kind=real`,macOS/Linux clean machine、Windows/WSL 能力判定)
|
|
48
|
-
//! 中验证;纯逻辑部分(版本解析 / 路径布局 / DoctorStatus 转码 / SkillInstallPlan diff)可单测。带
|
|
49
|
-
//! `// REAL-MACHINE-E2E` 标记的字段/分支即「只能真机/容器验」的部分。
|
|
50
|
-
//!
|
|
51
|
-
//! ROUND-0:仅类型 + struct/enum + fn 签名。所有 body = `unimplemented!("step15 port: <what>")`。
|
|
52
|
-
//! fallible 路径返 `Result`/`Option`(§10 实现层禁 unwrap/expect/panic,签名先做成 fallible)。
|
|
53
|
-
//! daemon/CLI entry fns 返 rich `Result<Report, PackagingError>`。`#![deny(...)]` 由 leader 在集成时
|
|
54
|
-
//! 统一加(原子替换/migration·repair 段建议局部等同 daemon 门),本骨架不加。
|
|
55
|
-
|
|
56
|
-
// ROUND-0 skeleton:fn body 全 unimplemented!() → import/field/method 暂未被用;P2 porter 落实现时移除。
|
|
57
|
-
#![allow(
|
|
58
|
-
dead_code,
|
|
59
|
-
unused_imports,
|
|
60
|
-
unused_variables,
|
|
61
|
-
clippy::result_large_err,
|
|
62
|
-
clippy::doc_overindented_list_items,
|
|
63
|
-
clippy::doc_lazy_continuation,
|
|
64
|
-
clippy::io_other_error
|
|
65
|
-
)]
|
|
66
|
-
// §10:原子替换二进制 / migration·repair 路径实现层禁 unwrap/expect/panic(unimplemented!() stub 不被拦);
|
|
67
|
-
// tests 子模块各自 allow。
|
|
68
|
-
#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
|
|
69
|
-
|
|
70
|
-
pub mod install;
|
|
71
|
-
pub mod migrate;
|
|
72
|
-
pub mod repair;
|
|
73
|
-
pub mod types;
|
|
74
|
-
|
|
75
|
-
// ── 重新导出 module 根原本可见的全部条目(保持 `crate::packaging::X` 与测试 `super::*` 解析不变)──
|
|
76
|
-
pub use install::*;
|
|
77
|
-
pub use migrate::*;
|
|
78
|
-
pub use repair::*;
|
|
79
|
-
pub use types::*;
|
|
80
|
-
|
|
81
|
-
// ── REUSE — committed model types(测试经 `super::*` 引用 `Provider`;与原单文件根 import 等价)──
|
|
82
|
-
use crate::model::enums::Provider;
|
|
83
|
-
|
|
84
|
-
// ── REUSE — step 4 event_log(install/upgrade/repair 审计事件;原子替换的 rebuild/rollback 标记)──
|
|
85
|
-
use crate::event_log::EventLog;
|
|
86
|
-
|
|
87
|
-
// ── REUSE — step 5 state(uninstall「有 team 在跑勿删」判定经 state 投影)──
|
|
88
|
-
// `state` 操作 state.json = serde_json::Value;此处仅在 fn 签名内经全限定路径引用,避免未用顶层 import。
|
|
89
|
-
|
|
90
|
-
#[cfg(test)]
|
|
91
|
-
mod tests;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
//!
|
|
2
|
-
//! schema migration / repair 转调:`doctor --fix-schema` → step 3 `fix_schema_layout`,包成
|
|
3
|
-
//! [`MigrationOutcome`]。
|
|
4
|
-
|
|
5
|
-
use std::path::Path;
|
|
6
|
-
|
|
7
|
-
use super::types::{MigrationOutcome, PackagingError};
|
|
8
|
-
use crate::db::migration::{fix_schema_layout, FixResult};
|
|
9
|
-
use crate::db::schema::SCHEMA_VERSION;
|
|
10
|
-
|
|
11
|
-
///
|
|
12
|
-
/// `team-agent doctor --fix-schema`(`commands.py:239`)→ 转调 step 3 [`fix_schema_layout`]。
|
|
13
|
-
/// migration·repair 实体在 step 3;packaging 仅转调 + 包成 [`MigrationOutcome`]。
|
|
14
|
-
/// // REAL-MACHINE-E2E:破坏性 rebuild(撞锁/备份/rollback)的真路径需真机验;转调逻辑可单测。
|
|
15
|
-
pub fn repair_schema(workspace: &Path) -> Result<MigrationOutcome, PackagingError> {
|
|
16
|
-
match fix_schema_layout(workspace, SCHEMA_VERSION)? {
|
|
17
|
-
FixResult::Missing(diagnosis) => Ok(MigrationOutcome::UpToDate { diagnosis }),
|
|
18
|
-
FixResult::Blocked { reason } => Ok(MigrationOutcome::Blocked { reason }),
|
|
19
|
-
FixResult::Fixed {
|
|
20
|
-
diagnosis,
|
|
21
|
-
rebuilds,
|
|
22
|
-
} if rebuilds.is_empty() => Ok(MigrationOutcome::UpToDate { diagnosis }),
|
|
23
|
-
FixResult::Fixed {
|
|
24
|
-
diagnosis,
|
|
25
|
-
rebuilds,
|
|
26
|
-
} => Ok(MigrationOutcome::Migrated {
|
|
27
|
-
fix: FixResult::Fixed {
|
|
28
|
-
diagnosis,
|
|
29
|
-
rebuilds,
|
|
30
|
-
},
|
|
31
|
-
}),
|
|
32
|
-
}
|
|
33
|
-
}
|