@team-agent/installer 0.5.123 → 0.5.125
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 -1
- package/crates/team-agent/src/cli/emit.rs +41 -15
- package/crates/team-agent/src/cli/intent/runtime.rs +30 -54
- package/crates/team-agent/src/cli/intent/runtime_tests.rs +59 -118
- 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 +6 -5
- package/crates/team-agent/src/cli/models.rs +93 -128
- 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/status_send.rs +17 -0
- package/crates/team-agent/src/compiler/tests.rs +21 -5
- package/crates/team-agent/src/compiler.rs +24 -1
- package/crates/team-agent/src/contract_runtime/backend.rs +30 -6
- package/crates/team-agent/src/contract_runtime/config.rs +34 -24
- package/crates/team-agent/src/contract_runtime/discovery.rs +79 -56
- package/crates/team-agent/src/contract_runtime/framework.rs +89 -34
- package/crates/team-agent/src/contract_runtime/registry.rs +299 -24
- package/crates/team-agent/src/coordinator/runtime_detectors.rs +0 -1
- 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 +0 -1
- 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 +14 -1
- package/crates/team-agent/src/lifecycle/launch/agent_state.rs +0 -9
- package/crates/team-agent/src/lifecycle/launch/fork_agent.rs +0 -1
- package/crates/team-agent/src/lifecycle/launch/mcp_config.rs +2 -2
- package/crates/team-agent/src/lifecycle/launch/pi_mcp.rs +19 -101
- package/crates/team-agent/src/lifecycle/launch/spawn.rs +0 -28
- 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 -20
- package/crates/team-agent/src/lifecycle/profile_launch.rs +11 -39
- package/crates/team-agent/src/lifecycle/profile_smoke.rs +1 -2
- package/crates/team-agent/src/lifecycle/restart/common.rs +1 -63
- package/crates/team-agent/src/lifecycle/role_config.rs +42 -3
- package/crates/team-agent/src/lifecycle/tests/cli_argv_routing_red.rs +43 -13
- package/crates/team-agent/src/lifecycle/tests/clone_fork_copilot_perms_red.rs +6 -2
- package/crates/team-agent/src/lifecycle/tests/pi_catalog_red.rs +1 -3
- package/crates/team-agent/src/lifecycle/tests/pi_command_red.rs +4 -16
- package/crates/team-agent/src/lifecycle/tests/pi_compiler_red.rs +1 -3
- package/crates/team-agent/src/lifecycle/tests/pi_executable_mcp_red.rs +84 -53
- package/crates/team-agent/src/lifecycle/tests/pi_fork_session_inheritance_red.rs +19 -1
- package/crates/team-agent/src/lifecycle/tests/pi_session_delivery_red.rs +21 -0
- package/crates/team-agent/src/lifecycle/tests/restart_rebind_hotfix_252_red.rs +0 -1
- package/crates/team-agent/src/lifecycle/tests/worker_spawn_env_red.rs +0 -137
- package/crates/team-agent/src/lifecycle/tests.rs +0 -3
- 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 +186 -38
- package/crates/team-agent/src/messaging/delivery_consumption_tests.rs +4 -4
- 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 +66 -4
- package/crates/team-agent/src/messaging/tests/runtime.rs +110 -4
- package/crates/team-agent/src/messaging/tests/spine.rs +22 -6
- package/crates/team-agent/src/model/enums.rs +1 -8
- package/crates/team-agent/src/provider/adapter.rs +1 -67
- package/crates/team-agent/src/provider/adapters/mod.rs +0 -1
- package/crates/team-agent/src/provider/adapters/pi.rs +4 -4
- 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 +2 -73
- package/crates/team-agent/src/provider/session/capture.rs +1 -1
- package/crates/team-agent/src/provider/session/context_fork.rs +4 -4
- package/crates/team-agent/src/provider/session_scan/common.rs +1 -2
- package/crates/team-agent/src/provider/session_scan/pi.rs +32 -19
- package/crates/team-agent/src/provider/session_scan.rs +0 -4
- package/crates/team-agent/src/provider/submit_now.rs +5 -28
- package/crates/team-agent/src/provider/tests/adapter.rs +5 -184
- package/crates/team-agent/src/provider/tests/classify.rs +53 -0
- package/crates/team-agent/src/provider/tests/command_helpers.rs +3 -6
- package/crates/team-agent/src/provider/types.rs +1 -1
- package/crates/team-agent/src/provider/wire.rs +48 -8
- 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/npm/install.mjs +40 -3
- package/package.json +4 -4
- package/skills/team-agent/SKILL.md +1 -1
- 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/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/provider/adapters/cursor_agent.rs +0 -44
- 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
|
@@ -6,23 +6,89 @@ use team_agent_contract::contract::{
|
|
|
6
6
|
descriptor::{PromptCarrier, ProviderDescriptor, ToolNaming},
|
|
7
7
|
types::InstanceIdentity,
|
|
8
8
|
hooks::{PlanHook, ProviderHooks},
|
|
9
|
-
plan::{LaunchPlan, ResolvedLaunch},
|
|
10
|
-
types::{ContractError, Support},
|
|
9
|
+
plan::{CatalogObservation, LaunchEntrypoint, LaunchPlan, ResolvedLaunch},
|
|
10
|
+
types::{ContractError, NativeIdentity, Support},
|
|
11
11
|
};
|
|
12
12
|
use team_agent_contract::kiro::{self, KiroAdapter, KIRO_DESCRIPTOR};
|
|
13
|
+
use team_agent_contract::providers::claude::{self, ClaudeAdapter, CLAUDE_DESCRIPTOR};
|
|
14
|
+
use team_agent_contract::providers::codex::{self, CodexAdapter, CODEX_DESCRIPTOR};
|
|
13
15
|
use team_agent_contract::providers::cursor::{self, CursorAdapter, CURSOR_DESCRIPTOR};
|
|
14
16
|
use team_agent_contract::providers::grok_build::{self, GrokAdapter, GROK_BUILD_DESCRIPTOR};
|
|
17
|
+
use team_agent_contract::providers::pi::{self, PiAdapter, PI_DESCRIPTOR};
|
|
15
18
|
use team_agent_contract::runtime::{
|
|
16
19
|
delivery::{ControlDefinition, StartupDefinition},
|
|
17
20
|
native_panel::{NativePanelPolicy, SessionPanelPolicy},
|
|
18
21
|
};
|
|
19
22
|
|
|
20
|
-
const DESCRIPTORS: &[&ProviderDescriptor] = &[&KIRO_DESCRIPTOR, &CURSOR_DESCRIPTOR, &GROK_BUILD_DESCRIPTOR];
|
|
23
|
+
const DESCRIPTORS: &[&ProviderDescriptor] = &[&KIRO_DESCRIPTOR, &CURSOR_DESCRIPTOR, &GROK_BUILD_DESCRIPTOR, &CODEX_DESCRIPTOR, &PI_DESCRIPTOR, &CLAUDE_DESCRIPTOR];
|
|
24
|
+
/// Declared keys the legacy runtime also owns (the Codex worker, leader and
|
|
25
|
+
/// app-server; the Pi worker, leader and default role provider). Only an explicit `contract_runtime: true` maps one to its leaf,
|
|
26
|
+
/// whose distinct canonical id is what compiled specs and state then carry, so
|
|
27
|
+
/// legacy readers never mistake a contract seat for a legacy one.
|
|
28
|
+
const OPT_IN: &[(&str, &ProviderDescriptor)] = &[("codex", &CODEX_DESCRIPTOR), ("pi", &PI_DESCRIPTOR)];
|
|
29
|
+
/// Declaration names that select a leaf without opt-in: Cursor's legacy key,
|
|
30
|
+
/// its npm package/public command and its binary. A persisted legacy state row
|
|
31
|
+
/// keeps its key and is never reclassified ([`descriptor`] does not match it).
|
|
32
|
+
const TRANSITION: &[(&str, &ProviderDescriptor)] = &[
|
|
33
|
+
("cursor_agent", &CURSOR_DESCRIPTOR), ("cursor-agent", &CURSOR_DESCRIPTOR), ("agent", &CURSOR_DESCRIPTOR),
|
|
34
|
+
];
|
|
21
35
|
|
|
36
|
+
/// One provider's public command route: the PATH-selected entry the pane execs
|
|
37
|
+
/// by bare name and the native image that route must exec into.
|
|
22
38
|
#[derive(Clone)]
|
|
23
39
|
pub enum NativeRuntime {
|
|
40
|
+
Kiro(kiro::native::RuntimeInstallation),
|
|
24
41
|
Cursor(cursor::native::RuntimeInstallation),
|
|
25
42
|
GrokBuild(grok_build::native::RuntimeInstallation),
|
|
43
|
+
Codex(codex::launcher::RuntimeInstallation),
|
|
44
|
+
Pi(pi::launcher::RuntimeInstallation),
|
|
45
|
+
Claude(claude::launcher::RuntimeInstallation),
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
impl NativeRuntime {
|
|
49
|
+
pub fn launcher(&self) -> LaunchEntrypoint {
|
|
50
|
+
match self {
|
|
51
|
+
Self::Kiro(runtime) => runtime.launcher(),
|
|
52
|
+
Self::Cursor(runtime) => runtime.launcher(),
|
|
53
|
+
Self::GrokBuild(runtime) => runtime.launcher(),
|
|
54
|
+
Self::Codex(runtime) => runtime.launcher(),
|
|
55
|
+
Self::Pi(runtime) => runtime.launcher(),
|
|
56
|
+
Self::Claude(runtime) => runtime.launcher(),
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
pub fn engine(&self) -> &PathBuf {
|
|
61
|
+
match self {
|
|
62
|
+
Self::Kiro(runtime) => &runtime.engine,
|
|
63
|
+
Self::Cursor(runtime) => &runtime.engine,
|
|
64
|
+
Self::GrokBuild(runtime) => &runtime.engine,
|
|
65
|
+
Self::Codex(runtime) => &runtime.engine,
|
|
66
|
+
Self::Pi(runtime) => &runtime.engine,
|
|
67
|
+
Self::Claude(runtime) => &runtime.engine,
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
pub fn native(&self) -> &NativeIdentity {
|
|
72
|
+
match self {
|
|
73
|
+
Self::Kiro(runtime) => &runtime.native,
|
|
74
|
+
Self::Cursor(runtime) => &runtime.native,
|
|
75
|
+
Self::GrokBuild(runtime) => &runtime.native,
|
|
76
|
+
Self::Codex(runtime) => &runtime.native,
|
|
77
|
+
Self::Pi(runtime) => &runtime.native,
|
|
78
|
+
Self::Claude(runtime) => &runtime.native,
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
pub fn bind_catalog(&self, catalog: &CatalogObservation) -> Result<CatalogObservation, ContractError> {
|
|
83
|
+
match self {
|
|
84
|
+
Self::Kiro(runtime) => runtime.bind_catalog(catalog),
|
|
85
|
+
Self::Cursor(runtime) => runtime.bind_catalog(catalog),
|
|
86
|
+
Self::GrokBuild(runtime) => runtime.bind_catalog(catalog),
|
|
87
|
+
Self::Codex(runtime) => runtime.bind_catalog(catalog),
|
|
88
|
+
Self::Pi(runtime) => runtime.bind_catalog(catalog),
|
|
89
|
+
Self::Claude(runtime) => runtime.bind_catalog(catalog),
|
|
90
|
+
}
|
|
91
|
+
}
|
|
26
92
|
}
|
|
27
93
|
|
|
28
94
|
/// Leaf selection stays here; the framework, lifecycle and outbox remain shared.
|
|
@@ -31,6 +97,9 @@ pub(super) enum NativeProvider {
|
|
|
31
97
|
Kiro,
|
|
32
98
|
Cursor,
|
|
33
99
|
GrokBuild,
|
|
100
|
+
Codex,
|
|
101
|
+
Pi,
|
|
102
|
+
Claude,
|
|
34
103
|
}
|
|
35
104
|
|
|
36
105
|
impl NativeProvider {
|
|
@@ -39,13 +108,16 @@ impl NativeProvider {
|
|
|
39
108
|
Self::Kiro => &KIRO_DESCRIPTOR,
|
|
40
109
|
Self::Cursor => &CURSOR_DESCRIPTOR,
|
|
41
110
|
Self::GrokBuild => &GROK_BUILD_DESCRIPTOR,
|
|
111
|
+
Self::Codex => &CODEX_DESCRIPTOR,
|
|
112
|
+
Self::Pi => &PI_DESCRIPTOR,
|
|
113
|
+
Self::Claude => &CLAUDE_DESCRIPTOR,
|
|
42
114
|
}
|
|
43
115
|
}
|
|
44
116
|
|
|
45
117
|
pub fn action_budget(self) -> std::time::Duration {
|
|
46
118
|
// Kiro's existing budget is unchanged; Cursor's measured cold-ready
|
|
47
119
|
// path needs a larger finite bound, not an unbounded readiness wait.
|
|
48
|
-
std::time::Duration::from_secs(match self { Self::Kiro => 30, Self::Cursor | Self::GrokBuild => 90 })
|
|
120
|
+
std::time::Duration::from_secs(match self { Self::Kiro => 30, Self::Cursor | Self::GrokBuild | Self::Codex | Self::Pi | Self::Claude => 90 })
|
|
49
121
|
}
|
|
50
122
|
|
|
51
123
|
pub fn controls(self) -> &'static [ControlDefinition] {
|
|
@@ -53,6 +125,9 @@ impl NativeProvider {
|
|
|
53
125
|
Self::Kiro => kiro::interaction::CONTROLS,
|
|
54
126
|
Self::Cursor => cursor::interaction::CONTROLS,
|
|
55
127
|
Self::GrokBuild => grok_build::interaction::CONTROLS,
|
|
128
|
+
Self::Codex => codex::interaction::CONTROLS,
|
|
129
|
+
Self::Pi => pi::interaction::CONTROLS,
|
|
130
|
+
Self::Claude => claude::interaction::CONTROLS,
|
|
56
131
|
}
|
|
57
132
|
}
|
|
58
133
|
|
|
@@ -65,20 +140,23 @@ impl NativeProvider {
|
|
|
65
140
|
/// These providers use the separately fenced native tool-roundtrip ledger,
|
|
66
141
|
/// never a guessed neutral tools panel or another provider's inspector.
|
|
67
142
|
pub fn uses_tool_roundtrips(self) -> bool {
|
|
68
|
-
matches!(self, Self::Cursor | Self::GrokBuild)
|
|
143
|
+
matches!(self, Self::Cursor | Self::GrokBuild | Self::Codex | Self::Pi | Self::Claude)
|
|
69
144
|
}
|
|
70
145
|
|
|
71
146
|
pub fn startup(self) -> Option<&'static StartupDefinition> {
|
|
72
147
|
match self {
|
|
73
148
|
Self::GrokBuild => Some(&grok_build::interaction::STARTUP),
|
|
74
|
-
|
|
149
|
+
// Claude's folder-trust screen is never answered (focus: No, exit).
|
|
150
|
+
Self::Kiro | Self::Cursor | Self::Codex | Self::Pi | Self::Claude => None,
|
|
75
151
|
}
|
|
76
152
|
}
|
|
77
153
|
|
|
78
154
|
pub fn session_panel(self) -> Option<&'static SessionPanelPolicy> {
|
|
79
155
|
match self {
|
|
80
156
|
Self::GrokBuild => Some(&grok_build::interaction::SESSION_PANEL),
|
|
81
|
-
|
|
157
|
+
// `/status` and `/session` print history cards, not modals: nothing to close.
|
|
158
|
+
// Claude's fresh session ID is preassigned by argv; nothing to close.
|
|
159
|
+
Self::Kiro | Self::Cursor | Self::Codex | Self::Pi | Self::Claude => None,
|
|
82
160
|
}
|
|
83
161
|
}
|
|
84
162
|
|
|
@@ -93,14 +171,29 @@ impl NativeProvider {
|
|
|
93
171
|
field: "Grok Build native Team-tool inspector",
|
|
94
172
|
reason: grok_build::UNVERIFIED,
|
|
95
173
|
}),
|
|
174
|
+
Self::Codex => Err(ContractError::Unverified {
|
|
175
|
+
field: "Codex native Team-tool inspector",
|
|
176
|
+
reason: codex::UNVERIFIED,
|
|
177
|
+
}),
|
|
178
|
+
Self::Pi => Err(ContractError::Unverified {
|
|
179
|
+
field: "Pi native Team-tool inspector",
|
|
180
|
+
reason: pi::UNVERIFIED,
|
|
181
|
+
}),
|
|
182
|
+
Self::Claude => Err(ContractError::Unverified {
|
|
183
|
+
field: "Claude Code native Team-tool inspector",
|
|
184
|
+
reason: claude::UNVERIFIED,
|
|
185
|
+
}),
|
|
96
186
|
}
|
|
97
187
|
}
|
|
98
188
|
|
|
99
189
|
pub fn server_key_for(self, identity: &InstanceIdentity) -> Result<String, ContractError> {
|
|
100
|
-
|
|
101
|
-
|
|
190
|
+
match self {
|
|
191
|
+
Self::GrokBuild => Ok(grok_build::server_key(identity)),
|
|
192
|
+
Self::Codex => Ok(codex::server_key(identity)),
|
|
193
|
+
Self::Pi => Ok(pi::server_key(identity)),
|
|
194
|
+
Self::Claude => Ok(claude::server_key(identity)),
|
|
195
|
+
Self::Kiro | Self::Cursor => Ok(self.server_key()?.into()),
|
|
102
196
|
}
|
|
103
|
-
Ok(self.server_key()?.into())
|
|
104
197
|
}
|
|
105
198
|
|
|
106
199
|
pub fn server_key(self) -> Result<&'static str, ContractError> {
|
|
@@ -126,6 +219,15 @@ impl NativeProvider {
|
|
|
126
219
|
Self::GrokBuild => GrokAdapter::new(grok_build::McpStdio {
|
|
127
220
|
executable, arguments, environment,
|
|
128
221
|
}).map(NativeAdapter::GrokBuild),
|
|
222
|
+
Self::Codex => CodexAdapter::new(codex::McpStdio {
|
|
223
|
+
executable, arguments, environment,
|
|
224
|
+
}).map(NativeAdapter::Codex),
|
|
225
|
+
Self::Pi => PiAdapter::new(pi::McpStdio {
|
|
226
|
+
executable, arguments, environment,
|
|
227
|
+
}).map(NativeAdapter::Pi),
|
|
228
|
+
Self::Claude => ClaudeAdapter::new(claude::McpStdio {
|
|
229
|
+
executable, arguments, environment,
|
|
230
|
+
}).map(NativeAdapter::Claude),
|
|
129
231
|
}
|
|
130
232
|
}
|
|
131
233
|
}
|
|
@@ -134,6 +236,9 @@ pub(super) enum NativeAdapter {
|
|
|
134
236
|
Kiro(KiroAdapter),
|
|
135
237
|
Cursor(CursorAdapter),
|
|
136
238
|
GrokBuild(GrokAdapter),
|
|
239
|
+
Codex(CodexAdapter),
|
|
240
|
+
Pi(PiAdapter),
|
|
241
|
+
Claude(ClaudeAdapter),
|
|
137
242
|
}
|
|
138
243
|
|
|
139
244
|
impl NativeAdapter {
|
|
@@ -143,7 +248,8 @@ impl NativeAdapter {
|
|
|
143
248
|
runtime: Option<NativeRuntime>,
|
|
144
249
|
) -> Result<Self, ContractError> {
|
|
145
250
|
match self {
|
|
146
|
-
|
|
251
|
+
// Kiro plans from the framework-resolved launch paths alone.
|
|
252
|
+
Self::Kiro(adapter) if matches!(runtime, None | Some(NativeRuntime::Kiro(_))) => Ok(Self::Kiro(adapter)),
|
|
147
253
|
Self::Kiro(_) => Err(ContractError::Mismatch("native runtime provider")),
|
|
148
254
|
Self::Cursor(adapter) => {
|
|
149
255
|
let adapter = adapter.with_project(project)?;
|
|
@@ -161,6 +267,30 @@ impl NativeAdapter {
|
|
|
161
267
|
None => adapter,
|
|
162
268
|
}))
|
|
163
269
|
}
|
|
270
|
+
Self::Codex(adapter) => {
|
|
271
|
+
let adapter = adapter.with_project(project)?;
|
|
272
|
+
Ok(Self::Codex(match runtime {
|
|
273
|
+
Some(NativeRuntime::Codex(runtime)) => adapter.with_runtime(runtime),
|
|
274
|
+
Some(_) => return Err(ContractError::Mismatch("native runtime provider")),
|
|
275
|
+
None => adapter,
|
|
276
|
+
}))
|
|
277
|
+
}
|
|
278
|
+
Self::Pi(adapter) => {
|
|
279
|
+
let adapter = adapter.with_project(project)?;
|
|
280
|
+
Ok(Self::Pi(match runtime {
|
|
281
|
+
Some(NativeRuntime::Pi(runtime)) => adapter.with_runtime(runtime),
|
|
282
|
+
Some(_) => return Err(ContractError::Mismatch("native runtime provider")),
|
|
283
|
+
None => adapter,
|
|
284
|
+
}))
|
|
285
|
+
}
|
|
286
|
+
Self::Claude(adapter) => {
|
|
287
|
+
let adapter = adapter.with_project(project)?;
|
|
288
|
+
Ok(Self::Claude(match runtime {
|
|
289
|
+
Some(NativeRuntime::Claude(runtime)) => adapter.with_runtime(runtime),
|
|
290
|
+
Some(_) => return Err(ContractError::Mismatch("native runtime provider")),
|
|
291
|
+
None => adapter,
|
|
292
|
+
}))
|
|
293
|
+
}
|
|
164
294
|
}
|
|
165
295
|
}
|
|
166
296
|
|
|
@@ -169,6 +299,9 @@ impl NativeAdapter {
|
|
|
169
299
|
Self::Kiro(adapter) => adapter.hooks(),
|
|
170
300
|
Self::Cursor(adapter) => adapter.hooks(),
|
|
171
301
|
Self::GrokBuild(adapter) => adapter.hooks(),
|
|
302
|
+
Self::Codex(adapter) => adapter.hooks(),
|
|
303
|
+
Self::Pi(adapter) => adapter.hooks(),
|
|
304
|
+
Self::Claude(adapter) => adapter.hooks(),
|
|
172
305
|
}
|
|
173
306
|
}
|
|
174
307
|
|
|
@@ -177,6 +310,9 @@ impl NativeAdapter {
|
|
|
177
310
|
Self::Kiro(adapter) => adapter.plan(request),
|
|
178
311
|
Self::Cursor(adapter) => adapter.plan(request),
|
|
179
312
|
Self::GrokBuild(adapter) => adapter.plan(request),
|
|
313
|
+
Self::Codex(adapter) => adapter.plan(request),
|
|
314
|
+
Self::Pi(adapter) => adapter.plan(request),
|
|
315
|
+
Self::Claude(adapter) => adapter.plan(request),
|
|
180
316
|
}
|
|
181
317
|
}
|
|
182
318
|
}
|
|
@@ -187,6 +323,9 @@ pub(super) fn provider(key: &str) -> Result<NativeProvider, ContractError> {
|
|
|
187
323
|
"kiro" => Ok(NativeProvider::Kiro),
|
|
188
324
|
"cursor" => Ok(NativeProvider::Cursor),
|
|
189
325
|
"grok_build" => Ok(NativeProvider::GrokBuild),
|
|
326
|
+
"codex_tui" => Ok(NativeProvider::Codex),
|
|
327
|
+
"pi_tui" => Ok(NativeProvider::Pi),
|
|
328
|
+
"claude_tui" => Ok(NativeProvider::Claude),
|
|
190
329
|
_ => Err(ContractError::Invalid("contract provider dispatcher")),
|
|
191
330
|
}
|
|
192
331
|
}
|
|
@@ -201,18 +340,31 @@ pub fn descriptor(key: &str) -> Option<&'static ProviderDescriptor> {
|
|
|
201
340
|
})
|
|
202
341
|
}
|
|
203
342
|
|
|
343
|
+
/// The leaf a role document selects. Canonical contract keys need no flag; a
|
|
344
|
+
/// shared legacy key selects its leaf only with `contract_runtime: true` and is
|
|
345
|
+
/// otherwise left to the legacy path unchanged (never re-routed).
|
|
346
|
+
pub fn declared(key: &str, contract_runtime: bool) -> Option<&'static ProviderDescriptor> {
|
|
347
|
+
OPT_IN.iter().find(|(shared, _)| contract_runtime && *shared == key)
|
|
348
|
+
.or_else(|| TRANSITION.iter().find(|(retired, _)| *retired == key))
|
|
349
|
+
.map(|(_, descriptor)| *descriptor)
|
|
350
|
+
.or_else(|| descriptor(key))
|
|
351
|
+
}
|
|
352
|
+
|
|
204
353
|
/// Recognize a misspelled/case-modified contract declaration so it can fail
|
|
205
354
|
/// explicitly instead of accidentally selecting a legacy default provider.
|
|
206
|
-
|
|
355
|
+
/// A shared legacy key is a contract declaration only when opted in.
|
|
356
|
+
pub fn recognizes(key: &str, contract_runtime: bool) -> bool {
|
|
207
357
|
let key = key.trim();
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
358
|
+
(contract_runtime && OPT_IN.iter().any(|(shared, _)| shared.eq_ignore_ascii_case(key)))
|
|
359
|
+
|| TRANSITION.iter().any(|(retired, _)| retired.eq_ignore_ascii_case(key))
|
|
360
|
+
|| DESCRIPTORS.iter().any(|descriptor| {
|
|
361
|
+
descriptor.identity.id.eq_ignore_ascii_case(key)
|
|
362
|
+
|| descriptor
|
|
363
|
+
.identity
|
|
364
|
+
.aliases
|
|
365
|
+
.iter()
|
|
366
|
+
.any(|alias| alias.eq_ignore_ascii_case(key))
|
|
367
|
+
})
|
|
216
368
|
}
|
|
217
369
|
|
|
218
370
|
#[cfg(test)]
|
|
@@ -223,22 +375,145 @@ mod tests {
|
|
|
223
375
|
fn canonical_cursor_does_not_reclassify_legacy_names() {
|
|
224
376
|
assert_eq!(provider("cursor").unwrap(), NativeProvider::Cursor);
|
|
225
377
|
assert_eq!(provider("kiro").unwrap(), NativeProvider::Kiro);
|
|
226
|
-
for legacy in ["
|
|
378
|
+
for legacy in ["pi", "codex", "grok"] {
|
|
379
|
+
assert!(descriptor(legacy).is_none());
|
|
380
|
+
assert!(!recognizes(legacy, false));
|
|
381
|
+
assert!(provider(legacy).is_err());
|
|
382
|
+
}
|
|
383
|
+
// Every Cursor name declares the leaf; a persisted legacy row keeps its runtime.
|
|
384
|
+
for name in ["cursor", "cursor_agent", "cursor-agent", "agent"] {
|
|
385
|
+
assert_eq!(declared(name, false).unwrap().identity.id, "cursor");
|
|
386
|
+
assert_eq!(declared(name, true).unwrap().identity.id, "cursor");
|
|
387
|
+
}
|
|
388
|
+
for legacy in ["cursor_agent", "cursor-agent", "agent"] {
|
|
227
389
|
assert!(descriptor(legacy).is_none());
|
|
228
|
-
assert!(!recognizes(legacy));
|
|
229
390
|
assert!(provider(legacy).is_err());
|
|
230
391
|
}
|
|
392
|
+
assert!(recognizes(" Cursor_Agent ", false));
|
|
393
|
+
assert!(declared("Cursor_Agent", false).is_none());
|
|
231
394
|
assert_eq!(provider("grok_build").unwrap(), NativeProvider::GrokBuild);
|
|
232
|
-
assert!(recognizes(" Grok_Build "));
|
|
395
|
+
assert!(recognizes(" Grok_Build ", false));
|
|
233
396
|
assert!(descriptor("Grok_Build").is_none());
|
|
234
397
|
assert!(GROK_BUILD_DESCRIPTOR.identity.aliases.is_empty());
|
|
235
|
-
assert!(recognizes(" Cursor "));
|
|
398
|
+
assert!(recognizes(" Cursor ", false));
|
|
236
399
|
assert!(descriptor("Cursor").is_none());
|
|
237
400
|
for descriptor in descriptors() {
|
|
238
401
|
assert_eq!(provider(descriptor.identity.id).unwrap().descriptor(), *descriptor);
|
|
239
402
|
}
|
|
240
403
|
}
|
|
241
404
|
|
|
405
|
+
#[test]
|
|
406
|
+
fn bare_codex_keeps_its_legacy_meaning_and_only_opt_in_selects_the_leaf() {
|
|
407
|
+
assert_eq!(CODEX_DESCRIPTOR.identity.id, "codex_tui");
|
|
408
|
+
assert_eq!(CODEX_DESCRIPTOR.identity.binary, "codex");
|
|
409
|
+
assert_eq!(provider("codex_tui").unwrap(), NativeProvider::Codex);
|
|
410
|
+
// Legacy state rows, compiled specs and CLI overrides keep `codex`.
|
|
411
|
+
assert!(descriptor("codex").is_none());
|
|
412
|
+
assert!(provider("codex").is_err());
|
|
413
|
+
assert!(declared("codex", false).is_none());
|
|
414
|
+
assert_eq!(declared("codex", true), Some(&CODEX_DESCRIPTOR));
|
|
415
|
+
assert_eq!(declared("codex_tui", false), Some(&CODEX_DESCRIPTOR));
|
|
416
|
+
for spelling in ["codex", " Codex ", "CODEX"] {
|
|
417
|
+
assert!(!recognizes(spelling, false), "{spelling:?}");
|
|
418
|
+
assert!(recognizes(spelling, true), "{spelling:?}");
|
|
419
|
+
}
|
|
420
|
+
// A case variant opted in is recognized (to fail explicitly), never selected.
|
|
421
|
+
assert!(declared("Codex", true).is_none());
|
|
422
|
+
assert!(declared("claude", true).is_none());
|
|
423
|
+
assert_eq!(declared("grok_build", true), Some(&GROK_BUILD_DESCRIPTOR));
|
|
424
|
+
let mut identity = InstanceIdentity {
|
|
425
|
+
scope: team_agent_contract::contract::types::ScopeId::new("scope").unwrap(),
|
|
426
|
+
seat: team_agent_contract::contract::types::SeatId::new("worker").unwrap(),
|
|
427
|
+
instance: team_agent_contract::contract::types::InstanceId::new("instance").unwrap(),
|
|
428
|
+
generation: team_agent_contract::contract::types::Generation(1),
|
|
429
|
+
};
|
|
430
|
+
let first = NativeProvider::Codex.server_key_for(&identity).unwrap();
|
|
431
|
+
assert_eq!(first, codex::server_key(&identity));
|
|
432
|
+
assert_ne!(first, grok_build::server_key(&identity));
|
|
433
|
+
identity.generation = team_agent_contract::contract::types::Generation(2);
|
|
434
|
+
assert_ne!(first, NativeProvider::Codex.server_key_for(&identity).unwrap());
|
|
435
|
+
assert!(NativeProvider::Codex.tool_panel().is_err());
|
|
436
|
+
assert!(NativeProvider::Codex.startup().is_none());
|
|
437
|
+
assert!(NativeProvider::Codex.session_panel().is_none());
|
|
438
|
+
assert!(NativeProvider::Codex.uses_tool_roundtrips());
|
|
439
|
+
assert!(NativeProvider::Codex.first_business_bootstrap());
|
|
440
|
+
let kinds: Vec<_> = NativeProvider::Codex.controls().iter().map(|control| control.command).collect();
|
|
441
|
+
assert_eq!(kinds, ["/status", "/exit"]);
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
#[test]
|
|
445
|
+
fn claude_leaf_has_a_distinct_key_and_no_startup_or_panel_fallback() {
|
|
446
|
+
use team_agent_contract::contract::types::{Generation, InstanceId, ScopeId, SeatId};
|
|
447
|
+
assert_eq!(CLAUDE_DESCRIPTOR.identity.id, "claude_tui");
|
|
448
|
+
assert_eq!(CLAUDE_DESCRIPTOR.identity.binary, "claude");
|
|
449
|
+
assert_eq!(provider("claude_tui").unwrap(), NativeProvider::Claude);
|
|
450
|
+
assert_eq!(declared("claude_tui", false), Some(&CLAUDE_DESCRIPTOR));
|
|
451
|
+
// Legacy state rows, compiled specs and CLI overrides keep their keys.
|
|
452
|
+
for legacy in ["claude", "claude_code", "claude-code"] {
|
|
453
|
+
assert!(descriptor(legacy).is_none(), "{legacy}");
|
|
454
|
+
assert!(!recognizes(legacy, false), "{legacy}");
|
|
455
|
+
assert!(declared(legacy, false).is_none(), "{legacy}");
|
|
456
|
+
assert!(provider(legacy).is_err(), "{legacy}");
|
|
457
|
+
}
|
|
458
|
+
assert!(recognizes(" Claude_TUI ", false));
|
|
459
|
+
let mut identity = InstanceIdentity {
|
|
460
|
+
scope: ScopeId::new("scope").unwrap(), seat: SeatId::new("worker").unwrap(),
|
|
461
|
+
instance: InstanceId::new("instance").unwrap(), generation: Generation(1),
|
|
462
|
+
};
|
|
463
|
+
let first = NativeProvider::Claude.server_key_for(&identity).unwrap();
|
|
464
|
+
assert_eq!(first, claude::server_key(&identity));
|
|
465
|
+
assert_ne!(first, grok_build::server_key(&identity));
|
|
466
|
+
assert_ne!(first, codex::server_key(&identity));
|
|
467
|
+
assert_ne!(first, pi::server_key(&identity));
|
|
468
|
+
identity.generation = Generation(2);
|
|
469
|
+
assert_ne!(first, NativeProvider::Claude.server_key_for(&identity).unwrap());
|
|
470
|
+
assert!(NativeProvider::Claude.server_key().is_err());
|
|
471
|
+
assert!(NativeProvider::Claude.tool_panel().is_err());
|
|
472
|
+
assert!(NativeProvider::Claude.startup().is_none(), "folder trust is never keyed");
|
|
473
|
+
assert!(NativeProvider::Claude.session_panel().is_none());
|
|
474
|
+
assert!(NativeProvider::Claude.uses_tool_roundtrips());
|
|
475
|
+
assert!(NativeProvider::Claude.first_business_bootstrap());
|
|
476
|
+
let kinds: Vec<_> = NativeProvider::Claude.controls().iter().map(|control| control.command).collect();
|
|
477
|
+
assert_eq!(kinds, ["/exit"]);
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
#[test]
|
|
481
|
+
fn bare_pi_keeps_its_legacy_meaning_and_only_opt_in_selects_the_leaf() {
|
|
482
|
+
use team_agent_contract::contract::types::{Generation, InstanceId, ScopeId, SeatId};
|
|
483
|
+
assert_eq!(PI_DESCRIPTOR.identity.id, "pi_tui");
|
|
484
|
+
assert_eq!(PI_DESCRIPTOR.identity.binary, "pi");
|
|
485
|
+
assert_eq!(provider("pi_tui").unwrap(), NativeProvider::Pi);
|
|
486
|
+
// The default role provider, the Pi leader and legacy state keep `pi`.
|
|
487
|
+
assert!(descriptor("pi").is_none());
|
|
488
|
+
assert!(provider("pi").is_err());
|
|
489
|
+
assert!(declared("pi", false).is_none());
|
|
490
|
+
assert_eq!(declared("pi", true), Some(&PI_DESCRIPTOR));
|
|
491
|
+
assert_eq!(declared("pi_tui", false), Some(&PI_DESCRIPTOR));
|
|
492
|
+
for spelling in ["pi", " Pi ", "PI"] {
|
|
493
|
+
assert!(!recognizes(spelling, false), "{spelling:?}");
|
|
494
|
+
assert!(recognizes(spelling, true), "{spelling:?}");
|
|
495
|
+
}
|
|
496
|
+
assert!(declared("Pi", true).is_none());
|
|
497
|
+
let mut identity = InstanceIdentity {
|
|
498
|
+
scope: ScopeId::new("scope").unwrap(), seat: SeatId::new("worker").unwrap(),
|
|
499
|
+
instance: InstanceId::new("instance").unwrap(), generation: Generation(1),
|
|
500
|
+
};
|
|
501
|
+
let first = NativeProvider::Pi.server_key_for(&identity).unwrap();
|
|
502
|
+
assert_eq!(first, pi::server_key(&identity));
|
|
503
|
+
assert_ne!(first, codex::server_key(&identity));
|
|
504
|
+
// Pi rejects a tool name over 64 characters.
|
|
505
|
+
assert!(format!("mcp__{first}__report_result").len() <= 64);
|
|
506
|
+
identity.generation = Generation(2);
|
|
507
|
+
assert_ne!(first, NativeProvider::Pi.server_key_for(&identity).unwrap());
|
|
508
|
+
assert!(NativeProvider::Pi.tool_panel().is_err());
|
|
509
|
+
assert!(NativeProvider::Pi.startup().is_none());
|
|
510
|
+
assert!(NativeProvider::Pi.session_panel().is_none());
|
|
511
|
+
assert!(NativeProvider::Pi.uses_tool_roundtrips());
|
|
512
|
+
assert!(NativeProvider::Pi.first_business_bootstrap());
|
|
513
|
+
let kinds: Vec<_> = NativeProvider::Pi.controls().iter().map(|control| control.command).collect();
|
|
514
|
+
assert_eq!(kinds, ["/session", "/quit"]);
|
|
515
|
+
}
|
|
516
|
+
|
|
242
517
|
#[test]
|
|
243
518
|
fn grok_server_key_is_generation_bound_and_has_no_inspector_fallback() {
|
|
244
519
|
use team_agent_contract::contract::types::{Generation, InstanceId, ScopeId, SeatId};
|
|
@@ -583,7 +583,6 @@ fn runtime_event_provider_name(provider: Provider) -> &'static str {
|
|
|
583
583
|
Provider::Copilot => "copilot",
|
|
584
584
|
Provider::GeminiCli => "gemini_cli",
|
|
585
585
|
Provider::Grok => "grok",
|
|
586
|
-
Provider::CursorAgent => "cursor_agent",
|
|
587
586
|
Provider::Pi => "pi",
|
|
588
587
|
Provider::Fake => "fake",
|
|
589
588
|
}
|
|
@@ -830,7 +830,7 @@ impl Coordinator {
|
|
|
830
830
|
// runs so the CapturedRuntimeFact map stays populated for
|
|
831
831
|
// downstream runtime detectors; only the activity classify
|
|
832
832
|
// happens once.
|
|
833
|
-
let jsonl_first =
|
|
833
|
+
let jsonl_first = native_activity_for_agent(agent);
|
|
834
834
|
if let Some(activity) = jsonl_first.as_ref() {
|
|
835
835
|
remember_idle_capture_schedule(agent, activity);
|
|
836
836
|
write_activity(agent, activity, false);
|
|
@@ -2313,6 +2313,47 @@ fn jsonl_activity_for_agent(agent: &Value) -> Option<crate::messaging::AgentActi
|
|
|
2313
2313
|
activity
|
|
2314
2314
|
}
|
|
2315
2315
|
|
|
2316
|
+
/// #379: for Claude, its live session registry outranks the transcript tail,
|
|
2317
|
+
/// which still reads idle between a submitted prompt and the first assistant
|
|
2318
|
+
/// record. Busy and waiting are decisive; idle yields only to a background
|
|
2319
|
+
/// task the transcript still holds open.
|
|
2320
|
+
fn native_activity_for_agent(agent: &Value) -> Option<crate::messaging::AgentActivity> {
|
|
2321
|
+
use crate::messaging::{ActivityStatus, AgentActivity};
|
|
2322
|
+
let jsonl = jsonl_activity_for_agent(agent);
|
|
2323
|
+
let claude = agent
|
|
2324
|
+
.get("provider")
|
|
2325
|
+
.and_then(Value::as_str)
|
|
2326
|
+
.and_then(parse_provider)
|
|
2327
|
+
.is_some_and(crate::provider::wire::is_claude_family);
|
|
2328
|
+
let registry = crate::provider::claude_registry_key(agent)
|
|
2329
|
+
.filter(|_| claude)
|
|
2330
|
+
.and_then(|(sessions, session_id)| {
|
|
2331
|
+
crate::provider::claude_registry_turn_state(
|
|
2332
|
+
&sessions,
|
|
2333
|
+
&session_id,
|
|
2334
|
+
agent.get("pane_id").and_then(Value::as_str),
|
|
2335
|
+
)
|
|
2336
|
+
});
|
|
2337
|
+
let (status, state) = match registry {
|
|
2338
|
+
Some(TurnState::Working) => (ActivityStatus::Working, "busy"),
|
|
2339
|
+
Some(TurnState::BlockedOnHuman) => (ActivityStatus::Uncertain, "waiting"),
|
|
2340
|
+
Some(TurnState::Idle)
|
|
2341
|
+
if jsonl
|
|
2342
|
+
.as_ref()
|
|
2343
|
+
.is_some_and(|activity| activity.rationale == "provider_jsonl:background_task") =>
|
|
2344
|
+
{
|
|
2345
|
+
return jsonl;
|
|
2346
|
+
}
|
|
2347
|
+
Some(TurnState::Idle) => (ActivityStatus::Idle, "idle"),
|
|
2348
|
+
_ => return jsonl,
|
|
2349
|
+
};
|
|
2350
|
+
Some(AgentActivity {
|
|
2351
|
+
status,
|
|
2352
|
+
confidence: 0.95,
|
|
2353
|
+
rationale: format!("claude_session_registry:{state}"),
|
|
2354
|
+
})
|
|
2355
|
+
}
|
|
2356
|
+
|
|
2316
2357
|
fn runtime_approval_target(
|
|
2317
2358
|
agent: &Value,
|
|
2318
2359
|
session_name: Option<&str>,
|
|
@@ -2908,6 +2949,53 @@ mod u1_tests {
|
|
|
2908
2949
|
use super::*;
|
|
2909
2950
|
use std::io::Write as _;
|
|
2910
2951
|
|
|
2952
|
+
// #379: the registry beside the transcript decides Claude's live turn.
|
|
2953
|
+
#[cfg(unix)]
|
|
2954
|
+
#[test]
|
|
2955
|
+
fn issue379_claude_registry_outranks_an_idle_transcript_tail() {
|
|
2956
|
+
use crate::messaging::ActivityStatus;
|
|
2957
|
+
let config = std::env::temp_dir().join(format!("ta-379-native-activity-{}", std::process::id()));
|
|
2958
|
+
let _ = std::fs::remove_dir_all(&config);
|
|
2959
|
+
let sid = "22222222-3333-4444-8555-666666666666";
|
|
2960
|
+
let projects = config.join("projects").join("-owned-cwd");
|
|
2961
|
+
std::fs::create_dir_all(&projects).unwrap();
|
|
2962
|
+
std::fs::create_dir_all(config.join("sessions")).unwrap();
|
|
2963
|
+
let rollout = projects.join(format!("{sid}.jsonl"));
|
|
2964
|
+
let pid = std::process::id();
|
|
2965
|
+
let registry = |status: &str| {
|
|
2966
|
+
let record = serde_json::json!({"pid": pid, "sessionId": sid, "tmux": "team-x:@1.%7", "status": status});
|
|
2967
|
+
std::fs::write(config.join("sessions").join(format!("{pid}.json")), record.to_string()).unwrap();
|
|
2968
|
+
};
|
|
2969
|
+
let end_turn = r#"{"type":"assistant","requestId":"r1","message":{"stop_reason":"end_turn"}}"#;
|
|
2970
|
+
let agent = serde_json::json!({
|
|
2971
|
+
"provider": "claude", "pane_id": "%7", "rollout_path": rollout, "process_alive": true,
|
|
2972
|
+
});
|
|
2973
|
+
let observe = || native_activity_for_agent(&agent).map(|a| (a.status, a.rationale));
|
|
2974
|
+
|
|
2975
|
+
// A submitted prompt before its first assistant record: the tail still reads idle.
|
|
2976
|
+
std::fs::write(&rollout, format!("{end_turn}\n")).unwrap();
|
|
2977
|
+
registry("busy");
|
|
2978
|
+
assert_eq!(observe(), Some((ActivityStatus::Working, "claude_session_registry:busy".into())));
|
|
2979
|
+
registry("waiting");
|
|
2980
|
+
assert_eq!(observe(), Some((ActivityStatus::Uncertain, "claude_session_registry:waiting".into())));
|
|
2981
|
+
registry("idle");
|
|
2982
|
+
assert_eq!(observe(), Some((ActivityStatus::Idle, "claude_session_registry:idle".into())));
|
|
2983
|
+
// A background shell the transcript holds open keeps the worker busy.
|
|
2984
|
+
let background = r#"{"type":"user","message":{"content":[{"type":"tool_result","content":"Command running in background with ID: bg1"}]}}"#;
|
|
2985
|
+
std::fs::write(&rollout, format!("{background}\n{end_turn}\n")).unwrap();
|
|
2986
|
+
assert_eq!(observe(), Some((ActivityStatus::Working, "provider_jsonl:background_task".into())));
|
|
2987
|
+
// Cold start: no transcript captured yet, only the launch's session id and root.
|
|
2988
|
+
let cold = serde_json::json!({
|
|
2989
|
+
"provider": "claude", "pane_id": "%7", "_pending_session_id": sid,
|
|
2990
|
+
"claude_projects_root": config.join("projects"),
|
|
2991
|
+
});
|
|
2992
|
+
assert_eq!(
|
|
2993
|
+
native_activity_for_agent(&cold).map(|a| (a.status, a.rationale)),
|
|
2994
|
+
Some((ActivityStatus::Idle, "claude_session_registry:idle".into()))
|
|
2995
|
+
);
|
|
2996
|
+
let _ = std::fs::remove_dir_all(&config);
|
|
2997
|
+
}
|
|
2998
|
+
|
|
2911
2999
|
struct CaptureFailureRegistry;
|
|
2912
3000
|
|
|
2913
3001
|
impl ProviderRegistry for CaptureFailureRegistry {
|