projectionlab-mcp 1.3.0 → 1.4.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 +1 -1
- package/MANUAL-SETUP.md +1 -1
- package/REFERENCE.md +7 -7
- package/SETUP-FOR-AGENTS.md +1 -1
- package/dist/bootstrap.js +0 -1
- package/dist/bootstrap.js.map +1 -1
- package/dist/bridge.d.ts +8 -14
- package/dist/config.js +4 -2
- package/dist/config.js.map +1 -1
- package/dist/currentFinances.d.ts +4 -12
- package/dist/currentFinances.js +8 -44
- package/dist/currentFinances.js.map +1 -1
- package/dist/dataModel.d.ts +9 -11
- package/dist/dataModel.js +25 -849
- package/dist/dataModel.js.map +1 -1
- package/dist/diff.d.ts +18 -20
- package/dist/diff.js +57 -172
- package/dist/diff.js.map +1 -1
- package/dist/extensionBridge.d.ts +16 -15
- package/dist/extensionBridge.js +33 -49
- package/dist/extensionBridge.js.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/layout.d.ts +32 -36
- package/dist/layout.js +44 -62
- package/dist/layout.js.map +1 -1
- package/dist/linkedFields.d.ts +74 -0
- package/dist/linkedFields.js +189 -0
- package/dist/linkedFields.js.map +1 -0
- package/dist/pathPatch.d.ts +3 -4
- package/dist/pathPatch.js +8 -8
- package/dist/pathPatch.js.map +1 -1
- package/dist/planSettings.d.ts +4 -6
- package/dist/planSettings.js +5 -9
- package/dist/planSettings.js.map +1 -1
- package/dist/plans.d.ts +24 -5
- package/dist/plans.js +99 -15
- package/dist/plans.js.map +1 -1
- package/dist/realEstate.d.ts +0 -21
- package/dist/realEstate.js +0 -117
- package/dist/realEstate.js.map +1 -1
- package/dist/resources/dataModel.d.ts +2 -6
- package/dist/resources/dataModel.js +24 -55
- package/dist/resources/dataModel.js.map +1 -1
- package/dist/resources/knowledge.d.ts +2 -7
- package/dist/resources/knowledge.js +8 -245
- package/dist/resources/knowledge.js.map +1 -1
- package/dist/resources/planData.js +1 -1
- package/dist/resources/planData.js.map +1 -1
- package/dist/settingsReport.d.ts +25 -0
- package/dist/settingsReport.js +464 -0
- package/dist/settingsReport.js.map +1 -0
- package/dist/settingsReportLayout.d.ts +59 -0
- package/dist/settingsReportLayout.js +367 -0
- package/dist/settingsReportLayout.js.map +1 -0
- package/dist/snapshot.d.ts +1 -2
- package/dist/snapshot.js +2 -2
- package/dist/snapshot.js.map +1 -1
- package/dist/summary.d.ts +3 -8
- package/dist/summary.js +7 -71
- package/dist/summary.js.map +1 -1
- package/dist/tools/bootstrap.js +1 -1
- package/dist/tools/bootstrap.js.map +1 -1
- package/dist/tools/clonePlan.js +3 -3
- package/dist/tools/clonePlan.js.map +1 -1
- package/dist/tools/connection.js +3 -3
- package/dist/tools/connection.js.map +1 -1
- package/dist/tools/deletePlan.js +3 -3
- package/dist/tools/deletePlan.js.map +1 -1
- package/dist/tools/diff.js +17 -23
- package/dist/tools/diff.js.map +1 -1
- package/dist/tools/export.js +2 -2
- package/dist/tools/export.js.map +1 -1
- package/dist/tools/getCurrentFinances.js +8 -48
- package/dist/tools/getCurrentFinances.js.map +1 -1
- package/dist/tools/getPlan.js +2 -4
- package/dist/tools/getPlan.js.map +1 -1
- package/dist/tools/getPlanSection.js +35 -10
- package/dist/tools/getPlanSection.js.map +1 -1
- package/dist/tools/getPlanSettings.js +8 -12
- package/dist/tools/getPlanSettings.js.map +1 -1
- package/dist/tools/restore.js +12 -87
- package/dist/tools/restore.js.map +1 -1
- package/dist/tools/schema.js +16 -71
- package/dist/tools/schema.js.map +1 -1
- package/dist/tools/settingsReport.d.ts +3 -0
- package/dist/tools/settingsReport.js +76 -0
- package/dist/tools/settingsReport.js.map +1 -0
- package/dist/tools/snapshots.js +9 -14
- package/dist/tools/snapshots.js.map +1 -1
- package/dist/tools/summary.js +1 -1
- package/dist/tools/summary.js.map +1 -1
- package/dist/tools/updateAccount.js +16 -26
- package/dist/tools/updateAccount.js.map +1 -1
- package/dist/tools/updatePlanEvent.js +22 -9
- package/dist/tools/updatePlanEvent.js.map +1 -1
- package/dist/tools/updatePlanSection.js +54 -9
- package/dist/tools/updatePlanSection.js.map +1 -1
- package/dist/tools/updatePlanSettings.js +4 -4
- package/dist/tools/updatePlanSettings.js.map +1 -1
- package/dist/tools/writeGuard.d.ts +3 -2
- package/dist/tools/writeGuard.js +5 -4
- package/dist/tools/writeGuard.js.map +1 -1
- package/dist/types/projectionlab.d.ts +4 -5
- package/dist/types/wire.d.ts +1 -1
- package/dist/types/wire.js.map +1 -1
- package/package.json +1 -1
- package/skills/projectionlab/SKILL.md +61 -65
- package/dist/resources/layoutResource.d.ts +0 -19
- package/dist/resources/layoutResource.js +0 -43
- package/dist/resources/layoutResource.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"writeGuard.js","sourceRoot":"","sources":["../../src/tools/writeGuard.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAGtE
|
|
1
|
+
{"version":3,"file":"writeGuard.js","sourceRoot":"","sources":["../../src/tools/writeGuard.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAGtE;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,MAAmC,EACnC,OAA8B;IAE9B,MAAM,MAAM,CAAC,WAAW,EAAE,CAAC;IAC3B,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC;YAAE,MAAM,sBAAsB,CAAC,MAAM,CAAC,CAAC;IACpE,CAAC;AACH,CAAC"}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import type { ExportLayout } from "../layout.js";
|
|
2
1
|
export interface ExportedData {
|
|
3
|
-
today?: unknown;
|
|
4
2
|
plans?: unknown[];
|
|
5
3
|
progress?: unknown;
|
|
6
4
|
settings?: unknown;
|
|
@@ -41,8 +39,9 @@ export interface Snapshot {
|
|
|
41
39
|
timestamp: string;
|
|
42
40
|
operation: string;
|
|
43
41
|
sections: string[];
|
|
44
|
-
/** Export layout the data was taken from
|
|
45
|
-
* without one were taken from ProjectionLab 4
|
|
46
|
-
|
|
42
|
+
/** Export layout the data was taken from: "v5" for ProjectionLab 5.
|
|
43
|
+
* Snapshots without one were taken from ProjectionLab 4; rollback and diff
|
|
44
|
+
* refuse them (assertSnapshotLayout in src/layout.ts). */
|
|
45
|
+
layout?: string;
|
|
47
46
|
data: Record<string, unknown>;
|
|
48
47
|
}
|
package/dist/types/wire.d.ts
CHANGED
|
@@ -43,7 +43,7 @@ export declare const HEARTBEAT_INTERVAL_MS = 20000;
|
|
|
43
43
|
* (ProjectionLab 5); see src/layout.ts. An executor that predates
|
|
44
44
|
* `apiVersion` rejects it as "Not a wire protocol method".
|
|
45
45
|
*/
|
|
46
|
-
export type WireMethod = "exportData" | "getAccounts" | "updateAccount" | "updateAccountValues" | "restoreCurrentFinances" | "restorePlans" | "
|
|
46
|
+
export type WireMethod = "exportData" | "getAccounts" | "updateAccount" | "updateAccountValues" | "restoreCurrentFinances" | "restorePlans" | "restoreSettings" | "validateApiKey" | "describeApi" | "waitForApi" | "apiVersion";
|
|
47
47
|
/**
|
|
48
48
|
* The methods that only read. Every other method is a write, which the
|
|
49
49
|
* server sends only to an executor that reports allowEdits on, and which the
|
package/dist/types/wire.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wire.js","sourceRoot":"","sources":["../../src/types/wire.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;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;
|
|
1
|
+
{"version":3,"file":"wire.js","sourceRoot":"","sources":["../../src/types/wire.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;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;AA6B5C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,YAAY,GAA0B;IACjD,YAAY;IACZ,aAAa;IACb,gBAAgB;IAChB,aAAa;IACb,YAAY;IACZ,YAAY;CACb,CAAC;AAuIF,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;IACV,iEAAiE;IACjE,OAAO,EAAE,IAAI;IACb;;;;OAIG;IACH,WAAW,EAAE,IAAI;CACT,CAAC"}
|
package/package.json
CHANGED
|
@@ -26,9 +26,9 @@ returns `browser`, `pageLoaded`, `apiAvailable`, `apiKeyValid`, `errors`,
|
|
|
26
26
|
answered. When the first four flags are `true`, proceed. Otherwise fix the
|
|
27
27
|
first failing item with the user, one step at a time, then check again.
|
|
28
28
|
|
|
29
|
-
`apiContract` is the Plugin API contract the page offers: `
|
|
30
|
-
ProjectionLab
|
|
31
|
-
|
|
29
|
+
`apiContract` is the Plugin API contract the page offers: `2` on
|
|
30
|
+
ProjectionLab 5. A page that reports no contract or another one fails the
|
|
31
|
+
check with `UNSUPPORTED_API_VERSION`, and nothing is read or written there.
|
|
32
32
|
|
|
33
33
|
`notices` are plain sentences about the server's release, never connection
|
|
34
34
|
failures. When the list is not empty, tell the user each one once, in plain
|
|
@@ -52,7 +52,7 @@ options page (browsers isolate extension storage by ID, so settings do not trans
|
|
|
52
52
|
| `browser: false`, port held by a program that is not projectionlab-mcp | Some other program is listening on the WebSocket port | Ask the user to stop that program, or set `PL_WS_PORT` to a free port for this server and enter the same port on the extension's options page |
|
|
53
53
|
| `browser: false`, handing the port over did not complete | Another instance holds the port and the browser did not reconnect here in time | Run `projectionlab_check_connection` again; if it keeps failing, ask the user to close the other agent's session |
|
|
54
54
|
| `browser: false` otherwise | No extension or snippet is connected | See "Connecting the browser" |
|
|
55
|
-
| `pageLoaded: false` | No ProjectionLab tab is open, or the account is on
|
|
55
|
+
| `pageLoaded: false` | No ProjectionLab tab is open, or the account is on Early Access and the extension has not been allowed to use it | Ask the user to open https://app.projectionlab.com and log in. If ProjectionLab sends them to https://ea.projectionlab.com, ask them to press **Allow ea.projectionlab.com** on the extension's options page and approve the browser's prompt |
|
|
56
56
|
| `apiAvailable: false` | Plugins are off, or the user is logged out | ProjectionLab -> Account Settings -> Plugins -> enable plugins |
|
|
57
57
|
| `apiKeyValid: false` | The key does not match the account | Ask the user to copy the key again from Account Settings -> Plugins |
|
|
58
58
|
|
|
@@ -93,7 +93,7 @@ Recommended, persistent: the **MCP Bridge for ProjectionLab** browser extension.
|
|
|
93
93
|
The status changes to **Connected** and the toolbar icon shows a green
|
|
94
94
|
check.
|
|
95
95
|
4. Open https://app.projectionlab.com and log in. If ProjectionLab sends the
|
|
96
|
-
user to https://ea.projectionlab.com (
|
|
96
|
+
user to https://ea.projectionlab.com (Early Access), they press
|
|
97
97
|
**Allow ea.projectionlab.com** on the options page and approve the
|
|
98
98
|
browser's prompt.
|
|
99
99
|
|
|
@@ -122,6 +122,7 @@ narrowest read that answers the question.
|
|
|
122
122
|
| One whole plan | `projectionlab_get_plan` |
|
|
123
123
|
| One section of a plan, one event, or one path in it | `projectionlab_get_plan_section` |
|
|
124
124
|
| Assumptions, Chance of Success, withdrawal strategy | `projectionlab_get_plan_settings` |
|
|
125
|
+
| A readable report of a plan's settings, or two plans' settings side by side | `projectionlab_get_settings_report` |
|
|
125
126
|
| Current Finances, or one account's editable paths | `projectionlab_get_current_finances` |
|
|
126
127
|
| Everything (rarely needed) | `projectionlab_export_data` |
|
|
127
128
|
| Snapshots already saved (id, time, operation, sections) | `projectionlab_list_snapshots` |
|
|
@@ -140,6 +141,19 @@ narrowest read that answers the question.
|
|
|
140
141
|
`listPaths: true` to list editable dot paths with their JSON types.
|
|
141
142
|
- `projectionlab_get_plan_settings` returns `variables`, `montecarlo` and
|
|
142
143
|
`withdrawalStrategy` as dot paths with JSON types; pass `section` for one.
|
|
144
|
+
- `projectionlab_get_settings_report` renders the same three sections as a
|
|
145
|
+
markdown report for the user, grouped by topic with everyday settings first
|
|
146
|
+
(growth and inflation, withdrawals, tax strategy, taxes, bonds), then more
|
|
147
|
+
and advanced ones. Settings use their on-screen label where one is known and
|
|
148
|
+
an italic descriptive name otherwise, with values as the app shows them.
|
|
149
|
+
Settings the plan's current choices leave unused (a withdrawal rule that is
|
|
150
|
+
not selected, custom rate curves in fixed mode) are listed near the end
|
|
151
|
+
with the choice that would use them. Add
|
|
152
|
+
`comparePlanIdentifier` for a second plan's column and a Differs marker, and
|
|
153
|
+
`differencesOnly: true` to list only what differs. Show the report as
|
|
154
|
+
returned. Use it when the user asks to see, review or compare settings; use
|
|
155
|
+
`projectionlab_get_plan_settings` for the paths a write needs, and
|
|
156
|
+
`projectionlab_diff` with `planA` and `planB` for events and accounts.
|
|
143
157
|
- `projectionlab_get_current_finances` with an exact `accountId` and
|
|
144
158
|
`listPaths: true` lists that account's editable paths. Real-estate assets
|
|
145
159
|
(`type: "real-estate"` in `assets`) carry a `realEstate` block:
|
|
@@ -167,7 +181,13 @@ narrowest read that answers the question.
|
|
|
167
181
|
out is counted in `omittedFieldChanges` and per-entry `omittedChanges` rather
|
|
168
182
|
than dropped, so a difference past the cap still reads as changed. Use it to
|
|
169
183
|
confirm a write landed as intended, to tell the user what changed, or to see
|
|
170
|
-
what a rollback would undo.
|
|
184
|
+
what a rollback would undo. An event whose name repeats in its section is
|
|
185
|
+
reported by its start, as in `Travel (starts Stop RV life)` or
|
|
186
|
+
`Medicare (starts 2034-10-01)`, and by occurrence (`Travel #2`) only when
|
|
187
|
+
it has no start or shares one with another event of that name; a modified
|
|
188
|
+
event also carries its `id` when it has one. The section dry run of
|
|
189
|
+
`projectionlab_update_plan_section` and the plan-to-plan mode name events
|
|
190
|
+
the same way.
|
|
171
191
|
- `projectionlab_diff` compares two different plans when you give it `planA` and
|
|
172
192
|
`planB` (plan name or exact ID) instead of a snapshot, which answers "does the
|
|
173
193
|
plan I rebuilt by hand match the original?". Both plans come from the live app,
|
|
@@ -229,11 +249,9 @@ values; it is not an API, and it does not contain the application logic.
|
|
|
229
249
|
When a change's effect matters, the user has to look at the result in the
|
|
230
250
|
ProjectionLab UI. The stored data cannot show it.
|
|
231
251
|
|
|
232
|
-
### ProjectionLab 5
|
|
252
|
+
### How ProjectionLab 5 stores the data
|
|
233
253
|
|
|
234
|
-
|
|
235
|
-
on ProjectionLab 5 and its data has a different layout. The read tools handle
|
|
236
|
-
both layouts; these differences show through:
|
|
254
|
+
These traits of the ProjectionLab 5 data show through the tools:
|
|
237
255
|
|
|
238
256
|
- **No active plan.** A ProjectionLab 5 plan has no `active` flag, so
|
|
239
257
|
`projectionlab_get_plan` reports `active: "not reported"`. Never call a plan
|
|
@@ -249,27 +267,28 @@ both layouts; these differences show through:
|
|
|
249
267
|
`eventIdentifier` matches no event id or name. A priority's `accountId` is
|
|
250
268
|
different: it holds the id of the plan's account event, not the Current
|
|
251
269
|
Finances account id. Keep the two kinds of id apart.
|
|
270
|
+
- **Linked fields belong to Current Finances.** A linked event takes some fields from the item it links to, and ProjectionLab
|
|
271
|
+
overwrites a value written to them in the plan. An account event takes its
|
|
272
|
+
name, type, balance, owner, icon, liquidity, cost basis and withdrawal terms
|
|
273
|
+
(`EWAge`, `hasEWPenalty`, `EWPenaltyRate`, `withdrawContribsFree`), among
|
|
274
|
+
others. An asset event takes its name, type, owner, purchase price, value
|
|
275
|
+
and loans, among others. A priority takes `owner` and `icon` from the
|
|
276
|
+
account it routes to. `projectionlab_get_plan_section` with `listPaths`
|
|
277
|
+
marks these paths `syncedFrom` on one linked event, and
|
|
278
|
+
`projectionlab_update_plan_event` and `projectionlab_update_plan_section`
|
|
279
|
+
refuse to change them. Change them with `projectionlab_update_account`
|
|
280
|
+
instead, after telling the user it changes every plan linked to that
|
|
281
|
+
item. projectionlab://data-model lists every linked field.
|
|
252
282
|
- **Current Finances is shared by every plan.** An account has one Current
|
|
253
283
|
Finances document, not one per plan, so `projectionlab_update_account` and
|
|
254
284
|
a Current Finances restore change what every plan starts from. Say so in
|
|
255
|
-
the preview before confirming. Plans keep their own copies of
|
|
256
|
-
fields
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
Finances, not from a plan event. On ProjectionLab 5, a balance or value
|
|
285
|
+
the preview before confirming. Plans keep their own copies of the linked
|
|
286
|
+
fields. Those copies refresh when a plan is opened or saved, so an export
|
|
287
|
+
can show an old value in a plan nobody has opened since. Read today's
|
|
288
|
+
figure from Current Finances, not from a plan event. A balance or value
|
|
260
289
|
edit also overwrites that account's `accountHistory` entry for the current
|
|
261
290
|
day.
|
|
262
|
-
- **
|
|
263
|
-
follow the layout the last connection check found. Read
|
|
264
|
-
`projectionlab://data-model?layout=v4` or `?layout=v5` (the same for
|
|
265
|
-
`knowledge`) to pick one explicitly.
|
|
266
|
-
- **Every write but Progress works.** The plan tools (`projectionlab_update_plan_event`,
|
|
267
|
-
`projectionlab_update_plan_section`, `projectionlab_update_plan_settings`,
|
|
268
|
-
`projectionlab_clone_plan`, `projectionlab_delete_plan`,
|
|
269
|
-
`projectionlab_restore_plans`) and `projectionlab_update_account` behave as
|
|
270
|
-
on ProjectionLab 4. `projectionlab_update_account` reports the account's
|
|
271
|
-
`kind` instead of a `collection`.
|
|
272
|
-
- **Current Finances restores keep missing accounts.** On ProjectionLab 5,
|
|
291
|
+
- **Current Finances restores keep missing accounts.**
|
|
273
292
|
`projectionlab_restore_current_finances` and a rollback of a Current
|
|
274
293
|
Finances snapshot replace every non-account field and each account they
|
|
275
294
|
hold, but never delete an account: one missing from the submission or the
|
|
@@ -277,9 +296,8 @@ both layouts; these differences show through:
|
|
|
277
296
|
lists those as `keptAccounts`; tell the user, and have them archive or
|
|
278
297
|
delete such an account in the ProjectionLab app if it should go.
|
|
279
298
|
- **Settings restores replace the whole document.**
|
|
280
|
-
`projectionlab_restore_settings
|
|
281
|
-
|
|
282
|
-
document it cannot read. Settings are account-wide, not per plan.
|
|
299
|
+
With `projectionlab_restore_settings`, the submission replaces every
|
|
300
|
+
setting, and ProjectionLab refuses a settings document it cannot read. Settings are account-wide, not per plan.
|
|
283
301
|
- **Year alignment can change plans.** The account's year alignment
|
|
284
302
|
(`settings.plan.alignment`) and a plan's override (`variables.alignment`)
|
|
285
303
|
decide where each plan year starts, and so how many plan years the plan
|
|
@@ -298,12 +316,9 @@ both layouts; these differences show through:
|
|
|
298
316
|
document the user has just edited until a read shows the edit: a write
|
|
299
317
|
replaces the unsaved change.
|
|
300
318
|
- **Progress cannot be written.** ProjectionLab 5 records Progress history
|
|
301
|
-
by itself whenever a current value changes
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
`WRITE_NOT_SUPPORTED` before they preview or snapshot anything. Tell the
|
|
305
|
-
user plainly; to bring back Progress from a backup file, they use Restore
|
|
306
|
-
in the ProjectionLab app.
|
|
319
|
+
by itself whenever a current value changes and offers no way to replace
|
|
320
|
+
it, so no tool writes it. Tell the user plainly; to bring back Progress
|
|
321
|
+
from a backup file, they use Restore in the ProjectionLab app.
|
|
307
322
|
- **Old snapshots.** A snapshot taken on ProjectionLab 4 cannot be compared
|
|
308
323
|
with or restored onto ProjectionLab 5 data: `projectionlab_diff` and
|
|
309
324
|
`projectionlab_rollback` refuse it with `LAYOUT_MISMATCH`. A ProjectionLab 4
|
|
@@ -318,7 +333,7 @@ Change the plan only when the user explicitly asks for that change.
|
|
|
318
333
|
- Never guess a path. Read it first with `projectionlab_get_plan_settings`,
|
|
319
334
|
`projectionlab_get_plan_section` or `projectionlab_get_current_finances`,
|
|
320
335
|
the last two with `listPaths: true`.
|
|
321
|
-
- Never assume a rate's scale. ProjectionLab
|
|
336
|
+
- Never assume a rate's scale. ProjectionLab stores most rates as
|
|
322
337
|
percentage points (`variables.inflation: 3` means 3%), but some as fractions
|
|
323
338
|
(`variables.taxStrategy.bracketRate: 0.22` means 22%). Read the current
|
|
324
339
|
value first and write the new one on the same scale; `projectionlab://data-model`
|
|
@@ -358,8 +373,8 @@ not enable writes on your own.
|
|
|
358
373
|
|
|
359
374
|
### Units
|
|
360
375
|
|
|
361
|
-
The scale of a number is the easiest thing to get wrong.
|
|
362
|
-
|
|
376
|
+
The scale of a number is the easiest thing to get wrong.
|
|
377
|
+
`projectionlab://data-model` records these scales:
|
|
363
378
|
|
|
364
379
|
- Rates in `variables` are percentage points: `inflation: 3` means 3%.
|
|
365
380
|
- `taxStrategy.bracketRate` and `taxStrategy.capGainsBracketRate` are decimal
|
|
@@ -434,7 +449,7 @@ Every tool below also takes `confirm` (default `false`, a dry run).
|
|
|
434
449
|
| A what-if copy of a plan | `projectionlab_clone_plan` | `planIdentifier`, `newName` |
|
|
435
450
|
| Remove a plan the user has decided to discard | `projectionlab_delete_plan` | `planId` (exact ID only) |
|
|
436
451
|
| A whole plan section, rebuilt deliberately | `projectionlab_update_plan_section` | `planIdentifier`, `section`, complete `sectionData`, plus `expectedPlanVersion` from the dry run |
|
|
437
|
-
| Replace a whole data area (rare) | `projectionlab_restore_plans`, `projectionlab_restore_current_finances`, `
|
|
452
|
+
| Replace a whole data area (rare) | `projectionlab_restore_plans`, `projectionlab_restore_current_finances`, `projectionlab_restore_settings` | `plans`, `currentFinances`, `settings`: the complete replacement |
|
|
438
453
|
| Undo a confirmed change | `projectionlab_rollback` | exactly one of `snapshotId`, `nBack`, `beforeTime` |
|
|
439
454
|
|
|
440
455
|
Prefer the targeted tools: they change only the paths given and keep sibling
|
|
@@ -462,9 +477,8 @@ patch the copy.
|
|
|
462
477
|
refuses the last remaining plan. Its snapshot lets
|
|
463
478
|
`projectionlab_rollback` restore the deleted plan.
|
|
464
479
|
|
|
465
|
-
`projectionlab_restore_current_finances`, `projectionlab_restore_plans
|
|
466
|
-
`
|
|
467
|
-
an entire data area. Use them only when the user wants exactly that.
|
|
480
|
+
`projectionlab_restore_current_finances`, `projectionlab_restore_plans` and
|
|
481
|
+
`projectionlab_restore_settings` replace an entire data area. Use them only when the user wants exactly that.
|
|
468
482
|
`projectionlab_restore_plans` refuses an empty array, which would delete every
|
|
469
483
|
plan.
|
|
470
484
|
|
|
@@ -609,27 +623,10 @@ must-have." Same plan and event as the example above.
|
|
|
609
623
|
`{"spendingType": {"before": "discretionary", "after": "essential"}}`.
|
|
610
624
|
Show it, get the user's approval, then confirm.
|
|
611
625
|
|
|
612
|
-
**Change a Current Finances account
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
property reads as `type: "real-estate"`). Then
|
|
617
|
-
`projectionlab_get_current_finances` with that `accountId` and
|
|
618
|
-
`listPaths: true` lists the account's editable paths, including `amount`
|
|
619
|
-
and `balance`.
|
|
620
|
-
2. `projectionlab_update_account` with
|
|
621
|
-
`{"accountId": "acct_abc123", "pathChanges": {"amount": 480000}}` returns
|
|
622
|
-
`dryRun: true`, the `accountName`, `collection: "assets"`, and `changes`
|
|
623
|
-
such as `{"amount": {"before": 450000, "after": 480000}}`. A property's
|
|
624
|
-
market value is stored in `amount`; `balance` is its outstanding loan, so
|
|
625
|
-
a value change goes in `amount`, never `balance`. Show the preview.
|
|
626
|
-
3. After the user approves, repeat the call with `"confirm": true`. The reply
|
|
627
|
-
gives `verified` and saves a snapshot of Current Finances.
|
|
628
|
-
|
|
629
|
-
**The same change on ProjectionLab 5.** When `projectionlab_check_connection`
|
|
630
|
-
reports `apiContract: 2`, Current Finances accounts are records of
|
|
631
|
-
`documents.currentFinances.accounts`, keyed by id and narrowed by `kind`, and
|
|
632
|
-
a property keeps its loan in a separate debt record.
|
|
626
|
+
**Change a Current Finances account.** User: "Our rental property is worth
|
|
627
|
+
480000 now; update Current Finances." Current Finances accounts are records
|
|
628
|
+
of `documents.currentFinances.accounts`, keyed by id and narrowed by `kind`,
|
|
629
|
+
and a property keeps its loan in a separate debt record.
|
|
633
630
|
|
|
634
631
|
1. `projectionlab_describe_schema` reports `layout: "v5"` and lists every
|
|
635
632
|
account with its stored `kind` and `type`: the property is a
|
|
@@ -645,8 +642,7 @@ a property keeps its loan in a separate debt record.
|
|
|
645
642
|
`listPaths: true` lists the record's editable paths, including `value` and
|
|
646
643
|
`purchasePrice`. Then `projectionlab_update_account` with
|
|
647
644
|
`{"accountId": "asset_abc123", "pathChanges": {"value": 480000}}` returns
|
|
648
|
-
`dryRun: true`, the `accountName`, `kind: "real-asset"`
|
|
649
|
-
ProjectionLab 4 reply carries a `collection`, and `changes` such as
|
|
645
|
+
`dryRun: true`, the `accountName`, `kind: "real-asset"`, and `changes` such as
|
|
650
646
|
`{"value": {"before": 450000, "after": 480000}}`. A property's market value
|
|
651
647
|
is stored in `value`, never in `balance`: `balance` belongs to the debt, so
|
|
652
648
|
the loan itself changes only by patching `debt_abc123`. Say in the preview
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { type McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
-
import type { Bridge } from "../bridge.js";
|
|
3
|
-
import { type ExportLayout } from "../layout.js";
|
|
4
|
-
export interface LayoutResourceSpec {
|
|
5
|
-
name: string;
|
|
6
|
-
uri: string;
|
|
7
|
-
title: string;
|
|
8
|
-
description: string;
|
|
9
|
-
render: (layout: ExportLayout) => string;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Registers a markdown resource whose text follows the ProjectionLab layout.
|
|
13
|
-
*
|
|
14
|
-
* The plain URI is a fixed resource, so it is listed and read by exact match.
|
|
15
|
-
* `<uri>?layout=v4` and `<uri>?layout=v5` are served by a URI template beside
|
|
16
|
-
* it, because the SDK reads a fixed resource only when the requested URI
|
|
17
|
-
* matches it exactly, query string included.
|
|
18
|
-
*/
|
|
19
|
-
export declare function registerLayoutResource(server: McpServer, bridge: Bridge | undefined, spec: LayoutResourceSpec): void;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { ResourceTemplate, } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
-
import { layoutForContract } from "../layout.js";
|
|
3
|
-
/**
|
|
4
|
-
* Registers a markdown resource whose text follows the ProjectionLab layout.
|
|
5
|
-
*
|
|
6
|
-
* The plain URI is a fixed resource, so it is listed and read by exact match.
|
|
7
|
-
* `<uri>?layout=v4` and `<uri>?layout=v5` are served by a URI template beside
|
|
8
|
-
* it, because the SDK reads a fixed resource only when the requested URI
|
|
9
|
-
* matches it exactly, query string included.
|
|
10
|
-
*/
|
|
11
|
-
export function registerLayoutResource(server, bridge, spec) {
|
|
12
|
-
const metadata = {
|
|
13
|
-
title: spec.title,
|
|
14
|
-
description: spec.description,
|
|
15
|
-
mimeType: "text/markdown",
|
|
16
|
-
};
|
|
17
|
-
const read = async (uri) => {
|
|
18
|
-
let layout;
|
|
19
|
-
const param = uri.searchParams.get("layout");
|
|
20
|
-
if (param === "v5" || param === "v4") {
|
|
21
|
-
layout = param;
|
|
22
|
-
}
|
|
23
|
-
else if (bridge) {
|
|
24
|
-
// The contract the last connection check or write read; reading a
|
|
25
|
-
// resource never waits on the browser.
|
|
26
|
-
const contract = bridge.knownApiContract();
|
|
27
|
-
if (contract !== undefined)
|
|
28
|
-
layout = layoutForContract(contract);
|
|
29
|
-
}
|
|
30
|
-
return {
|
|
31
|
-
contents: [
|
|
32
|
-
{
|
|
33
|
-
uri: uri.href,
|
|
34
|
-
text: spec.render(layout ?? "v4"),
|
|
35
|
-
mimeType: "text/markdown",
|
|
36
|
-
},
|
|
37
|
-
],
|
|
38
|
-
};
|
|
39
|
-
};
|
|
40
|
-
server.registerResource(spec.name, spec.uri, metadata, read);
|
|
41
|
-
server.registerResource(`${spec.name}-layout`, new ResourceTemplate(`${spec.uri}{?layout}`, { list: undefined }), metadata, read);
|
|
42
|
-
}
|
|
43
|
-
//# sourceMappingURL=layoutResource.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"layoutResource.js","sourceRoot":"","sources":["../../src/resources/layoutResource.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,GAEjB,MAAM,yCAAyC,CAAC;AAEjD,OAAO,EAAE,iBAAiB,EAAqB,MAAM,cAAc,CAAC;AAUpE;;;;;;;GAOG;AACH,MAAM,UAAU,sBAAsB,CACpC,MAAiB,EACjB,MAA0B,EAC1B,IAAwB;IAExB,MAAM,QAAQ,GAAG;QACf,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,QAAQ,EAAE,eAAe;KAC1B,CAAC;IACF,MAAM,IAAI,GAAG,KAAK,EAAE,GAAQ,EAAE,EAAE;QAC9B,IAAI,MAAgC,CAAC;QACrC,MAAM,KAAK,GAAG,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAC7C,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;YACrC,MAAM,GAAG,KAAK,CAAC;QACjB,CAAC;aAAM,IAAI,MAAM,EAAE,CAAC;YAClB,kEAAkE;YAClE,uCAAuC;YACvC,MAAM,QAAQ,GAAG,MAAM,CAAC,gBAAgB,EAAE,CAAC;YAC3C,IAAI,QAAQ,KAAK,SAAS;gBAAE,MAAM,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAC;QACnE,CAAC;QACD,OAAO;YACL,QAAQ,EAAE;gBACR;oBACE,GAAG,EAAE,GAAG,CAAC,IAAI;oBACb,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,IAAI,CAAC;oBACjC,QAAQ,EAAE,eAAe;iBAC1B;aACF;SACF,CAAC;IACJ,CAAC,CAAC;IAEF,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC;IAC7D,MAAM,CAAC,gBAAgB,CACrB,GAAG,IAAI,CAAC,IAAI,SAAS,EACrB,IAAI,gBAAgB,CAAC,GAAG,IAAI,CAAC,GAAG,WAAW,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,EACjE,QAAQ,EACR,IAAI,CACL,CAAC;AACJ,CAAC"}
|