@adapt-toolkit/mufl 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +172 -0
- package/LICENSE.fsl +105 -0
- package/NOTICE +25 -0
- package/README.md +70 -0
- package/bin/mufl-compile.js +4 -0
- package/bin/mufl.js +4 -0
- package/lib/launcher.js +60 -0
- package/lib/paths.js +26 -0
- package/meta/meta.mm +2666 -0
- package/mufl_stdlib/config.mufl +86 -0
- package/mufl_stdlib/continuation.mm +51 -0
- package/mufl_stdlib/control_packet.mu +184 -0
- package/mufl_stdlib/cryptography/address_document.mm +333 -0
- package/mufl_stdlib/cryptography/address_document_types.mm +16 -0
- package/mufl_stdlib/cryptography/attestation/attestation_document.mm +68 -0
- package/mufl_stdlib/cryptography/attestation/config.mufl +12 -0
- package/mufl_stdlib/cryptography/attestation/container_associated_data.mm +12 -0
- package/mufl_stdlib/cryptography/attestation/control_packet_identity_proof_document.mm +36 -0
- package/mufl_stdlib/cryptography/attestation/identity_proof_document_impl.mm +57 -0
- package/mufl_stdlib/cryptography/attestation/identity_proof_document_types.mm +45 -0
- package/mufl_stdlib/cryptography/attestation/node_description.mm +9 -0
- package/mufl_stdlib/cryptography/attestation/platform_dependent_attestation_document/browser/browser_attestation_document.mm +25 -0
- package/mufl_stdlib/cryptography/attestation/platform_dependent_attestation_document/browser/config.mufl +12 -0
- package/mufl_stdlib/cryptography/attestation/platform_dependent_attestation_document/config.mufl +12 -0
- package/mufl_stdlib/cryptography/attestation/platform_dependent_attestation_document/native/config.mufl +12 -0
- package/mufl_stdlib/cryptography/attestation/platform_dependent_attestation_document/native/native_attestation_document.mm +25 -0
- package/mufl_stdlib/cryptography/attestation/platform_dependent_attestation_document/platform_dependent_attestation_document.mm +57 -0
- package/mufl_stdlib/cryptography/authorizing_container.mm +21 -0
- package/mufl_stdlib/cryptography/config.mufl +12 -0
- package/mufl_stdlib/cryptography/encrypted_channel.mm +95 -0
- package/mufl_stdlib/cryptography/key_storage.mm +391 -0
- package/mufl_stdlib/cryptography/key_storage_api.mm +17 -0
- package/mufl_stdlib/cryptography/key_utils.mm +20 -0
- package/mufl_stdlib/cryptography/peer_container.mu +17 -0
- package/mufl_stdlib/cryptography/registration_proof.mm +40 -0
- package/mufl_stdlib/current_transaction_info.mm +78 -0
- package/mufl_stdlib/identity_proof_document.mm +21 -0
- package/mufl_stdlib/integration_test_api.mm +39 -0
- package/mufl_stdlib/lists.mm +84 -0
- package/mufl_stdlib/permissions.mm +219 -0
- package/mufl_stdlib/platform_type_id.mm +20 -0
- package/mufl_stdlib/random.mm +50 -0
- package/mufl_stdlib/rslt.mm +32 -0
- package/mufl_stdlib/transaction_message_decoder.mm +22 -0
- package/mufl_stdlib/transaction_queue.mm +60 -0
- package/mufl_stdlib/vector.mm +115 -0
- package/mufl_stdlib/verification.mm +35 -0
- package/package.json +43 -0
- package/prebuilds/linux-x64/mufl +0 -0
- package/prebuilds/linux-x64/mufl-compile +0 -0
- package/transactions/__t_wrapper.mm +169 -0
- package/transactions/config.mufl +22 -0
- package/transactions/transaction.mm +200 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
ADAPT ENGINE FREE-USE LICENSE (AEFL)
|
|
2
|
+
Version 1.0 — 2026-06-29
|
|
3
|
+
|
|
4
|
+
Covers the MUFL compiler, the MUFL REPL, and the adapt evaluator binaries
|
|
5
|
+
(together, the "Software").
|
|
6
|
+
|
|
7
|
+
Copyright (c) 2026 ADAPT FRAMEWORK SOLUTIONS LTD. All rights reserved.
|
|
8
|
+
ADAPT FRAMEWORK SOLUTIONS LTD, a company registered in England and Wales
|
|
9
|
+
(company no. 12371061), registered office: Steward House, 14 Commercial Way,
|
|
10
|
+
Woking, England, GU21 6ET.
|
|
11
|
+
|
|
12
|
+
PREAMBLE (non-binding)
|
|
13
|
+
This license lets anyone download and use the MUFL compiler, REPL, and adapt
|
|
14
|
+
evaluator at no charge, for any purpose including commercial, and keep full
|
|
15
|
+
ownership of everything they build with them. The binaries are free to use and
|
|
16
|
+
to redistribute unchanged; the underlying source code remains proprietary and
|
|
17
|
+
may not be reverse engineered. If a term and the binding text below disagree,
|
|
18
|
+
the binding text controls.
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
1. DEFINITIONS
|
|
22
|
+
|
|
23
|
+
1.1 "Software" means the MUFL compiler, the MUFL REPL, and the adapt evaluator
|
|
24
|
+
binaries distributed under this license, in any form (native executable,
|
|
25
|
+
archive, WebAssembly module, or N-API module), including any updates the
|
|
26
|
+
Licensor distributes under this license, but excluding any source code.
|
|
27
|
+
|
|
28
|
+
1.2 "Licensor" means the copyright holder identified above and its successors
|
|
29
|
+
and assigns.
|
|
30
|
+
|
|
31
|
+
1.3 "You" (or "Your") means the individual or legal entity exercising rights
|
|
32
|
+
under this license.
|
|
33
|
+
|
|
34
|
+
1.4 "Your Programs" means source code, configuration, and data that You author
|
|
35
|
+
or supply for processing by the Software.
|
|
36
|
+
|
|
37
|
+
1.5 "Output" means any artifact the Software produces from Your Programs,
|
|
38
|
+
including compiled modules, intermediate representations, and the results
|
|
39
|
+
of evaluation or execution.
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
2. GRANT OF RIGHTS
|
|
43
|
+
|
|
44
|
+
Subject to Your compliance with this license, the Licensor grants You a
|
|
45
|
+
worldwide, royalty-free, non-exclusive, perpetual (subject to Section 8)
|
|
46
|
+
license to:
|
|
47
|
+
|
|
48
|
+
(a) install and run the Software, on any number of machines, for any purpose,
|
|
49
|
+
including commercial use, at no charge;
|
|
50
|
+
|
|
51
|
+
(b) use the Software to author, compile, evaluate, execute, debug, and test
|
|
52
|
+
Your Programs; and
|
|
53
|
+
|
|
54
|
+
(c) redistribute the Software to third parties, provided that each copy is
|
|
55
|
+
complete and unmodified and that a verbatim copy of this license
|
|
56
|
+
accompanies it.
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
3. YOUR PROGRAMS AND OUTPUT
|
|
60
|
+
|
|
61
|
+
The Licensor claims no ownership of, and asserts no rights over, Your Programs
|
|
62
|
+
or the Output. You may use, reproduce, distribute, sublicense, sell, and
|
|
63
|
+
otherwise commercialize Your Programs and the Output without restriction and
|
|
64
|
+
without any obligation, attribution, or fee under this license. Authoring,
|
|
65
|
+
compiling, evaluating, or executing Your Programs with the Software does not
|
|
66
|
+
place Your Programs or the Output under this license or any obligation arising
|
|
67
|
+
from it.
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
4. RESTRICTIONS
|
|
71
|
+
|
|
72
|
+
You may not:
|
|
73
|
+
|
|
74
|
+
(a) reverse engineer, decompile, disassemble, or otherwise attempt to derive
|
|
75
|
+
the source code, internal design, structure, or algorithms of the
|
|
76
|
+
Software, except, and only to the limited extent, that applicable law
|
|
77
|
+
expressly forbids restricting such acts notwithstanding this limitation;
|
|
78
|
+
|
|
79
|
+
(b) modify, adapt, translate, or create derivative works of the Software, or
|
|
80
|
+
distribute any modified copy of the Software;
|
|
81
|
+
|
|
82
|
+
(c) remove, alter, or obscure any copyright, trademark, license, or other
|
|
83
|
+
proprietary notice contained in or accompanying the Software;
|
|
84
|
+
|
|
85
|
+
(d) use the Software, or any knowledge, measurement, or observation obtained
|
|
86
|
+
from it, to design, develop, train, or distribute a competing compiler,
|
|
87
|
+
REPL, evaluator, language runtime, or substantially similar product or
|
|
88
|
+
service; or
|
|
89
|
+
|
|
90
|
+
(e) use any name, logo, or trademark of the Licensor, except as strictly
|
|
91
|
+
necessary to identify unmodified redistributions of the Software, and
|
|
92
|
+
never in a manner that suggests endorsement, sponsorship, or affiliation
|
|
93
|
+
without the Licensor's prior written permission.
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
5. RESERVATION OF RIGHTS
|
|
97
|
+
|
|
98
|
+
The Software is licensed, not sold. The Licensor and its licensors retain all
|
|
99
|
+
right, title, and interest in and to the Software, including all intellectual
|
|
100
|
+
property rights and all rights in the Software's source code. All rights not
|
|
101
|
+
expressly granted to You in this license are reserved.
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
6. NO WARRANTY
|
|
105
|
+
|
|
106
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND "AS AVAILABLE", WITHOUT WARRANTY OF ANY
|
|
107
|
+
KIND, WHETHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, INCLUDING WITHOUT
|
|
108
|
+
LIMITATION THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
|
109
|
+
PURPOSE, TITLE, AND NON-INFRINGEMENT. THE LICENSOR DOES NOT WARRANT THAT THE
|
|
110
|
+
SOFTWARE WILL BE UNINTERRUPTED, ERROR-FREE, OR FREE OF HARMFUL COMPONENTS, OR
|
|
111
|
+
THAT ITS OUTPUT WILL BE ACCURATE OR RELIABLE.
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
7. LIMITATION OF LIABILITY
|
|
115
|
+
|
|
116
|
+
TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT SHALL THE
|
|
117
|
+
LICENSOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
|
118
|
+
OR CONSEQUENTIAL DAMAGES, OR FOR ANY LOSS OF PROFITS, REVENUE, DATA, OR
|
|
119
|
+
GOODWILL, ARISING OUT OF OR IN CONNECTION WITH THE SOFTWARE OR ITS USE OR
|
|
120
|
+
INABILITY TO BE USED, WHETHER IN CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
|
121
|
+
STRICT LIABILITY, OR ANY OTHER THEORY, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
122
|
+
SUCH DAMAGES. THIS SOFTWARE IS PROVIDED FREE OF CHARGE, AND THIS ALLOCATION OF
|
|
123
|
+
RISK IS AN ESSENTIAL BASIS OF THE LICENSOR'S DECISION TO PROVIDE IT.
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
8. TERM AND TERMINATION
|
|
127
|
+
|
|
128
|
+
This license takes effect when You first download, install, or use the
|
|
129
|
+
Software and continues until terminated. It terminates automatically and
|
|
130
|
+
immediately if You breach any of its terms. Upon termination You must cease
|
|
131
|
+
all use of the Software and destroy all copies in Your possession or control.
|
|
132
|
+
Sections 3, 5, 6, 7, 9, and 10 survive termination. Termination does not
|
|
133
|
+
affect Your Programs or Output created before termination, nor any rights of
|
|
134
|
+
third parties who received the Software from You in compliance with this
|
|
135
|
+
license.
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
9. GOVERNING LAW
|
|
139
|
+
|
|
140
|
+
This license is governed by and construed in accordance with the laws of
|
|
141
|
+
England and Wales, excluding its conflict-of-laws rules and excluding the
|
|
142
|
+
United Nations Convention on Contracts for the International Sale of Goods. The
|
|
143
|
+
courts of England and Wales shall have exclusive jurisdiction over any dispute
|
|
144
|
+
arising out of or relating to this license.
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
10. GENERAL
|
|
148
|
+
|
|
149
|
+
10.1 Entire Agreement. This license is the entire agreement between You and the
|
|
150
|
+
Licensor regarding the Software and supersedes any prior or contemporaneous
|
|
151
|
+
understandings.
|
|
152
|
+
|
|
153
|
+
10.2 Severability. If any provision is held unenforceable, it shall be modified
|
|
154
|
+
to the minimum extent necessary to make it enforceable, and the remaining
|
|
155
|
+
provisions shall remain in full force.
|
|
156
|
+
|
|
157
|
+
10.3 No Waiver. The Licensor's failure to enforce any provision is not a waiver
|
|
158
|
+
of its right to do so later.
|
|
159
|
+
|
|
160
|
+
10.4 Assignment. You may not assign or transfer this license except as part of
|
|
161
|
+
a permitted, unmodified redistribution of the Software under Section 2(c).
|
|
162
|
+
The Licensor may assign this license freely.
|
|
163
|
+
|
|
164
|
+
10.5 Reservation for Separate Terms. The Licensor may make the Software, or
|
|
165
|
+
additional rights to it, available to You or others under separate written
|
|
166
|
+
terms (for example, a commercial or source license). Those terms govern
|
|
167
|
+
only where expressly agreed and do not limit the rights granted here.
|
|
168
|
+
|
|
169
|
+
END OF TERMS
|
|
170
|
+
|
|
171
|
+
To request rights beyond this license (including commercial source licensing),
|
|
172
|
+
contact: alex@adaptframework.solutions.
|
package/LICENSE.fsl
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# Functional Source License, Version 1.1, ALv2 Future License
|
|
2
|
+
|
|
3
|
+
## Abbreviation
|
|
4
|
+
|
|
5
|
+
FSL-1.1-ALv2
|
|
6
|
+
|
|
7
|
+
## Notice
|
|
8
|
+
|
|
9
|
+
Copyright 2026 ADAPT FRAMEWORK SOLUTIONS LTD
|
|
10
|
+
|
|
11
|
+
## Terms and Conditions
|
|
12
|
+
|
|
13
|
+
### Licensor ("We")
|
|
14
|
+
|
|
15
|
+
The party offering the Software under these Terms and Conditions.
|
|
16
|
+
|
|
17
|
+
### The Software
|
|
18
|
+
|
|
19
|
+
The "Software" is each version of the software that we make available under
|
|
20
|
+
these Terms and Conditions, as indicated by our inclusion of these Terms and
|
|
21
|
+
Conditions with the Software.
|
|
22
|
+
|
|
23
|
+
### License Grant
|
|
24
|
+
|
|
25
|
+
Subject to your compliance with this License Grant and the Patents,
|
|
26
|
+
Redistribution and Trademark clauses below, we hereby grant you the right to
|
|
27
|
+
use, copy, modify, create derivative works, publicly perform, publicly display
|
|
28
|
+
and redistribute the Software for any Permitted Purpose identified below.
|
|
29
|
+
|
|
30
|
+
### Permitted Purpose
|
|
31
|
+
|
|
32
|
+
A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
|
|
33
|
+
means making the Software available to others in a commercial product or
|
|
34
|
+
service that:
|
|
35
|
+
|
|
36
|
+
1. substitutes for the Software;
|
|
37
|
+
|
|
38
|
+
2. substitutes for any other product or service we offer using the Software
|
|
39
|
+
that exists as of the date we make the Software available; or
|
|
40
|
+
|
|
41
|
+
3. offers the same or substantially similar functionality as the Software.
|
|
42
|
+
|
|
43
|
+
Permitted Purposes specifically include using the Software:
|
|
44
|
+
|
|
45
|
+
1. for your internal use and access;
|
|
46
|
+
|
|
47
|
+
2. for non-commercial education;
|
|
48
|
+
|
|
49
|
+
3. for non-commercial research; and
|
|
50
|
+
|
|
51
|
+
4. in connection with professional services that you provide to a licensee
|
|
52
|
+
using the Software in accordance with these Terms and Conditions.
|
|
53
|
+
|
|
54
|
+
### Patents
|
|
55
|
+
|
|
56
|
+
To the extent your use for a Permitted Purpose would necessarily infringe our
|
|
57
|
+
patents, the license grant above includes a license under our patents. If you
|
|
58
|
+
make a claim against any party that the Software infringes or contributes to
|
|
59
|
+
the infringement of any patent, then your patent license to the Software ends
|
|
60
|
+
immediately.
|
|
61
|
+
|
|
62
|
+
### Redistribution
|
|
63
|
+
|
|
64
|
+
The Terms and Conditions apply to all copies, modifications and derivatives of
|
|
65
|
+
the Software.
|
|
66
|
+
|
|
67
|
+
If you redistribute any copies, modifications or derivatives of the Software,
|
|
68
|
+
you must include a copy of or a link to these Terms and Conditions and not
|
|
69
|
+
remove any copyright notices provided in or with the Software.
|
|
70
|
+
|
|
71
|
+
### Disclaimer
|
|
72
|
+
|
|
73
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
|
|
74
|
+
IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
|
|
75
|
+
PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
|
|
76
|
+
|
|
77
|
+
IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
|
|
78
|
+
SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
|
|
79
|
+
EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
|
|
80
|
+
|
|
81
|
+
### Trademarks
|
|
82
|
+
|
|
83
|
+
Except for displaying the License Details and identifying us as the origin of
|
|
84
|
+
the Software, you have no right under these Terms and Conditions to use our
|
|
85
|
+
trademarks, trade names, service marks or product names.
|
|
86
|
+
|
|
87
|
+
## Grant of Future License
|
|
88
|
+
|
|
89
|
+
We hereby irrevocably grant you an additional license to use the Software under
|
|
90
|
+
the Apache License, Version 2.0 that is effective on the second anniversary of
|
|
91
|
+
the date we make the Software available. On or after that date, you may use the
|
|
92
|
+
Software under the Apache License, Version 2.0, in which case the following
|
|
93
|
+
will apply:
|
|
94
|
+
|
|
95
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
96
|
+
this file except in compliance with the License.
|
|
97
|
+
|
|
98
|
+
You may obtain a copy of the License at
|
|
99
|
+
|
|
100
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
101
|
+
|
|
102
|
+
Unless required by applicable law or agreed to in writing, software distributed
|
|
103
|
+
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
104
|
+
CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
|
105
|
+
specific language governing permissions and limitations under the License.
|
package/NOTICE
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
NOTICE — Bundled proprietary components (@adapt-toolkit/mufl)
|
|
2
|
+
|
|
3
|
+
This package ships two kinds of content under two licenses. The package
|
|
4
|
+
`license` field says "SEE LICENSE IN LICENSE"; this file is the map.
|
|
5
|
+
|
|
6
|
+
1. ENGINE BINARIES — the `mufl` (REPL) and `mufl-compile` (compiler)
|
|
7
|
+
executables under prebuilds/ are proprietary software of ADAPT FRAMEWORK
|
|
8
|
+
SOLUTIONS LTD, licensed under the Adapt Engine Free-Use License (AEFL);
|
|
9
|
+
the full text is in the LICENSE file at the package root. Free use,
|
|
10
|
+
including commercial use; redistribution only complete and unmodified with
|
|
11
|
+
the license text; no modification, derivatives, or reverse engineering.
|
|
12
|
+
|
|
13
|
+
2. EVERYTHING ELSE — the Node launcher shims (bin/, lib/) and the bundled
|
|
14
|
+
MUFL source trees (mufl_stdlib/, meta/, transactions/) are licensed under
|
|
15
|
+
the Functional Source License, Version 1.1, Apache 2.0 Future License
|
|
16
|
+
(FSL-1.1-Apache-2.0); the full text is in the LICENSE.fsl file.
|
|
17
|
+
|
|
18
|
+
For the avoidance of doubt, the binaries in (1) are EXCLUDED from the FSL
|
|
19
|
+
grant AND from the FSL "Future License" conversion: they do NOT become
|
|
20
|
+
available under Apache-2.0 (or any other license) on the Change Date or at
|
|
21
|
+
any other time. All rights in them are reserved except as expressly granted
|
|
22
|
+
by the AEFL. The proprietary MUFL/adapt engine implementation is never
|
|
23
|
+
distributed in source form.
|
|
24
|
+
|
|
25
|
+
Source-access / commercial licensing: alex@adaptframework.solutions
|
package/README.md
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# @adapt-toolkit/mufl
|
|
2
|
+
|
|
3
|
+
The MUFL toolchain as an npm package: prebuilt **`mufl`** (REPL / unified CLI)
|
|
4
|
+
and **`mufl-compile`** (compiler) engine binaries, plus the MUFL standard
|
|
5
|
+
library trees they need at run time (`mufl_stdlib/`, `meta/`, `transactions/`).
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install @adapt-toolkit/mufl
|
|
9
|
+
|
|
10
|
+
npx mufl-compile my_packet.mu # writes a content-hashed <hash>.muflo to the cwd
|
|
11
|
+
npx mufl --help # unified CLI: compile / run / repl subcommands
|
|
12
|
+
npx mufl # interactive REPL (console mode)
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Platform support
|
|
16
|
+
|
|
17
|
+
`linux-x64` (glibc) only. On any other platform/arch both commands exit 1 with:
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
@adapt-toolkit/mufl: no prebuilt binary for <platform>-<arch> (available: linux-x64)
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
On unsupported platforms, build from an adapt-toolkit checkout instead and
|
|
24
|
+
point your scripts at it (see the environment contract below — it is preserved
|
|
25
|
+
verbatim, so checkout-based workflows keep working).
|
|
26
|
+
|
|
27
|
+
Requires Node >= 20. The package weighs tens of MB (two native binaries plus
|
|
28
|
+
three MUFL source trees).
|
|
29
|
+
|
|
30
|
+
## Environment / flag contract
|
|
31
|
+
|
|
32
|
+
The launcher shims are thin: they spawn the real binary with your stdio and
|
|
33
|
+
propagate its exit code and signals. Two defaults are injected, both losing to
|
|
34
|
+
the caller:
|
|
35
|
+
|
|
36
|
+
- **`MUFL_STDLIB_PATH`** — set to the packaged `mufl_stdlib/` **unless already
|
|
37
|
+
set in your environment**. Your value always wins.
|
|
38
|
+
- **`-mp` meta search paths** — `-mp <pkg>/meta -mp <pkg>/transactions` are
|
|
39
|
+
appended **only when you passed no `-mp` flag at all**. Any caller-supplied
|
|
40
|
+
`-mp` disables the packaged defaults entirely (compose your own full set,
|
|
41
|
+
exactly like invocations inside an adapt checkout do).
|
|
42
|
+
|
|
43
|
+
## Programmatic paths
|
|
44
|
+
|
|
45
|
+
Build scripts can locate the toolkit without spawning a process:
|
|
46
|
+
|
|
47
|
+
```js
|
|
48
|
+
import { binDir, stdlibPath, metaPath, transactionsPath, binaryPath }
|
|
49
|
+
from '@adapt-toolkit/mufl/paths';
|
|
50
|
+
|
|
51
|
+
binaryPath('mufl-compile'); // <pkg>/prebuilds/linux-x64/mufl-compile
|
|
52
|
+
// throws the unsupported-platform error elsewhere
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Versioning
|
|
56
|
+
|
|
57
|
+
Version-locked to `@adapt-toolkit/sdk`: every release of this package is built
|
|
58
|
+
from the same CI run of the same commit as the SDK of the same version.
|
|
59
|
+
|
|
60
|
+
## License
|
|
61
|
+
|
|
62
|
+
`SEE LICENSE IN LICENSE` — dual scheme, mapped in [NOTICE](./NOTICE):
|
|
63
|
+
|
|
64
|
+
- the **engine binaries** (`prebuilds/`) are proprietary, under the
|
|
65
|
+
**Adapt Engine Free-Use License (AEFL)** — full text in `LICENSE`;
|
|
66
|
+
- the **launcher shims and bundled MUFL source trees** are under the
|
|
67
|
+
**Functional Source License, Version 1.1, Apache 2.0 Future License
|
|
68
|
+
(FSL-1.1-Apache-2.0)** — full text in `LICENSE.fsl`.
|
|
69
|
+
|
|
70
|
+
Source-access / commercial licensing: alex@adaptframework.solutions
|
package/bin/mufl.js
ADDED
package/lib/launcher.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// Shared launcher logic for the `mufl` / `mufl-compile` bin shims.
|
|
2
|
+
// Precedence contract (SPEC-5): a caller-provided MUFL_STDLIB_PATH always wins
|
|
3
|
+
// over the packaged stdlib, and any caller-supplied -mp flag disables the
|
|
4
|
+
// packaged -mp defaults entirely.
|
|
5
|
+
|
|
6
|
+
import { existsSync } from 'node:fs';
|
|
7
|
+
import { spawn } from 'node:child_process';
|
|
8
|
+
|
|
9
|
+
import { stdlibPath, metaPath, transactionsPath, binaryPath } from './paths.js';
|
|
10
|
+
|
|
11
|
+
export function buildEnv(env = process.env) {
|
|
12
|
+
const out = { ...env };
|
|
13
|
+
if (out.MUFL_STDLIB_PATH === undefined) {
|
|
14
|
+
out.MUFL_STDLIB_PATH = stdlibPath;
|
|
15
|
+
}
|
|
16
|
+
return out;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function buildArgs(argv) {
|
|
20
|
+
if (argv.includes('-mp')) {
|
|
21
|
+
return [...argv];
|
|
22
|
+
}
|
|
23
|
+
return [...argv, '-mp', metaPath, '-mp', transactionsPath];
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function run(name, argv = process.argv.slice(2)) {
|
|
27
|
+
let bin;
|
|
28
|
+
try {
|
|
29
|
+
bin = binaryPath(name);
|
|
30
|
+
} catch (err) {
|
|
31
|
+
console.error(err.message);
|
|
32
|
+
process.exit(1);
|
|
33
|
+
}
|
|
34
|
+
if (!existsSync(bin)) {
|
|
35
|
+
console.error(`@adapt-toolkit/mufl: prebuilt binary missing at ${bin} (broken install?)`);
|
|
36
|
+
process.exit(1);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const child = spawn(bin, buildArgs(argv), {
|
|
40
|
+
stdio: 'inherit',
|
|
41
|
+
env: buildEnv(),
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
for (const sig of ['SIGINT', 'SIGTERM']) {
|
|
45
|
+
process.on(sig, () => child.kill(sig));
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
child.on('error', (err) => {
|
|
49
|
+
console.error(`@adapt-toolkit/mufl: failed to launch ${name}: ${err.message}`);
|
|
50
|
+
process.exit(1);
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
child.on('close', (code, signal) => {
|
|
54
|
+
if (signal) {
|
|
55
|
+
process.kill(process.pid, signal);
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
process.exit(code ?? 1);
|
|
59
|
+
});
|
|
60
|
+
}
|
package/lib/paths.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// Programmatic access to the toolkit paths shipped in this package.
|
|
2
|
+
// Public interface: exported as `@adapt-toolkit/mufl/paths` — consumer build
|
|
3
|
+
// scripts locate the compiler and its runtime trees through these instead of
|
|
4
|
+
// spawning the CLI per query.
|
|
5
|
+
|
|
6
|
+
import { resolve, dirname } from 'node:path';
|
|
7
|
+
import { fileURLToPath } from 'node:url';
|
|
8
|
+
|
|
9
|
+
const pkgRoot = resolve(dirname(fileURLToPath(import.meta.url)), '..');
|
|
10
|
+
|
|
11
|
+
const SUPPORTED = ['linux-x64'];
|
|
12
|
+
|
|
13
|
+
export const binDir = resolve(pkgRoot, 'prebuilds');
|
|
14
|
+
export const stdlibPath = resolve(pkgRoot, 'mufl_stdlib');
|
|
15
|
+
export const metaPath = resolve(pkgRoot, 'meta');
|
|
16
|
+
export const transactionsPath = resolve(pkgRoot, 'transactions');
|
|
17
|
+
|
|
18
|
+
export function binaryPath(name, platform = process.platform, arch = process.arch) {
|
|
19
|
+
const platformArch = `${platform}-${arch}`;
|
|
20
|
+
if (!SUPPORTED.includes(platformArch)) {
|
|
21
|
+
throw new Error(
|
|
22
|
+
`@adapt-toolkit/mufl: no prebuilt binary for ${platformArch} (available: ${SUPPORTED.join(', ')})`,
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
return resolve(binDir, platformArch, name);
|
|
26
|
+
}
|