@team-agent/installer 0.5.127 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -4
- package/README.zh.md +1 -1
- package/package.json +4 -8
- package/skills/team-agent/SKILL.md +41 -26
- package/skills/team-agent/command-coverage.json +170 -184
- package/skills/team-agent/docs/reference/team-agent-operator.md +66 -32
- package/skills/team-agent/references/recovery-runbook.md +1 -1
- package/skills/team-agent/references/team-agent-operator.md +66 -32
- package/templates/team_state.md +1 -1
- package/Cargo.lock +0 -1063
- package/Cargo.toml +0 -36
- package/crates/team-agent/Cargo.toml +0 -69
- package/crates/team-agent/src/app_server_test_support.rs +0 -258
- package/crates/team-agent/src/cli/adapters.rs +0 -1298
- package/crates/team-agent/src/cli/arguments.rs +0 -401
- package/crates/team-agent/src/cli/attach_app_server_leader.rs +0 -98
- package/crates/team-agent/src/cli/diagnose.rs +0 -1675
- package/crates/team-agent/src/cli/emit.rs +0 -2898
- package/crates/team-agent/src/cli/grok_slot.rs +0 -384
- package/crates/team-agent/src/cli/helpers.rs +0 -91
- package/crates/team-agent/src/cli/intent/runtime.rs +0 -1189
- package/crates/team-agent/src/cli/intent/runtime_tests.rs +0 -821
- package/crates/team-agent/src/cli/intent/tests.rs +0 -691
- package/crates/team-agent/src/cli/intent.rs +0 -664
- package/crates/team-agent/src/cli/leader.rs +0 -300
- package/crates/team-agent/src/cli/leader_prompt.rs +0 -261
- package/crates/team-agent/src/cli/leaders.rs +0 -418
- package/crates/team-agent/src/cli/mod.rs +0 -6528
- package/crates/team-agent/src/cli/models.rs +0 -449
- package/crates/team-agent/src/cli/named_address.rs +0 -1651
- package/crates/team-agent/src/cli/profile.rs +0 -342
- package/crates/team-agent/src/cli/route.rs +0 -212
- package/crates/team-agent/src/cli/send/coordinator.rs +0 -164
- package/crates/team-agent/src/cli/send/mailbox.rs +0 -145
- package/crates/team-agent/src/cli/send/persist.rs +0 -192
- package/crates/team-agent/src/cli/send/presentation.rs +0 -370
- package/crates/team-agent/src/cli/send/resolve.rs +0 -573
- package/crates/team-agent/src/cli/send.rs +0 -201
- package/crates/team-agent/src/cli/shutdown_socket.rs +0 -288
- package/crates/team-agent/src/cli/spec.rs +0 -159
- package/crates/team-agent/src/cli/status.rs +0 -280
- package/crates/team-agent/src/cli/status_port/agents.rs +0 -358
- package/crates/team-agent/src/cli/status_port/approvals.rs +0 -79
- package/crates/team-agent/src/cli/status_port/brief.rs +0 -2043
- package/crates/team-agent/src/cli/status_port/compact.rs +0 -240
- package/crates/team-agent/src/cli/status_port/format.rs +0 -146
- package/crates/team-agent/src/cli/status_port/inbox.rs +0 -62
- package/crates/team-agent/src/cli/status_port/runtime.rs +0 -197
- package/crates/team-agent/src/cli/status_port/snapshot.rs +0 -208
- package/crates/team-agent/src/cli/status_port/store.rs +0 -416
- package/crates/team-agent/src/cli/status_port/tests.rs +0 -90
- package/crates/team-agent/src/cli/status_port.rs +0 -92
- package/crates/team-agent/src/cli/tests/base.rs +0 -885
- package/crates/team-agent/src/cli/tests/divergence.rs +0 -518
- package/crates/team-agent/src/cli/tests/lane_c.rs +0 -453
- package/crates/team-agent/src/cli/tests/leader_watch.rs +0 -372
- package/crates/team-agent/src/cli/tests/main_preserved.rs +0 -430
- package/crates/team-agent/src/cli/tests/missing_subcommands.rs +0 -336
- package/crates/team-agent/src/cli/tests/mod.rs +0 -137
- package/crates/team-agent/src/cli/tests/named_address.rs +0 -760
- package/crates/team-agent/src/cli/tests/parser_safety.rs +0 -383
- package/crates/team-agent/src/cli/tests/run_delegation.rs +0 -481
- package/crates/team-agent/src/cli/tests/shutdown_kill_plan.rs +0 -2179
- package/crates/team-agent/src/cli/tests/status_brief.rs +0 -1514
- package/crates/team-agent/src/cli/tests/status_send.rs +0 -1091
- package/crates/team-agent/src/cli/tests/verb_install_skill.rs +0 -93
- package/crates/team-agent/src/cli/tests/verb_profile.rs +0 -392
- package/crates/team-agent/src/cli/triage.rs +0 -234
- package/crates/team-agent/src/cli/types.rs +0 -591
- package/crates/team-agent/src/codex_app_server.rs +0 -546
- package/crates/team-agent/src/communication_mode/mod.rs +0 -56
- package/crates/team-agent/src/compiler/tests.rs +0 -842
- package/crates/team-agent/src/compiler.rs +0 -691
- package/crates/team-agent/src/conpty/backend.rs +0 -829
- package/crates/team-agent/src/conpty/mod.rs +0 -33
- package/crates/team-agent/src/contract_runtime/backend.rs +0 -1610
- package/crates/team-agent/src/contract_runtime/commands.rs +0 -671
- package/crates/team-agent/src/contract_runtime/config.rs +0 -354
- package/crates/team-agent/src/contract_runtime/config_tests.rs +0 -56
- package/crates/team-agent/src/contract_runtime/discovery.rs +0 -438
- package/crates/team-agent/src/contract_runtime/fork.rs +0 -368
- package/crates/team-agent/src/contract_runtime/forward.rs +0 -288
- package/crates/team-agent/src/contract_runtime/framework.rs +0 -350
- package/crates/team-agent/src/contract_runtime/mcp.rs +0 -399
- package/crates/team-agent/src/contract_runtime/mod.rs +0 -17
- package/crates/team-agent/src/contract_runtime/prompt.rs +0 -216
- package/crates/team-agent/src/contract_runtime/pump.rs +0 -271
- package/crates/team-agent/src/contract_runtime/registry.rs +0 -589
- package/crates/team-agent/src/contract_runtime/workspace.rs +0 -228
- package/crates/team-agent/src/coordinator/backoff.rs +0 -741
- package/crates/team-agent/src/coordinator/conpty_shim.rs +0 -805
- package/crates/team-agent/src/coordinator/health.rs +0 -1185
- package/crates/team-agent/src/coordinator/mod.rs +0 -119
- package/crates/team-agent/src/coordinator/orphan.rs +0 -110
- package/crates/team-agent/src/coordinator/runtime_detectors.rs +0 -798
- package/crates/team-agent/src/coordinator/runtime_observation.rs +0 -84
- package/crates/team-agent/src/coordinator/steps/abnormal.rs +0 -2309
- package/crates/team-agent/src/coordinator/steps/delivery.rs +0 -15
- package/crates/team-agent/src/coordinator/steps/health_sync.rs +0 -15
- package/crates/team-agent/src/coordinator/steps/mod.rs +0 -126
- package/crates/team-agent/src/coordinator/steps/persist.rs +0 -15
- package/crates/team-agent/src/coordinator/steps/runtime_prompts.rs +0 -15
- package/crates/team-agent/src/coordinator/steps/session_gate.rs +0 -16
- package/crates/team-agent/src/coordinator/tests/a0_lostupdate.rs +0 -158
- package/crates/team-agent/src/coordinator/tests/abnormal.rs +0 -312
- package/crates/team-agent/src/coordinator/tests/api_error_recovery.rs +0 -338
- package/crates/team-agent/src/coordinator/tests/basics.rs +0 -211
- package/crates/team-agent/src/coordinator/tests/daemon.rs +0 -514
- package/crates/team-agent/src/coordinator/tests/energy.rs +0 -549
- package/crates/team-agent/src/coordinator/tests/health_sync.rs +0 -461
- package/crates/team-agent/src/coordinator/tests/main_preserved.rs +0 -186
- package/crates/team-agent/src/coordinator/tests/mod.rs +0 -295
- package/crates/team-agent/src/coordinator/tests/s3_bounded.rs +0 -207
- package/crates/team-agent/src/coordinator/tests/spine.rs +0 -308
- package/crates/team-agent/src/coordinator/tests/takeover.rs +0 -286
- package/crates/team-agent/src/coordinator/tests/tick_core.rs +0 -237
- package/crates/team-agent/src/coordinator/tick.rs +0 -3112
- package/crates/team-agent/src/coordinator/types.rs +0 -540
- package/crates/team-agent/src/db/agent_health_capture.rs +0 -126
- package/crates/team-agent/src/db/message_store.rs +0 -1585
- package/crates/team-agent/src/db/migration.rs +0 -984
- package/crates/team-agent/src/db/mod.rs +0 -26
- package/crates/team-agent/src/db/schema.rs +0 -663
- package/crates/team-agent/src/diagnose/comms.rs +0 -242
- package/crates/team-agent/src/diagnose/mod.rs +0 -44
- package/crates/team-agent/src/diagnose/orphans.rs +0 -889
- package/crates/team-agent/src/event_log.rs +0 -502
- package/crates/team-agent/src/fake_worker.rs +0 -303
- package/crates/team-agent/src/kill_audit.rs +0 -106
- package/crates/team-agent/src/layout/manager.rs +0 -248
- package/crates/team-agent/src/layout/mod.rs +0 -36
- package/crates/team-agent/src/layout/overlay.rs +0 -134
- package/crates/team-agent/src/layout/placement.rs +0 -52
- package/crates/team-agent/src/layout/recovery.rs +0 -106
- package/crates/team-agent/src/layout/runtime_sessions.rs +0 -317
- package/crates/team-agent/src/layout/sessions.rs +0 -294
- package/crates/team-agent/src/layout/tmux_endpoint.rs +0 -165
- package/crates/team-agent/src/layout/worker_env.rs +0 -721
- package/crates/team-agent/src/layout/worker_window_helpers.rs +0 -37
- package/crates/team-agent/src/leader/helpers.rs +0 -178
- package/crates/team-agent/src/leader/incident.rs +0 -6
- package/crates/team-agent/src/leader/lease.rs +0 -3356
- package/crates/team-agent/src/leader/mod.rs +0 -104
- package/crates/team-agent/src/leader/owner_bind.rs +0 -400
- package/crates/team-agent/src/leader/prompt.rs +0 -905
- package/crates/team-agent/src/leader/provider_attribution.rs +0 -247
- package/crates/team-agent/src/leader/rediscover/tests.rs +0 -689
- package/crates/team-agent/src/leader/rediscover.rs +0 -1192
- package/crates/team-agent/src/leader/registry.rs +0 -883
- package/crates/team-agent/src/leader/start.rs +0 -4500
- package/crates/team-agent/src/leader/takeover.rs +0 -65
- package/crates/team-agent/src/leader/tests/basics.rs +0 -337
- package/crates/team-agent/src/leader/tests/byte_findings.rs +0 -355
- package/crates/team-agent/src/leader/tests/claim_leader_mailbox_flush_contract.rs +0 -544
- package/crates/team-agent/src/leader/tests/historical_inventory_upgrade_gate_red.rs +0 -624
- package/crates/team-agent/src/leader/tests/identity.rs +0 -465
- package/crates/team-agent/src/leader/tests/identity_session_names.rs +0 -42
- package/crates/team-agent/src/leader/tests/idle.rs +0 -113
- package/crates/team-agent/src/leader/tests/lease_api.rs +0 -520
- package/crates/team-agent/src/leader/tests/lease_claim.rs +0 -629
- package/crates/team-agent/src/leader/tests/mod.rs +0 -106
- package/crates/team-agent/src/leader/tests/prompt_contract.rs +0 -267
- package/crates/team-agent/src/leader/tests/rediscover.rs +0 -403
- package/crates/team-agent/src/leader/tests/rehomed_env.rs +0 -83
- package/crates/team-agent/src/leader/tests/team_in_team_state_scope_red.rs +0 -1273
- package/crates/team-agent/src/leader/tests/terminal_and_replay_vs_rerender_invariants_red.rs +0 -417
- package/crates/team-agent/src/leader/tests/wake_start_owner.rs +0 -168
- package/crates/team-agent/src/leader/types.rs +0 -534
- package/crates/team-agent/src/lib.rs +0 -145
- package/crates/team-agent/src/lifecycle/helpers.rs +0 -212
- package/crates/team-agent/src/lifecycle/launch/add_agent.rs +0 -848
- package/crates/team-agent/src/lifecycle/launch/add_agent_state.rs +0 -393
- package/crates/team-agent/src/lifecycle/launch/agent_state.rs +0 -332
- package/crates/team-agent/src/lifecycle/launch/clone_agent.rs +0 -178
- package/crates/team-agent/src/lifecycle/launch/fork_agent.rs +0 -82
- package/crates/team-agent/src/lifecycle/launch/fork_entry.rs +0 -63
- package/crates/team-agent/src/lifecycle/launch/identity.rs +0 -674
- package/crates/team-agent/src/lifecycle/launch/layout.rs +0 -350
- package/crates/team-agent/src/lifecycle/launch/leader_context.rs +0 -589
- package/crates/team-agent/src/lifecycle/launch/mcp_config.rs +0 -152
- package/crates/team-agent/src/lifecycle/launch/ownership.rs +0 -105
- package/crates/team-agent/src/lifecycle/launch/pi_mcp.rs +0 -629
- package/crates/team-agent/src/lifecycle/launch/pi_mcp_extension.js +0 -226
- package/crates/team-agent/src/lifecycle/launch/plan.rs +0 -269
- package/crates/team-agent/src/lifecycle/launch/quick_start.rs +0 -5176
- package/crates/team-agent/src/lifecycle/launch/quick_start_transport.rs +0 -368
- package/crates/team-agent/src/lifecycle/launch/readiness.rs +0 -519
- package/crates/team-agent/src/lifecycle/launch/role_source.rs +0 -287
- package/crates/team-agent/src/lifecycle/launch/spawn.rs +0 -450
- package/crates/team-agent/src/lifecycle/launch/spec_state.rs +0 -801
- package/crates/team-agent/src/lifecycle/launch/state_projection.rs +0 -624
- package/crates/team-agent/src/lifecycle/launch/worker_env.rs +0 -558
- package/crates/team-agent/src/lifecycle/launch.rs +0 -534
- package/crates/team-agent/src/lifecycle/lock.rs +0 -350
- package/crates/team-agent/src/lifecycle/mod.rs +0 -79
- package/crates/team-agent/src/lifecycle/pane_input_lock.rs +0 -239
- package/crates/team-agent/src/lifecycle/profile_launch.rs +0 -757
- package/crates/team-agent/src/lifecycle/profile_smoke.rs +0 -557
- package/crates/team-agent/src/lifecycle/restart/agent.rs +0 -2198
- package/crates/team-agent/src/lifecycle/restart/common.rs +0 -2052
- package/crates/team-agent/src/lifecycle/restart/orchestrator.rs +0 -65
- package/crates/team-agent/src/lifecycle/restart/preflight.rs +0 -113
- package/crates/team-agent/src/lifecycle/restart/rebuild.rs +0 -5135
- package/crates/team-agent/src/lifecycle/restart/remove.rs +0 -1504
- package/crates/team-agent/src/lifecycle/restart/selection.rs +0 -559
- package/crates/team-agent/src/lifecycle/restart/team_state.rs +0 -329
- package/crates/team-agent/src/lifecycle/restart.rs +0 -223
- package/crates/team-agent/src/lifecycle/role_config.rs +0 -1205
- package/crates/team-agent/src/lifecycle/tests/acceptance_b_batch_red.rs +0 -1021
- package/crates/team-agent/src/lifecycle/tests/agent_ops.rs +0 -1205
- package/crates/team-agent/src/lifecycle/tests/b0_legacy_snapshot_nonauthority_contract.rs +0 -265
- package/crates/team-agent/src/lifecycle/tests/b0_reader_hideone_audit_contract.rs +0 -490
- package/crates/team-agent/src/lifecycle/tests/behavioral_diff_264_red.rs +0 -656
- package/crates/team-agent/src/lifecycle/tests/claude_profile_launch_red.rs +0 -135
- package/crates/team-agent/src/lifecycle/tests/cli_argv_routing_red.rs +0 -1415
- package/crates/team-agent/src/lifecycle/tests/clone_agent_preserves_source_tools.rs +0 -427
- package/crates/team-agent/src/lifecycle/tests/clone_fork_copilot_perms_red.rs +0 -396
- package/crates/team-agent/src/lifecycle/tests/communication_mode_runtime_contract_red.rs +0 -418
- package/crates/team-agent/src/lifecycle/tests/copilot_provider_red.rs +0 -2039
- package/crates/team-agent/src/lifecycle/tests/core.rs +0 -1298
- package/crates/team-agent/src/lifecycle/tests/f032_startup_prompt_best_effort_red.rs +0 -315
- package/crates/team-agent/src/lifecycle/tests/fixtures/pi_list_models_g0.stdout.txt +0 -222
- package/crates/team-agent/src/lifecycle/tests/fixtures/pi_list_models_spaced_ids.stdout.txt +0 -9
- package/crates/team-agent/src/lifecycle/tests/fixtures/pi_native_mcp_host.mjs +0 -71
- package/crates/team-agent/src/lifecycle/tests/gate_fixtures.rs +0 -562
- package/crates/team-agent/src/lifecycle/tests/grok_require_explicit_model_red.rs +0 -110
- package/crates/team-agent/src/lifecycle/tests/harvest2_a_batch_red.rs +0 -472
- package/crates/team-agent/src/lifecycle/tests/host_cotenant_death_p0_contract.rs +0 -921
- package/crates/team-agent/src/lifecycle/tests/issue238_codex_effort_contract.rs +0 -68
- package/crates/team-agent/src/lifecycle/tests/lane_ops.rs +0 -1851
- package/crates/team-agent/src/lifecycle/tests/launch_spawn.rs +0 -3981
- package/crates/team-agent/src/lifecycle/tests/lifecycle_lock.rs +0 -339
- package/crates/team-agent/src/lifecycle/tests/lifecycle_rollback_red.rs +0 -596
- package/crates/team-agent/src/lifecycle/tests/main_preserved.rs +0 -513
- package/crates/team-agent/src/lifecycle/tests/mcp_tool_name_format_red.rs +0 -69
- package/crates/team-agent/src/lifecycle/tests/phase_b_contracts.rs +0 -824
- package/crates/team-agent/src/lifecycle/tests/phase_golden.rs +0 -723
- package/crates/team-agent/src/lifecycle/tests/pi_catalog_red.rs +0 -152
- package/crates/team-agent/src/lifecycle/tests/pi_command_red.rs +0 -182
- package/crates/team-agent/src/lifecycle/tests/pi_dual_entry_red.rs +0 -374
- package/crates/team-agent/src/lifecycle/tests/pi_executable_mcp_red.rs +0 -546
- package/crates/team-agent/src/lifecycle/tests/pi_lifecycle_doctor_red.rs +0 -31
- package/crates/team-agent/src/lifecycle/tests/pi_native_mcp_capability_red.rs +0 -528
- package/crates/team-agent/src/lifecycle/tests/pi_session_delivery_red.rs +0 -134
- package/crates/team-agent/src/lifecycle/tests/quick_start_worker_readiness_red.rs +0 -333
- package/crates/team-agent/src/lifecycle/tests/realmachine_clusters_1_6_red.rs +0 -786
- package/crates/team-agent/src/lifecycle/tests/realmachine_residual_g1_g4_red.rs +0 -648
- package/crates/team-agent/src/lifecycle/tests/restart.rs +0 -185
- package/crates/team-agent/src/lifecycle/tests/restart_build_before_destroy_0540_contract.rs +0 -1053
- package/crates/team-agent/src/lifecycle/tests/restart_liveness_red.rs +0 -679
- package/crates/team-agent/src/lifecycle/tests/restart_rebind_hotfix_252_red.rs +0 -1126
- package/crates/team-agent/src/lifecycle/tests/restart_session_capture_red.rs +0 -153
- package/crates/team-agent/src/lifecycle/tests/resume_recover_red.rs +0 -427
- package/crates/team-agent/src/lifecycle/tests/stale_team_saveconflict_contract.rs +0 -431
- package/crates/team-agent/src/lifecycle/tests/startup_latency_contract.rs +0 -1066
- package/crates/team-agent/src/lifecycle/tests/status_credential_redaction_contract.rs +0 -876
- package/crates/team-agent/src/lifecycle/tests/subprep_codex_trust_roundtrip_red.rs +0 -1026
- package/crates/team-agent/src/lifecycle/tests/swallow_batch4_semantics_red.rs +0 -90
- package/crates/team-agent/src/lifecycle/tests/team_in_team_identity_scope_red.rs +0 -543
- package/crates/team-agent/src/lifecycle/tests/team_in_team_sibling_quick_start_red.rs +0 -1103
- package/crates/team-agent/src/lifecycle/tests/team_in_team_state_scope_red.rs +0 -1276
- package/crates/team-agent/src/lifecycle/tests/team_key_retirement_roster_red.rs +0 -145
- package/crates/team-agent/src/lifecycle/tests/team_key_retirement_txn_red.rs +0 -603
- package/crates/team-agent/src/lifecycle/tests/test_isolation_escape_contract.rs +0 -936
- package/crates/team-agent/src/lifecycle/tests/upgrade_compat_0211_red.rs +0 -970
- package/crates/team-agent/src/lifecycle/tests/verify_rs031_window_consistency_red.rs +0 -996
- package/crates/team-agent/src/lifecycle/tests/worker_spawn_env_red.rs +0 -827
- package/crates/team-agent/src/lifecycle/tests.rs +0 -102
- package/crates/team-agent/src/lifecycle/types.rs +0 -861
- package/crates/team-agent/src/lifecycle/worker_command_context.rs +0 -370
- package/crates/team-agent/src/main.rs +0 -52
- package/crates/team-agent/src/mcp_server/helpers.rs +0 -510
- package/crates/team-agent/src/mcp_server/lifecycle_tools/mod.rs +0 -6
- package/crates/team-agent/src/mcp_server/lifecycle_tools/state_status.rs +0 -43
- package/crates/team-agent/src/mcp_server/mod.rs +0 -119
- package/crates/team-agent/src/mcp_server/normalize.rs +0 -485
- package/crates/team-agent/src/mcp_server/readiness.rs +0 -546
- package/crates/team-agent/src/mcp_server/readiness_tests.rs +0 -369
- package/crates/team-agent/src/mcp_server/tests/golden.rs +0 -285
- package/crates/team-agent/src/mcp_server/tests/normalize.rs +0 -247
- package/crates/team-agent/src/mcp_server/tests/scoped.rs +0 -168
- package/crates/team-agent/src/mcp_server/tests/send.rs +0 -388
- package/crates/team-agent/src/mcp_server/tests/tools.rs +0 -343
- package/crates/team-agent/src/mcp_server/tests/wire.rs +0 -254
- package/crates/team-agent/src/mcp_server/tests.rs +0 -43
- package/crates/team-agent/src/mcp_server/tools.rs +0 -1015
- package/crates/team-agent/src/mcp_server/types.rs +0 -396
- package/crates/team-agent/src/mcp_server/wire.rs +0 -867
- package/crates/team-agent/src/messaging/activity.rs +0 -461
- package/crates/team-agent/src/messaging/address.rs +0 -87
- package/crates/team-agent/src/messaging/delivery.rs +0 -3785
- package/crates/team-agent/src/messaging/delivery_consumption_tests.rs +0 -234
- package/crates/team-agent/src/messaging/enter_rescue.rs +0 -362
- package/crates/team-agent/src/messaging/enter_rescue_tests.rs +0 -633
- package/crates/team-agent/src/messaging/helpers.rs +0 -354
- package/crates/team-agent/src/messaging/leader_channel.rs +0 -287
- package/crates/team-agent/src/messaging/leader_receiver.rs +0 -786
- package/crates/team-agent/src/messaging/mod.rs +0 -166
- package/crates/team-agent/src/messaging/persist.rs +0 -377
- package/crates/team-agent/src/messaging/presentation.rs +0 -417
- package/crates/team-agent/src/messaging/results/collection_tests.rs +0 -719
- package/crates/team-agent/src/messaging/results.rs +0 -1415
- package/crates/team-agent/src/messaging/scheduler.rs +0 -217
- package/crates/team-agent/src/messaging/selftest.rs +0 -315
- package/crates/team-agent/src/messaging/send.rs +0 -981
- package/crates/team-agent/src/messaging/tests/basic.rs +0 -346
- package/crates/team-agent/src/messaging/tests/dup_inject.rs +0 -551
- package/crates/team-agent/src/messaging/tests/e23.rs +0 -49
- package/crates/team-agent/src/messaging/tests/leader_channel.rs +0 -169
- package/crates/team-agent/src/messaging/tests/leader_inject_acceptance.rs +0 -817
- package/crates/team-agent/src/messaging/tests/main_preserved.rs +0 -85
- package/crates/team-agent/src/messaging/tests/mod.rs +0 -306
- package/crates/team-agent/src/messaging/tests/runtime.rs +0 -3655
- package/crates/team-agent/src/messaging/tests/spine.rs +0 -837
- package/crates/team-agent/src/messaging/tests/wave2.rs +0 -381
- package/crates/team-agent/src/messaging/trust.rs +0 -215
- package/crates/team-agent/src/messaging/types.rs +0 -471
- package/crates/team-agent/src/messaging/wait.rs +0 -366
- package/crates/team-agent/src/messaging/watchers.rs +0 -916
- package/crates/team-agent/src/model/enums.rs +0 -356
- package/crates/team-agent/src/model/errors.rs +0 -18
- package/crates/team-agent/src/model/ids.rs +0 -165
- package/crates/team-agent/src/model/mod.rs +0 -29
- package/crates/team-agent/src/model/name_similarity.rs +0 -252
- package/crates/team-agent/src/model/pane_authority_refusal.rs +0 -359
- package/crates/team-agent/src/model/paths.rs +0 -257
- package/crates/team-agent/src/model/routing.rs +0 -387
- package/crates/team-agent/src/model/spec.rs +0 -1184
- package/crates/team-agent/src/model/task_graph.rs +0 -321
- package/crates/team-agent/src/model/testdata/fuzz.golden.yaml +0 -43
- package/crates/team-agent/src/model/testdata/fuzz.yaml +0 -43
- package/crates/team-agent/src/model/testdata/spec_invalid_a.yaml +0 -209
- package/crates/team-agent/src/model/testdata/team.spec.golden.yaml +0 -208
- package/crates/team-agent/src/model/testdata/team.spec.yaml +0 -208
- package/crates/team-agent/src/model/yaml/tests.rs +0 -188
- package/crates/team-agent/src/model/yaml.rs +0 -802
- package/crates/team-agent/src/os_probe.rs +0 -280
- package/crates/team-agent/src/packaging/install.rs +0 -219
- package/crates/team-agent/src/packaging/migrate.rs +0 -38
- package/crates/team-agent/src/packaging/mod.rs +0 -91
- package/crates/team-agent/src/packaging/repair.rs +0 -33
- package/crates/team-agent/src/packaging/tests.rs +0 -822
- package/crates/team-agent/src/packaging/types.rs +0 -417
- package/crates/team-agent/src/platform/argv.rs +0 -331
- package/crates/team-agent/src/platform/errors.rs +0 -104
- package/crates/team-agent/src/platform/file_lock.rs +0 -279
- package/crates/team-agent/src/platform/mod.rs +0 -5
- package/crates/team-agent/src/platform/process.rs +0 -545
- package/crates/team-agent/src/provider/adapter.rs +0 -898
- package/crates/team-agent/src/provider/adapters/copilot.rs +0 -75
- package/crates/team-agent/src/provider/adapters/copilot_fork.rs +0 -307
- package/crates/team-agent/src/provider/adapters/fake.rs +0 -18
- package/crates/team-agent/src/provider/adapters/mod.rs +0 -28
- package/crates/team-agent/src/provider/approvals/mod.rs +0 -3
- package/crates/team-agent/src/provider/approvals/parsing.rs +0 -586
- package/crates/team-agent/src/provider/approvals/runtime_prompts.rs +0 -205
- package/crates/team-agent/src/provider/argv_route.rs +0 -405
- package/crates/team-agent/src/provider/bypass_flags.rs +0 -116
- package/crates/team-agent/src/provider/classify.rs +0 -773
- package/crates/team-agent/src/provider/command_helpers.rs +0 -45
- package/crates/team-agent/src/provider/faults.rs +0 -165
- package/crates/team-agent/src/provider/helpers.rs +0 -52
- package/crates/team-agent/src/provider/mod.rs +0 -78
- package/crates/team-agent/src/provider/model_catalog.rs +0 -722
- package/crates/team-agent/src/provider/session/capture.rs +0 -2631
- package/crates/team-agent/src/provider/session/context_fork/outcome.rs +0 -168
- package/crates/team-agent/src/provider/session/context_fork.rs +0 -264
- package/crates/team-agent/src/provider/session/mod.rs +0 -36
- package/crates/team-agent/src/provider/session/resume.rs +0 -269
- package/crates/team-agent/src/provider/session_scan/common/tests.rs +0 -316
- package/crates/team-agent/src/provider/session_scan/common.rs +0 -618
- package/crates/team-agent/src/provider/session_scan/copilot.rs +0 -280
- package/crates/team-agent/src/provider/session_scan/pi.rs +0 -152
- package/crates/team-agent/src/provider/session_scan.rs +0 -61
- package/crates/team-agent/src/provider/startup_prompt.rs +0 -757
- package/crates/team-agent/src/provider/submit_now.rs +0 -71
- package/crates/team-agent/src/provider/testdata/copilot-ready-marker.txt +0 -5
- package/crates/team-agent/src/provider/testdata/copilot-trust-prompt.txt +0 -19
- package/crates/team-agent/src/provider/testdata/grok-models-authenticated.stdout +0 -9
- package/crates/team-agent/src/provider/testdata/grok-models-unauthenticated.stdout +0 -7
- package/crates/team-agent/src/provider/tests/adapter.rs +0 -354
- package/crates/team-agent/src/provider/tests/classify.rs +0 -201
- package/crates/team-agent/src/provider/tests/command_helpers.rs +0 -26
- package/crates/team-agent/src/provider/tests/copilot_fork.rs +0 -191
- package/crates/team-agent/src/provider/tests/faults.rs +0 -200
- package/crates/team-agent/src/provider/tests/idle.rs +0 -140
- package/crates/team-agent/src/provider/tests/wire.rs +0 -213
- package/crates/team-agent/src/provider/tests.rs +0 -32
- package/crates/team-agent/src/provider/types.rs +0 -529
- package/crates/team-agent/src/provider/wire.rs +0 -406
- package/crates/team-agent/src/redaction.rs +0 -259
- package/crates/team-agent/src/state/abnormal_watch/tests/mod.rs +0 -248
- package/crates/team-agent/src/state/abnormal_watch.rs +0 -144
- package/crates/team-agent/src/state/identity.rs +0 -914
- package/crates/team-agent/src/state/identity_keys.rs +0 -132
- package/crates/team-agent/src/state/mod.rs +0 -74
- package/crates/team-agent/src/state/owner_gate.rs +0 -482
- package/crates/team-agent/src/state/ownership.rs +0 -563
- package/crates/team-agent/src/state/paths.rs +0 -395
- package/crates/team-agent/src/state/persist.rs +0 -3811
- package/crates/team-agent/src/state/projection.rs +0 -1508
- package/crates/team-agent/src/state/repository/intent.rs +0 -14
- package/crates/team-agent/src/state/repository/tests.rs +0 -184
- package/crates/team-agent/src/state/repository.rs +0 -866
- package/crates/team-agent/src/state/selector.rs +0 -160
- package/crates/team-agent/src/state/testdata/state-rich.canonical.json +0 -133
- package/crates/team-agent/src/tmux_backend/enter_rescue.rs +0 -325
- package/crates/team-agent/src/tmux_backend/enter_rescue_tests.rs +0 -432
- package/crates/team-agent/src/tmux_backend/native_input.rs +0 -513
- package/crates/team-agent/src/tmux_backend/native_input_tests.rs +0 -742
- package/crates/team-agent/src/tmux_backend/tests.rs +0 -4254
- package/crates/team-agent/src/tmux_backend.rs +0 -4527
- package/crates/team-agent/src/topology.rs +0 -537
- package/crates/team-agent/src/transport/enter_rescue.rs +0 -166
- package/crates/team-agent/src/transport/native_input.rs +0 -491
- package/crates/team-agent/src/transport/test_support.rs +0 -743
- package/crates/team-agent/src/transport/tests/behavior.rs +0 -326
- package/crates/team-agent/src/transport/tests/mod.rs +0 -194
- package/crates/team-agent/src/transport/tests/wire.rs +0 -574
- package/crates/team-agent/src/transport.rs +0 -1655
- package/crates/team-agent/src/transport_factory.rs +0 -819
|
@@ -1,691 +0,0 @@
|
|
|
1
|
-
#![allow(clippy::unwrap_used, clippy::panic)]
|
|
2
|
-
use super::*;
|
|
3
|
-
use std::cell::RefCell;
|
|
4
|
-
|
|
5
|
-
pub(super) struct Sandbox(pub PathBuf);
|
|
6
|
-
impl Sandbox {
|
|
7
|
-
pub(super) fn new() -> Self {
|
|
8
|
-
use std::sync::atomic::{AtomicU64, Ordering};
|
|
9
|
-
static NEXT: AtomicU64 = AtomicU64::new(0);
|
|
10
|
-
let path = std::env::temp_dir().join(format!(
|
|
11
|
-
"ta-cli-phase1-{}-{}",
|
|
12
|
-
std::process::id(),
|
|
13
|
-
NEXT.fetch_add(1, Ordering::Relaxed)
|
|
14
|
-
));
|
|
15
|
-
std::fs::create_dir(&path).unwrap();
|
|
16
|
-
Self(path.canonicalize().unwrap())
|
|
17
|
-
}
|
|
18
|
-
pub(super) fn path(&self) -> &Path {
|
|
19
|
-
&self.0
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
impl Drop for Sandbox {
|
|
23
|
-
fn drop(&mut self) {
|
|
24
|
-
let _ = std::fs::remove_dir_all(&self.0);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
#[test]
|
|
29
|
-
fn native_receipt_reconciliation_is_start_only_not_implicit_stop_or_restart() {
|
|
30
|
-
assert_eq!(
|
|
31
|
-
seat_actions(
|
|
32
|
-
Verb::Start,
|
|
33
|
-
Observation::NativeReconcile,
|
|
34
|
-
false,
|
|
35
|
-
false,
|
|
36
|
-
false,
|
|
37
|
-
true
|
|
38
|
-
)
|
|
39
|
-
.unwrap(),
|
|
40
|
-
vec!["start"]
|
|
41
|
-
);
|
|
42
|
-
for verb in [Verb::Stop, Verb::Restart] {
|
|
43
|
-
assert!(seat_actions(
|
|
44
|
-
verb,
|
|
45
|
-
Observation::NativeReconcile,
|
|
46
|
-
false,
|
|
47
|
-
false,
|
|
48
|
-
false,
|
|
49
|
-
false
|
|
50
|
-
)
|
|
51
|
-
.is_err());
|
|
52
|
-
}
|
|
53
|
-
assert!(seat_actions(
|
|
54
|
-
Verb::Restart,
|
|
55
|
-
Observation::NativeReconcile,
|
|
56
|
-
false,
|
|
57
|
-
true,
|
|
58
|
-
false,
|
|
59
|
-
true
|
|
60
|
-
)
|
|
61
|
-
.unwrap()
|
|
62
|
-
.is_empty());
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
fn args(values: &[&str]) -> Vec<String> {
|
|
66
|
-
values.iter().map(|v| v.to_string()).collect()
|
|
67
|
-
}
|
|
68
|
-
pub(super) fn intent(verb: Verb) -> Intent {
|
|
69
|
-
Intent {
|
|
70
|
-
surface: Surface::Canonical,
|
|
71
|
-
verb,
|
|
72
|
-
subject: Subject::Agent(AgentId::new("one")),
|
|
73
|
-
workspace: PathBuf::from("/fixture"),
|
|
74
|
-
pinned_workspace: true,
|
|
75
|
-
team: Some("pinned".into()),
|
|
76
|
-
session: SessionPolicy::Preserve,
|
|
77
|
-
session_converge_deadline_ms: None,
|
|
78
|
-
dry_run: false,
|
|
79
|
-
json: true,
|
|
80
|
-
role_file: None,
|
|
81
|
-
patch: RoleConfigPatch::default(),
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
fn plan(verb: Verb, actions: &[&str]) -> Plan {
|
|
85
|
-
let intent = intent(verb);
|
|
86
|
-
let scope = ResolvedScope {
|
|
87
|
-
workspace: intent.workspace.clone(),
|
|
88
|
-
team: intent.team.clone(),
|
|
89
|
-
};
|
|
90
|
-
let steps = actions
|
|
91
|
-
.iter()
|
|
92
|
-
.map(|action| match *action {
|
|
93
|
-
"stop" => Step::StopAgent(StopAgentArgs {
|
|
94
|
-
agent: "one".into(),
|
|
95
|
-
workspace: scope.workspace.clone(),
|
|
96
|
-
team: scope.team.clone(),
|
|
97
|
-
json: true,
|
|
98
|
-
}),
|
|
99
|
-
_ => Step::StartAgent(StartAgentArgs {
|
|
100
|
-
agent: "one".into(),
|
|
101
|
-
workspace: scope.workspace.clone(),
|
|
102
|
-
team: scope.team.clone(),
|
|
103
|
-
force: false,
|
|
104
|
-
allow_fresh: false,
|
|
105
|
-
json: true,
|
|
106
|
-
role_config: RoleConfigPatch::default(),
|
|
107
|
-
}),
|
|
108
|
-
})
|
|
109
|
-
.collect();
|
|
110
|
-
Plan {
|
|
111
|
-
intent,
|
|
112
|
-
scope,
|
|
113
|
-
steps,
|
|
114
|
-
skipped: vec![],
|
|
115
|
-
no_eligible: None,
|
|
116
|
-
files: vec![],
|
|
117
|
-
expected: BTreeMap::new(),
|
|
118
|
-
topology: None,
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
#[test]
|
|
122
|
-
fn registered_truth_table_keeps_physics_configuration_and_intent_separate() {
|
|
123
|
-
use Observation::*;
|
|
124
|
-
use Verb::*;
|
|
125
|
-
for (verb, obs, expected) in [
|
|
126
|
-
(Start, Live, vec![]),
|
|
127
|
-
(Start, StoppedVerified, vec!["start"]),
|
|
128
|
-
(Start, Unstarted, vec!["start"]),
|
|
129
|
-
(Stop, Live, vec!["stop"]),
|
|
130
|
-
(Stop, StoppedVerified, vec![]),
|
|
131
|
-
(Restart, Live, vec!["stop", "start"]),
|
|
132
|
-
(Restart, StoppedVerified, vec!["start"]),
|
|
133
|
-
] {
|
|
134
|
-
assert_eq!(
|
|
135
|
-
seat_actions(verb, obs, false, false, false, false).unwrap(),
|
|
136
|
-
expected
|
|
137
|
-
);
|
|
138
|
-
}
|
|
139
|
-
for verb in [Start, Stop, Restart] {
|
|
140
|
-
assert!(seat_actions(verb, Unknown, false, false, false, false).is_err());
|
|
141
|
-
assert!(seat_actions(verb, Live, true, false, false, false).is_err());
|
|
142
|
-
}
|
|
143
|
-
assert!(seat_actions(Start, Live, false, false, true, false).is_err());
|
|
144
|
-
assert!(seat_actions(Start, Live, false, true, false, false).is_err());
|
|
145
|
-
assert!(seat_actions(Restart, Unstarted, false, false, false, false).is_err());
|
|
146
|
-
assert!(seat_actions(Start, Live, true, false, false, true)
|
|
147
|
-
.unwrap()
|
|
148
|
-
.is_empty());
|
|
149
|
-
assert!(seat_actions(Restart, Live, false, true, false, true)
|
|
150
|
-
.unwrap()
|
|
151
|
-
.is_empty());
|
|
152
|
-
assert_eq!(
|
|
153
|
-
seat_actions(Start, StoppedVerified, false, true, false, true).unwrap(),
|
|
154
|
-
["start"]
|
|
155
|
-
);
|
|
156
|
-
}
|
|
157
|
-
#[test]
|
|
158
|
-
fn explicit_stop_uses_existing_conservative_interpretation() {
|
|
159
|
-
for value in [json!(true), Value::Null, json!("false"), json!(0)] {
|
|
160
|
-
let row = json!({"explicit_stop":value});
|
|
161
|
-
assert!(crate::state::projection::agent_explicit_stop(&row));
|
|
162
|
-
}
|
|
163
|
-
for row in [json!({}), json!({"explicit_stop":false})] {
|
|
164
|
-
assert!(!crate::state::projection::agent_explicit_stop(&row));
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
#[test]
|
|
168
|
-
fn restart_executes_exact_pinned_stop_start_and_preserves_original_receipts() {
|
|
169
|
-
let calls = RefCell::new(Vec::new());
|
|
170
|
-
let result = execute_plan(
|
|
171
|
-
plan(Verb::Restart, &["stop", "start"]),
|
|
172
|
-
&mut |step| {
|
|
173
|
-
calls.borrow_mut().push(step.name());
|
|
174
|
-
Ok(CmdResult::from_json(
|
|
175
|
-
json!({"ok":true,"stopped":true,"start_mode":"resumed","original":17}),
|
|
176
|
-
true,
|
|
177
|
-
))
|
|
178
|
-
},
|
|
179
|
-
&mut |p, s, after_stop| {
|
|
180
|
-
assert_eq!(p.scope.team.as_deref(), Some("pinned"));
|
|
181
|
-
assert_eq!(s.agent(), Some("one"));
|
|
182
|
-
assert_eq!(after_stop, matches!(s, Step::StartAgent(_)));
|
|
183
|
-
Ok(())
|
|
184
|
-
},
|
|
185
|
-
)
|
|
186
|
-
.unwrap();
|
|
187
|
-
assert_eq!(*calls.borrow(), ["stop_agent", "start_agent"]);
|
|
188
|
-
let CmdOutput::Json(value) = result.output else {
|
|
189
|
-
panic!()
|
|
190
|
-
};
|
|
191
|
-
assert_eq!(value["steps"][1]["receipt"]["original"], 17);
|
|
192
|
-
assert_eq!(value["steps"][1]["mode"], "resumed");
|
|
193
|
-
}
|
|
194
|
-
#[test]
|
|
195
|
-
fn stop_failure_never_starts_and_spawn_failure_preserves_partial_uncertainty() {
|
|
196
|
-
for fail_at in [0, 1] {
|
|
197
|
-
let mut calls = Vec::new();
|
|
198
|
-
let result = execute_plan(
|
|
199
|
-
plan(Verb::Restart, &["stop", "start"]),
|
|
200
|
-
&mut |step| {
|
|
201
|
-
let n = calls.len();
|
|
202
|
-
calls.push(step.name());
|
|
203
|
-
Ok(CmdResult::from_json(
|
|
204
|
-
json!({"ok":n!=fail_at,"stopped":true,"error":"original refusal"}),
|
|
205
|
-
true,
|
|
206
|
-
))
|
|
207
|
-
},
|
|
208
|
-
&mut |_, _, _| Ok(()),
|
|
209
|
-
)
|
|
210
|
-
.unwrap();
|
|
211
|
-
assert_eq!(result.exit, ExitCode::Error);
|
|
212
|
-
assert_eq!(calls.len(), fail_at + 1);
|
|
213
|
-
let CmdOutput::Json(value) = result.output else {
|
|
214
|
-
panic!()
|
|
215
|
-
};
|
|
216
|
-
assert_eq!(
|
|
217
|
-
value["status"],
|
|
218
|
-
if fail_at == 0 { "failed" } else { "partial" }
|
|
219
|
-
);
|
|
220
|
-
assert_eq!(
|
|
221
|
-
value["steps"][fail_at]["receipt"]["error"],
|
|
222
|
-
"original refusal"
|
|
223
|
-
);
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
#[test]
|
|
227
|
-
fn owner_or_incarnation_change_interrupts_even_best_effort_start() {
|
|
228
|
-
let mut calls = 0;
|
|
229
|
-
let mut checks = 0;
|
|
230
|
-
let result = execute_plan(
|
|
231
|
-
plan(Verb::Start, &["start", "start"]),
|
|
232
|
-
&mut |_| {
|
|
233
|
-
calls += 1;
|
|
234
|
-
Ok(CmdResult::from_json(json!({"ok":true}), true))
|
|
235
|
-
},
|
|
236
|
-
&mut |_, _, _| {
|
|
237
|
-
checks += 1;
|
|
238
|
-
if checks == 2 {
|
|
239
|
-
Err(refusal("owner changed"))
|
|
240
|
-
} else {
|
|
241
|
-
Ok(())
|
|
242
|
-
}
|
|
243
|
-
},
|
|
244
|
-
)
|
|
245
|
-
.unwrap();
|
|
246
|
-
assert_eq!(calls, 1);
|
|
247
|
-
assert_eq!(result.exit, ExitCode::Error);
|
|
248
|
-
}
|
|
249
|
-
#[test]
|
|
250
|
-
fn role_change_between_stop_and_start_refuses_without_rollback_claim() {
|
|
251
|
-
let mut calls = 0;
|
|
252
|
-
let result = execute_plan(
|
|
253
|
-
plan(Verb::Restart, &["stop", "start"]),
|
|
254
|
-
&mut |_| {
|
|
255
|
-
calls += 1;
|
|
256
|
-
Ok(CmdResult::from_json(
|
|
257
|
-
json!({"ok":true,"stopped":true}),
|
|
258
|
-
true,
|
|
259
|
-
))
|
|
260
|
-
},
|
|
261
|
-
&mut |_, _, after_stop| {
|
|
262
|
-
if after_stop {
|
|
263
|
-
Err(refusal("role changed"))
|
|
264
|
-
} else {
|
|
265
|
-
Ok(())
|
|
266
|
-
}
|
|
267
|
-
},
|
|
268
|
-
)
|
|
269
|
-
.unwrap();
|
|
270
|
-
assert_eq!(calls, 1);
|
|
271
|
-
let CmdOutput::Json(value) = result.output else {
|
|
272
|
-
panic!()
|
|
273
|
-
};
|
|
274
|
-
assert_eq!(value["status"], "partial");
|
|
275
|
-
assert_eq!(value["last_confirmed_effect"], "original_instance_stopped");
|
|
276
|
-
assert_eq!(value["current_state"], "unknown");
|
|
277
|
-
}
|
|
278
|
-
#[test]
|
|
279
|
-
fn issue337_failed_handler_preserves_confirmed_and_uncertain_effects() {
|
|
280
|
-
for (coordinator, workers, confirmed) in [
|
|
281
|
-
("not_attempted", json!(["worker"]), true),
|
|
282
|
-
("attempted_unknown", json!([]), false),
|
|
283
|
-
] {
|
|
284
|
-
let result = execute_plan(
|
|
285
|
-
plan(Verb::Start, &["start"]),
|
|
286
|
-
&mut |_| Ok(CmdResult::from_json(json!({
|
|
287
|
-
"ok": false, "status": "partial", "error": "original failure",
|
|
288
|
-
"effects": {"worker_panes_started": workers, "coordinator_start": coordinator},
|
|
289
|
-
}), true)),
|
|
290
|
-
&mut |_, _, _| Ok(()),
|
|
291
|
-
).unwrap();
|
|
292
|
-
assert_eq!(result.exit, ExitCode::Error);
|
|
293
|
-
let CmdOutput::Json(value) = result.output else {
|
|
294
|
-
panic!()
|
|
295
|
-
};
|
|
296
|
-
assert_eq!(value["status"], "partial");
|
|
297
|
-
assert_eq!(value["steps"][0]["receipt"]["error"], "original failure");
|
|
298
|
-
assert_eq!(
|
|
299
|
-
value["effects"][0]["effects"]["coordinator_start"],
|
|
300
|
-
coordinator
|
|
301
|
-
);
|
|
302
|
-
assert_eq!(!value["last_confirmed_effect"].is_null(), confirmed);
|
|
303
|
-
let recovery = value["recovery"].as_str().unwrap();
|
|
304
|
-
assert!(recovery.contains("--workspace"));
|
|
305
|
-
assert!(recovery.contains("--team"));
|
|
306
|
-
assert!(recovery.contains("doctor"));
|
|
307
|
-
assert!(!recovery.contains("claim-leader"));
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
#[test]
|
|
312
|
-
fn issue337_zero_effect_refusal_is_explicit_at_top_without_hiding_prior_uncertainty() {
|
|
313
|
-
for prior_unknown in [false, true] {
|
|
314
|
-
let mut call = 0;
|
|
315
|
-
let actions = if prior_unknown {
|
|
316
|
-
vec!["start", "start"]
|
|
317
|
-
} else {
|
|
318
|
-
vec!["start"]
|
|
319
|
-
};
|
|
320
|
-
let result = execute_plan(
|
|
321
|
-
plan(Verb::Start, &actions),
|
|
322
|
-
&mut |_| {
|
|
323
|
-
call += 1;
|
|
324
|
-
let receipt = if prior_unknown && call == 1 {
|
|
325
|
-
json!({"ok":false,"error":"unclassified handler failure"})
|
|
326
|
-
} else {
|
|
327
|
-
json!({"ok":false,"status":"preflight_blocked",
|
|
328
|
-
"effects":{"worker_panes_started":[],"coordinator_start":"not_attempted"},
|
|
329
|
-
"next_actions":["run from the intended live Leader pane; no process was started"]})
|
|
330
|
-
};
|
|
331
|
-
Ok(CmdResult::from_json(receipt, true))
|
|
332
|
-
},
|
|
333
|
-
&mut |_, _, _| Ok(()),
|
|
334
|
-
).unwrap();
|
|
335
|
-
let CmdOutput::Json(value) = result.output else {
|
|
336
|
-
panic!()
|
|
337
|
-
};
|
|
338
|
-
assert_eq!(value["status"], "failed");
|
|
339
|
-
assert_eq!(
|
|
340
|
-
value["current_state"],
|
|
341
|
-
if prior_unknown {
|
|
342
|
-
"unknown"
|
|
343
|
-
} else {
|
|
344
|
-
"unchanged"
|
|
345
|
-
}
|
|
346
|
-
);
|
|
347
|
-
assert!(value["last_confirmed_effect"].is_null());
|
|
348
|
-
assert_eq!(
|
|
349
|
-
value["effects"][0]["effects"]["coordinator_start"],
|
|
350
|
-
"not_attempted"
|
|
351
|
-
);
|
|
352
|
-
let recovery = value["recovery"].as_str().unwrap();
|
|
353
|
-
if prior_unknown {
|
|
354
|
-
assert!(recovery.contains("doctor"));
|
|
355
|
-
assert!(!recovery.contains("no process was started"));
|
|
356
|
-
} else {
|
|
357
|
-
assert!(recovery.contains("live Leader pane"));
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
#[test]
|
|
363
|
-
fn dry_run_never_calls_handler_or_execution_admission() {
|
|
364
|
-
let mut plan = plan(Verb::Restart, &["stop", "start"]);
|
|
365
|
-
plan.intent.dry_run = true;
|
|
366
|
-
let result = execute_plan(plan, &mut |_| panic!("dry-run executed"), &mut |_, _, _| {
|
|
367
|
-
panic!("dry-run acquired execution admission")
|
|
368
|
-
})
|
|
369
|
-
.unwrap();
|
|
370
|
-
let CmdOutput::Json(value) = result.output else {
|
|
371
|
-
panic!()
|
|
372
|
-
};
|
|
373
|
-
assert_eq!(value["dry_run"], true);
|
|
374
|
-
assert_eq!(value["steps"].as_array().unwrap().len(), 2);
|
|
375
|
-
assert!(!value["deferred"].as_array().unwrap().is_empty());
|
|
376
|
-
}
|
|
377
|
-
#[test]
|
|
378
|
-
fn lexical_paths_never_use_dot_or_directory_existence_as_agent_inference() {
|
|
379
|
-
for id in ["reviewer", "reviewer.v2", "worker-1"] {
|
|
380
|
-
assert!(!path_syntax(id));
|
|
381
|
-
}
|
|
382
|
-
for path in [
|
|
383
|
-
".",
|
|
384
|
-
"..",
|
|
385
|
-
"./worker",
|
|
386
|
-
"/tmp/worker",
|
|
387
|
-
"a/b",
|
|
388
|
-
"a\\b",
|
|
389
|
-
"C:\\team",
|
|
390
|
-
] {
|
|
391
|
-
assert!(path_syntax(path));
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
#[test]
|
|
395
|
-
fn grammar_is_strict_and_payload_values_are_not_controls() {
|
|
396
|
-
for (schema, values) in [
|
|
397
|
-
("intent-start", vec!["one", "--force"]),
|
|
398
|
-
("intent-start", vec!["--from"]),
|
|
399
|
-
("intent-stop", vec!["one", "two"]),
|
|
400
|
-
("intent-stop", vec!["--session", "auto"]),
|
|
401
|
-
("intent-restart", vec!["one", "--model", "wrong"]),
|
|
402
|
-
("intent-restart", vec!["--session", "fresh"]),
|
|
403
|
-
(
|
|
404
|
-
"intent-start",
|
|
405
|
-
vec!["--workspace=missing", "--workspace=other"],
|
|
406
|
-
),
|
|
407
|
-
] {
|
|
408
|
-
assert!(super::super::arguments::parse(schema, &args(&values)).is_err());
|
|
409
|
-
}
|
|
410
|
-
let checked =
|
|
411
|
-
super::super::arguments::parse("intent-start", &args(&["one", "--prompt", "--help"]))
|
|
412
|
-
.unwrap();
|
|
413
|
-
assert!(!checked.help);
|
|
414
|
-
assert!(checked.tokens.contains(&"--prompt=--help".into()));
|
|
415
|
-
}
|
|
416
|
-
#[test]
|
|
417
|
-
fn frozen_legacy_restart_is_not_rerouted() {
|
|
418
|
-
let cwd = std::env::temp_dir();
|
|
419
|
-
for values in [
|
|
420
|
-
vec![],
|
|
421
|
-
vec!["--workspace", "/unread-by-bridge"],
|
|
422
|
-
vec!["./old-path"],
|
|
423
|
-
vec!["--allow-fresh"],
|
|
424
|
-
vec!["--help"],
|
|
425
|
-
] {
|
|
426
|
-
assert!(run("restart", &args(&values), &cwd).is_none());
|
|
427
|
-
}
|
|
428
|
-
for values in [vec!["--session", "auto", "--help"], vec!["one", "--help"]] {
|
|
429
|
-
assert!(run("restart", &args(&values), &cwd).unwrap().is_ok());
|
|
430
|
-
}
|
|
431
|
-
}
|
|
432
|
-
#[test]
|
|
433
|
-
fn canonical_help_and_invalid_flags_do_not_create_runtime() {
|
|
434
|
-
let root = Sandbox::new();
|
|
435
|
-
for command in ["start", "stop", "team", "agent"] {
|
|
436
|
-
assert_eq!(
|
|
437
|
-
run(command, &args(&["--help"]), root.path())
|
|
438
|
-
.unwrap()
|
|
439
|
-
.unwrap()
|
|
440
|
-
.exit,
|
|
441
|
-
ExitCode::Ok
|
|
442
|
-
);
|
|
443
|
-
}
|
|
444
|
-
assert!(run("start", &args(&["--workspaec", "x"]), root.path())
|
|
445
|
-
.unwrap()
|
|
446
|
-
.is_err());
|
|
447
|
-
assert!(run("stop", &args(&["./one"]), root.path())
|
|
448
|
-
.unwrap()
|
|
449
|
-
.is_err());
|
|
450
|
-
assert!(!root.path().join(".team").exists());
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
#[test]
|
|
454
|
-
fn delimiter_and_consumed_prompt_are_never_rendering_or_scope_controls() {
|
|
455
|
-
let checked =
|
|
456
|
-
super::super::arguments::parse("intent-start", &args(&["--", "--workspace=foreign"]))
|
|
457
|
-
.unwrap();
|
|
458
|
-
let (pos, flags) = options(&checked.tokens);
|
|
459
|
-
assert_eq!(pos, ["--workspace=foreign"]);
|
|
460
|
-
assert!(flags.is_empty());
|
|
461
|
-
assert!(!super::super::arguments::has_flag(
|
|
462
|
-
"start",
|
|
463
|
-
&args(&["one", "--prompt", "--json"]),
|
|
464
|
-
"--json"
|
|
465
|
-
));
|
|
466
|
-
assert!(!super::super::arguments::has_flag(
|
|
467
|
-
"agent",
|
|
468
|
-
&args(&["start", "one", "--prompt", "--json"]),
|
|
469
|
-
"--json"
|
|
470
|
-
));
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
#[test]
|
|
474
|
-
fn unconfirmed_stop_never_authorizes_a_restart_start_step() {
|
|
475
|
-
for receipt in [json!({"ok":true,"stopped":false}), json!({"ok":true})] {
|
|
476
|
-
let mut calls = 0;
|
|
477
|
-
let result = execute_plan(
|
|
478
|
-
plan(Verb::Restart, &["stop", "start"]),
|
|
479
|
-
&mut |_| {
|
|
480
|
-
calls += 1;
|
|
481
|
-
Ok(CmdResult::from_json(receipt.clone(), true))
|
|
482
|
-
},
|
|
483
|
-
&mut |_, _, _| Ok(()),
|
|
484
|
-
)
|
|
485
|
-
.unwrap();
|
|
486
|
-
assert_eq!(calls, 1);
|
|
487
|
-
assert_eq!(result.exit, ExitCode::Error);
|
|
488
|
-
let CmdOutput::Json(value) = result.output else {
|
|
489
|
-
panic!()
|
|
490
|
-
};
|
|
491
|
-
assert_eq!(value["steps"][0]["phase"], "stop_not_confirmed");
|
|
492
|
-
assert_eq!(value["status"], "failed");
|
|
493
|
-
}
|
|
494
|
-
}
|
|
495
|
-
|
|
496
|
-
#[test]
|
|
497
|
-
fn syntax_session_matrix_and_directory_ambiguity_are_deterministic() {
|
|
498
|
-
let root = Sandbox::new();
|
|
499
|
-
std::fs::create_dir(root.path().join("worker")).unwrap();
|
|
500
|
-
for (command, verb, input, agent, team, expected) in [
|
|
501
|
-
(
|
|
502
|
-
"start",
|
|
503
|
-
Verb::Start,
|
|
504
|
-
vec!["worker"],
|
|
505
|
-
false,
|
|
506
|
-
false,
|
|
507
|
-
SessionPolicy::Preserve,
|
|
508
|
-
),
|
|
509
|
-
(
|
|
510
|
-
"agent",
|
|
511
|
-
Verb::Restart,
|
|
512
|
-
vec!["worker"],
|
|
513
|
-
true,
|
|
514
|
-
false,
|
|
515
|
-
SessionPolicy::Auto,
|
|
516
|
-
),
|
|
517
|
-
(
|
|
518
|
-
"team",
|
|
519
|
-
Verb::Restart,
|
|
520
|
-
vec![],
|
|
521
|
-
false,
|
|
522
|
-
true,
|
|
523
|
-
SessionPolicy::Auto,
|
|
524
|
-
),
|
|
525
|
-
(
|
|
526
|
-
"restart",
|
|
527
|
-
Verb::Restart,
|
|
528
|
-
vec![],
|
|
529
|
-
false,
|
|
530
|
-
false,
|
|
531
|
-
SessionPolicy::Preserve,
|
|
532
|
-
),
|
|
533
|
-
(
|
|
534
|
-
"restart",
|
|
535
|
-
Verb::Restart,
|
|
536
|
-
vec!["--session=auto"],
|
|
537
|
-
false,
|
|
538
|
-
false,
|
|
539
|
-
SessionPolicy::Auto,
|
|
540
|
-
),
|
|
541
|
-
(
|
|
542
|
-
"agent",
|
|
543
|
-
Verb::Restart,
|
|
544
|
-
vec!["worker", "--session=preserve"],
|
|
545
|
-
true,
|
|
546
|
-
false,
|
|
547
|
-
SessionPolicy::Preserve,
|
|
548
|
-
),
|
|
549
|
-
(
|
|
550
|
-
"start",
|
|
551
|
-
Verb::Start,
|
|
552
|
-
vec!["worker", "--allow-fresh"],
|
|
553
|
-
false,
|
|
554
|
-
false,
|
|
555
|
-
SessionPolicy::Auto,
|
|
556
|
-
),
|
|
557
|
-
] {
|
|
558
|
-
let intent =
|
|
559
|
-
lifecycle_intent(command, verb, &args(&input), root.path(), agent, team).unwrap();
|
|
560
|
-
assert_eq!(intent.session, expected);
|
|
561
|
-
if input.first() == Some(&"worker") {
|
|
562
|
-
assert!(matches!(intent.subject, Subject::Agent(_)));
|
|
563
|
-
}
|
|
564
|
-
}
|
|
565
|
-
assert!(lifecycle_intent(
|
|
566
|
-
"restart",
|
|
567
|
-
Verb::Restart,
|
|
568
|
-
&args(&["worker"]),
|
|
569
|
-
root.path(),
|
|
570
|
-
false,
|
|
571
|
-
false
|
|
572
|
-
)
|
|
573
|
-
.is_err());
|
|
574
|
-
assert!(lifecycle_intent(
|
|
575
|
-
"restart",
|
|
576
|
-
Verb::Restart,
|
|
577
|
-
&args(&["--session=preserve", "--allow-fresh"]),
|
|
578
|
-
root.path(),
|
|
579
|
-
false,
|
|
580
|
-
false
|
|
581
|
-
)
|
|
582
|
-
.is_err());
|
|
583
|
-
assert!(lifecycle_intent(
|
|
584
|
-
"start",
|
|
585
|
-
Verb::Start,
|
|
586
|
-
&args(&["worker", "--from=worker"]),
|
|
587
|
-
root.path(),
|
|
588
|
-
false,
|
|
589
|
-
false
|
|
590
|
-
)
|
|
591
|
-
.is_err());
|
|
592
|
-
std::fs::create_dir(root.path().join("agents")).unwrap();
|
|
593
|
-
std::fs::write(root.path().join("TEAM.md"), "---\nname: caller\n---\n").unwrap();
|
|
594
|
-
let path_intent = lifecycle_intent(
|
|
595
|
-
"restart",
|
|
596
|
-
Verb::Restart,
|
|
597
|
-
&args(&["./worker", "--dry-run"]),
|
|
598
|
-
root.path(),
|
|
599
|
-
false,
|
|
600
|
-
false,
|
|
601
|
-
)
|
|
602
|
-
.unwrap();
|
|
603
|
-
assert_eq!(path_intent.workspace, root.path().join("worker"));
|
|
604
|
-
assert!(path_intent.pinned_workspace);
|
|
605
|
-
let role = root.path().join("role.md");
|
|
606
|
-
std::fs::write(&role, "fixture").unwrap();
|
|
607
|
-
let tokens = vec![
|
|
608
|
-
"one".into(),
|
|
609
|
-
format!("--workspace={}", root.path().join("worker").display()),
|
|
610
|
-
"--role-file=role.md".into(),
|
|
611
|
-
];
|
|
612
|
-
let intent =
|
|
613
|
-
lifecycle_intent("start", Verb::Start, &tokens, root.path(), false, false).unwrap();
|
|
614
|
-
assert_eq!(intent.role_file, Some(role));
|
|
615
|
-
assert!(lifecycle_intent(
|
|
616
|
-
"start",
|
|
617
|
-
Verb::Start,
|
|
618
|
-
&args(&["--from=role.md"]),
|
|
619
|
-
root.path(),
|
|
620
|
-
false,
|
|
621
|
-
false
|
|
622
|
-
)
|
|
623
|
-
.is_err());
|
|
624
|
-
assert!(lifecycle_intent(
|
|
625
|
-
"start",
|
|
626
|
-
Verb::Start,
|
|
627
|
-
&args(&["one", "--role-file=worker"]),
|
|
628
|
-
root.path(),
|
|
629
|
-
false,
|
|
630
|
-
false
|
|
631
|
-
)
|
|
632
|
-
.is_err());
|
|
633
|
-
}
|
|
634
|
-
|
|
635
|
-
#[test]
|
|
636
|
-
fn no_eligible_is_scoped_nonzero_with_skipped_and_zero_handlers_even_in_dry_run() {
|
|
637
|
-
for dry_run in [false, true] {
|
|
638
|
-
let mut p = plan(Verb::Start, &["start"]);
|
|
639
|
-
p.intent.dry_run = dry_run;
|
|
640
|
-
p.no_eligible = Some("all selected seats are paused");
|
|
641
|
-
p.skipped.push(json!({"agent":"one","reason":"paused"}));
|
|
642
|
-
let result = execute_plan(p, &mut |_| panic!("blocked handler"), &mut |_, _, _| {
|
|
643
|
-
panic!("blocked recheck")
|
|
644
|
-
})
|
|
645
|
-
.unwrap();
|
|
646
|
-
assert_eq!(result.exit, ExitCode::Error);
|
|
647
|
-
let CmdOutput::Json(value) = result.output else {
|
|
648
|
-
panic!()
|
|
649
|
-
};
|
|
650
|
-
assert_eq!(value["scope"]["team"], "pinned");
|
|
651
|
-
assert_eq!(value["status"], "no_eligible_agents");
|
|
652
|
-
assert_eq!(value["phase"], "planning");
|
|
653
|
-
assert_eq!(value["skipped"][0]["agent"], "one");
|
|
654
|
-
assert_eq!(value["skipped"][0]["reason"], "paused");
|
|
655
|
-
assert_eq!(value["steps"], json!([]));
|
|
656
|
-
assert_eq!(value["dry_run"], dry_run);
|
|
657
|
-
}
|
|
658
|
-
}
|
|
659
|
-
|
|
660
|
-
#[test]
|
|
661
|
-
fn accepted_pending_creation_keeps_original_receipt_and_actual_canonical_team() {
|
|
662
|
-
let mut p = plan(Verb::Start, &[]);
|
|
663
|
-
p.scope.team = None;
|
|
664
|
-
p.steps.push(Step::CreateTeam(QuickStartArgs {
|
|
665
|
-
workspace: PathBuf::from("/fixture"),
|
|
666
|
-
agents_dir: PathBuf::from("/fixture"),
|
|
667
|
-
name: None,
|
|
668
|
-
team_id: None,
|
|
669
|
-
yes: false,
|
|
670
|
-
json: true,
|
|
671
|
-
detail: true,
|
|
672
|
-
backend: None,
|
|
673
|
-
}));
|
|
674
|
-
let result = execute_plan(
|
|
675
|
-
p,
|
|
676
|
-
&mut |_| {
|
|
677
|
-
Ok(CmdResult::from_json(
|
|
678
|
-
json!({"ok":true,"status":"pending_tool_load","ready":false,"team":"actual-key"}),
|
|
679
|
-
true,
|
|
680
|
-
))
|
|
681
|
-
},
|
|
682
|
-
&mut |_, _, _| Ok(()),
|
|
683
|
-
)
|
|
684
|
-
.unwrap();
|
|
685
|
-
let CmdOutput::Json(value) = result.output else {
|
|
686
|
-
panic!()
|
|
687
|
-
};
|
|
688
|
-
assert_eq!(value["status"], "pending");
|
|
689
|
-
assert_eq!(value["scope"]["team"], "actual-key");
|
|
690
|
-
assert_eq!(value["steps"][0]["receipt"]["ready"], false);
|
|
691
|
-
}
|