truthspine 0.0.0-stage → 0.2.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.
- package/LICENSE +201 -0
- package/README.md +68 -2
- package/bin/truthspine-mcp.mjs +37 -0
- package/lib/claude-lifecycle-contract.cjs +67 -0
- package/lib/installed-mcp-launcher.cjs +715 -0
- package/lib/package.json +3 -0
- package/package.json +58 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction, and
|
|
10
|
+
distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,69 @@
|
|
|
1
|
-
#
|
|
1
|
+
# TruthSpine MCP connector (npm)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/truthspine) [](https://www.npmjs.com/package/truthspine) [](LICENSE)
|
|
4
|
+
|
|
5
|
+
The free MCP connector for TruthSpine, the local-first project-truth app for AI agents.
|
|
6
|
+
|
|
7
|
+
The keeper of your projects. You lead the work. TruthSpine keeps the truth automatically.
|
|
8
|
+
|
|
9
|
+
One checked record of what was decided, what was done, what failed and what comes next. Every connected chat starts already knowing your project. Your project stays on your computer.
|
|
10
|
+
|
|
11
|
+
This is the free connector. It needs the TruthSpine desktop app installed on the same computer: the [Microsoft Store](https://apps.microsoft.com/detail/9pbn25k75vdj) on Windows, the [Mac App Store](https://apps.apple.com/app/id6794478470) on macOS, or the AppImage from [truthspine.app](https://truthspine.app/download) on Linux.
|
|
12
|
+
|
|
13
|
+
## Setup
|
|
14
|
+
|
|
15
|
+
1. Install and open the TruthSpine app, and connect your project folder in it.
|
|
16
|
+
2. Add an MCP server to your tool that runs `npx -y @timeprooflabs/truthspine-mcp --host <tool>`, started in your project folder (or add `--project <folder>`). Use your tool's name for `<tool>`. Without `--host` the connection is labelled as an agent on this computer.
|
|
17
|
+
3. In a chat, say "Connect TruthSpine".
|
|
18
|
+
|
|
19
|
+
Names for `--host`:
|
|
20
|
+
|
|
21
|
+
- Claude Desktop: `claude-desktop`
|
|
22
|
+
- Claude Code: `claude-code`
|
|
23
|
+
- Codex: `codex-cli`
|
|
24
|
+
- Cursor: `cursor`
|
|
25
|
+
- VS Code: `vscode`
|
|
26
|
+
- GitHub Copilot in VS Code: `github-copilot-vscode`
|
|
27
|
+
- Cline: `cline`
|
|
28
|
+
- Windsurf / Devin: `windsurf-devin`
|
|
29
|
+
- OpenCode: `opencode`
|
|
30
|
+
- LM Studio: `lm-studio`
|
|
31
|
+
- Kiro: `kiro`
|
|
32
|
+
- Google Antigravity: `antigravity`
|
|
33
|
+
- JetBrains IDEs: `jetbrains`
|
|
34
|
+
- Zed: `zed`
|
|
35
|
+
- Hermes Agent: `hermes-agent`
|
|
36
|
+
- OpenClaw: `openclaw`
|
|
37
|
+
- GitHub Copilot CLI: `copilot-cli`
|
|
38
|
+
- Droid: `droid`
|
|
39
|
+
- Pi: `pi`
|
|
40
|
+
- Gemini CLI: `gemini-cli`
|
|
41
|
+
|
|
42
|
+
The TruthSpine app can also write these settings for you: open Connections and choose your tool.
|
|
43
|
+
|
|
44
|
+
## Tools
|
|
45
|
+
|
|
46
|
+
- `truthspine_attach`: Attach this chat to the project's TruthSpine record and receive the current brief: decisions, completed work, evidence and next steps.
|
|
47
|
+
- `truthspine_consult`: Ask what is true about the project, what was decided and why, or what to do next. Read only.
|
|
48
|
+
- `truthspine_record`: Save a decision, finished work, a failure or the next step to the project's record on this computer.
|
|
49
|
+
- `truthspine_history`: Read what was saved recently, or confirm that a save was recorded. Read only.
|
|
50
|
+
|
|
51
|
+
## Licence
|
|
52
|
+
|
|
53
|
+
This connector is free (Apache License 2.0). It needs the TruthSpine app, which you get and buy separately.
|
|
54
|
+
Installing the connector does not start a trial or need its own license.
|
|
55
|
+
On Windows, start the free 14-day trial in the TruthSpine app. Then buy once in the Microsoft Store: $99.99 at the launch price (regular price $249.99), for V1 and every 1.x update. Reinstalling does not restart the trial.
|
|
56
|
+
On Mac, start the free 14-day trial in the TruthSpine app. Then buy once in the App Store: $99.99 at the launch price (regular price $249.99), for V1 and every 1.x update. Restore Purchases brings it back on your other Macs.
|
|
57
|
+
On Linux, the TruthSpine AppImage from truthspine.app starts with a free 14-day trial. Then buy once from us: $99.99 at the launch price (regular price $249.99), for V1 and every 1.x update, on up to three of your own Linux computers. You can move it between them in the app.
|
|
58
|
+
|
|
59
|
+
## Privacy Policy
|
|
60
|
+
|
|
61
|
+
Full policy: https://truthspine.app/privacy
|
|
62
|
+
|
|
63
|
+
- **What is collected:** this connector collects nothing itself. It starts the TruthSpine app installed on your computer and passes your agent's requests to it.
|
|
64
|
+
- **Use and storage:** the TruthSpine app keeps your project record (decisions, completed work, evidence references and next steps) in its data folder on your computer. Project files are read on your computer and are not uploaded by TruthSpine.
|
|
65
|
+
- **Third-party sharing:** none by this connector. What your agent shows or sends to its own AI provider is governed by that provider. The app contacts TimeProofLabs only for licence checks and, if you agree to it, anonymous usage counts. Purchases go through Microsoft, Apple or Stripe. Optional features you turn on, such as remote access or GitHub projects, connect only to accounts you choose.
|
|
66
|
+
- **Retention:** the record stays on your computer until you delete the project or the app's data; you can download or delete it at any time from the app.
|
|
67
|
+
- **Contact:** support@truthspine.app
|
|
68
|
+
|
|
69
|
+
Support: https://truthspine.app/support
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import os from "node:os";
|
|
3
|
+
import launcher from "../lib/installed-mcp-launcher.cjs";
|
|
4
|
+
import contract from "../lib/claude-lifecycle-contract.cjs";
|
|
5
|
+
|
|
6
|
+
const args = process.argv.slice(2);
|
|
7
|
+
const option = (name) => { const index = args.indexOf(name); return index >= 0 && typeof args[index + 1] === "string" ? args[index + 1] : null; };
|
|
8
|
+
if (args.includes("--help") || args.includes("-h")) {
|
|
9
|
+
process.stdout.write("truthspine-mcp [--host <tool>] [--project <folder>]\nStarts the TruthSpine connector for the TruthSpine app installed on this computer.\n");
|
|
10
|
+
process.exit(0);
|
|
11
|
+
}
|
|
12
|
+
const configuredRoot = String(option("--project") ?? process.env.TRUTHSPINE_PROJECT_ROOT ?? "").trim();
|
|
13
|
+
const host = String(option("--host") ?? process.env.TRUTHSPINE_HOST_ID ?? "computer-agent").trim().toLowerCase();
|
|
14
|
+
const controller = new AbortController();
|
|
15
|
+
let connection;
|
|
16
|
+
let startupStage = "workspace-binding";
|
|
17
|
+
const stop = () => { controller.abort(); connection?.stop(1); };
|
|
18
|
+
process.once("SIGINT", stop); process.once("SIGTERM", stop);
|
|
19
|
+
try {
|
|
20
|
+
const unresolved = /\$\{[^}]+\}|%[A-Za-z_][A-Za-z0-9_]*%|\$env:[A-Za-z_][A-Za-z0-9_]*/i.test(configuredRoot);
|
|
21
|
+
process.env.TRUTHSPINE_PROJECT_ROOT = launcher.resolveBoundedHostWorkspace({ cwd: unresolved ? process.cwd() : configuredRoot || process.cwd(), homeDir: os.homedir() }).projectRoot;
|
|
22
|
+
process.env.TRUTHSPINE_LOCK_PROJECT_ROOT = "1";
|
|
23
|
+
process.env.TRUTHSPINE_HOST_ID = host;
|
|
24
|
+
process.env.TRUTHSPINE_LAUNCHER_HOST_ID = host;
|
|
25
|
+
delete process.env.NODE_OPTIONS; delete process.env.NODE_PATH;
|
|
26
|
+
startupStage = "installed-runtime-start";
|
|
27
|
+
process.env.TRUTHSPINE_RUNTIME_REGISTRATION_PATH = contract.defaultRuntimeRegistrationPath();
|
|
28
|
+
connection = await launcher.startInstalledMcpLauncherWithRecovery({ signal: controller.signal });
|
|
29
|
+
const result = await connection.closed;
|
|
30
|
+
process.exitCode = result.code;
|
|
31
|
+
} catch {
|
|
32
|
+
const guidance = startupStage === "workspace-binding"
|
|
33
|
+
? "Start it inside your project folder or pass --project <folder>. Licensing has not been checked; do not sign in or purchase to resolve this."
|
|
34
|
+
: "Install and open the TruthSpine app, connect this project in it, and check --host names your tool. This startup error alone does not establish a licensing failure.";
|
|
35
|
+
process.stderr.write(`TruthSpine startup failed at ${startupStage}. ${guidance}\n`);
|
|
36
|
+
process.exitCode = 1;
|
|
37
|
+
} finally { process.removeListener("SIGINT", stop); process.removeListener("SIGTERM", stop); }
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const crypto = require("node:crypto");
|
|
3
|
+
const launcher = require("./installed-mcp-launcher.cjs");
|
|
4
|
+
|
|
5
|
+
const fail = () => { throw new Error("TruthSpine could not bind this Claude session to its workspace. No automatic attachment was confirmed."); };
|
|
6
|
+
// Only the host lifecycle envelope is consumed. transcript_path is never read;
|
|
7
|
+
// permission_mode is never treated as a TruthSpine permission grant.
|
|
8
|
+
function buildClaudeSessionStartRequest(input, { homeDir, platform = process.platform } = {}) {
|
|
9
|
+
if (typeof input !== "string" || Buffer.byteLength(input) > 65536) fail();
|
|
10
|
+
let event;
|
|
11
|
+
try { event = JSON.parse(input); } catch { fail(); }
|
|
12
|
+
if (!event || typeof event !== "object" || Array.isArray(event)
|
|
13
|
+
|| event.hook_event_name !== "SessionStart"
|
|
14
|
+
|| !["startup", "resume", "clear", "compact"].includes(event.source)
|
|
15
|
+
|| typeof event.session_id !== "string" || !event.session_id.trim()
|
|
16
|
+
|| event.session_id.length > 2048 || /[\u0000-\u001f\u007f]/.test(event.session_id)) fail();
|
|
17
|
+
const { projectRoot } = launcher.resolveBoundedHostWorkspace({ cwd: event.cwd, homeDir, platform });
|
|
18
|
+
return Object.freeze({
|
|
19
|
+
tool: "truthspine_onboard_chat",
|
|
20
|
+
// Host/workspace are fixed by the transport, not overridable tool selectors.
|
|
21
|
+
// Older catalogs reject identityMode before tools/call, preventing silent
|
|
22
|
+
// fallback to the old per-attachment/title-derived chat identity.
|
|
23
|
+
arguments: Object.freeze({ hostChatId: event.session_id, identityMode: "host-thread" }),
|
|
24
|
+
projectRoot,
|
|
25
|
+
sessionIdHash: crypto.createHash("sha256").update(event.session_id).digest("hex")
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function formatClaudeSessionStartResult(request, result) {
|
|
30
|
+
const metrics = result?.metrics;
|
|
31
|
+
if (!request || request.tool !== "truthspine_onboard_chat"
|
|
32
|
+
|| result?.project?.projectRoot !== request.projectRoot
|
|
33
|
+
|| result?.binding?.hostSurface !== "claude-code"
|
|
34
|
+
|| result?.binding?.hostChatIdHash !== request.sessionIdHash
|
|
35
|
+
|| metrics?.hostSurface !== "claude-code"
|
|
36
|
+
|| typeof metrics?.label !== "string" || !/^[a-z0-9][a-z0-9_-]{0,255}$/.test(metrics.label)
|
|
37
|
+
|| metrics.runId !== metrics.label || metrics.sourceRef !== metrics.label
|
|
38
|
+
|| !/^[a-f0-9]{32}$/.test(metrics.chatSessionFingerprint || "")) fail();
|
|
39
|
+
const readScope = { chatId: metrics.label, chatSessionFingerprint: metrics.chatSessionFingerprint };
|
|
40
|
+
const syncIdentity = { runId: metrics.label, sourceRef: metrics.label,
|
|
41
|
+
chatSessionFingerprint: metrics.chatSessionFingerprint };
|
|
42
|
+
return {
|
|
43
|
+
hookSpecificOutput: { hookEventName: "SessionStart", additionalContext: [
|
|
44
|
+
"TruthSpine has returned this session's workspace-bound attachment identity.",
|
|
45
|
+
`Use this readScope for project-dependent TruthSpine reads: ${JSON.stringify(readScope)}.`,
|
|
46
|
+
`Use this identity for governed session updates: ${JSON.stringify(syncIdentity)}.`,
|
|
47
|
+
`For an explicit Attach TruthSpine request in this same host session/workspace, call truthspine_onboard_chat with these exact arguments: ${JSON.stringify(request.arguments)}. Never replace them with an empty object or a guessed title/ID.`,
|
|
48
|
+
"Consult truthspine_answer_guard before project-dependent answers and actions. Persist meaningful work deltas through governed session updates using this same identity; do not copy another chat's identity.",
|
|
49
|
+
"These identifiers provide attribution, not owner authorization or proof that reported work is correct."
|
|
50
|
+
].join("\n") }
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
// Where the installed app records itself (the same place the app writes it). Used when a
|
|
54
|
+
// public connector carries no machine-specific path; an explicit setting still wins.
|
|
55
|
+
function defaultRuntimeRegistrationPath({ platform = process.platform, env = process.env,
|
|
56
|
+
homeDir = require("node:os").homedir() } = {}) {
|
|
57
|
+
const path = require("node:path");
|
|
58
|
+
const configured = String(env.TRUTHSPINE_RUNTIME_REGISTRATION_PATH || "").trim();
|
|
59
|
+
if (configured) return configured;
|
|
60
|
+
// Windows: ~\.truthspine\app, never AppData, which a Store app sees only in its private copy (shared-registration-path.js).
|
|
61
|
+
if (platform === "win32") return path.win32.join(homeDir, ".truthspine", "app", "runtime.json");
|
|
62
|
+
const home = homeDir.replace(/\\/g, "/");
|
|
63
|
+
if (platform === "darwin") return path.posix.join(home, "Library", "Application Support", "TruthSpine", "runtime.json");
|
|
64
|
+
return path.posix.join(env.XDG_CONFIG_HOME || path.posix.join(home, ".config"), "TruthSpine", "runtime.json");
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
module.exports = { buildClaudeSessionStartRequest, formatClaudeSessionStartResult, defaultRuntimeRegistrationPath };
|
|
@@ -0,0 +1,715 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
// Thin connector transport, compatible with the MCPB's Node >=16 runtime.
|
|
5
|
+
// No TruthSpine engine import. Registration selects a launch destination; it
|
|
6
|
+
// never supplies Store ownership. The installed core verifies native access.
|
|
7
|
+
// (The one exception runs the installed package's own server in this process: inPlaceHandover below.)
|
|
8
|
+
const fs = require("node:fs");
|
|
9
|
+
const path = require("node:path");
|
|
10
|
+
const crypto = require("node:crypto");
|
|
11
|
+
const { spawn } = require("node:child_process");
|
|
12
|
+
const net = require("node:net");
|
|
13
|
+
|
|
14
|
+
const ERROR = "TruthSpine could not start. Open the TruthSpine app and try again. Your purchase is not affected.";
|
|
15
|
+
const fail = () => { throw new Error(ERROR); };
|
|
16
|
+
// Typed launcher results. Every failure still throws the same generic sentence (ERROR) and
|
|
17
|
+
// nothing below changes which conditions fail; a failure that can be told apart safely also
|
|
18
|
+
// carries a stable code so the entry point and host wrappers can show a short, honest message.
|
|
19
|
+
// The catalogue mirrors src/agent-contract/launcher-results.js and is kept inline because
|
|
20
|
+
// generated wrappers (MCPB, VS Code, Codex) must stay single-file with no engine import.
|
|
21
|
+
// license_required and incompatible_version are decided by the installed core after the
|
|
22
|
+
// connection opens, never by this transport.
|
|
23
|
+
const LAUNCHER_RESULTS = Object.freeze({
|
|
24
|
+
app_not_installed: "TruthSpine isn't installed on this computer.",
|
|
25
|
+
app_not_running: "TruthSpine is installed but not running. Open it and try again.",
|
|
26
|
+
unavailable: ERROR
|
|
27
|
+
});
|
|
28
|
+
const LAUNCHER_STORE_LINKS = Object.freeze({ win32: "https://apps.microsoft.com/detail/9pbn25k75vdj", darwin: "https://apps.apple.com/us/app/truthspine/id6794478470?mt=12" });
|
|
29
|
+
const LAUNCHER_CODE_PREFIX = "truthspine.launcher.";
|
|
30
|
+
const typedFail = code => { const error = new Error(ERROR); error.code = LAUNCHER_CODE_PREFIX + code; throw error; };
|
|
31
|
+
const typedCode = error => {
|
|
32
|
+
const code = error && typeof error.code === "string" && error.code.indexOf(LAUNCHER_CODE_PREFIX) === 0 ? error.code.slice(LAUNCHER_CODE_PREFIX.length) : null;
|
|
33
|
+
if (code && Object.prototype.hasOwnProperty.call(LAUNCHER_RESULTS, code)) return code;
|
|
34
|
+
return error && error.message === "store_package_recovery_unavailable" ? "app_not_installed" : null;
|
|
35
|
+
};
|
|
36
|
+
// The one line a person should read when the launcher cannot connect.
|
|
37
|
+
function describeLauncherFailure(error, platform) {
|
|
38
|
+
const code = typedCode(error) || "unavailable";
|
|
39
|
+
const link = code === "app_not_installed" ? LAUNCHER_STORE_LINKS[platform || process.platform] : undefined;
|
|
40
|
+
return { code, message: LAUNCHER_RESULTS[code] + (link ? " Install it from " + link : ""), storeLink: link };
|
|
41
|
+
}
|
|
42
|
+
const object = value => value !== null && typeof value === "object" && !Array.isArray(value);
|
|
43
|
+
// "continue" stays accepted so an entry an earlier version wrote keeps starting; TruthSpine no longer offers or writes it
|
|
44
|
+
// (Continue retired by the owner, 2026-10-09).
|
|
45
|
+
const HOST_IDS = new Set(["claude-desktop", "claude-code", "codex-cli", "cursor", "vscode", "github-copilot-vscode", "continue", "cline", "cline-cli", "windsurf-devin", "opencode", "opencode-ide", "lm-studio", "kiro", "antigravity", "jetbrains", "zed", "hermes-agent", "openclaw", "copilot-cli", "droid", "pi", "computer-agent", "gemini-cli"]);
|
|
46
|
+
function absolute(value, paths) {
|
|
47
|
+
if (typeof value !== "string" || !value.trim() || value !== value.trim()
|
|
48
|
+
|| /[\u0000-\u001f\u007f]/.test(value) || !paths.isAbsolute(value)) fail();
|
|
49
|
+
return paths.resolve(value);
|
|
50
|
+
}
|
|
51
|
+
function equal(a, b, platform) { return platform === "win32" ? a.toLowerCase() === b.toLowerCase() : a === b; }
|
|
52
|
+
// Program Files, where the Store installs (WindowsApps). Codex starts its servers with a short environment that leaves
|
|
53
|
+
// ProgramFiles out (Main Build, Windows VM 2026-10-10: TruthSpine stopped before Codex saw its tools); Windows keeps
|
|
54
|
+
// it on the system drive, as systemOrProgramFolder below already assumes. The executable must still sit exactly there.
|
|
55
|
+
function windowsProgramFiles(env, paths) {
|
|
56
|
+
const named = env.ProgramFiles || env.PROGRAMFILES || env.ProgramW6432;
|
|
57
|
+
if (named) return absolute(named, paths);
|
|
58
|
+
const system = env.SystemRoot || env.SYSTEMROOT || env.windir || env.WINDIR;
|
|
59
|
+
const drive = typeof system === "string" && paths.isAbsolute(system) ? paths.parse(paths.resolve(system)).root
|
|
60
|
+
: typeof env.SystemDrive === "string" && /^[A-Za-z]:$/.test(env.SystemDrive) ? `${env.SystemDrive}\\` : null;
|
|
61
|
+
if (!drive) fail();
|
|
62
|
+
return paths.join(drive, "Program Files");
|
|
63
|
+
}
|
|
64
|
+
// An app started outside any project works in a system or program folder: JetBrains AI Assistant starts its servers in
|
|
65
|
+
// C:\Windows\system32 (Main Build, 2026-10-09), an app may start in its own install folder. Such a folder is never a
|
|
66
|
+
// project; the connection finds its project instead (launcherProjectRoot returns null).
|
|
67
|
+
function systemOrProgramFolder(root, platform, env) {
|
|
68
|
+
const paths = platform === "win32" ? path.win32 : path.posix;
|
|
69
|
+
const inside = base => {
|
|
70
|
+
if (typeof base !== "string" || !base || !paths.isAbsolute(base)) return false;
|
|
71
|
+
const resolved = paths.resolve(base);
|
|
72
|
+
return equal(root, resolved, platform) || (platform === "win32" ? root.toLowerCase().indexOf(resolved.toLowerCase().replace(/\\$/, "") + "\\") === 0
|
|
73
|
+
: root.indexOf(resolved.replace(/\/$/, "") + "/") === 0);
|
|
74
|
+
};
|
|
75
|
+
if (platform === "win32") {
|
|
76
|
+
const drive = paths.parse(root).root;
|
|
77
|
+
const local = env.LOCALAPPDATA;
|
|
78
|
+
return [env.SystemRoot || env.SYSTEMROOT || env.windir || drive + "Windows", env.ProgramFiles || drive + "Program Files",
|
|
79
|
+
env["ProgramFiles(x86)"] || drive + "Program Files (x86)", env.ProgramW6432, env.ProgramData || drive + "ProgramData",
|
|
80
|
+
local && paths.join(local, "Programs"), local && paths.join(local, "Microsoft", "WindowsApps")].some(inside);
|
|
81
|
+
}
|
|
82
|
+
// /private/var is left out: a Mac's temporary folders live under it.
|
|
83
|
+
return ["/usr", "/bin", "/sbin", "/lib", "/lib32", "/lib64", "/etc", "/opt", "/snap", "/proc", "/sys", "/dev", "/boot", "/var/lib",
|
|
84
|
+
"/System", "/Library", "/Applications", "/private/etc"].some(inside) || /^\/tmp\/\.mount_[^/]+(\/|$)/.test(root);
|
|
85
|
+
}
|
|
86
|
+
// An AI app's own folder is never the person's project either: OpenClaw runs every agent turn in its own workspace
|
|
87
|
+
// (~/.openclaw/workspace, or agents.defaults.workspace in openclaw.json), whatever folder it was started from, and a chat
|
|
88
|
+
// there named that folder (Main Build, Linux 2026-10-10). The apps' settings and data folders in the home folder, and a
|
|
89
|
+
// configured OpenClaw workspace wherever it is, are refused; the connection then finds the person's project.
|
|
90
|
+
const APP_HOME_FOLDERS = [".openclaw", ".hermes", ".codex", ".claude", ".cursor", ".gemini", ".copilot", ".factory", ".pi", ".kiro",
|
|
91
|
+
".junie", ".ai", ".agents", ".truthspine", ".config", ".local", ".cache", ".vscode", ".vscode-insiders", ".vscode-oss", ".windsurf",
|
|
92
|
+
".codeium", ".continue", ".cline", ".lmstudio", ".ollama", ".opencode", ".zed", ".devin", ".npm", ".nvm", ".cargo", ".rustup",
|
|
93
|
+
".docker", ".ssh", ".gnupg"];
|
|
94
|
+
function insideFolder(root, base, platform) {
|
|
95
|
+
const paths = platform === "win32" ? path.win32 : path.posix;
|
|
96
|
+
if (typeof base !== "string" || !base || !paths.isAbsolute(base)) return false;
|
|
97
|
+
const resolved = paths.resolve(base);
|
|
98
|
+
return equal(root, resolved, platform) || (platform === "win32" ? root.toLowerCase().indexOf(resolved.toLowerCase().replace(/\\$/, "") + "\\") === 0
|
|
99
|
+
: root.indexOf(resolved.replace(/\/$/, "") + "/") === 0);
|
|
100
|
+
}
|
|
101
|
+
function openClawWorkspace(homeDir, platform) {
|
|
102
|
+
const paths = platform === "win32" ? path.win32 : path.posix;
|
|
103
|
+
try {
|
|
104
|
+
const file = paths.join(homeDir, ".openclaw", "openclaw.json");
|
|
105
|
+
if (fs.statSync(file).size > 1024 * 1024) return null;
|
|
106
|
+
const workspace = JSON.parse(fs.readFileSync(file, "utf8"))?.agents?.defaults?.workspace;
|
|
107
|
+
if (typeof workspace !== "string" || !workspace.trim()) return null;
|
|
108
|
+
const expanded = workspace.trim().replace(/^~(?=$|[\\/])/, homeDir);
|
|
109
|
+
return paths.isAbsolute(expanded) ? expanded : null;
|
|
110
|
+
} catch { return null; }
|
|
111
|
+
}
|
|
112
|
+
function appOwnFolder(root, homeDir, platform) {
|
|
113
|
+
const paths = platform === "win32" ? path.win32 : path.posix;
|
|
114
|
+
const home = paths.resolve(homeDir);
|
|
115
|
+
const bases = APP_HOME_FOLDERS.map(name => paths.join(home, name));
|
|
116
|
+
if (platform === "win32") bases.push(paths.join(home, "AppData", "Roaming"));
|
|
117
|
+
if (platform === "darwin") bases.push(paths.join(home, "Library"));
|
|
118
|
+
// The person's own program folder, where AppImages and unpacked apps live (Main Build, Linux 0.1.8: a chat started in
|
|
119
|
+
// ~/Applications/VSCode-linux-x64 became a project and was learned at a third of a core), by its own path and by the
|
|
120
|
+
// folder it links to (LinuxImac's ~/Applications points at /data/moved-from-home/Applications).
|
|
121
|
+
if (platform !== "win32") {
|
|
122
|
+
const programs = paths.join(home, "Applications");
|
|
123
|
+
bases.push(programs);
|
|
124
|
+
if (platform === process.platform) { try { bases.push(fs.realpathSync(programs)); } catch { /* none */ } }
|
|
125
|
+
}
|
|
126
|
+
bases.push(openClawWorkspace(home, platform));
|
|
127
|
+
return bases.some(base => insideFolder(root, base, platform));
|
|
128
|
+
}
|
|
129
|
+
// Codex's dated scratch folders, one per day: Documents\Codex\<yyyy-mm-dd>\<name> (also under a OneDrive Documents).
|
|
130
|
+
// Not a new project: a chat working there never registers it (Brainstorming, 2026-10-21: the owner's
|
|
131
|
+
// Documents\Codex\2026-10-16\lo, copies of two public repositories a chat looked at, became "AI Dungeon Master"). Unlike
|
|
132
|
+
// the folders above, one registered earlier stays listed with its records, and asks for its real folder.
|
|
133
|
+
const CODEX_DAY_FOLDER = /^(?:onedrive[^\\/]*[\\/])?documents[\\/]codex(?:[\\/]\d{4}-\d{2}-\d{2}(?:[\\/].*)?)?$/i;
|
|
134
|
+
function scratchFolder(folder, { homeDir, platform = process.platform } = {}) {
|
|
135
|
+
const paths = platform === "win32" ? path.win32 : path.posix;
|
|
136
|
+
if (typeof folder !== "string" || !paths.isAbsolute(folder) || typeof homeDir !== "string" || !paths.isAbsolute(homeDir)) return false;
|
|
137
|
+
const root = longWindowsName(paths.resolve(folder), platform), home = paths.resolve(homeDir);
|
|
138
|
+
if (!insideFolder(root, home, platform) || equal(root, home, platform)) return false;
|
|
139
|
+
return CODEX_DAY_FOLDER.test(paths.relative(home, root));
|
|
140
|
+
}
|
|
141
|
+
// The account's own home folder, from the user database. In the Mac App Store sandbox HOME and os.homedir() are the
|
|
142
|
+
// app's container (~/Library/Containers/<app>/Data), so the person's real home and its Library would otherwise pass
|
|
143
|
+
// as projects; found on TestFlight build 45, 2026-10-10: every chat attached to TruthSpine's own container.
|
|
144
|
+
function accountHomeFolder() {
|
|
145
|
+
try { const home = require("node:os").userInfo().homedir; return typeof home === "string" && home ? home : null; } catch { return null; }
|
|
146
|
+
}
|
|
147
|
+
// The system's temporary folder itself (not a folder inside it): a chat started there has no folder of its own (owner
|
|
148
|
+
// 2026-10-16, "yes to the tmp folder rule"; Main Build, Linux: a chat started in /tmp became a project named "tmp").
|
|
149
|
+
function systemTempFolder(root, platform, env) {
|
|
150
|
+
const paths = platform === "win32" ? path.win32 : path.posix;
|
|
151
|
+
const named = platform === "win32"
|
|
152
|
+
? [env.TEMP, env.TMP, env.LOCALAPPDATA && paths.join(env.LOCALAPPDATA, "Temp"), (env.SystemRoot || env.SYSTEMROOT || env.windir) && paths.join(env.SystemRoot || env.SYSTEMROOT || env.windir, "Temp")]
|
|
153
|
+
: ["/tmp", "/var/tmp", "/private/tmp", "/private/var/tmp", env.TMPDIR];
|
|
154
|
+
if (platform === process.platform) { try { named.push(require("node:os").tmpdir()); } catch { /* no temporary folder known */ } }
|
|
155
|
+
return named.some(base => typeof base === "string" && paths.isAbsolute(base) && equal(root, paths.resolve(base), platform));
|
|
156
|
+
}
|
|
157
|
+
// Judged by the path alone (a sandboxed relay may not look inside the folder): the disk root, a home folder (the one
|
|
158
|
+
// given and the account's own), a system or program folder, the temporary folder itself, or an AI app's own folder is
|
|
159
|
+
// never a project.
|
|
160
|
+
function neverAProjectFolder(folder, { homeDir, platform = process.platform, env = process.env } = {}) {
|
|
161
|
+
const paths = platform === "win32" ? path.win32 : path.posix;
|
|
162
|
+
if (typeof folder !== "string" || !paths.isAbsolute(folder)) return true;
|
|
163
|
+
// (also for a saved project: the start-of-app tidy then removes a "MICROS~1" project an earlier version made)
|
|
164
|
+
const root = longWindowsName(paths.resolve(folder), platform);
|
|
165
|
+
if (equal(root, paths.parse(root).root, platform) || systemOrProgramFolder(root, platform, env || {})
|
|
166
|
+
|| systemTempFolder(root, platform, env || {})) return true;
|
|
167
|
+
const homes = [homeDir, platform === process.platform ? accountHomeFolder() : null].filter(home => typeof home === "string" && paths.isAbsolute(home));
|
|
168
|
+
return homes.some(home => equal(root, paths.resolve(home), platform) || appOwnFolder(root, home, platform));
|
|
169
|
+
}
|
|
170
|
+
// A Windows short name ("C:\PROGRA~1\MICROS~1") is the same folder as its long one ("C:\Program Files\Microsoft VS
|
|
171
|
+
// Code"), but it matches none of the folders above by name. Cline starts its servers in VS Code's install folder under
|
|
172
|
+
// its short name (Windows VM, 2026-10-20): it became a project named "MICROS~1". The name is read in full first.
|
|
173
|
+
function longWindowsName(root, platform) {
|
|
174
|
+
if (platform !== "win32" || platform !== process.platform || !/~/.test(root)) return root;
|
|
175
|
+
try { return fs.realpathSync.native(root); } catch { return root; }
|
|
176
|
+
}
|
|
177
|
+
function resolveBoundedHostWorkspace({ cwd, homeDir, platform = process.platform, env = process.env } = {}) {
|
|
178
|
+
const paths = platform === "win32" ? path.win32 : path.posix;
|
|
179
|
+
if (typeof cwd !== "string" || !paths.isAbsolute(cwd)
|
|
180
|
+
|| typeof homeDir !== "string" || !paths.isAbsolute(homeDir)) throw new Error("TruthSpine needs an absolute host workspace directory.");
|
|
181
|
+
const root = longWindowsName(paths.resolve(cwd), platform);
|
|
182
|
+
if (neverAProjectFolder(root, { homeDir, platform, env })) {
|
|
183
|
+
throw new Error("TruthSpine could not identify a bounded host workspace. Open the intended project or folder; the last app-selected project will not be used for this task.");
|
|
184
|
+
}
|
|
185
|
+
if (!fs.statSync(root).isDirectory()) throw new Error("TruthSpine's host workspace must be an existing directory.");
|
|
186
|
+
const realRoot = fs.realpathSync(root), realHome = fs.realpathSync(homeDir);
|
|
187
|
+
const account = platform === process.platform ? accountHomeFolder() : null;
|
|
188
|
+
let realAccount = null;
|
|
189
|
+
try { realAccount = account ? fs.realpathSync(account) : null; } catch { /* the account home may not be readable in a sandbox */ }
|
|
190
|
+
if (equal(realRoot, realHome, platform) || neverAProjectFolder(realRoot, { homeDir: realHome, platform, env })
|
|
191
|
+
|| (realAccount && (equal(realRoot, realAccount, platform) || appOwnFolder(realRoot, realAccount, platform)))) {
|
|
192
|
+
throw new Error("TruthSpine refused a workspace alias to an unbounded home or filesystem root.");
|
|
193
|
+
}
|
|
194
|
+
// Preserve lexical nested-folder/worktree selection; it is not the Git root
|
|
195
|
+
// or the app's last selected project. Native access remains a core decision. VS Code starts servers in "c:\..."
|
|
196
|
+
// (2026-10-09 probe): the drive letter is written one way so one folder is one project.
|
|
197
|
+
return { projectRoot: platform === "win32" ? root.replace(/^[a-z]:/, drive => drive.toUpperCase()) : root };
|
|
198
|
+
}
|
|
199
|
+
function restrictiveTelemetryEnv(...sources) {
|
|
200
|
+
return sources.some(env => {
|
|
201
|
+
const mode = typeof env?.TRUTHSPINE_TELEMETRY_MODE === "string" ? env.TRUTHSPINE_TELEMETRY_MODE.trim().toLowerCase() : "";
|
|
202
|
+
return mode && mode !== "production";
|
|
203
|
+
}) ? { TRUTHSPINE_TELEMETRY_MODE: "disabled" } : {};
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
function readRegistration(filename) {
|
|
207
|
+
let fd;
|
|
208
|
+
try {
|
|
209
|
+
const before = fs.lstatSync(filename);
|
|
210
|
+
if (!before.isFile() || before.isSymbolicLink() || before.size > 65536) fail();
|
|
211
|
+
fd = fs.openSync(filename, "r");
|
|
212
|
+
const opened = fs.fstatSync(fd);
|
|
213
|
+
if (!opened.isFile() || opened.size > 65536 || opened.ino !== before.ino || opened.dev !== before.dev) fail();
|
|
214
|
+
const buffer = Buffer.alloc(65537); let used = 0;
|
|
215
|
+
while (used < buffer.length) { const count = fs.readSync(fd, buffer, used, buffer.length - used, null); if (!count) break; used += count; }
|
|
216
|
+
const after = fs.fstatSync(fd);
|
|
217
|
+
if (used > 65536 || used !== opened.size || after.size !== opened.size || after.mtimeMs !== opened.mtimeMs) fail();
|
|
218
|
+
const parsed = JSON.parse(buffer.subarray(0, used).toString("utf8"));
|
|
219
|
+
if (!object(parsed) || parsed.schema !== "truthspine.installed-runtime.v1") fail();
|
|
220
|
+
return parsed;
|
|
221
|
+
} catch { fail(); }
|
|
222
|
+
finally { if (fd !== undefined) fs.closeSync(fd); }
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
const WINDOWS_OS_NAMES = new Set(["systemroot", "windir", "comspec", "temp", "tmp", "userprofile", "localappdata", "appdata",
|
|
226
|
+
"programfiles", "programfiles(x86)", "programdata", "allusersprofile", "public", "processor_architecture",
|
|
227
|
+
"number_of_processors", "computername", "os", "pathext", "path"]);
|
|
228
|
+
// Linux: what the AppImage runtime and the server need to find the user's folders, and nothing else.
|
|
229
|
+
const LINUX_OS_NAMES = new Set(["home", "path", "user", "logname", "lang", "lc_all", "lc_ctype", "lc_messages", "tmpdir",
|
|
230
|
+
"xdg_data_home", "xdg_config_home", "xdg_cache_home", "xdg_runtime_dir", "appimage_extract_and_run"]);
|
|
231
|
+
const LINUX_APP_ROOT = "@app";
|
|
232
|
+
function installedChildEnv({ env, platform, profile, root, hostId, developmentBuild = false }) {
|
|
233
|
+
const childEnv = {};
|
|
234
|
+
const osNames = platform === "linux" ? LINUX_OS_NAMES : WINDOWS_OS_NAMES;
|
|
235
|
+
for (const name of Object.keys(env)) if (osNames.has(name.toLowerCase())) {
|
|
236
|
+
const value = env[name]; if (typeof value !== "string" || /[\u0000-\u001f\u007f]/.test(value)) fail();
|
|
237
|
+
childEnv[name] = value;
|
|
238
|
+
}
|
|
239
|
+
// A development copy's connections follow the app (owner 2026-10-06): no customer mode, so its data stays where
|
|
240
|
+
// the development app keeps it. A customer package still enforces the boundary from its own release marker.
|
|
241
|
+
Object.assign(childEnv, { ELECTRON_RUN_AS_NODE: "1", TRUTHSPINE_PACKAGED_RUNTIME: "1",
|
|
242
|
+
...(developmentBuild ? {} : { TRUTHSPINE_CUSTOMER_MODE: "1" }),
|
|
243
|
+
TRUTHSPINE_HOME: profile, ...(root ? { TRUTHSPINE_PROJECT_ROOT: root, TRUTHSPINE_LOCK_PROJECT_ROOT: "1" } : { TRUTHSPINE_FIND_PROJECT: "1" }),
|
|
244
|
+
// (the folder the app started this connection in: a chat's attach may name its own folder; mcp-server.js)
|
|
245
|
+
...(root && env.TRUTHSPINE_PROJECT_FROM_CWD === "1" ? { TRUTHSPINE_FOLLOWED_FOLDER: "1" } : {}),
|
|
246
|
+
TRUTHSPINE_HOST_ID: hostId,
|
|
247
|
+
TRUTHSPINE_MCP_OUTPUT_FRAMING: "jsonl" });
|
|
248
|
+
// Codex retains its existing full catalog, including session_update. Host
|
|
249
|
+
// identity is a policy selector, not authentication or permission to broaden
|
|
250
|
+
// another host's advertised tool profile.
|
|
251
|
+
if (!["codex-cli", "cursor", "kiro", "antigravity", "jetbrains", "zed"].includes(hostId)) childEnv.TRUTHSPINE_MCP_TOOL_PROFILE = hostId === "claude-desktop"
|
|
252
|
+
? "claude-desktop"
|
|
253
|
+
: hostId === "lm-studio" ? "lm-studio" : ["opencode", "hermes-agent", "openclaw", "droid", "pi"].includes(hostId) ? "local-agent" : "copilot";
|
|
254
|
+
// Preserve an existing restrictive opt-out, never an ambient opt-in or
|
|
255
|
+
// telemetry identity. Dropping an opt-out could enable collection when the
|
|
256
|
+
// registered profile has consent. This grants no product access.
|
|
257
|
+
Object.assign(childEnv, restrictiveTelemetryEnv(env));
|
|
258
|
+
// In particular: no NODE_OPTIONS, NODE_PATH, ambient credentials, authority
|
|
259
|
+
// overrides, or mutable runtime-registration path enters the child.
|
|
260
|
+
return childEnv;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
function buildInstalledMcpLaunchPlan({ registration, registrationPath, projectRoot,
|
|
264
|
+
platform = process.platform, env = process.env, hostId = "claude-desktop" } = {}) {
|
|
265
|
+
if (!["win32", "darwin", "linux"].includes(platform) || !object(registration)
|
|
266
|
+
|| registration.schema !== "truthspine.installed-runtime.v1" || !HOST_IDS.has(hostId)) fail();
|
|
267
|
+
const paths = platform === "win32" ? path.win32 : path.posix;
|
|
268
|
+
// No project (null): an app that starts outside any folder; the connection finds its project (launcherProjectRoot).
|
|
269
|
+
const root = projectRoot === null ? null : absolute(projectRoot, paths), profile = absolute(registration.truthHome, paths);
|
|
270
|
+
const registrationFile = absolute(registrationPath, paths);
|
|
271
|
+
if (root && equal(root, paths.parse(root).root, platform)) fail();
|
|
272
|
+
if (env.TRUTHSPINE_HOME !== undefined && !equal(absolute(env.TRUTHSPINE_HOME, paths), profile, platform)) fail();
|
|
273
|
+
// Root comes from this generated connector, never cwd/last app selection.
|
|
274
|
+
if (platform === "darwin") {
|
|
275
|
+
const userData = paths.dirname(registrationFile);
|
|
276
|
+
const marker = "/Library/Containers/com.timeprooflabs.truthspine/Data/";
|
|
277
|
+
const index = userData.indexOf(marker);
|
|
278
|
+
if (index < 1 || !equal(profile, paths.join(userData, "truthspine"), platform)) fail();
|
|
279
|
+
const dataRoot = userData.slice(0, index + marker.length - 1);
|
|
280
|
+
const hash = crypto.createHash("sha256").update(userData).digest("hex").slice(0, 8);
|
|
281
|
+
// No project (null): the bridge finds it for this connection (local-app-mcp-bridge.js find).
|
|
282
|
+
return Object.freeze({ mode: "app-owned-socket", platform, hostId, projectRoot: root, truthHome: profile,
|
|
283
|
+
socketPath: paths.join(dataRoot, ".ts", `mcp-${hash}.sock`) });
|
|
284
|
+
}
|
|
285
|
+
if (platform === "linux") {
|
|
286
|
+
// Linux AppImage lane (P12). The AppImage file is the one stable path: the app inside it is mounted
|
|
287
|
+
// under /tmp at a new path on every launch, so no mount path is trusted. The AppImage's AppRun turns
|
|
288
|
+
// a leading "@app/" argument into a path inside its own mount.
|
|
289
|
+
const provenance = registration.runtimeProvenance;
|
|
290
|
+
const command = absolute(registration.command, paths);
|
|
291
|
+
if (!object(provenance) || provenance.packaged !== true || provenance.packagedPlatform !== "linux-appimage"
|
|
292
|
+
|| !/[.]AppImage$/.test(paths.basename(command))
|
|
293
|
+
|| !equal(absolute(provenance.appExecutable, paths), command, platform)) fail();
|
|
294
|
+
return Object.freeze({ mode: "installed-stdio", platform, hostId, packageRoot: LINUX_APP_ROOT, command,
|
|
295
|
+
args: Object.freeze([`${LINUX_APP_ROOT}/src/mcp-server.js`]), cwd: root ?? profile, projectRoot: root, truthHome: profile,
|
|
296
|
+
env: Object.freeze(installedChildEnv({ env, platform, profile, root, hostId,
|
|
297
|
+
developmentBuild: registration.developmentBuild === true })) });
|
|
298
|
+
}
|
|
299
|
+
const packageRoot = absolute(registration.packageRoot, paths);
|
|
300
|
+
const executable = absolute(registration.runtimeProvenance && registration.runtimeProvenance.appExecutable, paths);
|
|
301
|
+
const programFiles = windowsProgramFiles(env, paths);
|
|
302
|
+
const localAppData = absolute(env.LOCALAPPDATA || env.LocalAppData || (env.USERPROFILE && paths.join(env.USERPROFILE, "AppData", "Local")), paths);
|
|
303
|
+
const command = paths.join(localAppData, "Microsoft", "WindowsApps", "truthspine-runtime.exe");
|
|
304
|
+
const install = paths.dirname(executable), packageName = paths.basename(install);
|
|
305
|
+
// Current Store lane only. Other volumes/architectures need OS discovery
|
|
306
|
+
// qualification before widening this routing policy, not a Node fallback.
|
|
307
|
+
if (registration.runtimeProvenance.packaged !== true
|
|
308
|
+
|| !/^TimeProofLabsLLC\.TruthSpine_\d+\.\d+\.\d+\.\d+_x64__xzspk04648dda$/.test(packageName)
|
|
309
|
+
|| !equal(executable, paths.join(programFiles, "WindowsApps", packageName, "TruthSpine.exe"), platform)
|
|
310
|
+
|| !equal(packageRoot, paths.join(install, "resources", "app"), platform)
|
|
311
|
+
|| !equal(absolute(registration.command, paths), command, platform)) fail();
|
|
312
|
+
const childEnv = installedChildEnv({ env, platform, profile, root, hostId });
|
|
313
|
+
return Object.freeze({ mode: "installed-stdio", platform, hostId, packageRoot, command, args: Object.freeze([paths.join(packageRoot, "src", "mcp-server.js")]),
|
|
314
|
+
cwd: root ?? profile, projectRoot: root, truthHome: profile, env: Object.freeze(childEnv) });
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
function buildInstalledCliLaunchPlan(options = {}) {
|
|
318
|
+
const args = options.args;
|
|
319
|
+
const commands = new Set(["guard", "nudge", "ask-truthspine", "gap-ledger", "context", "sync", "truth-index",
|
|
320
|
+
"coverage", "review", "app", "license", "onboard", "native-agent-edit", "connector-callback"]);
|
|
321
|
+
if (!Array.isArray(args) || args.length < 1 || args.length > 128
|
|
322
|
+
|| !commands.has(args[0])
|
|
323
|
+
|| args.some(value => typeof value !== "string" || value.includes("\0") || value.length > 65536
|
|
324
|
+
|| /^--project-root(?:=|$)/.test(value))
|
|
325
|
+
|| args.reduce((total, value) => total + Buffer.byteLength(value), 0) > 262144) fail();
|
|
326
|
+
const plan = buildInstalledMcpLaunchPlan(options);
|
|
327
|
+
// The Mac CLI is an RPC in the app-owned bridge, never a standalone process; a command always names its project.
|
|
328
|
+
if (plan.mode !== "installed-stdio" || !plan.projectRoot) fail();
|
|
329
|
+
const childEnv = { ...plan.env };
|
|
330
|
+
delete childEnv.TRUTHSPINE_MCP_TOOL_PROFILE;
|
|
331
|
+
delete childEnv.TRUTHSPINE_MCP_OUTPUT_FRAMING;
|
|
332
|
+
return Object.freeze({ ...plan, mode: "installed-cli", env: Object.freeze(childEnv),
|
|
333
|
+
args: Object.freeze([plan.platform === "linux" ? `${LINUX_APP_ROOT}/src/customer-connector-cli.js`
|
|
334
|
+
: path.win32.join(plan.packageRoot, "src", "customer-connector-cli.js"), ...args, "--project-root", plan.projectRoot]) });
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
function validateInstalledLaunchPlan(plan) {
|
|
338
|
+
if (!plan || plan.platform !== process.platform) fail();
|
|
339
|
+
try {
|
|
340
|
+
if (plan.platform === "linux" && ["installed-stdio", "installed-cli"].includes(plan.mode)) {
|
|
341
|
+
// The AppImage must still exist, be a runnable file owned by this user (or root, for a system-wide
|
|
342
|
+
// copy) and not writable by everyone. Group-writable is allowed: Ubuntu's default umask gives it.
|
|
343
|
+
const entry = plan.mode === "installed-cli" ? "customer-connector-cli.js" : "mcp-server.js";
|
|
344
|
+
if (plan.packageRoot !== LINUX_APP_ROOT || plan.args[0] !== `${LINUX_APP_ROOT}/src/${entry}`) fail();
|
|
345
|
+
let image;
|
|
346
|
+
try { image = fs.statSync(plan.command); } catch (error) { if (error && error.code === "ENOENT") typedFail("app_not_installed"); fail(); }
|
|
347
|
+
const uid = typeof process.getuid === "function" ? process.getuid() : null;
|
|
348
|
+
if (!image.isFile() || (image.mode & 0o002) !== 0 || (image.mode & 0o100) === 0
|
|
349
|
+
|| (uid !== null && image.uid !== uid && image.uid !== 0) || !fs.statSync(plan.cwd).isDirectory()) fail();
|
|
350
|
+
} else if (["installed-stdio", "installed-cli"].includes(plan.mode)) {
|
|
351
|
+
const entry = plan.mode === "installed-cli" ? "customer-connector-cli.js" : "mcp-server.js";
|
|
352
|
+
const script = plan.args[0];
|
|
353
|
+
if (!equal(script, path.join(plan.packageRoot, "src", entry), process.platform)) fail();
|
|
354
|
+
let installed;
|
|
355
|
+
try { installed = fs.statSync(script); } catch (error) { if (error && error.code === "ENOENT") typedFail("app_not_installed"); fail(); }
|
|
356
|
+
if (!installed.isFile() || !equal(fs.realpathSync(script), script, process.platform)
|
|
357
|
+
|| !fs.statSync(plan.cwd).isDirectory()) fail();
|
|
358
|
+
// Do not stat the execution alias: activation may work while stat fails.
|
|
359
|
+
} else if (plan.mode === "app-owned-socket") {
|
|
360
|
+
let socket;
|
|
361
|
+
try { socket = fs.lstatSync(plan.socketPath); } catch (error) { if (error && error.code === "ENOENT") typedFail("app_not_running"); fail(); }
|
|
362
|
+
if (!socket.isSocket() || socket.isSymbolicLink()
|
|
363
|
+
|| (typeof process.getuid === "function" && socket.uid !== process.getuid())) fail();
|
|
364
|
+
} else fail();
|
|
365
|
+
return plan;
|
|
366
|
+
} catch (error) { if (typedCode(error)) throw error; fail(); }
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
function relayInstalledMcp(plan, { input = process.stdin, output = process.stdout,
|
|
370
|
+
spawnImpl = spawn, connectImpl = net.createConnection, shutdownMs = 1500 } = {}) {
|
|
371
|
+
if (!Number.isInteger(shutdownMs) || shutdownMs < 1 || shutdownMs > 5000) fail();
|
|
372
|
+
let child, channel, remoteInput, remoteOutput, timer, hardTimer, confirmationTimer;
|
|
373
|
+
let settled = false, reported = false, stopping = false, requestedCode = 0, failureCode = null;
|
|
374
|
+
const noteFailure = (error, code) => { if (!failureCode && error && ["ENOENT", "ECONNREFUSED", "EACCES"].indexOf(error.code) !== -1) failureCode = code; };
|
|
375
|
+
let resolveClosed;
|
|
376
|
+
const closed = new Promise(resolve => { resolveClosed = resolve; });
|
|
377
|
+
const reportUnconfirmed = () => {
|
|
378
|
+
if (!settled && !reported) {
|
|
379
|
+
reported = true; resolveClosed({ code: 1, pid: child ? child.pid : null, cleanupConfirmed: false });
|
|
380
|
+
}
|
|
381
|
+
};
|
|
382
|
+
const finish = code => {
|
|
383
|
+
if (settled) return;
|
|
384
|
+
settled = true; clearTimeout(timer); clearTimeout(hardTimer); clearTimeout(confirmationTimer);
|
|
385
|
+
input.unpipe(remoteInput); if (remoteOutput) remoteOutput.unpipe(output); input.pause();
|
|
386
|
+
input.removeListener("end", stop); input.removeListener("close", closedInput);
|
|
387
|
+
input.removeListener("error", failed); output.removeListener("error", failed); output.removeListener("close", failed);
|
|
388
|
+
if (!reported) { reported = true; resolveClosed({ code: requestedCode || code, pid: child ? child.pid : null, cleanupConfirmed: true }); }
|
|
389
|
+
};
|
|
390
|
+
function failed() { stop(1); }
|
|
391
|
+
function closedInput() { if (!input.readableEnded) stop(1); }
|
|
392
|
+
function stop(code = 0) {
|
|
393
|
+
if (settled) return;
|
|
394
|
+
requestedCode = requestedCode || code;
|
|
395
|
+
if (stopping) return;
|
|
396
|
+
stopping = true;
|
|
397
|
+
input.unpipe(remoteInput); input.pause();
|
|
398
|
+
if (code && remoteOutput) remoteOutput.unpipe(output);
|
|
399
|
+
if (plan.mode === "app-owned-socket") {
|
|
400
|
+
channel.destroy(); confirmationTimer = setTimeout(reportUnconfirmed, shutdownMs); return;
|
|
401
|
+
}
|
|
402
|
+
if (remoteInput && !remoteInput.destroyed) remoteInput.end();
|
|
403
|
+
timer = setTimeout(() => {
|
|
404
|
+
if (!settled) { try { child.kill(); } catch {} }
|
|
405
|
+
hardTimer = setTimeout(() => {
|
|
406
|
+
if (!settled) { try { child.kill("SIGKILL"); } catch {} }
|
|
407
|
+
confirmationTimer = setTimeout(() => {
|
|
408
|
+
if (!settled && !reported) {
|
|
409
|
+
// A kill request is not terminal evidence. Retain the child's
|
|
410
|
+
// close/error observers and handle; do not claim cleanup or retry.
|
|
411
|
+
reportUnconfirmed();
|
|
412
|
+
}
|
|
413
|
+
}, shutdownMs);
|
|
414
|
+
}, shutdownMs);
|
|
415
|
+
}, shutdownMs);
|
|
416
|
+
}
|
|
417
|
+
try {
|
|
418
|
+
if (plan.mode === "installed-stdio") {
|
|
419
|
+
child = spawnImpl(plan.command, plan.args, { cwd: plan.cwd, env: plan.env, shell: false, windowsHide: true,
|
|
420
|
+
stdio: ["pipe", "pipe", "pipe"] });
|
|
421
|
+
remoteInput = child.stdin; remoteOutput = child.stdout;
|
|
422
|
+
// Never forward raw child diagnostics that may contain credentials.
|
|
423
|
+
child.stderr.on("error", failed); child.stderr.resume();
|
|
424
|
+
child.on("error", error => { noteFailure(error, "app_not_installed"); if (Number.isInteger(child.pid)) failed(); else finish(1); });
|
|
425
|
+
child.on("close", code => finish(code === 0 ? 0 : 1));
|
|
426
|
+
remoteInput.on("error", failed); remoteOutput.on("error", failed);
|
|
427
|
+
remoteOutput.pipe(output, { end: false }); input.pipe(remoteInput);
|
|
428
|
+
} else if (plan.mode === "app-owned-socket") {
|
|
429
|
+
channel = connectImpl(plan.socketPath); remoteInput = channel; remoteOutput = channel;
|
|
430
|
+
channel.on("error", error => { noteFailure(error, "app_not_running"); failed(); });
|
|
431
|
+
channel.on("close", () => finish(stopping ? 0 : 1));
|
|
432
|
+
channel.once("connect", () => {
|
|
433
|
+
if (settled || stopping) return;
|
|
434
|
+
const body = Buffer.from(JSON.stringify({ jsonrpc: "2.0", method: "truthspine/bridge/identify",
|
|
435
|
+
params: { hostId: plan.hostId || "claude-desktop", projectRoot: plan.projectRoot || "", ...(plan.projectRoot ? {} : { find: true }) } }));
|
|
436
|
+
channel.write(Buffer.concat([Buffer.from(`Content-Length: ${body.length}\r\n\r\n`), body]));
|
|
437
|
+
channel.pipe(output, { end: false }); input.pipe(channel);
|
|
438
|
+
});
|
|
439
|
+
} else fail();
|
|
440
|
+
input.once("end", stop); input.on("close", closedInput); input.on("error", failed);
|
|
441
|
+
output.on("error", failed); output.on("close", failed);
|
|
442
|
+
if (input.readableEnded) stop();
|
|
443
|
+
} catch { if (child) stop(1); else { if (channel) channel.destroy(); finish(1); } }
|
|
444
|
+
return { closed, stop, pid: child ? child.pid : null, failure: () => failureCode };
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
// Owner's rules 2026-10-08/09: one TruthSpine entry per app, in the app's own user settings, working in whatever
|
|
448
|
+
// folder the person is in, and a chat never inherits the project the TruthSpine app shows. TRUTHSPINE_PROJECT_FROM_CWD=1:
|
|
449
|
+
// the project is the folder the app started this connection in (bounded: never the home folder or a disk root). An app
|
|
450
|
+
// that starts outside any folder (Kiro starts in the home folder) gets null: the connection then finds its project
|
|
451
|
+
// from the folders the app has open or the folder the chat names (mcp-server.js TRUTHSPINE_FIND_PROJECT).
|
|
452
|
+
// TRUTHSPINE_FIND_PROJECT=1: an app whose working folder is never a project (Claude Desktop, LM Studio, window apps)
|
|
453
|
+
// always finds it that way.
|
|
454
|
+
function launcherProjectRoot({ env = process.env, cwd, homeDir } = {}) {
|
|
455
|
+
if (env.TRUTHSPINE_FIND_PROJECT === "1") return null;
|
|
456
|
+
if (env.TRUTHSPINE_PROJECT_FROM_CWD !== "1") return env.TRUTHSPINE_PROJECT_ROOT;
|
|
457
|
+
try { return resolveBoundedHostWorkspace({ cwd: cwd ?? process.cwd(), homeDir: homeDir ?? require("node:os").homedir() }).projectRoot; }
|
|
458
|
+
catch { return null; }
|
|
459
|
+
}
|
|
460
|
+
function installedLauncherOptions() {
|
|
461
|
+
const registrationPath = absolute(process.env.TRUTHSPINE_RUNTIME_REGISTRATION_PATH, path);
|
|
462
|
+
return { registration: readRegistration(registrationPath), registrationPath,
|
|
463
|
+
projectRoot: launcherProjectRoot(),
|
|
464
|
+
hostId: process.env.TRUTHSPINE_LAUNCHER_HOST_ID || "claude-desktop" };
|
|
465
|
+
}
|
|
466
|
+
function startInstalledMcpLauncher() {
|
|
467
|
+
const plan = buildInstalledMcpLaunchPlan(installedLauncherOptions());
|
|
468
|
+
validateInstalledLaunchPlan(plan);
|
|
469
|
+
return relayInstalledMcp(plan);
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
// The relay (owner 2026-10-16: "fix the claude extension gap too"). A Store update ends every process that runs from the
|
|
473
|
+
// TruthSpine package. This launcher runs from outside it when an app starts it with its own Node (Claude Desktop's
|
|
474
|
+
// extension), so it survives, but the TruthSpine it started does not, and the connection ended with it. Where the
|
|
475
|
+
// TruthSpine app has checked the relay on this computer, such a launcher hands the connection to the relay, which starts
|
|
476
|
+
// TruthSpine (through the shared launcher copy, under the Store runtime) and starts the new one after an update.
|
|
477
|
+
// Null when that does not apply: not Windows, already a package process, or no checked relay or shared launcher here.
|
|
478
|
+
function relayDelegationPlan({ platform = process.platform, execPath = process.execPath, env = process.env,
|
|
479
|
+
exists = file => fs.existsSync(file), readText = file => fs.readFileSync(file, "utf8") } = {}) {
|
|
480
|
+
if (platform !== "win32" || /[\\/]WindowsApps[\\/]/i.test(String(execPath || ""))) return null;
|
|
481
|
+
const registration = env.TRUTHSPINE_RUNTIME_REGISTRATION_PATH;
|
|
482
|
+
if (typeof registration !== "string" || !path.win32.isAbsolute(registration) || /[\x00-\x1f\x7f]/.test(registration)) return null;
|
|
483
|
+
const runtimeFolder = path.win32.join(path.win32.dirname(registration), "connector-runtime");
|
|
484
|
+
let relay = null;
|
|
485
|
+
try {
|
|
486
|
+
const ready = JSON.parse(readText(path.win32.join(runtimeFolder, "relay", "relay-ready.json")));
|
|
487
|
+
relay = ready && ready.ok === true && typeof ready.path === "string" && /[\\/]TruthSpine\.Relay\.exe$/i.test(ready.path) ? ready.path : null;
|
|
488
|
+
} catch { relay = null; }
|
|
489
|
+
const launcher = path.win32.join(runtimeFolder, "installed-mcp-launcher.cjs");
|
|
490
|
+
const localAppData = env.LOCALAPPDATA;
|
|
491
|
+
if (!relay || !exists(relay) || !exists(launcher) || typeof localAppData !== "string" || !path.win32.isAbsolute(localAppData)) return null;
|
|
492
|
+
const runtime = path.win32.join(localAppData, "Microsoft", "WindowsApps", "truthspine-runtime.exe");
|
|
493
|
+
return { mode: "installed-stdio", command: relay, args: ["--", runtime, launcher], cwd: process.cwd(),
|
|
494
|
+
env: { ...env, ELECTRON_RUN_AS_NODE: "1", TRUTHSPINE_PACKAGED_RUNTIME: "1" } };
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
// One process per chat (design approved 2026-10-21; owner: "Keep one runtime, measured budget"). When this launcher
|
|
498
|
+
// already runs in the very package its validated plan would start (the same AppImage on Linux, the same Store package
|
|
499
|
+
// on Windows), it becomes the chat server itself: the plan's environment exactly, plus the few keys the runtime needs,
|
|
500
|
+
// then the package's own mcp-server.js in this process. A second Electron-as-node is no longer started for each chat.
|
|
501
|
+
// It still starts one when this launcher runs on another runtime (an app's own Node, the relay), when it was started
|
|
502
|
+
// with NODE_OPTIONS, NODE_PATH or Node flags (they would reach the server, which the clean environment keeps out), or
|
|
503
|
+
// for the Mac's app-owned socket, which starts no server.
|
|
504
|
+
const IN_PLACE_RUNTIME_KEYS = Object.freeze({
|
|
505
|
+
linux: Object.freeze(["APPIMAGE", "APPDIR", "ARGV0", "OWD", "TRUTHSPINE_PACKAGED_PLATFORM"]),
|
|
506
|
+
win32: Object.freeze([])
|
|
507
|
+
});
|
|
508
|
+
function inPlaceHandover(plan, { platform = process.platform, execPath = process.execPath, env = process.env,
|
|
509
|
+
execArgv = process.execArgv, exists = file => { try { return fs.statSync(file).isFile(); } catch { return false; } } } = {}) {
|
|
510
|
+
if (!plan || plan.mode !== "installed-stdio" || plan.platform !== platform || !IN_PLACE_RUNTIME_KEYS[platform]) return null;
|
|
511
|
+
if (env.ELECTRON_RUN_AS_NODE !== "1" || (env.NODE_OPTIONS ?? "") !== "" || (env.NODE_PATH ?? "") !== "" || execArgv.length) return null;
|
|
512
|
+
const paths = platform === "win32" ? path.win32 : path.posix;
|
|
513
|
+
let serverPath;
|
|
514
|
+
if (platform === "linux") {
|
|
515
|
+
if (typeof env.APPIMAGE !== "string" || !paths.isAbsolute(env.APPIMAGE) || !equal(paths.resolve(env.APPIMAGE), plan.command, platform)) return null;
|
|
516
|
+
if (plan.args[0] !== `${LINUX_APP_ROOT}/src/mcp-server.js`) return null;
|
|
517
|
+
serverPath = paths.join(paths.dirname(execPath), "resources", "app", "src", "mcp-server.js");
|
|
518
|
+
} else {
|
|
519
|
+
if (!equal(paths.join(paths.dirname(execPath), "resources", "app"), plan.packageRoot, platform)) return null;
|
|
520
|
+
serverPath = paths.join(plan.packageRoot, "src", "mcp-server.js");
|
|
521
|
+
if (!equal(plan.args[0], serverPath, platform)) return null;
|
|
522
|
+
}
|
|
523
|
+
if (!exists(serverPath)) return null;
|
|
524
|
+
const next = { ...plan.env };
|
|
525
|
+
for (const key of IN_PLACE_RUNTIME_KEYS[platform]) if (typeof env[key] === "string") next[key] = env[key];
|
|
526
|
+
return Object.freeze({ serverPath, cwd: plan.cwd, env: Object.freeze(next) });
|
|
527
|
+
}
|
|
528
|
+
// The handover itself: nothing of this launcher's own start environment is left, and the server runs as its own entry.
|
|
529
|
+
async function handOverInPlace(handover, { importer = file => import(require("node:url").pathToFileURL(file).href) } = {}) {
|
|
530
|
+
for (const key of Object.keys(process.env)) if (!Object.prototype.hasOwnProperty.call(handover.env, key)) delete process.env[key];
|
|
531
|
+
Object.assign(process.env, handover.env);
|
|
532
|
+
process.chdir(handover.cwd);
|
|
533
|
+
process.argv[1] = handover.serverPath;
|
|
534
|
+
await importer(handover.serverPath);
|
|
535
|
+
return { inPlace: true };
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
async function startInstalledMcpLauncherWithRecovery({ signal, inPlace = handOverInPlace } = {}) {
|
|
539
|
+
if (signal?.aborted) fail();
|
|
540
|
+
const delegated = relayDelegationPlan();
|
|
541
|
+
if (delegated) return relayInstalledMcp(delegated);
|
|
542
|
+
const options = installedLauncherOptions();
|
|
543
|
+
let plan = buildInstalledMcpLaunchPlan(options);
|
|
544
|
+
try { validateInstalledLaunchPlan(plan); }
|
|
545
|
+
catch (error) {
|
|
546
|
+
if (plan.platform !== 'win32') throw error;
|
|
547
|
+
plan = (await prepareRecoveredMcpPlan(options, { signal })).plan;
|
|
548
|
+
}
|
|
549
|
+
if (signal?.aborted) fail();
|
|
550
|
+
// (only a plan that passed validation is ever handed over)
|
|
551
|
+
const handover = inPlaceHandover(plan);
|
|
552
|
+
if (handover) return inPlace(handover);
|
|
553
|
+
return relayInstalledMcp(plan);
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
// Store package discovery stays in this single-file thin transport so generated
|
|
557
|
+
// VS Code and MCPB launchers cannot omit a recovery dependency. Routing only.
|
|
558
|
+
const NAME = 'TimeProofLabsLLC.TruthSpine';
|
|
559
|
+
const FAMILY = NAME + '_xzspk04648dda';
|
|
560
|
+
const PUBLISHER = 'CN=C757D670-5A7C-4F9F-A475-D820CD5AC334';
|
|
561
|
+
const recoveryFail = () => { const error = new Error('store_package_recovery_unavailable'); error.code = LAUNCHER_CODE_PREFIX + 'app_not_installed'; throw error; };
|
|
562
|
+
function storeVersion(value) {
|
|
563
|
+
if (typeof value !== 'string' || !/^(0|[1-9]\d{0,4})(\.(0|[1-9]\d{0,4})){3}$/.test(value)) recoveryFail();
|
|
564
|
+
const parts = value.split('.').map(Number);
|
|
565
|
+
if (parts.some(n => n > 65535)) recoveryFail();
|
|
566
|
+
return parts;
|
|
567
|
+
}
|
|
568
|
+
function storeAbsolute(value) {
|
|
569
|
+
if (typeof value !== 'string' || !/^[A-Za-z]:\\/.test(value) || /[\x00-\x1f\x7f]/.test(value)
|
|
570
|
+
|| value !== value.trim() || value.includes('/') || value !== path.win32.normalize(value)) recoveryFail();
|
|
571
|
+
return value;
|
|
572
|
+
}
|
|
573
|
+
function qualifyCurrentStorePackage({ packages, programFiles, minimumVersion }) {
|
|
574
|
+
if (!Array.isArray(packages) || packages.length !== 1) recoveryFail();
|
|
575
|
+
const row = packages[0], floor = storeVersion(minimumVersion);
|
|
576
|
+
if (!row || typeof row !== 'object' || Array.isArray(row)) recoveryFail();
|
|
577
|
+
const current = storeVersion(row.version);
|
|
578
|
+
const delta = current.map((n, i) => n - floor[i]).find(n => n !== 0) || 0;
|
|
579
|
+
if (delta < 0 || row.name !== NAME || row.family !== FAMILY || row.publisher !== PUBLISHER
|
|
580
|
+
|| row.architecture !== 'X64' || row.signatureKind !== 'Store' || row.status !== 'Ok'
|
|
581
|
+
|| row.developmentMode !== false || row.partiallyStaged !== false) recoveryFail();
|
|
582
|
+
const fullName = `${NAME}_${row.version}_x64__xzspk04648dda`;
|
|
583
|
+
const expected = path.win32.join(storeAbsolute(programFiles), 'WindowsApps', fullName);
|
|
584
|
+
if (row.fullName !== fullName || storeAbsolute(row.installLocation).toLowerCase() !== expected.toLowerCase()) recoveryFail();
|
|
585
|
+
return Object.freeze({ packageFullName: fullName, version: row.version,
|
|
586
|
+
executable: path.win32.join(expected, 'TruthSpine.exe'), packageRoot: path.win32.join(expected, 'resources', 'app') });
|
|
587
|
+
}
|
|
588
|
+
// Fixed, read-only command: no registration strings or user arguments enter
|
|
589
|
+
// PowerShell source. Current user only; never -AllUsers or elevation.
|
|
590
|
+
const DISCOVERY = "$ErrorActionPreference='Stop'; [Console]::OutputEncoding=[Text.UTF8Encoding]::new($false); $items=@(Get-AppxPackage -Name TimeProofLabsLLC.TruthSpine | ForEach-Object { @{name=$_.Name;family=$_.PackageFamilyName;publisher=$_.Publisher;version=[string]$_.Version;fullName=$_.PackageFullName;architecture=[string]$_.Architecture;signatureKind=[string]$_.SignatureKind;status=[string]$_.Status;developmentMode=[bool]$_.IsDevelopmentMode;partiallyStaged=[bool]$_.IsPartiallyStaged;installLocation=$_.InstallLocation} }); ConvertTo-Json -InputObject $items -Depth 3 -Compress";
|
|
591
|
+
async function discoverCurrentStorePackage({ minimumVersion, signal } = {}) {
|
|
592
|
+
storeVersion(minimumVersion);
|
|
593
|
+
if (process.platform !== 'win32' || signal?.aborted) recoveryFail();
|
|
594
|
+
const systemRoot = storeAbsolute(process.env.SystemRoot || process.env.SYSTEMROOT);
|
|
595
|
+
const programFiles = storeAbsolute(process.env.ProgramFiles || process.env.PROGRAMFILES || process.env.ProgramW6432
|
|
596
|
+
|| path.win32.join(path.win32.parse(systemRoot).root, 'Program Files'));
|
|
597
|
+
const executable = path.win32.join(systemRoot, 'System32', 'WindowsPowerShell', 'v1.0', 'powershell.exe');
|
|
598
|
+
if (fs.realpathSync(executable).toLowerCase() !== executable.toLowerCase()) recoveryFail();
|
|
599
|
+
const env = {};
|
|
600
|
+
for (const key of Object.keys(process.env)) {
|
|
601
|
+
if (/^(systemroot|windir|temp|tmp|userprofile|localappdata|appdata|programfiles|programfiles\(x86\)|programdata|psmodulepath)$/i.test(key)
|
|
602
|
+
&& !/^psmodulepath$/i.test(key)) env[key] = process.env[key];
|
|
603
|
+
}
|
|
604
|
+
// Prevent ambient modules/profile/startup injection. Only built-in Windows
|
|
605
|
+
// PowerShell modules are discoverable; module output is bounded and parsed.
|
|
606
|
+
env.PSModulePath = path.win32.join(systemRoot, 'System32', 'WindowsPowerShell', 'v1.0', 'Modules');
|
|
607
|
+
const wire = await new Promise((resolve, reject) => {
|
|
608
|
+
let child, output = '', bytes = 0, failed = false, settled = false, deadline, cleanup;
|
|
609
|
+
const finish = (error, value) => {
|
|
610
|
+
if (settled) return; settled = true;
|
|
611
|
+
clearTimeout(deadline); clearTimeout(cleanup); signal?.removeEventListener('abort', cancel);
|
|
612
|
+
error ? reject(new Error('store_package_recovery_unavailable')) : resolve(value);
|
|
613
|
+
};
|
|
614
|
+
const cancel = () => {
|
|
615
|
+
if (settled || failed) return; failed = true;
|
|
616
|
+
try { child?.kill(); } catch {}
|
|
617
|
+
// Never report successful cleanup or retry when closure is unknown.
|
|
618
|
+
cleanup = setTimeout(() => finish(true), 2000);
|
|
619
|
+
};
|
|
620
|
+
try {
|
|
621
|
+
child = spawn(executable, ['-NoLogo', '-NoProfile', '-NonInteractive', '-Command', DISCOVERY],
|
|
622
|
+
{ cwd: path.win32.join(systemRoot, 'System32'), env, shell: false, windowsHide: true, stdio: ['ignore', 'pipe', 'pipe'] });
|
|
623
|
+
deadline = setTimeout(cancel, 10000);
|
|
624
|
+
signal?.addEventListener('abort', cancel, { once: true });
|
|
625
|
+
if (signal?.aborted) cancel();
|
|
626
|
+
child.stdout.setEncoding('utf8');
|
|
627
|
+
child.stdout.on('data', chunk => { bytes += Buffer.byteLength(chunk); if (bytes > 16384) cancel(); else if (!failed) output += chunk; });
|
|
628
|
+
child.stderr.on('data', chunk => { bytes += chunk.length; if (bytes > 16384) cancel(); });
|
|
629
|
+
child.stdout.on('error', cancel); child.stderr.on('error', cancel);
|
|
630
|
+
child.on('error', cancel);
|
|
631
|
+
child.on('close', (code, endedBySignal) => finish(failed || code !== 0 || !!endedBySignal, output));
|
|
632
|
+
} catch { cancel(); }
|
|
633
|
+
});
|
|
634
|
+
let packages;
|
|
635
|
+
try { packages = JSON.parse(wire.replace(/^\uFEFF/, '')); } catch { recoveryFail(); }
|
|
636
|
+
return qualifyCurrentStorePackage({ packages, programFiles, minimumVersion });
|
|
637
|
+
}
|
|
638
|
+
async function prepareRecoveredMcpPlan(options, { signal } = {}) {
|
|
639
|
+
// Validate and snapshot all caller routing before any asynchronous work.
|
|
640
|
+
return prepareRecoveredInstalledPlan(buildInstalledMcpLaunchPlan(options), signal);
|
|
641
|
+
}
|
|
642
|
+
async function prepareRecoveredCliPlan(options, { signal } = {}) {
|
|
643
|
+
// Snapshot command arguments before discovery, just like workspace/profile.
|
|
644
|
+
return prepareRecoveredInstalledPlan(buildInstalledCliLaunchPlan(options), signal);
|
|
645
|
+
}
|
|
646
|
+
async function prepareRecoveredInstalledPlan(initial, signal) {
|
|
647
|
+
if (initial.platform !== 'win32' || !['installed-stdio', 'installed-cli'].includes(initial.mode)) recoveryFail();
|
|
648
|
+
// Pin directory identity before awaiting OS discovery. Preserving lexical
|
|
649
|
+
// strings alone would allow a replaced junction/profile to select new data.
|
|
650
|
+
// This is a routing-race check, not ongoing folder authorization or a grant.
|
|
651
|
+
const directories = [initial.projectRoot, initial.truthHome].filter(Boolean);
|
|
652
|
+
const directoryIdentity = directory => {
|
|
653
|
+
try {
|
|
654
|
+
const real = fs.realpathSync(directory);
|
|
655
|
+
const stat = fs.statSync(real, { bigint: true });
|
|
656
|
+
if (!stat.isDirectory() || typeof stat.dev !== 'bigint' || typeof stat.ino !== 'bigint'
|
|
657
|
+
|| fs.realpathSync(directory) !== real) recoveryFail();
|
|
658
|
+
return { real, dev: String(stat.dev), ino: String(stat.ino) };
|
|
659
|
+
} catch { recoveryFail(); }
|
|
660
|
+
};
|
|
661
|
+
const originalDirectories = JSON.stringify(directories.map(directoryIdentity));
|
|
662
|
+
const assertDirectories = () => {
|
|
663
|
+
if (JSON.stringify(directories.map(directoryIdentity)) !== originalDirectories) recoveryFail();
|
|
664
|
+
};
|
|
665
|
+
// packageRoot ends resources/app; use its enclosing installation instead.
|
|
666
|
+
const packageName = path.win32.basename(path.win32.dirname(path.win32.dirname(initial.packageRoot)));
|
|
667
|
+
const registered = /^TimeProofLabsLLC\.TruthSpine_(\d+\.\d+\.\d+\.\d+)_x64__xzspk04648dda$/.exec(packageName);
|
|
668
|
+
if (!registered || signal?.aborted) recoveryFail();
|
|
669
|
+
const selected = await discoverCurrentStorePackage({ minimumVersion: registered[1], signal });
|
|
670
|
+
if (signal?.aborted) recoveryFail();
|
|
671
|
+
assertDirectories();
|
|
672
|
+
const entry = initial.mode === 'installed-cli' ? 'customer-connector-cli.js' : 'mcp-server.js';
|
|
673
|
+
const recovered = Object.freeze({ ...initial, packageRoot: selected.packageRoot,
|
|
674
|
+
args: Object.freeze([path.win32.join(selected.packageRoot, 'src', entry), ...initial.args.slice(1)]) });
|
|
675
|
+
validateInstalledLaunchPlan(recovered);
|
|
676
|
+
// Discovery is routing, not a lasting grant. Refuse a package switch while
|
|
677
|
+
// preparing the connection. Native core identity still gates actual work.
|
|
678
|
+
const after = await discoverCurrentStorePackage({ minimumVersion: registered[1], signal });
|
|
679
|
+
if (signal?.aborted || JSON.stringify(after) !== JSON.stringify(selected)) recoveryFail();
|
|
680
|
+
assertDirectories();
|
|
681
|
+
validateInstalledLaunchPlan(recovered);
|
|
682
|
+
return Object.freeze({ plan: recovered, previousVersion: registered[1], package: selected,
|
|
683
|
+
recovered: selected.version !== registered[1] });
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
module.exports = { readRegistration, resolveBoundedHostWorkspace, neverAProjectFolder, scratchFolder, launcherProjectRoot, buildInstalledMcpLaunchPlan, buildInstalledCliLaunchPlan,
|
|
687
|
+
validateInstalledLaunchPlan, restrictiveTelemetryEnv, relayInstalledMcp, relayDelegationPlan, startInstalledMcpLauncher,
|
|
688
|
+
startInstalledMcpLauncherWithRecovery, qualifyCurrentStorePackage, discoverCurrentStorePackage, prepareRecoveredMcpPlan, prepareRecoveredCliPlan,
|
|
689
|
+
LAUNCHER_RESULTS, LAUNCHER_STORE_LINKS, describeLauncherFailure, inPlaceHandover, handOverInPlace, IN_PLACE_RUNTIME_KEYS };
|
|
690
|
+
if (require.main === module) {
|
|
691
|
+
const controller = new AbortController();
|
|
692
|
+
let connection;
|
|
693
|
+
const stop = () => { controller.abort(); connection?.stop(1); };
|
|
694
|
+
process.once("SIGINT", stop); process.once("SIGTERM", stop);
|
|
695
|
+
(async () => {
|
|
696
|
+
connection = await startInstalledMcpLauncherWithRecovery({ signal: controller.signal, inPlace: handover => {
|
|
697
|
+
// (from here this process is the chat server, which handles its own stop: mcp-server.js)
|
|
698
|
+
process.removeListener("SIGINT", stop); process.removeListener("SIGTERM", stop);
|
|
699
|
+
return handOverInPlace(handover);
|
|
700
|
+
} });
|
|
701
|
+
if (connection.inPlace) return;
|
|
702
|
+
connection.closed.then(result => {
|
|
703
|
+
process.removeListener("SIGINT", stop); process.removeListener("SIGTERM", stop);
|
|
704
|
+
if (result.code !== 0) {
|
|
705
|
+
const code = typeof connection.failure === "function" ? connection.failure() : null;
|
|
706
|
+
process.stderr.write(describeLauncherFailure(code ? { code: LAUNCHER_CODE_PREFIX + code } : null).message + "\n");
|
|
707
|
+
}
|
|
708
|
+
process.exitCode = result.code;
|
|
709
|
+
});
|
|
710
|
+
})().catch(error => {
|
|
711
|
+
process.removeListener("SIGINT", stop); process.removeListener("SIGTERM", stop);
|
|
712
|
+
// Only the catalogue sentence is printed; the caught error's own text never reaches stderr.
|
|
713
|
+
process.stderr.write(describeLauncherFailure(error).message + "\n"); process.exitCode = 1;
|
|
714
|
+
});
|
|
715
|
+
}
|
package/lib/package.json
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,60 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "truthspine",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.2.1",
|
|
4
|
+
"description": "Stop re-explaining your project to every new AI chat. MCP connector for TruthSpine: gives AI agents a checked, local record of your project (decisions, work done, failures, next steps). Works on your computer. No cloud account. Needs the TruthSpine app.",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"author": {
|
|
7
|
+
"name": "TimeProofLabs",
|
|
8
|
+
"email": "support@truthspine.app",
|
|
9
|
+
"url": "https://truthspine.app/"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://truthspine.app/",
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "git+https://github.com/TimeProofLabs/truthspine-app.git"
|
|
15
|
+
},
|
|
16
|
+
"bugs": {
|
|
17
|
+
"url": "https://truthspine.app/support"
|
|
18
|
+
},
|
|
19
|
+
"keywords": [
|
|
20
|
+
"truthspine",
|
|
21
|
+
"mcp",
|
|
22
|
+
"model-context-protocol",
|
|
23
|
+
"model context protocol",
|
|
24
|
+
"project memory",
|
|
25
|
+
"ai memory",
|
|
26
|
+
"agent memory",
|
|
27
|
+
"persistent memory",
|
|
28
|
+
"persistent context",
|
|
29
|
+
"cross-session context",
|
|
30
|
+
"context management",
|
|
31
|
+
"project context",
|
|
32
|
+
"project truth",
|
|
33
|
+
"decision log",
|
|
34
|
+
"decisions",
|
|
35
|
+
"ai agents",
|
|
36
|
+
"coding agents",
|
|
37
|
+
"claude code",
|
|
38
|
+
"claude desktop",
|
|
39
|
+
"cursor",
|
|
40
|
+
"windsurf",
|
|
41
|
+
"cline",
|
|
42
|
+
"codex",
|
|
43
|
+
"copilot",
|
|
44
|
+
"local-first"
|
|
45
|
+
],
|
|
46
|
+
"mcpName": "app.truthspine/truthspine",
|
|
47
|
+
"type": "module",
|
|
48
|
+
"bin": {
|
|
49
|
+
"truthspine-mcp": "bin/truthspine-mcp.mjs"
|
|
50
|
+
},
|
|
51
|
+
"files": [
|
|
52
|
+
"bin/",
|
|
53
|
+
"lib/",
|
|
54
|
+
"README.md",
|
|
55
|
+
"LICENSE"
|
|
56
|
+
],
|
|
57
|
+
"engines": {
|
|
58
|
+
"node": ">=18"
|
|
59
|
+
}
|
|
60
|
+
}
|