@team-agent/installer 0.5.124 → 0.5.126
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 -8
- package/Cargo.toml +1 -1
- package/README.md +2 -2
- package/README.zh.md +2 -2
- package/crates/team-agent/Cargo.toml +0 -1
- package/crates/team-agent/src/cli/diagnose.rs +39 -69
- package/crates/team-agent/src/cli/emit.rs +45 -15
- package/crates/team-agent/src/cli/intent/runtime.rs +5 -53
- package/crates/team-agent/src/cli/intent/runtime_tests.rs +10 -130
- package/crates/team-agent/src/cli/leader.rs +2 -3
- package/crates/team-agent/src/cli/leader_prompt.rs +1 -1
- package/crates/team-agent/src/cli/mod.rs +28 -33
- package/crates/team-agent/src/cli/models.rs +44 -880
- package/crates/team-agent/src/cli/route.rs +1 -1
- package/crates/team-agent/src/cli/send/persist.rs +36 -0
- package/crates/team-agent/src/cli/send/presentation.rs +7 -1
- package/crates/team-agent/src/cli/send.rs +3 -1
- package/crates/team-agent/src/cli/spec.rs +1 -2
- package/crates/team-agent/src/cli/status_port/brief.rs +66 -0
- package/crates/team-agent/src/cli/tests/base.rs +4 -11
- package/crates/team-agent/src/cli/tests/mod.rs +1 -1
- package/crates/team-agent/src/cli/tests/run_delegation.rs +5 -4
- package/crates/team-agent/src/cli/tests/status_send.rs +17 -0
- package/crates/team-agent/src/compiler/tests.rs +39 -8
- package/crates/team-agent/src/compiler.rs +28 -204
- package/crates/team-agent/src/contract_runtime/backend.rs +79 -40
- package/crates/team-agent/src/contract_runtime/config.rs +37 -24
- package/crates/team-agent/src/contract_runtime/discovery.rs +33 -0
- package/crates/team-agent/src/contract_runtime/fork.rs +368 -0
- package/crates/team-agent/src/contract_runtime/framework.rs +87 -34
- package/crates/team-agent/src/contract_runtime/mod.rs +1 -0
- package/crates/team-agent/src/contract_runtime/registry.rs +299 -21
- package/crates/team-agent/src/coordinator/runtime_detectors.rs +0 -1
- package/crates/team-agent/src/coordinator/tests/api_error_recovery.rs +29 -8
- package/crates/team-agent/src/coordinator/tests/health_sync.rs +0 -42
- package/crates/team-agent/src/coordinator/tick.rs +89 -1
- package/crates/team-agent/src/db/message_store.rs +78 -3
- package/crates/team-agent/src/layout/worker_window_helpers.rs +0 -1
- package/crates/team-agent/src/leader/prompt.rs +1 -2
- package/crates/team-agent/src/leader/provider_attribution.rs +0 -52
- package/crates/team-agent/src/leader/start.rs +1 -2
- package/crates/team-agent/src/leader/tests/prompt_contract.rs +2 -3
- package/crates/team-agent/src/lifecycle/launch/add_agent.rs +91 -0
- package/crates/team-agent/src/lifecycle/launch/add_agent_state.rs +15 -195
- package/crates/team-agent/src/lifecycle/launch/agent_state.rs +0 -9
- package/crates/team-agent/src/lifecycle/launch/clone_agent.rs +11 -27
- package/crates/team-agent/src/lifecycle/launch/fork_agent.rs +18 -29
- package/crates/team-agent/src/lifecycle/launch/fork_entry.rs +6 -87
- package/crates/team-agent/src/lifecycle/launch/mcp_config.rs +3 -11
- package/crates/team-agent/src/lifecycle/launch/pi_mcp.rs +74 -244
- package/crates/team-agent/src/lifecycle/launch/quick_start.rs +0 -24
- package/crates/team-agent/src/lifecycle/launch/role_source.rs +5 -0
- package/crates/team-agent/src/lifecycle/launch/spawn.rs +21 -61
- package/crates/team-agent/src/lifecycle/launch/spec_state.rs +0 -1
- package/crates/team-agent/src/lifecycle/launch/worker_env.rs +0 -108
- package/crates/team-agent/src/lifecycle/launch.rs +2 -43
- package/crates/team-agent/src/lifecycle/profile_launch.rs +21 -348
- package/crates/team-agent/src/lifecycle/profile_smoke.rs +1 -2
- package/crates/team-agent/src/lifecycle/restart/common.rs +43 -378
- package/crates/team-agent/src/lifecycle/restart/selection.rs +5 -5
- package/crates/team-agent/src/lifecycle/restart.rs +0 -2
- package/crates/team-agent/src/lifecycle/role_config.rs +42 -3
- package/crates/team-agent/src/lifecycle/tests/behavioral_diff_264_red.rs +11 -6
- package/crates/team-agent/src/lifecycle/tests/claude_profile_launch_red.rs +8 -320
- package/crates/team-agent/src/lifecycle/tests/cli_argv_routing_red.rs +60 -145
- package/crates/team-agent/src/lifecycle/tests/clone_fork_copilot_perms_red.rs +8 -334
- package/crates/team-agent/src/lifecycle/tests/communication_mode_runtime_contract_red.rs +30 -11
- package/crates/team-agent/src/lifecycle/tests/copilot_provider_red.rs +2 -2
- package/crates/team-agent/src/lifecycle/tests/core.rs +17 -16
- package/crates/team-agent/src/lifecycle/tests/grok_require_explicit_model_red.rs +12 -12
- package/crates/team-agent/src/lifecycle/tests/harvest2_a_batch_red.rs +3 -51
- package/crates/team-agent/src/lifecycle/tests/launch_spawn.rs +26 -28
- package/crates/team-agent/src/lifecycle/tests/pi_catalog_red.rs +6 -18
- package/crates/team-agent/src/lifecycle/tests/pi_command_red.rs +52 -70
- package/crates/team-agent/src/lifecycle/tests/pi_dual_entry_red.rs +4 -157
- package/crates/team-agent/src/lifecycle/tests/pi_executable_mcp_red.rs +10 -302
- package/crates/team-agent/src/lifecycle/tests/pi_lifecycle_doctor_red.rs +1 -68
- package/crates/team-agent/src/lifecycle/tests/pi_native_mcp_capability_red.rs +1 -19
- package/crates/team-agent/src/lifecycle/tests/pi_session_delivery_red.rs +2 -100
- package/crates/team-agent/src/lifecycle/tests/quick_start_worker_readiness_red.rs +11 -10
- package/crates/team-agent/src/lifecycle/tests/restart_rebind_hotfix_252_red.rs +0 -1
- package/crates/team-agent/src/lifecycle/tests/restart_session_capture_red.rs +2 -106
- package/crates/team-agent/src/lifecycle/tests/status_credential_redaction_contract.rs +2 -2
- package/crates/team-agent/src/lifecycle/tests/swallow_batch4_semantics_red.rs +2 -254
- package/crates/team-agent/src/lifecycle/tests/upgrade_compat_0211_red.rs +4 -4
- package/crates/team-agent/src/lifecycle/tests/verify_rs031_window_consistency_red.rs +6 -5
- package/crates/team-agent/src/lifecycle/tests/worker_spawn_env_red.rs +7 -153
- package/crates/team-agent/src/lifecycle/tests.rs +0 -6
- package/crates/team-agent/src/lifecycle/types.rs +2 -18
- package/crates/team-agent/src/lifecycle/worker_command_context.rs +2 -4
- package/crates/team-agent/src/mcp_server/readiness.rs +148 -97
- package/crates/team-agent/src/mcp_server/readiness_tests.rs +115 -16
- package/crates/team-agent/src/messaging/delivery.rs +185 -168
- package/crates/team-agent/src/messaging/delivery_consumption_tests.rs +5 -5
- package/crates/team-agent/src/messaging/enter_rescue_tests.rs +1 -1
- package/crates/team-agent/src/messaging/helpers.rs +19 -0
- package/crates/team-agent/src/messaging/tests/dup_inject.rs +67 -5
- package/crates/team-agent/src/messaging/tests/runtime.rs +110 -4
- package/crates/team-agent/src/messaging/tests/spine.rs +46 -36
- package/crates/team-agent/src/model/enums.rs +1 -8
- package/crates/team-agent/src/provider/adapter.rs +33 -302
- package/crates/team-agent/src/provider/adapters/mod.rs +4 -5
- package/crates/team-agent/src/provider/argv_route.rs +1 -5
- package/crates/team-agent/src/provider/bypass_flags.rs +3 -11
- package/crates/team-agent/src/provider/classify.rs +68 -3
- package/crates/team-agent/src/provider/faults.rs +1 -1
- package/crates/team-agent/src/provider/model_catalog.rs +14 -273
- package/crates/team-agent/src/provider/session/capture.rs +7 -107
- package/crates/team-agent/src/provider/session/context_fork/outcome.rs +0 -4
- package/crates/team-agent/src/provider/session/context_fork.rs +17 -109
- package/crates/team-agent/src/provider/session_scan/common.rs +11 -36
- package/crates/team-agent/src/provider/session_scan/pi.rs +1 -34
- package/crates/team-agent/src/provider/session_scan.rs +4 -14
- package/crates/team-agent/src/provider/submit_now.rs +5 -28
- package/crates/team-agent/src/provider/tests/adapter.rs +39 -275
- package/crates/team-agent/src/provider/tests/classify.rs +53 -0
- package/crates/team-agent/src/provider/tests/command_helpers.rs +3 -15
- package/crates/team-agent/src/provider/tests/idle.rs +0 -25
- package/crates/team-agent/src/provider/types.rs +1 -1
- package/crates/team-agent/src/provider/wire.rs +79 -11
- 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/repository/tests.rs +2 -2
- package/crates/team-agent/src/tmux_backend/native_input_tests.rs +2 -178
- package/crates/team-agent/src/tmux_backend/tests.rs +151 -0
- package/crates/team-agent/src/tmux_backend.rs +43 -8
- package/crates/team-agent/src/transport/native_input.rs +2 -231
- package/package.json +4 -4
- package/skills/team-agent/SKILL.md +7 -5
- 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/cursor_create_chat.rs +0 -229
- package/crates/team-agent/src/lifecycle/launch/cursor_mcp.rs +0 -522
- package/crates/team-agent/src/lifecycle/launch/cursor_mcp_iso.rs +0 -282
- package/crates/team-agent/src/lifecycle/restart/avatar.rs +0 -1805
- package/crates/team-agent/src/lifecycle/tests/claude_compatible_config_red.rs +0 -325
- package/crates/team-agent/src/lifecycle/tests/cursor_mcp_overlay.rs +0 -576
- package/crates/team-agent/src/lifecycle/tests/cursor_require_explicit_model_red.rs +0 -222
- package/crates/team-agent/src/lifecycle/tests/cursor_restart_resume_red.rs +0 -511
- package/crates/team-agent/src/lifecycle/tests/pi_compiler_red.rs +0 -210
- package/crates/team-agent/src/lifecycle/tests/pi_fork_session_inheritance_red.rs +0 -1409
- package/crates/team-agent/src/provider/adapters/claude.rs +0 -78
- package/crates/team-agent/src/provider/adapters/claude_fork.rs +0 -131
- package/crates/team-agent/src/provider/adapters/cursor_agent.rs +0 -44
- package/crates/team-agent/src/provider/adapters/pi.rs +0 -100
- package/crates/team-agent/src/provider/session/context_fork/claude.rs +0 -123
- package/crates/team-agent/src/provider/session_scan/claude.rs +0 -523
- package/crates/team-agent/src/provider/session_scan/cursor.rs +0 -538
- package/crates/team-agent/src/provider/testdata/cursor-list-models-native.stdout +0 -250
- package/crates/team-agent/src/test_support/models_timeout_fixture.rs +0 -144
|
@@ -2,29 +2,16 @@
|
|
|
2
2
|
use super::{CliError, CmdOutput, CmdResult, ExitCode, ModelsArgs};
|
|
3
3
|
use serde_json::{json, Value};
|
|
4
4
|
#[cfg(test)]
|
|
5
|
-
use std::collections::BTreeMap;
|
|
6
|
-
#[cfg(test)]
|
|
7
5
|
use std::path::Path;
|
|
8
|
-
#[cfg(test)]
|
|
9
|
-
use std::time::Duration;
|
|
10
|
-
|
|
11
|
-
#[cfg(test)]
|
|
12
|
-
const CATALOG_TIMEOUT: Duration = Duration::from_secs(10);
|
|
13
|
-
#[cfg(test)]
|
|
14
|
-
const MAX_CATALOG_BYTES: u64 = 1024 * 1024;
|
|
15
6
|
type ModelRecord = crate::provider::model_catalog::ModelRecord;
|
|
16
7
|
|
|
17
|
-
#[cfg(test)]
|
|
18
|
-
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
|
19
|
-
enum CatalogFormat {
|
|
20
|
-
Pi,
|
|
21
|
-
CursorAgent,
|
|
22
|
-
}
|
|
23
|
-
|
|
24
8
|
pub fn cmd_models(args: &ModelsArgs) -> Result<CmdResult, CliError> {
|
|
25
9
|
#[cfg(unix)]
|
|
26
|
-
if crate::contract_runtime::registry::
|
|
27
|
-
|
|
10
|
+
if let Some(descriptor) = crate::contract_runtime::registry::declared(&args.provider, false) {
|
|
11
|
+
// A role's provider names its catalog: `agent` or `cursor-agent` is the
|
|
12
|
+
// Cursor leaf; `claude`/`claude_code` and `pi` are the Claude Code and Pi leaves.
|
|
13
|
+
let args = ModelsArgs { provider: descriptor.identity.id.into(), ..args.clone() };
|
|
14
|
+
return crate::contract_runtime::discovery::models(&args);
|
|
28
15
|
}
|
|
29
16
|
let records = match crate::provider::model_catalog::discover_model_catalog(&args.provider) {
|
|
30
17
|
Ok(records) => records,
|
|
@@ -47,14 +34,9 @@ fn render_catalog(args: &ModelsArgs, all: Vec<ModelRecord>) -> Result<CmdResult,
|
|
|
47
34
|
.collect()
|
|
48
35
|
},
|
|
49
36
|
);
|
|
50
|
-
let current = if args.provider == "pi" {
|
|
51
|
-
current_role_model(&all.iter().map(|model| model.id.clone()).collect::<Vec<_>>())
|
|
52
|
-
} else {
|
|
53
|
-
None
|
|
54
|
-
};
|
|
55
37
|
let entries: Vec<Value> = visible.iter().map(|model| json!({
|
|
56
38
|
"role_model": model.id,
|
|
57
|
-
"current":
|
|
39
|
+
"current": Value::Null,
|
|
58
40
|
"provider": model.provider,
|
|
59
41
|
"vendor": model.vendor,
|
|
60
42
|
"model_id": model.id,
|
|
@@ -65,7 +47,7 @@ fn render_catalog(args: &ModelsArgs, all: Vec<ModelRecord>) -> Result<CmdResult,
|
|
|
65
47
|
let provider = args.provider.as_str();
|
|
66
48
|
let value = json!({
|
|
67
49
|
"schema_version": "models.v1", "ok": true, "provider": provider, "models": entries,
|
|
68
|
-
"auth": "ok", "auth_basis": "catalog_visibility", "current_role_model":
|
|
50
|
+
"auth": "ok", "auth_basis": "catalog_visibility", "current_role_model": Value::Null, "search": args.search,
|
|
69
51
|
});
|
|
70
52
|
if args.json {
|
|
71
53
|
Ok(CmdResult {
|
|
@@ -86,11 +68,7 @@ fn render_catalog(args: &ModelsArgs, all: Vec<ModelRecord>) -> Result<CmdResult,
|
|
|
86
68
|
model.vendor,
|
|
87
69
|
model.id,
|
|
88
70
|
model.display_name,
|
|
89
|
-
|
|
90
|
-
(current.as_deref() == Some(model.id.as_str())).to_string()
|
|
91
|
-
} else {
|
|
92
|
-
"—".to_string()
|
|
93
|
-
},
|
|
71
|
+
"—",
|
|
94
72
|
model
|
|
95
73
|
.default
|
|
96
74
|
.map_or_else(|| "—".to_string(), |value| value.to_string()),
|
|
@@ -107,89 +85,6 @@ fn render_catalog(args: &ModelsArgs, all: Vec<ModelRecord>) -> Result<CmdResult,
|
|
|
107
85
|
}
|
|
108
86
|
}
|
|
109
87
|
|
|
110
|
-
/// Existing injectable Pi boundary retained for deterministic command/timeout tests.
|
|
111
|
-
#[cfg(test)]
|
|
112
|
-
fn cmd_models_with(
|
|
113
|
-
args: &ModelsArgs,
|
|
114
|
-
program: &Path,
|
|
115
|
-
timeout: Duration,
|
|
116
|
-
max_bytes: u64,
|
|
117
|
-
) -> Result<CmdResult, CliError> {
|
|
118
|
-
cmd_models_with_format(args, program, CatalogFormat::Pi, timeout, max_bytes)
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
#[cfg(test)]
|
|
122
|
-
fn cmd_models_with_format(
|
|
123
|
-
args: &ModelsArgs,
|
|
124
|
-
program: &Path,
|
|
125
|
-
format: CatalogFormat,
|
|
126
|
-
timeout: Duration,
|
|
127
|
-
max_bytes: u64,
|
|
128
|
-
) -> Result<CmdResult, CliError> {
|
|
129
|
-
let bytes = match run_catalog(program, timeout, max_bytes) {
|
|
130
|
-
Ok(bytes) => bytes,
|
|
131
|
-
Err(message) => return Ok(failure(args, &message)),
|
|
132
|
-
};
|
|
133
|
-
let all = match parse_catalog(&bytes, format) {
|
|
134
|
-
Ok(models) => models,
|
|
135
|
-
Err(message) => return Ok(failure(args, &message)),
|
|
136
|
-
};
|
|
137
|
-
render_catalog(args, all)
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
#[cfg(test)]
|
|
141
|
-
fn parse_catalog(bytes: &[u8], format: CatalogFormat) -> Result<Vec<ModelRecord>, String> {
|
|
142
|
-
let provider = match format {
|
|
143
|
-
CatalogFormat::Pi => "pi",
|
|
144
|
-
CatalogFormat::CursorAgent => "cursor_agent",
|
|
145
|
-
};
|
|
146
|
-
let result = match format {
|
|
147
|
-
CatalogFormat::Pi => crate::provider::model_catalog::parse_pi_catalog(bytes),
|
|
148
|
-
CatalogFormat::CursorAgent => crate::provider::model_catalog::parse_cursor_catalog(bytes),
|
|
149
|
-
};
|
|
150
|
-
result.map_err(|error| error.message(provider))
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
#[cfg(test)]
|
|
154
|
-
fn parse_cursor_catalog(bytes: &[u8]) -> Result<Vec<ModelRecord>, String> {
|
|
155
|
-
crate::provider::model_catalog::parse_cursor_catalog(bytes)
|
|
156
|
-
.map_err(|error| error.message("cursor_agent"))
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
#[cfg(test)]
|
|
160
|
-
fn model_matches(model: &ModelRecord, search: &str) -> bool {
|
|
161
|
-
crate::provider::model_catalog::model_matches(model, search)
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
#[cfg(test)]
|
|
165
|
-
fn current_model_for(format: CatalogFormat, models: &[ModelRecord]) -> Option<String> {
|
|
166
|
-
match format {
|
|
167
|
-
CatalogFormat::Pi => current_role_model(
|
|
168
|
-
&models
|
|
169
|
-
.iter()
|
|
170
|
-
.map(|model| model.id.clone())
|
|
171
|
-
.collect::<Vec<_>>(),
|
|
172
|
-
),
|
|
173
|
-
CatalogFormat::CursorAgent => None,
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
#[cfg(test)]
|
|
178
|
-
fn failure(args: &ModelsArgs, message: &str) -> CmdResult {
|
|
179
|
-
let action = if message.starts_with("unsupported model provider") {
|
|
180
|
-
"choose a supported provider: pi, cursor_agent, codex, claude, or claude_code".to_string()
|
|
181
|
-
} else {
|
|
182
|
-
let executable = match args.provider.as_str() {
|
|
183
|
-
"cursor_agent" => "agent",
|
|
184
|
-
"codex" => "codex",
|
|
185
|
-
"claude" | "claude_code" => "claude",
|
|
186
|
-
_ => "pi",
|
|
187
|
-
};
|
|
188
|
-
format!("install or repair the PATH-first `{executable}` executable, then retry `team-agent models --provider {}`", args.provider)
|
|
189
|
-
};
|
|
190
|
-
failure_with_action(args, message, &action)
|
|
191
|
-
}
|
|
192
|
-
|
|
193
88
|
fn failure_with_action(args: &ModelsArgs, message: &str, action: &str) -> CmdResult {
|
|
194
89
|
let value = json!({ "schema_version": "models.v1", "ok": false, "provider": args.provider, "auth": "not_ready", "auth_basis": "catalog_visibility", "models": Value::Array(Vec::new()), "current_role_model": Value::Null, "error": message, "action": action });
|
|
195
90
|
if args.json {
|
|
@@ -205,39 +100,11 @@ fn failure_with_action(args: &ModelsArgs, message: &str, action: &str) -> CmdRes
|
|
|
205
100
|
CmdResult { output: CmdOutput::Human(format!("models.v1 | error: {message}\naction: {action}\nauth: not_ready (catalog_visibility)")), exit: ExitCode::Error, as_json: false, preserve_json_order: false }
|
|
206
101
|
}
|
|
207
102
|
}
|
|
208
|
-
fn current_role_model(models: &[String]) -> Option<String> {
|
|
209
|
-
current_role_model_from(
|
|
210
|
-
models,
|
|
211
|
-
std::env::var("PI_PROVIDER").ok().as_deref(),
|
|
212
|
-
std::env::var("PI_MODEL").ok().as_deref(),
|
|
213
|
-
)
|
|
214
|
-
}
|
|
215
|
-
fn current_role_model_from(
|
|
216
|
-
models: &[String],
|
|
217
|
-
provider: Option<&str>,
|
|
218
|
-
model: Option<&str>,
|
|
219
|
-
) -> Option<String> {
|
|
220
|
-
let exact = format!("{}/{}", provider?, model?);
|
|
221
|
-
models
|
|
222
|
-
.iter()
|
|
223
|
-
.any(|candidate| candidate == &exact)
|
|
224
|
-
.then_some(exact)
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
/// Injectable executable, deadline, and byte-limit boundary for deterministic tests.
|
|
228
|
-
#[cfg(test)]
|
|
229
|
-
fn run_catalog(program: &Path, timeout: Duration, max_bytes: u64) -> Result<Vec<u8>, String> {
|
|
230
|
-
crate::lifecycle::launch::pi_mcp::run_pi_catalog(program, timeout, max_bytes)
|
|
231
|
-
}
|
|
232
|
-
|
|
233
103
|
#[cfg(test)]
|
|
234
104
|
mod tests {
|
|
235
105
|
use super::*;
|
|
236
106
|
#[cfg(unix)]
|
|
237
|
-
use std::io::Write;
|
|
238
|
-
#[cfg(unix)]
|
|
239
107
|
use std::sync::atomic::{AtomicU64, Ordering};
|
|
240
|
-
use std::time::Instant;
|
|
241
108
|
|
|
242
109
|
#[cfg(unix)]
|
|
243
110
|
static FIXTURE_SEQUENCE: AtomicU64 = AtomicU64::new(0);
|
|
@@ -257,187 +124,6 @@ mod tests {
|
|
|
257
124
|
std::process::exit(exit.code());
|
|
258
125
|
}
|
|
259
126
|
|
|
260
|
-
#[cfg(unix)]
|
|
261
|
-
#[test]
|
|
262
|
-
fn real_dispatcher_isolated_success_json_human_and_no_match() {
|
|
263
|
-
let pi = fixture("printf 'provider model\\nopenai-codex gpt-5.6-sol\\n'");
|
|
264
|
-
let dir = pi.parent().unwrap().to_path_buf();
|
|
265
|
-
let run_child = |args: &[&str], model: &str| {
|
|
266
|
-
std::process::Command::new(std::env::current_exe().unwrap())
|
|
267
|
-
.args([
|
|
268
|
-
"--exact",
|
|
269
|
-
"cli::models::tests::real_dispatcher_child_helper",
|
|
270
|
-
"--nocapture",
|
|
271
|
-
])
|
|
272
|
-
.env("TEAM_AGENT_MODELS_CHILD", "1")
|
|
273
|
-
.env(
|
|
274
|
-
"TEAM_AGENT_MODELS_ARGS",
|
|
275
|
-
serde_json::to_string(args).unwrap(),
|
|
276
|
-
)
|
|
277
|
-
.env("PATH", &dir)
|
|
278
|
-
.env("PI_PROVIDER", "openai-codex")
|
|
279
|
-
.env("PI_MODEL", model)
|
|
280
|
-
.output()
|
|
281
|
-
.unwrap()
|
|
282
|
-
};
|
|
283
|
-
let json = run_child(&["models", "--provider", "pi", "--json"], "gpt-5.6-sol");
|
|
284
|
-
assert!(json.status.success());
|
|
285
|
-
let output = String::from_utf8(json.stdout).unwrap();
|
|
286
|
-
let cli_output = output
|
|
287
|
-
.split("__TEAM_AGENT_MODELS_CLI_OUTPUT_v1__\n")
|
|
288
|
-
.nth(1)
|
|
289
|
-
.unwrap();
|
|
290
|
-
let value: Value = serde_json::from_str(cli_output.trim()).unwrap();
|
|
291
|
-
assert_eq!(value["schema_version"], "models.v1");
|
|
292
|
-
assert_eq!(value["models"][0]["role_model"], "openai-codex/gpt-5.6-sol");
|
|
293
|
-
assert_eq!(value["models"][0]["current"], true);
|
|
294
|
-
let human = run_child(
|
|
295
|
-
&["models", "--provider", "pi", "--search", "absent"],
|
|
296
|
-
"missing",
|
|
297
|
-
);
|
|
298
|
-
assert!(human.status.success());
|
|
299
|
-
let human_output = String::from_utf8(human.stdout).unwrap();
|
|
300
|
-
let text = human_output
|
|
301
|
-
.split("__TEAM_AGENT_MODELS_CLI_OUTPUT_v1__\n")
|
|
302
|
-
.nth(1)
|
|
303
|
-
.unwrap();
|
|
304
|
-
assert!(text.contains("No models matched --search") && text.contains("auth: ok"));
|
|
305
|
-
let null = run_child(&["models", "--provider", "pi", "--json"], "missing");
|
|
306
|
-
let null_output = String::from_utf8(null.stdout).unwrap();
|
|
307
|
-
let null_cli = null_output
|
|
308
|
-
.split("__TEAM_AGENT_MODELS_CLI_OUTPUT_v1__\n")
|
|
309
|
-
.nth(1)
|
|
310
|
-
.unwrap();
|
|
311
|
-
let null_value: Value = serde_json::from_str(null_cli.trim()).unwrap();
|
|
312
|
-
assert!(null.status.success() && null_value["current_role_model"].is_null());
|
|
313
|
-
std::fs::write(&pi, "#!/bin/sh\nprintf 'sensitive-stderr' >&2\nexit 7\n").unwrap();
|
|
314
|
-
let failed = run_child(&["models", "--provider", "pi", "--json"], "missing");
|
|
315
|
-
assert!(!failed.status.success());
|
|
316
|
-
let failed_output = String::from_utf8(failed.stdout).unwrap();
|
|
317
|
-
let failed_cli = failed_output
|
|
318
|
-
.split("__TEAM_AGENT_MODELS_CLI_OUTPUT_v1__\n")
|
|
319
|
-
.nth(1)
|
|
320
|
-
.unwrap();
|
|
321
|
-
assert!(!failed_cli.contains("sensitive-stderr"));
|
|
322
|
-
assert_eq!(
|
|
323
|
-
std::fs::read_to_string(pi.with_extension("count"))
|
|
324
|
-
.unwrap()
|
|
325
|
-
.lines()
|
|
326
|
-
.count(),
|
|
327
|
-
3
|
|
328
|
-
);
|
|
329
|
-
cleanup_fixture(&pi);
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
#[test]
|
|
333
|
-
fn current_model_is_deterministic() {
|
|
334
|
-
let models = vec!["openai-codex/gpt-5.6-sol".into()];
|
|
335
|
-
assert_eq!(
|
|
336
|
-
current_role_model_from(&models, Some("openai-codex"), Some("gpt-5.6-sol")),
|
|
337
|
-
Some("openai-codex/gpt-5.6-sol".into())
|
|
338
|
-
);
|
|
339
|
-
assert_eq!(
|
|
340
|
-
current_role_model_from(&models, Some("openai-codex"), Some("other")),
|
|
341
|
-
None
|
|
342
|
-
);
|
|
343
|
-
assert_eq!(
|
|
344
|
-
current_role_model_from(&models, None, Some("gpt-5.6-sol")),
|
|
345
|
-
None
|
|
346
|
-
);
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
#[cfg(unix)]
|
|
350
|
-
#[test]
|
|
351
|
-
fn search_survives_unrelated_spaced_model_ids() {
|
|
352
|
-
let catalog =
|
|
353
|
-
include_str!("../lifecycle/tests/fixtures/pi_list_models_spaced_ids.stdout.txt");
|
|
354
|
-
let path = fixture(&format!("printf '%s' '{catalog}'"));
|
|
355
|
-
let result = cmd_models_with(
|
|
356
|
-
&ModelsArgs {
|
|
357
|
-
provider: "pi".into(),
|
|
358
|
-
search: Some("gpt-5.6-luna".into()),
|
|
359
|
-
json: true,
|
|
360
|
-
},
|
|
361
|
-
&path,
|
|
362
|
-
Duration::from_secs(10),
|
|
363
|
-
MAX_CATALOG_BYTES,
|
|
364
|
-
)
|
|
365
|
-
.unwrap();
|
|
366
|
-
cleanup_fixture(&path);
|
|
367
|
-
assert_eq!(result.exit, ExitCode::Ok);
|
|
368
|
-
let CmdOutput::Human(text) = result.output else {
|
|
369
|
-
panic!("expected JSON projection")
|
|
370
|
-
};
|
|
371
|
-
let value: Value = serde_json::from_str(&text).unwrap();
|
|
372
|
-
assert_eq!(value["ok"], true);
|
|
373
|
-
assert_eq!(value["auth"], "ok");
|
|
374
|
-
let models = value["models"].as_array().unwrap();
|
|
375
|
-
assert_eq!(models.len(), 2);
|
|
376
|
-
assert_eq!(models[0]["role_model"], "openai-codex/gpt-5.6-luna");
|
|
377
|
-
assert_eq!(models[1]["role_model"], "team-agent/gpt-5.6-luna");
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
#[cfg(unix)]
|
|
381
|
-
#[test]
|
|
382
|
-
fn cursor_catalog_parses_copyable_ids_and_multiword_search() {
|
|
383
|
-
let path = fixture(
|
|
384
|
-
"printf 'Available models\\ngpt-5.6-luna-high - GPT-5.6 Luna 1M High\\ncursor-grok-4.6-high - Cursor Grok 4.6\\nauto - Auto (default)\\n'",
|
|
385
|
-
);
|
|
386
|
-
let result = cmd_models_with_format(
|
|
387
|
-
&ModelsArgs {
|
|
388
|
-
provider: "cursor_agent".into(),
|
|
389
|
-
search: Some("GPT luna".into()),
|
|
390
|
-
json: true,
|
|
391
|
-
},
|
|
392
|
-
&path,
|
|
393
|
-
CatalogFormat::CursorAgent,
|
|
394
|
-
Duration::from_secs(1),
|
|
395
|
-
MAX_CATALOG_BYTES,
|
|
396
|
-
)
|
|
397
|
-
.unwrap();
|
|
398
|
-
let CmdOutput::Human(text) = result.output else {
|
|
399
|
-
panic!("expected JSON projection")
|
|
400
|
-
};
|
|
401
|
-
let value: Value = serde_json::from_str(&text).unwrap();
|
|
402
|
-
assert_eq!(value["ok"], true, "{text}");
|
|
403
|
-
assert_eq!(value["provider"], "cursor_agent");
|
|
404
|
-
assert_eq!(value["models"].as_array().unwrap().len(), 1);
|
|
405
|
-
assert_eq!(value["models"][0]["role_model"], "gpt-5.6-luna-high");
|
|
406
|
-
assert_eq!(value["models"][0]["model_id"], "gpt-5.6-luna-high");
|
|
407
|
-
assert_eq!(value["models"][0]["display_name"], "GPT-5.6 Luna 1M High");
|
|
408
|
-
assert_eq!(value["models"][0]["current"], Value::Null);
|
|
409
|
-
cleanup_fixture(&path);
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
#[cfg(unix)]
|
|
413
|
-
#[test]
|
|
414
|
-
fn cursor_native_tip_fixture_works_through_public_cli_once() {
|
|
415
|
-
let agent = native_cli_fixture(
|
|
416
|
-
"agent",
|
|
417
|
-
include_bytes!("../provider/testdata/cursor-list-models-native.stdout"),
|
|
418
|
-
);
|
|
419
|
-
let output = run_public_models_cli(
|
|
420
|
-
&agent.program,
|
|
421
|
-
agent.response.as_deref(),
|
|
422
|
-
&["models", "--provider", "cursor_agent", "--json"],
|
|
423
|
-
);
|
|
424
|
-
let text = public_cli_text(&output);
|
|
425
|
-
let calls =
|
|
426
|
-
std::fs::read_to_string(agent.program.with_extension("count")).unwrap_or_default();
|
|
427
|
-
drop(agent);
|
|
428
|
-
assert!(output.status.success(), "{text}");
|
|
429
|
-
assert_eq!(calls, "1:--list-models\n");
|
|
430
|
-
let value: Value = serde_json::from_str(text.trim()).unwrap();
|
|
431
|
-
assert_eq!(value["schema_version"], "models.v1");
|
|
432
|
-
assert_eq!(value["provider"], "cursor_agent");
|
|
433
|
-
let models = value["models"].as_array().unwrap();
|
|
434
|
-
for exact in ["gpt-5.6-luna-low", "gpt-5.6-luna-xhigh"] {
|
|
435
|
-
assert!(models.iter().any(|model| model["model_id"] == exact));
|
|
436
|
-
}
|
|
437
|
-
assert_eq!(models[0]["model_id"], "auto");
|
|
438
|
-
assert_eq!(models[0]["default"], true);
|
|
439
|
-
}
|
|
440
|
-
|
|
441
127
|
#[cfg(unix)]
|
|
442
128
|
#[test]
|
|
443
129
|
fn cursor_contract_catalog_uses_public_launcher_metadata_then_exact_ids() {
|
|
@@ -450,7 +136,7 @@ case "$1" in
|
|
|
450
136
|
esac"#);
|
|
451
137
|
let mut cursor = CliFixture::new(program);
|
|
452
138
|
let response = cursor.program.with_extension("stdout");
|
|
453
|
-
std::fs::write(&response, include_bytes!("
|
|
139
|
+
std::fs::write(&response, include_bytes!("../../../team-agent-contract/tests/fixtures/cursor-2026.10.01-models.txt")).unwrap();
|
|
454
140
|
cursor.response = Some(response);
|
|
455
141
|
let output = run_public_models_cli(&cursor.program, cursor.response.as_deref(),
|
|
456
142
|
&["models", "--provider", "cursor", "--search", "gpt-5.6-luna-xhigh", "--json"]);
|
|
@@ -495,6 +181,38 @@ esac"#);
|
|
|
495
181
|
assert!(value["models"].as_array().unwrap().iter().any(|row| row["model_id"] == "grok-4.7-build-fast"));
|
|
496
182
|
}
|
|
497
183
|
|
|
184
|
+
#[cfg(unix)]
|
|
185
|
+
#[test]
|
|
186
|
+
fn every_cursor_provider_name_reads_the_contract_catalog_through_cursor_agent() {
|
|
187
|
+
use std::os::unix::fs::PermissionsExt;
|
|
188
|
+
for name in ["cursor_agent", "cursor-agent", "agent"] {
|
|
189
|
+
let mut cursor = CliFixture::new(fixture_program("cursor-agent", r#"
|
|
190
|
+
test "$#" = 1 || exit 9
|
|
191
|
+
case "$1" in
|
|
192
|
+
--version) printf '%s\n' '2026.10.01-a1b2c3' ;;
|
|
193
|
+
--list-models) exec /bin/cat "$TEAM_AGENT_MODELS_FIXTURE" ;;
|
|
194
|
+
*) exit 9 ;;
|
|
195
|
+
esac"#));
|
|
196
|
+
let response = cursor.program.with_extension("stdout");
|
|
197
|
+
std::fs::write(&response, include_bytes!("../../../team-agent-contract/tests/fixtures/cursor-2026.10.01-models.txt")).unwrap();
|
|
198
|
+
cursor.response = Some(response);
|
|
199
|
+
// The legacy binary name on PATH is never what runs.
|
|
200
|
+
let legacy = cursor.program.parent().unwrap().join("agent");
|
|
201
|
+
std::fs::write(&legacy, "#!/bin/sh\nprintf 'called' > \"$0.called\"\nexit 9\n").unwrap();
|
|
202
|
+
std::fs::set_permissions(&legacy, std::fs::Permissions::from_mode(0o700)).unwrap();
|
|
203
|
+
let output = run_public_models_cli(&cursor.program, cursor.response.as_deref(),
|
|
204
|
+
&["models", "--provider", name, "--json"]);
|
|
205
|
+
let text = public_cli_text(&output);
|
|
206
|
+
assert!(output.status.success(), "{name}: {text}");
|
|
207
|
+
assert_eq!(std::fs::read_to_string(cursor.program.with_extension("count")).unwrap(),
|
|
208
|
+
"1:--version\n1:--list-models\n", "{name}");
|
|
209
|
+
assert!(!legacy.with_extension("called").exists(), "{name}");
|
|
210
|
+
let value: Value = serde_json::from_str(text.trim()).unwrap();
|
|
211
|
+
assert_eq!(value["provider"], "cursor", "{name}");
|
|
212
|
+
assert!(value["models"].as_array().unwrap().iter().any(|row| row["model_id"] == "gpt-5.6-luna-xhigh"), "{name}");
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
498
216
|
#[cfg(unix)]
|
|
499
217
|
#[test]
|
|
500
218
|
fn cursor_contract_bad_version_has_no_legacy_entrypoint_fallback() {
|
|
@@ -714,11 +432,6 @@ esac"#);
|
|
|
714
432
|
);
|
|
715
433
|
}
|
|
716
434
|
|
|
717
|
-
#[cfg(unix)]
|
|
718
|
-
fn fixture(body: &str) -> std::path::PathBuf {
|
|
719
|
-
fixture_program("pi", body)
|
|
720
|
-
}
|
|
721
|
-
|
|
722
435
|
#[cfg(unix)]
|
|
723
436
|
fn fixture_program(program: &str, body: &str) -> std::path::PathBuf {
|
|
724
437
|
let sequence = FIXTURE_SEQUENCE.fetch_add(1, Ordering::Relaxed);
|
|
@@ -836,568 +549,19 @@ esac"#);
|
|
|
836
549
|
.to_string()
|
|
837
550
|
}
|
|
838
551
|
|
|
839
|
-
#[cfg(unix)]
|
|
840
|
-
fn fixture_with_sidecars(body: &str) -> std::path::PathBuf {
|
|
841
|
-
let path = fixture(body);
|
|
842
|
-
let script = std::fs::read_to_string(&path).unwrap();
|
|
843
|
-
let script = script.strip_prefix("#!/bin/sh\n").unwrap();
|
|
844
|
-
let script = format!(
|
|
845
|
-
"#!/bin/sh\nprintf '1\\n' > \"$0.entered\" || :\n{script}body_status=$?\nprintf '1\\n' > \"$0.completed\" || :\nexit \"$body_status\"\n"
|
|
846
|
-
);
|
|
847
|
-
install_executable(&path, &script);
|
|
848
|
-
path
|
|
849
|
-
}
|
|
850
|
-
|
|
851
552
|
#[cfg(unix)]
|
|
852
553
|
fn cleanup_fixture(path: &Path) {
|
|
853
554
|
let _ = std::fs::remove_dir_all(path.parent().unwrap());
|
|
854
555
|
}
|
|
855
556
|
|
|
856
|
-
#[cfg(unix)]
|
|
857
|
-
fn native_timeout_fixture() -> std::path::PathBuf {
|
|
858
|
-
let path = std::path::PathBuf::from(env!("TEAM_AGENT_MODELS_TIMEOUT_FIXTURE"));
|
|
859
|
-
assert!(path.is_file(), "prebuilt models timeout fixture is missing");
|
|
860
|
-
path
|
|
861
|
-
}
|
|
862
|
-
|
|
863
|
-
#[cfg(unix)]
|
|
864
|
-
fn native_timeout_receipt() -> std::path::PathBuf {
|
|
865
|
-
let stamp = std::time::SystemTime::now()
|
|
866
|
-
.duration_since(std::time::UNIX_EPOCH)
|
|
867
|
-
.unwrap()
|
|
868
|
-
.as_nanos();
|
|
869
|
-
std::path::PathBuf::from("/tmp").join(format!(
|
|
870
|
-
"team-agent-models-timeout-{}-{stamp}.receipt",
|
|
871
|
-
std::process::id()
|
|
872
|
-
))
|
|
873
|
-
}
|
|
874
|
-
|
|
875
|
-
#[cfg(unix)]
|
|
876
|
-
fn native_timeout_stage_receipt(receipt: &Path) -> std::path::PathBuf {
|
|
877
|
-
receipt.with_extension("stage")
|
|
878
|
-
}
|
|
879
|
-
|
|
880
|
-
#[cfg(unix)]
|
|
881
|
-
fn parse_native_timeout_receipt(path: &Path) -> Option<BTreeMap<String, String>> {
|
|
882
|
-
let mut fields = BTreeMap::new();
|
|
883
|
-
for line in std::fs::read_to_string(path).ok()?.lines() {
|
|
884
|
-
let (key, value) = line.split_once('=')?;
|
|
885
|
-
if fields.insert(key.to_string(), value.to_string()).is_some() {
|
|
886
|
-
return None;
|
|
887
|
-
}
|
|
888
|
-
}
|
|
889
|
-
let keys = fields.keys().map(String::as_str).collect::<Vec<_>>();
|
|
890
|
-
(keys
|
|
891
|
-
== vec![
|
|
892
|
-
"child_argv_exact",
|
|
893
|
-
"child_pid",
|
|
894
|
-
"child_spawn_attempts",
|
|
895
|
-
"descendant_pid",
|
|
896
|
-
"descendant_started",
|
|
897
|
-
"descendant_stdout_inherited",
|
|
898
|
-
"parent_argv_exact",
|
|
899
|
-
"parent_pid",
|
|
900
|
-
"parent_started_once",
|
|
901
|
-
])
|
|
902
|
-
.then_some(fields)
|
|
903
|
-
}
|
|
904
|
-
|
|
905
|
-
#[cfg(unix)]
|
|
906
|
-
fn wait_native_timeout_receipt(path: &Path) -> BTreeMap<String, String> {
|
|
907
|
-
let deadline = Instant::now() + Duration::from_millis(500);
|
|
908
|
-
loop {
|
|
909
|
-
if let Some(fields) = parse_native_timeout_receipt(path) {
|
|
910
|
-
return fields;
|
|
911
|
-
}
|
|
912
|
-
if Instant::now() >= deadline {
|
|
913
|
-
panic!("native timeout receipt did not become complete after runner return");
|
|
914
|
-
}
|
|
915
|
-
std::thread::sleep(Duration::from_millis(1));
|
|
916
|
-
}
|
|
917
|
-
}
|
|
918
|
-
|
|
919
|
-
#[cfg(unix)]
|
|
920
|
-
fn with_native_mode<T>(
|
|
921
|
-
mode: &str,
|
|
922
|
-
action: impl FnOnce() -> T,
|
|
923
|
-
) -> (
|
|
924
|
-
T,
|
|
925
|
-
crate::lifecycle::launch::pi_mcp::PiCatalogTestObservation,
|
|
926
|
-
) {
|
|
927
|
-
let receipt = native_timeout_receipt();
|
|
928
|
-
assert!(!receipt.exists());
|
|
929
|
-
let result = crate::lifecycle::launch::pi_mcp::with_pi_catalog_test_observation(
|
|
930
|
-
&receipt,
|
|
931
|
-
Some(mode),
|
|
932
|
-
action,
|
|
933
|
-
);
|
|
934
|
-
assert!(!receipt.exists());
|
|
935
|
-
let _ = std::fs::remove_file(format!("{}.sock", receipt.display()));
|
|
936
|
-
result
|
|
937
|
-
}
|
|
938
|
-
|
|
939
|
-
#[cfg(unix)]
|
|
940
|
-
fn safe_fixture_sidecar(path: &Path, expected: &str) -> &'static str {
|
|
941
|
-
match std::fs::read_to_string(path) {
|
|
942
|
-
Ok(text) if text == expected => "present_expected",
|
|
943
|
-
Ok(_) => "present_unexpected",
|
|
944
|
-
Err(error) if error.kind() == std::io::ErrorKind::NotFound => "missing",
|
|
945
|
-
Err(_) => "unavailable",
|
|
946
|
-
}
|
|
947
|
-
}
|
|
948
|
-
|
|
949
|
-
#[cfg(unix)]
|
|
950
|
-
fn safe_runner_fixture_observation(path: &Path) -> String {
|
|
951
|
-
format!(
|
|
952
|
-
"fixture_entered={} fixture_completed={} fixture_count={}",
|
|
953
|
-
safe_fixture_sidecar(&path.with_extension("entered"), "1\n"),
|
|
954
|
-
safe_fixture_sidecar(&path.with_extension("completed"), "1\n"),
|
|
955
|
-
safe_fixture_sidecar(&path.with_extension("count"), "1:--list-models\n"),
|
|
956
|
-
)
|
|
957
|
-
}
|
|
958
|
-
|
|
959
|
-
#[cfg(unix)]
|
|
960
|
-
fn safe_runner_observation(
|
|
961
|
-
elapsed: Duration,
|
|
962
|
-
observation: &crate::lifecycle::launch::pi_mcp::PiCatalogTestObservation,
|
|
963
|
-
) -> String {
|
|
964
|
-
format!(
|
|
965
|
-
"elapsed_ms={} spawn_count={} argv={:?} parent_pid={:?} parent_exit_success={:?} parent_exit_code={:?} reader_timeout={}",
|
|
966
|
-
elapsed.as_millis(),
|
|
967
|
-
observation.spawn_count,
|
|
968
|
-
observation.argv,
|
|
969
|
-
observation.parent_pid,
|
|
970
|
-
observation.parent_exit_success,
|
|
971
|
-
observation.parent_exit_code,
|
|
972
|
-
observation.reader_timeout,
|
|
973
|
-
)
|
|
974
|
-
}
|
|
975
|
-
|
|
976
|
-
#[cfg(unix)]
|
|
977
|
-
fn safe_models_result_class(result: &CmdResult) -> &'static str {
|
|
978
|
-
let CmdOutput::Human(text) = &result.output else {
|
|
979
|
-
return "non_human_output";
|
|
980
|
-
};
|
|
981
|
-
let Ok(value) = serde_json::from_str::<Value>(text) else {
|
|
982
|
-
return "non_json_output";
|
|
983
|
-
};
|
|
984
|
-
match value.get("ok").and_then(Value::as_bool) {
|
|
985
|
-
Some(true) => "success_json",
|
|
986
|
-
Some(false) => match value.get("error").and_then(Value::as_str) {
|
|
987
|
-
Some(error) if error.contains("unavailable") => "runner_unavailable",
|
|
988
|
-
Some(error) if error.contains("timed out") => "runner_timeout",
|
|
989
|
-
Some(error) if error.contains("command failed") => "runner_exit",
|
|
990
|
-
Some(error) if error.contains("could not be read") => "reader_error",
|
|
991
|
-
Some(error) if error.contains("exceeds") => "reader_oversize",
|
|
992
|
-
Some(error) if error.contains("catalog") => "parser_catalog_error",
|
|
993
|
-
Some(_) => "failure_json",
|
|
994
|
-
None => "failure_json_missing_error",
|
|
995
|
-
},
|
|
996
|
-
None => "json_missing_ok",
|
|
997
|
-
}
|
|
998
|
-
}
|
|
999
|
-
|
|
1000
|
-
#[cfg(unix)]
|
|
1001
|
-
fn safe_models_observation(
|
|
1002
|
-
elapsed: Duration,
|
|
1003
|
-
result: &CmdResult,
|
|
1004
|
-
observation: &crate::lifecycle::launch::pi_mcp::PiCatalogTestObservation,
|
|
1005
|
-
) -> String {
|
|
1006
|
-
format!(
|
|
1007
|
-
"class={} elapsed_ms={} parent_pid={:?} parent_exit_success={:?} parent_exit_code={:?} reader_timeout={}",
|
|
1008
|
-
safe_models_result_class(result),
|
|
1009
|
-
elapsed.as_millis(),
|
|
1010
|
-
observation.parent_pid,
|
|
1011
|
-
observation.parent_exit_success,
|
|
1012
|
-
observation.parent_exit_code,
|
|
1013
|
-
observation.reader_timeout,
|
|
1014
|
-
)
|
|
1015
|
-
}
|
|
1016
|
-
|
|
1017
|
-
#[cfg(unix)]
|
|
1018
|
-
#[test]
|
|
1019
|
-
fn runner_invokes_exact_argv_once_and_drains() {
|
|
1020
|
-
let path = fixture_with_sidecars(
|
|
1021
|
-
"test \"$1\" = --list-models && echo provider model && echo openai-codex gpt-5.6-sol",
|
|
1022
|
-
);
|
|
1023
|
-
let receipt = native_timeout_receipt();
|
|
1024
|
-
assert!(!receipt.exists());
|
|
1025
|
-
let started = Instant::now();
|
|
1026
|
-
let (result, observation) =
|
|
1027
|
-
crate::lifecycle::launch::pi_mcp::with_pi_catalog_test_observation(
|
|
1028
|
-
&receipt,
|
|
1029
|
-
None,
|
|
1030
|
-
|| run_catalog(&path, Duration::from_secs(1), 1024),
|
|
1031
|
-
);
|
|
1032
|
-
let elapsed = started.elapsed();
|
|
1033
|
-
let fixture_observation = safe_runner_fixture_observation(&path);
|
|
1034
|
-
assert!(
|
|
1035
|
-
result
|
|
1036
|
-
.as_ref()
|
|
1037
|
-
.is_ok_and(|bytes| bytes.starts_with(b"provider model")),
|
|
1038
|
-
"runner observation: {}; {}",
|
|
1039
|
-
safe_runner_observation(elapsed, &observation),
|
|
1040
|
-
fixture_observation
|
|
1041
|
-
);
|
|
1042
|
-
let _ = result.unwrap();
|
|
1043
|
-
let _ = std::fs::remove_file(&receipt);
|
|
1044
|
-
let _ = std::fs::remove_file(format!("{}.sock", receipt.display()));
|
|
1045
|
-
assert_eq!(
|
|
1046
|
-
std::fs::read_to_string(path.with_extension("count")).unwrap(),
|
|
1047
|
-
"1:--list-models\n"
|
|
1048
|
-
);
|
|
1049
|
-
cleanup_fixture(&path);
|
|
1050
|
-
}
|
|
1051
|
-
|
|
1052
|
-
#[cfg(unix)]
|
|
1053
|
-
const NATIVE_STAGE_KEYS: [&str; 5] = [
|
|
1054
|
-
"parent_entry_ms",
|
|
1055
|
-
"parent_before_child_spawn_ms",
|
|
1056
|
-
"parent_after_child_spawn_ms",
|
|
1057
|
-
"parent_before_exit_ms",
|
|
1058
|
-
"test_spawn_return_ms",
|
|
1059
|
-
];
|
|
1060
|
-
|
|
1061
|
-
#[cfg(unix)]
|
|
1062
|
-
// Match the native helper's UNIX epoch millisecond clock exactly.
|
|
1063
|
-
fn append_native_stage(path: &Path, key: &str) {
|
|
1064
|
-
if !NATIVE_STAGE_KEYS.contains(&key) {
|
|
1065
|
-
return;
|
|
1066
|
-
}
|
|
1067
|
-
let Some(milliseconds) = std::time::SystemTime::now()
|
|
1068
|
-
.duration_since(std::time::UNIX_EPOCH)
|
|
1069
|
-
.ok()
|
|
1070
|
-
.map(|duration| duration.as_millis())
|
|
1071
|
-
else {
|
|
1072
|
-
return;
|
|
1073
|
-
};
|
|
1074
|
-
let Ok(mut file) = std::fs::OpenOptions::new()
|
|
1075
|
-
.create(true)
|
|
1076
|
-
.append(true)
|
|
1077
|
-
.open(path)
|
|
1078
|
-
else {
|
|
1079
|
-
return;
|
|
1080
|
-
};
|
|
1081
|
-
let _ = writeln!(file, "{key}={milliseconds}");
|
|
1082
|
-
}
|
|
1083
|
-
|
|
1084
|
-
#[cfg(unix)]
|
|
1085
|
-
fn safe_native_stage(path: &Path) -> String {
|
|
1086
|
-
let (read_state, text) = match std::fs::read_to_string(path) {
|
|
1087
|
-
Ok(text) => ("ok", Some(text)),
|
|
1088
|
-
Err(error) if error.kind() == std::io::ErrorKind::NotFound => ("missing", None),
|
|
1089
|
-
Err(_) => ("unavailable", None),
|
|
1090
|
-
};
|
|
1091
|
-
let mut fields = BTreeMap::new();
|
|
1092
|
-
if let Some(ref text) = text {
|
|
1093
|
-
for line in text.lines() {
|
|
1094
|
-
let Some((key, value)) = line.split_once('=') else {
|
|
1095
|
-
continue;
|
|
1096
|
-
};
|
|
1097
|
-
if NATIVE_STAGE_KEYS.contains(&key)
|
|
1098
|
-
&& value.len() <= 20
|
|
1099
|
-
&& value.bytes().all(|byte| byte.is_ascii_digit())
|
|
1100
|
-
{
|
|
1101
|
-
fields.entry(key).or_insert(value);
|
|
1102
|
-
}
|
|
1103
|
-
}
|
|
1104
|
-
}
|
|
1105
|
-
let field = |key: &str| fields.get(key).copied().unwrap_or("unknown");
|
|
1106
|
-
format!(
|
|
1107
|
-
"stage_read={read_state} parent_entry_ms={} parent_before_child_spawn_ms={} parent_after_child_spawn_ms={} parent_before_exit_ms={} test_spawn_return_ms={}",
|
|
1108
|
-
field("parent_entry_ms"),
|
|
1109
|
-
field("parent_before_child_spawn_ms"),
|
|
1110
|
-
field("parent_after_child_spawn_ms"),
|
|
1111
|
-
field("parent_before_exit_ms"),
|
|
1112
|
-
field("test_spawn_return_ms"),
|
|
1113
|
-
)
|
|
1114
|
-
}
|
|
1115
|
-
|
|
1116
|
-
#[cfg(unix)]
|
|
1117
|
-
fn wait_for_native_parent_exit(
|
|
1118
|
-
child: &mut std::process::Child,
|
|
1119
|
-
stage: &Path,
|
|
1120
|
-
) -> std::process::ExitStatus {
|
|
1121
|
-
let deadline = Instant::now() + Duration::from_millis(500);
|
|
1122
|
-
loop {
|
|
1123
|
-
match child.try_wait() {
|
|
1124
|
-
Ok(Some(status)) => return status,
|
|
1125
|
-
Ok(None) if Instant::now() < deadline => {
|
|
1126
|
-
std::thread::sleep(Duration::from_millis(1));
|
|
1127
|
-
}
|
|
1128
|
-
Ok(None) => {
|
|
1129
|
-
let before_kill = safe_native_stage(stage);
|
|
1130
|
-
let _ = child.kill();
|
|
1131
|
-
let _ = child.wait();
|
|
1132
|
-
let after_wait = safe_native_stage(stage);
|
|
1133
|
-
panic!(
|
|
1134
|
-
"native parent did not exit before test setup deadline; stage_before_kill={before_kill}; stage_after_wait={after_wait}"
|
|
1135
|
-
);
|
|
1136
|
-
}
|
|
1137
|
-
Err(_) => {
|
|
1138
|
-
let before_kill = safe_native_stage(stage);
|
|
1139
|
-
let _ = child.kill();
|
|
1140
|
-
let _ = child.wait();
|
|
1141
|
-
let after_wait = safe_native_stage(stage);
|
|
1142
|
-
panic!(
|
|
1143
|
-
"native parent status could not be observed; stage_before_kill={before_kill}; stage_after_wait={after_wait}"
|
|
1144
|
-
);
|
|
1145
|
-
}
|
|
1146
|
-
}
|
|
1147
|
-
}
|
|
1148
|
-
}
|
|
1149
|
-
|
|
1150
|
-
/// Read/drain seam only: public `run_catalog` spawn coverage remains in the
|
|
1151
|
-
/// normal success and fail-closed tests.
|
|
1152
|
-
#[cfg(unix)]
|
|
1153
|
-
#[test]
|
|
1154
|
-
fn reader_deadline_is_bounded_after_parent_exit_with_descendant_pipe() {
|
|
1155
|
-
let path = native_timeout_fixture();
|
|
1156
|
-
let receipt = native_timeout_receipt();
|
|
1157
|
-
let stage = native_timeout_stage_receipt(&receipt);
|
|
1158
|
-
assert!(!receipt.exists());
|
|
1159
|
-
assert!(!stage.exists());
|
|
1160
|
-
let mut parent = std::process::Command::new(&path)
|
|
1161
|
-
.arg("--list-models")
|
|
1162
|
-
.env("TEAM_AGENT_MODELS_TIMEOUT_RECEIPT", &receipt)
|
|
1163
|
-
.env("TEAM_AGENT_MODELS_TIMEOUT_STAGE_RECEIPT", &stage)
|
|
1164
|
-
.env("TEAM_AGENT_MODELS_TIMEOUT_MODE", "descendant")
|
|
1165
|
-
.stdin(std::process::Stdio::null())
|
|
1166
|
-
.stdout(std::process::Stdio::piped())
|
|
1167
|
-
.stderr(std::process::Stdio::null())
|
|
1168
|
-
.spawn()
|
|
1169
|
-
.unwrap();
|
|
1170
|
-
append_native_stage(&stage, "test_spawn_return_ms");
|
|
1171
|
-
let parent_pid = parent.id();
|
|
1172
|
-
let parent_status = wait_for_native_parent_exit(&mut parent, &stage);
|
|
1173
|
-
let stdout = parent.stdout.take().expect("native parent stdout pipe");
|
|
1174
|
-
let started = Instant::now();
|
|
1175
|
-
let (result, observation) =
|
|
1176
|
-
crate::lifecycle::launch::pi_mcp::with_pi_catalog_test_observation(
|
|
1177
|
-
&receipt,
|
|
1178
|
-
Some("descendant"),
|
|
1179
|
-
|| {
|
|
1180
|
-
crate::lifecycle::launch::pi_mcp::run_pi_catalog_after_parent_exit_for_test(
|
|
1181
|
-
stdout,
|
|
1182
|
-
parent_pid,
|
|
1183
|
-
parent_status,
|
|
1184
|
-
Duration::from_millis(40),
|
|
1185
|
-
1024,
|
|
1186
|
-
)
|
|
1187
|
-
},
|
|
1188
|
-
);
|
|
1189
|
-
let elapsed = started.elapsed();
|
|
1190
|
-
assert!(
|
|
1191
|
-
elapsed < Duration::from_millis(500),
|
|
1192
|
-
"runner observation: {}",
|
|
1193
|
-
safe_runner_observation(elapsed, &observation)
|
|
1194
|
-
);
|
|
1195
|
-
assert!(result.unwrap_err().contains("timed out"));
|
|
1196
|
-
assert_eq!(
|
|
1197
|
-
observation.parent_exit_success,
|
|
1198
|
-
Some(true),
|
|
1199
|
-
"runner observation: {}",
|
|
1200
|
-
safe_runner_observation(elapsed, &observation)
|
|
1201
|
-
);
|
|
1202
|
-
assert_eq!(observation.parent_exit_code, Some(0));
|
|
1203
|
-
assert!(observation.reader_timeout);
|
|
1204
|
-
|
|
1205
|
-
let fields = wait_native_timeout_receipt(&receipt);
|
|
1206
|
-
assert_eq!(fields["parent_started_once"], "1");
|
|
1207
|
-
assert_eq!(fields["parent_argv_exact"], "1");
|
|
1208
|
-
assert_eq!(fields["child_spawn_attempts"], "1");
|
|
1209
|
-
assert_eq!(fields["child_argv_exact"], "1");
|
|
1210
|
-
assert_eq!(fields["descendant_started"], "1");
|
|
1211
|
-
assert_eq!(fields["descendant_stdout_inherited"], "1");
|
|
1212
|
-
assert_eq!(
|
|
1213
|
-
fields["parent_pid"],
|
|
1214
|
-
observation.parent_pid.unwrap().to_string()
|
|
1215
|
-
);
|
|
1216
|
-
assert_eq!(fields["child_pid"], fields["descendant_pid"]);
|
|
1217
|
-
let _ = std::fs::remove_file(&receipt);
|
|
1218
|
-
let _ = std::fs::remove_file(&stage);
|
|
1219
|
-
let _ = std::fs::remove_file(format!("{}.sock", receipt.display()));
|
|
1220
|
-
}
|
|
1221
|
-
|
|
1222
|
-
#[cfg(unix)]
|
|
1223
|
-
#[test]
|
|
1224
|
-
#[serial_test::serial(env)]
|
|
1225
|
-
fn command_boundary_connects_runner_parser_search_and_contract() {
|
|
1226
|
-
let path = fixture(
|
|
1227
|
-
"printf 'provider model\\nopenai-codex gpt-5.6-sol\\nopenai-codex gpt-5.6-luna\\n'",
|
|
1228
|
-
);
|
|
1229
|
-
let args = ModelsArgs {
|
|
1230
|
-
provider: "pi".into(),
|
|
1231
|
-
search: Some("sol".into()),
|
|
1232
|
-
json: true,
|
|
1233
|
-
};
|
|
1234
|
-
let receipt = native_timeout_receipt();
|
|
1235
|
-
assert!(!receipt.exists());
|
|
1236
|
-
let started = Instant::now();
|
|
1237
|
-
let (result, observation) =
|
|
1238
|
-
crate::lifecycle::launch::pi_mcp::with_pi_catalog_test_observation(
|
|
1239
|
-
&receipt,
|
|
1240
|
-
None,
|
|
1241
|
-
|| cmd_models_with(&args, &path, Duration::from_secs(1), 1024),
|
|
1242
|
-
);
|
|
1243
|
-
let elapsed = started.elapsed();
|
|
1244
|
-
let result = match result {
|
|
1245
|
-
Ok(result) => result,
|
|
1246
|
-
Err(_) => panic!(
|
|
1247
|
-
"command boundary returned a CLI error; class=cli_error elapsed_ms={} parent_pid={:?} parent_exit_success={:?} parent_exit_code={:?} reader_timeout={}",
|
|
1248
|
-
elapsed.as_millis(),
|
|
1249
|
-
observation.parent_pid,
|
|
1250
|
-
observation.parent_exit_success,
|
|
1251
|
-
observation.parent_exit_code,
|
|
1252
|
-
observation.reader_timeout,
|
|
1253
|
-
),
|
|
1254
|
-
};
|
|
1255
|
-
let CmdOutput::Human(text) = &result.output else {
|
|
1256
|
-
panic!(
|
|
1257
|
-
"expected JSON projection; {}",
|
|
1258
|
-
safe_models_observation(elapsed, &result, &observation)
|
|
1259
|
-
)
|
|
1260
|
-
};
|
|
1261
|
-
let value: Value = serde_json::from_str(text).unwrap_or_else(|_| {
|
|
1262
|
-
panic!(
|
|
1263
|
-
"expected valid JSON projection; {}",
|
|
1264
|
-
safe_models_observation(elapsed, &result, &observation)
|
|
1265
|
-
)
|
|
1266
|
-
});
|
|
1267
|
-
assert_eq!(
|
|
1268
|
-
value["schema_version"],
|
|
1269
|
-
"models.v1",
|
|
1270
|
-
"{}",
|
|
1271
|
-
safe_models_observation(elapsed, &result, &observation)
|
|
1272
|
-
);
|
|
1273
|
-
assert_eq!(
|
|
1274
|
-
value["models"][0]["role_model"],
|
|
1275
|
-
"openai-codex/gpt-5.6-sol",
|
|
1276
|
-
"{}",
|
|
1277
|
-
safe_models_observation(elapsed, &result, &observation)
|
|
1278
|
-
);
|
|
1279
|
-
assert_eq!(
|
|
1280
|
-
value["models"][0]["current"],
|
|
1281
|
-
false,
|
|
1282
|
-
"{}",
|
|
1283
|
-
safe_models_observation(elapsed, &result, &observation)
|
|
1284
|
-
);
|
|
1285
|
-
assert_eq!(
|
|
1286
|
-
value["auth"],
|
|
1287
|
-
"ok",
|
|
1288
|
-
"{}",
|
|
1289
|
-
safe_models_observation(elapsed, &result, &observation)
|
|
1290
|
-
);
|
|
1291
|
-
let model_count = value["models"].as_array().map(|models| models.len());
|
|
1292
|
-
assert_eq!(
|
|
1293
|
-
model_count,
|
|
1294
|
-
Some(1),
|
|
1295
|
-
"{}",
|
|
1296
|
-
safe_models_observation(elapsed, &result, &observation)
|
|
1297
|
-
);
|
|
1298
|
-
let _ = std::fs::remove_file(&receipt);
|
|
1299
|
-
let _ = std::fs::remove_file(format!("{}.sock", receipt.display()));
|
|
1300
|
-
let human = cmd_models_with(
|
|
1301
|
-
&ModelsArgs {
|
|
1302
|
-
provider: "pi".into(),
|
|
1303
|
-
search: Some("absent".into()),
|
|
1304
|
-
json: false,
|
|
1305
|
-
},
|
|
1306
|
-
&path,
|
|
1307
|
-
Duration::from_secs(1),
|
|
1308
|
-
1024,
|
|
1309
|
-
)
|
|
1310
|
-
.unwrap();
|
|
1311
|
-
let CmdOutput::Human(text) = human.output else {
|
|
1312
|
-
panic!("expected human projection")
|
|
1313
|
-
};
|
|
1314
|
-
assert!(text.contains("No models matched --search") && text.contains("auth: ok"));
|
|
1315
|
-
let refusal = crate::cli::emit::__test_dispatch(
|
|
1316
|
-
"models",
|
|
1317
|
-
&["--provider".into(), "cloud".into()],
|
|
1318
|
-
Path::new("/tmp"),
|
|
1319
|
-
);
|
|
1320
|
-
assert!(matches!(refusal, Ok(ExitCode::Error)));
|
|
1321
|
-
cleanup_fixture(&path);
|
|
1322
|
-
}
|
|
1323
|
-
|
|
1324
|
-
#[cfg(unix)]
|
|
1325
|
-
#[test]
|
|
1326
|
-
fn runner_fails_closed_for_nonzero_oversize_timeout_and_unavailable() {
|
|
1327
|
-
let fail = native_timeout_fixture();
|
|
1328
|
-
let started = Instant::now();
|
|
1329
|
-
let (failed_result, fail_observation) =
|
|
1330
|
-
with_native_mode("exit7", || run_catalog(&fail, Duration::from_secs(1), 1024));
|
|
1331
|
-
let elapsed = started.elapsed();
|
|
1332
|
-
assert_eq!(
|
|
1333
|
-
failed_result.unwrap_err(),
|
|
1334
|
-
"Pi model catalog command failed",
|
|
1335
|
-
"runner observation: {}",
|
|
1336
|
-
safe_runner_observation(elapsed, &fail_observation)
|
|
1337
|
-
);
|
|
1338
|
-
assert_eq!(fail_observation.spawn_count, 1);
|
|
1339
|
-
assert_eq!(fail_observation.argv, vec!["--list-models"]);
|
|
1340
|
-
assert_eq!(fail_observation.parent_exit_success, Some(false));
|
|
1341
|
-
assert_eq!(fail_observation.parent_exit_code, Some(7));
|
|
1342
|
-
assert!(!fail_observation.reader_timeout);
|
|
1343
|
-
let (failed, failed_observation) = with_native_mode("exit7", || {
|
|
1344
|
-
cmd_models_with(
|
|
1345
|
-
&ModelsArgs {
|
|
1346
|
-
provider: "pi".into(),
|
|
1347
|
-
search: None,
|
|
1348
|
-
json: false,
|
|
1349
|
-
},
|
|
1350
|
-
&fail,
|
|
1351
|
-
Duration::from_secs(1),
|
|
1352
|
-
1024,
|
|
1353
|
-
)
|
|
1354
|
-
});
|
|
1355
|
-
let failed = failed.unwrap();
|
|
1356
|
-
assert_eq!(failed_observation.spawn_count, 1);
|
|
1357
|
-
assert_eq!(failed_observation.argv, vec!["--list-models"]);
|
|
1358
|
-
assert_eq!(failed_observation.parent_exit_success, Some(false));
|
|
1359
|
-
assert_eq!(failed_observation.parent_exit_code, Some(7));
|
|
1360
|
-
assert!(!failed_observation.reader_timeout);
|
|
1361
|
-
let CmdOutput::Human(text) = failed.output else {
|
|
1362
|
-
panic!("expected failure projection")
|
|
1363
|
-
};
|
|
1364
|
-
assert_eq!(failed.exit, ExitCode::Error);
|
|
1365
|
-
assert!(!text.contains("sensitive-token"));
|
|
1366
|
-
let big = native_timeout_fixture();
|
|
1367
|
-
let (big_result, big_observation) =
|
|
1368
|
-
with_native_mode("oversize", || run_catalog(&big, Duration::from_secs(1), 8));
|
|
1369
|
-
assert!(big_result.unwrap_err().contains("bounded output"));
|
|
1370
|
-
assert_eq!(big_observation.spawn_count, 1);
|
|
1371
|
-
assert_eq!(big_observation.argv, vec!["--list-models"]);
|
|
1372
|
-
assert_eq!(big_observation.parent_exit_success, Some(true));
|
|
1373
|
-
assert_eq!(big_observation.parent_exit_code, Some(0));
|
|
1374
|
-
assert!(!big_observation.reader_timeout);
|
|
1375
|
-
let slow = native_timeout_fixture();
|
|
1376
|
-
let (slow_result, slow_observation) = with_native_mode("sleep", || {
|
|
1377
|
-
run_catalog(&slow, Duration::from_millis(20), 1024)
|
|
1378
|
-
});
|
|
1379
|
-
assert!(slow_result.unwrap_err().contains("timed out"));
|
|
1380
|
-
assert_eq!(slow_observation.spawn_count, 1);
|
|
1381
|
-
assert_eq!(slow_observation.argv, vec!["--list-models"]);
|
|
1382
|
-
assert_eq!(slow_observation.parent_exit_success, None);
|
|
1383
|
-
assert!(!slow_observation.reader_timeout);
|
|
1384
|
-
assert!(run_catalog(
|
|
1385
|
-
std::path::Path::new("/does/not/exist"),
|
|
1386
|
-
Duration::from_secs(1),
|
|
1387
|
-
1024
|
|
1388
|
-
)
|
|
1389
|
-
.unwrap_err()
|
|
1390
|
-
.contains("unavailable"));
|
|
1391
|
-
}
|
|
1392
|
-
|
|
1393
557
|
#[test]
|
|
1394
558
|
fn public_failure_and_help_contracts_are_versioned() {
|
|
1395
559
|
let args = ModelsArgs {
|
|
1396
|
-
provider: "
|
|
560
|
+
provider: "codex".into(),
|
|
1397
561
|
search: None,
|
|
1398
562
|
json: true,
|
|
1399
563
|
};
|
|
1400
|
-
let result =
|
|
564
|
+
let result = failure_with_action(&args, "safe failure", "safe action");
|
|
1401
565
|
let CmdOutput::Human(text) = result.output else {
|
|
1402
566
|
panic!("json contract must render")
|
|
1403
567
|
};
|
|
@@ -1417,7 +581,7 @@ esac"#);
|
|
|
1417
581
|
),
|
|
1418
582
|
ExitCode::Error
|
|
1419
583
|
);
|
|
1420
|
-
let usage = "team-agent models [--provider pi|cursor|
|
|
584
|
+
let usage = "team-agent models [--provider pi|cursor|codex|claude|claude_code|grok|kiro] [QUERY|--search TEXT] [--json]";
|
|
1421
585
|
assert_eq!(crate::cli::spec::command_spec("models").unwrap().usage, usage);
|
|
1422
586
|
assert!(crate::cli::emit::command_help(Some("models")).contains(usage));
|
|
1423
587
|
}
|