Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Synchronising sagemaker patches present in their latest branch #47

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
saumitsAmazon merged 1 commit into main from saumits_branch_sync
Aug 29, 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
1 change: 1 addition & 0 deletions patches/sagemaker.series
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,4 @@ sagemaker/sagemaker-extensions-sync.diff
sagemaker/sagemaker-ui-post-startup.diff
sagemaker/sagemaker-integration.diff
sagemaker/sagemaker-idle-extension.diff
sagemaker/base-path-compatibility.diff
32 changes: 32 additions & 0 deletions patches/sagemaker/base-path-compatibility.diff
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
Index: sagemaker-code-editor/vscode/src/vs/server/node/serverEnvironmentService.ts
===================================================================
--- third-party-src/src/vs/server/node/serverEnvironmentService.ts
+++ third-party-src/src/vs/server/node/serverEnvironmentService.ts
@@ -9,6 +9,7 @@
import { OPTIONS, OptionDescriptions } from '../../platform/environment/node/argv.js';
import { refineServiceDecorator } from '../../platform/instantiation/common/instantiation.js';
import { IEnvironmentService, INativeEnvironmentService } from '../../platform/environment/common/environment.js';
+import { IProductService } from '../../platform/product/common/productService.js';
import { memoize } from '../../base/common/decorators.js';
import { URI } from '../../base/common/uri.js';

@@ -235,7 +235,17 @@
}

export class ServerEnvironmentService extends NativeEnvironmentService implements IServerEnvironmentService {
+
+ constructor(args: ServerParsedArgs, productService: IProductService) {
+ /* ----- sagemaker compatibility: map --base-path to --server-base-path ----- */
+ if (args['base-path']) {
+ args['server-base-path'] = args['base-path'];
+ }
+
+ super(args, productService);
+ }
+
@memoize
override get userRoamingDataHome(): URI { return this.appSettingsHome; }
override get args(): ServerParsedArgs { return super.args as ServerParsedArgs; }
-}
+}
\ No newline at end of file
115 changes: 109 additions & 6 deletions patches/sagemaker/post-startup-notifications.diff
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -253,13 +253,22 @@ Index: third-party-src/extensions/post-startup-notifications/src/extension.ts
===================================================================
--- /dev/null
+++ third-party-src/extensions/post-startup-notifications/src/extension.ts
@@ -0,0 +1,80 @@
@@ -0,0 +1,117 @@
+import * as vscode from 'vscode';
+import * as fs from 'fs';
+import { POST_START_UP_STATUS_FILE, SERVICE_NAME_ENV_KEY, SERVICE_NAME_ENV_VALUE } from './constant';
+import { StatusFile } from './types';
+import * as chokidar from 'chokidar';
+
+// Simple method to check if user has seen a notification
+function hasUserSeen(context: vscode.ExtensionContext, notificationId: string): boolean {
+ return context.globalState.get(`notification_seen_${notificationId}`) === true;
+}
+
+// Simple method to mark notification as seen
+function markAsSeen(context: vscode.ExtensionContext, notificationId: string): void {
+ context.globalState.update(`notification_seen_${notificationId}`, true);
+}
+
+let previousStatus: string | undefined;
+let watcher: chokidar.FSWatcher;
Expand All @@ -274,6 +283,9 @@ Index: third-party-src/extensions/post-startup-notifications/src/extension.ts
+ }
+
+ outputChannel = vscode.window.createOutputChannel('SageMaker Unified Studio Post Startup Notifications');
+
+ // Show Q CLI notification if user hasn't seen it before
+ showQCliNotification(context);
+
+ try {
+ watcher = chokidar.watch(POST_START_UP_STATUS_FILE, {
Expand Down Expand Up @@ -325,6 +337,31 @@ Index: third-party-src/extensions/post-startup-notifications/src/extension.ts
+ }
+};
+
+// Show Q CLI notification if user hasn't seen it before
+function showQCliNotification(context: vscode.ExtensionContext): void {
+ const notificationId = 'smus_q_cli_notification';
+ const message = 'The Amazon Q Command Line Interface (CLI) is installed. You can now access AI-powered assistance in your terminal.';
+ const link = 'https://docs.aws.amazon.com/sagemaker-unified-studio/latest/userguide/q-actions.html';
+ const linkLabel = 'Learn More';
+
+ if (!hasUserSeen(context, notificationId)) {
+ outputChannel.appendLine("User has not seen the notification")
+ // Show notification with Learn More button
+ vscode.window.showInformationMessage(
+ message,
+ { modal: false },
+ { title: linkLabel, isCloseAffordance: false }
+ ).then((selection) => {
+ if (selection && selection.title === linkLabel) {
+ vscode.env.openExternal(vscode.Uri.parse(link));
+ }
+
+ // Mark as seen regardless of which button was clicked
+ markAsSeen(context, notificationId);
+ });
+ }
+}
+
+export function deactivate() {
+ if (watcher) {
+ watcher.close();
Expand All @@ -338,7 +375,7 @@ Index: third-party-src/extensions/post-startup-notifications/src/test/extension.
===================================================================
--- /dev/null
+++ third-party-src/extensions/post-startup-notifications/src/test/extension.test.ts
@@ -0,0 +1,201 @@
@@ -0,0 +1,267 @@
+import * as vscode from 'vscode';
+import * as fs from 'fs';
+import * as chokidar from 'chokidar';
Expand All @@ -356,8 +393,14 @@ Index: third-party-src/extensions/post-startup-notifications/src/test/extension.
+jest.mock('vscode', () => ({
+ window: {
+ showErrorMessage: jest.fn(),
+ showInformationMessage: jest.fn(),
+ showInformationMessage: jest.fn().mockReturnValue(Promise.resolve()),
+ createOutputChannel: jest.fn()
+ },
+ env: {
+ openExternal: jest.fn()
+ },
+ Uri: {
+ parse: jest.fn(url => ({ toString: () => url }))
+ }
+}));
+
Expand All @@ -373,8 +416,15 @@ Index: third-party-src/extensions/post-startup-notifications/src/test/extension.
+ // Reset mocks
+ jest.resetAllMocks();
+
+ // Setup context
+ mockContext = { subscriptions: [] } as any;
+ // Setup context with globalState for storage
+ mockContext = {
+ subscriptions: [],
+ globalState: {
+ get: jest.fn(),
+ update: jest.fn(),
+ keys: jest.fn().mockReturnValue([])
+ }
+ } as any;
+
+ // Setup watcher
+ mockWatcher = {
Expand Down Expand Up @@ -529,7 +579,59 @@ Index: third-party-src/extensions/post-startup-notifications/src/test/extension.
+ expect(vscode.window.showInformationMessage).not.toHaveBeenCalled();
+ });
+ });
+
+ describe('Q CLI Notification Tests', () => {
+ test('should show Q CLI notification with Learn More button', () => {
+ // Set up globalState to simulate first-time user
+ (mockContext.globalState.get as jest.Mock).mockReturnValue(undefined);
+
+ activate(mockContext);
+
+ // Verify notification is shown with correct message and button
+ expect(vscode.window.showInformationMessage).toHaveBeenCalledWith(
+ 'The Amazon Q Command Line Interface (CLI) is installed. You can now access AI-powered assistance in your terminal.',
+ { modal: false },
+ { title: 'Learn More', isCloseAffordance: false }
+ );
+ });
+
+ test('should open documentation when Learn More is clicked', async () => {
+ // Set up globalState to simulate first-time user
+ (mockContext.globalState.get as jest.Mock).mockReturnValue(undefined);
+
+ // Mock the user clicking "Learn More"
+ const mockSelection = { title: 'Learn More' };
+ (vscode.window.showInformationMessage as jest.Mock).mockReturnValue(Promise.resolve(mockSelection));
+
+ activate(mockContext);
+
+ // Wait for the promise to resolve
+ await new Promise(process.nextTick);
+
+ // Verify the documentation link is opened
+ expect(vscode.env.openExternal).toHaveBeenCalledWith(
+ expect.objectContaining({
+ toString: expect.any(Function)
+ })
+ );
+
+ // Verify notification is marked as seen
+ expect(mockContext.globalState.update).toHaveBeenCalledWith(
+ 'notification_seen_smus_q_cli_notification',
+ true
+ );
+ });
+
+ test('should not show notification if already seen', () => {
+ // Set up globalState to simulate returning user who has seen notification
+ (mockContext.globalState.get as jest.Mock).mockReturnValue(true);
+
+ activate(mockContext);
+
+ // Verify notification is not shown again
+ expect(vscode.window.showInformationMessage).not.toHaveBeenCalled();
+ });
+ });
+
+ describe('Deactivation Tests', () => {
+ test('should cleanup resources properly', () => {
+ activate(mockContext);
Expand All @@ -540,6 +642,7 @@ Index: third-party-src/extensions/post-startup-notifications/src/test/extension.
+ });
+ });
+});
+
Index: third-party-src/extensions/post-startup-notifications/src/types.ts
===================================================================
--- /dev/null
Expand Down
2 changes: 1 addition & 1 deletion patches/sagemaker/sagemaker-idle-extension.diff
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ Index: third-party-src/src/vs/server/node/webClientServer.ts
+ writeFileSync(idleFilePath, timestamp);
+ }
+
+ const data = await readFile(idleFilePath, 'utf8');
+ const data = await promises.readFile(idleFilePath, 'utf8');
+
+ res.statusCode = 200;
+ res.setHeader('Content-Type', 'application/json');
Expand Down

AltStyle によって変換されたページ (->オリジナル) /