[upstream-sync] Port session filesystem provider support (upstream PR #917)#79
Closed
github-actions[bot] wants to merge 1 commit intomainfrom
Closed
[upstream-sync] Port session filesystem provider support (upstream PR #917)#79github-actions[bot] wants to merge 1 commit intomainfrom
github-actions[bot] wants to merge 1 commit intomainfrom
Conversation
Add :session-fs client option and :create-session-fs-handler session config option, enabling applications to virtualize per-session file I/O through custom callbacks instead of the server's default local filesystem. Changes: - specs.clj: Add ::session-fs-config, ::session-fs, ::create-session-fs-handler specs; add :session-fs to client-options and ::create-session-fs-handler to session-config, resume-session-config, join-session-config; add ::aborted to ::session.task_complete-data (optional boolean for abort signal cancellation) - session.clj: Add :session-fs-handler nil to initial session state; add set-session-fs-handler! to store handler per session - client.clj: Import camel-snake-kebab.core; add :session-fs to docstring; add handle-session-fs-request! to dispatch incoming sessionFs.* RPC calls; refactor setup-request-handler! to check sessionFs.* prefix before case; update start! to send sessionFs.setProvider RPC when :session-fs is set; update pre-register-session to call :create-session-fs-handler factory; update create-session and resume-session docstrings - CHANGELOG.md, doc/reference/API.md: Document new options Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR ports the session filesystem provider feature from upstream github/copilot-sdk PR #917, which adds support for virtualizing the per-session storage that the underlying runtime uses (event log, large output handling, etc.) through custom client callbacks.
Upstream Changes Ported
PR #917 — Support sessionFs in Node SDK
Adds a mechanism for SDK clients to intercept file I/O that the runtime performs on a per-session basis, routing it through user-provided callbacks instead of the server's default local filesystem.
API additions:
:session-fsnew option increate-client— takes aSessionFsConfigmap::initial-cwd— initial working directory for sessions:session-state-path— path within each session's SessionFs where the runtime stores files:conventions— path conventions:"windows"or"posix"start!, sendssessionFs.setProviderRPC to register as the filesystem provider:create-session-fs-handlernew option increate-session/resume-session— required when:session-fsis set. A factory(fn [session] -> handler-map)called once per session that returns a map implementing the file operations::read-file,:write-file,:append-file,:exists,:stat:mkdir,:readdir,:readdir-with-types,:rm,:renameEvent changes (also in PR #917):
session.task_completedata now has optional:aborted?boolean (true when cancelled via abort signal)"needs-auth"valueChanges Skipped
Implementation Notes
The
SessionFsHandlerTypeScript interface is represented in Clojure as a plain map of functions (idiomatic Clojure, no protocol needed). IncomingsessionFs.*RPC calls from the server are dispatched viahandle-session-fs-request!, which converts the camelCase operation name to a kebab-case keyword usingcamel-snake-kebabto look up the handler function. Handler return values are normalized through the existing protocolclj->wirelayer.Files Changed
src/github/copilot_sdk/client.clj— newhandle-session-fs-request!, updatedsetup-request-handler!,start!,pre-register-session, docstringssrc/github/copilot_sdk/session.clj—:session-fs-handleradded to session state, newset-session-fs-handler!src/github/copilot_sdk/specs.clj— new specs:::session-fs-config,::session-fs,::create-session-fs-handler,::aborted; updated::session-config,::resume-session-config,::join-session-config,::client-options,::session.task_complete-datadoc/reference/API.md— documented:session-fsand:create-session-fs-handlerCHANGELOG.md— added entries under[Unreleased]Testing
Tests could not be run in this environment due to Maven dependency cache unavailability (network download failure). Please run
bb testlocally to verify.The implementation follows the same patterns used by existing request handlers (
hooks.invoke,systemMessage.transform) and is structurally consistent with how the Node.js SDK routes sessionFs calls.