Verified Commit 362ac880 authored by primetheus's avatar primetheus Committed by GitLab
Browse files

feat(duo): add direct proxy setting for LSP traffic

parent 51babe51
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -11,7 +11,7 @@
      "license": "MIT",
      "dependencies": {
        "@anycable/core": "^0.9.2",
        "@gitlab-org/gitlab-lsp": "^9.6.0",
        "@gitlab-org/gitlab-lsp": "^9.7.0",
        "@gitlab/needle": "2.0.0",
        "@opentelemetry/api": "^1.9.1",
        "@opentelemetry/core": "^2.8.0",
@@ -3048,9 +3048,9 @@
      }
    },
    "node_modules/@gitlab-org/gitlab-lsp": {
      "version": "9.6.0",
      "resolved": "https://gitlab.com/api/v4/projects/46519181/packages/npm/@gitlab-org/gitlab-lsp/-/@gitlab-org/gitlab-lsp-9.6.0.tgz",
      "integrity": "sha1-/VOSq4u3eovRaeHAYBedb2L0woA=",
      "version": "9.7.0",
      "resolved": "https://gitlab.com/api/v4/projects/46519181/packages/npm/@gitlab-org/gitlab-lsp/-/@gitlab-org/gitlab-lsp-9.7.0.tgz",
      "integrity": "sha1-xfJEFwiDz4LZF0a6Yd1j4As/9X0=",
      "dependencies": {
        "@anthropic-ai/sandbox-runtime": "^0.0.62",
        "@anycable/core": "^0.9.2",
@@ -28842,9 +28842,9 @@
      }
    },
    "@gitlab-org/gitlab-lsp": {
      "version": "9.6.0",
      "resolved": "https://gitlab.com/api/v4/projects/46519181/packages/npm/@gitlab-org/gitlab-lsp/-/@gitlab-org/gitlab-lsp-9.6.0.tgz",
      "integrity": "sha1-/VOSq4u3eovRaeHAYBedb2L0woA=",
      "version": "9.7.0",
      "resolved": "https://gitlab.com/api/v4/projects/46519181/packages/npm/@gitlab-org/gitlab-lsp/-/@gitlab-org/gitlab-lsp-9.7.0.tgz",
      "integrity": "sha1-xfJEFwiDz4LZF0a6Yd1j4As/9X0=",
      "requires": {
        "@anthropic-ai/sandbox-runtime": "^0.0.62",
        "@anycable/core": "^0.9.2",
+8 −1
Original line number Diff line number Diff line
@@ -322,6 +322,13 @@
            "order": 7,
            "description": "Enable keybinding hints for GitLab Duo"
          },
          "gitlab.duo.proxy.directConnection": {
            "type": "boolean",
            "default": false,
            "scope": "machine",
            "order": 9,
            "description": "Connect GitLab Duo directly from the language server, without using VS Code or system proxy settings."
          },
          "gitlab.duoCodeSuggestions.enabledSupportedLanguages": {
            "description": "Enable Code Suggestions for these languages.",
            "type": "object",
@@ -629,7 +636,7 @@
  },
  "dependencies": {
    "@anycable/core": "^0.9.2",
    "@gitlab-org/gitlab-lsp": "^9.6.0",
    "@gitlab-org/gitlab-lsp": "^9.7.0",
    "@gitlab/needle": "2.0.0",
    "@opentelemetry/api": "^1.9.1",
    "@opentelemetry/core": "^2.8.0",
+28 −0
Original line number Diff line number Diff line
@@ -272,6 +272,9 @@ describe('LanguageClientWrapper', () => {
              sandbox: {
                enabled: false,
              },
              proxy: {
                mode: 'inherit',
              },
            },
            duoChat: {
              enabled: true,
@@ -768,6 +771,31 @@ describe('LanguageClientWrapper', () => {
      );
    });

    it('syncs direct Duo proxy mode when configured', async () => {
      setFakeWorkspaceConfiguration({
        duo: {
          proxy: {
            directConnection: true,
          },
        },
      });

      await wrapper.syncConfig();

      expect(client.sendNotification).toHaveBeenCalledWith(
        DidChangeConfigurationNotification.type,
        {
          settings: expect.objectContaining({
            duo: expect.objectContaining({
              proxy: {
                mode: 'direct',
              },
            }),
          }),
        },
      );
    });

    it('prioritizes platformClientConfig over default configuration', async () => {
      const customConfig = {
        baseUrl: 'https://override.gitlab.com',
+3 −0
Original line number Diff line number Diff line
@@ -359,6 +359,9 @@ export class LanguageClientWrapperImpl implements LanguageClientWrapper {
        sandbox: {
          enabled: extensionConfiguration.duo.sandbox.enabled,
        },
        proxy: {
          mode: extensionConfiguration.duo.proxy.directConnection ? 'direct' : 'inherit',
        },
      },
      duoChat: {
        enabled: duoChatConfiguration.enabled,
+5 −0
Original line number Diff line number Diff line
@@ -34,11 +34,16 @@ export interface DuoSandboxConfiguration {
  enabled: boolean;
}

export interface DuoProxyConfiguration {
  directConnection: boolean;
}

export interface DuoConfiguration {
  enabledWithoutGitLabProject: boolean;
  workflow: DuoWorkflowConfiguration;
  agentPlatform: DuoAgentPlatformConfiguration;
  sandbox: DuoSandboxConfiguration;
  proxy: DuoProxyConfiguration;
}

export interface DuoChatConfiguration {
Loading