diff options
| author | Michelle Tilley <michelle@michelletilley.net> | 2026-04-23 13:29:58 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-04-23 13:29:58 -0700 |
| commit | b121b73d07df389d324b3a8f27066661a6609618 (patch) | |
| tree | f66b69655b6d425ff642200224b3b2a1fdcd0df8 /crates/atuin-ai/src/stream.rs | |
| parent | fix: minor issues with fish's vim mode(s) (#3362) (diff) | |
| download | atuin-b121b73d07df389d324b3a8f27066661a6609618.zip | |
feat: Send user-defined context with `TERMINAL.md` (#3443)
This PR adds the ability to inject user-defined content into Atuin AI
requests, a la `AGENTS.md` or `CLAUDE.md`.
* `.atuin/TERMINAL.md` (or alternatively just `TERMINAL.md`) is checked in every directory from the cwd up to the root
* `~/.config/atuin/TERMINAL.md` (or equivalent config dir) is also
checked
* Supports Claude-style ``` !`` ``` and ```` ```!...``` ```` style shell
interpolation
Diffstat (limited to 'crates/atuin-ai/src/stream.rs')
| -rw-r--r-- | crates/atuin-ai/src/stream.rs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/crates/atuin-ai/src/stream.rs b/crates/atuin-ai/src/stream.rs index 19d287e7..e7155a08 100644 --- a/crates/atuin-ai/src/stream.rs +++ b/crates/atuin-ai/src/stream.rs @@ -100,6 +100,7 @@ pub(crate) fn create_chat_stream( client_ctx: ClientContext, send_cwd: bool, last_command: Option<String>, + user_contexts: Vec<crate::user_context::UserContext>, ) -> std::pin::Pin<Box<dyn futures::Stream<Item = Result<StreamFrame>> + Send>> { Box::pin(async_stream::stream! { ensure_crypto_provider(); @@ -115,10 +116,18 @@ pub(crate) fn create_chat_stream( let context = client_ctx.to_json(send_cwd, last_command.as_deref()); + let mut config = serde_json::json!({ + "capabilities": request.capabilities, + }); + + if !user_contexts.is_empty() { + config["user_contexts"] = serde_json::json!(user_contexts); + } + let mut request_body = serde_json::json!({ "messages": request.messages, "context": context, - "capabilities": request.capabilities, + "config": config, "invocation_id": request.invocation_id }); |
