@cyanheads/calculator-mcp-server 0.3.5 → 0.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/AGENTS.md +20 -17
- package/CLAUDE.md +20 -17
- package/Dockerfile +14 -10
- package/LICENSE +1 -1
- package/README.md +42 -3
- package/changelog/0.1.x/0.1.0.md +20 -0
- package/changelog/0.1.x/0.1.1.md +28 -0
- package/changelog/0.1.x/0.1.10.md +25 -0
- package/changelog/0.1.x/0.1.11.md +29 -0
- package/changelog/0.1.x/0.1.12.md +21 -0
- package/changelog/0.1.x/0.1.13.md +20 -0
- package/changelog/0.1.x/0.1.14.md +18 -0
- package/changelog/0.1.x/0.1.15.md +20 -0
- package/changelog/0.1.x/0.1.16.md +26 -0
- package/changelog/0.1.x/0.1.17.md +24 -0
- package/changelog/0.1.x/0.1.18.md +21 -0
- package/changelog/0.1.x/0.1.19.md +18 -0
- package/changelog/0.1.x/0.1.2.md +22 -0
- package/changelog/0.1.x/0.1.20.md +21 -0
- package/changelog/0.1.x/0.1.21.md +26 -0
- package/changelog/0.1.x/0.1.22.md +33 -0
- package/changelog/0.1.x/0.1.23.md +32 -0
- package/changelog/0.1.x/0.1.24.md +16 -0
- package/changelog/0.1.x/0.1.25.md +23 -0
- package/changelog/0.1.x/0.1.26.md +16 -0
- package/changelog/0.1.x/0.1.3.md +19 -0
- package/changelog/0.1.x/0.1.4.md +20 -0
- package/changelog/0.1.x/0.1.5.md +19 -0
- package/changelog/0.1.x/0.1.6.md +26 -0
- package/changelog/0.1.x/0.1.7.md +19 -0
- package/changelog/0.1.x/0.1.8.md +18 -0
- package/changelog/0.1.x/0.1.9.md +29 -0
- package/changelog/0.2.x/0.2.0.md +18 -0
- package/changelog/0.3.x/0.3.0.md +19 -0
- package/changelog/0.3.x/0.3.1.md +30 -0
- package/changelog/0.3.x/0.3.2.md +18 -0
- package/changelog/0.3.x/0.3.3.md +27 -0
- package/changelog/0.3.x/0.3.4.md +17 -0
- package/changelog/0.3.x/0.3.5.md +23 -0
- package/changelog/0.4.x/0.4.0.md +28 -0
- package/changelog/0.4.x/0.4.1.md +28 -0
- package/changelog/template.md +168 -0
- package/dist/mcp-server/resources/definitions/help.resource.d.ts.map +1 -1
- package/dist/mcp-server/resources/definitions/help.resource.js +1 -0
- package/dist/mcp-server/resources/definitions/help.resource.js.map +1 -1
- package/dist/mcp-server/tools/definitions/calculate.tool.d.ts +8 -3
- package/dist/mcp-server/tools/definitions/calculate.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/calculate.tool.js +8 -2
- package/dist/mcp-server/tools/definitions/calculate.tool.js.map +1 -1
- package/dist/services/math/math-service.d.ts +6 -1
- package/dist/services/math/math-service.d.ts.map +1 -1
- package/dist/services/math/math-service.js +48 -15
- package/dist/services/math/math-service.js.map +1 -1
- package/package.json +23 -13
- package/server.json +3 -3
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
---
|
|
2
|
+
summary: "MCP SDK v2 compatibility with strict tool inputs, declared error envelopes, 2026 protocol support, and a 24-hour public cache hint for calculator help."
|
|
3
|
+
breaking: false
|
|
4
|
+
security: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# 0.4.1 — 2026-08-22
|
|
8
|
+
|
|
9
|
+
## Changed
|
|
10
|
+
|
|
11
|
+
- **MCP protocol** — `@cyanheads/mcp-ts-core` now serves protocol revision 2026-07-28 while retaining compatibility with 2025-era clients.
|
|
12
|
+
- **`calculate` input and error contracts** — undeclared root fields are rejected, and the advertised output schema includes the structured error envelope so validating clients accept failed calls.
|
|
13
|
+
- **`calculator://help`** — advertises a public 24-hour cache hint to 2026-era clients.
|
|
14
|
+
- **Bun 1.4 container** — the build stage targets `BUILDPLATFORM`; the production image omits optional peers and lifecycle scripts while retaining optional OpenTelemetry installation.
|
|
15
|
+
- **Supply-chain and typecheck gates** — installs use the three-day release hold and Socket scanner, while the TypeScript 7 configuration includes the test tree.
|
|
16
|
+
- **Project templates** — framework skills, build scripts, package metadata, and community-health files are synced to the current scaffold.
|
|
17
|
+
|
|
18
|
+
## Dependencies
|
|
19
|
+
|
|
20
|
+
- `@cyanheads/mcp-ts-core` `^0.10.10` → `^0.12.3`
|
|
21
|
+
- `@biomejs/biome` `^2.5.2` → `^2.5.9`
|
|
22
|
+
- `@socketsecurity/bun-security-scanner` added at `^1.1.2`
|
|
23
|
+
- `@types/node` `^26.1.0` → `^26.2.0`
|
|
24
|
+
- `ignore` `^7.0.5` → `^7.0.6`
|
|
25
|
+
- `tsc-alias` `^1.8.17` → `^1.9.2`
|
|
26
|
+
- `tsx` `^4.22.4` removed
|
|
27
|
+
- `typescript` `^6.0.3` → `^7.0.2`
|
|
28
|
+
- `vitest` `^4.1.9` → `^4.1.11`
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
---
|
|
2
|
+
# FORMAT REFERENCE — do not edit. Copy this file to
|
|
3
|
+
# `changelog/<major.minor>.x/<version>.md` (e.g. `changelog/0.8.x/0.8.6.md`)
|
|
4
|
+
# to author a new release. Set that file's H1 to `# <version> — YYYY-MM-DD`
|
|
5
|
+
# with a concrete date.
|
|
6
|
+
|
|
7
|
+
# Required. One-line GitHub Release-style headline. 350 character cap — a
|
|
8
|
+
# ceiling, not a target. Default short and scannable. Don't pad, don't stitch
|
|
9
|
+
# unrelated changes with commas/semicolons into an inventory — pick the
|
|
10
|
+
# headline, like a tag's theme line. Quotes required: unquoted YAML treats
|
|
11
|
+
# `: ` inside the value as a key separator and fails GitHub's strict parser.
|
|
12
|
+
summary: ""
|
|
13
|
+
|
|
14
|
+
# Set `true` when consumers must change code to upgrade: API removals,
|
|
15
|
+
# signature changes, config renames, behavior changes that break existing
|
|
16
|
+
# usage. Flagged as `Breaking` in the rollup.
|
|
17
|
+
breaking: false
|
|
18
|
+
|
|
19
|
+
# Set `true` ONLY for a security fix in THIS project's own source code — a
|
|
20
|
+
# vulnerability or hardening in code you ship. A dependency or transitive CVE
|
|
21
|
+
# bump is routine maintenance, NOT a security release: record it under
|
|
22
|
+
# `## Dependencies` (with the advisory ID) and leave this `false`. When true,
|
|
23
|
+
# pairs with the `## Security` section below and flags `Security` in the rollup.
|
|
24
|
+
security: false
|
|
25
|
+
|
|
26
|
+
# Optional free-form notes for maintenance agents processing this release.
|
|
27
|
+
# Not rendered in CHANGELOG — consumed by agents running `maintenance` on
|
|
28
|
+
# downstream servers. ADOPTION STEPS ONLY — new files to create, fields to
|
|
29
|
+
# populate, one-time migration steps. Never a second rendering of the body:
|
|
30
|
+
# if a body bullet already says it, name the bullet's symbol instead of
|
|
31
|
+
# re-explaining. Omit the field entirely when there's nothing to say.
|
|
32
|
+
# agent-notes: |
|
|
33
|
+
# <instructions for downstream maintenance agents>
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
# <version> — YYYY-MM-DD
|
|
37
|
+
|
|
38
|
+
<!--
|
|
39
|
+
AUTHORING GUIDE — applies to the new per-version file you create from this
|
|
40
|
+
template.
|
|
41
|
+
|
|
42
|
+
Audience: someone scanning release notes to decide what affects them. Lead
|
|
43
|
+
each bullet with the symbol or concept name in **bold** so they can skip
|
|
44
|
+
what's irrelevant and zoom in on what's not.
|
|
45
|
+
|
|
46
|
+
Tone: terse, fact-dense, not verbose. Bullet shape: **symbol** + what
|
|
47
|
+
changed + at most one consumer-facing caveat. One sentence by default, two
|
|
48
|
+
when the second carries weight — a bullet past ~40 words or three sentences
|
|
49
|
+
is wrong. The depth lives one hop away: the linked issue carries the why,
|
|
50
|
+
the commit diff carries the how. The changelog names what changed and what
|
|
51
|
+
a consumer does about it; a reader who wants mechanism opens the link.
|
|
52
|
+
|
|
53
|
+
Model length on THIS guide, never on the previous entry — entries modeled
|
|
54
|
+
on entries compound.
|
|
55
|
+
|
|
56
|
+
Cut (each has shipped as a wall of text; these are the cruft):
|
|
57
|
+
- History/justification narration — how the bug worked, why the old
|
|
58
|
+
behavior was wrong. One short clause at most; the issue carries the story.
|
|
59
|
+
- Design-rationale defense — "chosen over Y because…", "guarding the
|
|
60
|
+
getter is not enough…". That is the author arguing with a reviewer;
|
|
61
|
+
reviewers read the PR, not the changelog.
|
|
62
|
+
- Defensive unchanged-clauses — "X is unchanged", "byte-identical to
|
|
63
|
+
<prev>". Keep one only where its absence would cause a real misread,
|
|
64
|
+
as a short parenthetical.
|
|
65
|
+
- Edge-case inventories — marker lists, not-flagged lists, escape tables.
|
|
66
|
+
Tests and the issue carry those.
|
|
67
|
+
- Mechanism walkthroughs (JSDoc, CLAUDE.md/AGENTS.md, or the relevant
|
|
68
|
+
skill own those), ceremonial framings ("This release introduces…"),
|
|
69
|
+
backwards-compat paragraphs, file-by-file test enumerations. Prefer
|
|
70
|
+
code/symbol names over English re-explanations.
|
|
71
|
+
|
|
72
|
+
Verified ≠ included: the every-claim-verified-from-the-diff rule bounds
|
|
73
|
+
the TRUTH of what you write, never the AMOUNT.
|
|
74
|
+
|
|
75
|
+
Example — same fact, right size:
|
|
76
|
+
|
|
77
|
+
TOO LONG: **`fetchWithTimeout`'s `timeoutMs` bounds the whole exchange**
|
|
78
|
+
(#341). `fetch` resolves once headers arrive and the deadline was
|
|
79
|
+
cleared as the helper returned, so a peer that answered promptly and
|
|
80
|
+
then stalled the stream held the request open indefinitely. A 2xx
|
|
81
|
+
carrying a body now comes back as a passthrough wrapper that disarms
|
|
82
|
+
the deadline when the body closes, errors, or is cancelled; …
|
|
83
|
+
[+90 more words of mechanism and edge cases]
|
|
84
|
+
|
|
85
|
+
RIGHT: **`fetchWithTimeout`'s `timeoutMs` now bounds the whole
|
|
86
|
+
exchange, not just the headers** (#341). A stalled body aborts with
|
|
87
|
+
the same `Timeout` error; the returned `Response` is a wrapper, so
|
|
88
|
+
identity assertions (`toBe(response)`) no longer hold.
|
|
89
|
+
|
|
90
|
+
Narrative intro: skip by default. Add one short sentence only when the
|
|
91
|
+
release theme genuinely needs framing the bullets can't carry. When many
|
|
92
|
+
bullets share one upgrade consequence, state it ONCE — intro line or
|
|
93
|
+
agent-notes — never per bullet.
|
|
94
|
+
|
|
95
|
+
Sections: Keep a Changelog order — Added, Changed, Deprecated, Removed,
|
|
96
|
+
Fixed, Security. Include only sections with entries; delete the rest
|
|
97
|
+
(including the commented-out scaffolding below). Don't ship empty headers.
|
|
98
|
+
|
|
99
|
+
Include: every distinct fact a reader needs to adopt or audit the release —
|
|
100
|
+
new exports, signatures, lint rule IDs, env vars, breaking changes, version
|
|
101
|
+
bumps on shipped skills. Nothing more.
|
|
102
|
+
|
|
103
|
+
Links: link issues, PRs, docs, or skills where they help a reader jump to
|
|
104
|
+
context. Once per item per entry — don't re-link the same issue in summary,
|
|
105
|
+
narrative, and bullet. Skip links for inline symbol names; code spans speak
|
|
106
|
+
for themselves.
|
|
107
|
+
|
|
108
|
+
Issue/PR URLs: use full URLs. GitHub's bare `#NN` auto-link only resolves
|
|
109
|
+
inside its own UI, not in npm reads or local editors.
|
|
110
|
+
|
|
111
|
+
[#38](https://github.com/cyanheads/mcp-ts-core/issues/38) ← issue
|
|
112
|
+
[#42](https://github.com/cyanheads/mcp-ts-core/pull/42) ← PR
|
|
113
|
+
|
|
114
|
+
Verify numbers exist before linking (`gh issue view NN`, `gh pr view NN`).
|
|
115
|
+
Never speculate on a future number — `#42` for an upcoming PR silently
|
|
116
|
+
resolves to whatever real item already owns 42, and timeline previews pull
|
|
117
|
+
in that unrelated item's metadata.
|
|
118
|
+
|
|
119
|
+
TAG ANNOTATIONS — the annotated tag body renders as the GitHub Release body
|
|
120
|
+
via `gh release create --notes-from-tag`. The tag is a derivative of this
|
|
121
|
+
changelog entry — a condensed, scannable version, not a copy. Format:
|
|
122
|
+
|
|
123
|
+
<theme — omit version number, GitHub prepends it>
|
|
124
|
+
← blank line
|
|
125
|
+
<1-2 sentence context: what this release does>
|
|
126
|
+
← blank line
|
|
127
|
+
Dependency bumps: ← section header
|
|
128
|
+
← blank line
|
|
129
|
+
- `@cyanheads/mcp-ts-core` ^0.9.1 → ^0.9.6 ← bullet
|
|
130
|
+
← blank line
|
|
131
|
+
Changed: ← only sections with entries
|
|
132
|
+
← blank line
|
|
133
|
+
- `format()` output includes `query` in text mode
|
|
134
|
+
← blank line
|
|
135
|
+
Added:
|
|
136
|
+
← blank line
|
|
137
|
+
- `manifest.json` scaffolded for MCPB bundle support
|
|
138
|
+
- Install badges (Claude Desktop, Cursor, VS Code)
|
|
139
|
+
← blank line
|
|
140
|
+
<N> tests pass; `bun run devcheck` clean. ← footer
|
|
141
|
+
|
|
142
|
+
Never a flat comma-separated string. Always structured markdown with
|
|
143
|
+
sections. The tag must scan well as a rendered GitHub Release page.
|
|
144
|
+
-->
|
|
145
|
+
|
|
146
|
+
## Added
|
|
147
|
+
|
|
148
|
+
-
|
|
149
|
+
|
|
150
|
+
## Changed
|
|
151
|
+
|
|
152
|
+
-
|
|
153
|
+
|
|
154
|
+
<!-- ## Deprecated
|
|
155
|
+
|
|
156
|
+
- -->
|
|
157
|
+
|
|
158
|
+
<!-- ## Removed
|
|
159
|
+
|
|
160
|
+
- -->
|
|
161
|
+
|
|
162
|
+
## Fixed
|
|
163
|
+
|
|
164
|
+
-
|
|
165
|
+
|
|
166
|
+
<!-- ## Security
|
|
167
|
+
|
|
168
|
+
- -->
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"help.resource.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/resources/definitions/help.resource.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,eAAO,MAAM,YAAY;;
|
|
1
|
+
{"version":3,"file":"help.resource.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/resources/definitions/help.resource.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,eAAO,MAAM,YAAY;;wDAYvB,CAAC"}
|
|
@@ -8,6 +8,7 @@ export const helpResource = resource('calculator://help', {
|
|
|
8
8
|
name: 'Calculator Help',
|
|
9
9
|
description: 'Available functions, operators, constants, and syntax reference.',
|
|
10
10
|
mimeType: 'text/markdown',
|
|
11
|
+
cacheHint: { ttlMs: 86_400_000, cacheScope: 'public' },
|
|
11
12
|
// Override the auto-derived view-source URL — `calculator://help` doesn't
|
|
12
13
|
// kebab-mirror to `help.resource.ts`. See cyanheads/mcp-ts-core#42.
|
|
13
14
|
sourceUrl: 'https://github.com/cyanheads/calculator-mcp-server/blob/main/src/mcp-server/resources/definitions/help.resource.ts',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"help.resource.js","sourceRoot":"","sources":["../../../../src/mcp-server/resources/definitions/help.resource.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEjE,MAAM,CAAC,MAAM,YAAY,GAAG,QAAQ,CAAC,mBAAmB,EAAE;IACxD,IAAI,EAAE,iBAAiB;IACvB,WAAW,EAAE,kEAAkE;IAC/E,QAAQ,EAAE,eAAe;IACzB,0EAA0E;IAC1E,oEAAoE;IACpE,SAAS,EACP,oHAAoH;IACtH,OAAO;QACL,OAAO,cAAc,EAAE,CAAC,cAAc,EAAE,CAAC;IAC3C,CAAC;CACF,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"help.resource.js","sourceRoot":"","sources":["../../../../src/mcp-server/resources/definitions/help.resource.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEjE,MAAM,CAAC,MAAM,YAAY,GAAG,QAAQ,CAAC,mBAAmB,EAAE;IACxD,IAAI,EAAE,iBAAiB;IACvB,WAAW,EAAE,kEAAkE;IAC/E,QAAQ,EAAE,eAAe;IACzB,SAAS,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE;IACtD,0EAA0E;IAC1E,oEAAoE;IACpE,SAAS,EACP,oHAAoH;IACtH,OAAO;QACL,OAAO,cAAc,EAAE,CAAC,cAAc,EAAE,CAAC;IAC3C,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -8,26 +8,26 @@ import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
|
8
8
|
export declare const calculateTool: import("@cyanheads/mcp-ts-core").ToolDefinition<z.ZodObject<{
|
|
9
9
|
expression: z.ZodString;
|
|
10
10
|
operation: z.ZodDefault<z.ZodEnum<{
|
|
11
|
+
derivative: "derivative";
|
|
11
12
|
evaluate: "evaluate";
|
|
12
13
|
simplify: "simplify";
|
|
13
|
-
derivative: "derivative";
|
|
14
14
|
}>>;
|
|
15
15
|
variable: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"">, z.ZodString]>>;
|
|
16
16
|
scope: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
17
17
|
precision: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"">, z.ZodNumber]>>;
|
|
18
18
|
numericType: z.ZodDefault<z.ZodEnum<{
|
|
19
|
-
number: "number";
|
|
20
19
|
BigNumber: "BigNumber";
|
|
21
20
|
Fraction: "Fraction";
|
|
21
|
+
number: "number";
|
|
22
22
|
}>>;
|
|
23
23
|
}, z.core.$strip>, z.ZodObject<{
|
|
24
24
|
result: z.ZodString;
|
|
25
25
|
resultType: z.ZodString;
|
|
26
26
|
expression: z.ZodString;
|
|
27
27
|
operation: z.ZodEnum<{
|
|
28
|
+
derivative: "derivative";
|
|
28
29
|
evaluate: "evaluate";
|
|
29
30
|
simplify: "simplify";
|
|
30
|
-
derivative: "derivative";
|
|
31
31
|
}>;
|
|
32
32
|
scopeVars: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
33
33
|
precisionUsed: z.ZodOptional<z.ZodNumber>;
|
|
@@ -67,6 +67,11 @@ export declare const calculateTool: import("@cyanheads/mcp-ts-core").ToolDefinit
|
|
|
67
67
|
readonly code: JsonRpcErrorCode.ValidationError;
|
|
68
68
|
readonly when: "Expression evaluated to Infinity, -Infinity, or NaN (e.g., division by zero).";
|
|
69
69
|
readonly recovery: "Check for division by zero, log of non-positive numbers, or other undefined operations.";
|
|
70
|
+
}, {
|
|
71
|
+
readonly reason: "fraction_unsupported";
|
|
72
|
+
readonly code: JsonRpcErrorCode.ValidationError;
|
|
73
|
+
readonly when: "numericType is \"Fraction\" but the expression has no exact rational value (irrational or transcendental result, e.g. sqrt, sin, log).";
|
|
74
|
+
readonly recovery: "Retry with numericType \"number\" or \"BigNumber\" — those represent irrational and transcendental results.";
|
|
70
75
|
}, {
|
|
71
76
|
readonly reason: "parse_failed";
|
|
72
77
|
readonly code: JsonRpcErrorCode.ValidationError;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calculate.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/calculate.tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAGjE,eAAO,MAAM,aAAa
|
|
1
|
+
{"version":3,"file":"calculate.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/calculate.tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAGjE,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAiPxB,CAAC"}
|
|
@@ -17,7 +17,7 @@ export const calculateTool = tool('calculate', {
|
|
|
17
17
|
expression: z
|
|
18
18
|
.string()
|
|
19
19
|
.min(1)
|
|
20
|
-
.describe(`One mathematical expression per call — neither \`;\` nor newlines separate statements. Inside matrices, \`;\` separates rows (e.g. \`[1, 2; 3, 4]\`). Supports arithmetic (+, -, *, /, ^, %), functions across arithmetic/trig (sin, cos, sqrt, log, abs, round), statistics (mean, median, std, variance), combinatorics (factorial, permutations, combinations), and matrix (det, inv, transpose), plus constants (pi, e, phi, i), units (5 kg to lbs), and variables (when scope is provided). Standard notation \`ln\` and \`arc*\` (e.g. \`arcsin\`, \`arctan\`) is accepted alongside the math.js names \`log\` and \`asin\`/\`atan\`; common synonyms such as \`stdev\`, \`permute\`, and \`
|
|
20
|
+
.describe(`One mathematical expression per call — neither \`;\` nor newlines separate statements. Inside matrices, \`;\` separates rows (e.g. \`[1, 2; 3, 4]\`). Supports arithmetic (+, -, *, /, ^, %), functions across arithmetic/trig (sin, cos, sqrt, log, abs, round), statistics (mean, median, std, variance), combinatorics (factorial, permutations, combinations), and matrix (det, inv, transpose), plus constants (pi, e, phi, i), units (5 kg to lbs), and variables (when scope is provided). Standard notation \`ln\` and \`arc*\` (e.g. \`arcsin\`, \`arctan\`) is accepted alongside the math.js names \`log\` and \`asin\`/\`atan\`; common synonyms such as \`stdev\`, \`permute\`, \`nCr\`, and \`length\`/\`len\` resolve to their math.js names (\`std\`, \`permutations\`, \`combinations\`, \`count\`).`),
|
|
21
21
|
operation: z
|
|
22
22
|
.enum(['evaluate', 'simplify', 'derivative'])
|
|
23
23
|
.default('evaluate')
|
|
@@ -47,7 +47,7 @@ export const calculateTool = tool('calculate', {
|
|
|
47
47
|
numericType: z
|
|
48
48
|
.enum(['number', 'BigNumber', 'Fraction'])
|
|
49
49
|
.default('number')
|
|
50
|
-
.describe('Numeric type for evaluate. "number" (default): 64-bit IEEE 754 float — fastest, standard precision. "BigNumber": arbitrary-precision decimal — use when intermediate values overflow 64-bit float (e.g. large factorial ratios like 10000!/9999!); slower than "number". "Fraction": exact rational arithmetic — eliminates floating-point rounding (e.g. 0.1 + 0.2 = 0.3 exactly); limited to expressions
|
|
50
|
+
.describe('Numeric type for evaluate. "number" (default): 64-bit IEEE 754 float — fastest, standard precision. "BigNumber": arbitrary-precision decimal — use when intermediate values overflow 64-bit float (e.g. large factorial ratios like 10000!/9999!); slower than "number". "Fraction": exact rational arithmetic — eliminates floating-point rounding (e.g. 0.1 + 0.2 = 0.3 exactly); limited to expressions with exactly-rational results — an irrational or transcendental result (sqrt, sin, log, …) fails with fraction_unsupported, so use "number" or "BigNumber" for those. Ignored for symbolic operations (simplify, derivative). When "number" evaluation produces a non-finite result (undefined_result error), retry with "BigNumber".'),
|
|
51
51
|
}),
|
|
52
52
|
output: z.object({
|
|
53
53
|
result: z.string().describe('The computed result as a string.'),
|
|
@@ -114,6 +114,12 @@ export const calculateTool = tool('calculate', {
|
|
|
114
114
|
when: 'Expression evaluated to Infinity, -Infinity, or NaN (e.g., division by zero).',
|
|
115
115
|
recovery: 'Check for division by zero, log of non-positive numbers, or other undefined operations.',
|
|
116
116
|
},
|
|
117
|
+
{
|
|
118
|
+
reason: 'fraction_unsupported',
|
|
119
|
+
code: JsonRpcErrorCode.ValidationError,
|
|
120
|
+
when: 'numericType is "Fraction" but the expression has no exact rational value (irrational or transcendental result, e.g. sqrt, sin, log).',
|
|
121
|
+
recovery: 'Retry with numericType "number" or "BigNumber" — those represent irrational and transcendental results.',
|
|
122
|
+
},
|
|
117
123
|
{
|
|
118
124
|
reason: 'parse_failed',
|
|
119
125
|
code: JsonRpcErrorCode.ValidationError,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calculate.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/calculate.tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEjE,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,CAAC,WAAW,EAAE;IAC7C,WAAW,EACT,0NAA0N;IAC5N,WAAW,EAAE;QACX,YAAY,EAAE,IAAI;QAClB,cAAc,EAAE,IAAI;QACpB,aAAa,EAAE,KAAK;KACrB;IACD,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,UAAU,EAAE,CAAC;aACV,MAAM,EAAE;aACR,GAAG,CAAC,CAAC,CAAC;aACN,QAAQ,CACP,
|
|
1
|
+
{"version":3,"file":"calculate.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/calculate.tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEjE,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,CAAC,WAAW,EAAE;IAC7C,WAAW,EACT,0NAA0N;IAC5N,WAAW,EAAE;QACX,YAAY,EAAE,IAAI;QAClB,cAAc,EAAE,IAAI;QACpB,aAAa,EAAE,KAAK;KACrB;IACD,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,UAAU,EAAE,CAAC;aACV,MAAM,EAAE;aACR,GAAG,CAAC,CAAC,CAAC;aACN,QAAQ,CACP,uxBAAuxB,CACxxB;QACH,SAAS,EAAE,CAAC;aACT,IAAI,CAAC,CAAC,UAAU,EAAE,UAAU,EAAE,YAAY,CAAC,CAAC;aAC5C,OAAO,CAAC,UAAU,CAAC;aACnB,QAAQ,CACP,+dAA+d,CAChe;QACH,QAAQ,EAAE,CAAC;aACR,KAAK,CAAC;YACL,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,oCAAoC,CAAC;YAC5D,CAAC;iBACE,MAAM,EAAE;iBACR,GAAG,CAAC,EAAE,CAAC;iBACP,KAAK,CACJ,0BAA0B,EAC1B,wDAAwD,CACzD;iBACA,QAAQ,C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,IAAI,MAAM,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;QACzF,MAAM,SAAS,GAAG,MAAM,CAAC,aAAa,IAAI,MAAM,CAAC;QACjD,MAAM,KAAK,GAAG;YACZ,qBAAqB,MAAM,CAAC,UAAU,IAAI;YAC1C,kBAAkB,MAAM,CAAC,SAAS,EAAE;YACpC,eAAe,MAAM,CAAC,MAAM,EAAE;YAC9B,aAAa,MAAM,CAAC,UAAU,EAAE;SACjC,CAAC;QACF,IAAI,MAAM,CAAC,SAAS,KAAK,SAAS,EAAE,CAAC;YACnC,qFAAqF;YACrF,KAAK,CAAC,IAAI,CACR,MAAM,CAAC,SAAS;gBACd,CAAC,CAAC,qEAAqE;gBACvE,CAAC,CAAC,4CAA4C,CACjD,CAAC;QACJ,CAAC;QACD,IAAI,MAAM,CAAC,SAAS,KAAK,UAAU,EAAE,CAAC;YACpC,KAAK,CAAC,IAAI,CAAC,wBAAwB,SAAS,EAAE,CAAC,CAAC;YAChD,KAAK,CAAC,IAAI,CAAC,kBAAkB,SAAS,EAAE,CAAC,CAAC;QAC5C,CAAC;QACD,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpD,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -54,7 +54,12 @@ export declare class MathService {
|
|
|
54
54
|
* accessors, so they are unaffected.
|
|
55
55
|
*/
|
|
56
56
|
private validateNoFunctionStringification;
|
|
57
|
-
/**
|
|
57
|
+
/**
|
|
58
|
+
* Runs a synchronous function inside a vm sandbox with timeout protection.
|
|
59
|
+
* `numericType` is supplied only by the evaluate path so a Fraction-mode
|
|
60
|
+
* conversion failure can be remapped to the actionable `fraction_unsupported`
|
|
61
|
+
* error instead of the misleading `parse_failed` (#19).
|
|
62
|
+
*/
|
|
58
63
|
private runWithTimeout;
|
|
59
64
|
}
|
|
60
65
|
/** Initialize the math service. Call once from createApp setup(). */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"math-service.d.ts","sourceRoot":"","sources":["../../../src/services/math/math-service.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAGtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"math-service.d.ts","sourceRoot":"","sources":["../../../src/services/math/math-service.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAGtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAgT1D,qBAAa,WAAW;IACtB,6EAA6E;IAC7E,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAe;IAC/C,uFAAuF;IACvF,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAe;IACjD,2FAA2F;IAC3F,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAe;IAEhD,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA6B;IACnD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAmE;IAC5F,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA6D;IACxF,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAiB;IAC/C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAe;IAEtC,YAAY,MAAM,EAAE,YAAY,EAmB/B;IAED,yFAAyF;IACzF,OAAO,CAAC,WAAW;IAWnB,4FAA4F;IAC5F,kBAAkB,CAChB,UAAU,EAAE,MAAM,EAClB,GAAG,EAAE,OAAO,EACZ,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC9B,SAAS,CAAC,EAAE,MAAM,EAClB,WAAW,GAAE,WAAsB,GAClC,UAAU,CAuBZ;IAED,qDAAqD;IACrD,kBAAkB,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,GAAG,UAAU,CA0B/D;IAED,mFAAmF;IACnF,uBAAuB,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,GAAG,UAAU,CAQtF;IAED,qFAAqF;IACrF,cAAc,IAAI,MAAM,CAEvB;IAED,OAAO,CAAC,aAAa;IAqBrB,uEAAuE;IACvE,OAAO,CAAC,aAAa;IAWrB,iGAAiG;IACjG,OAAO,CAAC,kBAAkB;IAS1B,2HAA2H;IAC3H,OAAO,CAAC,cAAc;IAStB,8DAA8D;IAC9D,OAAO,CAAC,kBAAkB;IAS1B;;;;;;;;;;;;;OAaG;IACH,OAAO,CAAC,iCAAiC;IAyBzC;;;;;OAKG;IACH,OAAO,CAAC,cAAc;CA6BvB;AAMD,qEAAqE;AACrE,wBAAgB,eAAe,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CAE1D;AAED,iDAAiD;AACjD,wBAAgB,cAAc,IAAI,WAAW,CAG5C"}
|
|
@@ -84,6 +84,14 @@ const BLOCKED_RESULT_TYPES = new Set(['function', 'Function', 'ResultSet', 'Pars
|
|
|
84
84
|
* stringification). See {@link MathService.validateNoFunctionStringification}.
|
|
85
85
|
*/
|
|
86
86
|
const STRINGIFYING_METHODS = new Set(['toString', 'toLocaleString']);
|
|
87
|
+
/**
|
|
88
|
+
* math.js error thrown when a Fraction-mode expression yields a value that has
|
|
89
|
+
* no exact rational representation (`sqrt`, `sin`, `log`, …). math.js reports it
|
|
90
|
+
* as an implicit type-conversion failure; paired with a `numericType === 'Fraction'`
|
|
91
|
+
* guard it maps to the actionable `fraction_unsupported` error instead of the
|
|
92
|
+
* misleading, syntax-oriented `parse_failed`. See {@link MathService.runWithTimeout}.
|
|
93
|
+
*/
|
|
94
|
+
const FRACTION_CONVERSION_ERROR = /Cannot implicitly convert a Fraction/;
|
|
87
95
|
/**
|
|
88
96
|
* Scope key names that could pollute the object prototype chain or shadow
|
|
89
97
|
* critical Object.prototype methods. Validated before passing to math.js.
|
|
@@ -196,6 +204,14 @@ function createMathInstance(number) {
|
|
|
196
204
|
const evaluate = math.evaluate.bind(math);
|
|
197
205
|
const format = math.format.bind(math);
|
|
198
206
|
const typeOf = math.typeOf.bind(math);
|
|
207
|
+
// Symbolic operations are captured here too so a hardened instance can back
|
|
208
|
+
// simplify/derivative — constant-folding inside them then hits the same
|
|
209
|
+
// disabled-function / redacted-constant overrides applied below (#18). `.rules`
|
|
210
|
+
// must be read before binding, since bind() drops the function's own properties.
|
|
211
|
+
const parse = math.parse.bind(math);
|
|
212
|
+
const simplify = math.simplify.bind(math);
|
|
213
|
+
const derivative = math.derivative.bind(math);
|
|
214
|
+
const simplifyRules = [...math.simplify.rules];
|
|
199
215
|
// Capture math.import before it's disabled — needed to install the config guard below.
|
|
200
216
|
const mathImport = math.import.bind(math);
|
|
201
217
|
// For BigNumber/Fraction instances, also capture config before the override.
|
|
@@ -222,6 +238,8 @@ function createMathInstance(number) {
|
|
|
222
238
|
nPr: math.permutations,
|
|
223
239
|
choose: math.combinations,
|
|
224
240
|
nCr: math.combinations,
|
|
241
|
+
length: math.count,
|
|
242
|
+
len: math.count,
|
|
225
243
|
});
|
|
226
244
|
// Disable dangerous functions in expression scope.
|
|
227
245
|
// `config` is excluded here for BigNumber/Fraction instances — installed as a
|
|
@@ -258,7 +276,7 @@ function createMathInstance(number) {
|
|
|
258
276
|
}, currentConfig);
|
|
259
277
|
mathImport({ config: configGuard }, { override: true });
|
|
260
278
|
}
|
|
261
|
-
return { evaluate, format, typeOf };
|
|
279
|
+
return { evaluate, format, typeOf, parse, simplify, derivative, simplifyRules };
|
|
262
280
|
}
|
|
263
281
|
export class MathService {
|
|
264
282
|
/** Default IEEE 754 instance — used for the vast majority of evaluations. */
|
|
@@ -274,19 +292,21 @@ export class MathService {
|
|
|
274
292
|
config;
|
|
275
293
|
constructor(config) {
|
|
276
294
|
this.config = config;
|
|
277
|
-
// biome-ignore lint/style/noNonNullAssertion: math.js types declare `all` as potentially undefined, but it's always defined at runtime
|
|
278
|
-
const baseMath = create(all);
|
|
279
|
-
// Save references for symbolic operations — these don't need numeric-type variants.
|
|
280
|
-
// parse / simplify / derivative operate on the AST, not numeric values.
|
|
281
|
-
this.parse = baseMath.parse.bind(baseMath);
|
|
282
|
-
this.simplify = baseMath.simplify.bind(baseMath);
|
|
283
|
-
this.derivative = baseMath.derivative.bind(baseMath);
|
|
284
|
-
this.simplifyRules = [...baseMath.simplify.rules, ...TRIG_SIMPLIFY_RULES];
|
|
285
295
|
// Pre-initialize one hardened instance per numeric type so numeric-type selection
|
|
286
296
|
// at evaluation time is a simple Map lookup, not a per-request reconfiguration.
|
|
287
297
|
this.defaultInstance = createMathInstance('number');
|
|
288
298
|
this.bigNumberInstance = createMathInstance('BigNumber');
|
|
289
299
|
this.fractionInstance = createMathInstance('Fraction');
|
|
300
|
+
// Symbolic operations (parse / simplify / derivative) operate on the AST and are
|
|
301
|
+
// numeric-type-agnostic, so they reuse the hardened default instance rather than a
|
|
302
|
+
// separate unhardened one. This ensures the constant-folding math.js performs inside
|
|
303
|
+
// simplify/derivative resolves disabled functions to their throwing stubs and reads
|
|
304
|
+
// the redacted `version` — closing the bypass where folded `evaluate("…")` ran on an
|
|
305
|
+
// unhardened instance (#18).
|
|
306
|
+
this.parse = this.defaultInstance.parse;
|
|
307
|
+
this.simplify = this.defaultInstance.simplify;
|
|
308
|
+
this.derivative = this.defaultInstance.derivative;
|
|
309
|
+
this.simplifyRules = [...this.defaultInstance.simplifyRules, ...TRIG_SIMPLIFY_RULES];
|
|
290
310
|
}
|
|
291
311
|
/** Select the pre-initialized evaluate/format/typeOf bundle for a given numeric type. */
|
|
292
312
|
instanceFor(numericType) {
|
|
@@ -307,7 +327,7 @@ export class MathService {
|
|
|
307
327
|
const normalized = normalizeNotation(expression);
|
|
308
328
|
this.validateNoFunctionStringification(normalized, ctx);
|
|
309
329
|
const inst = this.instanceFor(numericType);
|
|
310
|
-
const raw = this.runWithTimeout(() => (scope ? inst.evaluate(normalized, scope) : inst.evaluate(normalized)), ctx);
|
|
330
|
+
const raw = this.runWithTimeout(() => (scope ? inst.evaluate(normalized, scope) : inst.evaluate(normalized)), ctx, numericType);
|
|
311
331
|
const resultType = inst.typeOf(raw);
|
|
312
332
|
this.validateResultType(resultType, ctx);
|
|
313
333
|
this.validateFinite(raw, ctx);
|
|
@@ -325,6 +345,7 @@ export class MathService {
|
|
|
325
345
|
simplifyExpression(expression, ctx) {
|
|
326
346
|
this.validateInput(expression, ctx);
|
|
327
347
|
const normalized = normalizeNotation(expression);
|
|
348
|
+
this.validateNoFunctionStringification(normalized, ctx);
|
|
328
349
|
// Capture the AST-normalized form of the input before simplification so we
|
|
329
350
|
// can detect whether the simplifier made any progress. String comparison is
|
|
330
351
|
// not sufficient — formatting-only changes like `x+1` vs `x + 1` should not
|
|
@@ -350,6 +371,7 @@ export class MathService {
|
|
|
350
371
|
differentiateExpression(expression, variable, ctx) {
|
|
351
372
|
this.validateInput(expression, ctx);
|
|
352
373
|
const normalized = normalizeNotation(expression);
|
|
374
|
+
this.validateNoFunctionStringification(normalized, ctx);
|
|
353
375
|
const derived = this.runWithTimeout(() => this.derivative(normalized, variable), ctx);
|
|
354
376
|
const result = derived.toString();
|
|
355
377
|
this.validateResultSize(result, ctx);
|
|
@@ -432,8 +454,13 @@ export class MathService {
|
|
|
432
454
|
throw validationError('Converting a function to a string is not allowed — it would expose internal source. Only numeric, string, matrix, complex, unit, and boolean results are allowed.', { reason: 'disallowed_result_type', ...ctx.recoveryFor('disallowed_result_type') });
|
|
433
455
|
}
|
|
434
456
|
}
|
|
435
|
-
/**
|
|
436
|
-
|
|
457
|
+
/**
|
|
458
|
+
* Runs a synchronous function inside a vm sandbox with timeout protection.
|
|
459
|
+
* `numericType` is supplied only by the evaluate path so a Fraction-mode
|
|
460
|
+
* conversion failure can be remapped to the actionable `fraction_unsupported`
|
|
461
|
+
* error instead of the misleading `parse_failed` (#19).
|
|
462
|
+
*/
|
|
463
|
+
runWithTimeout(fn, ctx, numericType) {
|
|
437
464
|
const sandbox = { fn, result: undefined };
|
|
438
465
|
try {
|
|
439
466
|
vm.runInNewContext('result = fn()', sandbox, { timeout: this.config.evaluationTimeoutMs });
|
|
@@ -443,8 +470,14 @@ export class MathService {
|
|
|
443
470
|
if (err instanceof Error && 'code' in err && err.code === 'ERR_SCRIPT_EXECUTION_TIMEOUT') {
|
|
444
471
|
throw timeout(`Expression evaluation timed out after ${this.config.evaluationTimeoutMs / 1000} seconds. Simplify the expression or reduce matrix dimensions.`, { reason: 'evaluation_timeout', ...ctx.recoveryFor('evaluation_timeout') });
|
|
445
472
|
}
|
|
446
|
-
// All non-timeout errors from the VM are expression-related
|
|
447
473
|
const message = err instanceof Error ? err.message : String(err);
|
|
474
|
+
// Fraction mode cannot represent an irrational/transcendental result (sqrt, sin,
|
|
475
|
+
// log, …); math.js surfaces this as an implicit-conversion error. Remap to a
|
|
476
|
+
// dedicated, actionable error rather than the syntax-oriented parse_failed.
|
|
477
|
+
if (numericType === 'Fraction' && FRACTION_CONVERSION_ERROR.test(message)) {
|
|
478
|
+
throw validationError('This expression has no exact fractional value (irrational or transcendental result, e.g. sqrt, sin, log). Retry with numericType "number" or "BigNumber".', { reason: 'fraction_unsupported', ...ctx.recoveryFor('fraction_unsupported') });
|
|
479
|
+
}
|
|
480
|
+
// All other non-timeout errors from the VM are expression-related.
|
|
448
481
|
throw validationError(`Invalid expression: ${message}`, {
|
|
449
482
|
reason: 'parse_failed',
|
|
450
483
|
...ctx.recoveryFor('parse_failed'),
|
|
@@ -503,7 +536,7 @@ abs, ceil, floor, round, sign, sqrt, cbrt, exp, expm1, log (also: ln), log2, log
|
|
|
503
536
|
sin, cos, tan, asin (arcsin), acos (arccos), atan (arctan), atan2, sinh, cosh, tanh, asinh (arcsinh), acosh (arccosh), atanh (arctanh), sec, csc, cot, asec (arcsec), acsc (arccsc), acot (arccot), sech (arcsech), csch (arccsch), coth (arccoth)
|
|
504
537
|
|
|
505
538
|
### Statistics
|
|
506
|
-
mean (aliases: average, avg), median, mode, std (aliases: stdev, stddev), variance, min, max, sum, prod, quantileSeq, mad, count
|
|
539
|
+
mean (aliases: average, avg), median, mode, std (aliases: stdev, stddev), variance, min, max, sum, prod, quantileSeq, mad, count (aliases: length, len)
|
|
507
540
|
|
|
508
541
|
### Matrix
|
|
509
542
|
det, inv, transpose, trace, zeros, ones, identity, diag, size, reshape, flatten, concat, sort, cross, dot, eigs, expm, sqrtm, kron, pinv, range
|
|
@@ -564,7 +597,7 @@ Use the precision parameter (1\u201316 significant digits) for numeric results.
|
|
|
564
597
|
- **evaluate** (default): Compute a numeric result. Use the \`numericType\` parameter to control precision:
|
|
565
598
|
- \`"number"\` (default): 64-bit IEEE 754 float — fastest. Standard for most calculations.
|
|
566
599
|
- \`"BigNumber"\`: Arbitrary-precision decimal — use when intermediate values overflow (e.g. \`10000! / 9999!\` overflows as a 64-bit float but evaluates correctly as a BigNumber). Slower than \`"number"\`.
|
|
567
|
-
- \`"Fraction"\`: Exact rational arithmetic — eliminates floating-point rounding (e.g. \`0.1 + 0.2 = 0.3\` exactly). Limited to expressions
|
|
600
|
+
- \`"Fraction"\`: Exact rational arithmetic — eliminates floating-point rounding (e.g. \`0.1 + 0.2 = 0.3\` exactly). Limited to expressions with exactly-rational results; an irrational or transcendental result (\`sqrt(2)\`, \`sin(1)\`, \`log(3)\`, …) fails with a \`fraction_unsupported\` error — use \`"number"\` or \`"BigNumber"\` for those.
|
|
568
601
|
|
|
569
602
|
When \`"number"\` evaluation returns an \`undefined_result\` error (division by zero, overflow), retry with \`numericType: "BigNumber"\`.
|
|
570
603
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"math-service.js","sourceRoot":"","sources":["../../../src/services/math/math-service.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,SAAS,CAAC;AAEzB,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAyD,MAAM,QAAQ,CAAC;AAI5F;;;;GAIG;AACH,MAAM,mBAAmB,GAAmB;IAC1C,yBAAyB;IACzB,0BAA0B;IAC1B,0BAA0B;IAC1B,0BAA0B;IAC1B,0BAA0B;IAC1B,sCAAsC;IACtC,0BAA0B;IAC1B,0BAA0B;IAC1B,0BAA0B;IAC1B,0BAA0B;IAC1B,0BAA0B;IAC1B,0BAA0B;IAC1B,0BAA0B;IAC1B,mCAAmC;IACnC,mCAAmC;CACpC,CAAC;AAEF;;;;GAIG;AACH,MAAM,YAAY,GAA4C;IAC5D,GAAG,EAAE,aAAa;IAClB,IAAI,EAAE,EAAE,UAAU,EAAE,aAAa,EAAE,OAAO,EAAE,CAAC,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,EAAE;IACpE,SAAS,EAAE,EAAE,UAAU,EAAE,oBAAoB,EAAE,OAAO,EAAE,CAAC,YAAY,EAAE,IAAI,CAAC,EAAE;CAC/E,CAAC;AAEF;;;;GAIG;AACH,MAAM,kBAAkB,GAAG;IACzB,QAAQ;IACR,YAAY;IACZ,UAAU;IACV,OAAO;IACP,UAAU;IACV,YAAY;IACZ,SAAS;IACT,SAAS;IACT,SAAS;IACT,OAAO;IACP,QAAQ;IACR,QAAQ;CACA,CAAC;AAEX;;;;GAIG;AAEH;;;GAGG;AACH,MAAM,kBAAkB,GAA2B;IACjD,OAAO,EAAE,UAAU;CACpB,CAAC;AAEF;;;;GAIG;AACH,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAC,CAAC,UAAU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