mirror of
https://github.com/instructkr/claw-code.git
synced 2026-11-20 00:00:00 +08:00
Revert "Merge pull request #3341 from ultraworkers/fix/rebase-on-main"
This reverts commit734558eb31, reversing changes made to942805175a.
This commit is contained in:
1 parent
734558eb31
commit
350e907e35
26 files changed
+1161
-3940
No files matched your search
@@ -15,7 +15,6 @@ status-help.txt
|
|||||||
.port_sessions/
|
.port_sessions/
|
||||||
# Local agent session state
|
# Local agent session state
|
||||||
.gjc/
|
.gjc/
|
||||||
.claude/
|
|
||||||
# Nix build outputs and direnv
|
# Nix build outputs and direnv
|
||||||
.envrc.local
|
.envrc.local
|
||||||
result
|
result
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
{"schema_version":1,"session_id":"24aa7e35-e6af-4d2d-ab41-a38b9115a031","state":"running","ready_for_input":false,"updated_at":"2026-10-12T22:10:00.508Z","current_turn_id":null,"last_turn_id":null,"live":true,"reason":null,"source":"agent_session_event","event":"turn_start","cwd":"/home/bellman/Data/Workspace/gc-task-cc-pr-3250-lane","workdir":"/home/bellman/Data/Workspace/gc-task-cc-pr-3250-lane","branch":null,"session_file":"/home/bellman/.gajaeway/broker/agent/sessions/v2-famocqbiduwkxmc2g2nvg6jfq2ay6qtc5aihbhbdoqopsmduj4sa/2026-10-12T22-02-16-124Z_24aa7e35-e6af-4d2d-ab41-a38b9115a031.jsonl","activity":{"seq":149,"last_activity_at":"2026-10-12T22:10:01.196Z","tool":"bash","phase":"started","outcome":null,"elapsed_ms":null,"active_tool_count":1,"active_tools":[{"tool":"bash","started_at":"2026-10-12T22:10:01.196Z"}],"in_flight":[{"digest":"fa5f186357264e6b1be2a7a4a7162d0fff04f721630413a25d05b40bcd933836","tool":"bash","started_at":"2026-10-12T22:10:01.196Z"}]}}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
{"pid":1,"start_time":"unknown","token":"8389ee99-c41c-47dd-9615-e76a5268967c","owner_host_id":"7af2fb0e8e37bd543e3d0bda6f205b56f30077b5a9b77e83208e94ae441315ac","released":true}
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
{"pid":1,"start_time":"unknown","token":"6e35ded8-fda1-421e-a727-42906ef57646","owner_host_id":"7af2fb0e8e37bd543e3d0bda6f205b56f30077b5a9b77e83208e94ae441315ac","released":true}
|
|
||||||
Whitespace-only changes.
@@ -1,12 +0,0 @@
|
|||||||
{
|
|
||||||
"version": 1,
|
|
||||||
"sessionId": "24aa7e35-e6af-4d2d-ab41-a38b9115a031",
|
|
||||||
"pid": 177576,
|
|
||||||
"host": "127.0.0.1",
|
|
||||||
"port": 34539,
|
|
||||||
"url": "ws://127.0.0.1:34539",
|
|
||||||
"token": "8FBuSDC3564yKKk5Fpgl6TEknzktQX8W",
|
|
||||||
"startedAt": 1791842537691,
|
|
||||||
"updatedAt": 1791842537691,
|
|
||||||
"stale": false
|
|
||||||
}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
{"effectMarker":"7b92c148-d616-4eb5-95e8-4e95084bebe9","incarnation":"linux:159085489","pid":177576}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
{"effectMarker":"7b92c148-d616-4eb5-95e8-4e95084bebe9","incarnation":"linux:159085489","pid":177576}
|
|
||||||
Generated
+609
-640
File diff suppressed because it is too large.
Load diff
@@ -180,49 +180,6 @@ impl ApiError {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// HTTP status code for an `Api` error, if any. Used by callers (e.g. the
|
|
||||||
/// sub-agent provider chain) to decide whether to advance to the next
|
|
||||||
/// configured model — a 404 "model not found" on the primary should fall
|
|
||||||
/// through to the next fallback rather than killing the whole chain.
|
|
||||||
#[must_use]
|
|
||||||
pub fn status_code(&self) -> Option<reqwest::StatusCode> {
|
|
||||||
match self {
|
|
||||||
Self::Api { status, .. } => Some(*status),
|
|
||||||
Self::RetriesExhausted { last_error, .. } => last_error.status_code(),
|
|
||||||
Self::MissingCredentials { .. }
|
|
||||||
| Self::ContextWindowExceeded { .. }
|
|
||||||
| Self::ExpiredOAuthToken
|
|
||||||
| Self::Auth(_)
|
|
||||||
| Self::InvalidApiKeyEnv(_)
|
|
||||||
| Self::Http(_)
|
|
||||||
| Self::Io(_)
|
|
||||||
| Self::Json { .. }
|
|
||||||
| Self::InvalidSseFrame(_)
|
|
||||||
| Self::BackoffOverflow { .. }
|
|
||||||
| Self::RequestBodySizeExceeded { .. } => None,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Response body (best-effort) for an `Api` error, if any.
|
|
||||||
#[must_use]
|
|
||||||
pub fn response_body(&self) -> Option<&str> {
|
|
||||||
match self {
|
|
||||||
Self::Api { body, .. } => Some(body.as_str()),
|
|
||||||
Self::RetriesExhausted { last_error, .. } => last_error.response_body(),
|
|
||||||
Self::MissingCredentials { .. }
|
|
||||||
| Self::ContextWindowExceeded { .. }
|
|
||||||
| Self::ExpiredOAuthToken
|
|
||||||
| Self::Auth(_)
|
|
||||||
| Self::InvalidApiKeyEnv(_)
|
|
||||||
| Self::Http(_)
|
|
||||||
| Self::Io(_)
|
|
||||||
| Self::Json { .. }
|
|
||||||
| Self::InvalidSseFrame(_)
|
|
||||||
| Self::BackoffOverflow { .. }
|
|
||||||
| Self::RequestBodySizeExceeded { .. } => None,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn safe_failure_class(&self) -> &'static str {
|
pub fn safe_failure_class(&self) -> &'static str {
|
||||||
match self {
|
match self {
|
||||||
|
|||||||
@@ -30,9 +30,8 @@ pub use providers::openai_compat::{
|
|||||||
};
|
};
|
||||||
pub use providers::{
|
pub use providers::{
|
||||||
detect_provider_kind, max_tokens_for_model, max_tokens_for_model_with_override,
|
detect_provider_kind, max_tokens_for_model, max_tokens_for_model_with_override,
|
||||||
model_family_identity_for, model_family_identity_for_kind, model_token_limit,
|
model_family_identity_for, model_family_identity_for_kind, provider_diagnostics_for_model,
|
||||||
provider_diagnostics_for_model, resolve_model_alias, ModelTokenLimit, ProviderDiagnostics,
|
resolve_model_alias, ProviderDiagnostics, ProviderKind,
|
||||||
ProviderKind,
|
|
||||||
};
|
};
|
||||||
pub use sse::{parse_frame, SseParser};
|
pub use sse::{parse_frame, SseParser};
|
||||||
pub use types::{
|
pub use types::{
|
||||||
|
|||||||
@@ -683,15 +683,13 @@ pub fn model_token_limit(model: &str) -> Option<ModelTokenLimit> {
|
|||||||
max_output_tokens: 8_192,
|
max_output_tokens: 8_192,
|
||||||
context_window_tokens: 131_072,
|
context_window_tokens: 131_072,
|
||||||
}),
|
}),
|
||||||
// Qwen models via DashScope / OpenAI-compat
|
"qwen-max" => Some(ModelTokenLimit {
|
||||||
"qwen3.6-35b-fast" | "qwen3-235b-a22b" | "qwen-max" | "qwen-plus" | "qwen-turbo"
|
max_output_tokens: 8_192,
|
||||||
| "qwen-qwq" => Some(ModelTokenLimit {
|
|
||||||
max_output_tokens: 16_384,
|
|
||||||
context_window_tokens: 131_072,
|
context_window_tokens: 131_072,
|
||||||
}),
|
}),
|
||||||
"glm-5.1-fast" => Some(ModelTokenLimit {
|
"qwen-plus" => Some(ModelTokenLimit {
|
||||||
max_output_tokens: 16_384,
|
max_output_tokens: 8_192,
|
||||||
context_window_tokens: 200_000,
|
context_window_tokens: 131_072,
|
||||||
}),
|
}),
|
||||||
// Groq compound systems are exposed through an OpenAI-compatible API
|
// Groq compound systems are exposed through an OpenAI-compatible API
|
||||||
// but cap completions at 8,192 output tokens. Without this metadata
|
// but cap completions at 8,192 output tokens. Without this metadata
|
||||||
@@ -701,8 +699,6 @@ pub fn model_token_limit(model: &str) -> Option<ModelTokenLimit> {
|
|||||||
max_output_tokens: 8_192,
|
max_output_tokens: 8_192,
|
||||||
context_window_tokens: 131_072,
|
context_window_tokens: 131_072,
|
||||||
}),
|
}),
|
||||||
// Unknown models return None so preflight skips the context-window
|
|
||||||
// check and lets the API enforce its own limits.
|
|
||||||
_ => None,
|
_ => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -166,8 +166,8 @@ pub fn blob_to_f32_vec(blob: &[u8], dim: usize) -> Option<Vec<f32>> {
|
|||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
let mut v = Vec::with_capacity(dim);
|
let mut v = Vec::with_capacity(dim);
|
||||||
for chunk in blob.as_chunks::<4>().0 {
|
for chunk in blob.chunks_exact(4) {
|
||||||
v.push(f32::from_le_bytes(*chunk));
|
v.push(f32::from_le_bytes([chunk[0], chunk[1], chunk[2], chunk[3]]));
|
||||||
}
|
}
|
||||||
Some(v)
|
Some(v)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ async fn flush_path_batch(
|
|||||||
#[cfg(feature = "qdrant-index")]
|
#[cfg(feature = "qdrant-index")]
|
||||||
let mut qdrant_points: Vec<ChunkPoint> = Vec::with_capacity(batch.len());
|
let mut qdrant_points: Vec<ChunkPoint> = Vec::with_capacity(batch.len());
|
||||||
|
|
||||||
for ((ord, t), vec) in batch.drain(..).zip(vecs) {
|
for ((ord, t), vec) in batch.drain(..).zip(vecs.into_iter()) {
|
||||||
let dim = vec.len();
|
let dim = vec.len();
|
||||||
let cid = insert_chunk(conn, path, ord, &t)?;
|
let cid = insert_chunk(conn, path, ord, &t)?;
|
||||||
insert_embedding(conn, cid, dim, &vec)?;
|
insert_embedding(conn, cid, dim, &vec)?;
|
||||||
|
|||||||
@@ -808,7 +808,7 @@ const SLASH_COMMAND_SPECS: &[SlashCommandSpec] = &[
|
|||||||
name: "team",
|
name: "team",
|
||||||
aliases: &[],
|
aliases: &[],
|
||||||
summary: "Manage agent teams",
|
summary: "Manage agent teams",
|
||||||
argument_hint: Some("[on|off|status]"),
|
argument_hint: Some("[list|create|delete]"),
|
||||||
resume_supported: true,
|
resume_supported: true,
|
||||||
},
|
},
|
||||||
SlashCommandSpec {
|
SlashCommandSpec {
|
||||||
@@ -1191,14 +1191,10 @@ pub enum SlashCommand {
|
|||||||
History {
|
History {
|
||||||
count: Option<String>,
|
count: Option<String>,
|
||||||
},
|
},
|
||||||
Lsp {
|
Unknown(String),
|
||||||
action: Option<String>,
|
|
||||||
target: Option<String>,
|
|
||||||
},
|
|
||||||
Team {
|
Team {
|
||||||
action: Option<String>,
|
action: Option<String>,
|
||||||
},
|
},
|
||||||
Unknown(String),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
@@ -1520,9 +1516,6 @@ pub fn validate_slash_command_input(
|
|||||||
"history" => SlashCommand::History {
|
"history" => SlashCommand::History {
|
||||||
count: optional_single_arg(command, &args, "[count]")?,
|
count: optional_single_arg(command, &args, "[count]")?,
|
||||||
},
|
},
|
||||||
"team" => SlashCommand::Team {
|
|
||||||
action: optional_single_arg(command, &args, "[list|create|delete]")?,
|
|
||||||
},
|
|
||||||
other => SlashCommand::Unknown(other.to_string()),
|
other => SlashCommand::Unknown(other.to_string()),
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
@@ -5408,7 +5401,6 @@ pub fn handle_slash_command(
|
|||||||
| SlashCommand::OutputStyle { .. }
|
| SlashCommand::OutputStyle { .. }
|
||||||
| SlashCommand::AddDir { .. }
|
| SlashCommand::AddDir { .. }
|
||||||
| SlashCommand::History { .. }
|
| SlashCommand::History { .. }
|
||||||
| SlashCommand::Lsp { .. }
|
|
||||||
| SlashCommand::Team { .. }
|
| SlashCommand::Team { .. }
|
||||||
| SlashCommand::Setup
|
| SlashCommand::Setup
|
||||||
| SlashCommand::Unknown(_) => None,
|
| SlashCommand::Unknown(_) => None,
|
||||||
@@ -5541,16 +5533,6 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn parses_supported_slash_commands() {
|
fn parses_supported_slash_commands() {
|
||||||
assert_eq!(SlashCommand::parse("/help"), Ok(Some(SlashCommand::Help)));
|
assert_eq!(SlashCommand::parse("/help"), Ok(Some(SlashCommand::Help)));
|
||||||
assert_eq!(
|
|
||||||
SlashCommand::parse("/team"),
|
|
||||||
Ok(Some(SlashCommand::Team { action: None }))
|
|
||||||
);
|
|
||||||
assert_eq!(
|
|
||||||
SlashCommand::parse("/team on"),
|
|
||||||
Ok(Some(SlashCommand::Team {
|
|
||||||
action: Some("on".to_string())
|
|
||||||
}))
|
|
||||||
);
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
SlashCommand::parse(" /status "),
|
SlashCommand::parse(" /status "),
|
||||||
Ok(Some(SlashCommand::Status))
|
Ok(Some(SlashCommand::Status))
|
||||||
|
|||||||
@@ -826,7 +826,7 @@ mod tests {
|
|||||||
"message[{}] is a ToolResult but message[{}] has no ToolUse: {:?}",
|
"message[{}] is a ToolResult but message[{}] has no ToolUse: {:?}",
|
||||||
i,
|
i,
|
||||||
i - 1,
|
i - 1,
|
||||||
messages[i - 1].blocks
|
&messages[i - 1].blocks
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -164,20 +164,6 @@ pub struct RuntimeFeatureConfig {
|
|||||||
rules_import: RulesImportConfig,
|
rules_import: RulesImportConfig,
|
||||||
provider: RuntimeProviderConfig,
|
provider: RuntimeProviderConfig,
|
||||||
auto_memory_enabled: bool,
|
auto_memory_enabled: bool,
|
||||||
/// Model override used when spawning sub-agents via the Agent tool.
|
|
||||||
/// Read from `subagentModel` (or `subagent_model`) in settings; falls
|
|
||||||
/// back to the default model when unset.
|
|
||||||
subagent_model: Option<String>,
|
|
||||||
/// Cap on concurrently executing parallel-safe tool calls in one batch.
|
|
||||||
/// Read from `maxParallelToolCalls` (or `max_parallel_tool_calls`) in
|
|
||||||
/// settings; the CLI falls back to `CLAWD_PARALLEL_TOOL_CALLS` and then
|
|
||||||
/// to its built-in default when unset.
|
|
||||||
max_parallel_tool_calls: Option<usize>,
|
|
||||||
/// Default cap on concurrently *running* sub-agents per team. Read from
|
|
||||||
/// `maxConcurrentAgents` (or `max_concurrent_agents`) in settings; a
|
|
||||||
/// per-team `maxConcurrentAgents` on TeamCreate overrides it. `None`
|
|
||||||
/// means no gate (current pre-fix behavior).
|
|
||||||
max_concurrent_agents: Option<usize>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Controls which external AI coding framework rules are imported into the system prompt.
|
/// Controls which external AI coding framework rules are imported into the system prompt.
|
||||||
@@ -851,15 +837,6 @@ fn build_runtime_config(
|
|||||||
rules_import: parse_optional_rules_import(&merged_value)?,
|
rules_import: parse_optional_rules_import(&merged_value)?,
|
||||||
provider: parse_optional_provider_config(&merged_value)?,
|
provider: parse_optional_provider_config(&merged_value)?,
|
||||||
auto_memory_enabled: parse_auto_memory_enabled(&merged_value),
|
auto_memory_enabled: parse_auto_memory_enabled(&merged_value),
|
||||||
subagent_model: parse_optional_subagent_model(&merged_value),
|
|
||||||
max_parallel_tool_calls: parse_optional_positive_usize(
|
|
||||||
&merged_value,
|
|
||||||
&["maxParallelToolCalls", "max_parallel_tool_calls"],
|
|
||||||
)?,
|
|
||||||
max_concurrent_agents: parse_optional_positive_usize(
|
|
||||||
&merged_value,
|
|
||||||
&["maxConcurrentAgents", "max_concurrent_agents"],
|
|
||||||
)?,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(RuntimeConfig {
|
Ok(RuntimeConfig {
|
||||||
@@ -942,29 +919,6 @@ impl RuntimeConfig {
|
|||||||
self.feature_config.model.as_deref()
|
self.feature_config.model.as_deref()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Model override used when spawning sub-agents via the Agent tool.
|
|
||||||
/// Read from `subagentModel` in settings; `None` means "use default model".
|
|
||||||
#[must_use]
|
|
||||||
pub fn subagent_model(&self) -> Option<&str> {
|
|
||||||
self.feature_config.subagent_model.as_deref()
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Cap on concurrently executing parallel-safe tool calls in one batch.
|
|
||||||
/// Read from `maxParallelToolCalls` in settings; `None` means the CLI
|
|
||||||
/// falls back to `CLAWD_PARALLEL_TOOL_CALLS` and then its built-in default.
|
|
||||||
#[must_use]
|
|
||||||
pub fn max_parallel_tool_calls(&self) -> Option<usize> {
|
|
||||||
self.feature_config.max_parallel_tool_calls
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Default cap on concurrently running sub-agents per team. Read from
|
|
||||||
/// `maxConcurrentAgents` in settings; `None` means the built-in default
|
|
||||||
/// applies. A per-team `maxConcurrentAgents` on TeamCreate overrides it.
|
|
||||||
#[must_use]
|
|
||||||
pub fn max_concurrent_agents(&self) -> Option<usize> {
|
|
||||||
self.feature_config.max_concurrent_agents
|
|
||||||
}
|
|
||||||
|
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn aliases(&self) -> &BTreeMap<String, String> {
|
pub fn aliases(&self) -> &BTreeMap<String, String> {
|
||||||
&self.feature_config.aliases
|
&self.feature_config.aliases
|
||||||
@@ -1025,20 +979,6 @@ impl RuntimeFeatureConfig {
|
|||||||
&self.provider
|
&self.provider
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Cap on concurrently executing parallel-safe tool calls in one batch.
|
|
||||||
/// `None` means fall back to env/default.
|
|
||||||
#[must_use]
|
|
||||||
pub fn max_parallel_tool_calls(&self) -> Option<usize> {
|
|
||||||
self.max_parallel_tool_calls
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Default per-team cap on concurrently running sub-agents; `None`
|
|
||||||
/// means unlimited (pre-fix behavior).
|
|
||||||
#[must_use]
|
|
||||||
pub fn max_concurrent_agents(&self) -> Option<usize> {
|
|
||||||
self.max_concurrent_agents
|
|
||||||
}
|
|
||||||
|
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn with_hooks(mut self, hooks: RuntimeHookConfig) -> Self {
|
pub fn with_hooks(mut self, hooks: RuntimeHookConfig) -> Self {
|
||||||
self.hooks = hooks;
|
self.hooks = hooks;
|
||||||
@@ -1821,51 +1761,6 @@ fn parse_optional_model(root: &JsonValue) -> Option<String> {
|
|||||||
.map(ToOwned::to_owned)
|
.map(ToOwned::to_owned)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Reads `subagentModel` (or the snake_case `subagent_model` alias) from
|
|
||||||
/// merged settings. Returns `None` when absent or blank so the Agent tool
|
|
||||||
/// falls back to the default model.
|
|
||||||
fn parse_optional_subagent_model(root: &JsonValue) -> Option<String> {
|
|
||||||
root.as_object()
|
|
||||||
.and_then(|object| {
|
|
||||||
object
|
|
||||||
.get("subagentModel")
|
|
||||||
.or_else(|| object.get("subagent_model"))
|
|
||||||
})
|
|
||||||
.and_then(JsonValue::as_str)
|
|
||||||
.filter(|s| !s.trim().is_empty())
|
|
||||||
.map(|s| s.trim().to_string())
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Reads the first present key from `keys` as a positive integer.
|
|
||||||
/// Absent, null, or non-positive values parse to `None` so callers fall
|
|
||||||
/// back to their own defaults rather than silently disabling a cap via a
|
|
||||||
/// `0` typo. Accepts JSON numbers or numeric strings.
|
|
||||||
fn parse_optional_positive_usize(
|
|
||||||
root: &JsonValue,
|
|
||||||
keys: &[&str],
|
|
||||||
) -> Result<Option<usize>, ConfigError> {
|
|
||||||
let Some(object) = root.as_object() else {
|
|
||||||
return Ok(None);
|
|
||||||
};
|
|
||||||
for key in keys {
|
|
||||||
let Some(value) = object.get(*key) else {
|
|
||||||
continue;
|
|
||||||
};
|
|
||||||
if matches!(value, JsonValue::Null) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
let parsed = value
|
|
||||||
.as_i64()
|
|
||||||
.or_else(|| value.as_str().and_then(|s| s.trim().parse::<i64>().ok()))
|
|
||||||
.ok_or_else(|| ConfigError::Parse(format!("{key} must be a positive integer")))?;
|
|
||||||
if parsed <= 0 {
|
|
||||||
return Ok(None);
|
|
||||||
}
|
|
||||||
return Ok(usize::try_from(parsed).ok());
|
|
||||||
}
|
|
||||||
Ok(None)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn parse_optional_aliases(root: &JsonValue) -> Result<BTreeMap<String, String>, ConfigError> {
|
fn parse_optional_aliases(root: &JsonValue) -> Result<BTreeMap<String, String>, ConfigError> {
|
||||||
let Some(object) = root.as_object() else {
|
let Some(object) = root.as_object() else {
|
||||||
return Ok(BTreeMap::new());
|
return Ok(BTreeMap::new());
|
||||||
@@ -2737,49 +2632,6 @@ fn deep_merge_objects(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Read the provider config saved by `/setup` and inject its credentials
|
|
||||||
/// into the environment so `ProviderClient::from_model()` can find them via
|
|
||||||
/// the env-var-based provider dispatch. Only sets vars that aren't already
|
|
||||||
/// present (preserves explicit env). Idempotent.
|
|
||||||
///
|
|
||||||
/// Called by the main CLI at startup and by sub-agent threads in the tools
|
|
||||||
/// crate so that custom/ exotic providers work for spawned agents too.
|
|
||||||
pub fn inject_config_as_env_fallbacks() {
|
|
||||||
let cwd = std::env::current_dir().unwrap_or_default();
|
|
||||||
let Ok(config) = ConfigLoader::default_for(&cwd).load() else {
|
|
||||||
return;
|
|
||||||
};
|
|
||||||
let provider = config.provider();
|
|
||||||
|
|
||||||
// Map provider kind to the expected env var names
|
|
||||||
let (api_key_env, base_url_env) = match provider.kind().unwrap_or("anthropic") {
|
|
||||||
"anthropic" => ("ANTHROPIC_API_KEY", "ANTHROPIC_BASE_URL"),
|
|
||||||
"xai" => ("XAI_API_KEY", "XAI_BASE_URL"),
|
|
||||||
"openai" => ("OPENAI_API_KEY", "OPENAI_BASE_URL"),
|
|
||||||
"dashscope" => ("DASHSCOPE_API_KEY", "DASHSCOPE_BASE_URL"),
|
|
||||||
"custom-openai" => ("CLAWCUSTOMOPENAI_API_KEY", "CLAWCUSTOMOPENAI_BASE_URL"),
|
|
||||||
_ => return, // unknown provider kind — don't inject
|
|
||||||
};
|
|
||||||
|
|
||||||
// Only set env vars that aren't already set (preserve user's explicit env)
|
|
||||||
if let Some(api_key) = provider.api_key() {
|
|
||||||
if std::env::var(api_key_env).is_err() {
|
|
||||||
std::env::set_var(api_key_env, api_key);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if let Some(base_url) = provider.base_url() {
|
|
||||||
if std::env::var(base_url_env).is_err() {
|
|
||||||
std::env::set_var(base_url_env, base_url);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Also inject the saved model so resolve_model_alias sees it
|
|
||||||
if let Some(model) = provider.model() {
|
|
||||||
if std::env::var("CLAWD_PROVIDER_MODEL").is_err() {
|
|
||||||
std::env::set_var("CLAWD_PROVIDER_MODEL", model);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::{
|
use super::{
|
||||||
@@ -4177,151 +4029,4 @@ mod tests {
|
|||||||
|
|
||||||
fs::remove_dir_all(root).expect("cleanup temp dir");
|
fs::remove_dir_all(root).expect("cleanup temp dir");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn subagent_model_reads_camel_case_config_key() {
|
|
||||||
let root = temp_dir();
|
|
||||||
let cwd = root.join("project");
|
|
||||||
let home = root.join("home").join(".claw");
|
|
||||||
fs::create_dir_all(&home).expect("home config dir");
|
|
||||||
fs::create_dir_all(&cwd).expect("project dir");
|
|
||||||
fs::write(
|
|
||||||
home.join("settings.json"),
|
|
||||||
"{\n \"subagentModel\": \"custom/openclaw\"\n}\n",
|
|
||||||
)
|
|
||||||
.expect("write settings");
|
|
||||||
|
|
||||||
let config = ConfigLoader::new(&cwd, &home)
|
|
||||||
.load()
|
|
||||||
.expect("config should load");
|
|
||||||
assert_eq!(
|
|
||||||
config.subagent_model(),
|
|
||||||
Some("custom/openclaw"),
|
|
||||||
"subagentModel camelCase key should be read end-to-end"
|
|
||||||
);
|
|
||||||
|
|
||||||
fs::remove_dir_all(root).expect("cleanup temp dir");
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn subagent_model_reads_snake_case_config_key() {
|
|
||||||
let root = temp_dir();
|
|
||||||
let cwd = root.join("project");
|
|
||||||
let home = root.join("home").join(".claw");
|
|
||||||
fs::create_dir_all(&home).expect("home config dir");
|
|
||||||
fs::create_dir_all(&cwd).expect("project dir");
|
|
||||||
fs::write(
|
|
||||||
home.join("settings.json"),
|
|
||||||
"{\n \"subagent_model\": \"qwen3.6-35b-fast\"\n}\n",
|
|
||||||
)
|
|
||||||
.expect("write settings");
|
|
||||||
|
|
||||||
let config = ConfigLoader::new(&cwd, &home)
|
|
||||||
.load()
|
|
||||||
.expect("config should load");
|
|
||||||
assert_eq!(
|
|
||||||
config.subagent_model(),
|
|
||||||
Some("qwen3.6-35b-fast"),
|
|
||||||
"subagent_model snake_case key should be read end-to-end"
|
|
||||||
);
|
|
||||||
|
|
||||||
fs::remove_dir_all(root).expect("cleanup temp dir");
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn subagent_model_blank_value_returns_none() {
|
|
||||||
let root = temp_dir();
|
|
||||||
let cwd = root.join("project");
|
|
||||||
let home = root.join("home").join(".claw");
|
|
||||||
fs::create_dir_all(&home).expect("home config dir");
|
|
||||||
fs::create_dir_all(&cwd).expect("project dir");
|
|
||||||
fs::write(
|
|
||||||
home.join("settings.json"),
|
|
||||||
"{\n \"subagentModel\": \" \"\n}\n",
|
|
||||||
)
|
|
||||||
.expect("write settings");
|
|
||||||
|
|
||||||
let config = ConfigLoader::new(&cwd, &home)
|
|
||||||
.load()
|
|
||||||
.expect("config should load");
|
|
||||||
assert_eq!(
|
|
||||||
config.subagent_model(),
|
|
||||||
None,
|
|
||||||
"blank subagentModel should fall back to None"
|
|
||||||
);
|
|
||||||
|
|
||||||
fs::remove_dir_all(root).expect("cleanup temp dir");
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn parallel_and_agent_caps_read_camel_and_snake_case_keys() {
|
|
||||||
let root = temp_dir();
|
|
||||||
let cwd = root.join("project");
|
|
||||||
let home = root.join("home").join(".claw");
|
|
||||||
fs::create_dir_all(&home).expect("home config dir");
|
|
||||||
fs::create_dir_all(&cwd).expect("project dir");
|
|
||||||
fs::write(
|
|
||||||
home.join("settings.json"),
|
|
||||||
"{\n \"maxParallelToolCalls\": 4,\n \"max_concurrent_agents\": \"6\"\n}\n",
|
|
||||||
)
|
|
||||||
.expect("write settings");
|
|
||||||
|
|
||||||
let config = ConfigLoader::new(&cwd, &home)
|
|
||||||
.load()
|
|
||||||
.expect("config should load");
|
|
||||||
assert_eq!(
|
|
||||||
config.max_parallel_tool_calls(),
|
|
||||||
Some(4),
|
|
||||||
"maxParallelToolCalls camelCase key should parse"
|
|
||||||
);
|
|
||||||
assert_eq!(
|
|
||||||
config.max_concurrent_agents(),
|
|
||||||
Some(6),
|
|
||||||
"max_concurrent_agents snake_case key should parse numeric strings"
|
|
||||||
);
|
|
||||||
|
|
||||||
fs::remove_dir_all(root).expect("cleanup temp dir");
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn parallel_and_agent_caps_reject_nonpositive_and_malformed() {
|
|
||||||
let root = temp_dir();
|
|
||||||
let cwd = root.join("project");
|
|
||||||
let home = root.join("home").join(".claw");
|
|
||||||
fs::create_dir_all(&home).expect("home config dir");
|
|
||||||
fs::create_dir_all(&cwd).expect("project dir");
|
|
||||||
fs::write(
|
|
||||||
home.join("settings.json"),
|
|
||||||
"{\n \"maxParallelToolCalls\": 0\n}\n",
|
|
||||||
)
|
|
||||||
.expect("write settings");
|
|
||||||
|
|
||||||
let config = ConfigLoader::new(&cwd, &home)
|
|
||||||
.load()
|
|
||||||
.expect("zero cap should parse as unset");
|
|
||||||
assert_eq!(config.max_parallel_tool_calls(), None);
|
|
||||||
assert_eq!(config.max_concurrent_agents(), None);
|
|
||||||
fs::remove_dir_all(&root).expect("cleanup temp dir");
|
|
||||||
|
|
||||||
let root = temp_dir();
|
|
||||||
let cwd = root.join("project");
|
|
||||||
let home = root.join("home").join(".claw");
|
|
||||||
fs::create_dir_all(&home).expect("home config dir");
|
|
||||||
fs::create_dir_all(&cwd).expect("project dir");
|
|
||||||
fs::write(
|
|
||||||
home.join("settings.json"),
|
|
||||||
"{\n \"maxParallelToolCalls\": \"lots\"\n}\n",
|
|
||||||
)
|
|
||||||
.expect("write settings");
|
|
||||||
|
|
||||||
let error = ConfigLoader::new(&cwd, &home)
|
|
||||||
.load()
|
|
||||||
.expect_err("non-numeric cap should be a config error");
|
|
||||||
assert!(
|
|
||||||
error.to_string().contains("maxParallelToolCalls"),
|
|
||||||
"error should name the offending key: {error}"
|
|
||||||
);
|
|
||||||
|
|
||||||
fs::remove_dir_all(root).expect("cleanup temp dir");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -61,40 +61,6 @@ pub trait ApiClient {
|
|||||||
/// Trait implemented by tool dispatchers that execute model-requested tools.
|
/// Trait implemented by tool dispatchers that execute model-requested tools.
|
||||||
pub trait ToolExecutor {
|
pub trait ToolExecutor {
|
||||||
fn execute(&mut self, tool_name: &str, input: &str) -> Result<String, ToolError>;
|
fn execute(&mut self, tool_name: &str, input: &str) -> Result<String, ToolError>;
|
||||||
|
|
||||||
/// Execute a batch of tool calls, potentially in parallel.
|
|
||||||
/// Returns results in the same order as the input calls.
|
|
||||||
/// The default implementation executes sequentially via `execute`.
|
|
||||||
/// Override this to provide parallel execution for read-only tools.
|
|
||||||
fn execute_batch(&mut self, calls: Vec<ToolCall>) -> Vec<ToolResult> {
|
|
||||||
calls
|
|
||||||
.into_iter()
|
|
||||||
.map(|call| {
|
|
||||||
let result = self.execute(&call.tool_name, &call.input);
|
|
||||||
ToolResult {
|
|
||||||
tool_use_id: call.tool_use_id,
|
|
||||||
tool_name: call.tool_name,
|
|
||||||
result,
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.collect()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// A single tool call to execute.
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
||||||
pub struct ToolCall {
|
|
||||||
pub tool_use_id: String,
|
|
||||||
pub tool_name: String,
|
|
||||||
pub input: String,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The result of executing a tool call.
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
||||||
pub struct ToolResult {
|
|
||||||
pub tool_use_id: String,
|
|
||||||
pub tool_name: String,
|
|
||||||
pub result: Result<String, ToolError>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Error returned when a tool invocation fails locally.
|
/// Error returned when a tool invocation fails locally.
|
||||||
@@ -120,22 +86,6 @@ impl Display for ToolError {
|
|||||||
|
|
||||||
impl std::error::Error for ToolError {}
|
impl std::error::Error for ToolError {}
|
||||||
|
|
||||||
/// Callback trait for reporting tool execution progress during a turn.
|
|
||||||
/// Implementations can post progress to a team inbox, log to stderr, etc.
|
|
||||||
/// Called after each tool call completes (success or failure).
|
|
||||||
pub trait TurnProgressReporter: Send + Sync {
|
|
||||||
/// Called after a tool execution completes.
|
|
||||||
/// `iteration` is 1-based index of the tool call within this turn.
|
|
||||||
fn on_tool_result(
|
|
||||||
&self,
|
|
||||||
iteration: usize,
|
|
||||||
max_iterations: usize,
|
|
||||||
tool_name: &str,
|
|
||||||
input: &str,
|
|
||||||
result: Result<&str, &str>,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Error returned when a conversation turn cannot be completed.
|
/// Error returned when a conversation turn cannot be completed.
|
||||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
pub struct RuntimeError {
|
pub struct RuntimeError {
|
||||||
@@ -190,7 +140,6 @@ pub struct ConversationRuntime<C, T> {
|
|||||||
hook_abort_signal: HookAbortSignal,
|
hook_abort_signal: HookAbortSignal,
|
||||||
hook_progress_reporter: Option<Box<dyn HookProgressReporter>>,
|
hook_progress_reporter: Option<Box<dyn HookProgressReporter>>,
|
||||||
session_tracer: Option<SessionTracer>,
|
session_tracer: Option<SessionTracer>,
|
||||||
turn_progress_reporter: Option<Box<dyn TurnProgressReporter>>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<C, T> ConversationRuntime<C, T>
|
impl<C, T> ConversationRuntime<C, T>
|
||||||
@@ -245,7 +194,6 @@ where
|
|||||||
hook_abort_signal: HookAbortSignal::default(),
|
hook_abort_signal: HookAbortSignal::default(),
|
||||||
hook_progress_reporter: None,
|
hook_progress_reporter: None,
|
||||||
session_tracer: None,
|
session_tracer: None,
|
||||||
turn_progress_reporter: None,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -289,11 +237,6 @@ where
|
|||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_turn_progress_reporter(mut self, reporter: Box<dyn TurnProgressReporter>) -> Self {
|
|
||||||
self.turn_progress_reporter = Some(reporter);
|
|
||||||
self
|
|
||||||
}
|
|
||||||
|
|
||||||
fn run_pre_tool_use_hook(&mut self, tool_name: &str, input: &str) -> HookRunResult {
|
fn run_pre_tool_use_hook(&mut self, tool_name: &str, input: &str) -> HookRunResult {
|
||||||
if let Some(reporter) = self.hook_progress_reporter.as_mut() {
|
if let Some(reporter) = self.hook_progress_reporter.as_mut() {
|
||||||
self.hook_runner.run_pre_tool_use_with_context(
|
self.hook_runner.run_pre_tool_use_with_context(
|
||||||
@@ -477,24 +420,11 @@ where
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Phase 1: Pre-hooks and permission checks (sequential).
|
for (tool_use_id, tool_name, input) in pending_tool_uses {
|
||||||
// Hooks may mutate state and must run in order.
|
let pre_hook_result = self.run_pre_tool_use_hook(&tool_name, &input);
|
||||||
struct PendingTool {
|
|
||||||
tool_use_id: String,
|
|
||||||
tool_name: String,
|
|
||||||
effective_input: String,
|
|
||||||
pre_hook_messages: Vec<String>,
|
|
||||||
allowed: bool,
|
|
||||||
deny_reason: Option<String>,
|
|
||||||
}
|
|
||||||
|
|
||||||
let mut pending = Vec::with_capacity(pending_tool_uses.len());
|
|
||||||
for (tool_use_id, tool_name, input) in &pending_tool_uses {
|
|
||||||
let pre_hook_result = self.run_pre_tool_use_hook(tool_name, input);
|
|
||||||
let effective_input = pre_hook_result
|
let effective_input = pre_hook_result
|
||||||
.updated_input()
|
.updated_input()
|
||||||
.map_or_else(|| input.clone(), ToOwned::to_owned);
|
.map_or_else(|| input.clone(), ToOwned::to_owned);
|
||||||
let pre_hook_messages = pre_hook_result.messages().to_vec();
|
|
||||||
let permission_context = PermissionContext::new(
|
let permission_context = PermissionContext::new(
|
||||||
pre_hook_result.permission_override(),
|
pre_hook_result.permission_override(),
|
||||||
pre_hook_result.permission_reason().map(ToOwned::to_owned),
|
pre_hook_result.permission_reason().map(ToOwned::to_owned),
|
||||||
@@ -523,157 +453,71 @@ where
|
|||||||
}
|
}
|
||||||
} else if let Some(prompt) = prompter.as_mut() {
|
} else if let Some(prompt) = prompter.as_mut() {
|
||||||
self.permission_policy.authorize_with_context(
|
self.permission_policy.authorize_with_context(
|
||||||
tool_name,
|
&tool_name,
|
||||||
&effective_input,
|
&effective_input,
|
||||||
&permission_context,
|
&permission_context,
|
||||||
Some(*prompt),
|
Some(*prompt),
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
self.permission_policy.authorize_with_context(
|
self.permission_policy.authorize_with_context(
|
||||||
tool_name,
|
&tool_name,
|
||||||
&effective_input,
|
&effective_input,
|
||||||
&permission_context,
|
&permission_context,
|
||||||
None,
|
None,
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
match permission_outcome {
|
let result_message = match permission_outcome {
|
||||||
PermissionOutcome::Allow => {
|
PermissionOutcome::Allow => {
|
||||||
pending.push(PendingTool {
|
self.record_tool_started(iterations, &tool_name);
|
||||||
tool_use_id: tool_use_id.clone(),
|
let (mut output, mut is_error) =
|
||||||
tool_name: tool_name.clone(),
|
match self.tool_executor.execute(&tool_name, &effective_input) {
|
||||||
effective_input,
|
Ok(output) => (output, false),
|
||||||
pre_hook_messages,
|
Err(error) => (error.to_string(), true),
|
||||||
allowed: true,
|
};
|
||||||
deny_reason: None,
|
output = merge_hook_feedback(pre_hook_result.messages(), output, false);
|
||||||
});
|
|
||||||
}
|
|
||||||
PermissionOutcome::Deny { reason } => {
|
|
||||||
pending.push(PendingTool {
|
|
||||||
tool_use_id: tool_use_id.clone(),
|
|
||||||
tool_name: tool_name.clone(),
|
|
||||||
effective_input: String::new(),
|
|
||||||
pre_hook_messages,
|
|
||||||
allowed: false,
|
|
||||||
deny_reason: Some(reason),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Phase 2: Execute allowed tools (batch, may run in parallel).
|
let post_hook_result = if is_error {
|
||||||
let allowed_calls: Vec<ToolCall> = pending
|
self.run_post_tool_use_failure_hook(
|
||||||
.iter()
|
&tool_name,
|
||||||
.filter(|p| p.allowed)
|
&effective_input,
|
||||||
.map(|p| {
|
&output,
|
||||||
self.record_tool_started(iterations, &p.tool_name);
|
)
|
||||||
ToolCall {
|
} else {
|
||||||
tool_use_id: p.tool_use_id.clone(),
|
self.run_post_tool_use_hook(
|
||||||
tool_name: p.tool_name.clone(),
|
&tool_name,
|
||||||
input: p.effective_input.clone(),
|
&effective_input,
|
||||||
}
|
&output,
|
||||||
})
|
false,
|
||||||
.collect();
|
)
|
||||||
let batch_results = self.tool_executor.execute_batch(allowed_calls);
|
};
|
||||||
let mut batch_index = 0;
|
if post_hook_result.is_denied()
|
||||||
|
|
||||||
// Phase 3: Post-hooks and session updates (sequential, original order).
|
|
||||||
for p in &pending {
|
|
||||||
// Capture progress data for the reporter.
|
|
||||||
let (
|
|
||||||
progress_tool_name,
|
|
||||||
progress_input,
|
|
||||||
progress_output,
|
|
||||||
progress_is_error,
|
|
||||||
result_message,
|
|
||||||
) = if p.allowed {
|
|
||||||
let batch_result = &batch_results[batch_index];
|
|
||||||
batch_index += 1;
|
|
||||||
let (mut output, mut is_error) = match &batch_result.result {
|
|
||||||
Ok(output) => (output.clone(), false),
|
|
||||||
Err(error) => (error.to_string(), true),
|
|
||||||
};
|
|
||||||
output = merge_hook_feedback(&p.pre_hook_messages, output, false);
|
|
||||||
|
|
||||||
let post_hook_result = if is_error {
|
|
||||||
self.run_post_tool_use_failure_hook(
|
|
||||||
&p.tool_name,
|
|
||||||
&p.effective_input,
|
|
||||||
&output,
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
self.run_post_tool_use_hook(
|
|
||||||
&p.tool_name,
|
|
||||||
&p.effective_input,
|
|
||||||
&output,
|
|
||||||
false,
|
|
||||||
)
|
|
||||||
};
|
|
||||||
if post_hook_result.is_denied()
|
|
||||||
|| post_hook_result.is_failed()
|
|
||||||
|| post_hook_result.is_cancelled()
|
|
||||||
{
|
|
||||||
is_error = true;
|
|
||||||
}
|
|
||||||
output = merge_hook_feedback(
|
|
||||||
post_hook_result.messages(),
|
|
||||||
output,
|
|
||||||
post_hook_result.is_denied()
|
|
||||||
|| post_hook_result.is_failed()
|
|| post_hook_result.is_failed()
|
||||||
|| post_hook_result.is_cancelled(),
|
|| post_hook_result.is_cancelled()
|
||||||
);
|
{
|
||||||
let progress_output = output.clone();
|
is_error = true;
|
||||||
let result_message = ConversationMessage::tool_result(
|
}
|
||||||
p.tool_use_id.clone(),
|
output = merge_hook_feedback(
|
||||||
p.tool_name.clone(),
|
post_hook_result.messages(),
|
||||||
output,
|
output,
|
||||||
is_error,
|
post_hook_result.is_denied()
|
||||||
);
|
|| post_hook_result.is_failed()
|
||||||
(
|
|| post_hook_result.is_cancelled(),
|
||||||
p.tool_name.clone(),
|
);
|
||||||
p.effective_input.clone(),
|
|
||||||
progress_output,
|
ConversationMessage::tool_result(tool_use_id, tool_name, output, is_error)
|
||||||
is_error,
|
}
|
||||||
result_message,
|
PermissionOutcome::Deny { reason } => ConversationMessage::tool_result(
|
||||||
)
|
tool_use_id,
|
||||||
} else {
|
tool_name,
|
||||||
let denied_output = merge_hook_feedback(
|
merge_hook_feedback(pre_hook_result.messages(), reason, true),
|
||||||
&p.pre_hook_messages,
|
|
||||||
p.deny_reason.clone().unwrap_or_default(),
|
|
||||||
true,
|
true,
|
||||||
);
|
),
|
||||||
let result_message = ConversationMessage::tool_result(
|
|
||||||
p.tool_use_id.clone(),
|
|
||||||
p.tool_name.clone(),
|
|
||||||
denied_output,
|
|
||||||
true,
|
|
||||||
);
|
|
||||||
(
|
|
||||||
p.tool_name.clone(),
|
|
||||||
String::new(),
|
|
||||||
String::new(),
|
|
||||||
true,
|
|
||||||
result_message,
|
|
||||||
)
|
|
||||||
};
|
};
|
||||||
self.session
|
self.session
|
||||||
.push_message(result_message.clone())
|
.push_message(result_message.clone())
|
||||||
.map_err(|error| RuntimeError::new(error.to_string()))?;
|
.map_err(|error| RuntimeError::new(error.to_string()))?;
|
||||||
self.record_tool_finished(iterations, &result_message);
|
self.record_tool_finished(iterations, &result_message);
|
||||||
if let Some(ref reporter) = self.turn_progress_reporter {
|
|
||||||
let report_result = if progress_is_error {
|
|
||||||
Err(progress_output.as_str())
|
|
||||||
} else {
|
|
||||||
Ok(progress_output.as_str())
|
|
||||||
};
|
|
||||||
reporter.on_tool_result(
|
|
||||||
iterations,
|
|
||||||
self.max_iterations,
|
|
||||||
&progress_tool_name,
|
|
||||||
&progress_input,
|
|
||||||
report_result,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
tool_results.push(result_message);
|
tool_results.push(result_message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,16 +67,15 @@ pub use compact::{
|
|||||||
get_compact_continuation_message, should_compact, CompactionConfig, CompactionResult,
|
get_compact_continuation_message, should_compact, CompactionConfig, CompactionResult,
|
||||||
};
|
};
|
||||||
pub use config::{
|
pub use config::{
|
||||||
clear_user_provider_settings, default_config_home, inject_config_as_env_fallbacks,
|
clear_user_provider_settings, default_config_home, save_user_provider_settings,
|
||||||
save_user_provider_settings, suppress_config_warnings_for_json_mode, ApiTimeoutConfig,
|
suppress_config_warnings_for_json_mode, ApiTimeoutConfig, ConfigEntry, ConfigError,
|
||||||
ConfigEntry, ConfigError, ConfigFileReport, ConfigFileStatus, ConfigInspection, ConfigLoader,
|
ConfigFileReport, ConfigFileStatus, ConfigInspection, ConfigLoader, ConfigSource,
|
||||||
ConfigSource, McpConfigCollection, McpInvalidServerConfig, McpManagedProxyServerConfig,
|
McpConfigCollection, McpInvalidServerConfig, McpManagedProxyServerConfig, McpOAuthConfig,
|
||||||
McpOAuthConfig, McpRemoteServerConfig, McpSdkServerConfig, McpServerConfig,
|
McpRemoteServerConfig, McpSdkServerConfig, McpServerConfig, McpStdioServerConfig, McpTransport,
|
||||||
McpStdioServerConfig, McpTransport, McpWebSocketServerConfig, OAuthConfig,
|
McpWebSocketServerConfig, OAuthConfig, ProviderFallbackConfig, ResolvedPermissionMode,
|
||||||
ProviderFallbackConfig, ResolvedPermissionMode, RulesImportConfig, RuntimeConfig,
|
RulesImportConfig, RuntimeConfig, RuntimeFeatureConfig, RuntimeHookCommand, RuntimeHookConfig,
|
||||||
RuntimeFeatureConfig, RuntimeHookCommand, RuntimeHookConfig, RuntimeInvalidHookConfig,
|
RuntimeInvalidHookConfig, RuntimePermissionRuleConfig, RuntimePluginConfig,
|
||||||
RuntimePermissionRuleConfig, RuntimePluginConfig, RuntimeProviderConfig, ScopedMcpServerConfig,
|
RuntimeProviderConfig, ScopedMcpServerConfig, CLAW_SETTINGS_SCHEMA_NAME,
|
||||||
CLAW_SETTINGS_SCHEMA_NAME,
|
|
||||||
};
|
};
|
||||||
pub use config_validate::{
|
pub use config_validate::{
|
||||||
check_unsupported_format, format_diagnostics, validate_config_file, ConfigDiagnostic,
|
check_unsupported_format, format_diagnostics, validate_config_file, ConfigDiagnostic,
|
||||||
@@ -84,8 +83,8 @@ pub use config_validate::{
|
|||||||
};
|
};
|
||||||
pub use conversation::{
|
pub use conversation::{
|
||||||
auto_compaction_threshold_from_env, ApiClient, ApiRequest, AssistantEvent, AutoCompactionEvent,
|
auto_compaction_threshold_from_env, ApiClient, ApiRequest, AssistantEvent, AutoCompactionEvent,
|
||||||
ConversationRuntime, PromptCacheEvent, RuntimeError, StaticToolExecutor, ToolCall, ToolError,
|
ConversationRuntime, PromptCacheEvent, RuntimeError, StaticToolExecutor, ToolError,
|
||||||
ToolExecutor, ToolResult, TurnProgressReporter, TurnSummary,
|
ToolExecutor, TurnSummary,
|
||||||
};
|
};
|
||||||
pub use file_ops::{
|
pub use file_ops::{
|
||||||
edit_file, edit_file_in_workspace, glob_search, glob_search_in_workspace, grep_search,
|
edit_file, edit_file_in_workspace, glob_search, glob_search_in_workspace, grep_search,
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ impl Default for TridentConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Statistics from a Trident compaction run.
|
/// Statistics from a Trident compaction run.
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Default)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
pub struct TridentStats {
|
pub struct TridentStats {
|
||||||
pub superseded_count: usize,
|
pub superseded_count: usize,
|
||||||
pub collapsed_chains: usize,
|
pub collapsed_chains: usize,
|
||||||
@@ -41,6 +41,21 @@ pub struct TridentStats {
|
|||||||
pub final_message_count: usize,
|
pub final_message_count: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Default for TridentStats {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self {
|
||||||
|
superseded_count: 0,
|
||||||
|
collapsed_chains: 0,
|
||||||
|
messages_collapsed: 0,
|
||||||
|
clusters_found: 0,
|
||||||
|
messages_clustered: 0,
|
||||||
|
tokens_saved_estimate: 0,
|
||||||
|
original_message_count: 0,
|
||||||
|
final_message_count: 0,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl TridentStats {
|
impl TridentStats {
|
||||||
pub fn format_report(&self) -> String {
|
pub fn format_report(&self) -> String {
|
||||||
let compression = if self.final_message_count > 0 {
|
let compression = if self.final_message_count > 0 {
|
||||||
@@ -177,7 +192,7 @@ fn stage1_supersede(messages: &[ConversationMessage]) -> (Vec<ConversationMessag
|
|||||||
|
|
||||||
let mut obsolete_indices: BTreeSet<usize> = BTreeSet::new();
|
let mut obsolete_indices: BTreeSet<usize> = BTreeSet::new();
|
||||||
|
|
||||||
for ops in file_ops.values() {
|
for (_path, ops) in &file_ops {
|
||||||
if ops.len() < 2 {
|
if ops.len() < 2 {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -190,9 +205,9 @@ fn stage1_supersede(messages: &[ConversationMessage]) -> (Vec<ConversationMessag
|
|||||||
|
|
||||||
if let Some(last_write) = last_write_idx {
|
if let Some(last_write) = last_write_idx {
|
||||||
for op in ops {
|
for op in ops {
|
||||||
if (op.op_type == FileOp::Read
|
if op.op_type == FileOp::Read && op.index < last_write {
|
||||||
|| op.op_type == FileOp::Write
|
obsolete_indices.insert(op.index);
|
||||||
|| op.op_type == FileOp::Edit)
|
} else if (op.op_type == FileOp::Write || op.op_type == FileOp::Edit)
|
||||||
&& op.index < last_write
|
&& op.index < last_write
|
||||||
{
|
{
|
||||||
obsolete_indices.insert(op.index);
|
obsolete_indices.insert(op.index);
|
||||||
@@ -310,7 +325,7 @@ fn stage2_collapse(
|
|||||||
usage: None,
|
usage: None,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
result.append(&mut buffer);
|
result.extend(buffer.drain(..));
|
||||||
}
|
}
|
||||||
buffer.clear();
|
buffer.clear();
|
||||||
result.push(msg.clone());
|
result.push(msg.clone());
|
||||||
@@ -461,7 +476,7 @@ fn stage3_cluster(
|
|||||||
}
|
}
|
||||||
|
|
||||||
let total_clustered: usize = cluster_assignments.len();
|
let total_clustered: usize = cluster_assignments.len();
|
||||||
let clusters_found = cluster_id;
|
let clusters_found = cluster_id as usize;
|
||||||
|
|
||||||
let mut result: Vec<ConversationMessage> = Vec::new();
|
let mut result: Vec<ConversationMessage> = Vec::new();
|
||||||
let mut cluster_buffers: BTreeMap<usize, Vec<usize>> = BTreeMap::new();
|
let mut cluster_buffers: BTreeMap<usize, Vec<usize>> = BTreeMap::new();
|
||||||
@@ -662,7 +677,7 @@ fn truncate_text(text: &str, max_chars: usize) -> String {
|
|||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::compact::CompactionConfig;
|
use crate::compact::CompactionConfig;
|
||||||
use crate::session::{ContentBlock, ConversationMessage, Session};
|
use crate::session::{ContentBlock, ConversationMessage, MessageRole, Session};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn stage1_removes_obsolete_file_reads() {
|
fn stage1_removes_obsolete_file_reads() {
|
||||||
@@ -721,7 +736,7 @@ mod tests {
|
|||||||
fn stage2_collapses_chatty_messages() {
|
fn stage2_collapses_chatty_messages() {
|
||||||
let mut messages = vec![];
|
let mut messages = vec![];
|
||||||
for i in 0..6 {
|
for i in 0..6 {
|
||||||
messages.push(ConversationMessage::user_text(format!("ok {i}")));
|
messages.push(ConversationMessage::user_text(&format!("ok {i}")));
|
||||||
messages.push(ConversationMessage::assistant(vec![ContentBlock::Text {
|
messages.push(ConversationMessage::assistant(vec![ContentBlock::Text {
|
||||||
text: format!("got {i}"),
|
text: format!("got {i}"),
|
||||||
}]));
|
}]));
|
||||||
@@ -752,9 +767,9 @@ mod tests {
|
|||||||
},
|
},
|
||||||
]));
|
]));
|
||||||
messages.push(ConversationMessage::tool_result(
|
messages.push(ConversationMessage::tool_result(
|
||||||
format!("read_{i}"),
|
&format!("read_{i}"),
|
||||||
"read_file",
|
"read_file",
|
||||||
format!(r#"{{"path":"src/{i}.rs","content":"data {i}"}}"#),
|
&format!(r#"{{"path":"src/{i}.rs","content":"data {i}"}}"#),
|
||||||
false,
|
false,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ api = { path = "../api" }
|
|||||||
commands = { path = "../commands" }
|
commands = { path = "../commands" }
|
||||||
crossterm = "0.28"
|
crossterm = "0.28"
|
||||||
pulldown-cmark = "0.13"
|
pulldown-cmark = "0.13"
|
||||||
once_cell = "1"
|
|
||||||
rustyline = "15"
|
rustyline = "15"
|
||||||
runtime = { path = "../runtime" }
|
runtime = { path = "../runtime" }
|
||||||
plugins = { path = "../plugins" }
|
plugins = { path = "../plugins" }
|
||||||
@@ -26,15 +25,8 @@ tools = { path = "../tools" }
|
|||||||
log = "0.4"
|
log = "0.4"
|
||||||
|
|
||||||
|
|
||||||
[lints.rust]
|
[lints]
|
||||||
unsafe_code = "allow"
|
workspace = true
|
||||||
|
|
||||||
[lints.clippy]
|
|
||||||
all = { level = "warn", priority = -1 }
|
|
||||||
pedantic = { level = "allow", priority = -1 }
|
|
||||||
module_name_repetitions = "allow"
|
|
||||||
missing_panics_doc = "allow"
|
|
||||||
missing_errors_doc = "allow"
|
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
mock-anthropic-service = { path = "../mock-anthropic-service" }
|
mock-anthropic-service = { path = "../mock-anthropic-service" }
|
||||||
|
|||||||
@@ -18,8 +18,6 @@ pub enum ReadOutcome {
|
|||||||
Submit(String),
|
Submit(String),
|
||||||
Cancel,
|
Cancel,
|
||||||
Exit,
|
Exit,
|
||||||
ProviderSwap,
|
|
||||||
TeamToggle,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct SlashCommandHelper {
|
struct SlashCommandHelper {
|
||||||
@@ -88,19 +86,12 @@ impl Hinter for SlashCommandHelper {
|
|||||||
impl Highlighter for SlashCommandHelper {
|
impl Highlighter for SlashCommandHelper {
|
||||||
fn highlight<'l>(&self, line: &'l str, _pos: usize) -> Cow<'l, str> {
|
fn highlight<'l>(&self, line: &'l str, _pos: usize) -> Cow<'l, str> {
|
||||||
self.set_current_line(line);
|
self.set_current_line(line);
|
||||||
// When sentinel is present, show visible prompt instead of invisible char
|
Cow::Borrowed(line)
|
||||||
if line.contains('\x01') {
|
|
||||||
let display = line.replace('\x01', "\x1b[36m[Provider Swap]\x1b[0m ");
|
|
||||||
Cow::Owned(display)
|
|
||||||
} else {
|
|
||||||
Cow::Borrowed(line)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn highlight_char(&self, line: &str, _pos: usize, _kind: CmdKind) -> bool {
|
fn highlight_char(&self, line: &str, _pos: usize, _kind: CmdKind) -> bool {
|
||||||
self.set_current_line(line);
|
self.set_current_line(line);
|
||||||
// Re-highlight when sentinel is present to show the prompt
|
false
|
||||||
line.contains('\x01')
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,18 +115,6 @@ impl LineEditor {
|
|||||||
editor.set_helper(Some(SlashCommandHelper::new(completions)));
|
editor.set_helper(Some(SlashCommandHelper::new(completions)));
|
||||||
editor.bind_sequence(KeyEvent(KeyCode::Char('J'), Modifiers::CTRL), Cmd::Newline);
|
editor.bind_sequence(KeyEvent(KeyCode::Char('J'), Modifiers::CTRL), Cmd::Newline);
|
||||||
editor.bind_sequence(KeyEvent(KeyCode::Enter, Modifiers::SHIFT), Cmd::Newline);
|
editor.bind_sequence(KeyEvent(KeyCode::Enter, Modifiers::SHIFT), Cmd::Newline);
|
||||||
// Ctrl+P inserts a sentinel character that triggers provider swap.
|
|
||||||
// The sentinel is invisible but the highlighter shows "[Provider Swap]" prompt.
|
|
||||||
// User must press Enter to confirm (rustyline cannot chain commands).
|
|
||||||
editor.bind_sequence(
|
|
||||||
KeyEvent(KeyCode::Char('P'), Modifiers::CTRL),
|
|
||||||
Cmd::SelfInsert(1, '\x01'),
|
|
||||||
);
|
|
||||||
// Ctrl+T inserts a sentinel character that toggles agent teams mode.
|
|
||||||
editor.bind_sequence(
|
|
||||||
KeyEvent(KeyCode::Char('T'), Modifiers::CTRL),
|
|
||||||
Cmd::SelfInsert(1, '\x02'),
|
|
||||||
);
|
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
prompt: prompt.into(),
|
prompt: prompt.into(),
|
||||||
@@ -168,18 +147,7 @@ impl LineEditor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
match self.editor.readline(&self.prompt) {
|
match self.editor.readline(&self.prompt) {
|
||||||
Ok(line) => {
|
Ok(line) => Ok(ReadOutcome::Submit(line)),
|
||||||
// Ctrl+P inserts \x01 sentinel — triggers provider swap wizard.
|
|
||||||
// The sentinel is stripped and we return ProviderSwap to the REPL loop.
|
|
||||||
if line.contains('\x01') {
|
|
||||||
return Ok(ReadOutcome::ProviderSwap);
|
|
||||||
}
|
|
||||||
// Ctrl+T inserts \x02 sentinel — toggles team mode.
|
|
||||||
if line.contains('\x02') {
|
|
||||||
return Ok(ReadOutcome::TeamToggle);
|
|
||||||
}
|
|
||||||
Ok(ReadOutcome::Submit(line))
|
|
||||||
}
|
|
||||||
Err(ReadlineError::Interrupted) => {
|
Err(ReadlineError::Interrupted) => {
|
||||||
let has_input = !self.current_line().is_empty();
|
let has_input = !self.current_line().is_empty();
|
||||||
self.finish_interrupted_read()?;
|
self.finish_interrupted_read()?;
|
||||||
|
|||||||
File diff suppressed because it is too large.
Load diff
@@ -1,118 +0,0 @@
|
|||||||
# Multi-Tool Execution & Sub-Agent Delegation
|
|
||||||
|
|
||||||
Two complementary features that dramatically reduce latency and token usage when the model needs to perform multiple operations or gather context.
|
|
||||||
|
|
||||||
## Feature 1: Parallel Tool Execution
|
|
||||||
|
|
||||||
When the model returns multiple tool_use blocks in a single response, read-only tools now execute concurrently instead of sequentially.
|
|
||||||
|
|
||||||
### How it works
|
|
||||||
|
|
||||||
The `run_turn` loop is refactored into 3 phases:
|
|
||||||
|
|
||||||
1. **Pre-hooks + permission checks** (sequential — hooks may mutate state)
|
|
||||||
2. **Tool execution** (batch — parallel for read-only tools via `std::thread::scope`)
|
|
||||||
3. **Post-hooks + session updates** (sequential — preserves original ordering)
|
|
||||||
|
|
||||||
### Parallel-safe tools
|
|
||||||
|
|
||||||
These tools are safe to run concurrently because they only read state and dispatch through the stateless tool registry:
|
|
||||||
|
|
||||||
- `read_file`, `glob_search`, `grep_search`
|
|
||||||
- `WebFetch`, `WebSearch`
|
|
||||||
- `ToolSearch`, `Skill`
|
|
||||||
- `LSP`
|
|
||||||
- `GitStatus`, `GitDiff`, `GitLog`, `GitShow`, `GitBlame`
|
|
||||||
|
|
||||||
### Sequential-only tools
|
|
||||||
|
|
||||||
Tools that require `&mut self` or have side effects continue to run one at a time:
|
|
||||||
|
|
||||||
- `bash`, `write_file`, `edit_file` (side effects)
|
|
||||||
- `MCP`, `McpAuth`, `RemoteTrigger` (network state)
|
|
||||||
- `Agent`, `TaskCreate`, `WorkerCreate` (stateful)
|
|
||||||
- `NotebookEdit`, `REPL`, `PowerShell` (side effects)
|
|
||||||
|
|
||||||
### Safety guarantees
|
|
||||||
|
|
||||||
- Pre/post hooks always run sequentially
|
|
||||||
- Permission checks complete before any tool executes
|
|
||||||
- Tool results are pushed to the session in the original model order
|
|
||||||
- Falls back to sequential for single-tool batches
|
|
||||||
- Thread scopes ensure all parallel work completes before `execute_batch` returns
|
|
||||||
|
|
||||||
### Impact
|
|
||||||
|
|
||||||
For a response with 5 `read_file` calls: **~5x faster** execution. The main model still sees all results in order.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Feature 2: SubAgent Delegation
|
|
||||||
|
|
||||||
A `SubAgent` tool that lets the main model delegate multi-step tasks to a fast sub-agent. The sub-agent runs autonomously with its own `ConversationRuntime`, making multiple tool calls without round-tripping through the main model.
|
|
||||||
|
|
||||||
### Tool parameters
|
|
||||||
|
|
||||||
| Parameter | Type | Required | Description |
|
|
||||||
|-----------|------|----------|-------------|
|
|
||||||
| `prompt` | string | yes | Task description for the sub-agent |
|
|
||||||
| `task_type` | string | no | `Explore` (default), `Plan`, or `Verify` |
|
|
||||||
| `model` | string | no | Override the sub-agent model |
|
|
||||||
|
|
||||||
### Task types
|
|
||||||
|
|
||||||
| Type | Available tools | Use for |
|
|
||||||
|------|----------------|---------|
|
|
||||||
| `Explore` | read_file, glob_search, grep_search, WebFetch, WebSearch, ToolSearch, StructuredOutput | Searching code, reading files, gathering context |
|
|
||||||
| `Plan` | Explore + TodoWrite | Planning approaches with structured todo output |
|
|
||||||
| `Verify` | Plan + bash | Running tests, checking builds, verifying changes |
|
|
||||||
|
|
||||||
### Configuration
|
|
||||||
|
|
||||||
Set the sub-agent model in `~/.claw/settings.json`:
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"model": "openai/glm-5.1-fast",
|
|
||||||
"subagentModel": "openai/qwen3.6-35b-fast"
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
If `subagentModel` is not set, the sub-agent uses the same model as the main session (or the `model` override parameter on the tool call).
|
|
||||||
|
|
||||||
### Example
|
|
||||||
|
|
||||||
Main model prompt: "Find all Rust files that import `ConversationRuntime` and list their paths"
|
|
||||||
|
|
||||||
Without SubAgent: 5–10 sequential tool calls (grep → read each file → summarize)
|
|
||||||
With SubAgent: 1 SubAgent call → sub-agent does all the work autonomously → returns summary
|
|
||||||
|
|
||||||
**Result**: ~10x fewer tokens consumed by the main model, faster overall completion.
|
|
||||||
|
|
||||||
### Architecture
|
|
||||||
|
|
||||||
The sub-agent reuses the same building blocks as the existing `Agent` tool:
|
|
||||||
|
|
||||||
- `ProviderRuntimeClient` — API client with fallback chain
|
|
||||||
- `SubagentToolExecutor` — filtered tool access with permission enforcement
|
|
||||||
- `ConversationRuntime` — full conversation loop with hooks and compaction
|
|
||||||
- `agent_permission_policy()` — auto-approve read-only, deny write tools
|
|
||||||
|
|
||||||
Key differences from the `Agent` tool:
|
|
||||||
- **Synchronous** — blocks until complete, returns result directly
|
|
||||||
- **Lighter** — fewer default tools, focused on the task type
|
|
||||||
- **Configurable model** — uses `subagentModel` or the tool's `model` param
|
|
||||||
- **Structured output** — returns `result`, `tool_calls`, and `iterations`
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Changed files
|
|
||||||
|
|
||||||
| File | Changes |
|
|
||||||
|------|---------|
|
|
||||||
| `rust/crates/runtime/src/conversation.rs` | `ToolCall`, `ToolResult` types; `execute_batch` on `ToolExecutor`; 3-phase `run_turn` |
|
|
||||||
| `rust/crates/runtime/src/lib.rs` | Exports for `ToolCall`, `ToolResult` |
|
|
||||||
| `rust/crates/runtime/src/config.rs` | `subagent_model` field, `parse_optional_subagent_model()`, accessor |
|
|
||||||
| `rust/crates/runtime/src/config_validate.rs` | `subagentModel` field spec |
|
|
||||||
| `rust/crates/rusty-claude-cli/src/main.rs` | `CliToolExecutor::execute_batch` with parallel-safe classification |
|
|
||||||
| `rust/crates/tools/src/lib.rs` | `SubAgent` tool spec, `SubAgentInput`, `run_sub_agent()`, `load_subagent_model_from_config()`, `build_sub_agent_system_prompt()` |
|
|
||||||
@@ -116,8 +116,6 @@ mod tests {
|
|||||||
lane_events: vec![],
|
lane_events: vec![],
|
||||||
derived_state: "working".to_string(),
|
derived_state: "working".to_string(),
|
||||||
current_blocker: None,
|
current_blocker: None,
|
||||||
team_id: None,
|
|
||||||
task_id: None,
|
|
||||||
error: None,
|
error: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+50
-1859
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user