@team-agent/installer 0.5.126 → 0.5.128
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/Cargo.lock +1 -1
- package/Cargo.toml +1 -1
- package/README.md +11 -0
- package/crates/team-agent/src/cli/adapters.rs +3 -13
- package/crates/team-agent/src/cli/arguments.rs +4 -0
- package/crates/team-agent/src/cli/diagnose.rs +68 -91
- package/crates/team-agent/src/cli/emit.rs +61 -28
- package/crates/team-agent/src/cli/grok_slot.rs +88 -3
- package/crates/team-agent/src/cli/intent/runtime.rs +38 -9
- package/crates/team-agent/src/cli/intent/runtime_tests.rs +147 -11
- package/crates/team-agent/src/cli/intent/tests.rs +10 -12
- package/crates/team-agent/src/cli/intent.rs +1 -1
- package/crates/team-agent/src/cli/mod.rs +38 -9
- package/crates/team-agent/src/cli/models.rs +789 -186
- package/crates/team-agent/src/cli/schedule.rs +175 -0
- package/crates/team-agent/src/cli/send/persist.rs +0 -36
- package/crates/team-agent/src/cli/send/presentation.rs +1 -1
- package/crates/team-agent/src/cli/send.rs +108 -110
- package/crates/team-agent/src/cli/spec.rs +6 -0
- package/crates/team-agent/src/cli/status_port/brief.rs +5 -67
- package/crates/team-agent/src/cli/tests/leader_watch.rs +12 -62
- package/crates/team-agent/src/cli/tests/mod.rs +3 -3
- package/crates/team-agent/src/cli/tests/named_address.rs +11 -10
- package/crates/team-agent/src/cli/tests/run_delegation.rs +12 -9
- package/crates/team-agent/src/cli/tests/status_send.rs +70 -273
- package/crates/team-agent/src/compiler/tests.rs +39 -27
- package/crates/team-agent/src/compiler.rs +206 -6
- package/crates/team-agent/src/contract_runtime/backend.rs +181 -11
- package/crates/team-agent/src/contract_runtime/commands.rs +338 -7
- package/crates/team-agent/src/contract_runtime/config.rs +30 -19
- package/crates/team-agent/src/contract_runtime/config_tests.rs +24 -4
- package/crates/team-agent/src/contract_runtime/discovery.rs +12 -1
- package/crates/team-agent/src/contract_runtime/fork.rs +3 -10
- package/crates/team-agent/src/contract_runtime/framework.rs +28 -14
- package/crates/team-agent/src/contract_runtime/mcp.rs +19 -24
- package/crates/team-agent/src/contract_runtime/prompt.rs +2 -2
- package/crates/team-agent/src/contract_runtime/registry.rs +93 -130
- package/crates/team-agent/src/coordinator/steps/abnormal.rs +45 -5
- package/crates/team-agent/src/coordinator/tests/api_error_recovery.rs +8 -29
- package/crates/team-agent/src/coordinator/tests/energy.rs +4 -4
- package/crates/team-agent/src/coordinator/tests/health_sync.rs +44 -2
- package/crates/team-agent/src/coordinator/tests/main_preserved.rs +2 -2
- package/crates/team-agent/src/coordinator/tests/spine.rs +1 -1
- package/crates/team-agent/src/coordinator/tests/takeover.rs +3 -3
- package/crates/team-agent/src/coordinator/tick.rs +1 -89
- package/crates/team-agent/src/db/message_store.rs +7 -65
- package/crates/team-agent/src/direct_delivery.rs +368 -0
- package/crates/team-agent/src/inbox_store.rs +169 -0
- package/crates/team-agent/src/leader/registry.rs +5 -0
- package/crates/team-agent/src/leader/start.rs +2 -1
- package/crates/team-agent/src/leader/tests/lease_api.rs +2 -2
- package/crates/team-agent/src/leader/tests/prompt_contract.rs +1 -0
- package/crates/team-agent/src/lib.rs +2 -0
- package/crates/team-agent/src/lifecycle/launch/add_agent.rs +33 -0
- package/crates/team-agent/src/lifecycle/launch/add_agent_state.rs +206 -1
- package/crates/team-agent/src/lifecycle/launch/clone_agent.rs +28 -2
- package/crates/team-agent/src/lifecycle/launch/fork_agent.rs +36 -179
- package/crates/team-agent/src/lifecycle/launch/fork_entry.rs +87 -6
- package/crates/team-agent/src/lifecycle/launch/mcp_config.rs +13 -488
- package/crates/team-agent/src/lifecycle/launch/pi_mcp.rs +351 -81
- package/crates/team-agent/src/lifecycle/launch/pi_mcp_extension.js +3 -4
- package/crates/team-agent/src/lifecycle/launch/quick_start.rs +26 -2
- package/crates/team-agent/src/lifecycle/launch/spawn.rs +41 -31
- package/crates/team-agent/src/lifecycle/launch.rs +27 -12
- package/crates/team-agent/src/lifecycle/profile_launch.rs +318 -64
- package/crates/team-agent/src/lifecycle/restart/agent.rs +1 -0
- package/crates/team-agent/src/lifecycle/restart/avatar.rs +1798 -0
- package/crates/team-agent/src/lifecycle/restart/claude_fork.rs +163 -0
- package/crates/team-agent/src/lifecycle/restart/common.rs +298 -133
- package/crates/team-agent/src/lifecycle/restart/remove.rs +129 -0
- package/crates/team-agent/src/lifecycle/restart/selection.rs +5 -5
- package/crates/team-agent/src/lifecycle/restart.rs +4 -0
- package/crates/team-agent/src/lifecycle/role_config.rs +79 -27
- package/crates/team-agent/src/lifecycle/tests/acceptance_b_batch_red.rs +1 -1
- package/crates/team-agent/src/lifecycle/tests/agent_ops.rs +8 -12
- package/crates/team-agent/src/lifecycle/tests/behavioral_diff_264_red.rs +37 -240
- package/crates/team-agent/src/lifecycle/tests/claude_compatible_config_red.rs +325 -0
- package/crates/team-agent/src/lifecycle/tests/claude_profile_launch_red.rs +320 -8
- package/crates/team-agent/src/lifecycle/tests/cli_argv_routing_red.rs +329 -70
- package/crates/team-agent/src/lifecycle/tests/clone_fork_copilot_perms_red.rs +378 -4
- package/crates/team-agent/src/lifecycle/tests/communication_mode_runtime_contract_red.rs +25 -39
- package/crates/team-agent/src/lifecycle/tests/copilot_provider_red.rs +7 -11
- package/crates/team-agent/src/lifecycle/tests/core.rs +39 -36
- package/crates/team-agent/src/lifecycle/tests/f032_startup_prompt_best_effort_red.rs +22 -8
- package/crates/team-agent/src/lifecycle/tests/fixtures/pi_native_mcp_host.mjs +2 -1
- package/crates/team-agent/src/lifecycle/tests/grok_require_explicit_model_red.rs +15 -133
- package/crates/team-agent/src/lifecycle/tests/harvest2_a_batch_red.rs +60 -20
- package/crates/team-agent/src/lifecycle/tests/host_cotenant_death_p0_contract.rs +30 -67
- package/crates/team-agent/src/lifecycle/tests/issue238_codex_effort_contract.rs +3 -31
- package/crates/team-agent/src/lifecycle/tests/lane_ops.rs +194 -169
- package/crates/team-agent/src/lifecycle/tests/launch_spawn.rs +164 -282
- package/crates/team-agent/src/lifecycle/tests/lifecycle_rollback_red.rs +15 -78
- package/crates/team-agent/src/lifecycle/tests/main_preserved.rs +7 -7
- package/crates/team-agent/src/lifecycle/tests/mcp_tool_name_format_red.rs +6 -6
- package/crates/team-agent/src/lifecycle/tests/phase_b_contracts.rs +75 -69
- package/crates/team-agent/src/lifecycle/tests/phase_golden.rs +2 -10
- package/crates/team-agent/src/lifecycle/tests/pi_catalog_red.rs +18 -6
- package/crates/team-agent/src/lifecycle/tests/pi_command_red.rs +70 -52
- package/crates/team-agent/src/lifecycle/tests/pi_compiler_red.rs +210 -0
- package/crates/team-agent/src/lifecycle/tests/pi_dual_entry_red.rs +157 -4
- package/crates/team-agent/src/lifecycle/tests/pi_executable_mcp_red.rs +526 -10
- package/crates/team-agent/src/lifecycle/tests/pi_fork_session_inheritance_red.rs +1419 -0
- package/crates/team-agent/src/lifecycle/tests/pi_lifecycle_doctor_red.rs +68 -1
- package/crates/team-agent/src/lifecycle/tests/pi_native_mcp_capability_red.rs +34 -12
- package/crates/team-agent/src/lifecycle/tests/pi_session_delivery_red.rs +94 -2
- package/crates/team-agent/src/lifecycle/tests/quick_start_worker_readiness_red.rs +14 -15
- package/crates/team-agent/src/lifecycle/tests/restart.rs +12 -153
- package/crates/team-agent/src/lifecycle/tests/restart_build_before_destroy_0540_contract.rs +27 -5
- package/crates/team-agent/src/lifecycle/tests/restart_liveness_red.rs +59 -10
- package/crates/team-agent/src/lifecycle/tests/restart_rebind_hotfix_252_red.rs +47 -6
- package/crates/team-agent/src/lifecycle/tests/restart_session_capture_red.rs +3 -1374
- package/crates/team-agent/src/lifecycle/tests/resume_recover_red.rs +27 -10
- package/crates/team-agent/src/lifecycle/tests/status_credential_redaction_contract.rs +7 -7
- package/crates/team-agent/src/lifecycle/tests/subprep_codex_trust_roundtrip_red.rs +67 -313
- package/crates/team-agent/src/lifecycle/tests/swallow_batch4_semantics_red.rs +254 -2
- package/crates/team-agent/src/lifecycle/tests/team_in_team_identity_scope_red.rs +2 -2
- package/crates/team-agent/src/lifecycle/tests/team_in_team_sibling_quick_start_red.rs +1 -1
- package/crates/team-agent/src/lifecycle/tests/team_in_team_state_scope_red.rs +2 -2
- package/crates/team-agent/src/lifecycle/tests/team_key_retirement_txn_red.rs +4 -4
- package/crates/team-agent/src/lifecycle/tests/upgrade_compat_0211_red.rs +74 -19
- package/crates/team-agent/src/lifecycle/tests/verify_rs031_window_consistency_red.rs +38 -39
- package/crates/team-agent/src/lifecycle/tests/worker_spawn_env_red.rs +51 -88
- package/crates/team-agent/src/lifecycle/tests.rs +3 -4
- package/crates/team-agent/src/lifecycle/types.rs +18 -5
- package/crates/team-agent/src/lifecycle/worker_command_context.rs +43 -50
- package/crates/team-agent/src/mcp_server/readiness.rs +130 -149
- package/crates/team-agent/src/mcp_server/readiness_tests.rs +86 -109
- package/crates/team-agent/src/mcp_server/tests/scoped.rs +21 -31
- package/crates/team-agent/src/mcp_server/tests/send.rs +72 -107
- package/crates/team-agent/src/mcp_server/tests/tools.rs +10 -12
- package/crates/team-agent/src/mcp_server/tools.rs +70 -196
- package/crates/team-agent/src/messaging/delivery.rs +143 -253
- package/crates/team-agent/src/messaging/delivery_consumption_tests.rs +5 -5
- package/crates/team-agent/src/messaging/helpers.rs +1 -19
- package/crates/team-agent/src/messaging/mod.rs +1 -0
- package/crates/team-agent/src/messaging/reminders.rs +316 -0
- package/crates/team-agent/src/messaging/scheduler.rs +7 -1
- package/crates/team-agent/src/messaging/tests/dup_inject.rs +255 -150
- package/crates/team-agent/src/messaging/tests/main_preserved.rs +2 -2
- package/crates/team-agent/src/messaging/tests/runtime.rs +9 -115
- package/crates/team-agent/src/messaging/tests/spine.rs +44 -24
- package/crates/team-agent/src/messaging/tests/wave2.rs +13 -20
- package/crates/team-agent/src/messaging/types.rs +1 -0
- package/crates/team-agent/src/provider/adapter.rs +208 -254
- package/crates/team-agent/src/provider/adapters/claude.rs +78 -0
- package/crates/team-agent/src/provider/adapters/claude_fork.rs +131 -0
- package/crates/team-agent/src/provider/adapters/mod.rs +7 -7
- package/crates/team-agent/src/provider/adapters/pi.rs +106 -0
- package/crates/team-agent/src/provider/classify.rs +1 -66
- package/crates/team-agent/src/provider/model_catalog.rs +201 -13
- package/crates/team-agent/src/provider/session/capture.rs +111 -111
- package/crates/team-agent/src/provider/session/context_fork/claude.rs +123 -0
- package/crates/team-agent/src/provider/session/context_fork/outcome.rs +10 -18
- package/crates/team-agent/src/provider/session/context_fork.rs +87 -74
- package/crates/team-agent/src/provider/session/mod.rs +2 -3
- package/crates/team-agent/src/provider/session_scan/claude.rs +523 -0
- package/crates/team-agent/src/provider/session_scan/common.rs +47 -47
- package/crates/team-agent/src/provider/session_scan/pi.rs +34 -1
- package/crates/team-agent/src/provider/session_scan.rs +13 -13
- package/crates/team-agent/src/provider/tests/adapter.rs +127 -121
- package/crates/team-agent/src/provider/tests/classify.rs +0 -53
- package/crates/team-agent/src/provider/tests/command_helpers.rs +11 -19
- package/crates/team-agent/src/provider/tests/idle.rs +13 -19
- package/crates/team-agent/src/provider/types.rs +0 -4
- package/crates/team-agent/src/provider/wire.rs +34 -20
- package/crates/team-agent/src/state/abnormal_watch/tests/mod.rs +1 -1
- package/crates/team-agent/src/state/persist.rs +6 -6
- package/crates/team-agent/src/state/projection.rs +1 -1
- package/crates/team-agent/src/state/repository/tests.rs +2 -2
- package/crates/team-agent/src/test_support/models_timeout_fixture.rs +144 -0
- package/crates/team-agent/src/tmux_backend/tests.rs +0 -151
- package/crates/team-agent/src/tmux_backend.rs +9 -43
- package/package.json +4 -4
- package/skills/team-agent/SKILL.md +7 -8
- package/skills/team-agent/command-coverage.json +15 -1
- package/skills/team-agent/docs/reference/team-agent-operator.md +5 -3
- package/skills/team-agent/references/team-agent-operator.md +5 -3
- package/crates/team-agent/src/lifecycle/launch/grok_per_seat.rs +0 -260
- package/crates/team-agent/src/lifecycle/tests/codex_weak_window_attribution_red.rs +0 -683
- package/crates/team-agent/src/lifecycle/tests/grok_effort_argv_red.rs +0 -247
- package/crates/team-agent/src/lifecycle/tests/grok_mcp_overlay_red.rs +0 -507
- package/crates/team-agent/src/lifecycle/tests/grok_restart_resume_red.rs +0 -300
- package/crates/team-agent/src/provider/adapters/codex.rs +0 -101
- package/crates/team-agent/src/provider/adapters/grok.rs +0 -67
- package/crates/team-agent/src/provider/session/context_fork/codex.rs +0 -514
- package/crates/team-agent/src/provider/session_scan/codex.rs +0 -326
- package/crates/team-agent/src/provider/session_scan/grok.rs +0 -288
package/Cargo.lock
CHANGED
package/Cargo.toml
CHANGED
package/README.md
CHANGED
|
@@ -36,6 +36,17 @@ team-agent claude
|
|
|
36
36
|
|
|
37
37
|
Two steps. Everything else happens in the conversation.
|
|
38
38
|
|
|
39
|
+
## Scheduled leader reminders
|
|
40
|
+
|
|
41
|
+
```sh
|
|
42
|
+
team-agent schedule add --in 10m --text "Check progress"
|
|
43
|
+
team-agent schedule add --every 1h --text "Review status"
|
|
44
|
+
team-agent schedule list --json
|
|
45
|
+
team-agent schedule cancel sched_1
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Use `--workspace PATH --team KEY` to select the leader. Durations are positive integers followed by `ms`, `s`, `m`, `h`, or `d`. Reminders share the existing coordinator timer and durable queue; there is no extra daemon. Delivery has coordinator-tick granularity. After a coordinator restart, an overdue recurring reminder fires once and resumes its interval without replaying missed occurrences. Cancellation stops future occurrences, not reminders already firing or queued for delivery. `list` shows active reminders.
|
|
49
|
+
|
|
39
50
|
## Everyday CLI: start, stop, restart
|
|
40
51
|
|
|
41
52
|
Check the selected binary with `team-agent start --help` and `team-agent team --help`. If these are missing, obtain an authorized supporting build; a version string alone is not a feature guarantee. Lifecycle commands run in the authorized native **Leader's tool context**, not an ordinary worker's pane.
|
|
@@ -371,18 +371,8 @@ pub fn cmd_approvals(args: &ApprovalsArgs) -> Result<CmdResult, CliError> {
|
|
|
371
371
|
|
|
372
372
|
/// `cmd_inbox`(`commands.py:137`)。
|
|
373
373
|
pub fn cmd_inbox(args: &InboxArgs) -> Result<CmdResult, CliError> {
|
|
374
|
-
let
|
|
375
|
-
|
|
376
|
-
args.team.as_deref(),
|
|
377
|
-
crate::state::selector::SelectorMode::RuntimeOnly,
|
|
378
|
-
)
|
|
379
|
-
.map_err(|e| CliError::Runtime(e.to_string()))?;
|
|
380
|
-
let value = status_port::inbox(
|
|
381
|
-
&selected.run_workspace,
|
|
382
|
-
&args.agent,
|
|
383
|
-
args.limit,
|
|
384
|
-
Some(&selected.team_key),
|
|
385
|
-
)?;
|
|
374
|
+
let value = crate::inbox_store::read(&args.workspace, &args.agent, args.limit, args.team.as_deref())
|
|
375
|
+
.map_err(CliError::Usage)?;
|
|
386
376
|
if args.json {
|
|
387
377
|
Ok(CmdResult::from_json(value, true))
|
|
388
378
|
} else {
|
|
@@ -447,7 +437,7 @@ fn format_inbox_human(agent: &str, value: &Value) -> String {
|
|
|
447
437
|
.unwrap_or("-"),
|
|
448
438
|
);
|
|
449
439
|
let summary =
|
|
450
|
-
clean_inbox_field(message.get("summary").and_then(Value::as_str).unwrap_or(""));
|
|
440
|
+
clean_inbox_field(message.get("summary").or_else(|| message.get("content")).and_then(Value::as_str).unwrap_or(""));
|
|
451
441
|
truncate_inbox_line(&format!(
|
|
452
442
|
"[{id}] [{sender} -> {recipient}] [{status}] [{time}] [{summary}]"
|
|
453
443
|
))
|
|
@@ -66,6 +66,8 @@ fn schema(command: &str) -> Option<Schema> {
|
|
|
66
66
|
),
|
|
67
67
|
"send" => (
|
|
68
68
|
&[
|
|
69
|
+
("--socket", Token),
|
|
70
|
+
("--dialect", Token),
|
|
69
71
|
("--targets", Token),
|
|
70
72
|
("--pane", Token),
|
|
71
73
|
("--to-name", Token),
|
|
@@ -88,9 +90,11 @@ fn schema(command: &str) -> Option<Schema> {
|
|
|
88
90
|
],
|
|
89
91
|
usize::MAX,
|
|
90
92
|
),
|
|
93
|
+
"schedule" => (&[("--in", Token), ("--every", Token), ("--text", Payload)], 2),
|
|
91
94
|
"status" => (&[("--detail", Switch), ("--summary", Switch)], 1),
|
|
92
95
|
"models" => (&[("--provider", Token), ("--search", Query)], usize::MAX),
|
|
93
96
|
"inbox" => (&[("--limit", Count)], 1),
|
|
97
|
+
"locate" => (&[], 0),
|
|
94
98
|
"shutdown" => (&[("--keep-logs", Switch)], 0),
|
|
95
99
|
"restart" => (
|
|
96
100
|
&[
|
|
@@ -9,6 +9,74 @@ use crate::model::pane_authority_refusal::{
|
|
|
9
9
|
use crate::provider::wire::{command_name, parse_provider, provider_wire};
|
|
10
10
|
use crate::transport::Transport;
|
|
11
11
|
|
|
12
|
+
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize)]
|
|
13
|
+
#[serde(rename_all = "snake_case")]
|
|
14
|
+
pub(crate) enum PiBackingStatus {
|
|
15
|
+
Pending,
|
|
16
|
+
Captured,
|
|
17
|
+
Missing,
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize)]
|
|
21
|
+
#[serde(rename_all = "snake_case")]
|
|
22
|
+
pub(crate) enum PiMcpStatus {
|
|
23
|
+
Unavailable,
|
|
24
|
+
ConfiguredLazy,
|
|
25
|
+
RoundtripVerified,
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
pub(crate) struct PiDoctorInput {
|
|
29
|
+
pub executable_chain_verified: bool,
|
|
30
|
+
pub pi_version: Option<String>,
|
|
31
|
+
pub adapter_version: Option<String>,
|
|
32
|
+
pub catalog_sha256: Option<String>,
|
|
33
|
+
pub selected_model: Option<String>,
|
|
34
|
+
pub candidate_executable: Option<std::path::PathBuf>,
|
|
35
|
+
pub wrapper: Option<std::path::PathBuf>,
|
|
36
|
+
pub mcp_roundtrip_at: Option<String>,
|
|
37
|
+
pub backing: PiBackingStatus,
|
|
38
|
+
pub activity: crate::provider::TurnState,
|
|
39
|
+
pub activity_source: crate::provider::ClassifySource,
|
|
40
|
+
pub env_key_names: Vec<String>,
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize)]
|
|
44
|
+
pub(crate) struct PiDoctorFacts {
|
|
45
|
+
pub mcp: PiMcpStatus,
|
|
46
|
+
pub mcp_connected: bool,
|
|
47
|
+
pub backing: PiBackingStatus,
|
|
48
|
+
pub activity: crate::provider::TurnState,
|
|
49
|
+
pub activity_source: crate::provider::ClassifySource,
|
|
50
|
+
pub auth_hint: crate::provider::AuthHintStatus,
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
pub(crate) fn pi_doctor_facts(input: PiDoctorInput) -> PiDoctorFacts {
|
|
54
|
+
let mcp = if input.mcp_roundtrip_at.is_some() {
|
|
55
|
+
PiMcpStatus::RoundtripVerified
|
|
56
|
+
} else if input.wrapper.is_some() {
|
|
57
|
+
PiMcpStatus::ConfiguredLazy
|
|
58
|
+
} else {
|
|
59
|
+
PiMcpStatus::Unavailable
|
|
60
|
+
};
|
|
61
|
+
let _ = (
|
|
62
|
+
input.executable_chain_verified,
|
|
63
|
+
input.pi_version,
|
|
64
|
+
input.adapter_version,
|
|
65
|
+
input.catalog_sha256,
|
|
66
|
+
input.selected_model,
|
|
67
|
+
input.candidate_executable,
|
|
68
|
+
input.env_key_names,
|
|
69
|
+
);
|
|
70
|
+
PiDoctorFacts {
|
|
71
|
+
mcp,
|
|
72
|
+
mcp_connected: mcp == PiMcpStatus::RoundtripVerified,
|
|
73
|
+
backing: input.backing,
|
|
74
|
+
activity: input.activity,
|
|
75
|
+
activity_source: input.activity_source,
|
|
76
|
+
auth_hint: crate::provider::AuthHintStatus::Unknown,
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
12
80
|
/// 0.5.39 Slice 1 (tmux-server-death-locate §11.1 B): classify a tmux
|
|
13
81
|
/// transport error string into a diagnose issue id. When the underlying
|
|
14
82
|
/// tmux subprocess stderr contains `server exited unexpectedly`, the
|
|
@@ -58,14 +126,6 @@ fn is_public_window_name(provider: &str, window: &str) -> bool {
|
|
|
58
126
|
if provider == "pi_tui" && matches!(window, "pi" | "node") {
|
|
59
127
|
return true;
|
|
60
128
|
}
|
|
61
|
-
// tmux names a Claude pane after the image its `claude` route execs: an npm
|
|
62
|
-
// `claude.exe`, or the native installer's version-named `<semver>` file.
|
|
63
|
-
if provider == "claude_tui"
|
|
64
|
-
&& (matches!(window, "claude" | "claude.exe")
|
|
65
|
-
|| team_agent_contract::providers::claude::catalog::semver(window))
|
|
66
|
-
{
|
|
67
|
-
return true;
|
|
68
|
-
}
|
|
69
129
|
parse_provider(provider).is_some_and(|parsed| {
|
|
70
130
|
command_name(parsed) == window
|
|
71
131
|
|| crate::layout::worker_window_helpers::provider_window_name(parsed) == window
|
|
@@ -1180,22 +1240,6 @@ mod tests {
|
|
|
1180
1240
|
);
|
|
1181
1241
|
}
|
|
1182
1242
|
|
|
1183
|
-
fn write_codex_identity_rollout(
|
|
1184
|
-
workspace: &std::path::Path,
|
|
1185
|
-
session_id: &str,
|
|
1186
|
-
embedded_agent_id: &str,
|
|
1187
|
-
) -> std::path::PathBuf {
|
|
1188
|
-
let path = workspace.join("rollout-poison.jsonl");
|
|
1189
|
-
let text = format!(
|
|
1190
|
-
"{{\"session_meta\":{{\"payload\":{{\"id\":\"{session_id}\",\"cwd\":\"{}\"}}}}}}\n\
|
|
1191
|
-
{{\"type\":\"turn_context\",\"payload\":{{}}}}\n\
|
|
1192
|
-
{{\"type\":\"response_item\",\"payload\":{{\"content\":[{{\"type\":\"input_text\",\"text\":\"You are Team Agent worker `{embedded_agent_id}` with role `fixture`.\"}}]}}}}\n",
|
|
1193
|
-
workspace.to_string_lossy()
|
|
1194
|
-
);
|
|
1195
|
-
std::fs::write(&path, text).expect("write rollout");
|
|
1196
|
-
path
|
|
1197
|
-
}
|
|
1198
|
-
|
|
1199
1243
|
fn coordinator_health_fixture(
|
|
1200
1244
|
status: crate::coordinator::CoordinatorHealthStatus,
|
|
1201
1245
|
metadata_mismatch_reason: Option<&str>,
|
|
@@ -1271,59 +1315,6 @@ mod tests {
|
|
|
1271
1315
|
);
|
|
1272
1316
|
}
|
|
1273
1317
|
|
|
1274
|
-
#[test]
|
|
1275
|
-
fn diagnose_surfaces_codex_session_identity_mismatch() {
|
|
1276
|
-
let workspace =
|
|
1277
|
-
std::env::temp_dir().join(format!("ta-diagnose-crossbind-{}", std::process::id()));
|
|
1278
|
-
let _ = std::fs::remove_dir_all(&workspace);
|
|
1279
|
-
std::fs::create_dir_all(&workspace).unwrap();
|
|
1280
|
-
let rollout = write_codex_identity_rollout(
|
|
1281
|
-
&workspace,
|
|
1282
|
-
"019f3327-c35a-7023-b3cd-1bea93a7a157",
|
|
1283
|
-
"ios-dev",
|
|
1284
|
-
);
|
|
1285
|
-
let state = json!({
|
|
1286
|
-
"session_name": "team-fixture",
|
|
1287
|
-
"leader_receiver": {
|
|
1288
|
-
"mode": "direct_tmux",
|
|
1289
|
-
"status": "attached",
|
|
1290
|
-
"pane_id": "%leader",
|
|
1291
|
-
"provider": "codex"
|
|
1292
|
-
},
|
|
1293
|
-
"agents": {
|
|
1294
|
-
"frontend": {
|
|
1295
|
-
"provider": "codex",
|
|
1296
|
-
"status": "running",
|
|
1297
|
-
"session_id": "019f3327-c35a-7023-b3cd-1bea93a7a157",
|
|
1298
|
-
"rollout_path": rollout.to_string_lossy(),
|
|
1299
|
-
"captured_at": "2026-07-05T17:04:04Z",
|
|
1300
|
-
"captured_via": "fs_watch",
|
|
1301
|
-
"spawn_cwd": workspace.to_string_lossy(),
|
|
1302
|
-
"window": "frontend"
|
|
1303
|
-
}
|
|
1304
|
-
}
|
|
1305
|
-
});
|
|
1306
|
-
let backend = crate::transport::test_support::OfflineTransport::new()
|
|
1307
|
-
.with_session_present(true)
|
|
1308
|
-
.with_windows(vec![crate::transport::WindowName::new("frontend")]);
|
|
1309
|
-
let (issues, repairs) = diagnose_runtime(&state, &backend);
|
|
1310
|
-
assert!(
|
|
1311
|
-
issues
|
|
1312
|
-
.as_array()
|
|
1313
|
-
.is_some_and(|items| items.iter().any(|item| item.as_str()
|
|
1314
|
-
== Some("session_identity_mismatch:frontend"))),
|
|
1315
|
-
"diagnose must surface session_identity_mismatch for poisoned Codex tuples; issues={issues}"
|
|
1316
|
-
);
|
|
1317
|
-
assert!(
|
|
1318
|
-
repairs.as_array().is_some_and(|items| items.iter().any(|item| {
|
|
1319
|
-
item.get("issue").and_then(Value::as_str)
|
|
1320
|
-
== Some("session_identity_mismatch:frontend")
|
|
1321
|
-
})),
|
|
1322
|
-
"diagnose should include an explicit repair hint for the mismatched tuple; repairs={repairs}"
|
|
1323
|
-
);
|
|
1324
|
-
let _ = std::fs::remove_dir_all(&workspace);
|
|
1325
|
-
}
|
|
1326
|
-
|
|
1327
1318
|
fn pane(session: &str, pane_id: &str, window: &str) -> crate::transport::PaneInfo {
|
|
1328
1319
|
crate::transport::PaneInfo {
|
|
1329
1320
|
pane_id: crate::transport::PaneId::new(pane_id),
|
|
@@ -1400,20 +1391,6 @@ mod tests {
|
|
|
1400
1391
|
assert!(is_public_window_name("codex_tui", "node"));
|
|
1401
1392
|
assert!(!is_public_window_name("codex_tui", "grok"));
|
|
1402
1393
|
assert!(!is_public_window_name("grok_build", "node"));
|
|
1403
|
-
assert!(is_public_window_name("pi_tui", "pi"));
|
|
1404
|
-
assert!(is_public_window_name("pi_tui", "node"));
|
|
1405
|
-
assert!(!is_public_window_name("pi_tui", "codex"));
|
|
1406
|
-
}
|
|
1407
|
-
|
|
1408
|
-
#[test]
|
|
1409
|
-
fn claude_contract_window_may_carry_its_npm_or_version_named_image() {
|
|
1410
|
-
for window in ["claude", "claude.exe", "2.1.309", "2.1.282"] {
|
|
1411
|
-
assert!(is_public_window_name("claude_tui", window), "{window}");
|
|
1412
|
-
}
|
|
1413
|
-
for window in ["2.1", "claude-wrapper", "node", "grok"] {
|
|
1414
|
-
assert!(!is_public_window_name("claude_tui", window), "{window}");
|
|
1415
|
-
}
|
|
1416
|
-
assert!(!is_public_window_name("grok_build", "2.1.309"));
|
|
1417
1394
|
}
|
|
1418
1395
|
|
|
1419
1396
|
#[test]
|
|
@@ -110,7 +110,7 @@ fn emit_cli_error_for_command(
|
|
|
110
110
|
cwd: &Path,
|
|
111
111
|
error: &CliError,
|
|
112
112
|
) -> ExitCode {
|
|
113
|
-
let missing_input = matches!(error, CliError::Usage(message) if message.starts_with("missing ") || message.starts_with("Provide ") || matches!(message.as_str(), "add-agent requires --provider <name>" | "
|
|
113
|
+
let missing_input = matches!(error, CliError::Usage(message) if message.starts_with("missing ") || message.starts_with("Provide ") || matches!(message.as_str(), "add-agent requires --provider <name>" | "--source is required unless --uninstall"));
|
|
114
114
|
if command_spec(command).is_some() && missing_input {
|
|
115
115
|
let help = command_help(Some(command));
|
|
116
116
|
let explanation = match error {
|
|
@@ -123,9 +123,6 @@ fn emit_cli_error_for_command(
|
|
|
123
123
|
"add-agent requires --provider <name>" => {
|
|
124
124
|
"Select a provider with --provider, or supply a role file with --role-file.".to_string()
|
|
125
125
|
}
|
|
126
|
-
"add-agent requires --bypass <true|false>" => {
|
|
127
|
-
"Explicitly retain permission prompts with --bypass false, or declare bypass in the role file.".to_string()
|
|
128
|
-
}
|
|
129
126
|
other => other
|
|
130
127
|
.strip_prefix("missing ")
|
|
131
128
|
.map(|field| format!("Provide the required argument: {field}."))
|
|
@@ -234,7 +231,8 @@ fn dispatch(command: &str, args: &[String], cwd: &Path) -> Result<ExitCode, CliE
|
|
|
234
231
|
|
|
235
232
|
fn prepare_control_args(command: &str, args: &[String], cwd: &Path) -> Result<super::arguments::CheckedArgs, CliError> {
|
|
236
233
|
let mut checked = super::arguments::parse(command, args)?;
|
|
237
|
-
|
|
234
|
+
let raw_send = command == "send" && checked.tokens.iter().any(|token| token == "--socket");
|
|
235
|
+
if !checked.help && !raw_send { checked.tokens = resolve_command_scope(command, checked.tokens, cwd)?; }
|
|
238
236
|
Ok(checked)
|
|
239
237
|
}
|
|
240
238
|
|
|
@@ -271,7 +269,25 @@ fn dispatch_prepared(command: &str, checked: super::arguments::CheckedArgs, cwd:
|
|
|
271
269
|
}
|
|
272
270
|
match command {
|
|
273
271
|
"quick-start" => cmd_quick_start(&quick_start_args(args, cwd)?).map(emit_result),
|
|
274
|
-
"send" =>
|
|
272
|
+
"send" => {
|
|
273
|
+
let parsed = parse_args(args);
|
|
274
|
+
if parsed.socket.is_some() || parsed.dialect.is_some() {
|
|
275
|
+
let socket = parsed.socket.as_deref().ok_or_else(|| CliError::Usage("raw send requires --socket".into()))?;
|
|
276
|
+
let pane = parsed.pane.as_deref().ok_or_else(|| CliError::Usage("raw send requires --pane".into()))?;
|
|
277
|
+
let dialect = parsed.dialect.as_deref().ok_or_else(|| CliError::Usage("raw send requires --dialect".into()))?;
|
|
278
|
+
if parsed.targets.is_some() || parsed.to_name.is_some() || parsed.to_leader.is_some() || parsed.mailbox {
|
|
279
|
+
return Err(CliError::Usage("raw send cannot be combined with semantic addressing or --mailbox".into()));
|
|
280
|
+
}
|
|
281
|
+
crate::direct_delivery::direct_send(socket, pane, dialect, &parsed.positionals.join(" ")).map_err(CliError::Runtime)?;
|
|
282
|
+
Ok(emit_result(CmdResult::from_json(serde_json::json!({"ok": true, "status": "sent", "delivery": "physical", "pane_id": pane, "accepted": null}), parsed.json)))
|
|
283
|
+
} else { cmd_send(&send_args(args, cwd)?).map(emit_result) }
|
|
284
|
+
},
|
|
285
|
+
"locate" => {
|
|
286
|
+
let parsed = parse_args(args);
|
|
287
|
+
let value = crate::direct_delivery::locate(&workspace(&parsed, cwd), parsed.team.as_deref()).map_err(CliError::Usage)?;
|
|
288
|
+
Ok(emit_result(CmdResult::from_json(value, parsed.json)))
|
|
289
|
+
},
|
|
290
|
+
"schedule" => super::schedule::run(args, cwd).map(emit_result),
|
|
275
291
|
"status" => cmd_status_for_team(&status_args(args, cwd), parse_args(args).team.as_deref())
|
|
276
292
|
.map(emit_result),
|
|
277
293
|
"shutdown" => cmd_shutdown(&shutdown_args(args, cwd)?).map(emit_result),
|
|
@@ -353,7 +369,7 @@ pub(crate) fn default_help() -> String {
|
|
|
353
369
|
append_help_section(
|
|
354
370
|
&mut out,
|
|
355
371
|
"Getting started",
|
|
356
|
-
&["start", "quick-start", "send", "status", "models", "inbox"],
|
|
372
|
+
&["start", "quick-start", "send", "schedule", "status", "models", "inbox"],
|
|
357
373
|
);
|
|
358
374
|
append_help_section(&mut out, "Team lifecycle", &["stop", "team", "restart", "shutdown"]);
|
|
359
375
|
append_help_section(
|
|
@@ -373,7 +389,7 @@ pub(crate) fn default_help() -> String {
|
|
|
373
389
|
append_help_section(
|
|
374
390
|
&mut out,
|
|
375
391
|
"Observation and collaboration",
|
|
376
|
-
&["leaders", "doctor", "approvals"],
|
|
392
|
+
&["locate", "leaders", "doctor", "approvals"],
|
|
377
393
|
);
|
|
378
394
|
append_help_section(
|
|
379
395
|
&mut out,
|
|
@@ -450,9 +466,14 @@ pub(super) fn command_help(command: Option<&str>) -> String {
|
|
|
450
466
|
"TEAMDIR contains TEAM.md and agents/; --workspace selects the runtime project.\n--name sets the team name; --team/--team-id selects the team; --yes retains compatibility; --detail includes full diagnostics.\nProviders must be installed and signed in. Declare provider/model/effort in role files; permission bypass defaults to false.\n--backend tmux is for POSIX; conpty requires a Windows host and an installed ConPTY shim.",
|
|
451
467
|
"team-agent quick-start\nteam-agent quick-start ./roles --workspace ./project\nteam-agent quick-start . --json",
|
|
452
468
|
"Compatibility bridge only. In the authorized Leader context, prefer team-agent start --from TEAMDIR for complete new configuration and team-agent start for later activation. Check models and native sign-in first; inspect status and actual replies after starting."),
|
|
453
|
-
"send" => ("<agent> is an agent name from
|
|
469
|
+
"send" => ("<agent> is an agent name from the read-only endpoint snapshot; MESSAGE is the task text.\nPaste + Enter completes synchronously without coordinator queues or SQLite writes. Physical success is not provider acceptance.\n--socket SOCKET --pane %N --dialect PROVIDER sends directly without a workspace snapshot. Automatic snapshot provider aliases select the native sequence: Claude/Cursor 100ms, Grok 150ms, Pi/Codex no floor, then one Enter.\nExplicit double-enter submits twice; cursor-double-enter retains Cursor\'s 100ms floor. No automatic retry or third Enter.\n--mailbox appends to the independent inbox without injecting into the conversation.",
|
|
454
470
|
"team-agent send worker 'Calculate 245 * 37 and reply to the leader.'\nteam-agent send worker 'Review the changes' --workspace . --team help-demo\nteam-agent send worker 'Read this when next available' --mailbox",
|
|
455
471
|
"Acceptance is not delivery or completion. Wait for an actual reply; use team-agent inbox leader -n 3. Diagnose with status/doctor rather than repeated sends."),
|
|
472
|
+
"locate" => ("Read the endpoint snapshot and list live tmux panes without starting or contacting the coordinator.",
|
|
473
|
+
"team-agent locate --workspace . --json\nteam-agent locate --team help-demo", "Use the socket, pane_id and dialect for raw send, or the agent name for workspace-scoped send."),
|
|
474
|
+
"schedule" => ("add requires exactly one of --in or --every and non-empty --text. Durations are positive integers followed by ms, s, m, h or d.\nlist shows active reminders; cancel takes the sched_<hex> id returned by add.",
|
|
475
|
+
"team-agent schedule add --in 10m --text 'Check progress'\nteam-agent schedule add --every 1h --text 'Review status'\nteam-agent schedule list --json\nteam-agent schedule cancel sched_1",
|
|
476
|
+
"Uses the existing coordinator timer; schedules survive daemon restarts. Delivery has tick granularity. Cancellation stops future occurrences, not reminders already firing or queued. A stopped coordinator resumes timers when restarted, without replaying missed intervals."),
|
|
456
477
|
"inbox" => ("<agent> is the recipient name; -n/--limit bounds the message count. Reading replies does not resend messages.",
|
|
457
478
|
"team-agent inbox leader -n 3\nteam-agent inbox worker --limit 5\nteam-agent inbox leader --workspace . --team help-demo --json", "Wait for a natural reply, then check team-agent status if needed. Do not inspect worker terminal content."),
|
|
458
479
|
"status" => ("Optional <agent> selects one agent. --summary/--detail retain compatibility and do not add fields.\nNine fields: name/provider/model/effort/runtime_status/activity/health/session_name/tmux_command.\nRuntime, activity and health are distinct. unknown means insufficient evidence; null means unset. No default model is guessed.",
|
|
@@ -463,7 +484,7 @@ pub(super) fn command_help(command: Option<&str>) -> String {
|
|
|
463
484
|
"team-agent restart worker --dry-run --json\nteam-agent restart worker --session preserve --workspace . --dry-run --json", "Use team-agent team restart for deliberate team recovery; choose --session preserve when context must be retained. Team restart leaves explicitly stopped/paused seats alone; team-agent start intentionally activates the non-paused roster. Inspect partial/unknown outcomes with status/doctor, never blind reset or retry."),
|
|
464
485
|
"shutdown" => ("Compatibility bridge: stop only the selected workspace/team. Logs are retained by default; --keep-logs remains compatible.\n--json reports scope, degradation and owned residuals. Success does not mean other teams were shut down.",
|
|
465
486
|
"team-agent shutdown --workspace .\nteam-agent shutdown --workspace . --team help-demo --json", "Prefer team-agent stop --workspace . --team KEY --json. Verify this team's owned residuals are empty; use team-agent start for authorized later activation. Do not clean up other teams or shared servers."),
|
|
466
|
-
"add-agent" => ("Compatibility add-only entry. <agent> names the new seat; --provider/--model/--effort select intentional launch settings.\n--bypass requires true|false; --prompt sets responsibilities; --profile selects a local profile.\nProvider and bypass must be explicit in arguments or --role-file. Conflicting settings are refused before writes. --force requires explicit authorization, a positively dead old pane and no live cohort.",
|
|
487
|
+
"add-agent" => ("Compatibility add-only entry. <agent> names the new seat; --provider/--model/--effort select intentional launch settings.\n--bypass requires true|false; --prompt sets responsibilities; --profile selects a local profile.\nProvider and bypass must be explicit in arguments or --role-file. Conflicting settings are refused before writes. --force requires explicit authorization, a positively dead old pane and no live cohort;\nfor a removed seat, --force re-adopts the role file it left behind and CLI values override it.",
|
|
467
488
|
"team-agent add-agent reviewer --provider pi --model openai-codex/gpt-6-luna --bypass false --prompt 'Review tasks'\nteam-agent add-agent reviewer --role-file ./agents/reviewer.md", "Prefer team-agent start reviewer --role-file FILE for add-or-wake, or team-agent agent add reviewer for strict new-seat behavior. Keep provider/bypass explicit; check status and send a task after actual startup."),
|
|
468
489
|
"start-agent" => ("Compatibility entry starts an existing stopped seat only; a running seat is refused.\n--provider/--model/--effort/--bypass select intentional settings; --prompt replaces permanent instructions and --profile selects local authentication.\nA different provider is refused. Use --allow-fresh only after explicit authorization to lose saved context.",
|
|
469
490
|
"team-agent start-agent worker\nteam-agent start-agent worker --model openai-codex/gpt-6-luna", "Prefer team-agent start worker for daily add-or-wake or verified live no-op. Use team-agent stop worker before applying changed settings; inspect status and send a task afterward. A no-op is not role synchronization or business readiness."),
|
|
@@ -904,6 +925,7 @@ struct ParsedArgs {
|
|
|
904
925
|
to_leader: Option<String>,
|
|
905
926
|
provider: Option<String>,
|
|
906
927
|
socket: Option<String>,
|
|
928
|
+
dialect: Option<String>,
|
|
907
929
|
thread_id: Option<String>,
|
|
908
930
|
message_id: Option<String>,
|
|
909
931
|
mailbox: bool,
|
|
@@ -1006,6 +1028,7 @@ fn parse_args(args: &[String]) -> ParsedArgs {
|
|
|
1006
1028
|
"--to-leader" => parsed.to_leader = next_arg(args, &mut i),
|
|
1007
1029
|
"--provider" => parsed.provider = next_arg(args, &mut i),
|
|
1008
1030
|
"--socket" => parsed.socket = next_arg(args, &mut i),
|
|
1031
|
+
"--dialect" => parsed.dialect = next_arg(args, &mut i),
|
|
1009
1032
|
"--thread-id" => parsed.thread_id = next_arg(args, &mut i),
|
|
1010
1033
|
"--message-id" => parsed.message_id = next_arg(args, &mut i),
|
|
1011
1034
|
"--mailbox" => parsed.mailbox = true,
|
|
@@ -1644,9 +1667,9 @@ fn role_agent_args(
|
|
|
1644
1667
|
match flag {
|
|
1645
1668
|
"--provider" => {
|
|
1646
1669
|
// A contract name is written as the leaf's public name (`agent` →
|
|
1647
|
-
// `cursor`, `
|
|
1670
|
+
// `cursor`, `codex_cli` → `codex`); it declares the same leaf.
|
|
1648
1671
|
#[cfg(unix)]
|
|
1649
|
-
let contract = crate::contract_runtime::registry::declared(&value
|
|
1672
|
+
let contract = crate::contract_runtime::registry::declared(&value)
|
|
1650
1673
|
.map(crate::contract_runtime::registry::public_name);
|
|
1651
1674
|
#[cfg(not(unix))]
|
|
1652
1675
|
let contract: Option<&str> = None;
|
|
@@ -1689,11 +1712,6 @@ fn role_agent_args(
|
|
|
1689
1712
|
"add-agent requires --provider <name>".into(),
|
|
1690
1713
|
));
|
|
1691
1714
|
}
|
|
1692
|
-
if role.bypass.is_none() {
|
|
1693
|
-
return Err(CliError::Usage(
|
|
1694
|
-
"add-agent requires --bypass <true|false>".into(),
|
|
1695
|
-
));
|
|
1696
|
-
}
|
|
1697
1715
|
}
|
|
1698
1716
|
if parsed.positionals.len() != 1 {
|
|
1699
1717
|
return Err(CliError::Usage(
|
|
@@ -1716,10 +1734,9 @@ mod role_cli_tests {
|
|
|
1716
1734
|
}
|
|
1717
1735
|
|
|
1718
1736
|
#[test]
|
|
1719
|
-
fn
|
|
1737
|
+
fn add_requires_provider_without_a_template_but_accepts_file_input() {
|
|
1720
1738
|
for args in [
|
|
1721
1739
|
vec!["w"],
|
|
1722
|
-
vec!["w", "--provider", "pi"],
|
|
1723
1740
|
vec!["w", "--bypass", "false"],
|
|
1724
1741
|
] {
|
|
1725
1742
|
assert!(role_agent_args(&strings(&args), true).is_err());
|
|
@@ -1749,22 +1766,37 @@ mod role_cli_tests {
|
|
|
1749
1766
|
fn provider_accepts_contract_names_as_their_leaf_id() {
|
|
1750
1767
|
for (name, leaf) in [
|
|
1751
1768
|
("cursor", "cursor"), ("cursor-agent", "cursor"), ("agent", "cursor"),
|
|
1752
|
-
("cursor_agent", "cursor"), ("kiro", "kiro"),
|
|
1753
|
-
//
|
|
1754
|
-
|
|
1755
|
-
("
|
|
1769
|
+
("cursor_agent", "cursor"), ("kiro", "kiro"),
|
|
1770
|
+
// Codex and Grok Build keep their public command names, which
|
|
1771
|
+
// declare the leaf.
|
|
1772
|
+
("codex", "codex"), ("codex_cli", "codex"), ("codex-cli", "codex"),
|
|
1773
|
+
("codex_tui", "codex"), ("grok", "grok"), ("grok_build", "grok"),
|
|
1756
1774
|
] {
|
|
1757
1775
|
let (_, patch) = role_agent_args(
|
|
1758
1776
|
&strings(&["w", "--provider", name, "--bypass", "true"]), true,
|
|
1759
1777
|
).unwrap_or_else(|error| panic!("{name}: {error}"));
|
|
1760
1778
|
assert_eq!(patch.provider.as_deref(), Some(leaf), "{name}");
|
|
1761
1779
|
}
|
|
1762
|
-
let (_, patch) =
|
|
1763
|
-
role_agent_args(&strings(&["w", "--provider", "codex", "--bypass", "true"]), true).unwrap();
|
|
1764
|
-
assert_eq!(patch.provider.as_deref(), Some("codex"), "a bare shared key stays legacy");
|
|
1765
1780
|
assert!(role_agent_args(&strings(&["w", "--provider", "Cursor", "--bypass", "true"]), true).is_err());
|
|
1766
1781
|
}
|
|
1767
1782
|
|
|
1783
|
+
#[test]
|
|
1784
|
+
fn add_accepts_bypass_true_false_or_omission_for_every_provider() {
|
|
1785
|
+
for &provider in crate::provider::wire::all_providers() {
|
|
1786
|
+
let provider = crate::provider::wire::provider_wire(provider);
|
|
1787
|
+
let (_, patch) = role_agent_args(&strings(&["w", "--provider", provider]), true).unwrap();
|
|
1788
|
+
assert_eq!(patch.bypass, None);
|
|
1789
|
+
for bypass in ["true", "false"] {
|
|
1790
|
+
let (_, patch) = role_agent_args(
|
|
1791
|
+
&strings(&["w", "--provider", provider, "--bypass", bypass]),
|
|
1792
|
+
true,
|
|
1793
|
+
)
|
|
1794
|
+
.unwrap();
|
|
1795
|
+
assert_eq!(patch.bypass, Some(bypass == "true"));
|
|
1796
|
+
}
|
|
1797
|
+
}
|
|
1798
|
+
}
|
|
1799
|
+
|
|
1768
1800
|
#[test]
|
|
1769
1801
|
fn strict_role_options_reject_ambiguous_values() {
|
|
1770
1802
|
for args in [
|
|
@@ -2219,8 +2251,8 @@ mod tests {
|
|
|
2219
2251
|
.collect();
|
|
2220
2252
|
assert_eq!(
|
|
2221
2253
|
expected.len(),
|
|
2222
|
-
|
|
2223
|
-
"the public catalog
|
|
2254
|
+
36,
|
|
2255
|
+
"the public catalog includes endpoint discovery and scheduled leader reminders"
|
|
2224
2256
|
);
|
|
2225
2257
|
for spec_name in &expected {
|
|
2226
2258
|
assert!(
|
|
@@ -2348,6 +2380,7 @@ mod tests {
|
|
|
2348
2380
|
&["--workspace", "--team-id", "--yes", "--json"][..],
|
|
2349
2381
|
),
|
|
2350
2382
|
("send", &["--workspace", "--team", "--json"][..]),
|
|
2383
|
+
("schedule", &["--in", "--every", "--text", "--workspace", "--team", "--json"][..]),
|
|
2351
2384
|
(
|
|
2352
2385
|
"status",
|
|
2353
2386
|
&["--workspace", "--team", "--summary", "--json", "--detail"][..],
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
//! ---
|
|
2
|
-
//! purpose: 对账 .grok/config.toml
|
|
2
|
+
//! purpose: 对账 .grok/config.toml 残余共享槽与升级前遗留的在役 grok 席,含未首 turn 危险窗
|
|
3
3
|
//! contract:
|
|
4
4
|
//! provides:
|
|
5
5
|
//! - name: grok_slot_report
|
|
6
6
|
//! what: 盘上 ID/OWNER/AUTH、在役 grok、pre_first_turn;读不出为 unjudgeable
|
|
7
7
|
//! boundary:
|
|
8
8
|
//! - 读不出不报一致
|
|
9
|
-
//! - 不写盘、不改 overlay
|
|
9
|
+
//! - 不写盘、不改 overlay;legacy grok worker 已退役,本文件只做观测,
|
|
10
|
+
//! 帮助清理升级前留下的席位与共享槽(grok_build 叶子不写这份 toml)
|
|
10
11
|
//! maturity: wired
|
|
11
12
|
//! ---
|
|
12
13
|
|
|
@@ -91,8 +92,50 @@ struct DiskSlot {
|
|
|
91
92
|
extras: Vec<(String, String)>,
|
|
92
93
|
}
|
|
93
94
|
|
|
95
|
+
/// Shared identity keys belong on pane env. The only TEAM_AGENT_* key
|
|
96
|
+
/// allowed in the directory-scoped grok toml is WORKSPACE (same cwd).
|
|
97
|
+
fn is_per_seat_env_key(key: &str) -> bool {
|
|
98
|
+
let key = key.trim();
|
|
99
|
+
key.starts_with("TEAM_AGENT_") && key != "TEAM_AGENT_WORKSPACE"
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/// Per-seat keys of every `*.env` table, first-seen order, values unquoted.
|
|
103
|
+
fn per_seat_keys_in_toml(text: &str) -> Vec<(String, String)> {
|
|
104
|
+
let mut in_env_table = false;
|
|
105
|
+
let mut out = Vec::new();
|
|
106
|
+
for line in text.lines() {
|
|
107
|
+
let trimmed = line.trim();
|
|
108
|
+
if trimmed.starts_with('[') && trimmed.ends_with(']') {
|
|
109
|
+
let name = &trimmed[1..trimmed.len() - 1];
|
|
110
|
+
in_env_table = name.ends_with(".env");
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
if !in_env_table {
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
let Some((key, rest)) = trimmed.split_once('=') else {
|
|
117
|
+
continue;
|
|
118
|
+
};
|
|
119
|
+
let key = key.trim();
|
|
120
|
+
if !is_per_seat_env_key(key) {
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
let rest = rest.trim();
|
|
124
|
+
let value = rest
|
|
125
|
+
.strip_prefix('"')
|
|
126
|
+
.and_then(|s| s.strip_suffix('"'))
|
|
127
|
+
.or_else(|| rest.strip_prefix('\'').and_then(|s| s.strip_suffix('\'')))
|
|
128
|
+
.unwrap_or(rest);
|
|
129
|
+
if out.iter().any(|(existing, _)| existing == key) {
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
out.push((key.to_string(), value.to_string()));
|
|
133
|
+
}
|
|
134
|
+
out
|
|
135
|
+
}
|
|
136
|
+
|
|
94
137
|
fn parse_disk_slot(text: &str) -> DiskSlot {
|
|
95
|
-
let keys =
|
|
138
|
+
let keys = per_seat_keys_in_toml(text);
|
|
96
139
|
DiskSlot {
|
|
97
140
|
team_agent_id: find_key(&keys, "TEAM_AGENT_ID"),
|
|
98
141
|
owner_team_id: find_key(&keys, "TEAM_AGENT_OWNER_TEAM_ID"),
|
|
@@ -296,4 +339,46 @@ fn expected_auth_mode(live: &[LiveGrok]) -> Option<String> {
|
|
|
296
339
|
found
|
|
297
340
|
}
|
|
298
341
|
|
|
342
|
+
#[cfg(test)]
|
|
343
|
+
mod tests {
|
|
344
|
+
use super::*;
|
|
299
345
|
|
|
346
|
+
#[test]
|
|
347
|
+
fn workspace_is_shared_other_team_agent_keys_are_per_seat() {
|
|
348
|
+
assert!(!is_per_seat_env_key("TEAM_AGENT_WORKSPACE"));
|
|
349
|
+
assert!(is_per_seat_env_key("TEAM_AGENT_ID"));
|
|
350
|
+
assert!(is_per_seat_env_key("TEAM_AGENT_OWNER_TEAM_ID"));
|
|
351
|
+
assert!(is_per_seat_env_key("TEAM_AGENT_AUTH_MODE"));
|
|
352
|
+
assert!(is_per_seat_env_key("TEAM_AGENT_FUTURE_SEAT_KEY"));
|
|
353
|
+
assert!(!is_per_seat_env_key("GROK_FOLDER_TRUST"));
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
#[test]
|
|
357
|
+
fn scan_finds_per_seat_keys_in_env_table_only() {
|
|
358
|
+
let text = r#"
|
|
359
|
+
[mcp_servers.other.env]
|
|
360
|
+
TEAM_AGENT_ID = "ignore-other-server-still-counts"
|
|
361
|
+
|
|
362
|
+
[mcp_servers.team_orchestrator]
|
|
363
|
+
command = "/bin/x"
|
|
364
|
+
|
|
365
|
+
[mcp_servers.team_orchestrator.env]
|
|
366
|
+
TEAM_AGENT_WORKSPACE = "/ws"
|
|
367
|
+
TEAM_AGENT_AUTH_MODE = "impostor"
|
|
368
|
+
"#;
|
|
369
|
+
let keys = per_seat_keys_in_toml(text);
|
|
370
|
+
assert!(
|
|
371
|
+
keys.iter()
|
|
372
|
+
.any(|(k, v)| k == "TEAM_AGENT_AUTH_MODE" && v == "impostor"),
|
|
373
|
+
"must see AUTH; keys={keys:?}"
|
|
374
|
+
);
|
|
375
|
+
assert!(
|
|
376
|
+
keys.iter().any(|(k, _)| k == "TEAM_AGENT_ID"),
|
|
377
|
+
"any env table per-seat key counts; keys={keys:?}"
|
|
378
|
+
);
|
|
379
|
+
assert!(
|
|
380
|
+
!keys.iter().any(|(k, _)| k == "TEAM_AGENT_WORKSPACE"),
|
|
381
|
+
"WORKSPACE is shared; keys={keys:?}"
|
|
382
|
+
);
|
|
383
|
+
}
|
|
384
|
+
}
|