@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,394 +0,0 @@
|
|
|
1
|
-
//!
|
|
2
|
-
//! Provider wire-format helpers — the single source of truth for converting
|
|
3
|
-
//! `Provider` ↔ string forms used across state JSON, CLI args, log fields,
|
|
4
|
-
//! and the workers we shell out to.
|
|
5
|
-
//!
|
|
6
|
-
//! This module replaces 7 hand-rolled copies of these match arms that lived
|
|
7
|
-
//! in `leader/helpers.rs`, `coordinator/tick.rs` (×2), `lifecycle/restart/common.rs`,
|
|
8
|
-
//! `lifecycle/profile_launch.rs`, `lifecycle/launch.rs`, `provider/adapter.rs`,
|
|
9
|
-
//! and `lifecycle/restart/rebuild.rs`. Centralising them removes the kind of
|
|
10
|
-
//! drift that left `restart/rebuild.rs` with a `claude-code` alias the other
|
|
11
|
-
//! sites silently dropped, and shrinks the surface area when a new provider
|
|
12
|
-
//! is added.
|
|
13
|
-
//!
|
|
14
|
-
//! Wire-format invariants (do not change without a coordinated migration):
|
|
15
|
-
//! * `provider_wire(Provider)` returns the canonical snake_case string used
|
|
16
|
-
//! in state JSON. These values are persisted on disk and read by older
|
|
17
|
-
//! runtimes — changing them is a breaking change.
|
|
18
|
-
//! * `parse_provider(&str)` accepts the canonical form AND every historical
|
|
19
|
-
//! alias we have ever written. New aliases go in `aliases()` and become
|
|
20
|
-
//! a parse target automatically.
|
|
21
|
-
//! * `command_name(Provider)` returns the binary name we exec for that
|
|
22
|
-
//! provider. `Claude` and `ClaudeCode` both shell out to `claude` —
|
|
23
|
-
//! they are distinct state values but share an executable.
|
|
24
|
-
|
|
25
|
-
use crate::model::enums::Provider;
|
|
26
|
-
|
|
27
|
-
/// A state row written by a release that still ran a legacy worker engine:
|
|
28
|
-
/// Cursor's `cursor_agent`/`agent` or Codex's `codex`/`codex_cli`.
|
|
29
|
-
/// No legacy worker runtime exists for it now; it must never fall back
|
|
30
|
-
/// to another provider. Role and CLI declarations of these names select the
|
|
31
|
-
/// contract leaf, whose state row carries the leaf id instead. A leader is not
|
|
32
|
-
/// an `agents` row, so its own provider key is unaffected. Claude Code
|
|
33
|
-
/// (`claude`/`claude_code`) and Pi (`pi`) rows keep their legacy runtimes.
|
|
34
|
-
pub(crate) const RETIRED_PROVIDER_ERROR: &str =
|
|
35
|
-
"legacy cursor_agent seat has no runtime in this release; stop or remove it, then add it again (provider: cursor)";
|
|
36
|
-
const RETIRED_CODEX_ERROR: &str =
|
|
37
|
-
"legacy codex seat has no runtime in this release; stop or remove it, then add it again (provider: codex)";
|
|
38
|
-
|
|
39
|
-
pub(crate) fn is_retired_provider(raw: &str) -> bool {
|
|
40
|
-
matches!(
|
|
41
|
-
raw.trim().to_ascii_lowercase().as_str(),
|
|
42
|
-
"cursor_agent" | "agent" | "codex" | "codex_cli" | "codex-cli"
|
|
43
|
-
)
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/// The refusal for a retired state row, naming the provider to re-add it with.
|
|
47
|
-
pub(crate) fn retired_provider_error(raw: &str) -> &'static str {
|
|
48
|
-
match raw.trim().to_ascii_lowercase().as_str() {
|
|
49
|
-
"codex" | "codex_cli" | "codex-cli" => RETIRED_CODEX_ERROR,
|
|
50
|
-
_ => RETIRED_PROVIDER_ERROR,
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
pub(crate) fn require_active_state_providers(
|
|
55
|
-
state: &serde_json::Value,
|
|
56
|
-
target: Option<&str>,
|
|
57
|
-
) -> Result<(), &'static str> {
|
|
58
|
-
let retired = state
|
|
59
|
-
.get("agents")
|
|
60
|
-
.and_then(serde_json::Value::as_object)
|
|
61
|
-
.and_then(|agents| {
|
|
62
|
-
agents.iter().find_map(|(id, row)| {
|
|
63
|
-
row.get("provider")
|
|
64
|
-
.and_then(serde_json::Value::as_str)
|
|
65
|
-
.filter(|provider| {
|
|
66
|
-
target.is_none_or(|target| target == id) && is_retired_provider(provider)
|
|
67
|
-
})
|
|
68
|
-
})
|
|
69
|
-
});
|
|
70
|
-
match retired {
|
|
71
|
-
Some(provider) => Err(retired_provider_error(provider)),
|
|
72
|
-
None => Ok(()),
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/// Canonical snake_case wire string for `Provider`. Used for state JSON,
|
|
77
|
-
/// log fields, and any cross-process serialization. Stable: do not change
|
|
78
|
-
/// existing values.
|
|
79
|
-
pub(crate) fn provider_wire(provider: Provider) -> &'static str {
|
|
80
|
-
match provider {
|
|
81
|
-
Provider::Claude => "claude",
|
|
82
|
-
Provider::ClaudeCode => "claude_code",
|
|
83
|
-
Provider::Codex => "codex",
|
|
84
|
-
Provider::Copilot => "copilot",
|
|
85
|
-
Provider::GeminiCli => "gemini_cli",
|
|
86
|
-
Provider::Grok => "grok",
|
|
87
|
-
Provider::Pi => "pi",
|
|
88
|
-
Provider::Fake => "fake",
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
/// Parse a wire string back to `Provider`. Accepts the canonical
|
|
93
|
-
/// `provider_wire` output AND every historical alias listed by `aliases()`.
|
|
94
|
-
/// Returns `None` for unknown strings.
|
|
95
|
-
pub(crate) fn parse_provider(raw: &str) -> Option<Provider> {
|
|
96
|
-
for &provider in ALL_PROVIDERS {
|
|
97
|
-
for alias in aliases(provider) {
|
|
98
|
-
if *alias == raw {
|
|
99
|
-
return Some(provider);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
None
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
/// Parse only canonical persisted provider wire strings.
|
|
107
|
-
///
|
|
108
|
-
/// Use this for spec/schema surfaces that historically rejected aliases such as
|
|
109
|
-
/// `claude-code`; use [`parse_provider`] when reading state/log fields where
|
|
110
|
-
/// historical aliases must remain accepted.
|
|
111
|
-
pub(crate) fn parse_canonical_provider(raw: &str) -> Option<Provider> {
|
|
112
|
-
all_providers()
|
|
113
|
-
.iter()
|
|
114
|
-
.copied()
|
|
115
|
-
.find(|provider| provider_wire(*provider) == raw)
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
pub(crate) fn all_providers() -> &'static [Provider] {
|
|
119
|
-
ALL_PROVIDERS
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
pub(crate) fn is_claude_family(provider: Provider) -> bool {
|
|
123
|
-
matches!(provider, Provider::Claude | Provider::ClaudeCode)
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
pub(crate) fn requires_resume_backing(provider: Provider) -> bool {
|
|
127
|
-
matches!(
|
|
128
|
-
provider,
|
|
129
|
-
Provider::Codex
|
|
130
|
-
| Provider::Claude
|
|
131
|
-
| Provider::ClaudeCode
|
|
132
|
-
| Provider::Copilot
|
|
133
|
-
| Provider::Grok
|
|
134
|
-
| Provider::Pi
|
|
135
|
-
)
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
/// All aliases (including the canonical wire form) that parse to `provider`.
|
|
140
|
-
/// The canonical wire form is always the first entry, so callers that need
|
|
141
|
-
/// the "primary" string can take `aliases(p)[0]` — though most code should
|
|
142
|
-
/// use `provider_wire(p)` directly for clarity.
|
|
143
|
-
pub(crate) fn aliases(provider: Provider) -> &'static [&'static str] {
|
|
144
|
-
match provider {
|
|
145
|
-
Provider::Claude => &["claude"],
|
|
146
|
-
// `claude-code` (kebab) is a historical alias that appeared in
|
|
147
|
-
// restart/rebuild.rs:1186-1194 only. Keeping it parseable means
|
|
148
|
-
// legacy state files still load.
|
|
149
|
-
Provider::ClaudeCode => &["claude_code", "claude-code"],
|
|
150
|
-
Provider::Codex => &["codex"],
|
|
151
|
-
Provider::Copilot => &["copilot"],
|
|
152
|
-
Provider::GeminiCli => &["gemini_cli"],
|
|
153
|
-
Provider::Grok => &["grok"],
|
|
154
|
-
Provider::Pi => &["pi"],
|
|
155
|
-
Provider::Fake => &["fake"],
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
/// Executable name we exec for the worker. `Claude` and `ClaudeCode` both
|
|
160
|
-
/// resolve to `claude` — the distinction is in state semantics
|
|
161
|
-
/// (`ClaudeCode` is the canonical CLI; `Claude` is a legacy alias kept for
|
|
162
|
-
/// older specs). Spawn this public name. Do not replace it with a
|
|
163
|
-
/// canonicalized deep binary; that skips the user's wrapper.
|
|
164
|
-
pub(crate) fn command_name(provider: Provider) -> &'static str {
|
|
165
|
-
match provider {
|
|
166
|
-
Provider::Claude | Provider::ClaudeCode => "claude",
|
|
167
|
-
Provider::Codex => "codex",
|
|
168
|
-
Provider::Copilot => "copilot",
|
|
169
|
-
Provider::GeminiCli => "gemini",
|
|
170
|
-
Provider::Grok => "grok",
|
|
171
|
-
Provider::Pi => "pi",
|
|
172
|
-
Provider::Fake => "team-agent",
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
const ALL_PROVIDERS: &[Provider] = &[
|
|
177
|
-
Provider::Claude,
|
|
178
|
-
Provider::ClaudeCode,
|
|
179
|
-
Provider::Codex,
|
|
180
|
-
Provider::Copilot,
|
|
181
|
-
Provider::GeminiCli,
|
|
182
|
-
Provider::Grok,
|
|
183
|
-
Provider::Pi,
|
|
184
|
-
Provider::Fake,
|
|
185
|
-
];
|
|
186
|
-
|
|
187
|
-
#[cfg(test)]
|
|
188
|
-
mod tests {
|
|
189
|
-
use super::*;
|
|
190
|
-
|
|
191
|
-
#[test]
|
|
192
|
-
fn provider_wire_round_trip_all_providers() {
|
|
193
|
-
for &p in ALL_PROVIDERS {
|
|
194
|
-
let wire = provider_wire(p);
|
|
195
|
-
assert_eq!(parse_provider(wire), Some(p), "round-trip {p:?}");
|
|
196
|
-
assert_eq!(
|
|
197
|
-
parse_canonical_provider(wire),
|
|
198
|
-
Some(p),
|
|
199
|
-
"canonical parse {p:?}"
|
|
200
|
-
);
|
|
201
|
-
for alias in aliases(p) {
|
|
202
|
-
assert_eq!(parse_provider(alias), Some(p), "alias {alias:?} -> {p:?}");
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
#[test]
|
|
208
|
-
fn claude_code_kebab_alias_parses() {
|
|
209
|
-
// Historical alias preserved from restart/rebuild.rs:1186-1194.
|
|
210
|
-
assert_eq!(parse_provider("claude-code"), Some(Provider::ClaudeCode));
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
#[test]
|
|
214
|
-
fn provider_wire_migrated_sites_compile_without_local_provider_clones() {
|
|
215
|
-
let capture_rs = include_str!("session/capture.rs");
|
|
216
|
-
let restart_selection_rs = include_str!("../lifecycle/restart/selection.rs");
|
|
217
|
-
let model_spec_rs = include_str!("../model/spec.rs");
|
|
218
|
-
let compiler_rs = include_str!("../compiler.rs");
|
|
219
|
-
let delivery_rs = include_str!("../messaging/delivery.rs");
|
|
220
|
-
let rediscover_rs = include_str!("../leader/rediscover.rs");
|
|
221
|
-
let profile_smoke_rs = include_str!("../lifecycle/profile_smoke.rs");
|
|
222
|
-
let diagnose_rs = include_str!("../cli/diagnose.rs");
|
|
223
|
-
|
|
224
|
-
assert!(
|
|
225
|
-
capture_rs.contains("provider::wire") && capture_rs.contains("parse_provider"),
|
|
226
|
-
"session capture must import the canonical provider parser"
|
|
227
|
-
);
|
|
228
|
-
assert!(
|
|
229
|
-
!capture_rs.contains("fn parse_provider("),
|
|
230
|
-
"session capture must not carry a local provider parser copy"
|
|
231
|
-
);
|
|
232
|
-
assert!(
|
|
233
|
-
capture_rs.contains("is_claude_family"),
|
|
234
|
-
"session capture must use typed Claude-family detection"
|
|
235
|
-
);
|
|
236
|
-
assert!(
|
|
237
|
-
restart_selection_rs.contains("parse_canonical_provider")
|
|
238
|
-
&& restart_selection_rs.contains("requires_resume_backing"),
|
|
239
|
-
"restart selection must route resumable backing through typed provider helpers"
|
|
240
|
-
);
|
|
241
|
-
assert!(
|
|
242
|
-
!restart_selection_rs.contains(r#""codex" | "claude" | "claude_code" | "copilot""#),
|
|
243
|
-
"restart selection must not keep a local resumable provider string match"
|
|
244
|
-
);
|
|
245
|
-
assert!(
|
|
246
|
-
!model_spec_rs.contains("SUPPORTED_PROVIDERS"),
|
|
247
|
-
"model spec must not keep a local provider whitelist"
|
|
248
|
-
);
|
|
249
|
-
assert!(
|
|
250
|
-
model_spec_rs.contains("parse_canonical_provider")
|
|
251
|
-
&& model_spec_rs.contains("resolve_for_provider"),
|
|
252
|
-
"model spec must validate providers through typed helpers"
|
|
253
|
-
);
|
|
254
|
-
assert!(
|
|
255
|
-
compiler_rs.contains("parse_canonical_provider"),
|
|
256
|
-
"compiler must validate providers through typed helpers"
|
|
257
|
-
);
|
|
258
|
-
assert!(
|
|
259
|
-
delivery_rs.contains("parse_canonical_provider")
|
|
260
|
-
&& delivery_rs.contains("parse_provider")
|
|
261
|
-
&& delivery_rs.contains("provider_wire"),
|
|
262
|
-
"message delivery provider dispatch must use wire helpers"
|
|
263
|
-
);
|
|
264
|
-
for (path, source) in [
|
|
265
|
-
("leader/rediscover.rs", rediscover_rs),
|
|
266
|
-
("lifecycle/profile_smoke.rs", profile_smoke_rs),
|
|
267
|
-
("cli/diagnose.rs", diagnose_rs),
|
|
268
|
-
] {
|
|
269
|
-
assert!(
|
|
270
|
-
!source.contains("fn provider_wire("),
|
|
271
|
-
"{path} must not carry a local provider_wire clone"
|
|
272
|
-
);
|
|
273
|
-
assert!(
|
|
274
|
-
source.contains("provider::wire"),
|
|
275
|
-
"{path} must import provider wire helpers"
|
|
276
|
-
);
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
#[test]
|
|
281
|
-
fn provider_wire_command_grammar_sites_are_named_helpers_not_provider_parse() {
|
|
282
|
-
let provider_attribution_rs = include_str!("../leader/provider_attribution.rs");
|
|
283
|
-
let worker_window_helpers_rs = include_str!("../layout/worker_window_helpers.rs");
|
|
284
|
-
let runtime_detectors_rs = include_str!("../coordinator/runtime_detectors.rs");
|
|
285
|
-
let emit_rs = include_str!("../cli/emit.rs");
|
|
286
|
-
let messaging_helpers_rs = include_str!("../messaging/helpers.rs");
|
|
287
|
-
|
|
288
|
-
assert!(
|
|
289
|
-
provider_attribution_rs.contains("COMMAND_GRAMMAR_PROVIDER_COMMANDS")
|
|
290
|
-
&& provider_attribution_rs.contains("provider_from_command_text"),
|
|
291
|
-
"leader provider attribution must name command grammar explicitly"
|
|
292
|
-
);
|
|
293
|
-
assert!(
|
|
294
|
-
worker_window_helpers_rs.contains("provider_window_name")
|
|
295
|
-
&& worker_window_helpers_rs.contains("Command/UI grammar"),
|
|
296
|
-
"worker window helpers must keep a named window grammar helper"
|
|
297
|
-
);
|
|
298
|
-
assert!(
|
|
299
|
-
runtime_detectors_rs.contains("runtime_event_provider_name")
|
|
300
|
-
&& runtime_detectors_rs.contains("Event-field grammar"),
|
|
301
|
-
"runtime detectors must name event provider grammar explicitly"
|
|
302
|
-
);
|
|
303
|
-
assert!(
|
|
304
|
-
emit_rs.contains("LEADER_PASSTHROUGH_COMMANDS")
|
|
305
|
-
&& emit_rs.contains("is_leader_passthrough_command"),
|
|
306
|
-
"CLI emit must name passthrough command grammar explicitly"
|
|
307
|
-
);
|
|
308
|
-
assert!(
|
|
309
|
-
messaging_helpers_rs.contains("non_provider_command")
|
|
310
|
-
&& messaging_helpers_rs.contains("Activity command grammar"),
|
|
311
|
-
"messaging helpers must name activity command grammar explicitly"
|
|
312
|
-
);
|
|
313
|
-
for (path, source) in [
|
|
314
|
-
("leader/provider_attribution.rs", provider_attribution_rs),
|
|
315
|
-
("layout/worker_window_helpers.rs", worker_window_helpers_rs),
|
|
316
|
-
("coordinator/runtime_detectors.rs", runtime_detectors_rs),
|
|
317
|
-
("cli/emit.rs", emit_rs),
|
|
318
|
-
("messaging/helpers.rs", messaging_helpers_rs),
|
|
319
|
-
] {
|
|
320
|
-
assert!(
|
|
321
|
-
!source.contains("parse_canonical_provider"),
|
|
322
|
-
"{path} is command/UI grammar and must not reuse provider identity parsing"
|
|
323
|
-
);
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
#[test]
|
|
328
|
-
fn unknown_string_returns_none() {
|
|
329
|
-
assert_eq!(parse_provider(""), None);
|
|
330
|
-
assert_eq!(parse_provider("openai"), None);
|
|
331
|
-
assert_eq!(parse_provider("CLAUDE"), None); // case-sensitive
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
#[test]
|
|
335
|
-
fn retired_state_guard_is_scoped_to_the_addressed_seat() {
|
|
336
|
-
let state = serde_json::json!({"agents": {
|
|
337
|
-
"pi": {"provider": "pi"},
|
|
338
|
-
"claude": {"provider": "claude"},
|
|
339
|
-
"claude_code": {"provider": "claude_code"},
|
|
340
|
-
"copilot": {"provider": "copilot"},
|
|
341
|
-
"retired": {"provider": "cursor_agent"},
|
|
342
|
-
"codex": {"provider": "codex_tui"},
|
|
343
|
-
"grok": {"provider": "grok_build"},
|
|
344
|
-
"legacy_codex": {"provider": "codex"},
|
|
345
|
-
"legacy_codex_cli": {"provider": "codex-cli"},
|
|
346
|
-
"legacy_grok": {"provider": "grok"}
|
|
347
|
-
}});
|
|
348
|
-
assert!(require_active_state_providers(&state, Some("pi")).is_ok());
|
|
349
|
-
assert!(require_active_state_providers(&state, Some("claude")).is_ok());
|
|
350
|
-
assert!(require_active_state_providers(&state, Some("claude_code")).is_ok());
|
|
351
|
-
assert!(require_active_state_providers(&state, Some("copilot")).is_ok());
|
|
352
|
-
assert!(require_active_state_providers(&state, Some("codex")).is_ok());
|
|
353
|
-
assert!(require_active_state_providers(&state, Some("grok")).is_ok());
|
|
354
|
-
assert_eq!(require_active_state_providers(&state, Some("retired")), Err(RETIRED_PROVIDER_ERROR));
|
|
355
|
-
assert_eq!(require_active_state_providers(&state, Some("legacy_codex")), Err(RETIRED_CODEX_ERROR));
|
|
356
|
-
assert_eq!(require_active_state_providers(&state, Some("legacy_codex_cli")), Err(RETIRED_CODEX_ERROR));
|
|
357
|
-
assert!(require_active_state_providers(&state, Some("legacy_grok")).is_ok());
|
|
358
|
-
assert!(!is_retired_provider("grok"));
|
|
359
|
-
assert!(require_active_state_providers(&state, None).is_err());
|
|
360
|
-
for retired in ["cursor_agent", "agent"] {
|
|
361
|
-
assert_eq!(parse_provider(retired), None, "no legacy engine to parse into");
|
|
362
|
-
}
|
|
363
|
-
// The leader keys still parse: a leader is never an `agents` row.
|
|
364
|
-
for leader in ["codex"] {
|
|
365
|
-
assert!(is_retired_provider(leader), "{leader}");
|
|
366
|
-
assert!(parse_provider(leader).is_some(), "{leader}");
|
|
367
|
-
}
|
|
368
|
-
// Claude Code and Pi keep their legacy worker runtimes.
|
|
369
|
-
for legacy in ["claude", "claude_code", "claude-code", "pi"] {
|
|
370
|
-
assert!(!is_retired_provider(legacy), "{legacy}");
|
|
371
|
-
assert!(parse_provider(legacy).is_some(), "{legacy}");
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
#[test]
|
|
376
|
-
fn aliases_first_entry_is_canonical_wire() {
|
|
377
|
-
for &p in ALL_PROVIDERS {
|
|
378
|
-
assert_eq!(aliases(p)[0], provider_wire(p), "canonical first for {p:?}");
|
|
379
|
-
}
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
#[test]
|
|
383
|
-
fn command_name_claude_and_claude_code_both_resolve_to_claude_binary() {
|
|
384
|
-
assert_eq!(command_name(Provider::Claude), "claude");
|
|
385
|
-
assert_eq!(command_name(Provider::ClaudeCode), "claude");
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
#[test]
|
|
389
|
-
fn command_name_covers_every_provider() {
|
|
390
|
-
for &p in ALL_PROVIDERS {
|
|
391
|
-
assert!(!command_name(p).is_empty(), "{p:?} has no command name");
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
}
|
|
@@ -1,259 +0,0 @@
|
|
|
1
|
-
use std::sync::LazyLock;
|
|
2
|
-
|
|
3
|
-
use regex::{Captures, Regex};
|
|
4
|
-
use serde_json::Value;
|
|
5
|
-
|
|
6
|
-
const REDACTED: &str = "[REDACTED]";
|
|
7
|
-
const SENSITIVE_FAMILIES: [&str; 7] = [
|
|
8
|
-
"PROXY",
|
|
9
|
-
"TOKEN",
|
|
10
|
-
"KEY",
|
|
11
|
-
"PASSWORD",
|
|
12
|
-
"AUTH",
|
|
13
|
-
"SECRET",
|
|
14
|
-
"CREDENTIAL",
|
|
15
|
-
];
|
|
16
|
-
const SENSITIVE_KEYS: [&str; 2] = ["authorization_header", "credential_blob"];
|
|
17
|
-
const STRUCTURAL_KEYS: [&str; 13] = [
|
|
18
|
-
"active_team_key",
|
|
19
|
-
"cohort_key",
|
|
20
|
-
"dedupe_key",
|
|
21
|
-
"error_key",
|
|
22
|
-
"error_observation_key",
|
|
23
|
-
"last_check_key",
|
|
24
|
-
"last_error_observation_key",
|
|
25
|
-
"last_notified_key",
|
|
26
|
-
"last_suppressed_key",
|
|
27
|
-
"parent_team_key",
|
|
28
|
-
"runtime_team_key",
|
|
29
|
-
"team_key",
|
|
30
|
-
"team_state_key",
|
|
31
|
-
];
|
|
32
|
-
|
|
33
|
-
static SHELL_ASSIGNMENT: LazyLock<Regex> = LazyLock::new(|| {
|
|
34
|
-
Regex::new(
|
|
35
|
-
r#"(?i)(?P<prefix>^|[\s\[,;('"])(?P<key>[a-z_][a-z0-9_.]*)=(?P<value>'[^']*'|"[^"]*"|[^\s,\]\[};)]+)"#,
|
|
36
|
-
)
|
|
37
|
-
.expect("shell assignment redaction regex")
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
static URL_USERINFO: LazyLock<Regex> = LazyLock::new(|| {
|
|
41
|
-
Regex::new(r"(?P<scheme>[A-Za-z][A-Za-z0-9+.-]*://)[^\s/?#]+@")
|
|
42
|
-
.expect("URL userinfo redaction regex")
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
static BEARER_TOKEN: LazyLock<Regex> = LazyLock::new(|| {
|
|
46
|
-
Regex::new(
|
|
47
|
-
r"(?i)(?P<prefix>\bBearer[ \t]+)(?P<token>[A-Za-z0-9][-A-Za-z0-9._~+/=]{14,}[-A-Za-z0-9._~+/=])",
|
|
48
|
-
)
|
|
49
|
-
.expect("Bearer token redaction regex")
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
pub(crate) fn redact_external_value(value: &serde_json::Value) -> serde_json::Value {
|
|
53
|
-
match value {
|
|
54
|
-
Value::Object(object) => Value::Object(
|
|
55
|
-
object
|
|
56
|
-
.iter()
|
|
57
|
-
.map(|(key, value)| {
|
|
58
|
-
let value = if key.eq_ignore_ascii_case("auth")
|
|
59
|
-
&& value.as_str() == Some("unknown")
|
|
60
|
-
{
|
|
61
|
-
value.clone()
|
|
62
|
-
} else if is_sensitive_env_key(key) {
|
|
63
|
-
Value::String(REDACTED.to_string())
|
|
64
|
-
} else if is_argument_array_key(key) {
|
|
65
|
-
redact_argument_array(value)
|
|
66
|
-
} else {
|
|
67
|
-
redact_external_value(value)
|
|
68
|
-
};
|
|
69
|
-
(key.clone(), value)
|
|
70
|
-
})
|
|
71
|
-
.collect(),
|
|
72
|
-
),
|
|
73
|
-
Value::Array(values) => Value::Array(values.iter().map(redact_external_value).collect()),
|
|
74
|
-
Value::String(text) => Value::String(redact_external_text(text)),
|
|
75
|
-
other => other.clone(),
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
fn is_argument_array_key(key: &str) -> bool {
|
|
80
|
-
key.eq_ignore_ascii_case("argv") || key.eq_ignore_ascii_case("command")
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
fn redact_argument_array(value: &Value) -> Value {
|
|
84
|
-
let Value::Array(values) = value else {
|
|
85
|
-
return redact_external_value(value);
|
|
86
|
-
};
|
|
87
|
-
let mut redact_next = false;
|
|
88
|
-
Value::Array(
|
|
89
|
-
values
|
|
90
|
-
.iter()
|
|
91
|
-
.map(|value| {
|
|
92
|
-
if redact_next {
|
|
93
|
-
redact_next = false;
|
|
94
|
-
return Value::String(REDACTED.to_string());
|
|
95
|
-
}
|
|
96
|
-
if let Some(flag) = value.as_str().filter(|flag| flag.starts_with('-')) {
|
|
97
|
-
let normalized = flag.trim_start_matches('-').replace('-', "_");
|
|
98
|
-
redact_next = is_sensitive_env_key(&normalized);
|
|
99
|
-
}
|
|
100
|
-
redact_external_value(value)
|
|
101
|
-
})
|
|
102
|
-
.collect(),
|
|
103
|
-
)
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
pub(crate) fn redact_external_text(text: &str) -> String {
|
|
107
|
-
let assignments = SHELL_ASSIGNMENT.replace_all(text, |captures: &Captures<'_>| {
|
|
108
|
-
let key = captures.name("key").map_or("", |value| value.as_str());
|
|
109
|
-
if !is_sensitive_env_key(key) {
|
|
110
|
-
return captures[0].to_string();
|
|
111
|
-
}
|
|
112
|
-
let prefix = captures.name("prefix").map_or("", |value| value.as_str());
|
|
113
|
-
let value = captures.name("value").map_or("", |value| value.as_str());
|
|
114
|
-
let quote = match (value.as_bytes().first(), value.as_bytes().last()) {
|
|
115
|
-
(Some(b'\''), Some(b'\'')) => "'",
|
|
116
|
-
(Some(b'"'), Some(b'"')) => "\"",
|
|
117
|
-
_ => "",
|
|
118
|
-
};
|
|
119
|
-
let unquoted = value
|
|
120
|
-
.strip_prefix(quote)
|
|
121
|
-
.and_then(|value| value.strip_suffix(quote))
|
|
122
|
-
.unwrap_or(value);
|
|
123
|
-
let has_url_userinfo = URL_USERINFO.is_match(unquoted);
|
|
124
|
-
let redacted_url = URL_USERINFO
|
|
125
|
-
.replace_all(unquoted, "${scheme}[REDACTED]@")
|
|
126
|
-
.into_owned();
|
|
127
|
-
let safe_value = if has_url_userinfo {
|
|
128
|
-
&redacted_url
|
|
129
|
-
} else {
|
|
130
|
-
REDACTED
|
|
131
|
-
};
|
|
132
|
-
format!("{prefix}{key}={quote}{safe_value}{quote}")
|
|
133
|
-
});
|
|
134
|
-
let urls = URL_USERINFO
|
|
135
|
-
.replace_all(&assignments, "${scheme}[REDACTED]@")
|
|
136
|
-
.into_owned();
|
|
137
|
-
BEARER_TOKEN
|
|
138
|
-
.replace_all(&urls, "${prefix}[REDACTED]")
|
|
139
|
-
.into_owned()
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
fn is_sensitive_env_key(key: &str) -> bool {
|
|
143
|
-
let key = key.rsplit('.').next().unwrap_or(key);
|
|
144
|
-
if STRUCTURAL_KEYS
|
|
145
|
-
.iter()
|
|
146
|
-
.any(|structural| key.eq_ignore_ascii_case(structural))
|
|
147
|
-
{
|
|
148
|
-
return false;
|
|
149
|
-
}
|
|
150
|
-
if SENSITIVE_KEYS
|
|
151
|
-
.iter()
|
|
152
|
-
.any(|sensitive| key.eq_ignore_ascii_case(sensitive))
|
|
153
|
-
{
|
|
154
|
-
return true;
|
|
155
|
-
}
|
|
156
|
-
let key = key.to_ascii_uppercase();
|
|
157
|
-
SENSITIVE_FAMILIES
|
|
158
|
-
.iter()
|
|
159
|
-
.any(|family| key == *family || key.ends_with(&format!("_{family}")))
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
#[cfg(test)]
|
|
163
|
-
mod tests {
|
|
164
|
-
use super::*;
|
|
165
|
-
use serde_json::json;
|
|
166
|
-
|
|
167
|
-
#[test]
|
|
168
|
-
fn recursive_values_mask_env_families_without_erasing_wire_truth() {
|
|
169
|
-
let input = json!({
|
|
170
|
-
"HTTPS_PROXY": "proxy-secret",
|
|
171
|
-
"Copilot_Github_Token": "token-secret",
|
|
172
|
-
"nested": [{"db_password": "password-secret"}],
|
|
173
|
-
"team_key": "current",
|
|
174
|
-
"active_team_key": "current",
|
|
175
|
-
"dedupe_key": "restart:worker",
|
|
176
|
-
"auth_mode": "subscription",
|
|
177
|
-
"model_source": "role",
|
|
178
|
-
"model_stale": true,
|
|
179
|
-
});
|
|
180
|
-
|
|
181
|
-
let redacted = redact_external_value(&input);
|
|
182
|
-
|
|
183
|
-
assert_eq!(redacted["HTTPS_PROXY"], REDACTED);
|
|
184
|
-
assert_eq!(redacted["Copilot_Github_Token"], REDACTED);
|
|
185
|
-
assert_eq!(redacted["nested"][0]["db_password"], REDACTED);
|
|
186
|
-
assert_eq!(redacted["team_key"], "current");
|
|
187
|
-
assert_eq!(redacted["active_team_key"], "current");
|
|
188
|
-
assert_eq!(redacted["dedupe_key"], "restart:worker");
|
|
189
|
-
assert_eq!(redacted["auth_mode"], "subscription");
|
|
190
|
-
assert_eq!(redacted["model_source"], "role");
|
|
191
|
-
assert_eq!(redacted["model_stale"], true);
|
|
192
|
-
assert_eq!(redact_external_value(&redacted), redacted);
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
#[test]
|
|
196
|
-
fn text_masks_quoted_assignments_and_url_userinfo_idempotently() {
|
|
197
|
-
let input = "HTTPS_PROXY='https://user:pass@proxy.invalid:8443/path' http_proxy=other endpoint=https://user:pass@proxy.invalid:8443/path";
|
|
198
|
-
let expected = "HTTPS_PROXY='https://[REDACTED]@proxy.invalid:8443/path' http_proxy=[REDACTED] endpoint=https://[REDACTED]@proxy.invalid:8443/path";
|
|
199
|
-
|
|
200
|
-
let redacted = redact_external_text(input);
|
|
201
|
-
|
|
202
|
-
assert_eq!(redacted, expected);
|
|
203
|
-
assert_eq!(redact_external_text(&redacted), redacted);
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
#[test]
|
|
207
|
-
fn text_leaves_non_env_assignments_and_plain_urls_unchanged() {
|
|
208
|
-
let input = "team_key=current author=operator endpoint=https://proxy.invalid/health";
|
|
209
|
-
assert_eq!(redact_external_text(input), input);
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
#[test]
|
|
213
|
-
fn mixed_external_value_is_idempotent() {
|
|
214
|
-
let marker = "synthetic-redaction-unit-marker";
|
|
215
|
-
let credential_url = format!("https://demo-user:{marker}@proxy.invalid:8443/path");
|
|
216
|
-
let diagnostic = format!(
|
|
217
|
-
"subprocess exited 37: argv=[tmux, HTTPS_PROXY='{credential_url}']; endpoint={credential_url}"
|
|
218
|
-
);
|
|
219
|
-
let input = json!({
|
|
220
|
-
"HTTPS_PROXY": marker,
|
|
221
|
-
"ordinary_diagnostic": format!(
|
|
222
|
-
"HTTPS_PROXY='{credential_url}' http_proxy=\"{credential_url}\" OPENAI_API_KEY={marker} endpoint={credential_url}"
|
|
223
|
-
),
|
|
224
|
-
"nested": [[diagnostic, credential_url]],
|
|
225
|
-
"team_key": "current",
|
|
226
|
-
});
|
|
227
|
-
|
|
228
|
-
let once = redact_external_value(&input);
|
|
229
|
-
let twice = redact_external_value(&once);
|
|
230
|
-
let text = once.to_string();
|
|
231
|
-
|
|
232
|
-
assert!(!text.contains(marker));
|
|
233
|
-
assert!(text.contains("https://[REDACTED]@proxy.invalid:8443/path"));
|
|
234
|
-
assert_eq!(twice, once);
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
#[test]
|
|
238
|
-
fn event_log_shapes_are_masked_without_hiding_structural_arguments() {
|
|
239
|
-
let marker = "synthetic-event-log-marker";
|
|
240
|
-
let input = json!({
|
|
241
|
-
"authorization_header": format!("Bearer {marker}"),
|
|
242
|
-
"credential_blob": marker,
|
|
243
|
-
"config": format!("mcp_servers.demo.env.OPENAI_API_KEY=\"{marker}\""),
|
|
244
|
-
"argv": ["provider", "--api-key", marker, "--team-key", "current"],
|
|
245
|
-
"command": ["provider", "--authorization-header", marker, "--auth-mode", "subscription"],
|
|
246
|
-
});
|
|
247
|
-
|
|
248
|
-
let redacted = redact_external_value(&input);
|
|
249
|
-
|
|
250
|
-
assert!(!redacted.to_string().contains(marker));
|
|
251
|
-
assert_eq!(redacted["authorization_header"], REDACTED);
|
|
252
|
-
assert_eq!(redacted["credential_blob"], REDACTED);
|
|
253
|
-
assert_eq!(redacted["argv"][2], REDACTED);
|
|
254
|
-
assert_eq!(redacted["argv"][4], "current");
|
|
255
|
-
assert_eq!(redacted["command"][2], REDACTED);
|
|
256
|
-
assert_eq!(redacted["command"][4], "subscription");
|
|
257
|
-
assert_eq!(redact_external_value(&redacted), redacted);
|
|
258
|
-
}
|
|
259
|
-
}
|