-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgithub.copilot-sdk.client.html
More file actions
70 lines (70 loc) · 30.8 KB
/
github.copilot-sdk.client.html
File metadata and controls
70 lines (70 loc) · 30.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<!DOCTYPE html PUBLIC ""
"">
<html><head><meta charset="UTF-8" /><title>github.copilot-sdk.client documentation</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 & 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 "><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 current"><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="sidebar secondary"><h3><a href="#top"><span class="inner">Public Vars</span></a></h3><ul><li class="depth-1"><a href="github.copilot-sdk.client.html#var-.3Ccreate-session"><div class="inner"><span><create-session</span></div></a></li><li class="depth-1"><a href="github.copilot-sdk.client.html#var-.3Cresume-session"><div class="inner"><span><resume-session</span></div></a></li><li class="depth-1"><a href="github.copilot-sdk.client.html#var-approve-all"><div class="inner"><span>approve-all</span></div></a></li><li class="depth-1"><a href="github.copilot-sdk.client.html#var-client"><div class="inner"><span>client</span></div></a></li><li class="depth-1"><a href="github.copilot-sdk.client.html#var-connect-with-streams.21"><div class="inner"><span>connect-with-streams!</span></div></a></li><li class="depth-1"><a href="github.copilot-sdk.client.html#var-create-session"><div class="inner"><span>create-session</span></div></a></li><li class="depth-1"><a href="github.copilot-sdk.client.html#var-default-join-session-permission-handler"><div class="inner"><span>default-join-session-permission-handler</span></div></a></li><li class="depth-1"><a href="github.copilot-sdk.client.html#var-delete-session.21"><div class="inner"><span>delete-session!</span></div></a></li><li class="depth-1"><a href="github.copilot-sdk.client.html#var-force-stop.21"><div class="inner"><span>force-stop!</span></div></a></li><li class="depth-1"><a href="github.copilot-sdk.client.html#var-get-auth-status"><div class="inner"><span>get-auth-status</span></div></a></li><li class="depth-1"><a href="github.copilot-sdk.client.html#var-get-foreground-session-id"><div class="inner"><span>get-foreground-session-id</span></div></a></li><li class="depth-1"><a href="github.copilot-sdk.client.html#var-get-last-session-id"><div class="inner"><span>get-last-session-id</span></div></a></li><li class="depth-1"><a href="github.copilot-sdk.client.html#var-get-quota"><div class="inner"><span>get-quota</span></div></a></li><li class="depth-1"><a href="github.copilot-sdk.client.html#var-get-session-metadata"><div class="inner"><span>get-session-metadata</span></div></a></li><li class="depth-1"><a href="github.copilot-sdk.client.html#var-get-status"><div class="inner"><span>get-status</span></div></a></li><li class="depth-1"><a href="github.copilot-sdk.client.html#var-join-session"><div class="inner"><span>join-session</span></div></a></li><li class="depth-1"><a href="github.copilot-sdk.client.html#var-list-models"><div class="inner"><span>list-models</span></div></a></li><li class="depth-1"><a href="github.copilot-sdk.client.html#var-list-sessions"><div class="inner"><span>list-sessions</span></div></a></li><li class="depth-1"><a href="github.copilot-sdk.client.html#var-list-tools"><div class="inner"><span>list-tools</span></div></a></li><li class="depth-1"><a href="github.copilot-sdk.client.html#var-mcp-config-add.21"><div class="inner"><span>mcp-config-add!</span></div></a></li><li class="depth-1"><a href="github.copilot-sdk.client.html#var-mcp-config-list"><div class="inner"><span>mcp-config-list</span></div></a></li><li class="depth-1"><a href="github.copilot-sdk.client.html#var-mcp-config-remove.21"><div class="inner"><span>mcp-config-remove!</span></div></a></li><li class="depth-1"><a href="github.copilot-sdk.client.html#var-mcp-config-update.21"><div class="inner"><span>mcp-config-update!</span></div></a></li><li class="depth-1"><a href="github.copilot-sdk.client.html#var-notifications"><div class="inner"><span>notifications</span></div></a></li><li class="depth-1"><a href="github.copilot-sdk.client.html#var-on-lifecycle-event"><div class="inner"><span>on-lifecycle-event</span></div></a></li><li class="depth-1"><a href="github.copilot-sdk.client.html#var-options"><div class="inner"><span>options</span></div></a></li><li class="depth-1"><a href="github.copilot-sdk.client.html#var-ping"><div class="inner"><span>ping</span></div></a></li><li class="depth-1"><a href="github.copilot-sdk.client.html#var-resume-session"><div class="inner"><span>resume-session</span></div></a></li><li class="depth-1"><a href="github.copilot-sdk.client.html#var-set-foreground-session-id.21"><div class="inner"><span>set-foreground-session-id!</span></div></a></li><li class="depth-1"><a href="github.copilot-sdk.client.html#var-start.21"><div class="inner"><span>start!</span></div></a></li><li class="depth-1"><a href="github.copilot-sdk.client.html#var-state"><div class="inner"><span>state</span></div></a></li><li class="depth-1"><a href="github.copilot-sdk.client.html#var-stop.21"><div class="inner"><span>stop!</span></div></a></li></ul></div><div class="namespace-docs" id="content"><h1 class="anchor" id="top">github.copilot-sdk.client</h1><div class="doc"><div class="markdown"><p>CopilotClient - manages connection to the Copilot CLI server.</p>
</div></div><div class="public anchor" id="var-.3Ccreate-session"><h3><create-session</h3><div class="usage"><code>(<create-session client config)</code></div><div class="doc"><div class="markdown"><p>Async version of create-session. Returns a channel that delivers a CopilotSession.</p>
<p>Same config options as create-session (<code>:on-permission-request</code> is <strong>required</strong>). Validation is performed synchronously (throws immediately on invalid config). The RPC call parks instead of blocking, making this safe to use inside go blocks.</p>
<p>On RPC error, delivers an ExceptionInfo to the channel (not nil). Callers should check the result with (instance? Throwable result).</p>
<p>Usage: (go (let <a href="result (<! (<create-session client {:on-permission-request copilot/approve-all
:model "gpt-5.4"}))">result (<! (<create-session client {:on-permission-request copilot/approve-all :model “gpt-5.4”}))</a> (if (instance? Throwable result) (println “Error:” (ex-message result)) ;; use result as session )))</p>
</div></div></div><div class="public anchor" id="var-.3Cresume-session"><h3><resume-session</h3><div class="usage"><code>(<resume-session client session-id config)</code></div><div class="doc"><div class="markdown"><p>Async version of resume-session. Returns a channel that delivers a CopilotSession.</p>
<p>Same config options as resume-session (<code>:on-permission-request</code> is <strong>required</strong>). Validation is performed synchronously (throws immediately on invalid config). The RPC call parks instead of blocking, making this safe to use inside go blocks.</p>
<p>On RPC error, delivers an ExceptionInfo to the channel (not nil). Callers should check the result with (instance? Throwable result).</p>
<p>Usage: (go (let <a href="result (<! (<resume-session client session-id
{:on-permission-request copilot/approve-all
:model "gpt-5.4"}))">result (<! (<resume-session client session-id {:on-permission-request copilot/approve-all :model “gpt-5.4”}))</a> (if (instance? Throwable result) (println “Error:” (ex-message result)) ;; use result as session )))</p>
</div></div></div><div class="public anchor" id="var-approve-all"><h3>approve-all</h3><div class="usage"><code>(approve-all _request _ctx)</code></div><div class="doc"><div class="markdown"><p>Permission handler that approves all permission requests.</p>
<p>The SDK uses a <strong>deny-by-default</strong> permission model: all permission requests (file writes, shell commands, URL fetches, etc.) are denied unless your session config provides an <code>:on-permission-request</code> handler.</p>
<p>Use <code>approve-all</code> to opt into approving everything (equivalent to the upstream <code>approveAll</code> export):</p>
<p>(copilot/create-session client {:on-permission-request copilot/approve-all})</p>
<p>For fine-grained control, provide your own handler function instead.</p>
</div></div></div><div class="public anchor" id="var-client"><h3>client</h3><div class="usage"><code>(client)</code><code>(client opts)</code></div><div class="doc"><div class="markdown"><p>Create a new CopilotClient.</p>
<p>Options: - :cli-path - Path to CLI executable (default: “copilot”) - :cli-args - Extra arguments for CLI - :cli-url - URL of existing server (e.g., “localhost:8080”) - :cwd - Working directory for CLI process - :port - TCP port (default: 0 for random) - :use-stdio? - Use stdio transport (default: true) - :log-level - :none :error :warning :info :debug :all - :auto-start? - Auto-start on first use (default: true) - :auto-restart? - <strong>DEPRECATED</strong>: This option has no effect and will be removed in a future release. - :notification-queue-size - Max queued protocol notifications (default: 4096) - :router-queue-size - Max queued non-session notifications (default: 4096) - :tool-timeout-ms - Timeout for tool calls that return a channel (default: 120000) - :env - Environment variables map - :github-token - GitHub token for authentication (sets COPILOT_SDK_AUTH_TOKEN env var) - :use-logged-in-user? - Whether to use logged-in user auth (default: true, false when github-token provided) - :is-child-process? - When true, SDK is a child of an existing Copilot CLI process and uses stdio to communicate with it (no process spawning) - :on-list-models - Zero-arg fn returning a seq of model info maps; bypasses the RPC call and does not require start! - :telemetry - OpenTelemetry config map with optional keys :otlp-endpoint, :file-path, :exporter-type, :source-name, :capture-content? - :on-get-trace-context - Zero-arg fn returning {:traceparent … :tracestate …} for distributed trace propagation</p>
</div></div></div><div class="public anchor" id="var-connect-with-streams.21"><h3>connect-with-streams!</h3><div class="usage"><code>(connect-with-streams! client in out)</code></div><div class="doc"><div class="markdown"><p>Connect to a server using pre-existing input/output streams. For testing purposes only.</p>
</div></div></div><div class="public anchor" id="var-create-session"><h3>create-session</h3><div class="usage"><code>(create-session client config)</code></div><div class="doc"><div class="markdown"><p>Create a new conversation session.</p>
<p>Config options (<code>:on-permission-request</code> is <strong>required</strong>): - :on-permission-request - Permission handler function (<strong>required</strong>, e.g. <code>approve-all</code>) - :session-id - Custom session ID - :client-name - Client name to identify the application (included in User-Agent header) - :model - Model to use (e.g., “gpt-5.4”) - :tools - Vector of tool definitions - :commands - Vector of command definitions (slash commands for TUI) - :system-message - System message config - :available-tools - List of allowed tool names - :excluded-tools - List of excluded tool names - :provider - Custom provider config (BYOK) - :streaming? - Enable streaming - :mcp-servers - MCP server configs map - :custom-agents - Custom agent configs - :config-dir - Override config directory for CLI (configDir) - :skill-directories - Additional skill directories to load - :disabled-skills - Disable specific skills by name - :large-output - (Experimental) Tool output handling config {:enabled :max-size-bytes :output-dir} Note: CLI protocol feature, not in official SDK. outputDir may be ignored. - :working-directory - Working directory for the session (tool operations relative to this) - :infinite-sessions - Infinite session config for automatic context compaction {:enabled (default true) :background-compaction-threshold (0.0-1.0, default 0.80) :buffer-exhaustion-threshold (0.0-1.0, default 0.95)} - :reasoning-effort - Reasoning effort level: “low”, “medium”, “high”, or “xhigh” (PR #302) - :on-user-input-request - Handler for ask_user requests (PR #269) - :on-elicitation-request - Handler for elicitation requests from the agent (upstream PRs #908, #960). When provided, sends requestElicitation=true and enables the elicitation capability. Single-arg handler receives an ElicitationContext map with :session-id, :message, :requested-schema, :mode, :elicitation-source, :url. Returns an ElicitationResult map. - :hooks - Lifecycle hooks map (PR #269): {:on-pre-tool-use, :on-post-tool-use, :on-user-prompt-submitted, :on-session-start, :on-session-end, :on-error-occurred} - :on-event - Event handler (1-arg fn) registered before the RPC call. Guarantees early events like session.start are not missed. - :enable-config-discovery - Boolean. Auto-discover .mcp.json, .vscode/mcp.json, skills, etc. Instruction files are always loaded regardless. (upstream PR #1044) - :model-capabilities - Model capabilities override map (upstream PR #1029). DeepPartial of model capabilities, e.g. {:model-supports {:supports-vision true}}</p>
<p>Returns a CopilotSession.</p>
</div></div></div><div class="public anchor" id="var-default-join-session-permission-handler"><h3>default-join-session-permission-handler</h3><div class="usage"><code>(default-join-session-permission-handler _request _ctx)</code></div><div class="doc"><div class="markdown"><p>Default permission handler for resuming sessions.</p>
<p>Returns <code>{:kind :no-result}</code> — the CLI handles permission decisions itself. When used with <code>resume-session</code>, tells the CLI that this client does NOT want to handle permission requests (<code>requestPermission: false</code> on the wire).</p>
<p>Use this when reconnecting to a session where the original client already established permission handling:</p>
<p>(copilot/resume-session client session-id {:on-permission-request copilot/default-join-session-permission-handler})</p>
<p>Equivalent to the upstream <code>defaultJoinSessionPermissionHandler</code> export.</p>
</div></div></div><div class="public anchor" id="var-delete-session.21"><h3>delete-session!</h3><div class="usage"><code>(delete-session! client session-id)</code></div><div class="doc"><div class="markdown"><p>Permanently deletes a session and all its data from disk, including conversation history, planning state, and artifacts. Unlike <code>disconnect!</code>, which only releases in-memory resources and preserves session data for later resumption, this method is irreversible.</p>
</div></div></div><div class="public anchor" id="var-force-stop.21"><h3>force-stop!</h3><div class="usage"><code>(force-stop! client)</code></div><div class="doc"><div class="markdown"><p>Force stop the CLI server without graceful cleanup.</p>
</div></div></div><div class="public anchor" id="var-get-auth-status"><h3>get-auth-status</h3><div class="usage"><code>(get-auth-status client)</code></div><div class="doc"><div class="markdown"><p>Get current authentication status. Returns {:authenticated? :auth-type :host :login :status-message}.</p>
</div></div></div><div class="public anchor" id="var-get-foreground-session-id"><h3>get-foreground-session-id</h3><div class="usage"><code>(get-foreground-session-id client)</code></div><div class="doc"><div class="markdown"><p>Get the foreground session ID (TUI+server mode). Returns the session ID or nil if none.</p>
</div></div></div><div class="public anchor" id="var-get-last-session-id"><h3>get-last-session-id</h3><div class="usage"><code>(get-last-session-id client)</code></div><div class="doc"><div class="markdown"><p>Get the ID of the most recently updated session.</p>
</div></div></div><div class="public anchor" id="var-get-quota"><h3>get-quota</h3><div class="usage"><code>(get-quota client)</code></div><div class="doc"><div class="markdown"><p>Get account quota information. Returns a map of quota type (string) to quota snapshot maps: {:entitlement-requests :used-requests :remaining-percentage :overage :overage-allowed-with-exhausted-quota? :reset-date}</p>
</div></div></div><div class="public anchor" id="var-get-session-metadata"><h3>get-session-metadata</h3><div class="usage"><code>(get-session-metadata client session-id)</code></div><div class="doc"><div class="markdown"><p>Gets metadata for a specific session by ID.</p>
<p>Provides an efficient O(1) lookup of a single session’s metadata instead of listing all sessions and filtering client-side.</p>
<p>Returns the session metadata map if found, or nil if not found.</p>
<p>The returned map has keys: - :session-id — the session ID string - :start-time — java.time.Instant when the session was created - :modified-time — java.time.Instant of last modification - :remote? — boolean, true if the session is remote - :summary — optional summary string - :context — optional map with :cwd and optional :git-root, :repository, :branch</p>
</div></div></div><div class="public anchor" id="var-get-status"><h3>get-status</h3><div class="usage"><code>(get-status client)</code></div><div class="doc"><div class="markdown"><p>Get CLI status including version and protocol information. Returns {:version :protocol-version}.</p>
</div></div></div><div class="public anchor" id="var-join-session"><h3>join-session</h3><div class="usage"><code>(join-session config)</code></div><div class="doc"><div class="markdown"><p>Join the current foreground session from an extension running as a child process.</p>
<p>Reads the SESSION_ID environment variable and connects to the parent CLI process via stdio. This is intended for extensions spawned by the Copilot CLI.</p>
<p>Config is the same as resume-session. <code>:on-permission-request</code> is <strong>optional</strong>; when omitted, a default handler is used that returns <code>{:kind :no-result}</code>, leaving any pending permission request unanswered (appropriate for most extensions that use <code>:skip-permission?</code> on their tools or do not require permission handling). The <code>:disable-resume?</code> option defaults to true.</p>
<p>Returns a map with :client and :session keys. The caller is responsible for stopping the client when done.</p>
<p>Throws if SESSION_ID is not set in the environment.</p>
</div></div></div><div class="public anchor" id="var-list-models"><h3>list-models</h3><div class="usage"><code>(list-models client)</code></div><div class="doc"><div class="markdown"><p>List available models with their metadata. Results are cached per client connection to prevent rate limiting under concurrency. Cache is cleared on stop!/force-stop!. When :on-list-models handler is provided in client options, calls the handler instead of the RPC method. The handler does not require a CLI connection. Requires authentication (unless :on-list-models handler is provided). Returns a vector of model info maps with keys: :id :name :vendor :family :version :max-input-tokens :max-output-tokens :preview? :default-temperature :model-picker-priority :model-capabilities {:model-supports {:supports-vision :supports-reasoning-effort} :model-limits {:max-prompt-tokens :max-context-window-tokens :vision-capabilities {:supported-media-types :max-prompt-images :max-prompt-image-size}}} :model-policy {:policy-state :terms} :model-billing {:multiplier} :supported-reasoning-efforts :default-reasoning-effort :supports-reasoning-effort (legacy flat key) :vision-limits {:supported-media-types :max-prompt-images :max-prompt-image-size} (legacy)</p>
</div></div></div><div class="public anchor" id="var-list-sessions"><h3>list-sessions</h3><div class="usage"><code>(list-sessions client)</code><code>(list-sessions client filter-opts)</code></div><div class="doc"><div class="markdown"><p>List all available sessions. Returns a vector of session metadata maps. Optional filter map narrows results by context fields: {:cwd :git-root :repository :branch}</p>
</div></div></div><div class="public anchor" id="var-list-tools"><h3>list-tools</h3><div class="usage"><code>(list-tools client)</code><code>(list-tools client model)</code></div><div class="doc"><div class="markdown"><p>List available tools with their metadata. Optional :model param returns model-specific tool overrides. Returns a vector of tool info maps with keys: :name :namespaced-name :description :parameters :instructions</p>
</div></div></div><div class="public anchor" id="var-mcp-config-add.21"><h3>mcp-config-add!</h3><div class="usage"><code>(mcp-config-add! client params)</code></div><div class="doc"><div class="markdown"><p>Add an MCP server configuration. params is a map with server config using plain keys (:name, :command, :args, :tools, etc.) — NOT the :mcp-prefixed keys used in session config :mcp-servers.</p>
</div></div></div><div class="public anchor" id="var-mcp-config-list"><h3>mcp-config-list</h3><div class="usage"><code>(mcp-config-list client)</code></div><div class="doc"><div class="markdown"><p>List all MCP server configurations. Returns a map with :servers (vector of server config maps).</p>
</div></div></div><div class="public anchor" id="var-mcp-config-remove.21"><h3>mcp-config-remove!</h3><div class="usage"><code>(mcp-config-remove! client params)</code></div><div class="doc"><div class="markdown"><p>Remove an MCP server configuration. params is a map identifying the server using plain keys (see mcp-config-add!).</p>
</div></div></div><div class="public anchor" id="var-mcp-config-update.21"><h3>mcp-config-update!</h3><div class="usage"><code>(mcp-config-update! client params)</code></div><div class="doc"><div class="markdown"><p>Update an MCP server configuration. params is a map with server config using plain keys (see mcp-config-add!).</p>
</div></div></div><div class="public anchor" id="var-notifications"><h3>notifications</h3><div class="usage"><code>(notifications client)</code></div><div class="doc"><div class="markdown"><p>Get the channel that receives non-session notifications. Notifications are dropped if the channel is full.</p>
</div></div></div><div class="public anchor" id="var-on-lifecycle-event"><h3>on-lifecycle-event</h3><div class="usage"><code>(on-lifecycle-event client handler)</code><code>(on-lifecycle-event client event-type handler)</code></div><div class="doc"><div class="markdown"><p>Subscribe to session lifecycle events.</p>
<p>Two arities: (on-lifecycle-event client handler) Subscribe to ALL lifecycle events. Handler receives the full event map with keys :lifecycle-event-type, :session-id, and optionally :metadata.</p>
<p>(on-lifecycle-event client event-type handler) Subscribe to a specific event type only. event-type is a keyword like :session.created, :session.deleted, etc.</p>
<p>Returns an unsubscribe function (call with no args to remove the handler).</p>
</div></div></div><div class="public anchor" id="var-options"><h3>options</h3><div class="usage"><code>(options client)</code></div><div class="doc"><div class="markdown"><p>Get the client options that were used to create this client. Returns the user-provided options merged with defaults. Note: This reflects SDK configuration, not necessarily server state.</p>
</div></div></div><div class="public anchor" id="var-ping"><h3>ping</h3><div class="usage"><code>(ping client)</code><code>(ping client message)</code></div><div class="doc"><div class="markdown"><p>Ping the server to check connectivity. Returns {:message :timestamp :protocol-version}.</p>
</div></div></div><div class="public anchor" id="var-resume-session"><h3>resume-session</h3><div class="usage"><code>(resume-session client session-id config)</code></div><div class="doc"><div class="markdown"><p>Resume an existing session by ID.</p>
<p>Config options (<code>:on-permission-request</code> is <strong>required</strong>): - :on-permission-request - Permission handler function (<strong>required</strong>, e.g. <code>approve-all</code>) - :client-name - Client name to identify the application (included in User-Agent header) - :model - Change the model for the resumed session - :tools - Tools exposed to the CLI server - :system-message - System message configuration {:mode :content} - :available-tools - List of tool names to allow - :excluded-tools - List of tool names to disable - :provider - Custom provider configuration (BYOK) - :streaming? - Enable streaming responses - :mcp-servers - MCP server configurations - :custom-agents - Custom agent configurations - :config-dir - Override configuration directory - :skill-directories - Directories to load skills from - :disabled-skills - Skills to disable - :infinite-sessions - Infinite session configuration - :reasoning-effort - Reasoning effort level: “low”, “medium”, “high”, or “xhigh” - :on-user-input-request - Handler for ask_user requests - :on-elicitation-request - Handler for elicitation requests (upstream PRs #908, #960). Single-arg handler receives an ElicitationContext map with :session-id, :message, :requested-schema, :mode, :elicitation-source, :url. Returns an ElicitationResult map. - :hooks - Lifecycle hooks map - :on-event - Event handler (1-arg fn) registered before the RPC call. Guarantees early events like session.start are not missed. - :enable-config-discovery - Boolean. Auto-discover .mcp.json, skills, etc. (upstream PR #1044) - :model-capabilities - Model capabilities override map (upstream PR #1029).</p>
<p>Returns a CopilotSession.</p>
</div></div></div><div class="public anchor" id="var-set-foreground-session-id.21"><h3>set-foreground-session-id!</h3><div class="usage"><code>(set-foreground-session-id! client session-id)</code></div><div class="doc"><div class="markdown"><p>Set the foreground session (TUI+server mode). Requests the TUI to switch to displaying the specified session.</p>
</div></div></div><div class="public anchor" id="var-start.21"><h3>start!</h3><div class="usage"><code>(start! client)</code></div><div class="doc"><div class="markdown"><p>Start the CLI server and establish connection. Blocks until connected or throws on error.</p>
<p>Thread safety: do not call start! and stop! concurrently from different threads. The :stopping? flag guards against concurrent calls, but explicit concurrent calls are unsupported.</p>
</div></div></div><div class="public anchor" id="var-state"><h3>state</h3><div class="usage"><code>(state client)</code></div><div class="doc"><div class="markdown"><p>Get the current connection state.</p>
</div></div></div><div class="public anchor" id="var-stop.21"><h3>stop!</h3><div class="usage"><code>(stop! client)</code></div><div class="doc"><div class="markdown"><p>Stop the CLI server and close all sessions. Returns a vector of any errors encountered during cleanup.</p>
<p>Thread safety: do not call start! and stop! concurrently from different threads. Auto-restart is suppressed via the :stopping? flag, but explicit concurrent calls are unsupported.</p>
</div></div></div></div></body></html>