Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 36 additions & 6 deletions docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -2145,17 +2145,47 @@
"group": "Rust",
"pages": [
"sdks/rust/api/README",
"sdks/rust/api/resq-ai",
"sdks/rust/api/resq-bin",
"sdks/rust/api/resq-ai/config",
"sdks/rust/api/resq-ai/index",
"sdks/rust/api/resq-ai/provider",
"sdks/rust/api/resq-ai/token",
"sdks/rust/api/resq-bin/analysis",
"sdks/rust/api/resq-bin/bin_explorer",
"sdks/rust/api/resq-bin/index",
"sdks/rust/api/resq-clean",
"sdks/rust/api/resq-cli",
"sdks/rust/api/resq-cli/commands",
"sdks/rust/api/resq-cli/commands/audit",
"sdks/rust/api/resq-cli/commands/commit",
"sdks/rust/api/resq-cli/commands/completions",
"sdks/rust/api/resq-cli/commands/copyright",
"sdks/rust/api/resq-cli/commands/dev",
"sdks/rust/api/resq-cli/commands/docs",
"sdks/rust/api/resq-cli/commands/explore",
"sdks/rust/api/resq-cli/commands/format",
"sdks/rust/api/resq-cli/commands/hook_templates",
"sdks/rust/api/resq-cli/commands/hooks",
"sdks/rust/api/resq-cli/commands/pre_commit",
"sdks/rust/api/resq-cli/commands/secrets",
"sdks/rust/api/resq-cli/commands/version",
"sdks/rust/api/resq-cli/gitignore",
"sdks/rust/api/resq-cli/index",
"sdks/rust/api/resq-cli/resq_cli",
"sdks/rust/api/resq-cli/utils",
"sdks/rust/api/resq-deploy",
"sdks/rust/api/resq-dsa",
"sdks/rust/api/resq-dsa/bloom",
"sdks/rust/api/resq-dsa/count_min",
"sdks/rust/api/resq-dsa/graph",
"sdks/rust/api/resq-dsa/heap",
"sdks/rust/api/resq-dsa/index",
"sdks/rust/api/resq-dsa/resq_dsa",
"sdks/rust/api/resq-dsa/trie",
"sdks/rust/api/resq-flame",
"sdks/rust/api/resq-health",
"sdks/rust/api/resq-logs",
"sdks/rust/api/resq-perf",
"sdks/rust/api/resq-tui"
"sdks/rust/api/resq-tui/index",
"sdks/rust/api/resq-tui/resq_tui",
"sdks/rust/api/resq-tui/terminal"
]
},
{
Expand Down Expand Up @@ -2494,4 +2524,4 @@
"website": "https://resq.software"
}
}
}
}
2 changes: 1 addition & 1 deletion sdks/rust/api/README.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Auto-generated reference for [`resq-software/crates`](https://github.com/resq-software/crates) at ref `master`.

Each entry below lists a crate published from the workspace. Click through for the README plus a link to the canonical [docs.rs](https://docs.rs) API reference.
Each entry below lists a crate from the workspace. Library crates link to their full rendered API reference; binary-only crates show their README and link to [docs.rs](https://docs.rs).

## Crates

Expand Down
40 changes: 35 additions & 5 deletions sdks/rust/api/_pages.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,43 @@
[
"resq-ai",
"resq-bin",
"resq-ai/config",
"resq-ai/index",
"resq-ai/provider",
"resq-ai/token",
"resq-bin/analysis",
"resq-bin/bin_explorer",
"resq-bin/index",
"resq-clean",
"resq-cli",
"resq-cli/commands",
"resq-cli/commands/audit",
"resq-cli/commands/commit",
"resq-cli/commands/completions",
"resq-cli/commands/copyright",
"resq-cli/commands/dev",
"resq-cli/commands/docs",
"resq-cli/commands/explore",
"resq-cli/commands/format",
"resq-cli/commands/hook_templates",
"resq-cli/commands/hooks",
"resq-cli/commands/pre_commit",
"resq-cli/commands/secrets",
"resq-cli/commands/version",
"resq-cli/gitignore",
"resq-cli/index",
"resq-cli/resq_cli",
"resq-cli/utils",
"resq-deploy",
"resq-dsa",
"resq-dsa/bloom",
"resq-dsa/count_min",
"resq-dsa/graph",
"resq-dsa/heap",
"resq-dsa/index",
"resq-dsa/resq_dsa",
"resq-dsa/trie",
"resq-flame",
"resq-health",
"resq-logs",
"resq-perf",
"resq-tui"
"resq-tui/index",
"resq-tui/resq_tui",
"resq-tui/terminal"
]
10 changes: 0 additions & 10 deletions sdks/rust/api/resq-ai.md

This file was deleted.

56 changes: 56 additions & 0 deletions sdks/rust/api/resq-ai/config.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
**resq_ai > config**

# Module: config

## Contents

**Structs**

- [`AiConfig`](#aiconfig) - AI configuration.

**Functions**

- [`load_config`](#load_config) - Load config with cascade: env vars -> ~/.resq/ai.toml -> .resq/ai.toml.

---

## resq_ai::config::AiConfig

*Struct*

AI configuration.

**Fields:**
- `provider: crate::provider::Provider` - Selected provider.
- `model: String` - Model identifier.
- `base_url: Option<String>` - Base URL override.
- `max_tokens: u32` - Max tokens in response.
- `timeout_secs: u64` - HTTP request timeout in seconds.

**Methods:**

- `fn api_key(self: &Self) -> &str` - Access the API key.

**Trait Implementations:**

- **Debug**
- `fn fmt(self: &Self, f: & mut fmt::Formatter) -> fmt::Result`



## resq_ai::config::load_config

*Function*

Load config with cascade: env vars -> ~/.resq/ai.toml -> .resq/ai.toml.

# Errors

Returns an error if no API key is found for the selected provider.

```rust
fn load_config() -> anyhow::Result<AiConfig>
```



23 changes: 23 additions & 0 deletions sdks/rust/api/resq-ai/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# resq_ai

> **Version:** `v0.1.0` · **License:** `Apache-2.0` · **Crate:** [crates.io](https://crates.io/crates/resq-ai) · **API docs:** [docs.rs](https://docs.rs/resq-ai/0.1.0)

Multi-provider LLM abstraction for `ResQ` developer tools.

Supports Anthropic, `OpenAI`, and Google Gemini APIs with a unified
`complete()` interface and cascading config resolution.

## Modules

### [`config`](./config.md)

*1 function, 1 struct*

### [`provider`](./provider.md)

*1 enum, 1 function*

### [`token`](./token.md)

*2 functions*

67 changes: 67 additions & 0 deletions sdks/rust/api/resq-ai/provider.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
**resq_ai > provider**

# Module: provider

## Contents

**Enums**

- [`Provider`](#provider) - Supported LLM providers.

**Functions**

- [`complete`](#complete) - Send a completion request to the configured provider.

---

## resq_ai::provider::Provider

*Enum*

Supported LLM providers.

**Variants:**
- `Anthropic` - Anthropic Claude API
- `OpenAi` - OpenAI-compatible Chat Completions API
- `Gemini` - Google Gemini API

**Methods:**

- `fn default_model(self: &Self) -> &'static str` - Default model for this provider.
- `fn default_base_url(self: &Self) -> &'static str` - Default base URL for this provider.
- `fn api_key_env_var(self: &Self) -> &'static str` - Environment variable name for the API key.

**Traits:** Eq, Copy

**Trait Implementations:**

- **Deserialize**
- `fn deserialize<__D>(__deserializer: __D) -> _serde::__private228::Result<Self, <__D as >::Error>`
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The generated documentation is exposing internal implementation details such as _serde::__private228::Result. The generator should be configured to resolve these to their public-facing types (e.g., serde::Result or Result) to maintain clarity for end-users and avoid exposing unstable internals.

- **Debug**
- `fn fmt(self: &Self, f: & mut $crate::fmt::Formatter) -> $crate::fmt::Result`
- **Clone**
- `fn clone(self: &Self) -> Provider`
- **PartialEq**
- `fn eq(self: &Self, other: &Provider) -> bool`



## resq_ai::provider::complete

*Function*

Send a completion request to the configured provider.

A single [`reqwest::Client`] is reused across calls to benefit from
connection pooling.

# Errors

Returns an error on network failure, auth failure, or empty response.

```rust
fn complete(config: &super::AiConfig, system: &str, user: &str) -> anyhow::Result<String>
```



38 changes: 38 additions & 0 deletions sdks/rust/api/resq-ai/token.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
**resq_ai > token**

# Module: token

## Contents

**Functions**

- [`estimate_tokens`](#estimate_tokens) - Estimate token count using the chars/4 heuristic.
- [`truncate_to_budget`](#truncate_to_budget) - Truncate text to fit within a token budget.

---

## resq_ai::token::estimate_tokens

*Function*

Estimate token count using the chars/4 heuristic.

```rust
fn estimate_tokens(text: &str) -> usize
```



## resq_ai::token::truncate_to_budget

*Function*

Truncate text to fit within a token budget.
Cuts at line boundaries to avoid broken diff hunks.

```rust
fn truncate_to_budget(text: &str, max_tokens: usize) -> &str
```



Loading
Loading