-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Python servers require the initialized notification
- Loading branch information
1 parent
8d1e7dd
commit 0e6276c
Showing
9 changed files
with
253 additions
and
182 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
services: | ||
mcp_docker: | ||
image: mcp/docker:0.0.3 | ||
image: mcp/docker:0.0.4 | ||
ports: | ||
- 8811:8811 | ||
volumes: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
(ns jsonrpc.extras | ||
(:require | ||
[clojure.core.async :as async] | ||
git | ||
graph | ||
[jsonrpc.logger :as logger] | ||
[lsp4clj.server :as lsp.server] | ||
[promesa.core :as p] | ||
state | ||
volumes)) | ||
|
||
(defmethod lsp.server/receive-request "docker/prompts/register" [_ {:keys [db* id]} params] | ||
(logger/info "docker/prompts/register")) | ||
|
||
(defmethod lsp.server/receive-request "docker/prompts/run" | ||
[_ {:keys [db* id] :as components} {:keys [thread-id] {:keys [file content uri]} :prompts :as params}] | ||
(lsp.server/discarding-stdout | ||
(let [conversation-id (str (java.util.UUID/randomUUID)) | ||
prompt-string (cond | ||
file (slurp file) | ||
content content | ||
uri (slurp (git/prompt-file uri)))] | ||
(swap! db* update-in [:mcp/conversations] (fnil assoc {}) conversation-id | ||
{:state-promise | ||
(p/create | ||
(fn [resolve reject] | ||
(resolve | ||
(async/<!! | ||
(volumes/with-volume | ||
(fn [thread-id] | ||
(let [m (-> {} | ||
(assoc-in [:opts :conversation-id] conversation-id) | ||
(assoc-in [:opts :thread-id] thread-id) | ||
(assoc-in [:opts :prompt-content] prompt-string) | ||
(state/construct-initial-state-from-prompts))] | ||
(graph/stream | ||
(if (-> m :metadata :agent) | ||
((graph/require-graph (-> m :metadata :agent)) m) | ||
(graph/chat-with-tools m)) | ||
m))) | ||
(if thread-id | ||
{:thread-id thread-id :save-thread-volume false} | ||
{}))))))}) | ||
{:conversation-id conversation-id}))) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.