Skip to content

Commit 875da82

Browse files
authored
Merge pull request #83 from copilot-community-sdk/v0.2.1-public-preview-sync
Sync with upstream copilot-sdk v0.2.1 public preview release
2 parents 5274cd4 + bc0e50f commit 875da82

19 files changed

Lines changed: 696 additions & 40 deletions

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,17 @@ All notable changes to this project will be documented in this file. This change
33

44
## [Unreleased]
55

6+
### Added (v0.2.1 sync)
7+
- **`resolvedByHook` guard on `permission.requested`** — when the runtime resolves a permission request via a `permissionRequest` hook, the broadcast event includes `resolvedByHook: true`. The SDK now skips the client's `:on-permission-request` handler and does not send the `handlePendingPermissionRequest` RPC, preventing duplicate responses. Event subscribers still observe the event (upstream PR #999, runtime 1.0.17).
8+
- **New permission result kinds**`:denied-by-content-exclusion-policy` and `:denied-by-permission-request-hook` added to `::permission-result-kind` spec (upstream PR #999).
9+
- **MCP fields on `tool.execution_start` events** — optional `:mcp-server-name` and `:mcp-tool-name` fields added to `::tool.execution_start-data` spec indicating the MCP server and original tool name for MCP-originated tool calls (upstream runtime 1.0.17).
10+
- **`::resolved-by-hook` spec** — boolean spec for the `resolvedByHook` field on `permission.requested` event data.
11+
- **Commands example** — new `examples/commands.clj` demonstrating slash command registration and handling.
12+
- Integration tests for `resolvedByHook` guard (both true and false cases), new permission result kind specs, and MCP tool event fields.
13+
14+
### Changed
15+
- **Public preview branding** — README updated from "technical preview" to "public preview" with link to the [announcement](https://github.blog/changelog/2026-04-02-copilot-sdk-in-public-preview/).
16+
617
### Changed (v0.2.1 sync)
718
- **BREAKING**: Elicitation handler signature changed from 2-arg `(fn [request ctx])` to single-arg `(fn [context])`. The `ElicitationContext` map now includes `:session-id` alongside request fields (`:message`, `:requested-schema`, `:mode`, `:elicitation-source`, `:url`). Matches upstream cross-SDK consistency change (upstream PR #960). `::elicitation-request` spec renamed to `::elicitation-context`.
819

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Clojure SDK for programmatic control of GitHub Copilot CLI via JSON-RPC.
44

5-
> **Note:** This SDK is in technical preview and may change in breaking ways.
5+
> **Note:** This SDK is in [public preview](https://github.blog/changelog/2026-04-02-copilot-sdk-in-public-preview/) and may change in breaking ways.
66
77
A fully-featured Clojure port of the official [GitHub Copilot SDK](https://github.com/github/copilot-sdk), designed with idiomatic functional programming patterns. The SDK uses immutable data structures throughout, manages client/session state via Clojure's concurrency primitives (atoms, agents), and leverages [core.async](https://github.com/clojure/core.async) for non-blocking event streams and async operations.
88

@@ -150,6 +150,8 @@ See the [`examples/`](./examples/) directory for complete working examples:
150150
| [`ask_user_failure.clj`](./examples/ask_user_failure.clj) | Advanced | User cancellation (Esc) with event tracing |
151151
| [`mcp_local_server.clj`](./examples/mcp_local_server.clj) | Advanced | Model Context Protocol server integration |
152152
| [`byok_provider.clj`](./examples/byok_provider.clj) | Advanced | Bring Your Own Key provider configuration |
153+
| [`elicitation_provider.clj`](./examples/elicitation_provider.clj) | Advanced | Custom elicitation provider for UI dialogs |
154+
| [`commands.clj`](./examples/commands.clj) | Intermediate | Register slash commands on sessions |
153155

154156
Run examples:
155157

doc/api/API.html

Lines changed: 368 additions & 11 deletions
Large diffs are not rendered by default.

doc/api/getting-started.html

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
<!DOCTYPE html PUBLIC ""
22
"">
33
<html><head><meta charset="UTF-8" /><title>Getting Started with the Copilot SDK for Clojure</title><link rel="stylesheet" type="text/css" href="css/default.css" /><link rel="stylesheet" type="text/css" href="css/highlight.css" /><script type="text/javascript" src="js/highlight.min.js"></script><script type="text/javascript" src="js/jquery.min.js"></script><script type="text/javascript" src="js/page_effects.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body><div id="header"><h2>Generated by <a href="https://github.com/weavejester/codox">Codox</a></h2><h1><a href="index.html"><span class="project-title"><span class="project-name"></span> <span class="project-version"></span></span></a></h1></div><div class="sidebar primary"><h3 class="no-link"><span class="inner">Project</span></h3><ul class="index-link"><li class="depth-1 "><a href="index.html"><div class="inner">Index</div></a></li></ul><h3 class="no-link"><span class="inner">Topics</span></h3><ul><li class="depth-1 "><a href="API.html"><div class="inner"><span>API Reference</span></div></a></li><li class="depth-1 "><a href="azure-managed-identity.html"><div class="inner"><span>Azure Managed Identity with BYOK</span></div></a></li><li class="depth-1 "><a href="byok.html"><div class="inner"><span>BYOK (Bring Your Own Key)</span></div></a></li><li class="depth-1 "><a href="custom-agents.html"><div class="inner"><span>Custom Agents &amp; Sub-Agent Orchestration</span></div></a></li><li class="depth-1 "><a href="debugging.html"><div class="inner"><span>MCP Server Debugging Guide</span></div></a></li><li class="depth-1 current"><a href="getting-started.html"><div class="inner"><span>Getting Started with the Copilot SDK for Clojure</span></div></a></li><li class="depth-1 "><a href="index.html"><div class="inner"><span>Authentication</span></div></a></li><li class="depth-1 "><a href="index.html"><div class="inner"><span>Documentation</span></div></a></li><li class="depth-1 "><a href="overview.html"><div class="inner"><span>Using MCP Servers with the Copilot SDK for Clojure</span></div></a></li><li class="depth-1 "><a href="style.html"><div class="inner"><span>Documentation Style Guide</span></div></a></li></ul><h3 class="no-link"><span class="inner">Namespaces</span></h3><ul><li class="depth-1"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>github</span></div></div></li><li class="depth-2"><a href="github.copilot-sdk.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>copilot-sdk</span></div></a></li><li class="depth-3 branch"><a href="github.copilot-sdk.client.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>client</span></div></a></li><li class="depth-3 branch"><a href="github.copilot-sdk.helpers.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>helpers</span></div></a></li><li class="depth-3 branch"><a href="github.copilot-sdk.instrument.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>instrument</span></div></a></li><li class="depth-3 branch"><a href="github.copilot-sdk.logging.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>logging</span></div></a></li><li class="depth-3 branch"><a href="github.copilot-sdk.process.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>process</span></div></a></li><li class="depth-3 branch"><a href="github.copilot-sdk.protocol.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>protocol</span></div></a></li><li class="depth-3 branch"><a href="github.copilot-sdk.session.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>session</span></div></a></li><li class="depth-3 branch"><a href="github.copilot-sdk.specs.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>specs</span></div></a></li><li class="depth-3 branch"><a href="github.copilot-sdk.tools.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>tools</span></div></a></li><li class="depth-3"><a href="github.copilot-sdk.util.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>util</span></div></a></li></ul></div><div class="document" id="content"><div class="doc"><div class="markdown"><h1><a href="#getting-started-with-the-copilot-sdk-for-clojure" id="getting-started-with-the-copilot-sdk-for-clojure"></a>Getting Started with the Copilot SDK for Clojure</h1>
4+
<blockquote>
5+
<p><strong>Note:</strong> This SDK is in <a href="https://github.blog/changelog/2026-04-02-copilot-sdk-in-public-preview/">public preview</a> and may change in breaking ways.</p>
6+
</blockquote>
47
<p>In this tutorial, you’ll use the Copilot SDK for Clojure to build a command-line assistant. You’ll start with the basics, add streaming responses, then add custom tools — giving Copilot the ability to call your code.</p>
58
<p><strong>What you’ll build:</strong></p>
69
<pre><code>Q: What's the weather like in Seattle?
@@ -14,20 +17,20 @@ <h2><a href="#prerequisites" id="prerequisites"></a>Prerequisites</h2>
1417
<p>Before you begin, make sure you have:</p>
1518
<ul>
1619
<li><strong>GitHub Copilot CLI</strong> installed and authenticated (<a href="https://docs.github.com/en/copilot/how-tos/set-up/install-copilot-cli">Installation guide</a>)</li>
17-
<li><strong>Clojure</strong> 1.11+ with the <code>clojure</code> CLI tool</li>
20+
<li><strong>Clojure</strong> 1.12+ with the <code>clojure</code> CLI tool</li>
1821
<li><strong>Java</strong> 11+</li>
1922
</ul>
2023
<p>Verify the CLI is working:</p>
2124
<pre><code class="language-bash">copilot --version
2225
</code></pre>
2326
<h2><a href="#step-1-add-the-sdk-dependency" id="step-1-add-the-sdk-dependency"></a>Step 1: Add the SDK Dependency</h2>
2427
<p>Add to your <code>deps.edn</code>:</p>
25-
<pre><code class="language-clojure">{:deps {io.github.copilot-community-sdk/copilot-sdk-clojure {:mvn/version "LATEST"}}}
28+
<pre><code class="language-clojure">{:deps {io.github.copilot-community-sdk/copilot-sdk-clojure {:mvn/version "0.2.1.1-SNAPSHOT"}}}
2629
</code></pre>
2730
<p>Or use as a Git dependency:</p>
2831
<pre><code class="language-clojure">{:deps {io.github.copilot-community-sdk/copilot-sdk-clojure
2932
{:git/url "https://github.com/copilot-community-sdk/copilot-sdk-clojure"
30-
:git/sha "LATEST_SHA"}}}
33+
:git/sha "7a30402b9bd843494752c46a18ff7f2fec27a620"}}}
3134
</code></pre>
3235
<h2><a href="#step-2-send-your-first-message" id="step-2-send-your-first-message"></a>Step 2: Send Your First Message</h2>
3336
<p>The simplest way to use the SDK — about 3 lines of code:</p>
@@ -52,7 +55,8 @@ <h2><a href="#step-2-send-your-first-message" id="step-2-send-your-first-message
5255
<h2><a href="#step-3-add-streaming-responses" id="step-3-add-streaming-responses"></a>Step 3: Add Streaming Responses</h2>
5356
<p>Right now, you wait for the complete response before seeing anything. Let’s make it interactive by streaming the response as it’s generated.</p>
5457
<h3><a href="#using-lazy-sequences" id="using-lazy-sequences"></a>Using Lazy Sequences</h3>
55-
<pre><code class="language-clojure">(require '[github.copilot-sdk.helpers :as h])
58+
<pre><code class="language-clojure">(require '[github.copilot-sdk :as copilot])
59+
(require '[github.copilot-sdk.helpers :as h])
5660

5761
(defmulti handle-event :type)
5862
(defmethod handle-event :default [_] nil)

doc/api/github.copilot-sdk.client.html

Lines changed: 7 additions & 3 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)