@team-agent/installer 0.3.1 → 0.3.2
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/adapters.rs +38 -7
- package/crates/team-agent/src/cli/emit.rs +7 -6
- package/crates/team-agent/src/cli/mod.rs +623 -21
- package/crates/team-agent/src/cli/status_port.rs +170 -44
- package/crates/team-agent/src/cli/tests/run_delegation.rs +2 -0
- package/crates/team-agent/src/cli/types.rs +1 -0
- package/crates/team-agent/src/coordinator/health.rs +9 -0
- package/crates/team-agent/src/lifecycle/launch.rs +271 -58
- package/crates/team-agent/src/lifecycle/restart/common.rs +65 -0
- package/crates/team-agent/src/lifecycle/restart/rebuild.rs +57 -15
- package/crates/team-agent/src/lifecycle/restart/remove.rs +5 -1
- package/crates/team-agent/src/lifecycle/restart.rs +20 -0
- package/crates/team-agent/src/messaging/delivery.rs +397 -36
- package/crates/team-agent/src/messaging/mod.rs +1 -1
- package/crates/team-agent/src/messaging/results.rs +200 -47
- package/crates/team-agent/src/provider/adapter.rs +95 -10
- package/crates/team-agent/src/provider/helpers.rs +10 -1
- package/crates/team-agent/src/state/persist.rs +113 -1
- package/crates/team-agent/src/state/projection.rs +127 -3
- package/crates/team-agent/src/tmux_backend.rs +66 -6
- package/package.json +4 -4
package/Cargo.lock
CHANGED
package/Cargo.toml
CHANGED
|
@@ -85,7 +85,7 @@ pub fn cmd_init(args: &InitArgs) -> Result<CmdResult, CliError> {
|
|
|
85
85
|
/// `cmd_quick_start`(`commands.py:18`)。`--json` 或 `!ok` → 整 dict;否则 `result["summary"]`。
|
|
86
86
|
pub fn cmd_quick_start(args: &QuickStartArgs) -> Result<CmdResult, CliError> {
|
|
87
87
|
let value = lifecycle_port::quick_start(
|
|
88
|
-
&args.
|
|
88
|
+
&args.workspace,
|
|
89
89
|
&args.agents_dir,
|
|
90
90
|
args.name.as_deref(),
|
|
91
91
|
args.team_id.as_deref(),
|
|
@@ -123,6 +123,10 @@ pub fn cmd_compile(args: &CompileArgs) -> Result<CmdResult, CliError> {
|
|
|
123
123
|
/// `cmd_status`(`commands.py:90`)。三态:`--summary`(xor json,xor agent)→五行文本;
|
|
124
124
|
/// `--json`→`status_port::status(compact=!detail)`;else→`status_port::format_status(agent)`。
|
|
125
125
|
pub fn cmd_status(args: &StatusArgs) -> Result<CmdResult, CliError> {
|
|
126
|
+
cmd_status_for_team(args, None)
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
pub fn cmd_status_for_team(args: &StatusArgs, team: Option<&str>) -> Result<CmdResult, CliError> {
|
|
126
130
|
if args.summary && args.json {
|
|
127
131
|
return Err(CliError::Runtime(
|
|
128
132
|
"--summary and --json are mutually exclusive".to_string(),
|
|
@@ -135,7 +139,7 @@ pub fn cmd_status(args: &StatusArgs) -> Result<CmdResult, CliError> {
|
|
|
135
139
|
}
|
|
136
140
|
let selected = match crate::state::selector::resolve_active_team(
|
|
137
141
|
&args.workspace,
|
|
138
|
-
|
|
142
|
+
team,
|
|
139
143
|
crate::state::selector::SelectorMode::RuntimeOnly,
|
|
140
144
|
) {
|
|
141
145
|
Ok(selected) => selected,
|
|
@@ -147,15 +151,29 @@ pub fn cmd_status(args: &StatusArgs) -> Result<CmdResult, CliError> {
|
|
|
147
151
|
}
|
|
148
152
|
};
|
|
149
153
|
if args.summary {
|
|
150
|
-
let value = status_port::
|
|
154
|
+
let value = status_port::status_scoped(
|
|
155
|
+
&selected.run_workspace,
|
|
156
|
+
&selected.state,
|
|
157
|
+
Some(&selected.team_key),
|
|
158
|
+
true,
|
|
159
|
+
false,
|
|
160
|
+
)?;
|
|
151
161
|
return Ok(CmdResult::human(format_status_summary(&value)));
|
|
152
162
|
}
|
|
153
163
|
if args.json {
|
|
154
|
-
let value = status_port::
|
|
164
|
+
let value = status_port::status_scoped(
|
|
165
|
+
&selected.run_workspace,
|
|
166
|
+
&selected.state,
|
|
167
|
+
Some(&selected.team_key),
|
|
168
|
+
status_compact_flag(args.detail),
|
|
169
|
+
args.detail,
|
|
170
|
+
)?;
|
|
155
171
|
return Ok(CmdResult::from_json(value, true));
|
|
156
172
|
}
|
|
157
|
-
Ok(CmdResult::human(status_port::
|
|
173
|
+
Ok(CmdResult::human(status_port::format_status_scoped(
|
|
158
174
|
&selected.run_workspace,
|
|
175
|
+
&selected.state,
|
|
176
|
+
Some(&selected.team_key),
|
|
159
177
|
args.agent.as_deref(),
|
|
160
178
|
)?))
|
|
161
179
|
}
|
|
@@ -252,9 +270,13 @@ pub fn cmd_validate_result(args: &ValidateResultArgs) -> Result<CmdResult, CliEr
|
|
|
252
270
|
|
|
253
271
|
/// `cmd_collect`(`parser.py:292`)。
|
|
254
272
|
pub fn cmd_collect(args: &CollectArgs) -> Result<CmdResult, CliError> {
|
|
273
|
+
cmd_collect_for_team(args, None)
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
pub fn cmd_collect_for_team(args: &CollectArgs, team: Option<&str>) -> Result<CmdResult, CliError> {
|
|
255
277
|
let selected = match crate::state::selector::resolve_active_team(
|
|
256
278
|
&args.workspace,
|
|
257
|
-
|
|
279
|
+
team,
|
|
258
280
|
crate::state::selector::SelectorMode::RuntimeOnly,
|
|
259
281
|
) {
|
|
260
282
|
Ok(selected) => selected,
|
|
@@ -269,7 +291,16 @@ pub fn cmd_collect(args: &CollectArgs) -> Result<CmdResult, CliError> {
|
|
|
269
291
|
));
|
|
270
292
|
}
|
|
271
293
|
};
|
|
272
|
-
let value = match
|
|
294
|
+
let value = match if team.is_some() {
|
|
295
|
+
messaging::collect_for_team(
|
|
296
|
+
&selected.run_workspace,
|
|
297
|
+
args.result_file.as_deref(),
|
|
298
|
+
false,
|
|
299
|
+
Some(&selected.team_key),
|
|
300
|
+
)
|
|
301
|
+
} else {
|
|
302
|
+
messaging::collect(&selected.run_workspace, args.result_file.as_deref(), false)
|
|
303
|
+
} {
|
|
273
304
|
Ok(value) => value,
|
|
274
305
|
Err(error) => {
|
|
275
306
|
return Ok(CmdResult::from_json(
|
|
@@ -79,7 +79,7 @@ fn dispatch(command: &str, args: &[String], cwd: &Path) -> Result<ExitCode, CliE
|
|
|
79
79
|
"compile" => cmd_compile(&compile_args(args, cwd)?).map(emit_result),
|
|
80
80
|
"send" => cmd_send(&send_args(args, cwd)?).map(emit_result),
|
|
81
81
|
"allow-peer-talk" => cmd_allow_peer_talk(&allow_peer_talk_args(args, cwd)?).map(emit_result),
|
|
82
|
-
"status" =>
|
|
82
|
+
"status" => cmd_status_for_team(&status_args(args, cwd), parse_args(args).team.as_deref()).map(emit_result),
|
|
83
83
|
"stop" => cmd_shutdown(&shutdown_args(args, cwd)).map(emit_result),
|
|
84
84
|
"shutdown" => cmd_shutdown(&shutdown_args(args, cwd)).map(emit_result),
|
|
85
85
|
"restart" => cmd_restart(&restart_args(args, cwd)).map(emit_result),
|
|
@@ -108,7 +108,7 @@ fn dispatch(command: &str, args: &[String], cwd: &Path) -> Result<ExitCode, CliE
|
|
|
108
108
|
Ok(ExitCode::Usage)
|
|
109
109
|
}
|
|
110
110
|
"validate-result" => cmd_validate_result(&validate_result_args(args)?).map(emit_result),
|
|
111
|
-
"collect" =>
|
|
111
|
+
"collect" => cmd_collect_for_team(&collect_args(args, cwd), parse_args(args).team.as_deref()).map(emit_result),
|
|
112
112
|
"settle" => cmd_settle(&settle_args(args, cwd)).map(emit_result),
|
|
113
113
|
"repair-state" => cmd_repair_state(&repair_state_args(args, cwd)?).map(emit_result),
|
|
114
114
|
"diagnose" => cmd_diagnose(&diagnose_args(args, cwd)).map(emit_result),
|
|
@@ -195,7 +195,7 @@ fn command_help(command: Option<&str>) -> String {
|
|
|
195
195
|
Some("compile") => "usage: team-agent compile --team TEAM [--out FILE] [--json]".to_string(),
|
|
196
196
|
Some("send") => "usage: team-agent send TARGET MESSAGE... [--workspace WORKSPACE] [--team TEAM] [--targets AGENTS] [--task TASK] [--sender SENDER] [--watch-result] [--requires-ack|--no-ack] [--no-wait] [--timeout SECONDS] [--confirm-human] [--message-id ID] [--json]".to_string(),
|
|
197
197
|
Some("allow-peer-talk") => "usage: team-agent allow-peer-talk A B [--workspace WORKSPACE] [--json]".to_string(),
|
|
198
|
-
Some("status") => "usage: team-agent status [AGENT] [--workspace WORKSPACE] [--summary|--json] [--detail]".to_string(),
|
|
198
|
+
Some("status") => "usage: team-agent status [AGENT] [--workspace WORKSPACE] [--team TEAM] [--summary|--json] [--detail]".to_string(),
|
|
199
199
|
Some("stop") => "usage: team-agent stop [--workspace WORKSPACE] [--team TEAM] [--keep-logs] [--json]".to_string(),
|
|
200
200
|
Some("shutdown") => "usage: team-agent shutdown [--workspace WORKSPACE] [--team TEAM] [--keep-logs] [--json]".to_string(),
|
|
201
201
|
Some("restart") => "usage: team-agent restart [WORKSPACE] [--team TEAM] [--allow-fresh] [--json]".to_string(),
|
|
@@ -222,7 +222,7 @@ fn command_help(command: Option<&str>) -> String {
|
|
|
222
222
|
Some("validate") => "usage: team-agent validate [SPEC] [--json]".to_string(),
|
|
223
223
|
Some("profile") => "usage: team-agent profile COMMAND NAME [--workspace WORKSPACE] [--team TEAM] [--auth-mode MODE] [--json]".to_string(),
|
|
224
224
|
Some("validate-result") => "usage: team-agent validate-result [ENVELOPE] [--file FILE|--result JSON] [--json]".to_string(),
|
|
225
|
-
Some("collect") => "usage: team-agent collect [--workspace WORKSPACE] [--result-file FILE] [--json]".to_string(),
|
|
225
|
+
Some("collect") => "usage: team-agent collect [--workspace WORKSPACE] [--team TEAM] [--result-file FILE] [--json]".to_string(),
|
|
226
226
|
Some("settle") => "usage: team-agent settle [--workspace WORKSPACE] [--json]".to_string(),
|
|
227
227
|
Some("repair-state") => "usage: team-agent repair-state --task TASK --status STATUS [SUMMARY] [--assignee AGENT] [--workspace WORKSPACE] [--json]".to_string(),
|
|
228
228
|
Some("diagnose") => "usage: team-agent diagnose [--workspace WORKSPACE] [--json]".to_string(),
|
|
@@ -565,6 +565,7 @@ fn quick_start_args(args: &[String], cwd: &Path) -> Result<QuickStartArgs, CliEr
|
|
|
565
565
|
workspace.join(agents_dir)
|
|
566
566
|
};
|
|
567
567
|
Ok(QuickStartArgs {
|
|
568
|
+
workspace,
|
|
568
569
|
agents_dir,
|
|
569
570
|
name: parsed.name,
|
|
570
571
|
team_id: parsed.team_id.or(parsed.team),
|
|
@@ -1161,7 +1162,7 @@ mod tests {
|
|
|
1161
1162
|
for (command, flags) in [
|
|
1162
1163
|
("quick-start", &["--workspace", "--team-id", "--yes", "--fresh", "--json"][..]),
|
|
1163
1164
|
("send", &["--workspace", "--team", "--targets", "--watch-result", "--timeout", "--json"][..]),
|
|
1164
|
-
("status", &["--workspace", "--summary", "--json", "--detail"][..]),
|
|
1165
|
+
("status", &["--workspace", "--team", "--summary", "--json", "--detail"][..]),
|
|
1165
1166
|
("shutdown", &["--workspace", "--team", "--keep-logs", "--json"][..]),
|
|
1166
1167
|
("restart", &["--team", "--allow-fresh", "--json"][..]),
|
|
1167
1168
|
("start-agent", &["--workspace", "--team", "--force", "--allow-fresh", "--no-display", "--json"][..]),
|
|
@@ -1170,7 +1171,7 @@ mod tests {
|
|
|
1170
1171
|
("fork-agent", &["--as", "--label", "--workspace", "--team", "--no-display", "--json"][..]),
|
|
1171
1172
|
("remove-agent", &["--workspace", "--team", "--from-spec", "--confirm", "--force", "--json"][..]),
|
|
1172
1173
|
("doctor", &["--workspace", "--team", "--gate", "--fix-schema", "--cleanup-orphans", "--json"][..]),
|
|
1173
|
-
("collect", &["--workspace", "--result-file", "--json"][..]),
|
|
1174
|
+
("collect", &["--workspace", "--team", "--result-file", "--json"][..]),
|
|
1174
1175
|
("repair-state", &["--task", "--status", "--assignee", "--workspace", "--json"][..]),
|
|
1175
1176
|
("wait-ready", &["--workspace", "--timeout", "--json"][..]),
|
|
1176
1177
|
("peek", &["--workspace", "--tail", "--allow-raw-screen", "--json"][..]),
|