projectionlab-mcp 1.2.2 → 1.3.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 +5 -4
- package/MANUAL-SETUP.md +8 -4
- package/README.md +1 -1
- package/REFERENCE.md +25 -9
- package/SETUP-FOR-AGENTS.md +4 -4
- package/dist/bootstrap.js +15 -3
- package/dist/bootstrap.js.map +1 -1
- package/dist/bridge.d.ts +29 -6
- package/dist/config.d.ts +0 -1
- package/dist/config.js +0 -2
- package/dist/config.js.map +1 -1
- package/dist/currentFinances.d.ts +60 -0
- package/dist/currentFinances.js +117 -2
- package/dist/currentFinances.js.map +1 -1
- package/dist/dataModel.d.ts +37 -8
- package/dist/dataModel.js +1138 -15
- package/dist/dataModel.js.map +1 -1
- package/dist/diff.d.ts +18 -10
- package/dist/diff.js +142 -20
- package/dist/diff.js.map +1 -1
- package/dist/editAccess.d.ts +15 -0
- package/dist/editAccess.js +29 -0
- package/dist/editAccess.js.map +1 -0
- package/dist/errors.d.ts +1 -1
- package/dist/errors.js.map +1 -1
- package/dist/extensionBridge.d.ts +44 -8
- package/dist/extensionBridge.js +179 -30
- package/dist/extensionBridge.js.map +1 -1
- package/dist/index.js +2 -3
- package/dist/index.js.map +1 -1
- package/dist/instructions.d.ts +1 -1
- package/dist/instructions.js +1 -1
- package/dist/layout.d.ts +68 -0
- package/dist/layout.js +122 -0
- package/dist/layout.js.map +1 -0
- package/dist/pathPatch.d.ts +41 -3
- package/dist/pathPatch.js +162 -14
- package/dist/pathPatch.js.map +1 -1
- package/dist/planSettings.d.ts +21 -2
- package/dist/planSettings.js +30 -6
- package/dist/planSettings.js.map +1 -1
- package/dist/planVersion.d.ts +7 -2
- package/dist/planVersion.js +27 -11
- package/dist/planVersion.js.map +1 -1
- package/dist/plans.d.ts +24 -3
- package/dist/plans.js +55 -2
- package/dist/plans.js.map +1 -1
- package/dist/realEstate.d.ts +20 -0
- package/dist/realEstate.js +57 -0
- package/dist/realEstate.js.map +1 -1
- package/dist/redact.d.ts +20 -0
- package/dist/redact.js +62 -0
- package/dist/redact.js.map +1 -1
- package/dist/resources/dataModel.d.ts +6 -2
- package/dist/resources/dataModel.js +86 -16
- package/dist/resources/dataModel.js.map +1 -1
- package/dist/resources/knowledge.d.ts +7 -1
- package/dist/resources/knowledge.js +262 -14
- package/dist/resources/knowledge.js.map +1 -1
- package/dist/resources/layoutResource.d.ts +19 -0
- package/dist/resources/layoutResource.js +43 -0
- package/dist/resources/layoutResource.js.map +1 -0
- package/dist/resources/planData.js +1 -1
- package/dist/resources/planData.js.map +1 -1
- package/dist/snapshot.d.ts +2 -1
- package/dist/snapshot.js +3 -1
- package/dist/snapshot.js.map +1 -1
- package/dist/summary.d.ts +39 -2
- package/dist/summary.js +148 -31
- package/dist/summary.js.map +1 -1
- package/dist/tools/bootstrap.js +2 -1
- package/dist/tools/bootstrap.js.map +1 -1
- package/dist/tools/clonePlan.js +10 -9
- package/dist/tools/clonePlan.js.map +1 -1
- package/dist/tools/connection.js +8 -8
- package/dist/tools/connection.js.map +1 -1
- package/dist/tools/deletePlan.js +9 -8
- package/dist/tools/deletePlan.js.map +1 -1
- package/dist/tools/diff.js +54 -15
- package/dist/tools/diff.js.map +1 -1
- package/dist/tools/export.js +5 -5
- package/dist/tools/export.js.map +1 -1
- package/dist/tools/getCurrentFinances.js +80 -24
- package/dist/tools/getCurrentFinances.js.map +1 -1
- package/dist/tools/getPlan.js +7 -1
- package/dist/tools/getPlan.js.map +1 -1
- package/dist/tools/getPlanSection.js +10 -3
- package/dist/tools/getPlanSection.js.map +1 -1
- package/dist/tools/getPlanSettings.js +16 -4
- package/dist/tools/getPlanSettings.js.map +1 -1
- package/dist/tools/restore.d.ts +4 -3
- package/dist/tools/restore.js +82 -42
- package/dist/tools/restore.js.map +1 -1
- package/dist/tools/schema.js +100 -22
- package/dist/tools/schema.js.map +1 -1
- package/dist/tools/snapshots.js +39 -19
- package/dist/tools/snapshots.js.map +1 -1
- package/dist/tools/summary.js +34 -1
- package/dist/tools/summary.js.map +1 -1
- package/dist/tools/updateAccount.js +69 -26
- package/dist/tools/updateAccount.js.map +1 -1
- package/dist/tools/updatePlanEvent.js +49 -27
- package/dist/tools/updatePlanEvent.js.map +1 -1
- package/dist/tools/updatePlanSection.js +9 -8
- package/dist/tools/updatePlanSection.js.map +1 -1
- package/dist/tools/updatePlanSettings.js +33 -13
- package/dist/tools/updatePlanSettings.js.map +1 -1
- package/dist/tools/writeGuard.d.ts +11 -0
- package/dist/tools/writeGuard.js +17 -0
- package/dist/tools/writeGuard.js.map +1 -0
- package/dist/types/projectionlab.d.ts +4 -0
- package/dist/types/wire.d.ts +57 -8
- package/dist/types/wire.js +16 -2
- package/dist/types/wire.js.map +1 -1
- package/package.json +1 -1
- package/skills/projectionlab/SKILL.md +215 -17
|
@@ -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
|
|
26
|
-
|
|
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
|
|
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
|
|
@@ -222,6 +229,86 @@ values; it is not an API, and it does not contain the application logic.
|
|
|
222
229
|
When a change's effect matters, the user has to look at the result in the
|
|
223
230
|
ProjectionLab UI. The stored data cannot show it.
|
|
224
231
|
|
|
232
|
+
### ProjectionLab 5
|
|
233
|
+
|
|
234
|
+
When `projectionlab_check_connection` reports `apiContract: 2`, the account is
|
|
235
|
+
on ProjectionLab 5 and its data has a different layout. The read tools handle
|
|
236
|
+
both layouts; these differences show through:
|
|
237
|
+
|
|
238
|
+
- **No active plan.** A ProjectionLab 5 plan has no `active` flag, so
|
|
239
|
+
`projectionlab_get_plan` reports `active: "not reported"`. Never call a plan
|
|
240
|
+
active or inactive from that, and never pick one plan as "the" plan: ask the
|
|
241
|
+
user which plan they mean.
|
|
242
|
+
- **`planSelection`.** `projectionlab_get_plan_settings` also returns the
|
|
243
|
+
workspace's plan settings (`activeId`, `baselineId`, `alignment`, `tabs`).
|
|
244
|
+
Report them as stored values; they do not tell you which plan the user is
|
|
245
|
+
working in, and a value the export leaves empty reads `"not reported"`.
|
|
246
|
+
- **Events linked to Current Finances.** A plan account or asset event names
|
|
247
|
+
its Current Finances item in `accountId` or `assetId`, so
|
|
248
|
+
`projectionlab_get_plan_section` also finds the event by that id when the
|
|
249
|
+
`eventIdentifier` matches no event id or name. A priority's `accountId` is
|
|
250
|
+
different: it holds the id of the plan's account event, not the Current
|
|
251
|
+
Finances account id. Keep the two kinds of id apart.
|
|
252
|
+
- **Current Finances is shared by every plan.** An account has one Current
|
|
253
|
+
Finances document, not one per plan, so `projectionlab_update_account` and
|
|
254
|
+
a Current Finances restore change what every plan starts from. Say so in
|
|
255
|
+
the preview before confirming. Plans keep their own copies of some linked
|
|
256
|
+
fields, such as an account event's `name` and `balance`. On ProjectionLab
|
|
257
|
+
5, those copies refresh when a plan is opened, so an export can show an old
|
|
258
|
+
value in a plan nobody has opened since. Read today's figure from Current
|
|
259
|
+
Finances, not from a plan event. On ProjectionLab 5, a balance or value
|
|
260
|
+
edit also overwrites that account's `accountHistory` entry for the current
|
|
261
|
+
day.
|
|
262
|
+
- **Resources.** `projectionlab://data-model` and `projectionlab://knowledge`
|
|
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,
|
|
273
|
+
`projectionlab_restore_current_finances` and a rollback of a Current
|
|
274
|
+
Finances snapshot replace every non-account field and each account they
|
|
275
|
+
hold, but never delete an account: one missing from the submission or the
|
|
276
|
+
snapshot, such as an account added since, stays as it is. The preview
|
|
277
|
+
lists those as `keptAccounts`; tell the user, and have them archive or
|
|
278
|
+
delete such an account in the ProjectionLab app if it should go.
|
|
279
|
+
- **Settings restores replace the whole document.**
|
|
280
|
+
`projectionlab_restore_settings` behaves as on ProjectionLab 4: the
|
|
281
|
+
submission replaces every setting, and ProjectionLab refuses a settings
|
|
282
|
+
document it cannot read. Settings are account-wide, not per plan.
|
|
283
|
+
- **Year alignment can change plans.** The account's year alignment
|
|
284
|
+
(`settings.plan.alignment`) and a plan's override (`variables.alignment`)
|
|
285
|
+
decide where each plan year starts, and so how many plan years the plan
|
|
286
|
+
has. When that number changes, ProjectionLab moves the last point of a
|
|
287
|
+
plan's glide path, such as `bondSettings.allocation`, to the new final year
|
|
288
|
+
in each plan it saves meanwhile, not only the plan being edited. Changing
|
|
289
|
+
the alignment back adds a point at the final year and keeps the moved one,
|
|
290
|
+
and a settings rollback does not undo either change, because settings
|
|
291
|
+
snapshots hold no plans. Before
|
|
292
|
+
changing the alignment, warn the user; afterwards, compare the plans with
|
|
293
|
+
the export from before the change and offer to remove an extra point.
|
|
294
|
+
- **Changes made in the app take time to show.** ProjectionLab saves an
|
|
295
|
+
edit a minute or two after the user makes it, and reads return only saved
|
|
296
|
+
data. When the user says they changed something and a read does not show
|
|
297
|
+
it, wait and read again before calling it a bug. Never write to a plan or
|
|
298
|
+
document the user has just edited until a read shows the edit: a write
|
|
299
|
+
replaces the unsaved change.
|
|
300
|
+
- **Progress cannot be written.** ProjectionLab 5 records Progress history
|
|
301
|
+
by itself whenever a current value changes, and removed the way to
|
|
302
|
+
replace it. `projectionlab_restore_progress` and a rollback of a snapshot
|
|
303
|
+
holding progress, dry runs included, are refused with
|
|
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.
|
|
307
|
+
- **Old snapshots.** A snapshot taken on ProjectionLab 4 cannot be compared
|
|
308
|
+
with or restored onto ProjectionLab 5 data: `projectionlab_diff` and
|
|
309
|
+
`projectionlab_rollback` refuse it with `LAYOUT_MISMATCH`. A ProjectionLab 4
|
|
310
|
+
backup goes back only through the Restore action in the app.
|
|
311
|
+
|
|
225
312
|
## Changing the plan
|
|
226
313
|
|
|
227
314
|
Change the plan only when the user explicitly asks for that change.
|
|
@@ -260,9 +347,14 @@ Change the plan only when the user explicitly asks for that change.
|
|
|
260
347
|
|
|
261
348
|
**Writes are off by default.** `writesEnabled` in the connection check shows
|
|
262
349
|
the current mode. While it is `false`, every write tool, dry runs included,
|
|
263
|
-
fails with `READ_ONLY_MODE` until the user
|
|
264
|
-
|
|
265
|
-
|
|
350
|
+
fails with `READ_ONLY_MODE` until the user turns on **Enable agent plan edits**
|
|
351
|
+
on the browser extension's options page (they click the extension's toolbar
|
|
352
|
+
icon). It takes effect at once, with no restart; no file or environment
|
|
353
|
+
variable enables writes. If the error says the executor has no plan-edits
|
|
354
|
+
switch, the browser is running the console bootstrap snippet or an extension
|
|
355
|
+
release without the switch, which can only read: the fix is the current
|
|
356
|
+
extension from the browser's store. Explain this and let the user decide; do
|
|
357
|
+
not enable writes on your own.
|
|
266
358
|
|
|
267
359
|
### Units
|
|
268
360
|
|
|
@@ -281,10 +373,54 @@ ProjectionLab 4.6.0:
|
|
|
281
373
|
|
|
282
374
|
For every other field read `projectionlab://data-model`; with `listPaths: true`
|
|
283
375
|
each listed path also comes back with `units` and `allowedValues` when the
|
|
284
|
-
registry knows the field
|
|
285
|
-
|
|
286
|
-
the
|
|
376
|
+
registry knows the field, each list with `allowedValuesEnforced`: only an
|
|
377
|
+
enforced list refuses a write, and an unenforced one is a hint that may leave
|
|
378
|
+
choices the app offers out of it. In `projectionlab_update_plan_event`,
|
|
379
|
+
`projectionlab_update_plan_settings` and `projectionlab_update_account`,
|
|
380
|
+
writing a string outside the allowed values of a field tagged `observed` is
|
|
381
|
+
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
382
|
never refused this way, and `ui-label` fields are annotated but not enforced.
|
|
383
|
+
The same check reaches inside a whole-object or whole-array value, and it
|
|
384
|
+
applies to a leaf only when the write changes it: an out-of-list value the plan
|
|
385
|
+
already stores rides through a write that changes another field beside it.
|
|
386
|
+
|
|
387
|
+
Users know plan settings, events and accounts by their on-screen labels, not
|
|
388
|
+
by paths. A listed value can also carry `uiLabel` and `uiLocation`: the control's label and
|
|
389
|
+
where it is in ProjectionLab 5.0.0, with any mode that must be selected for it
|
|
390
|
+
to appear in parentheses (for example `inflation` is "Inflation Rate" under
|
|
391
|
+
"Plan Settings > Rates (Fixed mode)"). Use them when describing a change or
|
|
392
|
+
telling the user where to check it, and say "inflation rate", not
|
|
393
|
+
`variables.inflation`. A value without them has no recorded label; describe
|
|
394
|
+
it from its `description`. `projectionlab://data-model` lists every recorded
|
|
395
|
+
label under "Fields in the app".
|
|
396
|
+
|
|
397
|
+
### Fields you cannot change
|
|
398
|
+
|
|
399
|
+
Some things the user sees in the app cannot be changed through these tools.
|
|
400
|
+
Do not guess a path for them or force a change through another field; tell the
|
|
401
|
+
user where to change them in the app.
|
|
402
|
+
|
|
403
|
+
- Milestone settings (Whose Milestone, Count Progress From, Start a Chapter,
|
|
404
|
+
Active in This Plan, Marker on Charts, Warn if Never Reached) are not in the
|
|
405
|
+
export.
|
|
406
|
+
- Built-in milestones (retirement, life expectancy) cannot be deleted.
|
|
407
|
+
- Events ProjectionLab generates, such as the Medicare expenses, carry
|
|
408
|
+
`_meta.deletion: "locked"`. Leave them in place.
|
|
409
|
+
- Monthly Benefit, Full Retirement Age, Years to Pay Off, Real Return, and a
|
|
410
|
+
real asset's equity and loan balance are computed by the app and have no
|
|
411
|
+
stored field.
|
|
412
|
+
- Keys starting with an underscore (`_rothConversions`,
|
|
413
|
+
`bondSettings._allocation`) are switched-off copies. Editing them changes
|
|
414
|
+
nothing in the app.
|
|
415
|
+
- A field that only applies in a mode, such as `incomeRate` while
|
|
416
|
+
`generateIncome` is off, has no effect until the user selects that mode.
|
|
417
|
+
- A plan asset with an `assetId` shows its Details (Name, Owner, Purchase
|
|
418
|
+
Price, Current Value, Type) from Current Finances, so changing them changes
|
|
419
|
+
every plan. Say so before proposing the change.
|
|
420
|
+
- Progress history is recorded by ProjectionLab 5, and writing it is refused.
|
|
421
|
+
- Switching a Social Security income to Estimate Benefit in the app also
|
|
422
|
+
changes its end and `taxExempt`. Read the event again after the user
|
|
423
|
+
switches modes.
|
|
288
424
|
|
|
289
425
|
### Choose the write tool
|
|
290
426
|
|
|
@@ -329,13 +465,23 @@ refuses the last remaining plan. Its snapshot lets
|
|
|
329
465
|
`projectionlab_restore_current_finances`, `projectionlab_restore_plans`,
|
|
330
466
|
`projectionlab_restore_progress` and `projectionlab_restore_settings` replace
|
|
331
467
|
an entire data area. Use them only when the user wants exactly that.
|
|
468
|
+
`projectionlab_restore_plans` refuses an empty array, which would delete every
|
|
469
|
+
plan.
|
|
332
470
|
|
|
333
471
|
Reads hide secret values: a secret-named field reads back as `[REDACTED]`. A
|
|
334
472
|
`sectionData` or `restore_*` payload that still carries that sentinel under a
|
|
335
473
|
secret-named key is refused with `INVALID_INPUT`, dry runs included, naming the
|
|
336
|
-
paths.
|
|
337
|
-
`
|
|
338
|
-
|
|
474
|
+
paths. So is a whole-object value sent to `projectionlab_update_plan_event`,
|
|
475
|
+
`projectionlab_update_plan_settings` or `projectionlab_update_account`. Type
|
|
476
|
+
the real value, or change the fields beside it one at a time by path, which
|
|
477
|
+
leaves the hidden value untouched.
|
|
478
|
+
|
|
479
|
+
`projectionlab_restore_settings` is the exception. Settings hold the Plugin
|
|
480
|
+
API key this server connects with, and the restore replaces the whole
|
|
481
|
+
document. Leave each hidden field as `[REDACTED]`: the server writes the
|
|
482
|
+
stored value back and lists those paths under `keptSecrets`. A payload that
|
|
483
|
+
leaves out a stored secret, such as the key, is refused, since the
|
|
484
|
+
replacement would erase it and disconnect the server.
|
|
339
485
|
|
|
340
486
|
### Change workflow
|
|
341
487
|
|
|
@@ -377,8 +523,31 @@ Change progress:
|
|
|
377
523
|
dry run to pick up the latest data, show the user the new preview, and
|
|
378
524
|
confirm again. When confirming `projectionlab_update_plan_section`, pass the
|
|
379
525
|
dry run's `planVersion` as `expectedPlanVersion`.
|
|
526
|
+
- **`verified: false`** from `projectionlab_update_plan_event`,
|
|
527
|
+
`projectionlab_update_plan_settings` or `projectionlab_update_account`
|
|
528
|
+
means the write was sent and snapshotted, but a fresh read did not show
|
|
529
|
+
every changed field. The reply lists `verificationIssues`, one per field,
|
|
530
|
+
each with its `path`, the `expected` value sent, the `stored` value read
|
|
531
|
+
back (left out when nothing is stored), and a `reason`: `absent` (the
|
|
532
|
+
field, or the whole event, plan or account, is missing from the read),
|
|
533
|
+
`shape` (a different kind of value is stored, such as an object where a
|
|
534
|
+
number was sent, or `null`) or `value` (the same kind of value with
|
|
535
|
+
different contents). Values are compared by content, so an object stored
|
|
536
|
+
in a different key order, or with extra fields the app filled in, still
|
|
537
|
+
verifies. Tell the user which fields did not land, re-read them, and offer
|
|
538
|
+
`projectionlab_rollback` when the change is partial. A
|
|
539
|
+
`projectionlab_update_account` reply with no `verified` field means the
|
|
540
|
+
fresh read itself failed; re-read the account to check.
|
|
380
541
|
- **`INVALID_INPUT`** usually means an unknown path or a changed JSON type.
|
|
381
542
|
List the paths again and correct the call.
|
|
543
|
+
- **`WRITE_NOT_SUPPORTED`** means the account is on ProjectionLab 5, which
|
|
544
|
+
has no way to make that change, such as replacing Progress (see
|
|
545
|
+
"ProjectionLab 5"). Nothing was written; help the user make the change in
|
|
546
|
+
the app.
|
|
547
|
+
- **`CONTRACT_CHANGED`** means the ProjectionLab page changed between the
|
|
548
|
+
server's version check and the write (for example, a tab on the other
|
|
549
|
+
ProjectionLab version took over). Nothing was written. Run
|
|
550
|
+
`projectionlab_check_connection`, then re-run the dry run and confirm again.
|
|
382
551
|
|
|
383
552
|
## Worked examples
|
|
384
553
|
|
|
@@ -440,8 +609,8 @@ must-have." Same plan and event as the example above.
|
|
|
440
609
|
`{"spendingType": {"before": "discretionary", "after": "essential"}}`.
|
|
441
610
|
Show it, get the user's approval, then confirm.
|
|
442
611
|
|
|
443
|
-
**Change a Current Finances account.** User: "Our rental
|
|
444
|
-
480000 now; update Current Finances."
|
|
612
|
+
**Change a Current Finances account (ProjectionLab 4).** User: "Our rental
|
|
613
|
+
property is worth 480000 now; update Current Finances."
|
|
445
614
|
|
|
446
615
|
1. `projectionlab_describe_schema` gives the asset's exact `accountId` (a
|
|
447
616
|
property reads as `type: "real-estate"`). Then
|
|
@@ -457,6 +626,35 @@ must-have." Same plan and event as the example above.
|
|
|
457
626
|
3. After the user approves, repeat the call with `"confirm": true`. The reply
|
|
458
627
|
gives `verified` and saves a snapshot of Current Finances.
|
|
459
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.
|
|
633
|
+
|
|
634
|
+
1. `projectionlab_describe_schema` reports `layout: "v5"` and lists every
|
|
635
|
+
account with its stored `kind` and `type`: the property is a
|
|
636
|
+
`kind: "real-asset"` record such as `asset_abc123`, and its loan is its own
|
|
637
|
+
`kind: "debt"` record such as `debt_abc123`, which names the property in
|
|
638
|
+
`securedByAssetId` and holds the outstanding loan in `balance`. A real
|
|
639
|
+
asset's row reports `value` and `purchasePrice` instead of a `balance`.
|
|
640
|
+
2. `projectionlab_get_current_finances` with `accountId: "asset_abc123"`
|
|
641
|
+
returns the record with a `realAsset` block: `value`, `loanBalance`,
|
|
642
|
+
`equity`, and the `securedDebts` that make up that loan. That is where to
|
|
643
|
+
read the loan figure and confirm which debt carries it before editing.
|
|
644
|
+
3. `projectionlab_get_current_finances` with the same `accountId` and
|
|
645
|
+
`listPaths: true` lists the record's editable paths, including `value` and
|
|
646
|
+
`purchasePrice`. Then `projectionlab_update_account` with
|
|
647
|
+
`{"accountId": "asset_abc123", "pathChanges": {"value": 480000}}` returns
|
|
648
|
+
`dryRun: true`, the `accountName`, `kind: "real-asset"` where the
|
|
649
|
+
ProjectionLab 4 reply carries a `collection`, and `changes` such as
|
|
650
|
+
`{"value": {"before": 450000, "after": 480000}}`. A property's market value
|
|
651
|
+
is stored in `value`, never in `balance`: `balance` belongs to the debt, so
|
|
652
|
+
the loan itself changes only by patching `debt_abc123`. Say in the preview
|
|
653
|
+
that Current Finances is shared by every plan, so this changes what every
|
|
654
|
+
plan starts from. Show the preview.
|
|
655
|
+
4. After the user approves, repeat the call with `"confirm": true`. The reply
|
|
656
|
+
gives `verified` and saves a snapshot of Current Finances.
|
|
657
|
+
|
|
460
658
|
**Clone a plan.** User: "Copy my Retire at 55 plan so I can try retiring
|
|
461
659
|
at 60."
|
|
462
660
|
|