@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,71 +0,0 @@
|
|
|
1
|
-
//! ---
|
|
2
|
-
//! purpose: grok 忙时默认把显式队列顶出去(再按回车)
|
|
3
|
-
//! contract:
|
|
4
|
-
//! provides:
|
|
5
|
-
//! - name: flush_explicit_queue
|
|
6
|
-
//! what: 屏幕出现 grok `Enter:send now` 时只重按回车直到消失
|
|
7
|
-
//! depends:
|
|
8
|
-
//! - crate::transport::Transport
|
|
9
|
-
//! boundary:
|
|
10
|
-
//! - 不重粘文本、不用 Escape、不用 Ctrl-C、不加自动重投
|
|
11
|
-
//! - 不按忙闲决定发不发;只在已经注入之后确认队列态
|
|
12
|
-
//! - 无标记时不改 claude/codex 提交行为
|
|
13
|
-
//! maturity: wired
|
|
14
|
-
//! ---
|
|
15
|
-
|
|
16
|
-
use std::time::Duration;
|
|
17
|
-
|
|
18
|
-
use crate::transport::{CaptureRange, Key, Target, Transport, TransportError};
|
|
19
|
-
|
|
20
|
-
/// grok 1.0.4 实测:页脚出现这串就是显式队列。
|
|
21
|
-
pub const GROK_SEND_NOW_MARK: &str = "Enter:send now";
|
|
22
|
-
|
|
23
|
-
/// 最多再按 8 次回车。
|
|
24
|
-
pub const GROK_SEND_NOW_MAX_ENTERS: u32 = 8;
|
|
25
|
-
|
|
26
|
-
pub struct FlushReport {
|
|
27
|
-
pub extra_enters: u32,
|
|
28
|
-
pub mark_cleared: bool,
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/// After paste+first Enter, if the pane still shows a queue footer,
|
|
32
|
-
/// press Enter only until the mark is gone. No mark ⇒ no keys (claude/codex).
|
|
33
|
-
pub fn flush_explicit_queue(
|
|
34
|
-
transport: &dyn Transport,
|
|
35
|
-
target: &Target,
|
|
36
|
-
) -> Result<FlushReport, TransportError> {
|
|
37
|
-
let mut extra_enters = 0;
|
|
38
|
-
for _ in 0..GROK_SEND_NOW_MAX_ENTERS {
|
|
39
|
-
let captured = transport.capture(target, CaptureRange::Tail(40))?;
|
|
40
|
-
if !queue_mark_visible(&captured.text) {
|
|
41
|
-
return Ok(FlushReport {
|
|
42
|
-
extra_enters,
|
|
43
|
-
mark_cleared: true,
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
transport.send_keys(target, &[Key::Enter])?;
|
|
47
|
-
extra_enters = extra_enters.saturating_add(1);
|
|
48
|
-
std::thread::sleep(retry_pause());
|
|
49
|
-
}
|
|
50
|
-
let captured = transport.capture(target, CaptureRange::Tail(40))?;
|
|
51
|
-
Ok(FlushReport {
|
|
52
|
-
extra_enters,
|
|
53
|
-
mark_cleared: !queue_mark_visible(&captured.text),
|
|
54
|
-
})
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
pub fn keep_provider_queue_requested() -> bool {
|
|
58
|
-
matches!(
|
|
59
|
-
std::env::var("TEAM_AGENT_KEEP_PROVIDER_QUEUE").as_deref(),
|
|
60
|
-
Ok("1") | Ok("true") | Ok("yes")
|
|
61
|
-
)
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
pub fn queue_mark_visible(text: &str) -> bool {
|
|
65
|
-
text.contains(GROK_SEND_NOW_MARK)
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
#[allow(dead_code)]
|
|
69
|
-
fn retry_pause() -> Duration {
|
|
70
|
-
Duration::from_millis(50)
|
|
71
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
╭──────────────────────────────────────────────────────────────────────────────╮
|
|
2
|
-
│ Confirm folder trust │
|
|
3
|
-
│ ──────────────────────────────────────────────────────────────────────────── │
|
|
4
|
-
│ ╭──────────────────────────────────────────────────────────────────────────╮ │
|
|
5
|
-
│ │ /private/tmp/copilot-trust-fixture-20260611T160323Z/dir-a │ │
|
|
6
|
-
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
|
|
7
|
-
│ │
|
|
8
|
-
│ Copilot can read files in this folder and, with your permission, edit them │
|
|
9
|
-
│ or run code and shell commands. It will remember your permissions for the │
|
|
10
|
-
│ rest of this session. │
|
|
11
|
-
│ │
|
|
12
|
-
│ Do you trust the files in this folder? │
|
|
13
|
-
│ │
|
|
14
|
-
│ ❯ 1. Yes │
|
|
15
|
-
│ 2. Yes, and remember this folder for future sessions │
|
|
16
|
-
│ 3. No (Esc) │
|
|
17
|
-
│ │
|
|
18
|
-
│ ↑/↓ to navigate · enter to select · esc to cancel │
|
|
19
|
-
╰──────────────────────────────────────────────────────────────────────────────╯
|
|
@@ -1,354 +0,0 @@
|
|
|
1
|
-
#[test]
|
|
2
|
-
fn trimmed_provider_builders_preserve_fresh_and_resume_argv() {
|
|
3
|
-
for (provider, base) in [
|
|
4
|
-
(
|
|
5
|
-
Provider::Copilot,
|
|
6
|
-
vec![
|
|
7
|
-
"copilot", "--no-color", "--no-auto-update", "--no-remote",
|
|
8
|
-
"--disable-builtin-mcps", "--allow-tool", "team_orchestrator",
|
|
9
|
-
"--model", "test-model",
|
|
10
|
-
],
|
|
11
|
-
),
|
|
12
|
-
] {
|
|
13
|
-
let adapter = get_adapter(provider);
|
|
14
|
-
let ctx = ProviderCommandContext {
|
|
15
|
-
auth_mode: AuthMode::Subscription,
|
|
16
|
-
mcp_config: None,
|
|
17
|
-
system_prompt: Some("role"),
|
|
18
|
-
model: Some("test-model"),
|
|
19
|
-
dangerously_skip_permissions: false,
|
|
20
|
-
profile_launch: None,
|
|
21
|
-
agent_id_hint: Some("worker"),
|
|
22
|
-
effort: None,
|
|
23
|
-
};
|
|
24
|
-
let mut expected = base.iter().map(|s| s.to_string()).collect::<Vec<_>>();
|
|
25
|
-
let fresh = adapter.build_command_plan(ctx).expect("fresh plan");
|
|
26
|
-
expected.push("--session-id".to_string());
|
|
27
|
-
expected.push(
|
|
28
|
-
fresh.expected_session_id.as_ref().expect("session hint").as_str().to_string(),
|
|
29
|
-
);
|
|
30
|
-
assert_eq!(fresh.argv, expected, "{provider:?} fresh argv");
|
|
31
|
-
let session = SessionId::new("existing-session");
|
|
32
|
-
let mut expected = base.iter().map(|s| s.to_string()).collect::<Vec<_>>();
|
|
33
|
-
expected.extend(["--resume".to_string(), session.as_str().to_string()]);
|
|
34
|
-
assert_eq!(
|
|
35
|
-
adapter
|
|
36
|
-
.build_resume_command_plan(Some(&session), ctx)
|
|
37
|
-
.expect("resume plan")
|
|
38
|
-
.argv,
|
|
39
|
-
expected,
|
|
40
|
-
"{provider:?} resume argv"
|
|
41
|
-
);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
#[test]
|
|
46
|
-
fn abnormal_dedup_key_uses_signature_and_optional_turn_id() {
|
|
47
|
-
// probe(/tmp/probe_idle.py read_fault_facts): the C8 dedup key is
|
|
48
|
-
// (Signature, Option<TurnId>). Golden facts below are the exact extraction.
|
|
49
|
-
|
|
50
|
-
// claude api_error → signature=api_error, turn_id=sess-9 (sessionId), kind=error.
|
|
51
|
-
let api_err = [serde_json::json!(
|
|
52
|
-
{"type":"system","subtype":"api_error","level":"error","sessionId":"sess-9"}
|
|
53
|
-
)];
|
|
54
|
-
let f = read_fault_facts(&api_err, Provider::Claude);
|
|
55
|
-
assert_eq!(f.len(), 1);
|
|
56
|
-
assert_eq!(f[0].signature, Signature::new("api_error"));
|
|
57
|
-
assert_eq!(f[0].turn_id, Some(TurnId::new("sess-9")));
|
|
58
|
-
assert_eq!(f[0].kind, FactKind::Error);
|
|
59
|
-
|
|
60
|
-
// claude tool_result is_error → signature=tool_result_is_error,
|
|
61
|
-
// turn_id=parentUuid ("p-1"), kind=error.
|
|
62
|
-
let tool_err = [serde_json::json!(
|
|
63
|
-
{"type":"user","uuid":"u","parentUuid":"p-1",
|
|
64
|
-
"message":{"content":[{"type":"tool_result","is_error":true}]}}
|
|
65
|
-
)];
|
|
66
|
-
let f = read_fault_facts(&tool_err, Provider::Claude);
|
|
67
|
-
assert_eq!(f.len(), 1);
|
|
68
|
-
assert_eq!(f[0].signature, Signature::new("tool_result_is_error"));
|
|
69
|
-
assert_eq!(f[0].turn_id, Some(TurnId::new("p-1")));
|
|
70
|
-
|
|
71
|
-
// claude api_error with NO ids → key = (api_error, None) — Option must hold None.
|
|
72
|
-
let api_err_noids = [serde_json::json!(
|
|
73
|
-
{"type":"system","subtype":"api_error","level":"error"}
|
|
74
|
-
)];
|
|
75
|
-
let f = read_fault_facts(&api_err_noids, Provider::Claude);
|
|
76
|
-
assert_eq!(f.len(), 1);
|
|
77
|
-
assert_eq!(f[0].signature, Signature::new("api_error"));
|
|
78
|
-
assert_eq!(f[0].turn_id, None, "api_error with no ids dedups on (api_error, None)");
|
|
79
|
-
|
|
80
|
-
// codex turn_failed → signature=turn_failed, turn_id=ct4, kind=failed.
|
|
81
|
-
let codex_failed = [serde_json::json!(
|
|
82
|
-
{"jsonrpc":"2.0","method":"turn/completed","params":{"turn":{"id":"ct4","status":"failed"}}}
|
|
83
|
-
)];
|
|
84
|
-
let f = read_fault_facts(&codex_failed, Provider::Codex);
|
|
85
|
-
assert_eq!(f.len(), 1);
|
|
86
|
-
assert_eq!(f[0].signature, Signature::new("turn_failed"));
|
|
87
|
-
assert_eq!(f[0].turn_id, Some(TurnId::new("ct4")));
|
|
88
|
-
assert_eq!(f[0].kind, FactKind::Failed);
|
|
89
|
-
|
|
90
|
-
// codex approval → signature=approval_required, turn_id=ct5, kind=approval.
|
|
91
|
-
let codex_approval = [serde_json::json!(
|
|
92
|
-
{"jsonrpc":"2.0","method":"session/requestApproval","params":{"turnId":"ct5"}}
|
|
93
|
-
)];
|
|
94
|
-
let f = read_fault_facts(&codex_approval, Provider::Codex);
|
|
95
|
-
assert_eq!(f.len(), 1);
|
|
96
|
-
assert_eq!(f[0].signature, Signature::new("approval_required"));
|
|
97
|
-
assert_eq!(f[0].turn_id, Some(TurnId::new("ct5")));
|
|
98
|
-
assert_eq!(f[0].kind, FactKind::Approval);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
// ---- (e) session capture payload + bug-085 fallback (confidence=low) ----
|
|
102
|
-
|
|
103
|
-
#[test]
|
|
104
|
-
fn capture_session_id_success_payload_fields() {
|
|
105
|
-
// Shared spawn_cwd scan success → CapturedSession high confidence, fs_watch,
|
|
106
|
-
// session_id Some, rollout_path Some. Drive the real fn against a temp cwd
|
|
107
|
-
// that contains a discoverable transcript; assert ALL 5 typed fields.
|
|
108
|
-
let dir = std::env::temp_dir().join(format!(
|
|
109
|
-
"ta-cap-success-{}",
|
|
110
|
-
std::process::id()
|
|
111
|
-
));
|
|
112
|
-
let _ = std::fs::create_dir_all(&dir);
|
|
113
|
-
let transcript = dir.join("session.jsonl");
|
|
114
|
-
let _ = std::fs::write(
|
|
115
|
-
&transcript,
|
|
116
|
-
r#"{"type":"user","sessionId":"sess-1","cwd":"PLACEHOLDER","message":{"content":"hi"}}"#,
|
|
117
|
-
);
|
|
118
|
-
let adapter = get_adapter(Provider::Fake);
|
|
119
|
-
let cs = adapter
|
|
120
|
-
.capture_session_id("agentX", &dir, 3)
|
|
121
|
-
.expect("capture ok")
|
|
122
|
-
.expect("transcript found → Some");
|
|
123
|
-
assert_eq!(cs.captured_via, CaptureVia::FsWatch);
|
|
124
|
-
assert_eq!(cs.attribution_confidence, Confidence::High);
|
|
125
|
-
assert!(cs.session_id.is_some(), "found transcript yields a session_id");
|
|
126
|
-
assert!(cs.rollout_path.is_some(), "found transcript yields a rollout_path");
|
|
127
|
-
let _ = std::fs::remove_dir_all(&dir);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
#[test]
|
|
131
|
-
fn capture_session_id_bug085_compatible_api_fallback_is_low_confidence_none_session() {
|
|
132
|
-
// probe(shared scan fallback): transcript w/o a session_id →
|
|
133
|
-
// session_id=None, captured_via=fs_mtime_fallback, confidence=low,
|
|
134
|
-
// rollout_path SET. The half-state is LEGAL and must not panic (bug-085).
|
|
135
|
-
let dir = std::env::temp_dir().join(format!(
|
|
136
|
-
"ta-cap-fallback-{}",
|
|
137
|
-
std::process::id()
|
|
138
|
-
));
|
|
139
|
-
let _ = std::fs::create_dir_all(&dir);
|
|
140
|
-
let transcript = dir.join("nosession.jsonl");
|
|
141
|
-
let _ = std::fs::write(&transcript, r#"{"type":"user","message":{"content":"hi"}}"#);
|
|
142
|
-
let adapter = get_adapter(Provider::Fake);
|
|
143
|
-
let cs = adapter
|
|
144
|
-
.capture_session_id("agentX", &dir, 3)
|
|
145
|
-
.expect("capture ok")
|
|
146
|
-
.expect("fallback transcript → Some half-state");
|
|
147
|
-
assert_eq!(cs.session_id, None, "bug-085: fallback session_id is None");
|
|
148
|
-
assert_eq!(cs.captured_via, CaptureVia::FsMtimeFallback);
|
|
149
|
-
assert_eq!(cs.attribution_confidence, Confidence::Low);
|
|
150
|
-
assert!(cs.rollout_path.is_some(), "fallback still pins rollout_path");
|
|
151
|
-
let _ = std::fs::remove_dir_all(&dir);
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
#[test]
|
|
155
|
-
fn capture_session_id_no_match_returns_none() {
|
|
156
|
-
// Deadline with no match → Ok(None), explicitly NOT Err.
|
|
157
|
-
let empty = std::env::temp_dir().join(format!("ta-cap-empty-{}", std::process::id()));
|
|
158
|
-
let _ = std::fs::create_dir_all(&empty);
|
|
159
|
-
let adapter = get_adapter(Provider::Fake);
|
|
160
|
-
let res = adapter.capture_session_id("agentX", &empty, 0);
|
|
161
|
-
// ProviderError 非 PartialEq(携 Io)→ 用 matches! 而非 ==。
|
|
162
|
-
assert!(matches!(res, Ok(None)), "no transcript + timeout 0 → Ok(None), never Err");
|
|
163
|
-
let _ = std::fs::remove_dir_all(&empty);
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
// ---- resume / fork / build_command / caps — command-build core ----
|
|
167
|
-
|
|
168
|
-
#[test]
|
|
169
|
-
fn retired_worker_caps_are_neither_resumable_nor_forkable() {
|
|
170
|
-
// Claude Code, Codex and Grok workers run only through their contract
|
|
171
|
-
// leaves; a pre-upgrade legacy row must never become capture-pending or
|
|
172
|
-
// resumable.
|
|
173
|
-
for provider in [Provider::Claude, Provider::ClaudeCode, Provider::Codex, Provider::Grok] {
|
|
174
|
-
let adapter = get_adapter(provider);
|
|
175
|
-
assert_eq!(
|
|
176
|
-
adapter.caps(),
|
|
177
|
-
ProviderCaps {
|
|
178
|
-
resume: false,
|
|
179
|
-
fork: false,
|
|
180
|
-
native_mcp_config: false,
|
|
181
|
-
writes_global_settings: false,
|
|
182
|
-
},
|
|
183
|
-
"{provider:?}"
|
|
184
|
-
);
|
|
185
|
-
assert_eq!(adapter.auth_hint(AuthMode::Subscription), AuthHintStatus::Unknown);
|
|
186
|
-
assert!(matches!(
|
|
187
|
-
adapter.build_command(AuthMode::Subscription, None, Some("worker"), Some("opus")),
|
|
188
|
-
Err(ProviderError::Command(_))
|
|
189
|
-
));
|
|
190
|
-
let ctx = ProviderCommandContext {
|
|
191
|
-
auth_mode: AuthMode::Subscription,
|
|
192
|
-
mcp_config: None,
|
|
193
|
-
system_prompt: Some("worker"),
|
|
194
|
-
model: Some("opus"),
|
|
195
|
-
dangerously_skip_permissions: false,
|
|
196
|
-
profile_launch: None,
|
|
197
|
-
agent_id_hint: Some("worker"),
|
|
198
|
-
effort: None,
|
|
199
|
-
};
|
|
200
|
-
match adapter.build_command_plan(ctx) {
|
|
201
|
-
Err(ProviderError::Command(text)) => assert!(
|
|
202
|
-
text.contains("worker runtime was excised"),
|
|
203
|
-
"{provider:?}: {text}"
|
|
204
|
-
),
|
|
205
|
-
other => panic!("{provider:?} legacy plan must be refused, got {other:?}"),
|
|
206
|
-
}
|
|
207
|
-
let session = SessionId::new("legacy-session");
|
|
208
|
-
assert!(
|
|
209
|
-
matches!(
|
|
210
|
-
adapter.build_resume_command(Some(&session), AuthMode::Subscription, None),
|
|
211
|
-
Err(ProviderError::ResumeUnavailable(_))
|
|
212
|
-
),
|
|
213
|
-
"{provider:?} resume"
|
|
214
|
-
);
|
|
215
|
-
assert!(
|
|
216
|
-
matches!(
|
|
217
|
-
adapter.fork(Some(&session), AuthMode::Subscription, None),
|
|
218
|
-
Err(ProviderError::CapabilityUnsupported(_))
|
|
219
|
-
),
|
|
220
|
-
"{provider:?} fork"
|
|
221
|
-
);
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
#[test]
|
|
226
|
-
fn gemini_writes_global_settings_cap() {
|
|
227
|
-
// gemini.py:40-78 — install_mcp writes ~/.gemini/settings.json →
|
|
228
|
-
// caps.writes_global_settings=true, native_mcp_config=false.
|
|
229
|
-
let adapter = get_adapter(Provider::GeminiCli);
|
|
230
|
-
let caps = adapter.caps();
|
|
231
|
-
assert!(caps.writes_global_settings, "gemini writes a global settings file");
|
|
232
|
-
assert!(!caps.native_mcp_config, "gemini has no native --mcp-config flag");
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
#[test]
|
|
236
|
-
fn build_resume_command_without_session_id_is_resume_unavailable() {
|
|
237
|
-
// No session_id → ResumeUnavailable, never a bare crash.
|
|
238
|
-
let adapter = get_adapter(Provider::Copilot);
|
|
239
|
-
let res = adapter.build_resume_command(None, AuthMode::Subscription, None);
|
|
240
|
-
assert!(
|
|
241
|
-
matches!(res, Err(ProviderError::ResumeUnavailable(_))),
|
|
242
|
-
"resume without session_id must be ResumeUnavailable, got {res:?}"
|
|
243
|
-
);
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
#[test]
|
|
247
|
-
fn session_is_resumable_none_session_is_false_not_panic() {
|
|
248
|
-
// session_id falsy → not resumable; bug-085 None穿透.
|
|
249
|
-
let adapter = get_adapter(Provider::Copilot);
|
|
250
|
-
let res = adapter.session_is_resumable(None, AuthMode::CompatibleApi);
|
|
251
|
-
assert!(matches!(res, Ok(false)), "None session → Ok(false), never panic (bug-085)");
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
#[test]
|
|
255
|
-
fn unsupported_provider_capability_error_message_shape() {
|
|
256
|
-
// unsupported.py:31 ProviderCapabilityError — placeholder providers reject
|
|
257
|
-
// on call. The skeleton Provider enum has no Copilot/Opencode variant, so
|
|
258
|
-
// the unsupported path is exercised through ProviderError::CapabilityUnsupported
|
|
259
|
-
// construction (message contract) here; full plug dispatch deferred.
|
|
260
|
-
let e = ProviderError::CapabilityUnsupported("opencode:start".to_string());
|
|
261
|
-
assert_eq!(
|
|
262
|
-
e.to_string(),
|
|
263
|
-
"provider capability unsupported: opencode:start"
|
|
264
|
-
);
|
|
265
|
-
let e2 = ProviderError::ResumeUnavailable("claude resume requires session_id".to_string());
|
|
266
|
-
assert_eq!(
|
|
267
|
-
e2.to_string(),
|
|
268
|
-
"resume unavailable: claude resume requires session_id"
|
|
269
|
-
);
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
// ═══════════════ P2 FIX-LOOP RED (复绿即对抗 cross-model findings) ═══════════════
|
|
273
|
-
// Lock the CORRECT Python v0.2.11 behavior the strengthened contracts missed.
|
|
274
|
-
// Golden re-probed via /tmp/probe_p2_provider.py vs team-agent-public @ 439bef8.
|
|
275
|
-
|
|
276
|
-
#[test]
|
|
277
|
-
fn pi_wire_roundtrip_requires_backing() {
|
|
278
|
-
use crate::provider::wire::{
|
|
279
|
-
aliases, command_name, parse_canonical_provider, parse_provider, provider_wire,
|
|
280
|
-
requires_resume_backing,
|
|
281
|
-
};
|
|
282
|
-
|
|
283
|
-
let provider = Provider::Pi;
|
|
284
|
-
assert_eq!(provider_wire(provider), "pi");
|
|
285
|
-
assert_eq!(parse_provider("pi"), Some(provider));
|
|
286
|
-
assert_eq!(parse_canonical_provider("pi"), Some(provider));
|
|
287
|
-
assert_eq!(aliases(provider), &["pi"]);
|
|
288
|
-
assert_eq!(command_name(provider), "pi");
|
|
289
|
-
assert!(requires_resume_backing(provider));
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
#[test]
|
|
293
|
-
fn pi_caps_resume_false_fork_false_native_mcp_false_auth_unknown() {
|
|
294
|
-
// Pi workers run only through the contract leaf; a legacy row is not resumable.
|
|
295
|
-
let adapter = get_adapter(Provider::Pi);
|
|
296
|
-
assert_eq!(
|
|
297
|
-
adapter.caps(),
|
|
298
|
-
ProviderCaps {
|
|
299
|
-
resume: false,
|
|
300
|
-
fork: false,
|
|
301
|
-
native_mcp_config: false,
|
|
302
|
-
writes_global_settings: false,
|
|
303
|
-
}
|
|
304
|
-
);
|
|
305
|
-
assert_eq!(
|
|
306
|
-
adapter.auth_hint(AuthMode::Subscription),
|
|
307
|
-
AuthHintStatus::Unknown
|
|
308
|
-
);
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
#[test]
|
|
312
|
-
fn pi_fork_is_typed_capability_unsupported() {
|
|
313
|
-
let adapter = get_adapter(Provider::Pi);
|
|
314
|
-
let source = SessionId::new("7dcfed9a-88ce-45bf-b1e3-161696acfe89");
|
|
315
|
-
let result = adapter.fork(Some(&source), AuthMode::Subscription, None);
|
|
316
|
-
assert!(
|
|
317
|
-
matches!(result, Err(ProviderError::CapabilityUnsupported(_))),
|
|
318
|
-
"Pi fork must be a typed capability refusal, got {result:?}"
|
|
319
|
-
);
|
|
320
|
-
if let Err(error) = result {
|
|
321
|
-
let text = error.to_string();
|
|
322
|
-
assert!(text.contains("pi") && text.contains("fork"), "got {text}");
|
|
323
|
-
assert!(!text.to_ascii_lowercase().contains("clone"), "got {text}");
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
#[test]
|
|
328
|
-
fn pi_classify_has_no_lifecycle_facts() {
|
|
329
|
-
let transcript = concat!(
|
|
330
|
-
r#"{"type":"turn_started","turn_id":"turn-1"}"#,
|
|
331
|
-
"\n",
|
|
332
|
-
r#"{"type":"turn_completed","turn_id":"turn-1"}"#,
|
|
333
|
-
);
|
|
334
|
-
let classified = crate::provider::classify::classify(
|
|
335
|
-
Provider::Pi,
|
|
336
|
-
transcript,
|
|
337
|
-
ProcessLiveness::Alive,
|
|
338
|
-
60.0,
|
|
339
|
-
)
|
|
340
|
-
.expect("Pi classification must preserve unknown without a turn reader");
|
|
341
|
-
assert_eq!(classified.state, TurnState::Unknown);
|
|
342
|
-
assert_eq!(classified.reason, "no_turn_lifecycle_fact");
|
|
343
|
-
|
|
344
|
-
let records = [serde_json::json!({
|
|
345
|
-
"type": "system",
|
|
346
|
-
"subtype": "api_error",
|
|
347
|
-
"level": "error",
|
|
348
|
-
"sessionId": "pi-session"
|
|
349
|
-
})];
|
|
350
|
-
assert!(
|
|
351
|
-
crate::provider::faults::read_fault_facts(&records, Provider::Pi).is_empty(),
|
|
352
|
-
"Pi has no JSONL lifecycle/fault reader"
|
|
353
|
-
);
|
|
354
|
-
}
|
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
fn claude_end_turn() -> String {
|
|
2
|
-
r#"{"type":"assistant","requestId":"r1","message":{"stop_reason":"end_turn"}}"#.to_string()
|
|
3
|
-
}
|
|
4
|
-
fn claude_open_turn() -> String {
|
|
5
|
-
r#"{"type":"assistant","requestId":"r1","message":{"stop_reason":"tool_use"}}"#.to_string()
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
#[test]
|
|
9
|
-
fn classify_state_table() {
|
|
10
|
-
use ClassifySource::{ProcessGuard, SessionFile};
|
|
11
|
-
use ProcessLiveness::{Alive, Unverifiable};
|
|
12
|
-
use Provider::{Claude, ClaudeCode, Codex};
|
|
13
|
-
use TurnState::{Abnormal, BlockedOnHuman, Idle, IdleInterrupted, Unknown, Working};
|
|
14
|
-
|
|
15
|
-
type Input<'a> = (Provider, &'a str, ProcessLiveness, f64);
|
|
16
|
-
// State, reason, turn ID, source, exact annotations, idle-for-takeover.
|
|
17
|
-
// None skips an originally absent assertion; Some(None) asserts no turn ID.
|
|
18
|
-
type Expected<'a> = (
|
|
19
|
-
TurnState, &'a str, Option<Option<&'a str>>, Option<ClassifySource>,
|
|
20
|
-
Option<&'a [&'a str]>, Option<bool>,
|
|
21
|
-
);
|
|
22
|
-
let open = claude_open_turn();
|
|
23
|
-
let two = format!(
|
|
24
|
-
"{}\n{}",
|
|
25
|
-
r#"{"type":"assistant","requestId":"a","message":{"stop_reason":"tool_use"}}"#,
|
|
26
|
-
r#"{"type":"assistant","requestId":"b","message":{"stop_reason":"end_turn"}}"#,
|
|
27
|
-
);
|
|
28
|
-
let c14 = format!(
|
|
29
|
-
"{}\n{}",
|
|
30
|
-
r#"{"type":"assistant","requestId":"a","message":{"stop_reason":"end_turn"}}"#,
|
|
31
|
-
r#"{"type":"assistant","requestId":"b","message":{"stop_reason":"tool_use"}}"#,
|
|
32
|
-
);
|
|
33
|
-
let cases: &[(&str, Input<'_>, Expected<'_>)] = &[
|
|
34
|
-
// Unknown is NEVER idle (bug-071/077/085, C5).
|
|
35
|
-
("empty",
|
|
36
|
-
(ClaudeCode, "", Unverifiable, 0.0),
|
|
37
|
-
(Unknown, "unreadable_or_empty", Some(None), Some(SessionFile), None, Some(false))),
|
|
38
|
-
("whitespace",
|
|
39
|
-
(Claude, " \n \t \n", Unverifiable, 0.0),
|
|
40
|
-
(Unknown, "unreadable_or_empty", None, None, None, Some(false))),
|
|
41
|
-
// !had_records wins over parse diagnostics (common.py:72-75).
|
|
42
|
-
("garbage_jsonl",
|
|
43
|
-
(Claude, "not json\n{broken", Unverifiable, 0.0),
|
|
44
|
-
(Unknown, "unreadable_or_empty", None, None, None, Some(false))),
|
|
45
|
-
// Valid record without lifecycle facts: NOT unrecognized_format.
|
|
46
|
-
("unrecognized_record",
|
|
47
|
-
(Claude, r#"{"foo":"bar"}"#, Unverifiable, 0.0),
|
|
48
|
-
(Unknown, "no_turn_lifecycle_fact", None, None, None, Some(false))),
|
|
49
|
-
// C4: missing process identity is NEVER optimistically working.
|
|
50
|
-
("open_unverifiable_identity",
|
|
51
|
-
(Claude, &open, Unverifiable, 0.0),
|
|
52
|
-
(Unknown, "process_identity_unverified", Some(Some("r1")), Some(ProcessGuard), None, Some(false))),
|
|
53
|
-
("open_alive",
|
|
54
|
-
(Claude, &open, Alive, 0.0),
|
|
55
|
-
(Working, "open_turn", Some(Some("r1")), Some(SessionFile), None, None)),
|
|
56
|
-
("open_unverifiable_process",
|
|
57
|
-
(Claude, &open, Unverifiable, 0.0),
|
|
58
|
-
(Unknown, "process_identity_unverified", None, None, None, Some(false))),
|
|
59
|
-
("last_fact_wins",
|
|
60
|
-
(Claude, &two, Unverifiable, 0.0),
|
|
61
|
-
(Idle, "end_turn", Some(Some("b")), None, None, None)),
|
|
62
|
-
// C14: silence is discarded; only a dead process can demote an open turn.
|
|
63
|
-
("open_beats_silence",
|
|
64
|
-
(Claude, &c14, Alive, 9999.0),
|
|
65
|
-
(Working, "open_turn", Some(Some("b")), None, None, None)),
|
|
66
|
-
// C12: idle_interrupted IS idle for take-over, with exact annotations.
|
|
67
|
-
("claude_interrupted",
|
|
68
|
-
(Claude, r#"{"type":"user","uuid":"u1","message":{"content":[{"type":"text","text":"[Request interrupted by user]"}]}}"#, Unverifiable, 0.0),
|
|
69
|
-
(IdleInterrupted, "user_interrupt", Some(Some("u1")), None, Some(&["interrupted"]), Some(true))),
|
|
70
|
-
("claude_stop_sequence",
|
|
71
|
-
(Claude, r#"{"type":"assistant","requestId":"r1","message":{"stop_reason":"stop_sequence"}}"#, Unverifiable, 0.0),
|
|
72
|
-
(Idle, "stop_sequence", None, None, None, None)),
|
|
73
|
-
("codex_task_complete",
|
|
74
|
-
(Codex, r#"{"type":"event_msg","payload":{"type":"task_complete","turn_id":"ct1"}}"#, Unverifiable, 0.0),
|
|
75
|
-
(Idle, "task_complete", Some(Some("ct1")), None, None, None)),
|
|
76
|
-
("codex_abort_interrupted",
|
|
77
|
-
(Codex, r#"{"type":"event_msg","payload":{"type":"turn_aborted","turn_id":"ct2","reason":"interrupted"}}"#, Unverifiable, 0.0),
|
|
78
|
-
(IdleInterrupted, "interrupted", None, None, None, None)),
|
|
79
|
-
// Raw abort reason must pass through, including non-interrupted errors.
|
|
80
|
-
("codex_abort_error",
|
|
81
|
-
(Codex, r#"{"type":"event_msg","payload":{"type":"turn_aborted","turn_id":"ct3","reason":"error"}}"#, Unverifiable, 0.0),
|
|
82
|
-
(IdleInterrupted, "error", Some(Some("ct3")), None, None, None)),
|
|
83
|
-
("codex_turn_failed",
|
|
84
|
-
(Codex, r#"{"jsonrpc":"2.0","method":"turn/completed","params":{"turn":{"id":"ct4","status":"failed"}}}"#, Unverifiable, 0.0),
|
|
85
|
-
(Abnormal, "turn_failed", Some(Some("ct4")), None, Some(&["turn_failed"]), Some(false))),
|
|
86
|
-
// blocked_on_human is NOT idle for take-over.
|
|
87
|
-
("codex_approval",
|
|
88
|
-
(Codex, r#"{"jsonrpc":"2.0","method":"session/requestApproval","params":{"turnId":"ct5"}}"#, Unverifiable, 0.0),
|
|
89
|
-
(BlockedOnHuman, "approval_required", Some(Some("ct5")), None, Some(&["awaiting_approval"]), Some(false))),
|
|
90
|
-
];
|
|
91
|
-
for &(id, (provider, text, liveness, silence), expected) in cases {
|
|
92
|
-
let c = classify(provider, text, liveness, silence)
|
|
93
|
-
.unwrap_or_else(|err| panic!("{id}: classify failed: {err:?}"));
|
|
94
|
-
let (state, reason, turn_id, source, annotations, idle) = expected;
|
|
95
|
-
let note = match id {
|
|
96
|
-
"empty" => "unreadable/empty input must never be idle (C5)",
|
|
97
|
-
"codex_abort_error" => "raw abort reason must pass through",
|
|
98
|
-
_ => "",
|
|
99
|
-
};
|
|
100
|
-
assert_eq!(c.state, state, "{id}: state");
|
|
101
|
-
assert_eq!(c.reason, reason, "{id}: reason; {note}");
|
|
102
|
-
if let Some(turn_id) = turn_id {
|
|
103
|
-
assert_eq!(c.turn_id.as_ref().map(TurnId::as_str), turn_id, "{id}: turn ID");
|
|
104
|
-
}
|
|
105
|
-
if let Some(source) = source {
|
|
106
|
-
assert_eq!(c.source, source, "{id}: source");
|
|
107
|
-
}
|
|
108
|
-
if let Some(annotations) = annotations {
|
|
109
|
-
let actual: Vec<_> = c.annotations.iter().map(String::as_str).collect();
|
|
110
|
-
assert_eq!(actual.as_slice(), annotations, "{id}: exact annotations");
|
|
111
|
-
}
|
|
112
|
-
if let Some(idle) = idle {
|
|
113
|
-
assert_eq!(c.state.is_idle_for_takeover(), idle, "{id}: idle-for-takeover; {note}");
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
#[test]
|
|
119
|
-
fn classify_claude_code_alias_normalizes_to_claude_reader() {
|
|
120
|
-
// 陷阱 #4: claude_code → claude reader (__init__.py:88). Both must classify an
|
|
121
|
-
// end_turn transcript identically to idle / end_turn — the alias never dies.
|
|
122
|
-
let txt = claude_end_turn();
|
|
123
|
-
let alias = classify(Provider::ClaudeCode, &txt, ProcessLiveness::Unverifiable, 0.0)
|
|
124
|
-
.expect("alias ok");
|
|
125
|
-
let canon = classify(Provider::Claude, &txt, ProcessLiveness::Unverifiable, 0.0)
|
|
126
|
-
.expect("canon ok");
|
|
127
|
-
assert_eq!(alias.state, TurnState::Idle);
|
|
128
|
-
assert_eq!(alias.reason, "end_turn");
|
|
129
|
-
assert_eq!(alias, canon, "claude_code must normalize to the claude reader");
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
#[test]
|
|
133
|
-
fn classify_open_turn_dead_is_abnormal_crashed_mid_turn() {
|
|
134
|
-
// probe open_turn_dead: open turn + Dead → abnormal / crashed_mid_turn /
|
|
135
|
-
// source=process_guard, annotations contains "crashed_mid_turn".
|
|
136
|
-
let c = classify(Provider::Claude, &claude_open_turn(), ProcessLiveness::Dead, 0.0)
|
|
137
|
-
.expect("classify ok");
|
|
138
|
-
assert_eq!(c.state, TurnState::Abnormal);
|
|
139
|
-
assert_eq!(c.reason, "crashed_mid_turn");
|
|
140
|
-
assert_eq!(c.source, ClassifySource::ProcessGuard);
|
|
141
|
-
assert!(c.annotations.contains(&"crashed_mid_turn".to_string()));
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
// ---- (b) idle predicate / evaluate_takeover_reminder (NoPingReason cases) ----
|
|
145
|
-
//
|
|
146
|
-
// Golden via /tmp/probe_idle.py (idle_predicate.evaluate_takeover_reminder).
|
|
147
|
-
// Nodes / monitor_state passed as serde_json::Value dicts (Python dict shape).
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
// #379: Claude Code's live session registry, located before and after capture.
|
|
151
|
-
#[cfg(unix)]
|
|
152
|
-
#[test]
|
|
153
|
-
fn claude_registry_turn_state_reads_the_live_record_for_this_transcript() {
|
|
154
|
-
let config = std::env::temp_dir().join(format!("ta-claude-registry-{}", std::process::id()));
|
|
155
|
-
let _ = std::fs::remove_dir_all(&config);
|
|
156
|
-
let sid = "11111111-2222-4333-8444-555555555555";
|
|
157
|
-
let projects = config.join("projects").join("-owned-cwd");
|
|
158
|
-
std::fs::create_dir_all(&projects).unwrap();
|
|
159
|
-
std::fs::create_dir_all(config.join("sessions")).unwrap();
|
|
160
|
-
let rollout = projects.join(format!("{sid}.jsonl"));
|
|
161
|
-
std::fs::write(&rollout, "").unwrap();
|
|
162
|
-
let sessions = config.join("sessions");
|
|
163
|
-
let expected_key = Some((sessions.clone(), sid.to_string()));
|
|
164
|
-
assert_eq!(claude_registry_key(&serde_json::json!({"rollout_path": rollout})), expected_key);
|
|
165
|
-
// Cold start: the launch's `--session-id` and projects root, before any capture.
|
|
166
|
-
assert_eq!(
|
|
167
|
-
claude_registry_key(&serde_json::json!({
|
|
168
|
-
"_pending_session_id": sid, "session_id": "stale", "claude_projects_root": config.join("projects"),
|
|
169
|
-
})),
|
|
170
|
-
expected_key
|
|
171
|
-
);
|
|
172
|
-
// Only `<config>/projects/<slug>/<id>.jsonl` names a registry.
|
|
173
|
-
assert_eq!(claude_registry_key(&serde_json::json!({"rollout_path": config.join(format!("{sid}.jsonl"))})), None);
|
|
174
|
-
let live = std::process::id();
|
|
175
|
-
let write = |pid: u32, session: &str, tmux: &str, status: &str| {
|
|
176
|
-
let record = serde_json::json!({"pid": pid, "sessionId": session, "tmux": tmux, "status": status});
|
|
177
|
-
std::fs::write(sessions.join(format!("{pid}.json")), record.to_string()).unwrap();
|
|
178
|
-
};
|
|
179
|
-
let read = |pane: Option<&str>| claude_registry_turn_state(&sessions, sid, pane);
|
|
180
|
-
for (status, expected) in [
|
|
181
|
-
("busy", Some(TurnState::Working)),
|
|
182
|
-
("waiting", Some(TurnState::BlockedOnHuman)),
|
|
183
|
-
("idle", Some(TurnState::Idle)),
|
|
184
|
-
("starting", None),
|
|
185
|
-
] {
|
|
186
|
-
write(live, sid, "team-x:@3.%7", status);
|
|
187
|
-
assert_eq!(read(Some("%7")), expected, "{status}");
|
|
188
|
-
}
|
|
189
|
-
write(live, sid, "team-x:@3.%7", "busy");
|
|
190
|
-
assert_eq!(read(None), Some(TurnState::Working));
|
|
191
|
-
assert_eq!(read(Some("%8")), None, "another pane's record");
|
|
192
|
-
write(live, "99999999-2222-4333-8444-555555555555", "team-x:@3.%7", "busy");
|
|
193
|
-
assert_eq!(read(Some("%7")), None, "another session's record");
|
|
194
|
-
std::fs::remove_file(sessions.join(format!("{live}.json"))).unwrap();
|
|
195
|
-
let mut child = std::process::Command::new("true").spawn().unwrap();
|
|
196
|
-
let dead = child.id();
|
|
197
|
-
child.wait().unwrap();
|
|
198
|
-
write(dead, sid, "team-x:@3.%7", "busy");
|
|
199
|
-
assert_eq!(read(Some("%7")), None, "a dead process is no evidence");
|
|
200
|
-
let _ = std::fs::remove_dir_all(&config);
|
|
201
|
-
}
|