diff --git a/.cursor/skills/marqdo/SKILL.md b/.cursor/skills/marqdo/SKILL.md index 6f03858..e9db79a 100644 --- a/.cursor/skills/marqdo/SKILL.md +++ b/.cursor/skills/marqdo/SKILL.md @@ -24,7 +24,7 @@ Canonical design (repo): `doc/design/markdown-mapping.md`, `doc/design/keywords. 4. **Do not invent keywords** `if` / `else` / `while` / `for` / `def` / `return`. Control flow is Markdown: **`+` params** (under heading), **`1.` `2.` … branches**, **`-` loops**, arm `N. *` = else, `#` = **object/type**, `##`+ = **function/method**, `**…**` = return. 5. **Identifiers use backticks** — params `` + `name` ``. **Exemptions:** foreach `` - [item](coll) ``; footnote `` name[^key] ``; **inside italic `*…*` / bold `**…**`**, bare ids are **variables** (Python-style unified namespace) and method-call receivers are bare too. **Drop the backticks on value-expression variable names and method receivers inside `*…*` / `**…**`** — they are redundant once the `*…*`/`**…**` markers mark the segment as code: `*分类 = 分类[^苹果]*`, `**n * 2**`, `*p = > page.主体装配 组件=home*`. **Text literals must be quoted**: `*a = > text.split value=src sep=","*`. Backticks **still required** where a bare word is *not* a variable in **standalone `>` calls** (bare = text there): `` > str `n` ``, `` > `obj`.method ``. **No trailing space** inside `*…*` / `**…**` wrapped code: the closing marker must touch the last token directly (`*a = 1*`, `**n**`), never `` *a = 1 * ``. 6. **Structure lines are not wrapped in italics.** `#` `>` `+` `-` `|` lines stand alone; use `*…*` only for general statements (bindings / expressions). -7. **Paths:** In bare *expressions* `/` is division. In **call args / param defaults**, unspaced `a/b` and quoted `".marqdo/agent-kb"` are path text — no `json.parse` needed. +7. **Paths:** In bare *expressions* `/` is division. In **call args / param defaults / table cells**, unspaced `a/b` and quoted `".marqdo/agent-kb"` are path text — no `json.parse` needed. Numeric ratios that must stay text use quotes (`"1/5"`, `"16/9"`); bare `1/5` is division. 8. Prefer ending side-effect-only function bodies with a lone `---` or `***` line (or `****` empty return) so later siblings are not swallowed. 9. **`ext/**` never calls `host_*`.** Agent/OKF helpers are plugin names (`agent_kb_*`, …) after `plugin.load`. Do **not** add agent/OKF domain code to `src/host/` (core bloat). See `doc/design/ext-agent.md` §4. diff --git a/CHANGELOG.md b/CHANGELOG.md index a0a3265..a5d3726 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ ## Unreleased +### Fixed +- **Admin UI**:主区取消 `max-width:56rem` 限制,表格外包可横向滚动的 `.table-wrap`,单元格完整展示并自动换行;表单加宽且 textarea 可随内容增高。 +- **`marqdo ext add`**:安装含原生插件的扩展时**先**定位/自动 `cargo build` 再拷贝 `.mq.md`,避免只装上文稿、运行时报 `native plugin not found`;扩大 `.so` 搜索路径。 +- **`web_style` / 样式装配**:正确输出 `@keyframes` 块(停点为嵌套规则,不再写成 `0%: opacity: 0`)。 +- **样式表含 `/` 的值**:文档明确**引号优先**(`"16/9"`、`"1/5"`);不引入靠空格消歧的表单元格比率折叠。 + ## v0.3.1 — 2026-08-29 ### Highlights diff --git a/doc/design/ext-cli.md b/doc/design/ext-cli.md index e12bb7c..0533634 100644 --- a/doc/design/ext-cli.md +++ b/doc/design/ext-cli.md @@ -52,14 +52,21 @@ Future optional ext domains get their own subdirs (e.g. `ext/web/`, `ext/quantum | `web` | `web/web.mq.md`, `web/网页.mq.md`, **`native/libweb.so`** — 见 [ext-web.md](ext-web.md) · [roadmap](../roadmap/ext-web.md) | | `quantum` | `quantum/quantum.mq.md`, `quantum/量子.mq.md`, **`native/libquantum.so`** — 见 [ext-quantum.md](ext-quantum.md) · [roadmap](../roadmap/ext-quantum.md) | -`add agent` copies the built native plugin into `MARQDO_EXT/native/`. Build it first: +`add agent` / `add web` / `add quantum` **先定位原生插件**,再复制 `.mq.md`: + +1. 在 `CARGO_TARGET_DIR`、`target/{debug,release}`、源码 `ext` 旁的 `target/`、可执行文件旁等路径查找 `lib{name}.so`(或 `.dll` / `.dylib`) +2. 找不到则自动执行 `cargo build -p marqdo_plugin_{name}`,再安装到 `MARQDO_EXT/native/` +3. 写入 `{name}.plugin` 绝对路径提示,供 `plugin.native_path` 解析 + +这样不会出现「只装了 `.mq.md`、运行时报 native plugin not found」的半安装状态。 ```bash -cargo build -p marqdo_plugin_agent -marqdo ext add agent +# 推荐:在仓库根目录 +marqdo ext add web +# 等价于找到或编好 libweb.so 后拷入 ~/.marqdo/ext/native/ ``` -Without install, runtime resolves the plugin via `plugin.native_path name=agent` (see [ext-abi.md](ext-abi.md)): `MARQDO_AGENT_PLUGIN` → `CARGO_TARGET_DIR/{debug,release}/` → cwd `target/…` → beside `marqdo` binary → `MARQDO_EXT/native/`. +Without a prior install, runtime still resolves via `plugin.native_path name=web` (see [ext-abi.md](ext-abi.md)): `MARQDO_WEB_PLUGIN` → `CARGO_TARGET_DIR/{debug,release}/` → cwd `target/…` → beside `marqdo` binary → `MARQDO_EXT/native/`. ## Tests diff --git a/doc/design/markdown-mapping.md b/doc/design/markdown-mapping.md index 6a039ae..245b6c7 100644 --- a/doc/design/markdown-mapping.md +++ b/doc/design/markdown-mapping.md @@ -268,7 +268,7 @@ Markdown **标记即语法**。输出**不是**语言架构原语,而是内置 | **首列表头 `@` / `行` / `row`** | **行向** `List` of `Map`(标记列不进入字段;任意数据行数) | | 重复表头 | 诊断错误 | -**数据单元格是表达式**(与调用实参值语法相同:裸词、数字、`` `var` ``、算术、引号串;URL / `gpt-4o-mini` 等按路径·连字符折叠为文本)。表头仍是键名文本。细则:[table-cell-expressions.md](table-cell-expressions.md)。 +**数据单元格是表达式**(与调用实参值语法相同:裸词、数字、`` `var` ``、算术、引号串;URL / `gpt-4o-mini` 等按路径·连字符折叠为文本;含 `/` 的 CSS 比率等请用引号 `"1/5"`,裸 `1/5` 为除法)。表头仍是键名文本。细则:[table-cell-expressions.md](table-cell-expressions.md)。 ```markdown *`k` = secret * diff --git a/doc/design/table-cell-expressions.md b/doc/design/table-cell-expressions.md index 4494f97..d9cb69e 100644 --- a/doc/design/table-cell-expressions.md +++ b/doc/design/table-cell-expressions.md @@ -44,10 +44,11 @@ v1 把 GFM 数据单元格一律收成 **字面量**(`Int` / `Text`)。结 | `` `api_key` `` | 变量引用 | | `` `a` + `b` `` | 普通表达式 | | `True` / `假` / `None` | 布尔 / 空 | -| `"https://…"` / `".marqdo/x"` | 引号字符串(可含 `/`、插值) | +| `"https://…"` / `".marqdo/x"` / `"1/5"` / `"16/9"` | 引号字符串(可含 `/`、插值;**CSS 比率等含 `/` 的值请用引号**,勿依赖空格消歧) | | `https://api.openai.com/v1` | **路径折叠**:无空格的 `Text/Text/…` 除法链收成整段文本(同调用实参) | | `gpt-4o-mini` | **连字符散文**:不拆成减法(同调用实参) | | `` /about ``、`` /chat/completions `` | 以 `/` 开头的路径散文 → 整段文本 | +| `1/5` | **整数除法**(同表达式 / 调用实参;今日整除得 `0`)——要文本请写 `"1/5"` | | 空单元格 | 空文本 `""` | ### 2.2 表头仍是键名文本 @@ -111,9 +112,10 @@ v1 把 GFM 数据单元格一律收成 **字面量**(`Int` / `Text`)。结 |--------|------| | 纯中文/英文词、整数 | **不变** | | `gpt-4o-mini`、URL、`/path` | **不变**(折叠规则与调用实参一致) | -| 真正要做除法 / 减法 | 用空格或括号:`` `n` / 2 ``、`` `a` - 1 ``;或先在表外算再 `` `x` `` 填入 | +| 真正要做除法 / 减法 | 裸写 `1/5` 或空格/括号:`` `n` / 2 ``、`` `a` - 1 ``;或先在表外算再 `` `x` `` 填入 | +| CSS / 含 `/` 的散文值 | **引号优先**:`"1/5"`、`"16/9"`、`"image/png"`(不靠空格把算术「关掉」) | -破坏性:几乎无。唯一需注意的是「想在单元格里写算术且两侧是裸词」——与调用实参同一套消歧。 +破坏性:几乎无。唯一需注意的是「想在单元格里写算术且两侧是裸词」——与调用实参同一套消歧;含 `/` 的**文本**一律用引号。 --- @@ -132,6 +134,7 @@ v1 把 GFM 数据单元格一律收成 **字面量**(`Int` / `Text`)。结 |----|------| | 金样 | 横表单元格 `` `var` `` 读环境;竖表旧金样全绿 | | 路径 | `https://…`、`/chat/completions`、`gpt-4o-mini` 仍为文本 | +| 含 `/` 文本 | 表单元格用引号:`"1/5"`、`"16/9"`;裸 `1/5` 为除法 | | 扩展 | `ext/ai/llm` 构造可用表写入运行时字段,去掉无必要的 `json.set` 链 | | 文档 | 本页 + roadmap T5 + markdown-mapping §9 同步 | diff --git a/ext/web/web.mq.md b/ext/web/web.mq.md index 25a3724..fa966b4 100644 --- a/ext/web/web.mq.md +++ b/ext/web/web.mq.md @@ -24,8 +24,11 @@ Load the ABI v2 `web` plugin once. Assemble a GFM style table into a CSS string. Two shapes are accepted: `|选择器|属性|值|` rule rows (arbitrary selectors; rows sharing a selector are merged, and a leading `|媒体|` column groups rows into `@media` blocks), or -`|属性|值|` property rows wrapped as `.name { … }`. Styles stay as data tables, -`make_style` turns them into CSS — 样式即数据、装配即函数. +`|属性|值|` property rows wrapped as `.name { … }`. Selectors starting with +`@keyframes name` emit keyframe blocks (`属性` = stop `from`/`to`/`N%`, +`值` = `prop: val` or use `@keyframes name from` + normal 属性/值). Quote CSS +values that contain `/` (e.g. `"16/9"`, `"1/5"`); bare `1/5` is integer division. +Styles stay as data tables, `make_style` turns them into CSS — 样式即数据、装配即函数. > ensure_plugin **> web_style name=`name` table=`table`** diff --git a/ext/web/网页.mq.md b/ext/web/网页.mq.md index ceab2a9..f8b2025 100644 --- a/ext/web/网页.mq.md +++ b/ext/web/网页.mq.md @@ -24,6 +24,9 @@ import sys:lib/sys.mq.md 把 GFM 样式表装配成一段 CSS 文本。支持两种表形: `|选择器|属性|值|` 规则行(选择器任意,同一选择器多行合并成一条规则; 加 `|媒体|` 列即可分组进 `@media` 块),或 `|属性|值|` 属性行(按 `.名 { … }` 包裹)。 +选择器以 `@keyframes 名` 开头时输出关键帧块(`属性` 为停点 `from`/`to`/`N%`, +`值` 写 `opacity: 0` 等声明;也可用 `@keyframes 名 from` + 普通属性/值)。 +含 `/` 的 CSS 值请加引号(如 `"16/9"`、`"1/5"`),否则按表达式除法求值。 样式即数据、装配即函数 —— 主题模块据此把样式表拼成完整样式表。 > 确保插件 diff --git a/plugins/web/src/http.rs b/plugins/web/src/http.rs index 861846b..84c9b29 100644 --- a/plugins/web/src/http.rs +++ b/plugins/web/src/http.rs @@ -1211,16 +1211,6 @@ fn flash_html(flash: Option<&str>) -> String { } } -fn truncate_cell(s: &str, max: usize) -> String { - let mut it = s.chars(); - let head: String = it.by_ref().take(max).collect(); - if it.next().is_some() { - format!("{head}…") - } else { - head - } -} - fn admin_shell(st: &AppState, title: &str, active: Option<&str>, inner: &str) -> String { let tables = st .db_url @@ -1270,7 +1260,7 @@ fn admin_shell(st: &AppState, title: &str, active: Option<&str>, inner: &str) ->