@team-agent/installer 0.5.85 → 0.5.86
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/mod.rs +0 -1
- package/crates/team-agent/src/compiler/tests.rs +13 -24
- package/crates/team-agent/src/compiler.rs +1 -50
- package/crates/team-agent/src/leader/start.rs +0 -2
- package/crates/team-agent/src/lifecycle/launch/add_agent.rs +0 -1
- package/crates/team-agent/src/lifecycle/launch/add_agent_state.rs +0 -1
- package/crates/team-agent/src/lifecycle/launch/agent_state.rs +0 -6
- package/crates/team-agent/src/lifecycle/launch/identity.rs +0 -1
- package/crates/team-agent/src/lifecycle/launch/layout.rs +0 -1
- package/crates/team-agent/src/lifecycle/launch/leader_context.rs +0 -1
- package/crates/team-agent/src/lifecycle/launch/mcp_config.rs +0 -58
- package/crates/team-agent/src/lifecycle/launch/ownership.rs +0 -1
- package/crates/team-agent/src/lifecycle/launch/pi_mcp.rs +0 -3
- package/crates/team-agent/src/lifecycle/launch/quick_start.rs +14 -24
- package/crates/team-agent/src/lifecycle/launch/quick_start_transport.rs +0 -1
- package/crates/team-agent/src/lifecycle/launch/readiness.rs +0 -1
- package/crates/team-agent/src/lifecycle/launch/spawn.rs +4 -8
- package/crates/team-agent/src/lifecycle/launch/spec_state.rs +0 -1
- package/crates/team-agent/src/lifecycle/launch/state_projection.rs +0 -1
- package/crates/team-agent/src/lifecycle/launch/worker_env.rs +0 -1
- package/crates/team-agent/src/lifecycle/launch.rs +0 -9
- package/crates/team-agent/src/lifecycle/restart/common.rs +4 -8
- package/crates/team-agent/src/lifecycle/tests/claude_compatible_config_red.rs +1 -3
- package/crates/team-agent/src/lifecycle/tests/clone_agent_preserves_source_tools.rs +42 -46
- package/crates/team-agent/src/lifecycle/tests/copilot_provider_red.rs +30 -44
- package/crates/team-agent/src/lifecycle/tests/core_034_real_red.rs +32 -77
- package/crates/team-agent/src/lifecycle/tests/launch_spawn.rs +2 -13
- package/crates/team-agent/src/lifecycle/tests/pi_catalog_red.rs +0 -1
- package/crates/team-agent/src/lifecycle/tests/pi_command_red.rs +0 -2
- package/crates/team-agent/src/lifecycle/tests/pi_compiler_red.rs +14 -85
- package/crates/team-agent/src/lifecycle/tests/pi_dual_entry_red.rs +1 -1
- package/crates/team-agent/src/lifecycle/tests/pi_executable_mcp_red.rs +0 -5
- package/crates/team-agent/src/lifecycle/tests/pi_session_delivery_red.rs +0 -1
- package/crates/team-agent/src/lifecycle/tests/restart_rebind_hotfix_252_red.rs +4 -4
- package/crates/team-agent/src/lifecycle/tests.rs +0 -1
- package/crates/team-agent/src/lifecycle/types.rs +0 -10
- package/crates/team-agent/src/lifecycle/worker_command_context.rs +4 -248
- package/crates/team-agent/src/model/enums.rs +0 -35
- package/crates/team-agent/src/model/mod.rs +0 -1
- package/crates/team-agent/src/model/spec.rs +23 -84
- package/crates/team-agent/src/provider/adapter.rs +48 -50
- package/crates/team-agent/src/provider/adapters/claude.rs +5 -30
- package/crates/team-agent/src/provider/adapters/codex.rs +5 -25
- package/crates/team-agent/src/provider/adapters/copilot.rs +8 -41
- package/crates/team-agent/src/provider/adapters/cursor_agent.rs +4 -8
- package/crates/team-agent/src/provider/adapters/grok.rs +5 -58
- package/crates/team-agent/src/provider/adapters/mod.rs +5 -7
- package/crates/team-agent/src/provider/adapters/pi.rs +1 -56
- package/crates/team-agent/src/provider/bypass_flags.rs +1 -2
- package/crates/team-agent/src/provider/session/capture.rs +4 -4
- package/crates/team-agent/src/provider/tests/adapter.rs +7 -24
- package/crates/team-agent/src/provider/types.rs +1 -1
- package/package.json +4 -4
- package/schemas/team.schema.json +4 -9
- package/crates/team-agent/src/lifecycle/tests/g1_silent_faces.rs +0 -784
- package/crates/team-agent/src/model/permissions.rs +0 -721
|
@@ -6,20 +6,18 @@
|
|
|
6
6
|
//! serde_json `preserve_order` 保证 child 迭代序 == Python 插入序。
|
|
7
7
|
//!
|
|
8
8
|
//! 本文件先落地 `validate_result_envelope`(自包含,step 7/11 的门)。`validate_spec`
|
|
9
|
-
//! 依赖 `
|
|
10
|
-
//! 待那几个叶子模块集成后再加。
|
|
9
|
+
//! 依赖 `find_dependency_cycle`(task_graph)+ yaml Value。
|
|
11
10
|
|
|
12
11
|
use std::path::Path;
|
|
13
12
|
|
|
14
13
|
use serde_json::Value;
|
|
15
14
|
|
|
16
|
-
use crate::model::enums::
|
|
15
|
+
use crate::model::enums::TaskStatus;
|
|
17
16
|
use crate::model::errors::ModelError;
|
|
18
17
|
use crate::model::ids::TaskId;
|
|
19
18
|
use crate::model::task_graph::{find_dependency_cycle, TaskNode};
|
|
20
19
|
use crate::model::yaml::Value as Yaml;
|
|
21
|
-
use crate::model::
|
|
22
|
-
use crate::provider::adapters::pi::first_unsupported_pi_tool_category;
|
|
20
|
+
use crate::model::yaml;
|
|
23
21
|
use crate::provider::wire::{is_claude_family, parse_canonical_provider};
|
|
24
22
|
|
|
25
23
|
/// result_envelope_v1 顶层 required(= allowed)。
|
|
@@ -333,12 +331,13 @@ fn basic_schema_errors(spec: &Yaml) -> Vec<String> {
|
|
|
333
331
|
if !matches!(mode, Some("supervisor_worker" | "swarm_limited")) {
|
|
334
332
|
e.push("/team/mode: invalid mode".to_string());
|
|
335
333
|
}
|
|
336
|
-
let leader_keys = &["id", "role", "provider", "model", "
|
|
334
|
+
let leader_keys = &["id", "role", "provider", "model", "context_policy"];
|
|
335
|
+
let leader_allowed = &["id", "role", "provider", "model", "tools", "context_policy"];
|
|
337
336
|
check_keys_y(
|
|
338
337
|
spec.get("leader"),
|
|
339
338
|
"/leader",
|
|
340
339
|
leader_keys,
|
|
341
|
-
|
|
340
|
+
leader_allowed,
|
|
342
341
|
&mut e,
|
|
343
342
|
);
|
|
344
343
|
let cp_keys = &[
|
|
@@ -407,7 +406,6 @@ fn check_agent(agent: &Yaml, path: &str, errors: &mut Vec<String>) {
|
|
|
407
406
|
"model",
|
|
408
407
|
"working_directory",
|
|
409
408
|
"system_prompt",
|
|
410
|
-
"tools",
|
|
411
409
|
"dangerously_skip_permissions",
|
|
412
410
|
"preferred_for",
|
|
413
411
|
"avoid_for",
|
|
@@ -483,7 +481,6 @@ fn check_agent(agent: &Yaml, path: &str, errors: &mut Vec<String>) {
|
|
|
483
481
|
&["inline", "file"],
|
|
484
482
|
errors,
|
|
485
483
|
);
|
|
486
|
-
check_list_y(agent.get("tools"), &format!("{path}/tools"), errors);
|
|
487
484
|
check_list_y(
|
|
488
485
|
agent.get("preferred_for"),
|
|
489
486
|
&format!("{path}/preferred_for"),
|
|
@@ -787,67 +784,6 @@ fn semantic_errors(spec: &Yaml, base_dir: &Path) -> Vec<String> {
|
|
|
787
784
|
));
|
|
788
785
|
}
|
|
789
786
|
}
|
|
790
|
-
let tools: Vec<&str> = agent
|
|
791
|
-
.get("tools")
|
|
792
|
-
.and_then(Yaml::as_list)
|
|
793
|
-
.unwrap_or(&[])
|
|
794
|
-
.iter()
|
|
795
|
-
.filter_map(Yaml::as_str)
|
|
796
|
-
.collect();
|
|
797
|
-
let expanded_tools = permissions::expand_tool_strings(tools);
|
|
798
|
-
for tool in &expanded_tools {
|
|
799
|
-
if !permissions::is_canonical_tool(tool) {
|
|
800
|
-
e.push(format!(
|
|
801
|
-
"/agents/{idx}/tools: unknown tool {}",
|
|
802
|
-
py_repr_str(tool)
|
|
803
|
-
));
|
|
804
|
-
}
|
|
805
|
-
}
|
|
806
|
-
if parse_canonical_provider(provider.and_then(Yaml::as_str).unwrap_or(""))
|
|
807
|
-
== Some(Provider::Pi)
|
|
808
|
-
{
|
|
809
|
-
if let Some(category) = first_unsupported_pi_tool_category(
|
|
810
|
-
expanded_tools
|
|
811
|
-
.iter()
|
|
812
|
-
.filter(|tool| permissions::is_canonical_tool(tool))
|
|
813
|
-
.map(String::as_str),
|
|
814
|
-
) {
|
|
815
|
-
e.push(format!(
|
|
816
|
-
"/agents/{idx}/tools: Pi does not support Team Agent tool category {category:?}; remove it from this agent's tools"
|
|
817
|
-
));
|
|
818
|
-
}
|
|
819
|
-
}
|
|
820
|
-
}
|
|
821
|
-
|
|
822
|
-
let leader_tools: Vec<&str> = leader
|
|
823
|
-
.and_then(|l| l.get("tools"))
|
|
824
|
-
.and_then(Yaml::as_list)
|
|
825
|
-
.unwrap_or(&[])
|
|
826
|
-
.iter()
|
|
827
|
-
.filter_map(Yaml::as_str)
|
|
828
|
-
.collect();
|
|
829
|
-
let expanded_leader_tools = permissions::expand_tool_strings(leader_tools);
|
|
830
|
-
for tool in &expanded_leader_tools {
|
|
831
|
-
if !permissions::is_canonical_tool(tool) {
|
|
832
|
-
e.push(format!(
|
|
833
|
-
"/leader/tools: unknown tool {}",
|
|
834
|
-
py_repr_str(tool)
|
|
835
|
-
));
|
|
836
|
-
}
|
|
837
|
-
}
|
|
838
|
-
if parse_canonical_provider(leader_provider.and_then(Yaml::as_str).unwrap_or(""))
|
|
839
|
-
== Some(Provider::Pi)
|
|
840
|
-
{
|
|
841
|
-
if let Some(category) = first_unsupported_pi_tool_category(
|
|
842
|
-
expanded_leader_tools
|
|
843
|
-
.iter()
|
|
844
|
-
.filter(|tool| permissions::is_canonical_tool(tool))
|
|
845
|
-
.map(String::as_str),
|
|
846
|
-
) {
|
|
847
|
-
e.push(format!(
|
|
848
|
-
"/leader/tools: Pi does not support Team Agent tool category {category:?}; remove it from the leader's tools"
|
|
849
|
-
));
|
|
850
|
-
}
|
|
851
787
|
}
|
|
852
788
|
|
|
853
789
|
let routing = spec.get("routing");
|
|
@@ -1070,7 +1006,7 @@ mod tests {
|
|
|
1070
1006
|
}
|
|
1071
1007
|
|
|
1072
1008
|
#[test]
|
|
1073
|
-
fn
|
|
1009
|
+
fn tools_are_transparent_for_all_providers() {
|
|
1074
1010
|
let pi_text = include_str!("testdata/team.spec.yaml")
|
|
1075
1011
|
.lines()
|
|
1076
1012
|
.filter(|line| {
|
|
@@ -1093,22 +1029,26 @@ mod tests {
|
|
|
1093
1029
|
1,
|
|
1094
1030
|
);
|
|
1095
1031
|
let bad_agent = yaml::loads(&bad_agent_text).unwrap();
|
|
1096
|
-
let error = validate_spec(&bad_agent, Path::new(TD)).unwrap_err().to_string();
|
|
1097
1032
|
assert!(
|
|
1098
|
-
|
|
1099
|
-
"
|
|
1033
|
+
validate_spec(&bad_agent, Path::new(TD)).is_ok(),
|
|
1034
|
+
"Pi tools metadata must be ignored"
|
|
1100
1035
|
);
|
|
1101
1036
|
|
|
1102
|
-
let
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1037
|
+
let missing_tools = pi_text
|
|
1038
|
+
.replacen(
|
|
1039
|
+
" tools:\n - fs_read\n - fs_list\n - mcp_team\n",
|
|
1040
|
+
"",
|
|
1041
|
+
1,
|
|
1042
|
+
)
|
|
1043
|
+
.replacen(
|
|
1044
|
+
" tools:\n - fs_read\n - fs_write\n - fs_list\n - execute_bash\n - mcp_team\n",
|
|
1045
|
+
"",
|
|
1046
|
+
1,
|
|
1047
|
+
);
|
|
1048
|
+
let missing_tools = yaml::loads(&missing_tools).unwrap();
|
|
1109
1049
|
assert!(
|
|
1110
|
-
|
|
1111
|
-
"
|
|
1050
|
+
validate_spec(&missing_tools, Path::new(TD)).is_ok(),
|
|
1051
|
+
"omitted tools metadata must be accepted"
|
|
1112
1052
|
);
|
|
1113
1053
|
}
|
|
1114
1054
|
|
|
@@ -1121,7 +1061,6 @@ mod tests {
|
|
|
1121
1061
|
"/version: must equal 1",
|
|
1122
1062
|
"/team/mode: invalid mode",
|
|
1123
1063
|
"/leader/provider: unknown provider 'badprov'",
|
|
1124
|
-
"/agents/0/tools: unknown tool 'banana'",
|
|
1125
1064
|
]
|
|
1126
1065
|
);
|
|
1127
1066
|
}
|
|
@@ -54,27 +54,26 @@ pub trait ProviderAdapter {
|
|
|
54
54
|
model: Option<&str>,
|
|
55
55
|
) -> Result<Vec<String>, ProviderError>;
|
|
56
56
|
|
|
57
|
-
/// Same as [`ProviderAdapter::build_command`], with the
|
|
58
|
-
|
|
59
|
-
fn build_command_with_tools(
|
|
57
|
+
/// Same as [`ProviderAdapter::build_command`], with the explicit bypass flag.
|
|
58
|
+
fn build_command_with_permissions(
|
|
60
59
|
&self,
|
|
61
60
|
auth_mode: AuthMode,
|
|
62
61
|
mcp_config: Option<&McpConfig>,
|
|
63
62
|
system_prompt: Option<&str>,
|
|
64
63
|
model: Option<&str>,
|
|
65
|
-
|
|
64
|
+
dangerously_skip_permissions: bool,
|
|
66
65
|
) -> Result<Vec<String>, ProviderError>;
|
|
67
66
|
|
|
68
67
|
fn build_command_plan(
|
|
69
68
|
&self,
|
|
70
69
|
ctx: ProviderCommandContext<'_>,
|
|
71
70
|
) -> Result<CommandPlan, ProviderError> {
|
|
72
|
-
self.
|
|
71
|
+
self.build_command_with_permissions(
|
|
73
72
|
ctx.auth_mode,
|
|
74
73
|
ctx.mcp_config,
|
|
75
74
|
ctx.system_prompt,
|
|
76
75
|
ctx.model,
|
|
77
|
-
ctx.
|
|
76
|
+
ctx.dangerously_skip_permissions,
|
|
78
77
|
)
|
|
79
78
|
.map(CommandPlan::argv_only)
|
|
80
79
|
}
|
|
@@ -139,7 +138,7 @@ pub trait ProviderAdapter {
|
|
|
139
138
|
mcp_config: Option<&McpConfig>,
|
|
140
139
|
system_prompt: Option<&str>,
|
|
141
140
|
model: Option<&str>,
|
|
142
|
-
|
|
141
|
+
dangerously_skip_permissions: bool,
|
|
143
142
|
) -> Result<Vec<String>, ProviderError>;
|
|
144
143
|
|
|
145
144
|
fn build_resume_command_plan(
|
|
@@ -153,7 +152,7 @@ pub trait ProviderAdapter {
|
|
|
153
152
|
ctx.mcp_config,
|
|
154
153
|
ctx.system_prompt,
|
|
155
154
|
ctx.model,
|
|
156
|
-
ctx.
|
|
155
|
+
ctx.dangerously_skip_permissions,
|
|
157
156
|
)
|
|
158
157
|
.map(CommandPlan::argv_only)
|
|
159
158
|
}
|
|
@@ -174,7 +173,7 @@ pub trait ProviderAdapter {
|
|
|
174
173
|
mcp_config: Option<&McpConfig>,
|
|
175
174
|
system_prompt: Option<&str>,
|
|
176
175
|
model: Option<&str>,
|
|
177
|
-
|
|
176
|
+
dangerously_skip_permissions: bool,
|
|
178
177
|
) -> Result<Vec<String>, ProviderError>;
|
|
179
178
|
|
|
180
179
|
fn fork_plan(
|
|
@@ -188,7 +187,7 @@ pub trait ProviderAdapter {
|
|
|
188
187
|
ctx.mcp_config,
|
|
189
188
|
ctx.system_prompt,
|
|
190
189
|
ctx.model,
|
|
191
|
-
ctx.
|
|
190
|
+
ctx.dangerously_skip_permissions,
|
|
192
191
|
)
|
|
193
192
|
.map(CommandPlan::argv_only)
|
|
194
193
|
}
|
|
@@ -429,16 +428,16 @@ impl ProviderAdapter for BasicProviderAdapter {
|
|
|
429
428
|
system_prompt: Option<&str>,
|
|
430
429
|
model: Option<&str>,
|
|
431
430
|
) -> Result<Vec<String>, ProviderError> {
|
|
432
|
-
self.
|
|
431
|
+
self.build_command_with_permissions(auth_mode, mcp_config, system_prompt, model, false)
|
|
433
432
|
}
|
|
434
433
|
|
|
435
|
-
fn
|
|
434
|
+
fn build_command_with_permissions(
|
|
436
435
|
&self,
|
|
437
436
|
auth_mode: AuthMode,
|
|
438
437
|
mcp_config: Option<&McpConfig>,
|
|
439
438
|
system_prompt: Option<&str>,
|
|
440
439
|
model: Option<&str>,
|
|
441
|
-
|
|
440
|
+
dangerously_skip_permissions: bool,
|
|
442
441
|
) -> Result<Vec<String>, ProviderError> {
|
|
443
442
|
match self.provider {
|
|
444
443
|
Provider::Claude | Provider::ClaudeCode => Ok(claude_launch_command(
|
|
@@ -447,7 +446,7 @@ impl ProviderAdapter for BasicProviderAdapter {
|
|
|
447
446
|
mcp_config,
|
|
448
447
|
system_prompt,
|
|
449
448
|
model,
|
|
450
|
-
|
|
449
|
+
dangerously_skip_permissions,
|
|
451
450
|
)?),
|
|
452
451
|
Provider::Codex => Ok(codex_base_command(
|
|
453
452
|
None,
|
|
@@ -455,7 +454,7 @@ impl ProviderAdapter for BasicProviderAdapter {
|
|
|
455
454
|
mcp_config,
|
|
456
455
|
system_prompt,
|
|
457
456
|
model,
|
|
458
|
-
|
|
457
|
+
dangerously_skip_permissions,
|
|
459
458
|
None,
|
|
460
459
|
None,
|
|
461
460
|
)),
|
|
@@ -470,7 +469,7 @@ impl ProviderAdapter for BasicProviderAdapter {
|
|
|
470
469
|
mcp_config,
|
|
471
470
|
system_prompt,
|
|
472
471
|
model,
|
|
473
|
-
|
|
472
|
+
dangerously_skip_permissions,
|
|
474
473
|
)),
|
|
475
474
|
Provider::GeminiCli => {
|
|
476
475
|
let mut argv = vec!["gemini".to_string()];
|
|
@@ -486,7 +485,7 @@ impl ProviderAdapter for BasicProviderAdapter {
|
|
|
486
485
|
mcp_config,
|
|
487
486
|
system_prompt,
|
|
488
487
|
model,
|
|
489
|
-
|
|
488
|
+
dangerously_skip_permissions,
|
|
490
489
|
)?),
|
|
491
490
|
Provider::CursorAgent => Ok(cursor_agent_base_command(
|
|
492
491
|
self,
|
|
@@ -494,7 +493,7 @@ impl ProviderAdapter for BasicProviderAdapter {
|
|
|
494
493
|
mcp_config,
|
|
495
494
|
system_prompt,
|
|
496
495
|
model,
|
|
497
|
-
|
|
496
|
+
dangerously_skip_permissions,
|
|
498
497
|
false,
|
|
499
498
|
None,
|
|
500
499
|
)?),
|
|
@@ -542,7 +541,7 @@ impl ProviderAdapter for BasicProviderAdapter {
|
|
|
542
541
|
ctx.mcp_config,
|
|
543
542
|
ctx.system_prompt,
|
|
544
543
|
model,
|
|
545
|
-
ctx.
|
|
544
|
+
ctx.dangerously_skip_permissions,
|
|
546
545
|
managed,
|
|
547
546
|
ctx.effort,
|
|
548
547
|
)?;
|
|
@@ -581,7 +580,7 @@ impl ProviderAdapter for BasicProviderAdapter {
|
|
|
581
580
|
ctx.mcp_config,
|
|
582
581
|
ctx.system_prompt,
|
|
583
582
|
ctx.model,
|
|
584
|
-
ctx.
|
|
583
|
+
ctx.dangerously_skip_permissions,
|
|
585
584
|
ctx.profile_launch.map(|profile| &profile.command_overrides),
|
|
586
585
|
ctx.effort,
|
|
587
586
|
))),
|
|
@@ -602,7 +601,7 @@ impl ProviderAdapter for BasicProviderAdapter {
|
|
|
602
601
|
ctx.mcp_config,
|
|
603
602
|
ctx.system_prompt,
|
|
604
603
|
ctx.model,
|
|
605
|
-
ctx.
|
|
604
|
+
ctx.dangerously_skip_permissions,
|
|
606
605
|
ctx.profile_launch
|
|
607
606
|
.is_some_and(|profile| profile.managed_mcp_config),
|
|
608
607
|
ctx.effort,
|
|
@@ -623,7 +622,7 @@ impl ProviderAdapter for BasicProviderAdapter {
|
|
|
623
622
|
ctx.mcp_config,
|
|
624
623
|
ctx.system_prompt,
|
|
625
624
|
ctx.model,
|
|
626
|
-
ctx.
|
|
625
|
+
ctx.dangerously_skip_permissions,
|
|
627
626
|
);
|
|
628
627
|
argv.push("--session-id".to_string());
|
|
629
628
|
argv.push(expected.clone());
|
|
@@ -643,7 +642,7 @@ impl ProviderAdapter for BasicProviderAdapter {
|
|
|
643
642
|
ctx.mcp_config,
|
|
644
643
|
ctx.system_prompt,
|
|
645
644
|
ctx.model,
|
|
646
|
-
ctx.
|
|
645
|
+
ctx.dangerously_skip_permissions,
|
|
647
646
|
ctx.profile_launch
|
|
648
647
|
.is_some_and(|profile| profile.managed_mcp_config),
|
|
649
648
|
ctx.effort,
|
|
@@ -659,12 +658,12 @@ impl ProviderAdapter for BasicProviderAdapter {
|
|
|
659
658
|
"Pi commands require the shared lifecycle materializer".to_string(),
|
|
660
659
|
)),
|
|
661
660
|
_ => self
|
|
662
|
-
.
|
|
661
|
+
.build_command_with_permissions(
|
|
663
662
|
ctx.auth_mode,
|
|
664
663
|
ctx.mcp_config,
|
|
665
664
|
ctx.system_prompt,
|
|
666
665
|
ctx.model,
|
|
667
|
-
ctx.
|
|
666
|
+
ctx.dangerously_skip_permissions,
|
|
668
667
|
)
|
|
669
668
|
.map(CommandPlan::argv_only),
|
|
670
669
|
}
|
|
@@ -760,7 +759,7 @@ impl ProviderAdapter for BasicProviderAdapter {
|
|
|
760
759
|
auth_mode: AuthMode,
|
|
761
760
|
mcp_config: Option<&McpConfig>,
|
|
762
761
|
) -> Result<Vec<String>, ProviderError> {
|
|
763
|
-
self.build_resume_command_with_context(session_id, auth_mode, mcp_config, None, None,
|
|
762
|
+
self.build_resume_command_with_context(session_id, auth_mode, mcp_config, None, None, false)
|
|
764
763
|
}
|
|
765
764
|
|
|
766
765
|
fn build_resume_command_with_context(
|
|
@@ -770,7 +769,7 @@ impl ProviderAdapter for BasicProviderAdapter {
|
|
|
770
769
|
mcp_config: Option<&McpConfig>,
|
|
771
770
|
system_prompt: Option<&str>,
|
|
772
771
|
model: Option<&str>,
|
|
773
|
-
|
|
772
|
+
dangerously_skip_permissions: bool,
|
|
774
773
|
) -> Result<Vec<String>, ProviderError> {
|
|
775
774
|
if !self.session_is_resumable(session_id, auth_mode)? {
|
|
776
775
|
return Err(ProviderError::ResumeUnavailable(format!(
|
|
@@ -791,7 +790,7 @@ impl ProviderAdapter for BasicProviderAdapter {
|
|
|
791
790
|
mcp_config,
|
|
792
791
|
system_prompt,
|
|
793
792
|
model,
|
|
794
|
-
|
|
793
|
+
dangerously_skip_permissions,
|
|
795
794
|
None,
|
|
796
795
|
None,
|
|
797
796
|
);
|
|
@@ -805,7 +804,7 @@ impl ProviderAdapter for BasicProviderAdapter {
|
|
|
805
804
|
mcp_config,
|
|
806
805
|
system_prompt,
|
|
807
806
|
model,
|
|
808
|
-
|
|
807
|
+
dangerously_skip_permissions,
|
|
809
808
|
false,
|
|
810
809
|
None,
|
|
811
810
|
)?;
|
|
@@ -817,7 +816,7 @@ impl ProviderAdapter for BasicProviderAdapter {
|
|
|
817
816
|
// copilot --resume 接受 id|name)。
|
|
818
817
|
Provider::Copilot => {
|
|
819
818
|
let mut argv =
|
|
820
|
-
copilot_base_command_resume(auth_mode, mcp_config, system_prompt, model,
|
|
819
|
+
copilot_base_command_resume(auth_mode, mcp_config, system_prompt, model, dangerously_skip_permissions);
|
|
821
820
|
argv.push("--resume".to_string());
|
|
822
821
|
argv.push(session_id.as_str().to_string());
|
|
823
822
|
Ok(argv)
|
|
@@ -830,7 +829,7 @@ impl ProviderAdapter for BasicProviderAdapter {
|
|
|
830
829
|
mcp_config,
|
|
831
830
|
system_prompt,
|
|
832
831
|
model,
|
|
833
|
-
|
|
832
|
+
dangerously_skip_permissions,
|
|
834
833
|
false,
|
|
835
834
|
None,
|
|
836
835
|
)?;
|
|
@@ -846,7 +845,7 @@ impl ProviderAdapter for BasicProviderAdapter {
|
|
|
846
845
|
mcp_config,
|
|
847
846
|
system_prompt,
|
|
848
847
|
model,
|
|
849
|
-
|
|
848
|
+
dangerously_skip_permissions,
|
|
850
849
|
false,
|
|
851
850
|
None,
|
|
852
851
|
)?;
|
|
@@ -888,7 +887,7 @@ impl ProviderAdapter for BasicProviderAdapter {
|
|
|
888
887
|
ctx.mcp_config,
|
|
889
888
|
ctx.system_prompt,
|
|
890
889
|
model,
|
|
891
|
-
ctx.
|
|
890
|
+
ctx.dangerously_skip_permissions,
|
|
892
891
|
managed,
|
|
893
892
|
ctx.effort,
|
|
894
893
|
)?;
|
|
@@ -928,7 +927,7 @@ impl ProviderAdapter for BasicProviderAdapter {
|
|
|
928
927
|
ctx.mcp_config,
|
|
929
928
|
ctx.system_prompt,
|
|
930
929
|
ctx.model,
|
|
931
|
-
ctx.
|
|
930
|
+
ctx.dangerously_skip_permissions,
|
|
932
931
|
ctx.profile_launch.map(|profile| &profile.command_overrides),
|
|
933
932
|
ctx.effort,
|
|
934
933
|
);
|
|
@@ -947,7 +946,7 @@ impl ProviderAdapter for BasicProviderAdapter {
|
|
|
947
946
|
ctx.mcp_config,
|
|
948
947
|
ctx.system_prompt,
|
|
949
948
|
ctx.model,
|
|
950
|
-
ctx.
|
|
949
|
+
ctx.dangerously_skip_permissions,
|
|
951
950
|
ctx.profile_launch
|
|
952
951
|
.is_some_and(|profile| profile.managed_mcp_config),
|
|
953
952
|
ctx.effort,
|
|
@@ -974,7 +973,7 @@ impl ProviderAdapter for BasicProviderAdapter {
|
|
|
974
973
|
ctx.mcp_config,
|
|
975
974
|
ctx.system_prompt,
|
|
976
975
|
ctx.model,
|
|
977
|
-
ctx.
|
|
976
|
+
ctx.dangerously_skip_permissions,
|
|
978
977
|
ctx.profile_launch
|
|
979
978
|
.is_some_and(|profile| profile.managed_mcp_config),
|
|
980
979
|
ctx.effort,
|
|
@@ -990,7 +989,7 @@ impl ProviderAdapter for BasicProviderAdapter {
|
|
|
990
989
|
ctx.mcp_config,
|
|
991
990
|
ctx.system_prompt,
|
|
992
991
|
ctx.model,
|
|
993
|
-
ctx.
|
|
992
|
+
ctx.dangerously_skip_permissions,
|
|
994
993
|
)
|
|
995
994
|
.map(CommandPlan::argv_only),
|
|
996
995
|
}
|
|
@@ -1002,7 +1001,7 @@ impl ProviderAdapter for BasicProviderAdapter {
|
|
|
1002
1001
|
auth_mode: AuthMode,
|
|
1003
1002
|
mcp_config: Option<&McpConfig>,
|
|
1004
1003
|
) -> Result<Vec<String>, ProviderError> {
|
|
1005
|
-
self.fork_with_context(session_id, auth_mode, mcp_config, None, None,
|
|
1004
|
+
self.fork_with_context(session_id, auth_mode, mcp_config, None, None, false)
|
|
1006
1005
|
}
|
|
1007
1006
|
|
|
1008
1007
|
fn fork_with_context(
|
|
@@ -1012,7 +1011,7 @@ impl ProviderAdapter for BasicProviderAdapter {
|
|
|
1012
1011
|
mcp_config: Option<&McpConfig>,
|
|
1013
1012
|
system_prompt: Option<&str>,
|
|
1014
1013
|
model: Option<&str>,
|
|
1015
|
-
|
|
1014
|
+
dangerously_skip_permissions: bool,
|
|
1016
1015
|
) -> Result<Vec<String>, ProviderError> {
|
|
1017
1016
|
if !self.caps().fork || auth_mode == AuthMode::CompatibleApi {
|
|
1018
1017
|
return Err(ProviderError::CapabilityUnsupported(format!(
|
|
@@ -1033,7 +1032,7 @@ impl ProviderAdapter for BasicProviderAdapter {
|
|
|
1033
1032
|
mcp_config,
|
|
1034
1033
|
system_prompt,
|
|
1035
1034
|
model,
|
|
1036
|
-
|
|
1035
|
+
dangerously_skip_permissions,
|
|
1037
1036
|
None,
|
|
1038
1037
|
None,
|
|
1039
1038
|
);
|
|
@@ -1047,7 +1046,7 @@ impl ProviderAdapter for BasicProviderAdapter {
|
|
|
1047
1046
|
mcp_config,
|
|
1048
1047
|
system_prompt,
|
|
1049
1048
|
model,
|
|
1050
|
-
|
|
1049
|
+
dangerously_skip_permissions,
|
|
1051
1050
|
false,
|
|
1052
1051
|
None,
|
|
1053
1052
|
)?;
|
|
@@ -1073,7 +1072,7 @@ impl ProviderAdapter for BasicProviderAdapter {
|
|
|
1073
1072
|
mcp_config,
|
|
1074
1073
|
system_prompt,
|
|
1075
1074
|
model,
|
|
1076
|
-
|
|
1075
|
+
dangerously_skip_permissions,
|
|
1077
1076
|
false,
|
|
1078
1077
|
None,
|
|
1079
1078
|
)?;
|
|
@@ -1125,7 +1124,7 @@ impl ProviderAdapter for BasicProviderAdapter {
|
|
|
1125
1124
|
ctx.mcp_config,
|
|
1126
1125
|
ctx.system_prompt,
|
|
1127
1126
|
model,
|
|
1128
|
-
ctx.
|
|
1127
|
+
ctx.dangerously_skip_permissions,
|
|
1129
1128
|
managed,
|
|
1130
1129
|
ctx.effort,
|
|
1131
1130
|
)?;
|
|
@@ -1156,7 +1155,7 @@ impl ProviderAdapter for BasicProviderAdapter {
|
|
|
1156
1155
|
ctx.mcp_config,
|
|
1157
1156
|
ctx.system_prompt,
|
|
1158
1157
|
ctx.model,
|
|
1159
|
-
ctx.
|
|
1158
|
+
ctx.dangerously_skip_permissions,
|
|
1160
1159
|
ctx.profile_launch.map(|profile| &profile.command_overrides),
|
|
1161
1160
|
ctx.effort,
|
|
1162
1161
|
);
|
|
@@ -1197,7 +1196,7 @@ impl ProviderAdapter for BasicProviderAdapter {
|
|
|
1197
1196
|
ctx.mcp_config,
|
|
1198
1197
|
ctx.system_prompt,
|
|
1199
1198
|
ctx.model,
|
|
1200
|
-
ctx.
|
|
1199
|
+
ctx.dangerously_skip_permissions,
|
|
1201
1200
|
);
|
|
1202
1201
|
argv.push("--resume".to_string());
|
|
1203
1202
|
argv.push(expected.as_str().to_string());
|
|
@@ -1220,7 +1219,7 @@ impl ProviderAdapter for BasicProviderAdapter {
|
|
|
1220
1219
|
ctx.mcp_config,
|
|
1221
1220
|
ctx.system_prompt,
|
|
1222
1221
|
ctx.model,
|
|
1223
|
-
ctx.
|
|
1222
|
+
ctx.dangerously_skip_permissions,
|
|
1224
1223
|
ctx.profile_launch
|
|
1225
1224
|
.is_some_and(|profile| profile.managed_mcp_config),
|
|
1226
1225
|
ctx.effort,
|
|
@@ -1239,7 +1238,7 @@ impl ProviderAdapter for BasicProviderAdapter {
|
|
|
1239
1238
|
ctx.mcp_config,
|
|
1240
1239
|
ctx.system_prompt,
|
|
1241
1240
|
ctx.model,
|
|
1242
|
-
ctx.
|
|
1241
|
+
ctx.dangerously_skip_permissions,
|
|
1243
1242
|
)
|
|
1244
1243
|
.map(CommandPlan::argv_only),
|
|
1245
1244
|
}
|
|
@@ -1402,9 +1401,8 @@ pub(crate) fn json_inline(value: &serde_json::Value) -> String {
|
|
|
1402
1401
|
|
|
1403
1402
|
// 0.4.x decoupling step 2: provider-local command builders moved to provider/adapters/.
|
|
1404
1403
|
// Only the entry points the trait impl actually calls are re-imported here;
|
|
1405
|
-
//
|
|
1406
|
-
//
|
|
1407
|
-
// extracted base_command fns, not directly by this file.
|
|
1404
|
+
// The per-provider command helpers and MCP renderers are called from within
|
|
1405
|
+
// the extracted base-command functions, not directly by this file.
|
|
1408
1406
|
use super::adapters::claude::{claude_base_command, claude_launch_command};
|
|
1409
1407
|
use super::adapters::codex::codex_base_command;
|
|
1410
1408
|
use super::adapters::copilot::{copilot_base_command, copilot_base_command_resume};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
//!
|
|
4
4
|
//! Extracted from `provider/adapter.rs` (0.4.x decoupling step 2). Pure
|
|
5
5
|
//! extraction — byte-identical to the original inline forms. Scope kept
|
|
6
|
-
//! small on purpose: base command +
|
|
6
|
+
//! small on purpose: base command + launch wrapper +
|
|
7
7
|
//! launch wrapper. Auth hints (`claude_auth_hint`) and the context-aware model
|
|
8
8
|
//! resolver (`claude_context_model`) stay in `adapter.rs`; capture scanning
|
|
9
9
|
//! helpers now live under `provider/session_scan/claude.rs`.
|
|
@@ -18,7 +18,7 @@ pub(crate) fn claude_launch_command(
|
|
|
18
18
|
mcp_config: Option<&McpConfig>,
|
|
19
19
|
system_prompt: Option<&str>,
|
|
20
20
|
model: Option<&str>,
|
|
21
|
-
|
|
21
|
+
dangerously_skip_permissions: bool,
|
|
22
22
|
) -> Result<Vec<String>, ProviderError> {
|
|
23
23
|
let mut argv = claude_base_command(
|
|
24
24
|
adapter,
|
|
@@ -26,7 +26,7 @@ pub(crate) fn claude_launch_command(
|
|
|
26
26
|
mcp_config,
|
|
27
27
|
system_prompt,
|
|
28
28
|
model,
|
|
29
|
-
|
|
29
|
+
dangerously_skip_permissions,
|
|
30
30
|
false,
|
|
31
31
|
None,
|
|
32
32
|
)?;
|
|
@@ -41,14 +41,14 @@ pub(crate) fn claude_base_command(
|
|
|
41
41
|
mcp_config: Option<&McpConfig>,
|
|
42
42
|
system_prompt: Option<&str>,
|
|
43
43
|
model: Option<&str>,
|
|
44
|
-
|
|
44
|
+
dangerously_skip_permissions: bool,
|
|
45
45
|
managed_mcp_config: bool,
|
|
46
46
|
// 0.4.x provider effort MVP step 5: when Some, inject `--effort <level>`
|
|
47
47
|
// immediately after the model (before prompt/MCP).
|
|
48
48
|
effort: Option<crate::model::enums::ProviderEffort>,
|
|
49
49
|
) -> Result<Vec<String>, ProviderError> {
|
|
50
50
|
let mut argv = vec!["claude".to_string()];
|
|
51
|
-
if
|
|
51
|
+
if dangerously_skip_permissions {
|
|
52
52
|
// 0.5.66 bypass 单源:flag 由 provider_bypass_flag 表供给(单源)。
|
|
53
53
|
let flag = crate::provider::bypass_flags::provider_bypass_flag(Provider::Claude)
|
|
54
54
|
.expect("claude provider must define a bypass flag");
|
|
@@ -82,30 +82,5 @@ pub(crate) fn claude_base_command(
|
|
|
82
82
|
argv.push("--mcp-config".to_string());
|
|
83
83
|
argv.push(raw.to_string());
|
|
84
84
|
}
|
|
85
|
-
for tool in claude_disallowed_tools(tools) {
|
|
86
|
-
argv.push("--disallowedTools".to_string());
|
|
87
|
-
argv.push(tool.to_string());
|
|
88
|
-
}
|
|
89
85
|
Ok(argv)
|
|
90
86
|
}
|
|
91
|
-
|
|
92
|
-
pub(crate) fn claude_dangerous_auto_approve(tools: &[&str]) -> bool {
|
|
93
|
-
tools.contains(&"dangerous_auto_approve")
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
pub(crate) fn claude_disallowed_tools(tools: &[&str]) -> Vec<&'static str> {
|
|
97
|
-
let mut disallowed = Vec::new();
|
|
98
|
-
if !tools.contains(&"execute_bash") {
|
|
99
|
-
disallowed.push("Bash");
|
|
100
|
-
}
|
|
101
|
-
if !tools.contains(&"fs_read") {
|
|
102
|
-
disallowed.push("Read");
|
|
103
|
-
}
|
|
104
|
-
if !tools.contains(&"fs_write") {
|
|
105
|
-
disallowed.extend(["Edit", "Write", "MultiEdit", "NotebookEdit"]);
|
|
106
|
-
}
|
|
107
|
-
if !tools.contains(&"fs_list") {
|
|
108
|
-
disallowed.extend(["Glob", "Grep"]);
|
|
109
|
-
}
|
|
110
|
-
disallowed
|
|
111
|
-
}
|