projectionlab-mcp 1.4.1 → 1.5.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/HOW-IT-WORKS.md +2 -2
- package/README.md +4 -2
- package/REFERENCE.md +20 -8
- package/dist/appBusy.d.ts +3 -0
- package/dist/appBusy.js +7 -0
- package/dist/appBusy.js.map +1 -0
- package/dist/appMap.d.ts +59 -0
- package/dist/appMap.js +595 -0
- package/dist/appMap.js.map +1 -0
- package/dist/appResultsPage.d.ts +31 -0
- package/dist/appResultsPage.js +427 -0
- package/dist/appResultsPage.js.map +1 -0
- package/dist/bootstrap.d.ts +3 -1
- package/dist/bootstrap.js +18 -3
- package/dist/bootstrap.js.map +1 -1
- package/dist/bridge.d.ts +42 -5
- package/dist/bridge.js +15 -1
- package/dist/bridge.js.map +1 -1
- package/dist/changeSummary.d.ts +129 -0
- package/dist/changeSummary.js +346 -0
- package/dist/changeSummary.js.map +1 -0
- package/dist/editAccess.d.ts +6 -3
- package/dist/editAccess.js +10 -3
- package/dist/editAccess.js.map +1 -1
- package/dist/errors.d.ts +1 -1
- package/dist/errors.js.map +1 -1
- package/dist/extensionBridge.d.ts +27 -6
- package/dist/extensionBridge.js +103 -11
- package/dist/extensionBridge.js.map +1 -1
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -1
- package/dist/instructions.d.ts +1 -1
- package/dist/instructions.js +2 -2
- package/dist/largeOutput.js +2 -23
- package/dist/largeOutput.js.map +1 -1
- package/dist/planEventTemplates.d.ts +35 -0
- package/dist/planEventTemplates.js +177 -0
- package/dist/planEventTemplates.js.map +1 -0
- package/dist/planReport.d.ts +9 -0
- package/dist/planReport.js +902 -0
- package/dist/planReport.js.map +1 -0
- package/dist/plans.d.ts +2 -0
- package/dist/plans.js +6 -0
- package/dist/plans.js.map +1 -1
- package/dist/printHtml.d.ts +8 -0
- package/dist/printHtml.js +144 -0
- package/dist/printHtml.js.map +1 -0
- package/dist/prompts/index.js +41 -11
- package/dist/prompts/index.js.map +1 -1
- package/dist/reportCopy.d.ts +16 -0
- package/dist/reportCopy.js +55 -0
- package/dist/reportCopy.js.map +1 -0
- package/dist/resources/appMap.d.ts +2 -0
- package/dist/resources/appMap.js +14 -0
- package/dist/resources/appMap.js.map +1 -0
- package/dist/resources/knowledge.d.ts +1 -1
- package/dist/resources/knowledge.js +302 -71
- package/dist/resources/knowledge.js.map +1 -1
- package/dist/retention.d.ts +8 -0
- package/dist/retention.js +35 -0
- package/dist/retention.js.map +1 -0
- package/dist/settingsReport.d.ts +35 -0
- package/dist/settingsReport.js +56 -22
- package/dist/settingsReport.js.map +1 -1
- package/dist/snapshot.d.ts +12 -0
- package/dist/snapshot.js +52 -2
- package/dist/snapshot.js.map +1 -1
- package/dist/tools/addPlanEvent.d.ts +4 -0
- package/dist/tools/addPlanEvent.js +301 -0
- package/dist/tools/addPlanEvent.js.map +1 -0
- package/dist/tools/clonePlan.d.ts +1 -1
- package/dist/tools/clonePlan.js +11 -1
- package/dist/tools/clonePlan.js.map +1 -1
- package/dist/tools/deletePlan.d.ts +1 -1
- package/dist/tools/deletePlan.js +10 -1
- package/dist/tools/deletePlan.js.map +1 -1
- package/dist/tools/findInApp.d.ts +2 -0
- package/dist/tools/findInApp.js +31 -0
- package/dist/tools/findInApp.js.map +1 -0
- package/dist/tools/listChanges.d.ts +3 -0
- package/dist/tools/listChanges.js +147 -0
- package/dist/tools/listChanges.js.map +1 -0
- package/dist/tools/planReport.d.ts +3 -0
- package/dist/tools/planReport.js +62 -0
- package/dist/tools/planReport.js.map +1 -0
- package/dist/tools/projection.d.ts +3 -0
- package/dist/tools/projection.js +381 -0
- package/dist/tools/projection.js.map +1 -0
- package/dist/tools/removePlanEvent.d.ts +4 -0
- package/dist/tools/removePlanEvent.js +196 -0
- package/dist/tools/removePlanEvent.js.map +1 -0
- package/dist/tools/restore.d.ts +1 -1
- package/dist/tools/restore.js +30 -6
- package/dist/tools/restore.js.map +1 -1
- package/dist/tools/settingsReport.js +23 -4
- package/dist/tools/settingsReport.js.map +1 -1
- package/dist/tools/snapshots.d.ts +1 -1
- package/dist/tools/snapshots.js +65 -31
- package/dist/tools/snapshots.js.map +1 -1
- package/dist/tools/updateAccount.d.ts +1 -1
- package/dist/tools/updateAccount.js +12 -1
- package/dist/tools/updateAccount.js.map +1 -1
- package/dist/tools/updatePlanEvent.d.ts +1 -1
- package/dist/tools/updatePlanEvent.js +19 -2
- package/dist/tools/updatePlanEvent.js.map +1 -1
- package/dist/tools/updatePlanSection.d.ts +1 -1
- package/dist/tools/updatePlanSection.js +19 -3
- package/dist/tools/updatePlanSection.js.map +1 -1
- package/dist/tools/updatePlanSettings.d.ts +1 -1
- package/dist/tools/updatePlanSettings.js +16 -4
- package/dist/tools/updatePlanSettings.js.map +1 -1
- package/dist/types/wire.d.ts +30 -2
- package/dist/types/wire.js +8 -0
- package/dist/types/wire.js.map +1 -1
- package/package.json +1 -1
- package/skills/projectionlab/SKILL.md +142 -18
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { toJson } from "../json.js";
|
|
3
|
+
import { parseBeforeTime } from "../snapshot.js";
|
|
4
|
+
import { ProjectionLabError, errorResult } from "../errors.js";
|
|
5
|
+
import { redactSecrets } from "../redact.js";
|
|
6
|
+
import { textOrFile } from "../largeOutput.js";
|
|
7
|
+
import { changeSummary, rollbackSummary } from "../changeSummary.js";
|
|
8
|
+
/**
|
|
9
|
+
* The instant this server process started.
|
|
10
|
+
*
|
|
11
|
+
* A snapshot folder is shared by every server process on the machine and
|
|
12
|
+
* survives restarts, and a backup does not record which process took it.
|
|
13
|
+
* The process start bounds the window instead: this server takes no write
|
|
14
|
+
* before it is up, so every backup it takes is at or after this instant, and
|
|
15
|
+
* backups left by an earlier server process fall outside it. A backup another
|
|
16
|
+
* server process takes in the same folder after this instant, for another
|
|
17
|
+
* MCP host running at the same time, falls inside it. A caller who wants a
|
|
18
|
+
* different window passes `since`.
|
|
19
|
+
*/
|
|
20
|
+
const PROCESS_START_ISO = new Date(performance.timeOrigin).toISOString();
|
|
21
|
+
/**
|
|
22
|
+
* The window to list, from the optional `since`. Both branches name a single
|
|
23
|
+
* instant: the process start, or the caller's own time, read by the same
|
|
24
|
+
* strict rule as `beforeTime` in projectionlab_rollback.
|
|
25
|
+
*/
|
|
26
|
+
function resolveWindow(since) {
|
|
27
|
+
if (since === undefined) {
|
|
28
|
+
return {
|
|
29
|
+
since: PROCESS_START_ISO,
|
|
30
|
+
sinceSource: "processStart",
|
|
31
|
+
cutoff: Date.parse(PROCESS_START_ISO),
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
const cutoff = parseBeforeTime(since);
|
|
35
|
+
if (Number.isNaN(cutoff)) {
|
|
36
|
+
throw new ProjectionLabError("INVALID_INPUT", `since is not a usable time: ${since}`, "Pass an ISO 8601 time carrying an explicit Z or ±HH:MM offset, such as 2026-11-08T15:30:00Z " +
|
|
37
|
+
"or 2026-11-08T15:30:00+02:00. Times without an offset and bare dates are refused " +
|
|
38
|
+
"because their instant is ambiguous.");
|
|
39
|
+
}
|
|
40
|
+
return { since: new Date(cutoff).toISOString(), sinceSource: "since", cutoff };
|
|
41
|
+
}
|
|
42
|
+
export function registerListChangesTool(server, snapshots) {
|
|
43
|
+
server.registerTool("projectionlab_list_changes", {
|
|
44
|
+
title: "List Recent Changes",
|
|
45
|
+
description: "Lists the confirmed writes since this server process started, oldest first, each with " +
|
|
46
|
+
"the projectionlab_rollback call that undoes it. A write counts once it is confirmed, " +
|
|
47
|
+
"because that is when its backup is saved, so a dry run never appears here. Each entry " +
|
|
48
|
+
"gives the time, the operation, the data sections the backup holds, the change in plain " +
|
|
49
|
+
"words, and the undo. The backup records the operation and its sections, not which plan " +
|
|
50
|
+
"or item changed, so use projectionlab_diff with the entry's snapshotId to see values. " +
|
|
51
|
+
"A rollback restores a whole section, so undoing one change also undoes every later " +
|
|
52
|
+
"write to the same section; it is itself a dry run until confirm is true. " +
|
|
53
|
+
"The list comes from the snapshot folder every server process on this machine shares, " +
|
|
54
|
+
"so a write another MCP host's server made in the same window is listed too. " +
|
|
55
|
+
"Defaults to the changes made since this server process started; pass since to list a " +
|
|
56
|
+
"wider or narrower window.",
|
|
57
|
+
inputSchema: {
|
|
58
|
+
since: z
|
|
59
|
+
.string()
|
|
60
|
+
.optional()
|
|
61
|
+
.describe("ISO 8601 time carrying an explicit Z or ±HH:MM offset, such as 2026-11-08T15:30:00Z " +
|
|
62
|
+
"or 2026-11-08T15:30:00+02:00; lists the changes at or after it. Omit it to list " +
|
|
63
|
+
"the changes taken since this server process started. Times " +
|
|
64
|
+
"without an offset and bare dates are refused because their instant is ambiguous."),
|
|
65
|
+
},
|
|
66
|
+
annotations: {
|
|
67
|
+
readOnlyHint: true,
|
|
68
|
+
destructiveHint: false,
|
|
69
|
+
openWorldHint: false,
|
|
70
|
+
},
|
|
71
|
+
}, async ({ since }) => {
|
|
72
|
+
try {
|
|
73
|
+
const window = resolveWindow(since);
|
|
74
|
+
const rows = [];
|
|
75
|
+
let outsideWindow = 0;
|
|
76
|
+
for (const saved of await snapshots.list()) {
|
|
77
|
+
const at = Date.parse(saved.timestamp);
|
|
78
|
+
// A record with no readable time belongs to no window; it is
|
|
79
|
+
// counted, not listed.
|
|
80
|
+
if (Number.isNaN(at) || at < window.cutoff) {
|
|
81
|
+
outsideWindow += 1;
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
rows.push({
|
|
85
|
+
at,
|
|
86
|
+
snapshotId: saved.id,
|
|
87
|
+
timestamp: saved.timestamp,
|
|
88
|
+
operation: saved.operation,
|
|
89
|
+
sections: saved.sections,
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
// Oldest first: a log of changes reads in the order it happened,
|
|
93
|
+
// which is the reverse of projectionlab_list_snapshots. Equal
|
|
94
|
+
// milliseconds keep the id order that list uses, so both tools rank
|
|
95
|
+
// the same way.
|
|
96
|
+
rows.sort((a, b) => a.at - b.at ||
|
|
97
|
+
(a.snapshotId < b.snapshotId ? -1 : a.snapshotId > b.snapshotId ? 1 : 0));
|
|
98
|
+
const changes = rows.map((row) => ({
|
|
99
|
+
snapshotId: row.snapshotId,
|
|
100
|
+
timestamp: row.timestamp,
|
|
101
|
+
operation: row.operation,
|
|
102
|
+
sections: row.sections,
|
|
103
|
+
summary: changeSummary({
|
|
104
|
+
operation: row.operation,
|
|
105
|
+
sections: row.sections,
|
|
106
|
+
}),
|
|
107
|
+
undo: {
|
|
108
|
+
tool: "projectionlab_rollback",
|
|
109
|
+
arguments: { snapshotId: row.snapshotId },
|
|
110
|
+
},
|
|
111
|
+
undoSummary: rollbackSummary({
|
|
112
|
+
timestamp: row.timestamp,
|
|
113
|
+
operation: row.operation,
|
|
114
|
+
sections: row.sections,
|
|
115
|
+
}),
|
|
116
|
+
}));
|
|
117
|
+
const result = {
|
|
118
|
+
session: {
|
|
119
|
+
serverStartedAt: PROCESS_START_ISO,
|
|
120
|
+
since: window.since,
|
|
121
|
+
sinceSource: window.sinceSource,
|
|
122
|
+
changesOutsideWindow: outsideWindow,
|
|
123
|
+
},
|
|
124
|
+
count: changes.length,
|
|
125
|
+
changes,
|
|
126
|
+
};
|
|
127
|
+
if (changes.length === 0) {
|
|
128
|
+
result.message =
|
|
129
|
+
`No confirmed writes since ${window.since}. A dry run saves no backup, so a change ` +
|
|
130
|
+
"that was previewed but never confirmed is not listed here; pass since to widen " +
|
|
131
|
+
"the window.";
|
|
132
|
+
}
|
|
133
|
+
// Nothing here comes from plan data: the entries are built from the
|
|
134
|
+
// snapshot's own metadata, never its stored sections. The result is
|
|
135
|
+
// redacted like every other read all the same, so no value can leave
|
|
136
|
+
// the process carrying the Plugin API key.
|
|
137
|
+
const text = await textOrFile(toJson(redactSecrets(result, { byName: true })), "list-changes", { session: result.session });
|
|
138
|
+
return {
|
|
139
|
+
content: [{ type: "text", text }],
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
catch (err) {
|
|
143
|
+
return errorResult(err);
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
//# sourceMappingURL=listChanges.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"listChanges.js","sourceRoot":"","sources":["../../src/tools/listChanges.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,eAAe,EAAwB,MAAM,gBAAgB,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAErE;;;;;;;;;;;GAWG;AACH,MAAM,iBAAiB,GAAG,IAAI,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC,WAAW,EAAE,CAAC;AAWzE;;;;GAIG;AACH,SAAS,aAAa,CAAC,KAAyB;IAK9C,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,OAAO;YACL,KAAK,EAAE,iBAAiB;YACxB,WAAW,EAAE,cAAc;YAC3B,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC;SACtC,CAAC;IACJ,CAAC;IAED,MAAM,MAAM,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC;IACtC,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;QACzB,MAAM,IAAI,kBAAkB,CAC1B,eAAe,EACf,+BAA+B,KAAK,EAAE,EACtC,8FAA8F;YAC5F,mFAAmF;YACnF,qCAAqC,CACxC,CAAC;IACJ,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC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,GAA4B;gBACtC,OAAO,EAAE;oBACP,eAAe,EAAE,iBAAiB;oBAClC,KAAK,EAAE,MAAM,CAAC,KAAK;oBACnB,WAAW,EAAE,MAAM,CAAC,WAAW;oBAC/B,oBAAoB,EAAE,aAAa;iBACpC;gBACD,KAAK,EAAE,OAAO,CAAC,MAAM;gBACrB,OAAO;aACR,CAAC;YACF,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACzB,MAAM,CAAC,OAAO;oBACZ,6BAA6B,MAAM,CAAC,KAAK,2CAA2C;wBACpF,iFAAiF;wBACjF,aAAa,CAAC;YAClB,CAAC;YAED,oEAAoE;YACpE,oEAAoE;YACpE,qEAAqE;YACrE,2CAA2C;YAC3C,MAAM,IAAI,GAAG,MAAM,UAAU,CAC3B,MAAM,CAAC,aAAa,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAC/C,cAAc,EACd,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,CAC5B,CAAC;YACF,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;aAClC,CAAC;QACJ,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { errorResult } from "../errors.js";
|
|
3
|
+
import { renderPlanReport } from "../planReport.js";
|
|
4
|
+
import { planDisplayName, planNotFoundError, requirePlans, resolvePlan } from "../plans.js";
|
|
5
|
+
import { redactSecrets } from "../redact.js";
|
|
6
|
+
import { savePrintCopy } from "../reportCopy.js";
|
|
7
|
+
export function registerPlanReportTool(server, bridge) {
|
|
8
|
+
server.registerTool("projectionlab_get_plan_report", {
|
|
9
|
+
title: "Get Plan Inputs and Assumptions Report",
|
|
10
|
+
description: "Returns a markdown document, \"Plan Inputs and Assumptions\", recording one plan's " +
|
|
11
|
+
"inputs and settings, to keep, print, or share, for example with a financial " +
|
|
12
|
+
"advisor who builds their own plan from the same starting point: the household and " +
|
|
13
|
+
"life expectancies, Current Finances (accounts, real assets and debts, shared by " +
|
|
14
|
+
"every plan), each milestone with its date, income, expenses, flows, how the plan " +
|
|
15
|
+
"treats each account and asset, and the plan settings in effect. It " +
|
|
16
|
+
"holds no projections or Chance of Success. It also saves a print-ready HTML copy, " +
|
|
17
|
+
"owner-only, under ~/.projectionlab-mcp/reports/ and gives its path and a file:// " +
|
|
18
|
+
"link: opened in a browser, its Print or save as PDF button prints it. Give the " +
|
|
19
|
+
"user the link and that step. " +
|
|
20
|
+
"Names follow ProjectionLab 5's on-screen labels, and secret-named fields are " +
|
|
21
|
+
"redacted. Use this when the user wants a document of a plan's inputs and assumptions, " +
|
|
22
|
+
"to export, print, keep, or share for review; use projectionlab_get_settings_report " +
|
|
23
|
+
"to review or compare settings " +
|
|
24
|
+
"alone. Present the report to the user as returned; it holds private figures, so " +
|
|
25
|
+
"never send it anywhere outside the conversation.",
|
|
26
|
+
inputSchema: {
|
|
27
|
+
planIdentifier: z
|
|
28
|
+
.string()
|
|
29
|
+
.trim()
|
|
30
|
+
.min(1)
|
|
31
|
+
.describe("Plan name (case-insensitive; a partial match must identify exactly one plan) or exact plan ID"),
|
|
32
|
+
},
|
|
33
|
+
annotations: {
|
|
34
|
+
readOnlyHint: false,
|
|
35
|
+
destructiveHint: false,
|
|
36
|
+
openWorldHint: true,
|
|
37
|
+
},
|
|
38
|
+
}, async ({ planIdentifier }) => {
|
|
39
|
+
try {
|
|
40
|
+
const data = await bridge.exportData();
|
|
41
|
+
const plans = requirePlans(data);
|
|
42
|
+
const plan = resolvePlan(plans, planIdentifier);
|
|
43
|
+
if (!plan)
|
|
44
|
+
throw planNotFoundError(plans, planIdentifier);
|
|
45
|
+
const markdown = renderPlanReport(data, plan);
|
|
46
|
+
// The name the report shows, so the saved copy's title and file name
|
|
47
|
+
// are scrubbed the way its body is.
|
|
48
|
+
const name = redactSecrets(planDisplayName(plan), { byName: true });
|
|
49
|
+
const note = await savePrintCopy(markdown, `Plan Inputs and Assumptions: ${name}`, name);
|
|
50
|
+
return {
|
|
51
|
+
content: [
|
|
52
|
+
{ type: "text", text: markdown },
|
|
53
|
+
{ type: "text", text: note },
|
|
54
|
+
],
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
catch (err) {
|
|
58
|
+
return errorResult(err);
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=planReport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planReport.js","sourceRoot":"","sources":["../../src/tools/planReport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC5F,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,MAAM,UAAU,sBAAsB,CAAC,MAAiB,EAAE,MAAc;IACtE,MAAM,CAAC,YAAY,CACjB,+BAA+B,EAC/B;QACE,KAAK,EAAE,wCAAwC;QAC/C,WAAW,EACT,qFAAqF;YACrF,8EAA8E;YAC9E,oFAAoF;YACpF,kFAAkF;YAClF,mFAAmF;YACnF,qEAAqE;YACrE,oFAAoF;YACpF,mFAAmF;YACnF,iFAAiF;YACjF,+BAA+B;YAC/B,+EAA+E;YAC/E,wFAAwF;YACxF,qFAAqF;YACrF,gCAAgC;YAChC,kFAAkF;YAClF,kDAAkD;QAC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
|
|
2
|
+
import { errorResult, ProjectionLabError } from "../errors.js";
|
|
3
|
+
import { toJson } from "../json.js";
|
|
4
|
+
import { redactSecrets } from "../redact.js";
|
|
5
|
+
/** How often the server reads the page while it waits. Each read is its own
|
|
6
|
+
* operation, so the clock runs in Node and a hidden tab's throttled timers
|
|
7
|
+
* cannot stretch it. */
|
|
8
|
+
const POLL_MS = 250;
|
|
9
|
+
/** A projection counts as settled once its revision has not changed for
|
|
10
|
+
* this long (design 3.1: a run follows a write in about 0.14 s). */
|
|
11
|
+
const QUIET_MS = 1_500;
|
|
12
|
+
/** The longest wait for a projection run. */
|
|
13
|
+
const PROJECTION_WAIT_MS = 30_000;
|
|
14
|
+
/** How long the Chance of Success screen may take to show its Run button,
|
|
15
|
+
* and a pressed Run to show as started. */
|
|
16
|
+
const RUN_START_WAIT_MS = 10_000;
|
|
17
|
+
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
18
|
+
async function app(bridge, method, options) {
|
|
19
|
+
if (!bridge.appRequest) {
|
|
20
|
+
throw new ProjectionLabError("EXECUTOR_OUTDATED", "This bridge cannot read ProjectionLab's results", "Results need the MCP Bridge for ProjectionLab extension or the console snippet.");
|
|
21
|
+
}
|
|
22
|
+
return (await bridge.appRequest(method, options));
|
|
23
|
+
}
|
|
24
|
+
function requireActivePlan(active, planId) {
|
|
25
|
+
if (planId === undefined || planId === active.id)
|
|
26
|
+
return;
|
|
27
|
+
throw new ProjectionLabError("PLAN_NOT_ACTIVE", `Plan ${planId} is not the active plan. ProjectionLab computes results only for the plan open in the app, ` +
|
|
28
|
+
`which is "${active.name}" (${active.id}).`, "Read the active plan's results, or ask the user to open the other plan in ProjectionLab (the plan switcher " +
|
|
29
|
+
"in the sidebar) and try again.");
|
|
30
|
+
}
|
|
31
|
+
const amount = (value) => value === null ? "not shown" : Math.round(value).toLocaleString("en-US");
|
|
32
|
+
function dollarsPhrase(dollars, noInflation = false) {
|
|
33
|
+
if (noInflation)
|
|
34
|
+
return "the plan has no inflation, so today's and future dollars are the same";
|
|
35
|
+
if (dollars === "today")
|
|
36
|
+
return "in today's dollars, as the user's chart shows them";
|
|
37
|
+
if (dollars === "future")
|
|
38
|
+
return "in future dollars, as the user's chart shows them";
|
|
39
|
+
return "in the units the user's chart shows";
|
|
40
|
+
}
|
|
41
|
+
const yearPhrase = (ref) => ref ? `${ref.year}${ref.age === null ? "" : `, age ${ref.age}`}` : "year not shown";
|
|
42
|
+
function projectionSummary(read) {
|
|
43
|
+
const parts = [
|
|
44
|
+
`ProjectionLab projects "${read.plan.name}"` +
|
|
45
|
+
(read.outcome.status ? ` with the outcome "${read.outcome.status}".` : "."),
|
|
46
|
+
`Net worth at retirement (${yearPhrase(read.retirement)}): ${amount(read.netWorthAtRetirement)}.`,
|
|
47
|
+
`Net worth at the end of the plan (${yearPhrase(read.endOfPlan)}): ${amount(read.finalNetWorth)}.`,
|
|
48
|
+
`Figures are ${dollarsPhrase(read.dollars, read.noInflation)}.`,
|
|
49
|
+
];
|
|
50
|
+
if (read.compare) {
|
|
51
|
+
parts.push(`Compare is on against "${read.compare.referenceName ?? "another plan"}"` +
|
|
52
|
+
(read.compare.whatIf ? " (What If)" : "") +
|
|
53
|
+
(read.compare.years ? "; its projection is in compare.years." : "; its projection is not readable yet."));
|
|
54
|
+
}
|
|
55
|
+
parts.push(`The user is on ${read.route}.`);
|
|
56
|
+
return parts.join(" ");
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* The milestones to return, by year. ProjectionLab marks the plan's own
|
|
60
|
+
* milestones and the events it treats as key (running out of money or of
|
|
61
|
+
* liquidity, a sale the withdrawal strategy forces) as critical; the start
|
|
62
|
+
* and end of each income, expense and asset event are not. A milestone with
|
|
63
|
+
* no year sorts last, and one year keeps ProjectionLab's order.
|
|
64
|
+
*/
|
|
65
|
+
function milestoneList(milestones, allEvents) {
|
|
66
|
+
const kept = allEvents ? milestones : milestones.filter((milestone) => milestone.critical === true);
|
|
67
|
+
const yearOf = (milestone) => typeof milestone.year === "number" ? milestone.year : Infinity;
|
|
68
|
+
return {
|
|
69
|
+
milestones: kept
|
|
70
|
+
.map((milestone, index) => ({ milestone, index }))
|
|
71
|
+
.sort((a, b) => yearOf(a.milestone) - yearOf(b.milestone) || a.index - b.index)
|
|
72
|
+
.map(({ milestone }) => milestone),
|
|
73
|
+
otherEvents: milestones.length - kept.length,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Waits until the projection revision is past `after` (when given) and has
|
|
78
|
+
* not changed for QUIET_MS, then reads it. A revision that changed between
|
|
79
|
+
* the wait and the read restarts the wait.
|
|
80
|
+
*/
|
|
81
|
+
async function settledProjection(bridge, planId, after, options) {
|
|
82
|
+
const deadline = Date.now() + PROJECTION_WAIT_MS;
|
|
83
|
+
let seen;
|
|
84
|
+
let since = Date.now();
|
|
85
|
+
let route = "";
|
|
86
|
+
for (;;) {
|
|
87
|
+
const state = await app(bridge, "appState");
|
|
88
|
+
route = state.route;
|
|
89
|
+
requireActivePlan(state.activePlan, planId);
|
|
90
|
+
const revision = state.projection.present ? state.projection.revision : null;
|
|
91
|
+
if (revision !== seen) {
|
|
92
|
+
seen = revision;
|
|
93
|
+
since = Date.now();
|
|
94
|
+
}
|
|
95
|
+
const ready = revision !== null && (after === undefined || revision > after);
|
|
96
|
+
if (ready && Date.now() - since >= QUIET_MS) {
|
|
97
|
+
const read = await app(bridge, "getProjection", options);
|
|
98
|
+
if (read.revision === revision)
|
|
99
|
+
return read;
|
|
100
|
+
seen = read.revision;
|
|
101
|
+
since = Date.now();
|
|
102
|
+
}
|
|
103
|
+
if (Date.now() >= deadline)
|
|
104
|
+
break;
|
|
105
|
+
await sleep(POLL_MS);
|
|
106
|
+
}
|
|
107
|
+
if (after !== undefined && seen === after) {
|
|
108
|
+
throw new ProjectionLabError("PROJECTION_TIMEOUT", `ProjectionLab has not re-run the projection since the write within ${PROJECTION_WAIT_MS / 1000} seconds. The user is on ${route}.`, "A change the projection does not depend on leaves it as it was: read it again without afterProjection.");
|
|
109
|
+
}
|
|
110
|
+
throw new ProjectionLabError("PROJECTION_TIMEOUT", `ProjectionLab did not finish a projection run within ${PROJECTION_WAIT_MS / 1000} seconds. The user is on ${route}.`, "Ask the user to check that the plan screen has loaded in ProjectionLab, then try again.");
|
|
111
|
+
}
|
|
112
|
+
export function registerProjectionTools(server, bridge) {
|
|
113
|
+
const planIdArg = z
|
|
114
|
+
.string()
|
|
115
|
+
.min(1)
|
|
116
|
+
.optional()
|
|
117
|
+
.describe("The plan to read. Must be the plan open in ProjectionLab; omit it to use that plan.");
|
|
118
|
+
server.registerTool("projectionlab_get_projection", {
|
|
119
|
+
title: "Get Projection",
|
|
120
|
+
description: "Reads ProjectionLab's own projection of the active plan from the user's ProjectionLab tab: " +
|
|
121
|
+
"the outcome, retirement and end-of-plan net worth, a yearly table (net worth, liquid net worth, " +
|
|
122
|
+
"income, spending, taxes, shortfall) and milestone years in order. ProjectionLab computes every figure; this " +
|
|
123
|
+
"tool only reads them. Opens the plan overview when the user is not on a plan screen and leaves them " +
|
|
124
|
+
"there (refused with APP_BUSY while a dialog is open). Waits for a settled run. After a confirmed plan " +
|
|
125
|
+
"write, pass its `projection` result as `afterProjection` so the figures reflect the change. While " +
|
|
126
|
+
"Compare is on, also returns the reference plan's projection. Figures are in the units the user's " +
|
|
127
|
+
"chart shows (`dollars`). Relay `summary` as written and attribute every figure to ProjectionLab.",
|
|
128
|
+
inputSchema: {
|
|
129
|
+
planId: planIdArg,
|
|
130
|
+
afterProjection: z
|
|
131
|
+
.object({ planId: z.string(), revision: z.number().int() })
|
|
132
|
+
.optional()
|
|
133
|
+
.describe("The `projection` object a confirmed write returned; the tool waits for a newer run."),
|
|
134
|
+
fromYear: z.number().int().optional().describe("First calendar year in the yearly table."),
|
|
135
|
+
toYear: z.number().int().optional().describe("Last calendar year in the yearly table."),
|
|
136
|
+
fields: z
|
|
137
|
+
.array(z.string().min(1).max(64))
|
|
138
|
+
.max(20)
|
|
139
|
+
.optional()
|
|
140
|
+
.describe("More per-year values: a chart metric key (for example investableAssets, netIncome, " +
|
|
141
|
+
"effectiveTaxRate, wr) gives its total; a row field (for example endingValues) gives its value."),
|
|
142
|
+
allEvents: z
|
|
143
|
+
.boolean()
|
|
144
|
+
.optional()
|
|
145
|
+
.describe("Also list the start and end of every income, expense and asset event. By default `milestones` " +
|
|
146
|
+
"holds the plan's milestones and the events ProjectionLab marks as key, such as running out of money."),
|
|
147
|
+
},
|
|
148
|
+
annotations: {
|
|
149
|
+
readOnlyHint: false,
|
|
150
|
+
destructiveHint: false,
|
|
151
|
+
idempotentHint: true,
|
|
152
|
+
openWorldHint: false,
|
|
153
|
+
},
|
|
154
|
+
}, async ({ planId, afterProjection, fromYear, toYear, fields, allEvents }) => {
|
|
155
|
+
try {
|
|
156
|
+
const state = await app(bridge, "appState");
|
|
157
|
+
requireActivePlan(state.activePlan, planId);
|
|
158
|
+
let moved = false;
|
|
159
|
+
if (!state.planScreen) {
|
|
160
|
+
moved = (await app(bridge, "openScreen", { screen: "plan" })).moved;
|
|
161
|
+
}
|
|
162
|
+
const notes = [];
|
|
163
|
+
let after;
|
|
164
|
+
if (afterProjection && afterProjection.planId === state.activePlan.id)
|
|
165
|
+
after = afterProjection.revision;
|
|
166
|
+
else if (afterProjection) {
|
|
167
|
+
notes.push("afterProjection came from another plan and was not used.");
|
|
168
|
+
}
|
|
169
|
+
// A run stays readable while no plan screen is open, so one read just
|
|
170
|
+
// after opening the screen can predate a change (design 2.6).
|
|
171
|
+
if (after === undefined && moved) {
|
|
172
|
+
notes.push("This read opened the plan screen, so the run may predate a change made while no plan screen was open.");
|
|
173
|
+
}
|
|
174
|
+
const read = await settledProjection(bridge, state.activePlan.id, after, { fromYear, toYear, fields });
|
|
175
|
+
const base = {
|
|
176
|
+
source: "ProjectionLab",
|
|
177
|
+
plan: read.plan,
|
|
178
|
+
screen: read.route,
|
|
179
|
+
openedScreen: moved,
|
|
180
|
+
revision: read.revision,
|
|
181
|
+
};
|
|
182
|
+
if (!read.allFeatures) {
|
|
183
|
+
return text({
|
|
184
|
+
...base,
|
|
185
|
+
gated: true,
|
|
186
|
+
summary: `ProjectionLab shows the projection for "${read.plan.name}" on the user's screen (${read.route}). ` +
|
|
187
|
+
"This account does not have all of ProjectionLab's features, so this tool returns no figures; " +
|
|
188
|
+
"the user can read them in the app.",
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
const events = milestoneList(read.milestones, allEvents === true);
|
|
192
|
+
return text({
|
|
193
|
+
...base,
|
|
194
|
+
gated: false,
|
|
195
|
+
summary: projectionSummary(read),
|
|
196
|
+
notes,
|
|
197
|
+
dollars: read.dollars,
|
|
198
|
+
noInflation: read.noInflation,
|
|
199
|
+
outcome: read.outcome,
|
|
200
|
+
start: read.start,
|
|
201
|
+
retirement: read.retirement,
|
|
202
|
+
endOfPlan: read.endOfPlan,
|
|
203
|
+
netWorthAtRetirement: read.netWorthAtRetirement,
|
|
204
|
+
finalNetWorth: read.finalNetWorth,
|
|
205
|
+
finalNetLegacy: read.finalNetLegacy,
|
|
206
|
+
years: read.years,
|
|
207
|
+
milestones: events.milestones,
|
|
208
|
+
...(allEvents === true ? {} : { otherEvents: events.otherEvents }),
|
|
209
|
+
compare: read.compare,
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
catch (err) {
|
|
213
|
+
return errorResult(err);
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
server.registerTool("projectionlab_run_chance_of_success", {
|
|
217
|
+
title: "Run Chance of Success",
|
|
218
|
+
description: "Starts ProjectionLab's own Chance of Success run for the active plan, the way the user would: " +
|
|
219
|
+
"opens the Chance of Success screen (refused with APP_BUSY while a dialog is open), presses Run or " +
|
|
220
|
+
"Re-run, and returns once the run has started, leaving the user on that screen. Then read the " +
|
|
221
|
+
"result with projectionlab_get_chance_of_success. A new run replaces the previous results. The run " +
|
|
222
|
+
"changes no plan input, but before it starts ProjectionLab resets the plan's stored chart metric if " +
|
|
223
|
+
"that is not one of the plan's metrics, as it does when the user presses Run. It works with plan " +
|
|
224
|
+
"edits off and takes no confirm step, so start a run only when the user asks for one.",
|
|
225
|
+
inputSchema: { planId: planIdArg },
|
|
226
|
+
annotations: {
|
|
227
|
+
readOnlyHint: false,
|
|
228
|
+
destructiveHint: false,
|
|
229
|
+
idempotentHint: false,
|
|
230
|
+
openWorldHint: false,
|
|
231
|
+
},
|
|
232
|
+
}, async ({ planId }) => {
|
|
233
|
+
try {
|
|
234
|
+
const state = await app(bridge, "appState");
|
|
235
|
+
requireActivePlan(state.activePlan, planId);
|
|
236
|
+
if (state.monteCarlo.running) {
|
|
237
|
+
throw new ProjectionLabError("RUN_IN_PROGRESS", "A Chance of Success run is already in progress.", "Wait for it, then read it with projectionlab_get_chance_of_success.");
|
|
238
|
+
}
|
|
239
|
+
await app(bridge, "openScreen", { screen: "chanceOfSuccess" });
|
|
240
|
+
const pressDeadline = Date.now() + RUN_START_WAIT_MS;
|
|
241
|
+
let pressed;
|
|
242
|
+
while (!pressed) {
|
|
243
|
+
try {
|
|
244
|
+
pressed = await app(bridge, "startMonteCarlo");
|
|
245
|
+
}
|
|
246
|
+
catch (err) {
|
|
247
|
+
// The screen may still be mounting its Run button.
|
|
248
|
+
if (!(err instanceof ProjectionLabError) || err.code !== "RUN_UNAVAILABLE" || Date.now() >= pressDeadline)
|
|
249
|
+
throw err;
|
|
250
|
+
await sleep(POLL_MS);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
// Waiting for the button and waiting for the run each get the full time.
|
|
254
|
+
const startDeadline = Date.now() + RUN_START_WAIT_MS;
|
|
255
|
+
for (;;) {
|
|
256
|
+
const now = await app(bridge, "appState");
|
|
257
|
+
const revision = now.monteCarlo.runRevision;
|
|
258
|
+
const before = pressed.runRevisionBefore;
|
|
259
|
+
if (now.monteCarlo.running || (revision !== null && (before === null || revision > before))) {
|
|
260
|
+
return text({
|
|
261
|
+
source: "ProjectionLab",
|
|
262
|
+
started: true,
|
|
263
|
+
plan: now.activePlan,
|
|
264
|
+
screen: now.route,
|
|
265
|
+
totalTrials: now.monteCarlo.totalTrials,
|
|
266
|
+
summary: `ProjectionLab is running Chance of Success for "${now.activePlan.name}" ` +
|
|
267
|
+
`(${now.monteCarlo.totalTrials.toLocaleString("en-US")} trials). The user is on ${now.route}.`,
|
|
268
|
+
next: "call projectionlab_get_chance_of_success",
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
if (Date.now() >= startDeadline)
|
|
272
|
+
break;
|
|
273
|
+
await sleep(POLL_MS);
|
|
274
|
+
}
|
|
275
|
+
throw new ProjectionLabError("RUN_UNAVAILABLE", "Run was pressed in ProjectionLab, but no Chance of Success run started.", "Ask the user to look at the Chance of Success screen; the plan may need attention before it runs.");
|
|
276
|
+
}
|
|
277
|
+
catch (err) {
|
|
278
|
+
return errorResult(err);
|
|
279
|
+
}
|
|
280
|
+
});
|
|
281
|
+
server.registerTool("projectionlab_get_chance_of_success", {
|
|
282
|
+
title: "Get Chance of Success",
|
|
283
|
+
description: "Reads the active plan's latest Chance of Success run from the user's ProjectionLab tab, without " +
|
|
284
|
+
"starting one: progress while it runs; when done, ProjectionLab's Chance of Success figure, the " +
|
|
285
|
+
"outcome counts, percentile bands of each chart metric (at the start, retirement, end of plan and " +
|
|
286
|
+
"every tenth year, or a year range), the milestone table and the run's settings. `stale: true` means " +
|
|
287
|
+
"ProjectionLab marks the run as older than the plan. After a confirmed plan write, pass its " +
|
|
288
|
+
"`chanceOfSuccessRunRevision` as `afterRunRevision`. Changes nothing. Relay `summary` as written and " +
|
|
289
|
+
"attribute every figure to ProjectionLab.",
|
|
290
|
+
inputSchema: {
|
|
291
|
+
planId: planIdArg,
|
|
292
|
+
afterRunRevision: z
|
|
293
|
+
.number()
|
|
294
|
+
.int()
|
|
295
|
+
.optional()
|
|
296
|
+
.describe("The `chanceOfSuccessRunRevision` a confirmed write returned; older runs come back stale."),
|
|
297
|
+
metric: z.string().min(1).max(64).optional().describe("One chart metric (for example netWorth, wr) instead of all."),
|
|
298
|
+
percentiles: z
|
|
299
|
+
.array(z.string().min(1).max(20))
|
|
300
|
+
.max(11)
|
|
301
|
+
.optional()
|
|
302
|
+
.describe('Percentile labels as ProjectionLab names them, "Top 1%" through "Median" to "Bottom 1%".'),
|
|
303
|
+
fromYear: z.number().int().optional().describe("First calendar year for the percentile bands."),
|
|
304
|
+
toYear: z.number().int().optional().describe("Last calendar year for the percentile bands."),
|
|
305
|
+
},
|
|
306
|
+
annotations: {
|
|
307
|
+
readOnlyHint: true,
|
|
308
|
+
destructiveHint: false,
|
|
309
|
+
idempotentHint: true,
|
|
310
|
+
openWorldHint: false,
|
|
311
|
+
},
|
|
312
|
+
}, async ({ planId, afterRunRevision, metric, percentiles, fromYear, toYear }) => {
|
|
313
|
+
try {
|
|
314
|
+
const read = await app(bridge, "getMonteCarlo", {
|
|
315
|
+
metric,
|
|
316
|
+
percentiles,
|
|
317
|
+
fromYear,
|
|
318
|
+
toYear,
|
|
319
|
+
});
|
|
320
|
+
requireActivePlan(read.plan, planId);
|
|
321
|
+
const name = read.plan.name;
|
|
322
|
+
if (read.gated) {
|
|
323
|
+
return text({
|
|
324
|
+
source: "ProjectionLab",
|
|
325
|
+
gated: true,
|
|
326
|
+
plan: read.plan,
|
|
327
|
+
screen: read.route,
|
|
328
|
+
summary: `ProjectionLab shows Chance of Success for "${name}" on its Chance of Success screen. This ` +
|
|
329
|
+
"account does not have all of ProjectionLab's features, so this tool returns no figures; the " +
|
|
330
|
+
"user can see what their account shows in the app.",
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
if (read.running) {
|
|
334
|
+
return text({
|
|
335
|
+
source: "ProjectionLab",
|
|
336
|
+
running: true,
|
|
337
|
+
plan: read.plan,
|
|
338
|
+
screen: read.route,
|
|
339
|
+
completedTrials: read.completedTrials,
|
|
340
|
+
totalTrials: read.totalTrials,
|
|
341
|
+
summary: `ProjectionLab is still running Chance of Success for "${name}": ` +
|
|
342
|
+
`${(read.completedTrials ?? 0).toLocaleString("en-US")} of ${read.totalTrials.toLocaleString("en-US")} trials.`,
|
|
343
|
+
next: "call projectionlab_get_chance_of_success again in a few seconds",
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
if (!read.ran) {
|
|
347
|
+
return text({
|
|
348
|
+
source: "ProjectionLab",
|
|
349
|
+
ran: false,
|
|
350
|
+
plan: read.plan,
|
|
351
|
+
screen: read.route,
|
|
352
|
+
summary: `ProjectionLab has no Chance of Success results for "${name}" in this session yet.`,
|
|
353
|
+
next: "call projectionlab_run_chance_of_success when the user asks for a run",
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
const olderThanWrite = afterRunRevision !== undefined && (read.runRevision === null || read.runRevision <= afterRunRevision);
|
|
357
|
+
const stale = read.stale === true || olderThanWrite;
|
|
358
|
+
const { plan, route, ...results } = read;
|
|
359
|
+
return text({
|
|
360
|
+
source: "ProjectionLab",
|
|
361
|
+
summary: `ProjectionLab says the chance of success for "${name}" is ${read.chanceOfSuccessPercent}% ` +
|
|
362
|
+
`(${(read.trials ?? 0).toLocaleString("en-US")} trials)` +
|
|
363
|
+
(stale ? ", from a run older than the plan's latest change." : ".") +
|
|
364
|
+
` Currency figures are ${dollarsPhrase(read.dollars)}.`,
|
|
365
|
+
plan,
|
|
366
|
+
screen: route,
|
|
367
|
+
...results,
|
|
368
|
+
stale,
|
|
369
|
+
...(stale ? { next: "call projectionlab_run_chance_of_success when the user asks for a fresh run" } : {}),
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
catch (err) {
|
|
373
|
+
return errorResult(err);
|
|
374
|
+
}
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
/** A result, scrubbed like every other read of page data. */
|
|
378
|
+
function text(value) {
|
|
379
|
+
return { content: [{ type: "text", text: toJson(redactSecrets(value, { byName: true })) }] };
|
|
380
|
+
}
|
|
381
|
+
//# sourceMappingURL=projection.js.map
|
|
@@ -0,0 +1 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I,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,cAAc,CAAC,OAAO,CAAC,UAAU;oBACxD,CAAC,KAAK,CAAC,CAAC,CAAC,mDAAmD,CAAC,CAAC,CAAC,GAAG,CAAC;oBACnE,yBAAyB,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG;gBACzD,IAAI;gBACJ,MAAM,EAAE,KAAK;gBACb,GAAG,OAAO;gBACV,KAAK;gBACL,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,6EAA6E,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aAC1G,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC;AAED,6DAA6D;AAC7D,SAAS,IAAI,CAAC,KAAc;IAC1B,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,MAAM,CAAC,aAAa,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;AACxG,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
import { type Bridge } from "../bridge.js";
|
|
3
|
+
import type { SnapshotManager } from "../snapshot.js";
|
|
4
|
+
export declare function registerRemovePlanEventTool(server: McpServer, bridge: Bridge, snapshots: SnapshotManager): void;
|