Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .copilot-schema-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.49-1
1.0.49
28 changes: 28 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,34 @@ All notable changes to this project will be documented in this file. This change

## [Unreleased]

### Added (post-v1.0.0-beta.4 sync, round 2)
- **SessionFs SQLite support** — `sessionFs.sqliteQuery` and `sessionFs.sqliteExists`
RPCs are now dispatched to a user-supplied provider. The provider-style handler
accepts an optional nested `:sqlite {:query (fn [query-type sql params]) :exists (fn [])}`
map, alongside the existing filesystem keys. The low-level handler shape uses
flat `:sqlite-query` / `:sqlite-exists` keys (the adapter translates between
them). Clients advertise support via `:capabilities {:sqlite true}` under
`:session-fs`; the value is forwarded on `sessionFs.setProvider` and validated
at session creation (declaring `capabilities.sqlite` without providing a
`:sqlite` handler now throws). `query-type` is automatically coerced from the
wire string to a keyword (`#{:exec :query :run}`). SQL bind-parameter keys
(e.g. `$userId`) are preserved verbatim through wire normalization, and
result row column-name keys (e.g. `:user_id`, `:created_at`) round-trip
verbatim on the outgoing wire path — they are no longer mangled by
recursive kebab→camelCase conversion. SQLite errors propagate as JSON-RPC
errors (not wrapped as SessionFsError). (upstream PR #1299)
- **Schema bump** — `.copilot-schema-version` advanced from `1.0.49-1` to `1.0.49`.
Additive changes only: new named enum types (`AutoModeSwitchResponse`,
`ExitPlanModeAction`, `McpServerSource`, `McpServerStatus`, `SessionMode`,
`SkillSource`, renamed `PermissionRequestMemoryAction/Direction`),
`format: "duration"`/`"uri"` annotations, `"max"` value in reasoning-effort
description, plus the new `sessionFs.sqliteQuery` / `sessionFs.sqliteExists`
RPC methods. (upstream PRs #1305, #1307, #1327, #1333)

### Fixed (post-v1.0.0-beta.4 sync, round 2)
- **`examples/permission_bash.clj`** — Updated permission decision kind from the
deprecated `:approved` to the current `:approve-once`. (carried from upstream PR #1315)

### Added (post-v1.0.0-beta.4 sync)
- **`:session-id` on hook input maps** — `:on-hook-invoke` handlers now receive
a `:session-id` key on the input map. When the upstream wire payload includes
Expand Down
41 changes: 41 additions & 0 deletions doc/reference/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -2179,9 +2179,50 @@ The low-level handler map requires all 10 operations:
| `:readdir-with-types` | `{:session-id :path}` | `{:entries [...]}` |
| `:rm` | `{:session-id :path :recursive :force}` | nil |
| `:rename` | `{:session-id :src :dest}` | nil |
| `:sqlite-query` | `{:session-id :query-type :query :params}` | `{:rows [...] :columns [...] :rows-affected n}` (optional) |
| `:sqlite-exists` | `{:session-id}` | `{:exists true/false}` (optional) |
Comment thread
krukow marked this conversation as resolved.
Outdated

Handler functions may return values directly or via core.async channels.

#### SQLite support (optional)

To handle `sessionFs.sqliteQuery` and `sessionFs.sqliteExists` (upstream PR #1299),
add a nested `:sqlite` map to the provider and advertise the capability on the
client config:

```clojure
(def client
(copilot/client {:session-fs {:initial-cwd "/home/user/project"
:session-state-path "/sessions"
:conventions "posix"
:capabilities {:sqlite true}}}))

(def session
(copilot/create-session client
{:on-permission-request copilot/approve-all
:create-session-fs-handler
(fn [_session]
{;; ... all 10 fs operations above ...
:sqlite {:query (fn [query-type sql params]
;; query-type is one of :exec, :query, :run
;; params is the raw bind-parameter map (keys preserved verbatim, e.g. :$userId)
{:rows [{:n 1}] :columns ["n"] :rows-affected 0})
:exists (fn [] true)}})}))
```

Notes:

- `:capabilities {:sqlite true}` is required when sqlite is advertised; declaring
it without supplying `:sqlite` in the provider throws at session creation.
- SQL bind-parameter map keys (e.g. `$userId`) bypass kebab-case conversion and
arrive at the handler verbatim.
- Result row column-name keys (e.g. `:user_id`, `:created_at`) round-trip
verbatim on the outgoing wire path — they are not converted to camelCase,
matching upstream Node.js semantics where provider rows are forwarded
untouched.
- SQLite handler exceptions propagate as JSON-RPC errors (not wrapped as
`SessionFsError`).

### Session Hooks

Lifecycle hooks allow custom logic at various points during the session:
Expand Down
2 changes: 1 addition & 1 deletion examples/permission_bash.clj
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
:on-permission-request (fn [request _ctx]
(pprint/pprint request)
(if (contains? allowed-commands (:full-command-text request))
{:kind :approved}
{:kind :approve-once}
{:kind :denied-by-rules
:rules [{:kind "shell"
:argument (:full-command-text request)}]}))}]
Expand Down
2 changes: 1 addition & 1 deletion schemas/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ These files are fetched verbatim from the `@github/copilot` npm package at the v

**Do not edit by hand.** To update, run `bb schemas:fetch` after bumping `.copilot-schema-version`.

Currently pinned version: `1.0.49-1`
Currently pinned version: `1.0.49`
Loading
Loading