@team-agent/installer 0.5.126 → 0.5.128
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Cargo.lock +1 -1
- package/Cargo.toml +1 -1
- package/README.md +11 -0
- package/crates/team-agent/src/cli/adapters.rs +3 -13
- package/crates/team-agent/src/cli/arguments.rs +4 -0
- package/crates/team-agent/src/cli/diagnose.rs +68 -91
- package/crates/team-agent/src/cli/emit.rs +61 -28
- package/crates/team-agent/src/cli/grok_slot.rs +88 -3
- package/crates/team-agent/src/cli/intent/runtime.rs +38 -9
- package/crates/team-agent/src/cli/intent/runtime_tests.rs +147 -11
- package/crates/team-agent/src/cli/intent/tests.rs +10 -12
- package/crates/team-agent/src/cli/intent.rs +1 -1
- package/crates/team-agent/src/cli/mod.rs +38 -9
- package/crates/team-agent/src/cli/models.rs +789 -186
- package/crates/team-agent/src/cli/schedule.rs +175 -0
- package/crates/team-agent/src/cli/send/persist.rs +0 -36
- package/crates/team-agent/src/cli/send/presentation.rs +1 -1
- package/crates/team-agent/src/cli/send.rs +108 -110
- package/crates/team-agent/src/cli/spec.rs +6 -0
- package/crates/team-agent/src/cli/status_port/brief.rs +5 -67
- package/crates/team-agent/src/cli/tests/leader_watch.rs +12 -62
- package/crates/team-agent/src/cli/tests/mod.rs +3 -3
- package/crates/team-agent/src/cli/tests/named_address.rs +11 -10
- package/crates/team-agent/src/cli/tests/run_delegation.rs +12 -9
- package/crates/team-agent/src/cli/tests/status_send.rs +70 -273
- package/crates/team-agent/src/compiler/tests.rs +39 -27
- package/crates/team-agent/src/compiler.rs +206 -6
- package/crates/team-agent/src/contract_runtime/backend.rs +181 -11
- package/crates/team-agent/src/contract_runtime/commands.rs +338 -7
- package/crates/team-agent/src/contract_runtime/config.rs +30 -19
- package/crates/team-agent/src/contract_runtime/config_tests.rs +24 -4
- package/crates/team-agent/src/contract_runtime/discovery.rs +12 -1
- package/crates/team-agent/src/contract_runtime/fork.rs +3 -10
- package/crates/team-agent/src/contract_runtime/framework.rs +28 -14
- package/crates/team-agent/src/contract_runtime/mcp.rs +19 -24
- package/crates/team-agent/src/contract_runtime/prompt.rs +2 -2
- package/crates/team-agent/src/contract_runtime/registry.rs +93 -130
- package/crates/team-agent/src/coordinator/steps/abnormal.rs +45 -5
- package/crates/team-agent/src/coordinator/tests/api_error_recovery.rs +8 -29
- package/crates/team-agent/src/coordinator/tests/energy.rs +4 -4
- package/crates/team-agent/src/coordinator/tests/health_sync.rs +44 -2
- package/crates/team-agent/src/coordinator/tests/main_preserved.rs +2 -2
- package/crates/team-agent/src/coordinator/tests/spine.rs +1 -1
- package/crates/team-agent/src/coordinator/tests/takeover.rs +3 -3
- package/crates/team-agent/src/coordinator/tick.rs +1 -89
- package/crates/team-agent/src/db/message_store.rs +7 -65
- package/crates/team-agent/src/direct_delivery.rs +368 -0
- package/crates/team-agent/src/inbox_store.rs +169 -0
- package/crates/team-agent/src/leader/registry.rs +5 -0
- package/crates/team-agent/src/leader/start.rs +2 -1
- package/crates/team-agent/src/leader/tests/lease_api.rs +2 -2
- package/crates/team-agent/src/leader/tests/prompt_contract.rs +1 -0
- package/crates/team-agent/src/lib.rs +2 -0
- package/crates/team-agent/src/lifecycle/launch/add_agent.rs +33 -0
- package/crates/team-agent/src/lifecycle/launch/add_agent_state.rs +206 -1
- package/crates/team-agent/src/lifecycle/launch/clone_agent.rs +28 -2
- package/crates/team-agent/src/lifecycle/launch/fork_agent.rs +36 -179
- package/crates/team-agent/src/lifecycle/launch/fork_entry.rs +87 -6
- package/crates/team-agent/src/lifecycle/launch/mcp_config.rs +13 -488
- package/crates/team-agent/src/lifecycle/launch/pi_mcp.rs +351 -81
- package/crates/team-agent/src/lifecycle/launch/pi_mcp_extension.js +3 -4
- package/crates/team-agent/src/lifecycle/launch/quick_start.rs +26 -2
- package/crates/team-agent/src/lifecycle/launch/spawn.rs +41 -31
- package/crates/team-agent/src/lifecycle/launch.rs +27 -12
- package/crates/team-agent/src/lifecycle/profile_launch.rs +318 -64
- package/crates/team-agent/src/lifecycle/restart/agent.rs +1 -0
- package/crates/team-agent/src/lifecycle/restart/avatar.rs +1798 -0
- package/crates/team-agent/src/lifecycle/restart/claude_fork.rs +163 -0
- package/crates/team-agent/src/lifecycle/restart/common.rs +298 -133
- package/crates/team-agent/src/lifecycle/restart/remove.rs +129 -0
- package/crates/team-agent/src/lifecycle/restart/selection.rs +5 -5
- package/crates/team-agent/src/lifecycle/restart.rs +4 -0
- package/crates/team-agent/src/lifecycle/role_config.rs +79 -27
- package/crates/team-agent/src/lifecycle/tests/acceptance_b_batch_red.rs +1 -1
- package/crates/team-agent/src/lifecycle/tests/agent_ops.rs +8 -12
- package/crates/team-agent/src/lifecycle/tests/behavioral_diff_264_red.rs +37 -240
- package/crates/team-agent/src/lifecycle/tests/claude_compatible_config_red.rs +325 -0
- package/crates/team-agent/src/lifecycle/tests/claude_profile_launch_red.rs +320 -8
- package/crates/team-agent/src/lifecycle/tests/cli_argv_routing_red.rs +329 -70
- package/crates/team-agent/src/lifecycle/tests/clone_fork_copilot_perms_red.rs +378 -4
- package/crates/team-agent/src/lifecycle/tests/communication_mode_runtime_contract_red.rs +25 -39
- package/crates/team-agent/src/lifecycle/tests/copilot_provider_red.rs +7 -11
- package/crates/team-agent/src/lifecycle/tests/core.rs +39 -36
- package/crates/team-agent/src/lifecycle/tests/f032_startup_prompt_best_effort_red.rs +22 -8
- package/crates/team-agent/src/lifecycle/tests/fixtures/pi_native_mcp_host.mjs +2 -1
- package/crates/team-agent/src/lifecycle/tests/grok_require_explicit_model_red.rs +15 -133
- package/crates/team-agent/src/lifecycle/tests/harvest2_a_batch_red.rs +60 -20
- package/crates/team-agent/src/lifecycle/tests/host_cotenant_death_p0_contract.rs +30 -67
- package/crates/team-agent/src/lifecycle/tests/issue238_codex_effort_contract.rs +3 -31
- package/crates/team-agent/src/lifecycle/tests/lane_ops.rs +194 -169
- package/crates/team-agent/src/lifecycle/tests/launch_spawn.rs +164 -282
- package/crates/team-agent/src/lifecycle/tests/lifecycle_rollback_red.rs +15 -78
- package/crates/team-agent/src/lifecycle/tests/main_preserved.rs +7 -7
- package/crates/team-agent/src/lifecycle/tests/mcp_tool_name_format_red.rs +6 -6
- package/crates/team-agent/src/lifecycle/tests/phase_b_contracts.rs +75 -69
- package/crates/team-agent/src/lifecycle/tests/phase_golden.rs +2 -10
- package/crates/team-agent/src/lifecycle/tests/pi_catalog_red.rs +18 -6
- package/crates/team-agent/src/lifecycle/tests/pi_command_red.rs +70 -52
- package/crates/team-agent/src/lifecycle/tests/pi_compiler_red.rs +210 -0
- package/crates/team-agent/src/lifecycle/tests/pi_dual_entry_red.rs +157 -4
- package/crates/team-agent/src/lifecycle/tests/pi_executable_mcp_red.rs +526 -10
- package/crates/team-agent/src/lifecycle/tests/pi_fork_session_inheritance_red.rs +1419 -0
- package/crates/team-agent/src/lifecycle/tests/pi_lifecycle_doctor_red.rs +68 -1
- package/crates/team-agent/src/lifecycle/tests/pi_native_mcp_capability_red.rs +34 -12
- package/crates/team-agent/src/lifecycle/tests/pi_session_delivery_red.rs +94 -2
- package/crates/team-agent/src/lifecycle/tests/quick_start_worker_readiness_red.rs +14 -15
- package/crates/team-agent/src/lifecycle/tests/restart.rs +12 -153
- package/crates/team-agent/src/lifecycle/tests/restart_build_before_destroy_0540_contract.rs +27 -5
- package/crates/team-agent/src/lifecycle/tests/restart_liveness_red.rs +59 -10
- package/crates/team-agent/src/lifecycle/tests/restart_rebind_hotfix_252_red.rs +47 -6
- package/crates/team-agent/src/lifecycle/tests/restart_session_capture_red.rs +3 -1374
- package/crates/team-agent/src/lifecycle/tests/resume_recover_red.rs +27 -10
- package/crates/team-agent/src/lifecycle/tests/status_credential_redaction_contract.rs +7 -7
- package/crates/team-agent/src/lifecycle/tests/subprep_codex_trust_roundtrip_red.rs +67 -313
- package/crates/team-agent/src/lifecycle/tests/swallow_batch4_semantics_red.rs +254 -2
- package/crates/team-agent/src/lifecycle/tests/team_in_team_identity_scope_red.rs +2 -2
- package/crates/team-agent/src/lifecycle/tests/team_in_team_sibling_quick_start_red.rs +1 -1
- package/crates/team-agent/src/lifecycle/tests/team_in_team_state_scope_red.rs +2 -2
- package/crates/team-agent/src/lifecycle/tests/team_key_retirement_txn_red.rs +4 -4
- package/crates/team-agent/src/lifecycle/tests/upgrade_compat_0211_red.rs +74 -19
- package/crates/team-agent/src/lifecycle/tests/verify_rs031_window_consistency_red.rs +38 -39
- package/crates/team-agent/src/lifecycle/tests/worker_spawn_env_red.rs +51 -88
- package/crates/team-agent/src/lifecycle/tests.rs +3 -4
- package/crates/team-agent/src/lifecycle/types.rs +18 -5
- package/crates/team-agent/src/lifecycle/worker_command_context.rs +43 -50
- package/crates/team-agent/src/mcp_server/readiness.rs +130 -149
- package/crates/team-agent/src/mcp_server/readiness_tests.rs +86 -109
- package/crates/team-agent/src/mcp_server/tests/scoped.rs +21 -31
- package/crates/team-agent/src/mcp_server/tests/send.rs +72 -107
- package/crates/team-agent/src/mcp_server/tests/tools.rs +10 -12
- package/crates/team-agent/src/mcp_server/tools.rs +70 -196
- package/crates/team-agent/src/messaging/delivery.rs +143 -253
- package/crates/team-agent/src/messaging/delivery_consumption_tests.rs +5 -5
- package/crates/team-agent/src/messaging/helpers.rs +1 -19
- package/crates/team-agent/src/messaging/mod.rs +1 -0
- package/crates/team-agent/src/messaging/reminders.rs +316 -0
- package/crates/team-agent/src/messaging/scheduler.rs +7 -1
- package/crates/team-agent/src/messaging/tests/dup_inject.rs +255 -150
- package/crates/team-agent/src/messaging/tests/main_preserved.rs +2 -2
- package/crates/team-agent/src/messaging/tests/runtime.rs +9 -115
- package/crates/team-agent/src/messaging/tests/spine.rs +44 -24
- package/crates/team-agent/src/messaging/tests/wave2.rs +13 -20
- package/crates/team-agent/src/messaging/types.rs +1 -0
- package/crates/team-agent/src/provider/adapter.rs +208 -254
- package/crates/team-agent/src/provider/adapters/claude.rs +78 -0
- package/crates/team-agent/src/provider/adapters/claude_fork.rs +131 -0
- package/crates/team-agent/src/provider/adapters/mod.rs +7 -7
- package/crates/team-agent/src/provider/adapters/pi.rs +106 -0
- package/crates/team-agent/src/provider/classify.rs +1 -66
- package/crates/team-agent/src/provider/model_catalog.rs +201 -13
- package/crates/team-agent/src/provider/session/capture.rs +111 -111
- package/crates/team-agent/src/provider/session/context_fork/claude.rs +123 -0
- package/crates/team-agent/src/provider/session/context_fork/outcome.rs +10 -18
- package/crates/team-agent/src/provider/session/context_fork.rs +87 -74
- package/crates/team-agent/src/provider/session/mod.rs +2 -3
- package/crates/team-agent/src/provider/session_scan/claude.rs +523 -0
- package/crates/team-agent/src/provider/session_scan/common.rs +47 -47
- package/crates/team-agent/src/provider/session_scan/pi.rs +34 -1
- package/crates/team-agent/src/provider/session_scan.rs +13 -13
- package/crates/team-agent/src/provider/tests/adapter.rs +127 -121
- package/crates/team-agent/src/provider/tests/classify.rs +0 -53
- package/crates/team-agent/src/provider/tests/command_helpers.rs +11 -19
- package/crates/team-agent/src/provider/tests/idle.rs +13 -19
- package/crates/team-agent/src/provider/types.rs +0 -4
- package/crates/team-agent/src/provider/wire.rs +34 -20
- package/crates/team-agent/src/state/abnormal_watch/tests/mod.rs +1 -1
- package/crates/team-agent/src/state/persist.rs +6 -6
- package/crates/team-agent/src/state/projection.rs +1 -1
- package/crates/team-agent/src/state/repository/tests.rs +2 -2
- package/crates/team-agent/src/test_support/models_timeout_fixture.rs +144 -0
- package/crates/team-agent/src/tmux_backend/tests.rs +0 -151
- package/crates/team-agent/src/tmux_backend.rs +9 -43
- package/package.json +4 -4
- package/skills/team-agent/SKILL.md +7 -8
- package/skills/team-agent/command-coverage.json +15 -1
- package/skills/team-agent/docs/reference/team-agent-operator.md +5 -3
- package/skills/team-agent/references/team-agent-operator.md +5 -3
- package/crates/team-agent/src/lifecycle/launch/grok_per_seat.rs +0 -260
- package/crates/team-agent/src/lifecycle/tests/codex_weak_window_attribution_red.rs +0 -683
- package/crates/team-agent/src/lifecycle/tests/grok_effort_argv_red.rs +0 -247
- package/crates/team-agent/src/lifecycle/tests/grok_mcp_overlay_red.rs +0 -507
- package/crates/team-agent/src/lifecycle/tests/grok_restart_resume_red.rs +0 -300
- package/crates/team-agent/src/provider/adapters/codex.rs +0 -101
- package/crates/team-agent/src/provider/adapters/grok.rs +0 -67
- package/crates/team-agent/src/provider/session/context_fork/codex.rs +0 -514
- package/crates/team-agent/src/provider/session_scan/codex.rs +0 -326
- package/crates/team-agent/src/provider/session_scan/grok.rs +0 -288
|
@@ -19,7 +19,6 @@
|
|
|
19
19
|
|
|
20
20
|
use std::cell::{Cell, RefCell};
|
|
21
21
|
use std::path::Path;
|
|
22
|
-
use std::time::Duration;
|
|
23
22
|
|
|
24
23
|
use rusqlite::{params, OptionalExtension};
|
|
25
24
|
|
|
@@ -27,7 +26,9 @@ use crate::event_log::EventLog;
|
|
|
27
26
|
use crate::message_store::MessageStore;
|
|
28
27
|
use crate::model::enums::{PaneLiveness, Provider};
|
|
29
28
|
use crate::model::ids::TeamKey;
|
|
30
|
-
use crate::provider::wire::
|
|
29
|
+
use crate::provider::wire::{
|
|
30
|
+
is_claude_family, parse_canonical_provider, parse_provider, provider_wire,
|
|
31
|
+
};
|
|
31
32
|
use crate::transport::{
|
|
32
33
|
submit_verification_wire, turn_verification_wire, BusySignalKind, CaptureRange,
|
|
33
34
|
CaptureSampleOutcome, InjectPayload, InjectReport, InjectVerification, InputSurfaceProbe, Key,
|
|
@@ -300,156 +301,6 @@ fn prepare_message_state(
|
|
|
300
301
|
Ok(Ok(prepared))
|
|
301
302
|
}
|
|
302
303
|
|
|
303
|
-
/// #372: how long a seat may wait for its MCP handshake, counted from its
|
|
304
|
-
/// spawn or the message's creation (whichever is later), before the message
|
|
305
|
-
/// parks instead of re-polling every tick.
|
|
306
|
-
#[cfg(unix)]
|
|
307
|
-
const MCP_HANDSHAKE_WAIT_LIMIT_SECS: i64 = 300;
|
|
308
|
-
|
|
309
|
-
#[cfg(unix)]
|
|
310
|
-
#[allow(clippy::too_many_arguments)]
|
|
311
|
-
fn mcp_handshake_pending_outcome(
|
|
312
|
-
workspace: &Path,
|
|
313
|
-
store: &MessageStore,
|
|
314
|
-
event_log: &EventLog,
|
|
315
|
-
state: &serde_json::Value,
|
|
316
|
-
owner: Option<&str>,
|
|
317
|
-
message_id: &str,
|
|
318
|
-
message: &PendingMessage,
|
|
319
|
-
attempt: u32,
|
|
320
|
-
reason: &str,
|
|
321
|
-
) -> Result<DeliveryOutcome, MessagingError> {
|
|
322
|
-
let already_claimed = || DeliveryOutcome {
|
|
323
|
-
ok: false,
|
|
324
|
-
status: DeliveryStatus::Refused,
|
|
325
|
-
message_status: MessageStatusShadow("target_resolved".to_string()),
|
|
326
|
-
message_id: Some(message_id.to_string()),
|
|
327
|
-
verification: None,
|
|
328
|
-
stage: None,
|
|
329
|
-
reason: Some(DeliveryRefusal::MessageAlreadyClaimed),
|
|
330
|
-
channel: None,
|
|
331
|
-
ack_forced_off: false,
|
|
332
|
-
turn_verification: None,
|
|
333
|
-
};
|
|
334
|
-
let spawned_at = state["agents"][message.recipient.as_str()]["spawned_at"].as_str();
|
|
335
|
-
let waited_s = [spawned_at, message.created_at.as_deref()]
|
|
336
|
-
.into_iter()
|
|
337
|
-
.flatten()
|
|
338
|
-
.filter_map(|at| chrono::DateTime::parse_from_rfc3339(at).ok())
|
|
339
|
-
.max()
|
|
340
|
-
.map_or(0, |since| {
|
|
341
|
-
(chrono::Utc::now() - since.with_timezone(&chrono::Utc)).num_seconds()
|
|
342
|
-
});
|
|
343
|
-
if waited_s >= MCP_HANDSHAKE_WAIT_LIMIT_SECS {
|
|
344
|
-
if !store.park_delivery_before_input(message_id, attempt)? {
|
|
345
|
-
return Ok(already_claimed());
|
|
346
|
-
}
|
|
347
|
-
// A receipt published between this preflight and the park found no
|
|
348
|
-
// parked row to resume; one re-check keeps that publication from being lost.
|
|
349
|
-
let published_meanwhile = owner.is_some_and(|owner| {
|
|
350
|
-
crate::mcp_server::readiness::preflight(workspace, Some(owner), &message.recipient, state)
|
|
351
|
-
.is_ok()
|
|
352
|
-
});
|
|
353
|
-
if published_meanwhile {
|
|
354
|
-
store.requeue_parked_deliveries(&message.recipient, owner.unwrap_or_default())?;
|
|
355
|
-
} else {
|
|
356
|
-
event_log.write("delivery.mcp_handshake_parked", serde_json::json!({
|
|
357
|
-
"message_id": message_id,
|
|
358
|
-
"recipient": message.recipient,
|
|
359
|
-
"reason": reason,
|
|
360
|
-
"waited_s": waited_s,
|
|
361
|
-
}))?;
|
|
362
|
-
notify_mcp_handshake_parked(workspace, store, event_log, state, &message.recipient, reason, waited_s)?;
|
|
363
|
-
}
|
|
364
|
-
return Ok(DeliveryOutcome {
|
|
365
|
-
ok: false,
|
|
366
|
-
status: DeliveryStatus::Blocked,
|
|
367
|
-
message_status: MessageStatusShadow(
|
|
368
|
-
if published_meanwhile { "accepted" } else { "queued_until_start" }.to_string(),
|
|
369
|
-
),
|
|
370
|
-
message_id: Some(message_id.to_string()),
|
|
371
|
-
verification: Some(format!("{}:{reason}", crate::message_store::MCP_HANDSHAKE_TIMEOUT)),
|
|
372
|
-
stage: None,
|
|
373
|
-
reason: None,
|
|
374
|
-
channel: None,
|
|
375
|
-
ack_forced_off: false,
|
|
376
|
-
turn_verification: None,
|
|
377
|
-
});
|
|
378
|
-
}
|
|
379
|
-
// No paste/key has occurred. Only this exact claim may be released; a
|
|
380
|
-
// concurrent cancellation or newer delivery must never be overwritten.
|
|
381
|
-
if !store.release_delivery_before_input(message_id, attempt, reason)? {
|
|
382
|
-
return Ok(already_claimed());
|
|
383
|
-
}
|
|
384
|
-
event_log.write("delivery.deferred_mcp_handshake", serde_json::json!({
|
|
385
|
-
"message_id": message_id,
|
|
386
|
-
"recipient": message.recipient,
|
|
387
|
-
"reason": reason,
|
|
388
|
-
"waited_s": waited_s,
|
|
389
|
-
"effect": "none",
|
|
390
|
-
}))?;
|
|
391
|
-
Ok(DeliveryOutcome {
|
|
392
|
-
ok: false,
|
|
393
|
-
status: DeliveryStatus::Degraded,
|
|
394
|
-
message_status: MessageStatusShadow("target_resolved".to_string()),
|
|
395
|
-
message_id: Some(message_id.to_string()),
|
|
396
|
-
verification: Some(reason.to_string()),
|
|
397
|
-
stage: None,
|
|
398
|
-
reason: None,
|
|
399
|
-
channel: None,
|
|
400
|
-
ack_forced_off: false,
|
|
401
|
-
turn_verification: None,
|
|
402
|
-
})
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
/// One leader notice per seat spawn; later parks of the same spawn stay quiet.
|
|
406
|
-
#[cfg(unix)]
|
|
407
|
-
fn notify_mcp_handshake_parked(
|
|
408
|
-
workspace: &Path,
|
|
409
|
-
store: &MessageStore,
|
|
410
|
-
event_log: &EventLog,
|
|
411
|
-
state: &serde_json::Value,
|
|
412
|
-
recipient: &str,
|
|
413
|
-
reason: &str,
|
|
414
|
-
waited_s: i64,
|
|
415
|
-
) -> Result<(), MessagingError> {
|
|
416
|
-
let agent = &state["agents"][recipient];
|
|
417
|
-
let result_id = format!(
|
|
418
|
-
"mcp_handshake.timeout:{recipient}:{}",
|
|
419
|
-
agent["spawned_at"].as_str().unwrap_or("unknown")
|
|
420
|
-
);
|
|
421
|
-
let notified = crate::db::schema::open_db(store.db_path())?
|
|
422
|
-
.query_row(
|
|
423
|
-
"select 1 from leader_notification_log where result_id = ?1 limit 1",
|
|
424
|
-
params![result_id],
|
|
425
|
-
|_| Ok(()),
|
|
426
|
-
)
|
|
427
|
-
.optional()?
|
|
428
|
-
.is_some();
|
|
429
|
-
if notified {
|
|
430
|
-
return Ok(());
|
|
431
|
-
}
|
|
432
|
-
let live = agent["pane_pid"]
|
|
433
|
-
.as_u64()
|
|
434
|
-
.and_then(|pid| u32::try_from(pid).ok())
|
|
435
|
-
.map(crate::mcp_server::readiness::live_servers_under)
|
|
436
|
-
.unwrap_or_default();
|
|
437
|
-
let live = if live.is_empty() { "none".to_string() } else { format!("{live:?}") };
|
|
438
|
-
let content = format!(
|
|
439
|
-
"mcp_handshake.timeout\nerror: messages to {recipient} are parked after waiting {waited_s}s for its MCP handshake ({reason}); live mcp-server pids under its pane: {live}\naction: run team-agent restart {recipient}; parked messages resume automatically once its MCP server publishes a handshake\nlog: .team/logs/events.jsonl"
|
|
440
|
-
);
|
|
441
|
-
let outcome = crate::messaging::send_to_leader_receiver(
|
|
442
|
-
workspace, state, "leader", &content, None, "coordinator", false, Some(&result_id), event_log,
|
|
443
|
-
);
|
|
444
|
-
event_log.write("delivery.mcp_handshake_parked_notification", serde_json::json!({
|
|
445
|
-
"recipient": recipient,
|
|
446
|
-
"result_id": result_id,
|
|
447
|
-
"live_mcp_servers": live,
|
|
448
|
-
"error": outcome.err().map(|error| error.to_string()),
|
|
449
|
-
}))?;
|
|
450
|
-
Ok(())
|
|
451
|
-
}
|
|
452
|
-
|
|
453
304
|
fn deliver_prepared_message(
|
|
454
305
|
workspace: &Path,
|
|
455
306
|
store: &MessageStore,
|
|
@@ -792,11 +643,8 @@ fn deliver_prepared_message(
|
|
|
792
643
|
turn_verification: None,
|
|
793
644
|
});
|
|
794
645
|
}
|
|
795
|
-
//
|
|
796
|
-
//
|
|
797
|
-
// No business input is allowed before the current tools/list flush. A
|
|
798
|
-
// readiness-only refusal releases this exact claim without spending an
|
|
799
|
-
// input attempt; it never holds a pane-input lock or sleeps for startup.
|
|
646
|
+
// MCP readiness is diagnostic, not permission to type into a live pane.
|
|
647
|
+
// Missing/foreign evidence never releases the claim or parks this message.
|
|
800
648
|
#[cfg(unix)]
|
|
801
649
|
{
|
|
802
650
|
let admission = crate::mcp_server::readiness::preflight(
|
|
@@ -808,10 +656,11 @@ fn deliver_prepared_message(
|
|
|
808
656
|
Ok(())
|
|
809
657
|
});
|
|
810
658
|
if let Err(reason) = admission {
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
659
|
+
let _ = event_log.write("delivery.mcp_handshake_warning", serde_json::json!({
|
|
660
|
+
"message_id": message_id,
|
|
661
|
+
"reason": reason,
|
|
662
|
+
"delivery_blocked": false,
|
|
663
|
+
}));
|
|
815
664
|
}
|
|
816
665
|
}
|
|
817
666
|
let rendered = render_message(
|
|
@@ -837,8 +686,8 @@ fn deliver_prepared_message(
|
|
|
837
686
|
);
|
|
838
687
|
// v0.5.113 delivery: address/owner and pane serialization are authoritative;
|
|
839
688
|
// composer appearance is not admission. Native CLIs buffer/queue input.
|
|
840
|
-
let inject_attempt = crate::tmux_backend::
|
|
841
|
-
|
|
689
|
+
let inject_attempt = crate::tmux_backend::with_cursor_single_enter(
|
|
690
|
+
recipient_requires_single_enter(state, &message.recipient),
|
|
842
691
|
|| {
|
|
843
692
|
transport.inject_with_submit_observer(
|
|
844
693
|
&target,
|
|
@@ -853,7 +702,9 @@ fn deliver_prepared_message(
|
|
|
853
702
|
Ok(report) => {
|
|
854
703
|
// grok 忙时第一次回车只入显式队列。默认 send-now:只重按回车顶出去。
|
|
855
704
|
// 无 `Enter:send now` 时零次额外按键,claude/codex 行为不变。
|
|
856
|
-
if !crate::provider::submit_now::keep_provider_queue_requested()
|
|
705
|
+
if !crate::provider::submit_now::keep_provider_queue_requested()
|
|
706
|
+
&& recipient_allows_explicit_queue_flush(state, &message.recipient)
|
|
707
|
+
{
|
|
857
708
|
match crate::provider::submit_now::flush_explicit_queue(transport, &target) {
|
|
858
709
|
Ok(flush) if flush.extra_enters > 0 => {
|
|
859
710
|
let _ = event_log.write(
|
|
@@ -993,31 +844,7 @@ fn deliver_prepared_message(
|
|
|
993
844
|
// worker delivery both require post-submit evidence; leader additionally
|
|
994
845
|
// waits for its authoritative provider transcript below.
|
|
995
846
|
let native_consumed = observed_token_consumed(transport, state, &message.recipient, &target, message_id);
|
|
996
|
-
let
|
|
997
|
-
// #379: a pane the verifier could not read is not a failed send. The
|
|
998
|
-
// recipient's own transcript row (user turn or queued enqueue) is the
|
|
999
|
-
// provider's receipt; native observers keep their veto.
|
|
1000
|
-
if !verified
|
|
1001
|
-
&& native_consumed.is_none()
|
|
1002
|
-
&& recipient_transcript_contains_within(
|
|
1003
|
-
state,
|
|
1004
|
-
&message.recipient,
|
|
1005
|
-
&message_token_marker(message_id),
|
|
1006
|
-
TRANSCRIPT_RECEIPT_TAIL_BYTES,
|
|
1007
|
-
)
|
|
1008
|
-
{
|
|
1009
|
-
verified = true;
|
|
1010
|
-
event_log.write(
|
|
1011
|
-
"send.unverified_reconciled",
|
|
1012
|
-
serde_json::json!({
|
|
1013
|
-
"message_id": message_id,
|
|
1014
|
-
"recipient": message.recipient,
|
|
1015
|
-
"source": "recipient_transcript",
|
|
1016
|
-
"submit_verification": submit_verification_wire(inject_report.submit_verification),
|
|
1017
|
-
"attempts": inject_report.attempts,
|
|
1018
|
-
}),
|
|
1019
|
-
)?;
|
|
1020
|
-
}
|
|
847
|
+
let verified = submit_verified && native_consumed != Some(false);
|
|
1021
848
|
if !verified {
|
|
1022
849
|
let reason = if native_consumed == Some(false) {
|
|
1023
850
|
"submit_unverified:current_composer_or_consumption_unknown".to_string()
|
|
@@ -1040,7 +867,6 @@ fn deliver_prepared_message(
|
|
|
1040
867
|
"recipient": message.recipient,
|
|
1041
868
|
"reason": reason,
|
|
1042
869
|
"attempts": inject_report.attempts,
|
|
1043
|
-
"delivery_attempt": attempt,
|
|
1044
870
|
"submit_attempts_detail": submit_attempts_detail,
|
|
1045
871
|
});
|
|
1046
872
|
merge_inject_readback_fields(
|
|
@@ -1050,8 +876,7 @@ fn deliver_prepared_message(
|
|
|
1050
876
|
resolved.metadata.as_ref(),
|
|
1051
877
|
);
|
|
1052
878
|
event_log.write("send.unverified", unverified)?;
|
|
1053
|
-
|
|
1054
|
-
if attempt >= u32::from(SEND_RETRY_MAX_ATTEMPTS) {
|
|
879
|
+
if inject_report.attempts >= u32::from(SEND_RETRY_MAX_ATTEMPTS) {
|
|
1055
880
|
store.mark(message_id, "failed", Some("send_unverified_exhausted"))?;
|
|
1056
881
|
emit_send_failed_exhausted(
|
|
1057
882
|
workspace,
|
|
@@ -1059,7 +884,7 @@ fn deliver_prepared_message(
|
|
|
1059
884
|
event_log,
|
|
1060
885
|
message_id,
|
|
1061
886
|
&message.recipient,
|
|
1062
|
-
|
|
887
|
+
inject_report.attempts,
|
|
1063
888
|
"send_unverified_exhausted",
|
|
1064
889
|
&reason,
|
|
1065
890
|
Some(&inject_report),
|
|
@@ -1093,6 +918,75 @@ fn deliver_prepared_message(
|
|
|
1093
918
|
turn_verification: Some(turn_verification),
|
|
1094
919
|
});
|
|
1095
920
|
}
|
|
921
|
+
// S1-CAPTURE-001 (0.4.8, CR M4 Claude phase-1): for Claude/ClaudeCode
|
|
922
|
+
// recipients with a known authoritative rollout_path, verify the message
|
|
923
|
+
// token actually reached the worker's transcript before marking
|
|
924
|
+
// delivered. This catches the gate's mis-attribution: pane inject
|
|
925
|
+
// succeeded but the token landed in the leader/unassigned transcript,
|
|
926
|
+
// not the worker's. Budget per architect plan: 64KB tail / single
|
|
927
|
+
// per-delivery check / short grace window. Phase-1 Claude only —
|
|
928
|
+
// codex/copilot keep the pre-fix behaviour (will be addressed in
|
|
929
|
+
// phase-2 once Claude phase-1 is field-validated).
|
|
930
|
+
if let Some((rollout_path, provider_wire_str)) =
|
|
931
|
+
claude_recipient_rollout(state, &message.recipient)
|
|
932
|
+
{
|
|
933
|
+
let token_marker = format!("[team-agent-token:{message_id}]");
|
|
934
|
+
let grace = std::time::Duration::from_millis(200);
|
|
935
|
+
let deadline = std::time::Instant::now() + std::time::Duration::from_millis(500);
|
|
936
|
+
let transcript_has_token = loop {
|
|
937
|
+
let found = rollout_tail_contains(&rollout_path, &token_marker, 64 * 1024);
|
|
938
|
+
if found || std::time::Instant::now() >= deadline {
|
|
939
|
+
break found;
|
|
940
|
+
}
|
|
941
|
+
std::thread::sleep(grace);
|
|
942
|
+
};
|
|
943
|
+
if !transcript_has_token {
|
|
944
|
+
// Loud but non-fatal: emit a mismatch event for diagnose/status
|
|
945
|
+
// observability. Do NOT mark delivered — degrade to
|
|
946
|
+
// submitted_unverified so capture is forced to re-attribute.
|
|
947
|
+
let reason = format!(
|
|
948
|
+
"transcript_missing:provider={provider_wire_str},rollout={}",
|
|
949
|
+
rollout_path.display()
|
|
950
|
+
);
|
|
951
|
+
event_log.write(
|
|
952
|
+
"provider.session.transcript_mismatch",
|
|
953
|
+
serde_json::json!({
|
|
954
|
+
"message_id": message_id,
|
|
955
|
+
"recipient": message.recipient,
|
|
956
|
+
"provider": provider_wire_str,
|
|
957
|
+
"rollout_path": rollout_path.to_string_lossy(),
|
|
958
|
+
"pane_id": state
|
|
959
|
+
.get("agents")
|
|
960
|
+
.and_then(|a| a.get(&message.recipient))
|
|
961
|
+
.and_then(|a| a.get("pane_id"))
|
|
962
|
+
.and_then(serde_json::Value::as_str)
|
|
963
|
+
.unwrap_or(""),
|
|
964
|
+
"spawn_epoch": state
|
|
965
|
+
.get("agents")
|
|
966
|
+
.and_then(|a| a.get(&message.recipient))
|
|
967
|
+
.and_then(|a| a.get("spawn_epoch"))
|
|
968
|
+
.and_then(serde_json::Value::as_u64)
|
|
969
|
+
.unwrap_or(0),
|
|
970
|
+
"reason": "transcript_missing",
|
|
971
|
+
}),
|
|
972
|
+
)?;
|
|
973
|
+
store.mark(message_id, "submitted_unverified", Some(&reason))?;
|
|
974
|
+
bind_enter_watchdog(store, transport, state, &target, message_id, &message,
|
|
975
|
+
canonical_owner_team_id.as_deref(), event_log)?;
|
|
976
|
+
return Ok(DeliveryOutcome {
|
|
977
|
+
ok: false,
|
|
978
|
+
status: DeliveryStatus::Failed,
|
|
979
|
+
message_status: MessageStatusShadow("submitted_unverified".to_string()),
|
|
980
|
+
message_id: Some(message_id.to_string()),
|
|
981
|
+
verification: Some(reason),
|
|
982
|
+
stage: Some(DeliveryStage::Submit),
|
|
983
|
+
reason: None,
|
|
984
|
+
channel: None,
|
|
985
|
+
ack_forced_off: false,
|
|
986
|
+
turn_verification: Some(turn_verification),
|
|
987
|
+
});
|
|
988
|
+
}
|
|
989
|
+
}
|
|
1096
990
|
if is_leader_recipient {
|
|
1097
991
|
store.record_delivery_submission(message_id, readback_verified)?;
|
|
1098
992
|
match observe_leader_receipt(state, message_id) {
|
|
@@ -2404,11 +2298,11 @@ pub fn deliver_pending_messages(
|
|
|
2404
2298
|
where status in (
|
|
2405
2299
|
'pending', 'accepted', 'target_resolved',
|
|
2406
2300
|
'submitted_pending_acceptance', 'queued_until_leader_attach', ?1
|
|
2407
|
-
)
|
|
2301
|
+
) or (status = 'queued_until_start' and error = ?2)
|
|
2408
2302
|
order by created_at, message_id",
|
|
2409
2303
|
)?;
|
|
2410
2304
|
let rows = stmt.query_map(
|
|
2411
|
-
[crate::message_store::MessageRowStatus::QueuedCoordinatorUnavailable.as_str()],
|
|
2305
|
+
[crate::message_store::MessageRowStatus::QueuedCoordinatorUnavailable.as_str(), crate::message_store::MCP_HANDSHAKE_TIMEOUT],
|
|
2412
2306
|
|row| row.get::<_, String>(0),
|
|
2413
2307
|
)?;
|
|
2414
2308
|
rows.collect::<Result<Vec<_>, _>>()?
|
|
@@ -2553,18 +2447,17 @@ fn recipient_pane_has_actionable_startup_prompt(
|
|
|
2553
2447
|
_ => return false,
|
|
2554
2448
|
};
|
|
2555
2449
|
match provider {
|
|
2556
|
-
Provider::
|
|
2557
|
-
crate::provider::
|
|
2450
|
+
Provider::Claude | Provider::ClaudeCode => matches!(
|
|
2451
|
+
crate::provider::classify_claude_startup_screen(&captured),
|
|
2558
2452
|
crate::provider::StartupScreenDecision::AnswerWorkspaceTrust
|
|
2559
|
-
| crate::provider::StartupScreenDecision::SkipUpdatePrompt
|
|
2560
2453
|
),
|
|
2561
2454
|
Provider::Copilot => matches!(
|
|
2562
2455
|
crate::provider::classify_copilot_startup_screen(&captured),
|
|
2563
2456
|
crate::provider::StartupScreenDecision::AnswerWorkspaceTrust
|
|
2564
2457
|
),
|
|
2565
|
-
//
|
|
2566
|
-
|
|
2567
|
-
|
|
2458
|
+
// Codex and Grok workers run only through their contract leaves; a
|
|
2459
|
+
// legacy row was refused before this peek.
|
|
2460
|
+
Provider::Codex
|
|
2568
2461
|
| Provider::Pi
|
|
2569
2462
|
| Provider::Grok
|
|
2570
2463
|
| Provider::GeminiCli
|
|
@@ -2583,20 +2476,28 @@ fn recipient_provider(state: &serde_json::Value, recipient: &str) -> Option<Prov
|
|
|
2583
2476
|
}
|
|
2584
2477
|
|
|
2585
2478
|
/// ---
|
|
2586
|
-
/// purpose:
|
|
2587
|
-
///
|
|
2588
|
-
/// boundary: 不把地板套到 claude/codex
|
|
2479
|
+
/// purpose: 判断收件 provider 是否必须禁止 submit observer 重按 Enter
|
|
2480
|
+
/// returns: Pi 为 true,其余为 false
|
|
2589
2481
|
/// ---
|
|
2590
|
-
pub(crate) fn
|
|
2482
|
+
pub(crate) fn recipient_requires_single_enter(state: &serde_json::Value, recipient: &str) -> bool {
|
|
2483
|
+
matches!(
|
|
2484
|
+
recipient_provider(state, recipient),
|
|
2485
|
+
Some(Provider::Pi)
|
|
2486
|
+
)
|
|
2487
|
+
}
|
|
2488
|
+
|
|
2489
|
+
/// ---
|
|
2490
|
+
/// purpose: 判断收件 provider 是否允许 Grok send-now 显式队列 flush
|
|
2491
|
+
/// returns: Pi 为 false,其余为 true
|
|
2492
|
+
/// ---
|
|
2493
|
+
pub(crate) fn recipient_allows_explicit_queue_flush(
|
|
2591
2494
|
state: &serde_json::Value,
|
|
2592
2495
|
recipient: &str,
|
|
2593
|
-
) ->
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
_ => Duration::ZERO,
|
|
2599
|
-
}
|
|
2496
|
+
) -> bool {
|
|
2497
|
+
!matches!(
|
|
2498
|
+
recipient_provider(state, recipient),
|
|
2499
|
+
Some(Provider::Pi)
|
|
2500
|
+
)
|
|
2600
2501
|
}
|
|
2601
2502
|
|
|
2602
2503
|
fn leader_rollout_path(state: &serde_json::Value) -> Option<std::path::PathBuf> {
|
|
@@ -3490,6 +3391,30 @@ pub fn retry_injection_after_trust_auto_answer(
|
|
|
3490
3391
|
})
|
|
3491
3392
|
}
|
|
3492
3393
|
|
|
3394
|
+
/// S1-CAPTURE-001 (0.4.8 phase-1): returns (rollout_path, provider_wire) when
|
|
3395
|
+
/// the recipient agent is Claude/ClaudeCode with a known authoritative
|
|
3396
|
+
/// rollout_path; otherwise None (skip transcript verify). Phase-1 Claude only —
|
|
3397
|
+
/// codex/copilot return None and keep pre-fix delivery semantics.
|
|
3398
|
+
fn claude_recipient_rollout(
|
|
3399
|
+
state: &serde_json::Value,
|
|
3400
|
+
recipient: &str,
|
|
3401
|
+
) -> Option<(std::path::PathBuf, &'static str)> {
|
|
3402
|
+
let agent = state.get("agents")?.get(recipient)?;
|
|
3403
|
+
let provider = agent
|
|
3404
|
+
.get("provider")
|
|
3405
|
+
.and_then(serde_json::Value::as_str)
|
|
3406
|
+
.and_then(parse_provider)?;
|
|
3407
|
+
if !is_claude_family(provider) {
|
|
3408
|
+
return None;
|
|
3409
|
+
}
|
|
3410
|
+
let provider_wire_str = provider_wire(provider);
|
|
3411
|
+
let rollout = agent
|
|
3412
|
+
.get("rollout_path")
|
|
3413
|
+
.and_then(serde_json::Value::as_str)
|
|
3414
|
+
.filter(|s| !s.is_empty())?;
|
|
3415
|
+
Some((std::path::PathBuf::from(rollout), provider_wire_str))
|
|
3416
|
+
}
|
|
3417
|
+
|
|
3493
3418
|
/// S1-CAPTURE-001 (0.4.8 phase-1): bounded tail read of the rollout file
|
|
3494
3419
|
/// searching for `needle`. Reads up to `tail_bytes` from the end of the file
|
|
3495
3420
|
/// (default 64KB budget). Returns true iff the needle appears in the tail.
|
|
@@ -3607,21 +3532,12 @@ pub(crate) fn token_already_visible(
|
|
|
3607
3532
|
}
|
|
3608
3533
|
|
|
3609
3534
|
fn recipient_transcript_contains(state: &serde_json::Value, recipient: &str, marker: &str) -> bool {
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
fn recipient_transcript_contains_within(
|
|
3617
|
-
state: &serde_json::Value,
|
|
3618
|
-
recipient: &str,
|
|
3619
|
-
marker: &str,
|
|
3620
|
-
tail_bytes: u64,
|
|
3621
|
-
) -> bool {
|
|
3622
|
-
recipient_transcript_paths(state, recipient)
|
|
3623
|
-
.iter()
|
|
3624
|
-
.any(|path| rollout_tail_contains(path, marker, tail_bytes))
|
|
3535
|
+
for path in recipient_transcript_paths(state, recipient) {
|
|
3536
|
+
if rollout_tail_contains(&path, marker, 64 * 1024) {
|
|
3537
|
+
return true;
|
|
3538
|
+
}
|
|
3539
|
+
}
|
|
3540
|
+
false
|
|
3625
3541
|
}
|
|
3626
3542
|
|
|
3627
3543
|
fn recipient_transcript_paths(
|
|
@@ -3730,32 +3646,6 @@ mod consumption_tests;
|
|
|
3730
3646
|
#[cfg(test)]
|
|
3731
3647
|
mod paste_floor_tests {
|
|
3732
3648
|
use super::*;
|
|
3733
|
-
use std::time::Duration;
|
|
3734
|
-
|
|
3735
|
-
fn state_with_provider(provider: &str) -> serde_json::Value {
|
|
3736
|
-
serde_json::json!({
|
|
3737
|
-
"agents": { "w1": { "provider": provider } }
|
|
3738
|
-
})
|
|
3739
|
-
}
|
|
3740
|
-
|
|
3741
|
-
#[test]
|
|
3742
|
-
fn grok_paste_to_submit_floor_is_one_second() {
|
|
3743
|
-
let grok = paste_to_submit_floor_for_recipient(&state_with_provider("grok"), "w1");
|
|
3744
|
-
assert_eq!(grok, crate::tmux_backend::CURSOR_PASTE_TO_SUBMIT_FLOOR);
|
|
3745
|
-
assert_eq!(grok, Duration::from_secs(1));
|
|
3746
|
-
}
|
|
3747
|
-
|
|
3748
|
-
#[test]
|
|
3749
|
-
fn claude_and_codex_paste_to_submit_floor_stays_zero() {
|
|
3750
|
-
assert_eq!(
|
|
3751
|
-
paste_to_submit_floor_for_recipient(&state_with_provider("claude"), "w1"),
|
|
3752
|
-
Duration::ZERO
|
|
3753
|
-
);
|
|
3754
|
-
assert_eq!(
|
|
3755
|
-
paste_to_submit_floor_for_recipient(&state_with_provider("codex"), "w1"),
|
|
3756
|
-
Duration::ZERO
|
|
3757
|
-
);
|
|
3758
|
-
}
|
|
3759
3649
|
|
|
3760
3650
|
fn empty_report() -> InjectReport {
|
|
3761
3651
|
InjectReport {
|
|
@@ -103,7 +103,7 @@ fn frame(composer: &str, transcript: &str) -> InputFrame {
|
|
|
103
103
|
|
|
104
104
|
#[test]
|
|
105
105
|
fn current_token_in_composer_is_not_duplicate_delivered_or_repasted() {
|
|
106
|
-
let f = Fixture::new("
|
|
106
|
+
let f = Fixture::new("pi");
|
|
107
107
|
let marker = message_token_marker("msg_one");
|
|
108
108
|
let t = f
|
|
109
109
|
.transport()
|
|
@@ -122,7 +122,7 @@ fn successful_transport_report_does_not_override_unconsumed_composer() {
|
|
|
122
122
|
"[Pasted text #1 +25 lines]",
|
|
123
123
|
"foreign draft",
|
|
124
124
|
] {
|
|
125
|
-
let mut f = Fixture::new("
|
|
125
|
+
let mut f = Fixture::new("pi");
|
|
126
126
|
#[cfg(unix)]
|
|
127
127
|
let panes = vec![crate::mcp_server::readiness::test_ready_worker(
|
|
128
128
|
&f.workspace,
|
|
@@ -146,7 +146,7 @@ fn successful_transport_report_does_not_override_unconsumed_composer() {
|
|
|
146
146
|
|
|
147
147
|
#[test]
|
|
148
148
|
fn unknown_current_native_surface_is_unverified_not_success() {
|
|
149
|
-
let f = Fixture::new("
|
|
149
|
+
let f = Fixture::new("pi");
|
|
150
150
|
let t = f
|
|
151
151
|
.transport()
|
|
152
152
|
.with_native_input_error("native_surface_unknown");
|
|
@@ -167,7 +167,7 @@ fn pane_visibility_without_an_observation_protocol_is_not_duplicate_acceptance()
|
|
|
167
167
|
|
|
168
168
|
#[test]
|
|
169
169
|
fn current_empty_composer_and_unique_transcript_token_prove_consumption() {
|
|
170
|
-
let f = Fixture::new("
|
|
170
|
+
let f = Fixture::new("pi");
|
|
171
171
|
let marker = message_token_marker("msg_one");
|
|
172
172
|
let t = f
|
|
173
173
|
.transport()
|
|
@@ -180,7 +180,7 @@ fn current_empty_composer_and_unique_transcript_token_prove_consumption() {
|
|
|
180
180
|
|
|
181
181
|
#[test]
|
|
182
182
|
fn busy_answers_or_duplicate_history_tokens_do_not_prove_consumption() {
|
|
183
|
-
let f = Fixture::new("
|
|
183
|
+
let f = Fixture::new("pi");
|
|
184
184
|
let target = Target::Pane(PaneId::new("%1"));
|
|
185
185
|
for transcript in [
|
|
186
186
|
"answer is 5535",
|
|
@@ -105,6 +105,7 @@ pub(crate) fn validate_result_envelope(envelope: &serde_json::Value) -> Result<(
|
|
|
105
105
|
pub(crate) fn parse_scheduled_kind(kind: &str) -> Result<ScheduledKind, MessagingError> {
|
|
106
106
|
match kind {
|
|
107
107
|
"send" => Ok(ScheduledKind::Send),
|
|
108
|
+
"reminder" => Ok(ScheduledKind::Reminder),
|
|
108
109
|
"health_ping" => Ok(ScheduledKind::HealthPing),
|
|
109
110
|
"trust_retry" => Ok(ScheduledKind::TrustRetry),
|
|
110
111
|
"enter_rescue" => Ok(ScheduledKind::EnterRescue),
|
|
@@ -158,25 +159,6 @@ pub(crate) fn latest_prompt_signal(scrollback: &str) -> Option<AgentActivity> {
|
|
|
158
159
|
// IRON LAW (activity.rs:3 / bug-071/077/085): no-signal in the bottom
|
|
159
160
|
// region must be Uncertain (caller treats None here as "no decisive
|
|
160
161
|
// signal" and surfaces Uncertain), NEVER silently flipped to Idle.
|
|
161
|
-
// #379: Claude Code's spinner sits above its composer box, outside the
|
|
162
|
-
// bottom five rows, and its finished-turn `✻ Worked for 3s` sits inside
|
|
163
|
-
// them. The box's own grammar (shared with delivery) decides instead.
|
|
164
|
-
if let Some((surface, _)) =
|
|
165
|
-
team_agent_contract::providers::claude::interaction::inspect_legacy_composer(scrollback)
|
|
166
|
-
{
|
|
167
|
-
use team_agent_contract::contract::delivery::InputSurface;
|
|
168
|
-
match surface {
|
|
169
|
-
InputSurface::Busy => {
|
|
170
|
-
return Some(AgentActivity {
|
|
171
|
-
status: ActivityStatus::Working,
|
|
172
|
-
confidence: 0.9,
|
|
173
|
-
rationale: "claude_spinner_row".to_string(),
|
|
174
|
-
})
|
|
175
|
-
}
|
|
176
|
-
InputSurface::ComposerReady => return Some(idle_activity()),
|
|
177
|
-
_ => {}
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
162
|
let active_region: Vec<&str> = scrollback
|
|
181
163
|
.lines()
|
|
182
164
|
.rev()
|