brightspace-mcp-server 1.6.3 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +43 -35
- package/build/api/client.d.ts +37 -10
- package/build/api/client.d.ts.map +1 -1
- package/build/api/client.js +158 -100
- package/build/api/client.js.map +1 -1
- package/build/api/errors.d.ts +4 -0
- package/build/api/errors.d.ts.map +1 -1
- package/build/api/errors.js +7 -0
- package/build/api/errors.js.map +1 -1
- package/build/auth/auth-cooldown.d.ts +24 -0
- package/build/auth/auth-cooldown.d.ts.map +1 -0
- package/build/auth/auth-cooldown.js +60 -0
- package/build/auth/auth-cooldown.js.map +1 -0
- package/build/auth/auth-lock.d.ts +7 -0
- package/build/auth/auth-lock.d.ts.map +1 -0
- package/build/auth/auth-lock.js +162 -0
- package/build/auth/auth-lock.js.map +1 -0
- package/build/auth/auth-runner.d.ts +30 -9
- package/build/auth/auth-runner.d.ts.map +1 -1
- package/build/auth/auth-runner.js +171 -56
- package/build/auth/auth-runner.js.map +1 -1
- package/build/auth/browser-auth.d.ts +19 -87
- package/build/auth/browser-auth.d.ts.map +1 -1
- package/build/auth/browser-auth.js +266 -614
- package/build/auth/browser-auth.js.map +1 -1
- package/build/auth/browser-state-store.d.ts +19 -0
- package/build/auth/browser-state-store.d.ts.map +1 -0
- package/build/auth/browser-state-store.js +101 -0
- package/build/auth/browser-state-store.js.map +1 -0
- package/build/auth/credential-store.d.ts +29 -0
- package/build/auth/credential-store.d.ts.map +1 -0
- package/build/auth/credential-store.js +233 -0
- package/build/auth/credential-store.js.map +1 -0
- package/build/auth/encrypted-store.d.ts +25 -0
- package/build/auth/encrypted-store.d.ts.map +1 -0
- package/build/auth/encrypted-store.js +61 -0
- package/build/auth/encrypted-store.js.map +1 -0
- package/build/auth/legacy-profile.d.ts +3 -0
- package/build/auth/legacy-profile.d.ts.map +1 -0
- package/build/auth/legacy-profile.js +41 -0
- package/build/auth/legacy-profile.js.map +1 -0
- package/build/auth/legacy-state.d.ts +14 -0
- package/build/auth/legacy-state.d.ts.map +1 -0
- package/build/auth/legacy-state.js +107 -0
- package/build/auth/legacy-state.js.map +1 -0
- package/build/auth/purdue-sso.d.ts +25 -36
- package/build/auth/purdue-sso.d.ts.map +1 -1
- package/build/auth/purdue-sso.js +210 -191
- package/build/auth/purdue-sso.js.map +1 -1
- package/build/auth/session-store.d.ts +16 -38
- package/build/auth/session-store.d.ts.map +1 -1
- package/build/auth/session-store.js +157 -152
- package/build/auth/session-store.js.map +1 -1
- package/build/auth/sso-flow.d.ts +16 -4
- package/build/auth/sso-flow.d.ts.map +1 -1
- package/build/auth/sso-flow.js +24 -2
- package/build/auth/sso-flow.js.map +1 -1
- package/build/auth/suny-sso.d.ts +6 -2
- package/build/auth/suny-sso.d.ts.map +1 -1
- package/build/auth/suny-sso.js +17 -24
- package/build/auth/suny-sso.js.map +1 -1
- package/build/auth/token-manager.d.ts +10 -3
- package/build/auth/token-manager.d.ts.map +1 -1
- package/build/auth/token-manager.js +62 -26
- package/build/auth/token-manager.js.map +1 -1
- package/build/auth/token-mint.d.ts +2 -2
- package/build/auth/token-mint.d.ts.map +1 -1
- package/build/auth/token-mint.js +31 -9
- package/build/auth/token-mint.js.map +1 -1
- package/build/auth-cli.d.ts +1 -7
- package/build/auth-cli.d.ts.map +1 -1
- package/build/auth-cli.js +71 -70
- package/build/auth-cli.js.map +1 -1
- package/build/index.js +20 -64
- package/build/index.js.map +1 -1
- package/build/setup.js +44 -19
- package/build/setup.js.map +1 -1
- package/build/tools/tool-helpers.d.ts +7 -1
- package/build/tools/tool-helpers.d.ts.map +1 -1
- package/build/tools/tool-helpers.js +96 -11
- package/build/tools/tool-helpers.js.map +1 -1
- package/build/types/index.d.ts +6 -0
- package/build/types/index.d.ts.map +1 -1
- package/build/utils/browser-install.d.ts +23 -0
- package/build/utils/browser-install.d.ts.map +1 -0
- package/build/utils/browser-install.js +33 -0
- package/build/utils/browser-install.js.map +1 -0
- package/build/utils/commands.d.ts +26 -0
- package/build/utils/commands.d.ts.map +1 -0
- package/build/utils/commands.js +26 -0
- package/build/utils/commands.js.map +1 -0
- package/build/utils/config-store.d.ts +1 -0
- package/build/utils/config-store.d.ts.map +1 -1
- package/build/utils/config-store.js +3 -0
- package/build/utils/config-store.js.map +1 -1
- package/build/utils/config.d.ts +2 -1
- package/build/utils/config.d.ts.map +1 -1
- package/build/utils/config.js +32 -10
- package/build/utils/config.js.map +1 -1
- package/build/utils/download-errors.d.ts +45 -0
- package/build/utils/download-errors.d.ts.map +1 -0
- package/build/utils/download-errors.js +45 -0
- package/build/utils/download-errors.js.map +1 -0
- package/build/utils/download-helpers.d.ts.map +1 -1
- package/build/utils/download-helpers.js +2 -1
- package/build/utils/download-helpers.js.map +1 -1
- package/build/utils/file-validator.d.ts +1 -1
- package/build/utils/file-validator.d.ts.map +1 -1
- package/build/utils/file-validator.js +47 -7
- package/build/utils/file-validator.js.map +1 -1
- package/build/utils/install-sites.d.ts +61 -0
- package/build/utils/install-sites.d.ts.map +1 -0
- package/build/utils/install-sites.js +207 -0
- package/build/utils/install-sites.js.map +1 -0
- package/build/utils/secure-config.d.ts +6 -0
- package/build/utils/secure-config.d.ts.map +1 -0
- package/build/utils/secure-config.js +57 -0
- package/build/utils/secure-config.js.map +1 -0
- package/build/utils/self-update.d.ts +61 -0
- package/build/utils/self-update.d.ts.map +1 -0
- package/build/utils/self-update.js +92 -0
- package/build/utils/self-update.js.map +1 -0
- package/build/utils/update-checker.d.ts +85 -7
- package/build/utils/update-checker.d.ts.map +1 -1
- package/build/utils/update-checker.js +141 -36
- package/build/utils/update-checker.js.map +1 -1
- package/package.json +4 -2
|
@@ -1,64 +1,27 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Brightspace MCP Server
|
|
3
3
|
* Copyright (c) 2026 Rohan Muppa. All rights reserved.
|
|
4
|
-
* Licensed under MIT
|
|
4
|
+
* Licensed under MIT: see LICENSE file for details.
|
|
5
5
|
*/
|
|
6
6
|
import type { AppConfig, TokenData } from "../types/index.js";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
import type { RequestMfaCode } from "./sso-flow.js";
|
|
8
|
+
export declare class BrowserAuthTransportError extends Error {
|
|
9
|
+
readonly code = "AUTH_TRANSPORT";
|
|
10
|
+
constructor(message: string, options?: ErrorOptions);
|
|
11
|
+
}
|
|
12
|
+
export interface AuthenticateOptions {
|
|
13
|
+
automatic?: boolean;
|
|
14
|
+
/** Persist the token before releasing the shared authentication lock. */
|
|
15
|
+
onAuthenticated?: (token: TokenData) => Promise<void>;
|
|
13
16
|
}
|
|
14
|
-
/** Whether the current attempt has to start over with a window on screen. */
|
|
15
|
-
export declare function needsVisibleBrowser({ launchedHeadless }: {
|
|
16
|
-
launchedHeadless: boolean;
|
|
17
|
-
}): boolean;
|
|
18
17
|
export declare class BrowserAuth {
|
|
19
18
|
private config;
|
|
20
19
|
private ssoFlow;
|
|
21
|
-
|
|
22
|
-
private
|
|
23
|
-
constructor(config: AppConfig);
|
|
24
|
-
/**
|
|
25
|
-
* Detect if running inside WSL (Windows Subsystem for Linux) or Docker.
|
|
26
|
-
* These environments require --no-sandbox for Chromium to launch.
|
|
27
|
-
*/
|
|
20
|
+
private readonly stateStore;
|
|
21
|
+
private readonly cooldown;
|
|
22
|
+
constructor(config: AppConfig, requestMfaCode?: RequestMfaCode);
|
|
28
23
|
private static isWSLOrDocker;
|
|
29
|
-
|
|
30
|
-
* Build Chromium launch args based on the current platform and environment.
|
|
31
|
-
*/
|
|
32
|
-
private static buildChromiumArgs;
|
|
33
|
-
/**
|
|
34
|
-
* Prevent Chrome for Testing from SIGTRAP'ing on launch on macOS (issue #10).
|
|
35
|
-
*
|
|
36
|
-
* Three layers, all idempotent and cheap:
|
|
37
|
-
* 1. ApplePersistenceIgnoreState — disables NSPersistentUIRestorer's crash-prompt
|
|
38
|
-
* modal, which Chrome for Testing's AppKit bridge cannot handle.
|
|
39
|
-
* 2. IIO_LaunchInfo=0 — resets LaunchServices' per-app crash counter so macOS
|
|
40
|
-
* stops triggering the recovery pathway in the first place.
|
|
41
|
-
* 3. Nuke the Cocoa saved-application-state bundle — if it exists, AppKit tries
|
|
42
|
-
* to replay window state during launch and can crash the browser process.
|
|
43
|
-
*
|
|
44
|
-
* Runs before every launch. None of these are destructive to user data; Chrome
|
|
45
|
-
* for Testing is a disposable test profile.
|
|
46
|
-
*/
|
|
47
|
-
private static applyMacOSCrashGuard;
|
|
48
|
-
/**
|
|
49
|
-
* Recovery step: the current browser-data profile is corrupted in a way that
|
|
50
|
-
* makes Chromium SIGTRAP during launch (issue #10). Move it aside so the next
|
|
51
|
-
* launch attempt gets a clean profile. Cheap — user just re-authenticates.
|
|
52
|
-
*/
|
|
53
|
-
private quarantineBrowserDataDir;
|
|
54
|
-
/**
|
|
55
|
-
* Authenticate, opening a window if the flow turns out to need one.
|
|
56
|
-
*
|
|
57
|
-
* Headless is only ever safe for the silent path. The moment a real sign-in
|
|
58
|
-
* is required the run starts over with a visible browser, because the MFA
|
|
59
|
-
* number match has to be readable by a human.
|
|
60
|
-
*/
|
|
61
|
-
authenticate(): Promise<TokenData>;
|
|
24
|
+
authenticate(options?: AuthenticateOptions): Promise<TokenData>;
|
|
62
25
|
private attemptAuthentication;
|
|
63
26
|
/**
|
|
64
27
|
* Run the token extraction strategy chain, cheapest to most invasive.
|
|
@@ -71,23 +34,14 @@ export declare class BrowserAuth {
|
|
|
71
34
|
* Returns true if the token is accepted by D2L, false otherwise.
|
|
72
35
|
*/
|
|
73
36
|
private validateToken;
|
|
74
|
-
/**
|
|
75
|
-
* Set up passive network request listener to capture Bearer token.
|
|
76
|
-
* MUST be called BEFORE page.goto() to avoid race condition.
|
|
77
|
-
*/
|
|
78
|
-
private setupTokenInterception;
|
|
79
|
-
/**
|
|
80
|
-
* Navigate to Brightspace and login if needed.
|
|
81
|
-
* Returns true if already authenticated (cookies valid), false if SSO login was performed.
|
|
82
|
-
*/
|
|
37
|
+
/** Restore first, and only attempt credentials after a real sign-in is needed. */
|
|
83
38
|
private navigateAndLogin;
|
|
84
|
-
/** Let the page finish loading, without letting a slow one fail the run. */
|
|
85
|
-
private settle;
|
|
86
39
|
/**
|
|
87
40
|
* Give the SSO chain a bounded window to finish with no human input.
|
|
88
41
|
* Returns true only when the session proves itself live.
|
|
89
42
|
*/
|
|
90
43
|
private awaitSilentSSO;
|
|
44
|
+
private hasCredentialPrompt;
|
|
91
45
|
/**
|
|
92
46
|
* A POSITIVE session check, never "the URL doesn't look like a login page".
|
|
93
47
|
* Institutions bounce through intermediate SAML hops with a perfectly live
|
|
@@ -102,6 +56,8 @@ export declare class BrowserAuth {
|
|
|
102
56
|
private clickSilentSurfaces;
|
|
103
57
|
/** Visibility without the actionability wait, so a poll keeps its rhythm. */
|
|
104
58
|
private isOnScreen;
|
|
59
|
+
/** Check each selector independently so a hidden earlier match cannot mask a visible one. */
|
|
60
|
+
private isAnyOnScreen;
|
|
105
61
|
/**
|
|
106
62
|
* Try to extract Bearer token from D2L's localStorage.
|
|
107
63
|
* D2L stores API tokens in localStorage under "D2L.Fetch.Tokens".
|
|
@@ -130,29 +86,5 @@ export declare class BrowserAuth {
|
|
|
130
86
|
* Constructs a cookie header string from d2lSessionVal and d2lSecureSessionVal.
|
|
131
87
|
*/
|
|
132
88
|
private extractCookieToken;
|
|
133
|
-
/**
|
|
134
|
-
* Load previously saved storage state (cookies + localStorage).
|
|
135
|
-
* Workaround for Playwright bug #36139: session cookies don't persist in persistent context.
|
|
136
|
-
*/
|
|
137
|
-
private loadStorageState;
|
|
138
|
-
private saveStorageState;
|
|
139
|
-
/**
|
|
140
|
-
* Launch browser with retry logic.
|
|
141
|
-
* Windows is prone to 180s launch timeouts (Playwright issue #22117) caused by
|
|
142
|
-
* lingering Chromium processes, antivirus interference, or resource contention.
|
|
143
|
-
* On timeout, we clear lock files and retry once.
|
|
144
|
-
*/
|
|
145
|
-
private launchBrowserWithRetry;
|
|
146
|
-
/**
|
|
147
|
-
* Validate and remove stale Chromium lock files from the browser data directory.
|
|
148
|
-
* Playwright's persistent context uses Chromium's SingletonLock mechanism.
|
|
149
|
-
* If the browser is killed unexpectedly (antivirus, force close, crash),
|
|
150
|
-
* these lock files persist and block all future launch attempts.
|
|
151
|
-
*
|
|
152
|
-
* For SingletonLock (a symlink whose target is "hostname-pid"), we check
|
|
153
|
-
* whether the owning process is still alive before removing it. This avoids
|
|
154
|
-
* deleting a lock held by a legitimate running instance.
|
|
155
|
-
*/
|
|
156
|
-
private validateAndClearLockFiles;
|
|
157
89
|
}
|
|
158
90
|
//# sourceMappingURL=browser-auth.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser-auth.d.ts","sourceRoot":"","sources":["../../src/auth/browser-auth.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"browser-auth.d.ts","sourceRoot":"","sources":["../../src/auth/browser-auth.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAK9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAoBpD,qBAAa,yBAA0B,SAAQ,KAAK;IAClD,QAAQ,CAAC,IAAI,oBAAoB;gBACrB,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY;CAIpD;AAED,MAAM,WAAW,mBAAmB;IAClC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,yEAAyE;IACzE,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACvD;AAED,qBAAa,WAAW;IACtB,OAAO,CAAC,MAAM,CAAY;IAC1B,OAAO,CAAC,OAAO,CAAU;IACzB,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAoB;IAC/C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAe;gBAE5B,MAAM,EAAE,SAAS,EAAE,cAAc,CAAC,EAAE,cAAc;IAO9D,OAAO,CAAC,MAAM,CAAC,aAAa;IAetB,YAAY,CAAC,OAAO,GAAE,mBAAwB,GAAG,OAAO,CAAC,SAAS,CAAC;YAgB3D,qBAAqB;IAwEnC;;;;OAIG;YACW,eAAe;IA0D7B;;;OAGG;YACW,aAAa;IA0B3B,kFAAkF;YACpE,gBAAgB;IAmD9B;;;OAGG;YACW,cAAc;YAmDd,mBAAmB;IAKjC;;;;;OAKG;YACW,cAAc;IAsB5B;;;OAGG;YACW,mBAAmB;IA0CjC,6EAA6E;YAC/D,UAAU;IAQxB,6FAA6F;YAC/E,aAAa;IAO3B;;;OAGG;YACW,wBAAwB;IAyCtC;;;;;OAKG;YACW,sBAAsB;IAoCpC;;;;OAIG;YACW,eAAe;IAoD7B;;;OAGG;YACW,gBAAgB;IAgE9B;;;OAGG;YACW,kBAAkB;CAiCjC"}
|