@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,562 +0,0 @@
|
|
|
1
|
-
//! ---
|
|
2
|
-
//! purpose: 把 leader 手写的三件判据夹具迁成 cargo test 能跑到的测试基建
|
|
3
|
-
//! contract:
|
|
4
|
-
//! provides:
|
|
5
|
-
//! - name: assert_probe_red
|
|
6
|
-
//! what: 跑 probe,要求修复前非零且不是 exit 2;已绿则 Fail,exit 2 保持 Unjudgeable
|
|
7
|
-
//! - name: assert_probe_two_sided
|
|
8
|
-
//! what: 先要求坏状态红,再跑 make_green,再要求好状态绿;缺任一半则 Fail,exit 2 不折态
|
|
9
|
-
//! - name: check_brief
|
|
10
|
-
//! what: lint 任务书是否含既有四条硬条款;读不到则 Unjudgeable,缺条款则 Fail
|
|
11
|
-
//! depends:
|
|
12
|
-
//! - sh(只用来跑调用方提供的 probe / make_green 脚本)
|
|
13
|
-
//! boundary:
|
|
14
|
-
//! - 不删除、不改写 .team/probes 下原三件;去留由审查席裁定
|
|
15
|
-
//! - 不发明第四个退出码;超预算与不适用都保持 exit 2(不可判),不折进 0/1
|
|
16
|
-
//! - 不写产品路径判据,只夹住「判据本身有没有分辨力」
|
|
17
|
-
//! - ⛔ 「工具自己坏了」不许叫 Unjudgeable:sh 起不来 / 收不到输出 / 子进程被信号打死
|
|
18
|
-
//! 一律走 GateVerdict::ToolFailure,与探针自报 exit 2 是两个值
|
|
19
|
-
//! maturity: wired
|
|
20
|
-
//! ---
|
|
21
|
-
|
|
22
|
-
use std::cell::{Cell, RefCell};
|
|
23
|
-
use std::fs;
|
|
24
|
-
use std::path::{Path, PathBuf};
|
|
25
|
-
use std::process::{Command, Stdio};
|
|
26
|
-
use std::sync::atomic::{AtomicU64, Ordering};
|
|
27
|
-
use std::time::{SystemTime, UNIX_EPOCH};
|
|
28
|
-
|
|
29
|
-
static SEQ: AtomicU64 = AtomicU64::new(0);
|
|
30
|
-
|
|
31
|
-
/// 夹具四态里实际会出口的三值(超预算与不适用都走 Unjudgeable,exit 2,与原脚本一致),
|
|
32
|
-
/// 外加一个**不属于四态**的出口:ToolFailure —— 量具自己坏了,不是被测对象不可判。
|
|
33
|
-
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
34
|
-
enum GateVerdict {
|
|
35
|
-
Pass,
|
|
36
|
-
Fail,
|
|
37
|
-
Unjudgeable,
|
|
38
|
-
/// 量具坏了:sh 起不来 / 输出收不回来 / 子进程被信号打死。
|
|
39
|
-
/// ⛔ 绝不塌进 Unjudgeable——那样「探针真报不可判」与「探针根本没跑」就没有分辨力。
|
|
40
|
-
ToolFailure(ShFailure),
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/// run_sh 的失败分类。Debug 打出来即为一眼可辨的失败原因。
|
|
44
|
-
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
45
|
-
enum ShFailure {
|
|
46
|
-
/// 起不了 sh(CI 上没有 sh / PATH 不对 / 权限)——⛔ 与探针 exit 2 无关。
|
|
47
|
-
Spawn { script: String, error: String },
|
|
48
|
-
/// sh 起来了但收不回 stdout/stderr。
|
|
49
|
-
OutputCapture { script: String, error: String },
|
|
50
|
-
/// 子进程没有退出码:被信号打死(unix 下带信号号)。
|
|
51
|
-
KilledBySignal { script: String, signal: Option<i32> },
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
impl GateVerdict {
|
|
55
|
-
fn from_probe_exit(code: i32) -> ProbeOutcome {
|
|
56
|
-
match code {
|
|
57
|
-
0 => ProbeOutcome::Green,
|
|
58
|
-
2 => ProbeOutcome::Unjudgeable,
|
|
59
|
-
_ => ProbeOutcome::Red,
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
|
65
|
-
enum ProbeOutcome {
|
|
66
|
-
Green,
|
|
67
|
-
Red,
|
|
68
|
-
Unjudgeable,
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/// ---
|
|
72
|
-
/// purpose: 因果性夹具——probe 必须在修复前判红
|
|
73
|
-
/// params:
|
|
74
|
-
/// probe: 被夹的判据脚本路径
|
|
75
|
-
/// returns: Pass=见到红;Fail=修复前已绿;Unjudgeable=缺文件或 probe 自报 exit 2;
|
|
76
|
-
/// ToolFailure=sh 根本没跑起来/输出丢了/被信号打死(量具坏,非不可判)
|
|
77
|
-
/// ---
|
|
78
|
-
fn assert_probe_red(probe: &Path) -> GateVerdict {
|
|
79
|
-
if !probe.is_file() {
|
|
80
|
-
return GateVerdict::Unjudgeable;
|
|
81
|
-
}
|
|
82
|
-
let log = probe
|
|
83
|
-
.parent()
|
|
84
|
-
.unwrap_or_else(|| Path::new("."))
|
|
85
|
-
.join("RED-EVIDENCE.log");
|
|
86
|
-
let _ = fs::write(
|
|
87
|
-
&log,
|
|
88
|
-
format!("#PROBE {}\n#---- 原始输出 ----\n", probe.display()),
|
|
89
|
-
);
|
|
90
|
-
match run_sh(probe, &log) {
|
|
91
|
-
Err(failure) => GateVerdict::ToolFailure(failure),
|
|
92
|
-
Ok(0) => GateVerdict::Fail,
|
|
93
|
-
Ok(2) => GateVerdict::Unjudgeable,
|
|
94
|
-
Ok(_) => GateVerdict::Pass,
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
/// ---
|
|
99
|
-
/// purpose: 两头夹住——坏状态必须红,好状态必须绿
|
|
100
|
-
/// params:
|
|
101
|
-
/// probe: 被夹的判据脚本
|
|
102
|
-
/// make_green: 只许动隔离夹具的阳性对照
|
|
103
|
-
/// returns: 两半都成立才 Pass;因果性或可满足性缺一则 Fail;缺脚本 / 对照失败 / exit 2 为 Unjudgeable;
|
|
104
|
-
/// 任一次 sh 没跑起来则 ToolFailure(量具坏,非不可判)
|
|
105
|
-
/// ---
|
|
106
|
-
fn assert_probe_two_sided(probe: &Path, make_green: &Path) -> GateVerdict {
|
|
107
|
-
if !probe.is_file() || !make_green.is_file() {
|
|
108
|
-
return GateVerdict::Unjudgeable;
|
|
109
|
-
}
|
|
110
|
-
let log = probe
|
|
111
|
-
.parent()
|
|
112
|
-
.unwrap_or_else(|| Path::new("."))
|
|
113
|
-
.join("TWO-SIDED-EVIDENCE.log");
|
|
114
|
-
let _ = fs::write(
|
|
115
|
-
&log,
|
|
116
|
-
format!(
|
|
117
|
-
"#PROBE {}\n#MAKEGREEN {}\n",
|
|
118
|
-
probe.display(),
|
|
119
|
-
make_green.display()
|
|
120
|
-
),
|
|
121
|
-
);
|
|
122
|
-
|
|
123
|
-
match run_sh(probe, &log) {
|
|
124
|
-
Err(failure) => return GateVerdict::ToolFailure(failure),
|
|
125
|
-
Ok(0) => return GateVerdict::Fail,
|
|
126
|
-
Ok(2) => return GateVerdict::Unjudgeable,
|
|
127
|
-
Ok(_) => {}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
match run_sh(make_green, &log) {
|
|
131
|
-
Err(failure) => return GateVerdict::ToolFailure(failure),
|
|
132
|
-
Ok(0) => {}
|
|
133
|
-
// 阳性对照自己没做成(脚本跑了但没成功)——这是真·不可判,不是量具坏。
|
|
134
|
-
Ok(_) => return GateVerdict::Unjudgeable,
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
match run_sh(probe, &log) {
|
|
138
|
-
Err(failure) => GateVerdict::ToolFailure(failure),
|
|
139
|
-
Ok(0) => GateVerdict::Pass,
|
|
140
|
-
Ok(2) => GateVerdict::Unjudgeable,
|
|
141
|
-
Ok(_) => GateVerdict::Fail,
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
const BRIEF_REQUIRED: &[(&str, &[&str])] = &[
|
|
146
|
-
(
|
|
147
|
-
"report_result 不传 task_id",
|
|
148
|
-
&["不要传 task_id", "不传 task_id", "留空走框架默认归属"],
|
|
149
|
-
),
|
|
150
|
-
(
|
|
151
|
-
"禁止改判据",
|
|
152
|
-
&["不许改判据", "不得修改判据", "判据由", "不许动判据"],
|
|
153
|
-
),
|
|
154
|
-
("产物落地路径", &[".team/nodes/"]),
|
|
155
|
-
(
|
|
156
|
-
"验收判据是行为自证",
|
|
157
|
-
&["行为自证", "退出码", "expected_exit_code"],
|
|
158
|
-
),
|
|
159
|
-
];
|
|
160
|
-
|
|
161
|
-
/// ---
|
|
162
|
-
/// purpose: 任务书结构 lint,只挡「缺了必失败」的已知条款
|
|
163
|
-
/// params:
|
|
164
|
-
/// task_md: TASK.md 路径
|
|
165
|
-
/// returns: 条款齐全 Pass;缺条款或过短 Fail;读不到 Unjudgeable
|
|
166
|
-
/// ---
|
|
167
|
-
fn check_brief(task_md: &Path) -> GateVerdict {
|
|
168
|
-
let text = match fs::read_to_string(task_md) {
|
|
169
|
-
Ok(t) => t,
|
|
170
|
-
Err(_) => return GateVerdict::Unjudgeable,
|
|
171
|
-
};
|
|
172
|
-
if text.trim().len() < 200 {
|
|
173
|
-
return GateVerdict::Fail;
|
|
174
|
-
}
|
|
175
|
-
let missing = BRIEF_REQUIRED
|
|
176
|
-
.iter()
|
|
177
|
-
.any(|(_name, keys)| !keys.iter().any(|k| text.contains(k)));
|
|
178
|
-
if missing {
|
|
179
|
-
GateVerdict::Fail
|
|
180
|
-
} else {
|
|
181
|
-
GateVerdict::Pass
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
/// ---
|
|
186
|
-
/// purpose: 跑一个 sh 脚本并把失败原因分类带回来
|
|
187
|
-
/// returns: Ok(退出码);Err(ShFailure) 区分 起不来 / 收不到输出 / 被信号打死
|
|
188
|
-
/// ---
|
|
189
|
-
/// ⛔ 不许再用 `.ok()?` 把 io::Error 吞成 None——那会让「量具坏」与「exit 2」同值。
|
|
190
|
-
/// 拆成 spawn + wait_with_output 两步,正是为了让前两类可分。
|
|
191
|
-
fn run_sh(script: &Path, log: &Path) -> Result<i32, ShFailure> {
|
|
192
|
-
let name = script.display().to_string();
|
|
193
|
-
let child = Command::new(shell_for_this_call())
|
|
194
|
-
.arg(script)
|
|
195
|
-
// 钉死子 shell 自己的 PATH:它内部再解析裸名外部命令(如 touch)时不能继承
|
|
196
|
-
// 父进程当次可能已被并发测试改写的 PATH(绝对路径只保证这一次 spawn 本身不查 PATH)。
|
|
197
|
-
.env("PATH", "/usr/bin:/bin")
|
|
198
|
-
.stdout(Stdio::piped())
|
|
199
|
-
.stderr(Stdio::piped())
|
|
200
|
-
.spawn()
|
|
201
|
-
.map_err(|error| ShFailure::Spawn {
|
|
202
|
-
script: name.clone(),
|
|
203
|
-
error: error.to_string(),
|
|
204
|
-
})?;
|
|
205
|
-
let output = child
|
|
206
|
-
.wait_with_output()
|
|
207
|
-
.map_err(|error| ShFailure::OutputCapture {
|
|
208
|
-
script: name.clone(),
|
|
209
|
-
error: error.to_string(),
|
|
210
|
-
})?;
|
|
211
|
-
let mut buf = fs::read(log).unwrap_or_default();
|
|
212
|
-
buf.extend_from_slice(&output.stdout);
|
|
213
|
-
buf.extend_from_slice(&output.stderr);
|
|
214
|
-
let _ = fs::write(log, buf);
|
|
215
|
-
output
|
|
216
|
-
.status
|
|
217
|
-
.code()
|
|
218
|
-
.ok_or_else(|| ShFailure::KilledBySignal {
|
|
219
|
-
script: name,
|
|
220
|
-
signal: termination_signal(&output.status),
|
|
221
|
-
})
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
/// 一个**绝对路径**的不存在解释器。绝对路径 ⇒ execvp 不查 PATH,必然 ENOENT。
|
|
225
|
-
/// ⛔ 不用「unset PATH」那一招:unix 下 PATH 未设时 execvp 回落 confstr(_CS_PATH),
|
|
226
|
-
/// 仍能找到 /bin/sh,破坏是无效的。
|
|
227
|
-
const UNSPAWNABLE_SHELL: &str = "/nonexistent-gate-fixtures/no-such-shell";
|
|
228
|
-
|
|
229
|
-
thread_local! {
|
|
230
|
-
/// 只在**本线程**生效的量具破坏开关:列出「第几次 run_sh 调用该用坏解释器」。
|
|
231
|
-
/// 线程局部 ⇒ 不碰 PATH、不碰任何进程级环境,绝不外溢到并发跑的别的测试。
|
|
232
|
-
static BREAK_SH_ON_CALLS: RefCell<Vec<usize>> = const { RefCell::new(Vec::new()) };
|
|
233
|
-
static SH_CALL_SEQ: Cell<usize> = const { Cell::new(0) };
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
fn shell_for_this_call() -> &'static str {
|
|
237
|
-
let n = SH_CALL_SEQ.with(|seq| {
|
|
238
|
-
let n = seq.get();
|
|
239
|
-
seq.set(n + 1);
|
|
240
|
-
n
|
|
241
|
-
});
|
|
242
|
-
if BREAK_SH_ON_CALLS.with(|calls| calls.borrow().contains(&n)) {
|
|
243
|
-
UNSPAWNABLE_SHELL
|
|
244
|
-
} else {
|
|
245
|
-
// 绝对路径 ⇒ execve 不查 PATH:不与并发跑的、会原地改写进程级 PATH 的其它测试赛跑。
|
|
246
|
-
"/bin/sh"
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
/// 在本线程内令第 `calls` 次 run_sh 调用的解释器起不来,跑完立刻复位。
|
|
251
|
-
/// 用于在**健康环境**下主动造出「量具失效」,不依赖运行环境恰好坏掉。
|
|
252
|
-
fn with_broken_sh_on<T>(calls: &[usize], body: impl FnOnce() -> T) -> T {
|
|
253
|
-
SH_CALL_SEQ.with(|seq| seq.set(0));
|
|
254
|
-
BREAK_SH_ON_CALLS.with(|c| *c.borrow_mut() = calls.to_vec());
|
|
255
|
-
let out = body();
|
|
256
|
-
BREAK_SH_ON_CALLS.with(|c| c.borrow_mut().clear());
|
|
257
|
-
SH_CALL_SEQ.with(|seq| seq.set(0));
|
|
258
|
-
out
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
#[cfg(unix)]
|
|
262
|
-
fn termination_signal(status: &std::process::ExitStatus) -> Option<i32> {
|
|
263
|
-
use std::os::unix::process::ExitStatusExt;
|
|
264
|
-
status.signal()
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
#[cfg(not(unix))]
|
|
268
|
-
fn termination_signal(_status: &std::process::ExitStatus) -> Option<i32> {
|
|
269
|
-
None
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
fn scratch_dir() -> PathBuf {
|
|
273
|
-
// scratch 根必须可移植:CI(ubuntu) 上 `/Volumes/...` 不存在且 `/` 不可写,
|
|
274
|
-
// create_dir_all 直接 errno 13。⛔ 不硬编码任何绝对路径;默认走标准临时目录
|
|
275
|
-
// (`std::env::temp_dir()`,尊重 TMPDIR),`TEAM_AGENT_TEST_TMP` 仍可覆盖。
|
|
276
|
-
let base = std::env::var_os("TEAM_AGENT_TEST_TMP")
|
|
277
|
-
.map(PathBuf::from)
|
|
278
|
-
.unwrap_or_else(std::env::temp_dir);
|
|
279
|
-
let n = SEQ.fetch_add(1, Ordering::Relaxed);
|
|
280
|
-
let nanos = SystemTime::now()
|
|
281
|
-
.duration_since(UNIX_EPOCH)
|
|
282
|
-
.map(|d| d.as_nanos())
|
|
283
|
-
.unwrap_or(0);
|
|
284
|
-
let dir = base.join(format!(
|
|
285
|
-
"gate-fixtures-{}-{}-{}",
|
|
286
|
-
std::process::id(),
|
|
287
|
-
nanos,
|
|
288
|
-
n
|
|
289
|
-
));
|
|
290
|
-
let _ = fs::remove_dir_all(&dir);
|
|
291
|
-
fs::create_dir_all(&dir).expect("create gate-fixtures scratch");
|
|
292
|
-
dir
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
fn write_sh(dir: &Path, name: &str, body: &str) -> PathBuf {
|
|
296
|
-
let path = dir.join(name);
|
|
297
|
-
fs::write(&path, format!("#!/bin/sh\nset -u\n{body}\n")).expect("write fixture script");
|
|
298
|
-
path
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
fn valid_brief() -> String {
|
|
302
|
-
// 远超 200 字符,四条硬条款各出现至少一处。故意弄坏测试会删掉其中一条。
|
|
303
|
-
format!(
|
|
304
|
-
"本任务书给下一棒执行。产物必须落在 .team/nodes/gate-governance/ 下。\n\
|
|
305
|
-
调 report_result 不要传 task_id,留空走框架默认归属。\n\
|
|
306
|
-
不许改判据。探针与夹具实现席都不得修改。\n\
|
|
307
|
-
验收必须是行为自证:看退出码 / expected_exit_code,不要看席位自报。\n\
|
|
308
|
-
填充段落:{}。\n",
|
|
309
|
-
"约束坐标与隔离环境说明。".repeat(8)
|
|
310
|
-
)
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
#[test]
|
|
314
|
-
fn assert_probe_red_passes_on_a_genuinely_red_probe() {
|
|
315
|
-
let dir = scratch_dir();
|
|
316
|
-
let probe = write_sh(&dir, "probe.sh", "exit 1");
|
|
317
|
-
assert_eq!(assert_probe_red(&probe), GateVerdict::Pass);
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
#[test]
|
|
321
|
-
fn assert_probe_red_fails_when_subject_is_already_green() {
|
|
322
|
-
let dir = scratch_dir();
|
|
323
|
-
let good = write_sh(&dir, "ok.sh", "exit 1");
|
|
324
|
-
assert_eq!(assert_probe_red(&good), GateVerdict::Pass);
|
|
325
|
-
let broken = write_sh(&dir, "already-green.sh", "exit 0");
|
|
326
|
-
assert_eq!(assert_probe_red(&broken), GateVerdict::Fail);
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
#[test]
|
|
330
|
-
fn assert_probe_red_keeps_exit2_unjudgeable_not_red_or_green() {
|
|
331
|
-
let dir = scratch_dir();
|
|
332
|
-
let probe = write_sh(&dir, "probe.sh", "exit 2");
|
|
333
|
-
let v = assert_probe_red(&probe);
|
|
334
|
-
assert_eq!(v, GateVerdict::Unjudgeable);
|
|
335
|
-
assert_ne!(v, GateVerdict::Fail);
|
|
336
|
-
assert_ne!(v, GateVerdict::Pass);
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
#[test]
|
|
340
|
-
fn assert_probe_red_missing_probe_is_unjudgeable() {
|
|
341
|
-
let dir = scratch_dir();
|
|
342
|
-
assert_eq!(
|
|
343
|
-
assert_probe_red(&dir.join("nope.sh")),
|
|
344
|
-
GateVerdict::Unjudgeable
|
|
345
|
-
);
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
#[test]
|
|
349
|
-
fn assert_probe_two_sided_passes_when_both_halves_hold() {
|
|
350
|
-
let dir = scratch_dir();
|
|
351
|
-
let flag = dir.join("fixed");
|
|
352
|
-
let probe = write_sh(
|
|
353
|
-
&dir,
|
|
354
|
-
"probe.sh",
|
|
355
|
-
&format!(
|
|
356
|
-
"if [ -f '{}' ]; then exit 0; else exit 1; fi",
|
|
357
|
-
flag.display()
|
|
358
|
-
),
|
|
359
|
-
);
|
|
360
|
-
let mk = write_sh(
|
|
361
|
-
&dir,
|
|
362
|
-
"make_green.sh",
|
|
363
|
-
&format!("touch '{}'", flag.display()),
|
|
364
|
-
);
|
|
365
|
-
assert_eq!(assert_probe_two_sided(&probe, &mk), GateVerdict::Pass);
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
#[test]
|
|
369
|
-
fn assert_probe_two_sided_fails_when_probe_is_green_before_fix() {
|
|
370
|
-
let dir = scratch_dir();
|
|
371
|
-
let probe = write_sh(&dir, "probe.sh", "exit 0");
|
|
372
|
-
let mk = write_sh(&dir, "make_green.sh", "exit 0");
|
|
373
|
-
assert_eq!(assert_probe_two_sided(&probe, &mk), GateVerdict::Fail);
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
#[test]
|
|
377
|
-
fn assert_probe_two_sided_fails_when_probe_can_never_go_green() {
|
|
378
|
-
let dir = scratch_dir();
|
|
379
|
-
let probe = write_sh(&dir, "probe.sh", "exit 1");
|
|
380
|
-
let mk = write_sh(&dir, "make_green.sh", "exit 0");
|
|
381
|
-
assert_eq!(assert_probe_two_sided(&probe, &mk), GateVerdict::Fail);
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
#[test]
|
|
385
|
-
fn assert_probe_two_sided_keeps_exit2_unjudgeable_on_either_half() {
|
|
386
|
-
let dir = scratch_dir();
|
|
387
|
-
let always2 = write_sh(&dir, "u.sh", "exit 2");
|
|
388
|
-
let mk = write_sh(&dir, "make_green.sh", "exit 0");
|
|
389
|
-
let v1 = assert_probe_two_sided(&always2, &mk);
|
|
390
|
-
assert_eq!(v1, GateVerdict::Unjudgeable);
|
|
391
|
-
assert_ne!(v1, GateVerdict::Fail);
|
|
392
|
-
assert_ne!(v1, GateVerdict::Pass);
|
|
393
|
-
|
|
394
|
-
let flag = dir.join("fixed");
|
|
395
|
-
let probe = write_sh(
|
|
396
|
-
&dir,
|
|
397
|
-
"probe.sh",
|
|
398
|
-
&format!(
|
|
399
|
-
"if [ -f '{}' ]; then exit 2; else exit 1; fi",
|
|
400
|
-
flag.display()
|
|
401
|
-
),
|
|
402
|
-
);
|
|
403
|
-
let mk2 = write_sh(&dir, "mk2.sh", &format!("touch '{}'", flag.display()));
|
|
404
|
-
let v2 = assert_probe_two_sided(&probe, &mk2);
|
|
405
|
-
assert_eq!(v2, GateVerdict::Unjudgeable);
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
#[test]
|
|
409
|
-
fn assert_probe_two_sided_make_green_failure_is_unjudgeable() {
|
|
410
|
-
let dir = scratch_dir();
|
|
411
|
-
let probe = write_sh(&dir, "probe.sh", "exit 1");
|
|
412
|
-
let mk = write_sh(&dir, "make_green.sh", "exit 1");
|
|
413
|
-
assert_eq!(
|
|
414
|
-
assert_probe_two_sided(&probe, &mk),
|
|
415
|
-
GateVerdict::Unjudgeable
|
|
416
|
-
);
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
#[test]
|
|
420
|
-
fn check_brief_passes_when_all_required_clauses_present() {
|
|
421
|
-
let dir = scratch_dir();
|
|
422
|
-
let path = dir.join("TASK.md");
|
|
423
|
-
fs::write(&path, valid_brief()).unwrap();
|
|
424
|
-
assert_eq!(check_brief(&path), GateVerdict::Pass);
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
#[test]
|
|
428
|
-
fn check_brief_fails_when_one_required_clause_is_removed() {
|
|
429
|
-
let dir = scratch_dir();
|
|
430
|
-
let good = dir.join("good.md");
|
|
431
|
-
fs::write(&good, valid_brief()).unwrap();
|
|
432
|
-
assert_eq!(check_brief(&good), GateVerdict::Pass);
|
|
433
|
-
|
|
434
|
-
let broken = valid_brief()
|
|
435
|
-
.replace("不许改判据", "")
|
|
436
|
-
.replace("不得修改判据", "")
|
|
437
|
-
.replace("判据由", "")
|
|
438
|
-
.replace("不许动判据", "");
|
|
439
|
-
let path = dir.join("TASK.md");
|
|
440
|
-
fs::write(&path, broken).unwrap();
|
|
441
|
-
assert_eq!(check_brief(&path), GateVerdict::Fail);
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
#[test]
|
|
445
|
-
fn check_brief_unreadable_is_unjudgeable_not_fail() {
|
|
446
|
-
let dir = scratch_dir();
|
|
447
|
-
let v = check_brief(&dir.join("missing.md"));
|
|
448
|
-
assert_eq!(v, GateVerdict::Unjudgeable);
|
|
449
|
-
assert_ne!(v, GateVerdict::Fail);
|
|
450
|
-
assert_ne!(v, GateVerdict::Pass);
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
#[test]
|
|
454
|
-
fn check_brief_too_short_is_fail() {
|
|
455
|
-
let dir = scratch_dir();
|
|
456
|
-
let path = dir.join("TASK.md");
|
|
457
|
-
fs::write(&path, "太短").unwrap();
|
|
458
|
-
assert_eq!(check_brief(&path), GateVerdict::Fail);
|
|
459
|
-
}
|
|
460
|
-
|
|
461
|
-
#[test]
|
|
462
|
-
fn four_state_probe_red_is_not_collapsed_to_boolean() {
|
|
463
|
-
let dir = scratch_dir();
|
|
464
|
-
let green = write_sh(&dir, "g.sh", "exit 0");
|
|
465
|
-
let red = write_sh(&dir, "r.sh", "exit 7");
|
|
466
|
-
let unj = write_sh(&dir, "u.sh", "exit 2");
|
|
467
|
-
assert_eq!(GateVerdict::from_probe_exit(0), ProbeOutcome::Green);
|
|
468
|
-
assert_eq!(GateVerdict::from_probe_exit(7), ProbeOutcome::Red);
|
|
469
|
-
assert_eq!(GateVerdict::from_probe_exit(2), ProbeOutcome::Unjudgeable);
|
|
470
|
-
assert_eq!(assert_probe_red(&green), GateVerdict::Fail);
|
|
471
|
-
assert_eq!(assert_probe_red(&red), GateVerdict::Pass);
|
|
472
|
-
assert_eq!(assert_probe_red(&unj), GateVerdict::Unjudgeable);
|
|
473
|
-
}
|
|
474
|
-
|
|
475
|
-
/// 齿:量具失效必须产生 ToolFailure,⛔ 不得塌回 Unjudgeable。
|
|
476
|
-
///
|
|
477
|
-
/// 这条守的是 fea1e2fd 新立的不变量本身。没有它,把三处
|
|
478
|
-
/// `Err(f) => ToolFailure(f)` 改回 `Err(_) => Unjudgeable` 不会有任何测试报警,
|
|
479
|
-
/// 那三条刚封住的恒绿空壳就会原样复活。
|
|
480
|
-
///
|
|
481
|
-
/// 破坏是**自己造的**(thread-local 把某一次 run_sh 的解释器换成绝对不存在的路径),
|
|
482
|
-
/// 因此在健康环境下也能跑、也必须绿;⛔ 不依赖运行环境恰好坏掉。
|
|
483
|
-
#[test]
|
|
484
|
-
fn tool_failure_is_never_collapsed_into_unjudgeable() {
|
|
485
|
-
let dir = scratch_dir();
|
|
486
|
-
let two = write_sh(&dir, "u.sh", "exit 2");
|
|
487
|
-
let red = write_sh(&dir, "r.sh", "exit 1");
|
|
488
|
-
let mk = write_sh(&dir, "make_green.sh", "exit 0");
|
|
489
|
-
|
|
490
|
-
// 阳性对照:同一个 exit 2 探针,sh 健康时是真·不可判。
|
|
491
|
-
let healthy = assert_probe_red(&two);
|
|
492
|
-
assert_eq!(
|
|
493
|
-
healthy,
|
|
494
|
-
GateVerdict::Unjudgeable,
|
|
495
|
-
"阳性对照失效:健康 sh 下 exit 2 必须是 Unjudgeable"
|
|
496
|
-
);
|
|
497
|
-
|
|
498
|
-
// 齿① assert_probe_red 的那次 run_sh。
|
|
499
|
-
let t1 = with_broken_sh_on(&[0], || assert_probe_red(&two));
|
|
500
|
-
println!("[齿① assert_probe_red ] {t1:?}");
|
|
501
|
-
assert_ne!(
|
|
502
|
-
t1,
|
|
503
|
-
GateVerdict::Unjudgeable,
|
|
504
|
-
"量具起不来被塌回 Unjudgeable:与探针自报 exit 2 无法区分。t1={t1:?}"
|
|
505
|
-
);
|
|
506
|
-
assert!(
|
|
507
|
-
matches!(t1, GateVerdict::ToolFailure(ShFailure::Spawn { .. })),
|
|
508
|
-
"量具起不来必须是 ToolFailure(Spawn)。t1={t1:?}"
|
|
509
|
-
);
|
|
510
|
-
|
|
511
|
-
// 齿② assert_probe_two_sided 第 1 次 run_sh(坏态探针)。
|
|
512
|
-
let t2 = with_broken_sh_on(&[0], || assert_probe_two_sided(&red, &mk));
|
|
513
|
-
println!("[齿② two_sided 坏态探针 ] {t2:?}");
|
|
514
|
-
assert_ne!(
|
|
515
|
-
t2,
|
|
516
|
-
GateVerdict::Unjudgeable,
|
|
517
|
-
"two_sided 第一次 run_sh 塌态。t2={t2:?}"
|
|
518
|
-
);
|
|
519
|
-
assert!(
|
|
520
|
-
matches!(t2, GateVerdict::ToolFailure(ShFailure::Spawn { .. })),
|
|
521
|
-
"t2={t2:?}"
|
|
522
|
-
);
|
|
523
|
-
|
|
524
|
-
// 齿③ 第 2 次 run_sh(阳性对照 make_green)——与「对照跑了但没成功」必须是两回事。
|
|
525
|
-
let t3 = with_broken_sh_on(&[1], || assert_probe_two_sided(&red, &mk));
|
|
526
|
-
println!("[齿③ two_sided make_green ] {t3:?}");
|
|
527
|
-
assert_ne!(
|
|
528
|
-
t3,
|
|
529
|
-
GateVerdict::Unjudgeable,
|
|
530
|
-
"对照脚本起不来 ≠ 对照没做成,⛔ 不许同值。t3={t3:?}"
|
|
531
|
-
);
|
|
532
|
-
assert!(
|
|
533
|
-
matches!(t3, GateVerdict::ToolFailure(ShFailure::Spawn { .. })),
|
|
534
|
-
"t3={t3:?}"
|
|
535
|
-
);
|
|
536
|
-
|
|
537
|
-
// 齿④ 第 3 次 run_sh(修好后复跑探针)。
|
|
538
|
-
let flag = dir.join("fixed");
|
|
539
|
-
let probe = write_sh(
|
|
540
|
-
&dir,
|
|
541
|
-
"probe.sh",
|
|
542
|
-
&format!(
|
|
543
|
-
"if [ -f '{}' ]; then exit 0; else exit 1; fi",
|
|
544
|
-
flag.display()
|
|
545
|
-
),
|
|
546
|
-
);
|
|
547
|
-
let mk2 = write_sh(&dir, "mk2.sh", &format!("touch '{}'", flag.display()));
|
|
548
|
-
let t4 = with_broken_sh_on(&[2], || assert_probe_two_sided(&probe, &mk2));
|
|
549
|
-
println!("[齿④ two_sided 复跑探针 ] {t4:?}");
|
|
550
|
-
assert_ne!(t4, GateVerdict::Unjudgeable, "t4={t4:?}");
|
|
551
|
-
assert!(
|
|
552
|
-
matches!(t4, GateVerdict::ToolFailure(ShFailure::Spawn { .. })),
|
|
553
|
-
"t4={t4:?}"
|
|
554
|
-
);
|
|
555
|
-
|
|
556
|
-
// 破坏开关必须已复位:紧接着的健康调用不得再坏。
|
|
557
|
-
assert_eq!(
|
|
558
|
-
assert_probe_red(&two),
|
|
559
|
-
GateVerdict::Unjudgeable,
|
|
560
|
-
"with_broken_sh_on 没复位,破坏外溢"
|
|
561
|
-
);
|
|
562
|
-
}
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
//! purpose: copilot 席位角色文件缺 model 时仍能正常启动
|
|
2
|
-
//! contract: 缺 model 的 copilot 角色启动成功并真的 spawn worker
|
|
3
|
-
//! boundary: legacy Grok worker runtime 已移除(grok 角色现走 grok_build 合约叶),
|
|
4
|
-
//! 本文件只保留 copilot 缺 model 的回归钉子
|
|
5
|
-
|
|
6
|
-
#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
|
|
7
|
-
|
|
8
|
-
#[path = "../../../tests/support/hermetic.rs"]
|
|
9
|
-
mod hermetic_guard;
|
|
10
|
-
#[allow(dead_code)]
|
|
11
|
-
fn _hermetic_boundary_marker(_: &hermetic_guard::HermeticTestEnv) {}
|
|
12
|
-
|
|
13
|
-
fn enter_hermetic(tag: &str) -> hermetic_guard::HermeticTestEnv {
|
|
14
|
-
hermetic_guard::HermeticTestEnv::enter_with_leader(tag)
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
use std::path::{Path, PathBuf};
|
|
18
|
-
use std::sync::atomic::{AtomicU64, Ordering};
|
|
19
|
-
|
|
20
|
-
use serial_test::serial;
|
|
21
|
-
use team_agent::lifecycle::quick_start_with_transport_in_workspace;
|
|
22
|
-
use team_agent::transport::test_support::OfflineTransport;
|
|
23
|
-
|
|
24
|
-
/// copilot 角色缺 model ⇒ 行为不变(仍能启动)。
|
|
25
|
-
#[test]
|
|
26
|
-
#[serial(env)]
|
|
27
|
-
fn copilot_role_missing_model_still_starts() {
|
|
28
|
-
let _hermetic = enter_hermetic("grok-copilot-missing-model");
|
|
29
|
-
let ws = tmp_dir("copilot-no-model");
|
|
30
|
-
super::launch_spawn::seed_healthy_coordinator(&ws);
|
|
31
|
-
let team = write_role_team(
|
|
32
|
-
&ws,
|
|
33
|
-
"copilotteam",
|
|
34
|
-
"copiloter",
|
|
35
|
-
"copilot",
|
|
36
|
-
None,
|
|
37
|
-
"Copilot Worker",
|
|
38
|
-
);
|
|
39
|
-
let transport = OfflineTransport::new();
|
|
40
|
-
|
|
41
|
-
let result = quick_start_with_transport_in_workspace(
|
|
42
|
-
&ws,
|
|
43
|
-
&team,
|
|
44
|
-
None,
|
|
45
|
-
true,
|
|
46
|
-
Some("copilotteam"),
|
|
47
|
-
&transport,
|
|
48
|
-
);
|
|
49
|
-
assert!(
|
|
50
|
-
result.is_ok(),
|
|
51
|
-
"copilot role without model must keep starting; err={result:?}"
|
|
52
|
-
);
|
|
53
|
-
let argv = first_spawn_argv(&transport);
|
|
54
|
-
assert!(
|
|
55
|
-
!argv.is_empty(),
|
|
56
|
-
"copilot seat must still spawn; argv={argv:?}"
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
fn first_spawn_argv(transport: &OfflineTransport) -> Vec<String> {
|
|
61
|
-
let records = transport.spawn_records();
|
|
62
|
-
assert!(
|
|
63
|
-
!records.is_empty(),
|
|
64
|
-
"expected a worker spawn so argv can be inspected; records={records:?}"
|
|
65
|
-
);
|
|
66
|
-
records[0].1.clone()
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
fn write_role_team(
|
|
70
|
-
ws: &Path,
|
|
71
|
-
team_key: &str,
|
|
72
|
-
agent_id: &str,
|
|
73
|
-
provider: &str,
|
|
74
|
-
model: Option<&str>,
|
|
75
|
-
role: &str,
|
|
76
|
-
) -> PathBuf {
|
|
77
|
-
let team = ws.join(team_key);
|
|
78
|
-
std::fs::create_dir_all(team.join("agents")).unwrap();
|
|
79
|
-
std::fs::write(
|
|
80
|
-
team.join("TEAM.md"),
|
|
81
|
-
format!(
|
|
82
|
-
"---\nname: {team_key}\nobjective: explicit-model contract.\nprovider: {provider}\ndangerously_skip_permissions: false\n---\n\nTeam.\n"
|
|
83
|
-
),
|
|
84
|
-
)
|
|
85
|
-
.unwrap();
|
|
86
|
-
let model_line = match model {
|
|
87
|
-
Some(value) => format!("model: {value}\n"),
|
|
88
|
-
None => String::new(),
|
|
89
|
-
};
|
|
90
|
-
std::fs::write(
|
|
91
|
-
team.join("agents").join(format!("{agent_id}.md")),
|
|
92
|
-
format!(
|
|
93
|
-
"---\nname: {agent_id}\nrole: {role}\nprovider: {provider}\n{model_line}auth_mode: subscription\ndangerously_skip_permissions: false\ntools:\n - mcp_team\n---\n\nWorker.\n"
|
|
94
|
-
),
|
|
95
|
-
)
|
|
96
|
-
.unwrap();
|
|
97
|
-
team
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
fn tmp_dir(tag: &str) -> PathBuf {
|
|
101
|
-
static N: AtomicU64 = AtomicU64::new(0);
|
|
102
|
-
let dir = std::env::temp_dir().join(format!(
|
|
103
|
-
"ta-rs-grok-model-{tag}-{}-{}",
|
|
104
|
-
std::process::id(),
|
|
105
|
-
N.fetch_add(1, Ordering::Relaxed)
|
|
106
|
-
));
|
|
107
|
-
let _ = std::fs::remove_dir_all(&dir);
|
|
108
|
-
std::fs::create_dir_all(&dir).unwrap();
|
|
109
|
-
std::fs::canonicalize(dir).unwrap()
|
|
110
|
-
}
|