Skip to main content

Crate codemode

Crate codemode 

Source
Expand description

Embeddable code execution and code search tools for custom agent tool runners.

codemode is intentionally small:

  • CodeMode is the engine
  • Request / Response are the typed boundary
  • package, environment, and native function providers customize behavior

The intended embedding path is:

use std::sync::Arc;

use codemode::{CodeMode, CodeModeConfig, SearchCode};

let codemode = Arc::new(
    CodeMode::builder()
        .with_config(CodeModeConfig::default().multithreaded(true))
        .build()?
);

let response = codemode
    .search_code(SearchCode {
        query: "fetch".to_string(),
        limit: Some(5),
    })
    .await?;

println!("{} matches", response.matches.len());

Structs§

CodeMode
Embeddable codemode engine.
CodeModeBuilder
Builder for CodeMode.
CodeModeConfig
Configuration applied to a CodeMode instance.
EnvironmentVariable
Environment variable made available to the engine.
NativeFunctionRegistry
Named host functions exposed to JavaScript.
Package
JavaScript package made available to the engine.
PackageMatch
A package hit returned from SearchCode.
RunCode
Executes JavaScript code inside the codemode engine.
RunCodeResult
Structured result of a RunCode request.
SearchCode
Searches available packages/code exposed by package providers.
SearchCodeResult
Structured result of a SearchCode request.

Enums§

CodeModeError
Errors produced by the codemode engine and its extension points.
Request
Request handled by CodeMode.
Response
Response returned by CodeMode.

Traits§

EnvironmentProvider
Source of environment variables exposed to the engine.
NativeFunction
Async host function exposed to JavaScript by CodeMode.
PackageProvider
Source of JavaScript packages available to the engine.

Type Aliases§

CodeModeResult
Result type used throughout codemode.