2023-05-19 21:20:58 +00:00
|
|
|
[package]
|
2023-09-22 01:54:59 +00:00
|
|
|
name = "assistant"
|
2023-05-19 21:20:58 +00:00
|
|
|
version = "0.1.0"
|
|
|
|
edition = "2021"
|
|
|
|
publish = false
|
2024-01-27 12:51:16 +00:00
|
|
|
license = "GPL-3.0-or-later"
|
2024-01-23 16:40:30 +00:00
|
|
|
|
2024-05-24 17:14:27 +00:00
|
|
|
[lints]
|
|
|
|
workspace = true
|
|
|
|
|
2023-05-19 21:20:58 +00:00
|
|
|
[lib]
|
2023-09-22 01:54:59 +00:00
|
|
|
path = "src/assistant.rs"
|
2023-05-19 21:20:58 +00:00
|
|
|
doctest = false
|
|
|
|
|
2024-07-10 15:36:22 +00:00
|
|
|
[features]
|
|
|
|
test-support = [
|
|
|
|
"editor/test-support",
|
|
|
|
"language/test-support",
|
|
|
|
"project/test-support",
|
|
|
|
"text/test-support",
|
|
|
|
]
|
|
|
|
|
2023-05-19 21:20:58 +00:00
|
|
|
[dependencies]
|
2024-05-14 13:57:52 +00:00
|
|
|
anthropic = { workspace = true, features = ["schemars"] }
|
2024-07-02 17:14:56 +00:00
|
|
|
anyhow.workspace = true
|
2024-07-19 09:13:15 +00:00
|
|
|
assets.workspace = true
|
2024-05-24 17:03:41 +00:00
|
|
|
assistant_slash_command.workspace = true
|
2024-09-03 23:14:36 +00:00
|
|
|
assistant_tool.workspace = true
|
2024-06-21 15:41:43 +00:00
|
|
|
async-watch.workspace = true
|
2024-05-14 22:39:52 +00:00
|
|
|
cargo_toml.workspace = true
|
2024-01-31 02:41:29 +00:00
|
|
|
chrono.workspace = true
|
2024-03-19 18:22:26 +00:00
|
|
|
client.workspace = true
|
2024-07-10 15:36:22 +00:00
|
|
|
clock.workspace = true
|
2024-02-06 19:41:36 +00:00
|
|
|
collections.workspace = true
|
2024-03-22 15:55:29 +00:00
|
|
|
command_palette_hooks.workspace = true
|
context_servers: Add initial implementation (#16103)
This commit proposes the addition of "context serveres" and the
underlying protocol (model context protocol). Context servers allow
simple definition of slash commands in another language and running
local on the user machines. This aims to quickly prototype new commands,
and provide a way to add personal (or company wide) customizations to
the assistant panel, without having to maintain an extension. We can
use this to reuse our existing codebase, with authenticators, etc and
easily have it provide context into the assistant panel.
As such it occupies a different design space as extensions, which I
think are
more aimed towards long-term, well maintained pieces of code that can be
easily distributed.
It's implemented as a central crate for easy reusability across the
codebase
and to easily hook into the assistant panel at all points.
Design wise there are a few pieces:
1. client.rs: A simple JSON-RPC client talking over stdio to a spawned
server. This is
very close to how LSP work and likely there could be a combined client
down the line.
2. types.rs: Serialization and deserialization client for the underlying
model context protocol.
3. protocol.rs: Handling the session between client and server.
4. manager.rs: Manages settings and adding and deleting servers from a
central pool.
A server can be defined in the settings.json as:
```
"context_servers": [
{"id": "test", "executable": "python", "args": ["-m", "context_server"]
]
```
## Quick Example
A quick example of how a theoretical backend site can look like. With
roughly 100 lines
of code (nicely generated by Claude) and a bit of decorator magic (200
lines in total), one
can come up with a framework that makes it as easy as:
```python
@context_server.slash_command(name="rot13", description="Perform a rot13 transformation")
@context_server.argument(name="input", type=str, help="String to rot13")
async def rot13(input: str) -> str:
return ''.join(chr((ord(c) - 97 + 13) % 26 + 97) if c.isalpha() else c for c in echo.lower())
```
to define a new slash_command.
## Todo:
- Allow context servers to be defined in workspace settings.
- Allow passing env variables to context_servers
Release Notes:
- N/A
---------
Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
2024-08-15 14:49:30 +00:00
|
|
|
context_servers.workspace = true
|
2024-08-29 03:11:01 +00:00
|
|
|
db.workspace = true
|
2024-02-06 19:41:36 +00:00
|
|
|
editor.workspace = true
|
2024-07-31 19:05:19 +00:00
|
|
|
feature_flags.workspace = true
|
2024-02-06 19:41:36 +00:00
|
|
|
fs.workspace = true
|
2024-01-31 02:41:29 +00:00
|
|
|
futures.workspace = true
|
2024-05-22 21:06:28 +00:00
|
|
|
fuzzy.workspace = true
|
2024-08-16 17:09:38 +00:00
|
|
|
globset.workspace = true
|
2024-02-06 19:41:36 +00:00
|
|
|
gpui.workspace = true
|
2024-08-07 01:30:48 +00:00
|
|
|
handlebars.workspace = true
|
2024-06-03 13:58:43 +00:00
|
|
|
heed.workspace = true
|
2024-06-04 20:14:26 +00:00
|
|
|
html_to_markdown.workspace = true
|
2024-07-23 22:01:05 +00:00
|
|
|
http_client.workspace = true
|
2024-07-02 17:14:56 +00:00
|
|
|
indexed_docs.workspace = true
|
2024-01-31 02:41:29 +00:00
|
|
|
indoc.workspace = true
|
2024-02-06 19:41:36 +00:00
|
|
|
language.workspace = true
|
Extract completion provider crate (#14823)
We will soon need `semantic_index` to be able to use
`CompletionProvider`. This is currently impossible due to a cyclic crate
dependency, because `CompletionProvider` lives in the `assistant` crate,
which depends on `semantic_index`.
This PR breaks the dependency cycle by extracting two crates out of
`assistant`: `language_model` and `completion`.
Only one piece of logic changed: [this
code](https://github.com/zed-industries/zed/commit/922fcaf5a6076e56890373035b1065b13512546d#diff-3857b3707687a4d585f1200eec4c34a7a079eae8d303b4ce5b4fce46234ace9fR61-R69).
* As of https://github.com/zed-industries/zed/pull/13276, whenever we
ask a given completion provider for its available models, OpenAI
providers would go and ask the global assistant settings whether the
user had configured an `available_models` setting, and if so, return
that.
* This PR changes it so that instead of eagerly asking the assistant
settings for this info (the new crate must not depend on `assistant`, or
else the dependency cycle would be back), OpenAI completion providers
now store the user-configured settings as part of their struct, and
whenever the settings change, we update the provider.
In theory, this change should not change user-visible behavior...but
since it's the only change in this large PR that's more than just moving
code around, I'm mentioning it here in case there's an unexpected
regression in practice! (cc @amtoaer in case you'd like to try out this
branch and verify that the feature is still working the way you expect.)
Release Notes:
- N/A
---------
Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
2024-07-19 17:35:34 +00:00
|
|
|
language_model.workspace = true
|
2024-11-23 17:11:31 +00:00
|
|
|
language_model_selector.workspace = true
|
2024-11-20 23:49:34 +00:00
|
|
|
language_models.workspace = true
|
2024-01-31 02:41:29 +00:00
|
|
|
log.workspace = true
|
2024-09-23 17:40:34 +00:00
|
|
|
lsp.workspace = true
|
2024-08-01 13:54:47 +00:00
|
|
|
markdown.workspace = true
|
2024-02-06 19:41:36 +00:00
|
|
|
menu.workspace = true
|
|
|
|
multi_buffer.workspace = true
|
2024-06-12 00:35:27 +00:00
|
|
|
ollama = { workspace = true, features = ["schemars"] }
|
2024-03-19 18:22:26 +00:00
|
|
|
open_ai = { workspace = true, features = ["schemars"] }
|
2023-08-24 10:45:44 +00:00
|
|
|
ordered-float.workspace = true
|
2024-03-19 18:22:26 +00:00
|
|
|
parking_lot.workspace = true
|
2024-06-17 23:27:42 +00:00
|
|
|
paths.workspace = true
|
2024-08-29 03:11:01 +00:00
|
|
|
picker.workspace = true
|
2024-02-06 19:41:36 +00:00
|
|
|
project.workspace = true
|
2024-07-31 19:05:19 +00:00
|
|
|
proto.workspace = true
|
2023-06-20 19:29:34 +00:00
|
|
|
regex.workspace = true
|
2024-08-29 03:11:01 +00:00
|
|
|
release_channel.workspace = true
|
2024-05-17 22:38:14 +00:00
|
|
|
rope.workspace = true
|
2024-09-16 21:50:30 +00:00
|
|
|
rpc.workspace = true
|
2023-06-02 08:55:19 +00:00
|
|
|
schemars.workspace = true
|
2024-02-06 19:41:36 +00:00
|
|
|
search.workspace = true
|
2024-05-28 14:06:09 +00:00
|
|
|
semantic_index.workspace = true
|
2023-05-29 14:23:16 +00:00
|
|
|
serde.workspace = true
|
|
|
|
serde_json.workspace = true
|
2024-02-06 19:41:36 +00:00
|
|
|
settings.workspace = true
|
2024-08-16 12:31:02 +00:00
|
|
|
similar.workspace = true
|
2024-08-29 03:11:01 +00:00
|
|
|
smallvec.workspace = true
|
2023-06-20 09:59:51 +00:00
|
|
|
smol.workspace = true
|
2024-08-29 17:18:52 +00:00
|
|
|
strum.workspace = true
|
2024-02-23 16:13:28 +00:00
|
|
|
telemetry_events.workspace = true
|
2024-07-01 18:53:56 +00:00
|
|
|
terminal.workspace = true
|
2024-06-20 18:20:34 +00:00
|
|
|
terminal_view.workspace = true
|
2024-08-02 22:13:17 +00:00
|
|
|
text.workspace = true
|
2024-02-06 19:41:36 +00:00
|
|
|
theme.workspace = true
|
2024-05-14 22:39:52 +00:00
|
|
|
toml.workspace = true
|
2024-02-06 19:41:36 +00:00
|
|
|
ui.workspace = true
|
|
|
|
util.workspace = true
|
2024-01-31 02:41:29 +00:00
|
|
|
uuid.workspace = true
|
2024-02-06 19:41:36 +00:00
|
|
|
workspace.workspace = true
|
2024-07-31 19:05:19 +00:00
|
|
|
zed_actions.workspace = true
|
2023-05-19 21:20:58 +00:00
|
|
|
|
|
|
|
[dev-dependencies]
|
2023-08-23 07:09:01 +00:00
|
|
|
ctor.workspace = true
|
2024-02-06 19:41:36 +00:00
|
|
|
editor = { workspace = true, features = ["test-support"] }
|
2023-08-23 07:09:01 +00:00
|
|
|
env_logger.workspace = true
|
2024-07-10 15:36:22 +00:00
|
|
|
language = { workspace = true, features = ["test-support"] }
|
2024-08-05 07:18:06 +00:00
|
|
|
language_model = { workspace = true, features = ["test-support"] }
|
2024-09-19 11:43:49 +00:00
|
|
|
languages = { workspace = true, features = ["test-support"] }
|
2023-08-23 07:09:01 +00:00
|
|
|
log.workspace = true
|
2024-10-17 17:18:13 +00:00
|
|
|
pretty_assertions.workspace = true
|
2024-02-06 19:41:36 +00:00
|
|
|
project = { workspace = true, features = ["test-support"] }
|
2023-08-23 07:09:01 +00:00
|
|
|
rand.workspace = true
|
2024-07-30 11:09:50 +00:00
|
|
|
serde_json_lenient.workspace = true
|
2024-07-10 15:36:22 +00:00
|
|
|
text = { workspace = true, features = ["test-support"] }
|
2024-09-19 11:43:49 +00:00
|
|
|
tree-sitter-md.workspace = true
|
2024-05-17 22:38:14 +00:00
|
|
|
unindent.workspace = true
|