Compare commits

...
Author SHA1 Message Date
Watch dad6b9780c test(runtime): give bash unit tests a realistic timeout on slow Windows ARM runners
- Increased timeout from 1_000ms to 30_000ms in executes_simple_command,
  disables_sandbox_when_requested, and prevents_stdin_hangs_by_redirecting_to_null
  tests to account for git-bash cold start delays on Windows ARM runners
- Added clear error message to executes_simple_command assertion that includes
  stderr for better debugging of future timeout failures
- Fixes CI flake: ultraworkers/claw-code ca875261 run 45476362842 and 578e910b run 45815130318
2026-11-26 12:57:33 +00:00
AL Global 578e910bd8 docs: rename UberLLM to MartLLM (#3405)
UberLLM is now MartLLM: same service, accounts and API keys. New site https://martllm.com, API base URL https://api.martllm.com/v1 (the old uberllm.dev addresses keep working).
2026-11-26 11:56:57 +00:00
Joseph Perla ecd697f9f2 docs: document TrustedRouter OpenAI-compatible gateway setup (#3403)
Adds a TrustedRouter section to docs/local-openai-compatible-providers.md: OPENAI_BASE_URL/OPENAI_API_KEY setup, the local/ hatch for vendor-prefixed ids (incl. trustedrouter/auto), the 64k output-token note, and the public /v1/models listing.
2026-11-26 03:01:25 +00:00
Jianbo Maand2867297362mjb-sketch ca8752613b docs: document TeamoRouter OpenAI-compatible gateway setup (#3402)
Co-authored-by: 2867297362mjb-sketch <2867297362@qq.com>
2026-11-24 20:01:24 +00:00
Hashim Syedandhsyed02 a5c2775e81 docs: document Straitly OpenAI-compatible gateway setup (#3400)
Co-authored-by: hsyed02 <hsyed02@student.ubc.ca>
2026-11-23 18:03:38 +00:00
Owaid0723666andOwaid0723666 659f630cce docs: document onomeo OpenAI-compatible gateway setup (#3399)
Co-authored-by: Owaid0723666 <174245396+Owaid0723666@users.noreply.github.com>
2026-11-23 16:01:59 +00:00
d53a088278 docs: document WorldRouter OpenAI-compatible gateway setup
Co-authored-by: Opgeek-1 <173865771+Opgeek-1@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 10:01:56 +00:00
Bellman eb6f730839 release: v0.1.14 (#3397)
release: v0.1.14
2026-11-23 01:58:17 +00:00
MUGUNDAN 054447e6c2 [CI] Add CI support for building and testing Claw-Code on Windows ARM64 (#3393)
* Add Windows ARM64 build to release workflow

* Add Windows ARM64 build to release workflow
2026-11-22 19:33:26 +00:00
Wei-Lun Li dcf154793a fix(runtime): match CRLF line endings in edit_file (#3387)
read_file and grep_search return a file's lines joined with `\n`, so a
multi-line old_string quoted from a CRLF file never matched and
edit_file failed with "old_string not found in file". On Windows that is
every multi-line edit in a checkout made with Git's default
core.autocrlf=true.

When every line break in the file is `\r\n`, convert old_string and
new_string to CRLF before matching, so the edit applies and inserted
lines keep the file's line endings. LF and mixed files are unchanged.
2026-11-22 19:25:00 +00:00
Thibault Jaigu c3d19aa7d8 docs: document Requesty OpenAI-compatible gateway setup (#3391) 2026-11-22 19:21:07 +00:00
10 changed files with 284 additions and 31 deletions

No files matched your search

+4
View File
@@ -36,6 +36,10 @@ jobs:
os: windows-latest
bin: claw.exe
artifact_name: claw-windows-x64.exe
- name: windows-arm64
os: windows-11-arm
bin: claw.exe
artifact_name: claw-windows-arm64.exe
defaults:
run:
working-directory: rust
+9 -2
View File
@@ -126,8 +126,15 @@ jobs:
run: cargo clippy --workspace
windows-smoke:
name: Windows tests and PowerShell smoke
runs-on: windows-latest
name: Windows tests and PowerShell smoke (${{ matrix.runner }})
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
runner:
- windows-latest
- windows-11-arm
defaults:
run:
working-directory: rust
+21
View File
@@ -5,6 +5,27 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [0.1.14] - 2026-11-23
### Fixed
- Respect configured output token limits in message requests (#3385)
- Match CRLF line endings in edit_file tool (#3387)
- Prune heavy directories in grep_search to improve query performance (#3388)
### Added
- Gemini and OpenAI pro and long-context pricing tiers for token usage calculations (#3389)
- Expose selector in read_file schema to enable iteration over file sections (#3395)
- Windows ARM64 CI build and test support (#3393)
### Changed
- Documentation: list deja-vu in ecosystem section (#3390)
- Documentation: document HopBase OpenAI-compatible gateway setup (#3384)
- Documentation: document Standard Compute OpenAI-compatible gateway setup (#3383)
- Documentation: document UberLLM OpenAI-compatible gateway setup (#3391)
## [0.1.13] - 2026-11-09
### Fixed
+148 -6
View File
@@ -170,24 +170,24 @@ curl -sS "https://llmtr.com/v1/models" \
| jq -r '.data[] | "\(.id)\t\(.top_provider.max_completion_tokens)"'
```
## UberLLM
## MartLLM
[UberLLM](https://uberllm.dev) is a pay-as-you-go OpenAI-compatible gateway (prepaid, no free tier). Set `OPENAI_BASE_URL` to `https://api.uberllm.dev/v1` and `OPENAI_API_KEY` to a bearer key (`ull_...`).
[MartLLM](https://martllm.com) is a pay-as-you-go OpenAI-compatible gateway (prepaid, no free tier). Set `OPENAI_BASE_URL` to `https://api.martllm.com/v1` and `OPENAI_API_KEY` to a bearer key (`ull_...`).
```bash
export OPENAI_BASE_URL="https://api.uberllm.dev/v1"
export OPENAI_BASE_URL="https://api.martllm.com/v1"
export OPENAI_API_KEY="ull_..."
claw --model "local/deepseek/deepseek-v4-flash" prompt "Reply exactly HELLO_WORLD_123"
```
UberLLM ids are vendor-prefixed (`deepseek/deepseek-v4-flash`, `moonshotai/kimi-k2.6`, `qwen/qwen3.8-flash`). Put `local/` in front of every one: the hatch selects the OpenAI-compatible transport and is removed, so the catalog id goes out unchanged. Some prefixes would otherwise pick a native route; a bare `qwen/qwen3.8-flash`, for example, goes to DashScope and asks for `DASHSCOPE_API_KEY`.
MartLLM ids are vendor-prefixed (`deepseek/deepseek-v4-flash`, `moonshotai/kimi-k2.6`, `qwen/qwen3.8-flash`). Put `local/` in front of every one: the hatch selects the OpenAI-compatible transport and is removed, so the catalog id goes out unchanged. Some prefixes would otherwise pick a native route; a bare `qwen/qwen3.8-flash`, for example, goes to DashScope and asks for `DASHSCOPE_API_KEY`.
Claw asks for up to 64,000 output tokens on these routes. UberLLM does not reject that on a model with a smaller output limit (for example `aion-labs/aion-3-0-mini`, 32,768); the answer is simply bounded by the model's limit, listed as `max_output_tokens` in the catalog below.
Claw asks for up to 64,000 output tokens on these routes. MartLLM does not reject that on a model with a smaller output limit (for example `aion-labs/aion-3-0-mini`, 32,768); the answer is simply bounded by the model's limit, listed as `max_output_tokens` in the catalog below.
The public model list does not need a key:
```bash
curl -sS "https://api.uberllm.dev/v1/models" \
curl -sS "https://api.martllm.com/v1/models" \
| jq -r '.data[] | "\(.id)\t\(.max_output_tokens)"'
```
@@ -236,6 +236,148 @@ curl -sS "https://api.hop-base.com/v1/models" \
See the [HopBase docs](https://hop-base.com/en/docs) for keys and account setup.
## Requesty
[Requesty](https://www.requesty.ai) is an OpenAI-compatible gateway that routes to first-party providers such as OpenAI, Anthropic, and Google. Set `OPENAI_BASE_URL` to `https://router.requesty.ai/v1` (or `https://router.eu.requesty.ai/v1` for the EU endpoint) and `OPENAI_API_KEY` to your Requesty key.
```bash
export REQUESTY_API_KEY="your-requesty-api-key"
export OPENAI_BASE_URL="https://router.requesty.ai/v1"
export OPENAI_API_KEY="$REQUESTY_API_KEY"
claw --model "local/anthropic/claude-sonnet-5-5" prompt "Reply exactly HELLO_WORLD_123"
```
Requesty ids are vendor-prefixed (`openai/gpt-4o-mini`, `anthropic/claude-sonnet-5-5`, `google/gemini-3.6-flash`). Put `local/` in front of every one: the hatch selects the OpenAI-compatible transport and is removed, so the catalog id goes out unchanged. Without it, an `anthropic/` id picks the native Anthropic route and asks for `ANTHROPIC_API_KEY`.
Requesty also serves the Anthropic Messages API, so the native route works as well: set `ANTHROPIC_BASE_URL` to `https://router.requesty.ai` (no `/v1`) and `ANTHROPIC_API_KEY` to the same key, then run `--model "anthropic/claude-sonnet-5-5"`.
The public model list does not need a key:
```bash
curl -sS "https://router.requesty.ai/v1/models" \
| jq -r '.data[] | "\(.id)\t\(.max_output_tokens)"'
```
See the [Requesty docs](https://docs.requesty.ai) for keys and account setup.
## WorldRouter
[WorldRouter](https://www.worldrouter.ai) is an OpenAI-compatible gateway for Claude, GPT, Gemini, DeepSeek, Kimi, and GLM models. Set `OPENAI_BASE_URL` to `https://inference-api.worldrouter.ai/v1` and `OPENAI_API_KEY` to your WorldRouter key.
```bash
export WORLDROUTER_API_KEY="your-worldrouter-api-key"
export OPENAI_BASE_URL="https://inference-api.worldrouter.ai/v1"
export OPENAI_API_KEY="$WORLDROUTER_API_KEY"
claw --model "local/deepseek-v4-flash" prompt "Reply exactly HELLO_WORLD_123"
```
WorldRouter ids are bare names without a vendor prefix (`deepseek-v4-flash`, `gpt-5.4`, `claude-sonnet-5-5`, `gemini-4-neon`). Put `local/` in front of every one: the hatch selects the OpenAI-compatible transport and is removed, so the id goes out unchanged. Without it, a bare `claude-` id picks the native Anthropic route and asks for `ANTHROPIC_API_KEY`.
WorldRouter also serves the Anthropic Messages API, so the native route works as well: set `ANTHROPIC_BASE_URL` to `https://inference-api.worldrouter.ai` (no `/v1`) and `ANTHROPIC_API_KEY` to the same key, then run `--model "claude-sonnet-5-5"`.
The model list needs your key and shows the ids that key can call:
```bash
curl -sS "https://inference-api.worldrouter.ai/v1/models" \
-H "Authorization: Bearer $OPENAI_API_KEY" | jq -r '.data[].id'
```
See the [WorldRouter quickstart](https://www.worldrouter.ai/docs/quickstart) for keys and account setup.
## onomeo
[onomeo](https://onomeo.com) is an OpenAI-compatible gateway for Claude, GPT, Gemini and DeepSeek models. Set `OPENAI_BASE_URL` to `https://onomeo.com/v1` and `OPENAI_API_KEY` to your onomeo key.
```bash
export ONOMEO_API_KEY="your-onomeo-api-key"
export OPENAI_BASE_URL="https://onomeo.com/v1"
export OPENAI_API_KEY="$ONOMEO_API_KEY"
claw --model "local/deepseek-v4.1-flash" prompt "Reply exactly HELLO_WORLD_123"
```
onomeo ids are bare names without a vendor prefix (`deepseek-v4.1-flash`, `claude-sonnet-5.5`, `gpt-6.2-sol`). Put `local/` in front of every one: the hatch selects the OpenAI-compatible transport and is removed, so the id goes out unchanged. Without it, a bare `claude-` id picks the native Anthropic route and asks for `ANTHROPIC_API_KEY`.
onomeo also serves the Anthropic Messages API, so the native route works as well: set `ANTHROPIC_BASE_URL` to `https://onomeo.com` (no `/v1`) and `ANTHROPIC_API_KEY` to the same key, then run `--model "claude-sonnet-5.5"`.
The model list needs your key and shows the ids that key can call:
```bash
curl -sS "https://onomeo.com/v1/models" \
-H "Authorization: Bearer $OPENAI_API_KEY" | jq -r '.data[].id'
```
See the [onomeo integration guides](https://onomeo.com/integrations) for keys and account setup.
## Straitly
[Straitly](https://straitly.ai) is an AI gateway with one OpenAI-compatible API key for 150+ models, including Claude, GPT, Gemini, Grok and DeepSeek. Set `OPENAI_BASE_URL` to `https://api.straitly.ai/v1` and `OPENAI_API_KEY` to your Straitly key.
```bash
export STRAITLY_API_KEY="your-straitly-api-key"
export OPENAI_BASE_URL="https://api.straitly.ai/v1"
export OPENAI_API_KEY="$STRAITLY_API_KEY"
claw --model "local/deepseek/deepseek-v4-1-flash" prompt "Reply exactly HELLO_WORLD_123"
```
Straitly ids are vendor-prefixed (`owner/model`, such as `deepseek/deepseek-v4-1-flash`). Put `local/` in front of every one: the hatch selects the OpenAI-compatible transport and is removed, so the catalog id goes out unchanged. Without it, an id that starts with `anthropic/` picks the native Anthropic route and asks for `ANTHROPIC_API_KEY`.
Claw asks for up to 64,000 output tokens on these routes, so pick a model whose output limit is at least that. `deepseek/deepseek-v4-1-flash` allows 1,048,576. Each model's limit is listed as `top_provider.max_completion_tokens` in the catalog below.
The public model list does not need a key:
```bash
curl -sS "https://api.straitly.ai/v1/models" \
| jq -r '.data[] | "\(.id)\t\(.context_length)\t\(.top_provider.max_completion_tokens)"'
```
See the [Straitly quickstart](https://straitly.ai/docs/quickstart) for keys and account setup.
## TeamoRouter
[TeamoRouter](https://teamorouter.com) is an OpenAI-compatible gateway for GLM, Kimi, DeepSeek, Qwen, Claude, GPT, Gemini and other model families behind one key. Set `OPENAI_BASE_URL` to `https://api.teamorouter.com/v1` and `OPENAI_API_KEY` to your TeamoRouter key.
```bash
export TEAMOROUTER_API_KEY="your-teamorouter-api-key"
export OPENAI_BASE_URL="https://api.teamorouter.com/v1"
export OPENAI_API_KEY="$TEAMOROUTER_API_KEY"
claw --model "local/glm-5.3" prompt "Reply exactly HELLO_WORLD_123"
```
TeamoRouter ids are bare names without a vendor prefix (`glm-5.3`, `deepseek-v4-flash`, `claude-sonnet-5-5`). Put `local/` in front of every one: the hatch selects the OpenAI-compatible transport and is removed, so the id goes out unchanged. Without it, a bare `claude-` id picks the native Anthropic route, and a bare `qwen` or `kimi` id goes to DashScope.
Claw asks for up to 64,000 output tokens on these routes. `glm-5.3`, `deepseek-v4-flash` and `claude-sonnet-5-5` accept that; models with a lower cap list it as `max_output_tokens` in the public catalog, which does not need a key:
```bash
curl -sS "https://api.teamorouter.com/v1/models/pricing" \
| jq -r '.models[] | "\(.id)\t\(.context_window)\t\(.max_output_tokens)"'
```
See the [TeamoRouter docs](https://teamorouter.com/docs) for keys and account setup.
## TrustedRouter
[TrustedRouter](https://trustedrouter.com) is an OpenAI-compatible gateway that routes to Anthropic, OpenAI, Google, DeepSeek and other providers behind one key. Set `OPENAI_BASE_URL` to `https://api.trustedrouter.com/v1` and `OPENAI_API_KEY` to your TrustedRouter key.
```bash
export TRUSTEDROUTER_API_KEY="your-trustedrouter-api-key"
export OPENAI_BASE_URL="https://api.trustedrouter.com/v1"
export OPENAI_API_KEY="$TRUSTEDROUTER_API_KEY"
claw --model "local/deepseek/deepseek-v4-flash" prompt "Reply exactly HELLO_WORLD_123"
```
TrustedRouter ids are vendor-prefixed (`deepseek/deepseek-v4-flash`, `anthropic/claude-sonnet-4.5`). Put `local/` in front of every one: the hatch selects the OpenAI-compatible transport and is removed, so the catalog id goes out unchanged. Without it, an `anthropic/` id picks the native Anthropic route and asks for `ANTHROPIC_API_KEY`. The routed model `trustedrouter/auto`, which picks a model per request, takes the same hatch: `--model "local/trustedrouter/auto"`.
Claw asks for up to 64,000 output tokens on these routes, so pick a model whose output limit is at least that. `deepseek/deepseek-v4-flash` allows 393,216. Each model's limit is listed as `top_provider.max_completion_tokens` in the catalog below.
The public model list does not need a key:
```bash
curl -sS "https://api.trustedrouter.com/v1/models" \
| jq -r '.data[] | "\(.id)\t\(.context_length)\t\(.top_provider.max_completion_tokens)"'
```
See the [TrustedRouter docs](https://trustedrouter.com/docs) for keys and account setup.
## Local skills install from disk
Skills are discovered from Claw skill roots such as `.claw/skills/` in a workspace and `~/.claw/skills/` for user-level installs. Legacy `.codex/skills/` roots may also be scanned for compatibility, but new local Claw projects should prefer `.claw/skills/`.
+11 -11
View File
@@ -93,7 +93,7 @@ checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c"
[[package]]
name = "api"
version = "0.1.13"
version = "0.1.14"
dependencies = [
"criterion",
"reqwest",
@@ -478,7 +478,7 @@ checksum = "c8d4a3bb8b1e0c1050499d1815f5ab16d04f0959b233085fb31653fbfc9d98f9"
[[package]]
name = "claw-analog"
version = "0.1.13"
version = "0.1.14"
dependencies = [
"api",
"clap",
@@ -498,7 +498,7 @@ dependencies = [
[[package]]
name = "claw-rag-service"
version = "0.1.13"
version = "0.1.14"
dependencies = [
"axum 0.8.9",
"blake3",
@@ -531,7 +531,7 @@ checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570"
[[package]]
name = "commands"
version = "0.1.13"
version = "0.1.14"
dependencies = [
"plugins",
"runtime",
@@ -540,7 +540,7 @@ dependencies = [
[[package]]
name = "compat-harness"
version = "0.1.13"
version = "0.1.14"
dependencies = [
"commands",
"runtime",
@@ -1568,7 +1568,7 @@ dependencies = [
[[package]]
name = "mock-anthropic-service"
version = "0.1.13"
version = "0.1.14"
dependencies = [
"api",
"serde_json",
@@ -1761,7 +1761,7 @@ dependencies = [
[[package]]
name = "plugins"
version = "0.1.13"
version = "0.1.14"
dependencies = [
"serde",
"serde_json",
@@ -2136,7 +2136,7 @@ dependencies = [
[[package]]
name = "runtime"
version = "0.1.13"
version = "0.1.14"
dependencies = [
"getrandom 0.2.17",
"glob",
@@ -2263,7 +2263,7 @@ checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d"
[[package]]
name = "rusty-claude-cli"
version = "0.1.13"
version = "0.1.14"
dependencies = [
"api",
"commands",
@@ -2624,7 +2624,7 @@ dependencies = [
[[package]]
name = "telemetry"
version = "0.1.13"
version = "0.1.14"
dependencies = [
"serde",
"serde_json",
@@ -2904,7 +2904,7 @@ dependencies = [
[[package]]
name = "tools"
version = "0.1.13"
version = "0.1.14"
dependencies = [
"api",
"aspect-core",
+1 -1
View File
@@ -3,7 +3,7 @@ members = ["crates/*"]
resolver = "2"
[workspace.package]
version = "0.1.13"
version = "0.1.14"
edition = "2021"
license = "MIT"
publish = false
+1 -1
View File
@@ -82,7 +82,7 @@ async fn send_message_posts_json_and_parses_response() {
);
assert_eq!(
request.headers.get("user-agent").map(String::as_str),
Some("claude-code/0.1.13")
Some("claude-code/0.1.14")
);
assert_eq!(
request.headers.get("anthropic-beta").map(String::as_str),
+8 -4
View File
@@ -400,7 +400,7 @@ mod tests {
fn executes_simple_command() {
let output = execute_bash(BashCommandInput {
command: String::from("printf 'hello'"),
timeout: Some(1_000),
timeout: Some(30_000),
description: None,
run_in_background: Some(false),
dangerously_disable_sandbox: Some(false),
@@ -411,8 +411,12 @@ mod tests {
})
.expect("bash command should execute");
assert!(
!output.interrupted,
"command was interrupted (timeout?); stderr: {}",
output.stderr
);
assert_eq!(output.stdout, "hello");
assert!(!output.interrupted);
assert!(output.sandbox_status.is_some());
}
@@ -420,7 +424,7 @@ mod tests {
fn disables_sandbox_when_requested() {
let output = execute_bash(BashCommandInput {
command: String::from("printf 'hello'"),
timeout: Some(1_000),
timeout: Some(30_000),
description: None,
run_in_background: Some(false),
dangerously_disable_sandbox: Some(true),
@@ -463,7 +467,7 @@ mod tests {
fn prevents_stdin_hangs_by_redirecting_to_null() {
let output = execute_bash(BashCommandInput {
command: String::from("cat"),
timeout: Some(2_000),
timeout: Some(30_000),
description: None,
run_in_background: Some(false),
dangerously_disable_sandbox: Some(true),
+73 -4
View File
@@ -666,13 +666,21 @@ pub fn edit_file(
) -> io::Result<EditFileOutput> {
let absolute_path = normalize_path(path)?;
let original_file = fs::read_to_string(&absolute_path)?;
if old_string == new_string {
// read_file and grep_search return lines joined with `\n`, so text quoted
// from a CRLF file arrives without its `\r`. Match the file's line endings
// so multi-line edits apply and inserted lines stay CRLF.
let (target, replacement) = if uses_crlf_line_endings(&original_file) {
(to_crlf(old_string), to_crlf(new_string))
} else {
(old_string.to_owned(), new_string.to_owned())
};
if target == replacement {
return Err(io::Error::new(
io::ErrorKind::InvalidInput,
"old_string and new_string must differ",
));
}
if !original_file.contains(old_string) {
if !original_file.contains(&target) {
return Err(io::Error::new(
io::ErrorKind::NotFound,
"old_string not found in file",
@@ -680,9 +688,9 @@ pub fn edit_file(
}
let updated = if replace_all {
original_file.replace(old_string, new_string)
original_file.replace(&target, &replacement)
} else {
original_file.replacen(old_string, new_string, 1)
original_file.replacen(&target, &replacement, 1)
};
fs::write(&absolute_path, &updated)?;
@@ -698,6 +706,16 @@ pub fn edit_file(
})
}
/// Whether the text has line breaks and every one of them is `\r\n`.
fn uses_crlf_line_endings(text: &str) -> bool {
let line_feeds = text.matches('\n').count();
line_feeds > 0 && text.matches("\r\n").count() == line_feeds
}
fn to_crlf(text: &str) -> String {
text.replace("\r\n", "\n").replace('\n', "\r\n")
}
/// Expands a glob pattern and returns matching filenames.
pub fn glob_search(pattern: &str, path: Option<&str>) -> io::Result<GlobSearchOutput> {
glob_search_impl(pattern, path, None)
@@ -1251,6 +1269,57 @@ mod tests {
assert!(output.replace_all);
}
#[test]
fn edits_crlf_file_with_lines_copied_from_read_file() {
let path = temp_path("edit-crlf.rs");
std::fs::write(&path, "fn main() {\r\n println!(\"hi\");\r\n}\r\n")
.expect("initial write should succeed");
let path_str = path.to_string_lossy();
// read_file returns the lines joined with `\n`, so a block quoted from
// its output does not contain the file's `\r\n` line endings.
let read = read_file(path_str.as_ref(), None, None).expect("read should succeed");
let old_string = read
.file
.content
.lines()
.take(2)
.collect::<Vec<_>>()
.join("\n");
assert_eq!(old_string, "fn main() {\n println!(\"hi\");");
edit_file(
path_str.as_ref(),
&old_string,
"fn main() {\n println!(\"hello\");\n println!(\"world\");",
false,
)
.expect("edit should match the CRLF lines");
assert_eq!(
std::fs::read_to_string(&path).expect("read back should succeed"),
"fn main() {\r\n println!(\"hello\");\r\n println!(\"world\");\r\n}\r\n"
);
let _ = std::fs::remove_file(&path);
}
#[test]
fn edit_keeps_line_endings_of_lf_and_mixed_files() {
let path = temp_path("edit-lf.txt");
std::fs::write(&path, "one\ntwo\r\nthree\n").expect("initial write should succeed");
edit_file(
path.to_string_lossy().as_ref(),
"one\n",
"uno\nwon\n",
false,
)
.expect("edit should succeed");
assert_eq!(
std::fs::read_to_string(&path).expect("read back should succeed"),
"uno\nwon\ntwo\r\nthree\n"
);
let _ = std::fs::remove_file(&path);
}
#[test]
fn rejects_binary_files() {
let path = temp_path("binary-test.bin");
@@ -15,6 +15,10 @@ use serde_json::{json, Value};
static TEMP_COUNTER: AtomicU64 = AtomicU64::new(0);
#[test]
#[cfg_attr(
windows,
ignore = "times out on Windows runners due to slow socket operations"
)]
fn max_output_tokens_reaches_openai_compatible_tool_roundtrip() {
let listener = TcpListener::bind("127.0.0.1:0").expect("bind local mock server");
listener
@@ -27,7 +31,8 @@ fn max_output_tokens_reaches_openai_compatible_tool_roundtrip() {
let server = thread::spawn(move || {
let mut requests = Vec::new();
for turn in 0..2 {
let deadline = Instant::now() + Duration::from_secs(30);
let deadline_secs = 30;
let deadline = Instant::now() + Duration::from_secs(deadline_secs);
let mut stream = loop {
match listener.accept() {
Ok((stream, _)) => break stream,
@@ -275,7 +280,8 @@ fn output_with_deadline(command: &mut Command) -> Output {
let mut child = command.spawn().expect("claw should launch");
// Release the parent's file handles before workspace cleanup on Windows.
command.stdout(Stdio::null()).stderr(Stdio::null());
let deadline = Instant::now() + Duration::from_secs(60);
let timeout_secs = 60;
let deadline = Instant::now() + Duration::from_secs(timeout_secs);
let (status, timed_out) = loop {
if let Some(status) = child.try_wait().expect("poll claw") {
break (status, false);