projectionlab-mcp 1.1.0 → 1.2.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.
- package/HOW-IT-WORKS.md +2 -2
- package/MANUAL-SETUP.md +19 -13
- package/README.md +3 -2
- package/REFERENCE.md +11 -2
- package/SETUP-FOR-AGENTS.md +7 -4
- package/dist/bootstrap.js +5 -3
- package/dist/bootstrap.js.map +1 -1
- package/dist/bridge.d.ts +2 -0
- package/dist/config.d.ts +4 -0
- package/dist/config.js +41 -6
- package/dist/config.js.map +1 -1
- package/dist/errors.d.ts +6 -0
- package/dist/errors.js +10 -0
- package/dist/errors.js.map +1 -1
- package/dist/extensionBridge.d.ts +14 -1
- package/dist/extensionBridge.js +86 -26
- package/dist/extensionBridge.js.map +1 -1
- package/dist/index.js +9 -1
- package/dist/index.js.map +1 -1
- package/dist/instructions.d.ts +1 -1
- package/dist/instructions.js +1 -1
- package/dist/largeOutput.js +25 -0
- package/dist/largeOutput.js.map +1 -1
- package/dist/logger.js +11 -4
- package/dist/logger.js.map +1 -1
- package/dist/pathPatch.js +5 -0
- package/dist/pathPatch.js.map +1 -1
- package/dist/plans.d.ts +45 -10
- package/dist/plans.js +139 -42
- package/dist/plans.js.map +1 -1
- package/dist/redact.d.ts +24 -0
- package/dist/redact.js +91 -0
- package/dist/redact.js.map +1 -1
- package/dist/resources/planData.js +3 -1
- package/dist/resources/planData.js.map +1 -1
- package/dist/resources/summary.js +4 -1
- package/dist/resources/summary.js.map +1 -1
- package/dist/snapshot.js +18 -11
- package/dist/snapshot.js.map +1 -1
- package/dist/tools/clonePlan.js +3 -3
- package/dist/tools/clonePlan.js.map +1 -1
- package/dist/tools/connection.js +21 -3
- package/dist/tools/connection.js.map +1 -1
- package/dist/tools/diff.js +7 -7
- package/dist/tools/diff.js.map +1 -1
- package/dist/tools/getPlan.js +4 -4
- package/dist/tools/getPlan.js.map +1 -1
- package/dist/tools/getPlanSection.js +5 -5
- package/dist/tools/getPlanSection.js.map +1 -1
- package/dist/tools/getPlanSettings.js +3 -3
- package/dist/tools/getPlanSettings.js.map +1 -1
- package/dist/tools/restore.js +18 -1
- package/dist/tools/restore.js.map +1 -1
- package/dist/tools/snapshots.js +17 -1
- package/dist/tools/snapshots.js.map +1 -1
- package/dist/tools/updatePlanEvent.js +63 -37
- package/dist/tools/updatePlanEvent.js.map +1 -1
- package/dist/tools/updatePlanSection.js +11 -6
- package/dist/tools/updatePlanSection.js.map +1 -1
- package/dist/tools/updatePlanSettings.js +3 -3
- package/dist/tools/updatePlanSettings.js.map +1 -1
- package/dist/types/wire.d.ts +38 -2
- package/dist/types/wire.js +12 -2
- package/dist/types/wire.js.map +1 -1
- package/dist/updateCheck.d.ts +22 -0
- package/dist/updateCheck.js +58 -0
- package/dist/updateCheck.js.map +1 -0
- package/dist/versionCompare.d.ts +5 -0
- package/dist/versionCompare.js +33 -0
- package/dist/versionCompare.js.map +1 -0
- package/dist/versionNotices.d.ts +9 -0
- package/dist/versionNotices.js +46 -0
- package/dist/versionNotices.js.map +1 -0
- package/package.json +1 -1
- package/skills/projectionlab/SKILL.md +71 -28
|
@@ -6,7 +6,7 @@ import { toJson } from "../json.js";
|
|
|
6
6
|
import { log } from "../logger.js";
|
|
7
7
|
import { redactSecrets } from "../redact.js";
|
|
8
8
|
import { PLAN_SETTING_SECTIONS, applyPlanSettingChanges, planSettingChangesApplied, } from "../planSettings.js";
|
|
9
|
-
import {
|
|
9
|
+
import { resolvePlanIndex, planNotFoundError, requirePlans, } from "../plans.js";
|
|
10
10
|
export function registerUpdatePlanSettingsTool(server, bridge, snapshots) {
|
|
11
11
|
server.registerTool("projectionlab_update_plan_settings", {
|
|
12
12
|
title: "Update Plan Settings",
|
|
@@ -21,7 +21,7 @@ export function registerUpdatePlanSettingsTool(server, bridge, snapshots) {
|
|
|
21
21
|
.string()
|
|
22
22
|
.trim()
|
|
23
23
|
.min(1)
|
|
24
|
-
.describe("Plan name (case-insensitive
|
|
24
|
+
.describe("Plan name (case-insensitive; a partial match must identify exactly one plan) or exact plan ID"),
|
|
25
25
|
section: z
|
|
26
26
|
.enum(PLAN_SETTING_SECTIONS)
|
|
27
27
|
.describe("The configuration section containing the settings"),
|
|
@@ -46,7 +46,7 @@ export function registerUpdatePlanSettingsTool(server, bridge, snapshots) {
|
|
|
46
46
|
}
|
|
47
47
|
const data = await bridge.exportData({ fresh: true });
|
|
48
48
|
const plans = requirePlans(data);
|
|
49
|
-
const planIndex =
|
|
49
|
+
const planIndex = resolvePlanIndex(plans, planIdentifier);
|
|
50
50
|
if (planIndex === -1)
|
|
51
51
|
throw planNotFoundError(plans, planIdentifier);
|
|
52
52
|
const plan = plans[planIndex];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updatePlanSettings.js","sourceRoot":"","sources":["../../src/tools/updatePlanSettings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EACL,qBAAqB,EACrB,uBAAuB,EACvB,yBAAyB,GAC1B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"updatePlanSettings.js","sourceRoot":"","sources":["../../src/tools/updatePlanSettings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,WA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B,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CACxD,CAAC,IAAI,CACJ,CAAC,IAAI,EAAE,EAAE,CACP,IAAI;gBACJ,OAAO,IAAI,KAAK,QAAQ;gBACvB,IAAgB,CAAC,EAAE,KAAK,IAAI,CAAC,EAAE,CACZ,CAAC;YACzB,MAAM,QAAQ,GACZ,CAAC,CAAC,YAAY;gBACd,yBAAyB,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC;YAE5D,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,MAAM,CAAC;4BACX,OAAO,EAAE,IAAI;4BACb,QAAQ,EAAE,IAAI,CAAC,IAAI;4BACnB,OAAO;4BACP,OAAO,EAAE,aAAa,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;4BACjD,QAAQ;4BACR,UAAU,EAAE,QAAQ,CAAC,EAAE;4BACvB,OAAO,EAAE,QAAQ;gCACf,CAAC,CAAC,mEAAmE;gCACrE,CAAC,CAAC,sJAAsJ;yBAC3J,CAAC;qBACH;iBACF;aACF,CAAC;QACJ,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
package/dist/types/wire.d.ts
CHANGED
|
@@ -7,10 +7,18 @@
|
|
|
7
7
|
*
|
|
8
8
|
* Transport: JSON text frames over ws://127.0.0.1:<port>. The browser side is
|
|
9
9
|
* always the WebSocket client. The server accepts one active executor
|
|
10
|
-
* connection at a time
|
|
10
|
+
* connection at a time. The incumbent keeps it: a second authenticated
|
|
11
|
+
* executor is refused with 4004 and retries until the incumbent goes away,
|
|
12
|
+
* unless it requests takeover or repeats the incumbent's instanceId.
|
|
11
13
|
*/
|
|
12
14
|
/** Bumped on any breaking change to frame shapes or semantics. */
|
|
13
15
|
export declare const PROTOCOL_VERSION = 1;
|
|
16
|
+
/**
|
|
17
|
+
* Minimum extension release required by this server version.
|
|
18
|
+
* Extensions below this version lack features required by the server (e.g.
|
|
19
|
+
* standby, takeover, instanceId).
|
|
20
|
+
*/
|
|
21
|
+
export declare const MIN_EXTENSION_VERSION = "1.2.0";
|
|
14
22
|
/** Default listen port; override with PL_WS_PORT / the extension options page. */
|
|
15
23
|
export declare const DEFAULT_WS_PORT = 8788;
|
|
16
24
|
/** Heartbeat interval. Also keeps the MV3 service worker alive (Chrome >=116). */
|
|
@@ -33,11 +41,37 @@ export interface HelloFrame {
|
|
|
33
41
|
protocolVersion: number;
|
|
34
42
|
/** "extension/<version>" or "bootstrap/<version>", the release version from package.json */
|
|
35
43
|
executor: string;
|
|
44
|
+
/**
|
|
45
|
+
* Stable id of this executor installation (one UUID per extension
|
|
46
|
+
* installation, one per page load for the snippet). Additive: absent from
|
|
47
|
+
* 1.1.0 executors, and the server treats it as absent unless it is a
|
|
48
|
+
* string of 1 to 64 characters. A hello whose instanceId equals the
|
|
49
|
+
* connected executor's replaces that connection, so an executor is never
|
|
50
|
+
* locked out by its own stale socket.
|
|
51
|
+
*/
|
|
52
|
+
instanceId?: string;
|
|
53
|
+
/**
|
|
54
|
+
* Ask the server to switch to this executor now, closing the incumbent
|
|
55
|
+
* with 4003. Additive: only exactly `true` counts. The extension sends it
|
|
56
|
+
* when the user presses Save on the options page.
|
|
57
|
+
*/
|
|
58
|
+
takeover?: boolean;
|
|
36
59
|
}
|
|
37
60
|
/** Server acknowledges a valid hello. Requests only flow after this. */
|
|
38
61
|
export interface HelloAckFrame {
|
|
39
62
|
type: "helloAck";
|
|
40
63
|
protocolVersion: number;
|
|
64
|
+
/**
|
|
65
|
+
* The server's release version (package.json). Additive: executors that
|
|
66
|
+
* ignore it keep working, and older servers simply omit it.
|
|
67
|
+
*/
|
|
68
|
+
serverVersion?: string;
|
|
69
|
+
/**
|
|
70
|
+
* Minimum extension release required by this server version. Additive:
|
|
71
|
+
* older servers omit it. When present and the extension's release is older,
|
|
72
|
+
* the options page shows an update notice.
|
|
73
|
+
*/
|
|
74
|
+
minExtensionVersion?: string;
|
|
41
75
|
}
|
|
42
76
|
export interface RequestFrame {
|
|
43
77
|
type: "request";
|
|
@@ -83,6 +117,8 @@ export declare const CLOSE_CODES: {
|
|
|
83
117
|
readonly AUTH_FAILED: 4001;
|
|
84
118
|
/** Protocol version mismatch. */
|
|
85
119
|
readonly VERSION_MISMATCH: 4002;
|
|
86
|
-
/** A
|
|
120
|
+
/** A takeover replaced this executor; retry slowly, the next attempt normally gets BUSY. */
|
|
87
121
|
readonly REPLACED: 4003;
|
|
122
|
+
/** Another executor holds the connection; retry later. */
|
|
123
|
+
readonly BUSY: 4004;
|
|
88
124
|
};
|
package/dist/types/wire.js
CHANGED
|
@@ -7,10 +7,18 @@
|
|
|
7
7
|
*
|
|
8
8
|
* Transport: JSON text frames over ws://127.0.0.1:<port>. The browser side is
|
|
9
9
|
* always the WebSocket client. The server accepts one active executor
|
|
10
|
-
* connection at a time
|
|
10
|
+
* connection at a time. The incumbent keeps it: a second authenticated
|
|
11
|
+
* executor is refused with 4004 and retries until the incumbent goes away,
|
|
12
|
+
* unless it requests takeover or repeats the incumbent's instanceId.
|
|
11
13
|
*/
|
|
12
14
|
/** Bumped on any breaking change to frame shapes or semantics. */
|
|
13
15
|
export const PROTOCOL_VERSION = 1;
|
|
16
|
+
/**
|
|
17
|
+
* Minimum extension release required by this server version.
|
|
18
|
+
* Extensions below this version lack features required by the server (e.g.
|
|
19
|
+
* standby, takeover, instanceId).
|
|
20
|
+
*/
|
|
21
|
+
export const MIN_EXTENSION_VERSION = "1.2.0";
|
|
14
22
|
/** Default listen port; override with PL_WS_PORT / the extension options page. */
|
|
15
23
|
export const DEFAULT_WS_PORT = 8788;
|
|
16
24
|
/** Heartbeat interval. Also keeps the MV3 service worker alive (Chrome >=116). */
|
|
@@ -21,7 +29,9 @@ export const CLOSE_CODES = {
|
|
|
21
29
|
AUTH_FAILED: 4001,
|
|
22
30
|
/** Protocol version mismatch. */
|
|
23
31
|
VERSION_MISMATCH: 4002,
|
|
24
|
-
/** A
|
|
32
|
+
/** A takeover replaced this executor; retry slowly, the next attempt normally gets BUSY. */
|
|
25
33
|
REPLACED: 4003,
|
|
34
|
+
/** Another executor holds the connection; retry later. */
|
|
35
|
+
BUSY: 4004,
|
|
26
36
|
};
|
|
27
37
|
//# sourceMappingURL=wire.js.map
|
package/dist/types/wire.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wire.js","sourceRoot":"","sources":["../../src/types/wire.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"wire.js","sourceRoot":"","sources":["../../src/types/wire.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,kEAAkE;AAClE,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAElC;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,OAAO,CAAC;AAE7C,kFAAkF;AAClF,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,CAAC;AAEpC,kFAAkF;AAClF,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CAAC;AA0G5C,gDAAgD;AAChD,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,8FAA8F;IAC9F,WAAW,EAAE,IAAI;IACjB,iCAAiC;IACjC,gBAAgB,EAAE,IAAI;IACtB,4FAA4F;IAC5F,QAAQ,EAAE,IAAI;IACd,0DAA0D;IAC1D,IAAI,EAAE,IAAI;CACF,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export type FetchLike = (url: string, init: {
|
|
2
|
+
headers: Record<string, string>;
|
|
3
|
+
signal: AbortSignal;
|
|
4
|
+
}) => Promise<{
|
|
5
|
+
ok: boolean;
|
|
6
|
+
json(): Promise<unknown>;
|
|
7
|
+
}>;
|
|
8
|
+
/**
|
|
9
|
+
* Read the `version` field of the registry's latest-release document.
|
|
10
|
+
* Any failure (offline, timeout, non-200, bad JSON, missing or unparsable
|
|
11
|
+
* version) resolves to null; this never rejects.
|
|
12
|
+
*/
|
|
13
|
+
export declare function fetchLatestVersion(fetchImpl?: FetchLike, timeoutMs?: number): Promise<string | null>;
|
|
14
|
+
export interface UpdateCheck {
|
|
15
|
+
/** Start the lookup; without PL_UPDATE_CHECK=false and at most once. */
|
|
16
|
+
start(fetchImpl?: FetchLike): void;
|
|
17
|
+
/** The latest version found, or null while unknown or disabled. */
|
|
18
|
+
latest(): string | null;
|
|
19
|
+
}
|
|
20
|
+
/** A fresh holder; the module-level one is what the server uses. */
|
|
21
|
+
export declare function createUpdateCheck(): UpdateCheck;
|
|
22
|
+
export declare const updateCheck: UpdateCheck;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// One request per server process asks the npm registry for the latest
|
|
2
|
+
// published version of this package, so check_connection can tell the user
|
|
3
|
+
// an update is available. The request carries no user data: no query string,
|
|
4
|
+
// no custom headers beyond Accept, nothing from config or the plan.
|
|
5
|
+
// PL_UPDATE_CHECK=false turns the lookup off entirely.
|
|
6
|
+
import { config } from "./config.js";
|
|
7
|
+
import { log } from "./logger.js";
|
|
8
|
+
import { compareVersions } from "./versionCompare.js";
|
|
9
|
+
import { VERSION } from "./version.js";
|
|
10
|
+
const REGISTRY_URL = "https://registry.npmjs.org/projectionlab-mcp/latest";
|
|
11
|
+
const DEFAULT_TIMEOUT_MS = 3000;
|
|
12
|
+
/**
|
|
13
|
+
* Read the `version` field of the registry's latest-release document.
|
|
14
|
+
* Any failure (offline, timeout, non-200, bad JSON, missing or unparsable
|
|
15
|
+
* version) resolves to null; this never rejects.
|
|
16
|
+
*/
|
|
17
|
+
export async function fetchLatestVersion(fetchImpl = fetch, timeoutMs = DEFAULT_TIMEOUT_MS) {
|
|
18
|
+
try {
|
|
19
|
+
const response = await fetchImpl(REGISTRY_URL, {
|
|
20
|
+
headers: { Accept: "application/json" },
|
|
21
|
+
signal: AbortSignal.timeout(timeoutMs),
|
|
22
|
+
});
|
|
23
|
+
if (!response.ok)
|
|
24
|
+
return null;
|
|
25
|
+
const body = (await response.json());
|
|
26
|
+
if (typeof body?.version !== "string")
|
|
27
|
+
return null;
|
|
28
|
+
// Unparsable versions are as good as unknown.
|
|
29
|
+
return compareVersions(body.version, "0.0.0") === null ? null : body.version;
|
|
30
|
+
}
|
|
31
|
+
catch (err) {
|
|
32
|
+
log.debug("updateCheck", `update lookup failed: ${err}`);
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
/** A fresh holder; the module-level one is what the server uses. */
|
|
37
|
+
export function createUpdateCheck() {
|
|
38
|
+
let latest = null;
|
|
39
|
+
let started = false;
|
|
40
|
+
return {
|
|
41
|
+
start(fetchImpl = fetch) {
|
|
42
|
+
if (started || !config.updateCheck)
|
|
43
|
+
return;
|
|
44
|
+
started = true;
|
|
45
|
+
void fetchLatestVersion(fetchImpl).then((found) => {
|
|
46
|
+
latest = found;
|
|
47
|
+
if (found && compareVersions(found, VERSION) === 1) {
|
|
48
|
+
log.info("updateCheck", `projectionlab-mcp ${found} is available (running ${VERSION})`);
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
},
|
|
52
|
+
latest() {
|
|
53
|
+
return latest;
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
export const updateCheck = createUpdateCheck();
|
|
58
|
+
//# sourceMappingURL=updateCheck.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"updateCheck.js","sourceRoot":"","sources":["../src/updateCheck.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,2EAA2E;AAC3E,6EAA6E;AAC7E,oEAAoE;AACpE,uDAAuD;AAEvD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EA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WAAW;gBAAE,OAAO;YAC3C,OAAO,GAAG,IAAI,CAAC;YACf,KAAK,kBAAkB,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE;gBAChD,MAAM,GAAG,KAAK,CAAC;gBACf,IAAI,KAAK,IAAI,eAAe,CAAC,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;oBACnD,GAAG,CAAC,IAAI,CACN,aAAa,EACb,qBAAqB,KAAK,0BAA0B,OAAO,GAAG,CAC/D,CAAC;gBACJ,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;QACD,MAAM;YACJ,OAAO,MAAM,CAAC;QAChB,CAAC;KACF,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,WAAW,GAAG,iBAAiB,EAAE,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// Release versions are major.minor.patch triples of non-negative integers.
|
|
2
|
+
// Anything else (a leading v, prerelease or build suffixes, extra segments)
|
|
3
|
+
// is unparsable, and callers treat unparsable as "say nothing".
|
|
4
|
+
function parse(version) {
|
|
5
|
+
if (typeof version !== "string")
|
|
6
|
+
return null;
|
|
7
|
+
const parts = version.split(".");
|
|
8
|
+
if (parts.length !== 3)
|
|
9
|
+
return null;
|
|
10
|
+
const numbers = [];
|
|
11
|
+
for (const part of parts) {
|
|
12
|
+
if (!/^(0|[1-9]\d*)$/.test(part))
|
|
13
|
+
return null;
|
|
14
|
+
numbers.push(Number(part));
|
|
15
|
+
}
|
|
16
|
+
return [numbers[0], numbers[1], numbers[2]];
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Compare two `major.minor.patch` versions numerically. Returns -1, 0, or 1,
|
|
20
|
+
* or null when either input is not three dot-separated non-negative integers.
|
|
21
|
+
*/
|
|
22
|
+
export function compareVersions(a, b) {
|
|
23
|
+
const left = parse(a);
|
|
24
|
+
const right = parse(b);
|
|
25
|
+
if (!left || !right)
|
|
26
|
+
return null;
|
|
27
|
+
for (let i = 0; i < 3; i++) {
|
|
28
|
+
if (left[i] !== right[i])
|
|
29
|
+
return left[i] < right[i] ? -1 : 1;
|
|
30
|
+
}
|
|
31
|
+
return 0;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=versionCompare.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"versionCompare.js","sourceRoot":"","sources":["../src/versionCompare.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,4EAA4E;AAC5E,gEAAgE;AAEhE,SAAS,KAAK,CAAC,OAAe;IAC5B,IAAI,OAAO,OAAO,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IAC7C,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACjC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACpC,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC;YAAE,OAAO,IAAI,CAAC;QAC9C,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;IAC7B,CAAC;IACD,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;AAC9C,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,CAAS,EAAE,CAAS;IAClD,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IACtB,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IACvB,IAAI,CAAC,IAAI,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAC;IACjC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC3B,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC;YAAE,OAAO,IAAI,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/D,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface VersionInfo {
|
|
2
|
+
/** The server's own release. */
|
|
3
|
+
server: string;
|
|
4
|
+
/** Connected executor, "extension/<v>" or "bootstrap/<v>", or null. */
|
|
5
|
+
executor: string | null;
|
|
6
|
+
/** Newest release on npm, or null when unknown or the check is off. */
|
|
7
|
+
latest: string | null;
|
|
8
|
+
}
|
|
9
|
+
export declare function versionNotices(info: VersionInfo): string[];
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// Plain-language update notices for projectionlab_check_connection. Each
|
|
2
|
+
// rule says nothing whenever a needed comparison is unparsable or a version
|
|
3
|
+
// is unknown; being out of date is never reported as a connection failure.
|
|
4
|
+
import { MIN_EXTENSION_VERSION } from "./types/wire.js";
|
|
5
|
+
import { compareVersions } from "./versionCompare.js";
|
|
6
|
+
const SERVER_FIX = "To update it, fully quit and reopen the AI assistant's host so npx fetches the new release; " +
|
|
7
|
+
"if the old version is still reported afterwards, set the server args in the host " +
|
|
8
|
+
"configuration to -y projectionlab-mcp@latest.";
|
|
9
|
+
const EXTENSION_FIX = "The browser's extension store normally updates it on its own: MCP Bridge for ProjectionLab is on " +
|
|
10
|
+
"the Chrome Web Store (https://chromewebstore.google.com/detail/mcp-bridge-for-projection/njgjmcihabchffonldcgfjiocjalpoaf) " +
|
|
11
|
+
"and Firefox Add-ons (https://addons.mozilla.org/en-US/firefox/addon/mcp-bridge-for-projectionlab/). " +
|
|
12
|
+
"Ask the user to check for updates on the browser's extensions page, or to install it from the " +
|
|
13
|
+
"store above if it was never installed there. If an older unpacked or temporary copy was loaded manually, " +
|
|
14
|
+
"ask the user to remove it from the extensions page and copy the token from ~/.projectionlab-mcp/ws-token " +
|
|
15
|
+
"into the new extension's settings (browsers isolate settings by extension ID, so they do not transfer automatically).";
|
|
16
|
+
export function versionNotices(info) {
|
|
17
|
+
const notices = [];
|
|
18
|
+
const serverOutOfDate = info.latest !== null && compareVersions(info.latest, info.server) === 1;
|
|
19
|
+
if (serverOutOfDate) {
|
|
20
|
+
notices.push(`The ProjectionLab MCP server is running version ${info.server}, but version ` +
|
|
21
|
+
`${info.latest} is available on npm. ${SERVER_FIX}`);
|
|
22
|
+
}
|
|
23
|
+
if (info.executor) {
|
|
24
|
+
const slash = info.executor.lastIndexOf("/");
|
|
25
|
+
const kind = slash === -1 ? "" : info.executor.slice(0, slash);
|
|
26
|
+
const version = slash === -1 ? "" : info.executor.slice(slash + 1);
|
|
27
|
+
if (kind === "extension") {
|
|
28
|
+
const cmp = compareVersions(version, MIN_EXTENSION_VERSION);
|
|
29
|
+
if (cmp === -1) {
|
|
30
|
+
notices.push(`The ProjectionLab browser extension is version ${version}, older than the minimum ` +
|
|
31
|
+
`required version (${MIN_EXTENSION_VERSION}). ${EXTENSION_FIX}`);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
else if (kind === "bootstrap") {
|
|
35
|
+
const cmp = compareVersions(version, info.server);
|
|
36
|
+
if (cmp !== null && cmp !== 0) {
|
|
37
|
+
notices.push(`The bootstrap snippet in the ProjectionLab tab is version ${version}, pasted from a ` +
|
|
38
|
+
`different server release than the running server (${info.server}). Ask the user to ` +
|
|
39
|
+
`reload the tab, then call projectionlab_get_bootstrap and paste the fresh snippet ` +
|
|
40
|
+
`into the browser console.`);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return notices;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=versionNotices.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"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nE,IAAI,IAAI,KAAK,WAAW,EAAE,CAAC;YACzB,MAAM,GAAG,GAAG,eAAe,CAAC,OAAO,EAAE,qBAAqB,CAAC,CAAC;YAC5D,IAAI,GAAG,KAAK,CAAC,CAAC,EAAE,CAAC;gBACf,OAAO,CAAC,IAAI,CACV,kDAAkD,OAAO,2BAA2B;oBAClF,qBAAqB,qBAAqB,MAAM,aAAa,EAAE,CAClE,CAAC;YACJ,CAAC;QACH,CAAC;aAAM,IAAI,IAAI,KAAK,WAAW,EAAE,CAAC;YAChC,MAAM,GAAG,GAAG,eAAe,CAAC,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;YAClD,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,CAAC,EAAE,CAAC;gBAC9B,OAAO,CAAC,IAAI,CACV,6DAA6D,OAAO,kBAAkB;oBACpF,qDAAqD,IAAI,CAAC,MAAM,qBAAqB;oBACrF,oFAAoF;oBACpF,2BAA2B,CAC9B,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: projectionlab
|
|
3
3
|
description: Reads and edits a user's ProjectionLab retirement and financial plan through the projectionlab MCP server - plans, Current Finances, assumptions, Chance of Success (Monte Carlo) and withdrawal-strategy settings - with previewed, snapshotted, reversible changes. Use when the user asks about their ProjectionLab plan, retirement readiness, FIRE or decumulation, Roth conversions, comparing scenarios, or changing plan values, or when projectionlab tools fail to connect and the user needs setup help.
|
|
4
4
|
license: MIT
|
|
5
|
-
compatibility: Requires the projectionlab MCP server (npx -y projectionlab-mcp, Node.js 20+) and a ProjectionLab tab open in Chrome
|
|
5
|
+
compatibility: Requires the projectionlab MCP server (npx -y projectionlab-mcp, Node.js 20+) and a ProjectionLab tab open in Chrome or Firefox 140+ (both tested; Edge and Brave use the same builds and are unverified), connected through the MCP Bridge for ProjectionLab extension or the bootstrap snippet.
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# ProjectionLab MCP
|
|
@@ -21,15 +21,30 @@ also serves this guide as the MCP resource `projectionlab://guide`.
|
|
|
21
21
|
## Start every session with a connection check
|
|
22
22
|
|
|
23
23
|
Call `projectionlab_check_connection` before any other ProjectionLab tool. It
|
|
24
|
-
returns `browser`, `pageLoaded`, `apiAvailable`, `apiKeyValid`, `errors
|
|
25
|
-
`writesEnabled`. When the first four flags are
|
|
26
|
-
the first failing item with the user, one step
|
|
24
|
+
returns `browser`, `pageLoaded`, `apiAvailable`, `apiKeyValid`, `errors`,
|
|
25
|
+
`writesEnabled`, `versions` and `notices`. When the first four flags are
|
|
26
|
+
`true`, proceed. Otherwise fix the first failing item with the user, one step
|
|
27
|
+
at a time, then check again.
|
|
28
|
+
|
|
29
|
+
`notices` are plain sentences about the server's release, never connection
|
|
30
|
+
failures. When the list is not empty, tell the user each one once, in plain
|
|
31
|
+
words, then carry on; do not repeat them later in the session and do not refuse
|
|
32
|
+
to work because of them. The fix for an out-of-date server is quitting and
|
|
33
|
+
reopening the AI assistant's host so `npx` fetches the new release; if it still
|
|
34
|
+
reports the old version, set the server args to
|
|
35
|
+
`["-y", "projectionlab-mcp@latest"]`. The extension's release is not locked
|
|
36
|
+
to the server's release: the browser's store keeps it current on its own, and
|
|
37
|
+
the server speaks only if the connected extension is older than its minimum
|
|
38
|
+
required version. When guiding a user to install the store version over an older
|
|
39
|
+
unpacked copy, have them remove the unpacked extension from `chrome://extensions`
|
|
40
|
+
and copy the token from `~/.projectionlab-mcp/ws-token` into the new extension's
|
|
41
|
+
options page (browsers isolate extension storage by ID, so settings do not transfer).
|
|
27
42
|
|
|
28
43
|
| Failing item | What it means | What to do with the user |
|
|
29
44
|
|---|---|---|
|
|
30
45
|
| `API_KEY_MISSING` in `errors` | The server has no Plugin API key | See "Setting the API key" |
|
|
31
46
|
| `browser: false`, port held by another instance | Another agent on this machine runs the server and has the extension | Wait for that agent to exit (this server takes over within about a minute), or give this one its own `PL_WS_PORT` and point the extension at it |
|
|
32
|
-
| `browser: false` otherwise | No extension or snippet is connected | See "Connecting the browser"
|
|
47
|
+
| `browser: false` otherwise | No extension or snippet is connected | See "Connecting the browser" |
|
|
33
48
|
| `pageLoaded: false` | No ProjectionLab tab is open | Ask the user to open https://app.projectionlab.com and log in |
|
|
34
49
|
| `apiAvailable: false` | Plugins are off, or the user is logged out | ProjectionLab -> Account Settings -> Plugins -> enable plugins |
|
|
35
50
|
| `apiKeyValid: false` | The key does not match the account | Ask the user to copy the key again from Account Settings -> Plugins |
|
|
@@ -52,13 +67,19 @@ If you write the file for the user, do not repeat the value back.
|
|
|
52
67
|
|
|
53
68
|
Recommended, persistent: the **MCP Bridge for ProjectionLab** browser extension.
|
|
54
69
|
|
|
55
|
-
1.
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
70
|
+
1. Have the user add **MCP Bridge for ProjectionLab** from their browser's
|
|
71
|
+
store; you cannot click the install button for them. Chrome, Edge or Brave:
|
|
72
|
+
https://chromewebstore.google.com/detail/mcp-bridge-for-projection/njgjmcihabchffonldcgfjiocjalpoaf
|
|
73
|
+
then **Add to Chrome** (Edge asks once to allow extensions from other
|
|
74
|
+
stores). Firefox 140+:
|
|
75
|
+
https://addons.mozilla.org/en-US/firefox/addon/mcp-bridge-for-projectionlab/
|
|
76
|
+
then **Install Add-on**. The store keeps the extension updated.
|
|
77
|
+
Chrome and Firefox are tested with this server; Edge and Brave run the same
|
|
78
|
+
builds and are unverified, so pick one of the tested two when the user has a
|
|
79
|
+
choice.
|
|
80
|
+
2. Install it from one source only. An unpacked copy alongside a store copy
|
|
81
|
+
gives the browser two extensions competing for the server's single
|
|
82
|
+
connection, and the loser stands by.
|
|
62
83
|
3. Open the extension's options page (click its toolbar icon). Enter the port
|
|
63
84
|
(`8788` unless `PL_WS_PORT` is set) and the token from
|
|
64
85
|
`~/.projectionlab-mcp/ws-token`, which the server creates on first start.
|
|
@@ -66,10 +87,10 @@ Recommended, persistent: the **MCP Bridge for ProjectionLab** browser extension.
|
|
|
66
87
|
check.
|
|
67
88
|
4. Open https://app.projectionlab.com and log in.
|
|
68
89
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
the
|
|
90
|
+
If another browser is already connected to the server, the status reads
|
|
91
|
+
**Standing by** instead: that extension connects on its own when the other
|
|
92
|
+
browser disconnects, and pressing Save on the options page makes this
|
|
93
|
+
browser the active one now.
|
|
73
94
|
|
|
74
95
|
Quick, no install: call `projectionlab_get_bootstrap` and have the user paste
|
|
75
96
|
the returned snippet into the ProjectionLab tab's developer console (F12 ->
|
|
@@ -77,9 +98,12 @@ Console). It must be pasted again after every page reload.
|
|
|
77
98
|
|
|
78
99
|
## Reading the plan
|
|
79
100
|
|
|
80
|
-
Plans are addressed by `planIdentifier`: a plan name (case-insensitive
|
|
81
|
-
partial match
|
|
82
|
-
|
|
101
|
+
Plans are addressed by `planIdentifier`: a plan name (case-insensitive; a
|
|
102
|
+
partial match must identify exactly one plan, and an ambiguous one is refused
|
|
103
|
+
with the candidates listed) or an exact plan ID. The same rule covers
|
|
104
|
+
`eventIdentifier` and the `planA`/`planB` names of `projectionlab_diff`, so a
|
|
105
|
+
read and the following write can never target different items. Prefer the
|
|
106
|
+
narrowest read that answers the question.
|
|
83
107
|
|
|
84
108
|
| Question | Tool |
|
|
85
109
|
|---|---|
|
|
@@ -150,8 +174,8 @@ question.
|
|
|
150
174
|
what to use when the user wants to know whether two plans agree without sending
|
|
151
175
|
their contents to the model.
|
|
152
176
|
- Results over about 100,000 characters are written to
|
|
153
|
-
`~/.projectionlab-mcp/exports/` and returned as a file path
|
|
154
|
-
you need from the file.
|
|
177
|
+
`~/.projectionlab-mcp/exports/` and returned as a file path (pruned
|
|
178
|
+
automatically after 30 days). Read the parts you need from the file.
|
|
155
179
|
- `projectionlab_describe_plugin_api` lists the Plugin API methods the running
|
|
156
180
|
app exposes. Use it before concluding that a capability does not exist.
|
|
157
181
|
|
|
@@ -227,6 +251,9 @@ Change the plan only when the user explicitly asks for that change.
|
|
|
227
251
|
- Never replace a whole section when a targeted tool can make the change.
|
|
228
252
|
`projectionlab_update_plan_section` overwrites the complete array, so any
|
|
229
253
|
event missing from what you send is gone.
|
|
254
|
+
- Never write payloads carrying `[REDACTED]` under secret fields. Reads scrub
|
|
255
|
+
secrets with this placeholder, and write tools refuse payloads containing it
|
|
256
|
+
to prevent overwriting real credentials or keys with placeholder text.
|
|
230
257
|
|
|
231
258
|
**Writes are off by default.** `writesEnabled` in the connection check shows
|
|
232
259
|
the current mode. While it is `false`, every write tool, dry runs included,
|
|
@@ -276,12 +303,18 @@ values intact. Paths must already exist and keep their JSON type; get them from
|
|
|
276
303
|
the matching read tool (`get_plan_settings`, `get_plan_section` with
|
|
277
304
|
`listPaths: true`, or `get_current_finances` with `listPaths: true`). The
|
|
278
305
|
older `patch` (events) and `data` (accounts) inputs merge top-level fields
|
|
279
|
-
only;
|
|
306
|
+
only; existing fields keep their JSON type and are validated like
|
|
307
|
+
`pathChanges`, and new fields must be plain, non-secret names. Supply
|
|
308
|
+
exactly one of the patch inputs.
|
|
280
309
|
|
|
281
310
|
Milestones: ProjectionLab always keeps a Retirement and a Life Expectancy
|
|
282
311
|
milestone and disables deleting them in the app, so never remove either one.
|
|
283
312
|
`projectionlab_update_plan_section` replaces the whole `milestones` array, so
|
|
284
|
-
send both of them back in it.
|
|
313
|
+
send both of them back in it. Its `sectionData` must also match the section's
|
|
314
|
+
current container shape - an array for milestones, an object with an `events`
|
|
315
|
+
array for event sections, an object for `variables`, `montecarlo` and
|
|
316
|
+
`withdrawalStrategy` - or it is refused with `INVALID_INPUT`, dry runs
|
|
317
|
+
included.
|
|
285
318
|
|
|
286
319
|
To explore a what-if without touching the original, clone the plan first and
|
|
287
320
|
patch the copy.
|
|
@@ -294,6 +327,13 @@ refuses the last remaining plan. Its snapshot lets
|
|
|
294
327
|
`projectionlab_restore_progress` and `projectionlab_restore_settings` replace
|
|
295
328
|
an entire data area. Use them only when the user wants exactly that.
|
|
296
329
|
|
|
330
|
+
Reads hide secret values: a secret-named field reads back as `[REDACTED]`. A
|
|
331
|
+
`sectionData` or `restore_*` payload that still carries that sentinel under a
|
|
332
|
+
secret-named key is refused with `INVALID_INPUT`, dry runs included, naming the
|
|
333
|
+
paths. Type the real value or change single fields with
|
|
334
|
+
`projectionlab_update_plan_event` or `projectionlab_update_plan_settings`,
|
|
335
|
+
which patch by path and never round-trip hidden values.
|
|
336
|
+
|
|
297
337
|
### Change workflow
|
|
298
338
|
|
|
299
339
|
Copy this checklist and work through it for each change:
|
|
@@ -365,8 +405,10 @@ Retire at 55 plan."
|
|
|
365
405
|
2. `projectionlab_update_plan_event` with
|
|
366
406
|
`{"planIdentifier": "Retire at 55", "section": "expenses", "eventIdentifier": "Groceries", "pathChanges": {"amount": 600}}`
|
|
367
407
|
returns `dryRun: true`, the `planName`, `section`, the `event` label, and
|
|
368
|
-
`changes` such as `{"amount": {"before": 500, "after": 600}}
|
|
369
|
-
|
|
408
|
+
`changes` such as `{"amount": {"before": 500, "after": 600}}`; the `patch`
|
|
409
|
+
input reports the same before/after objects, and a field it adds reports
|
|
410
|
+
`"before": "[ABSENT]"`. Use `pathChanges`, not `patch`, so sibling fields
|
|
411
|
+
are kept. Show the before and
|
|
370
412
|
after values to the user in plain words: "In Retire at 55, Groceries goes
|
|
371
413
|
from $500 to $600 a month. Want me to make that change?"
|
|
372
414
|
3. After the user approves, repeat the call with `"confirm": true`. The reply
|
|
@@ -448,9 +490,10 @@ at 60."
|
|
|
448
490
|
and picks the same snapshot, so its field-level list of what differs from the
|
|
449
491
|
live data shows exactly what that rollback would undo. Show it with the
|
|
450
492
|
preview when the user asks what will come back.
|
|
451
|
-
4. After the user approves, repeat with `{"nBack": 1, "confirm": true}`.
|
|
452
|
-
|
|
453
|
-
|
|
493
|
+
4. After the user approves, repeat with `{"nBack": 1, "confirm": true}`. The
|
|
494
|
+
reply reports `verified: true` (or lists `unverifiedSections` if the
|
|
495
|
+
re-read differed). A confirmed rollback saves the current state first, so
|
|
496
|
+
another `nBack: 1` right after a rollback undoes that rollback.
|
|
454
497
|
5. `snapshotId` names one id from the list. `beforeTime` takes an ISO 8601
|
|
455
498
|
time carrying a `Z` or `±HH:MM` offset, such as `2026-11-08T15:30:00Z`,
|
|
456
499
|
and restores the latest snapshot strictly before it; a time with no
|