Skip to content

Commit 11a58c6

Browse files
committed
feat: add core AI MITM proxy daemon
1 parent 42e964f commit 11a58c6

File tree

16 files changed

+539
-0
lines changed

16 files changed

+539
-0
lines changed

cli/testdata/coder_server_--help.golden

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,20 @@ AI BRIDGE OPTIONS:
139139
Maximum number of AI Bridge requests per second per replica. Set to 0
140140
to disable (unlimited).
141141

142+
AI PROXY OPTIONS:
143+
--aiproxy-cert-file string, $CODER_AIPROXY_CERT_FILE
144+
Path to the CA certificate file for MITM.
145+
146+
--aiproxy-enabled bool, $CODER_AIPROXY_ENABLED (default: false)
147+
Enable the AI MITM proxy for intercepting and decrypting AI provider
148+
requests.
149+
150+
--aiproxy-key-file string, $CODER_AIPROXY_KEY_FILE
151+
Path to the CA private key file for MITM.
152+
153+
--aiproxy-listen-addr string, $CODER_AIPROXY_LISTEN_ADDR (default: :8888)
154+
The address the AI proxy will listen on.
155+
142156
CLIENT OPTIONS:
143157
These options change the behavior of how clients interact with the Coder.
144158
Clients include the Coder CLI, Coder Desktop, IDE extensions, and the web UI.

cli/testdata/server-config.yaml.golden

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -765,6 +765,19 @@ aibridge:
765765
# (unlimited).
766766
# (default: 0, type: int)
767767
rateLimit: 0
768+
aiproxy:
769+
# Enable the AI MITM proxy for intercepting and decrypting AI provider requests.
770+
# (default: false, type: bool)
771+
enabled: false
772+
# The address the AI proxy will listen on.
773+
# (default: :8888, type: string)
774+
listen_addr: :8888
775+
# Path to the CA certificate file for MITM.
776+
# (default: <unset>, type: string)
777+
cert_file: ""
778+
# Path to the CA private key file for MITM.
779+
# (default: <unset>, type: string)
780+
key_file: ""
768781
# Configure data retention policies for various database tables. Retention
769782
# policies automatically purge old data to reduce database size and improve
770783
# performance. Setting a retention duration to 0 disables automatic purging for

coderd/apidoc/docs.go

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/apidoc/swagger.json

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

codersdk/deployment.go

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1217,6 +1217,10 @@ func (c *DeploymentValues) Options() serpent.OptionSet {
12171217
Name: "AI Bridge",
12181218
YAML: "aibridge",
12191219
}
1220+
deploymentGroupAIProxy = serpent.Group{
1221+
Name: "AI Proxy",
1222+
YAML: "aiproxy",
1223+
}
12201224
deploymentGroupRetention = serpent.Group{
12211225
Name: "Retention",
12221226
Description: "Configure data retention policies for various database tables. Retention policies automatically purge old data to reduce database size and improve performance. Setting a retention duration to 0 disables automatic purging for that data type.",
@@ -3443,6 +3447,50 @@ Write out the current server config as YAML to stdout.`,
34433447
Group: &deploymentGroupAIBridge,
34443448
YAML: "rateLimit",
34453449
},
3450+
3451+
// AI Proxy Options
3452+
{
3453+
Name: "AI Proxy Enabled",
3454+
Description: "Enable the AI MITM proxy for intercepting and decrypting AI provider requests.",
3455+
Flag: "aiproxy-enabled",
3456+
Env: "CODER_AIPROXY_ENABLED",
3457+
Value: &c.AI.ProxyConfig.Enabled,
3458+
Default: "false",
3459+
Group: &deploymentGroupAIProxy,
3460+
YAML: "enabled",
3461+
},
3462+
{
3463+
Name: "AI Proxy Listen Address",
3464+
Description: "The address the AI proxy will listen on.",
3465+
Flag: "aiproxy-listen-addr",
3466+
Env: "CODER_AIPROXY_LISTEN_ADDR",
3467+
Value: &c.AI.ProxyConfig.ListenAddr,
3468+
Default: ":8888",
3469+
Group: &deploymentGroupAIProxy,
3470+
YAML: "listen_addr",
3471+
},
3472+
{
3473+
Name: "AI Proxy Certificate File",
3474+
Description: "Path to the CA certificate file for MITM.",
3475+
Flag: "aiproxy-cert-file",
3476+
Env: "CODER_AIPROXY_CERT_FILE",
3477+
Value: &c.AI.ProxyConfig.CertFile,
3478+
Default: "",
3479+
Group: &deploymentGroupAIProxy,
3480+
YAML: "cert_file",
3481+
},
3482+
{
3483+
Name: "AI Proxy Key File",
3484+
Description: "Path to the CA private key file for MITM.",
3485+
Flag: "aiproxy-key-file",
3486+
Env: "CODER_AIPROXY_KEY_FILE",
3487+
Value: &c.AI.ProxyConfig.KeyFile,
3488+
Default: "",
3489+
Group: &deploymentGroupAIProxy,
3490+
YAML: "key_file",
3491+
Annotations: serpent.Annotations{}.Mark(annotationSecretKey, "true"),
3492+
},
3493+
34463494
// Retention settings
34473495
{
34483496
Name: "Audit Logs Retention",
@@ -3535,8 +3583,16 @@ type AIBridgeBedrockConfig struct {
35353583
SmallFastModel serpent.String `json:"small_fast_model" typescript:",notnull"`
35363584
}
35373585

3586+
type AIProxyConfig struct {
3587+
Enabled serpent.Bool `json:"enabled" typescript:",notnull"`
3588+
ListenAddr serpent.String `json:"listen_addr" typescript:",notnull"`
3589+
CertFile serpent.String `json:"cert_file" typescript:",notnull"`
3590+
KeyFile serpent.String `json:"key_file" typescript:",notnull"`
3591+
}
3592+
35383593
type AIConfig struct {
35393594
BridgeConfig AIBridgeConfig `json:"bridge,omitempty"`
3595+
ProxyConfig AIProxyConfig `json:"proxy,omitempty"`
35403596
}
35413597

35423598
type SupportConfig struct {

docs/reference/api/general.md

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/api/schemas.md

Lines changed: 39 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/cli/server.md

Lines changed: 42 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)