Commit 24cafde
Phase F: internals cleanup + expand public API surface
Mirrors PR #1357 Phase K + 4.1 (TypeScript SDK API review).
Cleanup:
* Remove the deprecated `CopilotSession.destroy()` method. Only `disconnect()`
remains (matches TS PR #1357 4.1).
* Rename `NO_RESULT_PERMISSION_V2_ERROR` → `_NO_RESULT_PERMISSION_V2_ERROR`
and `MIN_PROTOCOL_VERSION` → `_MIN_PROTOCOL_VERSION` (module-private
constants; Python equivalent of TS `@internal` + `stripInternal`).
Public API audit vs C# / TypeScript:
* `copilot/__init__.py` now re-exports the full set of types that match the
TS public surface from `nodejs/src/index.ts`. Notable additions:
- Lifecycle event hierarchy: `SessionCreatedEvent`, `SessionDeletedEvent`,
`SessionUpdatedEvent`, `SessionForegroundEvent`, `SessionBackgroundEvent`,
`SessionLifecycleEvent`, `SessionLifecycleEventBase`,
`SessionLifecycleEventMetadata`, `SessionLifecycleEventType`,
`SessionLifecycleHandler`
- Session metadata / context: `SessionContext`, `SessionListFilter`,
`SessionMetadata`
- Generated `PermissionRequest`, `SessionEvent`, `SessionEventType` (
consumers shouldn't have to reach into `copilot.generated.*`)
- `PermissionHandler`, `PermissionRequestResult`, `PermissionNoResult`,
`UserInputHandler`, `UserInputRequest`, `UserInputResponse`
- MCP server configs: `MCPHTTPServerConfig`, `MCPServerConfig`,
`MCPStdioServerConfig`
- Session config: `SessionConfig`, `ResumeSessionConfig`, `SessionHooks`,
`SystemMessageConfig`, `InfiniteSessionConfig`
- All hook handler / input / output TypedDicts: `PreToolUseHandler` &
friends across the six hook lifecycle points
- Model* completion (added `ModelLimits`, `ModelSupports`,
`ModelVisionLimits`, `ModelBilling`, `ModelPolicy`, `ModelCapabilities`)
- `ConnectionState`, `LogLevel`, `PingResponse`, `GetStatusResponse`,
`GetAuthStatusResponse`, `StopError`
- `ToolResultType`, `SessionEventHandler`
`__all__` is now alphabetically sorted.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 9d63384 commit 24cafde
3 files changed
Lines changed: 145 additions & 31 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
13 | 19 | | |
| 20 | + | |
| 21 | + | |
14 | 22 | | |
| 23 | + | |
| 24 | + | |
15 | 25 | | |
| 26 | + | |
16 | 27 | | |
| 28 | + | |
17 | 29 | | |
18 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
19 | 44 | | |
| 45 | + | |
20 | 46 | | |
21 | 47 | | |
22 | 48 | | |
23 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
24 | 55 | | |
25 | 56 | | |
26 | 57 | | |
| |||
33 | 64 | | |
34 | 65 | | |
35 | 66 | | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
36 | 70 | | |
37 | 71 | | |
38 | 72 | | |
| 73 | + | |
39 | 74 | | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
40 | 90 | | |
| 91 | + | |
41 | 92 | | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
42 | 98 | | |
43 | 99 | | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
44 | 104 | | |
45 | 105 | | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
46 | 113 | | |
47 | 114 | | |
48 | 115 | | |
| |||
56 | 123 | | |
57 | 124 | | |
58 | 125 | | |
| 126 | + | |
59 | 127 | | |
60 | 128 | | |
61 | 129 | | |
62 | 130 | | |
63 | 131 | | |
64 | 132 | | |
65 | 133 | | |
66 | | - | |
67 | 134 | | |
68 | 135 | | |
69 | 136 | | |
70 | 137 | | |
71 | | - | |
72 | 138 | | |
73 | 139 | | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
74 | 143 | | |
75 | 144 | | |
76 | 145 | | |
77 | 146 | | |
| 147 | + | |
78 | 148 | | |
79 | 149 | | |
80 | | - | |
81 | 150 | | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
82 | 154 | | |
83 | 155 | | |
84 | 156 | | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
85 | 160 | | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
86 | 167 | | |
| 168 | + | |
| 169 | + | |
87 | 170 | | |
| 171 | + | |
| 172 | + | |
88 | 173 | | |
| 174 | + | |
89 | 175 | | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
90 | 190 | | |
91 | 191 | | |
| 192 | + | |
92 | 193 | | |
| 194 | + | |
93 | 195 | | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
94 | 207 | | |
95 | 208 | | |
96 | 209 | | |
97 | 210 | | |
98 | 211 | | |
99 | 212 | | |
100 | | - | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
101 | 224 | | |
102 | 225 | | |
| 226 | + | |
103 | 227 | | |
| 228 | + | |
| 229 | + | |
104 | 230 | | |
105 | 231 | | |
106 | 232 | | |
107 | 233 | | |
108 | 234 | | |
109 | 235 | | |
| 236 | + | |
110 | 237 | | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
111 | 244 | | |
| 245 | + | |
112 | 246 | | |
113 | 247 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
979 | 979 | | |
980 | 980 | | |
981 | 981 | | |
982 | | - | |
| 982 | + | |
983 | 983 | | |
984 | 984 | | |
985 | 985 | | |
986 | 986 | | |
987 | 987 | | |
988 | | - | |
| 988 | + | |
989 | 989 | | |
990 | 990 | | |
991 | 991 | | |
| |||
2664 | 2664 | | |
2665 | 2665 | | |
2666 | 2666 | | |
2667 | | - | |
| 2667 | + | |
2668 | 2668 | | |
2669 | 2669 | | |
2670 | 2670 | | |
2671 | 2671 | | |
2672 | | - | |
| 2672 | + | |
2673 | 2673 | | |
2674 | 2674 | | |
2675 | | - | |
| 2675 | + | |
2676 | 2676 | | |
2677 | 2677 | | |
2678 | 2678 | | |
| |||
3364 | 3364 | | |
3365 | 3365 | | |
3366 | 3366 | | |
3367 | | - | |
| 3367 | + | |
3368 | 3368 | | |
3369 | 3369 | | |
3370 | | - | |
| 3370 | + | |
3371 | 3371 | | |
3372 | 3372 | | |
3373 | 3373 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2338 | 2338 | | |
2339 | 2339 | | |
2340 | 2340 | | |
2341 | | - | |
2342 | | - | |
2343 | | - | |
2344 | | - | |
2345 | | - | |
2346 | | - | |
2347 | | - | |
2348 | | - | |
2349 | | - | |
2350 | | - | |
2351 | | - | |
2352 | | - | |
2353 | | - | |
2354 | | - | |
2355 | | - | |
2356 | | - | |
2357 | | - | |
2358 | | - | |
2359 | | - | |
2360 | | - | |
2361 | 2341 | | |
2362 | 2342 | | |
2363 | 2343 | | |
| |||
0 commit comments