projectionlab-mcp 1.2.2 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/HOW-IT-WORKS.md +5 -4
  2. package/MANUAL-SETUP.md +8 -4
  3. package/README.md +1 -1
  4. package/REFERENCE.md +25 -9
  5. package/SETUP-FOR-AGENTS.md +4 -4
  6. package/dist/bootstrap.js +15 -3
  7. package/dist/bootstrap.js.map +1 -1
  8. package/dist/bridge.d.ts +29 -6
  9. package/dist/config.d.ts +0 -1
  10. package/dist/config.js +0 -2
  11. package/dist/config.js.map +1 -1
  12. package/dist/currentFinances.d.ts +60 -0
  13. package/dist/currentFinances.js +117 -2
  14. package/dist/currentFinances.js.map +1 -1
  15. package/dist/dataModel.d.ts +37 -8
  16. package/dist/dataModel.js +1138 -15
  17. package/dist/dataModel.js.map +1 -1
  18. package/dist/diff.d.ts +26 -10
  19. package/dist/diff.js +163 -23
  20. package/dist/diff.js.map +1 -1
  21. package/dist/editAccess.d.ts +15 -0
  22. package/dist/editAccess.js +29 -0
  23. package/dist/editAccess.js.map +1 -0
  24. package/dist/errors.d.ts +1 -1
  25. package/dist/errors.js.map +1 -1
  26. package/dist/extensionBridge.d.ts +44 -8
  27. package/dist/extensionBridge.js +179 -30
  28. package/dist/extensionBridge.js.map +1 -1
  29. package/dist/index.js +2 -3
  30. package/dist/index.js.map +1 -1
  31. package/dist/instructions.d.ts +1 -1
  32. package/dist/instructions.js +1 -1
  33. package/dist/layout.d.ts +68 -0
  34. package/dist/layout.js +122 -0
  35. package/dist/layout.js.map +1 -0
  36. package/dist/linkedFields.d.ts +77 -0
  37. package/dist/linkedFields.js +191 -0
  38. package/dist/linkedFields.js.map +1 -0
  39. package/dist/pathPatch.d.ts +41 -3
  40. package/dist/pathPatch.js +162 -14
  41. package/dist/pathPatch.js.map +1 -1
  42. package/dist/planSettings.d.ts +21 -2
  43. package/dist/planSettings.js +30 -6
  44. package/dist/planSettings.js.map +1 -1
  45. package/dist/planVersion.d.ts +7 -2
  46. package/dist/planVersion.js +27 -11
  47. package/dist/planVersion.js.map +1 -1
  48. package/dist/plans.d.ts +46 -6
  49. package/dist/plans.js +152 -15
  50. package/dist/plans.js.map +1 -1
  51. package/dist/realEstate.d.ts +20 -0
  52. package/dist/realEstate.js +57 -0
  53. package/dist/realEstate.js.map +1 -1
  54. package/dist/redact.d.ts +20 -0
  55. package/dist/redact.js +62 -0
  56. package/dist/redact.js.map +1 -1
  57. package/dist/resources/dataModel.d.ts +6 -2
  58. package/dist/resources/dataModel.js +96 -16
  59. package/dist/resources/dataModel.js.map +1 -1
  60. package/dist/resources/knowledge.d.ts +7 -1
  61. package/dist/resources/knowledge.js +262 -14
  62. package/dist/resources/knowledge.js.map +1 -1
  63. package/dist/resources/layoutResource.d.ts +19 -0
  64. package/dist/resources/layoutResource.js +43 -0
  65. package/dist/resources/layoutResource.js.map +1 -0
  66. package/dist/resources/planData.js +1 -1
  67. package/dist/resources/planData.js.map +1 -1
  68. package/dist/snapshot.d.ts +2 -1
  69. package/dist/snapshot.js +3 -1
  70. package/dist/snapshot.js.map +1 -1
  71. package/dist/summary.d.ts +39 -2
  72. package/dist/summary.js +148 -31
  73. package/dist/summary.js.map +1 -1
  74. package/dist/tools/bootstrap.js +2 -1
  75. package/dist/tools/bootstrap.js.map +1 -1
  76. package/dist/tools/clonePlan.js +10 -9
  77. package/dist/tools/clonePlan.js.map +1 -1
  78. package/dist/tools/connection.js +8 -8
  79. package/dist/tools/connection.js.map +1 -1
  80. package/dist/tools/deletePlan.js +9 -8
  81. package/dist/tools/deletePlan.js.map +1 -1
  82. package/dist/tools/diff.js +54 -15
  83. package/dist/tools/diff.js.map +1 -1
  84. package/dist/tools/export.js +5 -5
  85. package/dist/tools/export.js.map +1 -1
  86. package/dist/tools/getCurrentFinances.js +80 -24
  87. package/dist/tools/getCurrentFinances.js.map +1 -1
  88. package/dist/tools/getPlan.js +7 -1
  89. package/dist/tools/getPlan.js.map +1 -1
  90. package/dist/tools/getPlanSection.js +27 -4
  91. package/dist/tools/getPlanSection.js.map +1 -1
  92. package/dist/tools/getPlanSettings.js +16 -4
  93. package/dist/tools/getPlanSettings.js.map +1 -1
  94. package/dist/tools/restore.d.ts +4 -3
  95. package/dist/tools/restore.js +82 -42
  96. package/dist/tools/restore.js.map +1 -1
  97. package/dist/tools/schema.js +100 -22
  98. package/dist/tools/schema.js.map +1 -1
  99. package/dist/tools/snapshots.js +39 -19
  100. package/dist/tools/snapshots.js.map +1 -1
  101. package/dist/tools/summary.js +34 -1
  102. package/dist/tools/summary.js.map +1 -1
  103. package/dist/tools/updateAccount.js +69 -26
  104. package/dist/tools/updateAccount.js.map +1 -1
  105. package/dist/tools/updatePlanEvent.js +62 -27
  106. package/dist/tools/updatePlanEvent.js.map +1 -1
  107. package/dist/tools/updatePlanSection.js +59 -12
  108. package/dist/tools/updatePlanSection.js.map +1 -1
  109. package/dist/tools/updatePlanSettings.js +33 -13
  110. package/dist/tools/updatePlanSettings.js.map +1 -1
  111. package/dist/tools/writeGuard.d.ts +11 -0
  112. package/dist/tools/writeGuard.js +17 -0
  113. package/dist/tools/writeGuard.js.map +1 -0
  114. package/dist/types/projectionlab.d.ts +4 -0
  115. package/dist/types/wire.d.ts +57 -8
  116. package/dist/types/wire.js +16 -2
  117. package/dist/types/wire.js.map +1 -1
  118. package/package.json +1 -1
  119. package/skills/projectionlab/SKILL.md +234 -18
@@ -22,9 +22,9 @@ export declare const PROTOCOL_VERSION = 1;
22
22
  /**
23
23
  * Minimum extension release required by this server version.
24
24
  * Extensions below this version lack features required by the server (e.g.
25
- * standby, takeover, instanceId).
25
+ * standby, takeover, instanceId, the plan-edits switch).
26
26
  */
27
- export declare const MIN_EXTENSION_VERSION = "1.2.0";
27
+ export declare const MIN_EXTENSION_VERSION = "1.3.0";
28
28
  /** Default listen port; override with PL_WS_PORT / the extension options page. */
29
29
  export declare const DEFAULT_WS_PORT = 8788;
30
30
  /** Heartbeat interval. Also keeps the MV3 service worker alive (Chrome >=116). */
@@ -33,12 +33,24 @@ export declare const HEARTBEAT_INTERVAL_MS = 20000;
33
33
  * Plugin API operations the executor must support. `params` for each is an
34
34
  * ordered argument list matching window.projectionlabPluginAPI signatures,
35
35
  * except the meta-operations `describeApi` (no args; enumerates own +
36
- * prototype properties of the API object) and `waitForApi` (optional
36
+ * prototype properties of the API object), `waitForApi` (optional
37
37
  * `[timeoutMs]`; resolves once the API is attached to the page, waiting up to
38
- * `timeoutMs`, or 15 seconds when omitted). Other operations wait up to 15
39
- * seconds for the API before running.
38
+ * `timeoutMs`, or 15 seconds when omitted), and `apiVersion` (no args;
39
+ * resolves to the API object's `version` property, or null when it has none).
40
+ * Other operations wait up to 15 seconds for the API before running.
41
+ *
42
+ * `getAccounts` and `updateAccountValues` exist only on Plugin API contract 2
43
+ * (ProjectionLab 5); see src/layout.ts. An executor that predates
44
+ * `apiVersion` rejects it as "Not a wire protocol method".
45
+ */
46
+ export type WireMethod = "exportData" | "getAccounts" | "updateAccount" | "updateAccountValues" | "restoreCurrentFinances" | "restorePlans" | "restoreProgress" | "restoreSettings" | "validateApiKey" | "describeApi" | "waitForApi" | "apiVersion";
47
+ /**
48
+ * The methods that only read. Every other method is a write, which the
49
+ * server sends only to an executor that reports allowEdits on, and which the
50
+ * extension refuses in the browser while its switch is off. Mirrored by
51
+ * READ_METHODS in extension/src/wire.js.
40
52
  */
41
- export type WireMethod = "exportData" | "updateAccount" | "restoreCurrentFinances" | "restorePlans" | "restoreProgress" | "restoreSettings" | "validateApiKey" | "describeApi" | "waitForApi";
53
+ export declare const READ_METHODS: readonly WireMethod[];
42
54
  /** First frame the executor sends after the socket opens. */
43
55
  export interface HelloFrame {
44
56
  type: "hello";
@@ -62,6 +74,28 @@ export interface HelloFrame {
62
74
  * when the user presses Save on the options page.
63
75
  */
64
76
  takeover?: boolean;
77
+ /**
78
+ * Optional behaviors this executor supports. Additive: absent from 1.2.x
79
+ * executors, and the server ignores names it does not know.
80
+ * - "expectApiVersion": the executor honors RequestFrame.expectApiVersion.
81
+ */
82
+ features?: string[];
83
+ /**
84
+ * The extension's "Enable agent plan edits" switch at connect time.
85
+ * Additive: an executor that omits it (the bootstrap snippet, extensions
86
+ * released before the switch) has no switch, and the server sends it no
87
+ * writes. Only a boolean counts.
88
+ */
89
+ allowEdits?: boolean;
90
+ }
91
+ /**
92
+ * Sent by the extension after its helloAck and whenever the switch changes,
93
+ * so the server knows the current value without a reconnect. Servers that
94
+ * predate it ignore it.
95
+ */
96
+ export interface SettingsFrame {
97
+ type: "settings";
98
+ allowEdits: boolean;
65
99
  }
66
100
  /** Server acknowledges a valid hello. Requests only flow after this. */
67
101
  export interface HelloAckFrame {
@@ -85,6 +119,17 @@ export interface RequestFrame {
85
119
  id: string;
86
120
  method: WireMethod;
87
121
  params: unknown[];
122
+ /**
123
+ * The Plugin API version (`projectionlabPluginAPI.version`, undefined read
124
+ * as null) the server checked before sending this request. Sent only to an
125
+ * executor whose hello lists the "expectApiVersion" feature, and only on
126
+ * writes. When the property is present, the executor runs a Plugin API
127
+ * method only if the page's version is strictly equal to it, and otherwise
128
+ * answers CONTRACT_CHANGED without calling the API. The check and the call
129
+ * run in the same page turn, so a reload onto another ProjectionLab version
130
+ * between the server's check and the write cannot slip the write through.
131
+ */
132
+ expectApiVersion?: unknown;
88
133
  }
89
134
  export type WireErrorCode =
90
135
  /** No ProjectionLab tab is open and auto-open is disabled or failed. */
@@ -94,7 +139,11 @@ export type WireErrorCode =
94
139
  /** The Plugin API rejected the key. */
95
140
  | "API_KEY_INVALID"
96
141
  /** Executor-side timeout waiting on the page. */
97
- | "TIMEOUT" | "UNKNOWN";
142
+ | "TIMEOUT"
143
+ /** The page's Plugin API version differs from RequestFrame.expectApiVersion; nothing was called. */
144
+ | "CONTRACT_CHANGED"
145
+ /** A write arrived while the extension's Enable agent plan edits switch is off. */
146
+ | "EDITS_DISABLED" | "UNKNOWN";
98
147
  export interface ResponseFrame {
99
148
  type: "response";
100
149
  id: string;
@@ -124,7 +173,7 @@ export interface YieldFrame {
124
173
  type: "yield";
125
174
  token: string;
126
175
  }
127
- export type ClientFrame = HelloFrame | ResponseFrame | PongFrame | YieldFrame;
176
+ export type ClientFrame = HelloFrame | ResponseFrame | PongFrame | YieldFrame | SettingsFrame;
128
177
  export type ServerFrame = HelloAckFrame | RequestFrame | PingFrame;
129
178
  export type WireFrame = ClientFrame | ServerFrame;
130
179
  /** WebSocket close codes used by the server. */
@@ -22,13 +22,27 @@ export const PROTOCOL_VERSION = 1;
22
22
  /**
23
23
  * Minimum extension release required by this server version.
24
24
  * Extensions below this version lack features required by the server (e.g.
25
- * standby, takeover, instanceId).
25
+ * standby, takeover, instanceId, the plan-edits switch).
26
26
  */
27
- export const MIN_EXTENSION_VERSION = "1.2.0";
27
+ export const MIN_EXTENSION_VERSION = "1.3.0";
28
28
  /** Default listen port; override with PL_WS_PORT / the extension options page. */
29
29
  export const DEFAULT_WS_PORT = 8788;
30
30
  /** Heartbeat interval. Also keeps the MV3 service worker alive (Chrome >=116). */
31
31
  export const HEARTBEAT_INTERVAL_MS = 20_000;
32
+ /**
33
+ * The methods that only read. Every other method is a write, which the
34
+ * server sends only to an executor that reports allowEdits on, and which the
35
+ * extension refuses in the browser while its switch is off. Mirrored by
36
+ * READ_METHODS in extension/src/wire.js.
37
+ */
38
+ export const READ_METHODS = [
39
+ "exportData",
40
+ "getAccounts",
41
+ "validateApiKey",
42
+ "describeApi",
43
+ "waitForApi",
44
+ "apiVersion",
45
+ ];
32
46
  /** WebSocket close codes used by the server. */
33
47
  export const CLOSE_CODES = {
34
48
  /** hello token mismatch or malformed hello. Executor must not retry without reconfiguring. */
@@ -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;AAqH5C,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"}
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;AA8B5C;;;;;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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "projectionlab-mcp",
3
- "version": "1.2.2",
3
+ "version": "1.3.1",
4
4
  "description": "MCP server for ProjectionLab: read and safely edit your retirement plan from any MCP-compatible AI assistant",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -22,9 +22,13 @@ also serves this guide as the MCP resource `projectionlab://guide`.
22
22
 
23
23
  Call `projectionlab_check_connection` before any other ProjectionLab tool. It
24
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.
25
+ `writesEnabled`, `versions` and `notices`, and `apiContract` once the page has
26
+ answered. When the first four flags are `true`, proceed. Otherwise fix the
27
+ first failing item with the user, one step at a time, then check again.
28
+
29
+ `apiContract` is the Plugin API contract the page offers: `1` on
30
+ ProjectionLab 4 and `2` on ProjectionLab 5 (Early Access, at
31
+ https://ea.projectionlab.com). On `2`, follow "ProjectionLab 5" below.
28
32
 
29
33
  `notices` are plain sentences about the server's release, never connection
30
34
  failures. When the list is not empty, tell the user each one once, in plain
@@ -48,7 +52,7 @@ options page (browsers isolate extension storage by ID, so settings do not trans
48
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 |
49
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 |
50
54
  | `browser: false` otherwise | No extension or snippet is connected | See "Connecting the browser" |
51
- | `pageLoaded: false` | No ProjectionLab tab is open | Ask the user to open https://app.projectionlab.com and log in |
55
+ | `pageLoaded: false` | No ProjectionLab tab is open, or the account is on v5 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 |
52
56
  | `apiAvailable: false` | Plugins are off, or the user is logged out | ProjectionLab -> Account Settings -> Plugins -> enable plugins |
53
57
  | `apiKeyValid: false` | The key does not match the account | Ask the user to copy the key again from Account Settings -> Plugins |
54
58
 
@@ -88,7 +92,10 @@ Recommended, persistent: the **MCP Bridge for ProjectionLab** browser extension.
88
92
  `~/.projectionlab-mcp/ws-token`, which the server creates on first start.
89
93
  The status changes to **Connected** and the toolbar icon shows a green
90
94
  check.
91
- 4. Open https://app.projectionlab.com and log in.
95
+ 4. Open https://app.projectionlab.com and log in. If ProjectionLab sends the
96
+ user to https://ea.projectionlab.com (v5 Early Access), they press
97
+ **Allow ea.projectionlab.com** on the options page and approve the
98
+ browser's prompt.
92
99
 
93
100
  If another browser is already connected to the server, the status reads
94
101
  **Standing by** instead: that extension connects on its own when the other
@@ -143,7 +150,7 @@ narrowest read that answers the question.
143
150
  questions about a property's value or equity from that block, not from
144
151
  the raw `balance`.
145
152
  - `projectionlab_diff` answers "what changed?" in one read-only call, so it
146
- works with `PL_READ_ONLY=true`. `from` selects a saved snapshot with exactly
153
+ works while plan edits are turned off. `from` selects a saved snapshot with exactly
147
154
  one of `snapshotId`, `nBack` or `beforeTime`, the same selectors
148
155
  `projectionlab_rollback` takes and resolves the same way; `to` selects another
149
156
  snapshot, or omit it to compare against the data in ProjectionLab now. Only
@@ -160,7 +167,13 @@ narrowest read that answers the question.
160
167
  out is counted in `omittedFieldChanges` and per-entry `omittedChanges` rather
161
168
  than dropped, so a difference past the cap still reads as changed. Use it to
162
169
  confirm a write landed as intended, to tell the user what changed, or to see
163
- what a rollback would undo.
170
+ what a rollback would undo. An event whose name repeats in its section is
171
+ reported by its start, as in `Travel (starts Stop RV life)` or
172
+ `Medicare (starts 2034-10-01)`, and by occurrence (`Travel #2`) only when
173
+ it has no start or shares one with another event of that name; a modified
174
+ event also carries its `id` when it has one. The section dry run of
175
+ `projectionlab_update_plan_section` and the plan-to-plan mode name events
176
+ the same way.
164
177
  - `projectionlab_diff` compares two different plans when you give it `planA` and
165
178
  `planB` (plan name or exact ID) instead of a snapshot, which answers "does the
166
179
  plan I rebuilt by hand match the original?". Both plans come from the live app,
@@ -222,6 +235,98 @@ values; it is not an API, and it does not contain the application logic.
222
235
  When a change's effect matters, the user has to look at the result in the
223
236
  ProjectionLab UI. The stored data cannot show it.
224
237
 
238
+ ### ProjectionLab 5
239
+
240
+ When `projectionlab_check_connection` reports `apiContract: 2`, the account is
241
+ on ProjectionLab 5 and its data has a different layout. The read tools handle
242
+ both layouts; these differences show through:
243
+
244
+ - **No active plan.** A ProjectionLab 5 plan has no `active` flag, so
245
+ `projectionlab_get_plan` reports `active: "not reported"`. Never call a plan
246
+ active or inactive from that, and never pick one plan as "the" plan: ask the
247
+ user which plan they mean.
248
+ - **`planSelection`.** `projectionlab_get_plan_settings` also returns the
249
+ workspace's plan settings (`activeId`, `baselineId`, `alignment`, `tabs`).
250
+ Report them as stored values; they do not tell you which plan the user is
251
+ working in, and a value the export leaves empty reads `"not reported"`.
252
+ - **Events linked to Current Finances.** A plan account or asset event names
253
+ its Current Finances item in `accountId` or `assetId`, so
254
+ `projectionlab_get_plan_section` also finds the event by that id when the
255
+ `eventIdentifier` matches no event id or name. A priority's `accountId` is
256
+ different: it holds the id of the plan's account event, not the Current
257
+ Finances account id. Keep the two kinds of id apart.
258
+ - **Linked fields belong to Current Finances.** On ProjectionLab 5, a linked
259
+ event takes some fields from the item it links to, and ProjectionLab
260
+ overwrites a value written to them in the plan. An account event takes its
261
+ name, type, balance, owner, icon, liquidity, cost basis and withdrawal terms
262
+ (`EWAge`, `hasEWPenalty`, `EWPenaltyRate`, `withdrawContribsFree`), among
263
+ others. An asset event takes its name, type, owner, purchase price, value
264
+ and loans, among others. A priority takes `owner` and `icon` from the
265
+ account it routes to. `projectionlab_get_plan_section` with `listPaths`
266
+ marks these paths `syncedFrom` on one linked event, and
267
+ `projectionlab_update_plan_event` and `projectionlab_update_plan_section`
268
+ refuse to change them. Change them with `projectionlab_update_account`
269
+ instead, after telling the user it changes every plan linked to that
270
+ item. projectionlab://data-model lists every linked field.
271
+ - **Current Finances is shared by every plan.** An account has one Current
272
+ Finances document, not one per plan, so `projectionlab_update_account` and
273
+ a Current Finances restore change what every plan starts from. Say so in
274
+ the preview before confirming. Plans keep their own copies of the linked
275
+ fields. On ProjectionLab 5, those copies refresh when a plan is opened or
276
+ saved, so an export can show an old value in a plan nobody has opened
277
+ since. Read today's figure from Current Finances, not from a plan event. On ProjectionLab 5, a balance or value
278
+ edit also overwrites that account's `accountHistory` entry for the current
279
+ day.
280
+ - **Resources.** `projectionlab://data-model` and `projectionlab://knowledge`
281
+ follow the layout the last connection check found. Read
282
+ `projectionlab://data-model?layout=v4` or `?layout=v5` (the same for
283
+ `knowledge`) to pick one explicitly.
284
+ - **Every write but Progress works.** The plan tools (`projectionlab_update_plan_event`,
285
+ `projectionlab_update_plan_section`, `projectionlab_update_plan_settings`,
286
+ `projectionlab_clone_plan`, `projectionlab_delete_plan`,
287
+ `projectionlab_restore_plans`) and `projectionlab_update_account` behave as
288
+ on ProjectionLab 4. `projectionlab_update_account` reports the account's
289
+ `kind` instead of a `collection`.
290
+ - **Current Finances restores keep missing accounts.** On ProjectionLab 5,
291
+ `projectionlab_restore_current_finances` and a rollback of a Current
292
+ Finances snapshot replace every non-account field and each account they
293
+ hold, but never delete an account: one missing from the submission or the
294
+ snapshot, such as an account added since, stays as it is. The preview
295
+ lists those as `keptAccounts`; tell the user, and have them archive or
296
+ delete such an account in the ProjectionLab app if it should go.
297
+ - **Settings restores replace the whole document.**
298
+ `projectionlab_restore_settings` behaves as on ProjectionLab 4: the
299
+ submission replaces every setting, and ProjectionLab refuses a settings
300
+ document it cannot read. Settings are account-wide, not per plan.
301
+ - **Year alignment can change plans.** The account's year alignment
302
+ (`settings.plan.alignment`) and a plan's override (`variables.alignment`)
303
+ decide where each plan year starts, and so how many plan years the plan
304
+ has. When that number changes, ProjectionLab moves the last point of a
305
+ plan's glide path, such as `bondSettings.allocation`, to the new final year
306
+ in each plan it saves meanwhile, not only the plan being edited. Changing
307
+ the alignment back adds a point at the final year and keeps the moved one,
308
+ and a settings rollback does not undo either change, because settings
309
+ snapshots hold no plans. Before
310
+ changing the alignment, warn the user; afterwards, compare the plans with
311
+ the export from before the change and offer to remove an extra point.
312
+ - **Changes made in the app take time to show.** ProjectionLab saves an
313
+ edit a minute or two after the user makes it, and reads return only saved
314
+ data. When the user says they changed something and a read does not show
315
+ it, wait and read again before calling it a bug. Never write to a plan or
316
+ document the user has just edited until a read shows the edit: a write
317
+ replaces the unsaved change.
318
+ - **Progress cannot be written.** ProjectionLab 5 records Progress history
319
+ by itself whenever a current value changes, and removed the way to
320
+ replace it. `projectionlab_restore_progress` and a rollback of a snapshot
321
+ holding progress, dry runs included, are refused with
322
+ `WRITE_NOT_SUPPORTED` before they preview or snapshot anything. Tell the
323
+ user plainly; to bring back Progress from a backup file, they use Restore
324
+ in the ProjectionLab app.
325
+ - **Old snapshots.** A snapshot taken on ProjectionLab 4 cannot be compared
326
+ with or restored onto ProjectionLab 5 data: `projectionlab_diff` and
327
+ `projectionlab_rollback` refuse it with `LAYOUT_MISMATCH`. A ProjectionLab 4
328
+ backup goes back only through the Restore action in the app.
329
+
225
330
  ## Changing the plan
226
331
 
227
332
  Change the plan only when the user explicitly asks for that change.
@@ -260,9 +365,14 @@ Change the plan only when the user explicitly asks for that change.
260
365
 
261
366
  **Writes are off by default.** `writesEnabled` in the connection check shows
262
367
  the current mode. While it is `false`, every write tool, dry runs included,
263
- fails with `READ_ONLY_MODE` until the user sets `PL_READ_ONLY=false` (MCP host
264
- `env` block or `~/.projectionlab-mcp/.env`) and restarts the server. Explain this and let the
265
- user decide; do not enable writes on your own.
368
+ fails with `READ_ONLY_MODE` until the user turns on **Enable agent plan edits**
369
+ on the browser extension's options page (they click the extension's toolbar
370
+ icon). It takes effect at once, with no restart; no file or environment
371
+ variable enables writes. If the error says the executor has no plan-edits
372
+ switch, the browser is running the console bootstrap snippet or an extension
373
+ release without the switch, which can only read: the fix is the current
374
+ extension from the browser's store. Explain this and let the user decide; do
375
+ not enable writes on your own.
266
376
 
267
377
  ### Units
268
378
 
@@ -281,10 +391,54 @@ ProjectionLab 4.6.0:
281
391
 
282
392
  For every other field read `projectionlab://data-model`; with `listPaths: true`
283
393
  each listed path also comes back with `units` and `allowedValues` when the
284
- registry knows the field. Writing a string outside the allowed values of a
285
- field tagged `observed` is refused with `INVALID_INPUT`, and the refusal lists
286
- the choices: pick one of them and re-run the dry run. Numbers and booleans are
394
+ registry knows the field, each list with `allowedValuesEnforced`: only an
395
+ enforced list refuses a write, and an unenforced one is a hint that may leave
396
+ choices the app offers out of it. In `projectionlab_update_plan_event`,
397
+ `projectionlab_update_plan_settings` and `projectionlab_update_account`,
398
+ writing a string outside the allowed values of a field tagged `observed` is
399
+ refused with `INVALID_INPUT`, and the refusal lists the choices: pick one of them and re-run the dry run. Numbers and booleans are
287
400
  never refused this way, and `ui-label` fields are annotated but not enforced.
401
+ The same check reaches inside a whole-object or whole-array value, and it
402
+ applies to a leaf only when the write changes it: an out-of-list value the plan
403
+ already stores rides through a write that changes another field beside it.
404
+
405
+ Users know plan settings, events and accounts by their on-screen labels, not
406
+ by paths. A listed value can also carry `uiLabel` and `uiLocation`: the control's label and
407
+ where it is in ProjectionLab 5.0.0, with any mode that must be selected for it
408
+ to appear in parentheses (for example `inflation` is "Inflation Rate" under
409
+ "Plan Settings > Rates (Fixed mode)"). Use them when describing a change or
410
+ telling the user where to check it, and say "inflation rate", not
411
+ `variables.inflation`. A value without them has no recorded label; describe
412
+ it from its `description`. `projectionlab://data-model` lists every recorded
413
+ label under "Fields in the app".
414
+
415
+ ### Fields you cannot change
416
+
417
+ Some things the user sees in the app cannot be changed through these tools.
418
+ Do not guess a path for them or force a change through another field; tell the
419
+ user where to change them in the app.
420
+
421
+ - Milestone settings (Whose Milestone, Count Progress From, Start a Chapter,
422
+ Active in This Plan, Marker on Charts, Warn if Never Reached) are not in the
423
+ export.
424
+ - Built-in milestones (retirement, life expectancy) cannot be deleted.
425
+ - Events ProjectionLab generates, such as the Medicare expenses, carry
426
+ `_meta.deletion: "locked"`. Leave them in place.
427
+ - Monthly Benefit, Full Retirement Age, Years to Pay Off, Real Return, and a
428
+ real asset's equity and loan balance are computed by the app and have no
429
+ stored field.
430
+ - Keys starting with an underscore (`_rothConversions`,
431
+ `bondSettings._allocation`) are switched-off copies. Editing them changes
432
+ nothing in the app.
433
+ - A field that only applies in a mode, such as `incomeRate` while
434
+ `generateIncome` is off, has no effect until the user selects that mode.
435
+ - A plan asset with an `assetId` shows its Details (Name, Owner, Purchase
436
+ Price, Current Value, Type) from Current Finances, so changing them changes
437
+ every plan. Say so before proposing the change.
438
+ - Progress history is recorded by ProjectionLab 5, and writing it is refused.
439
+ - Switching a Social Security income to Estimate Benefit in the app also
440
+ changes its end and `taxExempt`. Read the event again after the user
441
+ switches modes.
288
442
 
289
443
  ### Choose the write tool
290
444
 
@@ -329,13 +483,23 @@ refuses the last remaining plan. Its snapshot lets
329
483
  `projectionlab_restore_current_finances`, `projectionlab_restore_plans`,
330
484
  `projectionlab_restore_progress` and `projectionlab_restore_settings` replace
331
485
  an entire data area. Use them only when the user wants exactly that.
486
+ `projectionlab_restore_plans` refuses an empty array, which would delete every
487
+ plan.
332
488
 
333
489
  Reads hide secret values: a secret-named field reads back as `[REDACTED]`. A
334
490
  `sectionData` or `restore_*` payload that still carries that sentinel under a
335
491
  secret-named key is refused with `INVALID_INPUT`, dry runs included, naming the
336
- paths. Type the real value or change single fields with
337
- `projectionlab_update_plan_event` or `projectionlab_update_plan_settings`,
338
- which patch by path and never round-trip hidden values.
492
+ paths. So is a whole-object value sent to `projectionlab_update_plan_event`,
493
+ `projectionlab_update_plan_settings` or `projectionlab_update_account`. Type
494
+ the real value, or change the fields beside it one at a time by path, which
495
+ leaves the hidden value untouched.
496
+
497
+ `projectionlab_restore_settings` is the exception. Settings hold the Plugin
498
+ API key this server connects with, and the restore replaces the whole
499
+ document. Leave each hidden field as `[REDACTED]`: the server writes the
500
+ stored value back and lists those paths under `keptSecrets`. A payload that
501
+ leaves out a stored secret, such as the key, is refused, since the
502
+ replacement would erase it and disconnect the server.
339
503
 
340
504
  ### Change workflow
341
505
 
@@ -377,8 +541,31 @@ Change progress:
377
541
  dry run to pick up the latest data, show the user the new preview, and
378
542
  confirm again. When confirming `projectionlab_update_plan_section`, pass the
379
543
  dry run's `planVersion` as `expectedPlanVersion`.
544
+ - **`verified: false`** from `projectionlab_update_plan_event`,
545
+ `projectionlab_update_plan_settings` or `projectionlab_update_account`
546
+ means the write was sent and snapshotted, but a fresh read did not show
547
+ every changed field. The reply lists `verificationIssues`, one per field,
548
+ each with its `path`, the `expected` value sent, the `stored` value read
549
+ back (left out when nothing is stored), and a `reason`: `absent` (the
550
+ field, or the whole event, plan or account, is missing from the read),
551
+ `shape` (a different kind of value is stored, such as an object where a
552
+ number was sent, or `null`) or `value` (the same kind of value with
553
+ different contents). Values are compared by content, so an object stored
554
+ in a different key order, or with extra fields the app filled in, still
555
+ verifies. Tell the user which fields did not land, re-read them, and offer
556
+ `projectionlab_rollback` when the change is partial. A
557
+ `projectionlab_update_account` reply with no `verified` field means the
558
+ fresh read itself failed; re-read the account to check.
380
559
  - **`INVALID_INPUT`** usually means an unknown path or a changed JSON type.
381
560
  List the paths again and correct the call.
561
+ - **`WRITE_NOT_SUPPORTED`** means the account is on ProjectionLab 5, which
562
+ has no way to make that change, such as replacing Progress (see
563
+ "ProjectionLab 5"). Nothing was written; help the user make the change in
564
+ the app.
565
+ - **`CONTRACT_CHANGED`** means the ProjectionLab page changed between the
566
+ server's version check and the write (for example, a tab on the other
567
+ ProjectionLab version took over). Nothing was written. Run
568
+ `projectionlab_check_connection`, then re-run the dry run and confirm again.
382
569
 
383
570
  ## Worked examples
384
571
 
@@ -440,8 +627,8 @@ must-have." Same plan and event as the example above.
440
627
  `{"spendingType": {"before": "discretionary", "after": "essential"}}`.
441
628
  Show it, get the user's approval, then confirm.
442
629
 
443
- **Change a Current Finances account.** User: "Our rental property is worth
444
- 480000 now; update Current Finances."
630
+ **Change a Current Finances account (ProjectionLab 4).** User: "Our rental
631
+ property is worth 480000 now; update Current Finances."
445
632
 
446
633
  1. `projectionlab_describe_schema` gives the asset's exact `accountId` (a
447
634
  property reads as `type: "real-estate"`). Then
@@ -457,6 +644,35 @@ must-have." Same plan and event as the example above.
457
644
  3. After the user approves, repeat the call with `"confirm": true`. The reply
458
645
  gives `verified` and saves a snapshot of Current Finances.
459
646
 
647
+ **The same change on ProjectionLab 5.** When `projectionlab_check_connection`
648
+ reports `apiContract: 2`, Current Finances accounts are records of
649
+ `documents.currentFinances.accounts`, keyed by id and narrowed by `kind`, and
650
+ a property keeps its loan in a separate debt record.
651
+
652
+ 1. `projectionlab_describe_schema` reports `layout: "v5"` and lists every
653
+ account with its stored `kind` and `type`: the property is a
654
+ `kind: "real-asset"` record such as `asset_abc123`, and its loan is its own
655
+ `kind: "debt"` record such as `debt_abc123`, which names the property in
656
+ `securedByAssetId` and holds the outstanding loan in `balance`. A real
657
+ asset's row reports `value` and `purchasePrice` instead of a `balance`.
658
+ 2. `projectionlab_get_current_finances` with `accountId: "asset_abc123"`
659
+ returns the record with a `realAsset` block: `value`, `loanBalance`,
660
+ `equity`, and the `securedDebts` that make up that loan. That is where to
661
+ read the loan figure and confirm which debt carries it before editing.
662
+ 3. `projectionlab_get_current_finances` with the same `accountId` and
663
+ `listPaths: true` lists the record's editable paths, including `value` and
664
+ `purchasePrice`. Then `projectionlab_update_account` with
665
+ `{"accountId": "asset_abc123", "pathChanges": {"value": 480000}}` returns
666
+ `dryRun: true`, the `accountName`, `kind: "real-asset"` where the
667
+ ProjectionLab 4 reply carries a `collection`, and `changes` such as
668
+ `{"value": {"before": 450000, "after": 480000}}`. A property's market value
669
+ is stored in `value`, never in `balance`: `balance` belongs to the debt, so
670
+ the loan itself changes only by patching `debt_abc123`. Say in the preview
671
+ that Current Finances is shared by every plan, so this changes what every
672
+ plan starts from. Show the preview.
673
+ 4. After the user approves, repeat the call with `"confirm": true`. The reply
674
+ gives `verified` and saves a snapshot of Current Finances.
675
+
460
676
  **Clone a plan.** User: "Copy my Retire at 55 plan so I can try retiring
461
677
  at 60."
462
678