Skip to content

1.3 #87

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

Open
wants to merge 10 commits into
base: 1.4.0
Choose a base branch
from
Open

1.3 #87

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
16 changes: 8 additions & 8 deletions patched-vscode/build/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -879,11 +879,11 @@ brace-expansion@^1.1.7:
concat-map "0.0.1"

braces@~3.0.2:
version "3.0.2"
resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107"
integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==
version "3.0.3"
resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.3.tgz#490332f40919452272d55a8480adc0c441358789"
integrity sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==
dependencies:
fill-range "^7.0.1"
fill-range "^7.1.1"

buffer-alloc-unsafe@^1.1.0:
version "1.1.0"
Expand Down Expand Up @@ -1422,10 +1422,10 @@ fd-slicer@~1.1.0:
dependencies:
pend "~1.2.0"

fill-range@^7.0.1:
version "7.0.1"
resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40"
integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==
fill-range@^7.1.1:
version "7.1.1"
resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.1.1.tgz#44265d3cac07e3ea7dc247516380643754a05292"
integrity sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==
dependencies:
to-regex-range "^5.0.1"

Expand Down
36 changes: 18 additions & 18 deletions patched-vscode/extensions/npm/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -38,22 +38,22 @@ brace-expansion@^2.0.1:
dependencies:
balanced-match "^1.0.0"

braces@^3.0.1:
version "3.0.2"
resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107"
integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==
braces@^3.0.3:
version "3.0.3"
resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.3.tgz#490332f40919452272d55a8480adc0c441358789"
integrity sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==
dependencies:
fill-range "^7.0.1"
fill-range "^7.1.1"

esprima@^4.0.0:
version "4.0.1"
resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71"
integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==

fill-range@^7.0.1:
version "7.0.1"
resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40"
integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==
fill-range@^7.1.1:
version "7.1.1"
resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.1.1.tgz#44265d3cac07e3ea7dc247516380643754a05292"
integrity sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==
dependencies:
to-regex-range "^5.0.1"

Expand Down Expand Up @@ -118,12 +118,12 @@ locate-path@^6.0.0:
p-locate "^5.0.0"

micromatch@^4.0.2:
version "4.0.2"
resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.2.tgz#4fcb0999bf9fbc2fcbdd212f6d629b9a56c39259"
integrity sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==
version "4.0.8"
resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.8.tgz#d66fa18f3a47076789320b9b1af32bd86d9fa202"
integrity sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==
dependencies:
braces "^3.0.1"
picomatch "^2.0.5"
braces "^3.0.3"
picomatch "^2.3.1"

minimatch@^5.1.6:
version "5.1.6"
Expand Down Expand Up @@ -151,10 +151,10 @@ path-exists@^4.0.0:
resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3"
integrity sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==

picomatch@^2.0.5:
version "2.2.2"
resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.2.2.tgz#21f333e9b6b8eaff02468f5146ea406d345f4dad"
integrity sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==
picomatch@^2.3.1:
version "2.3.1"
resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42"
integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==

pify@^4.0.1:
version "4.0.1"
Expand Down
10 changes: 8 additions & 2 deletions patched-vscode/extensions/sagemaker-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,14 @@
"contributes": {
"configuration": {
"type": "object",
"title": "Sagemaker Extension",
"properties": {}
"title": "SageMaker Extension",
"properties": {
"sagemaker-extension.notification.extensionAutoUpdateDisabled": {
"type": "boolean",
"default": true,
"markdownDescription": "Show notification if extension auto update is disabled"
}
}
},
"commands": [
]
Expand Down
35 changes: 35 additions & 0 deletions patched-vscode/extensions/sagemaker-extension/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import * as console from "console";


const PARSE_SAGEMAKER_COOKIE_COMMAND = 'sagemaker.parseCookies';
const ENABLE_AUTO_UPDATE_COMMAND = 'workbench.extensions.action.enableAutoUpdate';

function showWarningDialog() {
vscode.commands.executeCommand(PARSE_SAGEMAKER_COOKIE_COMMAND).then(response => {
Expand Down Expand Up @@ -121,6 +122,37 @@ function updateStatusItemWithMetadata(context: vscode.ExtensionContext) {
});
}

// Render warning message regarding auto upgrade disabled
function renderExtensionAutoUpgradeDisabledNotification() {
// Get current extension auto disabled config
const autoUpdateEnabled = vscode.workspace.getConfiguration('extensions').get('autoUpdate');

// Check if customer has choose to disable this notification
const extensionConfig = vscode.workspace.getConfiguration('sagemaker-extension');
const showNotificationEnabled = extensionConfig.get('notification.extensionAutoUpdateDisabled', true);

// Only show notification, if auto update is disabled, and customer hasn't opt-out the notification
if (showNotificationEnabled && autoUpdateEnabled == false) {
const enableAutoUpdate = 'Enable Auto Update Extensions';
const doNotShowAgain = 'Do not show again';
vscode.window.showInformationMessage(
'Extension auto-update is disabled. This can be changed in Code Editor settings.',
enableAutoUpdate,
doNotShowAgain,
).then(response => {
if (response === enableAutoUpdate) {
vscode.commands.executeCommand(ENABLE_AUTO_UPDATE_COMMAND)
} else if (response == doNotShowAgain) {
extensionConfig.update(
'notification.extensionAutoUpdateDisabled',
false,
vscode.ConfigurationTarget.Global
);
}
})
}
}

export function activate(context: vscode.ExtensionContext) {

// TODO: log activation of extension
Expand All @@ -134,4 +166,7 @@ export function activate(context: vscode.ExtensionContext) {
initialize(sagemakerCookie);
updateStatusItemWithMetadata(context);
});

// render warning message regarding auto upgrade disabled
renderExtensionAutoUpgradeDisabledNotification();
}
24 changes: 10 additions & 14 deletions patched-vscode/extensions/sagemaker-idle-extension/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,11 @@ export function deactivate() {

/**
* Initializes the file path where the idle timestamp will be stored.
* It sets the path to a hidden file in the user's home directory.
* It sets the path to a hidden file in the /tmp/ directory.
*/
function initializeIdleFilePath() {
const homeDirectory = process.env.HOME || process.env.USERPROFILE;
if (!homeDirectory) {
console.log(`${LOG_PREFIX} Unable to determine the home directory.`);
return;
}
idleFilePath = path.join(homeDirectory, ".sagemaker-last-active-timestamp");
const tmpDirectory = "/tmp/";
idleFilePath = path.join(tmpDirectory, ".sagemaker-last-active-timestamp");

// Set initial lastActivetimestamp
updateLastActivityTimestamp()
Expand Down Expand Up @@ -70,13 +66,13 @@ const startMonitoringTerminalActivity = () => {

/**
* Checks for terminal activity by reading the /dev/pts directory and comparing modification times of the files.
*
*
* The /dev/pts directory is used in Unix-like operating systems to represent pseudo-terminal (PTY) devices.
* Each active terminal session is assigned a PTY device. These devices are represented as files within the /dev/pts directory.
* When a terminal session has activity, such as when a user inputs commands or output is written to the terminal,
* the modification time (mtime) of the corresponding PTY device file is updated. By monitoring the modification
* Each active terminal session is assigned a PTY device. These devices are represented as files within the /dev/pts directory.
* When a terminal session has activity, such as when a user inputs commands or output is written to the terminal,
* the modification time (mtime) of the corresponding PTY device file is updated. By monitoring the modification
* times of the files in the /dev/pts directory, we can detect terminal activity.
*
*
* If activity is detected (i.e., if any PTY device file was modified within the CHECK_INTERVAL), this function
* updates the last activity timestamp.
*/
Expand All @@ -95,7 +91,7 @@ const checkTerminalActivity = () => {
const mtime = new Date(stats.mtime).getTime();
return now - mtime < CHECK_INTERVAL;
} catch (error) {
console.error(`${LOG_PREFIX}}Error reading file stats:`, error);
console.error(`${LOG_PREFIX} Error reading file stats:`, error);
return false;
}
});
Expand All @@ -106,7 +102,7 @@ const checkTerminalActivity = () => {
});
};

/**
/**
* Updates the last activity timestamp by recording the current timestamp in the idle file and
* refreshing the status bar. The timestamp should be in ISO 8601 format and set to the UTC timezone.
*/
Expand Down
26 changes: 13 additions & 13 deletions patched-vscode/extensions/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,12 @@
node-addon-api "^3.2.1"
node-gyp-build "^4.3.0"

braces@^3.0.2:
version "3.0.2"
resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107"
integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==
braces@^3.0.3:
version "3.0.3"
resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.3.tgz#490332f40919452272d55a8480adc0c441358789"
integrity sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==
dependencies:
fill-range "^7.0.1"
fill-range "^7.1.1"

[email protected]:
version "1.12.7"
Expand Down Expand Up @@ -180,10 +180,10 @@ [email protected]:
resolved "https://registry.yarnpkg.com/fast-plist/-/fast-plist-0.1.2.tgz#a45aff345196006d406ca6cdcd05f69051ef35b8"
integrity sha1-pFr/NFGWAG1AbKbNzQX2kFHvNbg=

fill-range@^7.0.1:
version "7.0.1"
resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40"
integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==
fill-range@^7.1.1:
version "7.1.1"
resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.1.1.tgz#44265d3cac07e3ea7dc247516380643754a05292"
integrity sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==
dependencies:
to-regex-range "^5.0.1"

Expand All @@ -205,11 +205,11 @@ is-number@^7.0.0:
integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==

micromatch@^4.0.5:
version "4.0.5"
resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.5.tgz#bc8999a7cbbf77cdc89f132f6e467051b49090c6"
integrity sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==
version "4.0.8"
resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.8.tgz#d66fa18f3a47076789320b9b1af32bd86d9fa202"
integrity sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==
dependencies:
braces "^3.0.2"
braces "^3.0.3"
picomatch "^2.3.1"

node-addon-api@^3.2.1:
Expand Down
26 changes: 13 additions & 13 deletions patched-vscode/remote/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -185,12 +185,12 @@ bl@^4.0.3:
inherits "^2.0.4"
readable-stream "^3.4.0"

braces@^3.0.2:
version "3.0.2"
resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107"
integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==
braces@^3.0.3:
version "3.0.3"
resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.3.tgz#490332f40919452272d55a8480adc0c441358789"
integrity sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==
dependencies:
fill-range "^7.0.1"
fill-range "^7.1.1"

buffer-crc32@~0.2.3:
version "0.2.13"
Expand Down Expand Up @@ -263,10 +263,10 @@ [email protected]:
resolved "https://registry.yarnpkg.com/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz#553a7b8446ff6f684359c445f1e37a05dacc33dd"
integrity sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==

fill-range@^7.0.1:
version "7.0.1"
resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40"
integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==
fill-range@^7.1.1:
version "7.1.1"
resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.1.1.tgz#44265d3cac07e3ea7dc247516380643754a05292"
integrity sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==
dependencies:
to-regex-range "^5.0.1"

Expand Down Expand Up @@ -378,11 +378,11 @@ lru-cache@^6.0.0:
yallist "^4.0.0"

micromatch@^4.0.5:
version "4.0.5"
resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.5.tgz#bc8999a7cbbf77cdc89f132f6e467051b49090c6"
integrity sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==
version "4.0.8"
resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.8.tgz#d66fa18f3a47076789320b9b1af32bd86d9fa202"
integrity sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==
dependencies:
braces "^3.0.2"
braces "^3.0.3"
picomatch "^2.3.1"

mimic-response@^3.1.0:
Expand Down
16 changes: 10 additions & 6 deletions patched-vscode/src/vs/server/node/webClientServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { createReadStream } from 'fs';
import { createReadStream, existsSync, writeFileSync } from 'fs';
import {readFile } from 'fs/promises';
import { Promises } from 'vs/base/node/pfs';
import * as path from 'path';
Expand Down Expand Up @@ -390,7 +390,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://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(' ');
Expand Down Expand Up @@ -463,12 +463,16 @@ export class WebClientServer {
*/
private async _handleIdle(req: http.IncomingMessage, res: http.ServerResponse): Promise<void> {
try {
const homeDirectory = process.env.HOME || process.env.USERPROFILE;
if (!homeDirectory) {
throw new Error('Home directory not found');
const tmpDirectory = '/tmp/'
const idleFilePath = path.join(tmpDirectory, '.sagemaker-last-active-timestamp');

// If idle shutdown file does not exist, this indicates the app UI may never been opened
// Create the initial metadata file
if (!existsSync(idleFilePath)) {
const timestamp = new Date().toISOString();
writeFileSync(idleFilePath, timestamp);
}

const idleFilePath = path.join(homeDirectory, '.code-editor-last-active-timestamp');
const data = await readFile(idleFilePath, 'utf8');

res.statusCode = 200;
Expand Down
Loading