Repository navigation
copilot: add a VS Code extension that serves Databricks models to Copilot Chat #1314
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
80748ac
Add a VS Code extension that serves Databricks models to Copilot Chat
xi-db 9d8737d
Run the VS Code extension's tests with Node's test runner
xi-db 2a6e1af
Import only the version from the extension's package.json
xi-db 7926b04
Send only the text blocks of a thinking model's stream
xi-db 4eeb2fa
Show the Databricks logo for the extension's models
xi-db 238af81
Take each model's token limits from its settings
xi-db File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| src/ucode/vscode/extension/out/extension.js linguist-generated=true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,105 @@ | ||
| { | ||
| "name": "unity-gateway", | ||
| "displayName": "Databricks Unity Gateway", | ||
| "description": "Chat with Databricks AI Gateway models in VS Code through Unity Gateway (ug)", | ||
| "version": "0.1.0", | ||
| "publisher": "databricks", | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "https://github.com/databricks/unity-gateway.git", | ||
| "directory": "vscode-extension" | ||
| }, | ||
| "engines": { | ||
| "vscode": "^1.128.0" | ||
| }, | ||
| "categories": [ | ||
| "AI", | ||
| "Chat" | ||
| ], | ||
| "extensionKind": [ | ||
| "ui" | ||
| ], | ||
| "main": "./out/extension.js", | ||
| "activationEvents": [], | ||
| "contributes": { | ||
| "languageModelChatProviders": [ | ||
| { | ||
| "vendor": "databricks-unity-gateway", | ||
| "displayName": "Databricks", | ||
| "icon": "media/databricks.svg" | ||
| } | ||
| ], | ||
| "configuration": { | ||
| "title": "Databricks Unity Gateway", | ||
| "properties": { | ||
| "unityGateway.workspace": { | ||
| "type": "string", | ||
| "default": "", | ||
| "description": "Databricks workspace URL, for example https://my-workspace.cloud.databricks.com. Set by `ug configure`.", | ||
| "scope": "application" | ||
| }, | ||
| "unityGateway.models": { | ||
| "type": "array", | ||
| "default": [], | ||
| "description": "Models to offer in the chat model picker. Set by `ug configure`.", | ||
| "items": { | ||
| "type": "object", | ||
| "required": [ | ||
| "id", | ||
| "api" | ||
| ], | ||
| "properties": { | ||
| "id": { | ||
| "type": "string", | ||
| "description": "Model service name, for example system.ai.claude-sonnet-5-5." | ||
|
masonc08 marked this conversation as resolved.
|
||
| }, | ||
| "api": { | ||
| "type": "string", | ||
| "enum": [ | ||
| "chat_completions", | ||
| "responses" | ||
| ], | ||
| "description": "The AI Gateway API the model is called through." | ||
| }, | ||
| "maxInputTokens": { | ||
| "type": "integer", | ||
| "minimum": 1, | ||
| "description": "Prompt tokens the model accepts. Defaults to 128000." | ||
| }, | ||
| "maxOutputTokens": { | ||
| "type": "integer", | ||
| "minimum": 1, | ||
| "description": "Tokens the model can write in one reply. Defaults to 32000." | ||
| } | ||
| } | ||
| }, | ||
| "scope": "application" | ||
| }, | ||
| "unityGateway.authCommand": { | ||
| "type": "string", | ||
| "default": "", | ||
| "description": "Command that prints a Databricks access token. Set by `ug configure`.", | ||
| "scope": "application" | ||
| } | ||
| } | ||
| }, | ||
| "commands": [ | ||
| { | ||
| "command": "unityGateway.refreshModels", | ||
| "title": "Refresh Models", | ||
| "category": "Unity Gateway" | ||
| } | ||
| ] | ||
| }, | ||
| "scripts": { | ||
| "build": "esbuild src/extension.ts --bundle --minify --legal-comments=none --outfile=../src/ucode/vscode/extension/out/extension.js --external:vscode --format=cjs --platform=node --target=node22 && node -e \"const fs = require('fs'); fs.copyFileSync('package.json', '../src/ucode/vscode/extension/package.json'); fs.cpSync('media', '../src/ucode/vscode/extension/media', { recursive: true })\"", | ||
| "typecheck": "tsc", | ||
| "test": "esbuild test/*.test.ts --bundle --platform=node --format=cjs --target=node22 --outdir=.test-out --alias:vscode=./test/vscode.ts --log-level=warning && node --test .test-out/*.test.js" | ||
| }, | ||
| "devDependencies": { | ||
| "@types/node": "^22.20.3", | ||
| "@types/vscode": "1.125.0", | ||
| "esbuild": "^0.28.2", | ||
| "typescript": "^5.9.3" | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| node_modules/ | ||
| *.vsix | ||
| .test-out/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| # The lockfile records the public registry; this lets `npm ci` fetch the same tarballs from | ||
| # whichever registry is configured locally. | ||
| replace-registry-host=always |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| # Unity Gateway for VS Code | ||
|
|
||
| Adds Databricks AI Gateway models to the VS Code chat model picker, for Copilot Chat in Ask and Agent | ||
| mode. The extension calls the workspace's AI Gateway directly: Chat Completions for Claude and open | ||
| models, Responses for GPT-5 and later. | ||
|
|
||
| `ug configure` installs it and writes its settings: | ||
|
|
||
| | Setting | Value | | ||
| |---|---| | ||
| | `unityGateway.workspace` | The workspace URL | | ||
| | `unityGateway.models` | `[{"id": "<model service>", "api": "chat_completions" \| "responses"}]` | | ||
| | `unityGateway.authCommand` | A command that prints a Databricks access token (`ug auth-token --host ...`) | | ||
|
|
||
| The token is kept in memory until it nears expiry, and fetched again when the gateway answers 401. | ||
| Run **Unity Gateway: Refresh Models** after changing the settings by hand. Token fetches and failed | ||
| requests are logged to the **Unity Gateway** output channel. | ||
|
|
||
| ## Development | ||
|
|
||
| `npm ci`, then `npm run typecheck`, `npm test` and `npm run build`. The build writes the bundle and | ||
| `package.json` to `../src/ucode/vscode/extension/`, which ug packs from; commit them (`just vscode-build`). |
|
masonc08 marked this conversation as resolved.
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.