brightspace-mcp-server 2.0.0 → 3.0.1

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.
Files changed (83) hide show
  1. package/README.md +35 -52
  2. package/build/api/client.d.ts +32 -7
  3. package/build/api/client.d.ts.map +1 -1
  4. package/build/api/client.js +93 -27
  5. package/build/api/client.js.map +1 -1
  6. package/build/auth/auth-cooldown.d.ts +8 -0
  7. package/build/auth/auth-cooldown.d.ts.map +1 -1
  8. package/build/auth/auth-cooldown.js +15 -2
  9. package/build/auth/auth-cooldown.js.map +1 -1
  10. package/build/auth/auth-lock.d.ts.map +1 -1
  11. package/build/auth/auth-lock.js +51 -3
  12. package/build/auth/auth-lock.js.map +1 -1
  13. package/build/auth/auth-runner.d.ts +15 -4
  14. package/build/auth/auth-runner.d.ts.map +1 -1
  15. package/build/auth/auth-runner.js +128 -109
  16. package/build/auth/auth-runner.js.map +1 -1
  17. package/build/auth/browser-auth.d.ts +2 -1
  18. package/build/auth/browser-auth.d.ts.map +1 -1
  19. package/build/auth/browser-auth.js +15 -4
  20. package/build/auth/browser-auth.js.map +1 -1
  21. package/build/auth/credential-store.d.ts.map +1 -1
  22. package/build/auth/credential-store.js +12 -2
  23. package/build/auth/credential-store.js.map +1 -1
  24. package/build/auth/purdue-sso.d.ts +7 -0
  25. package/build/auth/purdue-sso.d.ts.map +1 -1
  26. package/build/auth/purdue-sso.js +46 -0
  27. package/build/auth/purdue-sso.js.map +1 -1
  28. package/build/auth/sso-flow.d.ts +2 -1
  29. package/build/auth/sso-flow.d.ts.map +1 -1
  30. package/build/auth/sso-flow.js +10 -3
  31. package/build/auth/sso-flow.js.map +1 -1
  32. package/build/auth/suny-sso.d.ts +3 -0
  33. package/build/auth/suny-sso.d.ts.map +1 -1
  34. package/build/auth/suny-sso.js +2 -0
  35. package/build/auth/suny-sso.js.map +1 -1
  36. package/build/auth-cli.js +49 -4
  37. package/build/auth-cli.js.map +1 -1
  38. package/build/index.js +13 -61
  39. package/build/index.js.map +1 -1
  40. package/build/setup.js +32 -13
  41. package/build/setup.js.map +1 -1
  42. package/build/tools/get-assignments.d.ts.map +1 -1
  43. package/build/tools/get-assignments.js +157 -82
  44. package/build/tools/get-assignments.js.map +1 -1
  45. package/build/tools/tool-helpers.d.ts +7 -1
  46. package/build/tools/tool-helpers.d.ts.map +1 -1
  47. package/build/tools/tool-helpers.js +96 -11
  48. package/build/tools/tool-helpers.js.map +1 -1
  49. package/build/utils/browser-install.d.ts +23 -0
  50. package/build/utils/browser-install.d.ts.map +1 -0
  51. package/build/utils/browser-install.js +33 -0
  52. package/build/utils/browser-install.js.map +1 -0
  53. package/build/utils/commands.d.ts +26 -0
  54. package/build/utils/commands.d.ts.map +1 -0
  55. package/build/utils/commands.js +26 -0
  56. package/build/utils/commands.js.map +1 -0
  57. package/build/utils/config.d.ts.map +1 -1
  58. package/build/utils/config.js +4 -2
  59. package/build/utils/config.js.map +1 -1
  60. package/build/utils/download-errors.d.ts +45 -0
  61. package/build/utils/download-errors.d.ts.map +1 -0
  62. package/build/utils/download-errors.js +45 -0
  63. package/build/utils/download-errors.js.map +1 -0
  64. package/build/utils/download-helpers.d.ts.map +1 -1
  65. package/build/utils/download-helpers.js +2 -1
  66. package/build/utils/download-helpers.js.map +1 -1
  67. package/build/utils/file-validator.d.ts +1 -1
  68. package/build/utils/file-validator.d.ts.map +1 -1
  69. package/build/utils/file-validator.js +47 -7
  70. package/build/utils/file-validator.js.map +1 -1
  71. package/build/utils/install-sites.d.ts +61 -0
  72. package/build/utils/install-sites.d.ts.map +1 -0
  73. package/build/utils/install-sites.js +207 -0
  74. package/build/utils/install-sites.js.map +1 -0
  75. package/build/utils/self-update.d.ts +61 -0
  76. package/build/utils/self-update.d.ts.map +1 -0
  77. package/build/utils/self-update.js +92 -0
  78. package/build/utils/self-update.js.map +1 -0
  79. package/build/utils/update-checker.d.ts +85 -7
  80. package/build/utils/update-checker.d.ts.map +1 -1
  81. package/build/utils/update-checker.js +141 -36
  82. package/build/utils/update-checker.js.map +1 -1
  83. package/package.json +1 -1
package/README.md CHANGED
@@ -34,23 +34,23 @@ https://github.com/RohanMuppa/brightspace-mcp-server/blob/main/LLMs.md
34
34
  **Option 2: Run it yourself**
35
35
 
36
36
  ```bash
37
- npx brightspace-mcp-server setup
37
+ npx -y brightspace-mcp-server@latest setup
38
38
  ```
39
39
 
40
40
  Purdue students can add `--purdue` to skip entering the school URL:
41
41
 
42
42
  ```bash
43
- npx brightspace-mcp-server setup --purdue
43
+ npx -y brightspace-mcp-server@latest setup --purdue
44
44
  ```
45
45
 
46
46
  SUNY campuses share one Brightspace site, so `--suny` also asks which campus
47
47
  you're at and skips SUNY's campus picker when you sign in:
48
48
 
49
49
  ```bash
50
- npx brightspace-mcp-server setup --suny
50
+ npx -y brightspace-mcp-server@latest setup --suny
51
51
  ```
52
52
 
53
- The wizard saves your password in the native credential store and runs login in a headless browser. At Purdue, approve Microsoft Authenticator using the number printed in the terminal. No browser window opens. The wizard can configure Claude Desktop and Cursor. Restart your AI client when it finishes.
53
+ The wizard saves your password in the native credential store and asks how you complete MFA. Authentication can wait for approval or number matching, prompt in the terminal for a code from Google Authenticator or another app, or open a visible browser for other interactive methods. The wizard can configure Claude Desktop and Cursor. Restart your AI client when it finishes.
54
54
 
55
55
  Any other D2L school: run `setup` without a flag and paste your Brightspace URL (for example `https://yourschool.brightspace.com`).
56
56
 
@@ -65,35 +65,25 @@ npx -y brightspace-mcp-server@latest
65
65
 
66
66
  On **Windows**, npx must be wrapped: `cmd /c npx -y brightspace-mcp-server@latest`
67
67
 
68
- You still need to run `npx brightspace-mcp-server setup` first to save your credentials.
68
+ You still need to run `npx -y brightspace-mcp-server@latest setup` first to save your credentials.
69
69
 
70
70
  </details>
71
71
 
72
72
  ## Session Expired?
73
73
 
74
- Returning the next day normally requires no action. The server renews short-lived API tokens over HTTPS using the saved Brightspace session. If that session ends, a headless browser restores your saved Microsoft session and tries silent SSO. If Microsoft requires sign-in, your saved credentials are entered automatically and you complete MFA on your phone.
74
+ There is nothing to log into first. Ask for your grades and the sign-in happens as part of that request, so the assistant never has to check whether you are authenticated before it can answer. Starting your AI client touches Brightspace not at all: a restart on its own will never set off an MFA prompt.
75
+
76
+ Returning the next day normally requires no action. The server renews short-lived API tokens over HTTPS using the saved Brightspace session. If that session ends, a browser restores your saved Microsoft session and tries silent SSO. Approval and code-based modes stay headless; when an automatic run needs a code, run the auth command below to enter it securely in the terminal.
75
77
 
76
78
  Your school's policy controls when MFA is required. There is no local 24-hour cutoff, and the server no longer discards browser state after one hour. A network outage preserves the saved session and returns a temporary error.
77
79
 
78
- If you miss an MFA request, automatic browser authentication waits four hours before trying again. Existing tokens and HTTP token renewal still work. Browser-based SSO also pauses because Microsoft can send another phone prompt during a redirect, even without a password submission. Run this command in a terminal to retry immediately and see the MFA number:
80
+ If you miss an MFA request, automatic browser authentication pauses for five minutes before trying again. Existing tokens and HTTP token renewal still work. Browser-based SSO also pauses because Microsoft can send another phone prompt during a redirect, even without a password submission. Run this command in a terminal to retry immediately, see a number match, or enter an authenticator code:
79
81
 
80
82
  ```bash
81
- npx brightspace-mcp-server auth
83
+ npx -y brightspace-mcp-server@latest auth
82
84
  ```
83
85
 
84
- **MFA at Purdue** is Microsoft Authenticator number matching: enter the terminal-displayed number on your phone. The MCP also sends authentication progress as logging notifications to clients that display them. Some desktop clients hide server logs, so use the terminal command above if the number is not visible. Unsupported identity-provider pages require a supported sign-in handler; the server does not silently open a visible browser.
85
-
86
- ## Upgrading to 2.0.0
87
-
88
- - Restart existing MCP processes after upgrading. v1 and v2 should not authenticate simultaneously against the same session directory.
89
- - Named accounts use separate directories below `~/.d2l-session/accounts/`, keyed by school and username. The first v2 login for a named account may require MFA because v1 browser state does not prove which username it belongs to. Switching accounts never replays another account's cookies.
90
- - On first use, the server moves a v1 config password into the native credential store, verifies it, then removes it from `config.json`. Tokens and browser storage migrate to authenticated encryption using a new random key in that store.
91
- - A locked or unavailable credential store stops migration and preserves existing files. Unlock it and retry. macOS may ask you to allow the Node executable to access Keychain.
92
- - After migration, the old storage snapshot is moved to Trash. After successful browser authentication, the inactive `browser-data` profile is also moved to Trash. Those legacy copies remain recoverable there; existing `.corrupted.*` backups are not automatically removed.
93
- - The server uses a fresh browser context for each authentication attempt. It saves only encrypted browser storage, with no permanent Chromium profile.
94
- - Keep `D2L_SESSION_DIR` on this computer's local filesystem. Sharing it through NFS or a network drive is unsupported; its encryption key belongs to this operating-system account.
95
- - `D2L_HEADLESS` remains recognized for compatibility; v2 authentication always runs headlessly. Environment-supplied passwords remain accepted as input and are saved in native secure storage. Remove old password values from your own `.env` or client configuration after migration.
96
- - If you change your password, run `setup` again. If the encryption key was deleted, restore the native credential entry or use a new session directory and authenticate. Unreadable saved sessions are preserved rather than silently replaced.
86
+ **MFA at Purdue** commonly uses Microsoft Authenticator number matching: enter the terminal-displayed number on your phone. Google Authenticator and other one-time-code apps work too, with no setting to change: run the auth command above in a terminal and it prompts for the code when your provider asks for one. Pick the visible-browser option during setup only if your identity provider needs interaction the server cannot drive. The MCP also sends authentication progress as logging notifications to clients that display them. Some desktop clients hide server logs, so use the terminal command above for interactive MFA.
97
87
 
98
88
  ## What You Can Ask About
99
89
 
@@ -110,6 +100,8 @@ npx brightspace-mcp-server auth
110
100
  | Discussions | "What are people saying in the final project thread?" · "Summarize the latest discussion posts" |
111
101
  | Planning | "Build me a study schedule based on my upcoming due dates" · "Which class needs the most attention right now?" |
112
102
 
103
+ Assignment results cross-check the visible course table of contents and gradebook. This catches quizzes and other graded work that some Brightspace courses omit from their normal assignment or quiz listings.
104
+
113
105
  ## Security
114
106
 
115
107
  - Your school URL and username live in `~/.brightspace-mcp/config.json`. Your password lives in the native credential store. macOS and Windows use `@napi-rs/keyring`; Linux uses `secret-tool` directly to require Secret Service without a temporary kernel-key fallback. Linux secrets travel through stdin, never command-line arguments.
@@ -141,14 +133,33 @@ Licensed under the MIT License.
141
133
 
142
134
  ## Updates
143
135
 
144
- Automatic. Every time your AI client starts a session, it runs `npx brightspace-mcp-server@latest` which pulls the newest version from npm. No action needed.
136
+ Automatic, in both places it matters.
137
+
138
+ **The MCP server** is registered as `npx -y brightspace-mcp-server@latest`, so your AI client pulls the newest version every time it starts a session.
145
139
 
146
- If you ever suspect you're on an old version (the auth banner prints the version), clear the npx cache and restart your client:
140
+ **The auth CLI** updates itself too. If you installed globally with `npm install -g`, that copy stays at whatever version you installed it at — npm never revisits it. So when the CLI notices it is behind, it re-runs itself through `npx -y brightspace-mcp-server@latest auth` and you get the current code. You are not prompted and there is nothing to confirm.
141
+
142
+ One caveat worth knowing: a re-exec runs the newest code, it does not overwrite the old copy on disk. `npm ls -g` will still report the version you installed. To actually replace it:
147
143
 
148
144
  ```bash
145
+ npm install -g brightspace-mcp-server@latest
149
146
  npx clear-npx-cache
150
147
  ```
151
148
 
149
+ Then restart your AI client. The server and the CLI both check npm on startup, and the server re-checks every few hours, so you get told when either one falls behind — including when they disagree with each other.
150
+
151
+ Set `D2L_NO_UPDATE_CHECK=1` to switch all of this off.
152
+
153
+ ## What's new in 3.0.0
154
+
155
+ - Signing in is part of the first tool call. The separate `check_auth` tool is gone, and so is the step where the assistant had to ask about your login before it could answer anything. **This removes a tool, so any saved prompt that names `check_auth` needs updating.**
156
+ - Starting the server makes no network requests. API versions are discovered by the first request that needs them, and a tenant that is briefly unreachable no longer stops the server from starting.
157
+ - Concurrent tool calls on a cold session share one sign-in instead of racing, so you get one MFA prompt rather than several.
158
+ - Failed sign-ins now explain themselves in the tool's answer: a locked keychain, a paused MFA cooldown, or a network outage each say what to do.
159
+ - A missed MFA prompt pauses automatic sign-in for five minutes instead of four hours.
160
+ - Authenticator-code MFA (Google Authenticator and similar) works, with the code entered in the terminal.
161
+ - Every command the server prints is pinned to `@latest`, so following its own advice can never run a stale copy.
162
+
152
163
  ## What's new in 2.0.0
153
164
 
154
165
  - Headless saved-credential login and terminal MFA, with silent session reuse across restarts.
@@ -156,33 +167,5 @@ npx clear-npx-cache
156
167
  - Removed the one-hour browser-state cutoff and destructive profile recovery.
157
168
  - Process-level authentication coordination, failed-MFA cooldown, and transport errors that preserve your session.
158
169
  - Publishing waits for the test matrix on macOS, Windows, and Linux.
159
-
160
- Authentication recovery patterns were informed by [Brightspace Bar](https://github.com/DavidChen-006/Brightspace-Bar), distributed under the MIT license.
161
-
162
- ## What's new in 1.6.1
163
-
164
- - Your saved login now survives a network change. The session file was encrypted with a key derived from the machine hostname, which on campus wifi is a DHCP name that changes with the lease. When it changed, the saved session became unreadable and you were sent back through a full MFA login. Upgrading costs one final login, then it stops.
165
-
166
- ## What's new in 1.6.0
167
-
168
- - **Read the files attached to an assignment.** The spec PDF, the starter workbook, the rubric. Ask what an assignment requires and the answer comes from the actual document, not just its one-line description. Handles PDF, Word, Excel, and PowerPoint.
169
- - The roster no longer hides people: a class larger than the limit now reports the true total and says it was truncated, and the limit can be raised.
170
- - Fixed a case where a class list or course list could stop short of the last page.
171
-
172
- ## What's new in 1.5.0
173
-
174
- - Token refresh no longer opens a browser: the access token is re-minted from your session cookie in about 200 ms.
175
- - Silent re-login when your Microsoft session is still alive, and a fast fallback to the credential login when it is not.
176
- - The Microsoft Authenticator number match is printed in the terminal, so headless logins can be approved.
177
- - `get_upcoming_due_dates` reads due dates from assignments and quizzes directly. It no longer reports a quiz as due on the day it opens.
178
- - Every assignment, quiz, and due date carries a `url` that opens the item in Brightspace.
179
- - Gradebook columns with no matching assignment or quiz (a proctored midterm, for example) are surfaced as `gradeOnly` items.
180
- - Unpublished announcements are hidden, and announcements sort by the date they were scheduled to post.
181
- - A dead session is detected even when Brightspace answers with HTTP 200, so re-login triggers instead of a confusing network error.
182
- - SUNY preset (`--suny`) and a more robust Microsoft Entra login, contributed by the community.
183
-
184
- ---
185
-
186
- Proudly made for Boilermakers by [Rohan Muppa](https://github.com/rohanmuppa) 🚂
187
-
170
+
188
171
  [Report a bug](https://github.com/rohanmuppa/brightspace-mcp-server/issues) · MIT · Copyright 2026 Rohan Muppa
@@ -8,7 +8,7 @@ import type { D2LApiClientOptions, ApiVersions } from "./types.js";
8
8
  * D2L API client with authentication, caching, rate limiting, and version discovery.
9
9
  *
10
10
  * Key features:
11
- * - Auto-discovers LP/LE versions from /d2l/api/versions/
11
+ * - Auto-discovers LP/LE versions from /d2l/api/versions/ on the first request
12
12
  * - Supports both Bearer tokens and cookie-based auth (auto-detected via "cookie:" prefix)
13
13
  * - Client-side rate limiting using token bucket algorithm
14
14
  * - In-memory response caching with per-data-type TTLs
@@ -27,17 +27,38 @@ export declare class D2LApiClient {
27
27
  private readonly onAuthExpired?;
28
28
  private readonly retryConfig;
29
29
  private versions;
30
+ /** Single in-flight discovery, so concurrent first requests share one fetch. */
31
+ private versionsInFlight;
30
32
  constructor(options: D2LApiClientOptions);
31
33
  /**
32
- * Initialize the client by discovering API versions.
33
- * Must be called before making API requests.
34
+ * Discover the API versions, joining a discovery already in flight.
35
+ *
36
+ * Called from get() and getRaw() rather than at startup, so the server
37
+ * answers tools/list without touching the network and a user who never
38
+ * calls a tool never pays for a request. Nothing needs to call this
39
+ * directly.
40
+ */
41
+ ensureVersions(): Promise<ApiVersions>;
42
+ /**
43
+ * Discover API versions eagerly. Idempotent, and no longer required:
44
+ * requests discover on demand. Kept for callers that want the network
45
+ * failure up front rather than on the first tool call.
34
46
  */
35
47
  initialize(): Promise<void>;
36
48
  /**
37
49
  * Get discovered API versions.
38
- * @throws Error if initialize() hasn't been called yet
50
+ * @throws Error if no request has discovered them yet
39
51
  */
40
52
  get apiVersions(): ApiVersions;
53
+ /**
54
+ * Substitute the discovered versions into a path built by lp(), le(), or
55
+ * leGlobal(), discovering them first if no request has yet.
56
+ *
57
+ * A path that carries no placeholder is returned untouched and costs
58
+ * nothing: a bookmark page whose URL came back fully resolved from D2L
59
+ * does not trigger a discovery of its own.
60
+ */
61
+ private resolvePath;
41
62
  /**
42
63
  * Make a GET request to the D2L API.
43
64
  *
@@ -87,21 +108,25 @@ export declare class D2LApiClient {
87
108
  private buildAuthHeaders;
88
109
  /**
89
110
  * Build path for LP (Learning Platform) API endpoints.
111
+ *
112
+ * The version is left as a placeholder and substituted by get() or getRaw()
113
+ * once it has been discovered. See LP_VERSION above.
114
+ *
90
115
  * @param path - Path within LP API (e.g., "/users/whoami")
91
- * @returns Full versioned path (e.g., "/d2l/api/lp/1.56/users/whoami")
116
+ * @returns Versioned path template (e.g., "/d2l/api/lp/{lp}/users/whoami")
92
117
  */
93
118
  lp(path: string): string;
94
119
  /**
95
120
  * Build path for LE (Learning Environment) API endpoints with orgUnitId.
96
121
  * @param orgUnitId - Organizational unit ID (course ID)
97
122
  * @param path - Path within LE API (e.g., "/content/root/")
98
- * @returns Full versioned path (e.g., "/d2l/api/le/1.91/123456/content/root/")
123
+ * @returns Versioned path template (e.g., "/d2l/api/le/{le}/123456/content/root/")
99
124
  */
100
125
  le(orgUnitId: number, path: string): string;
101
126
  /**
102
127
  * Build path for global LE (Learning Environment) API endpoints without orgUnitId.
103
128
  * @param path - Path within LE API (e.g., "/enrollments/myenrollments/")
104
- * @returns Full versioned path (e.g., "/d2l/api/le/1.91/enrollments/myenrollments/")
129
+ * @returns Versioned path template (e.g., "/d2l/api/le/{le}/enrollments/myenrollments/")
105
130
  */
106
131
  leGlobal(path: string): string;
107
132
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/api/client.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,WAAW,EAAwB,MAAM,YAAY,CAAC;AAqCzF;;;;;;;;;;;;GAYG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAsC;IACnE,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAW;IACjC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAc;IAC1C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAY;IACtC,OAA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E,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAIxB;;;;;OAKG;IACH,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM;IAI3C;;;;OAIG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAI9B;;OAEG;IACH,UAAU,IAAI,IAAI;IAKlB;;OAEG;IACH,IAAI,SAAS,IAAI,MAAM,CAEtB;CACF"}
@@ -10,6 +10,7 @@ import { discoverVersions } from "./version-discovery.js";
10
10
  import { ApiError, RateLimitError, NetworkError } from "./errors.js";
11
11
  import { withRetry, isRetryableFailure, retryAfterMsFrom } from "./retry.js";
12
12
  import { log } from "../utils/logger.js";
13
+ import { AUTH_COMMAND } from "../utils/commands.js";
13
14
  /** An ordinary course HTML link to the login page is not an expired session. */
14
15
  function isExpiredSessionRedirect(body, baseUrl) {
15
16
  const expiredTarget = (target) => {
@@ -39,11 +40,26 @@ function isExpiredSessionRedirect(body, baseUrl) {
39
40
  }
40
41
  return false;
41
42
  }
43
+ /**
44
+ * Stand-ins for the discovered LP and LE versions.
45
+ *
46
+ * lp(), le(), and leGlobal() are synchronous path builders called from about
47
+ * forty places across the tools, but the versions they need come from a
48
+ * network request. Emitting a placeholder and substituting it inside get()
49
+ * and getRaw() keeps that request off the startup path without turning every
50
+ * one of those call sites async, and it means a newly added tool cannot
51
+ * forget to wait for discovery: the path it builds carries the requirement.
52
+ *
53
+ * Braces are used because D2L paths never contain them, so a substitution can
54
+ * never collide with a real path segment.
55
+ */
56
+ const LP_VERSION = "{lp}";
57
+ const LE_VERSION = "{le}";
42
58
  /**
43
59
  * D2L API client with authentication, caching, rate limiting, and version discovery.
44
60
  *
45
61
  * Key features:
46
- * - Auto-discovers LP/LE versions from /d2l/api/versions/
62
+ * - Auto-discovers LP/LE versions from /d2l/api/versions/ on the first request
47
63
  * - Supports both Bearer tokens and cookie-based auth (auto-detected via "cookie:" prefix)
48
64
  * - Client-side rate limiting using token bucket algorithm
49
65
  * - In-memory response caching with per-data-type TTLs
@@ -62,6 +78,8 @@ export class D2LApiClient {
62
78
  onAuthExpired;
63
79
  retryConfig;
64
80
  versions = null;
81
+ /** Single in-flight discovery, so concurrent first requests share one fetch. */
82
+ versionsInFlight = null;
65
83
  constructor(options) {
66
84
  // HTTPS-only enforcement, on a parsed URL rather than a string prefix so
67
85
  // a malformed base cannot slip through as "not http".
@@ -93,23 +111,66 @@ export class D2LApiClient {
93
111
  log("DEBUG", `D2LApiClient initialized for ${this.baseUrl}`);
94
112
  }
95
113
  /**
96
- * Initialize the client by discovering API versions.
97
- * Must be called before making API requests.
114
+ * Discover the API versions, joining a discovery already in flight.
115
+ *
116
+ * Called from get() and getRaw() rather than at startup, so the server
117
+ * answers tools/list without touching the network and a user who never
118
+ * calls a tool never pays for a request. Nothing needs to call this
119
+ * directly.
120
+ */
121
+ async ensureVersions() {
122
+ if (this.versions)
123
+ return this.versions;
124
+ if (!this.versionsInFlight) {
125
+ // The latch is released by the flow that owns it, as it settles, so a
126
+ // failed discovery is never replayed: the request after a network blip
127
+ // starts a fresh fetch instead of inheriting the stale rejection.
128
+ const flow = discoverVersions(this.baseUrl, this.timeoutMs)
129
+ .then(versions => {
130
+ this.versions = versions;
131
+ log("INFO", `D2L API versions discovered: LP ${versions.lp}, LE ${versions.le}`);
132
+ return versions;
133
+ })
134
+ .finally(() => {
135
+ if (this.versionsInFlight === flow)
136
+ this.versionsInFlight = null;
137
+ });
138
+ this.versionsInFlight = flow;
139
+ }
140
+ return this.versionsInFlight;
141
+ }
142
+ /**
143
+ * Discover API versions eagerly. Idempotent, and no longer required:
144
+ * requests discover on demand. Kept for callers that want the network
145
+ * failure up front rather than on the first tool call.
98
146
  */
99
147
  async initialize() {
100
- this.versions = await discoverVersions(this.baseUrl, this.timeoutMs);
101
- log("INFO", `D2L API versions discovered: LP ${this.versions.lp}, LE ${this.versions.le}`);
148
+ await this.ensureVersions();
102
149
  }
103
150
  /**
104
151
  * Get discovered API versions.
105
- * @throws Error if initialize() hasn't been called yet
152
+ * @throws Error if no request has discovered them yet
106
153
  */
107
154
  get apiVersions() {
108
155
  if (!this.versions) {
109
- throw new Error("API client not initialized. Call initialize() before accessing apiVersions.");
156
+ throw new Error("API versions have not been discovered yet. They are fetched on the first request.");
110
157
  }
111
158
  return this.versions;
112
159
  }
160
+ /**
161
+ * Substitute the discovered versions into a path built by lp(), le(), or
162
+ * leGlobal(), discovering them first if no request has yet.
163
+ *
164
+ * A path that carries no placeholder is returned untouched and costs
165
+ * nothing: a bookmark page whose URL came back fully resolved from D2L
166
+ * does not trigger a discovery of its own.
167
+ */
168
+ async resolvePath(path) {
169
+ if (!path.includes(LP_VERSION) && !path.includes(LE_VERSION))
170
+ return path;
171
+ const { lp, le } = await this.ensureVersions();
172
+ return path.split(LP_VERSION).join(lp).split(LE_VERSION).join(le);
173
+ }
113
174
  /**
114
175
  * Make a GET request to the D2L API.
115
176
  *
@@ -120,12 +181,19 @@ export class D2LApiClient {
120
181
  * @throws NetworkError on network/fetch failures
121
182
  */
122
183
  async get(path, options) {
123
- // Check cache first
184
+ // Checked before the path is resolved, and keyed by the path as the caller
185
+ // wrote it, so a cached read needs neither version discovery nor a token.
124
186
  if (options?.ttl && this.cache.has(path)) {
125
187
  log("DEBUG", `Cache hit: ${path}`);
126
188
  return this.cache.get(path);
127
189
  }
128
- return this.withAuthentication(path, token => this.makeRequest(path, token, options));
190
+ const resolved = await this.resolvePath(path);
191
+ const data = await this.withAuthentication(resolved, token => this.makeRequest(resolved, token));
192
+ if (options?.ttl) {
193
+ this.cache.set(path, data, options.ttl);
194
+ log("DEBUG", `Cached response for ${path} (TTL: ${options.ttl}ms)`);
195
+ }
196
+ return data;
129
197
  }
130
198
  /**
131
199
  * Make a GET request to the D2L API and return raw Response object.
@@ -138,7 +206,8 @@ export class D2LApiClient {
138
206
  * @throws NetworkError on network/fetch failures
139
207
  */
140
208
  async getRaw(path) {
141
- return this.withAuthentication(path, token => this.makeRawRequest(path, token));
209
+ const resolved = await this.resolvePath(path);
210
+ return this.withAuthentication(resolved, token => this.makeRawRequest(resolved, token));
142
211
  }
143
212
  /** One HTTP refresh and at most one browser login per caller. */
144
213
  async withAuthentication(path, request) {
@@ -204,12 +273,12 @@ export class D2LApiClient {
204
273
  }
205
274
  log("WARN", "Auto-reauthentication did not produce a valid token");
206
275
  }
207
- throw new ApiError(401, path, "Session expired. Please re-authenticate via brightspace-auth.");
276
+ throw new ApiError(401, path, `Session expired. Please re-authenticate via ${AUTH_COMMAND}.`);
208
277
  }
209
278
  /**
210
279
  * Make one HTTP request. Authentication recovery is shared with raw downloads.
211
280
  */
212
- async makeRequest(path, token, options) {
281
+ async makeRequest(path, token) {
213
282
  const url = `${this.baseUrl}${path}`;
214
283
  const headers = this.buildAuthHeaders(token);
215
284
  try {
@@ -253,14 +322,10 @@ export class D2LApiClient {
253
322
  // marker still parses, so it can never be misread as a dead session.
254
323
  if (isExpiredSessionRedirect(responseBody, this.baseUrl)) {
255
324
  log("DEBUG", "Response carried the session-expired stub, treating it as a 401");
256
- throw new ApiError(401, path, "Session expired. Please re-authenticate via brightspace-auth.");
325
+ throw new ApiError(401, path, `Session expired. Please re-authenticate via ${AUTH_COMMAND}.`);
257
326
  }
258
327
  throw new ApiError(response.status, path, `Expected JSON from ${path} but the body did not parse`);
259
328
  }
260
- if (options?.ttl) {
261
- this.cache.set(path, data, options.ttl);
262
- log("DEBUG", `Cached response for ${path} (TTL: ${options.ttl}ms)`);
263
- }
264
329
  return data;
265
330
  }
266
331
  catch (error) {
@@ -322,7 +387,7 @@ export class D2LApiClient {
322
387
  const body = await response.text();
323
388
  if (isExpiredSessionRedirect(body, this.baseUrl)) {
324
389
  log("DEBUG", "File download answered with the session-expired stub, treating it as a 401");
325
- throw new ApiError(401, path, "Session expired. Please re-authenticate via brightspace-auth.");
390
+ throw new ApiError(401, path, `Session expired. Please re-authenticate via ${AUTH_COMMAND}.`);
326
391
  }
327
392
  // A legitimate HTML page: hand back an equivalent response with the
328
393
  // body we already consumed.
@@ -370,31 +435,32 @@ export class D2LApiClient {
370
435
  }
371
436
  /**
372
437
  * Build path for LP (Learning Platform) API endpoints.
438
+ *
439
+ * The version is left as a placeholder and substituted by get() or getRaw()
440
+ * once it has been discovered. See LP_VERSION above.
441
+ *
373
442
  * @param path - Path within LP API (e.g., "/users/whoami")
374
- * @returns Full versioned path (e.g., "/d2l/api/lp/1.56/users/whoami")
443
+ * @returns Versioned path template (e.g., "/d2l/api/lp/{lp}/users/whoami")
375
444
  */
376
445
  lp(path) {
377
- const { lp } = this.apiVersions;
378
- return `/d2l/api/lp/${lp}${path}`;
446
+ return `/d2l/api/lp/${LP_VERSION}${path}`;
379
447
  }
380
448
  /**
381
449
  * Build path for LE (Learning Environment) API endpoints with orgUnitId.
382
450
  * @param orgUnitId - Organizational unit ID (course ID)
383
451
  * @param path - Path within LE API (e.g., "/content/root/")
384
- * @returns Full versioned path (e.g., "/d2l/api/le/1.91/123456/content/root/")
452
+ * @returns Versioned path template (e.g., "/d2l/api/le/{le}/123456/content/root/")
385
453
  */
386
454
  le(orgUnitId, path) {
387
- const { le } = this.apiVersions;
388
- return `/d2l/api/le/${le}/${orgUnitId}${path}`;
455
+ return `/d2l/api/le/${LE_VERSION}/${orgUnitId}${path}`;
389
456
  }
390
457
  /**
391
458
  * Build path for global LE (Learning Environment) API endpoints without orgUnitId.
392
459
  * @param path - Path within LE API (e.g., "/enrollments/myenrollments/")
393
- * @returns Full versioned path (e.g., "/d2l/api/le/1.91/enrollments/myenrollments/")
460
+ * @returns Versioned path template (e.g., "/d2l/api/le/{le}/enrollments/myenrollments/")
394
461
  */
395
462
  leGlobal(path) {
396
- const { le } = this.apiVersions;
397
- return `/d2l/api/le/${le}${path}`;
463
+ return `/d2l/api/le/${LE_VERSION}${path}`;
398
464
  }
399
465
  /**
400
466
  * Clear all cached responses.
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/api/client.ts"],"names":[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mCAAmC,CAAC,CAAC;QACpD,CAAC;aAAM,CAAC;YACN,oBAAoB;YACpB,OAAO,CAAC,eAAe,CAAC,GAAG,UAAU,KAAK,CAAC,WAAW,EAAE,CAAC;YACzD,GAAG,CAAC,OAAO,EAAE,mCAAmC,CAAC,CAAC;QACpD,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;IAED;;;;;;;;OAQG;IACH,EAAE,CAAC,IAAY;QACb,OAAO,eAAe,UAAU,GAAG,IAAI,EAAE,CAAC;IAC5C,CAAC;IAED;;;;;OAKG;IACH,EAAE,CAAC,SAAiB,EAAE,IAAY;QAChC,OAAO,eAAe,UAAU,IAAI,SAAS,GAAG,IAAI,EAAE,CAAC;IACzD,CAAC;IAED;;;;OAIG;IACH,QAAQ,CAAC,IAAY;QACnB,OAAO,eAAe,UAAU,GAAG,IAAI,EAAE,CAAC;IAC5C,CAAC;IAED;;OAEG;IACH,UAAU;QACR,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QACnB,GAAG,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;IAChC,CAAC;IAED;;OAEG;IACH,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;IACzB,CAAC;CACF"}
@@ -1,3 +1,11 @@
1
+ /**
2
+ * How long automatic sign-in pauses after a missed MFA prompt.
3
+ *
4
+ * Long enough to stop a hot loop of phone prompts, short enough that tapping
5
+ * the wrong number costs a coffee break rather than an afternoon. This was
6
+ * four hours, which meant one mistyped number disabled background sign-in
7
+ * until dinner, with nothing on screen explaining why.
8
+ */
1
9
  export declare const MFA_COOLDOWN_MS: number;
2
10
  export declare class AuthenticationCooldownError extends Error {
3
11
  readonly retryAt: number;
@@ -1 +1 @@
1
- {"version":3,"file":"auth-cooldown.d.ts","sourceRoot":"","sources":["../../src/auth/auth-cooldown.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,eAAe,QAAqB,CAAC;AAElD,qBAAa,2BAA4B,SAAQ,KAAK;aAExB,OAAO,EAAE,MAAM;IAD3C,QAAQ,CAAC,IAAI,mBAAmB;gBACJ,OAAO,EAAE,MAAM;CAI5C;AAED,kFAAkF;AAClF,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAS;gBAClB,UAAU,EAAE,MAAM;IAIxB,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;IAY9B,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC;IAIjC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;YAId,KAAK;CAMpB"}
1
+ {"version":3,"file":"auth-cooldown.d.ts","sourceRoot":"","sources":["../../src/auth/auth-cooldown.ts"],"names":[],"mappings":"AAKA;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,QAAgB,CAAC;AAE7C,qBAAa,2BAA4B,SAAQ,KAAK;aAExB,OAAO,EAAE,MAAM;IAD3C,QAAQ,CAAC,IAAI,mBAAmB;gBACJ,OAAO,EAAE,MAAM;CAU5C;AAED,kFAAkF;AAClF,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAS;gBAClB,UAAU,EAAE,MAAM;IAIxB,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;IAY9B,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC;IAIjC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;YAId,KAAK;CAMpB"}
@@ -1,12 +1,25 @@
1
1
  import * as fs from "node:fs/promises";
2
2
  import * as path from "node:path";
3
3
  import { randomUUID } from "node:crypto";
4
- export const MFA_COOLDOWN_MS = 4 * 60 * 60 * 1000;
4
+ import { AUTH_COMMAND } from "../utils/commands.js";
5
+ /**
6
+ * How long automatic sign-in pauses after a missed MFA prompt.
7
+ *
8
+ * Long enough to stop a hot loop of phone prompts, short enough that tapping
9
+ * the wrong number costs a coffee break rather than an afternoon. This was
10
+ * four hours, which meant one mistyped number disabled background sign-in
11
+ * until dinner, with nothing on screen explaining why.
12
+ */
13
+ export const MFA_COOLDOWN_MS = 5 * 60 * 1000;
5
14
  export class AuthenticationCooldownError extends Error {
6
15
  retryAt;
7
16
  code = "AUTH_COOLDOWN";
8
17
  constructor(retryAt) {
9
- super(`A previous MFA attempt failed. Automatic login resumes at ${new Date(retryAt).toISOString()}. Run brightspace-auth to retry now.`);
18
+ // Say it the way a person would. A timestamp tells someone staring at a
19
+ // stalled chat window nothing they can act on.
20
+ const minutes = Math.max(1, Math.ceil((retryAt - Date.now()) / 60000));
21
+ super(`The last sign-in prompt was not approved, so automatic sign-in is paused for ${minutes} more minute${minutes === 1 ? "" : "s"}. ` +
22
+ `To sign in right now, run this in a terminal: ${AUTH_COMMAND}`);
10
23
  this.retryAt = retryAt;
11
24
  this.name = "AuthenticationCooldownError";
12
25
  }
@@ -1 +1 @@
1
- {"version":3,"file":"auth-cooldown.js","sourceRoot":"","sources":["../../src/auth/auth-cooldown.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAElD,MAAM,OAAO,2BAA4B,SAAQ,KAAK;IAExB;IADnB,IAAI,GAAG,eAAe,CAAC;IAChC,YAA4B,OAAe;QACzC,KAAK,CAAC,6DAA6D,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,sCAAsC,CAAC,CAAC;QADhH,YAAO,GAAP,OAAO,CAAQ;QAEzC,IAAI,CAAC,IAAI,GAAG,6BAA6B,CAAC;IAC5C,CAAC;CACF;AAED,kFAAkF;AAClF,MAAM,OAAO,YAAY;IACN,IAAI,CAAS;IAC9B,YAAY,UAAkB;QAC5B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE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IAAI,CAAC,IAAI,CAAC,CAAC;IACxC,CAAC;CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"auth-lock.d.ts","sourceRoot":"","sources":["../../src/auth/auth-lock.ts"],"names":[],"mappings":"AAKA,qBAAa,6BAA8B,SAAQ,KAAK;IACtD,QAAQ,CAAC,IAAI,sBAAsB;;CAKpC;AAoDD,2EAA2E;AAC3E,wBAAsB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,CAIvF"}
1
+ {"version":3,"file":"auth-lock.d.ts","sourceRoot":"","sources":["../../src/auth/auth-lock.ts"],"names":[],"mappings":"AAwCA,qBAAa,6BAA8B,SAAQ,KAAK;IACtD,QAAQ,CAAC,IAAI,sBAAsB;;CAKpC;AA2DD,2EAA2E;AAC3E,wBAAsB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,CAIvF"}