@slexkit/mcp 0.2.0 → 0.3.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/README.md +3 -3
- package/dist/data/llms-authoring.txt +2 -0
- package/dist/data/llms-capabilities.txt +126 -0
- package/dist/data/llms-components.txt +27 -6
- package/dist/data/llms-full.txt +1729 -4
- package/dist/data/llms-runtime.txt +7 -1
- package/dist/data/llms.txt +22 -1
- package/dist/data/slexkit-ai-manifest.json +674 -23
- package/dist/index.js +1482 -41
- package/dist/index.js.map +5 -5
- package/package.json +39 -39
package/README.md
CHANGED
|
@@ -27,9 +27,9 @@ The server exposes three read-only tools:
|
|
|
27
27
|
|
|
28
28
|
| Tool | Purpose |
|
|
29
29
|
|------|---------|
|
|
30
|
-
| `slexkitDocs` | Search or fetch generated Markdown docs, including
|
|
31
|
-
| `slexkitExamples` | Return component examples or generated templates such as `status`, `calculator`, `toolhost-form`, and `host-integration`. |
|
|
32
|
-
| `slexkitValidate` | Parse Slex source and return diagnostics
|
|
30
|
+
| `slexkitDocs` | Search or fetch generated Markdown docs, optionally including `std.*` and `api.*` capability metadata. |
|
|
31
|
+
| `slexkitExamples` | Return component examples or generated templates such as `status`, `calculator`, `stdlib-calculator`, `secure-network-card`, `toolhost-form`, and `host-integration`. |
|
|
32
|
+
| `slexkitValidate` | Parse Slex source and return diagnostics, warnings, component usage, `std.*` usage, and `api.*` usage. |
|
|
33
33
|
|
|
34
34
|
Example validation request:
|
|
35
35
|
|
|
@@ -7,6 +7,7 @@ SlexKit's agent-readable source is Markdown with explicit `slex` fences. Do not
|
|
|
7
7
|
- Emit explicit `slex` fenced code blocks for display-oriented interactive UI.
|
|
8
8
|
- Use a Slex expression envelope: `slex`, `namespace`, `g`, and `layout`.
|
|
9
9
|
- Put mutable state and helper functions in `g`; put component structure in `layout`.
|
|
10
|
+
- Use `std.*` for common calculations, formatting, units, and small statistics.
|
|
10
11
|
- Use component keys in `type:identifier` form, such as `card:summary`.
|
|
11
12
|
- Use `$` read-pipes for dynamic props and `on*` write-pipes for event handlers.
|
|
12
13
|
- Include readable Markdown fallback text after the fence.
|
|
@@ -18,6 +19,7 @@ SlexKit's agent-readable source is Markdown with explicit `slex` fences. Do not
|
|
|
18
19
|
- Do not ask hosts to scan plain JavaScript, JSON, or untagged code blocks.
|
|
19
20
|
- Do not wrap ordinary status cards or summaries in ToolHost.
|
|
20
21
|
- Do not bypass the sandbox for untrusted source.
|
|
22
|
+
- Do not use native `fetch`, `XMLHttpRequest`, `WebSocket`, `setTimeout`, or `requestAnimationFrame` in secure mode; use policy-gated `api.*` instead.
|
|
21
23
|
- Do not invent `.mdx` routes for SlexKit docs.
|
|
22
24
|
|
|
23
25
|
## Display UI Example
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# SlexKit Capabilities for LLMs
|
|
2
|
+
|
|
3
|
+
Use `std.*` for pure deterministic calculations and formatting. Use `api.*` only for host-injected or secure-runtime capabilities that may require policy.
|
|
4
|
+
|
|
5
|
+
## Expression Context
|
|
6
|
+
|
|
7
|
+
- `g` (always): Reactive state proxy.
|
|
8
|
+
- `std` (always): Pure deterministic SlexKit standard library.
|
|
9
|
+
- `api` (host-injected): Host or secure runtime capability object.
|
|
10
|
+
- `$event` (event handlers): Event payload for on* handlers.
|
|
11
|
+
- `$item` ($for): Current array item.
|
|
12
|
+
- `$index` ($for): Current item index.
|
|
13
|
+
- `$key` ($for): Current item key.
|
|
14
|
+
|
|
15
|
+
## std.math
|
|
16
|
+
|
|
17
|
+
Small numeric helpers for common interactive calculations.
|
|
18
|
+
|
|
19
|
+
- `std.math.clamp(value, min, max)`: Clamp a number into a range. Example: `std.math.clamp(g.score, 0, 100)`
|
|
20
|
+
- `std.math.round(value, digits = 0)`: Round with a fixed number of decimal digits. Example: `std.math.round(g.latency, 1)`
|
|
21
|
+
- `std.math.safeDivide(numerator, denominator, fallback = 0)`: Divide with a fallback for zero or invalid denominators. Example: `std.math.safeDivide(g.used, g.total, 0)`
|
|
22
|
+
- `std.math.percent(part, total, digits = 1)`: Return part / total as a percentage number. Example: `std.math.percent(g.done, g.total, 1)`
|
|
23
|
+
- `std.math.lerp(start, end, t)`: Linear interpolation. Example: `std.math.lerp(0, 100, g.progress)`
|
|
24
|
+
|
|
25
|
+
## std.stats
|
|
26
|
+
|
|
27
|
+
Finite-number aggregations for arrays.
|
|
28
|
+
|
|
29
|
+
- `std.stats.sum(values)`: Sum finite numeric values. Empty arrays return 0. Example: `std.stats.sum(g.samples)`
|
|
30
|
+
- `std.stats.mean(values)`: Average finite numeric values. Empty arrays return NaN. Example: `std.stats.mean(g.samples)`
|
|
31
|
+
- `std.stats.min(values)`: Minimum finite numeric value. Empty arrays return NaN. Example: `std.stats.min(g.samples)`
|
|
32
|
+
- `std.stats.max(values)`: Maximum finite numeric value. Empty arrays return NaN. Example: `std.stats.max(g.samples)`
|
|
33
|
+
- `std.stats.median(values)`: Median finite numeric value. Empty arrays return NaN. Example: `std.stats.median(g.samples)`
|
|
34
|
+
|
|
35
|
+
## std.format
|
|
36
|
+
|
|
37
|
+
Deterministic display formatting with en-US defaults.
|
|
38
|
+
|
|
39
|
+
- `std.format.fixed(value, digits = 2)`: Format a number with fixed decimal places. Example: `std.format.fixed(g.voltage, 3)`
|
|
40
|
+
- `std.format.number(value, digits = 0, locale = 'en-US')`: Locale number formatting. Example: `std.format.number(g.requests)`
|
|
41
|
+
- `std.format.compact(value, digits = 1, locale = 'en-US')`: Compact number formatting. Example: `std.format.compact(g.users)`
|
|
42
|
+
- `std.format.percent(ratio, digits = 1)`: Format a ratio as a percentage string. Example: `std.format.percent(g.done / g.total, 1)`
|
|
43
|
+
- `std.format.currency(value, currency = 'USD', locale = 'en-US')`: Format a currency value. Example: `std.format.currency(g.revenue, 'USD')`
|
|
44
|
+
|
|
45
|
+
## std.units
|
|
46
|
+
|
|
47
|
+
Small unit display helpers for common dashboards.
|
|
48
|
+
|
|
49
|
+
- `std.units.withUnit(value, unit, digits = 2)`: Format a value with a unit suffix. Example: `std.units.withUnit(g.power, 'W', 1)`
|
|
50
|
+
- `std.units.bytes(value, digits = 1)`: Format bytes as B, KB, MB, GB, TB, or PB. Example: `std.units.bytes(g.payloadBytes)`
|
|
51
|
+
- `std.units.duration(ms, digits = 1)`: Format milliseconds as ms, s, min, or h. Example: `std.units.duration(g.elapsedMs)`
|
|
52
|
+
- `std.units.si(value, unit = '', digits = 2)`: Format with SI prefixes. Example: `std.units.si(g.frequency, 'Hz', 2)`
|
|
53
|
+
|
|
54
|
+
## Policy-Gated Runtime API
|
|
55
|
+
|
|
56
|
+
- `api.get(url, options)` (network, secure default: denied): Policy-gated GET request.
|
|
57
|
+
- `api.post(url, body, options)` (network, secure default: denied): Policy-gated POST request.
|
|
58
|
+
- `api.fetch(url, options)` (network, secure default: denied): Policy-gated GET or POST request.
|
|
59
|
+
- `api.setTimeout(fn, ms)` (timer, secure default: denied): Policy-gated timeout.
|
|
60
|
+
- `api.clearTimeout(id)` (timer, secure default: denied): Clear a policy-gated timeout.
|
|
61
|
+
- `api.setInterval(fn, ms)` (timer, secure default: denied): Policy-gated interval.
|
|
62
|
+
- `api.clearInterval(id)` (timer, secure default: denied): Clear a policy-gated interval.
|
|
63
|
+
- `api.raf(fn)` (animation, secure default: denied): Policy-gated animation frame.
|
|
64
|
+
- `api.cancelRaf(id)` (animation, secure default: denied): Cancel a policy-gated animation frame.
|
|
65
|
+
- `api.createCanvas(width, height)` (canvas, secure default: denied): Create a policy-counted canvas.
|
|
66
|
+
- `api.getCanvasContext(canvas, contextId, options)` (canvas, secure default: denied): Get a policy-checked canvas context.
|
|
67
|
+
- `api.onDispose(fn)` (lifecycle, secure default: available): Register runtime cleanup.
|
|
68
|
+
- `api.now()` (lifecycle, secure default: available): Runtime clock.
|
|
69
|
+
- `api.isTimeoutError(error)` (diagnostics, secure default: available): Check timeout errors.
|
|
70
|
+
- `api.isNetworkError(error)` (diagnostics, secure default: available): Check network errors.
|
|
71
|
+
- `api.isPolicyError(error)` (diagnostics, secure default: available): Check policy errors.
|
|
72
|
+
- `api.errorMessage(error)` (diagnostics, secure default: available): Extract a displayable error message.
|
|
73
|
+
|
|
74
|
+
Secure mode blocks native `fetch`, `XMLHttpRequest`, `WebSocket`, `setTimeout`, `setInterval`, and `requestAnimationFrame`. Use `api.get`, `api.post`, `api.fetch`, `api.setTimeout`, `api.setInterval`, and `api.raf` when host policy enables them.
|
|
75
|
+
|
|
76
|
+
## Recipe: Std Calculator
|
|
77
|
+
|
|
78
|
+
```slex
|
|
79
|
+
{
|
|
80
|
+
slex: "0.1",
|
|
81
|
+
namespace: "std_calculator",
|
|
82
|
+
g: { done: 7, total: 12, samples: [120, 95, 143, 110], bytes: 1536000 },
|
|
83
|
+
layout: {
|
|
84
|
+
"card:summary": {
|
|
85
|
+
title: "Stdlib calculator",
|
|
86
|
+
"stat:progress": { label: "Progress", "$value": "std.format.percent(std.math.safeDivide(g.done, g.total), 1)" },
|
|
87
|
+
"stat:average": { label: "Average", "$value": "std.format.fixed(std.stats.mean(g.samples), 1)", unit: "ms" },
|
|
88
|
+
"stat:payload": { label: "Payload", "$value": "std.units.bytes(g.bytes)" }
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Recipe: Secure Network Card
|
|
95
|
+
|
|
96
|
+
```slex
|
|
97
|
+
{
|
|
98
|
+
slex: "0.1",
|
|
99
|
+
namespace: "secure_network_card",
|
|
100
|
+
g: {
|
|
101
|
+
status: "idle",
|
|
102
|
+
async load() {
|
|
103
|
+
this.status = "loading";
|
|
104
|
+
try {
|
|
105
|
+
var result = await api.get("https://api.example.com/status", { credentials: "omit" });
|
|
106
|
+
this.status = "HTTP " + result.status;
|
|
107
|
+
} catch (error) {
|
|
108
|
+
this.status = api.isPolicyError(error) ? "blocked by policy" : api.errorMessage(error);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
layout: {
|
|
113
|
+
"card:network": {
|
|
114
|
+
title: "Secure network card",
|
|
115
|
+
"button:load": { label: "Load", onclick: "g.load()" },
|
|
116
|
+
"text:status": { "$text": "g.status" }
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Recipe: Timer and Animation Policy
|
|
123
|
+
|
|
124
|
+
- Timers are disabled in secure mode unless `policy.timer.enabled` is true.
|
|
125
|
+
- Use `api.setTimeout` and `api.setInterval`; do not use native scheduling globals.
|
|
126
|
+
- Animation is disabled unless `policy.animation.enabled` is true; use `api.raf`.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Use these components inside Markdown `slex` fences. Raw component docs are ordinary `.md` pages that preserve `slex` examples.
|
|
4
4
|
|
|
5
|
-
Public component count:
|
|
5
|
+
Public component count: 29
|
|
6
6
|
|
|
7
7
|
## Disclosure
|
|
8
8
|
|
|
@@ -39,6 +39,12 @@ Public component count: 28
|
|
|
39
39
|
- [Slider](/docs/components/slider.md): `slider` - Numeric range input.
|
|
40
40
|
- [Switch](/docs/components/switch.md): `switch` - Boolean switch input.
|
|
41
41
|
|
|
42
|
+
## Display
|
|
43
|
+
|
|
44
|
+
- [Formula](/docs/components/formula.md): `formula` - Reactive KaTeX formula display.
|
|
45
|
+
- [Stat](/docs/components/stat.md): `stat` - Metric display.
|
|
46
|
+
- [Text](/docs/components/text.md): `text` - Plain text display.
|
|
47
|
+
|
|
42
48
|
## Component
|
|
43
49
|
|
|
44
50
|
- [Icon](/docs/components/icon.md): `icon` - Shared icon field capability.
|
|
@@ -52,11 +58,6 @@ Public component count: 28
|
|
|
52
58
|
- [Progress](/docs/components/progress.md): `progress` - Progress bar.
|
|
53
59
|
- [Toast](/docs/components/toast.md): `toast` - Transient notification.
|
|
54
60
|
|
|
55
|
-
## Display
|
|
56
|
-
|
|
57
|
-
- [Stat](/docs/components/stat.md): `stat` - Metric display.
|
|
58
|
-
- [Text](/docs/components/text.md): `text` - Plain text display.
|
|
59
|
-
|
|
60
61
|
## Data
|
|
61
62
|
|
|
62
63
|
- [Table](/docs/components/table.md): `table` - Simple data table.
|
|
@@ -265,6 +266,26 @@ No child components.
|
|
|
265
266
|
|
|
266
267
|
---
|
|
267
268
|
|
|
269
|
+
## Formula API (`formula`)
|
|
270
|
+
|
|
271
|
+
Category: Display
|
|
272
|
+
Status: ready
|
|
273
|
+
State mode: none
|
|
274
|
+
Since: 0.1.0
|
|
275
|
+
|
|
276
|
+
### Props
|
|
277
|
+
- `tex` (string; optional; dynamic): KaTeX source to render.
|
|
278
|
+
- `formula` (string; optional; dynamic): Alias for tex.
|
|
279
|
+
- `value` (string; optional; dynamic): Alias for tex.
|
|
280
|
+
- `displayMode` (boolean; optional; static; default: true): Render as display math when true; inline math when false.
|
|
281
|
+
- `display` (boolean; optional; static; default: true): Alias for displayMode.
|
|
282
|
+
- `block` (boolean; optional; static; default: true): Alias for displayMode.
|
|
283
|
+
|
|
284
|
+
### Children
|
|
285
|
+
No child components.
|
|
286
|
+
|
|
287
|
+
---
|
|
288
|
+
|
|
268
289
|
## Grid API (`grid`)
|
|
269
290
|
|
|
270
291
|
Category: Layout
|