Skip to content

Modifying existing patches and adding sagemaker integration patch #19

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 2 commits into from
Jul 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions patches/sagemaker.series
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ web-server/embedding-events.diff
web-server/proxy-uri.diff
web-server/display-language.diff
web-server/signature-verification.diff
sagemaker/update-csp.diff
sagemaker/sagemaker-extension.diff
sagemaker/terminal-crash-mitigation.diff
sagemaker/sagemaker-open-notebook-extension.diff
Expand All @@ -29,4 +30,5 @@ sagemaker/sagemaker-extension-smus-support.diff
sagemaker/post-startup-notifications.diff
sagemaker/sagemaker-extensions-sync.diff
sagemaker/sagemaker-ui-post-startup.diff
sagemaker/sagemaker-integration.diff
sagemaker/sagemaker-idle-extension.diff
126 changes: 126 additions & 0 deletions patches/sagemaker/sagemaker-integration.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
Index: third-party-src/src/vs/workbench/browser/client.ts
===================================================================
--- /dev/null
+++ third-party-src/src/vs/workbench/browser/client.ts
@@ -0,0 +1,61 @@
+import { Disposable } from '../../base/common/lifecycle.js';
+import { CommandsRegistry } from '../../platform/commands/common/commands.js';
+import { MenuId, MenuRegistry } from '../../platform/actions/common/actions.js';
+import { localize } from '../../nls.js';
+import { ILogService } from '../../platform/log/common/log.js';
+
+export class SagemakerServerClient extends Disposable {
+ constructor (
+ @ILogService private logService: ILogService
+ ) {
+ super();
+
+ this.logService.debug('Initializing SagemakerServerClient...');
+ this.registerSagemakerCommands();
+ }
+
+ static LOGOUT_COMMAND_ID = 'sagemaker.logout';
+ static COOKIE_COMMAND_ID = 'sagemaker.parseCookies';
+
+ private registerSagemakerCommands() {
+ const authMode: string | undefined = this.getCookieValue('authMode');
+ const expiryTime: string | undefined = this.getCookieValue('expiryTime');
+ const studioUserProfileName: string | undefined = this.getCookieValue('studioUserProfileName')
+ const ssoExpiryTimestamp: string | undefined = this.getCookieValue('ssoExpiryTimestamp')
+ const redirectURL: string | undefined = this.getCookieValue('redirectURL')
+
+ this.logService.debug('Registering sagemaker commands...');
+
+ CommandsRegistry.registerCommand(SagemakerServerClient.COOKIE_COMMAND_ID, () => {
+ return {
+ authMode: authMode,
+ expiryTime: expiryTime,
+ ssoExpiryTimestamp: ssoExpiryTimestamp,
+ studioUserProfileName: studioUserProfileName,
+ redirectURL: redirectURL
+ };
+ });
+
+ CommandsRegistry.registerCommand(SagemakerServerClient.LOGOUT_COMMAND_ID, () => {
+ const currentUrl = new URL(window.location.href);
+ const hostname = currentUrl.hostname;
+ const pathComponents = currentUrl.pathname.split('/');
+ const logoutUrl = `https://${hostname}/${pathComponents[1]}/${pathComponents[2]}/logout`;
+ window.location.href = logoutUrl;
+ });
+
+ for (const menuId of [MenuId.CommandPalette, MenuId.MenubarHomeMenu]) {
+ MenuRegistry.appendMenuItem(menuId, {
+ command: {
+ id: SagemakerServerClient.LOGOUT_COMMAND_ID,
+ title: localize('logout', "{0}: Log out", 'Sagemaker'),
+ },
+ });
+ }
+ }
+
+ private getCookieValue(name: string): string | undefined {
+ const match = document.cookie.match('(^|[^;]+)\\s*' + name + '\\s*=\\s*([^;]+)'); // See https://stackoverflow.com/a/25490531
+ return match ? match.pop() : undefined;
+ }
+}
\ No newline at end of file
Index: third-party-src/src/vs/workbench/browser/web.main.ts
===================================================================
--- third-party-src.orig/src/vs/workbench/browser/web.main.ts
+++ third-party-src/src/vs/workbench/browser/web.main.ts
@@ -95,6 +95,7 @@ import { TunnelSource } from 'vs/workbench/services/re
import { TunnelSource } from '../services/remote/common/tunnelModel.js';
import { mainWindow } from '../../base/browser/window.js';
import { INotificationService, Severity } from '../../platform/notification/common/notification.js';
+import { SagemakerServerClient } from '../../workbench/browser/client.js';

export class BrowserMain extends Disposable {

@@ -129,6 +130,9 @@ export class BrowserMain extends Disposable {

// Startup
const instantiationService = workbench.startup();
+
+ // Create instance of SagemakerServerClient
+ this._register(instantiationService.createInstance(SagemakerServerClient));

// Window
this._register(instantiationService.createInstance(BrowserWindow));
Index: third-party-src/product.json
===================================================================
--- third-party-src.orig/product.json
+++ third-party-src/product.json
@@ -16,6 +16,6 @@
],
- "nameShort": "Code Editor",
- "nameLong": "Code Editor",
+ "nameShort": "SageMaker Code Editor",
+ "nameLong": "SageMaker Code Editor",
"applicationName": "code",
"dataFolderName": ".vscode-editor",
"win32MutexName": "vscodeoss",
Index: third-party-src/src/vs/platform/product/common/product.ts
===================================================================
--- third-party-src.orig/src/vs/platform/product/common/product.ts
+++ third-party-src/src/vs/platform/product/common/product.ts
@@ -69,15 +69,17 @@ else {
if (Object.keys(product).length === 0) {
Object.assign(product, {
version: '1.95.0-dev',
- nameShort: 'Code Editor',
- nameLong: 'Code Editor',
+ nameShort: 'SageMaker Code Editor',
+ nameLong: 'SageMaker Code Editor',
applicationName: 'code-oss',
dataFolderName: '.vscode-oss',
+ commit: "hellocommit",
+ date: "hellodate",
urlProtocol: 'code-oss',
reportIssueUrl: 'https://github.com/microsoft/vscode/issues/new',
licenseName: 'MIT',
licenseUrl: 'https://github.com/microsoft/vscode/blob/main/LICENSE.txt',
serverLicenseUrl: 'https://github.com/microsoft/vscode/blob/main/LICENSE.txt'
});
}
}
13 changes: 13 additions & 0 deletions patches/sagemaker/update-csp.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Index: sagemaker-code-editor/vscode/src/vs/server/node/webClientServer.ts
===================================================================
--- third-party-src.orig/src/vs/server/node/webClientServer.ts
+++ third-party-src/src/vs/server/node/webClientServer.ts
@@ -375,7 +375,7 @@ export class WebClientServer {
`frame-src 'self' https://*.vscode-cdn.net data:;`,
'worker-src \'self\' data: blob:;',
'style-src \'self\' \'unsafe-inline\';',
- 'connect-src \'self\' ws: wss: https:;',
+ 'connect-src \'self\' ws: wss: https://main.vscode-cdn.net http://localhost:* https://localhost:* https://login.microsoftonline.com/ https://update.code.visualstudio.com https://*.vscode-unpkg.net/ https://default.exp-tas.com/vscode/ab https://vscode-sync.trafficmanager.net https://vscode-sync-insiders.trafficmanager.net https://*.gallerycdn.vsassets.io https://marketplace.visualstudio.com https://openvsxorg.blob.core.windows.net https://az764295.vo.msecnd.net https://code.visualstudio.com https://*.gallery.vsassets.io https://*.rel.tunnels.api.visualstudio.com wss://*.rel.tunnels.api.visualstudio.com https://*.servicebus.windows.net/ https://vscode.blob.core.windows.net https://vscode.search.windows.net https://vsmarketplacebadges.dev https://vscode.download.prss.microsoft.com https://download.visualstudio.microsoft.com https://*.vscode-unpkg.net https://open-vsx.org;',
'font-src \'self\' blob:;',
'manifest-src \'self\';'
].join(' ');
Loading