n2-qln 3.3.4 → 3.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/FUNDING.yml +3 -0
- package/LICENSE +38 -176
- package/LICENSE-APACHE +190 -0
- package/README.ko.md +6 -4
- package/README.md +6 -4
- package/lib/router.js +120 -14
- package/package.json +2 -2
package/LICENSE
CHANGED
|
@@ -1,191 +1,53 @@
|
|
|
1
|
+
# Dual License
|
|
1
2
|
|
|
2
|
-
|
|
3
|
-
Version 2.0, January 2004
|
|
4
|
-
http://www.apache.org/licenses/
|
|
3
|
+
Copyright 2026 N2 (Hyunsoo Choi)
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
This software is licensed under a **dual license** model:
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
## 1. Open Source License — Apache License 2.0
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
For **non-commercial**, **personal**, **educational**, and **open-source** use,
|
|
10
|
+
this software is licensed under the Apache License, Version 2.0.
|
|
12
11
|
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
You may obtain a copy of the Apache License at:
|
|
13
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
15
14
|
|
|
16
|
-
|
|
17
|
-
other entities that control, are controlled by, or are under common
|
|
18
|
-
control with that entity. For the purposes of this definition,
|
|
19
|
-
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
-
direction or management of such entity, whether by contract or
|
|
21
|
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
15
|
+
The full text of the Apache License 2.0 is available in [LICENSE-APACHE](./LICENSE-APACHE).
|
|
23
16
|
|
|
24
|
-
|
|
25
|
-
|
|
17
|
+
### What you CAN do under Apache 2.0:
|
|
18
|
+
- Use in personal and educational projects
|
|
19
|
+
- Use in open-source projects (non-commercial)
|
|
20
|
+
- Modify and distribute (with attribution)
|
|
21
|
+
- Study and learn from the code
|
|
26
22
|
|
|
27
|
-
|
|
28
|
-
including but not limited to software source code, documentation
|
|
29
|
-
source, and configuration files.
|
|
23
|
+
## 2. Commercial License
|
|
30
24
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
25
|
+
For **commercial use** — including but not limited to:
|
|
26
|
+
- Incorporating this software into commercial products or services
|
|
27
|
+
- Using this software to generate revenue (directly or indirectly)
|
|
28
|
+
- Deploying this software in a commercial/enterprise environment
|
|
29
|
+
- Offering this software as part of a paid service (SaaS, PaaS, etc.)
|
|
35
30
|
|
|
36
|
-
|
|
37
|
-
Object form, made available under the License, as indicated by a
|
|
38
|
-
copyright notice that is included in or attached to the work
|
|
39
|
-
(an example is provided in the Appendix below).
|
|
31
|
+
You **must** obtain a separate commercial license.
|
|
40
32
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
-
of this License, Derivative Works shall not include works that remain
|
|
46
|
-
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
-
the Work and Derivative Works thereof.
|
|
33
|
+
### Contact for Commercial Licensing:
|
|
34
|
+
- Email: lagi0730@gmail.com
|
|
35
|
+
- GitHub: https://github.com/choihyunsus
|
|
48
36
|
|
|
49
|
-
|
|
50
|
-
the original version of the Work and any modifications or additions
|
|
51
|
-
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
-
submitted to the Licensor for inclusion in the Work by the copyright owner
|
|
53
|
-
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
-
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
-
means any form of electronic, verbal, or written communication sent
|
|
56
|
-
to the Licensor or its representatives, including but not limited to
|
|
57
|
-
communication on electronic mailing lists, source code control systems,
|
|
58
|
-
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
-
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
-
excluding communication that is conspicuously marked or otherwise
|
|
61
|
-
designated in writing by the copyright owner as "Not a Contribution."
|
|
37
|
+
## Summary
|
|
62
38
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
39
|
+
| Use Case | License | Cost |
|
|
40
|
+
|----------|---------|------|
|
|
41
|
+
| Personal / Educational | Apache 2.0 | Free |
|
|
42
|
+
| Open-source (non-commercial) | Apache 2.0 | Free |
|
|
43
|
+
| Commercial / Enterprise | Commercial License | Contact us |
|
|
66
44
|
|
|
67
|
-
|
|
68
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
-
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
-
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
-
Work and such Derivative Works in Source or Object form.
|
|
45
|
+
## Disclaimer
|
|
73
46
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
-
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
-
institute patent litigation against any entity (including a
|
|
84
|
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
-
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
-
or contributory patent infringement, then any patent licenses
|
|
87
|
-
granted to You under this License for that Work shall terminate
|
|
88
|
-
as of the date such litigation is filed.
|
|
89
|
-
|
|
90
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
-
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
-
modifications, and in Source or Object form, provided that You
|
|
93
|
-
meet the following conditions:
|
|
94
|
-
|
|
95
|
-
(a) You must give any other recipients of the Work or
|
|
96
|
-
Derivative Works a copy of this License; and
|
|
97
|
-
|
|
98
|
-
(b) You must cause any modified files to carry prominent notices
|
|
99
|
-
stating that You changed the files; and
|
|
100
|
-
|
|
101
|
-
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
-
that You distribute, all copyright, patent, trademark, and
|
|
103
|
-
attribution notices from the Source form of the Work,
|
|
104
|
-
excluding those notices that do not pertain to any part of
|
|
105
|
-
the Derivative Works; and
|
|
106
|
-
|
|
107
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
-
distribution, then any Derivative Works that You distribute must
|
|
109
|
-
include a readable copy of the attribution notices contained
|
|
110
|
-
within such NOTICE file, excluding any notices that do not
|
|
111
|
-
pertain to any part of the Derivative Works, in at least one
|
|
112
|
-
of the following places: within a NOTICE text file distributed
|
|
113
|
-
as part of the Derivative Works; within the Source form or
|
|
114
|
-
documentation, if provided along with the Derivative Works; or,
|
|
115
|
-
within a display generated by the Derivative Works, if and
|
|
116
|
-
wherever such third-party notices normally appear. The contents
|
|
117
|
-
of the NOTICE file are for informational purposes only and
|
|
118
|
-
do not modify the License. You may add Your own attribution
|
|
119
|
-
notices within Derivative Works that You distribute, alongside
|
|
120
|
-
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
-
that such additional attribution notices cannot be construed
|
|
122
|
-
as modifying the License.
|
|
123
|
-
|
|
124
|
-
You may add Your own copyright statement to Your modifications and
|
|
125
|
-
may provide additional or different license terms and conditions
|
|
126
|
-
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
-
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
-
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
-
the conditions stated in this License.
|
|
130
|
-
|
|
131
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
-
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
-
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
-
this License, without any additional terms or conditions.
|
|
135
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
-
the terms of any separate license agreement you may have executed
|
|
137
|
-
with Licensor regarding such Contributions.
|
|
138
|
-
|
|
139
|
-
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
-
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
-
except as required for reasonable and customary use in describing the
|
|
142
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
-
|
|
144
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
-
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
-
implied, including, without limitation, any warranties or conditions
|
|
149
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
-
appropriateness of using or redistributing the Work and assume any
|
|
152
|
-
risks associated with Your exercise of permissions under this License.
|
|
153
|
-
|
|
154
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
-
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
-
unless required by applicable law (such as deliberate and grossly
|
|
157
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
-
liable to You for damages, including any direct, indirect, special,
|
|
159
|
-
incidental, or consequential damages of any character arising as a
|
|
160
|
-
result of this License or out of the use or inability to use the
|
|
161
|
-
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
-
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
-
other commercial damages or losses), even if such Contributor
|
|
164
|
-
has been advised of the possibility of such damages.
|
|
165
|
-
|
|
166
|
-
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
-
or other liability obligations and/or rights consistent with this
|
|
170
|
-
License. However, in accepting such obligations, You may act only
|
|
171
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
-
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
-
defend, and hold each Contributor harmless for any liability
|
|
174
|
-
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
-
of your accepting any such warranty or additional liability.
|
|
176
|
-
|
|
177
|
-
END OF TERMS AND CONDITIONS
|
|
178
|
-
|
|
179
|
-
Copyright 2026 N2
|
|
180
|
-
|
|
181
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
182
|
-
you may not use this file except in compliance with the License.
|
|
183
|
-
You may obtain a copy of the License at
|
|
184
|
-
|
|
185
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
186
|
-
|
|
187
|
-
Unless required by applicable law or agreed to in writing, software
|
|
188
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
189
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
190
|
-
See the License for the specific language governing permissions and
|
|
191
|
-
limitations under the License.
|
|
47
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
48
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
49
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
50
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
51
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
52
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
53
|
+
SOFTWARE.
|
package/LICENSE-APACHE
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
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 the 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 the 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 any 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
|
+
Copyright 2026 N2
|
|
179
|
+
|
|
180
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
181
|
+
you may not use this file except in compliance with the License.
|
|
182
|
+
You may obtain a copy of the License at
|
|
183
|
+
|
|
184
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
185
|
+
|
|
186
|
+
Unless required by applicable law or agreed to in writing, software
|
|
187
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
188
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
189
|
+
See the License for the specific language governing permissions and
|
|
190
|
+
limitations under the License.
|
package/README.ko.md
CHANGED
|
@@ -29,7 +29,9 @@
|
|
|
29
29
|
|
|
30
30
|
🔍 **하나의 도구로 모든 것을** — AI는 `n2_qln_call` (~200 토큰)만 봅니다. 1,000개의 개별 도구가 아닙니다. 99.6% 컨텍스트 절감.
|
|
31
31
|
|
|
32
|
-
⚡ **5ms 이하 검색** — 3단계 검색 엔진 (트리거 + 키워드 + 시맨틱)이 1,000개 이상의 도구에서도 5ms 이내에 최적 도구를 찾습니다.
|
|
32
|
+
⚡ **5ms 이하 검색** — 3단계 검색 엔진 (트리거 + BM25 키워드 + 시맨틱)이 1,000개 이상의 도구에서도 5ms 이내에 최적 도구를 찾습니다.
|
|
33
|
+
|
|
34
|
+
🎯 **BM25 키워드 랭킹** *(v3.4)* — Stage 2에 [Okapi BM25](https://en.wikipedia.org/wiki/Okapi_BM25) 알고리즘 적용. 희귀한 단어일수록 높은 점수, 문서 길이 정규화. Google, Elasticsearch, Wikipedia 검색의 핵심 알고리즘.
|
|
33
35
|
|
|
34
36
|
📈 **자동 학습 랭킹** — 많이 사용되고 성공률이 높은 도구는 자동으로 상위에 랭크됩니다. 수동 튜닝 불필요.
|
|
35
37
|
|
|
@@ -184,14 +186,14 @@ QLN은 세 단계의 검색으로 적합한 도구를 찾습니다:
|
|
|
184
186
|
| 단계 | 방식 | 속도 | 작동 원리 |
|
|
185
187
|
|:---:|--------|:---:|---------|
|
|
186
188
|
| **1** | 트리거 매칭 | ⚡ <1ms | 도구 이름과 트리거 키워드 정확 매칭 |
|
|
187
|
-
| **2** | 키워드
|
|
189
|
+
| **2** | BM25 키워드 | ⚡ 1-3ms | [Okapi BM25](https://en.wikipedia.org/wiki/Okapi_BM25) 랭킹 검색 — IDF 가중치 + 문서 길이 정규화 *(v3.4)* |
|
|
188
190
|
| **3** | 시맨틱 검색 | 🧠 5-15ms | 임베딩 벡터 유사도 검색 *(선택, Ollama 필요)* |
|
|
189
191
|
|
|
190
192
|
모든 단계의 결과를 병합 후 랭킹:
|
|
191
193
|
|
|
192
194
|
```
|
|
193
195
|
final_score = trigger_score × 3.0
|
|
194
|
-
+
|
|
196
|
+
+ bm25_keyword_score × 1.0
|
|
195
197
|
+ semantic_score × 2.0
|
|
196
198
|
+ log2(usage_count + 1) × 0.5
|
|
197
199
|
+ success_rate × 1.0
|
|
@@ -397,7 +399,7 @@ n2-qln/
|
|
|
397
399
|
│ ├── schema.js # 도구 스키마 정규화 + 검색 텍스트 빌더
|
|
398
400
|
│ ├── validator.js # 강제 검증 (이름, 설명, 카테고리)
|
|
399
401
|
│ ├── registry.js # 도구 CRUD + 사용량 추적 + 임베딩 캐시
|
|
400
|
-
│ ├── router.js # 3단계 검색 엔진
|
|
402
|
+
│ ├── router.js # 3단계 검색 엔진 (BM25 v3.4)
|
|
401
403
|
│ ├── vector-index.js # Float32 벡터 인덱스 (centroid hierarchy)
|
|
402
404
|
│ ├── embedding.js # Ollama 임베딩 클라이언트 (nomic-embed-text)
|
|
403
405
|
│ ├── executor.js # HTTP/함수 도구 실행기
|
package/README.md
CHANGED
|
@@ -29,7 +29,9 @@
|
|
|
29
29
|
|
|
30
30
|
🔍 **One tool to rule them all** — Your AI sees `n2_qln_call` (~200 tokens), not 1,000 individual tools. 99.6% context reduction.
|
|
31
31
|
|
|
32
|
-
⚡ **Sub-5ms search** — 3-stage search engine (trigger + keyword + semantic) finds the right tool in under 5ms, even with 1,000+ tools indexed.
|
|
32
|
+
⚡ **Sub-5ms search** — 3-stage search engine (trigger + BM25 keyword + semantic) finds the right tool in under 5ms, even with 1,000+ tools indexed.
|
|
33
|
+
|
|
34
|
+
🎯 **BM25 keyword ranking** *(v3.4)* — Stage 2 uses [Okapi BM25](https://en.wikipedia.org/wiki/Okapi_BM25) for keyword search. Rare terms score higher, document length is normalized. The same algorithm behind Google, Elasticsearch, and Wikipedia search.
|
|
33
35
|
|
|
34
36
|
📈 **Self-learning ranking** — Tools that get used more and succeed more are automatically ranked higher over time. No manual tuning needed.
|
|
35
37
|
|
|
@@ -184,14 +186,14 @@ QLN finds the right tool using three parallel search stages:
|
|
|
184
186
|
| Stage | Method | Speed | How it works |
|
|
185
187
|
|:---:|--------|:---:|------|
|
|
186
188
|
| **1** | Trigger Match | ⚡ <1ms | Matches exact words in tool names and trigger keywords |
|
|
187
|
-
| **2** | Keyword
|
|
189
|
+
| **2** | BM25 Keyword | ⚡ 1-3ms | [Okapi BM25](https://en.wikipedia.org/wiki/Okapi_BM25) ranked search — IDF weighting + document length normalization *(v3.4)* |
|
|
188
190
|
| **3** | Semantic Search | 🧠 5-15ms | Vector similarity using embeddings *(optional, requires Ollama)* |
|
|
189
191
|
|
|
190
192
|
Results from all stages are merged and ranked:
|
|
191
193
|
|
|
192
194
|
```
|
|
193
195
|
final_score = trigger_score × 3.0
|
|
194
|
-
+
|
|
196
|
+
+ bm25_keyword_score × 1.0
|
|
195
197
|
+ semantic_score × 2.0
|
|
196
198
|
+ log2(usage_count + 1) × 0.5
|
|
197
199
|
+ success_rate × 1.0
|
|
@@ -417,7 +419,7 @@ n2-qln/
|
|
|
417
419
|
│ ├── schema.js # Tool schema normalization + search text builder
|
|
418
420
|
│ ├── validator.js # Enforced validation (name, description, category)
|
|
419
421
|
│ ├── registry.js # Tool CRUD + usage tracking + embedding cache
|
|
420
|
-
│ ├── router.js # 3-stage parallel search engine
|
|
422
|
+
│ ├── router.js # 3-stage parallel search engine (BM25 v3.4)
|
|
421
423
|
│ ├── vector-index.js # Float32 vector index with centroid hierarchy
|
|
422
424
|
│ ├── embedding.js # Ollama embedding client (nomic-embed-text)
|
|
423
425
|
│ ├── executor.js # HTTP/function tool executor
|
package/lib/router.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// QLN — L1 Router (3-Stage parallel search engine)
|
|
2
|
-
// Query → Stage1(Trigger) + Stage2(Keyword) + Stage3(Semantic) → Merge → Top-K
|
|
2
|
+
// Query → Stage1(Trigger) + Stage2(BM25 Keyword) + Stage3(Semantic) → Merge → Top-K
|
|
3
3
|
const { buildSearchText } = require('./schema');
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* 3-Stage search engine.
|
|
7
7
|
*
|
|
8
8
|
* Score formula:
|
|
9
|
-
* final = trigger×3.0 +
|
|
9
|
+
* final = trigger×3.0 + bm25_keyword×1.0 + semantic×2.0
|
|
10
10
|
* + log2(usageCount+1)×0.5 + successRate×1.0
|
|
11
11
|
*/
|
|
12
12
|
class Router {
|
|
@@ -19,6 +19,15 @@ class Router {
|
|
|
19
19
|
this._registry = registry;
|
|
20
20
|
this._vectorIndex = vectorIndex;
|
|
21
21
|
this._embedding = embedding;
|
|
22
|
+
|
|
23
|
+
// BM25 parameters (standard Okapi BM25 defaults)
|
|
24
|
+
this._k1 = 1.2; // Term frequency saturation
|
|
25
|
+
this._b = 0.75; // Document length normalization
|
|
26
|
+
|
|
27
|
+
// IDF cache (rebuilt when tools change)
|
|
28
|
+
this._idfCache = new Map();
|
|
29
|
+
this._avgDocLen = 0;
|
|
30
|
+
this._idfDirty = true;
|
|
22
31
|
}
|
|
23
32
|
|
|
24
33
|
/**
|
|
@@ -34,14 +43,17 @@ class Router {
|
|
|
34
43
|
const timing = { stage1: 0, stage2: 0, stage3: 0, merge: 0, total: 0 };
|
|
35
44
|
const t0 = Date.now();
|
|
36
45
|
|
|
46
|
+
// Rebuild IDF if registry changed
|
|
47
|
+
if (this._idfDirty) this._buildIDF();
|
|
48
|
+
|
|
37
49
|
// Stage 1: Trigger exact match (fastest)
|
|
38
50
|
const t1 = Date.now();
|
|
39
51
|
this._stage1TriggerMatch(query, scores);
|
|
40
52
|
timing.stage1 = Date.now() - t1;
|
|
41
53
|
|
|
42
|
-
// Stage 2:
|
|
54
|
+
// Stage 2: BM25 keyword search
|
|
43
55
|
const t2 = Date.now();
|
|
44
|
-
this.
|
|
56
|
+
this._stage2BM25(query, scores);
|
|
45
57
|
timing.stage2 = Date.now() - t2;
|
|
46
58
|
|
|
47
59
|
// Stage 3: Semantic vector search (when embedding available)
|
|
@@ -73,20 +85,101 @@ class Router {
|
|
|
73
85
|
}
|
|
74
86
|
}
|
|
75
87
|
|
|
76
|
-
/** Stage 2:
|
|
77
|
-
|
|
78
|
-
const
|
|
88
|
+
/** Stage 2: BM25 keyword search. Weight: 1.0 */
|
|
89
|
+
_stage2BM25(query, scores) {
|
|
90
|
+
const queryTerms = this._tokenize(query);
|
|
91
|
+
if (queryTerms.length === 0) return;
|
|
92
|
+
|
|
79
93
|
for (const tool of this._registry.getAll()) {
|
|
80
94
|
const text = (tool.searchText || buildSearchText(tool)).toLowerCase();
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
95
|
+
const bm25 = this._bm25Score(queryTerms, text);
|
|
96
|
+
if (bm25 > 0) {
|
|
97
|
+
this._getOrCreate(scores, tool.name).stage2 = bm25 * 1.0;
|
|
84
98
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Calculate BM25 score for a query against a document.
|
|
104
|
+
* @param {string[]} queryTerms - Tokenized query terms
|
|
105
|
+
* @param {string} docText - Document text (lowercased)
|
|
106
|
+
* @returns {number} BM25 score
|
|
107
|
+
*/
|
|
108
|
+
_bm25Score(queryTerms, docText) {
|
|
109
|
+
const docTerms = docText.split(/[\s_\-./]+/).filter(w => w.length > 1);
|
|
110
|
+
const docLen = docTerms.length;
|
|
111
|
+
if (docLen === 0) return 0;
|
|
112
|
+
|
|
113
|
+
// Build term frequency map for this document
|
|
114
|
+
const tf = new Map();
|
|
115
|
+
for (const term of docTerms) {
|
|
116
|
+
tf.set(term, (tf.get(term) || 0) + 1);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
let score = 0;
|
|
120
|
+
for (const term of queryTerms) {
|
|
121
|
+
const idf = this._idfCache.get(term) || 0;
|
|
122
|
+
const freq = tf.get(term) || 0;
|
|
123
|
+
if (freq === 0) continue;
|
|
124
|
+
|
|
125
|
+
// BM25 formula: IDF × (f × (k1+1)) / (f + k1 × (1 - b + b × |d|/avgDL))
|
|
126
|
+
const numerator = freq * (this._k1 + 1);
|
|
127
|
+
const denominator = freq + this._k1 * (1 - this._b + this._b * (docLen / this._avgDocLen));
|
|
128
|
+
score += idf * (numerator / denominator);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
return score;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Build IDF cache from all registered tools.
|
|
136
|
+
* IDF(term) = ln((N - n(t) + 0.5) / (n(t) + 0.5) + 1)
|
|
137
|
+
* where N = total docs, n(t) = docs containing term
|
|
138
|
+
*/
|
|
139
|
+
_buildIDF() {
|
|
140
|
+
const tools = this._registry.getAll();
|
|
141
|
+
const N = tools.length;
|
|
142
|
+
if (N === 0) {
|
|
143
|
+
this._idfDirty = false;
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// Tokenize all documents and count document frequencies
|
|
148
|
+
const docFreq = new Map();
|
|
149
|
+
let totalLen = 0;
|
|
150
|
+
|
|
151
|
+
for (const tool of tools) {
|
|
152
|
+
const text = (tool.searchText || buildSearchText(tool)).toLowerCase();
|
|
153
|
+
const terms = text.split(/[\s_\-./]+/).filter(w => w.length > 1);
|
|
154
|
+
totalLen += terms.length;
|
|
155
|
+
|
|
156
|
+
// Unique terms per document
|
|
157
|
+
const uniqueTerms = new Set(terms);
|
|
158
|
+
for (const term of uniqueTerms) {
|
|
159
|
+
docFreq.set(term, (docFreq.get(term) || 0) + 1);
|
|
88
160
|
}
|
|
89
161
|
}
|
|
162
|
+
|
|
163
|
+
this._avgDocLen = totalLen / N;
|
|
164
|
+
|
|
165
|
+
// Calculate IDF for each term
|
|
166
|
+
this._idfCache.clear();
|
|
167
|
+
for (const [term, df] of docFreq) {
|
|
168
|
+
// BM25 IDF: ln((N - df + 0.5) / (df + 0.5) + 1)
|
|
169
|
+
const idf = Math.log((N - df + 0.5) / (df + 0.5) + 1);
|
|
170
|
+
this._idfCache.set(term, idf);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
this._idfDirty = false;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Tokenize query string into search terms.
|
|
178
|
+
* @param {string} query
|
|
179
|
+
* @returns {string[]}
|
|
180
|
+
*/
|
|
181
|
+
_tokenize(query) {
|
|
182
|
+
return query.toLowerCase().split(/[\s_\-./]+/).filter(w => w.length > 2);
|
|
90
183
|
}
|
|
91
184
|
|
|
92
185
|
/** Stage 3: Semantic vector search. Weight: 2.0 */
|
|
@@ -167,11 +260,17 @@ class Router {
|
|
|
167
260
|
return ranked;
|
|
168
261
|
}
|
|
169
262
|
|
|
170
|
-
/** Build vector index */
|
|
263
|
+
/** Build vector index and refresh IDF cache */
|
|
171
264
|
buildIndex() {
|
|
265
|
+
this._idfDirty = true;
|
|
172
266
|
return this._vectorIndex.build(this._registry.getAll());
|
|
173
267
|
}
|
|
174
268
|
|
|
269
|
+
/** Mark IDF cache as dirty (call after tool registration changes) */
|
|
270
|
+
invalidateIDF() {
|
|
271
|
+
this._idfDirty = true;
|
|
272
|
+
}
|
|
273
|
+
|
|
175
274
|
/** @private */
|
|
176
275
|
_getOrCreate(scores, name) {
|
|
177
276
|
if (!scores.has(name)) scores.set(name, { stage1: 0, stage2: 0, stage3: 0 });
|
|
@@ -184,8 +283,15 @@ class Router {
|
|
|
184
283
|
registrySize: this._registry.size,
|
|
185
284
|
vectorIndex: this._vectorIndex.stats(),
|
|
186
285
|
embeddingAvailable: !!this._embedding,
|
|
286
|
+
bm25: {
|
|
287
|
+
idfTerms: this._idfCache.size,
|
|
288
|
+
avgDocLen: Math.round(this._avgDocLen * 10) / 10,
|
|
289
|
+
k1: this._k1,
|
|
290
|
+
b: this._b,
|
|
291
|
+
},
|
|
187
292
|
};
|
|
188
293
|
}
|
|
189
294
|
}
|
|
190
295
|
|
|
191
296
|
module.exports = { Router };
|
|
297
|
+
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n2-qln",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.4.1",
|
|
4
4
|
"description": "Query Layer Network — Semantic tool dispatcher for MCP. Route 1000 tools through 1 router.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"llm"
|
|
24
24
|
],
|
|
25
25
|
"author": "N2",
|
|
26
|
-
"license": "
|
|
26
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
27
27
|
"repository": {
|
|
28
28
|
"type": "git",
|
|
29
29
|
"url": "git+https://github.com/choihyunsus/n2-QLN.git"
|