Commit Graph
1206 Commits
Author SHA1 Message Date
clawdbot 89e717ec09 release: bump version to 0.1.6 and add CHANGELOG entry 2026-10-13 07:06:33 +00:00
Bellmanandclawdbot 01e9fc3229 [Slice 1.3] SDK session lifecycle & reconciliation (#3351)
* feat(sdk): implement session lifecycle and reconciliation

* fix(sdk): serialize session lifecycle recovery

* fix(sdk): preserve lifecycle outcomes and output

---------

Co-authored-by: clawdbot <clawdbot@ultraworkers.dev>
2026-10-13 07:02:25 +01:00
clawdbot 0e54dec1c9 test: make sandbox status check environment-aware
The /sandbox status can be 'ok' (with namespace isolation) or 'warn' (in
restricted environments like CI without unshare support). Update the test
to accept either value rather than hard-coding an expectation.
2026-10-13 03:05:56 +00:00
clawdbot c4ce758d5e test: fix version expectation in client_integration and sandbox status test
- Update client_integration.rs user-agent assertion to expect version 0.1.5
- Fix output_format_contract.rs /sandbox status expectation from 'warn' to 'ok'
2026-10-13 03:02:30 +00:00
clawdbot 4a920fb281 release: bump version to 0.1.5 and add CHANGELOG entry 2026-10-13 02:58:13 +00:00
Bellmanandclawdbot 192d40a860 feat(sdk): complete WebSocket client transport (#3349)
Co-authored-by: clawdbot <clawdbot@ultraworkers.dev>
2026-10-13 03:40:03 +01:00
clawdbot cf8f1da360 style: cargo fmt after #3346 2026-10-13 01:57:43 +00:00
Bellmanandclawdbot 0274174536 fix: isolate OPENAI_BASE_URL in provider hint test to prevent environment pollution (#3347)
The test explicit_model_provider_hint_controls_runtime_provider_dispatch
was failing when OPENAI_BASE_URL was set in the environment to a non-standard
URL (e.g., api.layofflabs.com). The test expects the OpenAI provider to use
the default base URL (api.openai.com) when no explicit base_url is provided
in the ProviderConfig.

This fix adds an EnvVarGuard struct to the tests module and uses it to
ensure OPENAI_BASE_URL is unset before running the test, preventing
environment pollution from affecting the test result.

Fixes: https://github.com/ultraworkers/claw-code/issues/3345

Co-authored-by: clawdbot <clawdbot@ultraworkers.dev>
2026-10-13 10:13:23 +09:00
Bellman da6a1692cf Merge pull request #3345 from ultraworkers/lane/skills-bundled-registry-chaining
feat(skills): implement bundled skills registry and chaining (#3324)
2026-10-13 10:10:35 +09:00
Bellman 6cddf08934 Merge pull request #3344 from ultraworkers/lane/issue-3321-sdk-operation-registry
feat(sdk): add operation registry and schema validation (#3321)
2026-10-13 10:08:59 +09:00
Bellmanandclawdbot d9d5d5da08 feat(runtime): implement per-session settings override & schema validation (#3346)
Implement issue #3325 (Slice 3.1) Config: Settings Override & Schema Validation

Additions:
- Setting schema registry with support for multiple value types
- SessionSettings struct with three-level hierarchy (global, session, request)
- SettingApplicator for merging and applying settings
- ConfigHotreloadMonitor for filesystem monitoring
- 36 comprehensive tests covering:
  - Schema validation with allowed values
  - Override hierarchy (request > session > global > default)
  - Permission mode overrides per-session
  - Temperature/token overrides work correctly
  - Dynamic setting application mid-session
  - Settings propagation to all tools
  - Config hotreload detection
  - Default values and type validation
  - Non-overridable settings

Size: ~750 LOC with tests

References:
- Issue #3325: [Slice 3.1] Config: Settings Override & Schema Validation
- Crate: runtime (enhance existing config.rs)

Co-authored-by: clawdbot <clawdbot@ultraworkers.dev>
2026-10-13 10:07:54 +09:00
clawdbot 592beb5584 style: fix cargo fmt issues 2026-10-13 01:06:46 +00:00
clawdbot cd04270a17 feat(skills): implement bundled skills registry and skill chaining support (#3324)
- Add SkillOrigin::Bundled variant to support bundled skills registry
- Implement bundled_skill_root() function for discovering bundled skills
- Update skill discovery to include bundled skills from standard install paths
- Create example bundled skills (example-skill, chain-example)
- Add comprehensive tests for bundled skills discovery and metadata
- Bundled skills follow same directory structure as plugins
- Skills can now chain/invoke other skills using standard dispatch mechanisms
- Maintains backward compatibility with existing SkillsDir and LegacyCommandsDir
2026-10-13 01:05:22 +00:00
clawdbot e28d9c1e25 feat(sdk): add operation registry and schema validation (#3321)
- Implement OperationRegistry with standard query, control, and event operations
- Add Schema struct for defining input/output schemas
- Add OperationMetadata for rich operation descriptions
- Add Frame methods to extract operation and input from broker requests
- Add comprehensive tests demonstrating the gap and the fix
- Operations can be discovered, validated, and customized

This addresses issue #3321 (Slice 1.2): SDK operation registry & schema validation.

The gap: The original SDK allowed any operation name with no validation.
The fix: A registry-based system that defines valid operations and their schemas.
2026-10-13 01:03:43 +00:00
Bellman 09f3b366ba Merge pull request #3339 from ultraworkers/lane/gjc-s32-r4-commands-impl
feat: implement /tools and /info slash commands
2026-10-13 09:24:24 +09:00
clawdbot d6b8202738 fix: update slash_command_specs count in test
Added /tools and /info commands increases the spec count from 140 to 142.
Update the test assertion to reflect the new count.
2026-10-13 00:19:41 +00:00
Bellman 12d8177608 Merge pull request #3335 from ultraworkers/lane/pr-3255
feat(cli): press Esc to interrupt a running turn
2026-10-13 09:18:54 +09:00
clawdbot 350e907e35 Revert "Merge pull request #3341 from ultraworkers/fix/rebase-on-main"
This reverts commit 734558eb31, reversing
changes made to 942805175a.
2026-10-13 00:14:54 +00:00
Bellman 734558eb31 Merge pull request #3341 from ultraworkers/fix/rebase-on-main
feat(team): team enhancements, subagentModel, parallel tool exec (fixed from #3250)
2026-10-13 09:13:47 +09:00
Bellman 942805175a Merge pull request #3338 from ultraworkers/lane/pr-3248
feat: custom-openai provider namespace with separate env vars
2026-10-13 09:13:14 +09:00
clawdbot dfa1e4f71e fix: resolve merge conflicts and test compatibility
- Resolve .gitignore conflict: include both nix entries and .claude/
- Update AnthropicRuntimeClient::new() test calls to match new signature
- Fix explicit_model_provider_hint test to unset OPENAI_BASE_URL env var
2026-10-13 00:12:36 +00:00
clawdbot 8a19ecd7cc fix: use PermissionMode.covers() instead of comparison operators
The PermissionMode enum intentionally does not implement PartialOrd
to prevent silent re-ranking of the privilege ladder. Use the explicit
covers() method for privilege comparisons instead of < and >=.
2026-10-13 00:12:35 +00:00
clawdbot 8938f53790 fix(clippy): resolve new lint violations in trident, compact, and claw-rag-service
- runtime/trident.rs: derive Default, fix for_kv_map, if_same_then_else, extend_with_drain, unnecessary_cast, needless_borrows
- runtime/compact.rs: fix useless_borrows_in_formatting
- claw-rag-service/ingest.rs: remove unnecessary into_iter()
- claw-rag-service/db.rs: use as_chunks instead of chunks_exact, remove unused import

All tests pass (1014 Rust + 47 Python tests verified).
2026-10-13 00:12:35 +00:00
TheArchitectit 5433dac4a2 fix(cli): order parallel tool results by call index and cap fan-out
execute_batch already keyed results to original call slots; this makes
that airtight: panicking worker threads resolve to their own index via
a fallback tuple instead of colliding with slot 0, and results are
asserted to follow call order with a regression test that mixes a
workspace-escape read among valid reads at cap=2.

Adds the fan-out bound: parallel-safe calls run in waves of at most
maxParallelToolCalls (default 8, CLAWD_PARALLEL_TOOL_CALLS env, or the
new setting applied via with_max_parallel_tool_calls at runtime build).
Sequential behavior is preserved: allowed_tools checks still run
before dispatch, and ToolSearch stays off the parallel path.
2026-10-13 00:12:35 +00:00
TheArchitectit f3a23bf39f feat(teams): bound per-team sub-agent concurrency with AgentGate
TeamCreate resolves maxConcurrentAgents from the per-team input, then
the maxConcurrentAgents setting, then unlimited (pre-fix behavior).
The cap is persisted in the manifest and registered on a process-wide
gate; agent threads still spawn immediately but block on an RAII slot
before entering their run loop, so manifest/task-claim semantics are
unchanged. TeamDelete forgets the gate so queued agents drain and no
stale team entries accumulate. Includes a gate regression test.
2026-10-13 00:12:35 +00:00
TheArchitectit 66006cca34 feat(config): parse maxParallelToolCalls and maxConcurrentAgents settings
Adds optional positive-integer parsing for the two new fan-out caps
next to subagentModel, in both camelCase and snake_case forms. Zero
parses as unset; non-numeric values are a named config error. Covered
by three regression tests mirroring the subagentModel test style.
2026-10-13 00:12:35 +00:00
TheArchitectitandClaw 08cce855b5 fix: restore workspace unsafe_code=forbid, fix TaskClaim TOCTOU, remove TUI deps
Review fixes for PR #3250:

1. Restore workspace-level unsafe_code = "forbid" (was downgraded to
   "warn" for TUI support). The per-crate [lints.rust] unsafe_code =
   "allow" on rusty-claude-cli already overrides it where needed.

2. Fix TaskClaim TOCTOU race in claim_task(). Replace exists()-then-write
   with OpenOptions::create_new(true) which atomically fails if the lock
   file already exists, eliminating the race window between the check and
   the write.

3. Remove TUI scaffolding deps (ratatui, tui-textarea, gag, crossbeam-channel,
   libc, unicode-width) and the /tui slash command spec — these belong in
   a future TUI PR and are unused in the current source.

Also updates the provider chain precedence test to reflect the new behavior
where the caller's resolved model is the chain primary.

Co-Authored-By: Claw <noreply@openclaw.ai>
2026-10-13 00:12:35 +00:00
TheArchitectit fe71ead55f test: add subagentModel accessor chain tests
Adds 3 unit tests covering the original silent-drop bug:
- camelCase 'subagentModel' key reads end-to-end
- snake_case 'subagent_model' key reads end-to-end
- blank value returns None (falls back to default model)

Requested by @1716775457damn in PR review.
2026-10-13 00:12:35 +00:00
TheArchitectit 334768249f fix: model_token_limit catch-all returns None for unknown models
Restores the fix from @Offwhite-Del that was lost during rebase.
Unknown models now return None so preflight skips the context-window
check and lets the API enforce its own limits.
2026-10-13 00:12:35 +00:00
TheArchitectit aab02464b2 cargo fmt 2026-10-13 00:12:35 +00:00
TheArchitectitandClaude Fable 5 7aa00a2798 feat(team): team enhancements, subagentModel, parallel tool exec
Port the agent-team enhancement layer onto upstream/main so the model
can spin up coordinated sub-agent teams for parallel work.

subagentModel config wiring (fix):
- Add subagent_model field to RuntimeFeatureConfig + RuntimeConfig::subagent_model()
  accessor so the subagentModel setting (already validated by config_validate.rs)
  is now actually read and stored.
- Agent tool's resolve_agent_model falls back to subagentModel from config
  when no explicit model is passed.

Provider namespace separation:
- New 'custom-openai' provider kind with dedicated env vars
  (CLAWCUSTOMOPENAI_API_KEY / CLAWCUSTOMOPENAI_BASE_URL)
- /setup wizard saves kind: 'custom-openai' for option 5
- Bare model name normalized to 'custom/' prefix to avoid proxy 404s
- Sub-agents inherit /setup-saved provider config via inject_config_as_env_fallbacks

Parallel tool execution:
- Override execute_batch to classify read-only tools as parallel-safe
  and run them concurrently via std::thread::scope
- Results return in original model order

Team coordination layer:
- AgentMessage, TaskClaim, TeamStatus tools + shared mailbox directory
- Mode presets (tiny/1x ... mega/6x) + enriched TeamCreate/Agent descriptions
- Background team watcher
- /team slash command: on/off/status/toggle

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-13 00:12:35 +00:00
clawdbot 837ffd0f6e feat: implement /tools and /info slash commands
- Add SlashCommand::Tools and SlashCommand::Info enum variants
- Add SLASH_COMMAND_SPECS entries for both commands
- Implement handlers in both REPL and CLI modes
- /tools lists available CLI tools with descriptions
- /info shows claw-code runtime information (version, git sha, rustc, target)
- Both commands return None from handle_slash_command, delegating to REPL/CLI layer
- Add test coverage for both commands in is_none test
- Implementations leverage existing tool specs and binary provenance infrastructure
2026-10-13 00:11:36 +00:00
clawdbot ab839bcfda fix: restore is_terminal() check for spinner in run_turn
The terminal check was removed during merge conflict resolution, causing
the spinner animation to be output to non-TTY streams (like pipes used
in tests), which corrupted the output format and broke the
text_prompt_mode_keeps_streamed_text_when_the_turn_fails test.

Restore the is_terminal() check to only animate when stdout is a real
terminal while keeping the interrupt feature.
2026-10-13 00:09:51 +00:00
Bellman 18c0bead90 Merge pull request #3336 from ultraworkers/lane/gjc-s32-r4
revert: duplicate /status /cost /version handlers (#3333)
2026-10-13 09:09:51 +09:00
clawdbotandTheArchitectit 9fadb16204 feat: integrate custom-openai provider namespace with separate env vars
- Add 'custom-openai' provider kind to setup_wizard.rs with distinct env namespace
- Add CustomOpenAi variant to ProviderConfigKind enum in api/client.rs
- Implement OpenAiCompatConfig::custom_openai() for custom-openai endpoint
- Update explicit_provider_kind_for_model() to handle 'custom-openai/' prefix
- Add tests for custom-openai configuration persistence across runtime boundary

Co-authored-by: TheArchitectit <thearchitectit@users.noreply.github.com>

Fixes #3248
2026-10-13 00:07:22 +00:00
Bellman 6f1819a8ee Merge pull request #3328 from ultraworkers/fix/issue-3259-comprehensive
fix(cli): comprehensive fix for issue #3259 - markdown streaming block spacing
2026-10-13 09:06:25 +09:00
clawdbot eb1537ca92 docs: add CHANGELOG for v0.1.4 release 2026-10-13 00:03:23 +00:00
clawdbot c13e71851b Revert "Merge pull request #3333 from ultraworkers/implement-slash-commands"
This reverts commit cf18dac3ee, reversing
changes made to a2eb74c00e.
2026-10-13 00:02:35 +00:00
amazd d4578586eb feat(cli): press Esc to interrupt a running turn
While a turn runs the main thread is blocked in the conversation loop,
so nothing reads the keyboard. Add an EscapeInterruptMonitor that, for
the duration of a turn on an interactive terminal, switches stdin to a
minimal non-canonical mode (echo/line-buffering off; ISIG and output
processing untouched, unlike full raw mode) and polls for a lone ESC
byte. Escape sequences such as arrow keys are recognized and swallowed.
On Esc it trips the TurnInterruptSignal: the in-flight request is
aborted and control returns to the REPL prompt with the session intact.

Permission prompts read whole lines from stdin mid-turn, so stdin
ownership is coordinated through a StdinPromptGate: while a prompt holds
a lease the listener restores canonical mode and stops consuming bytes.

Also:
- spinner shows '(esc to interrupt)' and the banner/help mention Esc
- WorkerStatus/WorkerEventKind gain an 'interrupted' lifecycle state
- non-terminal stdin and non-unix platforms skip the listener; Ctrl+C
  interruption still works there

Closes the Esc-to-interrupt feature request (#3196).
2026-10-13 00:02:11 +00:00
Bellman 0508c2aa05 Merge pull request #3334 from ultraworkers/lane/gjc-s21-conflicts
Implement :conflicts selector for read_file tool (#3323)
2026-10-13 09:02:11 +09:00
clawdbot 3d8fd5f917 fix(cli): comprehensive fix for issue #3259 - markdown streaming block spacing
Fixes #3259: When rendering markdown in streaming mode, block-level elements
(code blocks, lists, tables, etc.) were losing trailing newlines due to
render_markdown() calling trim_end(). This caused improper spacing when chunks
were split at block boundaries.

Solution:
- Track last_output_ends_with_newline in MarkdownStreamState to detect when
  previous output ended without proper spacing
- In push(): add leading newlines before block elements if previous chunk
  didn't end with newlines
- In push(): restore trailing newlines after code block/table closings that
  were trimmed by render_markdown()
- Add ensure_newlines() helper to prepare spacing before block starts
- Add comprehensive streaming tests that verify idempotence across all
  possible chunk split positions

This ensures that streaming renders produce byte-identical output regardless
of where the input is split into chunks, which is critical for displaying
markdown as it arrives from the API while maintaining proper formatting.
2026-10-13 00:01:51 +00:00
amazd 1efa72099d feat(cli): cancel in-flight model requests on turn interruption
Wire the runtime's TurnInterruptSignal through the CLI turn lifecycle:

- AnthropicRuntimeClient races the streaming request against the
  interrupt flag with tokio::select!; when the flag trips, the request
  future is dropped, aborting the in-flight HTTP stream for every
  provider variant.
- BuiltRuntime installs the shared signal into both the conversation
  loop and the API client.
- The per-turn Ctrl+C monitor now interrupts the whole turn instead of
  only aborting running hooks, so Ctrl+C mid-turn returns to the REPL
  prompt with partial output instead of leaving the request running.
- The REPL spinner reports an interrupted turn distinctly from a
  completed one.

Part of the Esc-to-interrupt work (#3196); the Esc key listener lands
separately.
2026-10-13 00:00:53 +00:00
amazd f58bf20aa3 feat(runtime): add TurnInterruptSignal for graceful turn interruption
Add a shared interrupt flag that the conversation loop polls at safe
points: before each model request, when a stream call fails, and before
each pending tool execution. When the flag is set the turn winds down
instead of failing: tools that have not run yet receive synthesized
error tool_results so every tool_use stays answered and the session
remains valid for the next request.

TurnSummary gains an interrupted field so callers can distinguish a
user-initiated stop from a completed turn, and the session tracer
records a turn_interrupted event (with iteration and phase) instead of
turn_failed / turn_completed.

Groundwork for Esc-to-interrupt (#3196): a follow-up wires this signal
into the streaming API client and the CLI input listener.
2026-10-13 00:00:53 +00:00
Bellman cf18dac3ee Merge pull request #3333 from ultraworkers/implement-slash-commands
feat: implement /status, /cost, and /version slash commands
2026-10-13 08:59:43 +09:00
clawdbot 2b64546b30 Apply rustfmt formatting 2026-10-12 23:59:04 +00:00
clawdbot 30f607e03a Implement :conflicts selector for read_file tool
- Add real git merge conflict extraction matching GJC behavior
- Extract unresolved conflict blocks (<<<<<<, =======, >>>>>>>)
- Support 3-way conflicts with diff3 markers (|||||||)
- Format conflicts as indexed summary with line ranges and labels
- Return clear 'No unresolved git merge conflicts' when clean
- Add comprehensive behavior tests for 2-way, 3-way, and no-conflicts cases
- Update documentation to mark :conflicts as implemented
- Closes #3323

Tests:
- read_with_selector_conflicts_no_conflicts: verifies clean file message
- read_with_selector_conflicts_two_way: verifies multiple conflict detection
- read_with_selector_conflicts_three_way: verifies diff3 marker support
2026-10-12 23:57:50 +00:00
clawdbot 4bd5a6381e feat: implement /status, /cost, and /version slash commands
- Add real implementations for /status, /cost, and /version slash commands
- /status shows session metadata including message count and token usage
- /cost displays cumulative token usage including cache metrics
- /version shows the claw-code version
- All three commands are fully backed by existing Session infrastructure
- Add comprehensive tests for all three commands
- Remove expectations that these commands return None

These commands fulfill the requirement to implement 2-3 missing GJC slash
commands that the existing claw-code runtime can fully support.
2026-10-12 23:57:07 +00:00
Bellman a2eb74c00e Merge pull request #3332 from ultraworkers/lane/gjc-s21
feat(tools): GJC-compatible read selectors (#3323)
2026-10-13 08:52:18 +09:00
clawdbot 44ff1249fa style: apply rustfmt formatting 2026-10-12 23:49:29 +00:00
clawdbot f4c375641a feat: wire GJC-style line range selector into read_file tool
- Add selector field to ReadFileInput accepting GJC syntax (:50, :50-200, :50+150, :raw)
- Implement read_file_with_selector and read_file_in_workspace_with_selector
- Add apply_line_selector to parse and apply selectors to file contents
- Add truncation_footer field to ReadFileOutput for GJC-compatible output
- Add comprehensive tests for selector parsing and application through tool entry point

Selectors take precedence over offset/limit for backward compatibility.
Closes #3323
2026-10-12 23:48:29 +00:00