@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,877 +0,0 @@
|
|
|
1
|
-
//! ---
|
|
2
|
-
//! purpose: lifecycle 的数据类型集中定义,newtype、枚举、报告结构、错误与事件名常量
|
|
3
|
-
//! contract:
|
|
4
|
-
//! provides:
|
|
5
|
-
//! - name: PlanId
|
|
6
|
-
//! what: 受正则约束的 plan 标识,构造时拒斜杠空格与路径穿越
|
|
7
|
-
//! - name: PlanCondition
|
|
8
|
-
//! what: plan 推进条件的封闭文法,只认 any 与 report_result 字段相等
|
|
9
|
-
//! - name: LifecycleError
|
|
10
|
-
//! what: 本模块所有对外错误的统一枚举
|
|
11
|
-
//! - name: CoordinatorStartSummary
|
|
12
|
-
//! what: coordinator 启动结果在 lifecycle 报告里的投影
|
|
13
|
-
//! - name: event_names
|
|
14
|
-
//! what: lifecycle/restart/display 稳定事件名常量集
|
|
15
|
-
//! depends:
|
|
16
|
-
//! - crate::model::ids
|
|
17
|
-
//! - crate::provider
|
|
18
|
-
//! - crate::transport
|
|
19
|
-
//! - crate::coordinator
|
|
20
|
-
//! boundary:
|
|
21
|
-
//! - 只定义类型与解析,不做 IO、不 spawn、不落盘
|
|
22
|
-
//! - 事件名只声明常量,实际写事件由各行为文件负责
|
|
23
|
-
//! maturity: wired
|
|
24
|
-
//! ---
|
|
25
|
-
//! lifecycle 数据类型:newtype / enum / data struct / error / outcome-report 集中定义。
|
|
26
|
-
|
|
27
|
-
use std::path::PathBuf;
|
|
28
|
-
|
|
29
|
-
use serde::{Deserialize, Serialize};
|
|
30
|
-
use thiserror::Error;
|
|
31
|
-
|
|
32
|
-
use crate::model::ids::AgentId;
|
|
33
|
-
use crate::provider::{RolloutPath, SessionId};
|
|
34
|
-
use crate::transport::SessionName;
|
|
35
|
-
|
|
36
|
-
// ===========================================================================
|
|
37
|
-
// CROSS-LANE PLACEHOLDERS(13/14/15 兄弟 lane 尚未交付;leader 集成时 reconcile)
|
|
38
|
-
// ===========================================================================
|
|
39
|
-
|
|
40
|
-
/// `EventLog` 已在 step4 落地,但 lifecycle 发射的 typed `EventKind` 名集(`lifecycle.*`/
|
|
41
|
-
/// `restart.*`/`display.*`)是 step4 owned 的稳定事件名(JSON 名与 Python 一致)。
|
|
42
|
-
/// **PLACEHOLDER**:此处仅命名 lifecycle 关心的事件名常量集,leader 集成时映射到
|
|
43
|
-
/// step4 `event_log::EventLog::write(name, fields)`。
|
|
44
|
-
pub mod event_names {
|
|
45
|
-
// lifecycle 步进事件(Gap 15/16:发射顺序被测试锁死)。
|
|
46
|
-
pub const ADD_STEP_COMPLETED: &str = "lifecycle.add_step_completed";
|
|
47
|
-
pub const ADD_STEP_ROLLED_BACK: &str = "lifecycle.add_step_rolled_back";
|
|
48
|
-
pub const ADD_FAILED: &str = "lifecycle.add_failed";
|
|
49
|
-
pub const REMOVE_STEP_COMPLETED: &str = "lifecycle.remove_step_completed";
|
|
50
|
-
pub const REMOVE_ROLLED_BACK: &str = "lifecycle.remove_rolled_back";
|
|
51
|
-
pub const CONTEXT_FORK: &str = "context_fork";
|
|
52
|
-
// restart 决策事件(Route B audit 契约必发)。
|
|
53
|
-
pub const RESTART_RESUME_DECISION: &str = "restart.resume_decision";
|
|
54
|
-
pub const RESTART_ATOMIC_REFUSAL: &str = "restart.atomic_refusal";
|
|
55
|
-
pub const RESTART_FIRST_SEND_AT_INVALID: &str = "restart.first_send_at_invalid";
|
|
56
|
-
pub const RESTART_FRESH_SPAWN: &str = "restart.fresh_spawn";
|
|
57
|
-
pub const RESTART_ROLLBACK_SESSION: &str = "restart.rollback_session";
|
|
58
|
-
// display 事件(C15/C16:每次降级非静默)。
|
|
59
|
-
pub const DISPLAY_BACKEND_RESOLVED: &str = "display.backend_resolved";
|
|
60
|
-
pub const DISPLAY_ADAPTIVE_OPENED: &str = "display.adaptive_opened";
|
|
61
|
-
pub const DISPLAY_ADAPTIVE_BLOCKED: &str = "display.adaptive_blocked";
|
|
62
|
-
pub const DISPLAY_ADAPTIVE_REBUILT: &str = "display.adaptive_rebuilt";
|
|
63
|
-
pub const DISPLAY_ADAPTIVE_CLOSED: &str = "display.adaptive_closed";
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// ===========================================================================
|
|
67
|
-
// NEWTYPES(card §3:散 str → newtype。`AgentId`/`SessionName` 复用既有;
|
|
68
|
-
// 此处新增 plan id / 派生 session 名)
|
|
69
|
-
// ===========================================================================
|
|
70
|
-
|
|
71
|
-
/// `PlanId`(`_PLAN_ID_RE = ^[A-Za-z0-9][A-Za-z0-9_.-]{0,63}$`,`orchestrator/state.py:11`)。
|
|
72
|
-
/// **必须 newtype**:防路径穿越(无 `/`、空格);`sanitize_plan_id` 拒绝则 `InvalidPlanId`。
|
|
73
|
-
#[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord, Serialize, Deserialize)]
|
|
74
|
-
#[serde(transparent)]
|
|
75
|
-
pub struct PlanId(String);
|
|
76
|
-
|
|
77
|
-
impl PlanId {
|
|
78
|
-
/// ---
|
|
79
|
-
/// purpose: 校验并构造 PlanId
|
|
80
|
-
/// params:
|
|
81
|
-
/// raw: 原始 plan 名,首字符须字母数字,其余只许字母数字与下划线点横线,长度不超过 64
|
|
82
|
-
/// returns: 通过校验的 PlanId
|
|
83
|
-
/// errors: 不满足上述形状时返回 InvalidPlanId
|
|
84
|
-
/// contract_id: lifecycle.types.plan_id_parse
|
|
85
|
-
/// ---
|
|
86
|
-
/// `sanitize_plan_id`(`orchestrator/state.py:18`):正则校验,失败 → `Err`。
|
|
87
|
-
pub fn parse(raw: &str) -> Result<Self, LifecycleError> {
|
|
88
|
-
let mut chars = raw.chars();
|
|
89
|
-
let first_ok = chars
|
|
90
|
-
.next()
|
|
91
|
-
.map(|c| c.is_ascii_alphanumeric())
|
|
92
|
-
.unwrap_or(false);
|
|
93
|
-
let rest_ok = chars.all(|c| c.is_ascii_alphanumeric() || matches!(c, '_' | '.' | '-'));
|
|
94
|
-
if first_ok && rest_ok && raw.len() <= 64 {
|
|
95
|
-
Ok(Self(raw.to_string()))
|
|
96
|
-
} else {
|
|
97
|
-
Err(LifecycleError::InvalidPlanId(format!(
|
|
98
|
-
"{raw:?} does not match ^[A-Za-z0-9][A-Za-z0-9_.-]{{0,63}}$; no slashes, spaces, or path-traversal segments are allowed"
|
|
99
|
-
)))
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
/// ---
|
|
103
|
-
/// purpose: 取 PlanId 的原始字符串
|
|
104
|
-
/// returns: 构造时保存的原文
|
|
105
|
-
/// ---
|
|
106
|
-
pub fn as_str(&self) -> &str {
|
|
107
|
-
&self.0
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
|
112
|
-
pub struct CoordinatorStartSummary {
|
|
113
|
-
pub ok: bool,
|
|
114
|
-
pub status: String,
|
|
115
|
-
pub pid: Option<u32>,
|
|
116
|
-
pub binary_path: Option<String>,
|
|
117
|
-
pub binary_version: Option<String>,
|
|
118
|
-
pub rotation_reason: Option<String>,
|
|
119
|
-
/// 0.5.41 Slice 3 (fault-invisibility-locate.md §5/§9 RED3): typed
|
|
120
|
-
/// binary-identity relation between caller and daemon that was
|
|
121
|
-
/// observed. Carried through from `StartReport` so restart/start
|
|
122
|
-
/// summaries keep `daemon_newer_than_caller` distinguishable from
|
|
123
|
-
/// a same-binary fresh daemon (both surface as `already_running`).
|
|
124
|
-
pub binary_identity_relation: String,
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
impl CoordinatorStartSummary {
|
|
128
|
-
/// ---
|
|
129
|
-
/// purpose: 把 coordinator 的 StartReport 投影成 lifecycle 报告用的摘要
|
|
130
|
-
/// params:
|
|
131
|
-
/// report: coordinator 启动返回的原始报告
|
|
132
|
-
/// returns: 摘要,status 已转成稳定 wire 字符串,binary_identity_relation 原样带出
|
|
133
|
-
/// ---
|
|
134
|
-
pub fn from_start_report(report: &crate::coordinator::StartReport) -> Self {
|
|
135
|
-
Self {
|
|
136
|
-
ok: report.ok,
|
|
137
|
-
status: coordinator_start_status_wire(report.status).to_string(),
|
|
138
|
-
pid: report.pid.map(|pid| pid.get()),
|
|
139
|
-
binary_path: report.binary_path.clone(),
|
|
140
|
-
binary_version: report.binary_version.clone(),
|
|
141
|
-
rotation_reason: report.rotation_reason.clone(),
|
|
142
|
-
binary_identity_relation: report.binary_identity_relation.as_str().to_string(),
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
fn coordinator_start_status_wire(status: crate::coordinator::StartOutcome) -> &'static str {
|
|
148
|
-
match status {
|
|
149
|
-
crate::coordinator::StartOutcome::AlreadyRunning => "already_running",
|
|
150
|
-
crate::coordinator::StartOutcome::RestartIncompatibleStopFailed => {
|
|
151
|
-
"restart_incompatible_stop_failed"
|
|
152
|
-
}
|
|
153
|
-
crate::coordinator::StartOutcome::SchemaIncompatible => "schema_incompatible",
|
|
154
|
-
crate::coordinator::StartOutcome::Started => "started",
|
|
155
|
-
crate::coordinator::StartOutcome::StartedAfterRotation => "started_after_rotation",
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
/// ---
|
|
160
|
-
/// purpose: 把 coordinator 启动摘要序列化成 JSON 对象
|
|
161
|
-
/// returns: 含 ok、status、pid、binary 路径与版本、rotation_reason、binary_identity_relation 的 JSON
|
|
162
|
-
/// ---
|
|
163
|
-
pub fn coordinator_start_summary_value(summary: &CoordinatorStartSummary) -> serde_json::Value {
|
|
164
|
-
serde_json::json!({
|
|
165
|
-
"ok": summary.ok,
|
|
166
|
-
"status": summary.status,
|
|
167
|
-
"pid": summary.pid,
|
|
168
|
-
"binary_path": summary.binary_path,
|
|
169
|
-
"binary_version": summary.binary_version,
|
|
170
|
-
"rotation_reason": summary.rotation_reason,
|
|
171
|
-
"binary_identity_relation": summary.binary_identity_relation,
|
|
172
|
-
})
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
impl std::fmt::Display for PlanId {
|
|
176
|
-
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
177
|
-
f.write_str(&self.0)
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
// ===========================================================================
|
|
182
|
-
// ENUM(card §3/§11:散字符串 → 穷尽 enum)
|
|
183
|
-
// ===========================================================================
|
|
184
|
-
|
|
185
|
-
/// `start_mode` / `restart_mode`(`start.py:179`,`orchestration.py:208`)。
|
|
186
|
-
/// **必须 enum**:start/restart 全程穷尽分支;`noop`(窗口已存在且非 force)只在
|
|
187
|
-
/// `start_agent` 出现。
|
|
188
|
-
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
|
189
|
-
#[serde(rename_all = "snake_case")]
|
|
190
|
-
pub enum StartMode {
|
|
191
|
-
Resumed,
|
|
192
|
-
Fresh,
|
|
193
|
-
FreshAfterMissingRollout,
|
|
194
|
-
Noop,
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
/// Route B resume 决策(`orchestration.py:498-505`)。每非 paused worker 发一条
|
|
198
|
-
/// `restart.resume_decision`;`Refuse` 是 atomic refusal 的唯一触发。
|
|
199
|
-
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
|
200
|
-
#[serde(rename_all = "snake_case")]
|
|
201
|
-
pub enum ResumeDecision {
|
|
202
|
-
Resume,
|
|
203
|
-
FreshStart,
|
|
204
|
-
Refuse,
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
/// `first_send_at` 严格分类(`_classify_first_send_at`,`orchestration.py:399-426`)。
|
|
208
|
-
/// **必须 enum + 严格解析**:显式拒空串 / `0` / `False` / `"null"` / 非 ISO;
|
|
209
|
-
/// garbage **hard refuse**,绝不靠 truthiness 把 `""` 当 absent 漏过去(陷阱)。
|
|
210
|
-
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
|
211
|
-
#[serde(rename_all = "snake_case")]
|
|
212
|
-
pub enum FirstSendAtState {
|
|
213
|
-
/// `null` / 缺失 —— worker 从未交互,可丢弃 fresh。
|
|
214
|
-
Absent,
|
|
215
|
-
/// 合法 ISO-8601 UTC 串。
|
|
216
|
-
Valid,
|
|
217
|
-
/// `""` / `0` / `False` / `"null"` / 非 ISO —— state.json 损坏,决策前 hard refuse。
|
|
218
|
-
Corrupt,
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
/// plan `status`(`orchestrator/__init__.py`)。**应 enum**:`start_plan` 对已
|
|
222
|
-
/// running/halted/completed 幂等返回。
|
|
223
|
-
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
|
224
|
-
#[serde(rename_all = "snake_case")]
|
|
225
|
-
pub enum PlanStatus {
|
|
226
|
-
Running,
|
|
227
|
-
Halted,
|
|
228
|
-
Completed,
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
/// 危险审批继承来源(`config.py:16` `dangerous_auto_approve_source`)。**应 enum**:
|
|
232
|
-
/// launch 在 `inherited=false` 且无 `--yes` 时 raise(`core.py:120`)。
|
|
233
|
-
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
|
234
|
-
#[serde(rename_all = "snake_case")]
|
|
235
|
-
pub enum DangerousApprovalSource {
|
|
236
|
-
RuntimeConfig,
|
|
237
|
-
LeaderProcess,
|
|
238
|
-
Disabled,
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
// ===========================================================================
|
|
242
|
-
// DATA STRUCT(restart 候选 / plan state / 危险审批)
|
|
243
|
-
// ===========================================================================
|
|
244
|
-
|
|
245
|
-
/// `RestartCandidate`(`restart/selection.py:27`)。`select_restart_state` 多 team 选择;
|
|
246
|
-
/// `has_context` 是 resume 可行性粗判。
|
|
247
|
-
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
|
248
|
-
pub struct RestartCandidate {
|
|
249
|
-
pub session_name: SessionName,
|
|
250
|
-
pub team_name: String,
|
|
251
|
-
pub state_path: PathBuf,
|
|
252
|
-
pub spec_path: PathBuf,
|
|
253
|
-
pub agents: Vec<AgentId>,
|
|
254
|
-
pub has_context: bool,
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
/// 危险审批继承态(`config.py:16` `dangerous_auto_approve{_source,_inherited,_provider,_flag}`)。
|
|
258
|
-
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
|
259
|
-
pub struct DangerousApproval {
|
|
260
|
-
pub enabled: bool,
|
|
261
|
-
pub source: DangerousApprovalSource,
|
|
262
|
-
pub inherited: bool,
|
|
263
|
-
pub provider: Option<String>,
|
|
264
|
-
pub flag: Option<String>,
|
|
265
|
-
pub worker_capability_above_leader: bool,
|
|
266
|
-
pub ancestry_binary_name: Option<String>,
|
|
267
|
-
pub unexpected_binary: bool,
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
/// `PlanState`(`orchestrator/__init__.py:51`)。plan 多 stage 状态机持久态。
|
|
271
|
-
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
|
272
|
-
pub struct PlanState {
|
|
273
|
-
pub plan_id: PlanId,
|
|
274
|
-
pub plan_path: PathBuf,
|
|
275
|
-
pub team: Option<String>,
|
|
276
|
-
pub current_stage: i64,
|
|
277
|
-
pub started_at: String,
|
|
278
|
-
pub completed_stages: Vec<String>,
|
|
279
|
-
pub status: PlanStatus,
|
|
280
|
-
pub halt_reason: Option<String>,
|
|
281
|
-
pub halt_artifact: Option<PathBuf>,
|
|
282
|
-
pub stages: Vec<PlanStage>,
|
|
283
|
-
pub current_dispatch: Option<String>,
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
/// 单 stage(`orchestrator/plan.py` stage mapping)。
|
|
287
|
-
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
|
288
|
-
pub struct PlanStage {
|
|
289
|
-
pub id: String,
|
|
290
|
-
pub assignee: Option<AgentId>,
|
|
291
|
-
pub prompt: Option<String>,
|
|
292
|
-
pub on_result: Option<PlanCondition>,
|
|
293
|
-
pub status: Option<String>,
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
/// plan 推进条件(封闭文法 `_CONDITION_RE`,`orchestrator/plan.py:9`)。
|
|
297
|
-
/// **必须 typed**:`any` | `report_result.<field> == '<value>'`;越界 → `InvalidPlan`。
|
|
298
|
-
/// 不做成自由表达式。
|
|
299
|
-
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
|
300
|
-
pub enum PlanCondition {
|
|
301
|
-
/// 无条件推进。
|
|
302
|
-
Any,
|
|
303
|
-
/// `report_result.<field> == '<value>'`。
|
|
304
|
-
FieldEq { field: String, value: String },
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
impl PlanCondition {
|
|
308
|
-
/// ---
|
|
309
|
-
/// purpose: 解析 plan 推进条件的封闭文法
|
|
310
|
-
/// params:
|
|
311
|
-
/// expr: any,或 report_result.<字段> == <值>,值须带单引号或双引号
|
|
312
|
-
/// returns: Any 或 FieldEq
|
|
313
|
-
/// errors: 前缀不对、缺等号、字段名非法或值未带引号时返回 InvalidPlan
|
|
314
|
-
/// contract_id: lifecycle.types.plan_condition_parse
|
|
315
|
-
/// ---
|
|
316
|
-
/// 解析封闭条件文法。越界 raise `InvalidPlan`(`orchestrator/plan.py:_is_supported_condition`)。
|
|
317
|
-
pub fn parse(expr: &str) -> Result<Self, LifecycleError> {
|
|
318
|
-
let trimmed = expr.trim();
|
|
319
|
-
if trimmed.eq_ignore_ascii_case("any") {
|
|
320
|
-
return Ok(Self::Any);
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
let Some(rest) = trimmed.strip_prefix("report_result.") else {
|
|
324
|
-
return Err(LifecycleError::InvalidPlan(format!(
|
|
325
|
-
"unsupported condition: {expr}"
|
|
326
|
-
)));
|
|
327
|
-
};
|
|
328
|
-
let Some((field, value_expr)) = rest.split_once("==") else {
|
|
329
|
-
return Err(LifecycleError::InvalidPlan(format!(
|
|
330
|
-
"unsupported condition: {expr}"
|
|
331
|
-
)));
|
|
332
|
-
};
|
|
333
|
-
let field = field.trim();
|
|
334
|
-
if field.is_empty() || !field.chars().all(|c| c.is_ascii_alphanumeric() || c == '_') {
|
|
335
|
-
return Err(LifecycleError::InvalidPlan(format!(
|
|
336
|
-
"unsupported condition: {expr}"
|
|
337
|
-
)));
|
|
338
|
-
}
|
|
339
|
-
let value_expr = value_expr.trim();
|
|
340
|
-
let value = if let Some(inner) = value_expr
|
|
341
|
-
.strip_prefix('\'')
|
|
342
|
-
.and_then(|v| v.strip_suffix('\''))
|
|
343
|
-
{
|
|
344
|
-
inner
|
|
345
|
-
} else if let Some(inner) = value_expr
|
|
346
|
-
.strip_prefix('"')
|
|
347
|
-
.and_then(|v| v.strip_suffix('"'))
|
|
348
|
-
{
|
|
349
|
-
inner
|
|
350
|
-
} else {
|
|
351
|
-
return Err(LifecycleError::InvalidPlan(format!(
|
|
352
|
-
"unsupported condition: {expr}"
|
|
353
|
-
)));
|
|
354
|
-
};
|
|
355
|
-
Ok(Self::FieldEq {
|
|
356
|
-
field: field.to_string(),
|
|
357
|
-
value: value.to_string(),
|
|
358
|
-
})
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
// ===========================================================================
|
|
363
|
-
// ERROR(card §10:fallible 边界;daemon/CLI 入口返 rich Result<Report, Error>)
|
|
364
|
-
// ===========================================================================
|
|
365
|
-
|
|
366
|
-
/// lifecycle 子系统错误。这里只装真失败:
|
|
367
|
-
/// owner-gate 拒绝、session 冲突、state 写崩(bug-084)、provider/transport I/O、回滚失败。
|
|
368
|
-
#[derive(Debug, Error)]
|
|
369
|
-
pub enum LifecycleError {
|
|
370
|
-
/// owner-gate 拒绝(foreign owner;`check_team_owner` 失败 —— lifecycle 第一道门)。
|
|
371
|
-
#[error("owner gate refused: {0}")]
|
|
372
|
-
OwnerRefused(String),
|
|
373
|
-
/// 同名 tmux session 已存在 —— **拒绝而非 kill**(`core.py:127`,`orchestration.py:79`)。
|
|
374
|
-
#[error("tmux session conflict: {0}")]
|
|
375
|
-
SessionConflict(String),
|
|
376
|
-
/// 危险自动审批未显式确认(`core.py:120`:inherited=false 且无 --yes)。
|
|
377
|
-
#[error("dangerous auto-approve requires explicit --yes: {0}")]
|
|
378
|
-
DangerousApprovalRequired(String),
|
|
379
|
-
/// 启动前门失败(`ensure_agent_start_requirements`:provider/profile/model check)。
|
|
380
|
-
#[error("agent start requirement unmet: {0}")]
|
|
381
|
-
RequirementUnmet(String),
|
|
382
|
-
/// state 持久化失败(bug-084:`os.replace` EACCES/EPERM/EBUSY 退避后仍败)。
|
|
383
|
-
#[error("state persistence failed: {0}")]
|
|
384
|
-
StatePersist(String),
|
|
385
|
-
/// workspace lifecycle transaction lock acquisition timed out.
|
|
386
|
-
#[error("error: lifecycle lock timeout after 30s\naction: retry or check for hung reset/start\nlog: {log_path}")]
|
|
387
|
-
LifecycleLockTimeout {
|
|
388
|
-
lock_path: PathBuf,
|
|
389
|
-
log_path: PathBuf,
|
|
390
|
-
operation: String,
|
|
391
|
-
waited_ms: u128,
|
|
392
|
-
},
|
|
393
|
-
/// 编译 spec / role doc 失败(`compile_team`/`compile_role_doc_agent`)。
|
|
394
|
-
#[error("spec compile failed: {0}")]
|
|
395
|
-
Compile(String),
|
|
396
|
-
/// Pi model/schema admission failed before lifecycle reservation or writes.
|
|
397
|
-
#[error("pi model preflight failed: {requested}")]
|
|
398
|
-
PiModelPreflight {
|
|
399
|
-
requested: String,
|
|
400
|
-
candidates: Vec<String>,
|
|
401
|
-
action: String,
|
|
402
|
-
not_ready: bool,
|
|
403
|
-
},
|
|
404
|
-
/// provider 命令构造 / resume 不可用(`ResumeUnavailable`)。
|
|
405
|
-
#[error("provider error: {0}")]
|
|
406
|
-
Provider(String),
|
|
407
|
-
/// transport I/O(tmux new-session / new-window / kill 等子进程失败)。
|
|
408
|
-
#[error("transport error: {0}")]
|
|
409
|
-
Transport(String),
|
|
410
|
-
/// 原子动作中途失败且**回滚也失败**(字节级回滚写回失败 —— Gap 15/16 最坏臂)。
|
|
411
|
-
#[error("rollback failed after {step}: {detail}")]
|
|
412
|
-
RollbackFailed { step: String, detail: String },
|
|
413
|
-
/// plan id 非法(`sanitize_plan_id` 拒绝;防路径穿越)。
|
|
414
|
-
#[error("invalid plan id: {0}")]
|
|
415
|
-
InvalidPlanId(String),
|
|
416
|
-
/// plan YAML 校验失败(`InvalidPlanError`)。
|
|
417
|
-
#[error("invalid plan: {0}")]
|
|
418
|
-
InvalidPlan(String),
|
|
419
|
-
/// 多 team 选择歧义 / 未找到(`select_restart_state`)。
|
|
420
|
-
#[error("team select: {0}")]
|
|
421
|
-
TeamSelect(String),
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
// ===========================================================================
|
|
425
|
-
// OUTCOME / REPORT(rich return — 契约断言这些 carry 的值)
|
|
426
|
-
// ===========================================================================
|
|
427
|
-
|
|
428
|
-
/// `launch(...)` 报告(`launch/core.py:294` 的 typed dict)。dry-run 时 `agents` 空、
|
|
429
|
-
/// `safety` 填充。
|
|
430
|
-
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
431
|
-
pub struct LaunchReport {
|
|
432
|
-
pub session_name: SessionName,
|
|
433
|
-
/// Legacy transport starts; their targets belong to the team transport.
|
|
434
|
-
pub started: Vec<StartedAgent>,
|
|
435
|
-
/// Committed contract starts, without fabricating legacy pane/window targets.
|
|
436
|
-
/// Empty on dry-run; populated only after the contract startup returns success.
|
|
437
|
-
pub contract_started: Vec<AgentId>,
|
|
438
|
-
/// 是否 dry-run(只解析路由/权限,不起进程)。
|
|
439
|
-
pub dry_run: bool,
|
|
440
|
-
/// Selected tmux endpoint for the team transport when known.
|
|
441
|
-
pub tmux_endpoint: Option<String>,
|
|
442
|
-
/// 路由决策(每 task 一条;`routing.decision` 事件)。
|
|
443
|
-
pub routes: Vec<RoutingDecision>,
|
|
444
|
-
/// leader receiver(attach 成功时;经 step10 leader::attach_leader_to_state)。
|
|
445
|
-
pub leader_receiver_attached: bool,
|
|
446
|
-
pub leader_bind_stage: Option<String>,
|
|
447
|
-
pub leader_bind_reason: Option<String>,
|
|
448
|
-
pub session_capture_incomplete_agents: Vec<String>,
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
/// 单个已起 worker(`launch` 的 `agents[]` / `started`)。
|
|
452
|
-
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
453
|
-
pub struct StartedAgent {
|
|
454
|
-
pub agent_id: AgentId,
|
|
455
|
-
pub start_mode: StartMode,
|
|
456
|
-
pub target: String,
|
|
457
|
-
pub spawned_at: String,
|
|
458
|
-
pub session_id: Option<SessionId>,
|
|
459
|
-
pub rollout_path: Option<RolloutPath>,
|
|
460
|
-
pub pending_session_id: Option<SessionId>,
|
|
461
|
-
pub claude_config_dir: Option<PathBuf>,
|
|
462
|
-
pub provider_projects_root: Option<PathBuf>,
|
|
463
|
-
pub managed_mcp_config: bool,
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
/// 路由决策(`routing.decision` 事件 / launch `routes[]`)。
|
|
467
|
-
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
468
|
-
pub struct RoutingDecision {
|
|
469
|
-
pub task_id: Option<String>,
|
|
470
|
-
pub selected_agent: AgentId,
|
|
471
|
-
pub reason: String,
|
|
472
|
-
pub manual_override: bool,
|
|
473
|
-
}
|
|
474
|
-
|
|
475
|
-
/// BUG-7 (0.3.1): quick-start cannot honestly report "ready" before the workers'
|
|
476
|
-
/// MCP tool sets have actually loaded — provider-side schema rejections (codex
|
|
477
|
-
/// invalid_function_parameters etc.) happen AFTER spawn and silently disable the
|
|
478
|
-
/// worker. The report must therefore carry a readiness verdict so the CLI surface
|
|
479
|
-
/// never emits bare "ready" while worker capability is unverified or already known
|
|
480
|
-
/// to be degraded.
|
|
481
|
-
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
482
|
-
pub enum QuickStartReadiness {
|
|
483
|
-
/// At least one agent already failed to materialize a live tmux window (BUG-2
|
|
484
|
-
/// observable). The team is *not* ready; user must inspect / restart.
|
|
485
|
-
Degraded { unhealthy_agents: Vec<String> },
|
|
486
|
-
/// All spawned agents have live windows but their MCP tool set load has NOT
|
|
487
|
-
/// been verified yet — provider-side schema/auth failures could still leave
|
|
488
|
-
/// the worker unable to call team_orchestrator tools. CLI must label this
|
|
489
|
-
/// `pending` / `unverified`, NOT bare `ready`.
|
|
490
|
-
PendingToolLoad,
|
|
491
|
-
}
|
|
492
|
-
|
|
493
|
-
/// `quick_start(...)` 报告(`diagnose/quick_start.py:103` typed 版)。`Refused` 区分
|
|
494
|
-
/// existing-context(需 restart 或 --fresh)与 preflight 失败。
|
|
495
|
-
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
496
|
-
pub enum QuickStartReport {
|
|
497
|
-
/// 起队成功 + wait_ready 就绪。
|
|
498
|
-
Ready {
|
|
499
|
-
session_name: SessionName,
|
|
500
|
-
launch: Box<LaunchReport>,
|
|
501
|
-
next_actions: Vec<String>,
|
|
502
|
-
attach_commands: Vec<String>,
|
|
503
|
-
/// BUG-7: real readiness verdict. `Ready` ⇒ the wrapper completed AND the
|
|
504
|
-
/// caller already verified tool-set availability; the framework itself
|
|
505
|
-
/// never emits this without an external observable confirming worker
|
|
506
|
-
/// tool calls succeeded. quick_start_with_transport always defaults to
|
|
507
|
-
/// [`QuickStartReadiness::PendingToolLoad`] (or `Degraded` if any agent
|
|
508
|
-
/// failed to spawn) so the CLI surface cannot lie about availability.
|
|
509
|
-
worker_readiness: QuickStartReadiness,
|
|
510
|
-
team: String,
|
|
511
|
-
},
|
|
512
|
-
/// Workers may exist, but post-spawn admission/coordinator completion failed.
|
|
513
|
-
/// Preserve confirmed effects; never disguise this as a preflight refusal.
|
|
514
|
-
Partial {
|
|
515
|
-
workspace: PathBuf,
|
|
516
|
-
session_name: SessionName,
|
|
517
|
-
launch: Box<LaunchReport>,
|
|
518
|
-
team: String,
|
|
519
|
-
error: String,
|
|
520
|
-
coordinator_state: String,
|
|
521
|
-
},
|
|
522
|
-
/// 已有 runtime state → quick-start 拒绝并引导用 restart。
|
|
523
|
-
ExistingRuntime {
|
|
524
|
-
team: Option<String>,
|
|
525
|
-
session_name: Option<SessionName>,
|
|
526
|
-
state_path: Option<PathBuf>,
|
|
527
|
-
next_actions: Vec<String>,
|
|
528
|
-
attach_commands: Vec<String>,
|
|
529
|
-
agent_ids: Vec<String>,
|
|
530
|
-
},
|
|
531
|
-
/// preflight 阻塞(`quick_start.py:59`)。
|
|
532
|
-
PreflightBlocked {
|
|
533
|
-
summary: String,
|
|
534
|
-
blockers: Vec<String>,
|
|
535
|
-
next_actions: Vec<String>,
|
|
536
|
-
attach_commands: Vec<String>,
|
|
537
|
-
},
|
|
538
|
-
}
|
|
539
|
-
|
|
540
|
-
/// 单 worker 动作通用 envelope(`{ok, agent_id, status, ...}`,`operations.py`/`agents.py`/
|
|
541
|
-
/// `start.py`)。status 的语义随动作不同,故各动作有专属 outcome enum 收口;此 struct
|
|
542
|
-
/// 是它们共享的字段载体。
|
|
543
|
-
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
544
|
-
pub struct AgentActionEnvelope {
|
|
545
|
-
pub agent_id: AgentId,
|
|
546
|
-
pub state_file: PathBuf,
|
|
547
|
-
/// coordinator 起后的报告(launch/start/fork/restart 末尾起 coordinator)。
|
|
548
|
-
pub coordinator_started: bool,
|
|
549
|
-
}
|
|
550
|
-
|
|
551
|
-
/// `start_agent(...)` 结果(`start.py:101/134/353`)。穷尽 start 路径。
|
|
552
|
-
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
553
|
-
pub enum StartAgentOutcome {
|
|
554
|
-
/// 起/复活成功,carry start_mode(resumed/fresh/fresh_after_missing_rollout)。
|
|
555
|
-
Running {
|
|
556
|
-
env: AgentActionEnvelope,
|
|
557
|
-
start_mode: StartMode,
|
|
558
|
-
target: String,
|
|
559
|
-
session_id: Option<SessionId>,
|
|
560
|
-
new_session_id: Option<SessionId>,
|
|
561
|
-
rollout_path: Option<RolloutPath>,
|
|
562
|
-
},
|
|
563
|
-
/// 窗口已存在且非 force → noop(`start.py:134`)。
|
|
564
|
-
Noop {
|
|
565
|
-
env: AgentActionEnvelope,
|
|
566
|
-
target: String,
|
|
567
|
-
},
|
|
568
|
-
/// agent paused → 不起(`start.py:101`,reason=agent_paused)。
|
|
569
|
-
Paused { agent_id: AgentId },
|
|
570
|
-
}
|
|
571
|
-
|
|
572
|
-
/// `stop_agent(...)` 结果(`operations.py:99`)。同时关显示(`test_stop_agent_display`)。
|
|
573
|
-
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
574
|
-
pub struct StopAgentReport {
|
|
575
|
-
pub agent_id: AgentId,
|
|
576
|
-
pub target: String,
|
|
577
|
-
/// 实际 kill 了的 window(已停则 false)。
|
|
578
|
-
pub stopped: bool,
|
|
579
|
-
pub display_closed: bool,
|
|
580
|
-
pub state_file: PathBuf,
|
|
581
|
-
}
|
|
582
|
-
|
|
583
|
-
/// `reset_agent(...)` 结果(`operations.py:104/133`)。**必须 `discard_session=true`**,
|
|
584
|
-
/// 否则 `Refused{ DiscardSessionRequired }`(`test_reset_agent_discard`)。
|
|
585
|
-
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
586
|
-
pub enum ResetAgentOutcome {
|
|
587
|
-
/// discard + 重起成功。
|
|
588
|
-
Reset {
|
|
589
|
-
env: AgentActionEnvelope,
|
|
590
|
-
start_mode: StartMode,
|
|
591
|
-
discarded_session_id: Option<SessionId>,
|
|
592
|
-
session_id: Option<SessionId>,
|
|
593
|
-
new_session_id: Option<SessionId>,
|
|
594
|
-
capture_state: String,
|
|
595
|
-
reset_proof: String,
|
|
596
|
-
weak_reset_warning: Option<String>,
|
|
597
|
-
},
|
|
598
|
-
/// 未传 discard_session → 拒绝(不丢上下文的误用保护)。
|
|
599
|
-
Refused { reason: ResetRefusal },
|
|
600
|
-
}
|
|
601
|
-
|
|
602
|
-
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
|
603
|
-
#[serde(rename_all = "snake_case")]
|
|
604
|
-
pub enum ResetRefusal {
|
|
605
|
-
DiscardSessionRequired,
|
|
606
|
-
}
|
|
607
|
-
|
|
608
|
-
/// `add_agent(...)` 结果(`operations.py:272`)。动态 role doc 编译进 spec + 起 worker;
|
|
609
|
-
/// 失败字节级回滚 spec_yaml / workspace_state / **team_state.md** / role_file(Gap 15.11)。
|
|
610
|
-
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
611
|
-
pub struct AddAgentReport {
|
|
612
|
-
pub env: AgentActionEnvelope,
|
|
613
|
-
pub start_mode: StartMode,
|
|
614
|
-
/// 写入的动态 role file 路径。
|
|
615
|
-
pub role_file: PathBuf,
|
|
616
|
-
}
|
|
617
|
-
|
|
618
|
-
/// `fork_agent(...)` 结果。Pi 的 snapshot fork 附带可审计的 source/target backing 细节;
|
|
619
|
-
/// 已支持的其他 provider 保持既有报告字段。
|
|
620
|
-
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
621
|
-
pub struct ForkAgentReport {
|
|
622
|
-
pub source_agent_id: AgentId,
|
|
623
|
-
pub new_agent_id: AgentId,
|
|
624
|
-
pub env: AgentActionEnvelope,
|
|
625
|
-
pub session_id: Option<SessionId>,
|
|
626
|
-
pub backing_state: ForkBackingState,
|
|
627
|
-
pub pi_fork: Option<PiForkDetails>,
|
|
628
|
-
}
|
|
629
|
-
|
|
630
|
-
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
631
|
-
pub struct PiForkDetails {
|
|
632
|
-
pub source_session_id: SessionId,
|
|
633
|
-
pub session_id: SessionId,
|
|
634
|
-
pub backing_path: RolloutPath,
|
|
635
|
-
}
|
|
636
|
-
|
|
637
|
-
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
|
638
|
-
#[serde(rename_all = "snake_case")]
|
|
639
|
-
pub enum ForkBackingState {
|
|
640
|
-
Verified,
|
|
641
|
-
PendingContextFork,
|
|
642
|
-
}
|
|
643
|
-
|
|
644
|
-
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
645
|
-
pub struct CloneAgentReport {
|
|
646
|
-
pub source_agent_id: AgentId,
|
|
647
|
-
pub new_agent_id: AgentId,
|
|
648
|
-
pub env: AgentActionEnvelope,
|
|
649
|
-
pub session_id: Option<SessionId>,
|
|
650
|
-
pub backing_path: Option<PathBuf>,
|
|
651
|
-
pub backing_state: CloneBackingState,
|
|
652
|
-
}
|
|
653
|
-
|
|
654
|
-
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
|
655
|
-
#[serde(rename_all = "snake_case")]
|
|
656
|
-
pub enum CloneBackingState {
|
|
657
|
-
Verified,
|
|
658
|
-
PendingFirstTurn,
|
|
659
|
-
}
|
|
660
|
-
|
|
661
|
-
/// Read-only remove-agent flag requirements for the target's current state.
|
|
662
|
-
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
663
|
-
pub struct RemoveAgentFlagRequirements {
|
|
664
|
-
pub agent_id: AgentId,
|
|
665
|
-
pub from_spec_required: bool,
|
|
666
|
-
pub force_required: bool,
|
|
667
|
-
pub has_session: bool,
|
|
668
|
-
}
|
|
669
|
-
|
|
670
|
-
/// `remove_agent(...)` 结果(`agents.py:54/56/150`)。`_RemoveRollback` 快照
|
|
671
|
-
/// spec/state/team_state/role_file/agent_health 字节级回滚(Gap 16)。
|
|
672
|
-
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
673
|
-
pub enum RemoveAgentOutcome {
|
|
674
|
-
/// 原子摘除成功(spec/state/team_state/role-file/agent_health 全删)。
|
|
675
|
-
Removed {
|
|
676
|
-
agent_id: AgentId,
|
|
677
|
-
state_file: PathBuf,
|
|
678
|
-
/// GC 掉的 agent_health 行(`test_remove_agent_health_gc`)。
|
|
679
|
-
agent_health_deleted: bool,
|
|
680
|
-
},
|
|
681
|
-
/// 未传 from_spec 确认(`agents.py:54`)。
|
|
682
|
-
RefusedFromSpecConfirm { agent_id: AgentId },
|
|
683
|
-
/// 运行中未传 force(`agents.py:56`)。
|
|
684
|
-
RefusedForceRequired { agent_id: AgentId },
|
|
685
|
-
/// Multiple required destructive flags are absent; report them together.
|
|
686
|
-
RefusedRequiredFlags {
|
|
687
|
-
agent_id: AgentId,
|
|
688
|
-
from_spec_required: bool,
|
|
689
|
-
force_required: bool,
|
|
690
|
-
},
|
|
691
|
-
}
|
|
692
|
-
|
|
693
|
-
/// `restart(...)` 结果(`orchestration.py:114/142/387`)。Route B:**先全量验证**
|
|
694
|
-
/// (resume 决策 + first_send_at 校验)**再**破坏性 teardown。refuse 时 nothing created。
|
|
695
|
-
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
696
|
-
pub enum RestartReport {
|
|
697
|
-
/// 整队重建成功。每 worker 已发 `restart.resume_decision`。
|
|
698
|
-
Restarted {
|
|
699
|
-
session_name: SessionName,
|
|
700
|
-
agents: Vec<RestartedAgent>,
|
|
701
|
-
/// Compatibility field: true means the coordinator requirement is
|
|
702
|
-
/// satisfied. The structured `coordinator` summary carries started vs
|
|
703
|
-
/// already-running vs rotated detail.
|
|
704
|
-
coordinator_started: bool,
|
|
705
|
-
coordinator: CoordinatorStartSummary,
|
|
706
|
-
next_actions: Vec<String>,
|
|
707
|
-
attach_commands: Vec<String>,
|
|
708
|
-
/// Debt returned by this restart's best-effort auto-attach, if any.
|
|
709
|
-
attach_window_failures: Option<serde_json::Value>,
|
|
710
|
-
leader_bind_ok: bool,
|
|
711
|
-
leader_bind_reason: Option<String>,
|
|
712
|
-
},
|
|
713
|
-
/// At least one worker failed during live spawn, but other workers were isolated
|
|
714
|
-
/// and restarted. The CLI reports `status=partial` and exits non-zero.
|
|
715
|
-
Partial {
|
|
716
|
-
session_name: SessionName,
|
|
717
|
-
agents: Vec<RestartedAgent>,
|
|
718
|
-
failed_agents: Vec<RestartFailedAgent>,
|
|
719
|
-
/// Compatibility field: true means the coordinator requirement is
|
|
720
|
-
/// satisfied. The structured `coordinator` summary carries started vs
|
|
721
|
-
/// already-running vs rotated detail.
|
|
722
|
-
coordinator_started: bool,
|
|
723
|
-
coordinator: CoordinatorStartSummary,
|
|
724
|
-
next_actions: Vec<String>,
|
|
725
|
-
attach_commands: Vec<String>,
|
|
726
|
-
/// Debt returned by this restart's best-effort auto-attach, if any.
|
|
727
|
-
attach_window_failures: Option<serde_json::Value>,
|
|
728
|
-
leader_bind_ok: bool,
|
|
729
|
-
leader_bind_reason: Option<String>,
|
|
730
|
-
},
|
|
731
|
-
/// All workers failed during live spawn. No worker is reported as restarted.
|
|
732
|
-
Failed {
|
|
733
|
-
session_name: SessionName,
|
|
734
|
-
failed_agents: Vec<RestartFailedAgent>,
|
|
735
|
-
next_actions: Vec<String>,
|
|
736
|
-
attach_commands: Vec<String>,
|
|
737
|
-
},
|
|
738
|
-
/// atomic refusal(`reason=resume_atomicity`):某 interacted worker 不可 resume
|
|
739
|
-
/// 且非 allow_fresh。**nothing created yet**,无需回滚。
|
|
740
|
-
RefusedResumeAtomicity {
|
|
741
|
-
unresumable: Vec<UnresumableWorker>,
|
|
742
|
-
allow_fresh: bool,
|
|
743
|
-
error: String,
|
|
744
|
-
},
|
|
745
|
-
/// session capture did not converge before destructive restart. No teardown/spawn occurred.
|
|
746
|
-
RefusedResumeNotReady {
|
|
747
|
-
missing: Vec<AgentId>,
|
|
748
|
-
allow_fresh: bool,
|
|
749
|
-
deadline: std::time::Duration,
|
|
750
|
-
elapsed: std::time::Duration,
|
|
751
|
-
error: String,
|
|
752
|
-
},
|
|
753
|
-
/// first_send_at 损坏(`reason=invalid_first_send_at`):决策前 hard refuse。
|
|
754
|
-
RefusedInvalidFirstSendAt {
|
|
755
|
-
invalid: Vec<CorruptFirstSendAt>,
|
|
756
|
-
allow_fresh: bool,
|
|
757
|
-
error: String,
|
|
758
|
-
},
|
|
759
|
-
/// 0.5.40 Slice 3 (tmux-server-death-locate §7 Slice 3, first-version
|
|
760
|
-
/// all-or-refuse): the previous worker session is still live AND state
|
|
761
|
-
/// carries running agents with real pane_ids. Restart today can only
|
|
762
|
-
/// proceed by killing the live session first — which loses provider
|
|
763
|
-
/// session state in the worker panes and, worse, can cascade into
|
|
764
|
-
/// server death under Case B. Until the build-before-destroy path
|
|
765
|
-
/// (later car: temporary session + minimal-viability proof + swap)
|
|
766
|
-
/// lands, restart refuses this shape *before* touching tmux or state.
|
|
767
|
-
/// **nothing created or killed; state.agents rows are byte-identical
|
|
768
|
-
/// to what was seeded before the call.**
|
|
769
|
-
RefusedBuildBeforeDestroyRequired {
|
|
770
|
-
/// Live worker session name from state that would need destructive
|
|
771
|
-
/// rebuild.
|
|
772
|
-
session_name: String,
|
|
773
|
-
/// Snapshot of agent ids currently running with real pane_ids —
|
|
774
|
-
/// this is the "authoritative old state" the refusal preserves.
|
|
775
|
-
live_agents: Vec<String>,
|
|
776
|
-
/// Human-readable error pointing the user at the canonical recovery
|
|
777
|
-
/// path (bare shutdown then restart).
|
|
778
|
-
error: String,
|
|
779
|
-
},
|
|
780
|
-
/// unit-3 (Stage 1): session-identity preflight refused — `state.session_name`
|
|
781
|
-
/// is a leader launcher session (`team-agent-leader-*`). Proceeding would
|
|
782
|
-
/// tear down the leader pane (E49 / 0.3.39). **nothing created or killed**.
|
|
783
|
-
RefusedDirtyTopology {
|
|
784
|
-
/// The session name that failed the preflight, verbatim from state.
|
|
785
|
-
session_name: String,
|
|
786
|
-
/// Stable machine-readable reason (currently
|
|
787
|
-
/// `"worker_session_is_leader_session"`).
|
|
788
|
-
reason: String,
|
|
789
|
-
/// Human-readable error directing the user to a recovery action.
|
|
790
|
-
error: String,
|
|
791
|
-
/// Stable topology issue ids surfaced by CLI/diagnose.
|
|
792
|
-
issue_ids: Vec<String>,
|
|
793
|
-
},
|
|
794
|
-
}
|
|
795
|
-
|
|
796
|
-
/// 单个重建后的 worker(carry restart_mode)。
|
|
797
|
-
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
798
|
-
pub struct RestartedAgent {
|
|
799
|
-
pub agent_id: AgentId,
|
|
800
|
-
pub restart_mode: StartMode,
|
|
801
|
-
pub decision: ResumeDecision,
|
|
802
|
-
pub session_id: Option<SessionId>,
|
|
803
|
-
}
|
|
804
|
-
|
|
805
|
-
/// Worker restart failure isolated from the rest of the restart pass.
|
|
806
|
-
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
807
|
-
pub struct RestartFailedAgent {
|
|
808
|
-
pub agent_id: AgentId,
|
|
809
|
-
pub restart_mode: StartMode,
|
|
810
|
-
pub decision: ResumeDecision,
|
|
811
|
-
pub session_id: Option<SessionId>,
|
|
812
|
-
pub phase: String,
|
|
813
|
-
pub error: String,
|
|
814
|
-
}
|
|
815
|
-
|
|
816
|
-
/// atomic refusal 里的不可重建 worker(`orchestration.py:517`)。
|
|
817
|
-
///
|
|
818
|
-
/// unit-5 (Stage 2): `reason` 是历史 free-form 字符串,JSON/CLI 直接吃它;新增
|
|
819
|
-
/// `refusal_reason` 携带 unit-5 的 closed enum(`provider::session::ResumeRefusalReason`)
|
|
820
|
-
/// 同源 wire 字符串。两者必须 round-trip 一致(see `ResumeRefusalReason::wire`)。
|
|
821
|
-
/// 旧调用方读 `reason` 不变;新调用方走 enum 拿到结构化原因。
|
|
822
|
-
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
823
|
-
pub struct UnresumableWorker {
|
|
824
|
-
pub agent_id: AgentId,
|
|
825
|
-
/// `no_persisted_session_id` | `session_unresumable` | `session_backing_store_missing` | …
|
|
826
|
-
pub reason: String,
|
|
827
|
-
/// unit-5 structured refusal (optional during migration; populated alongside `reason`).
|
|
828
|
-
pub refusal_reason: Option<crate::provider::session::ResumeRefusalReason>,
|
|
829
|
-
pub session_id: Option<SessionId>,
|
|
830
|
-
pub first_send_at: Option<String>,
|
|
831
|
-
}
|
|
832
|
-
|
|
833
|
-
/// first_send_at 损坏条目(`restart.first_send_at_invalid` 事件 payload)。
|
|
834
|
-
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
835
|
-
pub struct CorruptFirstSendAt {
|
|
836
|
-
pub worker_id: AgentId,
|
|
837
|
-
pub raw_first_send_at: serde_json::Value,
|
|
838
|
-
pub raw_first_send_at_type: String,
|
|
839
|
-
}
|
|
840
|
-
|
|
841
|
-
/// Route B 全量验证产物(`_emit_resume_decisions` + `_collect_corrupt_first_send_at`,
|
|
842
|
-
/// `orchestration.py:430/467`)。restart() **先**算它(纯计算,无副作用),corrupt 非空则
|
|
843
|
-
/// hard-refuse;否则按 decisions/unresumable 决定 teardown。把"每非 paused worker 发一条
|
|
844
|
-
/// `restart.resume_decision`" 与 "python type().__name__ 映射" 从 start_agent 的整条
|
|
845
|
-
/// lock+spawn 路径里**分离出来**,使 Route B audit 契约可在 fixture state 上单元级断言
|
|
846
|
-
/// (gate gap:restart() 只返回终态 RestartReport,缺隔离测试面)。
|
|
847
|
-
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
848
|
-
pub struct RestartPlan {
|
|
849
|
-
/// 每非 paused worker 一条决策(顺序 = restart_agents 顺序);Route B audit 契约必发。
|
|
850
|
-
pub decisions: Vec<RestartedAgent>,
|
|
851
|
-
/// first_send_at 损坏条目(决策前 hard-refuse 的依据;carry python type-name)。
|
|
852
|
-
pub corrupt_entries: Vec<CorruptFirstSendAt>,
|
|
853
|
-
/// allow_fresh=false 且 interacted-but-unresumable 的 worker(atomic_refusal 触发集)。
|
|
854
|
-
pub unresumable: Vec<UnresumableWorker>,
|
|
855
|
-
}
|
|
856
|
-
|
|
857
|
-
/// plan 状态机推进结果(`orchestrator/__init__.py` start_plan / handle_report_result /
|
|
858
|
-
/// halt_plan 的 typed 版)。
|
|
859
|
-
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
860
|
-
pub enum PlanProgress {
|
|
861
|
-
/// 仍运行,当前 stage。
|
|
862
|
-
Running {
|
|
863
|
-
plan_id: PlanId,
|
|
864
|
-
current_stage: i64,
|
|
865
|
-
state_path: PathBuf,
|
|
866
|
-
},
|
|
867
|
-
/// 全 stage 完成。
|
|
868
|
-
Completed { plan_id: PlanId },
|
|
869
|
-
/// halted(carry reason + artifact)。
|
|
870
|
-
Halted {
|
|
871
|
-
plan_id: PlanId,
|
|
872
|
-
reason: String,
|
|
873
|
-
artifact: Option<PathBuf>,
|
|
874
|
-
},
|
|
875
|
-
/// report_result 不匹配任何 stage 条件 → no-op(`__init__.py:96`)。
|
|
876
|
-
NoMatch,
|
|
877
|
-
}
|