@team-agent/installer 0.2.11 → 0.3.0
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 +744 -0
- package/Cargo.toml +34 -0
- package/crates/team-agent/Cargo.toml +33 -0
- package/crates/team-agent/src/cli/adapters.rs +1343 -0
- package/crates/team-agent/src/cli/diagnose.rs +554 -0
- package/crates/team-agent/src/cli/emit.rs +1077 -0
- package/crates/team-agent/src/cli/helpers.rs +88 -0
- package/crates/team-agent/src/cli/leader.rs +216 -0
- package/crates/team-agent/src/cli/mod.rs +1141 -0
- package/crates/team-agent/src/cli/profile.rs +306 -0
- package/crates/team-agent/src/cli/send.rs +215 -0
- package/crates/team-agent/src/cli/status.rs +179 -0
- package/crates/team-agent/src/cli/status_port.rs +502 -0
- package/crates/team-agent/src/cli/tests/base.rs +616 -0
- package/crates/team-agent/src/cli/tests/compile.rs +96 -0
- package/crates/team-agent/src/cli/tests/divergence.rs +509 -0
- package/crates/team-agent/src/cli/tests/lane_c.rs +333 -0
- package/crates/team-agent/src/cli/tests/leader_watch.rs +395 -0
- package/crates/team-agent/src/cli/tests/main_preserved.rs +675 -0
- package/crates/team-agent/src/cli/tests/missing_subcommands.rs +390 -0
- package/crates/team-agent/src/cli/tests/mod.rs +97 -0
- package/crates/team-agent/src/cli/tests/peer_allow.rs +137 -0
- package/crates/team-agent/src/cli/tests/repair_state_byte_lock.rs +302 -0
- package/crates/team-agent/src/cli/tests/run_delegation.rs +305 -0
- package/crates/team-agent/src/cli/tests/status_send.rs +385 -0
- package/crates/team-agent/src/cli/tests/verb_profile.rs +182 -0
- package/crates/team-agent/src/cli/tests/verb_settle.rs +236 -0
- package/crates/team-agent/src/cli/tests/verb_validate.rs +184 -0
- package/crates/team-agent/src/cli/types.rs +605 -0
- package/crates/team-agent/src/compiler/tests.rs +701 -0
- package/crates/team-agent/src/compiler.rs +489 -0
- package/crates/team-agent/src/coordinator/backoff.rs +153 -0
- package/crates/team-agent/src/coordinator/health.rs +436 -0
- package/crates/team-agent/src/coordinator/mod.rs +80 -0
- package/crates/team-agent/src/coordinator/orphan.rs +179 -0
- package/crates/team-agent/src/coordinator/tests/abnormal.rs +255 -0
- package/crates/team-agent/src/coordinator/tests/basics.rs +262 -0
- package/crates/team-agent/src/coordinator/tests/daemon.rs +323 -0
- package/crates/team-agent/src/coordinator/tests/health_sync.rs +263 -0
- package/crates/team-agent/src/coordinator/tests/main_preserved.rs +136 -0
- package/crates/team-agent/src/coordinator/tests/mod.rs +310 -0
- package/crates/team-agent/src/coordinator/tests/spine.rs +261 -0
- package/crates/team-agent/src/coordinator/tests/takeover.rs +227 -0
- package/crates/team-agent/src/coordinator/tests/tick_core.rs +256 -0
- package/crates/team-agent/src/coordinator/tests/watch.rs +167 -0
- package/crates/team-agent/src/coordinator/tick.rs +2032 -0
- package/crates/team-agent/src/coordinator/types.rs +584 -0
- package/crates/team-agent/src/db/migration.rs +716 -0
- package/crates/team-agent/src/db/mod.rs +23 -0
- package/crates/team-agent/src/db/schema.rs +378 -0
- package/crates/team-agent/src/event_log.rs +375 -0
- package/crates/team-agent/src/fake_worker.rs +253 -0
- package/crates/team-agent/src/leader/helpers.rs +190 -0
- package/crates/team-agent/src/leader/inject.rs +33 -0
- package/crates/team-agent/src/leader/lease.rs +1063 -0
- package/crates/team-agent/src/leader/mod.rs +99 -0
- package/crates/team-agent/src/leader/owner_bind.rs +292 -0
- package/crates/team-agent/src/leader/rediscover/tests.rs +525 -0
- package/crates/team-agent/src/leader/rediscover.rs +1099 -0
- package/crates/team-agent/src/leader/start.rs +273 -0
- package/crates/team-agent/src/leader/takeover.rs +235 -0
- package/crates/team-agent/src/leader/tests/basics.rs +183 -0
- package/crates/team-agent/src/leader/tests/byte_findings.rs +234 -0
- package/crates/team-agent/src/leader/tests/identity.rs +206 -0
- package/crates/team-agent/src/leader/tests/idle.rs +271 -0
- package/crates/team-agent/src/leader/tests/lease_api.rs +225 -0
- package/crates/team-agent/src/leader/tests/lease_claim.rs +253 -0
- package/crates/team-agent/src/leader/tests/mod.rs +125 -0
- package/crates/team-agent/src/leader/tests/rediscover.rs +351 -0
- package/crates/team-agent/src/leader/tests/wake_start_owner.rs +204 -0
- package/crates/team-agent/src/leader/types.rs +487 -0
- package/crates/team-agent/src/lib.rs +85 -0
- package/crates/team-agent/src/lifecycle/display.rs +228 -0
- package/crates/team-agent/src/lifecycle/helpers.rs +112 -0
- package/crates/team-agent/src/lifecycle/launch/plan.rs +227 -0
- package/crates/team-agent/src/lifecycle/launch.rs +1833 -0
- package/crates/team-agent/src/lifecycle/mod.rs +62 -0
- package/crates/team-agent/src/lifecycle/restart/agent.rs +533 -0
- package/crates/team-agent/src/lifecycle/restart/common.rs +517 -0
- package/crates/team-agent/src/lifecycle/restart/orchestrator.rs +41 -0
- package/crates/team-agent/src/lifecycle/restart/rebuild.rs +268 -0
- package/crates/team-agent/src/lifecycle/restart/remove.rs +780 -0
- package/crates/team-agent/src/lifecycle/restart/selection.rs +208 -0
- package/crates/team-agent/src/lifecycle/restart/team_state.rs +242 -0
- package/crates/team-agent/src/lifecycle/restart.rs +76 -0
- package/crates/team-agent/src/lifecycle/tests/agent_ops.rs +455 -0
- package/crates/team-agent/src/lifecycle/tests/core.rs +989 -0
- package/crates/team-agent/src/lifecycle/tests/lane_ops.rs +583 -0
- package/crates/team-agent/src/lifecycle/tests/launch_spawn.rs +933 -0
- package/crates/team-agent/src/lifecycle/tests/main_preserved.rs +265 -0
- package/crates/team-agent/src/lifecycle/tests.rs +27 -0
- package/crates/team-agent/src/lifecycle/types.rs +685 -0
- package/crates/team-agent/src/main.rs +41 -0
- package/crates/team-agent/src/mcp_server/helpers.rs +228 -0
- package/crates/team-agent/src/mcp_server/mod.rs +183 -0
- package/crates/team-agent/src/mcp_server/normalize.rs +312 -0
- package/crates/team-agent/src/mcp_server/tests/golden.rs +283 -0
- package/crates/team-agent/src/mcp_server/tests/normalize.rs +244 -0
- package/crates/team-agent/src/mcp_server/tests/scoped.rs +189 -0
- package/crates/team-agent/src/mcp_server/tests/send.rs +222 -0
- package/crates/team-agent/src/mcp_server/tests/tools.rs +158 -0
- package/crates/team-agent/src/mcp_server/tests/wire.rs +159 -0
- package/crates/team-agent/src/mcp_server/tests.rs +38 -0
- package/crates/team-agent/src/mcp_server/tools.rs +603 -0
- package/crates/team-agent/src/mcp_server/types.rs +421 -0
- package/crates/team-agent/src/mcp_server/wire.rs +388 -0
- package/crates/team-agent/src/message_store.rs +767 -0
- package/crates/team-agent/src/messaging/activity.rs +433 -0
- package/crates/team-agent/src/messaging/delivery.rs +542 -0
- package/crates/team-agent/src/messaging/helpers.rs +209 -0
- package/crates/team-agent/src/messaging/leader_receiver.rs +340 -0
- package/crates/team-agent/src/messaging/mod.rs +147 -0
- package/crates/team-agent/src/messaging/peers.rs +32 -0
- package/crates/team-agent/src/messaging/results.rs +537 -0
- package/crates/team-agent/src/messaging/scheduler.rs +344 -0
- package/crates/team-agent/src/messaging/selftest.rs +100 -0
- package/crates/team-agent/src/messaging/send.rs +582 -0
- package/crates/team-agent/src/messaging/tests/basic.rs +357 -0
- package/crates/team-agent/src/messaging/tests/main_preserved.rs +122 -0
- package/crates/team-agent/src/messaging/tests/mod.rs +293 -0
- package/crates/team-agent/src/messaging/tests/runtime.rs +1422 -0
- package/crates/team-agent/src/messaging/tests/spine.rs +437 -0
- package/crates/team-agent/src/messaging/trust.rs +192 -0
- package/crates/team-agent/src/messaging/types.rs +355 -0
- package/crates/team-agent/src/messaging/watchers.rs +591 -0
- package/crates/team-agent/src/model/enums.rs +311 -0
- package/crates/team-agent/src/model/errors.rs +17 -0
- package/crates/team-agent/src/model/ids.rs +155 -0
- package/crates/team-agent/src/model/mod.rs +22 -0
- package/crates/team-agent/src/model/paths.rs +228 -0
- package/crates/team-agent/src/model/permissions.rs +567 -0
- package/crates/team-agent/src/model/routing.rs +340 -0
- package/crates/team-agent/src/model/spec.rs +680 -0
- package/crates/team-agent/src/model/task_graph.rs +380 -0
- package/crates/team-agent/src/model/testdata/fuzz.golden.yaml +43 -0
- package/crates/team-agent/src/model/testdata/fuzz.yaml +43 -0
- package/crates/team-agent/src/model/testdata/spec_invalid_a.yaml +207 -0
- package/crates/team-agent/src/model/testdata/team.spec.golden.yaml +206 -0
- package/crates/team-agent/src/model/testdata/team.spec.yaml +206 -0
- package/crates/team-agent/src/model/yaml/tests.rs +288 -0
- package/crates/team-agent/src/model/yaml.rs +800 -0
- package/crates/team-agent/src/packaging/install.rs +305 -0
- package/crates/team-agent/src/packaging/migrate.rs +30 -0
- package/crates/team-agent/src/packaging/mod.rs +82 -0
- package/crates/team-agent/src/packaging/repair.rs +24 -0
- package/crates/team-agent/src/packaging/tests.rs +829 -0
- package/crates/team-agent/src/packaging/types.rs +369 -0
- package/crates/team-agent/src/provider/adapter.rs +801 -0
- package/crates/team-agent/src/provider/approvals/mod.rs +2 -0
- package/crates/team-agent/src/provider/approvals/parsing.rs +452 -0
- package/crates/team-agent/src/provider/approvals/runtime_prompts.rs +163 -0
- package/crates/team-agent/src/provider/classify.rs +456 -0
- package/crates/team-agent/src/provider/faults.rs +136 -0
- package/crates/team-agent/src/provider/helpers.rs +41 -0
- package/crates/team-agent/src/provider/mod.rs +53 -0
- package/crates/team-agent/src/provider/startup_prompt.rs +423 -0
- package/crates/team-agent/src/provider/tests/adapter.rs +239 -0
- package/crates/team-agent/src/provider/tests/classify.rs +240 -0
- package/crates/team-agent/src/provider/tests/faults.rs +120 -0
- package/crates/team-agent/src/provider/tests/idle.rs +208 -0
- package/crates/team-agent/src/provider/tests/wire.rs +213 -0
- package/crates/team-agent/src/provider/tests.rs +31 -0
- package/crates/team-agent/src/provider/types.rs +424 -0
- package/crates/team-agent/src/state/identity.rs +656 -0
- package/crates/team-agent/src/state/mod.rs +58 -0
- package/crates/team-agent/src/state/owner_gate.rs +423 -0
- package/crates/team-agent/src/state/persist.rs +712 -0
- package/crates/team-agent/src/state/projection.rs +657 -0
- package/crates/team-agent/src/state/selector.rs +105 -0
- package/crates/team-agent/src/state/testdata/state-rich.canonical.json +133 -0
- package/crates/team-agent/src/tmux_backend/tests.rs +586 -0
- package/crates/team-agent/src/tmux_backend.rs +758 -0
- package/crates/team-agent/src/transport/test_support.rs +252 -0
- package/crates/team-agent/src/transport/tests/behavior.rs +327 -0
- package/crates/team-agent/src/transport/tests/mod.rs +199 -0
- package/crates/team-agent/src/transport/tests/wire.rs +527 -0
- package/crates/team-agent/src/transport.rs +774 -0
- package/npm/install.mjs +90 -106
- package/package.json +15 -13
- package/crates/team-agent-core/Cargo.toml +0 -12
- package/crates/team-agent-core/src/lib.rs +0 -332
- package/crates/team-agent-core/src/main.rs +0 -152
- package/pyproject.toml +0 -18
- package/scripts/install.py +0 -88
- package/scripts/run_regression_tests.py +0 -83
- package/src/team_agent/__init__.py +0 -3
- package/src/team_agent/__main__.py +0 -5
- package/src/team_agent/_legacy_pane_discovery.py +0 -186
- package/src/team_agent/abnormal_track.py +0 -253
- package/src/team_agent/approvals/__init__.py +0 -65
- package/src/team_agent/approvals/constants.py +0 -6
- package/src/team_agent/approvals/parsing.py +0 -176
- package/src/team_agent/approvals/runtime_prompts.py +0 -171
- package/src/team_agent/approvals/status.py +0 -176
- package/src/team_agent/cli/__init__.py +0 -137
- package/src/team_agent/cli/commands.py +0 -481
- package/src/team_agent/cli/e2e.py +0 -202
- package/src/team_agent/cli/helpers.py +0 -226
- package/src/team_agent/cli/parser.py +0 -540
- package/src/team_agent/compiler.py +0 -334
- package/src/team_agent/coordinator/__init__.py +0 -53
- package/src/team_agent/coordinator/__main__.py +0 -119
- package/src/team_agent/coordinator/lifecycle.py +0 -411
- package/src/team_agent/coordinator/metadata.py +0 -61
- package/src/team_agent/coordinator/paths.py +0 -17
- package/src/team_agent/diagnose/__init__.py +0 -48
- package/src/team_agent/diagnose/checks.py +0 -101
- package/src/team_agent/diagnose/comms.py +0 -213
- package/src/team_agent/diagnose/health.py +0 -241
- package/src/team_agent/diagnose/orphan_cleanup.py +0 -364
- package/src/team_agent/diagnose/preflight.py +0 -194
- package/src/team_agent/diagnose/quick_start.py +0 -324
- package/src/team_agent/display/__init__.py +0 -92
- package/src/team_agent/display/adaptive.py +0 -511
- package/src/team_agent/display/backend.py +0 -46
- package/src/team_agent/display/close.py +0 -154
- package/src/team_agent/display/ghostty.py +0 -77
- package/src/team_agent/display/rebuild.py +0 -102
- package/src/team_agent/display/tiling.py +0 -156
- package/src/team_agent/display/worker_window.py +0 -114
- package/src/team_agent/display/workspace.py +0 -382
- package/src/team_agent/errors.py +0 -10
- package/src/team_agent/events.py +0 -84
- package/src/team_agent/fake_worker.py +0 -80
- package/src/team_agent/idle_predicate.py +0 -218
- package/src/team_agent/idle_takeover.py +0 -59
- package/src/team_agent/idle_takeover_wiring.py +0 -114
- package/src/team_agent/launch/__init__.py +0 -41
- package/src/team_agent/launch/bootstrap.py +0 -85
- package/src/team_agent/launch/config.py +0 -106
- package/src/team_agent/launch/core.py +0 -301
- package/src/team_agent/launch/requirements.py +0 -57
- package/src/team_agent/leader/__init__.py +0 -926
- package/src/team_agent/leader_binding.py +0 -183
- package/src/team_agent/lifecycle/__init__.py +0 -5
- package/src/team_agent/lifecycle/agents.py +0 -278
- package/src/team_agent/lifecycle/operations.py +0 -411
- package/src/team_agent/lifecycle/paste_buffer_hygiene.py +0 -39
- package/src/team_agent/lifecycle/start.py +0 -363
- package/src/team_agent/mcp_server/__init__.py +0 -42
- package/src/team_agent/mcp_server/__main__.py +0 -7
- package/src/team_agent/mcp_server/contracts.py +0 -148
- package/src/team_agent/mcp_server/normalize.py +0 -257
- package/src/team_agent/mcp_server/server.py +0 -150
- package/src/team_agent/mcp_server/tools.py +0 -352
- package/src/team_agent/message_store/__init__.py +0 -23
- package/src/team_agent/message_store/agent_health.py +0 -113
- package/src/team_agent/message_store/core.py +0 -497
- package/src/team_agent/message_store/leader_notification_log.py +0 -198
- package/src/team_agent/message_store/result_watchers.py +0 -251
- package/src/team_agent/message_store/schema.py +0 -308
- package/src/team_agent/message_store/schema_migration.py +0 -448
- package/src/team_agent/messaging/__init__.py +0 -1
- package/src/team_agent/messaging/activity_detector.py +0 -262
- package/src/team_agent/messaging/delivery.py +0 -504
- package/src/team_agent/messaging/deps.py +0 -247
- package/src/team_agent/messaging/idle_alerts.py +0 -423
- package/src/team_agent/messaging/internal_delivery.py +0 -46
- package/src/team_agent/messaging/leader.py +0 -497
- package/src/team_agent/messaging/leader_api_errors.py +0 -216
- package/src/team_agent/messaging/leader_panes.py +0 -673
- package/src/team_agent/messaging/owner_bypass.py +0 -29
- package/src/team_agent/messaging/result_delivery.py +0 -539
- package/src/team_agent/messaging/results.py +0 -447
- package/src/team_agent/messaging/scheduler.py +0 -450
- package/src/team_agent/messaging/send.py +0 -532
- package/src/team_agent/messaging/session_drift.py +0 -94
- package/src/team_agent/messaging/tmux_io.py +0 -506
- package/src/team_agent/messaging/tmux_prompt.py +0 -338
- package/src/team_agent/messaging/trust_auto_answer.py +0 -52
- package/src/team_agent/orchestrator/__init__.py +0 -376
- package/src/team_agent/orchestrator/plan.py +0 -122
- package/src/team_agent/orchestrator/state.py +0 -128
- package/src/team_agent/paths.py +0 -45
- package/src/team_agent/permissions.py +0 -123
- package/src/team_agent/profiles/__init__.py +0 -82
- package/src/team_agent/profiles/constants.py +0 -19
- package/src/team_agent/profiles/core.py +0 -407
- package/src/team_agent/profiles/helpers.py +0 -69
- package/src/team_agent/profiles/provider_env.py +0 -188
- package/src/team_agent/profiles/smoke.py +0 -201
- package/src/team_agent/provider_cli/__init__.py +0 -43
- package/src/team_agent/provider_cli/adapter.py +0 -172
- package/src/team_agent/provider_cli/base.py +0 -48
- package/src/team_agent/provider_cli/claude.py +0 -503
- package/src/team_agent/provider_cli/codex.py +0 -336
- package/src/team_agent/provider_cli/copilot.py +0 -8
- package/src/team_agent/provider_cli/fake.py +0 -39
- package/src/team_agent/provider_cli/gemini.py +0 -95
- package/src/team_agent/provider_cli/opencode.py +0 -8
- package/src/team_agent/provider_cli/prompt.py +0 -62
- package/src/team_agent/provider_cli/registry.py +0 -18
- package/src/team_agent/provider_cli/unsupported.py +0 -32
- package/src/team_agent/provider_state/README.md +0 -78
- package/src/team_agent/provider_state/__init__.py +0 -91
- package/src/team_agent/provider_state/claude.py +0 -86
- package/src/team_agent/provider_state/codex.py +0 -84
- package/src/team_agent/provider_state/common.py +0 -207
- package/src/team_agent/provider_state/registry.py +0 -118
- package/src/team_agent/providers.py +0 -163
- package/src/team_agent/quality_gates.py +0 -104
- package/src/team_agent/restart/__init__.py +0 -34
- package/src/team_agent/restart/orchestration.py +0 -554
- package/src/team_agent/restart/selection.py +0 -89
- package/src/team_agent/restart/snapshot.py +0 -70
- package/src/team_agent/routing.py +0 -84
- package/src/team_agent/runtime.py +0 -1243
- package/src/team_agent/rust_core.py +0 -327
- package/src/team_agent/sessions/__init__.py +0 -25
- package/src/team_agent/sessions/capture.py +0 -144
- package/src/team_agent/sessions/inventory.py +0 -44
- package/src/team_agent/sessions/resume.py +0 -135
- package/src/team_agent/simple_yaml.py +0 -236
- package/src/team_agent/spec.py +0 -370
- package/src/team_agent/state.py +0 -693
- package/src/team_agent/status/__init__.py +0 -63
- package/src/team_agent/status/approvals.py +0 -52
- package/src/team_agent/status/compact.py +0 -158
- package/src/team_agent/status/constants.py +0 -18
- package/src/team_agent/status/inbox.py +0 -58
- package/src/team_agent/status/peek.py +0 -117
- package/src/team_agent/status/queries.py +0 -199
- package/src/team_agent/task_graph.py +0 -80
- package/src/team_agent/terminal.py +0 -57
- package/src/team_agent/wake.py +0 -58
- package/src/team_agent/watch/__init__.py +0 -145
|
@@ -0,0 +1,605 @@
|
|
|
1
|
+
//! cli · types — 错误信封 / 退出码 / 命令结果载体 / leader passthrough 参数 /
|
|
2
|
+
//! 每子命令的 clap-style arg 结构 / 五行 summary 计数桶。
|
|
3
|
+
|
|
4
|
+
use super::*;
|
|
5
|
+
|
|
6
|
+
// =============================================================================
|
|
7
|
+
// ERRORS / EXIT(helpers.py `_emit_cli_error` / `_cli_error_payload`)
|
|
8
|
+
// =============================================================================
|
|
9
|
+
|
|
10
|
+
/// CLI 顶层错误信封(`_cli_error_payload`,`helpers.py:137-155`)。`--json` 时序列化为
|
|
11
|
+
/// `{ok:false, error, action, log, reason?, session_name?, next_actions?}`(字节级保留)。
|
|
12
|
+
/// 人读时打 `error:`/`action:`/`log:` 三行到 stderr(`helpers.py:132-134`)。
|
|
13
|
+
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
|
14
|
+
pub struct CliErrorPayload {
|
|
15
|
+
/// 恒 `false`(错误信封)。
|
|
16
|
+
pub ok: bool,
|
|
17
|
+
pub error: String,
|
|
18
|
+
pub action: String,
|
|
19
|
+
/// `.team/logs/cli-error-<ts>.log` 路径(mkdir 失败 fallback cwd,`helpers.py:122-125`)。
|
|
20
|
+
pub log: String,
|
|
21
|
+
/// tmux session 冲突时富化 `tmux_session_name_conflict`(`helpers.py:146-154`)。
|
|
22
|
+
#[serde(skip_serializing_if = "Option::is_none")]
|
|
23
|
+
pub reason: Option<String>,
|
|
24
|
+
#[serde(skip_serializing_if = "Option::is_none")]
|
|
25
|
+
pub session_name: Option<String>,
|
|
26
|
+
#[serde(skip_serializing_if = "Option::is_none")]
|
|
27
|
+
pub next_actions: Option<Vec<String>>,
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/// CLI 层错误(lib 边界 thiserror,§12)。bin main 经 [`run`] 把它落盘 + 转
|
|
31
|
+
/// [`CliErrorPayload`] + 退出码 1(`main` `except → _emit_cli_error → SystemExit(1)`)。
|
|
32
|
+
#[derive(Debug, Error)]
|
|
33
|
+
pub enum CliError {
|
|
34
|
+
/// 委派的 runtime/lifecycle/state 错误(对应 Python `TeamAgentError`)。message == `str(exc)`。
|
|
35
|
+
#[error("{0}")]
|
|
36
|
+
Runtime(String),
|
|
37
|
+
/// argparse 风格用法错误 / 互斥违反(如 `--summary` + `--json`、`--fix` 缺 `--gate`、
|
|
38
|
+
/// `peek` 缺 `--allow-raw-screen`)。对应 Python 抛 `TeamAgentError` 或 parser.error。
|
|
39
|
+
#[error("usage error: {0}")]
|
|
40
|
+
Usage(String),
|
|
41
|
+
/// state 解析失败(歧义/未找到 team 等)。透传 step 5。
|
|
42
|
+
#[error("{0}")]
|
|
43
|
+
State(#[from] crate::state::StateError),
|
|
44
|
+
/// messaging 委派失败(send/collect/stuck)。透传 step 11。
|
|
45
|
+
#[error("{0}")]
|
|
46
|
+
Messaging(crate::messaging::MessagingError),
|
|
47
|
+
/// I/O(cli-error 落盘、inbox 游标读写)。bug-084:写路径降级,不裸 panic。
|
|
48
|
+
#[error("io: {0}")]
|
|
49
|
+
Io(#[from] std::io::Error),
|
|
50
|
+
/// JSON 解析(`validate-result` 读 envelope)。
|
|
51
|
+
#[error("json: {0}")]
|
|
52
|
+
Json(#[from] serde_json::Error),
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
impl From<crate::messaging::MessagingError> for CliError {
|
|
56
|
+
fn from(error: crate::messaging::MessagingError) -> Self {
|
|
57
|
+
match error {
|
|
58
|
+
crate::messaging::MessagingError::Validation(message)
|
|
59
|
+
if message.starts_with("unknown task id:") =>
|
|
60
|
+
{
|
|
61
|
+
CliError::Runtime(message)
|
|
62
|
+
}
|
|
63
|
+
other => CliError::Messaging(other),
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
impl CliError {
|
|
69
|
+
/// `_cli_error_payload`(`helpers.py:137-155`):落盘日志后构造稳定信封。tmux session
|
|
70
|
+
/// 冲突时按 command 富化 reason/session_name/next_actions(`helpers.py:158-187`)。
|
|
71
|
+
pub fn to_payload(&self, log_path: &Path, command: &str) -> CliErrorPayload {
|
|
72
|
+
let error = self.to_string();
|
|
73
|
+
let mut payload = CliErrorPayload {
|
|
74
|
+
ok: false,
|
|
75
|
+
error: error.clone(),
|
|
76
|
+
action: "run `team-agent doctor` or inspect the log path shown here".to_string(),
|
|
77
|
+
log: log_path.to_string_lossy().to_string(),
|
|
78
|
+
reason: None,
|
|
79
|
+
session_name: None,
|
|
80
|
+
next_actions: None,
|
|
81
|
+
};
|
|
82
|
+
if let Some(session) = tmux_conflict_session(&error) {
|
|
83
|
+
payload.reason = Some("tmux_session_name_conflict".to_string());
|
|
84
|
+
payload.session_name = Some(session.clone());
|
|
85
|
+
if command == "quick-start" {
|
|
86
|
+
payload.action = format!(
|
|
87
|
+
"tmux session `{session}` already exists. It may be an active team. Do not terminate existing tmux sessions from quick-start; change `name:` in TEAM.md and run quick-start again."
|
|
88
|
+
);
|
|
89
|
+
payload.next_actions = Some(vec![
|
|
90
|
+
"Change `name:` in TEAM.md and run `team-agent quick-start` again.".to_string(),
|
|
91
|
+
]);
|
|
92
|
+
} else {
|
|
93
|
+
payload.action = format!(
|
|
94
|
+
"tmux session `{session}` already exists. It may be an active team. Do not terminate existing tmux sessions from startup; use a different team name or runtime.session_name and start again."
|
|
95
|
+
);
|
|
96
|
+
payload.next_actions = Some(vec![
|
|
97
|
+
"Use a different team name or runtime.session_name before starting again.".to_string(),
|
|
98
|
+
]);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
payload
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/// CLI 进程退出码(`main`:`result.ok is False` 或异常 → `SystemExit(1)`,否则 0)。
|
|
106
|
+
/// `watch` 路径直接 `SystemExit(0)`(`cmd_watch`)。
|
|
107
|
+
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
|
108
|
+
pub enum ExitCode {
|
|
109
|
+
Ok,
|
|
110
|
+
Error,
|
|
111
|
+
Usage,
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
impl ExitCode {
|
|
115
|
+
pub fn code(self) -> i32 {
|
|
116
|
+
match self {
|
|
117
|
+
ExitCode::Ok => 0,
|
|
118
|
+
ExitCode::Error => 1,
|
|
119
|
+
ExitCode::Usage => 2,
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// =============================================================================
|
|
125
|
+
// 命令结果(每个 subcommand handler 返回的 typed 富载体)
|
|
126
|
+
// =============================================================================
|
|
127
|
+
|
|
128
|
+
/// 单条 subcommand 的输出载体(`cmd_*` 的返回 + `emit` 的输入,`helpers.py:12-23`)。
|
|
129
|
+
/// Python `cmd_*` 返回 `dict | str | None`:
|
|
130
|
+
/// - `Json(Value)` ← 委派 runtime 的稳定 `{ok, ...}` dict(`--json` 序列化 sort_keys+indent=2)。
|
|
131
|
+
/// - `Human(String)` ← 人读渲染(`format_status`/`cmd_advanced`/五行 summary/comms boundary text)。
|
|
132
|
+
/// - `None` ← passthrough/watch 命令(`cmd_codex`/`cmd_claude`/`cmd_watch`,直接 SystemExit,无 emit)。
|
|
133
|
+
#[derive(Debug, Clone, PartialEq)]
|
|
134
|
+
pub enum CmdOutput {
|
|
135
|
+
/// 机器可读稳定 dict(`--json` 路径或 `result.get("ok") is False` 路径)。
|
|
136
|
+
Json(Value),
|
|
137
|
+
/// 人读字符串(`emit` 非 dict 分支直接 print)。
|
|
138
|
+
Human(String),
|
|
139
|
+
/// 无输出(passthrough/watch;不经 `emit`)。
|
|
140
|
+
None,
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/// subcommand handler 的统一返回(card:"each returns a typed CmdResult + CliError")。
|
|
144
|
+
/// 携带:输出载体 + 派生退出码 + 命令后是否需吐 leader inbox 摘要。
|
|
145
|
+
/// `main` 据 `output` 走 `emit`,据 `exit` 决定 `SystemExit`(`parser.py:494-508`)。
|
|
146
|
+
#[derive(Debug, Clone, PartialEq)]
|
|
147
|
+
pub struct CmdResult {
|
|
148
|
+
pub output: CmdOutput,
|
|
149
|
+
/// `result.get("ok") is False` → `ExitCode::Error`(`parser.py:507-508`),否则 `Ok`。
|
|
150
|
+
pub exit: ExitCode,
|
|
151
|
+
/// `--json` 旗标(决定 `emit` 与 inbox 摘要落 stderr vs stdout,`parser.py:505-506`)。
|
|
152
|
+
pub as_json: bool,
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
impl CmdResult {
|
|
156
|
+
/// 委派 dict 结果 → CmdResult(从 `{ok:..}` 推 exit code)。
|
|
157
|
+
pub fn from_json(value: Value, as_json: bool) -> Self {
|
|
158
|
+
let exit = if value.get("ok").and_then(Value::as_bool) == Some(false) {
|
|
159
|
+
ExitCode::Error
|
|
160
|
+
} else {
|
|
161
|
+
ExitCode::Ok
|
|
162
|
+
};
|
|
163
|
+
Self {
|
|
164
|
+
output: CmdOutput::Json(value),
|
|
165
|
+
exit,
|
|
166
|
+
as_json,
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
pub fn human(text: impl Into<String>) -> Self {
|
|
170
|
+
Self {
|
|
171
|
+
output: CmdOutput::Human(text.into()),
|
|
172
|
+
exit: ExitCode::Ok,
|
|
173
|
+
as_json: false,
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
pub fn none() -> Self {
|
|
177
|
+
Self {
|
|
178
|
+
output: CmdOutput::None,
|
|
179
|
+
exit: ExitCode::Ok,
|
|
180
|
+
as_json: false,
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// =============================================================================
|
|
186
|
+
// `codex`/`claude` passthrough 解析(helpers.py `_provider_args`/`_leader_launcher_args`)
|
|
187
|
+
// =============================================================================
|
|
188
|
+
|
|
189
|
+
/// `_leader_launcher_args`(`helpers.py:196-226`):leader passthrough 的 `--`/`--attach`/
|
|
190
|
+
/// `--attach-existing`/`--confirm`/`--attach-session[=]` 解析结果(`AttachLauncherArgs`)。
|
|
191
|
+
#[derive(Debug, Clone, PartialEq, Eq, Default)]
|
|
192
|
+
pub struct LeaderLauncherArgs {
|
|
193
|
+
/// `--` 之后或非旗标的透传给 provider 的 args。
|
|
194
|
+
pub provider_args: Vec<String>,
|
|
195
|
+
/// `--attach`/`--attach-existing`。
|
|
196
|
+
pub attach_existing: bool,
|
|
197
|
+
/// `--confirm`。
|
|
198
|
+
pub confirm_attach: bool,
|
|
199
|
+
/// `--attach-session <name>` / `--attach-session=<name>`。
|
|
200
|
+
pub attach_session: Option<String>,
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
// =============================================================================
|
|
204
|
+
// 五行 triage summary 计数桶(commands.py `_agent_summary_counts` / `_interaction_counts`)
|
|
205
|
+
// =============================================================================
|
|
206
|
+
|
|
207
|
+
/// 五行 triage 的 agent 分类桶(`_agent_summary_counts`,`commands.py:309-330`)。
|
|
208
|
+
/// **bug-071/077/085 铁律(§11)**:`blocked/awaiting_approval/interrupted/missing/stuck/uncertain`
|
|
209
|
+
/// 及任何无匹配态显式落 [`Unknown`](`else: unknown += 1`),**绝不 fallthrough 成 idle**。
|
|
210
|
+
/// 穷尽 match 在编译期防漏 idle 臂。
|
|
211
|
+
///
|
|
212
|
+
/// [`Unknown`]: SummaryBucket::Unknown
|
|
213
|
+
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
|
214
|
+
pub enum SummaryBucket {
|
|
215
|
+
Running,
|
|
216
|
+
Busy,
|
|
217
|
+
Idle,
|
|
218
|
+
Stopped,
|
|
219
|
+
Failed,
|
|
220
|
+
Unknown,
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/// 五行 summary 的 agent 计数(`_agent_summary_counts` 返回的 dict 的 typed 版)。
|
|
224
|
+
/// 渲染 line[2] 的 `running=.. busy=.. idle=.. stopped=.. failed=.. unknown=..`(Gap 18a 字节锁)。
|
|
225
|
+
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
|
|
226
|
+
pub struct SummaryCounts {
|
|
227
|
+
pub running: usize,
|
|
228
|
+
pub busy: usize,
|
|
229
|
+
pub idle: usize,
|
|
230
|
+
pub stopped: usize,
|
|
231
|
+
pub failed: usize,
|
|
232
|
+
pub unknown: usize,
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
impl SummaryCounts {
|
|
236
|
+
pub fn total(self) -> usize {
|
|
237
|
+
self.running + self.busy + self.idle + self.stopped + self.failed + self.unknown
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/// `interacted` marker 计数(`_interaction_counts`,`commands.py:292-306`)。源自 status 富化的
|
|
242
|
+
/// 每-agent `interacted` 字段(非空且 ≠ `"never"` 计 interacted,否则 never)。
|
|
243
|
+
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
|
|
244
|
+
pub struct InteractionCounts {
|
|
245
|
+
pub interacted: usize,
|
|
246
|
+
pub never: usize,
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
// =============================================================================
|
|
250
|
+
// clap-style arg structs(每个子命令一个;字段名 == argparse dest)
|
|
251
|
+
// =============================================================================
|
|
252
|
+
|
|
253
|
+
/// `quick-start`(`parser.py:105`)。
|
|
254
|
+
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
255
|
+
pub struct QuickStartArgs {
|
|
256
|
+
pub agents_dir: PathBuf,
|
|
257
|
+
pub name: Option<String>,
|
|
258
|
+
pub team_id: Option<String>,
|
|
259
|
+
pub yes: bool,
|
|
260
|
+
pub fresh: bool,
|
|
261
|
+
pub json: bool,
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
/// `init`(`parser.py` bootstrap verb)。
|
|
265
|
+
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
266
|
+
pub struct InitArgs {
|
|
267
|
+
pub workspace: PathBuf,
|
|
268
|
+
pub force: bool,
|
|
269
|
+
pub json: bool,
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/// `compile`(`parser.py:125`)。
|
|
273
|
+
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
274
|
+
pub struct CompileArgs {
|
|
275
|
+
pub team: PathBuf,
|
|
276
|
+
pub out: PathBuf,
|
|
277
|
+
pub json: bool,
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/// `send`(`parser.py:262`)。`target` xor `--to`(fanout);`message` 多 token join 空格。
|
|
281
|
+
#[derive(Debug, Clone, PartialEq)]
|
|
282
|
+
pub struct SendArgs {
|
|
283
|
+
pub target: Option<String>,
|
|
284
|
+
pub message: Vec<String>,
|
|
285
|
+
/// `--to a,b,c`(comma-split fanout)。
|
|
286
|
+
pub targets: Option<String>,
|
|
287
|
+
pub workspace: PathBuf,
|
|
288
|
+
pub team: Option<String>,
|
|
289
|
+
pub task: Option<String>,
|
|
290
|
+
pub sender: String,
|
|
291
|
+
pub no_ack: bool,
|
|
292
|
+
pub no_wait: bool,
|
|
293
|
+
pub watch_result: bool,
|
|
294
|
+
pub timeout: f64,
|
|
295
|
+
pub confirm_human: bool,
|
|
296
|
+
pub json: bool,
|
|
297
|
+
/// `--message-id <id>` — caller-supplied idempotency key (CR-015/054).
|
|
298
|
+
/// When set, the store insert uses this id verbatim; a repeat with the same
|
|
299
|
+
/// id returns a `Duplicate` refusal instead of creating a second row.
|
|
300
|
+
pub message_id: Option<String>,
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/// `allow-peer-talk`(`parser.py`): allow direct peer communication between two agents.
|
|
304
|
+
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
305
|
+
pub struct AllowPeerTalkArgs {
|
|
306
|
+
pub a: String,
|
|
307
|
+
pub b: String,
|
|
308
|
+
pub workspace: PathBuf,
|
|
309
|
+
pub json: bool,
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/// `status`(`parser.py:182`)。`--summary`/`--json`/`--detail` 三态(summary xor json,见 `cmd_status`)。
|
|
313
|
+
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
314
|
+
pub struct StatusArgs {
|
|
315
|
+
pub agent: Option<String>,
|
|
316
|
+
pub workspace: PathBuf,
|
|
317
|
+
pub detail: bool,
|
|
318
|
+
pub summary: bool,
|
|
319
|
+
pub json: bool,
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
/// `watch`(`parser.py:190`)。无 `--json`(纯 stream 到 SystemExit)。
|
|
323
|
+
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
324
|
+
pub struct WatchArgs {
|
|
325
|
+
pub workspace: PathBuf,
|
|
326
|
+
pub team: Option<String>,
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
/// `approvals`(`parser.py:195`)。
|
|
330
|
+
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
331
|
+
pub struct ApprovalsArgs {
|
|
332
|
+
pub agent: Option<String>,
|
|
333
|
+
pub workspace: PathBuf,
|
|
334
|
+
pub json: bool,
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
/// `inbox`(`parser.py:217`)。`--since` ISO8601(claim-leader inbox_hint 复用)。
|
|
338
|
+
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
339
|
+
pub struct InboxArgs {
|
|
340
|
+
pub agent: String,
|
|
341
|
+
pub workspace: PathBuf,
|
|
342
|
+
pub limit: usize,
|
|
343
|
+
pub since: Option<String>,
|
|
344
|
+
pub json: bool,
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
/// `takeover`(`parser.py:242`)。`--confirm` 必需(覆写 recorded team_owner)。
|
|
348
|
+
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
349
|
+
pub struct TakeoverArgs {
|
|
350
|
+
pub workspace: PathBuf,
|
|
351
|
+
pub team: Option<String>,
|
|
352
|
+
pub confirm: bool,
|
|
353
|
+
pub json: bool,
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
/// `claim-leader`(`parser.py:249`)。`--confirm` 缺省 = dry-run 摘要。
|
|
357
|
+
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
358
|
+
pub struct ClaimLeaderArgs {
|
|
359
|
+
pub workspace: PathBuf,
|
|
360
|
+
pub team: Option<String>,
|
|
361
|
+
pub confirm: bool,
|
|
362
|
+
pub json: bool,
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
/// `identity`(`parser.py:256`)。
|
|
366
|
+
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
367
|
+
pub struct IdentityArgs {
|
|
368
|
+
pub workspace: PathBuf,
|
|
369
|
+
pub team: Option<String>,
|
|
370
|
+
pub json: bool,
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
/// `shutdown`(`parser.py:355`)。`--keep-logs` 默认 true。
|
|
374
|
+
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
375
|
+
pub struct ShutdownArgs {
|
|
376
|
+
pub workspace: PathBuf,
|
|
377
|
+
pub team: Option<String>,
|
|
378
|
+
pub keep_logs: bool,
|
|
379
|
+
pub json: bool,
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
/// `restart`(`parser.py:362`)。
|
|
383
|
+
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
384
|
+
pub struct RestartArgs {
|
|
385
|
+
pub workspace: PathBuf,
|
|
386
|
+
pub team: Option<String>,
|
|
387
|
+
pub allow_fresh: bool,
|
|
388
|
+
pub json: bool,
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
/// `start-agent`(`parser.py:369`)。
|
|
392
|
+
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
393
|
+
pub struct StartAgentArgs {
|
|
394
|
+
pub agent: String,
|
|
395
|
+
pub workspace: PathBuf,
|
|
396
|
+
pub team: Option<String>,
|
|
397
|
+
pub force: bool,
|
|
398
|
+
pub allow_fresh: bool,
|
|
399
|
+
pub no_display: bool,
|
|
400
|
+
pub json: bool,
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
/// `stop-agent`(`parser.py:379`)。
|
|
404
|
+
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
405
|
+
pub struct StopAgentArgs {
|
|
406
|
+
pub agent: String,
|
|
407
|
+
pub workspace: PathBuf,
|
|
408
|
+
pub team: Option<String>,
|
|
409
|
+
pub json: bool,
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
/// `reset-agent`(`parser.py:386`)。`--discard-session` 必需。
|
|
413
|
+
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
414
|
+
pub struct ResetAgentArgs {
|
|
415
|
+
pub agent: String,
|
|
416
|
+
pub workspace: PathBuf,
|
|
417
|
+
pub team: Option<String>,
|
|
418
|
+
pub discard_session: bool,
|
|
419
|
+
pub no_display: bool,
|
|
420
|
+
pub json: bool,
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
/// `add-agent`(`parser.py:395`)。`--role-file` 必需。
|
|
424
|
+
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
425
|
+
pub struct AddAgentArgs {
|
|
426
|
+
pub agent: String,
|
|
427
|
+
pub workspace: PathBuf,
|
|
428
|
+
pub team: Option<String>,
|
|
429
|
+
pub role_file: String,
|
|
430
|
+
pub no_display: bool,
|
|
431
|
+
pub json: bool,
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
/// `fork-agent`(`parser.py:404`)。`--as` 必需。
|
|
435
|
+
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
436
|
+
pub struct ForkAgentArgs {
|
|
437
|
+
pub source_agent: String,
|
|
438
|
+
pub workspace: PathBuf,
|
|
439
|
+
pub team: Option<String>,
|
|
440
|
+
pub as_agent: String,
|
|
441
|
+
pub label: Option<String>,
|
|
442
|
+
pub no_display: bool,
|
|
443
|
+
pub json: bool,
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
/// `remove-agent`(`parser.py:414`)。`--from-spec` 须配 `--confirm`。
|
|
447
|
+
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
448
|
+
pub struct RemoveAgentArgs {
|
|
449
|
+
pub agent: String,
|
|
450
|
+
pub workspace: PathBuf,
|
|
451
|
+
pub team: Option<String>,
|
|
452
|
+
pub from_spec: bool,
|
|
453
|
+
pub confirm: bool,
|
|
454
|
+
pub force: bool,
|
|
455
|
+
pub json: bool,
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
/// `stuck-list`(`parser.py:424`)。
|
|
459
|
+
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
460
|
+
pub struct StuckListArgs {
|
|
461
|
+
pub workspace: PathBuf,
|
|
462
|
+
pub json: bool,
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
/// `stuck-cancel`(`parser.py:429`)。`--alert-type` ∈ {stuck, idle_fallback, all},默认 stuck。
|
|
466
|
+
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
467
|
+
pub struct StuckCancelArgs {
|
|
468
|
+
pub agent: String,
|
|
469
|
+
pub workspace: PathBuf,
|
|
470
|
+
/// `None` 表 `all`(展开全集);`Some(AlertType)` 表单类型。
|
|
471
|
+
pub alert_type: Option<AlertType>,
|
|
472
|
+
pub json: bool,
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
/// `acknowledge-idle`(`parser.py:436`)。
|
|
476
|
+
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
477
|
+
pub struct AcknowledgeIdleArgs {
|
|
478
|
+
pub team: Option<String>,
|
|
479
|
+
pub workspace: PathBuf,
|
|
480
|
+
pub json: bool,
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
/// `doctor`(`parser.py:318`)。`--gate` ∈ {orphans, comms};`--fix` 须配 `--gate`(`cmd_doctor` 校验)。
|
|
484
|
+
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
485
|
+
pub struct DoctorArgs {
|
|
486
|
+
pub spec: Option<PathBuf>,
|
|
487
|
+
pub workspace: PathBuf,
|
|
488
|
+
/// `None` / `Some(Orphans)` / `Some(Comms)`。
|
|
489
|
+
pub gate: Option<DoctorGate>,
|
|
490
|
+
pub comms: bool,
|
|
491
|
+
pub team: Option<String>,
|
|
492
|
+
pub fix: bool,
|
|
493
|
+
pub fix_schema: bool,
|
|
494
|
+
pub cleanup_orphans: bool,
|
|
495
|
+
pub confirm: bool,
|
|
496
|
+
pub json: bool,
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
/// `doctor --gate` 选择(`commands.py:218-236`;clap choices)。
|
|
500
|
+
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
|
501
|
+
pub enum DoctorGate {
|
|
502
|
+
Orphans,
|
|
503
|
+
Comms,
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
/// `sessions`(`parser.py:230`)。
|
|
507
|
+
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
508
|
+
pub struct SessionsArgs {
|
|
509
|
+
pub workspace: PathBuf,
|
|
510
|
+
pub json: bool,
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
/// `validate [spec=team.spec.yaml] --json`(`parser.py:120`)。
|
|
514
|
+
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
515
|
+
pub struct ValidateArgs {
|
|
516
|
+
pub spec: PathBuf,
|
|
517
|
+
pub json: bool,
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
/// `profile {init,doctor,show}`(`parser.py:131`)。
|
|
521
|
+
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
522
|
+
pub struct ProfileArgs {
|
|
523
|
+
pub command: String,
|
|
524
|
+
pub name: String,
|
|
525
|
+
pub workspace: PathBuf,
|
|
526
|
+
pub team: Option<String>,
|
|
527
|
+
pub auth_mode: Option<String>,
|
|
528
|
+
pub json: bool,
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
/// `validate-result`(`parser.py:312`)。
|
|
532
|
+
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
533
|
+
pub struct ValidateResultArgs {
|
|
534
|
+
pub envelope: Option<String>,
|
|
535
|
+
pub file: Option<PathBuf>,
|
|
536
|
+
pub result: Option<String>,
|
|
537
|
+
pub json: bool,
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
/// `collect`(`parser.py:292`)。
|
|
541
|
+
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
542
|
+
pub struct CollectArgs {
|
|
543
|
+
pub workspace: PathBuf,
|
|
544
|
+
pub result_file: Option<PathBuf>,
|
|
545
|
+
pub json: bool,
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
/// `settle`(`parser.py:177`)。
|
|
549
|
+
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
550
|
+
pub struct SettleArgs {
|
|
551
|
+
pub workspace: PathBuf,
|
|
552
|
+
pub json: bool,
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
/// `repair-state`(`parser.py:303`)。
|
|
556
|
+
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
557
|
+
pub struct RepairStateArgs {
|
|
558
|
+
pub workspace: PathBuf,
|
|
559
|
+
pub task_id: String,
|
|
560
|
+
pub assignee: Option<String>,
|
|
561
|
+
pub status: String,
|
|
562
|
+
pub summary: Option<String>,
|
|
563
|
+
pub json: bool,
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
/// `diagnose`(`parser.py:298`) runtime health report, distinct from `doctor`.
|
|
567
|
+
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
568
|
+
pub struct DiagnoseArgs {
|
|
569
|
+
pub workspace: PathBuf,
|
|
570
|
+
pub json: bool,
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
/// `preflight`(`parser.py:160`)。
|
|
574
|
+
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
575
|
+
pub struct PreflightArgs {
|
|
576
|
+
pub team: PathBuf,
|
|
577
|
+
pub json: bool,
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
/// `wait-ready`(`parser.py:171`)。
|
|
581
|
+
#[derive(Debug, Clone, PartialEq)]
|
|
582
|
+
pub struct WaitReadyArgs {
|
|
583
|
+
pub workspace: PathBuf,
|
|
584
|
+
pub timeout: f64,
|
|
585
|
+
pub json: bool,
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
/// `e2e`(`parser.py:449`)。
|
|
589
|
+
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
590
|
+
pub struct E2eArgs {
|
|
591
|
+
pub workspace: PathBuf,
|
|
592
|
+
pub providers: Vec<String>,
|
|
593
|
+
pub real: bool,
|
|
594
|
+
pub json: bool,
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
/// `peek`(`parser.py:201`)。
|
|
598
|
+
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
599
|
+
pub struct PeekArgs {
|
|
600
|
+
pub agent: String,
|
|
601
|
+
pub workspace: PathBuf,
|
|
602
|
+
pub tail: usize,
|
|
603
|
+
pub allow_raw_screen: bool,
|
|
604
|
+
pub json: bool,
|
|
605
|
+
}
|