Skip to content

Commit fd7ba76

Browse files
krukowCopilot
andcommitted
Fix review findings: missing ::model spec, attachment->wire, docs
- Add (s/def ::model string?) for tool.execution_complete-data - Add :github-reference case to attachment->wire with correct wire format - Add ::attachment-state spec and collision comment for clarity - Add :github-reference row to API.md attachment types table Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 69c5611 commit fd7ba76

3 files changed

Lines changed: 13 additions & 0 deletions

File tree

doc/reference/API.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,7 @@ Send a message to the session. Returns immediately with the message ID.
594594
| `:file` | `:type`, `:path` | `:display-name`, `:line-range` | File attachment |
595595
| `:directory` | `:type`, `:path` | `:display-name`, `:line-range` | Directory attachment |
596596
| `:selection` | `:type`, `:file-path`, `:display-name` | `:selection-range`, `:text` | Code selection attachment |
597+
| `:github-reference` | `:type`, `:number`, `:title`, `:reference-type`, `:state`, `:url` || GitHub issue, PR, or discussion reference |
597598

598599
`:line-range` is a map with `:start` and `:end` line numbers (zero-based) to restrict the attachment to a range of lines:
599600

src/github/copilot_sdk/specs.clj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,9 +275,12 @@
275275
#(= :selection (:type %))))
276276

277277
;; GitHub reference attachment (issue, PR, or discussion)
278+
;; Note: ::state is already defined as (instance? Atom) for the client record,
279+
;; so we cannot use s/keys here — manual predicates validate the :state field instead.
278280
(s/def ::number nat-int?)
279281
(s/def ::reference-type #{"issue" "pr" "discussion"})
280282
(s/def ::url string?)
283+
(s/def ::attachment-state string?)
281284
(s/def ::github-reference-attachment
282285
(s/and map?
283286
#(= :github-reference (:type %))
@@ -665,4 +668,5 @@
665668
;; Session model operations (session.model.getCurrent / switchTo)
666669
;; -----------------------------------------------------------------------------
667670

671+
(s/def ::model string?)
668672
(s/def ::model-id (s/nilable string?))

src/github/copilot_sdk/util.clj

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,14 @@
9797
(:selection-range att) (assoc :selection (clj->wire (:selection-range att)))
9898
(:text att) (assoc :text (:text att)))
9999

100+
:github-reference
101+
{:type "github_reference"
102+
:number (:number att)
103+
:title (:title att)
104+
:referenceType (name (:reference-type att))
105+
:state (:state att)
106+
:url (:url att)}
107+
100108
;; :file and :directory
101109
(cond-> {:type (name (:type att))
102110
:path (:path att)}

0 commit comments

Comments
 (0)