-
Notifications
You must be signed in to change notification settings - Fork 125
feat: add AI Bridge Proxy support to copilot module #725
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: ssncf/feat-aibridge-proxy-module
Are you sure you want to change the base?
Changes from all commits
3677eb8
89ef8f6
e6b692a
81667ea
83e44a9
997d16c
2a86f08
aa5fb17
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,6 +22,9 @@ ARG_DENY_TOOLS=${ARG_DENY_TOOLS:-} | |
| ARG_TRUSTED_DIRECTORIES=${ARG_TRUSTED_DIRECTORIES:-} | ||
| ARG_EXTERNAL_AUTH_ID=${ARG_EXTERNAL_AUTH_ID:-github} | ||
| ARG_RESUME_SESSION=${ARG_RESUME_SESSION:-true} | ||
| ARG_ENABLE_AIBRIDGE_PROXY=${ARG_ENABLE_AIBRIDGE_PROXY:-false} | ||
| ARG_AIBRIDGE_PROXY_AUTH_URL=${ARG_AIBRIDGE_PROXY_AUTH_URL:-} | ||
| ARG_AIBRIDGE_PROXY_CERT_PATH=${ARG_AIBRIDGE_PROXY_CERT_PATH:-} | ||
|
|
||
| validate_copilot_installation() { | ||
| if ! command_exists copilot; then | ||
|
|
@@ -118,6 +121,48 @@ setup_github_authentication() { | |
| return 0 | ||
| } | ||
|
|
||
| setup_aibridge_proxy() { | ||
| if [ "$ARG_ENABLE_AIBRIDGE_PROXY" != "true" ]; then | ||
| return 0 | ||
| fi | ||
|
|
||
| echo "Setting up AI Bridge Proxy..." | ||
|
|
||
| # Wait for the aibridge-proxy module to finish. | ||
| # Uses startup coordination to block until aibridge-proxy-setup signals completion. | ||
| if command -v coder > /dev/null 2>&1; then | ||
| coder exp sync want "copilot-aibridge" "aibridge-proxy-setup" > /dev/null 2>&1 || true | ||
| coder exp sync start "copilot-aibridge" > /dev/null 2>&1 || true | ||
| trap 'coder exp sync complete "copilot-aibridge" > /dev/null 2>&1 || true' EXIT | ||
| fi | ||
|
|
||
| if [ -z "$ARG_AIBRIDGE_PROXY_AUTH_URL" ]; then | ||
| echo "ERROR: AI Bridge Proxy is enabled but no proxy auth URL provided." | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [ -z "$ARG_AIBRIDGE_PROXY_CERT_PATH" ]; then | ||
| echo "ERROR: AI Bridge Proxy is enabled but no certificate path provided." | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [ ! -f "$ARG_AIBRIDGE_PROXY_CERT_PATH" ]; then | ||
| echo "ERROR: AI Bridge Proxy certificate not found at $ARG_AIBRIDGE_PROXY_CERT_PATH." | ||
| echo " Ensure the aibridge-proxy module has successfully completed setup." | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Set proxy environment variables scoped to this process tree only. | ||
| # These are inherited by the agentapi/copilot process below, | ||
| # but do not affect other workspace processes, avoiding routing | ||
| # unnecessary traffic through the proxy. | ||
| export HTTPS_PROXY="$ARG_AIBRIDGE_PROXY_AUTH_URL" | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Testing with |
||
| export NODE_EXTRA_CA_CERTS="$ARG_AIBRIDGE_PROXY_CERT_PATH" | ||
|
|
||
| echo "✓ AI Bridge Proxy configured" | ||
| echo " CA certificate: $ARG_AIBRIDGE_PROXY_CERT_PATH" | ||
| } | ||
|
|
||
| start_agentapi() { | ||
| echo "Starting in directory: $ARG_WORKDIR" | ||
| cd "$ARG_WORKDIR" | ||
|
|
@@ -157,5 +202,6 @@ start_agentapi() { | |
| } | ||
|
|
||
| setup_github_authentication | ||
| setup_aibridge_proxy | ||
| validate_copilot_installation | ||
| start_agentapi | ||
Uh oh!
There was an error while loading. Please reload this page.