@synlexa/studio 0.0.0-stage → 0.4.3

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 (46) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +72 -0
  3. package/README.md +70 -2
  4. package/assets/icon-256.png +0 -0
  5. package/assets/icon.icns +0 -0
  6. package/assets/icon.ico +0 -0
  7. package/assets/icon.png +0 -0
  8. package/bin/synlexa-studio.mjs +244 -0
  9. package/package.json +38 -4
  10. package/scripts/desktop-shortcut.mjs +413 -0
  11. package/scripts/postinstall.mjs +184 -0
  12. package/wasm/synlexa_bio_core.wasm +0 -0
  13. package/web-dist/assets/MolStarViewport-BYVdqMR8.css +1 -0
  14. package/web-dist/assets/MolStarViewport-C2s337aX.js +8197 -0
  15. package/web-dist/assets/bioCore.worker-BGMOX1WA.js +1 -0
  16. package/web-dist/assets/index-DR8pRGGj.css +1 -0
  17. package/web-dist/assets/index-U3MvggqW.js +845 -0
  18. package/web-dist/assets/node.browser-Bv5igiSk.js +1 -0
  19. package/web-dist/assets/node.browser-h9BcAsHn.js +1 -0
  20. package/web-dist/assets/rdkit.worker-BvevbBxc.js +19 -0
  21. package/web-dist/favicon_io/android-chrome-192x192.png +0 -0
  22. package/web-dist/favicon_io/android-chrome-512x512.png +0 -0
  23. package/web-dist/favicon_io/apple-touch-icon.png +0 -0
  24. package/web-dist/favicon_io/favicon-16x16.png +0 -0
  25. package/web-dist/favicon_io/favicon-32x32.png +0 -0
  26. package/web-dist/favicon_io/favicon.ico +0 -0
  27. package/web-dist/favicon_io/site.webmanifest +1 -0
  28. package/web-dist/fixtures/1A3N.cif +8411 -0
  29. package/web-dist/fixtures/1LZ1.cif +2950 -0
  30. package/web-dist/fixtures/1UBQ.cif +2237 -0
  31. package/web-dist/fixtures/3HS4.cif +7817 -0
  32. package/web-dist/fixtures/3HS4.pdb +5385 -0
  33. package/web-dist/fixtures/AF-P00918-F1-model_v6.cif +3372 -0
  34. package/web-dist/fixtures/AF-P00918-F1-model_v6.pdb +2141 -0
  35. package/web-dist/fixtures/AF-P00918-F1-predicted_aligned_error_v6.json +1 -0
  36. package/web-dist/fixtures/AF-P0CG48-F1-model_v6.cif +8128 -0
  37. package/web-dist/fixtures/AF-P61626-F1-model_v6.cif +2075 -0
  38. package/web-dist/fixtures/AF-P68871-F1-model_v6.cif +2029 -0
  39. package/web-dist/fixtures/fixtures-manifest.json +198 -0
  40. package/web-dist/fixtures/pubchem-panel.json +84 -0
  41. package/web-dist/index.html +19 -0
  42. package/web-dist/synlexa-logo.png +0 -0
  43. package/web-dist/synlexa-s-icon.svg +12 -0
  44. package/web-dist/synlexa-wordmark.png +0 -0
  45. package/web-dist/wasm/rdkit/RDKit_minimal.wasm +0 -0
  46. package/web-dist/wasm/synlexa_bio_core.wasm +0 -0
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,
10
+ and 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 notice 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 misconduct
156
+ and gross negligence) or agreed to in writing, shall any Contributor
157
+ be 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 2026 ATIL YALI / Synlexa
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/NOTICE ADDED
@@ -0,0 +1,72 @@
1
+ Synlexa Studio
2
+ Copyright 2026 ATIL YALI / Synlexa
3
+
4
+ This product includes software developed by Synlexa (https://www.synlexa.com).
5
+ Original Synlexa source code in this repository is licensed under the Apache
6
+ License, Version 2.0 (see LICENSE).
7
+
8
+ ===========================================================================
9
+ TRADEMARKS & BRAND ASSETS (Apache License 2.0 Section 6)
10
+ ===========================================================================
11
+ "Synlexa", "Synlexa Studio", "Synlexa Core", and the official logo, icon,
12
+ and wordmark files under apps/web/public/ and apps/desktop/src-tauri/icons/
13
+ remain trademarks of Synlexa. See TRADEMARKS.md for usage terms.
14
+
15
+ ===========================================================================
16
+ THIRD-PARTY SOFTWARE ATTRIBUTIONS
17
+ ===========================================================================
18
+
19
+ 1. Mol* (molstar)
20
+ License: MIT License
21
+ Copyright (c) Mol* contributors, https://molstar.org
22
+
23
+ 2. RDKit / @rdkit/rdkit (MinimalLib WebAssembly)
24
+ License: BSD-3-Clause License
25
+ Copyright (c) 2006-2026, Greg Landrum and other RDKit contributors
26
+ Redistribution and use in source and binary forms, with or without
27
+ modification, are permitted under the 3-Clause BSD License
28
+ (https://github.com/rdkit/rdkit/blob/master/license.txt).
29
+
30
+ 3. @anthropic-ai/sdk & TypeScript
31
+ License: Apache License, Version 2.0
32
+
33
+ 4. React, React DOM, Vite, Vitest, Tailwind CSS
34
+ License: MIT License
35
+
36
+ 5. Lucide React
37
+ License: ISC License
38
+
39
+ 6. lightningcss (build-time CSS bundler dependency via @tailwindcss/vite)
40
+ License: Mozilla Public License 2.0 (MPL-2.0)
41
+
42
+ 7. Tauri v2 & tauri-plugin-deep-link (apps/desktop/src-tauri scaffold)
43
+ License: Apache-2.0 OR MIT
44
+
45
+ 8. Optional external Python compute adapters (services/compute-worker)
46
+ Users who opt in to installing optional external scientific engines in
47
+ their own compute environments remain responsible for compliance with
48
+ those packages' upstream licenses:
49
+ - AutoDock Vina, PySCF, Nextflow: Apache-2.0
50
+ - FastAPI, Uvicorn, Pydantic, Boltz-2, Chemprop, Snakemake: MIT
51
+ - Biopython, RDKit: BSD-3-Clause / Biopython License
52
+ - Meeko: LGPL-2.1
53
+ - OpenMM: MIT / LGPL components
54
+ - GROMACS: LGPL-2.1+
55
+ - xTB: LGPL-3.0
56
+ - Open Babel (strictly user-installed external CLI plugin): GPL-2.0
57
+
58
+ ===========================================================================
59
+ SCIENTIFIC TEST & DEMO FIXTURES (SEPARATE DATA LICENSES)
60
+ ===========================================================================
61
+ The reference scientific datasets under tests/fixtures/ and
62
+ apps/web/public/fixtures/ (listed in fixtures-manifest.json) are NOT original
63
+ Synlexa software and remain governed by their upstream data licenses:
64
+
65
+ - RCSB Protein Data Bank structures (3HS4.cif, 3HS4.pdb, 1UBQ.cif, 1A3N.cif,
66
+ 1LZ1.cif): CC0-1.0 Universal Public Domain Dedication
67
+ - NCBI PubChem PUG REST compound snapshot (pubchem-panel.json):
68
+ CC0-1.0 / NCBI Public Domain Policy
69
+ - AlphaFold Protein Structure Database v6 models & PAE matrix
70
+ (AF-P00918-F1-*, AF-P0CG48-F1-*, AF-P68871-F1-*, AF-P61626-F1-*):
71
+ Creative Commons Attribution 4.0 International (CC-BY-4.0),
72
+ EMBL-EBI / Google DeepMind (Jumper et al., Varadi et al.)
package/README.md CHANGED
@@ -1,3 +1,71 @@
1
- # Temporary Holding Version
1
+ # Synlexa Studio (`@synlexa/studio`)
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ > **Research-Use-Only (RUO):** Synlexa Studio is for computational research and software evaluation only. It is not intended for diagnostic, therapeutic, clinical-decision, or medical-device use.
4
+
5
+ **This single package works on all computers** — **macOS (Apple Silicon M1–M4 & Intel)**, **Windows (x64 & ARM64)**, and **Linux**. You do **not** need to pick an architecture-specific package.
6
+
7
+ ---
8
+
9
+ ## Easiest Ways to Install (For Non-Technical Users)
10
+
11
+ ### macOS (Apple Silicon M1–M4 & Intel)
12
+
13
+ - **Drag-and-Drop Installer (No Terminal Needed):**
14
+ Download [`Synlexa-Studio-v0.4.3-universal-apple-darwin.dmg`](https://github.com/Synlexa/synlexa-studio/releases/download/v0.4.3/Synlexa-Studio-v0.4.3-universal-apple-darwin.dmg), double-click it, and drag **Synlexa Studio** into **Applications**.
15
+ - **Or One-Line Terminal Install (Adds Desktop + Applications Icon Automatically):**
16
+ ```sh
17
+ curl -fsSL https://www.synlexa.com/install.sh | sh
18
+ ```
19
+ - **Or Homebrew:**
20
+ ```sh
21
+ brew install --cask Synlexa/tap/synlexa-studio
22
+ ```
23
+
24
+ ### Windows (10 / 11)
25
+
26
+ Open **PowerShell** and paste:
27
+
28
+ ```powershell
29
+ irm https://www.synlexa.com/install.ps1 | iex
30
+ ```
31
+
32
+ This installs **Synlexa Studio** and creates clickable shortcuts on your **Desktop** and **Start Menu**.
33
+
34
+ ### Linux
35
+
36
+ Run in Terminal (adds a **Synlexa Studio** Desktop & Applications menu icon):
37
+
38
+ ```sh
39
+ curl -fsSL https://www.synlexa.com/install.sh | sh
40
+ ```
41
+
42
+ *(Debian/Ubuntu `.deb` and portable `.AppImage` files are also available on [GitHub Releases](https://github.com/Synlexa/synlexa-studio/releases).)*
43
+
44
+ ---
45
+
46
+ ## Installing via `npm`
47
+
48
+ > **Tip:** Direct `.tgz` installation requires **no GitHub login or token** and works identically on macOS, Windows, and Linux:
49
+
50
+ ```sh
51
+ npm install -g https://github.com/Synlexa/synlexa-studio/releases/download/v0.4.3/synlexa-studio-0.4.3.tgz
52
+ ```
53
+
54
+ Or install from **GitHub Packages** (`@synlexa/studio`) if you have a GitHub token with `read:packages` in `~/.npmrc`:
55
+
56
+ ```sh
57
+ npm install -g @synlexa/studio --@synlexa:registry=https://npm.pkg.github.com
58
+ ```
59
+
60
+ ### Launching After Install
61
+
62
+ - **From your Desktop / App Launcher (no CLI needed):**
63
+ Double-click the **Synlexa Studio** icon on your **Desktop** (or open it from **macOS Applications / Spotlight**, **Windows Start Menu**, or **Linux Applications**).
64
+ - **From Terminal:**
65
+ ```sh
66
+ synlexa-studio # Open Synlexa Studio window
67
+ synlexa-studio install-desktop # Recreate the Desktop icon anytime
68
+ synlexa-studio mcp --stdio # Start stdio MCP server for Claude / Codex / Cursor
69
+ ```
70
+ - **Browser App (Zero Install):**
71
+ Open [https://studio.synlexa.com](https://studio.synlexa.com).
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,244 @@
1
+ #!/usr/bin/env node
2
+ import { existsSync, readFileSync, statSync } from 'node:fs';
3
+ import { extname, join, resolve } from 'node:path';
4
+ import { spawn, spawnSync } from 'node:child_process';
5
+ import http from 'node:http';
6
+ import readline from 'node:readline';
7
+ import {
8
+ findNativeBinary,
9
+ installDesktopShortcut,
10
+ PKG_ROOT,
11
+ readPackageMeta,
12
+ uninstallDesktopShortcut,
13
+ } from '../scripts/desktop-shortcut.mjs';
14
+
15
+ const pkgRoot = PKG_ROOT;
16
+ const pkgMeta = readPackageMeta();
17
+ const PKG_VERSION = pkgMeta.version || '0.4.1';
18
+
19
+ const MIME = {
20
+ '.html': 'text/html; charset=utf-8',
21
+ '.js': 'application/javascript; charset=utf-8',
22
+ '.mjs': 'application/javascript; charset=utf-8',
23
+ '.css': 'text/css; charset=utf-8',
24
+ '.json': 'application/json; charset=utf-8',
25
+ '.cif': 'text/plain; charset=utf-8',
26
+ '.pdb': 'text/plain; charset=utf-8',
27
+ '.wasm': 'application/wasm',
28
+ '.svg': 'image/svg+xml',
29
+ '.png': 'image/png',
30
+ '.ico': 'image/x-icon',
31
+ };
32
+
33
+ function openUrl(url) {
34
+ try {
35
+ if (process.platform === 'darwin') {
36
+ const chromeApp = '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome';
37
+ if (existsSync(chromeApp)) {
38
+ spawn(chromeApp, [`--app=${url}`], { detached: true, stdio: 'ignore' }).unref();
39
+ return;
40
+ }
41
+ spawn('open', [url], { detached: true, stdio: 'ignore' }).unref();
42
+ } else if (process.platform === 'win32') {
43
+ spawn('cmd', ['/c', 'start', '', 'msedge', `--app=${url}`], { detached: true, stdio: 'ignore' }).unref();
44
+ } else {
45
+ spawn('xdg-open', [url], { detached: true, stdio: 'ignore' }).unref();
46
+ }
47
+ } catch {
48
+ // ignore headless environments
49
+ }
50
+ }
51
+
52
+ async function runWasmStdioMcp() {
53
+ const wasmPath = join(pkgRoot, 'wasm', 'synlexa_bio_core.wasm');
54
+ if (!existsSync(wasmPath)) {
55
+ console.error('Synlexa Studio MCP fallback requires wasm/synlexa_bio_core.wasm');
56
+ process.exit(1);
57
+ }
58
+ const wasmBytes = readFileSync(wasmPath);
59
+ const { instance } = await WebAssembly.instantiate(wasmBytes, {});
60
+ const exports = instance.exports;
61
+
62
+ const invokeWasm = (op, reqObj) => {
63
+ const jsonBytes = Buffer.from(JSON.stringify({ op, payload: reqObj }), 'utf8');
64
+ const ptr = exports.alloc(jsonBytes.length);
65
+ new Uint8Array(exports.memory.buffer, ptr, jsonBytes.length).set(jsonBytes);
66
+ const outPtr = exports.invoke_json(ptr, jsonBytes.length);
67
+ const outLen = exports.last_result_len();
68
+ exports.dealloc(ptr, jsonBytes.length);
69
+ const text = Buffer.from(exports.memory.buffer, outPtr, outLen).toString('utf8');
70
+ return JSON.parse(text);
71
+ };
72
+
73
+ const rl = readline.createInterface({ input: process.stdin, crlfDelay: Infinity });
74
+ for await (const line of rl) {
75
+ const trimmed = line.trim();
76
+ if (!trimmed) continue;
77
+ let msg;
78
+ try {
79
+ msg = JSON.parse(trimmed);
80
+ } catch {
81
+ process.stdout.write(
82
+ `${JSON.stringify({ jsonrpc: '2.0', id: null, error: { code: -32700, message: 'Parse error' } })}\n`,
83
+ );
84
+ continue;
85
+ }
86
+ if (msg.method?.startsWith('notifications/')) continue;
87
+ const id = msg.id ?? null;
88
+ if (msg.method === 'initialize') {
89
+ process.stdout.write(
90
+ `${JSON.stringify({
91
+ jsonrpc: '2.0',
92
+ id,
93
+ result: {
94
+ protocolVersion: '2024-11-05',
95
+ serverInfo: { name: 'synlexa-studio-wasm-mcp', version: PKG_VERSION },
96
+ capabilities: { tools: { listChanged: false }, resources: { listChanged: false } },
97
+ },
98
+ })}\n`,
99
+ );
100
+ } else if (msg.method === 'ping') {
101
+ process.stdout.write(`${JSON.stringify({ jsonrpc: '2.0', id, result: {} })}\n`);
102
+ } else if (msg.method === 'tools/list') {
103
+ process.stdout.write(
104
+ `${JSON.stringify({
105
+ jsonrpc: '2.0',
106
+ id,
107
+ result: {
108
+ tools: [
109
+ { name: 'analyze_molecule_smiles', description: 'Compute deterministic SMILES descriptors & 2D layout' },
110
+ { name: 'analyze_gene_crispr', description: 'Analyze coding transcript edit & scan CRISPR PAM sites' },
111
+ { name: 'analyze_peptide', description: 'Compute wild-type vs engineered peptide descriptors' },
112
+ { name: 'inspect_structure', description: 'Inspect mmCIF/PDB chains and ligands' },
113
+ { name: 'analyze_ramachandran', description: 'Compute Ramachandran dihedrals & contacts' },
114
+ ],
115
+ },
116
+ })}\n`,
117
+ );
118
+ } else if (msg.method === 'tools/call') {
119
+ const name = msg.params?.name;
120
+ const args = msg.params?.arguments ?? {};
121
+ const out = invokeWasm(name, args);
122
+ process.stdout.write(
123
+ `${JSON.stringify({
124
+ jsonrpc: '2.0',
125
+ id,
126
+ result: {
127
+ isError: !out.ok,
128
+ content: [{ type: 'text', text: JSON.stringify(out, null, 2) }],
129
+ },
130
+ })}\n`,
131
+ );
132
+ } else {
133
+ process.stdout.write(
134
+ `${JSON.stringify({ jsonrpc: '2.0', id, error: { code: -32601, message: `Method not found: ${msg.method}` } })}\n`,
135
+ );
136
+ }
137
+ }
138
+ }
139
+
140
+ async function launchStudioWebHost(args) {
141
+ const nativeHost = findNativeBinary('synlexa-studio-desktop-native');
142
+ const distDir = join(pkgRoot, 'web-dist');
143
+ const iconIcns = join(pkgRoot, 'assets', 'icon.icns');
144
+ const spawnEnv = existsSync(iconIcns)
145
+ ? { ...process.env, SYNLEXA_ICON_PATH: iconIcns }
146
+ : process.env;
147
+
148
+ if (nativeHost && existsSync(distDir)) {
149
+ const res = spawnSync(nativeHost, ['--dist', distDir, ...args], {
150
+ stdio: 'inherit',
151
+ env: spawnEnv,
152
+ });
153
+ process.exit(res.status ?? 0);
154
+ }
155
+ if (!existsSync(distDir)) {
156
+ console.error('Synlexa Studio web assets not found. Visit https://www.synlexa.com/download for desktop installers.');
157
+ process.exit(1);
158
+ }
159
+ const portIdx = args.indexOf('--port');
160
+ const hasExplicitPort = portIdx >= 0 && Boolean(args[portIdx + 1]);
161
+ const requestedPort = hasExplicitPort ? Number(args[portIdx + 1]) : 4179;
162
+ const noOpen = args.includes('--no-open');
163
+
164
+ const server = http.createServer((req, res) => {
165
+ const urlPath = (req.url || '/').split('?')[0];
166
+ const rel = urlPath === '/' ? 'index.html' : urlPath.replace(/^\/+/, '');
167
+ let target = resolve(distDir, rel);
168
+ if (!target.startsWith(distDir) || !existsSync(target) || statSync(target).isDirectory()) {
169
+ target = resolve(distDir, 'index.html');
170
+ }
171
+ const content = readFileSync(target);
172
+ res.writeHead(200, {
173
+ 'Content-Type': MIME[extname(target)] || 'application/octet-stream',
174
+ 'Cross-Origin-Opener-Policy': 'same-origin-allow-popups',
175
+ });
176
+ res.end(content);
177
+ });
178
+
179
+ server.on('error', (err) => {
180
+ if (err.code === 'EADDRINUSE' && !hasExplicitPort && requestedPort !== 0) {
181
+ server.listen(0, '127.0.0.1');
182
+ return;
183
+ }
184
+ throw err;
185
+ });
186
+
187
+ server.listen(requestedPort, '127.0.0.1', () => {
188
+ const addr = server.address();
189
+ const port = typeof addr === 'object' && addr ? addr.port : requestedPort;
190
+ const url = `http://127.0.0.1:${port}/`;
191
+ console.log(`Synlexa Studio (Research-Use-Only) running at ${url}`);
192
+ if (!noOpen) openUrl(url);
193
+ });
194
+ }
195
+
196
+ const args = process.argv.slice(2).filter((arg) => !arg.startsWith('-psn_'));
197
+ const sub = args[0];
198
+
199
+ if (
200
+ !sub ||
201
+ sub === 'launch' ||
202
+ sub === 'app' ||
203
+ sub === '--browser' ||
204
+ sub === '--no-open' ||
205
+ sub.startsWith('--port') ||
206
+ sub.startsWith('--auth-callback')
207
+ ) {
208
+ await launchStudioWebHost(sub === 'launch' || sub === 'app' ? args.slice(1) : args);
209
+ } else if (sub === 'install-desktop' || sub === '--install-desktop' || sub === 'desktop-icon') {
210
+ const created = installDesktopShortcut();
211
+ if (created.length === 0) {
212
+ console.log('Desktop shortcut installation is unsupported on this platform.');
213
+ } else {
214
+ console.log('Synlexa Studio desktop icon installed:');
215
+ for (const p of created) console.log(` - ${p}`);
216
+ }
217
+ } else if (sub === 'uninstall-desktop' || sub === '--uninstall-desktop') {
218
+ const removed = uninstallDesktopShortcut();
219
+ console.log(removed.length > 0 ? `Removed: ${removed.join(', ')}` : 'No Synlexa Studio desktop shortcuts found.');
220
+ } else if (sub === 'mcp') {
221
+ const nativeCli = findNativeBinary('studio-cli');
222
+ if (nativeCli) {
223
+ const res = spawnSync(nativeCli, args, { stdio: 'inherit' });
224
+ process.exit(res.status ?? 0);
225
+ }
226
+ await runWasmStdioMcp();
227
+ } else if (sub === '--help' || sub === '-h' || sub === 'help') {
228
+ console.log(`Synlexa Studio v${PKG_VERSION} (Research-Use-Only)
229
+ Usage:
230
+ synlexa-studio Launch the local Synlexa Studio workspace
231
+ synlexa-studio install-desktop Add a clickable Synlexa Studio Desktop & app launcher icon
232
+ synlexa-studio mcp --stdio Start the stdio MCP server for Claude / Codex / Cursor
233
+ synlexa-studio --version Print version`);
234
+ } else if (sub === '--version' || sub === '-v' || sub === '-V' || sub === 'version') {
235
+ console.log(PKG_VERSION);
236
+ } else {
237
+ const nativeCli = findNativeBinary('studio-cli');
238
+ if (nativeCli) {
239
+ const res = spawnSync(nativeCli, args, { stdio: 'inherit' });
240
+ process.exit(res.status ?? 0);
241
+ }
242
+ console.error(`Unknown subcommand "${sub}". Run "synlexa-studio --help" for usage.`);
243
+ process.exit(1);
244
+ }
package/package.json CHANGED
@@ -1,6 +1,40 @@
1
1
  {
2
2
  "name": "@synlexa/studio",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.4.3",
4
+ "description": "Synlexa Studio Desktop App & Launcher for macOS (Apple Silicon & Intel), Windows, and Linux — adds a clickable Synlexa Studio Desktop icon and CLI/MCP runtime (Research-Use-Only).",
5
+ "license": "Apache-2.0",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/Synlexa/synlexa-studio.git"
9
+ },
10
+ "homepage": "https://www.synlexa.com/download",
11
+ "type": "module",
12
+ "bin": {
13
+ "synlexa-studio": "./bin/synlexa-studio.mjs"
14
+ },
15
+ "files": [
16
+ "assets/",
17
+ "bin/",
18
+ "scripts/",
19
+ "wasm/",
20
+ "web-dist/",
21
+ "README.md",
22
+ "LICENSE",
23
+ "NOTICE"
24
+ ],
25
+ "scripts": {
26
+ "postinstall": "node ./scripts/postinstall.mjs"
27
+ },
28
+ "engines": {
29
+ "node": ">=18.0.0"
30
+ },
31
+ "keywords": [
32
+ "synlexa",
33
+ "bioinformatics",
34
+ "structural-biology",
35
+ "mcp",
36
+ "webassembly",
37
+ "crispr",
38
+ "cheminformatics"
39
+ ]
40
+ }