@team-agent/installer 0.5.125 → 0.5.127
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/crates/team-agent/src/cli/diagnose.rs +0 -137
- package/crates/team-agent/src/cli/emit.rs +13 -8
- package/crates/team-agent/src/cli/grok_slot.rs +88 -3
- package/crates/team-agent/src/cli/intent/runtime.rs +6 -4
- package/crates/team-agent/src/cli/intent/runtime_tests.rs +55 -10
- package/crates/team-agent/src/cli/mod.rs +35 -29
- package/crates/team-agent/src/cli/models.rs +33 -944
- package/crates/team-agent/src/cli/tests/leader_watch.rs +1 -1
- package/crates/team-agent/src/cli/tests/mod.rs +3 -3
- package/crates/team-agent/src/cli/tests/run_delegation.rs +8 -7
- package/crates/team-agent/src/cli/tests/status_send.rs +2 -2
- package/crates/team-agent/src/compiler/tests.rs +54 -12
- package/crates/team-agent/src/compiler.rs +7 -205
- package/crates/team-agent/src/contract_runtime/backend.rs +97 -38
- package/crates/team-agent/src/contract_runtime/commands.rs +335 -4
- package/crates/team-agent/src/contract_runtime/config.rs +12 -8
- package/crates/team-agent/src/contract_runtime/fork.rs +368 -0
- package/crates/team-agent/src/contract_runtime/framework.rs +8 -13
- package/crates/team-agent/src/contract_runtime/mod.rs +1 -0
- package/crates/team-agent/src/contract_runtime/registry.rs +100 -60
- package/crates/team-agent/src/coordinator/steps/abnormal.rs +45 -5
- package/crates/team-agent/src/coordinator/tests/api_error_recovery.rs +54 -16
- package/crates/team-agent/src/coordinator/tests/energy.rs +4 -4
- package/crates/team-agent/src/coordinator/tests/health_sync.rs +2 -44
- 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/leader/start.rs +1 -1
- package/crates/team-agent/src/lifecycle/launch/add_agent_state.rs +2 -195
- package/crates/team-agent/src/lifecycle/launch/clone_agent.rs +11 -27
- package/crates/team-agent/src/lifecycle/launch/fork_agent.rs +22 -200
- package/crates/team-agent/src/lifecycle/launch/fork_entry.rs +6 -87
- package/crates/team-agent/src/lifecycle/launch/mcp_config.rs +5 -496
- package/crates/team-agent/src/lifecycle/launch/pi_mcp.rs +74 -244
- package/crates/team-agent/src/lifecycle/launch/quick_start.rs +2 -26
- package/crates/team-agent/src/lifecycle/launch/role_source.rs +5 -0
- package/crates/team-agent/src/lifecycle/launch/spawn.rs +26 -51
- package/crates/team-agent/src/lifecycle/launch.rs +3 -34
- package/crates/team-agent/src/lifecycle/profile_launch.rs +18 -373
- package/crates/team-agent/src/lifecycle/restart/common.rs +45 -463
- 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 +0 -2
- package/crates/team-agent/src/lifecycle/role_config.rs +40 -13
- 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 +38 -236
- 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 +106 -186
- package/crates/team-agent/src/lifecycle/tests/clone_fork_copilot_perms_red.rs +4 -334
- package/crates/team-agent/src/lifecycle/tests/communication_mode_runtime_contract_red.rs +19 -15
- package/crates/team-agent/src/lifecycle/tests/copilot_provider_red.rs +2 -2
- package/crates/team-agent/src/lifecycle/tests/core.rs +33 -58
- package/crates/team-agent/src/lifecycle/tests/f032_startup_prompt_best_effort_red.rs +22 -8
- 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 +3 -51
- 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 +162 -284
- 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/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 +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 +15 -14
- 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 -1478
- 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 +2 -254
- 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 +39 -38
- package/crates/team-agent/src/lifecycle/tests/worker_spawn_env_red.rs +42 -97
- package/crates/team-agent/src/lifecycle/tests.rs +0 -7
- package/crates/team-agent/src/lifecycle/types.rs +2 -21
- package/crates/team-agent/src/mcp_server/readiness_tests.rs +15 -17
- package/crates/team-agent/src/messaging/delivery.rs +14 -195
- package/crates/team-agent/src/messaging/delivery_consumption_tests.rs +5 -5
- package/crates/team-agent/src/messaging/tests/dup_inject.rs +68 -69
- package/crates/team-agent/src/messaging/tests/main_preserved.rs +2 -2
- package/crates/team-agent/src/messaging/tests/runtime.rs +5 -5
- package/crates/team-agent/src/messaging/tests/spine.rs +30 -32
- package/crates/team-agent/src/messaging/tests/wave2.rs +13 -20
- package/crates/team-agent/src/provider/adapter.rs +71 -572
- package/crates/team-agent/src/provider/adapters/mod.rs +6 -8
- package/crates/team-agent/src/provider/model_catalog.rs +13 -201
- package/crates/team-agent/src/provider/session/capture.rs +11 -211
- package/crates/team-agent/src/provider/session/context_fork/outcome.rs +8 -24
- package/crates/team-agent/src/provider/session/context_fork.rs +29 -240
- package/crates/team-agent/src/provider/session/mod.rs +2 -3
- package/crates/team-agent/src/provider/session_scan/common.rs +27 -87
- package/crates/team-agent/src/provider/session_scan/pi.rs +1 -34
- package/crates/team-agent/src/provider/session_scan.rs +7 -23
- package/crates/team-agent/src/provider/tests/adapter.rs +66 -204
- package/crates/team-agent/src/provider/tests/command_helpers.rs +3 -29
- package/crates/team-agent/src/provider/tests/idle.rs +0 -68
- package/crates/team-agent/src/provider/types.rs +0 -4
- package/crates/team-agent/src/provider/wire.rs +77 -23
- 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.rs +4 -3
- package/package.json +4 -4
- package/skills/team-agent/SKILL.md +8 -5
- package/skills/team-agent/command-coverage.json +29 -1
- package/skills/team-agent/docs/reference/team-agent-operator.md +7 -3
- package/skills/team-agent/references/team-agent-operator.md +7 -3
- package/crates/team-agent/src/lifecycle/launch/grok_per_seat.rs +0 -260
- 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/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/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/codex.rs +0 -101
- package/crates/team-agent/src/provider/adapters/grok.rs +0 -67
- 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/context_fork/codex.rs +0 -514
- package/crates/team-agent/src/provider/session_scan/claude.rs +0 -523
- 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/crates/team-agent/src/test_support/models_timeout_fixture.rs +0 -144
|
@@ -50,7 +50,7 @@ use super::*;
|
|
|
50
50
|
/// pre-write JSON (so the half-written `status:starting` row is gone). The
|
|
51
51
|
/// caller propagates the ORIGINAL operation error after rollback; rollback
|
|
52
52
|
/// errors are swallowed (best-effort, no panic).
|
|
53
|
-
pub(
|
|
53
|
+
pub(crate) fn rollback_add_agent_atomic(
|
|
54
54
|
run_workspace: &Path,
|
|
55
55
|
spec_path: &Path,
|
|
56
56
|
pre_spec_text: Option<&str>,
|
|
@@ -165,7 +165,7 @@ pub(super) fn upsert_agent_state_from_role(
|
|
|
165
165
|
/// purpose: 把一席的 starting 行写进团队 state 并落盘
|
|
166
166
|
/// errors: 读或写 runtime state 失败时返回 StatePersist
|
|
167
167
|
/// ---
|
|
168
|
-
pub(
|
|
168
|
+
pub(crate) fn upsert_agent_entry(
|
|
169
169
|
workspace: &Path,
|
|
170
170
|
canonical_team_key: &str,
|
|
171
171
|
agent_id: &AgentId,
|
|
@@ -203,199 +203,6 @@ pub(super) fn upsert_agent_entry(
|
|
|
203
203
|
)
|
|
204
204
|
}
|
|
205
205
|
|
|
206
|
-
/// ---
|
|
207
|
-
/// purpose: 首次登记 Pi fork 席位,原子带入目标角色与完整 fork capture seed
|
|
208
|
-
/// returns: 成功后 TARGET 已按 ForkAgent typed intent 登记为 starting
|
|
209
|
-
/// errors: 重复席位、无效 capture seed 或 state 写入失败时拒绝
|
|
210
|
-
/// ---
|
|
211
|
-
pub(crate) fn fork_upsert_agent_state_from_role(
|
|
212
|
-
workspace: &Path,
|
|
213
|
-
canonical_team_key: &str,
|
|
214
|
-
agent_id: &AgentId,
|
|
215
|
-
meta: &Value,
|
|
216
|
-
compiled_agent: &Value,
|
|
217
|
-
dynamic_role_file: &Path,
|
|
218
|
-
seed: &ForkCaptureSeed,
|
|
219
|
-
) -> Result<(), LifecycleError> {
|
|
220
|
-
if agent_id == &seed.source_agent_id {
|
|
221
|
-
return Err(LifecycleError::RequirementUnmet(
|
|
222
|
-
"fork target must differ from source".to_string(),
|
|
223
|
-
));
|
|
224
|
-
}
|
|
225
|
-
if seed.captured.captured_via != crate::provider::CaptureVia::ForkSnapshot
|
|
226
|
-
|| seed.captured.attribution_confidence != crate::provider::Confidence::High
|
|
227
|
-
|| seed.captured.session_id.is_none()
|
|
228
|
-
|| seed.captured.rollout_path.is_none()
|
|
229
|
-
|| seed.captured_at.is_empty()
|
|
230
|
-
{
|
|
231
|
-
return Err(LifecycleError::RequirementUnmet(
|
|
232
|
-
"fork capture seed is incomplete or not a verified Pi snapshot".to_string(),
|
|
233
|
-
));
|
|
234
|
-
}
|
|
235
|
-
if compiled_agent.get("id").and_then(Value::as_str) != Some(agent_id.as_str()) {
|
|
236
|
-
return Err(LifecycleError::Compile(
|
|
237
|
-
"compiled fork role id does not match target".to_string(),
|
|
238
|
-
));
|
|
239
|
-
}
|
|
240
|
-
let sessions_root = std::fs::canonicalize(&seed.pi_sessions_root)
|
|
241
|
-
.map_err(|e| LifecycleError::StatePersist(e.to_string()))?;
|
|
242
|
-
let backing = seed.captured.rollout_path.as_ref().ok_or_else(|| {
|
|
243
|
-
LifecycleError::RequirementUnmet("fork backing path is missing".to_string())
|
|
244
|
-
})?;
|
|
245
|
-
let backing_path = std::fs::canonicalize(&backing.0)
|
|
246
|
-
.map_err(|e| LifecycleError::StatePersist(e.to_string()))?;
|
|
247
|
-
if !backing_path.starts_with(&sessions_root) {
|
|
248
|
-
return Err(LifecycleError::RequirementUnmet(
|
|
249
|
-
"fork backing is outside the target Pi session root".to_string(),
|
|
250
|
-
));
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
let mut state =
|
|
254
|
-
crate::state::projection::select_runtime_state(workspace, Some(canonical_team_key))
|
|
255
|
-
.map_err(|e| LifecycleError::TeamSelect(e.to_string()))?;
|
|
256
|
-
if !state.is_object() {
|
|
257
|
-
state = serde_json::json!({});
|
|
258
|
-
}
|
|
259
|
-
let root = state.as_object_mut().ok_or_else(|| {
|
|
260
|
-
LifecycleError::StatePersist("runtime state root is not an object".to_string())
|
|
261
|
-
})?;
|
|
262
|
-
let agents = root
|
|
263
|
-
.entry("agents".to_string())
|
|
264
|
-
.or_insert_with(|| serde_json::json!({}));
|
|
265
|
-
if !agents.is_object() {
|
|
266
|
-
*agents = serde_json::json!({});
|
|
267
|
-
}
|
|
268
|
-
let agent_map = agents.as_object_mut().ok_or_else(|| {
|
|
269
|
-
LifecycleError::StatePersist("runtime state agents is not an object".to_string())
|
|
270
|
-
})?;
|
|
271
|
-
if agent_map.contains_key(agent_id.as_str()) {
|
|
272
|
-
return Err(LifecycleError::RequirementUnmet(format!(
|
|
273
|
-
"agent id already exists in selected team: {}",
|
|
274
|
-
agent_id
|
|
275
|
-
)));
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
let source_profile_dir = agent_map
|
|
279
|
-
.get(seed.source_agent_id.as_str())
|
|
280
|
-
.and_then(serde_json::Value::as_object)
|
|
281
|
-
.and_then(|source| source.get("_profile_dir"))
|
|
282
|
-
.and_then(serde_json::Value::as_str)
|
|
283
|
-
.filter(|path| !path.is_empty())
|
|
284
|
-
.map(|path| serde_json::json!(path));
|
|
285
|
-
let mut entry = starting_agent_entry(workspace, agent_id, meta, dynamic_role_file);
|
|
286
|
-
let entry_object = entry.as_object_mut().ok_or_else(|| {
|
|
287
|
-
LifecycleError::StatePersist("fork target entry is not an object".to_string())
|
|
288
|
-
})?;
|
|
289
|
-
for field in [
|
|
290
|
-
"provider",
|
|
291
|
-
"auth_mode",
|
|
292
|
-
"role",
|
|
293
|
-
"model",
|
|
294
|
-
"effort",
|
|
295
|
-
"profile",
|
|
296
|
-
"tools",
|
|
297
|
-
"system_prompt",
|
|
298
|
-
"output_contract",
|
|
299
|
-
"communication_mode",
|
|
300
|
-
"working_directory",
|
|
301
|
-
"cwd",
|
|
302
|
-
"config",
|
|
303
|
-
"name",
|
|
304
|
-
"dangerously_skip_permissions",
|
|
305
|
-
] {
|
|
306
|
-
if let Some(value) = compiled_agent.get(field) {
|
|
307
|
-
entry_object.insert(field.to_string(), yaml_value_to_json(value));
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
if compiled_agent.get("model").is_some() && !entry_object.contains_key("model_source") {
|
|
311
|
-
entry_object.insert("model_source".to_string(), serde_json::json!("team"));
|
|
312
|
-
}
|
|
313
|
-
entry_object.insert("agent_id".to_string(), serde_json::json!(agent_id.as_str()));
|
|
314
|
-
entry_object.insert("label".to_string(), serde_json::json!(agent_id.as_str()));
|
|
315
|
-
entry_object.insert(
|
|
316
|
-
"owner_team_id".to_string(),
|
|
317
|
-
serde_json::json!(canonical_team_key),
|
|
318
|
-
);
|
|
319
|
-
entry_object.insert(
|
|
320
|
-
"claude_projects_root".to_string(),
|
|
321
|
-
serde_json::json!(sessions_root.to_string_lossy().to_string()),
|
|
322
|
-
);
|
|
323
|
-
entry_object.insert(
|
|
324
|
-
"forked_from".to_string(),
|
|
325
|
-
serde_json::json!(seed.source_agent_id.as_str()),
|
|
326
|
-
);
|
|
327
|
-
entry_object.insert(
|
|
328
|
-
"spawn_cwd".to_string(),
|
|
329
|
-
serde_json::json!(seed.captured.spawn_cwd.to_string_lossy().to_string()),
|
|
330
|
-
);
|
|
331
|
-
entry_object.insert(
|
|
332
|
-
"session_id".to_string(),
|
|
333
|
-
serde_json::json!(seed.captured.session_id.as_ref().map(|id| id.as_str())),
|
|
334
|
-
);
|
|
335
|
-
let backing = seed.captured.rollout_path.as_ref().ok_or_else(|| {
|
|
336
|
-
LifecycleError::RequirementUnmet("fork backing path is missing".to_string())
|
|
337
|
-
})?;
|
|
338
|
-
entry_object.insert(
|
|
339
|
-
"rollout_path".to_string(),
|
|
340
|
-
serde_json::json!(backing.0.to_string_lossy().to_string()),
|
|
341
|
-
);
|
|
342
|
-
entry_object.insert(
|
|
343
|
-
"captured_at".to_string(),
|
|
344
|
-
serde_json::json!(seed.captured_at.as_str()),
|
|
345
|
-
);
|
|
346
|
-
entry_object.insert(
|
|
347
|
-
"captured_via".to_string(),
|
|
348
|
-
serde_json::to_value(seed.captured.captured_via)
|
|
349
|
-
.map_err(|e| LifecycleError::StatePersist(e.to_string()))?,
|
|
350
|
-
);
|
|
351
|
-
entry_object.insert(
|
|
352
|
-
"attribution_confidence".to_string(),
|
|
353
|
-
serde_json::to_value(seed.captured.attribution_confidence)
|
|
354
|
-
.map_err(|e| LifecycleError::StatePersist(e.to_string()))?,
|
|
355
|
-
);
|
|
356
|
-
entry_object.insert("capture_state".to_string(), serde_json::json!("captured"));
|
|
357
|
-
if let Some(profile_dir) = source_profile_dir {
|
|
358
|
-
entry_object.insert("_profile_dir".to_string(), profile_dir);
|
|
359
|
-
} else {
|
|
360
|
-
entry_object.insert(
|
|
361
|
-
"_profile_dir".to_string(),
|
|
362
|
-
serde_json::json!(seed.profile_dir.to_string_lossy().to_string()),
|
|
363
|
-
);
|
|
364
|
-
}
|
|
365
|
-
agent_map.insert(agent_id.as_str().to_string(), entry);
|
|
366
|
-
crate::lifecycle::restart::remove::clear_agent_retirement_in_state(&mut state, agent_id);
|
|
367
|
-
crate::state::repository::StateRepository::new(workspace)
|
|
368
|
-
.save(
|
|
369
|
-
crate::state::repository::StateWriteIntent::ForkAgent {
|
|
370
|
-
team_key: canonical_team_key,
|
|
371
|
-
agent_id: agent_id.as_str(),
|
|
372
|
-
},
|
|
373
|
-
&state,
|
|
374
|
-
)
|
|
375
|
-
.map_err(|e| LifecycleError::StatePersist(e.to_string()))
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
fn yaml_value_to_json(value: &Value) -> serde_json::Value {
|
|
379
|
-
match value {
|
|
380
|
-
Value::Null => serde_json::Value::Null,
|
|
381
|
-
Value::Bool(value) => serde_json::json!(value),
|
|
382
|
-
Value::Int(value) => serde_json::json!(value),
|
|
383
|
-
Value::Float(value) => serde_json::Number::from_f64(*value)
|
|
384
|
-
.map(serde_json::Value::Number)
|
|
385
|
-
.unwrap_or(serde_json::Value::Null),
|
|
386
|
-
Value::Str(value) => serde_json::json!(value),
|
|
387
|
-
Value::List(values) => {
|
|
388
|
-
serde_json::Value::Array(values.iter().map(yaml_value_to_json).collect())
|
|
389
|
-
}
|
|
390
|
-
Value::Map(values) => serde_json::Value::Object(
|
|
391
|
-
values
|
|
392
|
-
.iter()
|
|
393
|
-
.map(|(key, value)| (key.clone(), yaml_value_to_json(value)))
|
|
394
|
-
.collect(),
|
|
395
|
-
),
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
|
|
399
206
|
fn starting_agent_entry(
|
|
400
207
|
workspace: &Path,
|
|
401
208
|
agent_id: &AgentId,
|
|
@@ -47,6 +47,16 @@ pub fn clone_agent(
|
|
|
47
47
|
.ok_or_else(|| {
|
|
48
48
|
LifecycleError::RequirementUnmet(format!("unknown worker agent id: {source_agent_id}"))
|
|
49
49
|
})?;
|
|
50
|
+
// A pre-upgrade Claude Code or Pi row has no legacy runtime to clone onto.
|
|
51
|
+
if let Some(retired) = source_agent
|
|
52
|
+
.get("provider")
|
|
53
|
+
.and_then(serde_json::Value::as_str)
|
|
54
|
+
.filter(|provider| crate::provider::wire::is_retired_provider(provider))
|
|
55
|
+
{
|
|
56
|
+
return Err(LifecycleError::Provider(
|
|
57
|
+
crate::provider::wire::retired_provider_error(retired).into(),
|
|
58
|
+
));
|
|
59
|
+
}
|
|
50
60
|
let source_session_id = source_agent
|
|
51
61
|
.get("session_id")
|
|
52
62
|
.and_then(serde_json::Value::as_str)
|
|
@@ -122,37 +132,11 @@ fn read_agent_session(
|
|
|
122
132
|
.get("rollout_path")
|
|
123
133
|
.and_then(serde_json::Value::as_str)
|
|
124
134
|
.filter(|value| !value.is_empty())
|
|
125
|
-
.map(std::path::PathBuf::from)
|
|
126
|
-
.or_else(|| find_claude_backing(agent, session))?;
|
|
135
|
+
.map(std::path::PathBuf::from)?;
|
|
127
136
|
let distinct = source_session_id.is_none_or(|source| source.as_str() != session);
|
|
128
137
|
(distinct && backing.is_file()).then(|| (SessionId::new(session), backing))
|
|
129
138
|
}
|
|
130
139
|
|
|
131
|
-
fn find_claude_backing(agent: &serde_json::Value, session: &str) -> Option<std::path::PathBuf> {
|
|
132
|
-
let root = agent
|
|
133
|
-
.get("claude_projects_root")
|
|
134
|
-
.and_then(serde_json::Value::as_str)
|
|
135
|
-
.map(std::path::PathBuf::from)
|
|
136
|
-
.or_else(|| {
|
|
137
|
-
std::env::var_os("HOME")
|
|
138
|
-
.map(|home| std::path::PathBuf::from(home).join(".claude/projects"))
|
|
139
|
-
})?;
|
|
140
|
-
let target = format!("{session}.jsonl");
|
|
141
|
-
let mut pending = vec![root];
|
|
142
|
-
while let Some(dir) = pending.pop() {
|
|
143
|
-
let entries = std::fs::read_dir(&dir).ok()?;
|
|
144
|
-
for entry in entries.flatten() {
|
|
145
|
-
let path = entry.path();
|
|
146
|
-
if path.is_dir() {
|
|
147
|
-
pending.push(path);
|
|
148
|
-
} else if path.file_name().and_then(|name| name.to_str()) == Some(target.as_str()) {
|
|
149
|
-
return Some(path);
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
None
|
|
154
|
-
}
|
|
155
|
-
|
|
156
140
|
fn persist_clone_session(
|
|
157
141
|
workspace: &Path,
|
|
158
142
|
team_key: &str,
|
|
@@ -1,108 +1,42 @@
|
|
|
1
1
|
//! ---
|
|
2
|
-
//! purpose:
|
|
2
|
+
//! purpose: legacy 席位的 fork 入口;legacy 席位一律拒绝,新席位 fork 只走 contract 管道
|
|
3
3
|
//! contract:
|
|
4
4
|
//! provides:
|
|
5
5
|
//! - name: fork_agent_with_transport
|
|
6
|
-
//! what:
|
|
7
|
-
//! - name: in_window_fork
|
|
8
|
-
//! what: 已验证的 provider+subscription 给出 command+screen_mark;未验证返回 None
|
|
6
|
+
//! what: 持席位生命周期锁读取源席;升级前遗留的 claude/codex/grok/pi worker 行按退役拒绝,其余 legacy provider 报未验证
|
|
9
7
|
//! depends:
|
|
10
8
|
//! - crate::lifecycle::lock
|
|
11
|
-
//! - crate::lifecycle::pane_input_lock
|
|
12
|
-
//! - crate::lifecycle::profile_launch
|
|
13
|
-
//! - crate::transport::Transport
|
|
14
9
|
//! boundary:
|
|
15
|
-
//! -
|
|
16
|
-
//! -
|
|
17
|
-
//! - 重试只重按回车,不重粘 /fork
|
|
18
|
-
//! - 不把 pane 锁超时从 200ms 调大
|
|
10
|
+
//! - 新席位 fork 只由 contract_runtime::fork 管道完成,这里不注册新席位、不注入窗口
|
|
11
|
+
//! - 不 spawn pane,不改 TEAM_AGENT_ID / MCP / 席位名
|
|
19
12
|
//! - 未验证的 provider 不猜斜杠命令
|
|
20
13
|
//! maturity: wired
|
|
21
14
|
//! ---
|
|
22
15
|
|
|
23
16
|
use super::*;
|
|
24
|
-
use crate::lifecycle::pane_input_lock::{
|
|
25
|
-
acquire_or_proceed, PaneInputLockRequest, PANE_INPUT_LOCK_TIMEOUT_EVENT,
|
|
26
|
-
};
|
|
27
|
-
use crate::lifecycle::profile_launch::{parse_auth_mode, parse_provider};
|
|
28
|
-
use crate::model::enums::{AuthMode, Provider};
|
|
29
|
-
|
|
30
|
-
const MAX_ENTER_RETRIES: u32 = 8;
|
|
31
|
-
|
|
32
|
-
/// Injected slash command + the screen mark that proves it landed.
|
|
33
|
-
/// Difference between providers lives only in this data.
|
|
34
|
-
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
|
35
|
-
pub struct InWindowFork {
|
|
36
|
-
pub command: &'static str,
|
|
37
|
-
pub screen_mark: &'static str,
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/// ---
|
|
41
|
-
/// purpose: 给出该 provider 与鉴权方式下窗口内 fork 用的斜杠命令与成功标记
|
|
42
|
-
/// returns: 已实测验证的组合返回命令与屏幕标记,其余一律 None
|
|
43
|
-
/// ---
|
|
44
|
-
/// Official in-window fork. None = unverified or unsupported-auth.
|
|
45
|
-
/// grok `/fork` mark `forked from` (2026-08-17).
|
|
46
|
-
/// claude `/branch` mark `Branched conversation` (Claude Code v2.1.181, 2026-08-17).
|
|
47
|
-
/// claude `/fork` is a background-agent command (`Usage: /fork <directive>`), not the session split.
|
|
48
|
-
pub fn in_window_fork(provider: Provider, auth: AuthMode) -> Option<InWindowFork> {
|
|
49
|
-
match (provider, auth) {
|
|
50
|
-
(Provider::Grok, AuthMode::Subscription) => Some(InWindowFork {
|
|
51
|
-
command: "/fork",
|
|
52
|
-
screen_mark: "forked from",
|
|
53
|
-
}),
|
|
54
|
-
(Provider::Claude | Provider::ClaudeCode, AuthMode::Subscription) => Some(InWindowFork {
|
|
55
|
-
command: "/branch",
|
|
56
|
-
screen_mark: "Branched conversation",
|
|
57
|
-
}),
|
|
58
|
-
_ => None,
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/// ---
|
|
63
|
-
/// purpose: 只取窗口内 fork 的斜杠命令
|
|
64
|
-
/// returns: 有已验证组合时返回命令,否则 None
|
|
65
|
-
/// ---
|
|
66
|
-
pub fn in_window_fork_command(provider: Provider, auth: AuthMode) -> Option<&'static str> {
|
|
67
|
-
in_window_fork(provider, auth).map(|spec| spec.command)
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
fn refuse_missing_in_window_fork(provider: Provider, provider_raw: &str) -> LifecycleError {
|
|
71
|
-
if matches!(
|
|
72
|
-
provider,
|
|
73
|
-
Provider::Grok
|
|
74
|
-
| Provider::Claude
|
|
75
|
-
| Provider::ClaudeCode
|
|
76
|
-
| Provider::Pi
|
|
77
|
-
) {
|
|
78
|
-
LifecycleError::Provider(format!(
|
|
79
|
-
"{provider_raw} does not support native session fork"
|
|
80
|
-
))
|
|
81
|
-
} else {
|
|
82
|
-
LifecycleError::Provider(format!(
|
|
83
|
-
"{provider_raw} in-window fork is unverified (未验证)"
|
|
84
|
-
))
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
17
|
|
|
88
18
|
/// ---
|
|
89
|
-
/// purpose:
|
|
19
|
+
/// purpose: legacy 席位的 fork:只读源席后拒绝,不做任何副作用
|
|
90
20
|
/// params:
|
|
91
21
|
/// source_agent_id: 被 fork 的席位
|
|
92
22
|
/// as_agent_id: 新席位名
|
|
93
|
-
/// transport: 目标 team 实际使用的 transport
|
|
94
|
-
/// returns:
|
|
95
|
-
/// errors: 选不到 team 返回 TeamSelect
|
|
23
|
+
/// transport: 目标 team 实际使用的 transport(legacy 席位不再注入)
|
|
24
|
+
/// returns: 不返回成功;contract 席位在此之前已由 contract 管道处理
|
|
25
|
+
/// errors: 选不到 team 返回 TeamSelect,退役 provider 行与其余 legacy provider 返回 Provider
|
|
96
26
|
/// ---
|
|
27
|
+
/// The Grok in-window `/fork` was the last legacy fork; Claude Code, Codex,
|
|
28
|
+
/// Grok and Pi fork only into a new seat through the contract pipeline
|
|
29
|
+
/// (`contract_runtime::fork`).
|
|
97
30
|
pub fn fork_agent_with_transport(
|
|
98
31
|
workspace: &Path,
|
|
99
32
|
source_agent_id: &AgentId,
|
|
100
33
|
as_agent_id: &AgentId,
|
|
101
34
|
label: Option<&str>,
|
|
102
|
-
|
|
35
|
+
open_display: bool,
|
|
103
36
|
team: Option<&str>,
|
|
104
37
|
transport: &dyn Transport,
|
|
105
38
|
) -> Result<ForkAgentReport, LifecycleError> {
|
|
39
|
+
let _ = (as_agent_id, label, open_display, transport);
|
|
106
40
|
let selected = crate::state::selector::resolve_active_team(
|
|
107
41
|
workspace,
|
|
108
42
|
team,
|
|
@@ -123,7 +57,6 @@ pub fn fork_agent_with_transport(
|
|
|
123
57
|
crate::state::selector::SelectorMode::RequireSpec,
|
|
124
58
|
)
|
|
125
59
|
.map_err(|e| LifecycleError::TeamSelect(e.to_string()))?;
|
|
126
|
-
let run_ws = selected.run_workspace.clone();
|
|
127
60
|
let agent = selected
|
|
128
61
|
.state
|
|
129
62
|
.get("agents")
|
|
@@ -135,126 +68,15 @@ pub fn fork_agent_with_transport(
|
|
|
135
68
|
.get("provider")
|
|
136
69
|
.and_then(serde_json::Value::as_str)
|
|
137
70
|
.unwrap_or("unknown");
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
return crate::lifecycle::restart::fork_pi_new_seat_locked(
|
|
146
|
-
&selected,
|
|
147
|
-
source_agent_id,
|
|
148
|
-
as_agent_id,
|
|
149
|
-
label,
|
|
150
|
-
transport,
|
|
151
|
-
);
|
|
152
|
-
}
|
|
153
|
-
let Some(spec) = in_window_fork(provider, auth) else {
|
|
154
|
-
return Err(refuse_missing_in_window_fork(provider, provider_raw));
|
|
155
|
-
};
|
|
156
|
-
if as_agent_id.as_str() != source_agent_id.as_str() {
|
|
157
|
-
return Err(LifecycleError::RequirementUnmet(format!(
|
|
158
|
-
"in-place fork refuses --as {as_agent_id}: session stays on {source_agent_id}"
|
|
159
|
-
)));
|
|
160
|
-
}
|
|
161
|
-
let pane_raw = agent
|
|
162
|
-
.get("pane_id")
|
|
163
|
-
.and_then(serde_json::Value::as_str)
|
|
164
|
-
.filter(|s| !s.is_empty())
|
|
165
|
-
.ok_or_else(|| {
|
|
166
|
-
LifecycleError::RequirementUnmet(format!(
|
|
167
|
-
"source agent {source_agent_id} has no pane_id"
|
|
168
|
-
))
|
|
169
|
-
})?;
|
|
170
|
-
let target = Target::Pane(PaneId::new(pane_raw));
|
|
171
|
-
let lock = acquire_or_proceed(PaneInputLockRequest {
|
|
172
|
-
workspace: Some(&run_ws),
|
|
173
|
-
target_key: pane_raw,
|
|
174
|
-
operation: "fork-inject",
|
|
175
|
-
});
|
|
176
|
-
if lock.is_none() {
|
|
177
|
-
let _ = crate::event_log::EventLog::new(&run_ws).write(
|
|
178
|
-
PANE_INPUT_LOCK_TIMEOUT_EVENT,
|
|
179
|
-
serde_json::json!({
|
|
180
|
-
"during": "fork-inject",
|
|
181
|
-
"agent_id": source_agent_id.as_str(),
|
|
182
|
-
"pane_id": pane_raw,
|
|
183
|
-
"observed_at": chrono::Utc::now().to_rfc3339(),
|
|
184
|
-
}),
|
|
185
|
-
);
|
|
186
|
-
}
|
|
187
|
-
inject_clean_command(transport, &target, spec.command)?;
|
|
188
|
-
wait_for_screen_mark(transport, &target, spec.screen_mark)?;
|
|
189
|
-
drop(lock);
|
|
190
|
-
crate::event_log::EventLog::new(&run_ws)
|
|
191
|
-
.write(
|
|
192
|
-
"lifecycle.fork.in_place",
|
|
193
|
-
serde_json::json!({
|
|
194
|
-
"source_agent_id": source_agent_id.as_str(),
|
|
195
|
-
"agent_id": source_agent_id.as_str(),
|
|
196
|
-
"pane_id": pane_raw,
|
|
197
|
-
"command": spec.command,
|
|
198
|
-
"screen_mark": spec.screen_mark,
|
|
199
|
-
}),
|
|
200
|
-
)
|
|
201
|
-
.map_err(|e| LifecycleError::StatePersist(format!("fork audit write failed: {e}")))?;
|
|
202
|
-
Ok(ForkAgentReport {
|
|
203
|
-
source_agent_id: source_agent_id.clone(),
|
|
204
|
-
new_agent_id: source_agent_id.clone(),
|
|
205
|
-
env: AgentActionEnvelope {
|
|
206
|
-
agent_id: source_agent_id.clone(),
|
|
207
|
-
state_file: crate::state::persist::runtime_state_path(&run_ws),
|
|
208
|
-
coordinator_started: false,
|
|
209
|
-
},
|
|
210
|
-
session_id: None,
|
|
211
|
-
backing_state: ForkBackingState::Verified,
|
|
212
|
-
pi_fork: None,
|
|
213
|
-
})
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
fn inject_clean_command(
|
|
217
|
-
transport: &dyn Transport,
|
|
218
|
-
target: &Target,
|
|
219
|
-
command: &str,
|
|
220
|
-
) -> Result<(), LifecycleError> {
|
|
221
|
-
transport
|
|
222
|
-
.inject(
|
|
223
|
-
target,
|
|
224
|
-
&crate::transport::InjectPayload::TextSkipConsumptionPoll(command.to_string()),
|
|
225
|
-
crate::transport::Key::Enter,
|
|
226
|
-
false,
|
|
227
|
-
)
|
|
228
|
-
.map_err(|e| LifecycleError::Transport(e.to_string()))?;
|
|
229
|
-
Ok(())
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
const NO_CONVERSATION_TO_BRANCH: &str = "Failed to branch conversation: No conversation to branch";
|
|
233
|
-
|
|
234
|
-
fn wait_for_screen_mark(
|
|
235
|
-
transport: &dyn Transport,
|
|
236
|
-
target: &Target,
|
|
237
|
-
screen_mark: &str,
|
|
238
|
-
) -> Result<(), LifecycleError> {
|
|
239
|
-
for attempt in 0..MAX_ENTER_RETRIES {
|
|
240
|
-
let cap = transport
|
|
241
|
-
.capture(target, crate::transport::CaptureRange::Tail(40))
|
|
242
|
-
.map_err(|e| LifecycleError::Transport(e.to_string()))?;
|
|
243
|
-
if cap.text.contains(screen_mark) {
|
|
244
|
-
return Ok(());
|
|
245
|
-
}
|
|
246
|
-
if cap.text.contains(NO_CONVERSATION_TO_BRANCH) {
|
|
247
|
-
return Err(LifecycleError::RequirementUnmet(
|
|
248
|
-
NO_CONVERSATION_TO_BRANCH.to_string(),
|
|
249
|
-
));
|
|
250
|
-
}
|
|
251
|
-
if attempt + 1 < MAX_ENTER_RETRIES {
|
|
252
|
-
// Mixed text in the box is not failure. Retry Enter only — never re-paste the slash command.
|
|
253
|
-
let _ = transport.send_keys(target, &[crate::transport::Key::Enter]);
|
|
254
|
-
std::thread::sleep(std::time::Duration::from_millis(80));
|
|
255
|
-
}
|
|
71
|
+
// A pre-upgrade Claude Code, Codex, Grok or Pi row has no legacy runtime
|
|
72
|
+
// to fork from; contract seats fork through the contract pipeline before
|
|
73
|
+
// this point.
|
|
74
|
+
if crate::provider::wire::is_retired_provider(provider_raw) {
|
|
75
|
+
return Err(LifecycleError::Provider(
|
|
76
|
+
crate::provider::wire::retired_provider_error(provider_raw).into(),
|
|
77
|
+
));
|
|
256
78
|
}
|
|
257
|
-
Err(LifecycleError::
|
|
258
|
-
"fork
|
|
79
|
+
Err(LifecycleError::Provider(format!(
|
|
80
|
+
"{provider_raw} native session fork is unverified (未验证); no legacy fork or fresh replacement was performed"
|
|
259
81
|
)))
|
|
260
82
|
}
|
|
@@ -44,39 +44,13 @@ pub fn fork_agent(
|
|
|
44
44
|
.map_err(|e| LifecycleError::TeamSelect(e.to_string()))?;
|
|
45
45
|
// Fork-agent routes to the selected live team's persisted endpoint, not
|
|
46
46
|
// the workspace-hash fallback socket.
|
|
47
|
-
let
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
.and_then(|agent| agent.get("provider"))
|
|
52
|
-
.and_then(serde_json::Value::as_str)
|
|
53
|
-
== Some("pi");
|
|
54
|
-
let transport: Box<dyn crate::transport::Transport> = if is_pi {
|
|
55
|
-
#[cfg(test)]
|
|
56
|
-
{
|
|
57
|
-
test_fork_transport(&selected, source_agent_id)
|
|
58
|
-
}
|
|
59
|
-
#[cfg(not(test))]
|
|
60
|
-
{
|
|
61
|
-
Box::new(
|
|
62
|
-
crate::lifecycle::restart::lifecycle_worker_tmux_backend_selection_for_state(
|
|
63
|
-
&selected.run_workspace,
|
|
64
|
-
&selected.state,
|
|
65
|
-
)?
|
|
66
|
-
.backend,
|
|
67
|
-
)
|
|
68
|
-
}
|
|
69
|
-
} else {
|
|
70
|
-
Box::new(
|
|
71
|
-
crate::lifecycle::restart::lifecycle_worker_tmux_backend_for_selected_state(
|
|
72
|
-
&selected.run_workspace,
|
|
73
|
-
Some(selected.team_key.as_str()),
|
|
74
|
-
)
|
|
75
|
-
.unwrap_or_else(|_| {
|
|
76
|
-
crate::tmux_backend::TmuxBackend::for_workspace(&selected.run_workspace)
|
|
77
|
-
}),
|
|
47
|
+
let transport: Box<dyn crate::transport::Transport> = Box::new(
|
|
48
|
+
crate::lifecycle::restart::lifecycle_worker_tmux_backend_for_selected_state(
|
|
49
|
+
&selected.run_workspace,
|
|
50
|
+
Some(selected.team_key.as_str()),
|
|
78
51
|
)
|
|
79
|
-
|
|
52
|
+
.unwrap_or_else(|_| crate::tmux_backend::TmuxBackend::for_workspace(&selected.run_workspace)),
|
|
53
|
+
);
|
|
80
54
|
fork_agent_with_transport(
|
|
81
55
|
workspace,
|
|
82
56
|
source_agent_id,
|
|
@@ -87,58 +61,3 @@ pub fn fork_agent(
|
|
|
87
61
|
transport.as_ref(),
|
|
88
62
|
)
|
|
89
63
|
}
|
|
90
|
-
|
|
91
|
-
#[cfg(test)]
|
|
92
|
-
fn test_fork_transport(
|
|
93
|
-
selected: &crate::state::selector::SelectedTeam,
|
|
94
|
-
source_agent_id: &AgentId,
|
|
95
|
-
) -> Box<dyn crate::transport::Transport> {
|
|
96
|
-
let state = &selected.state;
|
|
97
|
-
let session = state
|
|
98
|
-
.get("session_name")
|
|
99
|
-
.and_then(serde_json::Value::as_str)
|
|
100
|
-
.filter(|value| !value.is_empty())
|
|
101
|
-
.map(crate::transport::SessionName::new)
|
|
102
|
-
.unwrap_or_else(|| crate::transport::SessionName::new("offline"));
|
|
103
|
-
let source = state
|
|
104
|
-
.get("agents")
|
|
105
|
-
.and_then(|agents| agents.get(source_agent_id.as_str()));
|
|
106
|
-
let targets = source
|
|
107
|
-
.and_then(|agent| agent.get("pane_id"))
|
|
108
|
-
.and_then(serde_json::Value::as_str)
|
|
109
|
-
.filter(|pane| !pane.is_empty())
|
|
110
|
-
.map(|pane| {
|
|
111
|
-
let window = source
|
|
112
|
-
.and_then(|agent| agent.get("window"))
|
|
113
|
-
.and_then(serde_json::Value::as_str)
|
|
114
|
-
.filter(|value| !value.is_empty())
|
|
115
|
-
.unwrap_or(source_agent_id.as_str());
|
|
116
|
-
vec![crate::transport::PaneInfo {
|
|
117
|
-
pane_id: crate::transport::PaneId::new(pane),
|
|
118
|
-
session: session.clone(),
|
|
119
|
-
window_index: None,
|
|
120
|
-
window_name: Some(crate::transport::WindowName::new(window)),
|
|
121
|
-
pane_index: None,
|
|
122
|
-
tty: None,
|
|
123
|
-
current_command: None,
|
|
124
|
-
current_path: None,
|
|
125
|
-
active: false,
|
|
126
|
-
pane_pid: None,
|
|
127
|
-
leader_env: std::collections::BTreeMap::new(),
|
|
128
|
-
}]
|
|
129
|
-
})
|
|
130
|
-
.unwrap_or_default();
|
|
131
|
-
let endpoint = state
|
|
132
|
-
.get("tmux_endpoint")
|
|
133
|
-
.or_else(|| state.get("tmux_socket"))
|
|
134
|
-
.and_then(serde_json::Value::as_str)
|
|
135
|
-
.filter(|value| !value.is_empty())
|
|
136
|
-
.map(str::to_string)
|
|
137
|
-
.unwrap_or_else(|| "offline".to_string());
|
|
138
|
-
Box::new(
|
|
139
|
-
crate::transport::test_support::OfflineTransport::new()
|
|
140
|
-
.with_session_present(true)
|
|
141
|
-
.with_targets(targets)
|
|
142
|
-
.with_tmux_endpoint(endpoint),
|
|
143
|
-
)
|
|
144
|
-
}
|