@slexkit/mcp 0.2.0 → 0.3.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/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 +29 -7
- package/dist/data/llms-full.txt +1909 -153
- package/dist/data/llms-runtime.txt +18 -13
- package/dist/data/llms.txt +22 -1
- package/dist/data/slexkit-ai-manifest.json +717 -62
- package/dist/index.js +1483 -41
- package/dist/index.js.map +5 -5
- package/package.json +39 -39
|
@@ -51,7 +51,7 @@ ComponentKey = ComponentType ":" Identifier
|
|
|
51
51
|
- Named components use `Identifier` for instance state and lifecycle hooks.
|
|
52
52
|
- Keys without `:` are not rendered as component nodes.
|
|
53
53
|
|
|
54
|
-
Reserved context names: `g`, `api`, `$event`, `$item`, `$index`, `$key`.
|
|
54
|
+
Reserved context names: `g`, `std`, `api`, `$event`, `$item`, `$index`, `$key`.
|
|
55
55
|
|
|
56
56
|
## 3. Props classification
|
|
57
57
|
|
|
@@ -108,6 +108,7 @@ Expressions can access these variables:
|
|
|
108
108
|
| Variable | Type | Scope |
|
|
109
109
|
| ------------------ | ----------------------------- | ------------------------ |
|
|
110
110
|
| `g` | Reactive state proxy | Always |
|
|
111
|
+
| `std` | Pure SlexKit standard library | Always |
|
|
111
112
|
| Component state | e.g. `slider.value` | Named components |
|
|
112
113
|
| `api` | Host-injected object | If `api` option provided |
|
|
113
114
|
| `$event` | Event data | `on*` handlers only |
|
|
@@ -116,6 +117,8 @@ Expressions can access these variables:
|
|
|
116
117
|
| `$key` | Current item key | `$for` context only |
|
|
117
118
|
| Named `$for` alias | e.g. `user` for `"card:user"` | `$for` context only |
|
|
118
119
|
|
|
120
|
+
`std` contains deterministic helpers for math, formatting, units, and small statistics. Sensitive capabilities stay under host-injected `api.*` and may require secure runtime policy.
|
|
121
|
+
|
|
119
122
|
Expression evaluation errors are caught and produce a warning with namespace and path information. The last known value is returned as a fallback.
|
|
120
123
|
|
|
121
124
|
## 6. Component instance state
|
|
@@ -524,6 +527,7 @@ The `RenderContext` provides:
|
|
|
524
527
|
| Property | Type | Description |
|
|
525
528
|
|----------|------|-------------|
|
|
526
529
|
| `g` | reactive proxy | Global state |
|
|
530
|
+
| `std` | `SlexKitStdlib` | Pure deterministic helpers |
|
|
527
531
|
| `api` | `Record<string, unknown>` | Host-injected capabilities |
|
|
528
532
|
| `dir` | `"ltr"` or `"rtl"` | Resolved direction |
|
|
529
533
|
| `labels` | `Partial<Record<string, string>>` | Runtime labels |
|
|
@@ -591,6 +595,8 @@ type MountOptions = {
|
|
|
591
595
|
|
|
592
596
|
Calling `mount()` again on the same `container` clears the old root first, then appends a new root. The returned cleanup only unmounts the current root; it does not delete the namespace store.
|
|
593
597
|
|
|
598
|
+
Every expression receives `std`, SlexKit's pure deterministic standard library. Hosts can still inject capability objects through `api`, but network, timers, animation, and canvas should remain policy-gated in secure mode.
|
|
599
|
+
|
|
594
600
|
### `ingest(input)`
|
|
595
601
|
|
|
596
602
|
Ingests state-only Slex: updates `g` without rendering UI. Used by the Markdown runtime host for state-only fences. Returns `true` if parsing succeeded.
|
|
@@ -943,16 +949,16 @@ The renderer handles `slex` fences. It supports both trusted and secure runtime
|
|
|
943
949
|
|
|
944
950
|
## Obsidian integration
|
|
945
951
|
|
|
946
|
-
The
|
|
952
|
+
The official Obsidian plugin lives in <https://github.com/slexkit/obsidian-slexkit> and registers the `slex` fenced code block processor:
|
|
947
953
|
|
|
948
954
|
```ts
|
|
949
|
-
// In the
|
|
955
|
+
// In the plugin:
|
|
950
956
|
registerMarkdownCodeBlockProcessor("slex", (source, el, ctx) => { ... });
|
|
951
957
|
```
|
|
952
958
|
|
|
953
959
|
The adapter renders blocks in **reading mode only** and does not write back to the vault. Blocks within the same note share a trusted artifact runtime.
|
|
954
960
|
|
|
955
|
-
**Important**: The Obsidian adapter uses trusted mode because it renders content from the user's
|
|
961
|
+
**Important**: The Obsidian adapter uses trusted mode because it renders content from the user's local vault. It is not designed as a security boundary for untrusted or agent-generated Markdown.
|
|
956
962
|
|
|
957
963
|
## Writing a custom host adapter
|
|
958
964
|
|
|
@@ -1332,7 +1338,6 @@ slexkit (root - real code)
|
|
|
1332
1338
|
@slexkit/components-svelte (thin wrapper) ─── re-exports slexkit/components-svelte
|
|
1333
1339
|
@slexkit/theme-shadcn ─── CSS only
|
|
1334
1340
|
@slexkit/streamdown ─── React/Streamdown renderer
|
|
1335
|
-
@slexkit/obsidian ─── Obsidian plugin
|
|
1336
1341
|
@slexkit/mcp ─── read-only MCP server for AI agents
|
|
1337
1342
|
```
|
|
1338
1343
|
|
|
@@ -1424,15 +1429,15 @@ export function Message({ markdown }: { markdown: string }) {
|
|
|
1424
1429
|
|
|
1425
1430
|
Processes `slex` fences. Supports both trusted and secure runtime modes.
|
|
1426
1431
|
|
|
1427
|
-
##
|
|
1432
|
+
## Obsidian plugin
|
|
1428
1433
|
|
|
1429
|
-
Obsidian plugin
|
|
1434
|
+
The official Obsidian plugin lives in a separate release repository: <https://github.com/slexkit/obsidian-slexkit>.
|
|
1430
1435
|
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1436
|
+
Install **SlexKit** through Obsidian Community Plugins for normal vault use. Use BRAT or manual GitHub release assets only when testing unreleased builds from `slexkit/obsidian-slexkit`.
|
|
1437
|
+
|
|
1438
|
+
The community plugin is currently desktop-only and compatible with Obsidian 1.5.0+. Mobile support should be enabled only after real mobile vault testing.
|
|
1434
1439
|
|
|
1435
|
-
The adapter uses trusted runtime mode -it renders content from the user's local vault and is not designed as a sandbox for third-party or agent-generated Markdown.
|
|
1440
|
+
The adapter uses trusted runtime mode - it renders content from the user's local vault and is not designed as a sandbox for third-party or agent-generated Markdown. Secure sandbox support is not part of the v0 adapter.
|
|
1436
1441
|
|
|
1437
1442
|
## @slexkit/mcp
|
|
1438
1443
|
|
|
@@ -1453,7 +1458,7 @@ The server does not modify project files. Use it when an agent needs current Sle
|
|
|
1453
1458
|
| With Svelte components | `npm install slexkit @slexkit/runtime @slexkit/components-svelte` |
|
|
1454
1459
|
| Add shadcn theme | `npm install @slexkit/theme-shadcn` |
|
|
1455
1460
|
| React/Streamdown host | `npm install slexkit @slexkit/theme-shadcn @slexkit/streamdown streamdown react react-dom` |
|
|
1456
|
-
| Obsidian plugin |
|
|
1461
|
+
| Obsidian plugin | Install **SlexKit** from Obsidian Community Plugins |
|
|
1457
1462
|
| AI agent MCP server | `npx -y @slexkit/mcp` |
|
|
1458
1463
|
|
|
1459
1464
|
## v0 packaging strategy
|
|
@@ -1470,6 +1475,6 @@ bun run test
|
|
|
1470
1475
|
bun run smoke:release
|
|
1471
1476
|
```
|
|
1472
1477
|
|
|
1473
|
-
The release smoke packs and installs every scoped package, verifies public entry points, verifies CSS subpath exports,
|
|
1478
|
+
The release smoke packs and installs every scoped package in this repository, verifies public entry points, verifies CSS subpath exports, and starts the MCP stdio binary to check `initialize`, `tools/list`, and `slexkitValidate`.
|
|
1474
1479
|
|
|
1475
1480
|
---
|
package/dist/data/llms.txt
CHANGED
|
@@ -5,13 +5,14 @@
|
|
|
5
5
|
- [Full documentation](/llms-full.txt): all canonical English docs pages in one text file.
|
|
6
6
|
- [Component reference](/llms-components.txt): component docs index plus generated props/state reference.
|
|
7
7
|
- [Runtime docs](/llms-runtime.txt): runtime, host integration, and secure rendering docs.
|
|
8
|
+
- [Capabilities](/llms-capabilities.txt): expression context, `std.*` standard library, and policy-gated `api.*`.
|
|
8
9
|
- [ToolHost docs](/llms-toolhost.txt): structured user-input UI docs.
|
|
9
10
|
- [Authoring rules](/llms-authoring.txt): concise rules for Markdown `slex` fences.
|
|
10
11
|
- [AI manifest](/slexkit-ai-manifest.json): structured page, component, and hash metadata.
|
|
11
12
|
|
|
12
13
|
SlexKit raw docs are Markdown (`.md`) with explicit `slex` fences. The interactive layer is the fenced `slex` source inside each Markdown page.
|
|
13
14
|
|
|
14
|
-
Version: 0.
|
|
15
|
+
Version: 0.3.1
|
|
15
16
|
|
|
16
17
|
## Table of Contents
|
|
17
18
|
|
|
@@ -24,6 +25,25 @@ Version: 0.2.0
|
|
|
24
25
|
- [Secure Runtime Setup](/docs/guides/security-runtime.md): Decision and setup guide for rendering untrusted or agent-generated Slex source.
|
|
25
26
|
- [AI / Agents](/docs/guides/ai-agents.md): LLM docs, MCP server, skills, and authoring rules for SlexKit agents.
|
|
26
27
|
|
|
28
|
+
### Examples
|
|
29
|
+
- [你的第一个 SlexKit 卡片](/zh-CN/examples/hello-slexkit.md): 零交互、纯展示的静态卡片,展示 SlexKit 声明式 DSL 的渲染效果。
|
|
30
|
+
- [第一个交互:滑块操控数据](/zh-CN/examples/first-interaction.md): 在 SlexKit 卡片引入 g 对象和第一个滑块交互,体验响应式数据绑定。
|
|
31
|
+
- [多输入协同:两个滑块联动](/zh-CN/examples/multi-input-coordination.md): 两个 slider 相互影响,引入 g 方法、formula 组件和条件渲染。
|
|
32
|
+
- [分支与切换:模式选择器](/zh-CN/examples/tabs-and-branching.md): 用 select 实现场景切换,展示 UI = f(state) 的分支渲染模式。
|
|
33
|
+
- [五险一金计算器](/zh-CN/examples/salary-calculator.md): 输入工资基数和城市,计算五险一金明细,显示个人缴纳、单位缴纳和总计。
|
|
34
|
+
- [软件项目成本估算器](/zh-CN/examples/project-cost-estimator.md): 输入团队规模、开发周期和人员成本,计算项目总成本和人均成本。
|
|
35
|
+
- [分压器计算器](/zh-CN/examples/voltage-divider.md): 输入电压和两个电阻值,计算分压输出,并评估负载效应带来的误差。
|
|
36
|
+
- [RC 低通滤波器](/zh-CN/examples/rc-low-pass-filter.md): 用电阻和电容搭建的频率选择电路,计算截止频率和任意频率下的增益衰减。
|
|
37
|
+
- [波特率误差计算器](/zh-CN/examples/baud-rate-calculator.md): 输入晶振频率和目标波特率,计算 UART 波特率误差百分比,判断通信可靠性。
|
|
38
|
+
- [搜索与过滤表格](/zh-CN/examples/search-filter-table.md): 搜索输入框实时过滤表格行,点击行展开详情,展示 input + 动态 table + collapsible 组合。
|
|
39
|
+
- [项目仪表盘](/zh-CN/examples/project-dashboard.md): 用 section + grid 搭建信息仪表盘,覆盖 Sprint 进度、质量指标和团队健康度的多卡片联动。
|
|
40
|
+
- [ToolHost 表单提问](/zh-CN/examples/form-wizard-steps.md): AI 对话过程中突然需要收集用户信息,弹出表单卡片等待用户提交,提交后显示结果。
|
|
41
|
+
- [技术选型评估](/zh-CN/examples/tech-selection-evaluator.md): 评估不同技术方案的优劣,通过跨 fence 联动实现参数选择、评分分析和结论推荐。
|
|
42
|
+
- [ToolHost 对话演示](/zh-CN/examples/toolhost-demo.md): 展示 SlexKit 的 ToolHost 能力:在 AI 对话流中内嵌交互式表单,收集用户输入后返回结构化 ToolResult。
|
|
43
|
+
- [自建还是外购决策](/zh-CN/examples/roi-estimator.md): 自建还是外购决策矩阵——功能覆盖、成本对比、时间线、风险四维度评估,自动推荐方案。
|
|
44
|
+
- [跨文档状态实验室](/zh-CN/examples/cross-doc-state-lab.md): 展示 SlexKit 最独特的跨 fence 状态共享——文档不同位置的多块 slex 代码共享同一个响应式 g 对象。
|
|
45
|
+
- [JSONPlaceholder 网络请求实验台](/zh-CN/examples/network-policy-fetch-card.md): 用 JSONPlaceholder 演示 secure runtime 如何把用户触发的网络请求交给 host policy 审核和代理。
|
|
46
|
+
|
|
27
47
|
### Components
|
|
28
48
|
- [Accordion](/docs/components/accordion.md): Expandable grouped panels.
|
|
29
49
|
- [Badge](/docs/components/badge.md): Compact label for status or classification.
|
|
@@ -35,6 +55,7 @@ Version: 0.2.0
|
|
|
35
55
|
- [Collapsible](/docs/components/collapsible.md): Single expandable region.
|
|
36
56
|
- [Column](/docs/components/column.md): Vertical layout container.
|
|
37
57
|
- [Divider](/docs/components/divider.md): Visual separator.
|
|
58
|
+
- [Formula](/docs/components/formula.md): Reactive KaTeX formula display.
|
|
38
59
|
- [Grid](/docs/components/grid.md): Responsive grid container.
|
|
39
60
|
- [Icon](/docs/components/icon.md): Shared icon field capability.
|
|
40
61
|
- [Input](/docs/components/input.md): Text or engineering-value input.
|