pub trait KernelClient {
Show 17 methods
// Required methods
fn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
input: &'life1 str,
) -> Pin<Box<dyn Future<Output = ClientResult<ExecResult>> + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn execute_with_vars<'life0, 'life1, 'async_trait>(
&'life0 self,
input: &'life1 str,
vars: HashMap<String, Value>,
) -> Pin<Box<dyn Future<Output = ClientResult<ExecResult>> + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn get_var<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
) -> Pin<Box<dyn Future<Output = ClientResult<Option<Value>>> + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn set_var<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
value: Value,
) -> Pin<Box<dyn Future<Output = ClientResult<()>> + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn list_vars<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ClientResult<Vec<(String, Value)>>> + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn tool_schemas<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ClientResult<Vec<ToolSchema>>> + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn has_function<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
) -> Pin<Box<dyn Future<Output = ClientResult<bool>> + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn cancel<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ClientResult<()>> + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn cwd<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ClientResult<String>> + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn set_cwd<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = ClientResult<()>> + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn last_result<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ClientResult<ExecResult>> + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn reset<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ClientResult<()>> + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn ping<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ClientResult<String>> + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn shutdown<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ClientResult<()>> + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn read_blob<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = ClientResult<Vec<u8>>> + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn write_blob<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
content_type: &'life1 str,
data: &'life2 [u8],
) -> Pin<Box<dyn Future<Output = ClientResult<String>> + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn delete_blob<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = ClientResult<bool>> + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Expand description
Common interface for interacting with a kaish kernel.
Both EmbeddedClient and custom client implementations can implement this trait,
allowing code to work with any client type.
Required Methods§
Sourcefn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
input: &'life1 str,
) -> Pin<Box<dyn Future<Output = ClientResult<ExecResult>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
input: &'life1 str,
) -> Pin<Box<dyn Future<Output = ClientResult<ExecResult>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Execute kaish source code.
Returns the result of the last statement executed.
Sourcefn execute_with_vars<'life0, 'life1, 'async_trait>(
&'life0 self,
input: &'life1 str,
vars: HashMap<String, Value>,
) -> Pin<Box<dyn Future<Output = ClientResult<ExecResult>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn execute_with_vars<'life0, 'life1, 'async_trait>(
&'life0 self,
input: &'life1 str,
vars: HashMap<String, Value>,
) -> Pin<Box<dyn Future<Output = ClientResult<ExecResult>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Execute kaish source code with a transient overlay of exported variables.
The overlay vars are visible (and exported to subprocesses) for the duration of this call only, then removed. Names already exported in the persistent state retain their outer value on return.
Sourcefn get_var<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
) -> Pin<Box<dyn Future<Output = ClientResult<Option<Value>>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_var<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
) -> Pin<Box<dyn Future<Output = ClientResult<Option<Value>>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get a variable value.
Sourcefn set_var<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
value: Value,
) -> Pin<Box<dyn Future<Output = ClientResult<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn set_var<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
value: Value,
) -> Pin<Box<dyn Future<Output = ClientResult<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Set a variable value.
Sourcefn list_vars<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ClientResult<Vec<(String, Value)>>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list_vars<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ClientResult<Vec<(String, Value)>>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
List all variables.
Sourcefn tool_schemas<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ClientResult<Vec<ToolSchema>>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn tool_schemas<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ClientResult<Vec<ToolSchema>>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
List the schemas of all available tools (builtins + registered tools).
Each ToolSchema carries the tool’s name, description, parameters
(flags and positionals, with types/aliases/defaults), and examples.
This is the introspection surface embedders use to build command and
option completion, generate help, or validate arguments client-side.
Sourcefn has_function<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
) -> Pin<Box<dyn Future<Output = ClientResult<bool>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn has_function<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
) -> Pin<Box<dyn Future<Output = ClientResult<bool>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Report whether a user-defined function with the given name exists.
Lets a frontend probe for optional hooks (e.g. a kaish_prompt
function that customizes the prompt) before invoking them.
Sourcefn cancel<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ClientResult<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn cancel<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ClientResult<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Cancel the kernel’s in-flight execution.
Signals the kernel’s cancellation token, which cascades to any attached forks and external child processes. Used by interactive frontends to wire Ctrl-C to the running statement. Idempotent and safe to call when nothing is executing.
Sourcefn cwd<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ClientResult<String>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn cwd<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ClientResult<String>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get the current working directory.
Sourcefn set_cwd<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = ClientResult<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn set_cwd<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = ClientResult<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Set the current working directory.
Sourcefn last_result<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ClientResult<ExecResult>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn last_result<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ClientResult<ExecResult>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get the last execution result ($?).
Sourcefn reset<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ClientResult<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn reset<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ClientResult<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Reset the kernel to initial state.
Sourcefn ping<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ClientResult<String>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn ping<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ClientResult<String>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Ping the kernel (health check).
Sourcefn shutdown<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ClientResult<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn shutdown<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ClientResult<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Shutdown the kernel.
Sourcefn read_blob<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = ClientResult<Vec<u8>>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn read_blob<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = ClientResult<Vec<u8>>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Read a blob by ID.
Returns the blob contents as raw bytes.
Sourcefn write_blob<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
content_type: &'life1 str,
data: &'life2 [u8],
) -> Pin<Box<dyn Future<Output = ClientResult<String>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn write_blob<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
content_type: &'life1 str,
data: &'life2 [u8],
) -> Pin<Box<dyn Future<Output = ClientResult<String>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Write a blob and return its ID.
The blob is stored in /v/blobs/{id} and can be referenced via BlobRef.
Sourcefn delete_blob<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = ClientResult<bool>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete_blob<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = ClientResult<bool>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Delete a blob by ID.
Returns true if the blob was deleted, false if it didn’t exist.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".