lingshu-solver 1.0.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 +206 -0
- package/LICENSE.md +53 -0
- package/README.md +236 -0
- package/index.html +11816 -0
- package/mcp-server.js +239 -0
- package/package.json +56 -0
- package/solver-core.js +117 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,206 @@
|
|
|
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 Derivative
|
|
95
|
+
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.
|
|
111
|
+
|
|
112
|
+
You may add Your own copyright statement to Your modifications and
|
|
113
|
+
may provide additional or different license terms and conditions
|
|
114
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
115
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
116
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
117
|
+
the conditions stated in this License.
|
|
118
|
+
|
|
119
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
120
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
121
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
122
|
+
this License, without any additional terms or conditions.
|
|
123
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
124
|
+
the terms of any separate license agreement you may have executed
|
|
125
|
+
with Licensor regarding such Contributions.
|
|
126
|
+
|
|
127
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
128
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
129
|
+
except as required for reasonable and customary use in describing the
|
|
130
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
131
|
+
|
|
132
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
133
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
134
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
135
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
136
|
+
implied, including, without limitation, any warranties or conditions
|
|
137
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
138
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
139
|
+
appropriateness of using or redistributing the Work and assume any
|
|
140
|
+
risks associated with Your exercise of permissions under this License.
|
|
141
|
+
|
|
142
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
143
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
144
|
+
unless required by applicable law (such as deliberate and grossly
|
|
145
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
146
|
+
liable to You for damages, including any direct, indirect, special,
|
|
147
|
+
incidental, or consequential damages of any character arising as a
|
|
148
|
+
result of this License or out of the use or inability to use the
|
|
149
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
150
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
151
|
+
other commercial damages or losses), even if such Contributor
|
|
152
|
+
has been advised of the possibility of such damages.
|
|
153
|
+
|
|
154
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
155
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
156
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
157
|
+
or other liability obligations and/or rights consistent with this
|
|
158
|
+
License. However, in accepting such obligations, You may act only
|
|
159
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
160
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
161
|
+
defend, and hold each Contributor harmless for any liability
|
|
162
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
163
|
+
of your accepting any such warranty or additional liability.
|
|
164
|
+
|
|
165
|
+
END OF TERMS AND CONDITIONS
|
|
166
|
+
|
|
167
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
168
|
+
|
|
169
|
+
To apply the Apache License to your work, attach the following
|
|
170
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
171
|
+
replaced with your own identifying information. (Don't include
|
|
172
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
173
|
+
comment syntax for the file format. We also recommend that a
|
|
174
|
+
file or class name and description of purpose be included on the
|
|
175
|
+
same "printed page" as the copyright notice for easier
|
|
176
|
+
identification within third-party archives.
|
|
177
|
+
|
|
178
|
+
Copyright [yyyy] [name of copyright owner]
|
|
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.
|
|
191
|
+
|
|
192
|
+
----------------------------------------------------------------------------
|
|
193
|
+
|
|
194
|
+
Copyright 2026 广州OPC(红尘灵境)
|
|
195
|
+
|
|
196
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
197
|
+
you may not use this file except in compliance with the License.
|
|
198
|
+
You may obtain a copy of the License at
|
|
199
|
+
|
|
200
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
201
|
+
|
|
202
|
+
Unless required by applicable law or agreed to in writing, software
|
|
203
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
204
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
205
|
+
See the License for the specific language governing permissions and
|
|
206
|
+
limitations under the License.
|
package/LICENSE.md
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# 灵数求解器 软件许可协议(草稿 / DRAFT)
|
|
2
|
+
|
|
3
|
+
> ⚠️ **本文件为法律文件草稿,须经执业律师复核并定稿后方可采用。** 以下是文本模板与条款框架,不代表已生效的法律意见。
|
|
4
|
+
|
|
5
|
+
**软件名称**:灵数求解器(Lingshu Solver)
|
|
6
|
+
**著作权人**:红尘灵境数字科技有限公司(以下简称"权利人")
|
|
7
|
+
**版本**:本仓库当前版本
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## 1. 许可授予
|
|
12
|
+
权利人在遵守本协议的条件下,授予使用者一项**有限的、非独占的、不可转让的、可撤销的**使用权,允许使用者:
|
|
13
|
+
1. 在自有设备上安装、运行本软件(包括但不限于单文件 HTML 形态);
|
|
14
|
+
2. 为内部研究、教学、工程计算目的使用本软件的输出结果;
|
|
15
|
+
3. 在保留本协议全部内容的前提下,复制并分发本软件的原始未修改副本。
|
|
16
|
+
|
|
17
|
+
## 2. 使用限制
|
|
18
|
+
未经权利人书面许可,使用者**不得**:
|
|
19
|
+
1. 对本软件进行反向工程、反编译或试图提取源代码(为互操作目的的法律例外除外);
|
|
20
|
+
2. 移除或遮盖本软件中的著作权、商标或许可声明;
|
|
21
|
+
3. 将本软件用于再许可、出租、托管为对外服务(SaaS)而未另行签约;
|
|
22
|
+
4. 将本软件或其输出用于**安全攸关(safety-critical)场景**(定义见第 6 条)。
|
|
23
|
+
|
|
24
|
+
## 3. 知识产权
|
|
25
|
+
本软件及其全部源代码、算法、文档、界面设计的著作权及相关知识产权均归权利人所有。本协议不授予任何明示或暗示的专利权许可。
|
|
26
|
+
|
|
27
|
+
## 4. 无担保(AS IS)
|
|
28
|
+
本软件按"现状"提供,**不附任何明示或暗示担保**,包括但不限于对**适销性、特定用途适用性、不侵权、结果准确性、结果完备性**的担保。权利人明确声明:
|
|
29
|
+
- 在给定计算预算内,本软件采用保守区间算术以尽量确保所有真解被包含于输出集合;
|
|
30
|
+
- 当计算资源(盒子数、分支预算、迭代次数)耗尽时,结果可能不完整,并将以 `truncated` / `UNKNOWN` 等状态字段显式标记;
|
|
31
|
+
- 使用者须自行验证输出是否满足其应用场景的精度与完备性要求。
|
|
32
|
+
|
|
33
|
+
## 5. 责任限制
|
|
34
|
+
在任何情况下,权利人对因使用或无法使用本软件所导致的**间接、偶然、特殊、后果性损害**(包括利润损失、数据损失、业务中断)不承担责任。权利人的累计赔偿责任不超过使用者为获取本软件所支付的对价(若免费获取,则上限为零)。
|
|
35
|
+
|
|
36
|
+
## 6. 禁止安全攸关用途
|
|
37
|
+
本软件**不得**用于任何安全攸关、生命健康、重大财产或公共利益攸关的场景,包括但不限于:
|
|
38
|
+
- 交通工具(汽车、航空、轨道交通)的控制或认证;
|
|
39
|
+
- 医疗器械、诊断或治疗决策;
|
|
40
|
+
- 工业控制系统、 nuclear/能源关键设施;
|
|
41
|
+
- 任何若结果错误可能导致人身伤害或重大损失的用途。
|
|
42
|
+
|
|
43
|
+
在上述场景中使用本软件,须改用经独立功能安全认证(如 ISO 26262 / IEC 61508)的专用版本,并取得权利人书面授权。在本协议签署时,**安全版本尚未通过前述认证**,故本条禁止具有现实约束力。
|
|
44
|
+
|
|
45
|
+
## 7. 终止
|
|
46
|
+
违反本协议任何条款,本许可自动终止,使用者须删除所有副本。
|
|
47
|
+
|
|
48
|
+
## 8. 适用法律与争议解决
|
|
49
|
+
本协议受中华人民共和国法律管辖。因本协议产生的争议,提交权利人所在地有管辖权的人民法院诉讼解决。
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
*草稿版本 v0.1 — 待执业律师复核。*
|
package/README.md
ADDED
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
# 灵数求解器 · Lingshu Solver
|
|
2
|
+
|
|
3
|
+
[](LICENSE)
|
|
4
|
+
[](https://github.com/genesis-plan/lingshu-solver/stargazers)
|
|
5
|
+
[](https://github.com/genesis-plan/lingshu-solver/commits)
|
|
6
|
+
[](https://modelcontextprotocol.io)
|
|
7
|
+
[](https://genesis-plan.github.io/lingshu-solver/)
|
|
8
|
+
|
|
9
|
+
> **确定性**实数方程组求解引擎 · 面向 AI 智能体与普通用户的 MCP 工具
|
|
10
|
+
> 同样的题永远得到同样的答案,没有大模型的随机与幻觉,每个解都能回代验证。免费、网页打开即用、也能被 AI 智能体直接调用。
|
|
11
|
+
|
|
12
|
+
灵数求解器(代号 Epsilon,V4.1)是一个**离线、确定性、零数据**的实数方程组求解器,
|
|
13
|
+
覆盖 ≤6 个变量、实数解、轻量数值定位。它不要求用户提供初值,采用区间算术做保守收缩 +
|
|
14
|
+
Krawczyk 算子做解认证,并尽力穷尽多解。
|
|
15
|
+
|
|
16
|
+
👉 **给用户看的产品介绍(大白话,帮你看懂它能干嘛、适不适合你)**:[点这里](intro.html) | [国内 COS 在线版](https://hclj-1409755229.cos.ap-guangzhou.myqcloud.com/lingshu-solver/intro.html)
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## 🚀 快速上手(30 秒)
|
|
21
|
+
|
|
22
|
+
### 如果你完全不懂技术 —— 直接用网页版
|
|
23
|
+
**打开这个链接就能用,不用安装任何东西:**
|
|
24
|
+
👉 **https://genesis-plan.github.io/lingshu-solver/** (GitHub Pages,海外/通用)
|
|
25
|
+
|
|
26
|
+
**国内用户(更快,腾讯云 COS 托管):**
|
|
27
|
+
👉 **https://hclj-1409755229.cos.ap-guangzhou.myqcloud.com/lingshu-solver/index.html**
|
|
28
|
+
|
|
29
|
+
在输入框写方程(例如 `x^2 + y^2 = 25` 和 `x + y = 7`),点求解即可。
|
|
30
|
+
页面里有 6 个示例按钮,点一下就知道它能解什么。
|
|
31
|
+
|
|
32
|
+
### 如果你是 AI 用户(Claude / Cursor / Cline 等)
|
|
33
|
+
|
|
34
|
+
**方式 A · 远程托管(零安装,免密即用)**
|
|
35
|
+
我们已部署常驻公网服务,直接填 URL 即可,无需本机装 Node:
|
|
36
|
+
```json
|
|
37
|
+
{
|
|
38
|
+
"mcpServers": {
|
|
39
|
+
"lingshu-solver": {
|
|
40
|
+
"url": "http://159.75.154.206:3000/mcp"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
> 端点:`http://159.75.154.206:3000/mcp`(Streamable HTTP)。服务运行于腾讯云轻量服务器,开机自启、崩溃自动拉起。
|
|
46
|
+
> ⚠️ 当前为**裸 IP + HTTP 临时端点**,`hongchenlingjing.com` 备案通过后我们将切换为 `https://hongchenlingjing.com/mcp` 固定 HTTPS 域名(届时更新此处)。此临时端点可用于对接测试,Smithery 等需 HTTPS 的平台待备案后正式接入。
|
|
47
|
+
|
|
48
|
+
**方式 B · 本地 stdio(需本机 Node)**
|
|
49
|
+
```json
|
|
50
|
+
{
|
|
51
|
+
"mcpServers": {
|
|
52
|
+
"lingshu-solver": {
|
|
53
|
+
"command": "npx",
|
|
54
|
+
"args": ["-y", "lingshu-solver"]
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
> `npx` 版需本包发布到 npm 后可用;npm 账号已就绪,即将发布,发布后即可一键 `npx -y lingshu-solver`。在此之前可先 `git clone` 后用方式 C。
|
|
60
|
+
|
|
61
|
+
**方式 C · 本地 clone + 指定路径**
|
|
62
|
+
```bash
|
|
63
|
+
git clone https://github.com/genesis-plan/lingshu-solver.git
|
|
64
|
+
cd lingshu-solver
|
|
65
|
+
node mcp-server.js
|
|
66
|
+
```
|
|
67
|
+
MCP 配置:
|
|
68
|
+
```json
|
|
69
|
+
{ "mcpServers": { "lingshu-solver": { "command": "node", "args": ["本地绝对路径/灵数求解器/mcp-server.js"] } } }
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### 如果你是开发者
|
|
73
|
+
```bash
|
|
74
|
+
git clone https://github.com/genesis-plan/lingshu-solver.git
|
|
75
|
+
cd lingshu-solver
|
|
76
|
+
node mcp-server.js # 启动 MCP 服务端
|
|
77
|
+
node test/regression.js # 跑回归测试(28 用例)
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
本仓库包含:
|
|
83
|
+
- `index.html` —— 单文件产品(浏览器内 UI + 已验证核心脚本 `<script id="solver-core">`)
|
|
84
|
+
- `solver-core.js` —— Node 引擎加载器(读取 index.html 核心脚本,零依赖,供 MCP/测试复用)
|
|
85
|
+
- `mcp-server.js` —— 零依赖 MCP stdio 服务端(手工 JSON-RPC 2.0 + 换行符分隔 JSON,与官方 MCP SDK 线格式对齐)
|
|
86
|
+
- `package.json` —— 标准元数据,`node mcp-server.js` 本地启动即作为 MCP 工具(发布 npm 后亦可 `npx lingshu-solver`)
|
|
87
|
+
- `test/` —— 回归套件 + 冒烟测试 + 三套常驻考卷
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## 能力边界(诚实声明)
|
|
92
|
+
|
|
93
|
+
| 维度 | 说明 |
|
|
94
|
+
|---|---|
|
|
95
|
+
| 已验证解 | 每个找到的解都经 Krawczyk 认证(`tier=proven`),误差 ≤ 认证半径,数学保真 |
|
|
96
|
+
| 穷尽性 | **尽力穷尽多解**;极端病态(雅可比高度奇异、解簇极近)在预算内可能遗漏个别解,此时显式标记 `truncated=true`,**绝不谎称已穷尽** |
|
|
97
|
+
| `truncated` 语义 | 仅表示「全局分支未在预算内完全判定所有盒子(无法证明已穷尽)」,**不等于一定遗漏**;绝大多数情况全部真解已找到 |
|
|
98
|
+
| 变量数 | ≤6 |
|
|
99
|
+
| 数值范围 | 默认搜索域 ±1e6;对快增长函数(exp/sinh)或大域,建议显式给定 `domain` 以避免剪枝失效 |
|
|
100
|
+
| 确定性 | 无随机分支,同输入永远同输出 |
|
|
101
|
+
| 部署 | 纯本地、离线、零数据(无网络、无存储、无第三方依赖) |
|
|
102
|
+
|
|
103
|
+
**不保证**:对一切输入 100% 穷尽;对高度病态系统在预算内必收敛。这些是诚实边界,不是缺陷。
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## 作为 MCP 工具使用
|
|
108
|
+
|
|
109
|
+
### 1. 三种接入形态
|
|
110
|
+
|
|
111
|
+
| 形态 | 端点 / 命令 | 适用 |
|
|
112
|
+
|---|---|---|
|
|
113
|
+
| **远程 HTTP(已上线)** | `http://159.75.154.206:3000/mcp` | 任何支持 Streamable HTTP 的 MCP 客户端,零安装 |
|
|
114
|
+
| 本地 stdio(npx) | `npx -y lingshu-solver` | 本机已装 Node,npm 发布后可用 |
|
|
115
|
+
| 本地 stdio(clone) | `node mcp-server.js` | 开发者 / 离线自托管 |
|
|
116
|
+
|
|
117
|
+
**远程 HTTP 服务端代码**:`http-mcp-server.js`(零依赖,仅用 Node 内置模块;与 `mcp-server.js` 共享 `solver-core.js` 求解核心,结果同源一致)。如需自托管远程服务:
|
|
118
|
+
```bash
|
|
119
|
+
PORT=3000 node http-mcp-server.js
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### 2. 在 MCP 客户端(Claude Desktop / Cursor / Cline / VS Code 等)配置
|
|
123
|
+
|
|
124
|
+
**推荐 · 远程托管(零安装,已上线):**
|
|
125
|
+
```json
|
|
126
|
+
{
|
|
127
|
+
"mcpServers": {
|
|
128
|
+
"lingshu-solver": {
|
|
129
|
+
"url": "http://159.75.154.206:3000/mcp"
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
**本地 stdio · 一行命令(npm 发布后可用;npm 账号已就绪,即将发布):**
|
|
136
|
+
```json
|
|
137
|
+
{
|
|
138
|
+
"mcpServers": {
|
|
139
|
+
"lingshu-solver": {
|
|
140
|
+
"command": "npx",
|
|
141
|
+
"args": ["-y", "lingshu-solver"]
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
```
|
|
146
|
+
> 注:`npx lingshu-solver` 需本包发布到 npm 后可用;npm 账号已就绪,即将发布。在此之前请用下方「手动指定本地路径」版(先 clone 仓库)。
|
|
147
|
+
|
|
148
|
+
**备选 · 手动指定本地路径(已 clone 仓库时):**
|
|
149
|
+
```json
|
|
150
|
+
{
|
|
151
|
+
"mcpServers": {
|
|
152
|
+
"lingshu-solver": {
|
|
153
|
+
"command": "node",
|
|
154
|
+
"args": ["把这里替换成你本地的绝对路径/灵数求解器/mcp-server.js"]
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
> 手动版需将 `args` 中的路径替换为你本机的 `mcp-server.js` 绝对路径(例如 `C:/Users/你的用户名/Desktop/灵数求解器/mcp-server.js`)。npx 版无需此步。
|
|
161
|
+
|
|
162
|
+
### 工具一:`solve`
|
|
163
|
+
|
|
164
|
+
输入:
|
|
165
|
+
```json
|
|
166
|
+
{
|
|
167
|
+
"equations": ["x^2 + y^2 = 25", "x + y = 7"],
|
|
168
|
+
"variables": ["x", "y"],
|
|
169
|
+
"domain": { "x": [-30, 30], "y": [-30, 30] }
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
- `equations`:方程字符串数组(必填),支持 `+ - * / ^ sqrt log sin cos tan exp abs`,以及 in-text 域约束 `"x ∈ [-30,30]"`。
|
|
173
|
+
- `variables`:变量名数组(可选,不填则按出现顺序自动识别,最多 6 个)。
|
|
174
|
+
- `domain`:显式搜索域(可选)。**对"有限解·部分"演示或快增长函数建议给定**,否则默认 ±1e6 可能剪枝失效并触发 `truncated`。
|
|
175
|
+
|
|
176
|
+
> 输出精度固定 6 位小数(产品规格「6位小数有限网格」),不提供位数切换;解点 `values` 经网格吸附,实际残差通常 ≤ 1e-9。
|
|
177
|
+
|
|
178
|
+
输出(节选):
|
|
179
|
+
```json
|
|
180
|
+
{
|
|
181
|
+
"resultType": 2,
|
|
182
|
+
"resultTypeName": "finite",
|
|
183
|
+
"certified": true,
|
|
184
|
+
"truncated": false,
|
|
185
|
+
"precisionDecimals": 6,
|
|
186
|
+
"solutionCount": 2,
|
|
187
|
+
"recommended": { "values": [3, 4], "tier": "proven", "residual": 0 },
|
|
188
|
+
"solutions": [ { "values": [3, 4], "tier": "proven", "residual": 0 }, ... ],
|
|
189
|
+
"warnings": []
|
|
190
|
+
}
|
|
191
|
+
```
|
|
192
|
+
- `resultType`:`1=empty(无解)` / `2=finite(有限解)` / `3=infinite(无限解集,仅给距原点最近的推荐解)`。
|
|
193
|
+
- `tier`:`proven`(Krawczyk 认证)/ `candidate`(未证但可能为解)/ `structural`(结构推导)。
|
|
194
|
+
|
|
195
|
+
### 工具二:`give_feedback`
|
|
196
|
+
|
|
197
|
+
AI 智能体遇到卡点/错误/疑似问题时主动回报,仅落本地 `feedback.log`,不外传:
|
|
198
|
+
```json
|
|
199
|
+
{ "name": "give_feedback", "arguments": { "message": "x^2=4 期望2解", "context": "批量求解场景" } }
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
## 本地验证
|
|
205
|
+
|
|
206
|
+
```bash
|
|
207
|
+
node verify_core.js # 引擎加载 + 6 个代表性用例
|
|
208
|
+
node mcp_smoke.js # MCP 字节级冒烟(initialize/tools/list/tools/call)
|
|
209
|
+
node mcp_smoke2.js # give_feedback + 错误结构化(不泄露堆栈)
|
|
210
|
+
node test/regression.js # 三套常驻考卷回归(28 用例,known 命中率统计)
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
---
|
|
214
|
+
|
|
215
|
+
## 示例(6 类结果覆盖)
|
|
216
|
+
|
|
217
|
+
| 标题 | 方程 | 预期 |
|
|
218
|
+
|---|---|---|
|
|
219
|
+
| 最少 1 变量 | `x^2 = 4` | 2 解 |
|
|
220
|
+
| 最多 6 变量 | 6 元三对角线性 | 唯一解 |
|
|
221
|
+
| 空集无解 | `x+y=3` 与 `x+y=5` | 空集(sound 证无解) |
|
|
222
|
+
| 有限解·全部 | 圆 × 双曲线 `x²+y²=4, xy=1` | 4 解全认证 |
|
|
223
|
+
| 有限解·部分 | `sin(20x)=0.5, sin(20y)=0.5`(域 [-30,30]) | 多解 + `truncated` 横幅 |
|
|
224
|
+
| 无限解·推荐 | `x+y=3` | 无限集,推荐 (1.5,1.5) |
|
|
225
|
+
|
|
226
|
+
---
|
|
227
|
+
|
|
228
|
+
## 文档
|
|
229
|
+
|
|
230
|
+
- 《灵数求解器_代码流程中文说明.md》—— 从解析到输出的完整内部流程(面向数学背景读者)
|
|
231
|
+
- 《灵数求解器商业化战略白皮书.md》—— 定位、能力边界、风险
|
|
232
|
+
- 发明专利申请书系列(已提交)
|
|
233
|
+
|
|
234
|
+
## 许可
|
|
235
|
+
|
|
236
|
+
Apache License 2.0 —— 见 [LICENSE](./LICENSE)。
|