@team-agent/installer 0.5.128 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/README.zh.md +1 -1
- package/package.json +4 -8
- package/skills/team-agent/SKILL.md +37 -20
- package/skills/team-agent/command-coverage.json +169 -183
- package/skills/team-agent/docs/reference/team-agent-operator.md +64 -30
- package/skills/team-agent/references/recovery-runbook.md +1 -1
- package/skills/team-agent/references/team-agent-operator.md +64 -30
- package/templates/team_state.md +1 -1
- package/Cargo.lock +0 -1063
- package/Cargo.toml +0 -36
- package/crates/team-agent/Cargo.toml +0 -69
- package/crates/team-agent/src/app_server_test_support.rs +0 -258
- package/crates/team-agent/src/cli/adapters.rs +0 -1288
- package/crates/team-agent/src/cli/arguments.rs +0 -405
- package/crates/team-agent/src/cli/attach_app_server_leader.rs +0 -98
- package/crates/team-agent/src/cli/diagnose.rs +0 -1721
- package/crates/team-agent/src/cli/emit.rs +0 -2930
- package/crates/team-agent/src/cli/grok_slot.rs +0 -384
- package/crates/team-agent/src/cli/helpers.rs +0 -91
- package/crates/team-agent/src/cli/intent/runtime.rs +0 -1216
- package/crates/team-agent/src/cli/intent/runtime_tests.rs +0 -912
- package/crates/team-agent/src/cli/intent/tests.rs +0 -689
- package/crates/team-agent/src/cli/intent.rs +0 -664
- package/crates/team-agent/src/cli/leader.rs +0 -300
- package/crates/team-agent/src/cli/leader_prompt.rs +0 -261
- package/crates/team-agent/src/cli/leaders.rs +0 -418
- package/crates/team-agent/src/cli/mod.rs +0 -6545
- package/crates/team-agent/src/cli/models.rs +0 -1206
- package/crates/team-agent/src/cli/named_address.rs +0 -1651
- package/crates/team-agent/src/cli/profile.rs +0 -342
- package/crates/team-agent/src/cli/route.rs +0 -212
- package/crates/team-agent/src/cli/schedule.rs +0 -175
- package/crates/team-agent/src/cli/send/coordinator.rs +0 -164
- package/crates/team-agent/src/cli/send/mailbox.rs +0 -145
- package/crates/team-agent/src/cli/send/persist.rs +0 -156
- package/crates/team-agent/src/cli/send/presentation.rs +0 -370
- package/crates/team-agent/src/cli/send/resolve.rs +0 -573
- package/crates/team-agent/src/cli/send.rs +0 -199
- package/crates/team-agent/src/cli/shutdown_socket.rs +0 -288
- package/crates/team-agent/src/cli/spec.rs +0 -165
- package/crates/team-agent/src/cli/status.rs +0 -280
- package/crates/team-agent/src/cli/status_port/agents.rs +0 -358
- package/crates/team-agent/src/cli/status_port/approvals.rs +0 -79
- package/crates/team-agent/src/cli/status_port/brief.rs +0 -1981
- package/crates/team-agent/src/cli/status_port/compact.rs +0 -240
- package/crates/team-agent/src/cli/status_port/format.rs +0 -146
- package/crates/team-agent/src/cli/status_port/inbox.rs +0 -62
- package/crates/team-agent/src/cli/status_port/runtime.rs +0 -197
- package/crates/team-agent/src/cli/status_port/snapshot.rs +0 -208
- package/crates/team-agent/src/cli/status_port/store.rs +0 -416
- package/crates/team-agent/src/cli/status_port/tests.rs +0 -90
- package/crates/team-agent/src/cli/status_port.rs +0 -92
- package/crates/team-agent/src/cli/tests/base.rs +0 -885
- package/crates/team-agent/src/cli/tests/divergence.rs +0 -518
- package/crates/team-agent/src/cli/tests/lane_c.rs +0 -453
- package/crates/team-agent/src/cli/tests/leader_watch.rs +0 -322
- package/crates/team-agent/src/cli/tests/main_preserved.rs +0 -430
- package/crates/team-agent/src/cli/tests/missing_subcommands.rs +0 -336
- package/crates/team-agent/src/cli/tests/mod.rs +0 -137
- package/crates/team-agent/src/cli/tests/named_address.rs +0 -761
- package/crates/team-agent/src/cli/tests/parser_safety.rs +0 -383
- package/crates/team-agent/src/cli/tests/run_delegation.rs +0 -484
- package/crates/team-agent/src/cli/tests/shutdown_kill_plan.rs +0 -2179
- package/crates/team-agent/src/cli/tests/status_brief.rs +0 -1514
- package/crates/team-agent/src/cli/tests/status_send.rs +0 -888
- package/crates/team-agent/src/cli/tests/verb_install_skill.rs +0 -93
- package/crates/team-agent/src/cli/tests/verb_profile.rs +0 -392
- package/crates/team-agent/src/cli/triage.rs +0 -234
- package/crates/team-agent/src/cli/types.rs +0 -591
- package/crates/team-agent/src/codex_app_server.rs +0 -546
- package/crates/team-agent/src/communication_mode/mod.rs +0 -56
- package/crates/team-agent/src/compiler/tests.rs +0 -827
- package/crates/team-agent/src/compiler.rs +0 -890
- package/crates/team-agent/src/conpty/backend.rs +0 -829
- package/crates/team-agent/src/conpty/mod.rs +0 -33
- package/crates/team-agent/src/contract_runtime/backend.rs +0 -1744
- package/crates/team-agent/src/contract_runtime/commands.rs +0 -671
- package/crates/team-agent/src/contract_runtime/config.rs +0 -364
- package/crates/team-agent/src/contract_runtime/config_tests.rs +0 -76
- package/crates/team-agent/src/contract_runtime/discovery.rs +0 -449
- package/crates/team-agent/src/contract_runtime/fork.rs +0 -361
- package/crates/team-agent/src/contract_runtime/forward.rs +0 -288
- package/crates/team-agent/src/contract_runtime/framework.rs +0 -367
- package/crates/team-agent/src/contract_runtime/mcp.rs +0 -394
- package/crates/team-agent/src/contract_runtime/mod.rs +0 -17
- package/crates/team-agent/src/contract_runtime/prompt.rs +0 -216
- package/crates/team-agent/src/contract_runtime/pump.rs +0 -271
- package/crates/team-agent/src/contract_runtime/registry.rs +0 -553
- package/crates/team-agent/src/contract_runtime/workspace.rs +0 -228
- package/crates/team-agent/src/coordinator/backoff.rs +0 -741
- package/crates/team-agent/src/coordinator/conpty_shim.rs +0 -805
- package/crates/team-agent/src/coordinator/health.rs +0 -1185
- package/crates/team-agent/src/coordinator/mod.rs +0 -119
- package/crates/team-agent/src/coordinator/orphan.rs +0 -110
- package/crates/team-agent/src/coordinator/runtime_detectors.rs +0 -798
- package/crates/team-agent/src/coordinator/runtime_observation.rs +0 -84
- package/crates/team-agent/src/coordinator/steps/abnormal.rs +0 -2309
- package/crates/team-agent/src/coordinator/steps/delivery.rs +0 -15
- package/crates/team-agent/src/coordinator/steps/health_sync.rs +0 -15
- package/crates/team-agent/src/coordinator/steps/mod.rs +0 -126
- package/crates/team-agent/src/coordinator/steps/persist.rs +0 -15
- package/crates/team-agent/src/coordinator/steps/runtime_prompts.rs +0 -15
- package/crates/team-agent/src/coordinator/steps/session_gate.rs +0 -16
- package/crates/team-agent/src/coordinator/tests/a0_lostupdate.rs +0 -158
- package/crates/team-agent/src/coordinator/tests/abnormal.rs +0 -312
- package/crates/team-agent/src/coordinator/tests/api_error_recovery.rs +0 -300
- package/crates/team-agent/src/coordinator/tests/basics.rs +0 -211
- package/crates/team-agent/src/coordinator/tests/daemon.rs +0 -514
- package/crates/team-agent/src/coordinator/tests/energy.rs +0 -549
- package/crates/team-agent/src/coordinator/tests/health_sync.rs +0 -503
- package/crates/team-agent/src/coordinator/tests/main_preserved.rs +0 -186
- package/crates/team-agent/src/coordinator/tests/mod.rs +0 -295
- package/crates/team-agent/src/coordinator/tests/s3_bounded.rs +0 -207
- package/crates/team-agent/src/coordinator/tests/spine.rs +0 -308
- package/crates/team-agent/src/coordinator/tests/takeover.rs +0 -286
- package/crates/team-agent/src/coordinator/tests/tick_core.rs +0 -237
- package/crates/team-agent/src/coordinator/tick.rs +0 -3024
- package/crates/team-agent/src/coordinator/types.rs +0 -540
- package/crates/team-agent/src/db/agent_health_capture.rs +0 -126
- package/crates/team-agent/src/db/message_store.rs +0 -1527
- package/crates/team-agent/src/db/migration.rs +0 -984
- package/crates/team-agent/src/db/mod.rs +0 -26
- package/crates/team-agent/src/db/schema.rs +0 -663
- package/crates/team-agent/src/diagnose/comms.rs +0 -242
- package/crates/team-agent/src/diagnose/mod.rs +0 -44
- package/crates/team-agent/src/diagnose/orphans.rs +0 -889
- package/crates/team-agent/src/direct_delivery.rs +0 -368
- package/crates/team-agent/src/event_log.rs +0 -502
- package/crates/team-agent/src/fake_worker.rs +0 -303
- package/crates/team-agent/src/inbox_store.rs +0 -169
- package/crates/team-agent/src/kill_audit.rs +0 -106
- package/crates/team-agent/src/layout/manager.rs +0 -248
- package/crates/team-agent/src/layout/mod.rs +0 -36
- package/crates/team-agent/src/layout/overlay.rs +0 -134
- package/crates/team-agent/src/layout/placement.rs +0 -52
- package/crates/team-agent/src/layout/recovery.rs +0 -106
- package/crates/team-agent/src/layout/runtime_sessions.rs +0 -317
- package/crates/team-agent/src/layout/sessions.rs +0 -294
- package/crates/team-agent/src/layout/tmux_endpoint.rs +0 -165
- package/crates/team-agent/src/layout/worker_env.rs +0 -721
- package/crates/team-agent/src/layout/worker_window_helpers.rs +0 -37
- package/crates/team-agent/src/leader/helpers.rs +0 -178
- package/crates/team-agent/src/leader/incident.rs +0 -6
- package/crates/team-agent/src/leader/lease.rs +0 -3356
- package/crates/team-agent/src/leader/mod.rs +0 -104
- package/crates/team-agent/src/leader/owner_bind.rs +0 -400
- package/crates/team-agent/src/leader/prompt.rs +0 -905
- package/crates/team-agent/src/leader/provider_attribution.rs +0 -247
- package/crates/team-agent/src/leader/rediscover/tests.rs +0 -689
- package/crates/team-agent/src/leader/rediscover.rs +0 -1192
- package/crates/team-agent/src/leader/registry.rs +0 -888
- package/crates/team-agent/src/leader/start.rs +0 -4501
- package/crates/team-agent/src/leader/takeover.rs +0 -65
- package/crates/team-agent/src/leader/tests/basics.rs +0 -337
- package/crates/team-agent/src/leader/tests/byte_findings.rs +0 -355
- package/crates/team-agent/src/leader/tests/claim_leader_mailbox_flush_contract.rs +0 -544
- package/crates/team-agent/src/leader/tests/historical_inventory_upgrade_gate_red.rs +0 -624
- package/crates/team-agent/src/leader/tests/identity.rs +0 -465
- package/crates/team-agent/src/leader/tests/identity_session_names.rs +0 -42
- package/crates/team-agent/src/leader/tests/idle.rs +0 -113
- package/crates/team-agent/src/leader/tests/lease_api.rs +0 -520
- package/crates/team-agent/src/leader/tests/lease_claim.rs +0 -629
- package/crates/team-agent/src/leader/tests/mod.rs +0 -106
- package/crates/team-agent/src/leader/tests/prompt_contract.rs +0 -268
- package/crates/team-agent/src/leader/tests/rediscover.rs +0 -403
- package/crates/team-agent/src/leader/tests/rehomed_env.rs +0 -83
- package/crates/team-agent/src/leader/tests/team_in_team_state_scope_red.rs +0 -1273
- package/crates/team-agent/src/leader/tests/terminal_and_replay_vs_rerender_invariants_red.rs +0 -417
- package/crates/team-agent/src/leader/tests/wake_start_owner.rs +0 -168
- package/crates/team-agent/src/leader/types.rs +0 -534
- package/crates/team-agent/src/lib.rs +0 -147
- package/crates/team-agent/src/lifecycle/helpers.rs +0 -212
- package/crates/team-agent/src/lifecycle/launch/add_agent.rs +0 -881
- package/crates/team-agent/src/lifecycle/launch/add_agent_state.rs +0 -598
- package/crates/team-agent/src/lifecycle/launch/agent_state.rs +0 -332
- package/crates/team-agent/src/lifecycle/launch/clone_agent.rs +0 -204
- package/crates/team-agent/src/lifecycle/launch/fork_agent.rs +0 -107
- package/crates/team-agent/src/lifecycle/launch/fork_entry.rs +0 -144
- package/crates/team-agent/src/lifecycle/launch/identity.rs +0 -674
- package/crates/team-agent/src/lifecycle/launch/layout.rs +0 -350
- package/crates/team-agent/src/lifecycle/launch/leader_context.rs +0 -589
- package/crates/team-agent/src/lifecycle/launch/mcp_config.rs +0 -160
- package/crates/team-agent/src/lifecycle/launch/ownership.rs +0 -105
- package/crates/team-agent/src/lifecycle/launch/pi_mcp.rs +0 -899
- package/crates/team-agent/src/lifecycle/launch/pi_mcp_extension.js +0 -225
- package/crates/team-agent/src/lifecycle/launch/plan.rs +0 -269
- package/crates/team-agent/src/lifecycle/launch/quick_start.rs +0 -5200
- package/crates/team-agent/src/lifecycle/launch/quick_start_transport.rs +0 -368
- package/crates/team-agent/src/lifecycle/launch/readiness.rs +0 -519
- package/crates/team-agent/src/lifecycle/launch/role_source.rs +0 -287
- package/crates/team-agent/src/lifecycle/launch/spawn.rs +0 -473
- package/crates/team-agent/src/lifecycle/launch/spec_state.rs +0 -801
- package/crates/team-agent/src/lifecycle/launch/state_projection.rs +0 -624
- package/crates/team-agent/src/lifecycle/launch/worker_env.rs +0 -558
- package/crates/team-agent/src/lifecycle/launch.rs +0 -557
- package/crates/team-agent/src/lifecycle/lock.rs +0 -350
- package/crates/team-agent/src/lifecycle/mod.rs +0 -79
- package/crates/team-agent/src/lifecycle/pane_input_lock.rs +0 -239
- package/crates/team-agent/src/lifecycle/profile_launch.rs +0 -1067
- package/crates/team-agent/src/lifecycle/profile_smoke.rs +0 -557
- package/crates/team-agent/src/lifecycle/restart/agent.rs +0 -2199
- package/crates/team-agent/src/lifecycle/restart/avatar.rs +0 -1798
- package/crates/team-agent/src/lifecycle/restart/claude_fork.rs +0 -163
- package/crates/team-agent/src/lifecycle/restart/common.rs +0 -2362
- package/crates/team-agent/src/lifecycle/restart/orchestrator.rs +0 -65
- package/crates/team-agent/src/lifecycle/restart/preflight.rs +0 -113
- package/crates/team-agent/src/lifecycle/restart/rebuild.rs +0 -5135
- package/crates/team-agent/src/lifecycle/restart/remove.rs +0 -1504
- package/crates/team-agent/src/lifecycle/restart/selection.rs +0 -559
- package/crates/team-agent/src/lifecycle/restart/team_state.rs +0 -329
- package/crates/team-agent/src/lifecycle/restart.rs +0 -227
- package/crates/team-agent/src/lifecycle/role_config.rs +0 -1230
- package/crates/team-agent/src/lifecycle/tests/acceptance_b_batch_red.rs +0 -1021
- package/crates/team-agent/src/lifecycle/tests/agent_ops.rs +0 -1205
- package/crates/team-agent/src/lifecycle/tests/b0_legacy_snapshot_nonauthority_contract.rs +0 -265
- package/crates/team-agent/src/lifecycle/tests/b0_reader_hideone_audit_contract.rs +0 -490
- package/crates/team-agent/src/lifecycle/tests/behavioral_diff_264_red.rs +0 -656
- package/crates/team-agent/src/lifecycle/tests/claude_compatible_config_red.rs +0 -325
- package/crates/team-agent/src/lifecycle/tests/claude_profile_launch_red.rs +0 -447
- package/crates/team-agent/src/lifecycle/tests/cli_argv_routing_red.rs +0 -1638
- package/crates/team-agent/src/lifecycle/tests/clone_agent_preserves_source_tools.rs +0 -427
- package/crates/team-agent/src/lifecycle/tests/clone_fork_copilot_perms_red.rs +0 -770
- package/crates/team-agent/src/lifecycle/tests/communication_mode_runtime_contract_red.rs +0 -419
- package/crates/team-agent/src/lifecycle/tests/copilot_provider_red.rs +0 -2035
- package/crates/team-agent/src/lifecycle/tests/core.rs +0 -1327
- package/crates/team-agent/src/lifecycle/tests/f032_startup_prompt_best_effort_red.rs +0 -315
- package/crates/team-agent/src/lifecycle/tests/fixtures/pi_list_models_g0.stdout.txt +0 -222
- package/crates/team-agent/src/lifecycle/tests/fixtures/pi_list_models_spaced_ids.stdout.txt +0 -9
- package/crates/team-agent/src/lifecycle/tests/fixtures/pi_native_mcp_host.mjs +0 -72
- package/crates/team-agent/src/lifecycle/tests/gate_fixtures.rs +0 -562
- package/crates/team-agent/src/lifecycle/tests/grok_require_explicit_model_red.rs +0 -110
- package/crates/team-agent/src/lifecycle/tests/harvest2_a_batch_red.rs +0 -512
- package/crates/team-agent/src/lifecycle/tests/host_cotenant_death_p0_contract.rs +0 -921
- package/crates/team-agent/src/lifecycle/tests/issue238_codex_effort_contract.rs +0 -68
- package/crates/team-agent/src/lifecycle/tests/lane_ops.rs +0 -1851
- package/crates/team-agent/src/lifecycle/tests/launch_spawn.rs +0 -3983
- package/crates/team-agent/src/lifecycle/tests/lifecycle_lock.rs +0 -339
- package/crates/team-agent/src/lifecycle/tests/lifecycle_rollback_red.rs +0 -596
- package/crates/team-agent/src/lifecycle/tests/main_preserved.rs +0 -513
- package/crates/team-agent/src/lifecycle/tests/mcp_tool_name_format_red.rs +0 -69
- package/crates/team-agent/src/lifecycle/tests/phase_b_contracts.rs +0 -824
- package/crates/team-agent/src/lifecycle/tests/phase_golden.rs +0 -723
- package/crates/team-agent/src/lifecycle/tests/pi_catalog_red.rs +0 -164
- package/crates/team-agent/src/lifecycle/tests/pi_command_red.rs +0 -200
- package/crates/team-agent/src/lifecycle/tests/pi_compiler_red.rs +0 -210
- package/crates/team-agent/src/lifecycle/tests/pi_dual_entry_red.rs +0 -527
- package/crates/team-agent/src/lifecycle/tests/pi_executable_mcp_red.rs +0 -1062
- package/crates/team-agent/src/lifecycle/tests/pi_fork_session_inheritance_red.rs +0 -1419
- package/crates/team-agent/src/lifecycle/tests/pi_lifecycle_doctor_red.rs +0 -98
- package/crates/team-agent/src/lifecycle/tests/pi_native_mcp_capability_red.rs +0 -550
- package/crates/team-agent/src/lifecycle/tests/pi_session_delivery_red.rs +0 -226
- package/crates/team-agent/src/lifecycle/tests/quick_start_worker_readiness_red.rs +0 -332
- package/crates/team-agent/src/lifecycle/tests/realmachine_clusters_1_6_red.rs +0 -786
- package/crates/team-agent/src/lifecycle/tests/realmachine_residual_g1_g4_red.rs +0 -648
- package/crates/team-agent/src/lifecycle/tests/restart.rs +0 -185
- package/crates/team-agent/src/lifecycle/tests/restart_build_before_destroy_0540_contract.rs +0 -1053
- package/crates/team-agent/src/lifecycle/tests/restart_liveness_red.rs +0 -679
- package/crates/team-agent/src/lifecycle/tests/restart_rebind_hotfix_252_red.rs +0 -1126
- package/crates/team-agent/src/lifecycle/tests/restart_session_capture_red.rs +0 -153
- package/crates/team-agent/src/lifecycle/tests/resume_recover_red.rs +0 -427
- package/crates/team-agent/src/lifecycle/tests/stale_team_saveconflict_contract.rs +0 -431
- package/crates/team-agent/src/lifecycle/tests/startup_latency_contract.rs +0 -1066
- package/crates/team-agent/src/lifecycle/tests/status_credential_redaction_contract.rs +0 -876
- package/crates/team-agent/src/lifecycle/tests/subprep_codex_trust_roundtrip_red.rs +0 -1026
- package/crates/team-agent/src/lifecycle/tests/swallow_batch4_semantics_red.rs +0 -342
- package/crates/team-agent/src/lifecycle/tests/team_in_team_identity_scope_red.rs +0 -543
- package/crates/team-agent/src/lifecycle/tests/team_in_team_sibling_quick_start_red.rs +0 -1103
- package/crates/team-agent/src/lifecycle/tests/team_in_team_state_scope_red.rs +0 -1276
- package/crates/team-agent/src/lifecycle/tests/team_key_retirement_roster_red.rs +0 -145
- package/crates/team-agent/src/lifecycle/tests/team_key_retirement_txn_red.rs +0 -603
- package/crates/team-agent/src/lifecycle/tests/test_isolation_escape_contract.rs +0 -936
- package/crates/team-agent/src/lifecycle/tests/upgrade_compat_0211_red.rs +0 -970
- package/crates/team-agent/src/lifecycle/tests/verify_rs031_window_consistency_red.rs +0 -995
- package/crates/team-agent/src/lifecycle/tests/worker_spawn_env_red.rs +0 -836
- package/crates/team-agent/src/lifecycle/tests.rs +0 -105
- package/crates/team-agent/src/lifecycle/types.rs +0 -877
- package/crates/team-agent/src/lifecycle/worker_command_context.rs +0 -363
- package/crates/team-agent/src/main.rs +0 -52
- package/crates/team-agent/src/mcp_server/helpers.rs +0 -510
- package/crates/team-agent/src/mcp_server/lifecycle_tools/mod.rs +0 -6
- package/crates/team-agent/src/mcp_server/lifecycle_tools/state_status.rs +0 -43
- package/crates/team-agent/src/mcp_server/mod.rs +0 -119
- package/crates/team-agent/src/mcp_server/normalize.rs +0 -485
- package/crates/team-agent/src/mcp_server/readiness.rs +0 -527
- package/crates/team-agent/src/mcp_server/readiness_tests.rs +0 -348
- package/crates/team-agent/src/mcp_server/tests/golden.rs +0 -285
- package/crates/team-agent/src/mcp_server/tests/normalize.rs +0 -247
- package/crates/team-agent/src/mcp_server/tests/scoped.rs +0 -158
- package/crates/team-agent/src/mcp_server/tests/send.rs +0 -353
- package/crates/team-agent/src/mcp_server/tests/tools.rs +0 -341
- package/crates/team-agent/src/mcp_server/tests/wire.rs +0 -254
- package/crates/team-agent/src/mcp_server/tests.rs +0 -43
- package/crates/team-agent/src/mcp_server/tools.rs +0 -889
- package/crates/team-agent/src/mcp_server/types.rs +0 -396
- package/crates/team-agent/src/mcp_server/wire.rs +0 -867
- package/crates/team-agent/src/messaging/activity.rs +0 -461
- package/crates/team-agent/src/messaging/address.rs +0 -87
- package/crates/team-agent/src/messaging/delivery.rs +0 -3727
- package/crates/team-agent/src/messaging/delivery_consumption_tests.rs +0 -234
- package/crates/team-agent/src/messaging/enter_rescue.rs +0 -362
- package/crates/team-agent/src/messaging/enter_rescue_tests.rs +0 -633
- package/crates/team-agent/src/messaging/helpers.rs +0 -336
- package/crates/team-agent/src/messaging/leader_channel.rs +0 -287
- package/crates/team-agent/src/messaging/leader_receiver.rs +0 -786
- package/crates/team-agent/src/messaging/mod.rs +0 -167
- package/crates/team-agent/src/messaging/persist.rs +0 -377
- package/crates/team-agent/src/messaging/presentation.rs +0 -417
- package/crates/team-agent/src/messaging/reminders.rs +0 -316
- package/crates/team-agent/src/messaging/results/collection_tests.rs +0 -719
- package/crates/team-agent/src/messaging/results.rs +0 -1415
- package/crates/team-agent/src/messaging/scheduler.rs +0 -223
- package/crates/team-agent/src/messaging/selftest.rs +0 -315
- package/crates/team-agent/src/messaging/send.rs +0 -981
- package/crates/team-agent/src/messaging/tests/basic.rs +0 -346
- package/crates/team-agent/src/messaging/tests/dup_inject.rs +0 -657
- package/crates/team-agent/src/messaging/tests/e23.rs +0 -49
- package/crates/team-agent/src/messaging/tests/leader_channel.rs +0 -169
- package/crates/team-agent/src/messaging/tests/leader_inject_acceptance.rs +0 -817
- package/crates/team-agent/src/messaging/tests/main_preserved.rs +0 -85
- package/crates/team-agent/src/messaging/tests/mod.rs +0 -306
- package/crates/team-agent/src/messaging/tests/runtime.rs +0 -3549
- package/crates/team-agent/src/messaging/tests/spine.rs +0 -853
- package/crates/team-agent/src/messaging/tests/wave2.rs +0 -381
- package/crates/team-agent/src/messaging/trust.rs +0 -215
- package/crates/team-agent/src/messaging/types.rs +0 -472
- package/crates/team-agent/src/messaging/wait.rs +0 -366
- package/crates/team-agent/src/messaging/watchers.rs +0 -916
- package/crates/team-agent/src/model/enums.rs +0 -356
- package/crates/team-agent/src/model/errors.rs +0 -18
- package/crates/team-agent/src/model/ids.rs +0 -165
- package/crates/team-agent/src/model/mod.rs +0 -29
- package/crates/team-agent/src/model/name_similarity.rs +0 -252
- package/crates/team-agent/src/model/pane_authority_refusal.rs +0 -359
- package/crates/team-agent/src/model/paths.rs +0 -257
- package/crates/team-agent/src/model/routing.rs +0 -387
- package/crates/team-agent/src/model/spec.rs +0 -1184
- package/crates/team-agent/src/model/task_graph.rs +0 -321
- package/crates/team-agent/src/model/testdata/fuzz.golden.yaml +0 -43
- package/crates/team-agent/src/model/testdata/fuzz.yaml +0 -43
- package/crates/team-agent/src/model/testdata/spec_invalid_a.yaml +0 -209
- package/crates/team-agent/src/model/testdata/team.spec.golden.yaml +0 -208
- package/crates/team-agent/src/model/testdata/team.spec.yaml +0 -208
- package/crates/team-agent/src/model/yaml/tests.rs +0 -188
- package/crates/team-agent/src/model/yaml.rs +0 -802
- package/crates/team-agent/src/os_probe.rs +0 -280
- package/crates/team-agent/src/packaging/install.rs +0 -219
- package/crates/team-agent/src/packaging/migrate.rs +0 -38
- package/crates/team-agent/src/packaging/mod.rs +0 -91
- package/crates/team-agent/src/packaging/repair.rs +0 -33
- package/crates/team-agent/src/packaging/tests.rs +0 -822
- package/crates/team-agent/src/packaging/types.rs +0 -417
- package/crates/team-agent/src/platform/argv.rs +0 -331
- package/crates/team-agent/src/platform/errors.rs +0 -104
- package/crates/team-agent/src/platform/file_lock.rs +0 -279
- package/crates/team-agent/src/platform/mod.rs +0 -5
- package/crates/team-agent/src/platform/process.rs +0 -545
- package/crates/team-agent/src/provider/adapter.rs +0 -1150
- package/crates/team-agent/src/provider/adapters/claude.rs +0 -78
- package/crates/team-agent/src/provider/adapters/claude_fork.rs +0 -131
- package/crates/team-agent/src/provider/adapters/copilot.rs +0 -75
- package/crates/team-agent/src/provider/adapters/copilot_fork.rs +0 -307
- package/crates/team-agent/src/provider/adapters/fake.rs +0 -18
- package/crates/team-agent/src/provider/adapters/mod.rs +0 -30
- package/crates/team-agent/src/provider/adapters/pi.rs +0 -106
- package/crates/team-agent/src/provider/approvals/mod.rs +0 -3
- package/crates/team-agent/src/provider/approvals/parsing.rs +0 -586
- package/crates/team-agent/src/provider/approvals/runtime_prompts.rs +0 -205
- package/crates/team-agent/src/provider/argv_route.rs +0 -405
- package/crates/team-agent/src/provider/bypass_flags.rs +0 -116
- package/crates/team-agent/src/provider/classify.rs +0 -708
- package/crates/team-agent/src/provider/command_helpers.rs +0 -45
- package/crates/team-agent/src/provider/faults.rs +0 -165
- package/crates/team-agent/src/provider/helpers.rs +0 -52
- package/crates/team-agent/src/provider/mod.rs +0 -78
- package/crates/team-agent/src/provider/model_catalog.rs +0 -910
- package/crates/team-agent/src/provider/session/capture.rs +0 -2731
- package/crates/team-agent/src/provider/session/context_fork/claude.rs +0 -123
- package/crates/team-agent/src/provider/session/context_fork/outcome.rs +0 -172
- package/crates/team-agent/src/provider/session/context_fork.rs +0 -396
- package/crates/team-agent/src/provider/session/mod.rs +0 -36
- package/crates/team-agent/src/provider/session/resume.rs +0 -269
- package/crates/team-agent/src/provider/session_scan/claude.rs +0 -523
- package/crates/team-agent/src/provider/session_scan/common/tests.rs +0 -316
- package/crates/team-agent/src/provider/session_scan/common.rs +0 -654
- package/crates/team-agent/src/provider/session_scan/copilot.rs +0 -280
- package/crates/team-agent/src/provider/session_scan/pi.rs +0 -185
- package/crates/team-agent/src/provider/session_scan.rs +0 -71
- package/crates/team-agent/src/provider/startup_prompt.rs +0 -757
- package/crates/team-agent/src/provider/submit_now.rs +0 -71
- package/crates/team-agent/src/provider/testdata/copilot-ready-marker.txt +0 -5
- package/crates/team-agent/src/provider/testdata/copilot-trust-prompt.txt +0 -19
- package/crates/team-agent/src/provider/testdata/grok-models-authenticated.stdout +0 -9
- package/crates/team-agent/src/provider/testdata/grok-models-unauthenticated.stdout +0 -7
- package/crates/team-agent/src/provider/tests/adapter.rs +0 -441
- package/crates/team-agent/src/provider/tests/classify.rs +0 -148
- package/crates/team-agent/src/provider/tests/command_helpers.rs +0 -35
- package/crates/team-agent/src/provider/tests/copilot_fork.rs +0 -191
- package/crates/team-agent/src/provider/tests/faults.rs +0 -200
- package/crates/team-agent/src/provider/tests/idle.rs +0 -177
- package/crates/team-agent/src/provider/tests/wire.rs +0 -213
- package/crates/team-agent/src/provider/tests.rs +0 -32
- package/crates/team-agent/src/provider/types.rs +0 -529
- package/crates/team-agent/src/provider/wire.rs +0 -394
- package/crates/team-agent/src/redaction.rs +0 -259
- package/crates/team-agent/src/state/abnormal_watch/tests/mod.rs +0 -248
- package/crates/team-agent/src/state/abnormal_watch.rs +0 -144
- package/crates/team-agent/src/state/identity.rs +0 -914
- package/crates/team-agent/src/state/identity_keys.rs +0 -132
- package/crates/team-agent/src/state/mod.rs +0 -74
- package/crates/team-agent/src/state/owner_gate.rs +0 -482
- package/crates/team-agent/src/state/ownership.rs +0 -563
- package/crates/team-agent/src/state/paths.rs +0 -395
- package/crates/team-agent/src/state/persist.rs +0 -3811
- package/crates/team-agent/src/state/projection.rs +0 -1508
- package/crates/team-agent/src/state/repository/intent.rs +0 -14
- package/crates/team-agent/src/state/repository/tests.rs +0 -184
- package/crates/team-agent/src/state/repository.rs +0 -866
- package/crates/team-agent/src/state/selector.rs +0 -160
- package/crates/team-agent/src/state/testdata/state-rich.canonical.json +0 -133
- package/crates/team-agent/src/test_support/models_timeout_fixture.rs +0 -144
- package/crates/team-agent/src/tmux_backend/enter_rescue.rs +0 -325
- package/crates/team-agent/src/tmux_backend/enter_rescue_tests.rs +0 -432
- package/crates/team-agent/src/tmux_backend/native_input.rs +0 -513
- package/crates/team-agent/src/tmux_backend/native_input_tests.rs +0 -742
- package/crates/team-agent/src/tmux_backend/tests.rs +0 -4103
- package/crates/team-agent/src/tmux_backend.rs +0 -4492
- package/crates/team-agent/src/topology.rs +0 -537
- package/crates/team-agent/src/transport/enter_rescue.rs +0 -166
- package/crates/team-agent/src/transport/native_input.rs +0 -491
- package/crates/team-agent/src/transport/test_support.rs +0 -743
- package/crates/team-agent/src/transport/tests/behavior.rs +0 -326
- package/crates/team-agent/src/transport/tests/mod.rs +0 -194
- package/crates/team-agent/src/transport/tests/wire.rs +0 -574
- package/crates/team-agent/src/transport.rs +0 -1655
- package/crates/team-agent/src/transport_factory.rs +0 -819
|
@@ -1,674 +0,0 @@
|
|
|
1
|
-
//! ---
|
|
2
|
-
//! purpose: team 与席位的身份取值,团队键、auth_mode、effort 与 quick-start 层级判定
|
|
3
|
-
//! contract:
|
|
4
|
-
//! provides:
|
|
5
|
-
//! - name: spec_team_id
|
|
6
|
-
//! what: 从 spec 里取 team 标识
|
|
7
|
-
//! - name: runtime_team_key_for_spec
|
|
8
|
-
//! what: 由 spec 路径与 session 名算出 runtime 团队键
|
|
9
|
-
//! - name: transport_has_session
|
|
10
|
-
//! what: 探测 tmux session 是否存在,探测本身出错一律当不存在
|
|
11
|
-
//! - name: provider_effort_from_raw
|
|
12
|
-
//! what: 解析 effort,保留兼容忽略项并拒绝非法 provider 组合
|
|
13
|
-
//! - name: quick_start_depth_guard
|
|
14
|
-
//! what: 定出本次 quick-start 的父团队与层级,推不出父团队时拒绝
|
|
15
|
-
//! - name: annotate_persisted_team_depth
|
|
16
|
-
//! what: 把父团队与层级写回已落盘的 runtime state
|
|
17
|
-
//! depends:
|
|
18
|
-
//! - crate::state::projection
|
|
19
|
-
//! - crate::state::persist
|
|
20
|
-
//! - crate::state::repository
|
|
21
|
-
//! - crate::provider::wire
|
|
22
|
-
//! boundary:
|
|
23
|
-
//! - 只做身份判定与取值,不 spawn、不开显示
|
|
24
|
-
//! - effort 不被支持时只丢弃并给出事件载荷,不改写成别的档位
|
|
25
|
-
//! - 层级判定拿不准时报错,不默认当顶层团队
|
|
26
|
-
//! maturity: wired
|
|
27
|
-
//! ---
|
|
28
|
-
use std::collections::{BTreeMap, BTreeSet};
|
|
29
|
-
use std::path::{Path, PathBuf};
|
|
30
|
-
use std::process::Command;
|
|
31
|
-
|
|
32
|
-
use crate::lifecycle::*;
|
|
33
|
-
use crate::model::enums::{AuthMode, PaneLiveness, Provider, ProviderEffort};
|
|
34
|
-
use crate::model::ids::AgentId;
|
|
35
|
-
use crate::model::yaml::{self, Value};
|
|
36
|
-
use crate::state::persist::load_runtime_state;
|
|
37
|
-
use crate::transport::{PaneId, SessionName, Target, Transport, WindowName};
|
|
38
|
-
|
|
39
|
-
use crate::lifecycle::lock::{acquire_agent_lifecycle_lock, LifecycleLockRequest};
|
|
40
|
-
|
|
41
|
-
use super::*;
|
|
42
|
-
|
|
43
|
-
/// ---
|
|
44
|
-
/// purpose: 从 spec 里取 team 标识
|
|
45
|
-
/// params:
|
|
46
|
-
/// spec: 已解析的 spec
|
|
47
|
-
/// returns: team.id 优先,其次 team.name,再次顶层 name;都没有则 None
|
|
48
|
-
/// ---
|
|
49
|
-
pub(super) fn spec_team_id(spec: &Value) -> Option<String> {
|
|
50
|
-
spec.get("team")
|
|
51
|
-
.and_then(|v| v.get("id").or_else(|| v.get("name")))
|
|
52
|
-
.and_then(Value::as_str)
|
|
53
|
-
.map(str::to_string)
|
|
54
|
-
.or_else(|| spec.get("name").and_then(Value::as_str).map(str::to_string))
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/// ---
|
|
58
|
-
/// purpose: 取 runtime state 里显式记录的当前活跃团队键
|
|
59
|
-
/// returns: 非空的 active_team_key,缺失或为空则 None
|
|
60
|
-
/// ---
|
|
61
|
-
pub(super) fn explicit_active_team_key(state: &serde_json::Value) -> Option<String> {
|
|
62
|
-
state
|
|
63
|
-
.get("active_team_key")
|
|
64
|
-
.and_then(serde_json::Value::as_str)
|
|
65
|
-
.filter(|team| !team.is_empty())
|
|
66
|
-
.map(str::to_string)
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/// ---
|
|
70
|
-
/// purpose: 由 spec 路径、spec 内容与 session 名拼出 runtime 团队键
|
|
71
|
-
/// returns: 交给 state::projection 计算出的团队键
|
|
72
|
-
/// ---
|
|
73
|
-
pub(super) fn runtime_team_key_for_spec(
|
|
74
|
-
spec_path: &Path,
|
|
75
|
-
spec: &Value,
|
|
76
|
-
session_name: &SessionName,
|
|
77
|
-
) -> String {
|
|
78
|
-
let team_dir = spec_path.parent().unwrap_or_else(|| Path::new("."));
|
|
79
|
-
let state = serde_json::json!({
|
|
80
|
-
"team_dir": team_dir.to_string_lossy(),
|
|
81
|
-
"spec_path": spec_path.to_string_lossy(),
|
|
82
|
-
"session_name": session_name.as_str(),
|
|
83
|
-
"team": spec.get("team").map(yaml_value_to_json).unwrap_or(serde_json::Value::Null),
|
|
84
|
-
});
|
|
85
|
-
crate::state::projection::team_state_key(&state)
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
/// ---
|
|
89
|
-
/// purpose: 探测某 tmux session 是否存在
|
|
90
|
-
/// returns: 只有确定存在才返回 true;transport 报错或 panic 一律当作不存在
|
|
91
|
-
/// ---
|
|
92
|
-
pub(super) fn transport_has_session(transport: &dyn Transport, session_name: &SessionName) -> bool {
|
|
93
|
-
match std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {
|
|
94
|
-
transport.has_session(session_name)
|
|
95
|
-
})) {
|
|
96
|
-
Ok(Ok(live)) => live,
|
|
97
|
-
Ok(Err(_)) | Err(_) => false,
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
use crate::provider::wire::parse_provider;
|
|
102
|
-
|
|
103
|
-
/// ---
|
|
104
|
-
/// purpose: 把 auth_mode 字符串解析成枚举
|
|
105
|
-
/// params:
|
|
106
|
-
/// raw: 只接受 subscription、official_api、compatible_api
|
|
107
|
-
/// returns: 对应枚举,未知取值返回 None
|
|
108
|
-
/// ---
|
|
109
|
-
pub(super) fn parse_auth_mode(raw: &str) -> Option<AuthMode> {
|
|
110
|
-
match raw {
|
|
111
|
-
"subscription" => Some(AuthMode::Subscription),
|
|
112
|
-
"official_api" => Some(AuthMode::OfficialApi),
|
|
113
|
-
"compatible_api" => Some(AuthMode::CompatibleApi),
|
|
114
|
-
_ => None,
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
/// ---
|
|
119
|
-
/// purpose: 从原始字符串解析 effort,并要求当前 provider 支持它
|
|
120
|
-
/// params:
|
|
121
|
-
/// raw: effort 原文,None 或空白返回 None
|
|
122
|
-
/// returns: 支持的档位或兼容忽略的 None;已知非法 provider/effort 组合返回错误
|
|
123
|
-
/// ---
|
|
124
|
-
/// 0.4.x provider effort MVP step 4: low-level from a raw string. Returns
|
|
125
|
-
/// `Some(effort)` for supported levels, None for legacy ignored values,
|
|
126
|
-
/// and an error for provider/effort combinations rejected by configuration.
|
|
127
|
-
pub(crate) fn provider_effort_from_raw(
|
|
128
|
-
raw: Option<&str>,
|
|
129
|
-
provider: Provider,
|
|
130
|
-
) -> Result<Option<ProviderEffort>, LifecycleError> {
|
|
131
|
-
let Some(effort) = raw.and_then(ProviderEffort::parse) else {
|
|
132
|
-
return Ok(None);
|
|
133
|
-
};
|
|
134
|
-
effort.resolve_for_provider(provider).map_err(|reason| {
|
|
135
|
-
LifecycleError::RequirementUnmet(format!(
|
|
136
|
-
"{reason} (effort: {}; provider: {provider:?})",
|
|
137
|
-
effort.as_str()
|
|
138
|
-
))
|
|
139
|
-
})
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
/// ---
|
|
143
|
-
/// purpose: 当 spec 请求了该 provider 不支持的 effort 时,给出告警事件载荷
|
|
144
|
-
/// returns: 含 agent_id、provider、effort 与 ignored 动作的 JSON;未请求或本就支持时为 None
|
|
145
|
-
/// ---
|
|
146
|
-
/// 0.4.x provider effort MVP step 7: warning event payload when the spec
|
|
147
|
-
/// requested an effort level the provider does not support.
|
|
148
|
-
pub(crate) fn provider_effort_event_payload(
|
|
149
|
-
raw: Option<&str>,
|
|
150
|
-
provider: Provider,
|
|
151
|
-
agent_id: &str,
|
|
152
|
-
) -> Option<serde_json::Value> {
|
|
153
|
-
let raw = raw?.trim();
|
|
154
|
-
if raw.is_empty() {
|
|
155
|
-
return None;
|
|
156
|
-
}
|
|
157
|
-
let effort = ProviderEffort::parse(raw)?;
|
|
158
|
-
if !matches!(effort.resolve_for_provider(provider), Ok(None)) {
|
|
159
|
-
return None;
|
|
160
|
-
}
|
|
161
|
-
Some(serde_json::json!({
|
|
162
|
-
"agent_id": agent_id,
|
|
163
|
-
"provider": format!("{provider:?}").to_lowercase(),
|
|
164
|
-
"effort": effort.as_str(),
|
|
165
|
-
"action": "ignored",
|
|
166
|
-
"reason": "provider does not support effort",
|
|
167
|
-
}))
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
/// ---
|
|
171
|
-
/// purpose: 仅在存在显式 effort override 时清除继承的 CLAUDE_EFFORT
|
|
172
|
-
/// params:
|
|
173
|
-
/// base: 已有的待清除变量名列表
|
|
174
|
-
/// has_effort_override: 本次启动是否实际施加 effort
|
|
175
|
-
/// returns: 无显式 override 或非 claude 系时原样返回
|
|
176
|
-
/// ---
|
|
177
|
-
/// Preserve provider-native `CLAUDE_EFFORT` unless a supported explicit role
|
|
178
|
-
/// effort is applied; in that case prevent the inherited environment from
|
|
179
|
-
/// overriding the requested value.
|
|
180
|
-
pub(crate) fn extend_worker_env_unset_for_effort(
|
|
181
|
-
base: Vec<String>,
|
|
182
|
-
provider: Provider,
|
|
183
|
-
has_effort_override: bool,
|
|
184
|
-
) -> Vec<String> {
|
|
185
|
-
if !has_effort_override || !matches!(provider, Provider::Claude | Provider::ClaudeCode) {
|
|
186
|
-
return base;
|
|
187
|
-
}
|
|
188
|
-
let mut out = base;
|
|
189
|
-
if !out.iter().any(|k| k == "CLAUDE_EFFORT") {
|
|
190
|
-
out.push("CLAUDE_EFFORT".to_string());
|
|
191
|
-
}
|
|
192
|
-
out
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
/// ---
|
|
196
|
-
/// purpose: 从 YAML agent 节点解析出可用的 effort
|
|
197
|
-
/// returns: 该 provider 支持的 effort,否则 None
|
|
198
|
-
/// contract_id: lifecycle.identity.effort_for_spawn
|
|
199
|
-
/// ---
|
|
200
|
-
/// Convenience: resolve effort for a yaml::Value agent (spec / compiled).
|
|
201
|
-
pub(crate) fn provider_effort_for_spawn(
|
|
202
|
-
agent: &crate::model::yaml::Value,
|
|
203
|
-
provider: Provider,
|
|
204
|
-
) -> Result<Option<ProviderEffort>, LifecycleError> {
|
|
205
|
-
provider_effort_from_raw(agent.get("effort").and_then(|v| v.as_str()), provider)
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
/// ---
|
|
209
|
-
/// purpose: 从 YAML agent 节点取 effort,若被丢弃则给出告警事件载荷
|
|
210
|
-
/// returns: 告警载荷或 None
|
|
211
|
-
/// contract_id: lifecycle.identity.effort_event_if_dropped
|
|
212
|
-
/// ---
|
|
213
|
-
pub(crate) fn provider_effort_event_if_dropped(
|
|
214
|
-
agent: &crate::model::yaml::Value,
|
|
215
|
-
provider: Provider,
|
|
216
|
-
agent_id: &str,
|
|
217
|
-
) -> Option<serde_json::Value> {
|
|
218
|
-
provider_effort_event_payload(
|
|
219
|
-
agent.get("effort").and_then(|v| v.as_str()),
|
|
220
|
-
provider,
|
|
221
|
-
agent_id,
|
|
222
|
-
)
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
/// ---
|
|
226
|
-
/// purpose: 从 runtime state 的 JSON agent 节点解析出可用的 effort
|
|
227
|
-
/// returns: 该 provider 支持的 effort,否则 None
|
|
228
|
-
/// contract_id: lifecycle.identity.effort_for_spawn
|
|
229
|
-
/// ---
|
|
230
|
-
/// Same as [`provider_effort_for_spawn`] but for serde_json state values
|
|
231
|
-
/// (used by restart paths reading from `state.agents[id]`).
|
|
232
|
-
pub(crate) fn provider_effort_for_spawn_json(
|
|
233
|
-
agent: &serde_json::Value,
|
|
234
|
-
provider: Provider,
|
|
235
|
-
) -> Result<Option<ProviderEffort>, LifecycleError> {
|
|
236
|
-
provider_effort_from_raw(
|
|
237
|
-
agent.get("effort").and_then(serde_json::Value::as_str),
|
|
238
|
-
provider,
|
|
239
|
-
)
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
/// ---
|
|
243
|
-
/// purpose: 从 JSON agent 节点取 effort,若被丢弃则给出告警事件载荷
|
|
244
|
-
/// returns: 告警载荷或 None
|
|
245
|
-
/// contract_id: lifecycle.identity.effort_event_if_dropped
|
|
246
|
-
/// ---
|
|
247
|
-
pub(crate) fn provider_effort_event_if_dropped_json(
|
|
248
|
-
agent: &serde_json::Value,
|
|
249
|
-
provider: Provider,
|
|
250
|
-
agent_id: &str,
|
|
251
|
-
) -> Option<serde_json::Value> {
|
|
252
|
-
provider_effort_event_payload(
|
|
253
|
-
agent.get("effort").and_then(serde_json::Value::as_str),
|
|
254
|
-
provider,
|
|
255
|
-
agent_id,
|
|
256
|
-
)
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
/// ---
|
|
260
|
-
/// purpose: 定出 quick-start 本次请求的团队键
|
|
261
|
-
/// returns: team_id 优先于 name 的第一个非空值
|
|
262
|
-
/// ---
|
|
263
|
-
pub(super) fn quick_start_requested_team_key<'a>(
|
|
264
|
-
team_id: Option<&'a str>,
|
|
265
|
-
name: Option<&'a str>,
|
|
266
|
-
) -> Option<&'a str> {
|
|
267
|
-
team_id.or(name).filter(|team| !team.is_empty())
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
pub(super) struct QuickStartDepth {
|
|
271
|
-
pub(super) parent_team_key: Option<String>,
|
|
272
|
-
pub(super) team_depth: u64,
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
/// ---
|
|
276
|
-
/// purpose: 定出本次 quick-start 的父团队键与团队层级
|
|
277
|
-
/// params:
|
|
278
|
-
/// requested_team: 请求的团队键,用于识别 child 或 grandchild 这类嵌套意图
|
|
279
|
-
/// _agents_dir: 未参与判定
|
|
280
|
-
/// _strict_real_runtime: 未参与判定
|
|
281
|
-
/// returns: 父团队键与层级;无父上下文时父键为 None、层级为 1
|
|
282
|
-
/// errors: 已有活跃团队且请求键像嵌套意图但推不出父团队时返回 RequirementUnmet
|
|
283
|
-
/// ---
|
|
284
|
-
pub(super) fn quick_start_depth_guard(
|
|
285
|
-
workspace: &Path,
|
|
286
|
-
_agents_dir: &Path,
|
|
287
|
-
requested_team: Option<&str>,
|
|
288
|
-
_strict_real_runtime: bool,
|
|
289
|
-
) -> Result<QuickStartDepth, LifecycleError> {
|
|
290
|
-
// OWNER_TEAM_ID is injected into every worker process. It is parent
|
|
291
|
-
// context only when the target quick-start workspace is the same workspace
|
|
292
|
-
// that produced the environment; otherwise a worker launching a fresh
|
|
293
|
-
// external workspace would inherit a false nesting parent.
|
|
294
|
-
let env_parent = owner_context_matches_workspace(workspace).then(|| {
|
|
295
|
-
std::env::var("TEAM_AGENT_OWNER_TEAM_ID")
|
|
296
|
-
.ok()
|
|
297
|
-
.map(|value| value.trim().to_string())
|
|
298
|
-
.filter(|value| !value.is_empty())
|
|
299
|
-
}).flatten();
|
|
300
|
-
let parent = env_parent;
|
|
301
|
-
let Some(parent) = parent else {
|
|
302
|
-
let state = crate::state::persist::load_runtime_state(workspace)
|
|
303
|
-
.unwrap_or_else(|_| serde_json::json!({}));
|
|
304
|
-
let ambiguous_nested_intent = requested_team.is_some_and(|team| {
|
|
305
|
-
looks_ambiguous_child_team_key(team) || looks_grandchild_team_key(team)
|
|
306
|
-
});
|
|
307
|
-
if has_live_runtime_teams(&state) && ambiguous_nested_intent {
|
|
308
|
-
if requested_team.is_some_and(looks_grandchild_team_key) {
|
|
309
|
-
if let Some(parent_key) = infer_parent_team_from_active_state(&state) {
|
|
310
|
-
let parent_state =
|
|
311
|
-
crate::state::projection::project_top_level_view(&state, &parent_key);
|
|
312
|
-
let parent_depth = parent_state
|
|
313
|
-
.get("team_depth")
|
|
314
|
-
.and_then(serde_json::Value::as_u64)
|
|
315
|
-
.unwrap_or(1);
|
|
316
|
-
return Ok(QuickStartDepth {
|
|
317
|
-
parent_team_key: Some(parent_key),
|
|
318
|
-
team_depth: parent_depth.saturating_add(1),
|
|
319
|
-
});
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
return Err(LifecycleError::RequirementUnmet(
|
|
323
|
-
"cannot infer parent team for nested quick-start; pass an explicit worker/subleader owner context"
|
|
324
|
-
.to_string(),
|
|
325
|
-
));
|
|
326
|
-
}
|
|
327
|
-
return Ok(QuickStartDepth {
|
|
328
|
-
parent_team_key: None,
|
|
329
|
-
team_depth: 1,
|
|
330
|
-
});
|
|
331
|
-
};
|
|
332
|
-
let state = crate::state::persist::load_runtime_state(workspace)
|
|
333
|
-
.unwrap_or_else(|_| serde_json::json!({}));
|
|
334
|
-
let parent_key = crate::state::projection::resolve_owner_team_id(&state, &parent)
|
|
335
|
-
.canonical_key()
|
|
336
|
-
.map(str::to_string)
|
|
337
|
-
.unwrap_or(parent);
|
|
338
|
-
let parent_state = crate::state::projection::project_top_level_view(&state, &parent_key);
|
|
339
|
-
let parent_depth = parent_state
|
|
340
|
-
.get("team_depth")
|
|
341
|
-
.and_then(serde_json::Value::as_u64)
|
|
342
|
-
.unwrap_or(1);
|
|
343
|
-
let team_depth = parent_depth.saturating_add(1);
|
|
344
|
-
Ok(QuickStartDepth {
|
|
345
|
-
parent_team_key: Some(parent_key),
|
|
346
|
-
team_depth,
|
|
347
|
-
})
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
/// ---
|
|
351
|
-
/// purpose: 从 runtime state 推断父团队键
|
|
352
|
-
/// returns: 活跃团队键,且该团队确有 running 席位时返回它,否则 None
|
|
353
|
-
/// ---
|
|
354
|
-
fn owner_context_matches_workspace(workspace: &Path) -> bool {
|
|
355
|
-
let Some(env_workspace) = std::env::var_os("TEAM_AGENT_WORKSPACE") else {
|
|
356
|
-
return false;
|
|
357
|
-
};
|
|
358
|
-
let env_workspace = PathBuf::from(env_workspace);
|
|
359
|
-
env_workspace == workspace
|
|
360
|
-
|| std::fs::canonicalize(&env_workspace)
|
|
361
|
-
.ok()
|
|
362
|
-
.zip(std::fs::canonicalize(workspace).ok())
|
|
363
|
-
.is_some_and(|(env_path, target_path)| env_path == target_path)
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
pub(super) fn infer_parent_team_from_active_state(state: &serde_json::Value) -> Option<String> {
|
|
367
|
-
let active = explicit_active_team_key(state)?;
|
|
368
|
-
let team = state
|
|
369
|
-
.get("teams")
|
|
370
|
-
.and_then(serde_json::Value::as_object)
|
|
371
|
-
.and_then(|teams| teams.get(&active))?;
|
|
372
|
-
team_has_running_agent(team).then_some(active)
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
/// ---
|
|
376
|
-
/// purpose: 判断 state 里是否存在带 running 席位的团队
|
|
377
|
-
/// returns: 任一团队有 running 席位即 true
|
|
378
|
-
/// ---
|
|
379
|
-
pub(super) fn has_live_runtime_teams(state: &serde_json::Value) -> bool {
|
|
380
|
-
state
|
|
381
|
-
.get("teams")
|
|
382
|
-
.and_then(serde_json::Value::as_object)
|
|
383
|
-
.is_some_and(|teams| teams.values().any(team_has_running_agent))
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
/// ---
|
|
387
|
-
/// purpose: 判断某团队节点里是否有状态为 running 的席位
|
|
388
|
-
/// returns: 有则 true
|
|
389
|
-
/// ---
|
|
390
|
-
pub(super) fn team_has_running_agent(team: &serde_json::Value) -> bool {
|
|
391
|
-
team.get("agents")
|
|
392
|
-
.and_then(serde_json::Value::as_object)
|
|
393
|
-
.is_some_and(|agents| {
|
|
394
|
-
agents.values().any(|agent| {
|
|
395
|
-
agent.get("status").and_then(serde_json::Value::as_str) == Some("running")
|
|
396
|
-
})
|
|
397
|
-
})
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
/// ---
|
|
401
|
-
/// purpose: 判断团队键是否像有歧义的子团队名
|
|
402
|
-
/// params:
|
|
403
|
-
/// team: 团队键,比较前去空白并转小写
|
|
404
|
-
/// returns: 以 child 开头但不等于 child 时为 true
|
|
405
|
-
/// ---
|
|
406
|
-
pub(super) fn looks_ambiguous_child_team_key(team: &str) -> bool {
|
|
407
|
-
let team = team.trim().to_ascii_lowercase();
|
|
408
|
-
team != "child"
|
|
409
|
-
&& (team.starts_with("child-")
|
|
410
|
-
|| team.starts_with("child_")
|
|
411
|
-
|| team.starts_with("child.")
|
|
412
|
-
|| team.starts_with("child"))
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
/// ---
|
|
416
|
-
/// purpose: 判断团队键是否像孙团队名
|
|
417
|
-
/// returns: 等于 grandchild 或以 grandchild 开头时为 true
|
|
418
|
-
/// ---
|
|
419
|
-
pub(super) fn looks_grandchild_team_key(team: &str) -> bool {
|
|
420
|
-
let team = team.trim().to_ascii_lowercase();
|
|
421
|
-
team == "grandchild"
|
|
422
|
-
|| team.starts_with("grandchild-")
|
|
423
|
-
|| team.starts_with("grandchild_")
|
|
424
|
-
|| team.starts_with("grandchild.")
|
|
425
|
-
|| team.starts_with("grandchild")
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
/// ---
|
|
429
|
-
/// purpose: 就地给团队节点写上 team_depth 与可选的 parent_team_key
|
|
430
|
-
/// params:
|
|
431
|
-
/// state: 待改写的团队节点,非对象时不动
|
|
432
|
-
/// parent_team_key: 非空时才写入
|
|
433
|
-
/// ---
|
|
434
|
-
pub(super) fn annotate_team_depth(
|
|
435
|
-
state: &mut serde_json::Value,
|
|
436
|
-
parent_team_key: Option<&str>,
|
|
437
|
-
team_depth: u64,
|
|
438
|
-
) {
|
|
439
|
-
let Some(obj) = state.as_object_mut() else {
|
|
440
|
-
return;
|
|
441
|
-
};
|
|
442
|
-
obj.insert("team_depth".to_string(), serde_json::json!(team_depth));
|
|
443
|
-
if let Some(parent) = parent_team_key.filter(|value| !value.is_empty()) {
|
|
444
|
-
obj.insert("parent_team_key".to_string(), serde_json::json!(parent));
|
|
445
|
-
}
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
/// ---
|
|
449
|
-
/// purpose: 读出 runtime state,给指定团队写上层级与父键后存回
|
|
450
|
-
/// returns: 成功返回空值;state 里没有该团队时直接返回成功且不写盘
|
|
451
|
-
/// errors: 读或写 runtime state 失败时返回 StatePersist
|
|
452
|
-
/// ---
|
|
453
|
-
pub(super) fn annotate_persisted_team_depth(
|
|
454
|
-
workspace: &Path,
|
|
455
|
-
team_key: &str,
|
|
456
|
-
parent_team_key: Option<&str>,
|
|
457
|
-
team_depth: u64,
|
|
458
|
-
) -> Result<(), LifecycleError> {
|
|
459
|
-
let mut state = crate::state::persist::load_runtime_state(workspace)
|
|
460
|
-
.map_err(|e| LifecycleError::StatePersist(e.to_string()))?;
|
|
461
|
-
let Some(team) = state
|
|
462
|
-
.get_mut("teams")
|
|
463
|
-
.and_then(serde_json::Value::as_object_mut)
|
|
464
|
-
.and_then(|teams| teams.get_mut(team_key))
|
|
465
|
-
else {
|
|
466
|
-
return Ok(());
|
|
467
|
-
};
|
|
468
|
-
annotate_team_depth(team, parent_team_key, team_depth);
|
|
469
|
-
crate::state::repository::StateRepository::new(workspace)
|
|
470
|
-
.save(
|
|
471
|
-
crate::state::repository::StateWriteIntent::AnnotateTeamDepth { team_key },
|
|
472
|
-
&state,
|
|
473
|
-
)
|
|
474
|
-
.map_err(|e| LifecycleError::StatePersist(e.to_string()))?;
|
|
475
|
-
Ok(())
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
/// ---
|
|
479
|
-
/// purpose: 判断目标团队是否已有 worker runtime,已证明的 Leader-only 登记不算初始化
|
|
480
|
-
/// returns: 未初始化的有效 Leader-only 登记为 false;已有或无法分类的目标 runtime 为 true
|
|
481
|
-
/// ---
|
|
482
|
-
pub(super) fn runtime_state_has_quick_start_team(state: &serde_json::Value, team: &str) -> bool {
|
|
483
|
-
let entry = state
|
|
484
|
-
.get("teams")
|
|
485
|
-
.and_then(serde_json::Value::as_object)
|
|
486
|
-
.and_then(|teams| teams.get(team));
|
|
487
|
-
if let Some(entry) = entry {
|
|
488
|
-
return !is_quick_start_leader_bootstrap(entry);
|
|
489
|
-
}
|
|
490
|
-
// Legacy aliases still identify existing/ambiguous runtime, not a proven
|
|
491
|
-
// canonical bootstrap record. Do not grant fresh creation through an alias.
|
|
492
|
-
if state
|
|
493
|
-
.get("teams")
|
|
494
|
-
.and_then(serde_json::Value::as_object)
|
|
495
|
-
.is_some_and(|teams| teams.values().any(|entry| json_team_identity_matches(entry, team)))
|
|
496
|
-
{
|
|
497
|
-
return true;
|
|
498
|
-
}
|
|
499
|
-
let matches = explicit_active_team_key(state).as_deref() == Some(team)
|
|
500
|
-
|| crate::state::projection::team_state_key(state) == team
|
|
501
|
-
|| json_team_identity_matches(state, team)
|
|
502
|
-
|| state
|
|
503
|
-
.get("session_name")
|
|
504
|
-
.and_then(serde_json::Value::as_str)
|
|
505
|
-
.is_some_and(|session| session == team || session.strip_prefix("team-") == Some(team));
|
|
506
|
-
matches && !is_quick_start_leader_bootstrap(state)
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
// An empty agent table alone is not fresh: stopped/removed/partial teams keep
|
|
510
|
-
// their spec, session or task history. Only a coherent attached leader binding
|
|
511
|
-
// with no worker initialization evidence may proceed through first creation.
|
|
512
|
-
pub(super) fn is_quick_start_leader_bootstrap(state: &serde_json::Value) -> bool {
|
|
513
|
-
if !state.is_object()
|
|
514
|
-
|| state.get("teams").is_some_and(|teams| !teams.is_object())
|
|
515
|
-
|| !state.get("agents").and_then(serde_json::Value::as_object).is_some_and(|agents| agents.is_empty())
|
|
516
|
-
|| state.get("spec_path").is_some()
|
|
517
|
-
|| state.get("team_dir").is_some_and(|dir| !dir.is_null())
|
|
518
|
-
|| state.get("session_name").is_some_and(|session| !session.is_null())
|
|
519
|
-
|| state.get("tasks").is_some_and(|tasks| {
|
|
520
|
-
!tasks.as_object().is_some_and(|tasks| tasks.is_empty())
|
|
521
|
-
&& !tasks.as_array().is_some_and(|tasks| tasks.is_empty())
|
|
522
|
-
})
|
|
523
|
-
|| state.get("status").is_some_and(|status| status.as_str() != Some("alive"))
|
|
524
|
-
|| state.get("archived_at").is_some_and(|value| !value.is_null())
|
|
525
|
-
{
|
|
526
|
-
return false;
|
|
527
|
-
}
|
|
528
|
-
let owner = state.get("team_owner");
|
|
529
|
-
let receiver = state.get("leader_receiver");
|
|
530
|
-
let owner_pane = owner.and_then(|owner| owner.get("pane_id")).and_then(serde_json::Value::as_str).filter(|pane| !pane.is_empty());
|
|
531
|
-
let receiver_pane = receiver.and_then(|receiver| receiver.get("pane_id")).and_then(serde_json::Value::as_str);
|
|
532
|
-
owner_pane.is_some()
|
|
533
|
-
&& owner_pane == receiver_pane
|
|
534
|
-
&& receiver.and_then(|receiver| receiver.get("status")).and_then(serde_json::Value::as_str) == Some("attached")
|
|
535
|
-
}
|
|
536
|
-
|
|
537
|
-
/// ---
|
|
538
|
-
/// purpose: 判断某 JSON 节点的团队身份字段是否等于给定团队键
|
|
539
|
-
/// returns: team.id、team.name 或顶层 name 命中即 true
|
|
540
|
-
/// ---
|
|
541
|
-
pub(super) fn json_team_identity_matches(state: &serde_json::Value, team: &str) -> bool {
|
|
542
|
-
state
|
|
543
|
-
.get("team")
|
|
544
|
-
.and_then(|value| value.get("id").or_else(|| value.get("name")))
|
|
545
|
-
.and_then(serde_json::Value::as_str)
|
|
546
|
-
.is_some_and(|value| value == team)
|
|
547
|
-
|| state
|
|
548
|
-
.get("name")
|
|
549
|
-
.and_then(serde_json::Value::as_str)
|
|
550
|
-
.is_some_and(|value| value == team)
|
|
551
|
-
}
|
|
552
|
-
|
|
553
|
-
#[cfg(test)]
|
|
554
|
-
mod quick_start_runtime_identity_tests {
|
|
555
|
-
use super::runtime_state_has_quick_start_team;
|
|
556
|
-
use serde_json::{json, Value};
|
|
557
|
-
|
|
558
|
-
fn leader_bootstrap() -> Value {
|
|
559
|
-
json!({
|
|
560
|
-
"agents": {},
|
|
561
|
-
"session_name": null,
|
|
562
|
-
"tasks": {},
|
|
563
|
-
"team_owner": {"pane_id": "%0", "provider": "pi", "owner_epoch": 1},
|
|
564
|
-
"leader_receiver": {"pane_id": "%0", "status": "attached", "session_name": "team-agent-leader-pi-fixture"},
|
|
565
|
-
"leader_client": {"diagnostic_only": true}
|
|
566
|
-
})
|
|
567
|
-
}
|
|
568
|
-
|
|
569
|
-
#[test]
|
|
570
|
-
fn current_launcher_seed_is_not_initialized_and_is_not_mutated() {
|
|
571
|
-
let seed = leader_bootstrap();
|
|
572
|
-
let state = json!({"active_team_key": "current", "team_key": "current", "teams": {"current": seed}});
|
|
573
|
-
let before = state.clone();
|
|
574
|
-
assert!(!runtime_state_has_quick_start_team(&state, "current"));
|
|
575
|
-
assert_eq!(state, before);
|
|
576
|
-
}
|
|
577
|
-
|
|
578
|
-
#[test]
|
|
579
|
-
fn real_native_managed_launcher_empty_array_shape_is_fresh_and_unchanged() {
|
|
580
|
-
let mut entry = leader_bootstrap();
|
|
581
|
-
entry["tasks"] = json!([]);
|
|
582
|
-
entry["is_external_leader"] = json!(false);
|
|
583
|
-
entry["team_key"] = json!("current");
|
|
584
|
-
entry["tmux_socket"] = json!("/private/tmp/fixture-native-leader");
|
|
585
|
-
entry["owner_epoch"] = json!(1);
|
|
586
|
-
entry["team_owner"]["machine_fingerprint"] = json!("");
|
|
587
|
-
entry["team_owner"]["leader_session_uuid"] = json!("fixture-native-uuid");
|
|
588
|
-
entry["leader_receiver"]["owner_epoch"] = json!(1);
|
|
589
|
-
entry["leader_receiver"]["leader_session_uuid"] = json!("fixture-native-uuid");
|
|
590
|
-
let state = json!({
|
|
591
|
-
"agents": {}, "tasks": [], "session_name": null,
|
|
592
|
-
"active_team_key": "current", "team_key": "current",
|
|
593
|
-
"teams": {"current": entry}
|
|
594
|
-
});
|
|
595
|
-
let before = state.clone();
|
|
596
|
-
assert!(!runtime_state_has_quick_start_team(&state, "current"));
|
|
597
|
-
assert_eq!(state, before);
|
|
598
|
-
}
|
|
599
|
-
|
|
600
|
-
#[test]
|
|
601
|
-
fn legacy_flat_leader_binding_can_initialize() {
|
|
602
|
-
let mut state = leader_bootstrap();
|
|
603
|
-
state["active_team_key"] = json!("current");
|
|
604
|
-
assert!(!runtime_state_has_quick_start_team(&state, "current"));
|
|
605
|
-
}
|
|
606
|
-
|
|
607
|
-
#[test]
|
|
608
|
-
fn stopped_removed_partial_and_unknown_teams_remain_existing() {
|
|
609
|
-
let cases = [
|
|
610
|
-
("agents", json!({"worker": {"status": "stopped"}})),
|
|
611
|
-
("spec_path", json!("/tmp/current/team.spec.yaml")),
|
|
612
|
-
("spec_path", Value::Null),
|
|
613
|
-
("team_dir", json!("/tmp/.team/current")),
|
|
614
|
-
("session_name", json!("team-current")),
|
|
615
|
-
("session_name", json!("team-agent-leader-stale-worker-field")),
|
|
616
|
-
("tasks", json!({"finished_task": {"status": "done"}})),
|
|
617
|
-
("tasks", json!([{"status": "done"}])),
|
|
618
|
-
("tasks", Value::Null),
|
|
619
|
-
("tasks", json!("unknown")),
|
|
620
|
-
("tasks", json!(false)),
|
|
621
|
-
("tasks", json!(0)),
|
|
622
|
-
("status", json!("stopped")),
|
|
623
|
-
("archived_at", json!("2026-10-08")),
|
|
624
|
-
("agents", Value::Null),
|
|
625
|
-
("agents", json!([])),
|
|
626
|
-
("team_owner", Value::Null),
|
|
627
|
-
("leader_receiver", json!({"pane_id": "%99", "status": "attached"})),
|
|
628
|
-
("leader_receiver", json!({"pane_id": "%0", "status": "pending"})),
|
|
629
|
-
];
|
|
630
|
-
for (key, value) in cases {
|
|
631
|
-
let mut entry = leader_bootstrap();
|
|
632
|
-
entry[key] = value;
|
|
633
|
-
let state = json!({"active_team_key": "current", "teams": {"current": entry}});
|
|
634
|
-
assert!(runtime_state_has_quick_start_team(&state, "current"), "must protect {key}: {state}");
|
|
635
|
-
}
|
|
636
|
-
for entry in [json!({}), Value::Null, json!({"agents": {}, "session_name": null})] {
|
|
637
|
-
let state = json!({"teams": {"current": entry}});
|
|
638
|
-
assert!(runtime_state_has_quick_start_team(&state, "current"));
|
|
639
|
-
}
|
|
640
|
-
}
|
|
641
|
-
|
|
642
|
-
#[test]
|
|
643
|
-
fn malformed_team_tables_do_not_allow_flat_bootstrap_to_bypass_the_guard() {
|
|
644
|
-
for teams in [Value::Null, json!([]), json!("damaged")] {
|
|
645
|
-
let mut state = leader_bootstrap();
|
|
646
|
-
state["active_team_key"] = json!("current");
|
|
647
|
-
state["teams"] = teams;
|
|
648
|
-
assert!(runtime_state_has_quick_start_team(&state, "current"));
|
|
649
|
-
}
|
|
650
|
-
}
|
|
651
|
-
|
|
652
|
-
#[test]
|
|
653
|
-
fn only_the_requested_team_supplies_initialization_evidence() {
|
|
654
|
-
let state = json!({
|
|
655
|
-
"active_team_key": "other", "spec_path": "/tmp/other/spec.yaml",
|
|
656
|
-
"session_name": "team-other", "agents": {"other_worker": {}},
|
|
657
|
-
"teams": {
|
|
658
|
-
"other": {"spec_path": "/tmp/other/spec.yaml", "agents": {"other_worker": {}}},
|
|
659
|
-
"current": leader_bootstrap()
|
|
660
|
-
}
|
|
661
|
-
});
|
|
662
|
-
assert!(!runtime_state_has_quick_start_team(&state, "current"));
|
|
663
|
-
assert!(runtime_state_has_quick_start_team(&state, "other"));
|
|
664
|
-
assert!(!runtime_state_has_quick_start_team(&state, "new-team"));
|
|
665
|
-
}
|
|
666
|
-
|
|
667
|
-
#[test]
|
|
668
|
-
fn ambiguous_legacy_identity_is_not_fresh() {
|
|
669
|
-
let mut first = leader_bootstrap();
|
|
670
|
-
first["name"] = json!("current");
|
|
671
|
-
let state = json!({"teams": {"first": first, "second": {"name": "current"}}});
|
|
672
|
-
assert!(runtime_state_has_quick_start_team(&state, "current"));
|
|
673
|
-
}
|
|
674
|
-
}
|