@team-agent/installer 0.5.128 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +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,348 +0,0 @@
|
|
|
1
|
-
#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
|
|
2
|
-
|
|
3
|
-
use super::*;
|
|
4
|
-
use crate::model::enums::Provider;
|
|
5
|
-
use crate::transport::{PaneId, SessionName};
|
|
6
|
-
use serde_json::json;
|
|
7
|
-
use std::collections::BTreeMap;
|
|
8
|
-
use std::os::unix::fs::PermissionsExt;
|
|
9
|
-
|
|
10
|
-
struct Case {
|
|
11
|
-
ws: PathBuf,
|
|
12
|
-
state: Value,
|
|
13
|
-
target: Target,
|
|
14
|
-
panes: Vec<PaneInfo>,
|
|
15
|
-
started: DateTime<Utc>,
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
impl Case {
|
|
19
|
-
fn new() -> Self {
|
|
20
|
-
let ws = std::env::temp_dir().join(format!(
|
|
21
|
-
"ta-mcp-handshake-{}-{}",
|
|
22
|
-
std::process::id(),
|
|
23
|
-
crate::provider::adapter::next_session_token()
|
|
24
|
-
));
|
|
25
|
-
std::fs::create_dir(&ws).unwrap();
|
|
26
|
-
let ws = ws.canonicalize().unwrap();
|
|
27
|
-
let config = ws.join(".team/runtime/mcp/worker.json");
|
|
28
|
-
std::fs::create_dir_all(config.parent().unwrap()).unwrap();
|
|
29
|
-
let executable = std::env::current_exe().unwrap().canonicalize().unwrap();
|
|
30
|
-
std::fs::write(&config, serde_json::to_vec(&json!({
|
|
31
|
-
"mcpServers": {"team_orchestrator": {
|
|
32
|
-
"command": executable,
|
|
33
|
-
"env": {"TEAM_AGENT_WORKSPACE": ws, "TEAM_AGENT_ID": "worker", "TEAM_AGENT_OWNER_TEAM_ID": "owner"}
|
|
34
|
-
}}
|
|
35
|
-
})).unwrap()).unwrap();
|
|
36
|
-
// Existing managed configurations are 0644, unlike private receipts.
|
|
37
|
-
std::fs::set_permissions(&config, std::fs::Permissions::from_mode(0o644)).unwrap();
|
|
38
|
-
let carrier = crate::platform::process::current_parent_pid().unwrap();
|
|
39
|
-
assert!(carrier > 1);
|
|
40
|
-
let started = Utc::now();
|
|
41
|
-
let state = json!({"agents": {"worker": {
|
|
42
|
-
"provider": "copilot", "mcp_config": config,
|
|
43
|
-
"spawned_at": (started - chrono::Duration::seconds(10)).to_rfc3339(),
|
|
44
|
-
"pane_id": "%1", "pane_pid": carrier
|
|
45
|
-
}}});
|
|
46
|
-
let panes = vec![PaneInfo {
|
|
47
|
-
pane_id: PaneId::new("%1"),
|
|
48
|
-
session: SessionName::new("owned"),
|
|
49
|
-
window_index: None,
|
|
50
|
-
window_name: None,
|
|
51
|
-
pane_index: None,
|
|
52
|
-
tty: None,
|
|
53
|
-
current_command: None,
|
|
54
|
-
current_path: None,
|
|
55
|
-
active: true,
|
|
56
|
-
pane_pid: Some(carrier),
|
|
57
|
-
leader_env: BTreeMap::new(),
|
|
58
|
-
}];
|
|
59
|
-
Self {
|
|
60
|
-
ws,
|
|
61
|
-
state,
|
|
62
|
-
target: Target::Pane(PaneId::new("%1")),
|
|
63
|
-
panes,
|
|
64
|
-
started,
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
fn path(&self) -> PathBuf {
|
|
69
|
-
self.ws.join(".team/runtime/mcp-handshakes").join(format!(
|
|
70
|
-
"{}.{}.json",
|
|
71
|
-
key("owner", "worker"),
|
|
72
|
-
std::process::id()
|
|
73
|
-
))
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
fn publish(&self) {
|
|
77
|
-
let outcome = publish(&self.ws, "owner", "worker", self.started);
|
|
78
|
-
if outcome.is_err() {
|
|
79
|
-
for event in crate::event_log::EventLog::new(&self.ws).tail(0).unwrap() {
|
|
80
|
-
if event["event"] == "mcp.handshake_evidence_failed" {
|
|
81
|
-
eprintln!("CONTROLLED_MCP_HANDSHAKE_FAILURE {event}");
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
outcome.unwrap();
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
fn admission(&self) -> Result<Option<Admission>> {
|
|
89
|
-
preflight(&self.ws, Some("owner"), "worker", &self.state)
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
impl Drop for Case {
|
|
94
|
-
fn drop(&mut self) {
|
|
95
|
-
let _ = std::fs::remove_dir_all(&self.ws);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
#[test]
|
|
100
|
-
fn issue345_missing_mcp_config_does_not_disable_eager_admission() {
|
|
101
|
-
for provider in ["copilot"] {
|
|
102
|
-
let mut case = Case::new();
|
|
103
|
-
case.state["agents"]["worker"]["provider"] = json!(provider);
|
|
104
|
-
case.state["agents"]["worker"]
|
|
105
|
-
.as_object_mut()
|
|
106
|
-
.unwrap()
|
|
107
|
-
.remove("mcp_config");
|
|
108
|
-
assert!(
|
|
109
|
-
case.admission().is_err(),
|
|
110
|
-
"missing config cannot disable {provider} admission"
|
|
111
|
-
);
|
|
112
|
-
for value in [Value::Null, json!(false), json!(""), json!(" ")] {
|
|
113
|
-
case.state["agents"]["worker"]["mcp_config"] = value;
|
|
114
|
-
assert!(
|
|
115
|
-
case.admission().is_err(),
|
|
116
|
-
"invalid config cannot disable {provider} admission"
|
|
117
|
-
);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
#[test]
|
|
123
|
-
fn missing_handshake_is_unready_then_a_live_scoped_receipt_is_recognized() {
|
|
124
|
-
let case = Case::new();
|
|
125
|
-
assert!(case.admission().is_err());
|
|
126
|
-
case.publish();
|
|
127
|
-
let admission = case
|
|
128
|
-
.admission()
|
|
129
|
-
.unwrap()
|
|
130
|
-
.expect("eager client must require a receipt");
|
|
131
|
-
revalidate(&admission, &case.target, &case.panes).unwrap();
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
#[test]
|
|
135
|
-
#[ignore = "subprocess helper for PID-isolated publication"]
|
|
136
|
-
fn issue372_child_publisher() {
|
|
137
|
-
let ws = PathBuf::from(std::env::var_os("ISSUE372_WORKSPACE").unwrap());
|
|
138
|
-
publish(&ws, "owner", "worker", Utc::now()).unwrap();
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
#[test]
|
|
142
|
-
fn issue372_child_publication_and_exit_cannot_clobber_live_server() {
|
|
143
|
-
let case = Case::new();
|
|
144
|
-
case.publish();
|
|
145
|
-
let original = std::fs::read(case.path()).unwrap();
|
|
146
|
-
let mut child = std::process::Command::new(std::env::current_exe().unwrap())
|
|
147
|
-
.args([
|
|
148
|
-
"--ignored",
|
|
149
|
-
"--exact",
|
|
150
|
-
"mcp_server::readiness::tests::issue372_child_publisher",
|
|
151
|
-
])
|
|
152
|
-
.env("ISSUE372_WORKSPACE", &case.ws)
|
|
153
|
-
.spawn()
|
|
154
|
-
.unwrap();
|
|
155
|
-
let child_path = case.path().parent().unwrap().join(format!(
|
|
156
|
-
"{}.{}.json",
|
|
157
|
-
key("owner", "worker"),
|
|
158
|
-
child.id()
|
|
159
|
-
));
|
|
160
|
-
assert!(child.wait().unwrap().success());
|
|
161
|
-
assert!(
|
|
162
|
-
child_path.is_file(),
|
|
163
|
-
"child must really publish its own receipt"
|
|
164
|
-
);
|
|
165
|
-
assert_eq!(std::fs::read(case.path()).unwrap(), original);
|
|
166
|
-
assert_eq!(
|
|
167
|
-
case.admission().unwrap().unwrap().server.identity.pid,
|
|
168
|
-
std::process::id()
|
|
169
|
-
);
|
|
170
|
-
// A dead foreign writer in the old shared slot cannot hide the live receipt either.
|
|
171
|
-
let legacy = case
|
|
172
|
-
.path()
|
|
173
|
-
.parent()
|
|
174
|
-
.unwrap()
|
|
175
|
-
.join(format!("{}.json", key("owner", "worker")));
|
|
176
|
-
std::fs::copy(&child_path, &legacy).unwrap();
|
|
177
|
-
assert!(case.admission().unwrap().is_some());
|
|
178
|
-
std::fs::write(child_path, b"{broken").unwrap();
|
|
179
|
-
std::fs::write(legacy, b"{broken").unwrap();
|
|
180
|
-
assert!(case.admission().unwrap().is_some());
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
#[test]
|
|
184
|
-
fn issue372_live_legacy_receipt_is_still_recognized() {
|
|
185
|
-
let case = Case::new();
|
|
186
|
-
case.publish();
|
|
187
|
-
let legacy = case
|
|
188
|
-
.path()
|
|
189
|
-
.parent()
|
|
190
|
-
.unwrap()
|
|
191
|
-
.join(format!("{}.json", key("owner", "worker")));
|
|
192
|
-
std::fs::rename(case.path(), &legacy).unwrap();
|
|
193
|
-
assert!(case.admission().unwrap().is_some());
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
#[test]
|
|
197
|
-
fn receipt_cannot_cross_workspace_owner_or_seat() {
|
|
198
|
-
let case = Case::new();
|
|
199
|
-
case.publish();
|
|
200
|
-
assert!(preflight(&case.ws, None, "worker", &case.state).is_err());
|
|
201
|
-
assert!(preflight(&case.ws, Some("other"), "worker", &case.state).is_err());
|
|
202
|
-
let original = std::fs::read(case.path()).unwrap();
|
|
203
|
-
for field in ["workspace", "owner", "agent"] {
|
|
204
|
-
let mut value: Value = serde_json::from_slice(&original).unwrap();
|
|
205
|
-
value[field] = json!("foreign");
|
|
206
|
-
std::fs::write(case.path(), serde_json::to_vec(&value).unwrap()).unwrap();
|
|
207
|
-
assert!(case.admission().is_err(), "foreign {field} cannot admit");
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
#[test]
|
|
212
|
-
fn malformed_stale_birth_ancestry_and_image_receipts_refuse() {
|
|
213
|
-
let case = Case::new();
|
|
214
|
-
case.publish();
|
|
215
|
-
let original: Value = serde_json::from_slice(&std::fs::read(case.path()).unwrap()).unwrap();
|
|
216
|
-
let mut changed = Vec::new();
|
|
217
|
-
let mut v = original.clone();
|
|
218
|
-
v["schema"] = json!(2);
|
|
219
|
-
changed.push(v);
|
|
220
|
-
let mut v = original.clone();
|
|
221
|
-
v["server"]["identity"]["birth_identity"] = json!("wrong-birth");
|
|
222
|
-
changed.push(v);
|
|
223
|
-
let mut v = original.clone();
|
|
224
|
-
v["server"]["identity"]["executable"] = json!("/not-authorized");
|
|
225
|
-
changed.push(v);
|
|
226
|
-
let mut v = original.clone();
|
|
227
|
-
v["server"]["image"]["inode"] = json!(0);
|
|
228
|
-
changed.push(v);
|
|
229
|
-
let mut v = original.clone();
|
|
230
|
-
v["ancestors"][0]["birth"] = json!("reused-parent");
|
|
231
|
-
changed.push(v);
|
|
232
|
-
let mut v = original.clone();
|
|
233
|
-
v["server"]["parent"] = json!(1);
|
|
234
|
-
changed.push(v);
|
|
235
|
-
let mut v = original.clone();
|
|
236
|
-
v["started_at"] = json!("2000-01-01T00:00:00Z");
|
|
237
|
-
changed.push(v);
|
|
238
|
-
for value in changed {
|
|
239
|
-
std::fs::write(case.path(), serde_json::to_vec(&value).unwrap()).unwrap();
|
|
240
|
-
assert!(case.admission().is_err());
|
|
241
|
-
}
|
|
242
|
-
std::fs::write(case.path(), b"{incomplete").unwrap();
|
|
243
|
-
assert!(case.admission().is_err());
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
#[test]
|
|
247
|
-
fn changed_current_target_and_new_spawn_do_not_reuse_a_handshake() {
|
|
248
|
-
let mut case = Case::new();
|
|
249
|
-
case.publish();
|
|
250
|
-
let admission = case.admission().unwrap().unwrap();
|
|
251
|
-
let mut other = case.panes.clone();
|
|
252
|
-
other[0].pane_pid = Some(std::process::id());
|
|
253
|
-
assert!(revalidate(&admission, &case.target, &other).is_err());
|
|
254
|
-
assert!(revalidate(&admission, &Target::Pane(PaneId::new("%2")), &case.panes).is_err());
|
|
255
|
-
case.state["agents"]["worker"]["spawned_at"] =
|
|
256
|
-
json!((Utc::now() + chrono::Duration::seconds(1)).to_rfc3339());
|
|
257
|
-
assert!(case.admission().is_err());
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
#[test]
|
|
261
|
-
fn older_helper_cannot_overwrite_a_newer_handshake() {
|
|
262
|
-
let case = Case::new();
|
|
263
|
-
case.publish();
|
|
264
|
-
let original = std::fs::read(case.path()).unwrap();
|
|
265
|
-
publish(
|
|
266
|
-
&case.ws,
|
|
267
|
-
"owner",
|
|
268
|
-
"worker",
|
|
269
|
-
case.started - chrono::Duration::seconds(1),
|
|
270
|
-
)
|
|
271
|
-
.unwrap();
|
|
272
|
-
assert_eq!(std::fs::read(case.path()).unwrap(), original);
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
#[test]
|
|
276
|
-
fn issue372_reused_pid_can_replace_an_older_process_receipt() {
|
|
277
|
-
let case = Case::new();
|
|
278
|
-
case.publish();
|
|
279
|
-
let mut receipt = read_json(&case.path(), true).unwrap();
|
|
280
|
-
receipt["server"]["identity"]["birth_identity"] = json!("previous-process");
|
|
281
|
-
receipt["started_at"] = json!((Utc::now() + chrono::Duration::hours(1)).to_rfc3339());
|
|
282
|
-
std::fs::write(case.path(), serde_json::to_vec(&receipt).unwrap()).unwrap();
|
|
283
|
-
case.publish();
|
|
284
|
-
assert!(case.admission().unwrap().is_some());
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
#[test]
|
|
288
|
-
fn symlink_and_writable_evidence_are_not_adopted_or_overwritten() {
|
|
289
|
-
let case = Case::new();
|
|
290
|
-
case.publish();
|
|
291
|
-
std::fs::set_permissions(case.path(), std::fs::Permissions::from_mode(0o666)).unwrap();
|
|
292
|
-
assert!(case.admission().is_err());
|
|
293
|
-
std::fs::remove_file(case.path()).unwrap();
|
|
294
|
-
let outside = case.ws.join("outside");
|
|
295
|
-
std::fs::write(&outside, b"untouched").unwrap();
|
|
296
|
-
std::os::unix::fs::symlink(&outside, case.path()).unwrap();
|
|
297
|
-
assert!(case.admission().is_err());
|
|
298
|
-
assert!(publish(&case.ws, "owner", "worker", case.started).is_err());
|
|
299
|
-
assert_eq!(std::fs::read(outside).unwrap(), b"untouched");
|
|
300
|
-
assert!(std::fs::symlink_metadata(case.path())
|
|
301
|
-
.unwrap()
|
|
302
|
-
.file_type()
|
|
303
|
-
.is_symlink());
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
#[test]
|
|
307
|
-
fn config_scope_and_authorized_executable_cannot_be_substituted() {
|
|
308
|
-
let case = Case::new();
|
|
309
|
-
case.publish();
|
|
310
|
-
let path = case.ws.join(".team/runtime/mcp/worker.json");
|
|
311
|
-
let original: Value = serde_json::from_slice(&std::fs::read(&path).unwrap()).unwrap();
|
|
312
|
-
for field in [
|
|
313
|
-
"TEAM_AGENT_ID",
|
|
314
|
-
"TEAM_AGENT_OWNER_TEAM_ID",
|
|
315
|
-
"TEAM_AGENT_WORKSPACE",
|
|
316
|
-
] {
|
|
317
|
-
let mut value = original.clone();
|
|
318
|
-
value["mcpServers"]["team_orchestrator"]["env"][field] = json!("foreign");
|
|
319
|
-
std::fs::write(&path, serde_json::to_vec(&value).unwrap()).unwrap();
|
|
320
|
-
assert!(case.admission().is_err());
|
|
321
|
-
}
|
|
322
|
-
let mut value = original;
|
|
323
|
-
value["mcpServers"]["team_orchestrator"]["command"] = json!("/bin/sh");
|
|
324
|
-
std::fs::write(&path, serde_json::to_vec(&value).unwrap()).unwrap();
|
|
325
|
-
assert!(case.admission().is_err());
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
#[test]
|
|
329
|
-
fn fake_and_pi_keep_their_existing_non_eager_or_runtime_registry_admission() {
|
|
330
|
-
assert!(!crate::provider::get_adapter(Provider::Fake).requires_worker_mcp_handshake());
|
|
331
|
-
assert!(!crate::provider::get_adapter(Provider::Pi).requires_worker_mcp_handshake());
|
|
332
|
-
assert!(crate::provider::get_adapter(Provider::Copilot).requires_worker_mcp_handshake());
|
|
333
|
-
let case = Case::new();
|
|
334
|
-
for provider in ["fake", "pi"] {
|
|
335
|
-
let mut state = case.state.clone();
|
|
336
|
-
state["agents"]["worker"]["provider"] = json!(provider);
|
|
337
|
-
assert!(preflight(&case.ws, Some("owner"), "worker", &state)
|
|
338
|
-
.unwrap()
|
|
339
|
-
.is_none());
|
|
340
|
-
state["agents"]["worker"]
|
|
341
|
-
.as_object_mut()
|
|
342
|
-
.unwrap()
|
|
343
|
-
.remove("mcp_config");
|
|
344
|
-
assert!(preflight(&case.ws, Some("owner"), "worker", &state)
|
|
345
|
-
.unwrap()
|
|
346
|
-
.is_none());
|
|
347
|
-
}
|
|
348
|
-
}
|
|
@@ -1,285 +0,0 @@
|
|
|
1
|
-
#[test]
|
|
2
|
-
fn compact_ok_whitelist_is_exact_23_key_golden_set_and_order() {
|
|
3
|
-
let r = json!({
|
|
4
|
-
"ok": true, "status": "accepted", "message_id": "m1", "to": "alice",
|
|
5
|
-
"targets": ["a", "b"], "delivered_count": 2, "failed_count": 1, "submitted": true,
|
|
6
|
-
"visible": true, "queued": 3, "durably_stored": true, "result_id": "r1",
|
|
7
|
-
"task_id": "t1", "agent_id": "ag1", "new_agent_id": "ag2", "source_agent_id": "ag3",
|
|
8
|
-
"role_file_sha": "sha", "session_id": "s1", "leader_notified": true,
|
|
9
|
-
"notification_message_id": "nm", "notification_status": "sent",
|
|
10
|
-
"notification_channel": "ch", "notification_event_id": "ev",
|
|
11
|
-
// non-whitelist (golden DROPS these — Rust currently INVENTS the first three):
|
|
12
|
-
"delivery_pending": true, "poll_via": "x", "state_file": "/p", "secret": "z"
|
|
13
|
-
});
|
|
14
|
-
let v = serde_json::to_value(compact_tool_result(&r).expect("ok compaction")).unwrap();
|
|
15
|
-
assert_eq!(keys(&v), vec![
|
|
16
|
-
"ok", "status", "message_id", "to", "targets", "delivered_count", "failed_count",
|
|
17
|
-
"submitted", "visible", "queued", "durably_stored", "result_id", "task_id",
|
|
18
|
-
"agent_id", "new_agent_id", "source_agent_id", "role_file_sha", "session_id",
|
|
19
|
-
"leader_notified", "notification_message_id", "notification_status",
|
|
20
|
-
"notification_channel", "notification_event_id",
|
|
21
|
-
]);
|
|
22
|
-
// The invented Rust keys must NOT appear (golden has no such whitelist entries).
|
|
23
|
-
assert!(v.get("delivery_pending").is_none(), "delivery_pending not in golden ok-whitelist");
|
|
24
|
-
assert!(v.get("poll_via").is_none(), "poll_via not in golden ok-whitelist");
|
|
25
|
-
assert!(v.get("state_file").is_none(), "state_file not in golden ok-whitelist");
|
|
26
|
-
// golden drops everything but ok/status when only the invented keys are present:
|
|
27
|
-
let only_extra = json!({"ok": true, "status": "accepted",
|
|
28
|
-
"delivery_pending": true, "poll_via": "x", "state_file": "/p"});
|
|
29
|
-
let v2 = serde_json::to_value(compact_tool_result(&only_extra).unwrap()).unwrap();
|
|
30
|
-
assert_eq!(s(&v2), r#"{"ok":true,"status":"accepted"}"#);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// ── #30/#43/#50 compact error-whitelist: EXACT 16-key golden list + order ───
|
|
34
|
-
// GOLDEN (probe_mcp_red.py ERR-FULL-KEYS): normalize.py:8-25 order, all 16 kept.
|
|
35
|
-
#[test]
|
|
36
|
-
fn compact_error_whitelist_is_exact_16_key_golden_set_and_order() {
|
|
37
|
-
let r = json!({
|
|
38
|
-
"ok": false, "status": "failed", "reason": "boom", "error": "boom detail",
|
|
39
|
-
"message_id": "m1", "agent_id": "ag1", "new_agent_id": "ag2", "source_agent_id": "ag3",
|
|
40
|
-
"role_file_sha": "sha", "session_id": "s1", "to": "alice", "targets": ["a"],
|
|
41
|
-
"delivered_count": 0, "failed_count": 2, "fallback_path": "/fb", "suggestion": "try x",
|
|
42
|
-
// not in error-whitelist → dropped:
|
|
43
|
-
"result_id": "r1", "extra": "drop"
|
|
44
|
-
});
|
|
45
|
-
let v = serde_json::to_value(compact_tool_result(&r).expect("error compaction")).unwrap();
|
|
46
|
-
assert_eq!(keys(&v), vec![
|
|
47
|
-
"ok", "status", "reason", "error", "message_id", "agent_id", "new_agent_id",
|
|
48
|
-
"source_agent_id", "role_file_sha", "session_id", "to", "targets",
|
|
49
|
-
"delivered_count", "failed_count", "fallback_path", "suggestion",
|
|
50
|
-
]);
|
|
51
|
-
assert!(v.get("result_id").is_none(), "result_id not in golden error-whitelist");
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
// ── #52 acknowledged_count is OK-PATH ONLY (normalize.py:62 inside else) ────
|
|
55
|
-
// GOLDEN (probe_mcp_red.py ACK-ON-ERR): an ok:false result with acknowledged_messages
|
|
56
|
-
// → {"ok":false,"status":"x"} (NO acknowledged_count). Rust adds it unconditionally.
|
|
57
|
-
#[test]
|
|
58
|
-
fn compact_acknowledged_count_not_added_on_error_path() {
|
|
59
|
-
let r = json!({"ok": false, "status": "x", "acknowledged_messages": ["a", "b"]});
|
|
60
|
-
let v = serde_json::to_value(compact_tool_result(&r).expect("error compaction")).unwrap();
|
|
61
|
-
assert!(v.get("acknowledged_count").is_none(),
|
|
62
|
-
"acknowledged_count is added only on the ok branch (normalize.py:62)");
|
|
63
|
-
assert_eq!(s(&v), r#"{"ok":false,"status":"x"}"#);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// ── #34/#45/#58 normalize_change_kind: golden alias map + keyword set ───────
|
|
67
|
-
// GOLDEN (probe_mcp_red.py CK ...): verified/verify→modified (NOT observed!);
|
|
68
|
-
// inspected/inspect/observe→observed; edited/edit→modified; desc 'inspected'→observed.
|
|
69
|
-
#[test]
|
|
70
|
-
fn change_kind_golden_alias_and_keyword_set() {
|
|
71
|
-
// verified/verify are NOT in the golden alias map → fall to keyword inference.
|
|
72
|
-
// With empty desc, keyword scan finds no match → Modified (golden), NOT Observed.
|
|
73
|
-
assert_eq!(normalize_change_kind(Some("verified"), ""), ChangeKind::Modified);
|
|
74
|
-
assert_eq!(normalize_change_kind(Some("verify"), ""), ChangeKind::Modified);
|
|
75
|
-
// inspected/inspect ARE in the golden alias map → Observed.
|
|
76
|
-
assert_eq!(normalize_change_kind(Some("inspected"), ""), ChangeKind::Observed);
|
|
77
|
-
assert_eq!(normalize_change_kind(Some("inspect"), ""), ChangeKind::Observed);
|
|
78
|
-
assert_eq!(normalize_change_kind(Some("observe"), ""), ChangeKind::Observed);
|
|
79
|
-
// edited/edit→Modified.
|
|
80
|
-
assert_eq!(normalize_change_kind(Some("edited"), ""), ChangeKind::Modified);
|
|
81
|
-
assert_eq!(normalize_change_kind(Some("edit"), ""), ChangeKind::Modified);
|
|
82
|
-
// description keyword scan for observed includes 'inspected'.
|
|
83
|
-
assert_eq!(normalize_change_kind(None, "inspected it"), ChangeKind::Observed);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
// ── #40 normalize_result_status: 'partiallydone' (no underscore) → Partial ──
|
|
87
|
-
// Re-anchored per cr verdict (refined, 2026-06-10): the old Python golden mapped
|
|
88
|
-
// an unmatched literal to success (probe_mcp_red.py STATUS); RS deliberately
|
|
89
|
-
// normalizes a NON-EMPTY unknown literal to Partial (MUST-NOT-13, P7-type fix).
|
|
90
|
-
#[test]
|
|
91
|
-
fn result_status_partiallydone_no_underscore_is_partial() {
|
|
92
|
-
assert_eq!(normalize_result_status(Some("partiallydone")), ResultStatus::Partial);
|
|
93
|
-
assert_eq!(normalize_result_status(Some("PartiallyDone")), ResultStatus::Partial);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
// ── #35/#46/#53 normalize_changes: full alias set + empty-path SKIP ─────────
|
|
97
|
-
// GOLDEN (probe_mcp_red.py CHG ...): path={path,file,filepath,filename};
|
|
98
|
-
// kind={kind,type,action}; desc={description,summary,detail,details,message};
|
|
99
|
-
// no-path item is SKIPPED (not a phantom path:"").
|
|
100
|
-
#[test]
|
|
101
|
-
fn normalize_changes_full_aliases_and_skip_empty_path() {
|
|
102
|
-
// filepath alias honored; kind 'type-ignored' is not a real alias → keyword
|
|
103
|
-
// inference on desc 'fb' → Modified.
|
|
104
|
-
let v = normalize_changes(Some(&json!([{"filepath": "x.rs", "kind": "type-ignored"}])), "fb");
|
|
105
|
-
assert_eq!(v, vec![NormalizedChange {
|
|
106
|
-
path: "x.rs".to_string(), kind: ChangeKind::Modified, description: "fb".to_string()
|
|
107
|
-
}]);
|
|
108
|
-
// 'type' alias → kind resolution.
|
|
109
|
-
let v2 = normalize_changes(Some(&json!([{"path": "p", "type": "create"}])), "fb");
|
|
110
|
-
assert_eq!(v2[0].kind, ChangeKind::Created);
|
|
111
|
-
// filename + detail aliases.
|
|
112
|
-
let v3 = normalize_changes(Some(&json!([{"filename": "c.rs", "detail": "deet"}])), "fb");
|
|
113
|
-
assert_eq!(v3, vec![NormalizedChange {
|
|
114
|
-
path: "c.rs".to_string(), kind: ChangeKind::Modified, description: "deet".to_string()
|
|
115
|
-
}]);
|
|
116
|
-
// no path at all → SKIPPED (golden returns []).
|
|
117
|
-
assert!(normalize_changes(Some(&json!([{"kind": "created", "description": "d"}])), "fb").is_empty());
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
// ── #35/#46/#54 normalize_tests: full aliases + scalar coercion + skip ──────
|
|
121
|
-
// GOLDEN (probe_mcp_red.py TST ...): command={command,cmd,name,test};
|
|
122
|
-
// detail={detail,output,stdout,stderr,summary,message} (NO 'details');
|
|
123
|
-
// non-dict scalar (incl int) → {command:str(v),status:not_run}; no-command dict SKIPPED;
|
|
124
|
-
// a bare non-list scalar value is wrapped via _items.
|
|
125
|
-
#[test]
|
|
126
|
-
fn normalize_tests_full_aliases_scalar_coerce_and_skip() {
|
|
127
|
-
// name alias + output alias.
|
|
128
|
-
let v = normalize_tests(Some(&json!([{"name": "t", "output": "O"}])));
|
|
129
|
-
assert_eq!(v, vec![NormalizedTest {
|
|
130
|
-
command: "t".to_string(), status: TestStatus::NotRun, detail: Some("O".to_string())
|
|
131
|
-
}]);
|
|
132
|
-
// int scalar coerced to "123".
|
|
133
|
-
let vi = normalize_tests(Some(&json!([123])));
|
|
134
|
-
assert_eq!(vi, vec![NormalizedTest {
|
|
135
|
-
command: "123".to_string(), status: TestStatus::NotRun, detail: None
|
|
136
|
-
}]);
|
|
137
|
-
// dict with no command key → SKIPPED.
|
|
138
|
-
assert!(normalize_tests(Some(&json!([{"status": "pass"}]))).is_empty());
|
|
139
|
-
// non-list scalar value wrapped (_items): "x" → one test.
|
|
140
|
-
let vw = normalize_tests(Some(&json!("x")));
|
|
141
|
-
assert_eq!(vw, vec![NormalizedTest {
|
|
142
|
-
command: "x".to_string(), status: TestStatus::NotRun, detail: None
|
|
143
|
-
}]);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
// ── #35/#46/#55 normalize_risks: aliases + 'level' + scalar coerce + skip ───
|
|
147
|
-
// GOLDEN (probe_mcp_red.py RISK ...): desc={description,summary,detail,message};
|
|
148
|
-
// severity={severity,level}; int scalar→{severity:low,description:str(v)};
|
|
149
|
-
// no-description dict SKIPPED.
|
|
150
|
-
#[test]
|
|
151
|
-
fn normalize_risks_level_alias_scalar_coerce_and_skip() {
|
|
152
|
-
// 'detail' description alias + 'level' severity alias (HIGH → high).
|
|
153
|
-
let v = normalize_risks(Some(&json!([{"detail": "risky", "level": "HIGH"}])));
|
|
154
|
-
assert_eq!(v, vec![NormalizedRisk {
|
|
155
|
-
severity: RiskSeverity::High, description: "risky".to_string()
|
|
156
|
-
}]);
|
|
157
|
-
// int scalar coerced.
|
|
158
|
-
let vi = normalize_risks(Some(&json!([5])));
|
|
159
|
-
assert_eq!(vi, vec![NormalizedRisk {
|
|
160
|
-
severity: RiskSeverity::Low, description: "5".to_string()
|
|
161
|
-
}]);
|
|
162
|
-
// dict with no description → SKIPPED.
|
|
163
|
-
assert!(normalize_risks(Some(&json!([{"severity": "high"}]))).is_empty());
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
// ── #35/#46/#56 normalize_artifacts: aliases + scalar + skip ────────────────
|
|
167
|
-
// GOLDEN (probe_mcp_red.py ART ...): path={path,file,filepath,filename};
|
|
168
|
-
// desc={description,summary,detail} (default=path); no-path dict SKIPPED.
|
|
169
|
-
#[test]
|
|
170
|
-
fn normalize_artifacts_full_aliases_and_skip() {
|
|
171
|
-
// 'file' path alias + 'detail' description alias.
|
|
172
|
-
let v = normalize_artifacts(Some(&json!([{"file": "a.bin", "detail": "art"}])));
|
|
173
|
-
assert_eq!(v, vec![NormalizedArtifact {
|
|
174
|
-
path: "a.bin".to_string(), description: "art".to_string()
|
|
175
|
-
}]);
|
|
176
|
-
// dict with no path → SKIPPED.
|
|
177
|
-
assert!(normalize_artifacts(Some(&json!([{"description": "d"}]))).is_empty());
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
// ── #35/#46/#57 normalize_next_actions: action/todo/message aliases ─────────
|
|
181
|
-
// GOLDEN (probe_mcp_red.py NA ...): dict desc={description,summary,action,todo,message}.
|
|
182
|
-
#[test]
|
|
183
|
-
fn normalize_next_actions_action_todo_message_aliases() {
|
|
184
|
-
let v = normalize_next_actions(Some(&json!([
|
|
185
|
-
{"action": "a"}, {"todo": "t"}, {"message": "m"}
|
|
186
|
-
])));
|
|
187
|
-
assert_eq!(v, vec![
|
|
188
|
-
NormalizedNextAction { description: "a".to_string() },
|
|
189
|
-
NormalizedNextAction { description: "t".to_string() },
|
|
190
|
-
NormalizedNextAction { description: "m".to_string() },
|
|
191
|
-
]);
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
// ── #41 text_field: stringify non-string scalars (Python str()) ─────────────
|
|
195
|
-
// GOLDEN (probe_mcp_red.py ENV-NUMERIC): numeric task_id/agent_id/summary
|
|
196
|
-
// stringify to "123"/"456"/"42" (NOT the manual/unknown/completed fallbacks).
|
|
197
|
-
#[test]
|
|
198
|
-
fn report_envelope_stringifies_numeric_scalar_fields() {
|
|
199
|
-
let env = normalize_report_envelope(&json!({"task_id": 123, "agent_id": 456, "summary": 42}));
|
|
200
|
-
assert_eq!(env.task_id, TaskId::new("123"));
|
|
201
|
-
assert_eq!(env.agent_id, AgentId::new("456"));
|
|
202
|
-
assert_eq!(env.summary, "42");
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
// ── #28 handle_mcp initialize result KEY ORDER (server.py:55-59) ────────────
|
|
206
|
-
// GOLDEN (probe_init evidence): protocolVersion, capabilities, serverInfo.
|
|
207
|
-
// Rust currently emits protocolVersion, serverInfo, capabilities.
|
|
208
|
-
#[test]
|
|
209
|
-
fn handle_mcp_initialize_result_key_order_is_golden() {
|
|
210
|
-
let tools = TeamOrchestratorTools::with_identity(Path::new("/tmp/ws"), None, None);
|
|
211
|
-
let resp = handle_mcp(&tools, &json!({
|
|
212
|
-
"jsonrpc": "2.0", "id": 1, "method": "initialize", "params": {"protocolVersion": "X"}
|
|
213
|
-
})).unwrap().expect("initialize frame");
|
|
214
|
-
let result = resp.result.unwrap();
|
|
215
|
-
assert_eq!(keys(&result), vec!["protocolVersion", "capabilities", "serverInfo"]);
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
// ── #31 tools/call text field: json.dumps DEFAULT separators (spaces) ───────
|
|
219
|
-
// GOLDEN (probe_mcp_red.py DUMPS-DEFAULT): text has a space after ':' and ','.
|
|
220
|
-
// Rust serde_json::to_string is compact (no spaces).
|
|
221
|
-
#[test]
|
|
222
|
-
fn tool_call_text_field_uses_json_dumps_default_spacing() {
|
|
223
|
-
let tools = TeamOrchestratorTools::with_identity(Path::new("/tmp/ws"), None, None);
|
|
224
|
-
let resp = handle_mcp(&tools, &json!({
|
|
225
|
-
"jsonrpc": "2.0", "id": 9, "method": "tools/call",
|
|
226
|
-
"params": {"name": "nope", "arguments": {}}
|
|
227
|
-
})).unwrap().unwrap();
|
|
228
|
-
let text = resp.result.unwrap()["content"][0]["text"].as_str().unwrap().to_string();
|
|
229
|
-
// The raw bytes are compared by MCP clients: golden has ": " and ", ".
|
|
230
|
-
assert!(text.contains(r#""ok": false"#), "golden json.dumps puts a space after ':'");
|
|
231
|
-
assert!(text.contains(r#""reason": "unknown_tool""#), "golden has space after ':' and ','");
|
|
232
|
-
assert!(text.starts_with(r#"{"ok": false, "reason": "unknown_tool""#),
|
|
233
|
-
"byte-stable golden prefix; got: {text}");
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
// ── #33/#39 dispatch: empty/missing tool → 'unknown tool None'; method fallback;
|
|
237
|
-
// quote tool → Python repr double-quote switch ───────────────────────────
|
|
238
|
-
// GOLDEN (probe_dispatch_red.py): empty/missing tool message == "unknown tool None"
|
|
239
|
-
// (Python repr of None, not ''); method fallback resolves the tool name; a tool
|
|
240
|
-
// name containing a single quote reprs with DOUBLE quotes.
|
|
241
|
-
#[test]
|
|
242
|
-
fn dispatch_empty_and_missing_tool_message_is_unknown_tool_none() {
|
|
243
|
-
let tools = TeamOrchestratorTools::with_identity(Path::new("/tmp/ws"), None, None);
|
|
244
|
-
// empty-string tool is falsy in Python → falls through to method (None).
|
|
245
|
-
let e1 = dispatch(&tools, &json!({"tool": "", "arguments": {}})).expect_err("empty tool ⇒ Err");
|
|
246
|
-
assert_eq!(e1.message, "unknown tool None");
|
|
247
|
-
// no tool, no method at all.
|
|
248
|
-
let e2 = dispatch(&tools, &json!({"arguments": {}})).expect_err("missing tool ⇒ Err");
|
|
249
|
-
assert_eq!(e2.message, "unknown tool None");
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
#[test]
|
|
253
|
-
fn dispatch_falls_back_to_method_key_for_tool_name() {
|
|
254
|
-
// tool absent, method present and unknown → 'unknown tool 'nope'' (the method
|
|
255
|
-
// value, not 'unknown tool None'). Rust currently only falls back to 'name'.
|
|
256
|
-
let tools = TeamOrchestratorTools::with_identity(Path::new("/tmp/ws"), None, None);
|
|
257
|
-
let e = dispatch(&tools, &json!({"method": "nope", "params": {}})).expect_err("unknown ⇒ Err");
|
|
258
|
-
assert_eq!(e.message, "unknown tool 'nope'");
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
#[test]
|
|
262
|
-
fn dispatch_unknown_tool_with_quote_uses_python_repr_double_quotes() {
|
|
263
|
-
// GOLDEN QUOTE-TOOL: repr("a'b") switches to double quotes → unknown tool "a'b".
|
|
264
|
-
let tools = TeamOrchestratorTools::with_identity(Path::new("/tmp/ws"), None, None);
|
|
265
|
-
let e = dispatch(&tools, &json!({"tool": "a'b", "arguments": {}})).expect_err("unknown ⇒ Err");
|
|
266
|
-
assert_eq!(e.message, "unknown tool \"a'b\"");
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
// ── #37 rpc id echoed VERBATIM: float 1.5 and bigint beyond i64 ─────────────
|
|
270
|
-
// GOLDEN (probe_rpcid_red.py): id 1.5 → echoed 1.5; 99999999999999999999 → verbatim.
|
|
271
|
-
// Rust collapses both to null (RpcId has only Int(i64)/Str/Null).
|
|
272
|
-
#[test]
|
|
273
|
-
fn rpc_id_float_echoed_verbatim() {
|
|
274
|
-
let tools = TeamOrchestratorTools::with_identity(Path::new("/tmp/ws"), None, None);
|
|
275
|
-
let resp = handle_mcp(&tools, &json!({
|
|
276
|
-
"jsonrpc": "2.0", "id": 1.5, "method": "initialize", "params": {}
|
|
277
|
-
})).unwrap().unwrap();
|
|
278
|
-
let v = serde_json::to_value(&resp).unwrap();
|
|
279
|
-
assert_eq!(v["id"], json!(1.5), "float id echoed verbatim, not null");
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
// ── #51 dispatch_tool(SendMessage) WorkerAccepted returned VERBATIM ─────────
|
|
283
|
-
// GOLDEN (probe_sendoutcome evidence + tools.py:176-183): worker-accepted dict is
|
|
284
|
-
// returned DIRECTLY: keys [status, delivery_pending, poll_via, message_id]. Rust
|
|
285
|
-
// dispatch_tool re-runs compact_tool_result, dropping delivery_pending/poll_via.
|