Commit 396aefb
feat: promote to well-known provider — zero Node.js, env var auth, retry integration (microsoft#9)
* feat: resolve SDK bundled binary first in mount gate, eliminating Node.js requirement
Make _find_copilot_cli() check for the SDK's bundled binary (copilot/bin/copilot)
before falling back to system PATH lookup. This eliminates the Node.js requirement
when the copilot SDK package is installed with its bundled binary.
Search order is now:
1. COPILOT_CLI_PATH environment variable (explicit override)
2. SDK bundled binary (copilot/bin/copilot next to the installed package)
3. System PATH via shutil.which (original fallback)
Adds three new tests for SDK binary resolution logic:
- test_cli_from_sdk_bundled_binary
- test_cli_sdk_binary_preferred_over_path
- test_cli_fallback_when_sdk_binary_missing
🤖 Generated with [Amplifier](https://github.com/microsoft/amplifier)
Co-Authored-By: Amplifier <240397093+microsoft-amplifier@users.noreply.github.com>
* feat: add github_token passthrough with env var precedence chain
Added token-based auth support to _build_client_options() so users can
authenticate via environment variables (COPILOT_GITHUB_TOKEN, GH_TOKEN,
GITHUB_TOKEN) or explicit config instead of needing the npm CLI.
Token precedence: config > COPILOT_GITHUB_TOKEN > GH_TOKEN > GITHUB_TOKEN > OAuth fallback.
🤖 Generated with [Amplifier](https://github.com/microsoft/amplifier)
Co-Authored-By: Amplifier <240397093+microsoft-amplifier@users.noreply.github.com>
* feat: advertise credential env vars and improve auth error message
Update get_info() to advertise GITHUB_TOKEN, GH_TOKEN, and
COPILOT_GITHUB_TOKEN in credential_env_vars so the CLI can detect
available authentication paths.
Improve _verify_authentication() error message to guide users toward
'Set GITHUB_TOKEN', 'gh auth login', or 'amplifier init' instead of
the obsolete 'copilot auth login' command.
Task 3 of 8 in the well-known provider promotion plan.
🤖 Generated with [Amplifier](https://github.com/microsoft/amplifier)
Co-Authored-By: Amplifier <240397093+microsoft-amplifier@users.noreply.github.com>
* feat: add auth guidance and model choice config fields for setup wizard
Add two ConfigField entries to get_info() so the amplifier init setup
wizard can guide users through authentication and model selection:
- auth_info: text field explaining GitHub token / browser login options
- model: choice field with curated model options (claude-sonnet-4 default)
Includes 3 new tests in TestConfigFields verifying field presence,
types, and model choices.
🤖 Generated with [Amplifier](https://github.com/microsoft/amplifier)
Co-Authored-By: Amplifier <240397093+microsoft-amplifier@users.noreply.github.com>
* feat: translate Copilot exceptions to kernel LLMError types at complete() boundary
- Added kernel LLMError imports (AbortError, AuthenticationError, LLMError,
LLMTimeoutError, NetworkError, NotFoundError, ProviderUnavailableError,
RateLimitError) to provider.py
- Expanded Copilot exception imports (CopilotAbortError,
CopilotAuthenticationError, CopilotConnectionError,
CopilotModelNotFoundError, CopilotProviderError, CopilotRateLimitError,
CopilotSdkLoopError, CopilotSessionError)
- Replaced bare except Exception block in complete() with comprehensive
error translation mapping each Copilot exception to its kernel equivalent,
preserving retryable/retry_after semantics
- Added TestErrorTranslation class with 12 tests covering all paths
- Updated 3 existing metrics tests to expect KernelLLMError instead of
RuntimeError (behavioral change from new error wrapping)
🤖 Generated with [Amplifier](https://github.com/microsoft/amplifier)
Co-Authored-By: Amplifier <240397093+microsoft-amplifier@users.noreply.github.com>
* feat: add retry_with_backoff wrapper around complete() with rate-limit fail-fast
- Add RetryConfig/retry_with_backoff imports from amplifier_core.utils.retry
- Initialize _retry_config in __init__() with configurable max_retries, min_delay,
max_delay, jitter from provider config
- Restructure complete() using inner-function pattern: move session creation, send,
and error translation into _do_complete() inner function
- Add _on_retry callback that emits provider:retry events
- Add rate-limit fail-fast: mark CopilotRateLimitError as non-retryable when
retry_after exceeds max_delay
- Add TestRetryIntegration class with 3 tests verifying config defaults, custom
config, and non-retryable error propagation
- Set max_retries=0 in default test provider_config fixture to prevent real
asyncio.sleep delays in tests
🤖 Generated with [Amplifier](https://github.com/microsoft/amplifier)
Co-Authored-By: Amplifier <240397093+microsoft-amplifier@users.noreply.github.com>
* docs: remove Node.js prerequisite, document env var auth paths
- Remove Node.js 18+ and npm from prerequisites (SDK binary is now bundled)
- Document three auth options: env var (recommended), amplifier init wizard, gh CLI bridge
- Update installation to reflect well-known provider status (amplifier init handles everything)
- Keep all other sections (Usage, Models, Config, Features, Development, etc.) intact
🤖 Generated with [Amplifier](https://github.com/microsoft/amplifier)
Co-Authored-By: Amplifier <240397093+microsoft-amplifier@users.noreply.github.com>
* fix: use secret field with env_var for credential detection, remove hardcoded model list
This fixes two issues in the GitHub Copilot provider config_fields:
- Changed field_type from "text" to "secret" with env_var="GITHUB_TOKEN" so the
CLI wizard can detect existing credentials ("Found in environment/keyring")
- Removed hardcoded model choice field since the CLI wizard already calls
list_models() dynamically for model selection
Co-Authored-By: Amplifier <240397093+microsoft-amplifier@users.noreply.github.com>
* fix: guide users to gh auth login or copilot login instead of pasting tokens
Update ConfigField auth prompt to direct users toward 'gh auth login' or
'copilot login' instead of asking them to paste a raw GitHub token. Change
display_name to 'GitHub Copilot Authentication' for clarity. Update test
assertions to verify the new display_name and prompt content.
🤖 Generated with [Amplifier](https://github.com/microsoft/amplifier)
Co-Authored-By: Amplifier <240397093+microsoft-amplifier@users.noreply.github.com>
* fix: remove auth config field — auth handled by stored OAuth creds or env vars
The ConfigField system (text/secret/choice/boolean) cannot check live auth
status or launch OAuth flows. Authentication is handled naturally:
- Stored OAuth credentials in ~/.copilot/ (from copilot login or gh auth login)
- Environment variables (GITHUB_TOKEN, etc.)
- Auth check happens when list_models() runs during wizard model selection
Changes:
- Remove ConfigField import from provider.py (no longer used)
- Set config_fields=[] in get_info()
- Replace TestConfigFields with single test_config_fields_empty test
🤖 Generated with [Amplifier](https://github.com/microsoft/amplifier)
Co-Authored-By: Amplifier <240397093+microsoft-amplifier@users.noreply.github.com>
---------
Co-authored-by: Amplifier <240397093+microsoft-amplifier@users.noreply.github.com>1 parent 1e0734d commit 396aefb
8 files changed
Lines changed: 751 additions & 88 deletions
File tree
- amplifier_module_provider_github_copilot
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
11 | 10 | | |
12 | 11 | | |
13 | 12 | | |
14 | | - | |
| 13 | + | |
| 14 | + | |
15 | 15 | | |
16 | | - | |
17 | | - | |
| 16 | + | |
18 | 17 | | |
19 | | - | |
20 | | - | |
21 | | - | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
22 | 22 | | |
23 | | - | |
24 | | - | |
| 23 | + | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
28 | 37 | | |
29 | | - | |
| 38 | + | |
30 | 39 | | |
31 | 40 | | |
32 | | - | |
| 41 | + | |
33 | 42 | | |
34 | 43 | | |
| 44 | + | |
| 45 | + | |
35 | 46 | | |
36 | 47 | | |
37 | | - | |
| 48 | + | |
38 | 49 | | |
39 | 50 | | |
40 | | - | |
41 | | - | |
| 51 | + | |
| 52 | + | |
42 | 53 | | |
43 | | - | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
44 | 59 | | |
| 60 | + | |
| 61 | + | |
45 | 62 | | |
46 | 63 | | |
47 | 64 | | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
| 65 | + | |
54 | 66 | | |
55 | 67 | | |
56 | 68 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
221 | 221 | | |
222 | 222 | | |
223 | 223 | | |
224 | | - | |
225 | | - | |
226 | | - | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
227 | 230 | | |
228 | 231 | | |
229 | 232 | | |
| |||
232 | 235 | | |
233 | 236 | | |
234 | 237 | | |
235 | | - | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
236 | 257 | | |
237 | 258 | | |
238 | 259 | | |
239 | | - | |
| 260 | + | |
240 | 261 | | |
241 | 262 | | |
242 | | - | |
| 263 | + | |
243 | 264 | | |
244 | 265 | | |
245 | 266 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
315 | 315 | | |
316 | 316 | | |
317 | 317 | | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
318 | 325 | | |
319 | 326 | | |
320 | 327 | | |
| |||
327 | 334 | | |
328 | 335 | | |
329 | 336 | | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
330 | 349 | | |
331 | 350 | | |
332 | 351 | | |
| |||
343 | 362 | | |
344 | 363 | | |
345 | 364 | | |
346 | | - | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
347 | 368 | | |
348 | 369 | | |
349 | 370 | | |
| |||
0 commit comments