Commit 2fa6a92
authored
feat: add hooks and user input handlers to all SDKs with e2e tests (github#269)
* feat(auth): add githubToken and useLoggedInUser options to all SDK clients
Enable SDK clients to customize authentication when spawning the CLI server.
Node.js:
- Add githubToken and useLoggedInUser options to CopilotClientOptions
- Set COPILOT_SDK_AUTH_TOKEN env var and pass --auth-token-env flag
- Pass --no-auto-login when useLoggedInUser is false
- Default useLoggedInUser to false when githubToken is provided
Python:
- Add github_token and use_logged_in_user options
- Same behavior as Node.js SDK
Go:
- Add GithubToken and UseLoggedInUser fields to ClientOptions
- Same behavior as Node.js SDK
.NET:
- Add GithubToken and UseLoggedInUser properties to CopilotClientOptions
- Same behavior as Node.js SDK
All SDKs include validation to prevent use with cliUrl (external server)
and tests for the new options.
* feat: add hooks and user input handlers to all SDKs with e2e tests
- Add preToolUse, postToolUse, and other hook callbacks to Node.js, Python, Go, .NET SDKs
- Add requestUserInput callback (ask_user) to all SDKs
- Fix .NET SDK bug: StreamJsonRpc requires explicit = null defaults for optional parameters
- Add e2e tests for hooks (4 tests) and ask-user (3 tests) in all SDKs
- Create shared test snapshots for consistent LLM responses across SDKs1 parent 2fe7352 commit 2fa6a92
File tree
43 files changed
+3957
-61
lines changed- .vscode
- dotnet
- src
- test
- go
- e2e
- nodejs
- src
- test/e2e
- python
- copilot
- e2e
- test
- harness
- snapshots
- ask-user
- ask_user
- askuser
- hooks
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
43 files changed
+3957
-61
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
17 | 20 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
336 | 336 | | |
337 | 337 | | |
338 | 338 | | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
339 | 347 | | |
340 | 348 | | |
341 | 349 | | |
| |||
345 | 353 | | |
346 | 354 | | |
347 | 355 | | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
348 | 359 | | |
349 | 360 | | |
350 | 361 | | |
| |||
362 | 373 | | |
363 | 374 | | |
364 | 375 | | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
365 | 384 | | |
366 | 385 | | |
367 | 386 | | |
| |||
399 | 418 | | |
400 | 419 | | |
401 | 420 | | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
402 | 429 | | |
403 | 430 | | |
404 | 431 | | |
405 | 432 | | |
406 | 433 | | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
407 | 438 | | |
408 | 439 | | |
409 | 440 | | |
| |||
419 | 450 | | |
420 | 451 | | |
421 | 452 | | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
422 | 461 | | |
423 | 462 | | |
424 | 463 | | |
| |||
804 | 843 | | |
805 | 844 | | |
806 | 845 | | |
| 846 | + | |
| 847 | + | |
807 | 848 | | |
808 | 849 | | |
809 | 850 | | |
| |||
990 | 1031 | | |
991 | 1032 | | |
992 | 1033 | | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
993 | 1065 | | |
994 | 1066 | | |
995 | 1067 | | |
| |||
1024 | 1096 | | |
1025 | 1097 | | |
1026 | 1098 | | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
1027 | 1102 | | |
1028 | 1103 | | |
1029 | 1104 | | |
| |||
1050 | 1125 | | |
1051 | 1126 | | |
1052 | 1127 | | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
1053 | 1132 | | |
1054 | 1133 | | |
1055 | 1134 | | |
| |||
1079 | 1158 | | |
1080 | 1159 | | |
1081 | 1160 | | |
| 1161 | + | |
| 1162 | + | |
| 1163 | + | |
| 1164 | + | |
| 1165 | + | |
| 1166 | + | |
| 1167 | + | |
1082 | 1168 | | |
1083 | 1169 | | |
1084 | 1170 | | |
| |||
1131 | 1217 | | |
1132 | 1218 | | |
1133 | 1219 | | |
| 1220 | + | |
1134 | 1221 | | |
1135 | 1222 | | |
1136 | 1223 | | |
| |||
1143 | 1230 | | |
1144 | 1231 | | |
1145 | 1232 | | |
| 1233 | + | |
| 1234 | + | |
| 1235 | + | |
1146 | 1236 | | |
1147 | 1237 | | |
1148 | 1238 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
51 | 55 | | |
52 | 56 | | |
53 | 57 | | |
| |||
330 | 334 | | |
331 | 335 | | |
332 | 336 | | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
333 | 467 | | |
334 | 468 | | |
335 | 469 | | |
| |||
487 | 621 | | |
488 | 622 | | |
489 | 623 | | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
490 | 636 | | |
491 | 637 | | |
0 commit comments