Skip to content

Commit 3741316

Browse files
authored
Merge pull request #180 from aakashmandavilli96/srmanda1.8
Update code oss version to 1.101.2
2 parents cdcfb62 + 6fd2b97 commit 3741316

File tree

9 files changed

+293
-338
lines changed

9 files changed

+293
-338
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ jobs:
8484
- name: Apply patches (if any)
8585
run: |
8686
if [ -d patches ] && [ "$(ls -A patches)" ]; then
87-
quilt push -a || true
87+
set -e
88+
quilt push -a
8889
fi
8990
9091
# Step 5: Generate a version string for this specific build.

patched-vscode/src/vs/server/node/webClientServer.ts

Lines changed: 195 additions & 216 deletions
Large diffs are not rendered by default.

patches/custom-extensions-marketplace.diff

Lines changed: 34 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -34,34 +34,24 @@ Index: sagemaker-code-editor/vscode/src/vs/workbench/contrib/extensions/browser/
3434
===================================================================
3535
--- sagemaker-code-editor.orig/vscode/src/vs/workbench/contrib/extensions/browser/extensionsViewlet.ts
3636
+++ sagemaker-code-editor/vscode/src/vs/workbench/contrib/extensions/browser/extensionsViewlet.ts
37-
@@ -64,6 +64,8 @@ import { ILocalizedString } from 'vs/pla
38-
import { registerNavigableContainer } from 'vs/workbench/browser/actions/widgetNavigationCommands';
39-
import { MenuWorkbenchToolBar } from 'vs/platform/actions/browser/toolbar';
40-
import { createActionViewItem } from 'vs/platform/actions/browser/menuEntryActionViewItem';
41-
+import { IProductService } from 'vs/platform/product/common/productService';
42-
+import { memoize } from 'vs/base/common/decorators';
43-
44-
export const DefaultViewsContext = new RawContextKey<boolean>('defaultExtensionViews', true);
45-
export const ExtensionsSortByContext = new RawContextKey<string>('extensionsSortByValue', '');
46-
@@ -87,7 +89,6 @@ const SortByUpdateDateContext = new RawC
47-
const REMOTE_CATEGORY: ILocalizedString = localize2({ key: 'remote', comment: ['Remote as in remote machine'] }, "Remote");
48-
49-
export class ExtensionsViewletViewsContribution extends Disposable implements IWorkbenchContribution {
50-
-
51-
private readonly container: ViewContainer;
52-
53-
constructor(
54-
@@ -516,7 +517,8 @@ export class ExtensionsViewPaneContainer
55-
@IExtensionService extensionService: IExtensionService,
56-
@IViewDescriptorService viewDescriptorService: IViewDescriptorService,
57-
@IPreferencesService private readonly preferencesService: IPreferencesService,
58-
- @ICommandService private readonly commandService: ICommandService
59-
+ @ICommandService private readonly commandService: ICommandService,
37+
@@ -64,6 +64,8 @@ import { createActionViewItem } from '..
38+
import { SeverityIcon } from '../../../../base/browser/ui/severityIcon/severityIcon.js';
39+
import { StandardKeyboardEvent } from '../../../../base/browser/keyboardEvent.js';
40+
import { KeyCode } from '../../../../base/common/keyCodes.js';
41+
+import { IProductService } from '../../../../platform/product/common/productService.js';
42+
+import { memoize } from '../../../../base/common/decorators.js';
43+
import { ThemeIcon } from '../../../../base/common/themables.js';
44+
import { Codicon } from '../../../../base/common/codicons.js';
45+
import { IExtensionGalleryManifest, IExtensionGalleryManifestService } from '../../../../platform/extensionManagement/common/extensionGalleryManifest.js';
46+
@@ -531,6 +533,7 @@ export class ExtensionsViewPaneContainer
47+
@ICommandService private readonly commandService: ICommandService,
48+
@IMcpGalleryService private readonly mcpGalleryService: IMcpGalleryService,
49+
@ILogService logService: ILogService,
6050
+ @IProductService private readonly productService: IProductService,
6151
) {
62-
super(VIEWLET_ID, { mergeViewWithContainerWhenSingleView: true }, instantiationService, configurationService, layoutService, contextMenuService, telemetryService, extensionService, themeService, storageService, contextService, viewDescriptorService);
52+
super(VIEWLET_ID, { mergeViewWithContainerWhenSingleView: true }, instantiationService, configurationService, layoutService, contextMenuService, telemetryService, extensionService, themeService, storageService, contextService, viewDescriptorService, logService);
6353

64-
@@ -544,6 +546,15 @@ export class ExtensionsViewPaneContainer
54+
@@ -560,6 +563,15 @@ export class ExtensionsViewPaneContainer
6555
this.searchViewletState = this.getMemento(StorageScope.WORKSPACE, StorageTarget.MACHINE);
6656
}
6757

@@ -77,43 +67,33 @@ Index: sagemaker-code-editor/vscode/src/vs/workbench/contrib/extensions/browser/
7767
get searchValue(): string | undefined {
7868
return this.searchBox?.getValue();
7969
}
80-
@@ -558,8 +569,7 @@ export class ExtensionsViewPaneContainer
81-
hide(overlay);
70+
@@ -586,7 +598,7 @@ export class ExtensionsViewPaneContainer
8271

83-
const header = append(this.root, $('.header'));
72+
this.header = append(this.root, $('.header'));
8473
- const placeholder = localize('searchExtensions', "Search Extensions in Marketplace");
85-
-
8674
+ const placeholder = localize('searchExtensions', 'Search extensions in {0}', this.extensionsGalleryHostname);
75+
8776
const searchValue = this.searchViewletState['query.value'] ? this.searchViewletState['query.value'] : '';
8877

89-
const searchContainer = append(header, $('.extensions-search-container'));
90-
@@ -924,4 +934,4 @@ export class MaliciousExtensionChecker i
91-
}).then(() => undefined);
92-
}, err => this.logService.error(err));
93-
}
94-
-}
95-
+}
96-
\ No newline at end of file
9778
Index: sagemaker-code-editor/vscode/src/vs/server/node/webClientServer.ts
9879
===================================================================
9980
--- sagemaker-code-editor.orig/vscode/src/vs/server/node/webClientServer.ts
10081
+++ sagemaker-code-editor/vscode/src/vs/server/node/webClientServer.ts
101-
@@ -331,14 +331,7 @@ export class WebClientServer {
102-
const productConfiguration = {
103-
rootEndpoint: base,
82+
@@ -339,11 +339,7 @@ export class WebClientServer {
83+
const productConfiguration: Partial<Mutable<IProductConfiguration>> = {
10484
embedderIdentifier: 'server-distro',
10585
- extensionsGallery: this._webExtensionResourceUrlTemplate && this._productService.extensionsGallery ? {
10686
- ...this._productService.extensionsGallery,
10787
- resourceUrlTemplate: this._webExtensionResourceUrlTemplate.with({
10888
- scheme: 'http',
10989
- authority: remoteAuthority,
110-
- path: `${this._webExtensionRoute}/${this._webExtensionResourceUrlTemplate.authority}${this._webExtensionResourceUrlTemplate.path}`
90+
- path: `${webExtensionRoute}/${this._webExtensionResourceUrlTemplate.authority}${this._webExtensionResourceUrlTemplate.path}`
11191
- }).toString(true)
11292
- } : undefined
11393
+ extensionsGallery: this._productService.extensionsGallery,
114-
} satisfies Partial<IProductConfiguration>;
94+
};
11595

116-
if (!this._environmentService.isBuilt) {
96+
const proposedApi = this._environmentService.args['enable-proposed-api'];
11797
Index: sagemaker-code-editor/vscode/product.json
11898
===================================================================
11999
--- sagemaker-code-editor.orig/vscode/product.json
@@ -146,7 +126,16 @@ Index: sagemaker-code-editor/vscode/src/vs/platform/extensionResourceLoader/comm
146126
import { TargetPlatform } from 'vs/platform/extensions/common/extensions';
147127

148128
const WEB_EXTENSION_RESOURCE_END_POINT_SEGMENT = '/web-extension-resource/';
149-
@@ -141,9 +140,9 @@ export abstract class AbstractExtensionR
129+
@@ -123,7 +122,7 @@ export abstract class AbstractExtensionR
130+
: version,
131+
path: 'extension'
132+
}));
133+
- return this._isWebExtensionResourceEndPoint(uri) ? uri.with({ scheme: RemoteAuthorities.getPreferredWebSchema() }) : uri;
134+
+ return this._isWebExtensionResourceEndPoint(uri) ? uri.with({ scheme: 'https' }) : uri;
135+
}
136+
return undefined;
137+
}
138+
@@ -163,9 +162,9 @@ export abstract class AbstractExtensionR
150139
}
151140

152141
protected _isWebExtensionResourceEndPoint(uri: URI): boolean {
@@ -158,4 +147,4 @@ Index: sagemaker-code-editor/vscode/src/vs/platform/extensionResourceLoader/comm
158147
+ return uriPath.startsWith(WEB_EXTENSION_RESOURCE_END_POINT_SEGMENT);
159148
}
160149

161-
}
150+
}

patches/sagemaker-idle-extension.patch

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ Index: sagemaker-code-editor/vscode/extensions/sagemaker-idle-extension/src/exte
140140
@@ -0,0 +1,112 @@
141141
+import * as vscode from "vscode";
142142
+import * as fs from "fs";
143-
+import * as path from "path";
143+
+import { join } from "path";
144144
+
145145
+let idleFilePath: string
146146
+let terminalActivityInterval: NodeJS.Timeout | undefined
@@ -165,7 +165,7 @@ Index: sagemaker-code-editor/vscode/extensions/sagemaker-idle-extension/src/exte
165165
+ */
166166
+function initializeIdleFilePath() {
167167
+ const tmpDirectory = "/tmp/";
168-
+ idleFilePath = path.join(tmpDirectory, ".sagemaker-last-active-timestamp");
168+
+ idleFilePath = join(tmpDirectory, ".sagemaker-last-active-timestamp");
169169
+
170170
+ // Set initial lastActivetimestamp
171171
+ updateLastActivityTimestamp()
@@ -225,7 +225,7 @@ Index: sagemaker-code-editor/vscode/extensions/sagemaker-idle-extension/src/exte
225225
+
226226
+ const now = Date.now();
227227
+ const activityDetected = files.some((file) => {
228-
+ const filePath = path.join("/dev/pts", file);
228+
+ const filePath = join("/dev/pts", file);
229229
+ try {
230230
+ const stats = fs.statSync(filePath);
231231
+ const mtime = new Date(stats.mtime).getTime();
@@ -285,18 +285,18 @@ Index: sagemaker-code-editor/vscode/src/vs/server/node/webClientServer.ts
285285

286286
-import { createReadStream, promises } from 'fs';
287287
+import { createReadStream, promises, existsSync, writeFileSync } from 'fs';
288-
import * as path from 'path';
289288
import * as http from 'http';
290289
import * as url from 'url';
291-
@@ -96,6 +96,7 @@ const APP_ROOT = dirname(FileAccess.asFi
290+
import * as cookie from 'cookie';
291+
@@ -95,6 +95,7 @@ const APP_ROOT = dirname(FileAccess.asFi
292292
const STATIC_PATH = `/static`;
293293
const CALLBACK_PATH = `/callback`;
294294
const WEB_EXTENSION_PATH = `/web-extension-resource`;
295295
+const IDLE_EXTENSION_PATH = `/api/idle`;
296296

297297
export class WebClientServer {
298298

299-
@@ -133,6 +134,9 @@ export class WebClientServer {
299+
@@ -131,6 +132,9 @@ export class WebClientServer {
300300
// callback support
301301
return this._handleCallback(res);
302302
}
@@ -306,7 +306,7 @@ Index: sagemaker-code-editor/vscode/src/vs/server/node/webClientServer.ts
306306
if (pathname.startsWith(WEB_EXTENSION_PATH) && pathname.charCodeAt(WEB_EXTENSION_PATH.length) === CharCode.Slash) {
307307
// extension resource support
308308
return this._handleWebExtensionResource(req, res, pathname.substring(WEB_EXTENSION_PATH.length));
309-
@@ -498,4 +502,29 @@ export class WebClientServer {
309+
@@ -496,4 +500,29 @@ export class WebClientServer {
310310
});
311311
return void res.end(data);
312312
}
@@ -317,7 +317,7 @@ Index: sagemaker-code-editor/vscode/src/vs/server/node/webClientServer.ts
317317
+ private async _handleIdle(req: http.IncomingMessage, res: http.ServerResponse): Promise<void> {
318318
+ try {
319319
+ const tmpDirectory = '/tmp/'
320-
+ const idleFilePath = path.join(tmpDirectory, '.sagemaker-last-active-timestamp');
320+
+ const idleFilePath = join(tmpDirectory, '.sagemaker-last-active-timestamp');
321321
+
322322
+ // If idle shutdown file does not exist, this indicates the app UI may never been opened
323323
+ // Create the initial metadata file

patches/sagemaker-ui-dark-theme.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ Index: sagemaker-code-editor/vscode/build/npm/dirs.js
154154
===================================================================
155155
--- sagemaker-code-editor.orig/vscode/build/npm/dirs.js
156156
+++ sagemaker-code-editor/vscode/build/npm/dirs.js
157-
@@ -43,6 +43,7 @@ const dirs = [
157+
@@ -42,6 +42,7 @@ const dirs = [
158158
'extensions/sagemaker-idle-extension',
159159
'extensions/sagemaker-terminal-crash-mitigation',
160160
'extensions/sagemaker-open-notebook-extension',

patches/sagemaker-ui-post-startup.patch

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@ Index: sagemaker-code-editor/vscode/src/vs/server/node/webClientServer.ts
22
===================================================================
33
--- sagemaker-code-editor.orig/vscode/src/vs/server/node/webClientServer.ts
44
+++ sagemaker-code-editor/vscode/src/vs/server/node/webClientServer.ts
5-
@@ -4,6 +4,8 @@
6-
*--------------------------------------------------------------------------------------------*/
5+
@@ -6,6 +6,8 @@
76

87
import { createReadStream, promises, existsSync, writeFileSync } from 'fs';
8+
import * as http from 'http';
99
+import { spawn } from 'child_process';
1010
+import * as fs from 'fs';
11-
import * as path from 'path';
12-
import * as http from 'http';
1311
import * as url from 'url';
14-
@@ -38,6 +40,10 @@ const textMimeType: { [ext: string]: str
12+
import * as cookie from 'cookie';
13+
import * as crypto from 'crypto';
14+
@@ -30,6 +32,10 @@ const textMimeType: { [ext: string]: st
1515
'.svg': 'image/svg+xml',
1616
};
1717

@@ -22,61 +22,61 @@ Index: sagemaker-code-editor/vscode/src/vs/server/node/webClientServer.ts
2222
/**
2323
* Return an error to the client.
2424
*/
25-
@@ -97,6 +103,7 @@ const STATIC_PATH = `/static`;
25+
@@ -93,6 +99,7 @@ const STATIC_PATH = `/static`;
2626
const CALLBACK_PATH = `/callback`;
2727
const WEB_EXTENSION_PATH = `/web-extension-resource`;
2828
const IDLE_EXTENSION_PATH = `/api/idle`;
2929
+const POST_STARTUP_SCRIPT_PATH = `/api/poststartup`;
3030

3131
export class WebClientServer {
3232

33-
@@ -141,6 +148,9 @@ export class WebClientServer {
34-
// extension resource support
35-
return this._handleWebExtensionResource(req, res, pathname.substring(WEB_EXTENSION_PATH.length));
33+
@@ -134,6 +141,9 @@ export class WebClientServer {
34+
if (pathname === IDLE_EXTENSION_PATH) {
35+
return this._handleIdle(req, res);
3636
}
3737
+ if (pathname === POST_STARTUP_SCRIPT_PATH) {
3838
+ return this._handlePostStartupScriptInvocation(req, res);
3939
+ }
40-
41-
return serveError(req, res, 404, 'Not found.');
42-
} catch (error) {
43-
@@ -527,4 +537,39 @@ export class WebClientServer {
44-
serveError(req, res, 500, error.message)
45-
}
46-
}
40+
if (pathname.startsWith(WEB_EXTENSION_PATH) && pathname.charCodeAt(WEB_EXTENSION_PATH.length) === CharCode.Slash) {
41+
// extension resource support
42+
return this._handleWebExtensionResource(req, res, pathname.substring(WEB_EXTENSION_PATH.length));
43+
@@ -507,4 +517,39 @@ export class WebClientServer {
44+
serveError(req, res, 500, error.message)
45+
}
46+
}
4747
+
48-
+ /**
49-
+ * Handles API requests to run the post-startup script in SMD.
50-
+ */
51-
+ private async _handlePostStartupScriptInvocation(req: http.IncomingMessage, res: http.ServerResponse): Promise<void> {
52-
+ const postStartupScriptPath = '/etc/sagemaker-ui/sagemaker_ui_post_startup.sh'
53-
+ const logPath = '/var/log/apps/post_startup_default.log';
54-
+ const logStream = fs.createWriteStream(logPath, { flags: 'a' });
48+
+ /**
49+
+ * Handles API requests to run the post-startup script in SMD.
50+
+ */
51+
+ private async _handlePostStartupScriptInvocation(req: http.IncomingMessage, res: http.ServerResponse): Promise<void> {
52+
+ const postStartupScriptPath = '/etc/sagemaker-ui/sagemaker_ui_post_startup.sh'
53+
+ const logPath = '/var/log/apps/post_startup_default.log';
54+
+ const logStream = fs.createWriteStream(logPath, { flags: 'a' });
5555
+
56-
+ // Only trigger post-startup script invocation for SageMakerUnifiedStudio app.
57-
+ if (process.env['SERVICE_NAME'] != ServiceName.SAGEMAKER_UNIFIED_STUDIO) {
58-
+ return serveError(req, res, 403, 'Forbidden');
59-
+ } else {
60-
+ //If postStartupScriptFile doesn't exist, it will throw FileNotFoundError (404)
61-
+ //If exists, it will start the execution and add the execution logs in logFile.
62-
+ try {
63-
+ if (fs.existsSync(postStartupScriptPath)) {
64-
+ // Adding 0o755 to make script file executable
65-
+ fs.chmodSync(postStartupScriptPath, 0o755);
56+
+ // Only trigger post-startup script invocation for SageMakerUnifiedStudio app.
57+
+ if (process.env['SERVICE_NAME'] != ServiceName.SAGEMAKER_UNIFIED_STUDIO) {
58+
+ return serveError(req, res, 403, 'Forbidden');
59+
+ } else {
60+
+ //If postStartupScriptFile doesn't exist, it will throw FileNotFoundError (404)
61+
+ //If exists, it will start the execution and add the execution logs in logFile.
62+
+ try {
63+
+ if (fs.existsSync(postStartupScriptPath)) {
64+
+ // Adding 0o755 to make script file executable
65+
+ fs.chmodSync(postStartupScriptPath, 0o755);
6666
+
67-
+ const subprocess = spawn('bash', [`${postStartupScriptPath}`], { cwd: '/' });
68-
+ subprocess.stdout.pipe(logStream);
69-
+ subprocess.stderr.pipe(logStream);
67+
+ const subprocess = spawn('bash', [`${postStartupScriptPath}`], { cwd: '/' });
68+
+ subprocess.stdout.pipe(logStream);
69+
+ subprocess.stderr.pipe(logStream);
7070
+
71-
+ res.statusCode = 200;
72-
+ res.setHeader('Content-Type', 'application/json');
73-
+ res.end(JSON.stringify({ 'success': 'true' }));
74-
+ } else {
75-
+ serveError(req, res, 500, 'Poststartup script file not found at ' + postStartupScriptPath);
76-
+ }
77-
+ } catch (error) {
78-
+ serveError(req, res, 500, error.message);
79-
+ }
80-
+ }
81-
+ }
82-
}
71+
+ res.statusCode = 200;
72+
+ res.setHeader('Content-Type', 'application/json');
73+
+ res.end(JSON.stringify({ 'success': 'true' }));
74+
+ } else {
75+
+ serveError(req, res, 500, 'Poststartup script file not found at ' + postStartupScriptPath);
76+
+ }
77+
+ } catch (error) {
78+
+ serveError(req, res, 500, error.message);
79+
+ }
80+
+ }
81+
+ }
82+
}

patches/series

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,5 @@ sagemaker-ui-post-startup.patch
1515
sagemaker-extension-smus-support.patch
1616
post-startup-notifications.patch
1717
sagemaker-extensions-sync.patch
18+
# custom-extensions-marketplace.diff
19+
# display-language.patch

patches/webview.diff

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ Index: sagemaker-code-editor/vscode/src/vs/workbench/contrib/webview/browser/pre
7373
<meta charset="UTF-8">
7474

7575
<meta http-equiv="Content-Security-Policy"
76-
- content="default-src 'none'; script-src 'sha256-nlLyDpnjtftJG2xvXh2vuy77l7xFTjfOz7Jnj1iXNmA=' 'self'; frame-src 'self'; style-src 'unsafe-inline';">
76+
- content="default-src 'none'; script-src 'sha256-gEAyFzmkyqMoTTnN+3KReFUYoHsK4RAJEb+6eiul+UY=' 'self'; frame-src 'self'; style-src 'unsafe-inline';">
7777
+ content="default-src 'none'; script-src 'sha256-ap/AtocvSWp0rrxaO19DJy/nOpazT6M5Cv9utUWe7MA=' 'self'; frame-src 'self'; style-src 'unsafe-inline';">
7878

7979
<!-- Disable pinch zooming -->
@@ -91,23 +91,7 @@ Index: sagemaker-code-editor/vscode/src/vs/workbench/contrib/webview/browser/pre
9191
if (!crypto.subtle) {
9292
// cannot validate, not running in a secure context
9393
throw new Error(`'crypto.subtle' is not available so webviews will not work. This is likely because the editor is not running in a secure context (https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts).`);
94-
Index: sagemaker-code-editor/vscode/src/vs/workbench/contrib/webview/browser/pre/index-no-csp.html
95-
===================================================================
96-
--- sagemaker-code-editor.orig/vscode/src/vs/workbench/contrib/webview/browser/pre/index-no-csp.html
97-
+++ sagemaker-code-editor/vscode/src/vs/workbench/contrib/webview/browser/pre/index-no-csp.html
98-
@@ -334,6 +334,12 @@
99-
100-
const hostname = location.hostname;
101-
102-
+ // It is safe to run if we are on the same host.
103-
+ const parent = new URL(parentOrigin)
104-
+ if (parent.hostname === hostname) {
105-
+ return start(parentOrigin)
106-
+ }
107-
+
108-
if (!crypto.subtle) {
109-
// cannot validate, not running in a secure context
110-
throw new Error(`'crypto.subtle' is not available so webviews will not work. This is likely because the editor is not running in a secure context (https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts).`);
94+
11195
Index: sagemaker-code-editor/vscode/src/vs/workbench/services/extensions/worker/webWorkerExtensionHostIframe.html
11296
===================================================================
11397
--- sagemaker-code-editor.orig/vscode/src/vs/workbench/services/extensions/worker/webWorkerExtensionHostIframe.html

vscode

Submodule vscode updated 1424 files

0 commit comments

Comments
 (0)