feat: migrate corpus to file-scoped occlusion

This commit is contained in:
cflmy committed 2026-10-23 12:45:01 +00:00
1 parent c773503938
commit aea86746e7
485 files changed
+1160 -340

No files matched your search

+7
View File
@@ -45,10 +45,17 @@ marqdo ext add web # CDN → 2.0.0
### Added
- **文件级新语义迁移**:`marqdo migrate labels --mark` 可把整个库/目录迁移到显式 `markup: occlusion`,即使文件没有旧式索引也不再依赖进程默认值。迁移验证为语法级、无导入解析依赖,并在写入前比较 Classic 与 Occlusion AST 形状。
- **显式过渡入口**:`marqdo run --legacy-markup` 与 `marqdo check --legacy-markup` 可在一个版本周期内审阅未迁移的旧文件;环境变量不再改变语法。
### Fixed
- 标准库、扩展库、示例、公开文档与可解析测试夹具迁移为文件级 Occlusion;旧的 `[键](集合)` 和 `- [项](集合)` 分别改为 `access` 与 `遍历`。
### Changed
- 未标注源码默认采用 Occlusion。Classic 仅能通过明确的 frontmatter 或 `--legacy-markup` 进入,避免同一文档因进程配置而静默改变含义。
## v1.5.2 — 2026-10-18
### Highlights
+5 -5
View File
@@ -31,7 +31,7 @@ Marqdo 把 Markdown **标记当作编程语法**:同一个 `.mq.md` 文件,
| **知识-代码一致性**<br>Knowledge-Code Coherence | 说明、数据、示例与实现**同一份源文件**:文档里的表格就是程序的数据,文档里的调用就是真实执行。「文档过期」不再是悄悄漂移,而是可被机器发现的**知识不一致**——知识陈述本身可以被测试。 |
| **默认安全,AI 友好** | 无标记文字默认是叙述(注释),只有显式标记才进入执行。AI 自由发挥**不会污染**文档与代码的边界——这比「自然语言编程」安全得多,是 AI 原生语言的重要前提。 |
| **multi-view artifact**<br>`.mq.md` 双后缀即开放接口 | `.mq` 告诉解释器「可执行」,`.md` 告诉整个 Markdown 生态「仍是文档」。GitHub 直接读、VS Code 直接改、搜索引擎直接索引、LLM 直接理解、Marqdo 直接运行。**Marqdo 不占有知识,只是给 Markdown 增加执行语义。** |
| **表格即数据结构** | 程序的数据结构直接就是文档的数据结构:单列竖表 → `List`;横表(1 数据行)→ `Map`;横表(多数据行)→ `Map` of `List`(列向聚合);首列写 `@` / `行` / `row` → 行向记录 `List` of `Map`。取元 `[键](集合)` 也是 Markdown 链接形。这是 literate programming 的下一步。 |
| **表格即数据结构** | 程序的数据结构直接就是文档的数据结构:单列竖表 → `List`;横表(1 数据行)→ `Map`;横表(多数据行)→ `Map` of `List`(列向聚合);首列写 `@` / `行` / `row` → 行向记录 `List` of `Map`。取元使用 `access(集合, "键")`,链接 `[描述](表达式)` 只承载叙述与执行体。这是 literate programming 的下一步。 |
| **语义干净** | **返回是架构,打印只是函数**:`*…*` 改变控制流,`print` 只是副作用函数;分支与循环长在 Markdown 结构上(`1.` `2.` 递增 = 分支,`-` = 循环),不是所有列表都被粗暴当成 if。 |
| **AI 的可靠上下文与长期记忆** | 一个 `.mq.md` 同时是 documentation + schema + code + examples + knowledge + executable behavior;AI 不必再拼装 README + OpenAPI + JSON Schema + prompt。整个工程天然就是 AI 的**世界模型**——比 RAG 更接近 Executable RAG。 |
| **链接即调用**<br>Link as Call | 文档里的 `[描述](类.函数)` 不是装饰,是跨文档类调用;编译器解析类/函数并返回 **LinkInfo**,`view` 显示调用点,EKC 建边,`links.lock` 可选复现。**v2.1 设计目标**;v2.0.0 已具备本地表达式链接与 `import` + 实例调用。 |
@@ -151,7 +151,7 @@ Marqdo 把 Markdown **标记当作编程语法**:同一个 `.mq.md` 文件,
|------|------|
| 无标记行 | 叙述(注释);行内 `` `名` `` 可声明 |
| `**…**` | **代码**(赋值 / 调用 / 表达式) |
| `[描述](表达式)` | **链接(本地)**:描述 + 代码;`()` 与 `**…**` 同权(v2.0.0 需 `markup: occlusion`) |
| `[描述](表达式)` | **链接(本地)**:描述 + 代码;`()` 与 `**…**` 同权(默认语义) |
| `[描述](类.函数)` | **链接(跨文档/类调用)**:描述 + 已有类函数调用;可解析、可执行(v2.1 目标) |
| `[描述](url)` | 普通 Markdown 导航链接(惰性,不执行) |
| `*…*` | **返回值**(整行、`返回*n*`、或表达式形) |
@@ -163,11 +163,11 @@ Marqdo 把 Markdown **标记当作编程语法**:同一个 `.mq.md` 文件,
| `` > `obj`.method … `` | 方法调用(`obj` 为带 `_type` 的 map) |
| 叙述 `` `名` `` / `` `名`=默认 `` | 形参由体推断(`` + `名` `` 仍可用) |
| `1.` … | 体内 `1.` `2.` … = 分支(`N. *` = else) |
| `-` | 循环(`` - `条件` `` 或 `` - [项](集合) ``) |
| 表格 | 集合(几何即类型,见下);取元优先 `[键](集合)` |
| `-` | 循环(`` - `条件` `` 或 `` - [项](遍历 集合 为 项) ``) |
| 表格 | 集合(几何即类型,见下);取元使用 `access(集合, "键")` |
| 单独一行 `---` / `***` | **叙述分隔**(跳过;不是函数收束) |
> `[键](集合)` / `- [项](集合)` 是旧取元/循环形;v2 链接语法推荐 `[描述](表达式)` / `[描述](类.函数)` / `- [描述](遍历 集合 为 项)`。旧形在 Classic 下保留,见 [link-syntax.md](doc/design/link-syntax.md)。
> `[键](集合)` / `- [项](集合)` 是旧取元/循环形;迁移后使用 `access(集合, "键")` 与 `- [描述](遍历 集合 为 项)`。旧形只在显式 `markup: classic` 或 `--legacy-markup` 过渡入口中保留,见 [link-syntax.md](doc/design/link-syntax.md)。
```markdown
# main
@@ -1066,8 +1066,8 @@ View 至少展示:
| 阶段 | 默认行为 | 兼容行为 |
|---|---|---|
| 2.0.x | Classic 默认,Occlusion opt-in | 当前行为 |
| 2.1 preview | 新语义可显式开启;迁移报告必开 | Classic 发 deprecated warning |
| 2.0.x | Classic 默认,Occlusion opt-in | 历史行为 |
| 2.1 preview | 新语义默认;全仓语料具有文件级 `markup: occlusion` | `--legacy-markup` / 显式 `markup: classic` 只读过渡 |
| 2.1 stable | 新语义默认;旧形状必须已迁移 | `--legacy-markup` 只读运行一个周期 |
| 2.2 | 删除全局模式与旧 parser 分支 | 仅保留明确错误和迁移建议 |
@@ -1085,7 +1085,7 @@ View 至少展示:
### 16.3 必须显式变化的能力
- `[键](集合)` 迁为 `at`;
- `[键](集合)` 迁为 `access(集合, "键")`;
- 链接不再依赖进程级 markup 模式;
- `类.函数` 对无 receiver 函数成为合法 AssociatedFunction 调用;
- 正文知识链接被解析和诊断,但不自动执行;
+1
View File
@@ -1,4 +1,5 @@
---
markup: occlusion
title: agent-okf-flywheel (Wave B0)
description: Promote solidified workbook; second plan is cache=hit — document as knowledge base (OKF).
import:
+1
View File
@@ -1,4 +1,5 @@
---
markup: occlusion
title: agent-pong (Wave B0)
description: >-
Constitution demo — call_site + source in step context; optional live CALL via .env.
+6 -5
View File
@@ -1,4 +1,5 @@
---
markup: occlusion
title: agent-sandbox-okf — trial then commit
description: >
O1 example: opt-in sandbox trial with GFM-table returns and link-index reads.
@@ -20,8 +21,8 @@ Short demo: write via `agent.trial`, prove the host is clean until commit.
> fs.make_dir path="_example_sbx"
**dry = agent.trial root="_example_sbx" write_path="note.txt" text=sandbox-okf commit=False**
**dry_ok = [ok](dry)**
**dry_committed = [committed](dry)**
**dry_ok = [ok](access(dry, "ok"))**
**dry_committed = [committed](access(dry, "committed"))**
1. `dry_ok`
1. not `dry_committed`
> print text=dry-ok
@@ -37,8 +38,8 @@ Short demo: write via `agent.trial`, prove the host is clean until commit.
> print text=host-clean
**wet = agent.trial root="_example_sbx" write_path="note.txt" text=sandbox-okf commit=True**
**wet_ok = [ok](wet)**
**wet_committed = [committed](wet)**
**wet_ok = [ok](access(wet, "ok"))**
**wet_committed = [committed](access(wet, "committed"))**
1. `wet_ok`
1. `wet_committed`
> print text=wet-ok
@@ -53,7 +54,7 @@ Short demo: write via `agent.trial`, prove the host is clean until commit.
2. *
> print text=proof-missing
**pname = [name]([profile](wet))**
**pname = [name](access([profile](access(wet, "profile")), "name"))**
1. `pname` == "default"
> print text=profile-default
2. *
@@ -1,4 +1,5 @@
---
markup: occlusion
title: components/chrome
description: 暗恋见君壳层 — head 资源表、导航 HTML、页脚 HTML(对齐 Django base / site_footer)。
---
+4
View File
@@ -1,3 +1,7 @@
---
markup: occlusion
---
## 页脚
站点信息与站长链接(毛玻璃底由壳样式绘制)。
@@ -1,4 +1,5 @@
---
markup: occlusion
title: components/fragments
description: AJAX 片段 — /post/ten、/news/five。
导入:
+4
View File
@@ -1,3 +1,7 @@
---
markup: occlusion
---
## 首页引言
英雄区 HTML(品牌标语 + CTA + 漂浮主图)。样式在 `styles/shell` 的 Hero / 动效表。
@@ -1,4 +1,5 @@
---
markup: occlusion
title: components/home_body
description: 首页主体 HTML — hero + 公告 + 新闻时间线 + 论坛帖子(对齐 Django home.html,无外层导航)。
导入:
@@ -20,9 +21,9 @@ description: 首页主体 HTML — hero + 公告 + 新闻时间线 + 论坛帖
**帖子行 = > 库.查询 表="posts" 上限=10 排序="-created_at"**
**公告段 = None**
- [告](公告行)
**文 = [content](告)**
**时 = [created_at](告)**
- [告](遍历 公告行 为 告)
**文 = [content](access(告, "content"))**
**时 = [created_at](access(告, "created_at"))**
**一项 = "<div class=\"notice-item\"><article class=\"notice-content\">" + 文 + "</article><p class=\"notice-create-time\">" + 时 + "</p></div>"**
**公告段 = > table.append list=公告段 item=一项**
1. 公告段
+4
View File
@@ -1,3 +1,7 @@
---
markup: occlusion
---
## 导航
顶栏:首页、帖子、新闻、搜索、聊天、发帖(登录后)、后台。
+1
View File
@@ -1,4 +1,5 @@
---
markup: occlusion
title: components/page
description: 用原站 chrome 包一层完整 HTML 引言(bare 布局)。
import:
+1
View File
@@ -1,4 +1,5 @@
---
markup: occlusion
title: db/index
description: 打开库、建全表、幂等种子、帖子全文索引。
导入:
+4
View File
@@ -1,3 +1,7 @@
---
markup: occlusion
---
## posts
帖子主表。`slug` 用于详情路径;`board` 为板块显示名,`board_id` 关联 `boards`。
+4
View File
@@ -1,3 +1,7 @@
---
markup: occlusion
---
## boards
帖子板块:日常 / 开发 / 聊天。
+9 -8
View File
@@ -1,4 +1,5 @@
---
markup: occlusion
title: 暗恋见君 · Marqdo
description: 对齐 Django 暗恋见君:原站 CSS/DOM、首页四段、列表详情、发帖门禁、聊天室、专题、搜索、API 指南。
导入:
@@ -141,10 +142,10 @@ description: 对齐 Django 暗恋见君:原站 CSS/DOM、首页四段、列表
**房间行 = > store.查询 表="chat_rooms" 上限=50**
**房间段 = None**
- [房](房间行)
**名 = [name](房)**
**链 = [slug](房)**
**摘 = [summary](房)**
- [房](遍历 房间行 为 房)
**名 = [name](access(房, "name"))**
**链 = [slug](access(房, "slug"))**
**摘 = [summary](access(房, "summary"))**
**项 = "<article class=\"chat-room-card\"><h3><a href=\"/chat/" + 链 + "\">" + 名 + "</a></h3><p>" + 摘 + "</p></article>"**
**房间段 = > table.append list=房间段 item=项**
**房间内 = > text.str_join xs=房间段 sep=""**
@@ -165,10 +166,10 @@ description: 对齐 Django 暗恋见君:原站 CSS/DOM、首页四段、列表
**专题行 = > store.查询 表="topics" 上限=50**
**专题段 = None**
- [题](专题行)
**题名 = [title](题)**
**链 = [slug](题)**
**摘 = [summary](题)**
- [题](遍历 专题行 为 题)
**题名 = [title](access(题, "title"))**
**链 = [slug](access(题, "slug"))**
**摘 = [summary](access(题, "summary"))**
**项 = "<article class=\"topic-card\"><h3>" + 题名 + "</h3><p>" + 摘 + "</p><p class=\"text-muted\">slug: " + 链 + "</p></article>"**
**专题段 = > table.append list=专题段 item=项**
**专题内 = > text.str_join xs=专题段 sep=""**
+5 -4
View File
@@ -1,4 +1,5 @@
---
markup: occlusion
title: anlian-mq offline smoke
description: 不 listen:装配库表/页面/门禁/WS 路由袋,验证可读路径可构造。
导入:
@@ -45,7 +46,7 @@ description: 不 listen:装配库表/页面/门禁/WS 路由袋,验证可读
**应用 = > 应用.门禁 路径="/write" 角色="admin" 匹配="prefix" 拒绝="redirect"**
**应用 = > 应用.路由实时 路径="/chat/ws" 模式="broadcast"**
**gates = [gates](应用)**
**gates = [gates](access(应用, "gates"))**
**n = > len value=`gates`**
1. `n` >= 2
> print text=gates-ok
@@ -53,9 +54,9 @@ description: 不 listen:装配库表/页面/门禁/WS 路由袋,验证可读
> print text=gates-fail
> sys.exit code=1
**ws = [ws_routes](应用)**
**room = [/chat/ws](ws)**
**mode = [mode](room)**
**ws = [ws_routes](access(应用, "ws_routes"))**
**room = [/chat/ws](access(ws, "/chat/ws"))**
**mode = [mode](access(room, "mode"))**
1. `mode` == "broadcast"
> print text=ws-ok
2. *
+1
View File
@@ -1,4 +1,5 @@
---
markup: occlusion
title: styles/shell
description: 暗恋见君壳样式——对照 Django 原站粉玻璃 + 动效,用表格声明。
导入:
+1
View File
@@ -1,4 +1,5 @@
---
markup: occlusion
title: browser counter (C3)
description: wire table + browser.set_text — no json glue
import:
+1
View File
@@ -1,4 +1,5 @@
---
markup: occlusion
title: browser fetch (C4)
description: fetch/after effects via lib/browser — no json glue
import:
+1
View File
@@ -1,4 +1,5 @@
---
markup: occlusion
title: browser form (D3)
description: input wire passes value; effects via lib/browser
import:
+1
View File
@@ -1,4 +1,5 @@
---
markup: occlusion
title: browser-media (route F)
description: file / canvas / audio / observers / drag — GFM tables + lib/browser
import:
@@ -1,4 +1,5 @@
---
markup: occlusion
title: resolve_config
capability: config.resolve
status: stable
@@ -1,4 +1,5 @@
---
markup: occlusion
title: Engineering Knowledge demo
description: Tiny project demonstrating Capability Catalog + reuse + decisions.
---
@@ -1,4 +1,5 @@
---
markup: occlusion
id: document.invoice-answer
type: Answer
import:
@@ -7,7 +8,7 @@ import:
# 发票回答
**总额 = [订单的含税总价](pricing.订单定价.含税总额(订单))**
**总额 = [订单的含税总价](access(pricing.订单定价.含税总额(订单), "订单的含税总价"))**
这张订单的含税总额是[含税总价](总额)。
@@ -1,4 +1,5 @@
---
markup: occlusion
id: schema.order
type: Schema
---
+1
View File
@@ -1,4 +1,5 @@
---
markup: occlusion
type: Fact
id: libai
title: 李白
@@ -1,4 +1,5 @@
---
markup: occlusion
import:
libai: libai.mq.md
---
+4
View File
@@ -1,3 +1,7 @@
---
markup: occlusion
---
# main
诗人李白的出生年份是[出生年份](李白.出生年份)。
+4
View File
@@ -1,3 +1,7 @@
---
markup: occlusion
---
# 诗人
| 字段 | 类型 | 说明 |
+3 -2
View File
@@ -1,4 +1,5 @@
---
markup: occlusion
title: Least squares via lstsq
description: Overdetermined Ax≈b with ext/linalg lstsq + heatmap.
import:
@@ -28,8 +29,8 @@ $$
**`_` = > la.draw factor=`A` kind="heatmap" theme="light" path="ls-heatmap.svg"**
**`ls` = > la.lstsq a=`A` b=`b`**
**`x` = [x](ls)**
**`resid` = [residual_fro](ls)**
**`x` = [x](access(ls, "x"))**
**`resid` = [residual_fro](access(ls, "residual_fro"))**
> print text=`x`
> print text=`resid`
+2 -1
View File
@@ -1,4 +1,5 @@
---
markup: occlusion
title: SVD structure demo
description: Diagonal SVD + structure SVG via ext/linalg.
import:
@@ -18,7 +19,7 @@ $$
**`M` = > la.from_formula formula=`M`**
**`f` = > la.factorize matrix=`M` kind="svd"**
**`S` = [S](f)**
**`S` = [S](access(f, "S"))**
**`_` = > la.draw factor=`f` kind="svd" theme="light" path="svd-structure.svg"**
**`hm` = > la.draw factor=`M` kind="hinton" path="svd-hinton.svg"**
+3 -2
View File
@@ -1,4 +1,5 @@
---
markup: occlusion
title: Transpose identity (formula document)
description: (AB)^T = B^T A^T as a runnable lecture fragment.
import:
@@ -19,8 +20,8 @@ Declare shapes in a table, form \(P = AB\), then check \((AB)^\top = B^\top A^\t
| 2 | B | 3 | 2 |
**`env` = > la.declare table=`shapes`**
**`A` = [A](env)**
**`B` = [B](env)**
**`A` = [A](access(env, "A"))**
**`B` = [B](access(env, "B"))**
**`P` = `A` * `B`**
**`t` = > `P`.T_ascii**
> print text=`t`
+1
View File
@@ -1,4 +1,5 @@
---
markup: occlusion
type: Fact
id: libai
title: 李白
+4
View File
@@ -1,2 +1,6 @@
---
markup: occlusion
---
# main
用户想要知道李白的出生年份,我们要告诉用户[李白的出生年份](李白.李白的出生年份)
+1
View File
@@ -1,4 +1,5 @@
---
markup: occlusion
type: endpoint
method: POST
path: /api/echo
+1
View File
@@ -1,4 +1,5 @@
---
markup: occlusion
type: endpoint
method: GET
path: /api/ping
@@ -1,3 +1,7 @@
---
markup: occlusion
---
## 页脚
站点页脚。放版权与概览链接。
@@ -1,3 +1,7 @@
---
markup: occlusion
---
## 导航
站点顶部导航。首项是站点名(渐变 Logo 由主题 CSS 处理),`后台` 指向需要登录的 `/admin`。
@@ -1,3 +1,7 @@
---
markup: occlusion
---
## 侧栏
右侧归档面板:文章入口、标签、实时小部件。
+1
View File
@@ -1,4 +1,5 @@
---
markup: occlusion
title: blog posts schema
import:
data: ext/data/db.mq.md
+4
View File
@@ -1,3 +1,7 @@
---
markup: occlusion
---
## posts
文章主表结构。`slug` 用于详情页 `/post/{slug}` 的动态路由;`content` 存 Markdown 正文;`tag` 是主标签(tags 表 slug)。
+4
View File
@@ -1,3 +1,7 @@
---
markup: occlusion
---
## posts
种子文章。首页与详情页的初始数据。created_at 用于按时间倒序展示;tag 是主标签 slug。
+1
View File
@@ -1,4 +1,5 @@
---
markup: occlusion
type: web
title: Marqdo 博客
route: /
+1
View File
@@ -1,4 +1,5 @@
---
markup: occlusion
类型: 网页
路由: /about
方法: GET
+1
View File
@@ -1,4 +1,5 @@
---
markup: occlusion
type: web
title: Post
route: /post/{slug}
+1
View File
@@ -1,4 +1,5 @@
---
markup: occlusion
title: marqdo-blog serve
description: Scan Artifact documents/endpoints and listen (ADR 0007).
import:
+1
View File
@@ -1,4 +1,5 @@
---
markup: occlusion
title: styles/theme
description: 博客主题:样式即数据表格,装配即函数。
import:
+4
View File
@@ -1,3 +1,7 @@
---
markup: occlusion
---
## 加一
对于输入变量`n`,我们执行 **`n` = `n` + 1**,然后把更新后的值作为结果返回 *`n`*。
+3 -2
View File
@@ -1,4 +1,5 @@
---
markup: occlusion
title: 贝尔态:两个量子比特如何一起回答
description: 从一条假设开始,搭电路、看概率、画图,并用断言验收。
import:
@@ -31,8 +32,8 @@ import:
我们期待什么?如果假设成立,`概率`应该只在「00」与「11」上有值,而且各占一半。
先把两个关键概率取出来,读者不必在长映射里找:
**`p00` = [00](概率)**
**`p11` = [11](概率)**
**`p00` = [00](access(概率, "00"))**
**`p11` = [11](access(概率, "11"))**
> print text=`p00`
> print text=`p11`
+1
View File
@@ -1,4 +1,5 @@
---
markup: occlusion
title: 一份可执行的求导讲义
description: 公式、求导、求根、求值与绘图,在同一条叙述里完成。
import:
+1
View File
@@ -1,4 +1,5 @@
---
markup: occlusion
title: Bell state
description: H then CX; probabilities ≈ 1/2; circuit SVG.
import:
+2 -1
View File
@@ -1,4 +1,5 @@
---
markup: occlusion
title: Entanglement lab
description: Bell state — density, partial trace, Schmidt, themed SVG (Q7/Q8).
import:
@@ -31,7 +32,7 @@ Build |Φ⁺⟩ with H then CX. Full-state purity stays 1; tracing out one qubit
**ezz = > `qc`.expect obs=`zz`**
**sch = > `qc`.schmidt cut=1**
**ent = [entropy](sch)**
**ent = [entropy](access(sch, "entropy"))**
**_ = > `qc`.draw path="entangle-circuit.svg" theme="dark"**
**_ = > `qc`.draw kind="hinton" path="entangle-hinton.svg"**
+1
View File
@@ -1,4 +1,5 @@
---
markup: occlusion
title: GHZ state
description: 3-qubit GHZ; |000⟩/|111⟩ ≈ 1/2; probs + H matrix heatmap.
import:
+1
View File
@@ -1,4 +1,5 @@
---
markup: occlusion
type: web
title: Marqdo client site
route: /
+1
View File
@@ -1,4 +1,5 @@
---
markup: occlusion
title: web-client-site serve
import:
web: ext/web/web.mq.md
@@ -1,4 +1,5 @@
---
markup: occlusion
title: client counter (route D)
description: wired by client_embed auto-mount; GFM + lib/browser
import:
+1
View File
@@ -1,4 +1,5 @@
---
markup: occlusion
title: web-collab-doc
description: Two-browser collaborative plain-text editor over WS room (LWW snapshot sync)
import:
@@ -1,4 +1,5 @@
---
markup: occlusion
title: collab client
description: LWW text sync over WS room + presence (DOC\\t protocol)
import:
@@ -1,3 +1,7 @@
---
markup: occlusion
---
## 页脚
`页脚` =
@@ -1,3 +1,7 @@
---
markup: occlusion
---
## 导航
站点顶部导航。`后台` 指向需要登录的 `/admin`。
@@ -1,3 +1,7 @@
---
markup: occlusion
---
## 侧栏
本示例展示了哪些特性。
@@ -1,3 +1,7 @@
---
markup: occlusion
---
## 结构
`字段` =
+1
View File
@@ -1,4 +1,5 @@
---
markup: occlusion
title: db/index
description: 打开 sqlite、建表、幂等种子。
导入:
+5 -4
View File
@@ -1,4 +1,5 @@
---
markup: occlusion
title: 网络扩展站(中文)
description: 首页 + /about + /new(表单)+ /tools(lib/net)+ /admin(登录鉴权)+ /live(WebSocket)。
导入:
@@ -56,18 +57,18 @@ description: 首页 + /about + /new(表单)+ /tools(lib/net)+ /admin(
<!-- 工具页:用 lib/net 解析展示 -->
**解析请求 = > net.解析Cookie 内容="session=abc123; theme=dark"**
**请求块 = [1](解析请求)**
**请求块 = [1](access(解析请求, "1"))**
**解析响应 = > net.解析Cookie 内容="id=42; Path=/; HttpOnly; SameSite=Lax" 是响应头=True**
**响应块 = [1](解析响应)**
**响应块 = [1](access(解析响应, "1"))**
`边界` = ----b
`正文` = "--`边界`\nContent-Disposition: form-data; name=\"title\"\n\n你好\n--`边界`\nContent-Disposition: form-data; name=\"封面\"; filename=\"pic.png\"\nContent-Type: image/png\n\n<字节>\n--`边界`--\n"
**多部分 = > net.解析多部分 正文=`正文` 边界=`边界`**
**字段块 = [1](多部分)**
**文件块 = [2](多部分)**
**字段块 = [1](access(多部分, "1"))**
**文件块 = [2](access(多部分, "2"))**
`工具段` =
@@ -1,3 +1,7 @@
---
markup: occlusion
---
## 顶栏
`顶栏` =
@@ -1,3 +1,7 @@
---
markup: occlusion
---
## foot
`foot` =
@@ -1,3 +1,7 @@
---
markup: occlusion
---
## nav
Site top navigation. The Admin tab points at the login-gated admin page.
@@ -1,3 +1,7 @@
---
markup: occlusion
---
## side
Sidebar index of what this example demonstrates.
+4
View File
@@ -1,3 +1,7 @@
---
markup: occlusion
---
## schema
`fields` =
+1
View File
@@ -1,4 +1,5 @@
---
markup: occlusion
title: db/index
description: Open sqlite, init articles, seed once.
import:
+5 -4
View File
@@ -1,4 +1,5 @@
---
markup: occlusion
title: web-net-site
description: Home + /about + /new (form) + /tools (net lib) + /admin (auth) + /live (WebSocket).
import:
@@ -47,12 +48,12 @@ About page: same shell.
Parse a `Cookie` request header with the standard library.
**parsed_req = > net.cookie_parse text="session=abc123; theme=dark"**
**req_cookie = [1](parsed_req)**
**req_cookie = [1](access(parsed_req, "1"))**
Parse a `Set-Cookie` response header.
**parsed_resp = > net.cookie_parse text="id=42; Path=/; HttpOnly; SameSite=Lax" is_response=True**
**resp_cookie = [1](parsed_resp)**
**resp_cookie = [1](access(parsed_resp, "1"))**
Parse a `multipart/form-data` body.
@@ -61,8 +62,8 @@ Parse a `multipart/form-data` body.
`_body` = "--`_b`\nContent-Disposition: form-data; name=\"title\"\n\nHello\n--`_b`\nContent-Disposition: form-data; name=\"cover\"; filename=\"pic.png\"\nContent-Type: image/png\n\n<bytes>\n--`_b`--\n"
**mp = > net.multipart_parse body=`_body` boundary=`_b`**
**mp_title = [1](mp)**
**mp_cover = [2](mp)**
**mp_title = [1](access(mp, "1"))**
**mp_cover = [2](access(mp, "2"))**
Build the tools page as one HTML intro (intro is served raw).
+4
View File
@@ -1,3 +1,7 @@
---
markup: occlusion
---
## topnav
`topnav` =
@@ -1,4 +1,5 @@
---
markup: occlusion
title: components/desk
description: 管理台壳 — 顶栏品牌为「后台」,无前台侧栏。
---
@@ -1,3 +1,7 @@
---
markup: occlusion
---
## foot
`foot` =
@@ -1,3 +1,7 @@
---
markup: occlusion
---
## nav
顶栏:**登录**(访客)/ **后台** + **退出**(已登录)。
@@ -1,3 +1,7 @@
---
markup: occlusion
---
## side
`side` =
+4
View File
@@ -1,3 +1,7 @@
---
markup: occlusion
---
## schema
`fields` =
+1
View File
@@ -1,4 +1,5 @@
---
markup: occlusion
title: db/index
description: 打开 sqlite、建表、幂等种子。
导入:
+1
View File
@@ -1,4 +1,5 @@
---
markup: occlusion
title: 中文站点示例
description: >-
与 examples/web-site 对等的 WWW Demo 样站:表驱动全站;作者业务 JS=0;作者 .css=0。
+1
View File
@@ -1,4 +1,5 @@
---
markup: occlusion
title: styles/shell
description: >-
Literary dark theme for examples/web-site — ink / wine / gold after the
+1
View File
@@ -1,4 +1,5 @@
---
markup: occlusion
title: components/desk
description: Admin desk chrome — brand reads Admin; no public side rail.
---
+4
View File
@@ -1,3 +1,7 @@
---
markup: occlusion
---
## foot
`foot` =
+4
View File
@@ -1,3 +1,7 @@
---
markup: occlusion
---
## nav
Brand first, then demo routes. Guest sees **Login**; signed-in sees **Admin** + **Logout**.
+4
View File
@@ -1,3 +1,7 @@
---
markup: occlusion
---
## side
Hands-on demo checklist (links only — no JS).
+4
View File
@@ -1,3 +1,7 @@
---
markup: occlusion
---
## schema
`fields` =
+1
View File
@@ -1,4 +1,5 @@
---
markup: occlusion
title: db/index
description: Open sqlite, init articles, seed once.
import:
+1
View File
@@ -1,4 +1,5 @@
---
markup: occlusion
title: web-site
description: >-
WWW Demo sample — GFM tables for shell, schema, forms, styles, and admin.
+1
View File
@@ -1,4 +1,5 @@
---
markup: occlusion
title: styles/shell
description: >-
Literary dark theme for examples/web-site — ink / wine / gold after the
+1
View File
@@ -1,4 +1,5 @@
---
markup: occlusion
title: web-spa-app
description: Native Marqdo SPA — list/detail/edit via WASM client routes + memory store
import:
+1
View File
@@ -1,4 +1,5 @@
---
markup: occlusion
title: web-tenant-saas demo
description: Dual-tenant isolation via ?t= query + tenant_scope JSON API.
import:
+1
View File
@@ -1,4 +1,5 @@
---
markup: occlusion
title: web-ws-room demo
description: Dynamic room WS with presence (G-WS1/2 bag). Open / and connect via bridge or wscat.
import:
+15 -14
View File
@@ -1,4 +1,5 @@
---
markup: occlusion
title: ext/ai/agent
description: Document-driven agent v2 — step / plan / run; Skill Compilation via ABI plugin (episodes → learn → llm_free).
import:
@@ -139,7 +140,7 @@ Find a human-readable call line: `CALL:<name>` or `调用:<name>` / `调用:<n
**lines = > split value=`text` sep=`nl`**
**found = None**
- [`line`](`lines`)
- [line](遍历 `lines` 为 `line`)
**t = > trim value=`line`**
**parts = > split value=`t` sep=":"**
**n = > len value=`parts`**
@@ -245,7 +246,7 @@ Structured observation for the parent developer-agent: source, named writeback s
**last_ok = None**
**last_error = None**
- [`slot`](`slots`)
- [slot](遍历 `slots` 为 `slot`)
**k = > json.get value=`slot` key="key"**
**body = > json.get value=`slot` key="body"**
1. `k` == "ok"
@@ -407,7 +408,7 @@ With `sandbox=True`, run via `## trial` first (commit on ok); host unchanged unt
**acc = > table.empty_list**
**chars = 0**
**count = 0**
- [`line`](`lines`)
- [line](遍历 `lines` 为 `line`)
1. `count` < `max_lines`
**ln = > len value=`line`**
**next = chars + ln**
@@ -441,7 +442,7 @@ With `sandbox=True`, run via `## trial` first (commit on ok); host unchanged unt
**acc = > table.empty_list**
**i = 0**
**chars = 0**
- [`line`](`lines`)
- [line](遍历 `lines` 为 `line`)
1. `i` >= `start`
**ln = > len value=`line`**
**next = chars + ln**
@@ -468,7 +469,7 @@ Drop `<!-- … -->` blocks (including marqdo-out bodies) so parent excerpts stay
**lines = > split value=`raw` sep=`nl`**
**acc = > table.empty_list**
**skip = None**
- [`line`](`lines`)
- [line](遍历 `lines` 为 `line`)
1. `skip`
**end_parts = > split value=`line` sep="-->"**
**en = > len value=`end_parts`**
@@ -719,7 +720,7 @@ Parse `ARGS:{…}` JSON line, or a bare `{…}` line after CALL.
**text = > trim value=`reply`**
**lines = > split value=`text` sep=`nl`**
**found = None**
- [`line`](`lines`)
- [line](遍历 `lines` 为 `line`)
1. `found`
**_ = 1**
2. *
@@ -909,7 +910,7 @@ Parse READ:source|stderr|stdout|slots|skill (Chinese: 读取:…).
**text = > trim value=`reply`**
**lines = > split value=`text` sep=`nl`**
**found = None**
- [`line`](`lines`)
- [line](遍历 `lines` 为 `line`)
**t = > trim value=`line`**
**parts = > split value=`t` sep=":"**
**n = > len value=`parts`**
@@ -1005,7 +1006,7 @@ Parse NAME: id plus a triple-angle body after CALL:scratch_tool_write.
**name = None**
**body_lines = > table.empty_list**
**in_body = None**
- [`line`](`lines`)
- [line](遍历 `lines` 为 `line`)
1. `in_body`
**t = > trim value=`line`**
1. `t` == `close`
@@ -1231,7 +1232,7 @@ Bounded observation for the parent prompt (actionable, short).
**slots_brief = > table.empty_list**
1. `obs_slots`
- [`slot`](`obs_slots`)
- [slot](遍历 `obs_slots` 为 `slot`)
**sk = > json.get value=`slot` key="key"**
**sl = > json.get value=`slot` key="line"**
**sb = > json.get value=`slot` key="body"**
@@ -1296,7 +1297,7 @@ First matching DECISION / 决定 line wins (ignore later conflicting decisions i
**lines = > split value=`text` sep=`nl`**
**found = None**
- [`line`](`lines`)
- [line](遍历 `lines` 为 `line`)
1. `found`
**_ = 1**
2. *
@@ -1368,7 +1369,7 @@ Parse `SLUG: …` / `标识:…` after a soft-match REUSE decision.
**lines = > split value=`text` sep=`nl`**
**found = None**
- [`line`](`lines`)
- [line](遍历 `lines` 为 `line`)
**t = > trim value=`line`**
**parts = > split value=`t` sep=":"**
**n = > len value=`parts`**
@@ -1420,7 +1421,7 @@ Short parent prompt: REUSE+SLUG or NEW only. Candidates may include lexical `sco
**st = > json.get value=`esc` key="st"**
**lf = > json.get value=`esc` key="lf"**
**lines = > table.empty_list**
- [`t`](`tasks`)
- [t](遍历 `tasks` 为 `t`)
**slug = > json.get value=`t` key="slug"**
**title = > json.get value=`t` key="title"**
**row = slug + sep + title**
@@ -1469,7 +1470,7 @@ First `SUMMARY:` / `汇总:` / `汇总:` line body, else trimmed reply.
**lines = > split value=`text` sep=`nl`**
**found = None**
- [`line`](`lines`)
- [line](遍历 `lines` 为 `line`)
**t = > trim value=`line`**
**parts = > split value=`t` sep=":"**
**n = > len value=`parts`**
@@ -1793,7 +1794,7 @@ Always append a `decision` event. SSE publish only when `stream=True`.
Bubble parent `complete stream=True` reasoning/deltas (and errors) into the plan event list. Skip nested `done` so plan owns the final `done`. Always merge into `events` when present; `stream` reserved for callers that also SSE-publish upstream.
- [`ev`](`from`)
- [ev](遍历 `from` 为 `ev`)
**t = > json.get value=`ev` key="type"**
1. `t` == delta
**events = > table.append list=`events` item=`ev`**
+3 -2
View File
@@ -1,4 +1,5 @@
---
markup: occlusion
title: ext/ai/llm
description: >-
Marqdo LLM intelligence primitive — ask / stream / collect / named handles.
@@ -26,7 +27,7 @@ Collapse a stream event list to final answer text (`done.result` or `error.messa
**answer = ""**
- [ev](events)
- [ev](遍历 events 为 ev)
**t = > json.get value=`ev` key="type"**
1. `t` == "done"
**answer = > json.get value=`ev` key="result"**
@@ -357,7 +358,7 @@ Semantic stream: return the event list (use `llm.collect` to reduce to text). Om
Transport pack via `ext/ai/llm/openai` (Ollama uses the same OpenAI-compatible path). Non-stream → `{text,usage,finish}`; stream → `{events}`.
*> openai.chat_completions base_url=[base_url](self) api_key=[api_key](self) model=[model](self) prompt=`prompt` stream=`stream` echo=`echo` suffix=[suffix](self) bearer=[bearer](self)*
*> openai.chat_completions base_url=[base_url](access(self, "base_url")) api_key=[api_key](access(self, "api_key")) model=[model](access(self, "model")) prompt=`prompt` stream=`stream` echo=`echo` suffix=[suffix](access(self, "suffix")) bearer=[bearer](access(self, "bearer"))*
## complete
+ `prompt`
+1
View File
@@ -1,4 +1,5 @@
---
markup: occlusion
title: ext/ai/llm/ollama
description: >-
Ollama backend defaults. Transport reuses openai-compatible /v1 chat completions.
+1
View File
@@ -1,4 +1,5 @@
---
markup: occlusion
title: step-route policy (O3)
description: >
Table-driven map from step class → Adaptive Routing backend.
+14 -13
View File
@@ -1,4 +1,5 @@
---
markup: occlusion
title: ext/ai/大模型
description: >-
Marqdo 大模型智能原语 — 提问 / 流式 / 收集 / 命名句柄。
@@ -21,15 +22,15 @@ description: >-
**answer = ""**
- [ev](事件)
**t = [type](ev)**
- [ev](遍历 事件 为 ev)
**t = [type](access(ev, "type"))**
1. `t` == "done"
**answer = [result](ev)**
**answer = [result](access(ev, "result"))**
2. `t` == "error"
**answer = [message](ev)**
**answer = [message](access(ev, "message"))**
3. `t` == "delta"
4. `t` == "text"
**chunk = [text](ev)**
**chunk = [text](access(ev, "text"))**
1. `chunk`
**answer = answer + chunk**
2. *
@@ -142,7 +143,7 @@ description: >-
**m = > 创建 模型=`模型` 基址=`基址` 密钥=`密钥`**
**r = > m.提问 提示=`p`**
*[text](r)*
*[text](access(r, "text"))*
# 大模型
+ `模型`=None
@@ -243,10 +244,10 @@ description: >-
表单元格会遮蔽 `自` / 列名,先取出字段再组结果表。
**mdl = [model](自)**
**b = [backend](自)**
**nm = [name](自)**
**tt = [total_tokens](usage)**
**mdl = [model](access(自, "model"))**
**b = [backend](access(自, "backend"))**
**nm = [name](access(自, "name"))**
**tt = [total_tokens](access(usage, "total_tokens"))**
`result` =
@@ -276,7 +277,7 @@ description: >-
+ `流式`=False
+ `打印增量`=False
*> openai.chat_completions base_url=[base_url](自) api_key=[api_key](自) model=[model](自) prompt=`提示` stream=`流式` echo=`打印增量` suffix=[suffix](自) bearer=[bearer](自)*
*> openai.chat_completions base_url=[base_url](access(自, "base_url")) api_key=[api_key](access(自, "api_key")) model=[model](access(自, "model")) prompt=`提示` stream=`流式` echo=`打印增量` suffix=[suffix](access(自, "suffix")) bearer=[bearer](access(自, "bearer"))*
## 运行
+ `提示`
@@ -285,10 +286,10 @@ description: >-
1. `流式`
**pack = > 自.完整结果 提示=`提示` 流式=True 打印增量=`打印增量`**
*[events](pack)*
*[events](access(pack, "events"))*
2. *
**pack = > 自.完整结果 提示=`提示` 流式=False 打印增量=`打印增量`**
*[text](pack)*
*[text](access(pack, "text"))*
## 聊天
+ `提示`
+2 -1
View File
@@ -1,4 +1,5 @@
---
markup: occlusion
title: ext/ai/智能体
description: 文档驱动智能体 v2 — 单步 / 多步 / 运行;技能编译经 ABI v2 agent 插件(情景 → 学习 → llm_free)。
导入:
@@ -38,7 +39,7 @@ description: 文档驱动智能体 v2 — 单步 / 多步 / 运行;技能编
**lines = > split value=`text` sep=`nl`**
**found = 空**
- [`line`](`lines`)
- [line](遍历 `lines` 为 `line`)
**t = > trim value=`line`**
**parts = > split value=`t` sep=:**
**n = > len value=`parts`**
+1
View File
@@ -1,4 +1,5 @@
---
markup: occlusion
title: ext/ai/沙盒
description: >-
AI 试跑 CoW 工作区:打开 / 运行 / 差异 / 提交(中文面,委托英文 sandbox 模块)。
Loaded 100 of 485 files, more files were not shown because too many files have changed in this diff. Show more