@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,370 +0,0 @@
|
|
|
1
|
-
//! ---
|
|
2
|
-
//! purpose: 从 spec 里的一个 agent 定义,编译出 worker 启动所需的系统提示词
|
|
3
|
-
//! contract:
|
|
4
|
-
//! provides:
|
|
5
|
-
//! - name: WorkerCommandAgent
|
|
6
|
-
//! what: 从 YAML 或 JSON 读出的单 agent 命令上下文
|
|
7
|
-
//! - name: compile_worker_system_prompt
|
|
8
|
-
//! what: 按身份、runtime 契约、通信模式、角色正文、输出契约、权限说明拼系统提示词
|
|
9
|
-
//! depends:
|
|
10
|
-
//! - crate::communication_mode
|
|
11
|
-
//! boundary:
|
|
12
|
-
//! - 只产出字符串,不 spawn 进程、不写盘
|
|
13
|
-
//! - bypass 只认 agent 自身声明,不从 team/runtime/leader argv 继承
|
|
14
|
-
//! - provider 没有 bypass argv 定义时报错,不静默降级
|
|
15
|
-
//! maturity: wired
|
|
16
|
-
//! ---
|
|
17
|
-
use std::path::Path;
|
|
18
|
-
|
|
19
|
-
use crate::communication_mode::CommunicationMode;
|
|
20
|
-
use crate::lifecycle::types::LifecycleError;
|
|
21
|
-
use crate::model::enums::Provider;
|
|
22
|
-
|
|
23
|
-
const RUNTIME_CONTRACT_SECTION: &str = r#"# Team Agent Teammate Runtime Contract
|
|
24
|
-
|
|
25
|
-
You are a Team Agent teammate; leader cannot see terminal output.
|
|
26
|
-
All communication must go through Team Agent MCP tools.
|
|
27
|
-
|
|
28
|
-
## Communication:
|
|
29
|
-
|
|
30
|
-
- Teammate: {send_message}(to='<agent_id>', content='...')
|
|
31
|
-
- Broadcast: {send_message}(to='*', content='...')
|
|
32
|
-
- Complete: {report_result}(summary='...') — call exactly once
|
|
33
|
-
- Optional roster/status: {get_team_status} — use only when useful; it is not a communication or completion prerequisite.
|
|
34
|
-
|
|
35
|
-
Only these three Team Agent MCP tools are available. Lifecycle management remains on the separately authorized operator CLI.
|
|
36
|
-
|
|
37
|
-
## Rules:
|
|
38
|
-
|
|
39
|
-
- Do not pass sender, task_id, or schema_version — MCP fills them.
|
|
40
|
-
- Do not reply to pure ACKs, greetings, or unchanged status notices (such as "paused" or "waiting"); after reporting a blocker once or completing a task, remain silent until a new actionable instruction arrives.
|
|
41
|
-
- On 500/529/rate limits, retry only after 1-2 minutes."#;
|
|
42
|
-
|
|
43
|
-
// 0.4.11 trimmed: the runtime contract section above already covers
|
|
44
|
-
// send_message signatures and report_result exactly-once. The output
|
|
45
|
-
// contract now only carries the RESULT-ENVELOPE-SPECIFIC delivery
|
|
46
|
-
// semantics (leader-attach dependence + fallback status) that the
|
|
47
|
-
// generic runtime section deliberately leaves out.
|
|
48
|
-
const RESULT_ENVELOPE_OUTPUT_CONTRACT: &str =
|
|
49
|
-
"Final completion must call {report_result} exactly once with a short summary \
|
|
50
|
-
and optional status/changes/tests; the MCP runtime injects the result into the attached leader pane. \
|
|
51
|
-
If no leader is attached, the tool returns a fallback/failed result instead of completion.";
|
|
52
|
-
|
|
53
|
-
pub(crate) struct WorkerCommandAgent {
|
|
54
|
-
id: Option<String>,
|
|
55
|
-
provider: Provider,
|
|
56
|
-
role: Option<String>,
|
|
57
|
-
system_prompt_inline: Option<String>,
|
|
58
|
-
system_prompt_file: Option<String>,
|
|
59
|
-
output_contract_format: Option<String>,
|
|
60
|
-
communication_mode: CommunicationMode,
|
|
61
|
-
/// Missing `dangerously_skip_permissions` defaults to false; only explicit true enables bypass.
|
|
62
|
-
dangerously_skip_permissions: bool,
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
impl WorkerCommandAgent {
|
|
66
|
-
/// ---
|
|
67
|
-
/// purpose: 从 spec 的 YAML agent 节点读出命令上下文
|
|
68
|
-
/// params:
|
|
69
|
-
/// agent: 单个 agent 的 YAML 节点
|
|
70
|
-
/// fallback_id: agent 节点没写 id 时的兜底 id
|
|
71
|
-
/// provider: 已解析的 provider
|
|
72
|
-
/// returns: 填好的 WorkerCommandAgent
|
|
73
|
-
/// errors: communication_mode 取值非法时返回 LifecycleError
|
|
74
|
-
/// contract_id: lifecycle.worker_command_agent.from_source
|
|
75
|
-
/// ---
|
|
76
|
-
pub(crate) fn from_yaml(
|
|
77
|
-
agent: &crate::model::yaml::Value,
|
|
78
|
-
fallback_id: Option<&str>,
|
|
79
|
-
provider: Provider,
|
|
80
|
-
) -> Result<Self, LifecycleError> {
|
|
81
|
-
let system_prompt = agent.get("system_prompt");
|
|
82
|
-
Ok(Self {
|
|
83
|
-
id: agent
|
|
84
|
-
.get("id")
|
|
85
|
-
.and_then(crate::model::yaml::Value::as_str)
|
|
86
|
-
.or(fallback_id)
|
|
87
|
-
.map(str::to_string),
|
|
88
|
-
provider,
|
|
89
|
-
role: agent
|
|
90
|
-
.get("role")
|
|
91
|
-
.and_then(crate::model::yaml::Value::as_str)
|
|
92
|
-
.map(str::to_string),
|
|
93
|
-
system_prompt_inline: system_prompt
|
|
94
|
-
.and_then(|prompt| prompt.get("inline"))
|
|
95
|
-
.and_then(crate::model::yaml::Value::as_str)
|
|
96
|
-
.filter(|value| !value.is_empty())
|
|
97
|
-
.map(str::to_string),
|
|
98
|
-
system_prompt_file: system_prompt
|
|
99
|
-
.and_then(|prompt| prompt.get("file"))
|
|
100
|
-
.filter(|value| value.is_truthy())
|
|
101
|
-
.and_then(crate::model::yaml::Value::as_str)
|
|
102
|
-
.map(str::to_string),
|
|
103
|
-
output_contract_format: agent
|
|
104
|
-
.get("output_contract")
|
|
105
|
-
.and_then(|contract| contract.get("format"))
|
|
106
|
-
.and_then(crate::model::yaml::Value::as_str)
|
|
107
|
-
.map(str::to_string),
|
|
108
|
-
communication_mode: communication_mode(
|
|
109
|
-
agent
|
|
110
|
-
.get("communication_mode")
|
|
111
|
-
.and_then(crate::model::yaml::Value::as_str),
|
|
112
|
-
)?,
|
|
113
|
-
dangerously_skip_permissions: matches!(
|
|
114
|
-
agent.get("dangerously_skip_permissions"),
|
|
115
|
-
Some(crate::model::yaml::Value::Bool(true))
|
|
116
|
-
),
|
|
117
|
-
})
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
/// ---
|
|
121
|
-
/// purpose: 从 runtime state 的 JSON agent 节点读出命令上下文
|
|
122
|
-
/// params:
|
|
123
|
-
/// agent: 单个 agent 的 JSON 节点
|
|
124
|
-
/// fallback_id: agent 节点没写 id 时的兜底 id
|
|
125
|
-
/// provider: 已解析的 provider
|
|
126
|
-
/// returns: 填好的 WorkerCommandAgent
|
|
127
|
-
/// errors: communication_mode 取值非法时返回 LifecycleError
|
|
128
|
-
/// contract_id: lifecycle.worker_command_agent.from_source
|
|
129
|
-
/// ---
|
|
130
|
-
pub(crate) fn from_json(
|
|
131
|
-
agent: &serde_json::Value,
|
|
132
|
-
fallback_id: Option<&str>,
|
|
133
|
-
provider: Provider,
|
|
134
|
-
) -> Result<Self, LifecycleError> {
|
|
135
|
-
let system_prompt = agent.get("system_prompt");
|
|
136
|
-
Ok(Self {
|
|
137
|
-
id: agent
|
|
138
|
-
.get("id")
|
|
139
|
-
.and_then(serde_json::Value::as_str)
|
|
140
|
-
.or(fallback_id)
|
|
141
|
-
.map(str::to_string),
|
|
142
|
-
provider,
|
|
143
|
-
role: agent
|
|
144
|
-
.get("role")
|
|
145
|
-
.and_then(serde_json::Value::as_str)
|
|
146
|
-
.map(str::to_string),
|
|
147
|
-
system_prompt_inline: system_prompt
|
|
148
|
-
.and_then(|prompt| prompt.get("inline"))
|
|
149
|
-
.and_then(serde_json::Value::as_str)
|
|
150
|
-
.filter(|value| !value.is_empty())
|
|
151
|
-
.map(str::to_string),
|
|
152
|
-
system_prompt_file: system_prompt
|
|
153
|
-
.and_then(|prompt| prompt.get("file"))
|
|
154
|
-
.and_then(serde_json::Value::as_str)
|
|
155
|
-
.filter(|value| !value.is_empty())
|
|
156
|
-
.map(str::to_string),
|
|
157
|
-
output_contract_format: agent
|
|
158
|
-
.get("output_contract")
|
|
159
|
-
.and_then(|contract| contract.get("format"))
|
|
160
|
-
.and_then(serde_json::Value::as_str)
|
|
161
|
-
.map(str::to_string),
|
|
162
|
-
communication_mode: communication_mode(
|
|
163
|
-
agent
|
|
164
|
-
.get("communication_mode")
|
|
165
|
-
.and_then(serde_json::Value::as_str),
|
|
166
|
-
)?,
|
|
167
|
-
dangerously_skip_permissions: agent
|
|
168
|
-
.get("dangerously_skip_permissions")
|
|
169
|
-
.and_then(serde_json::Value::as_bool)
|
|
170
|
-
.unwrap_or(false),
|
|
171
|
-
})
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
/// ---
|
|
176
|
-
/// purpose: 拼出 worker 的系统提示词,身份段必须排在最前
|
|
177
|
-
/// returns: 各段以空行分隔的提示词,空段被丢弃
|
|
178
|
-
/// errors: 角色正文读取失败或权限解析失败时返回 LifecycleError
|
|
179
|
-
/// ---
|
|
180
|
-
pub(crate) fn compile_worker_system_prompt(
|
|
181
|
-
agent: &WorkerCommandAgent,
|
|
182
|
-
) -> Result<String, LifecycleError> {
|
|
183
|
-
// Python prompt.py:39 — chunks = [identity, TEAMMATE_SYSTEM_PROMPT, ...]: the worker
|
|
184
|
-
// identity line anchors the very first section (live Python worker argv confirms).
|
|
185
|
-
// C-1 cr verdict / B2 灵魂件 — identity 必须 FIRST(MUST-4 行为层守:空白上下文问
|
|
186
|
-
// "你是谁"必须先答 Team Agent worker 身份)。runtime contract 跟后。
|
|
187
|
-
let send_message = mcp_tool_name(agent.provider, "team_orchestrator", "send_message");
|
|
188
|
-
let get_team_status = format!(
|
|
189
|
-
"{}()",
|
|
190
|
-
mcp_tool_name(agent.provider, "team_orchestrator", "get_team_status")
|
|
191
|
-
);
|
|
192
|
-
let report_result = mcp_tool_name(agent.provider, "team_orchestrator", "report_result");
|
|
193
|
-
let runtime_contract =
|
|
194
|
-
runtime_contract_section(&send_message, &report_result, &get_team_status);
|
|
195
|
-
let communication_contract = agent.communication_mode.runtime_contract(&send_message);
|
|
196
|
-
let mut chunks = vec![
|
|
197
|
-
identity_section(agent),
|
|
198
|
-
runtime_contract,
|
|
199
|
-
communication_contract,
|
|
200
|
-
role_body(agent)?,
|
|
201
|
-
];
|
|
202
|
-
if let Some(contract) = output_contract(agent, &report_result) {
|
|
203
|
-
chunks.push(contract);
|
|
204
|
-
}
|
|
205
|
-
Ok(chunks
|
|
206
|
-
.into_iter()
|
|
207
|
-
.filter(|chunk| !chunk.is_empty())
|
|
208
|
-
.collect::<Vec<_>>()
|
|
209
|
-
.join("\n\n"))
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
pub(crate) fn compile_pi_leader_system_prompt() -> String {
|
|
213
|
-
r#"You are the Team Agent leader for this workspace. Coordinate work through the existing Team Agent MCP server.
|
|
214
|
-
|
|
215
|
-
The logical operations are send_message, report_result and get_team_status. The Team-owned Pi extension supplies the actual native/proxy tool names in the MCP wire binding before a run. Use that binding, not guessed tool names.
|
|
216
|
-
|
|
217
|
-
Do not pass sender, task_id or schema_version. Do not invent a second team protocol or assume that MCP registration proves a call has returned."#
|
|
218
|
-
.to_string()
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
/// Provider-facing MCP tool name. Only verified call forms are filled in.
|
|
222
|
-
/// Unverified providers keep the historical dotted spelling.
|
|
223
|
-
fn mcp_tool_name(provider: Provider, server: &str, tool: &str) -> String {
|
|
224
|
-
match provider {
|
|
225
|
-
Provider::Claude | Provider::ClaudeCode => format!("mcp__{server}__{tool}"),
|
|
226
|
-
Provider::Grok => format!("{server}__{tool}"),
|
|
227
|
-
// Pi's owned extension binds these logical operations to the observed MCP call surface.
|
|
228
|
-
Provider::Pi => tool.to_string(),
|
|
229
|
-
// Codex / Copilot / GeminiCli / Fake: 未验证,沿用现状点号。
|
|
230
|
-
Provider::Codex
|
|
231
|
-
| Provider::Copilot
|
|
232
|
-
| Provider::GeminiCli
|
|
233
|
-
| Provider::Fake => format!("{server}.{tool}"),
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
pub(crate) fn runtime_contract_section(
|
|
238
|
-
send_message: &str,
|
|
239
|
-
report_result: &str,
|
|
240
|
-
get_team_status: &str,
|
|
241
|
-
) -> String {
|
|
242
|
-
RUNTIME_CONTRACT_SECTION
|
|
243
|
-
.replace("{send_message}", send_message)
|
|
244
|
-
.replace("{report_result}", report_result)
|
|
245
|
-
.replace("{get_team_status}", get_team_status)
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
fn communication_mode(value: Option<&str>) -> Result<CommunicationMode, LifecycleError> {
|
|
249
|
-
let Some(value) = value else {
|
|
250
|
-
return Ok(CommunicationMode::default());
|
|
251
|
-
};
|
|
252
|
-
CommunicationMode::parse(value)
|
|
253
|
-
.ok_or_else(|| LifecycleError::Compile(format!("unknown communication_mode {value:?}")))
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
fn identity_section(agent: &WorkerCommandAgent) -> String {
|
|
257
|
-
worker_identity_section(
|
|
258
|
-
agent.id.as_deref().unwrap_or("unknown"),
|
|
259
|
-
agent.role.as_deref().unwrap_or("developer"),
|
|
260
|
-
)
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
pub(crate) fn worker_identity_section(id: &str, role: &str) -> String {
|
|
264
|
-
format!(
|
|
265
|
-
"You are Team Agent worker `{id}` with role `{role}`. When asked about your role or identity, answer with this Team Agent worker identity first, not only the generic provider product identity."
|
|
266
|
-
)
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
fn role_body(agent: &WorkerCommandAgent) -> Result<String, LifecycleError> {
|
|
270
|
-
let mut chunks = Vec::new();
|
|
271
|
-
if let Some(inline) = &agent.system_prompt_inline {
|
|
272
|
-
chunks.push(inline.clone());
|
|
273
|
-
}
|
|
274
|
-
if let Some(path) = &agent.system_prompt_file {
|
|
275
|
-
let body = std::fs::read_to_string(Path::new(path))
|
|
276
|
-
.map_err(|e| LifecycleError::Compile(format!("read system_prompt.file {path}: {e}")))?;
|
|
277
|
-
if !body.is_empty() {
|
|
278
|
-
chunks.push(body);
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
Ok(chunks.join("\n\n"))
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
fn output_contract(agent: &WorkerCommandAgent, report_result: &str) -> Option<String> {
|
|
285
|
-
(agent.output_contract_format.as_deref() == Some("result_envelope_v1"))
|
|
286
|
-
.then(|| RESULT_ENVELOPE_OUTPUT_CONTRACT.replace("{report_result}", report_result))
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
#[cfg(test)]
|
|
290
|
-
mod tests {
|
|
291
|
-
use super::*;
|
|
292
|
-
|
|
293
|
-
#[test]
|
|
294
|
-
fn system_prompt_uses_identity_then_runtime_contract_python_order() {
|
|
295
|
-
// #264 D6: Python truth source (prompt.py:39, live ps confirmed) builds
|
|
296
|
-
// chunks = [identity, TEAMMATE_SYSTEM_PROMPT, role_body, output].
|
|
297
|
-
// The previous assertion locked the inverted contract-first order with no
|
|
298
|
-
// Python evidence; this is the corrected golden.
|
|
299
|
-
// 0.3.5 union (copilot v2 C-1 / B2 MUST-4 行为层守): identity 必须 FIRST —
|
|
300
|
-
// 空白上下文问"你是谁"的第一行答案必须先答 Team Agent worker 身份;
|
|
301
|
-
// Copilot 适配的 C-1-3 行为层要求与其它 provider 同步。
|
|
302
|
-
let agent = WorkerCommandAgent {
|
|
303
|
-
id: Some("coder".to_string()),
|
|
304
|
-
provider: Provider::Codex,
|
|
305
|
-
role: Some("Runtime Developer".to_string()),
|
|
306
|
-
system_prompt_inline: Some("Implement the assigned slice.".to_string()),
|
|
307
|
-
system_prompt_file: None,
|
|
308
|
-
output_contract_format: Some("result_envelope_v1".to_string()),
|
|
309
|
-
communication_mode: CommunicationMode::default(),
|
|
310
|
-
dangerously_skip_permissions: false,
|
|
311
|
-
};
|
|
312
|
-
let prompt = compile_worker_system_prompt(&agent).unwrap();
|
|
313
|
-
assert!(
|
|
314
|
-
prompt.starts_with("You are Team Agent worker `coder` with role `Runtime Developer`."),
|
|
315
|
-
"compiled prompt must start with the identity section (Python prompt.py:39); head={:?}",
|
|
316
|
-
prompt.chars().take(120).collect::<String>()
|
|
317
|
-
);
|
|
318
|
-
let identity = prompt.find("worker `coder`").unwrap();
|
|
319
|
-
let runtime = prompt
|
|
320
|
-
.find(RUNTIME_CONTRACT_SECTION.lines().next().unwrap_or(""))
|
|
321
|
-
.unwrap();
|
|
322
|
-
let role = prompt.find("Implement the assigned slice.").unwrap();
|
|
323
|
-
let output = prompt
|
|
324
|
-
.find("Final completion must call team_orchestrator.report_result exactly once")
|
|
325
|
-
.unwrap();
|
|
326
|
-
assert!(identity < runtime && runtime < role && role < output);
|
|
327
|
-
let slowdown_phrase = format!("500/{}", 500 + 29);
|
|
328
|
-
assert!(prompt.contains(&slowdown_phrase));
|
|
329
|
-
assert!(prompt.contains("Runtime Developer"));
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
#[test]
|
|
333
|
-
fn all_provider_mode_prompts_share_silence_contract_without_unconditional_replies() {
|
|
334
|
-
for provider in [Provider::Codex, Provider::Pi] {
|
|
335
|
-
for mode in CommunicationMode::ALL.iter().copied() {
|
|
336
|
-
let agent = WorkerCommandAgent {
|
|
337
|
-
id: Some("worker".to_string()),
|
|
338
|
-
provider,
|
|
339
|
-
role: Some("developer".to_string()),
|
|
340
|
-
system_prompt_inline: Some("worker body".to_string()),
|
|
341
|
-
system_prompt_file: None,
|
|
342
|
-
output_contract_format: Some("result_envelope_v1".to_string()),
|
|
343
|
-
communication_mode: mode,
|
|
344
|
-
dangerously_skip_permissions: false,
|
|
345
|
-
};
|
|
346
|
-
let prompt = compile_worker_system_prompt(&agent).unwrap();
|
|
347
|
-
assert!(prompt.contains(
|
|
348
|
-
"Do not reply to pure ACKs, greetings, or unchanged status notices (such as \"paused\" or \"waiting\"); after reporting a blocker once or completing a task, remain silent until a new actionable instruction arrives."
|
|
349
|
-
));
|
|
350
|
-
assert!(!prompt.contains("Silence and resumption (mandatory)"));
|
|
351
|
-
assert!(!prompt.contains(
|
|
352
|
-
"When you receive a message from the leader or a teammate, you MUST respond"
|
|
353
|
-
));
|
|
354
|
-
match mode {
|
|
355
|
-
CommunicationMode::LeaderCentric => {
|
|
356
|
-
assert!(prompt.contains(
|
|
357
|
-
"Respond through Team Agent MCP tools only to actionable requests or questions; writing in your terminal does not deliver it."
|
|
358
|
-
));
|
|
359
|
-
}
|
|
360
|
-
CommunicationMode::Orchestrated => {
|
|
361
|
-
assert!(prompt.contains(
|
|
362
|
-
"Respond to task-related messages through Team Agent MCP tools."
|
|
363
|
-
));
|
|
364
|
-
assert!(prompt.contains("A pure ACK, unrelated status, or non-task message does not require a response."));
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
//! `team-agent` 二进制入口。
|
|
2
|
-
|
|
3
|
-
fn main() -> anyhow::Result<()> {
|
|
4
|
-
let mut args = std::env::args_os()
|
|
5
|
-
.skip(1)
|
|
6
|
-
.map(|arg| arg.to_string_lossy().into_owned());
|
|
7
|
-
let command = args.next();
|
|
8
|
-
#[cfg(unix)]
|
|
9
|
-
if matches!(command.as_deref(), Some("contract-mcp")) {
|
|
10
|
-
team_agent::contract_runtime::mcp::run(&args.collect::<Vec<_>>())
|
|
11
|
-
.map_err(|error| anyhow::anyhow!(error.to_string()))?;
|
|
12
|
-
return Ok(());
|
|
13
|
-
}
|
|
14
|
-
if matches!(command.as_deref(), Some("fake-worker")) {
|
|
15
|
-
let mut workspace = None;
|
|
16
|
-
let mut agent_id = None;
|
|
17
|
-
while let Some(arg) = args.next() {
|
|
18
|
-
match arg.as_str() {
|
|
19
|
-
"--workspace" => workspace = args.next().map(std::path::PathBuf::from),
|
|
20
|
-
"--agent-id" => agent_id = args.next(),
|
|
21
|
-
other => return Err(anyhow::anyhow!("unknown fake-worker argument: {other}")),
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
let workspace =
|
|
25
|
-
workspace.ok_or_else(|| anyhow::anyhow!("fake-worker requires --workspace <path>"))?;
|
|
26
|
-
let agent_id =
|
|
27
|
-
agent_id.ok_or_else(|| anyhow::anyhow!("fake-worker requires --agent-id <id>"))?;
|
|
28
|
-
let stdin = std::io::stdin();
|
|
29
|
-
let stdout = std::io::stdout();
|
|
30
|
-
team_agent::fake_worker::run(&workspace, &agent_id, stdin.lock(), stdout.lock())
|
|
31
|
-
.map_err(|e| anyhow::anyhow!(e.to_string()))?;
|
|
32
|
-
return Ok(());
|
|
33
|
-
}
|
|
34
|
-
if matches!(command.as_deref(), Some("mcp-server")) {
|
|
35
|
-
let mut workspace = None;
|
|
36
|
-
while let Some(arg) = args.next() {
|
|
37
|
-
match arg.as_str() {
|
|
38
|
-
"--workspace" => workspace = args.next().map(std::path::PathBuf::from),
|
|
39
|
-
other => return Err(anyhow::anyhow!("unknown mcp-server argument: {other}")),
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
let workspace = workspace.unwrap_or(std::env::current_dir()?);
|
|
43
|
-
team_agent::mcp_server::main(&workspace, &[])?;
|
|
44
|
-
return Ok(());
|
|
45
|
-
}
|
|
46
|
-
let argv = std::env::args_os()
|
|
47
|
-
.skip(1)
|
|
48
|
-
.map(|arg| arg.to_string_lossy().into_owned())
|
|
49
|
-
.collect::<Vec<_>>();
|
|
50
|
-
let cwd = std::env::current_dir()?;
|
|
51
|
-
std::process::exit(team_agent::cli::run(&argv, &cwd).code());
|
|
52
|
-
}
|