Liking cljdoc? Tell your friends :D
Clojure only.

copilot.types

Canonical data shapes used throughout the Copilot Clojure SDK.

All maps use kebab-case keywords internally. Conversion to/from camelCase JSON happens at the transport boundary (see copilot.json-rpc).

Canonical data shapes used throughout the Copilot Clojure SDK.

All maps use kebab-case keywords internally.  Conversion to/from
camelCase JSON happens at the transport boundary (see copilot.json-rpc).
raw docstring

ask-user-variantsclj

Values of the :ask-user-variant session option (wire askUserVariant).

Values of the :ask-user-variant session option (wire askUserVariant).
sourceraw docstring

auto-tiersclj

Auto routing tiers accepted by copilot.session/switch-auto-tier!.

Auto routing tiers accepted by `copilot.session/switch-auto-tier!`.
sourceraw docstring

autopilot-optionsclj

(autopilot-options & {:keys [continuation-enabled max-continues]})

Construct autopilot continuation options (session option :autopilot, wire execution.autopilot). Optional: :continuation-enabled (boolean), :max-continues (integer)

Construct autopilot continuation options (session option :autopilot,
wire execution.autopilot).
Optional: :continuation-enabled (boolean), :max-continues (integer)
sourceraw docstring

bearer-token-providerclj

(bearer-token-provider f)

Wrap a token-producing function as a BYOK bearer-token provider. f is a (fn [args] ...) returning a bearer token string (or a promise).

Wrap a token-producing function as a BYOK bearer-token provider.
`f` is a (fn [args] ...) returning a bearer token string (or a promise).
sourceraw docstring

canvas-actionclj

(canvas-action name description & {:as opts})

Create a canvas action.

name and description are required. Optional: :input-schema (JSON-schema map).

Create a canvas action.

`name` and `description` are required.
Optional: :input-schema (JSON-schema map).
sourceraw docstring

canvas-action-contextclj

(canvas-action-context session-id
                       extension-id
                       canvas-id
                       instance-id
                       action-name
                       input
                       &
                       {:as opts})

Create a canvas-action-context map. Optional: :host

Create a canvas-action-context map.
Optional: :host
sourceraw docstring

canvas-declarationclj

(canvas-declaration id display-name description & {:as opts})

Create a canvas declaration.

Required: id, display-name, description. Optional: :input-schema, :actions (vector of canvas-action maps).

Create a canvas declaration.

Required: `id`, `display-name`, `description`.
Optional: :input-schema, :actions (vector of canvas-action maps).
sourceraw docstring

canvas-host-capabilitiesclj

(canvas-host-capabilities & {:as opts})

Create a canvas-host-capabilities map. Optional: :canvases (defaults to false).

Create a canvas-host-capabilities map.
Optional: :canvases (defaults to false).
sourceraw docstring

canvas-host-contextclj

(canvas-host-context capabilities)

Create a canvas-host-context map. capabilities is required.

Create a canvas-host-context map. `capabilities` is required.
sourceraw docstring

canvas-lifecycle-contextclj

(canvas-lifecycle-context session-id
                          extension-id
                          canvas-id
                          instance-id
                          &
                          {:as opts})

Create a canvas-lifecycle-context map. Optional: :host

Create a canvas-lifecycle-context map.
Optional: :host
sourceraw docstring

canvas-open-contextclj

(canvas-open-context session-id
                     extension-id
                     canvas-id
                     instance-id
                     input
                     &
                     {:as opts})

Create a canvas-open-context map. Optional: :host

Create a canvas-open-context map.
Optional: :host
sourceraw docstring

canvas-open-responseclj

(canvas-open-response & {:as opts})

Create a canvas-open response. Optional keys: :url :title :status

Create a canvas-open response.
Optional keys: :url :title :status
sourceraw docstring

capi-configclj

(capi-config & {:keys [enabled]})

Construct the built-in Copilot API policy (session option :capi, wire github.capi). :enabled false keeps a BYOK-only model catalog.

Construct the built-in Copilot API policy (session option :capi, wire
github.capi).  :enabled false keeps a BYOK-only model catalog.
sourceraw docstring

client-infoclj

(client-info &
             {:keys [editor-name editor-version extension-name
                     extension-version]})

Construct the ClientInfo map declared on the connect handshake (client option :client-info). All keys are optional strings; empty values are dropped, and connect is not sent when every field is empty. Keys: :editor-name :editor-version :extension-name :extension-version

Construct the ClientInfo map declared on the `connect` handshake
(client option :client-info).  All keys are optional strings; empty values
are dropped, and `connect` is not sent when every field is empty.
Keys: :editor-name :editor-version :extension-name :extension-version
sourceraw docstring

client-modesclj

Client modes (client option :mode). "coding-agent" (the default) keeps the CLI-like coding tools and defaults; "empty" enables only what each session asks for, so every create/resume must pass :available-tools. The legacy name "copilot-cli" is accepted as an alias of "coding-agent".

Client modes (client option :mode).  "coding-agent" (the default) keeps
the CLI-like coding tools and defaults; "empty" enables only what each
session asks for, so every create/resume must pass :available-tools.  The
legacy name "copilot-cli" is accepted as an alias of "coding-agent".
sourceraw docstring

client-optionsclj

(client-options & {:as opts})

Create a client options map.

Optional keys: :cli-path - path to CLI executable (default: "copilot") :cli-args - extra CLI arguments (vector of strings) :cwd - working directory for CLI process :port - TCP port (default 0 = random) :use-stdio - use stdio transport (default true) :cli-url - URL of existing server (mutually exclusive with :cli-path/:use-stdio) :log-level - :none :error :warning :info :debug :all (default :info) :auto-start - auto-start on first use (default true) :auto-restart - auto-restart on crash (default true) :env - environment variables map :github-token - GitHub auth token :use-logged-in-user - use logged-in user auth (default true unless :github-token set) :session-idle-timeout-seconds - server-wide idle timeout for sessions in seconds :session-fs - session filesystem provider map (see session-fs-config) :copilot-home - custom path to the copilot home directory :tcp-connection-token - token for TCP connections :bearer-token-provider - BYOK bearer-token provider map (see bearer-token-provider) :builtin-plugin-directories - extra builtin plugin dirs (JSON: builtinPluginDirectories) :in-process - use in-process FFI transport (JSON: inProcess) :request-handler - CopilotRequestHandler map for outbound HTTP (see copilot-request-handler) :client-info - application identity sent on the connect handshake (see client-info) :mode - "coding-agent" (default) or "empty" (see client-modes) :network - network callbacks registered with network.setProvider: {:scope "connection"|"runtime" :resolve-proxy (fn [{:keys [url]}] -> PAC proxy string or nil) :authenticate-negotiate (fn [{:keys [spn]}] -> base64 token or nil) :authenticate-basic (fn [{:keys [proxy realm previous-rejected]}] -> {:username u :password p} or nil)}

Create a client options map.

Optional keys:
  :cli-path         - path to CLI executable (default: "copilot")
  :cli-args         - extra CLI arguments (vector of strings)
  :cwd              - working directory for CLI process
  :port             - TCP port (default 0 = random)
  :use-stdio        - use stdio transport (default true)
  :cli-url          - URL of existing server (mutually exclusive with :cli-path/:use-stdio)
  :log-level        - :none :error :warning :info :debug :all (default :info)
  :auto-start       - auto-start on first use (default true)
  :auto-restart     - auto-restart on crash (default true)
  :env              - environment variables map
  :github-token     - GitHub auth token
  :use-logged-in-user - use logged-in user auth (default true unless :github-token set)
  :session-idle-timeout-seconds - server-wide idle timeout for sessions in seconds
  :session-fs       - session filesystem provider map (see session-fs-config)
  :copilot-home     - custom path to the copilot home directory
  :tcp-connection-token - token for TCP connections
  :bearer-token-provider - BYOK bearer-token provider map (see bearer-token-provider)
  :builtin-plugin-directories - extra builtin plugin dirs (JSON: builtinPluginDirectories)
  :in-process       - use in-process FFI transport (JSON: inProcess)
  :request-handler  - CopilotRequestHandler map for outbound HTTP (see copilot-request-handler)
  :client-info      - application identity sent on the connect handshake (see client-info)
  :mode             - "coding-agent" (default) or "empty" (see client-modes)
  :network          - network callbacks registered with network.setProvider:
                      {:scope "connection"|"runtime"
                       :resolve-proxy (fn [{:keys [url]}] -> PAC proxy string or nil)
                       :authenticate-negotiate (fn [{:keys [spn]}] -> base64 token or nil)
                       :authenticate-basic (fn [{:keys [proxy realm previous-rejected]}]
                                             -> {:username u :password p} or nil)}
sourceraw docstring

cloud-session-optionsclj

(cloud-session-options & {:as opts})

Create cloud-session options. Optional: :repository

Create cloud-session options.
Optional: :repository
sourceraw docstring

cloud-session-repositoryclj

(cloud-session-repository owner name & {:as opts})

Create cloud-session repository metadata. Optional: :branch

Create cloud-session repository metadata.
Optional: :branch
sourceraw docstring

command-contextclj

(command-context session-id command command-name args)

Construct a command context map.

Construct a command context map.
sourceraw docstring

command-definitionclj

(command-definition name handler)
(command-definition name description handler)

Define a slash command. handler is a function of one arg (command-context map).

Define a slash command.  `handler` is a function of one arg (command-context map).
sourceraw docstring

commands-invoke-requestclj

(commands-invoke-request name & {:keys [input]})

Construct a commands invoke request map.

name - command name Optional: :input (string)

Construct a commands invoke request map.

`name`  - command name
Optional: :input (string)
sourceraw docstring

commands-list-requestclj

(commands-list-request &
                       {:keys [include-builtins include-client-commands
                               include-skills]})

Construct a commands list request map.

Optional: :include-builtins (boolean), :include-client-commands (boolean), :include-skills (boolean)

Construct a commands list request map.

Optional: :include-builtins (boolean), :include-client-commands (boolean),
          :include-skills (boolean)
sourceraw docstring

copilot-request-handlerclj

(copilot-request-handler f)

Wrap a function as a CopilotRequestHandler for outbound HTTP requests. f is a (fn [request] ...) returning a response map.

Wrap a function as a CopilotRequestHandler for outbound HTTP requests.
`f` is a (fn [request] ...) returning a response map.
sourceraw docstring

custom-agent-configclj

(custom-agent-config name prompt & {:as opts})

Create a custom agent configuration.

name - unique agent name prompt - agent prompt content Optional: :display-name :description :tools :mcp-servers :infer :skills (vector of skill name strings to preload) :args-schema (opaque map emitted as argsSchema)

Create a custom agent configuration.

`name`   - unique agent name
`prompt` - agent prompt content
Optional: :display-name :description :tools :mcp-servers :infer
          :skills (vector of skill name strings to preload)
          :args-schema (opaque map emitted as argsSchema)
sourceraw docstring

elicitation-contextclj

(elicitation-context session-id
                     message
                     &
                     {:keys [requested-schema mode elicitation-source url]})

Construct an elicitation context map.

Construct an elicitation context map.
sourceraw docstring

elicitation-resultclj

(elicitation-result action)
(elicitation-result action content)

Construct an elicitation result map. action is one of "accept", "decline", "cancel". content is an optional map of form values.

Construct an elicitation result map.
`action` is one of "accept", "decline", "cancel".
`content` is an optional map of form values.
sourceraw docstring

exit-plan-mode-requestclj

(exit-plan-mode-request session-id)

Construct an exit plan mode request map.

Construct an exit plan mode request map.
sourceraw docstring

exit-plan-mode-responseclj

(exit-plan-mode-response approved)

Construct an exit plan mode response map.

Construct an exit plan mode response map.
sourceraw docstring

get-auth-status-responseclj

(get-auth-status-response m)

Parse an auth.getStatus response.

Parse an auth.getStatus response.
sourceraw docstring

get-status-responseclj

(get-status-response m)

Parse a status.get response.

Parse a status.get response.
sourceraw docstring

github-attachment-typesclj

source

github-token-responseclj

(github-token-response result)

Encode a :github-token-provider result as the gitHubToken.getToken reply.

result - a token string, a map {:access-token s :token-type s :expires-in secs} (camelCase keys are also accepted), or :cancelled / nil to decline. :expires-in is the remaining lifetime in seconds; the runtime requires more than one hour, and it defaults to 28800 (8 hours, the typical GitHub token lifetime).

Encode a :github-token-provider result as the gitHubToken.getToken reply.

`result` - a token string, a map {:access-token s :token-type s :expires-in secs}
           (camelCase keys are also accepted), or :cancelled / nil to decline.
           :expires-in is the remaining lifetime in seconds; the runtime
           requires more than one hour, and it defaults to 28800 (8 hours,
           the typical GitHub token lifetime).
sourceraw docstring

image-generation-configclj

(image-generation-config & {:keys [enabled watermark save-to-disk]})

Construct an image generation opt-in map (session option :image-generation, wire tools.imageGeneration). Optional: :enabled, :watermark, :save-to-disk (booleans)

Construct an image generation opt-in map (session option :image-generation,
wire tools.imageGeneration).
Optional: :enabled, :watermark, :save-to-disk (booleans)
sourceraw docstring

image-optionsclj

(image-options & {:keys [size quality style]})

Create image options map for image generation. Options: :size (e.g. "1024x1024"), :quality ("hd" or "standard"), :style ("natural" or "vivid")

Create image options map for image generation.
Options: :size (e.g. "1024x1024"), :quality ("hd" or "standard"), :style ("natural" or "vivid")
sourceraw docstring

infinite-session-configclj

(infinite-session-config & {:as opts})

Create an infinite session configuration.

Optional: :enabled (default true), :background-compaction-threshold (0.0-1.0, default 0.80), :buffer-exhaustion-threshold (0.0-1.0, default 0.95)

Create an infinite session configuration.

Optional: :enabled (default true),
          :background-compaction-threshold (0.0-1.0, default 0.80),
          :buffer-exhaustion-threshold (0.0-1.0, default 0.95)
sourceraw docstring

mcp-local-server-configclj

(mcp-local-server-config command args tools & {:as opts})

Create a local/stdio MCP server configuration.

command - command string args - vector of argument strings tools - vector of tool name strings (or ["*"] for all) Optional: :type :timeout :env :cwd

Create a local/stdio MCP server configuration.

`command` - command string
`args`    - vector of argument strings
`tools`   - vector of tool name strings (or ["*"] for all)
Optional: :type :timeout :env :cwd
sourceraw docstring

mcp-remote-server-configclj

(mcp-remote-server-config type url tools & {:as opts})

Create a remote MCP server configuration.

type - :http or :sse url - remote server URL tools - vector of tool name strings Optional: :timeout :headers

Create a remote MCP server configuration.

`type`  - :http or :sse
`url`   - remote server URL
`tools` - vector of tool name strings
Optional: :timeout :headers
sourceraw docstring

memory-configurationclj

(memory-configuration & {:keys [enabled]})

Construct a MemoryConfiguration map (opt-in persistent session memory). Optional: :enabled (boolean). Maps to the camelCase wire key memory.

Construct a MemoryConfiguration map (opt-in persistent session memory).
Optional: :enabled (boolean).  Maps to the camelCase wire key `memory`.
sourceraw docstring

message-optionsclj

(message-options prompt & {:as opts})

Construct message options for sending a message.

prompt - the message string Optional: :attachments (vector of attachment maps), :mode (:enqueue or :immediate), :response-format (keyword from response-formats), :image-options (image options map), :agent-mode (string agent name to route the message to), :display-prompt (string shown in the UI in place of the raw prompt), :request-headers (map of string->string custom HTTP headers for outbound model requests), :source (message provenance: "user", "system", or "agent-<id>"; see message-source), :response-schema (JSON Schema map for structured output, sent as a json_schema responseFormat), :client-turn-id (opaque caller-chosen turn identifier, wire clientTurnId)

Construct message options for sending a message.

`prompt` - the message string
Optional: :attachments (vector of attachment maps), :mode (:enqueue or :immediate),
          :response-format (keyword from response-formats), :image-options (image options map),
          :agent-mode (string agent name to route the message to),
          :display-prompt (string shown in the UI in place of the raw prompt),
          :request-headers (map of string->string custom HTTP headers for outbound model requests),
          :source (message provenance: "user", "system", or "agent-<id>";
                   see `message-source`),
          :response-schema (JSON Schema map for structured output, sent as a
                            `json_schema` responseFormat),
          :client-turn-id (opaque caller-chosen turn identifier, wire `clientTurnId`)
sourceraw docstring

message-sourceclj

(message-source kind)
(message-source kind agent-id)

Construct a MessageSource value for the :source message option: (message-source :user) => "user", (message-source :system) => "system", (message-source :agent "id") => "agent-id".

Construct a MessageSource value for the :source message option:
(message-source :user) => "user", (message-source :system) => "system",
(message-source :agent "id") => "agent-id".
sourceraw docstring

model-billingclj

(model-billing multiplier & {:keys [token-prices picker-price-category]})

Construct a model billing map.

multiplier - billing multiplier (double) Optional: :token-prices (model-billing-token-prices map), :picker-price-category (one of "high" "low" "medium" "very_high")

Construct a model billing map.

`multiplier` - billing multiplier (double)
Optional: :token-prices (model-billing-token-prices map),
          :picker-price-category (one of "high" "low" "medium" "very_high")
sourceraw docstring

model-billing-token-pricesclj

(model-billing-token-prices &
                            {:keys [batch-size cache-price input-price
                                    output-price]})

Construct a model billing token prices map.

Optional: :batch-size (int), :cache-price (int), :input-price (int), :output-price (int)

Construct a model billing token prices map.

Optional: :batch-size (int), :cache-price (int),
          :input-price (int), :output-price (int)
sourceraw docstring

model-capabilities-overrideclj

(model-capabilities-override & {:keys [supports limits vision]})

Construct a model capabilities override map.

supports - map of capability flags (e.g. {:vision true}) limits - map of limits with snake_case wire keys, e.g. (model-limits-override :max-output-tokens 8192) => {:max_output_tokens 8192} vision - optional vision limits map

Construct a model capabilities override map.

`supports` - map of capability flags (e.g. {:vision true})
`limits`   - map of limits with snake_case wire keys, e.g.
             (model-limits-override :max-output-tokens 8192)
             => {:max_output_tokens 8192}
`vision`   - optional vision limits map
sourceraw docstring

model-infoclj

(model-info m)

Parse a raw model info map from JSON-RPC response.

Parse a raw model info map from JSON-RPC response.
sourceraw docstring

model-limits-overrideclj

(model-limits-override &
                       {:keys [max-prompt-tokens max-output-tokens
                               max-context-window-tokens vision]})

Construct the :limits map of model-capabilities-override. The wire keys inside capabilities limits are snake_case (max_output_tokens, ...). Optional: :max-prompt-tokens, :max-output-tokens, :max-context-window-tokens, :vision (map with snake_case keys)

Construct the :limits map of `model-capabilities-override`.  The wire keys
inside capabilities limits are snake_case (max_output_tokens, ...).
Optional: :max-prompt-tokens, :max-output-tokens, :max-context-window-tokens,
          :vision (map with snake_case keys)
sourceraw docstring

named-provider-configclj

(named-provider-config &
                       {:keys [type base-url api-key api-key-command
                               bearer-token wire-api transport azure headers
                               model-provider]
                        provider-name :name})

Construct a NamedProviderConfig map for the :providers session option (wire inference.providers[]). Model definitions reference it by :name, which cannot contain '/'.

Required: :name, :base-url Optional: :type, :api-key, :api-key-command, :bearer-token, :wire-api, :transport, :azure, :headers, :model-provider

Construct a NamedProviderConfig map for the :providers session option
(wire inference.providers[]).  Model definitions reference it by :name,
which cannot contain '/'.

Required: :name, :base-url
Optional: :type, :api-key, :api-key-command, :bearer-token, :wire-api,
          :transport, :azure, :headers, :model-provider
sourceraw docstring

network-set-provider-paramsclj

(network-set-provider-params network)

Build the network.setProvider params for a :network client option, or nil when no callback is set. Each registered callback is marked with an empty object; :scope is "connection" (runtime default) or "runtime".

Build the network.setProvider params for a :network client option, or nil
when no callback is set.  Each registered callback is marked with an empty
object; :scope is "connection" (runtime default) or "runtime".
sourceraw docstring

parse-assistant-image-dataclj

(parse-assistant-image-data data)

Parse assistant image data from a response map.

Parse assistant image data from a response map.
sourceraw docstring

parse-client-modeclj

(parse-client-mode mode)

Normalize a :mode client option (string or keyword) to :coding-agent or :empty. Throws ex-info for unknown values.

Normalize a :mode client option (string or keyword) to :coding-agent or
:empty.  Throws ex-info for unknown values.
sourceraw docstring

parse-content-blockclj

(parse-content-block block)

Parse a content block from a mixed text+image response.

Parse a content block from a mixed text+image response.
sourceraw docstring

permission-mode-refusalsclj

Known refusal reasons of session.permissions.setMode. :managed-policy ("managed_policy"): managed (enterprise) policy does not allow the mode.

Known refusal reasons of session.permissions.setMode.  :managed-policy
("managed_policy"): managed (enterprise) policy does not allow the mode.
sourceraw docstring

permission-requestclj

(permission-request kind & {:as extra})

Construct a permission request map. kind is one of :shell :write :mcp :read :url.

Construct a permission request map.
`kind` is one of :shell :write :mcp :read :url.
sourceraw docstring

permission-resultclj

(permission-result kind & {:as extra})

Construct a permission result map. kind is one of :approved :denied-by-rules :denied-no-approval-rule-and-could-not-request-from-user :denied-interactively-by-user Optional :decision-context (opaque map emitted as decisionContext).

Construct a permission result map.
`kind` is one of :approved :denied-by-rules
 :denied-no-approval-rule-and-could-not-request-from-user
 :denied-interactively-by-user
Optional :decision-context (opaque map emitted as decisionContext).
sourceraw docstring

permissions-set-mode-resultclj

(permissions-set-mode-result m)

Parse a session.permissions.setMode result into {:success :mode :reason}. A refused change has :success false and, when known, :reason "managed_policy".

Parse a session.permissions.setMode result into {:success :mode :reason}.
A refused change has :success false and, when known, :reason
"managed_policy".
sourceraw docstring

ping-responseclj

(ping-response m)

Parse a raw ping response map.

Parse a raw ping response map.
sourceraw docstring

policy-helper-failureclj

(policy-helper-failure x)

Extract the latest unresolved managed-settings policy helper failure (wire policyHelperFailure) from a refused session.create / session.resume (the thrown ex-info, its ex-data, or the JSON-RPC error :data) or from a managed settings snapshot. Returns nil when absent. Helper-authored text is untrusted: render it as plain text.

Keys: :category :failure-mode :message :previous-policy-retained :reason :authority :code :details :diagnostic :help-link

Extract the latest unresolved managed-settings policy helper failure
(wire policyHelperFailure) from a refused session.create / session.resume
(the thrown ex-info, its ex-data, or the JSON-RPC error :data) or from a
managed settings snapshot.  Returns nil when absent.  Helper-authored text
is untrusted: render it as plain text.

Keys: :category :failure-mode :message :previous-policy-retained :reason
      :authority :code :details :diagnostic :help-link
sourceraw docstring

provider-configclj

(provider-config & {:as opts})

Create a provider configuration map for BYOK (Bring Your Own Key).

Required: :base-url Optional: :type (:openai :azure :anthropic), :wire-api, :api-key, :bearer-token, :azure {:api-version ...}, :api-key-command (command whose stdout is used as the API key), :model-provider ("openai" "anthropic" "azure_openai" "ollama" "lm_studio" "foundry_local" "llama_cpp"), :transport, :headers

On SDK protocol 4 this legacy single provider is sent as the named "default" connection (inference.providers), selected with inference.defaultProvider, with Copilot API models disabled (github.capi.enabled false), which preserves v1 behavior.

Create a provider configuration map for BYOK (Bring Your Own Key).

Required: :base-url
Optional: :type (:openai :azure :anthropic), :wire-api, :api-key,
          :bearer-token, :azure {:api-version ...},
          :api-key-command (command whose stdout is used as the API key),
          :model-provider ("openai" "anthropic" "azure_openai" "ollama"
                           "lm_studio" "foundry_local" "llama_cpp"),
          :transport, :headers

On SDK protocol 4 this legacy single provider is sent as the named
"default" connection (`inference.providers`), selected with
`inference.defaultProvider`, with Copilot API models disabled
(`github.capi.enabled` false), which preserves v1 behavior.
sourceraw docstring

provider-model-configclj

(provider-model-config &
                       {:keys [provider id model-id wire-model max-prompt-tokens
                               max-context-window-tokens max-output-tokens
                               capabilities]
                        display-name :name})

Construct a ProviderModelConfig map for the :models session option (wire inference.models[]). Select the model with "<provider>/<id>".

Required: :provider, :id Optional: :model-id, :wire-model, :name, :max-prompt-tokens, :max-context-window-tokens, :max-output-tokens, :capabilities

Construct a ProviderModelConfig map for the :models session option
(wire inference.models[]).  Select the model with "<provider>/<id>".

Required: :provider, :id
Optional: :model-id, :wire-model, :name, :max-prompt-tokens,
          :max-context-window-tokens, :max-output-tokens, :capabilities
sourceraw docstring

remote-enable-requestclj

(remote-enable-request & {:keys [mode]})

Construct a remote enable request map.

Optional: :mode (one of "export" "off" "on")

Construct a remote enable request map.

Optional: :mode (one of "export" "off" "on")
sourceraw docstring

remote-enable-resultclj

(remote-enable-result m)

Parse a remote enable result map.

m - raw JSON map with :remoteSteerable (boolean, required) and :url (string, optional)

Parse a remote enable result map.

`m` - raw JSON map with :remoteSteerable (boolean, required) and :url (string, optional)
sourceraw docstring

remote-session-modesclj

Valid remote session mode values.

Valid remote session mode values.
sourceraw docstring

response-format->strclj

(response-format->str fmt)

Convert a response format keyword to its JSON string representation.

Convert a response format keyword to its JSON string representation.
sourceraw docstring

response-formatsclj

source

resume-session-configclj

(resume-session-config & {:as opts})

Create a resume-session configuration map. Accepts the same keys as session-config plus :disable-resume, :github-token, :commands, :on-elicitation-request, :instruction-directories, and :allow-transcript-recovery. :trust-working-directory is create-only and is not sent on resume.

Create a resume-session configuration map.  Accepts the same keys as
`session-config` plus :disable-resume, :github-token,
:commands, :on-elicitation-request, :instruction-directories, and
:allow-transcript-recovery.  :trust-working-directory is create-only and is
not sent on resume.
sourceraw docstring

sandbox-configclj

(sandbox-config &
                {:keys [enabled user-policy add-current-working-directory
                        sandbox-mcp-servers sandbox-lsp-servers
                        sandbox-extensions allow-bypass]
                 :or {enabled true}})

Construct a sandbox configuration map (session option :sandbox-config, wire permissions.sandbox).

Optional: :enabled (default true), :user-policy, :add-current-working-directory, :sandbox-mcp-servers, :sandbox-lsp-servers, :sandbox-extensions, :allow-bypass (lets the agent ask to run an individual command outside the sandbox; the request goes through the normal permission flow)

Construct a sandbox configuration map (session option :sandbox-config,
wire permissions.sandbox).

Optional: :enabled (default true), :user-policy, :add-current-working-directory,
          :sandbox-mcp-servers, :sandbox-lsp-servers, :sandbox-extensions,
          :allow-bypass (lets the agent ask to run an individual command
          outside the sandbox; the request goes through the normal
          permission flow)
sourceraw docstring

section-overrideclj

(section-override action)
(section-override action content)

Create a section override. action is one of :replace :remove :append :prepend. content is optional string.

Create a section override.
`action` is one of :replace :remove :append :prepend.
`content` is optional string.
sourceraw docstring

section-override-actionsclj

source

session-configclj

(session-config & {:as opts})

Create a session configuration map. All keys are optional.

Recognised keys (kebab-case): :session-id :model :reasoning-effort :config-dir :tools :system-message :available-tools :excluded-tools :provider :on-permission-request :on-user-input-request :hooks :working-directory :streaming :mcp-servers :custom-agents :skill-directories :disabled-skills :infinite-sessions :model-capabilities :enable-config-discovery :include-sub-agent-streaming-events :github-token :commands :on-elicitation-request :session-fs (session filesystem provider map) :instruction-directories (list of directories to search for instruction files) :enable-citations :excluded-builtin-agents :session-limits :memory-config :otlp-protocol :enable-web-socket-responses :exp-assignments :rewind-enabled :additional-directories :disabled-mcp-servers :github-mcp-tool-config :canvas-provider :custom-agents-local-only :tool-search :experimental-mode :content-exclusion :on-mcp-auth-request (fn invoked to supply an MCP OAuth host token)

v2.6.0 / v3.0.0 keys: :ask-user-variant ("legacy" or "elicitation") :github-token-provider (fn [request] -> token string, token map, or :cancelled; mutually exclusive with :github-token) :sandbox-config (see sandbox-config, includes :allow-bypass) :feature-flags (map of flag name -> value) :allowed-models (vector of model ids) :auth-client-id-metadata-url (string) :agent-directories :hook-directories (vectors of paths) :trust-working-directory (create only: "session" trusts the working directory for this session, "user" persists it) :allow-transcript-recovery (resume only) :image-generation (see image-generation-config) :autopilot (see autopilot-options) :providers (see named-provider-config) :models (see provider-model-config) :default-provider (string; on resume an explicit nil clears it) :capi (see capi-config) :on-shell-authentication-request (fn [request] -> value string or nil) :store-memory (fn [memory] ...)

Create a session configuration map.  All keys are optional.

Recognised keys (kebab-case):
  :session-id :model :reasoning-effort :config-dir
  :tools :system-message :available-tools :excluded-tools
  :provider :on-permission-request :on-user-input-request :hooks
  :working-directory :streaming :mcp-servers :custom-agents
  :skill-directories :disabled-skills :infinite-sessions
  :model-capabilities :enable-config-discovery
  :include-sub-agent-streaming-events
  :github-token :commands :on-elicitation-request
  :session-fs (session filesystem provider map)
  :instruction-directories (list of directories to search for instruction files)
  :enable-citations :excluded-builtin-agents :session-limits :memory-config
  :otlp-protocol :enable-web-socket-responses :exp-assignments
  :rewind-enabled :additional-directories :disabled-mcp-servers
  :github-mcp-tool-config :canvas-provider :custom-agents-local-only
  :tool-search :experimental-mode :content-exclusion
  :on-mcp-auth-request (fn invoked to supply an MCP OAuth host token)

v2.6.0 / v3.0.0 keys:
  :ask-user-variant ("legacy" or "elicitation")
  :github-token-provider (fn [request] -> token string, token map, or
                          :cancelled; mutually exclusive with :github-token)
  :sandbox-config (see `sandbox-config`, includes :allow-bypass)
  :feature-flags (map of flag name -> value)
  :allowed-models (vector of model ids)
  :auth-client-id-metadata-url (string)
  :agent-directories :hook-directories (vectors of paths)
  :trust-working-directory (create only: "session" trusts the working
                            directory for this session, "user" persists it)
  :allow-transcript-recovery (resume only)
  :image-generation (see `image-generation-config`)
  :autopilot (see `autopilot-options`)
  :providers (see `named-provider-config`) :models (see `provider-model-config`)
  :default-provider (string; on resume an explicit nil clears it)
  :capi (see `capi-config`)
  :on-shell-authentication-request (fn [request] -> value string or nil)
  :store-memory (fn [memory] ...)
sourceraw docstring

session-fs-configclj

(session-fs-config initial-cwd session-state-path & {:keys [conventions]})

Create a session filesystem configuration.

initial-cwd - initial working directory session-state-path - path for session state storage Optional: :conventions ("windows" or "posix")

Create a session filesystem configuration.

`initial-cwd`        - initial working directory
`session-state-path` - path for session state storage
Optional: :conventions ("windows" or "posix")
sourceraw docstring

session-fs-file-infoclj

(session-fs-file-info name size is-directory is-file & {:as opts})

Create a session filesystem file info map.

name - file or directory name size - size in bytes is-directory - boolean is-file - boolean Optional: :created-at (ISO 8601 string), :modified-at (ISO 8601 string)

Create a session filesystem file info map.

`name`          - file or directory name
`size`          - size in bytes
`is-directory`  - boolean
`is-file`       - boolean
Optional: :created-at (ISO 8601 string), :modified-at (ISO 8601 string)
sourceraw docstring

session-hooksclj

(session-hooks & {:as opts})

Create a session hooks map.

Optional keys: :on-pre-tool-use (fn [input invocation] ...) :on-post-tool-use (fn [input invocation] ...) :on-pre-mcp-tool-call (fn [input invocation] ...) :on-user-prompt-submitted (fn [input invocation] ...) :on-session-start (fn [input invocation] ...) :on-session-end (fn [input invocation] ...) :on-error-occurred (fn [input invocation] ...) :on-subagent-start (fn [input invocation] ...) hook type "subagentStart": input has :agentName :agentDisplayName :agentDescription; may return {:additionalContext "..."} :on-subagent-stop (fn [input invocation] ...) hook type "subagentStop": input adds :agentId :agentType :stopReason :response; may return {:decision "block" :reason "..."} or {:modifiedResponse "..."}

Create a session hooks map.

Optional keys:
  :on-pre-tool-use            (fn [input invocation] ...)
  :on-post-tool-use           (fn [input invocation] ...)
  :on-pre-mcp-tool-call       (fn [input invocation] ...)
  :on-user-prompt-submitted   (fn [input invocation] ...)
  :on-session-start           (fn [input invocation] ...)
  :on-session-end             (fn [input invocation] ...)
  :on-error-occurred          (fn [input invocation] ...)
  :on-subagent-start          (fn [input invocation] ...)  hook type "subagentStart":
                              input has :agentName :agentDisplayName :agentDescription;
                              may return {:additionalContext "..."}
  :on-subagent-stop           (fn [input invocation] ...)  hook type "subagentStop":
                              input adds :agentId :agentType :stopReason :response;
                              may return {:decision "block" :reason "..."} or
                              {:modifiedResponse "..."}
sourceraw docstring

session-lifecycle-eventclj

(session-lifecycle-event m)

Parse a raw session lifecycle event from JSON-RPC notification.

Parse a raw session lifecycle event from JSON-RPC notification.
sourceraw docstring

session-limitsclj

(session-limits & {:keys [max-ai-credits]})

Construct a session spending-limits map. Optional: :max-ai-credits (number) → wire key maxAiCredits.

Construct a session spending-limits map.
Optional: :max-ai-credits (number) → wire key `maxAiCredits`.
sourceraw docstring

session-metadataclj

(session-metadata m)

Parse a raw session metadata map.

Parse a raw session metadata map.
sourceraw docstring

shell-authentication-requestclj

(shell-authentication-request m)

Parse shellAuthentication.request params into the map passed to an :on-shell-authentication-request handler. :input-kind is "secret" (mask the input), "text", or "confirm" (answer "yes" or cancel).

Parse shellAuthentication.request params into the map passed to an
:on-shell-authentication-request handler.  :input-kind is "secret" (mask
the input), "text", or "confirm" (answer "yes" or cancel).
sourceraw docstring

shell-authentication-responseclj

(shell-authentication-response result)

Encode a shell authentication handler result as the reply: a string (or {:action "accept" :value s}) accepts with that value; nil, :cancel, or {:action "cancel"} cancels.

Encode a shell authentication handler result as the reply: a string (or
{:action "accept" :value s}) accepts with that value; nil, :cancel, or
{:action "cancel"} cancels.
sourceraw docstring

skills-load-diagnosticsclj

(skills-load-diagnostics errors warnings)

Construct a skills load diagnostics map.

errors - vector of error strings warnings - vector of warning strings

Construct a skills load diagnostics map.

`errors`   - vector of error strings
`warnings` - vector of warning strings
sourceraw docstring

slash-command-infoclj

(slash-command-info allow-during-agent-execution
                    description
                    kind
                    name
                    &
                    {:as opts})

Construct a slash command info map.

allow-during-agent-execution - boolean description - description string kind - one of "builtin" "client" "skill" name - command name Optional: :aliases (vector of strings), :experimental (boolean), :input (slash-command-input map)

Construct a slash command info map.

`allow-during-agent-execution` - boolean
`description`                  - description string
`kind`                         - one of "builtin" "client" "skill"
`name`                         - command name
Optional: :aliases (vector of strings), :experimental (boolean),
          :input (slash-command-input map)
sourceraw docstring

slash-command-inputclj

(slash-command-input hint & {:keys [completion]})

Construct a slash command input map.

hint - hint string for the command input Optional: :completion ("directory")

Construct a slash command input map.

`hint` - hint string for the command input
Optional: :completion ("directory")
sourceraw docstring

stored-memoryclj

(stored-memory m)

Parse memoryStore.store params into the map passed to a :store-memory callback: {:session-id :subject :fact :citations :reason}.

Parse memoryStore.store params into the map passed to a :store-memory
callback: {:session-id :subject :fact :citations :reason}.
sourceraw docstring

system-message-appendclj

(system-message-append)
(system-message-append content)

Append-mode system message (default). Content is appended after SDK sections.

Append-mode system message (default). Content is appended after SDK sections.
sourceraw docstring

system-message-customizeclj

(system-message-customize)
(system-message-customize sections)
(system-message-customize sections content)

Customize-mode system message. Override individual sections.

Customize-mode system message. Override individual sections.
sourceraw docstring

system-message-replaceclj

(system-message-replace content)

Replace-mode system message. Caller provides entire system message.

Replace-mode system message. Caller provides entire system message.
sourceraw docstring

system-prompt-sectionsclj

source

toolclj

(tool name description parameters handler & {:keys [idempotent]})

Construct a tool definition.

name - tool name string description - description for the LLM parameters - JSON Schema map (or nil) handler - (fn [args invocation] ...) -> any (may return a promise) Optional: :idempotent true marks the tool as safe to retry (repeated calls with the same arguments have no additional side effects).

Construct a tool definition.

`name`        - tool name string
`description` - description for the LLM
`parameters`  - JSON Schema map (or nil)
`handler`     - (fn [args invocation] ...) -> any  (may return a promise)
Optional: :idempotent true marks the tool as safe to retry (repeated calls
          with the same arguments have no additional side effects).
sourceraw docstring

tool-binary-resultclj

(tool-binary-result data mime-type type)
(tool-binary-result data mime-type type desc)

Construct a binary result entry.

data - base64-encoded string mime-type - MIME type string type - result type string desc - optional description

Construct a binary result entry.

`data`      - base64-encoded string
`mime-type` - MIME type string
`type`      - result type string
`desc`      - optional description
sourceraw docstring

tool-defer-modesclj

source

tool-invocationclj

(tool-invocation session-id tool-call-id tool-name arguments)

Construct a tool invocation context map.

Construct a tool invocation context map.
sourceraw docstring

tool-resultclj

(tool-result text result-type)
(tool-result text result-type opts)

Construct a normalised tool result map.

text - string result for the LLM result-type - one of :success :failure :rejected :denied opts - optional map of :error :session-log :tool-telemetry :binary-results-for-llm

Construct a normalised tool result map.

`text`        - string result for the LLM
`result-type` - one of :success :failure :rejected :denied
`opts`        - optional map of :error :session-log :tool-telemetry
                :binary-results-for-llm
sourceraw docstring

tool-shell-outputclj

(tool-shell-output event-or-data)

Parse the data of a tool.shell_output event (or the whole event) into {:tool-call-id :text :sequence :stream}. :stream is "stdout" (also when omitted), "stderr", or "terminal".

Parse the data of a tool.shell_output event (or the whole event) into
{:tool-call-id :text :sequence :stream}.  :stream is "stdout" (also when
omitted), "stderr", or "terminal".
sourceraw docstring

tool-shell-output-eventclj

Event type of live, append-only shell output chunks (ephemeral).

Event type of live, append-only shell output chunks (ephemeral).
sourceraw docstring

trace-contextclj

(trace-context & {:keys [traceparent tracestate]})

Construct a trace context map.

Construct a trace context map.
sourceraw docstring

user-input-requestclj

(user-input-request question & {:as opts})

Construct a user input request. question - string Optional: :choices (vec of strings), :allow-freeform (bool)

Construct a user input request.
`question` - string
Optional: :choices (vec of strings), :allow-freeform (bool)
sourceraw docstring

user-input-responseclj

(user-input-response answer was-freeform)

Construct a user input response. answer - string was-freeform - boolean

Construct a user input response.
`answer`       - string
`was-freeform` - boolean
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close