@team-agent/installer 0.5.84 → 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/cli/profile.rs +4 -12
- package/crates/team-agent/src/cli/tests/verb_profile.rs +66 -0
- 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 +1 -89
- 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/profile_launch.rs +1 -1
- package/crates/team-agent/src/lifecycle/restart/common.rs +6 -9
- 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 +209 -52
- 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/messaging/results/collection_tests.rs +719 -0
- package/crates/team-agent/src/messaging/results.rs +104 -27
- 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 +9 -42
- 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/crates/team-agent/src/state/persist.rs +15 -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
|
@@ -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
|
-
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
//!
|
|
2
|
-
//! Codex provider-local command builder
|
|
2
|
+
//! Codex provider-local command builder.
|
|
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. Shared helper
|
|
6
6
|
//! `json_inline` stays in `adapter.rs` because it is also used by other
|
|
7
7
|
//! sites; this file reaches it via `super::*`.
|
|
8
8
|
|
|
9
|
-
use crate::model::enums::
|
|
9
|
+
use crate::model::enums::AuthMode;
|
|
10
10
|
use crate::provider::adapter::json_inline;
|
|
11
11
|
use crate::provider::{McpConfig, ProviderCommandOverrides};
|
|
12
12
|
|
|
@@ -16,7 +16,7 @@ pub(crate) fn codex_base_command(
|
|
|
16
16
|
mcp_config: Option<&McpConfig>,
|
|
17
17
|
system_prompt: Option<&str>,
|
|
18
18
|
model: Option<&str>,
|
|
19
|
-
|
|
19
|
+
dangerously_skip_permissions: bool,
|
|
20
20
|
overrides: Option<&ProviderCommandOverrides>,
|
|
21
21
|
// 0.4.x provider effort MVP step 6: when Some, inject
|
|
22
22
|
// `-c model_reasoning_effort=<level>` AFTER existing profile
|
|
@@ -40,16 +40,11 @@ pub(crate) fn codex_base_command(
|
|
|
40
40
|
argv.push("--profile".to_string());
|
|
41
41
|
argv.push(profile.to_string());
|
|
42
42
|
}
|
|
43
|
-
if
|
|
43
|
+
if dangerously_skip_permissions {
|
|
44
44
|
// 0.5.66 bypass 单源:flag 由 provider_bypass_flag 表供给。
|
|
45
|
-
let flag = crate::provider::bypass_flags::provider_bypass_flag(Provider::Codex)
|
|
45
|
+
let flag = crate::provider::bypass_flags::provider_bypass_flag(crate::model::enums::Provider::Codex)
|
|
46
46
|
.expect("codex provider must define a bypass flag");
|
|
47
47
|
argv.push(flag.to_string());
|
|
48
|
-
} else {
|
|
49
|
-
argv.push("--sandbox".to_string());
|
|
50
|
-
argv.push(codex_sandbox_mode(tools).to_string());
|
|
51
|
-
argv.push("--ask-for-approval".to_string());
|
|
52
|
-
argv.push("on-request".to_string());
|
|
53
48
|
}
|
|
54
49
|
if let Some(model) = model {
|
|
55
50
|
argv.push("--model".to_string());
|
|
@@ -114,18 +109,3 @@ pub(crate) fn append_codex_mcp_overrides(argv: &mut Vec<String>, raw: &serde_jso
|
|
|
114
109
|
argv.push(format!("mcp_servers.{name}.tool_timeout_sec=600.0"));
|
|
115
110
|
}
|
|
116
111
|
}
|
|
117
|
-
|
|
118
|
-
pub(crate) fn codex_dangerous_auto_approve(tools: &[&str]) -> bool {
|
|
119
|
-
tools.contains(&"dangerous_auto_approve")
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
pub(crate) fn codex_sandbox_mode(tools: &[&str]) -> &'static str {
|
|
123
|
-
if tools
|
|
124
|
-
.iter()
|
|
125
|
-
.any(|tool| matches!(*tool, "fs_write" | "execute_bash"))
|
|
126
|
-
{
|
|
127
|
-
"workspace-write"
|
|
128
|
-
} else {
|
|
129
|
-
"read-only"
|
|
130
|
-
}
|
|
131
|
-
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
//!
|
|
2
|
-
//! Copilot provider-local command builders
|
|
2
|
+
//! Copilot provider-local command builders.
|
|
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: base command + resume +
|
|
6
|
+
//! small: base command + resume + MCP type→transport
|
|
7
7
|
//! translation. Auth hint (`copilot_auth_hint`) stays in `adapter.rs`;
|
|
8
8
|
//! session-store scanning lives under `provider/session_scan/copilot.rs`.
|
|
9
9
|
|
|
10
|
-
use crate::model::enums::
|
|
10
|
+
use crate::model::enums::AuthMode;
|
|
11
11
|
use crate::provider::McpConfig;
|
|
12
12
|
|
|
13
13
|
pub(crate) fn copilot_base_command(
|
|
@@ -15,7 +15,7 @@ pub(crate) fn copilot_base_command(
|
|
|
15
15
|
mcp_config: Option<&McpConfig>,
|
|
16
16
|
system_prompt: Option<&str>,
|
|
17
17
|
model: Option<&str>,
|
|
18
|
-
|
|
18
|
+
dangerously_skip_permissions: bool,
|
|
19
19
|
) -> Vec<String> {
|
|
20
20
|
let _ = (auth_mode, system_prompt);
|
|
21
21
|
let mut argv = vec![
|
|
@@ -28,15 +28,11 @@ pub(crate) fn copilot_base_command(
|
|
|
28
28
|
// spawn-time `copilot mcp list` scan + per-name --disable-mcp-server.
|
|
29
29
|
"--disable-builtin-mcps".to_string(),
|
|
30
30
|
];
|
|
31
|
-
if
|
|
31
|
+
if dangerously_skip_permissions {
|
|
32
32
|
// 0.5.66 bypass 单源:flag 由 provider_bypass_flag 表供给。
|
|
33
|
-
let flag = crate::provider::bypass_flags::provider_bypass_flag(Provider::Copilot)
|
|
33
|
+
let flag = crate::provider::bypass_flags::provider_bypass_flag(crate::model::enums::Provider::Copilot)
|
|
34
34
|
.expect("copilot provider must define a bypass flag");
|
|
35
35
|
argv.push(flag.to_string());
|
|
36
|
-
} else {
|
|
37
|
-
for flag in copilot_permission_flags(tools) {
|
|
38
|
-
argv.push(flag);
|
|
39
|
-
}
|
|
40
36
|
}
|
|
41
37
|
// mcp_team ∈ canonical → approval-free (whole-server pattern).
|
|
42
38
|
argv.push("--allow-tool".to_string());
|
|
@@ -57,7 +53,7 @@ pub(crate) fn copilot_base_command(
|
|
|
57
53
|
|
|
58
54
|
/// Translate `McpConfig.raw` canonical schema (`type`) into the copilot
|
|
59
55
|
/// `mcp add`/`--additional-mcp-config` expected `transport` field
|
|
60
|
-
/// (stdio|http|sse).
|
|
56
|
+
/// (stdio|http|sse). Shared by inline plans and lifecycle config files;
|
|
61
57
|
/// claude/codex paths leave canonical schema untouched.
|
|
62
58
|
pub(crate) fn copilot_translate_mcp_config(raw: &serde_json::Value) -> serde_json::Value {
|
|
63
59
|
let Some(servers) = raw.as_object() else {
|
|
@@ -90,36 +86,7 @@ pub(crate) fn copilot_base_command_resume(
|
|
|
90
86
|
mcp_config: Option<&McpConfig>,
|
|
91
87
|
system_prompt: Option<&str>,
|
|
92
88
|
model: Option<&str>,
|
|
93
|
-
|
|
89
|
+
dangerously_skip_permissions: bool,
|
|
94
90
|
) -> Vec<String> {
|
|
95
|
-
copilot_base_command(auth_mode, mcp_config, system_prompt, model,
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
pub(crate) fn copilot_dangerous_auto_approve(tools: &[&str]) -> bool {
|
|
99
|
-
tools.contains(&"dangerous_auto_approve")
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
/// Granular deny mapping (canonical tool → copilot flag, all via
|
|
103
|
-
/// `--deny-tool <kind>`; help-permissions Tool Permissions has four kinds:
|
|
104
|
-
/// shell/write/mcp/url):
|
|
105
|
-
/// execute_bash ∉ allowed → `--deny-tool 'shell'`
|
|
106
|
-
/// fs_write ∉ allowed → `--deny-tool 'write'`
|
|
107
|
-
/// network ∉ allowed → `--deny-tool 'url'`
|
|
108
|
-
/// fs_read/fs_list have no copilot deny kind (honestly prompt_only).
|
|
109
|
-
pub(crate) fn copilot_permission_flags(tools: &[&str]) -> Vec<String> {
|
|
110
|
-
let mut flags = Vec::new();
|
|
111
|
-
if !tools.contains(&"execute_bash") {
|
|
112
|
-
flags.push("--deny-tool".to_string());
|
|
113
|
-
flags.push("shell".to_string());
|
|
114
|
-
}
|
|
115
|
-
if !tools.contains(&"fs_write") {
|
|
116
|
-
flags.push("--deny-tool".to_string());
|
|
117
|
-
flags.push("write".to_string());
|
|
118
|
-
}
|
|
119
|
-
if !tools.contains(&"network") {
|
|
120
|
-
// `--deny-tool 'url'` (omit domain → match all URLs).
|
|
121
|
-
flags.push("--deny-tool".to_string());
|
|
122
|
-
flags.push("url".to_string());
|
|
123
|
-
}
|
|
124
|
-
flags
|
|
91
|
+
copilot_base_command(auth_mode, mcp_config, system_prompt, model, dangerously_skip_permissions)
|
|
125
92
|
}
|
|
@@ -32,7 +32,7 @@ pub(crate) fn cursor_agent_launch_command(
|
|
|
32
32
|
mcp_config: Option<&McpConfig>,
|
|
33
33
|
system_prompt: Option<&str>,
|
|
34
34
|
model: Option<&str>,
|
|
35
|
-
|
|
35
|
+
dangerously_skip_permissions: bool,
|
|
36
36
|
) -> Result<Vec<String>, ProviderError> {
|
|
37
37
|
cursor_agent_base_command(
|
|
38
38
|
adapter,
|
|
@@ -40,7 +40,7 @@ pub(crate) fn cursor_agent_launch_command(
|
|
|
40
40
|
mcp_config,
|
|
41
41
|
system_prompt,
|
|
42
42
|
model,
|
|
43
|
-
|
|
43
|
+
dangerously_skip_permissions,
|
|
44
44
|
false,
|
|
45
45
|
None,
|
|
46
46
|
)
|
|
@@ -52,14 +52,14 @@ pub(crate) fn cursor_agent_base_command(
|
|
|
52
52
|
mcp_config: Option<&McpConfig>,
|
|
53
53
|
system_prompt: Option<&str>,
|
|
54
54
|
model: Option<&str>,
|
|
55
|
-
|
|
55
|
+
dangerously_skip_permissions: bool,
|
|
56
56
|
managed_mcp_config: bool,
|
|
57
57
|
effort: Option<crate::model::enums::ProviderEffort>,
|
|
58
58
|
) -> Result<Vec<String>, ProviderError> {
|
|
59
59
|
let mut argv = vec!["agent".to_string()];
|
|
60
60
|
// --trust 跳过 Workspace Trust 闸(已实测)。无此 flag 会停在 Do you trust。
|
|
61
61
|
argv.push("--trust".to_string());
|
|
62
|
-
if
|
|
62
|
+
if dangerously_skip_permissions {
|
|
63
63
|
argv.push("--force".to_string());
|
|
64
64
|
}
|
|
65
65
|
// 与 cursor_seat.sh 主路径一致。沙箱实际隔离面未再拆,但 flag 本身已实测。
|
|
@@ -80,7 +80,3 @@ pub(crate) fn cursor_agent_base_command(
|
|
|
80
80
|
argv.push("{workspace}".to_string());
|
|
81
81
|
Ok(argv)
|
|
82
82
|
}
|
|
83
|
-
|
|
84
|
-
pub(crate) fn cursor_agent_dangerous_auto_approve(tools: &[&str]) -> bool {
|
|
85
|
-
tools.contains(&"dangerous_auto_approve")
|
|
86
|
-
}
|