projectionlab-mcp 1.3.1 → 1.4.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 (111) hide show
  1. package/HOW-IT-WORKS.md +1 -1
  2. package/MANUAL-SETUP.md +1 -1
  3. package/README.md +18 -0
  4. package/REFERENCE.md +7 -7
  5. package/SETUP-FOR-AGENTS.md +1 -1
  6. package/dist/bootstrap.js +0 -1
  7. package/dist/bootstrap.js.map +1 -1
  8. package/dist/bridge.d.ts +8 -14
  9. package/dist/config.js +4 -2
  10. package/dist/config.js.map +1 -1
  11. package/dist/currentFinances.d.ts +4 -12
  12. package/dist/currentFinances.js +8 -44
  13. package/dist/currentFinances.js.map +1 -1
  14. package/dist/dataModel.d.ts +9 -11
  15. package/dist/dataModel.js +25 -849
  16. package/dist/dataModel.js.map +1 -1
  17. package/dist/diff.d.ts +10 -20
  18. package/dist/diff.js +30 -163
  19. package/dist/diff.js.map +1 -1
  20. package/dist/extensionBridge.d.ts +16 -15
  21. package/dist/extensionBridge.js +33 -49
  22. package/dist/extensionBridge.js.map +1 -1
  23. package/dist/index.js +4 -2
  24. package/dist/index.js.map +1 -1
  25. package/dist/layout.d.ts +32 -36
  26. package/dist/layout.js +44 -62
  27. package/dist/layout.js.map +1 -1
  28. package/dist/linkedFields.d.ts +2 -5
  29. package/dist/linkedFields.js +3 -5
  30. package/dist/linkedFields.js.map +1 -1
  31. package/dist/pathPatch.d.ts +3 -4
  32. package/dist/pathPatch.js +8 -8
  33. package/dist/pathPatch.js.map +1 -1
  34. package/dist/planSettings.d.ts +4 -6
  35. package/dist/planSettings.js +5 -9
  36. package/dist/planSettings.js.map +1 -1
  37. package/dist/plans.d.ts +2 -2
  38. package/dist/plans.js +2 -2
  39. package/dist/realEstate.d.ts +0 -21
  40. package/dist/realEstate.js +0 -117
  41. package/dist/realEstate.js.map +1 -1
  42. package/dist/resources/dataModel.d.ts +2 -6
  43. package/dist/resources/dataModel.js +12 -53
  44. package/dist/resources/dataModel.js.map +1 -1
  45. package/dist/resources/knowledge.d.ts +2 -7
  46. package/dist/resources/knowledge.js +8 -245
  47. package/dist/resources/knowledge.js.map +1 -1
  48. package/dist/resources/planData.js +1 -1
  49. package/dist/resources/planData.js.map +1 -1
  50. package/dist/settingsReport.d.ts +25 -0
  51. package/dist/settingsReport.js +464 -0
  52. package/dist/settingsReport.js.map +1 -0
  53. package/dist/settingsReportLayout.d.ts +59 -0
  54. package/dist/settingsReportLayout.js +367 -0
  55. package/dist/settingsReportLayout.js.map +1 -0
  56. package/dist/snapshot.d.ts +1 -2
  57. package/dist/snapshot.js +2 -2
  58. package/dist/snapshot.js.map +1 -1
  59. package/dist/summary.d.ts +3 -8
  60. package/dist/summary.js +7 -71
  61. package/dist/summary.js.map +1 -1
  62. package/dist/tools/bootstrap.js +1 -1
  63. package/dist/tools/bootstrap.js.map +1 -1
  64. package/dist/tools/clonePlan.js +3 -3
  65. package/dist/tools/clonePlan.js.map +1 -1
  66. package/dist/tools/connection.js +3 -3
  67. package/dist/tools/connection.js.map +1 -1
  68. package/dist/tools/deletePlan.js +3 -3
  69. package/dist/tools/deletePlan.js.map +1 -1
  70. package/dist/tools/diff.js +17 -23
  71. package/dist/tools/diff.js.map +1 -1
  72. package/dist/tools/export.js +2 -2
  73. package/dist/tools/export.js.map +1 -1
  74. package/dist/tools/getCurrentFinances.js +8 -48
  75. package/dist/tools/getCurrentFinances.js.map +1 -1
  76. package/dist/tools/getPlan.js +2 -4
  77. package/dist/tools/getPlan.js.map +1 -1
  78. package/dist/tools/getPlanSection.js +19 -10
  79. package/dist/tools/getPlanSection.js.map +1 -1
  80. package/dist/tools/getPlanSettings.js +8 -12
  81. package/dist/tools/getPlanSettings.js.map +1 -1
  82. package/dist/tools/restore.js +12 -87
  83. package/dist/tools/restore.js.map +1 -1
  84. package/dist/tools/schema.js +16 -71
  85. package/dist/tools/schema.js.map +1 -1
  86. package/dist/tools/settingsReport.d.ts +3 -0
  87. package/dist/tools/settingsReport.js +76 -0
  88. package/dist/tools/settingsReport.js.map +1 -0
  89. package/dist/tools/snapshots.js +9 -14
  90. package/dist/tools/snapshots.js.map +1 -1
  91. package/dist/tools/summary.js +1 -1
  92. package/dist/tools/summary.js.map +1 -1
  93. package/dist/tools/updateAccount.js +16 -26
  94. package/dist/tools/updateAccount.js.map +1 -1
  95. package/dist/tools/updatePlanEvent.js +10 -10
  96. package/dist/tools/updatePlanEvent.js.map +1 -1
  97. package/dist/tools/updatePlanSection.js +4 -5
  98. package/dist/tools/updatePlanSection.js.map +1 -1
  99. package/dist/tools/updatePlanSettings.js +4 -4
  100. package/dist/tools/updatePlanSettings.js.map +1 -1
  101. package/dist/tools/writeGuard.d.ts +3 -2
  102. package/dist/tools/writeGuard.js +5 -4
  103. package/dist/tools/writeGuard.js.map +1 -1
  104. package/dist/types/projectionlab.d.ts +4 -5
  105. package/dist/types/wire.d.ts +1 -1
  106. package/dist/types/wire.js.map +1 -1
  107. package/package.json +1 -1
  108. package/skills/projectionlab/SKILL.md +78 -64
  109. package/dist/resources/layoutResource.d.ts +0 -19
  110. package/dist/resources/layoutResource.js +0 -43
  111. package/dist/resources/layoutResource.js.map +0 -1
package/HOW-IT-WORKS.md CHANGED
@@ -20,7 +20,7 @@ The server opens a WebSocket listener on `127.0.0.1:<PL_WS_PORT>`. A browser-sid
20
20
 
21
21
  - The executor connects and sends a `hello` frame with a shared token, the protocol version, and an `instanceId` (a stable id for the installation: the extension persists one UUID, the snippet generates one per page load). The server validates the `Origin` header (extension or app origin only), checks the token, and replies `helloAck`, or closes with code `4001` (auth), `4002` (version), `4003` (a takeover replaced this executor), or `4004` (busy: another executor holds the connection, retry later). The server keeps one active executor and the incumbent keeps it: a second authenticated executor is refused with `4004`, retries on a slow schedule, and connects by itself when the active one goes away. It takes over only by sending `takeover: true` in the hello (the extension does that when the user presses Save on its options page) or by repeating the incumbent's `instanceId`, which lets an executor replace its own stale socket. Several server instances (one per host session) can share the port the same way: one holds it and the others retry the bind. A waiting instance with an operation to run connects to the port and sends a `yield` frame carrying the token instead of a `hello`; the holder finishes its queued operations, releases the port, closes its executor with `1012` (an ordinary close, so the executor reconnects within seconds rather than standing by), and closes the yield socket with `4005`. The waiting instance binds the port at once and waits for the executor to reconnect. When several instances wait, the one that loses the bind asks the new holder in turn. A yield from a socket with an `Origin` header is refused, since only another server sends one. The `helloAck` carries the server's release version in `serverVersion` so the extension can show a mismatch line; executors that ignore the field are unaffected, and servers older than the field simply omit it.
22
22
  - Requests are `{ id, method, params }`; responses are `{ id, ok, result | error }`. Methods map directly to Plugin API calls plus `describeApi`, `waitForApi`, and `apiVersion` (the page's `projectionlabPluginAPI.version`, or `null` when it has none).
23
- - Writes are checked against the Plugin API contract three times. Each write tool reads the contract before it previews or snapshots anything and refuses a write the contract does not support (`WRITE_NOT_SUPPORTED`). The bridge reads it again in the same operation as the write, and refuses with `CONTRACT_CHANGED` when the tool prepared the write from an export of the other layout (two tabs on different ProjectionLab builds); a plan write also checks the layout of the export it re-reads for its conflict check. An executor whose `hello` lists the `expectApiVersion` feature also gets that version on the write request as `expectApiVersion`, and calls the Plugin API only if the page still reports exactly that version, answering `CONTRACT_CHANGED` otherwise; the check and the call run in the same page turn, so a tab reloaded onto another ProjectionLab version in between is never written to. Every executor gets the write only on the socket the version was read from, so a browser that takes the connection over in between is not written to either.
23
+ - Writes are checked against the Plugin API contract three times. Each write tool reads the contract before it previews or snapshots anything and refuses a write the contract does not support (`WRITE_NOT_SUPPORTED`). The bridge reads it again in the same operation as the write and refuses a page that is not ProjectionLab 5 (`UNSUPPORTED_API_VERSION`); a plan write also refuses when the export it re-reads for its conflict check is not a ProjectionLab 5 export. An executor whose `hello` lists the `expectApiVersion` feature also gets that version on the write request as `expectApiVersion`, and calls the Plugin API only if the page still reports exactly that version, answering `CONTRACT_CHANGED` otherwise; the check and the call run in the same page turn, so a tab reloaded onto another ProjectionLab version in between is never written to. Every executor gets the write only on the socket the version was read from, so a browser that takes the connection over in between is not written to either.
24
24
  - A ~20 s `ping`/`pong` heartbeat keeps the connection healthy (and keeps a Manifest V3 service worker from being suspended).
25
25
 
26
26
  ### The browser extension
package/MANUAL-SETUP.md CHANGED
@@ -59,7 +59,7 @@ the extension up to date.
59
59
 
60
60
  Then click the extension's toolbar icon to open its options page and enter
61
61
  port `8788` and the token from `~/.projectionlab-mcp/ws-token`. If your
62
- ProjectionLab account is on v5 Early Access (the app opens at
62
+ ProjectionLab account is on Early Access (the app opens at
63
63
  `ea.projectionlab.com`), also press **Allow ea.projectionlab.com** on that
64
64
  page and approve the browser's prompt.
65
65
 
package/README.md CHANGED
@@ -18,6 +18,22 @@ The assistant can look at your plan and walk through tradeoffs with you, and it
18
18
 
19
19
  ---
20
20
 
21
+ ## What you can use it for
22
+
23
+ Everything the assistant does, you could do by hand in ProjectionLab. What it adds is speed on tedious work and a second pair of eyes on your inputs.
24
+
25
+ - **Refresh your balances.** Paste figures from your statements, or let another tool your assistant is connected to supply them, and it updates the matching accounts in Current Finances.
26
+ - **Audit your plan.** It looks for stale balances, expenses that end too early or never end, inconsistent growth or inflation settings, and benefit start ages that look unintended.
27
+ - **Explain your plan.** It produces a readable report of a plan's settings, ordered by topic, or two plans side by side, and tells you exactly which values differ between plans or since a backup.
28
+ - **Build scenarios fast.** "Copy my plan and retire two years earlier," "lower returns by 2 points," "add a home purchase in 2030." It builds the copies; you compare the results in ProjectionLab.
29
+ - **Make bulk edits.** Raise every expense by a percentage, rename or tidy items, or apply the same change across several plans.
30
+ - **Think through tax strategy.** Talk through Roth conversions, tax brackets, and Medicare IRMAA thresholds against your own ages and income, then set up plan copies for ProjectionLab's Optimizer and projections to judge.
31
+ - **Undo and history.** See what changed and when, and roll any change back.
32
+
33
+ The assistant sees your plan's inputs, not its results: projections and Chance of Success run only in ProjectionLab. Its analysis is reasoning about your inputs, so check the effect of any change in the app.
34
+
35
+ ---
36
+
21
37
  ## Get started
22
38
 
23
39
  Paste this into your AI assistant:
@@ -39,6 +55,8 @@ Prefer to set it up yourself? See **[Manual setup](https://github.com/Backroads4
39
55
 
40
56
  ## Safety
41
57
 
58
+ **What's at stake.** ProjectionLab holds only what you typed into it: account names, balances, income, expenses, ages, goals, and any notes you wrote. It has no bank logins, account numbers, or live connections to your financial institutions, so there is nothing here that can move money or open an account. The Plugin API key works only inside a browser tab where you are already signed in to your own ProjectionLab account; there is no ProjectionLab API that accepts the key on its own. The data that leaves your computer is your plan's figures, which go to the AI model your assistant uses, under that provider's privacy terms. The main risk to manage is an unwanted edit to your plan, which the protections below are built for.
59
+
42
60
  - **Read-only by default.** The assistant can read your plan but not change it until you turn on **Enable agent plan edits** in the browser extension's options. Turning it off stops changes at once.
43
61
  - **Preview before saving.** Every change is a preview until the assistant explicitly confirms it, and the assistant is instructed to show you the preview and ask first.
44
62
  - **Undo.** Every confirmed change is backed up first, so it can be rolled back.
package/REFERENCE.md CHANGED
@@ -104,6 +104,7 @@ The server starts without `PL_API_KEY` so it can tell the agent what is missing;
104
104
  | `projectionlab_get_plan` | Retrieve a single plan | No |
105
105
  | `projectionlab_get_plan_section` | Retrieve a plan section; supports event/path filters and typed field-path listing | No |
106
106
  | `projectionlab_get_plan_settings` | List discrete plan settings as path-addressable values | No |
107
+ | `projectionlab_get_settings_report` | Render one plan's settings, or two plans' side by side with a Differs column, as a readable markdown report | No |
107
108
  | `projectionlab_get_current_finances` | Get Current Finances or list typed paths for one account | No |
108
109
  | `projectionlab_update_account` | Patch one Current Finances account by top-level fields or nested dot paths | Yes |
109
110
  | `projectionlab_update_plan_event` | Patch one event by top-level fields or nested dot paths | Yes |
@@ -115,7 +116,6 @@ The server starts without `PL_API_KEY` so it can tell the agent what is missing;
115
116
  | `projectionlab_diff` | Field-level changes between a snapshot and another snapshot or the live data, or between two plans (`planA` and `planB`) | No |
116
117
  | `projectionlab_restore_current_finances` | Replace Current Finances with the supplied data | Yes |
117
118
  | `projectionlab_restore_plans` | Replace all plans with the supplied array; an empty array is refused | Yes |
118
- | `projectionlab_restore_progress` | Replace Progress with the supplied data (ProjectionLab 4 only) | Yes |
119
119
  | `projectionlab_restore_settings` | Replace Settings with the supplied data | Yes |
120
120
  | `projectionlab_rollback` | Roll back to a previous snapshot | Yes |
121
121
 
@@ -123,10 +123,10 @@ The server starts without `PL_API_KEY` so it can tell the agent what is missing;
123
123
 
124
124
  | URI | Description |
125
125
  |---|---|
126
- | `projectionlab://plan-data` | Full export of all plans/finances/progress/settings (refreshed per access) |
126
+ | `projectionlab://plan-data` | Full export of all plans, Current Finances, settings and account history (refreshed per access) |
127
127
  | `projectionlab://summary` | High-level snapshot: net worth, account breakdown, plan count |
128
128
  | `projectionlab://knowledge` | Curated ProjectionLab data-model + FIRE/tax reference (static) |
129
- | `projectionlab://data-model` | Field meanings, units, and allowed values for path-addressable reads and writes, version-stamped to ProjectionLab 4.6.0 (v4) and 5.0.0 (v5); follows the connected ProjectionLab version once `projectionlab_check_connection` has run, and `?layout=v4` or `?layout=v5` chooses |
129
+ | `projectionlab://data-model` | Field meanings, units, and allowed values for path-addressable reads and writes, version-stamped to ProjectionLab 5.0.0 |
130
130
  | `projectionlab://guide` | Agent guide: setup walkthrough, tool selection, change workflow, privacy rules (static) |
131
131
 
132
132
  ## Prompts
@@ -144,7 +144,7 @@ Write operations (`update_*`, `restore_*`, `clone_plan`, `delete_plan`) default
144
144
 
145
145
  Every write that replaces the plans array re-reads the plans just before writing and refuses with `PLAN_CONFLICT` if any plan was added, removed, or saved in ProjectionLab since the tool read them, so an edit made in the ProjectionLab UI, or a write by another agent's server instance, is never silently overwritten. `projectionlab_update_plan_section` also returns a `planVersion` in its dry run; pass it back as `expectedPlanVersion` when confirming to refuse the write if the plan was saved after the preview.
146
146
 
147
- Plan reads hide secret values: a secret-named field (`apiKey`, `token`, `password`, …) comes back as `[REDACTED]`. A write payload that still holds that sentinel under a secret-named key is refused with `INVALID_INPUT`, dry runs included, naming the offending dot paths: `sectionData` for `projectionlab_update_plan_section`, the payload of `projectionlab_restore_plans`, `projectionlab_restore_current_finances` and `projectionlab_restore_progress`, and a whole-object value sent to `projectionlab_update_plan_event`, `projectionlab_update_plan_settings` or `projectionlab_update_account`. Supply the real value, or change the fields beside it one at a time by path with `projectionlab_update_plan_event` or `projectionlab_update_plan_settings`, which leaves the hidden value untouched. `projectionlab_restore_settings` is the exception: a secret field left as `[REDACTED]` keeps its stored value, and a payload that leaves a stored secret out is refused.
147
+ Plan reads hide secret values: a secret-named field (`apiKey`, `token`, `password`, …) comes back as `[REDACTED]`. A write payload that still holds that sentinel under a secret-named key is refused with `INVALID_INPUT`, dry runs included, naming the offending dot paths: `sectionData` for `projectionlab_update_plan_section`, the payload of `projectionlab_restore_plans` and `projectionlab_restore_current_finances`, and a whole-object value sent to `projectionlab_update_plan_event`, `projectionlab_update_plan_settings` or `projectionlab_update_account`. Supply the real value, or change the fields beside it one at a time by path with `projectionlab_update_plan_event` or `projectionlab_update_plan_settings`, which leaves the hidden value untouched. `projectionlab_restore_settings` is the exception: a secret field left as `[REDACTED]` keeps its stored value, and a payload that leaves a stored secret out is refused.
148
148
 
149
149
  `projectionlab_update_plan_section` also refuses `sectionData` that does not match the section's current container shape (array for milestones, `{ events: [...] }` for event sections, plain object for `variables`, `montecarlo` and `withdrawalStrategy`), so a wrong or omitted payload can never delete a section or change its type.
150
150
 
@@ -153,9 +153,9 @@ Plan reads hide secret values: a secret-named field (`apiKey`, `token`, `passwor
153
153
  field to a value outside the choices the app offers for it, and the refusal
154
154
  lists those choices. `projectionlab_update_plan_section` and the `restore_*`
155
155
  tools check the shape of what they write, not these choices. The
156
- enforced fields are the ones `projectionlab://data-model` tags `observed`, in
157
- the ProjectionLab 4 and the ProjectionLab 5 layout alike; a listing carries
158
- `allowedValues` for other fields too, as a hint a write does not enforce. The
156
+ enforced fields are the ones `projectionlab://data-model` tags `observed`; a
157
+ listing carries `allowedValues` for other fields too, as a hint a write does
158
+ not enforce. The
159
159
  check reaches inside a whole-object write and applies to a leaf only when the
160
160
  write changes it, so a value the plan already stores outside the list rides
161
161
  through while the field beside it is written.
@@ -35,6 +35,6 @@ The config location varies by host; see [Adding the server to your MCP host](htt
35
35
 
36
36
  - **Quick alternative: no install.** Call the `projectionlab_get_bootstrap` tool, then have the user paste the returned snippet into their ProjectionLab tab's developer console (F12 → Console). It reads the same way but cannot make changes, and must be re-pasted if they reload the page. Good for a first test drive.
37
37
 
38
- **5. Verify.** Have the user open [ProjectionLab](https://app.projectionlab.com), log in, and confirm plugins are enabled. If ProjectionLab sends them to `ea.projectionlab.com` (v5 Early Access), they also press **Allow ea.projectionlab.com** on the extension's options page and approve the browser's prompt. Then call `projectionlab_check_connection`; it should report all checks passing. Do this before any other tool call.
38
+ **5. Verify.** Have the user open [ProjectionLab](https://app.projectionlab.com), log in, and confirm plugins are enabled. If ProjectionLab sends them to `ea.projectionlab.com` (Early Access), they also press **Allow ea.projectionlab.com** on the extension's options page and approve the browser's prompt. Then call `projectionlab_check_connection`; it should report all checks passing. Do this before any other tool call.
39
39
 
40
40
  **6. Enabling changes (writes).** Leave everything read-only until the user explicitly asks to make changes. When they do: ask them to click the extension's toolbar icon and turn on **Enable agent plan edits** on its options page (it takes effect at once, with no restart; no file or setting on the computer enables writes), then confirm with `projectionlab_check_connection` that `writesEnabled` is `true`. The console bootstrap snippet has no such switch and can only read. Every write tool still previews unless called with `confirm: true`: show the user each preview and confirm only the change they approve. Every confirmed change is snapshotted first so it can be rolled back. Tell the user this before the first change.
package/dist/bootstrap.js CHANGED
@@ -9,7 +9,6 @@ const PLUGIN_METHODS = [
9
9
  "updateAccountValues",
10
10
  "restoreCurrentFinances",
11
11
  "restorePlans",
12
- "restoreProgress",
13
12
  "restoreSettings",
14
13
  "validateApiKey",
15
14
  ];
@@ -1 +1 @@
1
- {"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../src/bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAmB,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAE,OAAO,EAAE,MAAM,cAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAoFnD,CAAC;AACP,CAAC"}
package/dist/bridge.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { ApiContract, ExportLayout } from "./layout.js";
1
+ import type { ApiContract } from "./layout.js";
2
2
  import type { ExportedData } from "./types/projectionlab.js";
3
3
  export interface ConnectionStatus {
4
4
  browser: boolean;
@@ -30,31 +30,25 @@ export type EditAccess = "enabled" | "disabled" | "unsupported";
30
30
  export interface Bridge {
31
31
  checkConnection(): Promise<ConnectionStatus>;
32
32
  describePluginApi(): Promise<Record<string, string>>;
33
- /** The Plugin API contract the connected page offers, read fresh. */
33
+ /** The Plugin API contract the connected page offers, read fresh; a page
34
+ * on a contract this server does not support is refused. */
34
35
  apiContract(): Promise<ApiContract>;
35
- /**
36
- * The contract from the most recent successful contract read, without
37
- * contacting the page; undefined before the first one. For choosing
38
- * documentation only: writes read the contract fresh.
39
- */
40
- knownApiContract(): ApiContract | undefined;
41
36
  /** The connected executor's edit access; connects to it first if needed. */
42
37
  editAccess(): Promise<EditAccess>;
43
38
  /** Full export, served from a short-lived cache unless `fresh` is true. */
44
39
  exportData(opts?: {
45
40
  fresh?: boolean;
46
41
  }): Promise<ExportedData>;
47
- updateAccount(accountId: string, data: Record<string, unknown>, force: boolean | undefined, layout: ExportLayout): Promise<void>;
48
- restoreCurrentFinances(state: unknown, layout: ExportLayout): Promise<void>;
49
- restorePlans(plans: unknown[], layout: ExportLayout): Promise<void>;
42
+ updateAccount(accountId: string, data: Record<string, unknown>, force: boolean | undefined): Promise<void>;
43
+ restoreCurrentFinances(state: unknown): Promise<void>;
44
+ restorePlans(plans: unknown[]): Promise<void>;
50
45
  /**
51
46
  * Writes `plans` unless a plan was added, removed, or saved since `read`
52
47
  * was taken, in which case it throws PLAN_CONFLICT and writes nothing. The
53
48
  * re-read and the write are atomic: no other operation runs between them.
54
49
  */
55
- restorePlansIfUnchanged(read: unknown[], plans: unknown[], layout: ExportLayout): Promise<void>;
56
- restoreProgress(progress: unknown, layout: ExportLayout): Promise<void>;
57
- restoreSettings(settings: unknown, layout: ExportLayout): Promise<void>;
50
+ restorePlansIfUnchanged(read: unknown[], plans: unknown[]): Promise<void>;
51
+ restoreSettings(settings: unknown): Promise<void>;
58
52
  invalidateCache(): void;
59
53
  close(): Promise<void>;
60
54
  }
package/dist/config.js CHANGED
@@ -13,12 +13,14 @@ loadDotenv({ path: resolve(__dirname, "../.env") });
13
13
  function optional(name, fallback) {
14
14
  return process.env[name] || fallback;
15
15
  }
16
+ /** A non-negative integer: all digits. parseInt alone would accept
17
+ * "90000abc" and use whatever number it reads out of it. */
16
18
  function optionalInt(name, fallback) {
17
19
  const raw = process.env[name];
18
20
  if (!raw)
19
21
  return fallback;
20
- const value = parseInt(raw, 10);
21
- if (Number.isNaN(value) || value < 0) {
22
+ const value = /^\d+$/.test(raw.trim()) ? Number(raw.trim()) : NaN;
23
+ if (!Number.isSafeInteger(value)) {
22
24
  throw new Error(`Invalid value for ${name}: "${raw}" (expected a non-negative integer)`);
23
25
  }
24
26
  return value;
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAE1D,oEAAoE;AACpE,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,oBAAoB,EAAE,MAAM,CAAC,CAAC;AAE3E,yE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AI,CAAC;QAAE,OAAO,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9D,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC;AACpB,CAAC;AAED,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,2EAA2E;IAC3E,mEAAmE;IACnE,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,UAAU,IAAI,SAAS;IAC3C,4EAA4E;IAC5E,0EAA0E;IAC1E,+DAA+D;IAC/D,yEAAyE;IACzE,4CAA4C;IAC5C,MAAM,EAAE,WAAW,CAAC,YAAY,EAAE,IAAI,CAAC;IACvC,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,IAAI,EAAE,IAAI,SAAS;IACrD,MAAM,EAAE,MAAM,EAAE;IAChB,iBAAiB,EAAE,WAAW,CAAC,yBAAyB,EAAE,KAAK,CAAC;IAChE,6EAA6E;IAC7E,4DAA4D;IAC5D,aAAa,EAAE,WAAW,CAAC,oBAAoB,EAAE,KAAK,CAAC;IACvD,6EAA6E;IAC7E,UAAU,EAAE,eAAe,CAAC,gBAAgB,CAAC,IAAI,KAAK;IACtD,0EAA0E;IAC1E,0CAA0C;IAC1C,WAAW,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,KAAK,OAAO;IACjF,WAAW,EAAE,UAAU,CAAC,QAAQ,CAAC,iBAAiB,EAAE,gCAAgC,CAAC,CAAC;IACtF,QAAQ,EAAE,QAAQ,EAAE;CACZ,CAAC"}
@@ -1,13 +1,5 @@
1
1
  import { ProjectionLabError } from "./errors.js";
2
2
  import { type PlanObj } from "./plans.js";
3
- export declare const CURRENT_FINANCE_COLLECTIONS: readonly ["investmentAccounts", "savingsAccounts", "debts", "assets"];
4
- export interface CurrentFinanceEntry {
5
- collection: (typeof CURRENT_FINANCE_COLLECTIONS)[number];
6
- index: number;
7
- account: PlanObj;
8
- }
9
- export declare function listCurrentFinanceEntries(today: unknown): CurrentFinanceEntry[];
10
- export declare function findCurrentFinanceEntry(today: unknown, accountId: string): CurrentFinanceEntry | undefined;
11
3
  export declare function requireCurrentFinances(today: unknown): PlanObj;
12
4
  /**
13
5
  * A ProjectionLab 5 Current Finances account (`documents.currentFinances
@@ -30,8 +22,8 @@ export interface V5AccountEntry {
30
22
  }
31
23
  /**
32
24
  * Every account record of a v5 Current Finances document, archived ones
33
- * included, in stored order. Empty for a v4 `today`, which keeps its accounts
34
- * in per-type arrays and has no `accounts` object.
25
+ * included, in stored order. Empty when the document has no `accounts`
26
+ * object.
35
27
  */
36
28
  export declare function listV5Accounts(finances: unknown): V5AccountEntry[];
37
29
  /** The v5 account with this exact id (or, failing that, key), archived or not. */
@@ -63,13 +55,13 @@ export declare function withoutArchivedAccounts(finances: PlanObj): PlanObj;
63
55
  * The stored ProjectionLab 5 accounts that restoring `submitted` keeps
64
56
  * unchanged because the submission leaves them out. ProjectionLab 5's
65
57
  * restoreCurrentFinances replaces each submitted account and never deletes
66
- * one, so these survive the restore as they are. Empty for a v4 `today`.
58
+ * one, so these survive the restore as they are.
67
59
  */
68
60
  export declare function v5AccountsKept(submitted: unknown, stored: unknown): {
69
61
  id: string;
70
62
  name: string;
71
63
  }[];
72
- export declare function currentFinanceAccountNotFoundError(today: unknown, accountId: string): ProjectionLabError;
64
+ export declare function currentFinanceAccountNotFoundError(currentFinances: unknown, accountId: string): ProjectionLabError;
73
65
  /**
74
66
  * Problems for a Current Finances read taken before a write and one taken after
75
67
  * it: an id-bearing account the second read dropped or added, and a money field
@@ -1,36 +1,5 @@
1
1
  import { ProjectionLabError } from "./errors.js";
2
2
  import { containsSubset } from "./plans.js";
3
- export const CURRENT_FINANCE_COLLECTIONS = [
4
- "investmentAccounts",
5
- "savingsAccounts",
6
- "debts",
7
- "assets",
8
- ];
9
- export function listCurrentFinanceEntries(today) {
10
- if (!today || typeof today !== "object" || Array.isArray(today))
11
- return [];
12
- const root = today;
13
- const entries = [];
14
- for (const collection of CURRENT_FINANCE_COLLECTIONS) {
15
- const values = root[collection];
16
- if (!Array.isArray(values))
17
- continue;
18
- for (let index = 0; index < values.length; index++) {
19
- const value = values[index];
20
- if (value && typeof value === "object" && !Array.isArray(value)) {
21
- entries.push({
22
- collection,
23
- index,
24
- account: value,
25
- });
26
- }
27
- }
28
- }
29
- return entries;
30
- }
31
- export function findCurrentFinanceEntry(today, accountId) {
32
- return listCurrentFinanceEntries(today).find(({ account }) => String(account.id ?? "") === accountId);
33
- }
34
3
  export function requireCurrentFinances(today) {
35
4
  if (!today || typeof today !== "object" || Array.isArray(today)) {
36
5
  throw new ProjectionLabError("INVALID_INPUT", "No current finances data found in ProjectionLab", "Set up Current Finances in ProjectionLab first");
@@ -41,8 +10,8 @@ const isPlainObject = (value) => Boolean(value) && typeof value === "object" &&
41
10
  const nonEmptyString = (value) => typeof value === "string" && value !== "" ? value : undefined;
42
11
  /**
43
12
  * Every account record of a v5 Current Finances document, archived ones
44
- * included, in stored order. Empty for a v4 `today`, which keeps its accounts
45
- * in per-type arrays and has no `accounts` object.
13
+ * included, in stored order. Empty when the document has no `accounts`
14
+ * object.
46
15
  */
47
16
  export function listV5Accounts(finances) {
48
17
  const accounts = isPlainObject(finances) ? finances.accounts : undefined;
@@ -136,7 +105,7 @@ export function withoutArchivedAccounts(finances) {
136
105
  * The stored ProjectionLab 5 accounts that restoring `submitted` keeps
137
106
  * unchanged because the submission leaves them out. ProjectionLab 5's
138
107
  * restoreCurrentFinances replaces each submitted account and never deletes
139
- * one, so these survive the restore as they are. Empty for a v4 `today`.
108
+ * one, so these survive the restore as they are.
140
109
  */
141
110
  export function v5AccountsKept(submitted, stored) {
142
111
  const accounts = isPlainObject(submitted) && isPlainObject(submitted.accounts)
@@ -146,23 +115,18 @@ export function v5AccountsKept(submitted, stored) {
146
115
  .filter((entry) => !Object.prototype.hasOwnProperty.call(accounts, entry.key))
147
116
  .map(({ id, name }) => ({ id, name }));
148
117
  }
149
- export function currentFinanceAccountNotFoundError(today, accountId) {
150
- const count = listCurrentFinanceEntries(today).length + listV5Accounts(today).length;
118
+ export function currentFinanceAccountNotFoundError(currentFinances, accountId) {
119
+ const count = listV5Accounts(currentFinances).length;
151
120
  return new ProjectionLabError("INVALID_INPUT", `No Current Finances account with ID "${accountId}" found`, `Call projectionlab_get_current_finances to inspect the ${count} available account record(s)`);
152
121
  }
153
122
  /** The money fields of a Current Finances account. */
154
- const BALANCE_FIELDS = ["balance", "amount", "value", "costBasis"];
123
+ const BALANCE_FIELDS = ["balance", "value", "costBasis"];
155
124
  /**
156
- * The id-bearing accounts of one read, keyed by collection and id. A v5
157
- * account is keyed under the `accounts` collection, archived ones included.
125
+ * The accounts of one read, keyed by collection and id, archived ones
126
+ * included.
158
127
  */
159
128
  function accountsById(today) {
160
129
  const accounts = new Map();
161
- for (const entry of listCurrentFinanceEntries(today)) {
162
- const id = String(entry.account.id ?? "");
163
- if (id)
164
- accounts.set(`${entry.collection} ${id}`, entry.account);
165
- }
166
130
  for (const entry of listV5Accounts(today)) {
167
131
  accounts.set(`accounts ${entry.id}`, entry.account);
168
132
  }
@@ -1 +1 @@
1
- {"version":3,"file":"currentFinances.js","sourceRoot":"","sources":["../src/currentFinances.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,cAAc,EAAgB,MAAM,YAAY,CAAC;AAE1D,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,oBAAoB;IACpB,iBAAiB;IACjB,OAAO;IACP,QAAQ;CACA,CAAC;AAQX,MAAM,UAAU,yBAAyB,CACvC,KAAc;IAEd,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAC3E,MAAM,IAAI,GAAG,KAAgB,CAAC;IAC9B,M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AK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI;gBAAE,SAAS;YACpD,MAAM,GAAG,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;YAC3B,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,IAAI,EAAE,CAAC;gBACtC,QAAQ,CAAC,IAAI,CAAC,oBAAoB,KAAK,aAAa,KAAK,EAAE,CAAC,CAAC;YAC/D,CAAC;iBAAM,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,CAAC;gBACvC,QAAQ,CAAC,IAAI,CACX,oBAAoB,KAAK,IAAI,KAAK,iBAAiB,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CACrG,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;IACD,KAAK,MAAM,KAAK,IAAI,aAAa,CAAC,IAAI,EAAE,EAAE,CAAC;QACzC,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;YAC/B,QAAQ,CAAC,IAAI,CAAC,oBAAoB,KAAK,YAAY,CAAC,CAAC;QACvD,CAAC;IACH,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -1,5 +1,4 @@
1
1
  import { ProjectionLabError } from "./errors.js";
2
- import type { ExportLayout } from "./layout.js";
3
2
  /**
4
3
  * Verified field knowledge for the values this server reads and writes.
5
4
  * Single source for the `projectionlab://data-model` resource, the
@@ -12,10 +11,10 @@ import type { ExportLayout } from "./layout.js";
12
11
  * stored-value test.
13
12
  * - "export-shape": the field and its value type appear in a ProjectionLab 5
14
13
  * export; its meaning is not yet confirmed by a stored-value test.
15
- * Only fields confirmed against ProjectionLab 4.6.0 or 5.0.0 are listed;
16
- * fields known from names alone are left out entirely.
14
+ * Only fields confirmed against ProjectionLab 5.0.0, or plan settings
15
+ * confirmed against ProjectionLab 4.6.0 and carried as export-shape, are
16
+ * listed; fields known from names alone are left out entirely.
17
17
  */
18
- export declare const DATA_MODEL_PROJECTIONLAB_VERSION = "4.6.0";
19
18
  export declare const DATA_MODEL_V5_PROJECTIONLAB_VERSION = "5.0.0";
20
19
  export type DataModelEvidence = "observed" | "ui-label" | "export-shape";
21
20
  export interface DataModelField {
@@ -41,13 +40,12 @@ export interface DataModelGroup {
41
40
  title: string;
42
41
  fields: Record<string, DataModelField>;
43
42
  }
44
- export declare const DATA_MODEL_GROUPS: readonly DataModelGroup[];
45
43
  export declare const DATA_MODEL_V5_GROUPS: readonly DataModelGroup[];
46
44
  export declare const UI_LABELS_V5: Readonly<Record<string, Readonly<Record<string, readonly [label: string, location: string]>>>>;
47
- /** Get the data model groups for the specified export layout. */
48
- export declare function getDataModelGroups(layout?: ExportLayout): readonly DataModelGroup[];
45
+ /** The data model groups. */
46
+ export declare function getDataModelGroups(): readonly DataModelGroup[];
49
47
  /** Field entry for a scope-prefixed concrete path, or undefined. */
50
- export declare function matchDataModelField(scope: string, path: string, layout?: ExportLayout): DataModelField | undefined;
48
+ export declare function matchDataModelField(scope: string, path: string): DataModelField | undefined;
51
49
  /**
52
50
  * Whether a write of a value outside an entry's `allowedValues` is refused.
53
51
  * Only an observed entry binds a write: its field is confirmed by a
@@ -76,12 +74,12 @@ export interface DataModelAnnotation {
76
74
  */
77
75
  export declare function annotateAddressableValues<T extends {
78
76
  path: string;
79
- }>(scope: string | undefined, values: readonly T[], layout?: ExportLayout): (T & DataModelAnnotation)[];
77
+ }>(scope: string | undefined, values: readonly T[]): (T & DataModelAnnotation)[];
80
78
  /**
81
79
  * Choices to refuse a value over: an observed enum's list when value is a
82
80
  * string outside it. undefined when no refusal applies. Numeric and boolean
83
81
  * values are never refused; ui-label enums are annotated but not enforced.
84
82
  */
85
- export declare function refusedEnumChoices(scope: string | undefined, path: string, value: unknown, layout?: ExportLayout): readonly string[] | undefined;
83
+ export declare function refusedEnumChoices(scope: string | undefined, path: string, value: unknown): readonly string[] | undefined;
86
84
  /** Refusal for a value a write sets outside an observed enum's choices. */
87
- export declare function enumRefusalError(scope: string, path: string, value: unknown, layout?: ExportLayout): ProjectionLabError | undefined;
85
+ export declare function enumRefusalError(scope: string, path: string, value: unknown): ProjectionLabError | undefined;