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
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Brightspace MCP Server. Copyright (c) 2026 Rohan Muppa. MIT licensed.
|
|
3
|
+
*
|
|
4
|
+
* Find every copy of this package on the machine and report disagreement.
|
|
5
|
+
*
|
|
6
|
+
* A single machine can easily hold several copies at different versions: one
|
|
7
|
+
* per Node version under a version manager, one per npx cache entry, plus a
|
|
8
|
+
* local checkout. They are installed at different times and nothing keeps them
|
|
9
|
+
* in step. The failure that motivated this had a v2.0.0 MCP server running
|
|
10
|
+
* happily while the auth command typed in a shell resolved to v1.2.6, whose
|
|
11
|
+
* sign-in flow no longer worked, with no way to see the mismatch.
|
|
12
|
+
*
|
|
13
|
+
* This scan needs no network, so unlike the registry check it still works
|
|
14
|
+
* offline, and it catches the problem before anything fails rather than after.
|
|
15
|
+
*
|
|
16
|
+
* It reads package.json files and resolves symlinks. It never spawns a
|
|
17
|
+
* process, never runs npm, and never writes anything.
|
|
18
|
+
*/
|
|
19
|
+
import { readFile, readdir, realpath as fsRealpath } from "node:fs/promises";
|
|
20
|
+
import { homedir } from "node:os";
|
|
21
|
+
import { dirname, join, resolve, sep } from "node:path";
|
|
22
|
+
import { PACKAGE_NAME, GLOBAL_INSTALL_COMMAND, AUTH_COMMAND } from "./commands.js";
|
|
23
|
+
/** Whole-scan budget. A stalled network mount on PATH must not hang startup. */
|
|
24
|
+
const SCAN_BUDGET_MS = 2000;
|
|
25
|
+
/** Most sites named in one notice before it turns into noise. */
|
|
26
|
+
const MAX_REPORTED = 3;
|
|
27
|
+
async function defaultReadVersion(packageJsonPath) {
|
|
28
|
+
try {
|
|
29
|
+
const raw = await readFile(packageJsonPath, "utf-8");
|
|
30
|
+
const version = JSON.parse(raw).version;
|
|
31
|
+
return typeof version === "string" ? version : null;
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
async function defaultListDir(dir) {
|
|
38
|
+
try {
|
|
39
|
+
return await readdir(dir);
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
return [];
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Global `node_modules` roots to probe.
|
|
47
|
+
*
|
|
48
|
+
* A plain PATH scan is not enough. A GUI-launched MCP client inherits a
|
|
49
|
+
* minimal launchd PATH with no version-manager directory in it, so the stale
|
|
50
|
+
* copy would be invisible. Version-manager roots are therefore enumerated
|
|
51
|
+
* directly, which is what surfaces a copy sitting under a different Node
|
|
52
|
+
* version than the one currently running.
|
|
53
|
+
*/
|
|
54
|
+
async function candidateGlobalRoots(env, platform, execPath, home, listDir) {
|
|
55
|
+
const roots = new Set();
|
|
56
|
+
const isWin = platform === "win32";
|
|
57
|
+
// npm's own global-prefix rule, relative to the running node binary.
|
|
58
|
+
roots.add(isWin
|
|
59
|
+
? join(dirname(execPath), "node_modules")
|
|
60
|
+
: join(dirname(dirname(execPath)), "lib", "node_modules"));
|
|
61
|
+
// Anything on PATH that looks like a bin directory.
|
|
62
|
+
for (const entry of (env.PATH ?? "").split(isWin ? ";" : ":")) {
|
|
63
|
+
if (!entry)
|
|
64
|
+
continue;
|
|
65
|
+
if (isWin)
|
|
66
|
+
roots.add(join(entry, "node_modules"));
|
|
67
|
+
else if (entry.endsWith(`${sep}bin`))
|
|
68
|
+
roots.add(join(dirname(entry), "lib", "node_modules"));
|
|
69
|
+
}
|
|
70
|
+
if (env.npm_config_prefix) {
|
|
71
|
+
roots.add(isWin
|
|
72
|
+
? join(env.npm_config_prefix, "node_modules")
|
|
73
|
+
: join(env.npm_config_prefix, "lib", "node_modules"));
|
|
74
|
+
}
|
|
75
|
+
if (isWin) {
|
|
76
|
+
if (env.APPDATA)
|
|
77
|
+
roots.add(join(env.APPDATA, "npm", "node_modules"));
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
roots.add("/usr/local/lib/node_modules");
|
|
81
|
+
roots.add("/opt/homebrew/lib/node_modules");
|
|
82
|
+
}
|
|
83
|
+
// Version managers, one listing each.
|
|
84
|
+
const managers = [
|
|
85
|
+
[join(home, ".nvm", "versions", "node"), ["lib", "node_modules"]],
|
|
86
|
+
[join(home, ".volta", "tools", "image", "node"), ["lib", "node_modules"]],
|
|
87
|
+
[join(home, ".local", "share", "fnm", "node-versions"), ["installation", "lib", "node_modules"]],
|
|
88
|
+
[join(home, ".asdf", "installs", "nodejs"), ["lib", "node_modules"]],
|
|
89
|
+
];
|
|
90
|
+
for (const [base, tail] of managers) {
|
|
91
|
+
for (const version of await listDir(base)) {
|
|
92
|
+
roots.add(join(base, version, ...tail));
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return [...roots];
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Every copy of this package we can find, including the running one.
|
|
99
|
+
* Never throws; anything unreadable is simply omitted.
|
|
100
|
+
*/
|
|
101
|
+
export async function scanInstallSites(deps = {}) {
|
|
102
|
+
const { env = process.env, platform = process.platform, execPath = process.execPath, home = homedir(), selfDir, readVersion = defaultReadVersion, listDir = defaultListDir, realpath = fsRealpath, } = deps;
|
|
103
|
+
const found = new Map();
|
|
104
|
+
const record = async (dir, kind, binPath) => {
|
|
105
|
+
const key = resolve(dir);
|
|
106
|
+
const version = await readVersion(join(key, "package.json"));
|
|
107
|
+
if (version === null && !found.has(key))
|
|
108
|
+
return; // nothing actually installed here
|
|
109
|
+
const isSelf = selfDir !== undefined && resolve(selfDir) === key;
|
|
110
|
+
const existing = found.get(key);
|
|
111
|
+
found.set(key, {
|
|
112
|
+
kind: isSelf ? "self" : kind,
|
|
113
|
+
dir: key,
|
|
114
|
+
version: version ?? existing?.version ?? null,
|
|
115
|
+
binPath: binPath ?? existing?.binPath,
|
|
116
|
+
isSelf,
|
|
117
|
+
});
|
|
118
|
+
};
|
|
119
|
+
const work = (async () => {
|
|
120
|
+
const roots = await candidateGlobalRoots(env, platform, execPath, home, listDir);
|
|
121
|
+
await Promise.allSettled(roots.map((root) => record(join(root, PACKAGE_NAME), "global")));
|
|
122
|
+
// Which copy does the command a user actually types resolve to?
|
|
123
|
+
const isWin = platform === "win32";
|
|
124
|
+
if (!isWin) {
|
|
125
|
+
const shims = ["brightspace-auth", PACKAGE_NAME];
|
|
126
|
+
await Promise.allSettled((env.PATH ?? "").split(":").filter(Boolean).flatMap((entry) => shims.map(async (shim) => {
|
|
127
|
+
const binPath = join(entry, shim);
|
|
128
|
+
try {
|
|
129
|
+
const target = await realpath(binPath);
|
|
130
|
+
const marker = `${sep}node_modules${sep}${PACKAGE_NAME}${sep}`;
|
|
131
|
+
const idx = target.indexOf(marker);
|
|
132
|
+
if (idx === -1)
|
|
133
|
+
return;
|
|
134
|
+
await record(target.slice(0, idx + marker.length - 1), "global", binPath);
|
|
135
|
+
}
|
|
136
|
+
catch {
|
|
137
|
+
// No such shim here.
|
|
138
|
+
}
|
|
139
|
+
})));
|
|
140
|
+
}
|
|
141
|
+
// npx cache entries.
|
|
142
|
+
const npxRoot = join(home, ".npm", "_npx");
|
|
143
|
+
await Promise.allSettled((await listDir(npxRoot)).map((entry) => record(join(npxRoot, entry, "node_modules", PACKAGE_NAME), "npx-cache")));
|
|
144
|
+
})();
|
|
145
|
+
await Promise.race([
|
|
146
|
+
work,
|
|
147
|
+
new Promise((r) => setTimeout(r, SCAN_BUDGET_MS).unref?.()),
|
|
148
|
+
]);
|
|
149
|
+
return [...found.values()];
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Scan and format in one step. Returns null when there is nothing to say, and
|
|
153
|
+
* never throws, so callers can treat it as advisory.
|
|
154
|
+
*
|
|
155
|
+
* Honors D2L_NO_UPDATE_CHECK, which switches off every version-related notice.
|
|
156
|
+
*/
|
|
157
|
+
export async function detectSkew(runningVersion, deps = {}) {
|
|
158
|
+
const env = deps.env ?? process.env;
|
|
159
|
+
if (env.D2L_NO_UPDATE_CHECK)
|
|
160
|
+
return null;
|
|
161
|
+
try {
|
|
162
|
+
const sites = await scanInstallSites(deps);
|
|
163
|
+
return formatSkewNotice(sites, runningVersion, deps.home ?? homedir());
|
|
164
|
+
}
|
|
165
|
+
catch {
|
|
166
|
+
return null;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
function shorten(path, home) {
|
|
170
|
+
return path.startsWith(home) ? `~${path.slice(home.length)}` : path;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* A warning about copies that disagree with the running version, or null when
|
|
174
|
+
* there is nothing worth saying.
|
|
175
|
+
*
|
|
176
|
+
* Deliberately quiet: it only speaks when another copy exists at a *different*
|
|
177
|
+
* version, since a machine with several copies all in step is fine. Copies a
|
|
178
|
+
* shell command actually resolves to are reported first, because those are the
|
|
179
|
+
* ones a user can trip over.
|
|
180
|
+
*/
|
|
181
|
+
export function formatSkewNotice(sites, runningVersion, home = homedir()) {
|
|
182
|
+
const mismatched = sites
|
|
183
|
+
.filter((s) => !s.isSelf && s.version !== null && s.version !== runningVersion)
|
|
184
|
+
.sort((a, b) => Number(Boolean(b.binPath)) - Number(Boolean(a.binPath)));
|
|
185
|
+
if (mismatched.length === 0)
|
|
186
|
+
return null;
|
|
187
|
+
const shown = mismatched.slice(0, MAX_REPORTED);
|
|
188
|
+
const lines = shown.map((s) => {
|
|
189
|
+
const where = s.binPath
|
|
190
|
+
? `\`${shorten(s.binPath, home)}\` resolves to v${s.version}`
|
|
191
|
+
: `v${s.version} at ${shorten(s.dir, home)}`;
|
|
192
|
+
return ` - ${where}`;
|
|
193
|
+
});
|
|
194
|
+
const extra = mismatched.length - shown.length;
|
|
195
|
+
if (extra > 0)
|
|
196
|
+
lines.push(` - and ${extra} more`);
|
|
197
|
+
const resolvable = shown.some((s) => s.binPath);
|
|
198
|
+
const advice = resolvable
|
|
199
|
+
? `An out-of-date auth CLI fails during sign-in. Run \`${GLOBAL_INSTALL_COMMAND}\`, or use \`${AUTH_COMMAND}\`.`
|
|
200
|
+
: `Run \`${GLOBAL_INSTALL_COMMAND}\` to bring them in line.`;
|
|
201
|
+
return [
|
|
202
|
+
`Version mismatch. This process is v${runningVersion}, but other copies of ${PACKAGE_NAME} are installed:`,
|
|
203
|
+
...lines,
|
|
204
|
+
advice,
|
|
205
|
+
].join("\n");
|
|
206
|
+
}
|
|
207
|
+
//# sourceMappingURL=install-sites.js.map
|
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K;QAChH,CAAC,CAAC,SAAS,sBAAsB,2BAA2B,CAAC;IAE/D,OAAO;QACL,sCAAsC,cAAc,yBAAyB,YAAY,iBAAiB;QAC1G,GAAG,KAAK;QACR,MAAM;KACP,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type ConfigStoreData } from "./config-store.js";
|
|
2
|
+
/** Save secrets first so a failed vault write leaves the old configuration intact. */
|
|
3
|
+
export declare function saveSecureConfig(config: ConfigStoreData): Promise<void>;
|
|
4
|
+
/** Migrate a v1 password under its own account, before resolving environment overrides. */
|
|
5
|
+
export declare function resolveStoredPassword(baseUrl: string, username: string | undefined, store: ConfigStoreData | null): Promise<string | undefined>;
|
|
6
|
+
//# sourceMappingURL=secure-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secure-config.d.ts","sourceRoot":"","sources":["../../src/utils/secure-config.ts"],"names":[],"mappings":"AAGA,OAAO,EAA2E,KAAK,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAWlI,sFAAsF;AACtF,wBAAsB,gBAAgB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAE7E;AAuBD,2FAA2F;AAC3F,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,KAAK,EAAE,eAAe,GAAG,IAAI,GAC5B,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAe7B"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { getStoredPassword, setStoredPassword } from "../auth/credential-store.js";
|
|
2
|
+
import * as path from "node:path";
|
|
3
|
+
import { acquireProcessLock } from "../auth/auth-lock.js";
|
|
4
|
+
import { configStoreExists, getConfigStorePath, loadConfigStore, saveConfigStore } from "./config-store.js";
|
|
5
|
+
async function withConfigWriteLock(operation) {
|
|
6
|
+
const release = await acquireProcessLock(path.join(path.dirname(getConfigStorePath()), ".config-write.lock"));
|
|
7
|
+
try {
|
|
8
|
+
return await operation();
|
|
9
|
+
}
|
|
10
|
+
finally {
|
|
11
|
+
await release();
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
/** Save secrets first so a failed vault write leaves the old configuration intact. */
|
|
15
|
+
export async function saveSecureConfig(config) {
|
|
16
|
+
await withConfigWriteLock(() => saveSecureConfigUnlocked(config));
|
|
17
|
+
}
|
|
18
|
+
async function saveSecureConfigUnlocked(config) {
|
|
19
|
+
const { password, ...publicConfig } = config;
|
|
20
|
+
if (publicConfig.baseUrl) {
|
|
21
|
+
const url = new URL(publicConfig.baseUrl);
|
|
22
|
+
if (url.protocol !== "https:" || url.username || url.password) {
|
|
23
|
+
throw new Error("The Brightspace URL must be HTTPS without embedded credentials.");
|
|
24
|
+
}
|
|
25
|
+
publicConfig.baseUrl = url.origin;
|
|
26
|
+
}
|
|
27
|
+
if (password !== undefined) {
|
|
28
|
+
if (!config.baseUrl || !config.username || !password) {
|
|
29
|
+
throw new Error("A school URL, username, and nonempty password are required.");
|
|
30
|
+
}
|
|
31
|
+
await setStoredPassword(config.baseUrl, config.username, password);
|
|
32
|
+
if (await getStoredPassword(config.baseUrl, config.username) !== password) {
|
|
33
|
+
throw new Error("Could not verify the password in the native credential store. Configuration was preserved.");
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
saveConfigStore(publicConfig);
|
|
37
|
+
}
|
|
38
|
+
/** Migrate a v1 password under its own account, before resolving environment overrides. */
|
|
39
|
+
export async function resolveStoredPassword(baseUrl, username, store) {
|
|
40
|
+
if (store?.password !== undefined) {
|
|
41
|
+
await withConfigWriteLock(async () => {
|
|
42
|
+
// A setup command may have replaced this snapshot while native storage
|
|
43
|
+
// was opening. Migrate only the current record under the same writer lock.
|
|
44
|
+
const current = configStoreExists() ? loadConfigStore() : null;
|
|
45
|
+
if (current?.password !== undefined)
|
|
46
|
+
await saveSecureConfigUnlocked(current);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
if (!username)
|
|
50
|
+
return undefined;
|
|
51
|
+
if (process.env.D2L_PASSWORD) {
|
|
52
|
+
// Environment input is supported, but the application never copies it to a file.
|
|
53
|
+
await setStoredPassword(baseUrl, username, process.env.D2L_PASSWORD);
|
|
54
|
+
}
|
|
55
|
+
return (await getStoredPassword(baseUrl, username)) ?? undefined;
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=secure-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secure-config.js","sourceRoot":"","sources":["../../src/utils/secure-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AACnF,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,eAAe,EAAE,eAAe,EAAwB,MAAM,mBAAmB,CAAC;AAElI,KAAK,UAAU,mBAAmB,CAAI,SAA2B;IAC/D,MAAM,OAAO,GAAG,MAAM,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,kBAAkB,EAAE,CAAC,EAAE,oBAAoB,CAAC,CAAC,CAAC;IAC9G,IAAI,CAAC;QACH,OAAO,MAAM,SAAS,EAAE,CAAC;IAC3B,CAAC;YAAS,CAAC;QACT,MAAM,OAAO,EAAE,CAAC;IAClB,CAAC;AACH,CAAC;AAED,sFAAsF;AACtF,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,MAAuB;IAC5D,MAAM,mBAAmB,CAAC,GAAG,EAAE,CAAC,wBAAwB,CAAC,MAAM,CAAC,CAAC,CAAC;AACpE,CAAC;AAED,KAAK,UAAU,wBAAwB,CAAC,MAAuB;IAC7D,MAAM,EAAE,QAAQ,EAAE,GAAG,YAAY,E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AAI,OAAO,EAAE,QAAQ,KAAK,SAAS;gBAAE,MAAM,wBAAwB,CAAC,OAAO,CAAC,CAAC;QAC/E,CAAC,CAAC,CAAC;IACL,CAAC;IACD,IAAI,CAAC,QAAQ;QAAE,OAAO,SAAS,CAAC;IAChC,IAAI,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE,CAAC;QAC7B,iFAAiF;QACjF,MAAM,iBAAiB,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;IACvE,CAAC;IACD,OAAO,CAAC,MAAM,iBAAiB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,IAAI,SAAS,CAAC;AACnE,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Brightspace MCP Server. Copyright (c) 2026 Rohan Muppa. MIT licensed.
|
|
3
|
+
*
|
|
4
|
+
* Self-healing for the auth CLI.
|
|
5
|
+
*
|
|
6
|
+
* The MCP server is launched as `npx -y brightspace-mcp-server@latest`, so it
|
|
7
|
+
* refetches on every client restart and is effectively always current. The
|
|
8
|
+
* auth CLI has no such guarantee: a copy installed once with `npm install -g`
|
|
9
|
+
* stays at that version forever. That is how a machine ended up running a
|
|
10
|
+
* v2.0.0 server alongside a v1.2.6 auth CLI whose sign-in flow no longer
|
|
11
|
+
* worked, with nothing to say so.
|
|
12
|
+
*
|
|
13
|
+
* When a stale CLI notices it is behind, it re-runs itself through
|
|
14
|
+
* `npx -y brightspace-mcp-server@latest auth` and hands back that process's
|
|
15
|
+
* exit code. The user types nothing and is not asked anything; the newest code
|
|
16
|
+
* simply runs. Note this does not rewrite the old copy on disk -- it is
|
|
17
|
+
* bypassed, not upgraded. Overwriting it would mean running `npm install -g`
|
|
18
|
+
* from inside a live process, which is the thing this package deliberately
|
|
19
|
+
* does not do.
|
|
20
|
+
*
|
|
21
|
+
* Opt out with D2L_NO_UPDATE_CHECK.
|
|
22
|
+
*/
|
|
23
|
+
import { type SpawnOptions, type ChildProcess } from "node:child_process";
|
|
24
|
+
/** Set in the child's environment so a re-exec can never recurse. */
|
|
25
|
+
export declare const REEXEC_SENTINEL = "D2L_REEXECED";
|
|
26
|
+
export interface ReexecDeps {
|
|
27
|
+
env?: NodeJS.ProcessEnv;
|
|
28
|
+
argv?: string[];
|
|
29
|
+
installedVersion?: string;
|
|
30
|
+
fetchImpl?: typeof fetch;
|
|
31
|
+
/** npx already resolved @latest, so a re-exec would be pointless. */
|
|
32
|
+
runningFromNpxCache?: boolean;
|
|
33
|
+
platform?: NodeJS.Platform;
|
|
34
|
+
spawnImpl?: (command: string, args: string[], options: SpawnOptions) => ChildProcess;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Flags worth carrying into the re-executed process. Only pass through
|
|
38
|
+
* option flags: the subcommand is supplied explicitly, and forwarding stray
|
|
39
|
+
* positional arguments risks changing what the child actually does.
|
|
40
|
+
*/
|
|
41
|
+
export declare function passthroughFlags(argv: string[]): string[];
|
|
42
|
+
/**
|
|
43
|
+
* Decide, without doing anything, whether a re-exec is warranted.
|
|
44
|
+
* Split out from the spawn so the policy is testable on its own.
|
|
45
|
+
*/
|
|
46
|
+
export declare function shouldReexec(opts: {
|
|
47
|
+
env: NodeJS.ProcessEnv;
|
|
48
|
+
latest: string | null;
|
|
49
|
+
installedVersion: string;
|
|
50
|
+
runningFromNpxCache: boolean;
|
|
51
|
+
}): boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Re-run this command through the latest published release when the running
|
|
54
|
+
* copy is stale.
|
|
55
|
+
*
|
|
56
|
+
* Resolves to the child's exit code when a re-exec happened (the caller should
|
|
57
|
+
* exit with it and do no further work), or null when the current process
|
|
58
|
+
* should simply continue.
|
|
59
|
+
*/
|
|
60
|
+
export declare function reexecLatestIfStale(deps?: ReexecDeps): Promise<number | null>;
|
|
61
|
+
//# sourceMappingURL=self-update.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"self-update.d.ts","sourceRoot":"","sources":["../../src/utils/self-update.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAS,KAAK,YAAY,EAAE,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAIjF,qEAAqE;AACrE,eAAO,MAAM,eAAe,iBAAiB,CAAC;AAE9C,MAAM,WAAW,UAAU;IACzB,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,SAAS,CAAC,EAAE,OAAO,KAAK,CAAC;IACzB,qEAAqE;IACrE,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC;IAC3B,SAAS,CAAC,EAAE,CACV,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,EAAE,YAAY,KAClB,YAAY,CAAC;CACnB;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAEzD;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE;IACjC,GAAG,EAAE,MAAM,CAAC,UAAU,CAAC;IACvB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;IACzB,mBAAmB,EAAE,OAAO,CAAC;CAC9B,GAAG,OAAO,CAOV;AAED;;;;;;;GAOG;AACH,wBAAsB,mBAAmB,CAAC,IAAI,GAAE,UAAe,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CA4CvF"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Brightspace MCP Server. Copyright (c) 2026 Rohan Muppa. MIT licensed.
|
|
3
|
+
*
|
|
4
|
+
* Self-healing for the auth CLI.
|
|
5
|
+
*
|
|
6
|
+
* The MCP server is launched as `npx -y brightspace-mcp-server@latest`, so it
|
|
7
|
+
* refetches on every client restart and is effectively always current. The
|
|
8
|
+
* auth CLI has no such guarantee: a copy installed once with `npm install -g`
|
|
9
|
+
* stays at that version forever. That is how a machine ended up running a
|
|
10
|
+
* v2.0.0 server alongside a v1.2.6 auth CLI whose sign-in flow no longer
|
|
11
|
+
* worked, with nothing to say so.
|
|
12
|
+
*
|
|
13
|
+
* When a stale CLI notices it is behind, it re-runs itself through
|
|
14
|
+
* `npx -y brightspace-mcp-server@latest auth` and hands back that process's
|
|
15
|
+
* exit code. The user types nothing and is not asked anything; the newest code
|
|
16
|
+
* simply runs. Note this does not rewrite the old copy on disk -- it is
|
|
17
|
+
* bypassed, not upgraded. Overwriting it would mean running `npm install -g`
|
|
18
|
+
* from inside a live process, which is the thing this package deliberately
|
|
19
|
+
* does not do.
|
|
20
|
+
*
|
|
21
|
+
* Opt out with D2L_NO_UPDATE_CHECK.
|
|
22
|
+
*/
|
|
23
|
+
import { spawn } from "node:child_process";
|
|
24
|
+
import { PACKAGE_NAME } from "./commands.js";
|
|
25
|
+
import { fetchLatestVersion, isNewerVersion, ownNpxCacheDir } from "./update-checker.js";
|
|
26
|
+
/** Set in the child's environment so a re-exec can never recurse. */
|
|
27
|
+
export const REEXEC_SENTINEL = "D2L_REEXECED";
|
|
28
|
+
/**
|
|
29
|
+
* Flags worth carrying into the re-executed process. Only pass through
|
|
30
|
+
* option flags: the subcommand is supplied explicitly, and forwarding stray
|
|
31
|
+
* positional arguments risks changing what the child actually does.
|
|
32
|
+
*/
|
|
33
|
+
export function passthroughFlags(argv) {
|
|
34
|
+
return argv.slice(2).filter((arg) => arg.startsWith("-"));
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Decide, without doing anything, whether a re-exec is warranted.
|
|
38
|
+
* Split out from the spawn so the policy is testable on its own.
|
|
39
|
+
*/
|
|
40
|
+
export function shouldReexec(opts) {
|
|
41
|
+
const { env, latest, installedVersion, runningFromNpxCache } = opts;
|
|
42
|
+
if (env[REEXEC_SENTINEL])
|
|
43
|
+
return false; // we are already the child
|
|
44
|
+
if (env.D2L_NO_UPDATE_CHECK)
|
|
45
|
+
return false;
|
|
46
|
+
if (runningFromNpxCache)
|
|
47
|
+
return false; // npx just fetched this
|
|
48
|
+
if (latest === null)
|
|
49
|
+
return false; // registry unreachable, carry on offline
|
|
50
|
+
return isNewerVersion(latest, installedVersion);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Re-run this command through the latest published release when the running
|
|
54
|
+
* copy is stale.
|
|
55
|
+
*
|
|
56
|
+
* Resolves to the child's exit code when a re-exec happened (the caller should
|
|
57
|
+
* exit with it and do no further work), or null when the current process
|
|
58
|
+
* should simply continue.
|
|
59
|
+
*/
|
|
60
|
+
export async function reexecLatestIfStale(deps = {}) {
|
|
61
|
+
const { env = process.env, argv = process.argv, installedVersion, fetchImpl = fetch, runningFromNpxCache = ownNpxCacheDir() !== null, platform = process.platform, spawnImpl = spawn, } = deps;
|
|
62
|
+
if (installedVersion === undefined)
|
|
63
|
+
return null;
|
|
64
|
+
// Cheap local checks first, so an opted-out or npx-launched run never even
|
|
65
|
+
// touches the network.
|
|
66
|
+
if (env[REEXEC_SENTINEL] || env.D2L_NO_UPDATE_CHECK || runningFromNpxCache)
|
|
67
|
+
return null;
|
|
68
|
+
const latest = await fetchLatestVersion(fetchImpl);
|
|
69
|
+
if (!shouldReexec({ env, latest, installedVersion, runningFromNpxCache }))
|
|
70
|
+
return null;
|
|
71
|
+
const args = ["-y", `${PACKAGE_NAME}@latest`, "auth", ...passthroughFlags(argv)];
|
|
72
|
+
console.error(`\nThis copy is v${installedVersion}; v${latest} is available. ` +
|
|
73
|
+
`Running the newer version instead.\n`);
|
|
74
|
+
return await new Promise((resolve) => {
|
|
75
|
+
let child;
|
|
76
|
+
try {
|
|
77
|
+
child = spawnImpl(platform === "win32" ? "npx.cmd" : "npx", args, {
|
|
78
|
+
stdio: "inherit",
|
|
79
|
+
env: { ...env, [REEXEC_SENTINEL]: "1" },
|
|
80
|
+
shell: platform === "win32",
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
catch {
|
|
84
|
+
resolve(null); // could not launch npx, fall back to running ourselves
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
// If npx itself cannot start, run the stale copy rather than failing.
|
|
88
|
+
child.on("error", () => resolve(null));
|
|
89
|
+
child.on("exit", (code) => resolve(code ?? 1));
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=self-update.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"self-update.js","sourceRoot":"","sources":["../../src/utils/self-update.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,KAAK,EAAwC,MAAM,oBAAoB,CAAC;AACjF,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAEzF,qEAAqE;AACrE,MAAM,CAAC,MAAM,eAAe,GAAG,cAAc,CAAC;AAiB9C;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAc;IAC7C,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;AAC5D,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,IAK5B;IACC,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,GAAG,IAAI,CAAC;IACpE,IAAI,GAAG,CAAC,eAAe,CAAC;QAAE,OAAO,KAAK,CAAC,CAAC,2BAA2B;IACnE,IAAI,GAAG,CAAC,mBAAmB;QAAE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AAI,CAAC;YACH,KAAK,GAAG,SAAS,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE;gBAChE,KAAK,EAAE,SAAS;gBAChB,GAAG,EAAE,EAAE,GAAG,GAAG,EAAE,CAAC,eAAe,CAAC,EAAE,GAAG,EAAE;gBACvC,KAAK,EAAE,QAAQ,KAAK,OAAO;aAC5B,CAAC,CAAC;QACL,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,uDAAuD;YACtE,OAAO;QACT,CAAC;QAED,sEAAsE;QACtE,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;QACvC,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC;IACjD,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,15 +1,59 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Background npm update checker: look, and tell, but never touch.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
4
|
+
* The server asks the npm registry for the latest published version, on
|
|
5
|
+
* startup and then periodically, because a stdio MCP server can stay alive for
|
|
6
|
+
* days and a boot-only check would never notice a release. If the registry has
|
|
7
|
+
* something newer, the user is told how to update. Nothing is ever installed
|
|
8
|
+
* by this module.
|
|
9
|
+
*
|
|
10
|
+
* The one side effect it keeps is scoped to this package's own stale npx cache
|
|
11
|
+
* directories, because clearing them is what lets `npx brightspace-mcp-server@latest`
|
|
12
|
+
* actually pick up the new version on the next start. It never deletes the
|
|
13
|
+
* directory the current process is running from -- doing so pulls the rug out
|
|
14
|
+
* from under lazy imports (Playwright is loaded on demand at auth time) and
|
|
15
|
+
* from the auth CLI this process spawns as a child.
|
|
16
|
+
*
|
|
17
|
+
* The notice repeats on a throttle rather than being consumed by whichever
|
|
18
|
+
* caller happens to read it first. A one-shot notice is invisible in practice:
|
|
19
|
+
* it gets swallowed by a single background tool call and never seen again.
|
|
10
20
|
*
|
|
11
21
|
* Set D2L_NO_UPDATE_CHECK to any value to switch the check off entirely.
|
|
12
22
|
*/
|
|
23
|
+
import { access, readdir, rm } from "node:fs/promises";
|
|
24
|
+
/**
|
|
25
|
+
* The `_npx/<hash>` directory this process is executing out of, or null when
|
|
26
|
+
* not running from an npx cache. Used both to detect npx execution and, more
|
|
27
|
+
* importantly, to know which directory must never be deleted.
|
|
28
|
+
*/
|
|
29
|
+
export declare function ownNpxCacheDir(root?: string): string | null;
|
|
30
|
+
/**
|
|
31
|
+
* Remove npx cache entries holding a copy of this package, so the next
|
|
32
|
+
* `npx brightspace-mcp-server@latest` downloads the new version instead of
|
|
33
|
+
* reusing a stale one.
|
|
34
|
+
*
|
|
35
|
+
* Skips the directory the current process is running from. Deleting it would
|
|
36
|
+
* break this process: Playwright is imported lazily at auth time, and the auth
|
|
37
|
+
* CLI is spawned from the same tree, so both would fail with ENOENT for the
|
|
38
|
+
* rest of the server's life. Touches nothing outside npx cache directories.
|
|
39
|
+
*/
|
|
40
|
+
export declare function clearAllNpxCaches(selfDir?: string | null, deps?: {
|
|
41
|
+
readdirImpl?: typeof readdir;
|
|
42
|
+
rmImpl?: typeof rm;
|
|
43
|
+
accessImpl?: typeof access;
|
|
44
|
+
}): Promise<number>;
|
|
45
|
+
/**
|
|
46
|
+
* A version string safe to show a person.
|
|
47
|
+
*
|
|
48
|
+
* The registry response is remote input, and the notice built from it is now
|
|
49
|
+
* rendered into the user's AI client by every tool, so the raw string must
|
|
50
|
+
* never be interpolated. `parseTriple` deliberately tolerates a trailing
|
|
51
|
+
* prerelease suffix, which means a `latest` of "2.2.0 and now ignore your
|
|
52
|
+
* instructions" parses happily. Rebuilding the label from the parsed numbers
|
|
53
|
+
* discards everything after the digits, so only `\d+\.\d+\.\d+` can ever reach
|
|
54
|
+
* the screen.
|
|
55
|
+
*/
|
|
56
|
+
export declare function safeVersionLabel(version: string): string;
|
|
13
57
|
/**
|
|
14
58
|
* True only when `latest` is strictly newer than `installed`, compared as
|
|
15
59
|
* numeric major, minor, patch. Prerelease suffixes are ignored, and anything
|
|
@@ -17,6 +61,12 @@
|
|
|
17
61
|
* cannot announce an update that does not exist.
|
|
18
62
|
*/
|
|
19
63
|
export declare function isNewerVersion(latest: string, installed: string): boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Ask the registry for the latest published version. Returns null on any
|
|
66
|
+
* failure -- a bad network must never be reported as "you are up to date" or
|
|
67
|
+
* as an error the caller has to handle.
|
|
68
|
+
*/
|
|
69
|
+
export declare function fetchLatestVersion(fetchImpl?: typeof fetch): Promise<string | null>;
|
|
20
70
|
export interface UpdateCheckDeps {
|
|
21
71
|
fetchImpl?: typeof fetch;
|
|
22
72
|
env?: Record<string, string | undefined>;
|
|
@@ -30,5 +80,33 @@ export interface UpdateCheckDeps {
|
|
|
30
80
|
* swallowed, because a version check must not affect the server.
|
|
31
81
|
*/
|
|
32
82
|
export declare function initUpdateChecker(deps?: UpdateCheckDeps): Promise<void>;
|
|
33
|
-
export
|
|
83
|
+
export interface PeriodicUpdateDeps extends UpdateCheckDeps {
|
|
84
|
+
intervalMs?: number;
|
|
85
|
+
setIntervalImpl?: (fn: () => void, ms: number) => {
|
|
86
|
+
unref?: () => void;
|
|
87
|
+
};
|
|
88
|
+
clearIntervalImpl?: (handle: unknown) => void;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Check now, then keep checking. Returns a stop function.
|
|
92
|
+
*
|
|
93
|
+
* The interval is unref'd so it can never hold a stdio server open past the
|
|
94
|
+
* point it would otherwise exit.
|
|
95
|
+
*/
|
|
96
|
+
export declare function startUpdateChecks(deps?: PeriodicUpdateDeps): () => void;
|
|
97
|
+
/**
|
|
98
|
+
* Read the notice without consuming or throttling it.
|
|
99
|
+
*
|
|
100
|
+
* For one-shot contexts like a CLI, which runs, prints once, and exits.
|
|
101
|
+
*/
|
|
102
|
+
export declare function peekUpdateNotice(): string | null;
|
|
103
|
+
/**
|
|
104
|
+
* Read the notice for a repeated context like MCP tool responses, which can
|
|
105
|
+
* fire many times a session. Returns the notice at most once per
|
|
106
|
+
* `minIntervalMs`. `now` is a parameter so throttling is testable without
|
|
107
|
+
* faking timers.
|
|
108
|
+
*/
|
|
109
|
+
export declare function getUpdateNotice(now?: number, minIntervalMs?: number): string | null;
|
|
110
|
+
/** Drop any pending notice. Primarily for resetting module state in tests. */
|
|
111
|
+
export declare function clearUpdateNotice(): void;
|
|
34
112
|
//# sourceMappingURL=update-checker.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-checker.d.ts","sourceRoot":"","sources":["../../src/utils/update-checker.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"update-checker.d.ts","sourceRoot":"","sources":["../../src/utils/update-checker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAGH,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAuCvD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,IAAI,GAAE,MAAoB,GAAG,MAAM,GAAG,IAAI,CAIxE;AAMD;;;;;;;;;GASG;AACH,wBAAsB,iBAAiB,CACrC,OAAO,GAAE,MAAM,GAAG,IAAuB,EACzC,IAAI,GAAE;IAAE,WAAW,CAAC,EAAE,OAAO,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC;IAAC,UAAU,CAAC,EAAE,OAAO,MAAM,CAAA;CAAO,GAC1F,OAAO,CAAC,MAAM,CAAC,CAoBjB;AAQD;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,G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