diff --git a/doc/roadmap/markup-v0.3.md b/doc/roadmap/markup-v0.3.md index 1d6d5ff..a243fde 100644 --- a/doc/roadmap/markup-v0.3.md +++ b/doc/roadmap/markup-v0.3.md @@ -2,7 +2,7 @@ | | | |---|---| -| 状态 | **Active(v0.3 默认 · 无双模式;markup-v03 金样绿)** | +| 状态 | **Active(v0.3 sole · 存量已迁移 · gold 绿)** | | 日期 | 2026-09-13 | | 设计 | [markdown-mapping-v0.3.md](../design/markdown-mapping-v0.3.md) | | ADR | [0005-prose-unified-markup.md](../adr/0005-prose-unified-markup.md) | @@ -39,27 +39,27 @@ ### M2 — 形参推断 -- [ ] `InferParams`:首次 `` `名` `` = 必选;`` `名`=默认 `` = 可选 -- [ ] 体赋值 `n=n+1` 不误判为默认 -- [ ] 与显式 `+` 合并规则 + 警告 -- [ ] 方法 `self`/`自` 排除 -- [ ] 金样例:默认实参、位置/具名调用、粗体内调用 +- [x] `InferParams`:首次 `` `名` `` = 必选;`` `名`=默认 `` = 可选 +- [x] 体赋值 `n=n+1` 不误判为默认 +- [x] 与显式 `+` 合并规则 + 警告 +- [x] 方法 `self`/`自` 排除 +- [x] 金样例:默认实参、位置/具名调用、粗体内调用 **出门:** 推断签名与 `+` 兼容套件绿。 ### M3 — 调用面与消歧 -- [ ] `**callee args**` ≡ `> callee args` -- [ ] else 臂 `N. *` 与返回斜体消歧 -- [ ] 一行多 `**…**` 按序执行 -- [ ] 金样例:`---` / `*None*` / 整行 `**` / 兼容 `****`;叙述死绑定不升参 +- [x] `**callee args**` ≡ `> callee args` +- [x] else 臂 `N. *` 与返回斜体消歧 +- [x] 一行多 `**…**` 按序执行 +- [x] 金样例:`---` / `*None*` / 整行 `**` / 兼容 `****`;叙述死绑定不升参 - [ ] 诊断:必选缺失、未知 callee;空返回残缺粗体;死变量仅可选 lint **出门:** `tests/markup-v03/*` 覆盖设计 §9 示例。 ### M4 — 双后端与工具 -- [ ] 字节码发射跟随新 Stmt 源 +- [x] 字节码发射跟随新 Stmt 源 - [ ] `view` / Variables:显示推断形参与 prose Decl - [ ] (可选)`marqdo migrate markup-v03` 机械改写提示/工具 @@ -67,14 +67,14 @@ ### M5 — 默认切换与存量迁移 -- [ ] 默认 `MarkupEdition::V03` -- [ ] 迁移 `tests/**`、`lib/**`、`ext/**`、`public/**`、教程 -- [ ] 更新 `.cursor/skills/marqdo/SKILL.md` 硬规则 -- [ ] 修订 [markdown-mapping.md](../design/markdown-mapping.md) 为 v0.3 正式正文(或声明由 v0.3 文件接任) -- [ ] ADR 0005 → **Accepted** +- [x] 默认 `MarkupEdition::V03` +- [x] 迁移 `tests/**`、`lib/**`、`ext/**`、`public/**`、教程 +- [x] 更新 `.cursor/skills/marqdo/SKILL.md` 硬规则 +- [x] 修订 [markdown-mapping.md](../design/markdown-mapping.md) 为 v0.3 正式正文(或声明由 v0.3 文件接任) +- [x] ADR 0005 → **Accepted** - [ ] CHANGELOG / 发版说明(破坏性:标记对调) -**出门:** 全量 gold 默认绿;v0.2 仅 `--markup v0.2` 保留一个过渡版本周期。 +**出门:** 全量 gold 默认绿(live LLM 无钥跳过);无 v0.2 双模式。 --- diff --git a/examples/agent-okf-flywheel/index.mq.md b/examples/agent-okf-flywheel/index.mq.md index af85072..702e241 100644 --- a/examples/agent-okf-flywheel/index.mq.md +++ b/examples/agent-okf-flywheel/index.mq.md @@ -13,7 +13,7 @@ import sys:lib/sys.mq.md OKF flywheel offline: promote → plan same goal → `cache=hit` (no live LLM required for the hit path). -*p = > plugin.native_path name="agent"* +**p = > plugin.native_path name="agent"** 1. `p` > plugin.load path=`p` 2. * @@ -21,14 +21,14 @@ OKF flywheel offline: promote → plan same goal → `cache=hit` (no live LLM re > sys.exit code=1 > sys.env_set name="OPENAI_API_KEY" value="offline-okf-dummy" -*model = > llm.llm* -*tools = > json.parse text=[]* -*助手 = > agent.agent model=`model` tools=`tools` standing="offline okf flywheel"* +**model = > llm.llm** +**tools = > json.parse text=[]** +**助手 = > agent.agent model=`model` tools=`tools` standing="offline okf flywheel"** -*kb = ".marqdo/agent-kb-example-flywheel"* -*wb = ".marqdo/agent-runs/example-pong-solid.mq.md"* -*goal = "Reply with exactly the word pong and nothing else."* -*body = "---\ntitle: okf pong\n---\n\n# main\n\n*msg = \"pong\"*\n\n**msg**\n"* +**kb = ".marqdo/agent-kb-example-flywheel"** +**wb = ".marqdo/agent-runs/example-pong-solid.mq.md"** +**goal = "Reply with exactly the word pong and nothing else."** +**body = "---\ntitle: okf pong\n---\n\n# main\n\n*msg = \"pong\"*\n\n**msg**\n"** 1. > fs.exists path=`kb` > fs.remove path=`kb` @@ -37,20 +37,20 @@ OKF flywheel offline: promote → plan same goal → `cache=hit` (no live LLM re > fs.write_text path=`wb` text=`body` -*prom = > agent_kb_promote kb_dir=`kb` goal=`goal` workbook=`wb`* -*okp = > json.get value=`prom` key="promoted"* +**prom = > agent_kb_promote kb_dir=`kb` goal=`goal` workbook=`wb`** +**okp = > json.get value=`prom` key="promoted"** 1. `okp` > print text=promoted 2. * > print text=promote-fail > sys.exit code=1 -*out = > `助手`.plan goal=`goal` max_rounds=2 writeback=False kb_dir=`kb` explore_n=0 promote=False* -*cache = > json.get value=`out` key="cache"* +**out = > `助手`.plan goal=`goal` max_rounds=2 writeback=False kb_dir=`kb` explore_n=0 promote=False** +**cache = > json.get value=`out` key="cache"** > print text=`cache` -*match = > json.get value=`out` key="match"* +**match = > json.get value=`out` key="match"** > print text=`match` -*val = > json.get value=`out` key="result"* +**val = > json.get value=`out` key="result"** > print text=`val` 1. `cache` == "hit" diff --git a/examples/agent-pong/index.mq.md b/examples/agent-pong/index.mq.md index fd3eb4f..56c599c 100644 --- a/examples/agent-pong/index.mq.md +++ b/examples/agent-pong/index.mq.md @@ -15,12 +15,12 @@ import time:lib/time.mq.md Return today's date string (tool visible in source to the model). -*u = > time.now_unix* -**> time.format unix=`u` pattern="%Y-%m-%d"** +**u = > time.now_unix** +*> time.format unix=`u` pattern="%Y-%m-%d"* # main -*p = > plugin.native_path name="agent"* +**p = > plugin.native_path name="agent"** 1. `p` > plugin.load path=`p` 2. * @@ -35,53 +35,53 @@ Return today's date string (tool visible in source to the model). |------| | 获取时间 | -*model = > llm.llm* -*助手 = > agent.agent model=`model` tools=`工具表` standing="You are a Marqdo agent. Prefer CALL:获取时间 when the task needs today's date."* +**model = > llm.llm** +**助手 = > agent.agent model=`model` tools=`工具表` standing="You are a Marqdo agent. Prefer CALL:获取时间 when the task needs today's date."** Assert constitution markers in the assembled prompt (call site before how-to-act): -*ctx = > agent.build_step_context agent=`助手` task="What is today's date? Use the tool in this runbook."* +**ctx = > agent.build_step_context agent=`助手` task="What is today's date? Use the tool in this runbook."** -*parts = > split value=`ctx` sep="--- call site ---"* -*n = > len value=`parts`* +**parts = > split value=`ctx` sep="--- call site ---"** +**n = > len value=`parts`** 1. `n` > 1 > print text=call-site-ok 2. * > print text=call-site-missing > sys.exit code=1 -*parts2 = > split value=`ctx` sep="--- source (.mq.md) ---"* -*n2 = > len value=`parts2`* +**parts2 = > split value=`ctx` sep="--- source (.mq.md) ---"** +**n2 = > len value=`parts2`** 1. `n2` > 1 > print text=source-ok 2. * > print text=source-missing > sys.exit code=1 -*parts3 = > split value=`ctx` sep="获取时间"* -*n3 = > len value=`parts3`* +**parts3 = > split value=`ctx` sep="获取时间"** +**n3 = > len value=`parts3`** 1. `n3` > 1 > print text=tool-in-source-ok 2. * > print text=tool-in-source-missing > sys.exit code=1 -*site = > agent_call_site* -*fn = > json.get value=`site` key="function"* +**site = > agent_call_site** +**fn = > json.get value=`site` key="function"** > print text=`fn` Optional live step — set env AGENT_LIVE=1 and put keys in repo-root `.env`: -*live = > sys.env_get name="AGENT_LIVE"* -*key = > sys.env_get name="OPENAI_API_KEY"* +**live = > sys.env_get name="AGENT_LIVE"** +**key = > sys.env_get name="OPENAI_API_KEY"** 1. `live` == "1" 1. `key` - *out = > `助手`.step task="请调用获取时间工具,然后只回复日期字符串。" writeback=False* - *status = > json.get value=`out` key="status"* + **out = > `助手`.step task="请调用获取时间工具,然后只回复日期字符串。" writeback=False** + **status = > json.get value=`out` key="status"** > print text=`status` - *tool = > json.get value=`out` key="tool"* + **tool = > json.get value=`out` key="tool"** > print text=`tool` - *result = > json.get value=`out` key="result"* + **result = > json.get value=`out` key="result"** > print text=`result` 2. * > print text=live-skipped-no-key diff --git a/examples/anlian-mq/components/chrome.mq.md b/examples/anlian-mq/components/chrome.mq.md index dbab46b..b0acad0 100644 --- a/examples/anlian-mq/components/chrome.mq.md +++ b/examples/anlian-mq/components/chrome.mq.md @@ -35,7 +35,7 @@ description: 暗恋见君壳层 — head 资源表、导航 HTML、页脚 HTML | script | "/static/js/feed_board.js" | 真 | | script | "/static/js/index.js" | 真 | -**`头`** +*`头`* ## 导航HTML diff --git a/examples/anlian-mq/components/feed.mq.md b/examples/anlian-mq/components/feed.mq.md index cd771b1..eb87e70 100644 --- a/examples/anlian-mq/components/feed.mq.md +++ b/examples/anlian-mq/components/feed.mq.md @@ -10,55 +10,55 @@ import text:lib/text.mq.md 给定帖子行记录列表,输出 `ul.home-posts-list` 标记(首页与列表页共用)。 -*段 = None* +**段 = None** - [帖](行) - *板 = 帖[^board]* - *题 = 帖[^title]* - *链 = 帖[^slug]* - *作 = 帖[^author]* - *评 = 帖[^comments_count]* - *时 = 帖[^created_at]* + **板 = 帖[^board]** + **题 = 帖[^title]** + **链 = 帖[^slug]** + **作 = 帖[^author]** + **评 = 帖[^comments_count]** + **时 = 帖[^created_at]** 1. not 作 - *作 = "匿名"* + **作 = "匿名"** 2. * 1. not 评 - *评 = 0* + **评 = 0** 2. * 1. not 时 - *时 = ""* + **时 = ""** 2. * - *一项 = "
  • " + 板 + "

    " + 题 + "

  • "* - *段 = > table.append list=段 item=一项* + **一项 = "
  • " + 板 + "

    " + 题 + "

  • "** + **段 = > table.append list=段 item=一项** 1. 段 - *内 = > text.str_join xs=段 sep=""* - **""** + **内 = > text.str_join xs=段 sep=""** + *""* 2. * - **""** + *""* ## 新闻时间线HTML + `行` 给定新闻行记录列表,输出 `.news-timeline` 标记。 -*段 = None* +**段 = None** - [讯](行) - *题 = 讯[^title]* - *链 = 讯[^slug]* - *板 = 讯[^board]* - *时 = 讯[^created_at]* + **题 = 讯[^title]** + **链 = 讯[^slug]** + **板 = 讯[^board]** + **时 = 讯[^created_at]** 1. not 板 - *板 = ""* + **板 = ""** 2. * 1. not 时 - *时 = ""* + **时 = ""** 2. * - *一项 = "
  • " + 板 + "

    " + 题 + "

  • "* - *段 = > table.append list=段 item=一项* + **一项 = "
  • " + 板 + "

    " + 题 + "

  • "** + **段 = > table.append list=段 item=一项** 1. 段 - *内 = > text.str_join xs=段 sep=""* - **"
      " + 内 + "
    "** + **内 = > text.str_join xs=段 sep=""** + *"
      " + 内 + "
    "* 2. * - **"
    1. 暂无新闻

    "** + *"
    1. 暂无新闻

    "* ## 板块栏HTML + `板块` @@ -68,30 +68,30 @@ import text:lib/text.mq.md 板块 Tab 栏。`前缀` 如 `/post/ten/`;`查询键` 为 `board_id` 或 `news_board_id`;`全部类` 为 Tab 共用 class(含 js hook)。 -*数据属 = "data-board"* -*全标签 = "全部"* +**数据属 = "data-board"** +**全标签 = "全部"** 1. 查询键 == "news_board_id" - *数据属 = "data-news-board"* - *全标签 = "所有板块"* + **数据属 = "data-news-board"** + **全标签 = "所有板块"** 2. * -*段 = None* -*全链 = 前缀 + "?" + 查询键 + "=0"* -*全项 = "" + 全标签 + ""* -*段 = > table.append list=段 item=全项* +**段 = None** +**全链 = 前缀 + "?" + 查询键 + "=0"** +**全项 = "" + 全标签 + ""** +**段 = > table.append list=段 item=全项** - [板](板块) - *名 = 板[^name]* - *号 = 板[^id]* - *链 = 前缀 + "?" + 查询键 + "=" + 号* - *项 = "" + 名 + ""* - *段 = > table.append list=段 item=项* + **名 = 板[^name]** + **号 = 板[^id]** + **链 = 前缀 + "?" + 查询键 + "=" + 号** + **项 = "" + 名 + ""** + **段 = > table.append list=段 item=项** 1. 查询键 == "news_board_id" - *更多 = "全部新闻"* - *段 = > table.append list=段 item=更多* + **更多 = "全部新闻"** + **段 = > table.append list=段 item=更多** 2. * -*内 = > text.str_join xs=段 sep=""* -*栏类 = "home-posts-board-bar"* +**内 = > text.str_join xs=段 sep=""** +**栏类 = "home-posts-board-bar"** 1. 查询键 == "news_board_id" - *栏类 = "home-posts-board-bar home-news-board-bar"* + **栏类 = "home-posts-board-bar home-news-board-bar"** 2. * -**"
    " + 内 + "
    "** +*"
    " + 内 + "
    "* diff --git a/examples/anlian-mq/components/foot.mq.md b/examples/anlian-mq/components/foot.mq.md index 6e28d66..62f4131 100644 --- a/examples/anlian-mq/components/foot.mq.md +++ b/examples/anlian-mq/components/foot.mq.md @@ -12,4 +12,4 @@ | 公聊 | /chat | | sitemap | /sitemap.xml | -**`页脚`** +*`页脚`* diff --git a/examples/anlian-mq/components/fragments.mq.md b/examples/anlian-mq/components/fragments.mq.md index ef0e7dd..95df665 100644 --- a/examples/anlian-mq/components/fragments.mq.md +++ b/examples/anlian-mq/components/fragments.mq.md @@ -9,13 +9,13 @@ import feed:feed.mq.md ## 帖子十 + `board_id`="0" -*store = > db.打开* -*行 = > store.查询 表="posts" 上限=10 排序="-created_at"* -**> feed.帖子列表HTML 行=`行`** +**store = > db.打开** +**行 = > store.查询 表="posts" 上限=10 排序="-created_at"** +*> feed.帖子列表HTML 行=`行`* ## 新闻五 + `news_board_id`="0" -*store = > db.打开* -*行 = > store.查询 表="news" 上限=5 排序="-created_at"* -**> feed.新闻时间线HTML 行=`行`** +**store = > db.打开** +**行 = > store.查询 表="news" 上限=5 排序="-created_at"** +*> feed.新闻时间线HTML 行=`行`* diff --git a/examples/anlian-mq/components/home_body.mq.md b/examples/anlian-mq/components/home_body.mq.md index 814afe3..02c85d6 100644 --- a/examples/anlian-mq/components/home_body.mq.md +++ b/examples/anlian-mq/components/home_body.mq.md @@ -12,36 +12,36 @@ import feed:feed.mq.md 查询 notices / boards / news_boards / news(5) / posts(10),拼装首页四段 HTML(不含导航与页脚)。调用方传入已打开的 store。 -*公告行 = > 库.查询 表="notices" 上限=20 排序="-created_at"* -*板块行 = > 库.查询 表="boards" 上限=50* -*新闻板块行 = > 库.查询 表="news_boards" 上限=50* -*新闻行 = > 库.查询 表="news" 上限=5 排序="-created_at"* -*帖子行 = > 库.查询 表="posts" 上限=10 排序="-created_at"* +**公告行 = > 库.查询 表="notices" 上限=20 排序="-created_at"** +**板块行 = > 库.查询 表="boards" 上限=50** +**新闻板块行 = > 库.查询 表="news_boards" 上限=50** +**新闻行 = > 库.查询 表="news" 上限=5 排序="-created_at"** +**帖子行 = > 库.查询 表="posts" 上限=10 排序="-created_at"** -*公告段 = None* +**公告段 = None** - [告](公告行) - *文 = 告[^content]* - *时 = 告[^created_at]* - *一项 = "
    " + 文 + "

    " + 时 + "

    "* - *公告段 = > table.append list=公告段 item=一项* + **文 = 告[^content]** + **时 = 告[^created_at]** + **一项 = "
    " + 文 + "

    " + 时 + "

    "** + **公告段 = > table.append list=公告段 item=一项** 1. 公告段 - *公告内 = > text.str_join xs=公告段 sep=""* + **公告内 = > text.str_join xs=公告段 sep=""** 2. * - *公告内 = "

    暂无公告

    "* + **公告内 = "

    暂无公告

    "** -*新闻栏 = > feed.板块栏HTML 板块=新闻板块行 前缀="/news/five" 查询键="news_board_id" 全部类="home-posts-tab js-home-news-tab"* -*新闻板 = > feed.新闻时间线HTML 行=新闻行* -*帖子栏 = > feed.板块栏HTML 板块=板块行 前缀="/post/ten" 查询键="board_id" 全部类="home-posts-tab js-home-post-tab"* -*帖子表 = > feed.帖子列表HTML 行=帖子行* +**新闻栏 = > feed.板块栏HTML 板块=新闻板块行 前缀="/news/five" 查询键="news_board_id" 全部类="home-posts-tab js-home-news-tab"** +**新闻板 = > feed.新闻时间线HTML 行=新闻行** +**帖子栏 = > feed.板块栏HTML 板块=板块行 前缀="/post/ten" 查询键="board_id" 全部类="home-posts-tab js-home-post-tab"** +**帖子表 = > feed.帖子列表HTML 行=帖子行** -*段 = None* -*英雄 = "
    \"logo\"暗恋见君

    期待人们能够继续相信爱情

    粉玻璃社区 · 匿名与实名同在

    \"首页展示图\"
    "* -*段 = > table.append list=段 item=英雄* -*公告区 = "

    公告信息

    " + 公告内 + "
    "* -*段 = > table.append list=段 item=公告区* -*新闻区 = "

    新闻动态

    " + 新闻栏 + "
    " + 新闻板 + "
    "* -*段 = > table.append list=段 item=新闻区* -*更多 = "查看更多帖子"* -*帖子区 = "

    论坛交流

    " + 帖子栏 + "
    " + 帖子表 + 更多 + "
    "* -*段 = > table.append list=段 item=帖子区* -**> text.str_join xs=段 sep=""** +**段 = None** +**英雄 = "
    \"logo\"暗恋见君

    期待人们能够继续相信爱情

    粉玻璃社区 · 匿名与实名同在

    \"首页展示图\"
    "** +**段 = > table.append list=段 item=英雄** +**公告区 = "

    公告信息

    " + 公告内 + "
    "** +**段 = > table.append list=段 item=公告区** +**新闻区 = "

    新闻动态

    " + 新闻栏 + "
    " + 新闻板 + "
    "** +**段 = > table.append list=段 item=新闻区** +**更多 = "查看更多帖子"** +**帖子区 = "

    论坛交流

    " + 帖子栏 + "
    " + 帖子表 + 更多 + "
    "** +**段 = > table.append list=段 item=帖子区** +*> text.str_join xs=段 sep=""* diff --git a/examples/anlian-mq/components/nav.mq.md b/examples/anlian-mq/components/nav.mq.md index ab5f037..ff0dbff 100644 --- a/examples/anlian-mq/components/nav.mq.md +++ b/examples/anlian-mq/components/nav.mq.md @@ -15,4 +15,4 @@ | 登录 | /admin/login | | | guest | | 后台 | /admin | | | auth | -**`导航`** +*`导航`* diff --git a/examples/anlian-mq/components/page.mq.md b/examples/anlian-mq/components/page.mq.md index 23a5496..656b7c0 100644 --- a/examples/anlian-mq/components/page.mq.md +++ b/examples/anlian-mq/components/page.mq.md @@ -11,8 +11,8 @@ import chrome:chrome.mq.md 导航 + 正文 + 页脚;体类如 `page-home`。 -*顶 = > chrome.导航HTML* -*底 = > chrome.页脚HTML* -*鉴权脚本 = ""* -*鉴权样式 = ""* -**鉴权样式 + 顶 + "
    " + 正文 + "
    " + 底 + 鉴权脚本** +**顶 = > chrome.导航HTML** +**底 = > chrome.页脚HTML** +**鉴权脚本 = ""** +**鉴权样式 = ""** +*鉴权样式 + 顶 + "
    " + 正文 + "
    " + 底 + 鉴权脚本* diff --git a/examples/anlian-mq/db/index.mq.md b/examples/anlian-mq/db/index.mq.md index aa0878b..8dff976 100644 --- a/examples/anlian-mq/db/index.mq.md +++ b/examples/anlian-mq/db/index.mq.md @@ -10,16 +10,16 @@ import seed:seed.mq.md 打开 sqlite:data/anlian-mq.db,初始化全部表;帖子建 FTS;若 posts 为空则写入种子。返回 store。 -*store = > 网页.数据库 地址="sqlite:data/anlian-mq.db"* -*帖子字段 = > schema.posts* -*新闻字段 = > schema.news* -*板块字段 = > schema.boards* -*新闻板块字段 = > schema.news_boards* -*公告字段 = > schema.notices* -*评论字段 = > schema.comments* -*房间字段 = > schema.chat_rooms* -*专题字段 = > schema.topics* -*密钥字段 = > schema.api_keys* +**store = > 网页.数据库 地址="sqlite:data/anlian-mq.db"** +**帖子字段 = > schema.posts** +**新闻字段 = > schema.news** +**板块字段 = > schema.boards** +**新闻板块字段 = > schema.news_boards** +**公告字段 = > schema.notices** +**评论字段 = > schema.comments** +**房间字段 = > schema.chat_rooms** +**专题字段 = > schema.topics** +**密钥字段 = > schema.api_keys** > `store`.初始化 名=posts 字段=`帖子字段` > `store`.初始化 名=news 字段=`新闻字段` > `store`.初始化 名=boards 字段=`板块字段` @@ -40,18 +40,18 @@ import seed:seed.mq.md > `store`.全文 表=posts 列=`全文列` 名=posts_fts -*已有 = > store.查询 表="posts" 上限=1* +**已有 = > store.查询 表="posts" 上限=1** 1. `已有` - **store** + *store* 2. * - *板块 = > seed.boards* - *新闻板块 = > seed.news_boards* - *帖子 = > seed.posts* - *新闻 = > seed.news* - *公告 = > seed.notices* - *评论 = > seed.comments* - *房间 = > seed.chat_rooms* - *专题 = > seed.topics* + **板块 = > seed.boards** + **新闻板块 = > seed.news_boards** + **帖子 = > seed.posts** + **新闻 = > seed.news** + **公告 = > seed.notices** + **评论 = > seed.comments** + **房间 = > seed.chat_rooms** + **专题 = > seed.topics** > `store`.插入 表=boards 行=`板块` > `store`.插入 表=news_boards 行=`新闻板块` > `store`.插入 表=posts 行=`帖子` @@ -60,4 +60,4 @@ import seed:seed.mq.md > `store`.插入 表=comments 行=`评论` > `store`.插入 表=chat_rooms 行=`房间` > `store`.插入 表=topics 行=`专题` - **store** + *store* diff --git a/examples/anlian-mq/db/schema.mq.md b/examples/anlian-mq/db/schema.mq.md index debe25f..50d730a 100644 --- a/examples/anlian-mq/db/schema.mq.md +++ b/examples/anlian-mq/db/schema.mq.md @@ -19,7 +19,7 @@ | created_at | timestamp | true | | | updated_at | timestamp | true | | -**`posts`** +*`posts`* ## news @@ -39,7 +39,7 @@ | created_at | timestamp | true | | | updated_at | timestamp | true | | -**`news`** +*`news`* ## boards @@ -53,7 +53,7 @@ | name | text | false | | | slug | text | false | 是 | -**`boards`** +*`boards`* ## news_boards @@ -67,7 +67,7 @@ | name | text | false | | | slug | text | false | 是 | -**`news_boards`** +*`news_boards`* ## notices @@ -81,7 +81,7 @@ | content | text | false | | created_at | timestamp | true | -**`notices`** +*`notices`* ## comments @@ -98,7 +98,7 @@ | author | text | true | | created_at | timestamp | true | -**`comments`** +*`comments`* ## chat_rooms @@ -113,7 +113,7 @@ | name | text | false | | | summary | text | true | | -**`chat_rooms`** +*`chat_rooms`* ## topics @@ -128,7 +128,7 @@ | title | text | false | | | summary | text | true | | -**`topics`** +*`topics`* ## api_keys @@ -143,4 +143,4 @@ API Key 校验用哈希表(应用层 scopes)。 | hash | text | false | | scopes | text | true | -**`api_keys`** +*`api_keys`* diff --git a/examples/anlian-mq/db/seed.mq.md b/examples/anlian-mq/db/seed.mq.md index c013c1c..c74c61d 100644 --- a/examples/anlian-mq/db/seed.mq.md +++ b/examples/anlian-mq/db/seed.mq.md @@ -10,7 +10,7 @@ | 2 | 开发 | develop | | 3 | 聊天 | chat | -**`boards`** +*`boards`* ## news_boards @@ -23,7 +23,7 @@ | 1 | 站务 | site | | 2 | 技术 | tech | -**`news_boards`** +*`news_boards`* ## posts @@ -37,7 +37,7 @@ | 2 | 如何用表格写论坛 | tables-for-forums | 导航、表单、种子数据都是可读表格。 | 若某功能逼你写一长串 json.set,请先审视 ext/web 是否缺命名方法。 | 开发 | 2 | 站务 | 0 | 18 | | 3 | 公聊室已开放 | chat-open | WebSocket 广播房间。 | 打开 /chat,连上 /chat/ws,消息会扇出给同房间所有人。 | 聊天 | 3 | 站务 | 0 | 9 | -**`posts`** +*`posts`* ## news @@ -50,7 +50,7 @@ | 1 | 站点迁往 Marqdo | migrate-to-marqdo | 原生层换 Go libweb,作者面保持表格。 | 暗恋见君的验收目标:登录、发帖、列表详情、聊天与站长工具都能用 .mq.md 写完。 | 站务 | 1 | | 2 | 外接 PostgreSQL / Redis | pg-redis | 生产可用外接驱动。 | 本示例默认 sqlite:;把数据库地址换成 postgres:// 即可。 | 技术 | 2 | -**`news`** +*`news`* ## notices @@ -64,7 +64,7 @@ | 2 | 站点正用 Marqdo 表格重写验收:导航、首页四段、列表与公聊对齐原站 DOM。 | 2026-09-08 14:30:00 | | 3 | 发帖与评论请遵守社区规范;站务公告将在此置顶。 | 2026-09-10 09:00:00 | -**`notices`** +*`notices`* ## comments @@ -77,7 +77,7 @@ | 1 | post | welcome | 终于等到用表格写论坛的一天。 | 路人甲 | 2026-09-10 11:00:00 | | 2 | post | welcome | 期待人们能够继续相信爱情。 | 见君 | 2026-09-10 12:15:00 | -**`comments`** +*`comments`* ## chat_rooms @@ -90,7 +90,7 @@ | 1 | lobby | 大厅 | 全站公共聊天室。 | | 2 | casual | 闲聊 | 轻松闲聊,勿刷屏。 | -**`chat_rooms`** +*`chat_rooms`* ## topics @@ -103,4 +103,4 @@ | 1 | glass-ui | 粉玻璃界面 | 首页与列表的毛玻璃视觉专题(占位)。 | | 2 | tables-as-code | 表格即代码 | Marqdo GFM 表装配专题(占位)。 | -**`topics`** +*`topics`* diff --git a/examples/anlian-mq/index.mq.md b/examples/anlian-mq/index.mq.md index 00c5577..f6db7ed 100644 --- a/examples/anlian-mq/index.mq.md +++ b/examples/anlian-mq/index.mq.md @@ -87,124 +87,124 @@ import db:db/index.mq.md |------|------|------|------|------| | "public/img/favicon-32.png" | icon | "image/png" | 32x32 | "/favicon.ico" | -*store = > db.打开* -*头 = > chrome.头资源* -*顶 = > chrome.导航HTML* -*底 = > chrome.页脚HTML* -*鉴权补丁 = ""* +**store = > db.打开** +**头 = > chrome.头资源** +**顶 = > chrome.导航HTML** +**底 = > chrome.页脚HTML** +**鉴权补丁 = ""** -*主页体 = > home.装配 库=`store`* -*主页文 = > page.包装 正文=`主页体` 体类="page-home"* -*首页 = > 网页.页面 标题="暗恋见君论坛" 引言=`主页文` 壳样式="off" 布局="bare"* -*首页 = > 首页.头装配 表=`头`* +**主页体 = > home.装配 库=`store`** +**主页文 = > page.包装 正文=`主页体` 体类="page-home"** +**首页 = > 网页.页面 标题="暗恋见君论坛" 引言=`主页文` 壳样式="off" 布局="bare"** +**首页 = > 首页.头装配 表=`头`** -*板块行 = > store.查询 表="boards" 上限=50* -*帖子行 = > store.查询 表="posts" 上限=50 排序="-created_at"* -*帖子栏 = > feed.板块栏HTML 板块=板块行 前缀="/post" 查询键="board_id" 全部类="feed-tab"* -*帖子表 = > feed.帖子列表HTML 行=帖子行* -*帖子列表体 = "

    论坛交流

    " + 帖子栏 + 帖子表 + "

    发布帖子

    "* -*帖子列表文 = > page.包装 正文=`帖子列表体` 体类="page-post-list"* -*帖子列表 = > 网页.页面 标题="帖子 · 暗恋见君" 引言=`帖子列表文` 壳样式="off" 布局="bare"* -*帖子列表 = > 帖子列表.头装配 表=`头`* +**板块行 = > store.查询 表="boards" 上限=50** +**帖子行 = > store.查询 表="posts" 上限=50 排序="-created_at"** +**帖子栏 = > feed.板块栏HTML 板块=板块行 前缀="/post" 查询键="board_id" 全部类="feed-tab"** +**帖子表 = > feed.帖子列表HTML 行=帖子行** +**帖子列表体 = "

    论坛交流

    " + 帖子栏 + 帖子表 + "

    发布帖子

    "** +**帖子列表文 = > page.包装 正文=`帖子列表体` 体类="page-post-list"** +**帖子列表 = > 网页.页面 标题="帖子 · 暗恋见君" 引言=`帖子列表文` 壳样式="off" 布局="bare"** +**帖子列表 = > 帖子列表.头装配 表=`头`** -*新闻板块行 = > store.查询 表="news_boards" 上限=50* -*新闻行 = > store.查询 表="news" 上限=50 排序="-created_at"* -*新闻栏 = > feed.板块栏HTML 板块=新闻板块行 前缀="/news" 查询键="news_board_id" 全部类="feed-tab"* -*新闻表 = > feed.新闻时间线HTML 行=新闻行* -*新闻列表体 = "

    新闻动态

    " + 新闻栏 + 新闻表 + "
    "* -*新闻列表文 = > page.包装 正文=`新闻列表体` 体类="page-news-list"* -*新闻列表 = > 网页.页面 标题="新闻 · 暗恋见君" 引言=`新闻列表文` 壳样式="off" 布局="bare"* -*新闻列表 = > 新闻列表.头装配 表=`头`* +**新闻板块行 = > store.查询 表="news_boards" 上限=50** +**新闻行 = > store.查询 表="news" 上限=50 排序="-created_at"** +**新闻栏 = > feed.板块栏HTML 板块=新闻板块行 前缀="/news" 查询键="news_board_id" 全部类="feed-tab"** +**新闻表 = > feed.新闻时间线HTML 行=新闻行** +**新闻列表体 = "

    新闻动态

    " + 新闻栏 + 新闻表 + "
    "** +**新闻列表文 = > page.包装 正文=`新闻列表体` 体类="page-news-list"** +**新闻列表 = > 网页.页面 标题="新闻 · 暗恋见君" 引言=`新闻列表文` 壳样式="off" 布局="bare"** +**新闻列表 = > 新闻列表.头装配 表=`头`** -*帖子页 = > 网页.页面 标题="帖子详情" 引言=`鉴权补丁` 壳样式="off" 布局="stacked"* -*帖子页 = > 帖子页.头装配 表=`头`* -*帖子页 = > 帖子页.壳HTML 导航=`顶` 页脚=`底` 体类="page-post-detail"* -*帖子页 = > 帖子页.主体装配 主体=`帖子详情`* -*帖子页 = > 帖子页.查询条件 条件=`帖子条件`* -*帖子页 = > 帖子页.详情 详情=True* +**帖子页 = > 网页.页面 标题="帖子详情" 引言=`鉴权补丁` 壳样式="off" 布局="stacked"** +**帖子页 = > 帖子页.头装配 表=`头`** +**帖子页 = > 帖子页.壳HTML 导航=`顶` 页脚=`底` 体类="page-post-detail"** +**帖子页 = > 帖子页.主体装配 主体=`帖子详情`** +**帖子页 = > 帖子页.查询条件 条件=`帖子条件`** +**帖子页 = > 帖子页.详情 详情=True** -*新闻页 = > 网页.页面 标题="新闻详情" 引言=`鉴权补丁` 壳样式="off" 布局="stacked"* -*新闻页 = > 新闻页.头装配 表=`头`* -*新闻页 = > 新闻页.壳HTML 导航=`顶` 页脚=`底` 体类="page-news-detail"* -*新闻页 = > 新闻页.主体装配 主体=`新闻详情`* -*新闻页 = > 新闻页.查询条件 条件=`新闻条件`* -*新闻页 = > 新闻页.详情 详情=True* +**新闻页 = > 网页.页面 标题="新闻详情" 引言=`鉴权补丁` 壳样式="off" 布局="stacked"** +**新闻页 = > 新闻页.头装配 表=`头`** +**新闻页 = > 新闻页.壳HTML 导航=`顶` 页脚=`底` 体类="page-news-detail"** +**新闻页 = > 新闻页.主体装配 主体=`新闻详情`** +**新闻页 = > 新闻页.查询条件 条件=`新闻条件`** +**新闻页 = > 新闻页.详情 详情=True** -*发帖表 = > 网页.表单 表="posts" 动作="插入"* -*发帖表 = > 发帖表.字段 字段=`发帖字段`* -*发帖表 = > 发帖表.规则 规则=`发帖规则`* -*发帖引言 = > page.包装 正文="

    发布帖子

    需登录(admin / anlian)

    " 体类="page-post-public"* -*发帖页 = > 网页.页面 标题="发帖 · 暗恋见君" 引言=`发帖引言` 壳样式="off" 布局="bare"* -*发帖页 = > 发帖页.头装配 表=`头`* -*发帖页 = > 发帖页.表单装配 id="post" 表单=`发帖表`* +**发帖表 = > 网页.表单 表="posts" 动作="插入"** +**发帖表 = > 发帖表.字段 字段=`发帖字段`** +**发帖表 = > 发帖表.规则 规则=`发帖规则`** +**发帖引言 = > page.包装 正文="

    发布帖子

    需登录(admin / anlian)

    " 体类="page-post-public"** +**发帖页 = > 网页.页面 标题="发帖 · 暗恋见君" 引言=`发帖引言` 壳样式="off" 布局="bare"** +**发帖页 = > 发帖页.头装配 表=`头`** +**发帖页 = > 发帖页.表单装配 id="post" 表单=`发帖表`** -*房间行 = > store.查询 表="chat_rooms" 上限=50* -*房间段 = None* +**房间行 = > store.查询 表="chat_rooms" 上限=50** +**房间段 = None** - [房](房间行) - *名 = 房[^name]* - *链 = 房[^slug]* - *摘 = 房[^summary]* - *项 = "

    " + 名 + "

    " + 摘 + "

    "* - *房间段 = > table.append list=房间段 item=项* -*房间内 = > text.str_join xs=房间段 sep=""* -*聊天列表体 = "

    聊天室

    " + 房间内 + "
    "* -*聊天列表文 = > page.包装 正文=`聊天列表体` 体类="page-chat"* -*聊天列表 = > 网页.页面 标题="聊天 · 暗恋见君" 引言=`聊天列表文` 壳样式="off" 布局="bare"* -*聊天列表 = > 聊天列表.头装配 表=`头`* + **名 = 房[^name]** + **链 = 房[^slug]** + **摘 = 房[^summary]** + **项 = "

    " + 名 + "

    " + 摘 + "

    "** + **房间段 = > table.append list=房间段 item=项** +**房间内 = > text.str_join xs=房间段 sep=""** +**聊天列表体 = "

    聊天室

    " + 房间内 + "
    "** +**聊天列表文 = > page.包装 正文=`聊天列表体` 体类="page-chat"** +**聊天列表 = > 网页.页面 标题="聊天 · 暗恋见君" 引言=`聊天列表文` 壳样式="off" 布局="bare"** +**聊天列表 = > 聊天列表.头装配 表=`头`** -*大厅体 = "

    大厅

    "* -*大厅文 = > page.包装 正文=`大厅体` 体类="page-chat-room"* -*大厅页 = > 网页.页面 标题="大厅 · 暗恋见君" 引言=`大厅文` 壳样式="off" 布局="bare"* -*大厅页 = > 大厅页.头装配 表=`头`* +**大厅体 = "

    大厅

    "** +**大厅文 = > page.包装 正文=`大厅体` 体类="page-chat-room"** +**大厅页 = > 网页.页面 标题="大厅 · 暗恋见君" 引言=`大厅文` 壳样式="off" 布局="bare"** +**大厅页 = > 大厅页.头装配 表=`头`** -*闲聊体 = "

    闲聊

    "* -*闲聊文 = > page.包装 正文=`闲聊体` 体类="page-chat-room"* -*闲聊页 = > 网页.页面 标题="闲聊 · 暗恋见君" 引言=`闲聊文` 壳样式="off" 布局="bare"* -*闲聊页 = > 闲聊页.头装配 表=`头`* +**闲聊体 = "

    闲聊

    "** +**闲聊文 = > page.包装 正文=`闲聊体` 体类="page-chat-room"** +**闲聊页 = > 网页.页面 标题="闲聊 · 暗恋见君" 引言=`闲聊文` 壳样式="off" 布局="bare"** +**闲聊页 = > 闲聊页.头装配 表=`头`** -*专题行 = > store.查询 表="topics" 上限=50* -*专题段 = None* +**专题行 = > store.查询 表="topics" 上限=50** +**专题段 = None** - [题](专题行) - *题名 = 题[^title]* - *链 = 题[^slug]* - *摘 = 题[^summary]* - *项 = "

    " + 题名 + "

    " + 摘 + "

    slug: " + 链 + "

    "* - *专题段 = > table.append list=专题段 item=项* -*专题内 = > text.str_join xs=专题段 sep=""* -*专题体 = "

    专题书架

    " + 专题内 + "
    "* -*专题文 = > page.包装 正文=`专题体` 体类="page-topics"* -*专题页 = > 网页.页面 标题="专题 · 暗恋见君" 引言=`专题文` 壳样式="off" 布局="bare"* -*专题页 = > 专题页.头装配 表=`头`* + **题名 = 题[^title]** + **链 = 题[^slug]** + **摘 = 题[^summary]** + **项 = "

    " + 题名 + "

    " + 摘 + "

    slug: " + 链 + "

    "** + **专题段 = > table.append list=专题段 item=项** +**专题内 = > text.str_join xs=专题段 sep=""** +**专题体 = "

    专题书架

    " + 专题内 + "
    "** +**专题文 = > page.包装 正文=`专题体` 体类="page-topics"** +**专题页 = > 网页.页面 标题="专题 · 暗恋见君" 引言=`专题文` 壳样式="off" 布局="bare"** +**专题页 = > 专题页.头装配 表=`头`** -*搜索体 = "

    搜索

    全文检索走 SQLite FTS(posts_fts);结果面板后续可按 q 扩展。

    "* -*搜索文 = > page.包装 正文=`搜索体` 体类="page-search"* -*搜索页 = > 网页.页面 标题="搜索 · 暗恋见君" 引言=`搜索文` 壳样式="off" 布局="bare"* -*搜索页 = > 搜索页.头装配 表=`头`* +**搜索体 = "

    搜索

    全文检索走 SQLite FTS(posts_fts);结果面板后续可按 q 扩展。

    "** +**搜索文 = > page.包装 正文=`搜索体` 体类="page-search"** +**搜索页 = > 网页.页面 标题="搜索 · 暗恋见君" 引言=`搜索文` 壳样式="off" 布局="bare"** +**搜索页 = > 搜索页.头装配 表=`头`** -*指南体 = "

    API 自动化指南

    使用 Bearer / X-Api-Key 调用自动化接口。本验收切片提供 api_keys 表与 web_api_key_check 原语;业务 scopes 写在 .mq.md。

    Authorization: Bearer <token>
    "* -*指南文 = > page.包装 正文=`指南体` 体类="page-guide"* -*指南页 = > 网页.页面 标题="API 指南 · 暗恋见君" 引言=`指南文` 壳样式="off" 布局="bare"* -*指南页 = > 指南页.头装配 表=`头`* +**指南体 = "

    API 自动化指南

    使用 Bearer / X-Api-Key 调用自动化接口。本验收切片提供 api_keys 表与 web_api_key_check 原语;业务 scopes 写在 .mq.md。

    Authorization: Bearer <token>
    "** +**指南文 = > page.包装 正文=`指南体` 体类="page-guide"** +**指南页 = > 网页.页面 标题="API 指南 · 暗恋见君" 引言=`指南文` 壳样式="off" 布局="bare"** +**指南页 = > 指南页.头装配 表=`头`** -*应用 = > 网页.应用 页面=`首页` 数据库=`store` 后台=True 主机="127.0.0.1" 端口=18180* -*应用 = > 应用.路由 路径="/post" 页面=`帖子列表`* -*应用 = > 应用.路由 路径="/post/public" 页面=`发帖页`* -*应用 = > 应用.路由 路径="/post/{slug}" 页面=`帖子页`* -*应用 = > 应用.路由 路径="/news" 页面=`新闻列表`* -*应用 = > 应用.路由 路径="/news/{slug}" 页面=`新闻页`* -*应用 = > 应用.路由 路径="/chat" 页面=`聊天列表`* -*应用 = > 应用.路由 路径="/chat/lobby" 页面=`大厅页`* -*应用 = > 应用.路由 路径="/chat/casual" 页面=`闲聊页`* -*应用 = > 应用.路由 路径="/topics" 页面=`专题页`* -*应用 = > 应用.路由 路径="/search" 页面=`搜索页`* -*应用 = > 应用.路由 路径="/guide/automation-api" 页面=`指南页`* -*应用 = > 应用.静态 目录="public" 挂载="/static"* -*应用 = > 应用.图标 表=`图标`* -*应用 = > 应用.鉴权 用户表=`用户表` 会话时长=7200 登录路径="/accounts/login" 登录回跳="/post/public" 登出回跳="/"* -*应用 = > 应用.门禁 路径="/post/public" 角色="admin" 匹配="prefix" 拒绝="redirect" 排除="/accounts/login"* -*应用 = > 应用.路由实时 路径="/chat/ws" 模式="broadcast"* -*应用 = > 应用.调用 路径="/post/ten" 方法="GET" 函数="fragments.帖子十" 正文="query" 返回="html"* -*应用 = > 应用.调用 路径="/news/five" 方法="GET" 函数="fragments.新闻五" 正文="query" 返回="html"* -*应用 = > 应用.站点地图 路径="/sitemap.xml" 基址="http://127.0.0.1:18180" 条目=`地图项`* -*应用 = > 应用.爬虫协议 站点地图="http://127.0.0.1:18180/sitemap.xml"* +**应用 = > 网页.应用 页面=`首页` 数据库=`store` 后台=True 主机="127.0.0.1" 端口=18180** +**应用 = > 应用.路由 路径="/post" 页面=`帖子列表`** +**应用 = > 应用.路由 路径="/post/public" 页面=`发帖页`** +**应用 = > 应用.路由 路径="/post/{slug}" 页面=`帖子页`** +**应用 = > 应用.路由 路径="/news" 页面=`新闻列表`** +**应用 = > 应用.路由 路径="/news/{slug}" 页面=`新闻页`** +**应用 = > 应用.路由 路径="/chat" 页面=`聊天列表`** +**应用 = > 应用.路由 路径="/chat/lobby" 页面=`大厅页`** +**应用 = > 应用.路由 路径="/chat/casual" 页面=`闲聊页`** +**应用 = > 应用.路由 路径="/topics" 页面=`专题页`** +**应用 = > 应用.路由 路径="/search" 页面=`搜索页`** +**应用 = > 应用.路由 路径="/guide/automation-api" 页面=`指南页`** +**应用 = > 应用.静态 目录="public" 挂载="/static"** +**应用 = > 应用.图标 表=`图标`** +**应用 = > 应用.鉴权 用户表=`用户表` 会话时长=7200 登录路径="/accounts/login" 登录回跳="/post/public" 登出回跳="/"** +**应用 = > 应用.门禁 路径="/post/public" 角色="admin" 匹配="prefix" 拒绝="redirect" 排除="/accounts/login"** +**应用 = > 应用.路由实时 路径="/chat/ws" 模式="broadcast"** +**应用 = > 应用.调用 路径="/post/ten" 方法="GET" 函数="fragments.帖子十" 正文="query" 返回="html"** +**应用 = > 应用.调用 路径="/news/five" 方法="GET" 函数="fragments.新闻五" 正文="query" 返回="html"** +**应用 = > 应用.站点地图 路径="/sitemap.xml" 基址="http://127.0.0.1:18180" 条目=`地图项`** +**应用 = > 应用.爬虫协议 站点地图="http://127.0.0.1:18180/sitemap.xml"** > `应用`.监听 diff --git a/examples/anlian-mq/offline-smoke.mq.md b/examples/anlian-mq/offline-smoke.mq.md index 8a920b4..7716de0 100644 --- a/examples/anlian-mq/offline-smoke.mq.md +++ b/examples/anlian-mq/offline-smoke.mq.md @@ -32,37 +32,37 @@ import sys:lib/sys.mq.md |----|--------|------|------| | 1 | admin | anlian | admin | -*store = > db.打开* -*壳CSS = > shell.全局* -*首页 = > 网页.页面 标题="暗恋见君" 引言="

    ok

    "* -*首页 = > 首页.组件装配 组件=`壳`* -*首页 = > 首页.主体装配 主体=`帖子卡片`* -*首页 = > 首页.样式 样式=`壳CSS`* +**store = > db.打开** +**壳CSS = > shell.全局** +**首页 = > 网页.页面 标题="暗恋见君" 引言="

    ok

    "** +**首页 = > 首页.组件装配 组件=`壳`** +**首页 = > 首页.主体装配 主体=`帖子卡片`** +**首页 = > 首页.样式 样式=`壳CSS`** -*应用 = > 网页.应用 页面=`首页` 数据库=`store` 后台=True 主机="127.0.0.1" 端口=18180* -*应用 = > 应用.鉴权 用户表=`用户表`* -*应用 = > 应用.门禁 路径="/write" 角色="admin" 匹配="prefix" 拒绝="redirect"* -*应用 = > 应用.路由实时 路径="/chat/ws" 模式="broadcast"* +**应用 = > 网页.应用 页面=`首页` 数据库=`store` 后台=True 主机="127.0.0.1" 端口=18180** +**应用 = > 应用.鉴权 用户表=`用户表`** +**应用 = > 应用.门禁 路径="/write" 角色="admin" 匹配="prefix" 拒绝="redirect"** +**应用 = > 应用.路由实时 路径="/chat/ws" 模式="broadcast"** -*gates = 应用[^gates]* -*n = > len value=`gates`* +**gates = 应用[^gates]** +**n = > len value=`gates`** 1. `n` >= 2 > print text=gates-ok 2. * > print text=gates-fail > sys.exit code=1 -*ws = 应用[^ws_routes]* -*room = ws[^/chat/ws]* -*mode = room[^mode]* +**ws = 应用[^ws_routes]** +**room = ws[^/chat/ws]** +**mode = room[^mode]** 1. `mode` == "broadcast" > print text=ws-ok 2. * > print text=ws-fail > sys.exit code=1 -*list = > store.查询 表="posts" 上限=10* -*nr = > len value=`list`* +**list = > store.查询 表="posts" 上限=10** +**nr = > len value=`list`** 1. `nr` >= 1 > print text=seed-ok 2. * diff --git a/examples/anlian-mq/styles/shell.mq.md b/examples/anlian-mq/styles/shell.mq.md index 31e70fc..af1b0d0 100644 --- a/examples/anlian-mq/styles/shell.mq.md +++ b/examples/anlian-mq/styles/shell.mq.md @@ -54,7 +54,7 @@ import text:lib/text.mq.md | .main-intro | margin | 0 auto | | .main-intro | padding | 1.25rem 1.5rem 0 | -**`基础`** +*`基础`* ## 动效 @@ -75,7 +75,7 @@ import text:lib/text.mq.md | @keyframes cardRise 100% | opacity | "1" | | @keyframes cardRise 100% | transform | translateY(0) | -**`动效`** +*`动效`* ## 顶栏 @@ -126,7 +126,7 @@ import text:lib/text.mq.md | ul.nav li:first-child a:hover | transform | none | | ul.nav li:first-child a:hover | background | transparent | -**`顶栏`** +*`顶栏`* ## Hero @@ -223,7 +223,7 @@ import text:lib/text.mq.md | .page-stage p | margin | "0" | | .page-stage p | color | var(--muted) | -**`Hero`** +*`Hero`* ## 卡片 @@ -336,7 +336,7 @@ import text:lib/text.mq.md | .search-bar button | font-weight | "600" | | .search-bar button | cursor | pointer | -**`卡片`** +*`卡片`* ## 页脚 @@ -366,7 +366,7 @@ import text:lib/text.mq.md | ul.foot-nav a | font-weight | "500" | | ul.foot-nav a:hover | color | var(--accent-text) | -**`页脚`** +*`页脚`* ## 响应式 @@ -393,25 +393,25 @@ import text:lib/text.mq.md | (prefers-reduced-motion: reduce) | ul.nav li:first-child a::before | animation | none | | (prefers-reduced-motion: reduce) | article.card | animation | none | -**`响应式`** +*`响应式`* ## 全局 -*基础表 = > 基础* -*动效表 = > 动效* -*顶栏表 = > 顶栏* -*Hero表 = > Hero* -*卡片表 = > 卡片* -*页脚表 = > 页脚* -*响应式表 = > 响应式* +**基础表 = > 基础** +**动效表 = > 动效** +**顶栏表 = > 顶栏** +**Hero表 = > Hero** +**卡片表 = > 卡片** +**页脚表 = > 页脚** +**响应式表 = > 响应式** -*css基础 = > 网页.样式装配 名="基础" 表=`基础表`* -*css动效 = > 网页.样式装配 名="动效" 表=`动效表`* -*css顶栏 = > 网页.样式装配 名="顶栏" 表=`顶栏表`* -*cssHero = > 网页.样式装配 名="Hero" 表=`Hero表`* -*css卡片 = > 网页.样式装配 名="卡片" 表=`卡片表`* -*css页脚 = > 网页.样式装配 名="页脚" 表=`页脚表`* -*css响应式 = > 网页.样式装配 名="响应式" 表=`响应式表`* +**css基础 = > 网页.样式装配 名="基础" 表=`基础表`** +**css动效 = > 网页.样式装配 名="动效" 表=`动效表`** +**css顶栏 = > 网页.样式装配 名="顶栏" 表=`顶栏表`** +**cssHero = > 网页.样式装配 名="Hero" 表=`Hero表`** +**css卡片 = > 网页.样式装配 名="卡片" 表=`卡片表`** +**css页脚 = > 网页.样式装配 名="页脚" 表=`页脚表`** +**css响应式 = > 网页.样式装配 名="响应式" 表=`响应式表`** `css段` = @@ -425,5 +425,5 @@ import text:lib/text.mq.md | `css页脚` | | `css响应式` | -*css = > text.str_join xs=`css段` sep=""* -**css** +**css = > text.str_join xs=`css段` sep=""** +*css* diff --git a/examples/browser-app/app.mq.md b/examples/browser-app/app.mq.md index e143e3d..b5bb108 100644 --- a/examples/browser-app/app.mq.md +++ b/examples/browser-app/app.mq.md @@ -8,10 +8,10 @@ import text:lib/text.mq.md # main -*`ticks` = 0* -*`bag` = ""* -*`path` = "/"* -*`ws_id` = "echo"* +**`ticks` = 0** +**`bag` = ""** +**`path` = "/"** +**`ws_id` = "echo"** `wire` = @@ -52,26 +52,26 @@ import text:lib/text.mq.md |------|----------|---------| | `wire` | `nav` | `st` | -**boot** +*boot* ## add + `value`="" 1. `value` != "" 1. `bag` == "" - *`bag` = value* + **`bag` = value** 2. * - *`bag` = bag + "\n" + value* - *`parts` = > text.str_split s=bag sep="\n"* - *`html` = ""* + **`bag` = bag + "\n" + value** + **`parts` = > text.str_split s=bag sep="\n"** + **`html` = ""** - [item](parts) 1. `item` != "" - *`html` = html + "
  • " + item + "
  • "* - *`ret` = > browser.set_html sel="#items" html=html* - *`clr` = > browser.set_value sel="#draft" value=""* - *`ret` = > browser.merge a=ret b=clr* - *`f` = > browser.focus sel="#draft"* - **> browser.merge a=ret b=f** + **`html` = html + "
  • " + item + "
  • "** + **`ret` = > browser.set_html sel="#items" html=html** + **`clr` = > browser.set_value sel="#draft" value=""** + **`ret` = > browser.merge a=ret b=clr** + **`f` = > browser.focus sel="#draft"** + *> browser.merge a=ret b=f* 2. * **** @@ -79,25 +79,25 @@ import text:lib/text.mq.md + `data_id`="" 1. `data_id` != "" - *`parts` = > text.str_split s=bag sep="\n"* - *`next` = ""* + **`parts` = > text.str_split s=bag sep="\n"** + **`next` = ""** - [item](parts) 1. `item` != "" 1. `item` != `data_id` 1. `next` == "" - *`next` = item* + **`next` = item** 2. * - *`next` = next + "\n" + item* - *`bag` = next* - *`parts2` = > text.str_split s=bag sep="\n"* - *`html` = ""* + **`next` = next + "\n" + item** + **`bag` = next** + **`parts2` = > text.str_split s=bag sep="\n"** + **`html` = ""** - [item](parts2) 1. `item` != "" - *`html` = html + "
  • " + item + "
  • "* - *`ret` = > browser.set_html sel="#items" html=html* - *`msg` = "removed " + data_id* - *`t` = > browser.set_text sel="#log" text=msg* - **> browser.merge a=ret b=t** + **`html` = html + "
  • " + item + "
  • "** + **`ret` = > browser.set_html sel="#items" html=html** + **`msg` = "removed " + data_id** + **`t` = > browser.set_text sel="#log" text=msg** + *> browser.merge a=ret b=t* 2. * **** @@ -110,9 +110,9 @@ import text:lib/text.mq.md |----|-----|-------| | set | mq-draft | `value` | -*`msg` = > browser.set_text sel="#log" text="draft saved"* -*`s` = > browser.storage spec=st* -**> browser.merge a=msg b=s** +**`msg` = > browser.set_text sel="#log" text="draft saved"** +**`s` = > browser.storage spec=st** +*> browser.merge a=msg b=s* ## load_draft @@ -122,7 +122,7 @@ import text:lib/text.mq.md |----|-----|------| | get | mq-draft | on_draft | -**> browser.storage spec=st** +*> browser.storage spec=st* ## on_draft + `ok`=True @@ -130,47 +130,47 @@ import text:lib/text.mq.md + `found`=False 1. `found` - *`ret` = > browser.set_value sel="#draft" value=value* - *`msg` = > browser.set_text sel="#log" text="draft loaded"* - **> browser.merge a=ret b=msg** + **`ret` = > browser.set_value sel="#draft" value=value** + **`msg` = > browser.set_text sel="#log" text="draft loaded"** + *> browser.merge a=ret b=msg* 2. * - **> browser.set_text sel="#log" text="no draft"** + *> browser.set_text sel="#log" text="no draft"* ## start_tick -**> browser.interval ms=1000 then="on_tick" id="tick"** +*> browser.interval ms=1000 then="on_tick" id="tick"* ## stop_tick -**> browser.clear_interval id="tick"** +*> browser.clear_interval id="tick"* ## on_tick + `ok`=True + `id`="" -*`ticks` = ticks + 1* -*`label` = > str ticks* -**> browser.set_text sel="#tick" text=label** +**`ticks` = ticks + 1** +**`label` = > str ticks** +*> browser.set_text sel="#tick" text=label* ## go_home -*`path` = "/"* -**> show_path** +**`path` = "/"** +*> show_path* ## go_about -*`path` = "/about"* -**> show_path** +**`path` = "/about"** +*> show_path* ## go_net -*`path` = "/net"* -**> show_path** +**`path` = "/net"** +*> show_path* ## on_pop + `path`="" -*`path` = path* -**> show_path** +**`path` = path** +*> show_path* ## show_path -*`hide` = > table.put in=None at="hidden" value=""* -*`show` = > table.put in=None at="hidden" value=False* +**`hide` = > table.put in=None at="hidden" value=""** +**`show` = > table.put in=None at="hidden" value=False** 1. `path` == "/about" `attrs` = @@ -190,12 +190,12 @@ import text:lib/text.mq.md | #panel-home | #panel-about | #panel-net | |-------------|--------------|------------| | `show` | `hide` | `hide` | -*`label` = "path: " + path* -*`ret` = > browser.set_text sel="#path" text=label* -*`a` = > browser.wrap key="set_attr" value=attrs* -*`ret` = > browser.merge a=ret b=a* -*`nav` = > browser.navigate url=path* -**> browser.merge a=ret b=nav** +**`label` = "path: " + path** +**`ret` = > browser.set_text sel="#path" text=label** +**`a` = > browser.wrap key="set_attr" value=attrs** +**`ret` = > browser.merge a=ret b=a** +**`nav` = > browser.navigate url=path** +*> browser.merge a=ret b=nav* ## do_fetch_all @@ -206,15 +206,15 @@ import text:lib/text.mq.md | 1 | "https://httpbin.org/uuid" | | 2 | "https://httpbin.org/uuid" | -*`msg` = > browser.set_text sel="#net-out" text="fetch_all…"* -*`fa` = > browser.fetch_all requests=reqs then="on_fetch_all"* -**> browser.merge a=msg b=fa** +**`msg` = > browser.set_text sel="#net-out" text="fetch_all…"** +**`fa` = > browser.fetch_all requests=reqs then="on_fetch_all"** +*> browser.merge a=msg b=fa* ## on_fetch_all + `ok`=True + `results`=None -**> browser.set_text sel="#net-out" text="fetch_all done (see console / results in session)"** +*> browser.set_text sel="#net-out" text="fetch_all done (see console / results in session)"* ## ws_open @@ -224,32 +224,32 @@ import text:lib/text.mq.md |----|----|-----|-----------|--------------|------------|------------| | open | `ws_id` | "wss://echo.websocket.events" | on_ws_open | on_ws_msg | on_ws_err | on_ws_close | -**> browser.ws spec=w** +*> browser.ws spec=w* ## on_ws_open + `ok`=True + `id`="" -**> browser.set_text sel="#net-out" text="ws open"** +*> browser.set_text sel="#net-out" text="ws open"* ## on_ws_msg + `ok`=True + `data`="" -*`msg` = "ws ← " + data* -**> browser.set_text sel="#net-out" text=msg** +**`msg` = "ws ← " + data** +*> browser.set_text sel="#net-out" text=msg* ## on_ws_err + `ok`=False + `error`="" -*`msg` = "ws error: " + error* -**> browser.set_text sel="#net-out" text=msg** +**`msg` = "ws error: " + error** +*> browser.set_text sel="#net-out" text=msg* ## on_ws_close + `ok`=True -**> browser.set_text sel="#net-out" text="ws closed"** +*> browser.set_text sel="#net-out" text="ws closed"* ## ws_send + `value`="" @@ -260,7 +260,7 @@ import text:lib/text.mq.md |----|----|------| | send | `ws_id` | `value` | -**> browser.ws spec=w** +*> browser.ws spec=w* ## ws_close @@ -270,14 +270,14 @@ import text:lib/text.mq.md |----|----| | close | `ws_id` | -**> browser.ws spec=w** +*> browser.ws spec=w* ## copy_log -*`msg` = > browser.set_text sel="#log" text="copied bag to clipboard"* -*`c` = > browser.clipboard text=bag* -**> browser.merge a=msg b=c** +**`msg` = > browser.set_text sel="#log" text="copied bag to clipboard"** +**`c` = > browser.clipboard text=bag** +*> browser.merge a=msg b=c* ## dl_list -*`msg` = > browser.set_text sel="#log" text="download started"* -*`d` = > browser.download body=bag filename="items.txt"* -**> browser.merge a=msg b=d** +**`msg` = > browser.set_text sel="#log" text="download started"** +**`d` = > browser.download body=bag filename="items.txt"** +*> browser.merge a=msg b=d* diff --git a/examples/browser-hello/counter.mq.md b/examples/browser-hello/counter.mq.md index 3669540..294dec3 100644 --- a/examples/browser-hello/counter.mq.md +++ b/examples/browser-hello/counter.mq.md @@ -6,7 +6,7 @@ import browser:lib/browser.mq.md # main -*`count` = 0* +**`count` = 0** `wire` = @@ -15,13 +15,13 @@ import browser:lib/browser.mq.md | 1 | "#bump" | click | bump | | 2 | "#reset" | click | reset | -**`wire`** +*`wire`* ## bump -*`count` = count + 1* -*`label` = > str count* -**> browser.set_text sel="#count" text=label** +**`count` = count + 1** +**`label` = > str count** +*> browser.set_text sel="#count" text=label* ## reset -*`count` = 0* -**> browser.set_text sel="#count" text="0"** +**`count` = 0** +*> browser.set_text sel="#count" text="0"* diff --git a/examples/browser-hello/fetch.mq.md b/examples/browser-hello/fetch.mq.md index 1a9dca0..187f900 100644 --- a/examples/browser-hello/fetch.mq.md +++ b/examples/browser-hello/fetch.mq.md @@ -13,12 +13,12 @@ import browser:lib/browser.mq.md | 1 | "#load" | click | load | | 2 | "#ping" | click | ping | -**`wire`** +*`wire`* ## load -*`msg` = > browser.set_text sel="#status" text="loading…"* -*`req` = > browser.fetch url="https://httpbin.org/uuid" then="on_uuid"* -**> browser.merge a=msg b=req** +**`msg` = > browser.set_text sel="#status" text="loading…"** +**`req` = > browser.fetch url="https://httpbin.org/uuid" then="on_uuid"** +*> browser.merge a=msg b=req* ## on_uuid + `ok` @@ -27,16 +27,16 @@ import browser:lib/browser.mq.md + `error`="" 1. ok - **> browser.set_text sel="#status" text=body** + *> browser.set_text sel="#status" text=body* 2. * - **> browser.set_text sel="#status" text="fetch failed"** + *> browser.set_text sel="#status" text="fetch failed"* ## ping -*`msg` = > browser.set_text sel="#status" text="wait 600ms…"* -*`t` = > browser.after ms=600 then="on_ping"* -**> browser.merge a=msg b=t** +**`msg` = > browser.set_text sel="#status" text="wait 600ms…"** +**`t` = > browser.after ms=600 then="on_ping"** +*> browser.merge a=msg b=t* ## on_ping + `ok`=True -**> browser.set_text sel="#status" text="pong"** +*> browser.set_text sel="#status" text="pong"* diff --git a/examples/browser-hello/form.mq.md b/examples/browser-hello/form.mq.md index 8f21598..edc5c27 100644 --- a/examples/browser-hello/form.mq.md +++ b/examples/browser-hello/form.mq.md @@ -13,21 +13,21 @@ import table:lib/table.mq.md |---|--------|------|------| | 1 | "#name" | input | on_input | -**`wire`** +*`wire`* ## on_input + `value`="" + `event`="" 1. `value` != "" - *`label` = "你好," + value* - *`ret` = > browser.set_text sel="#echo" text=label* - *`cls` = > browser.set_class sel="#echo" class="hi"* - *`ret` = > browser.merge a=ret b=cls* - *`attrs` = > table.put in=None at="data-name" value=value* - *`attr` = > browser.set_attr sel="#echo" attrs=attrs* - **> browser.merge a=ret b=attr** + **`label` = "你好," + value** + **`ret` = > browser.set_text sel="#echo" text=label** + **`cls` = > browser.set_class sel="#echo" class="hi"** + **`ret` = > browser.merge a=ret b=cls** + **`attrs` = > table.put in=None at="data-name" value=value** + **`attr` = > browser.set_attr sel="#echo" attrs=attrs** + *> browser.merge a=ret b=attr* 2. * - *`ret` = > browser.set_text sel="#echo" text="(等待输入)"* - *`cls` = > browser.set_class sel="#echo" class=""* - **> browser.merge a=ret b=cls** + **`ret` = > browser.set_text sel="#echo" text="(等待输入)"** + **`cls` = > browser.set_class sel="#echo" class=""** + *> browser.merge a=ret b=cls* diff --git a/examples/browser-media/media.mq.md b/examples/browser-media/media.mq.md index ce56a1a..6f7c301 100644 --- a/examples/browser-media/media.mq.md +++ b/examples/browser-media/media.mq.md @@ -9,7 +9,7 @@ import table:lib/table.mq.md Route F demo: author data stays in tables; effects via `browser.*`. -*`obs_on` = False* +**`obs_on` = False** `wire` = @@ -25,15 +25,15 @@ Route F demo: author data stays in tables; effects via `browser.*`. | 8 | "#dropzone" | dragover | on_dragover | | | 9 | "#dropzone" | drop | on_drop | | -*`ready` = > browser.set_text sel="#log" text="ready (route F)"* -*`boot` = > table.put in=None at="wire" value=wire* -**> browser.merge a=boot b=ready** +**`ready` = > browser.set_text sel="#log" text="ready (route F)"** +**`boot` = > table.put in=None at="wire" value=wire** +*> browser.merge a=boot b=ready* ## read_text -**> browser.read_file sel="#file" then="on_file" as="text"** +*> browser.read_file sel="#file" then="on_file" as="text"* ## read_dataurl -**> browser.read_file sel="#file" then="on_file" as="data_url"** +*> browser.read_file sel="#file" then="on_file" as="data_url"* ## on_file + `ok`=False @@ -46,25 +46,25 @@ Route F demo: author data stays in tables; effects via `browser.*`. 1. `ok` 1. `as` == "data_url" - *`n` = > len value=data_url* - *`ns` = > str `n`* - *`preview` = name + " data_url chars=" + ns* - *`ret` = > browser.set_text sel="#log" text=preview* + **`n` = > len value=data_url** + **`ns` = > str `n`** + **`preview` = name + " data_url chars=" + ns** + **`ret` = > browser.set_text sel="#log" text=preview** 1. `data_url` != "" - *`h` = "\"preview\""* - *`img` = > browser.set_html sel="#preview" html=h* - **> browser.merge a=ret b=img** + **`h` = "\"preview\""** + **`img` = > browser.set_html sel="#preview" html=h** + *> browser.merge a=ret b=img* 2. * - **ret** + *ret* 2. * - *`n` = > len value=body* - *`ns` = > str `n`* - *`ss` = > str `size`* - *`preview` = name + " (" + ss + " B, chars=" + ns + ") ok"* - **> browser.set_text sel="#log" text=preview** + **`n` = > len value=body** + **`ns` = > str `n`** + **`ss` = > str `size`** + **`preview` = name + " (" + ss + " B, chars=" + ns + ") ok"** + *> browser.set_text sel="#log" text=preview* 2. * - *`preview` = "file error: " + error* - **> browser.set_text sel="#log" text=preview** + **`preview` = "file error: " + error** + *> browser.set_text sel="#log" text=preview* ## draw_box @@ -78,17 +78,17 @@ Canvas commands as a readable `@` table: | 2 | strokerect | 20 | 20 | 100 | 60 | | "#122018" | | | 3 | filltext | 40 | 55 | | | "#f5faf6" | | Marqdo | -*`cv` = > browser.canvas sel="#pad" commands=commands clear=True* -*`msg` = > browser.set_text sel="#log" text="canvas drawn"* -**> browser.merge a=cv b=msg** +**`cv` = > browser.canvas sel="#pad" commands=commands clear=True** +**`msg` = > browser.set_text sel="#log" text="canvas drawn"** +*> browser.merge a=cv b=msg* ## play_tone -*`tone` = > browser.audio op="play" id="demo" src="beep" freq=523 ms=220* -*`msg` = > browser.set_text sel="#log" text="audio beep"* -**> browser.merge a=tone b=msg** +**`tone` = > browser.audio op="play" id="demo" src="beep" freq=523 ms=220** +**`msg` = > browser.set_text sel="#log" text="audio beep"** +*> browser.merge a=tone b=msg* ## start_watch -*`obs_on` = True* +**`obs_on` = True** `obs` = @@ -97,12 +97,12 @@ Canvas commands as a readable `@` table: | 1 | intersect | "#beacon" | beacon | on_intersect | 0.25 | | 2 | resize | "#pad" | pad | on_resize | | -*`o` = > browser.observe specs=obs* -*`msg` = > browser.set_text sel="#log" text="observers on"* -**> browser.merge a=o b=msg** +**`o` = > browser.observe specs=obs** +**`msg` = > browser.set_text sel="#log" text="observers on"** +*> browser.merge a=o b=msg* ## stop_watch -*`obs_on` = False* +**`obs_on` = False** `ids` = @@ -111,23 +111,23 @@ Canvas commands as a readable `@` table: | 1 | beacon | | 2 | pad | -*`u` = > browser.unobserve specs=ids* -*`msg` = > browser.set_text sel="#log" text="observers off"* -**> browser.merge a=u b=msg** +**`u` = > browser.unobserve specs=ids** +**`msg` = > browser.set_text sel="#log" text="observers off"** +*> browser.merge a=u b=msg* ## on_intersect + `intersecting`=False + `ratio`=0 1. `obs_on` - *`state` = "hidden"* + **`state` = "hidden"** 1. `intersecting` - *`state` = "visible"* + **`state` = "visible"** 2. * --- - *`r` = > str `ratio`* - *`msg` = "beacon " + state + " ratio=" + r* - **> browser.set_text sel="#obs" text=msg** + **`r` = > str `ratio`** + **`msg` = "beacon " + state + " ratio=" + r** + *> browser.set_text sel="#obs" text=msg* 2. * **** @@ -136,18 +136,18 @@ Canvas commands as a readable `@` table: + `height`=0 1. `obs_on` - *`w` = > str `width`* - *`h` = > str `height`* - *`msg` = "pad size " + w + "×" + h* - **> browser.set_text sel="#obs" text=msg** + **`w` = > str `width`** + **`h` = > str `height`** + **`msg` = "pad size " + w + "×" + h** + *> browser.set_text sel="#obs" text=msg* 2. * **** ## on_drag + `drag`="" -*`msg` = "dragging: " + drag* -**> browser.set_text sel="#log" text=msg** +**`msg` = "dragging: " + drag** +*> browser.set_text sel="#log" text=msg* ## on_dragover **** @@ -155,8 +155,8 @@ Canvas commands as a readable `@` table: ## on_drop + `drop_text`="" -*`msg` = "dropped: " + drop_text* -*`h` = "" + drop_text + ""* -*`t` = > browser.set_text sel="#log" text=msg* -*`box` = > browser.set_html sel="#dropzone" html=h* -**> browser.merge a=t b=box** +**`msg` = "dropped: " + drop_text** +**`h` = "" + drop_text + ""** +**`t` = > browser.set_text sel="#log" text=msg** +**`box` = > browser.set_html sel="#dropzone" html=h** +*> browser.merge a=t b=box* diff --git a/examples/linalg-least-squares/index.mq.md b/examples/linalg-least-squares/index.mq.md index bc48341..a65b41a 100644 --- a/examples/linalg-least-squares/index.mq.md +++ b/examples/linalg-least-squares/index.mq.md @@ -21,14 +21,14 @@ $$ \begin{pmatrix}1\\2\\2\end{pmatrix} $$ -*`A` = > la.from_formula formula=`A`* -*`b` = > la.from_formula formula=`b`* +**`A` = > la.from_formula formula=`A`** +**`b` = > la.from_formula formula=`b`** -*`_` = > la.draw factor=`A` kind="heatmap" theme="light" path="ls-heatmap.svg"* +**`_` = > la.draw factor=`A` kind="heatmap" theme="light" path="ls-heatmap.svg"** -*`ls` = > la.lstsq a=`A` b=`b`* -*`x` = ls[^x]* -*`resid` = ls[^residual_fro]* +**`ls` = > la.lstsq a=`A` b=`b`** +**`x` = ls[^x]** +**`resid` = ls[^residual_fro]** > print text=`x` > print text=`resid` diff --git a/examples/linalg-svd/index.mq.md b/examples/linalg-svd/index.mq.md index 1002e25..b05d0ac 100644 --- a/examples/linalg-svd/index.mq.md +++ b/examples/linalg-svd/index.mq.md @@ -15,11 +15,11 @@ $$ \begin{bmatrix}4&0\\0&2\end{bmatrix} $$ -*`M` = > la.from_formula formula=`M`* -*`f` = > la.factorize matrix=`M` kind="svd"* -*`S` = 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"* +**`M` = > la.from_formula formula=`M`** +**`f` = > la.factorize matrix=`M` kind="svd"** +**`S` = 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"** > print text=`S` > print text=svd-ok diff --git a/examples/linalg-transpose/index.mq.md b/examples/linalg-transpose/index.mq.md index d8e99fa..d17712b 100644 --- a/examples/linalg-transpose/index.mq.md +++ b/examples/linalg-transpose/index.mq.md @@ -17,11 +17,11 @@ Declare shapes in a table, form \(P = AB\), then check \((AB)^\top = B^\top A^\t | 1 | A | 2 | 3 | | 2 | B | 3 | 2 | -*`env` = > la.declare table=`shapes`* -*`A` = env[^A]* -*`B` = env[^B]* -*`P` = `A` * `B`* -*`t` = > `P`.T_ascii* +**`env` = > la.declare table=`shapes`** +**`A` = env[^A]** +**`B` = env[^B]** +**`P` = `A` * `B`** +**`t` = > `P`.T_ascii** > print text=`t` 1. `t` == "B^T*A^T" > print text=identity-ok diff --git a/examples/marqdo-blog/components/foot.mq.md b/examples/marqdo-blog/components/foot.mq.md index 590f0d2..877eb3c 100644 --- a/examples/marqdo-blog/components/foot.mq.md +++ b/examples/marqdo-blog/components/foot.mq.md @@ -10,4 +10,4 @@ | 关于 | /about | | | 后台 | /admin | | -**`页脚`** \ No newline at end of file +*`页脚`* \ No newline at end of file diff --git a/examples/marqdo-blog/components/nav.mq.md b/examples/marqdo-blog/components/nav.mq.md index 221c630..b41153f 100644 --- a/examples/marqdo-blog/components/nav.mq.md +++ b/examples/marqdo-blog/components/nav.mq.md @@ -12,4 +12,4 @@ | 关于 | /about | | | 后台 | /admin | | -**`导航`** \ No newline at end of file +*`导航`* \ No newline at end of file diff --git a/examples/marqdo-blog/components/side.mq.md b/examples/marqdo-blog/components/side.mq.md index 7f83c2f..b43d879 100644 --- a/examples/marqdo-blog/components/side.mq.md +++ b/examples/marqdo-blog/components/side.mq.md @@ -12,4 +12,4 @@ | 发布文章 | /admin/new | | | 实时终端 | /#live | | -**`侧栏`** \ No newline at end of file +*`侧栏`* \ No newline at end of file diff --git a/examples/marqdo-blog/db/index.mq.md b/examples/marqdo-blog/db/index.mq.md index 77dca7b..69d7ba7 100644 --- a/examples/marqdo-blog/db/index.mq.md +++ b/examples/marqdo-blog/db/index.mq.md @@ -8,21 +8,21 @@ import seed:seed.mq.md ## 打开 -*store = > 网页.数据库 地址="sqlite:data/marqdo-blog.db"* -*字段 = > schema.posts* -*标签字段 = > schema.tags* -*关联字段 = > schema.post_tags* +**store = > 网页.数据库 地址="sqlite:data/marqdo-blog.db"** +**字段 = > schema.posts** +**标签字段 = > schema.tags** +**关联字段 = > schema.post_tags** > `store`.初始化 名=posts 字段=`字段` > `store`.初始化 名=tags 字段=`标签字段` > `store`.初始化 名=post_tags 字段=`关联字段` -*行 = > store.查询 表="posts" 上限=1* +**行 = > store.查询 表="posts" 上限=1** 1. `行` - **store** + *store* 2. * - *文章 = > seed.posts* - *标签 = > seed.tags* - *关联 = > seed.post_tags* + **文章 = > seed.posts** + **标签 = > seed.tags** + **关联 = > seed.post_tags** > `store`.插入 表=posts 行=`文章` > `store`.插入 表=tags 行=`标签` > `store`.插入 表=post_tags 行=`关联` - **store** \ No newline at end of file + *store* \ No newline at end of file diff --git a/examples/marqdo-blog/db/schema.mq.md b/examples/marqdo-blog/db/schema.mq.md index a5c9ded..2ad6403 100644 --- a/examples/marqdo-blog/db/schema.mq.md +++ b/examples/marqdo-blog/db/schema.mq.md @@ -15,7 +15,7 @@ | created_at | text | true | | updated_at | text | true | -**`schema`** +*`schema`* ## tags @@ -29,7 +29,7 @@ | name | text | false | | slug | text | false | -**`tags`** +*`tags`* ## post_tags @@ -43,4 +43,4 @@ | post_id | integer | false | | tag_id | integer | false | -**`post_tags`** \ No newline at end of file +*`post_tags`* \ No newline at end of file diff --git a/examples/marqdo-blog/db/seed.mq.md b/examples/marqdo-blog/db/seed.mq.md index 4671529..55de21c 100644 --- a/examples/marqdo-blog/db/seed.mq.md +++ b/examples/marqdo-blog/db/seed.mq.md @@ -13,7 +13,7 @@ | 5 | 会话与登录鉴权 | session-auth | 后台用 session 门禁保护,只有登录用户能发布文章。 | 用 app.鉴权 配置管理员用户表,/admin 下的 CRUD 页面都需要有效会话。 | web | 2026-08-18 | 2026-08-20 | | 6 | 数据库与 CRUD | database-crud | 博客的文章、标签、关联全部由 SQLite 支撑。 | db.初始化 建表、db.插入 写种子、后台表单增删改。文章与标签通过 post_tags 关联。 | database | 2026-08-20 | 2026-08-21 | -**`posts`** +*`posts`* ## tags @@ -29,7 +29,7 @@ | 4 | 数据库 | database | | 5 | 实时 | realtime | -**`tags`** +*`tags`* ## post_tags @@ -50,4 +50,4 @@ | 9 | 6 | 4 | | 10 | 6 | 1 | -**`post_tags`** \ No newline at end of file +*`post_tags`* \ No newline at end of file diff --git a/examples/marqdo-blog/index.mq.md b/examples/marqdo-blog/index.mq.md index 234d1b7..cd099e1 100644 --- a/examples/marqdo-blog/index.mq.md +++ b/examples/marqdo-blog/index.mq.md @@ -83,49 +83,49 @@ import db:db/index.mq.md |----|------|----|------|------|------| | "/static/logo.svg" | Marqdo | brand-logo | "/" | 40 | eager | -*store = > db.打开* +**store = > db.打开** -*首页CSS = > theme.全局* +**首页CSS = > theme.全局** -*page = > 网页.页面 标题="Marqdo 博客" 引言="

    Marqdo 博客

    用 web 扩展库搭建的博客:表格装配页面、SQLite 数据、动态路由、实时终端。

    实时终端

    connecting…

    "* -*page = > page.组件装配 组件=`首页`* -*page = > page.主体装配 主体=`列表`* -*page = > page.排序 排序="-created_at"* -*page = > page.样式 样式=`首页CSS`* -*page = > page.头装配 表=`头资源`* -*page = > page.图片装配 表=`品牌图`* +**page = > 网页.页面 标题="Marqdo 博客" 引言="

    Marqdo 博客

    用 web 扩展库搭建的博客:表格装配页面、SQLite 数据、动态路由、实时终端。

    实时终端

    connecting…

    "** +**page = > page.组件装配 组件=`首页`** +**page = > page.主体装配 主体=`列表`** +**page = > page.排序 排序="-created_at"** +**page = > page.样式 样式=`首页CSS`** +**page = > page.头装配 表=`头资源`** +**page = > page.图片装配 表=`品牌图`** -*about = > 网页.页面 标题="关于" 引言="

    关于本站

    一个用 Marqdo 的 web 扩展库(ext/web)写成的博客系统。

    它演示了:GFM 表格装配导航与侧栏、SQLite 驱动的主体绑定、动态路由 /post/{slug}、标签归档、以及受 session 保护的后台 CRUD。

    "* -*about = > about.组件装配 组件=`首页`* -*about = > about.样式 样式=`首页CSS`* +**about = > 网页.页面 标题="关于" 引言="

    关于本站

    一个用 Marqdo 的 web 扩展库(ext/web)写成的博客系统。

    它演示了:GFM 表格装配导航与侧栏、SQLite 驱动的主体绑定、动态路由 /post/{slug}、标签归档、以及受 session 保护的后台 CRUD。

    "** +**about = > about.组件装配 组件=`首页`** +**about = > about.样式 样式=`首页CSS`** -*post = > 网页.页面 标题="文章"* -*post = > post.组件装配 组件=`首页`* -*post = > post.主体装配 主体=`详情绑定`* -*post = > post.查询条件 条件=`文章条件`* -*post = > post.详情 详情=True* -*post = > post.样式 样式=`首页CSS`* +**post = > 网页.页面 标题="文章"** +**post = > post.组件装配 组件=`首页`** +**post = > post.主体装配 主体=`详情绑定`** +**post = > post.查询条件 条件=`文章条件`** +**post = > post.详情 详情=True** +**post = > post.样式 样式=`首页CSS`** -*tags = > 网页.页面 标题="标签归档" 引言="

    标签归档

    点击标签查看该主题下的文章。

    "* -*tags = > tags.组件装配 组件=`首页`* -*tags = > tags.主体装配 主体=`标签列表`* -*tags = > tags.链接前缀 前缀="/tag/"* -*tags = > tags.样式 样式=`首页CSS`* +**tags = > 网页.页面 标题="标签归档" 引言="

    标签归档

    点击标签查看该主题下的文章。

    "** +**tags = > tags.组件装配 组件=`首页`** +**tags = > tags.主体装配 主体=`标签列表`** +**tags = > tags.链接前缀 前缀="/tag/"** +**tags = > tags.样式 样式=`首页CSS`** -*tagged = > 网页.页面 标题="标签"* -*tagged = > tagged.组件装配 组件=`首页`* -*tagged = > tagged.主体装配 主体=`列表`* -*tagged = > tagged.查询条件 条件=`标签条件`* -*tagged = > tagged.排序 排序="-created_at"* -*tagged = > tagged.样式 样式=`首页CSS`* +**tagged = > 网页.页面 标题="标签"** +**tagged = > tagged.组件装配 组件=`首页`** +**tagged = > tagged.主体装配 主体=`列表`** +**tagged = > tagged.查询条件 条件=`标签条件`** +**tagged = > tagged.排序 排序="-created_at"** +**tagged = > tagged.样式 样式=`首页CSS`** -*app = > 网页.应用 页面=page 数据库=store 后台=True 主机="127.0.0.1" 端口=18085* -*app = > app.路由 路径="/about" 页面=about* -*app = > app.路由 路径="/post/{slug}" 页面=post* -*app = > app.路由 路径="/tags" 页面=tags* -*app = > app.路由 路径="/tag/{slug}" 页面=tagged* -*app = > app.静态 目录="public" 挂载="/static"* -*app = > app.图标 表=`站点图标`* -*app = > app.路由实时 路径="/live" 回显=True* -*app = > app.鉴权 用户表=`管理员` 会话时长=3600* +**app = > 网页.应用 页面=page 数据库=store 后台=True 主机="127.0.0.1" 端口=18085** +**app = > app.路由 路径="/about" 页面=about** +**app = > app.路由 路径="/post/{slug}" 页面=post** +**app = > app.路由 路径="/tags" 页面=tags** +**app = > app.路由 路径="/tag/{slug}" 页面=tagged** +**app = > app.静态 目录="public" 挂载="/static"** +**app = > app.图标 表=`站点图标`** +**app = > app.路由实时 路径="/live" 回显=True** +**app = > app.鉴权 用户表=`管理员` 会话时长=3600** > `app`.监听 \ No newline at end of file diff --git a/examples/marqdo-blog/styles/theme.mq.md b/examples/marqdo-blog/styles/theme.mq.md index 8b2a125..8969d04 100644 --- a/examples/marqdo-blog/styles/theme.mq.md +++ b/examples/marqdo-blog/styles/theme.mq.md @@ -47,7 +47,7 @@ import text:lib/text.mq.md | body.has-sidebar | grid-template-areas | "top top" "side main" "foot foot" | | body.no-sidebar | grid-template-areas | "top" "main" "foot" | -**`基础`** +*`基础`* ## 顶栏 @@ -96,7 +96,7 @@ import text:lib/text.mq.md | ul.nav li:first-child a | padding-left | .2rem | | ul.nav li:first-child a | padding-right | .2rem | -**`顶栏`** +*`顶栏`* ## 侧栏 @@ -129,7 +129,7 @@ import text:lib/text.mq.md | ul.side-nav a:hover | transform | translateX(4px) | | ul.side-nav a:hover | box-shadow | 0 1px 3px rgba(28,25,23,.08) | -**`侧栏`** +*`侧栏`* ## 主体 @@ -154,7 +154,7 @@ import text:lib/text.mq.md | .main-intro p | margin | 0 | | .main-intro p | font-size | 1.05rem | -**`主体`** +*`主体`* ## 卡片 @@ -210,7 +210,7 @@ import text:lib/text.mq.md | .content.cards p | font-size | .95rem | | .content.cards p | flex | 1 | -**`卡片`** +*`卡片`* ## 页脚 @@ -240,7 +240,7 @@ import text:lib/text.mq.md | ul.foot-nav a | text-decoration | none | | ul.foot-nav a:hover | color | var(--accent) | -**`页脚`** +*`页脚`* ## 表单 @@ -341,7 +341,7 @@ import text:lib/text.mq.md | .site-form .admin-list a | text-decoration | none | | .site-form .admin-list a | font-size | .9rem | -**`表单`** +*`表单`* ## 响应式 @@ -364,29 +364,29 @@ import text:lib/text.mq.md | (max-width: 860px) | .content.cards | grid-template-columns | 1fr | | (max-width: 520px) | ul.nav | flex-wrap | wrap | -**`响应式`** +*`响应式`* ## 全局 用 样式装配 函数逐个把段落表装配成 CSS,再拼接成完整样式表。 -*基础表 = > 基础* -*顶栏表 = > 顶栏* -*侧栏表 = > 侧栏* -*主体表 = > 主体* -*卡片表 = > 卡片* -*页脚表 = > 页脚* -*表单表 = > 表单* -*响应式表 = > 响应式* +**基础表 = > 基础** +**顶栏表 = > 顶栏** +**侧栏表 = > 侧栏** +**主体表 = > 主体** +**卡片表 = > 卡片** +**页脚表 = > 页脚** +**表单表 = > 表单** +**响应式表 = > 响应式** -*css基础 = > 网页.样式装配 名="基础" 表=`基础表`* -*css顶栏 = > 网页.样式装配 名="顶栏" 表=`顶栏表`* -*css侧栏 = > 网页.样式装配 名="侧栏" 表=`侧栏表`* -*css主体 = > 网页.样式装配 名="主体" 表=`主体表`* -*css卡片 = > 网页.样式装配 名="卡片" 表=`卡片表`* -*css页脚 = > 网页.样式装配 名="页脚" 表=`页脚表`* -*css表单 = > 网页.样式装配 名="表单" 表=`表单表`* -*css响应式 = > 网页.样式装配 名="响应式" 表=`响应式表`* +**css基础 = > 网页.样式装配 名="基础" 表=`基础表`** +**css顶栏 = > 网页.样式装配 名="顶栏" 表=`顶栏表`** +**css侧栏 = > 网页.样式装配 名="侧栏" 表=`侧栏表`** +**css主体 = > 网页.样式装配 名="主体" 表=`主体表`** +**css卡片 = > 网页.样式装配 名="卡片" 表=`卡片表`** +**css页脚 = > 网页.样式装配 名="页脚" 表=`页脚表`** +**css表单 = > 网页.样式装配 名="表单" 表=`表单表`** +**css响应式 = > 网页.样式装配 名="响应式" 表=`响应式表`** `css段` = @@ -401,5 +401,5 @@ import text:lib/text.mq.md | `css表单` | | `css响应式` | -*css = > text.str_join xs=`css段` sep=""* -**css** +**css = > text.str_join xs=`css段` sep=""** +*css* diff --git a/examples/quantum-bell/index.mq.md b/examples/quantum-bell/index.mq.md index 61a0f63..96b280e 100644 --- a/examples/quantum-bell/index.mq.md +++ b/examples/quantum-bell/index.mq.md @@ -19,9 +19,9 @@ H on qubit 0, then CNOT(0→1). Ideal measurement: |00⟩ and |11⟩ each with p | 1 | H | 0 | | 2 | CX | 0,1 | -*qc = > quantum.circuit qubits=2 steps=`steps`* -*p = > qc.probabilities* -*_ = > qc.draw path="bell.svg"* -*_ = > qc.draw kind="probs" path="bell-probs.svg"* +**qc = > quantum.circuit qubits=2 steps=`steps`** +**p = > qc.probabilities** +**_ = > qc.draw path="bell.svg"** +**_ = > qc.draw kind="probs" path="bell-probs.svg"** > print text=`p` diff --git a/examples/quantum-entanglement/index.mq.md b/examples/quantum-entanglement/index.mq.md index 8ead944..f93a136 100644 --- a/examples/quantum-entanglement/index.mq.md +++ b/examples/quantum-entanglement/index.mq.md @@ -18,25 +18,25 @@ Build |Φ⁺⟩ with H then CX. Full-state purity stays 1; tracing out one qubit | 1 | H | 0 | | 2 | CX | 0,1 | -*qc = > quantum.circuit qubits=2 steps=`steps`* -*p = > `qc`.probabilities* +**qc = > quantum.circuit qubits=2 steps=`steps`** +**p = > `qc`.probabilities** -*rho = > `qc`.density* -*pur = > `rho`.purity* -*red = > `rho`.partial_trace keep=0* -*rpur = > `red`.purity* +**rho = > `qc`.density** +**pur = > `rho`.purity** +**red = > `rho`.partial_trace keep=0** +**rpur = > `red`.purity** -*zz = "ZZ"* -*ezz = > `qc`.expect obs=`zz`* +**zz = "ZZ"** +**ezz = > `qc`.expect obs=`zz`** -*sch = > `qc`.schmidt cut=1* -*ent = sch[^entropy]* +**sch = > `qc`.schmidt cut=1** +**ent = sch[^entropy]** -*_ = > `qc`.draw path="entangle-circuit.svg" theme="dark"* -*_ = > `qc`.draw kind="hinton" path="entangle-hinton.svg"* -*_ = > `qc`.draw kind="qsphere" path="entangle-qsphere.svg"* -*_ = > `qc`.draw kind="multibloch" path="entangle-multibloch.svg"* -*_ = > `rho`.draw kind="city" path="entangle-city.svg"* +**_ = > `qc`.draw path="entangle-circuit.svg" theme="dark"** +**_ = > `qc`.draw kind="hinton" path="entangle-hinton.svg"** +**_ = > `qc`.draw kind="qsphere" path="entangle-qsphere.svg"** +**_ = > `qc`.draw kind="multibloch" path="entangle-multibloch.svg"** +**_ = > `rho`.draw kind="city" path="entangle-city.svg"** > print text=`p` > print text=`pur` diff --git a/examples/quantum-ghz/index.mq.md b/examples/quantum-ghz/index.mq.md index 767b80c..bceb8be 100644 --- a/examples/quantum-ghz/index.mq.md +++ b/examples/quantum-ghz/index.mq.md @@ -18,11 +18,11 @@ H on qubit 0, CX(0→1), CX(0→2). Ideal: |000⟩ and |111⟩ each with probabi | 2 | CX | 0,1 | | 3 | CX | 0,2 | -*qc = > quantum.circuit qubits=3 steps=`steps`* -*p = > qc.probabilities* -*_ = > qc.draw path="ghz.svg"* -*_ = > qc.draw kind="probs" path="ghz-probs.svg"* -*H = > quantum.gate name="H"* -*_ = > H.draw kind="matrix" path="ghz-h-matrix.svg"* +**qc = > quantum.circuit qubits=3 steps=`steps`** +**p = > qc.probabilities** +**_ = > qc.draw path="ghz.svg"** +**_ = > qc.draw kind="probs" path="ghz-probs.svg"** +**H = > quantum.gate name="H"** +**_ = > H.draw kind="matrix" path="ghz-h-matrix.svg"** > print text=`p` diff --git a/examples/web-client-site/index.mq.md b/examples/web-client-site/index.mq.md index 26baa15..36a3d8d 100644 --- a/examples/web-client-site/index.mq.md +++ b/examples/web-client-site/index.mq.md @@ -9,11 +9,11 @@ import web:ext/web/web.mq.md Server page with a counter UI. Client logic lives in `static/client.mq.md` (loaded by official bridge via `client_embed`). -*`embed` = > web.client_embed bridge="/static/marqdo-bridge.js" wasm="/static/marqdo_wasm.wasm" source="/static/client.mq.md" boot=True* +**`embed` = > web.client_embed bridge="/static/marqdo-bridge.js" wasm="/static/marqdo_wasm.wasm" source="/static/client.mq.md" boot=True** -*`intro` = "

    Marqdo client site

    SSR + WASM session. No author JS.

    0

    booting…
    " + embed* +**`intro` = "

    Marqdo client site

    SSR + WASM session. No author JS.

    0

    booting…
    " + embed** -*page = > web.page title="Marqdo client site" intro=intro* -*app = > web.app page=page host="127.0.0.1" port=18090* -*app = > app.static dir="static" mount="/static"* +**page = > web.page title="Marqdo client site" intro=intro** +**app = > web.app page=page host="127.0.0.1" port=18090** +**app = > app.static dir="static" mount="/static"** > `app`.listen diff --git a/examples/web-client-site/static/client.mq.md b/examples/web-client-site/static/client.mq.md index db0efaf..ba33c31 100644 --- a/examples/web-client-site/static/client.mq.md +++ b/examples/web-client-site/static/client.mq.md @@ -7,7 +7,7 @@ import table:lib/table.mq.md # main -*`count` = 0* +**`count` = 0** `wire` = @@ -16,15 +16,15 @@ import table:lib/table.mq.md | 1 | "#bump" | click | bump | | 2 | "#reset" | click | reset | -*`ready` = > browser.set_text sel="#log" text="client.mq.md ready"* -*`boot` = > table.put in=None at="wire" value=wire* -**> browser.merge a=boot b=ready** +**`ready` = > browser.set_text sel="#log" text="client.mq.md ready"** +**`boot` = > table.put in=None at="wire" value=wire** +*> browser.merge a=boot b=ready* ## bump -*`count` = count + 1* -*`label` = > str count* -**> browser.set_text sel="#count" text=label** +**`count` = count + 1** +**`label` = > str count** +*> browser.set_text sel="#count" text=label* ## reset -*`count` = 0* -**> browser.set_text sel="#count" text="0"** +**`count` = 0** +*> browser.set_text sel="#count" text="0"* diff --git a/examples/web-net-site-zh/components/foot.mq.md b/examples/web-net-site-zh/components/foot.mq.md index 2f7ddc6..6d65a2d 100644 --- a/examples/web-net-site-zh/components/foot.mq.md +++ b/examples/web-net-site-zh/components/foot.mq.md @@ -7,4 +7,4 @@ | Marqdo 网络扩展示例 | https://github.com | | | 文档 | /tools | | -**`页脚`** \ No newline at end of file +*`页脚`* \ No newline at end of file diff --git a/examples/web-net-site-zh/components/nav.mq.md b/examples/web-net-site-zh/components/nav.mq.md index 3ac12d9..ef97d93 100644 --- a/examples/web-net-site-zh/components/nav.mq.md +++ b/examples/web-net-site-zh/components/nav.mq.md @@ -12,4 +12,4 @@ | 工具 | /tools | | | 后台 | /admin | | -**`导航`** \ No newline at end of file +*`导航`* \ No newline at end of file diff --git a/examples/web-net-site-zh/components/side.mq.md b/examples/web-net-site-zh/components/side.mq.md index b2a04e4..0b83f3a 100644 --- a/examples/web-net-site-zh/components/side.mq.md +++ b/examples/web-net-site-zh/components/side.mq.md @@ -12,4 +12,4 @@ | 表单 | /new | | | lib/net | /tools | | -**`侧栏`** \ No newline at end of file +*`侧栏`* \ No newline at end of file diff --git a/examples/web-net-site-zh/db/articles.mq.md b/examples/web-net-site-zh/db/articles.mq.md index 68697a1..b8b6ae7 100644 --- a/examples/web-net-site-zh/db/articles.mq.md +++ b/examples/web-net-site-zh/db/articles.mq.md @@ -8,7 +8,7 @@ | title | text | false | | body | text | true | -**`字段`** +*`字段`* ## 种子 @@ -20,4 +20,4 @@ | 2 | 登录门禁后台 | /admin 页面需要 session 会话。 | | 3 | WebSocket 实时 | /live 端点会把你的消息实时回显。 | -**`行`** \ No newline at end of file +*`行`* \ No newline at end of file diff --git a/examples/web-net-site-zh/db/index.mq.md b/examples/web-net-site-zh/db/index.mq.md index 0101e3f..098bd06 100644 --- a/examples/web-net-site-zh/db/index.mq.md +++ b/examples/web-net-site-zh/db/index.mq.md @@ -7,13 +7,13 @@ import articles:articles.mq.md ## 打开 -*store = > 网页.数据库 地址="sqlite:data/site-net-zh.db"* -*字段 = > articles.结构* +**store = > 网页.数据库 地址="sqlite:data/site-net-zh.db"** +**字段 = > articles.结构** > `store`.初始化 名=articles 字段=`字段` -*行 = > store.查询 表="articles" 上限=1* +**行 = > store.查询 表="articles" 上限=1** 1. `行` - **store** + *store* 2. * - *种子 = > articles.种子* + **种子 = > articles.种子** > `store`.插入 表=articles 行=`种子` - **store** \ No newline at end of file + *store* \ No newline at end of file diff --git a/examples/web-net-site-zh/index.mq.md b/examples/web-net-site-zh/index.mq.md index c07ef37..dd5f570 100644 --- a/examples/web-net-site-zh/index.mq.md +++ b/examples/web-net-site-zh/index.mq.md @@ -44,29 +44,29 @@ import db:db/index.mq.md | title | max:120 | 标题太长 | | body | max:8000 | 正文太长 | -*store = > db.打开* -*page = > 网页.页面 标题="网络扩展站" 引言="

    网络扩展站

    SQLite 文章列表、WebSocket 实时小部件、登录门禁后台、以及标准库 lib/net 的解析工具。

    实时 WebSocket

    connecting…

    "* -*page = > page.组件装配 组件=`首页`* -*page = > page.主体装配 主体=`列表`* +**store = > db.打开** +**page = > 网页.页面 标题="网络扩展站" 引言="

    网络扩展站

    SQLite 文章列表、WebSocket 实时小部件、登录门禁后台、以及标准库 lib/net 的解析工具。

    实时 WebSocket

    connecting…

    "** +**page = > page.组件装配 组件=`首页`** +**page = > page.主体装配 主体=`列表`** -*about = > 网页.页面 标题="关于" 引言="

    关于

    演示网络扩展后的 web 库:会话、登录鉴权、WebSocket、multipart/cookie 解析。

    "* -*about = > about.组件装配 组件=`首页`* +**about = > 网页.页面 标题="关于" 引言="

    关于

    演示网络扩展后的 web 库:会话、登录鉴权、WebSocket、multipart/cookie 解析。

    "** +**about = > about.组件装配 组件=`首页`** -*解析请求 = > net.解析Cookie 内容="session=abc123; theme=dark"* -*请求块 = 解析请求[^1]* +**解析请求 = > net.解析Cookie 内容="session=abc123; theme=dark"** +**请求块 = 解析请求[^1]** -*解析响应 = > net.解析Cookie 内容="id=42; Path=/; HttpOnly; SameSite=Lax" 是响应头=True* -*响应块 = 解析响应[^1]* +**解析响应 = > net.解析Cookie 内容="id=42; Path=/; HttpOnly; SameSite=Lax" 是响应头=True** +**响应块 = 解析响应[^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]* +**多部分 = > net.解析多部分 正文=`正文` 边界=`边界`** +**字段块 = 多部分[^1]** +**文件块 = 多部分[^2]** `工具段` = @@ -83,17 +83,17 @@ import db:db/index.mq.md | `文件块`[^name] · `文件块`[^filename] · `文件块`[^content_type] | |

    | -*工具引言 = > text.str_join xs=`工具段` sep=""* -*tools = > 网页.页面 标题="工具" 引言=`工具引言`* -*tools = > tools.组件装配 组件=`首页`* +**工具引言 = > text.str_join xs=`工具段` sep=""** +**tools = > 网页.页面 标题="工具" 引言=`工具引言`** +**tools = > tools.组件装配 组件=`首页`** -*article_form = > 网页.表单 表="articles" 动作="插入"* -*article_form = > article_form.字段 字段=`文章字段`* -*article_form = > article_form.规则 规则=`文章规则`* +**article_form = > 网页.表单 表="articles" 动作="插入"** +**article_form = > article_form.字段 字段=`文章字段`** +**article_form = > article_form.规则 规则=`文章规则`** -*new = > 网页.页面 标题="发布" 引言="

    发布

    表单插入到 articles 表。

    "* -*new = > new.组件装配 组件=`首页`* -*new = > new.表单装配 id="article" 表单=article_form* +**new = > 网页.页面 标题="发布" 引言="

    发布

    表单插入到 articles 表。

    "** +**new = > new.组件装配 组件=`首页`** +**new = > new.表单装配 id="article" 表单=article_form** `管理员` = @@ -101,11 +101,11 @@ import db:db/index.mq.md |----|--------|------| | 1 | admin | secret | -*app = > 网页.应用 页面=page 数据库=store 后台=True 主机="127.0.0.1" 端口=18084* -*app = > app.路由 路径="/about" 页面=about* -*app = > app.路由 路径="/new" 页面=new* -*app = > app.路由 路径="/tools" 页面=tools* -*app = > app.静态 目录="public" 挂载="/static"* -*app = > app.路由实时 路径="/live" 回显=True* -*app = > app.鉴权 用户表=`管理员` 会话时长=3600* +**app = > 网页.应用 页面=page 数据库=store 后台=True 主机="127.0.0.1" 端口=18084** +**app = > app.路由 路径="/about" 页面=about** +**app = > app.路由 路径="/new" 页面=new** +**app = > app.路由 路径="/tools" 页面=tools** +**app = > app.静态 目录="public" 挂载="/static"** +**app = > app.路由实时 路径="/live" 回显=True** +**app = > app.鉴权 用户表=`管理员` 会话时长=3600** > `app`.监听 \ No newline at end of file diff --git a/examples/web-net-site-zh/styles/shell.mq.md b/examples/web-net-site-zh/styles/shell.mq.md index 84027f6..791e491 100644 --- a/examples/web-net-site-zh/styles/shell.mq.md +++ b/examples/web-net-site-zh/styles/shell.mq.md @@ -7,7 +7,7 @@ | background | #ffffff | | border-bottom | 1px solid #e7e5e4 | -**`顶栏`** +*`顶栏`* ## 侧栏面板 @@ -17,7 +17,7 @@ |------|-----| | background | #f5f5f4 | -**`侧栏面板`** +*`侧栏面板`* ## 卡片标题 @@ -28,7 +28,7 @@ | font-size | 1.15rem | | margin | 0 0 0.35rem | -**`卡片标题`** +*`卡片标题`* ## 卡片正文 @@ -39,4 +39,4 @@ | color | #57534e | | margin | 0 | -**`卡片正文`** \ No newline at end of file +*`卡片正文`* \ No newline at end of file diff --git a/examples/web-net-site/components/foot.mq.md b/examples/web-net-site/components/foot.mq.md index ca3554b..3fd1df0 100644 --- a/examples/web-net-site/components/foot.mq.md +++ b/examples/web-net-site/components/foot.mq.md @@ -7,4 +7,4 @@ | Marqdo web-net example | https://github.com | | | Docs | /tools | | -**`foot`** \ No newline at end of file +*`foot`* \ No newline at end of file diff --git a/examples/web-net-site/components/nav.mq.md b/examples/web-net-site/components/nav.mq.md index 1586fab..4bd502a 100644 --- a/examples/web-net-site/components/nav.mq.md +++ b/examples/web-net-site/components/nav.mq.md @@ -12,4 +12,4 @@ Site top navigation. The Admin tab points at the login-gated admin page. | Tools | /tools | | | Admin | /admin | | -**`nav`** +*`nav`* diff --git a/examples/web-net-site/components/side.mq.md b/examples/web-net-site/components/side.mq.md index fa3df07..c14038f 100644 --- a/examples/web-net-site/components/side.mq.md +++ b/examples/web-net-site/components/side.mq.md @@ -12,4 +12,4 @@ Sidebar index of what this example demonstrates. | Forms | /new | | | net lib | /tools | | -**`side`** \ No newline at end of file +*`side`* \ No newline at end of file diff --git a/examples/web-net-site/db/articles.mq.md b/examples/web-net-site/db/articles.mq.md index cf24f06..d0da7bb 100644 --- a/examples/web-net-site/db/articles.mq.md +++ b/examples/web-net-site/db/articles.mq.md @@ -8,7 +8,7 @@ | title | text | false | | body | text | true | -**`fields`** +*`fields`* ## seed @@ -20,4 +20,4 @@ | 2 | Login-gated admin | The /admin page requires a session cookie. | | 3 | WebSocket live | The /live endpoint echoes your message in real time. | -**`rows`** \ No newline at end of file +*`rows`* \ No newline at end of file diff --git a/examples/web-net-site/db/index.mq.md b/examples/web-net-site/db/index.mq.md index 82dfd59..bd7d34f 100644 --- a/examples/web-net-site/db/index.mq.md +++ b/examples/web-net-site/db/index.mq.md @@ -7,13 +7,13 @@ import articles:articles.mq.md ## open -*store = > web.db url="sqlite:data/site-net.db"* -*fields = > articles.schema* +**store = > web.db url="sqlite:data/site-net.db"** +**fields = > articles.schema** > `store`.init name=articles fields=`fields` -*rows = > store.select table="articles" limit=1* +**rows = > store.select table="articles" limit=1** 1. `rows` - **store** + *store* 2. * - *seed = > articles.seed* + **seed = > articles.seed** > `store`.insert table=articles rows=`seed` - **store** \ No newline at end of file + *store* \ No newline at end of file diff --git a/examples/web-net-site/index.mq.md b/examples/web-net-site/index.mq.md index 3565db7..8dfb4cd 100644 --- a/examples/web-net-site/index.mq.md +++ b/examples/web-net-site/index.mq.md @@ -31,27 +31,27 @@ import db:db/index.mq.md Home intro also embeds the live WebSocket widget (HTML is served raw). -*store = > db.open* -*page = > web.page title="Marqdo Net Site" intro="

    Net Site

    Articles from SQLite, a live WebSocket widget, login-gated admin, and net-library parsing tools.

    Live WebSocket

    connecting…

    "* -*page = > page.compose_components components=home* -*page = > page.compose_main main=index* +**store = > db.open** +**page = > web.page title="Marqdo Net Site" intro="

    Net Site

    Articles from SQLite, a live WebSocket widget, login-gated admin, and net-library parsing tools.

    Live WebSocket

    connecting…

    "** +**page = > page.compose_components components=home** +**page = > page.compose_main main=index** About page: same shell. -*about = > web.page title="About" intro="

    About

    Demonstrates the network-extended web library: sessions, auth, WebSocket, multipart/cookie parsing.

    "* -*about = > about.compose_components components=home* +**about = > web.page title="About" intro="

    About

    Demonstrates the network-extended web library: sessions, auth, WebSocket, multipart/cookie parsing.

    "** +**about = > about.compose_components components=home** Parse a `Cookie` request header with the standard library. -*parsed_req = > net.cookie_parse text="session=abc123; theme=dark"* -*req_cookie = parsed_req[^1]* +**parsed_req = > net.cookie_parse text="session=abc123; theme=dark"** +**req_cookie = 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 = parsed_resp[^1]* +**parsed_resp = > net.cookie_parse text="id=42; Path=/; HttpOnly; SameSite=Lax" is_response=True** +**resp_cookie = parsed_resp[^1]** Parse a `multipart/form-data` body. @@ -59,9 +59,9 @@ 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\n--`_b`--\n" -*mp = > net.multipart_parse body=`_body` boundary=`_b`* -*mp_title = mp[^1]* -*mp_cover = mp[^2]* +**mp = > net.multipart_parse body=`_body` boundary=`_b`** +**mp_title = mp[^1]** +**mp_cover = mp[^2]** Build the tools page as one HTML intro (intro is served raw). @@ -80,9 +80,9 @@ Build the tools page as one HTML intro (intro is served raw). | `mp_cover`[^name] · `mp_cover`[^filename] · `mp_cover`[^content_type] | |

    | -*tools_intro = > text.str_join xs=`tools_parts` sep=""* -*tools = > web.page title="Tools" intro=`tools_intro`* -*tools = > tools.compose_components components=home* +**tools_intro = > text.str_join xs=`tools_parts` sep=""** +**tools = > web.page title="Tools" intro=`tools_intro`** +**tools = > tools.compose_components components=home** Article create form: field table + rules table. @@ -101,15 +101,15 @@ Article create form: field table + rules table. | title | max:120 | Title is too long | | body | max:8000 | Body is too long | -*article_form = > web.form table="articles" action="insert"* -*article_form = > article_form.fields fields=article_fields* -*article_form = > article_form.rules rules=article_rules* +**article_form = > web.form table="articles" action="insert"** +**article_form = > article_form.fields fields=article_fields** +**article_form = > article_form.rules rules=article_rules** New article page: form embedded in the main slot. -*new = > web.page title="Publish" intro="

    Publish

    Form inserts into articles.

    "* -*new = > new.compose_components components=home* -*new = > new.compose_form id="article" form=article_form* +**new = > web.page title="Publish" intro="

    Publish

    Form inserts into articles.

    "** +**new = > new.compose_components components=home** +**new = > new.compose_form id="article" form=article_form** Admin users table (english + chinese column headers both work). @@ -119,11 +119,11 @@ Admin users table (english + chinese column headers both work). |----|----------|----------| | 1 | admin | secret | -*app = > web.app page=page db=store admin=True host="127.0.0.1" port=18083* -*app = > app.route path="/about" page=about* -*app = > app.route path="/new" page=new* -*app = > app.route path="/tools" page=tools* -*app = > app.static dir="public" mount="/static"* -*app = > app.route_ws path="/live" echo=True* -*app = > app.auth users=`admins` session_ttl=3600* +**app = > web.app page=page db=store admin=True host="127.0.0.1" port=18083** +**app = > app.route path="/about" page=about** +**app = > app.route path="/new" page=new** +**app = > app.route path="/tools" page=tools** +**app = > app.static dir="public" mount="/static"** +**app = > app.route_ws path="/live" echo=True** +**app = > app.auth users=`admins` session_ttl=3600** > `app`.listen \ No newline at end of file diff --git a/examples/web-net-site/styles/shell.mq.md b/examples/web-net-site/styles/shell.mq.md index 15cd41b..83bc026 100644 --- a/examples/web-net-site/styles/shell.mq.md +++ b/examples/web-net-site/styles/shell.mq.md @@ -7,7 +7,7 @@ | background | #ffffff | | border-bottom | 1px solid #e7e5e4 | -**`topnav`** +*`topnav`* ## side_panel @@ -17,7 +17,7 @@ |------|-----| | background | #f5f5f4 | -**`side_panel`** +*`side_panel`* ## card_title @@ -28,7 +28,7 @@ | font-size | 1.15rem | | margin | 0 0 0.35rem | -**`card_title`** +*`card_title`* ## card_body @@ -39,4 +39,4 @@ | color | #57534e | | margin | 0 | -**`card_body`** +*`card_body`* diff --git a/examples/web-site-zh/components/foot.mq.md b/examples/web-site-zh/components/foot.mq.md index 46d74ce..ff76f25 100644 --- a/examples/web-site-zh/components/foot.mq.md +++ b/examples/web-site-zh/components/foot.mq.md @@ -6,4 +6,4 @@ |------|-----|------| | Marqdo | https://github.com | | -**`foot`** +*`foot`* diff --git a/examples/web-site-zh/components/nav.mq.md b/examples/web-site-zh/components/nav.mq.md index 19095c5..b1f8aaa 100644 --- a/examples/web-site-zh/components/nav.mq.md +++ b/examples/web-site-zh/components/nav.mq.md @@ -9,4 +9,4 @@ | 写文章 | /new | | | 后台 | /admin | | -**`nav`** +*`nav`* diff --git a/examples/web-site-zh/components/side.mq.md b/examples/web-site-zh/components/side.mq.md index 7db7c02..42fd08f 100644 --- a/examples/web-site-zh/components/side.mq.md +++ b/examples/web-site-zh/components/side.mq.md @@ -7,4 +7,4 @@ | 笔记 | / | | | 文档 | https://github.com | | -**`side`** +*`side`* diff --git a/examples/web-site-zh/db/articles.mq.md b/examples/web-site-zh/db/articles.mq.md index 8d56413..9577398 100644 --- a/examples/web-site-zh/db/articles.mq.md +++ b/examples/web-site-zh/db/articles.mq.md @@ -8,7 +8,7 @@ | title | text | false | | body | text | true | -**`fields`** +*`fields`* ## seed @@ -19,4 +19,4 @@ | 1 | 你好 Marqdo | 第一篇来自 GFM 表格。 | | 2 | 代码即文档 | 页面表就是程序。 | -**`rows`** +*`rows`* diff --git a/examples/web-site-zh/db/index.mq.md b/examples/web-site-zh/db/index.mq.md index f66ba24..02c194d 100644 --- a/examples/web-site-zh/db/index.mq.md +++ b/examples/web-site-zh/db/index.mq.md @@ -7,13 +7,13 @@ import articles:articles.mq.md ## open -*store = > 网页.数据库 地址="sqlite:data/site-zh.db"* -*fields = > articles.schema* +**store = > 网页.数据库 地址="sqlite:data/site-zh.db"** +**fields = > articles.schema** > `store`.初始化 名=articles 字段=`fields` -*rows = > store.查询 表="articles" 上限=1* +**rows = > store.查询 表="articles" 上限=1** 1. `rows` - **store** + *store* 2. * - *seed = > articles.seed* + **seed = > articles.seed** > `store`.插入 表=articles 行=`seed` - **store** + *store* diff --git a/examples/web-site-zh/index.mq.md b/examples/web-site-zh/index.mq.md index dec6521..387c8c6 100644 --- a/examples/web-site-zh/index.mq.md +++ b/examples/web-site-zh/index.mq.md @@ -42,24 +42,24 @@ import db:db/index.mq.md | title | max:120 | 标题太长 | | body | max:8000 | 正文太长 | -*store = > db.open* -*page = > 网页.页面 标题="Marqdo 中文站" 引言="

    中文站

    表格 + 类方法。

    "* -*page = > page.组件装配 组件=home* -*page = > page.主体装配 主体=index* +**store = > db.open** +**page = > 网页.页面 标题="Marqdo 中文站" 引言="

    中文站

    表格 + 类方法。

    "** +**page = > page.组件装配 组件=home** +**page = > page.主体装配 主体=index** -*about = > 网页.页面 标题="关于" 引言="

    关于

    导入网页.mq.md 即用中文 API。

    "* -*about = > about.组件装配 组件=home* +**about = > 网页.页面 标题="关于" 引言="

    关于

    导入网页.mq.md 即用中文 API。

    "** +**about = > about.组件装配 组件=home** -*article_form = > 网页.表单 表="articles" 动作="插入"* -*article_form = > article_form.字段 字段=article_fields* -*article_form = > article_form.规则 规则=article_rules* +**article_form = > 网页.表单 表="articles" 动作="插入"** +**article_form = > article_form.字段 字段=article_fields** +**article_form = > article_form.规则 规则=article_rules** -*new = > 网页.页面 标题="写文章" 引言="

    写文章

    表单嵌在主区。

    "* -*new = > new.组件装配 组件=home* -*new = > new.表单装配 id="article" 表单=article_form* +**new = > 网页.页面 标题="写文章" 引言="

    写文章

    表单嵌在主区。

    "** +**new = > new.组件装配 组件=home** +**new = > new.表单装配 id="article" 表单=article_form** -*app = > 网页.应用 页面=page 数据库=store 后台=True 主机="127.0.0.1" 端口=18082* -*app = > app.路由 路径="/about" 页面=about* -*app = > app.路由 路径="/new" 页面=new* -*app = > app.静态 目录="public" 挂载="/static"* +**app = > 网页.应用 页面=page 数据库=store 后台=True 主机="127.0.0.1" 端口=18082** +**app = > app.路由 路径="/about" 页面=about** +**app = > app.路由 路径="/new" 页面=new** +**app = > app.静态 目录="public" 挂载="/static"** > `app`.监听 diff --git a/examples/web-site-zh/styles/shell.mq.md b/examples/web-site-zh/styles/shell.mq.md index 15cd41b..83bc026 100644 --- a/examples/web-site-zh/styles/shell.mq.md +++ b/examples/web-site-zh/styles/shell.mq.md @@ -7,7 +7,7 @@ | background | #ffffff | | border-bottom | 1px solid #e7e5e4 | -**`topnav`** +*`topnav`* ## side_panel @@ -17,7 +17,7 @@ |------|-----| | background | #f5f5f4 | -**`side_panel`** +*`side_panel`* ## card_title @@ -28,7 +28,7 @@ | font-size | 1.15rem | | margin | 0 0 0.35rem | -**`card_title`** +*`card_title`* ## card_body @@ -39,4 +39,4 @@ | color | #57534e | | margin | 0 | -**`card_body`** +*`card_body`* diff --git a/examples/web-site/components/foot.mq.md b/examples/web-site/components/foot.mq.md index 46d74ce..ff76f25 100644 --- a/examples/web-site/components/foot.mq.md +++ b/examples/web-site/components/foot.mq.md @@ -6,4 +6,4 @@ |------|-----|------| | Marqdo | https://github.com | | -**`foot`** +*`foot`* diff --git a/examples/web-site/components/nav.mq.md b/examples/web-site/components/nav.mq.md index 6c0fbac..4055efb 100644 --- a/examples/web-site/components/nav.mq.md +++ b/examples/web-site/components/nav.mq.md @@ -11,4 +11,4 @@ Static top links for the shell. | New | /new | | | Admin | /admin | | -**`nav`** +*`nav`* diff --git a/examples/web-site/components/side.mq.md b/examples/web-site/components/side.mq.md index f356139..cc680ff 100644 --- a/examples/web-site/components/side.mq.md +++ b/examples/web-site/components/side.mq.md @@ -7,4 +7,4 @@ | Notes | / | | | Docs | https://github.com | | -**`side`** +*`side`* diff --git a/examples/web-site/db/articles.mq.md b/examples/web-site/db/articles.mq.md index 471a84a..3ab453f 100644 --- a/examples/web-site/db/articles.mq.md +++ b/examples/web-site/db/articles.mq.md @@ -8,7 +8,7 @@ | title | text | false | | body | text | true | -**`fields`** +*`fields`* ## seed @@ -19,4 +19,4 @@ | 1 | Hello Marqdo | First article from a GFM table. | | 2 | Code as docs | The page table is the program. | -**`rows`** +*`rows`* diff --git a/examples/web-site/db/index.mq.md b/examples/web-site/db/index.mq.md index b24991c..7b4ee71 100644 --- a/examples/web-site/db/index.mq.md +++ b/examples/web-site/db/index.mq.md @@ -8,13 +8,13 @@ import fs:lib/fs.mq.md ## open -*store = > web.db url="sqlite:data/site.db"* -*fields = > articles.schema* +**store = > web.db url="sqlite:data/site.db"** +**fields = > articles.schema** > `store`.init name=articles fields=`fields` -*rows = > store.select table="articles" limit=1* +**rows = > store.select table="articles" limit=1** 1. `rows` - **store** + *store* 2. * - *seed = > articles.seed* + **seed = > articles.seed** > `store`.insert table=articles rows=`seed` - **store** + *store* diff --git a/examples/web-site/index.mq.md b/examples/web-site/index.mq.md index 5e7f063..c1f1f38 100644 --- a/examples/web-site/index.mq.md +++ b/examples/web-site/index.mq.md @@ -46,28 +46,28 @@ Article create form (design §5.5): field table + rules table. | title | max:120 | Title is too long | | body | max:8000 | Body is too long | -*store = > db.open* -*page = > web.page title="Marqdo Web Site" intro="

    Web Site

    Tables + class methods.

    "* -*page = > page.compose_components components=home* -*page = > page.compose_main main=index* +**store = > db.open** +**page = > web.page title="Marqdo Web Site" intro="

    Web Site

    Tables + class methods.

    "** +**page = > page.compose_components components=home** +**page = > page.compose_main main=index** About page: same shell, different intro (no main bind). -*about = > web.page title="About" intro="

    About

    Marqdo web = tables + class methods.

    "* -*about = > about.compose_components components=home* +**about = > web.page title="About" intro="

    About

    Marqdo web = tables + class methods.

    "** +**about = > about.compose_components components=home** -*article_form = > web.form table="articles" action="insert"* -*article_form = > article_form.fields fields=article_fields* -*article_form = > article_form.rules rules=article_rules* +**article_form = > web.form table="articles" action="insert"** +**article_form = > article_form.fields fields=article_fields** +**article_form = > article_form.rules rules=article_rules** New article: form embedded in the page main slot (design §5.5.4). -*new = > web.page title="New article" intro="

    New article

    Form lives in the main slot.

    "* -*new = > new.compose_components components=home* -*new = > new.compose_form id="article" form=article_form* +**new = > web.page title="New article" intro="

    New article

    Form lives in the main slot.

    "** +**new = > new.compose_components components=home** +**new = > new.compose_form id="article" form=article_form** -*app = > web.app page=page db=store admin=True host="127.0.0.1" port=18081* -*app = > app.route path="/about" page=about* -*app = > app.route path="/new" page=new* -*app = > app.static dir="public" mount="/static"* +**app = > web.app page=page db=store admin=True host="127.0.0.1" port=18081** +**app = > app.route path="/about" page=about** +**app = > app.route path="/new" page=new** +**app = > app.static dir="public" mount="/static"** > `app`.listen diff --git a/examples/web-site/styles/shell.mq.md b/examples/web-site/styles/shell.mq.md index 15cd41b..83bc026 100644 --- a/examples/web-site/styles/shell.mq.md +++ b/examples/web-site/styles/shell.mq.md @@ -7,7 +7,7 @@ | background | #ffffff | | border-bottom | 1px solid #e7e5e4 | -**`topnav`** +*`topnav`* ## side_panel @@ -17,7 +17,7 @@ |------|-----| | background | #f5f5f4 | -**`side_panel`** +*`side_panel`* ## card_title @@ -28,7 +28,7 @@ | font-size | 1.15rem | | margin | 0 0 0.35rem | -**`card_title`** +*`card_title`* ## card_body @@ -39,4 +39,4 @@ | color | #57534e | | margin | 0 | -**`card_body`** +*`card_body`* diff --git a/ext/ai/agent.mq.md b/ext/ai/agent.mq.md index b7b8cb1..2265b31 100644 --- a/ext/ai/agent.mq.md +++ b/ext/ai/agent.mq.md @@ -17,35 +17,35 @@ import plugin:lib/plugin.mq.md + `source_depth`=default + `skill_depth`=default -Assemble a readable prompt: standing, task, **call site**, tools, **budgeted** source + skill, and the act protocol. +Assemble a readable prompt: standing, task, call site, tools, budgeted source + skill, and the act protocol. The runbook `.mq.md` is ground truth (code as documentation). Default budgets keep long files from exploding the window; emit `READ:source` / `READ:skill` (Chinese `读取:`) to deepen, then answer or `CALL:`. -*standing = > json.get value=`agent` key="standing"* +**standing = > json.get value=`agent` key="standing"** 1. `standing` - *up = standing* + **up = standing** 2. * - *up = None* + **up = None** -*tools = > json.get value=`agent` key="tools"* -*tools_s = > agent_format_tools tools=`tools`* -*src = > source_brief depth=`source_depth`* -*site = > agent_call_site* -*site_s = > json.stringify value=`site`* -*skill = > skill_brief depth=`skill_depth`* -*task_s = > json.stringify value=`task`* +**tools = > json.get value=`agent` key="tools"** +**tools_s = > agent_format_tools tools=`tools`** +**src = > source_brief depth=`source_depth`** +**site = > agent_call_site** +**site_s = > json.stringify value=`site`** +**skill = > skill_brief depth=`skill_depth`** +**task_s = > json.stringify value=`task`** -*esc = > json.parse text={"a":"\n\n--- standing ---\n","b":"\n\n--- task ---\n","c":"\n\n--- tools ---\n","d":"\n\n--- call site ---\n","e":"\n\n--- source (.mq.md) ---\n","f":"\n\n--- marqdo skill ---\n","g":"\n\n--- how to act ---\nCall ONLY names listed under --- tools --- (whitelist). If that section is empty or says none, do NOT emit CALL / 调用 — reply with the final answer only.\nNever CALL internal framework helpers (build_step_context, plan, inspect_workbook, etc.).\nContext is budgeted: if you see a [truncated …] marker, you may first emit exactly one line READ:source or READ:skill (Chinese: 读取:source|skill) to deepen, then you will be re-prompted.\nWhen calling an allowed tool, reply with exactly one line: CALL:\n(Chinese ok: 调用:)\nOtherwise reply with the final answer only.\nTools run via Marqdo subtask (spawn fn / wait).\n"}* -*a = > json.get value=`esc` key="a"* -*b = > json.get value=`esc` key="b"* -*c = > json.get value=`esc` key="c"* -*d = > json.get value=`esc` key="d"* -*e = > json.get value=`esc` key="e"* -*f = > json.get value=`esc` key="f"* -*g = > json.get value=`esc` key="g"* +**esc = > json.parse text={"a":"\n\n--- standing ---\n","b":"\n\n--- task ---\n","c":"\n\n--- tools ---\n","d":"\n\n--- call site ---\n","e":"\n\n--- source (.mq.md) ---\n","f":"\n\n--- marqdo skill ---\n","g":"\n\n--- how to act ---\nCall ONLY names listed under --- tools --- (whitelist). If that section is empty or says none, do NOT emit CALL / 调用 — reply with the final answer only.\nNever CALL internal framework helpers (build_step_context, plan, inspect_workbook, etc.).\nContext is budgeted: if you see a [truncated …] marker, you may first emit exactly one line READ:source or READ:skill (Chinese: 读取:source|skill) to deepen, then you will be re-prompted.\nWhen calling an allowed tool, reply with exactly one line: CALL:\n(Chinese ok: 调用:)\nOtherwise reply with the final answer only.\nTools run via Marqdo subtask (spawn fn / wait).\n"}** +**a = > json.get value=`esc` key="a"** +**b = > json.get value=`esc` key="b"** +**c = > json.get value=`esc` key="c"** +**d = > json.get value=`esc` key="d"** +**e = > json.get value=`esc` key="e"** +**f = > json.get value=`esc` key="f"** +**g = > json.get value=`esc` key="g"** -*p = "You are a Marqdo agent. Code is documentation: this runbook source and call site are your ground truth — not a hidden system prompt."* -*p = p + a + up + b + task_s + d + site_s + c + tools_s + e + src + f + skill + g* -**p** +**p = "You are a Marqdo agent. Code is documentation: this runbook source and call site are your ground truth — not a hidden system prompt."** +**p = p + a + up + b + task_s + d + site_s + c + tools_s + e + src + f + skill + g** +*p* --- @@ -57,22 +57,22 @@ The runbook `.mq.md` is ground truth (code as documentation). Default budgets ke Inspect what `build_step_context` would send — no LLM. Returns a map: `prompt`, `call_site`, `prompt_chars`, `truncated` (true when budget markers appear). Use for harness / debugging the code-as-doc pipeline. -*prompt = > build_step_context agent=`agent` task=`task` source_depth=`source_depth` skill_depth=`skill_depth`* -*site = > agent_call_site* -*chars = > len value=`prompt`* -*parts = > split value=`prompt` sep="[truncated"* -*n = > len value=`parts`* -*truncated = False* +**prompt = > build_step_context agent=`agent` task=`task` source_depth=`source_depth` skill_depth=`skill_depth`** +**site = > agent_call_site** +**chars = > len value=`prompt`** +**parts = > split value=`prompt` sep="[truncated"** +**n = > len value=`parts`** +**truncated = False** 1. `n` > 1 - *truncated = True* + **truncated = True** 2. * - *_ = 1* -*out = > json.parse text={}* -*out = > json.set map=`out` key="prompt" value=`prompt`* -*out = > json.set map=`out` key="call_site" value=`site`* -*out = > json.set map=`out` key="prompt_chars" value=`chars`* -*out = > json.set map=`out` key="truncated" value=`truncated`* -**out** + **_ = 1** +**out = > json.parse text={}** +**out = > json.set map=`out` key="prompt" value=`prompt`** +**out = > json.set map=`out` key="call_site" value=`site`** +**out = > json.set map=`out` key="prompt_chars" value=`chars`** +**out = > json.set map=`out` key="truncated" value=`truncated`** +*out* --- @@ -81,31 +81,31 @@ Inspect what `build_step_context` would send — no LLM. Returns a map: `prompt` Find a human-readable call line: `CALL:` or `调用:` / `调用:`. -*esc = > json.parse text={"nl":"\n"}* -*nl = > json.get value=`esc` key="nl"* -*text = > trim value=`reply`* -*lines = > split value=`text` sep=`nl`* -*found = None* +**esc = > json.parse text={"nl":"\n"}** +**nl = > json.get value=`esc` key="nl"** +**text = > trim value=`reply`** +**lines = > split value=`text` sep=`nl`** +**found = None** - [`line`](`lines`) - *t = > trim value=`line`* - *parts = > split value=`t` sep=":"* - *n = > len value=`parts`* + **t = > trim value=`line`** + **parts = > split value=`t` sep=":"** + **n = > len value=`parts`** 1. `n` > 1 - *head = > at value=`parts` index=0* - *head = > trim value=`head`* - *rest = > at value=`parts` index=1* - *rest = > trim value=`rest`* + **head = > at value=`parts` index=0** + **head = > trim value=`head`** + **rest = > at value=`parts` index=1** + **rest = > trim value=`rest`** 1. `head` == CALL - *found = rest* + **found = rest** 2. `head` == 调用 - *found = rest* + **found = rest** 3. * - *_ = 1* + **_ = 1** 2. * - *_ = 1* + **_ = 1** -**found** +*found* --- @@ -115,13 +115,13 @@ Find a human-readable call line: `CALL:` or `调用:` / `调用: agent_tool_allowed tools=`tools` name=`name`* +**allowed = > agent_tool_allowed tools=`tools` name=`name`** 1. `allowed` - *id = > subtask.spawn fn=`name`* - **> subtask.wait id=`id`** + **id = > subtask.spawn fn=`name`** + *> subtask.wait id=`id`* 2. * - *msg = "Tool not allowed:"* - **msg + name** + **msg = "Tool not allowed:"** + *msg + name* ## render_workbook_skeleton + `goal` @@ -129,35 +129,35 @@ Allowlist check, then invoke the runbook `##` via `lib/subtask` (`spawn fn=` → Build a runnable workbook. `skeleton=single` (default): one worker `step`. `skeleton=dual`: research then write agents. On success the parent chooses DONE; runtime `agent_workbook_solidify` freezes the answer. -*q = > json.quote text=`goal`* -*esc = > json.parse text={"h":"---\ntitle: agent workbook\nimport llm:ext/ai/llm.mq.md\nimport agent:ext/ai/agent.mq.md\nimport json:lib/json.mq.md\nimport sys:lib/sys.mq.md\nimport wb:lib/writeback.mq.md\nimport subtask:lib/subtask.mq.md\n---\n\n# Goal\n\nParent goal is embedded as JSON in # main.\n\n## Solidify\n\nWhen the child returns a good value, parent DECISION: DONE — runtime agent_workbook_solidify freezes the answer as **return** (do not invent long FIND/REPLACE).\n\n# main\n\n> llm.load_env\n\n","s1":"\u002a\u0060model\u0060 = > llm.llm \u002a\n","s2":"\u002a\u0060tools\u0060 = > json.parse text=[] \u002a\n","s3":"\u002a\u0060worker\u0060 = > agent.agent model=\u0060model\u0060 tools=\u0060tools\u0060 standing=You are a workbook worker. tools=[] means never CALL. Finish the task with a direct final answer; do not invent tools. \u002a\n","s4":"\u002a\u0060wrap\u0060 = > json.parse text={\"task\":","s5":"} \u002a\n","s6":"\u002a\u0060task\u0060 = > json.get value=\u0060wrap\u0060 key=task \u002a\n","s7":"\u002a\u0060out\u0060 = > \u0060worker\u0060.step task=\u0060task\u0060 stream=True \u002a\n","s7b":"\u002a\u0060text\u0060 = > json.get value=\u0060out\u0060 key=result \u002a\n","s8":"\u002a\u002a\u0060text\u0060\u002a\u002a\n","d3":"\u002a\u0060research\u0060 = > agent.agent model=\u0060model\u0060 tools=\u0060tools\u0060 standing=You gather facts for the goal. Be concise. Do not invent tools. \u002a\n","d3b":"\u002a\u0060writer\u0060 = > agent.agent model=\u0060model\u0060 tools=\u0060tools\u0060 standing=You write the final answer from research notes. Do not invent tools. \u002a\n","d4":"\u002a\u0060wrap\u0060 = > json.parse text={\"task\":","d5":"} \u002a\n","d6":"\u002a\u0060task\u0060 = > json.get value=\u0060wrap\u0060 key=task \u002a\n","d7":"\u002a\u0060notes\u0060 = > \u0060research\u0060.step task=\u0060task\u0060 stream=True \u002a\n","d8":"\u002a\u0060ns\u0060 = > json.stringify value=\u0060notes\u0060 \u002a\n","d9":"\u002a\u0060wt\u0060 = Write the final answer. Research notes: \u002a\n","d10":"\u002a\u0060wt\u0060 = \u0060wt\u0060 + \u0060ns\u0060 \u002a\n","d11":"\u002a\u0060out\u0060 = > \u0060writer\u0060.step task=\u0060wt\u0060 stream=True \u002a\n","d11b":"\u002a\u0060text\u0060 = > json.get value=\u0060out\u0060 key=result \u002a\n","d12":"\u002a\u002a\u0060text\u0060\u002a\u002a\n"}* -*h = > json.get value=`esc` key="h"* -*s1 = > json.get value=`esc` key="s1"* -*s2 = > json.get value=`esc` key="s2"* +**q = > json.quote text=`goal`** +**esc = > json.parse text={"h":"---\ntitle: agent workbook\nimport llm:ext/ai/llm.mq.md\nimport agent:ext/ai/agent.mq.md\nimport json:lib/json.mq.md\nimport sys:lib/sys.mq.md\nimport wb:lib/writeback.mq.md\nimport subtask:lib/subtask.mq.md\n---\n\n# Goal\n\nParent goal is embedded as JSON in # main.\n\n## Solidify\n\nWhen the child returns a good value, parent DECISION: DONE — runtime agent_workbook_solidify freezes the answer as **return** (do not invent long FIND/REPLACE).\n\n# main\n\n> llm.load_env\n\n","s1":"\u002a\u0060model\u0060 = > llm.llm \u002a\n","s2":"\u002a\u0060tools\u0060 = > json.parse text=[] \u002a\n","s3":"\u002a\u0060worker\u0060 = > agent.agent model=\u0060model\u0060 tools=\u0060tools\u0060 standing=You are a workbook worker. tools=[] means never CALL. Finish the task with a direct final answer; do not invent tools. \u002a\n","s4":"\u002a\u0060wrap\u0060 = > json.parse text={\"task\":","s5":"} \u002a\n","s6":"\u002a\u0060task\u0060 = > json.get value=\u0060wrap\u0060 key=task \u002a\n","s7":"\u002a\u0060out\u0060 = > \u0060worker\u0060.step task=\u0060task\u0060 stream=True \u002a\n","s7b":"\u002a\u0060text\u0060 = > json.get value=\u0060out\u0060 key=result \u002a\n","s8":"\u002a\u002a\u0060text\u0060\u002a\u002a\n","d3":"\u002a\u0060research\u0060 = > agent.agent model=\u0060model\u0060 tools=\u0060tools\u0060 standing=You gather facts for the goal. Be concise. Do not invent tools. \u002a\n","d3b":"\u002a\u0060writer\u0060 = > agent.agent model=\u0060model\u0060 tools=\u0060tools\u0060 standing=You write the final answer from research notes. Do not invent tools. \u002a\n","d4":"\u002a\u0060wrap\u0060 = > json.parse text={\"task\":","d5":"} \u002a\n","d6":"\u002a\u0060task\u0060 = > json.get value=\u0060wrap\u0060 key=task \u002a\n","d7":"\u002a\u0060notes\u0060 = > \u0060research\u0060.step task=\u0060task\u0060 stream=True \u002a\n","d8":"\u002a\u0060ns\u0060 = > json.stringify value=\u0060notes\u0060 \u002a\n","d9":"\u002a\u0060wt\u0060 = Write the final answer. Research notes: \u002a\n","d10":"\u002a\u0060wt\u0060 = \u0060wt\u0060 + \u0060ns\u0060 \u002a\n","d11":"\u002a\u0060out\u0060 = > \u0060writer\u0060.step task=\u0060wt\u0060 stream=True \u002a\n","d11b":"\u002a\u0060text\u0060 = > json.get value=\u0060out\u0060 key=result \u002a\n","d12":"\u002a\u002a\u0060text\u0060\u002a\u002a\n"}** +**h = > json.get value=`esc` key="h"** +**s1 = > json.get value=`esc` key="s1"** +**s2 = > json.get value=`esc` key="s2"** 1. `skeleton` == dual - *s3 = > json.get value=`esc` key="d3"* - *s3b = > json.get value=`esc` key="d3b"* - *s4 = > json.get value=`esc` key="d4"* - *s5 = > json.get value=`esc` key="d5"* - *s6 = > json.get value=`esc` key="d6"* - *s7 = > json.get value=`esc` key="d7"* - *s8 = > json.get value=`esc` key="d8"* - *s9 = > json.get value=`esc` key="d9"* - *s10 = > json.get value=`esc` key="d10"* - *s11 = > json.get value=`esc` key="d11"* - *s11b = > json.get value=`esc` key="d11b"* - *s12 = > json.get value=`esc` key="d12"* - **h + s1 + s2 + s3 + s3b + s4 + q + s5 + s6 + s7 + s8 + s9 + s10 + s11 + s11b + s12** + **s3 = > json.get value=`esc` key="d3"** + **s3b = > json.get value=`esc` key="d3b"** + **s4 = > json.get value=`esc` key="d4"** + **s5 = > json.get value=`esc` key="d5"** + **s6 = > json.get value=`esc` key="d6"** + **s7 = > json.get value=`esc` key="d7"** + **s8 = > json.get value=`esc` key="d8"** + **s9 = > json.get value=`esc` key="d9"** + **s10 = > json.get value=`esc` key="d10"** + **s11 = > json.get value=`esc` key="d11"** + **s11b = > json.get value=`esc` key="d11b"** + **s12 = > json.get value=`esc` key="d12"** + *h + s1 + s2 + s3 + s3b + s4 + q + s5 + s6 + s7 + s8 + s9 + s10 + s11 + s11b + s12* 2. * - *s3 = > json.get value=`esc` key="s3"* - *s4 = > json.get value=`esc` key="s4"* - *s5 = > json.get value=`esc` key="s5"* - *s6 = > json.get value=`esc` key="s6"* - *s7 = > json.get value=`esc` key="s7"* - *s7b = > json.get value=`esc` key="s7b"* - *s8 = > json.get value=`esc` key="s8"* - **h + s1 + s2 + s3 + s4 + q + s5 + s6 + s7 + s7b + s8** + **s3 = > json.get value=`esc` key="s3"** + **s4 = > json.get value=`esc` key="s4"** + **s5 = > json.get value=`esc` key="s5"** + **s6 = > json.get value=`esc` key="s6"** + **s7 = > json.get value=`esc` key="s7"** + **s7b = > json.get value=`esc` key="s7b"** + **s8 = > json.get value=`esc` key="s8"** + *h + s1 + s2 + s3 + s4 + q + s5 + s6 + s7 + s7b + s8* --- @@ -170,49 +170,49 @@ Build a runnable workbook. `skeleton=single` (default): one worker `step`. `skel Structured observation for the parent developer-agent: source, named writeback slots, exit code, optional child return value, and quiet-captured I/O. -*source = > fs.read_text path=`path`* -*slots = > wb.scan_path path=`path`* -*obs = > json.parse text={"path":""}* -*obs = > json.set map=`obs` key="path" value=`path`* -*obs = > json.set map=`obs` key="source" value=`source`* -*obs = > json.set map=`obs` key="slots" value=`slots`* -*obs = > json.set map=`obs` key="exit_code" value=`exit_code`* +**source = > fs.read_text path=`path`** +**slots = > wb.scan_path path=`path`** +**obs = > json.parse text={"path":""}** +**obs = > json.set map=`obs` key="path" value=`path`** +**obs = > json.set map=`obs` key="source" value=`source`** +**obs = > json.set map=`obs` key="slots" value=`slots`** +**obs = > json.set map=`obs` key="exit_code" value=`exit_code`** 1. `value` - *obs = > json.set map=`obs` key="value" value=`value`* + **obs = > json.set map=`obs` key="value" value=`value`** 2. * - *_ = 1* + **_ = 1** 1. `stdout` - *obs = > json.set map=`obs` key="stdout" value=`stdout`* + **obs = > json.set map=`obs` key="stdout" value=`stdout`** 2. * - *_ = 1* + **_ = 1** 1. `stderr` - *obs = > json.set map=`obs` key="stderr" value=`stderr`* + **obs = > json.set map=`obs` key="stderr" value=`stderr`** 2. * - *_ = 1* + **_ = 1** -*last_ok = None* -*last_error = None* +**last_ok = None** +**last_error = None** - [`slot`](`slots`) - *k = > json.get value=`slot` key="key"* - *body = > json.get value=`slot` key="body"* + **k = > json.get value=`slot` key="key"** + **body = > json.get value=`slot` key="body"** 1. `k` == "ok" - *last_ok = body* + **last_ok = body** 2. `k` == "error" - *last_error = body* + **last_error = body** 3. * - *_ = 1* + **_ = 1** 1. `last_ok` - *obs = > json.set map=`obs` key="last_ok" value=`last_ok`* + **obs = > json.set map=`obs` key="last_ok" value=`last_ok`** 2. * - *_ = 1* + **_ = 1** 1. `last_error` - *obs = > json.set map=`obs` key="last_error" value=`last_error`* + **obs = > json.set map=`obs` key="last_error" value=`last_error`** 2. * - *_ = 1* + **_ = 1** -**obs** +*obs* --- @@ -221,18 +221,18 @@ Structured observation for the parent developer-agent: source, named writeback s Spawn a workbook file (quiet by default), wait for `{code,value,stdout?,stderr?}`, and inspect. -*id = > subtask.spawn path=`path`* -*waited = > subtask.wait id=`id`* -*code = > json.get value=`waited` key="code"* -*value = > json.get value=`waited` key="value"* -*stdout = > json.get value=`waited` key="stdout"* -*stderr = > json.get value=`waited` key="stderr"* -*obs = > inspect_workbook path=`path` exit_code=`code` value=`value` stdout=`stdout` stderr=`stderr`* -*out = > json.parse text={"code":0}* -*out = > json.set map=`out` key="code" value=`code`* -*out = > json.set map=`out` key="value" value=`value`* -*out = > json.set map=`out` key="observation" value=`obs`* -**out** +**id = > subtask.spawn path=`path`** +**waited = > subtask.wait id=`id`** +**code = > json.get value=`waited` key="code"** +**value = > json.get value=`waited` key="value"** +**stdout = > json.get value=`waited` key="stdout"** +**stderr = > json.get value=`waited` key="stderr"** +**obs = > inspect_workbook path=`path` exit_code=`code` value=`value` stdout=`stdout` stderr=`stderr`** +**out = > json.parse text={"code":0}** +**out = > json.set map=`out` key="code" value=`code`** +**out = > json.set map=`out` key="value" value=`value`** +**out = > json.set map=`out` key="observation" value=`obs`** +*out* --- @@ -241,26 +241,26 @@ Spawn a workbook file (quiet by default), wait for `{code,value,stdout?,stderr?} + `max_lines`=80 + `max_chars`=4000 -*esc = > json.parse text={"nl":"\n"}* -*nl = > json.get value=`esc` key="nl"* -*raw = > str value=`text`* -*lines = > split value=`raw` sep=`nl`* -*acc = > json.parse text=[]* -*chars = 0* -*count = 0* +**esc = > json.parse text={"nl":"\n"}** +**nl = > json.get value=`esc` key="nl"** +**raw = > str value=`text`** +**lines = > split value=`raw` sep=`nl`** +**acc = > json.parse text=[]** +**chars = 0** +**count = 0** - [`line`](`lines`) 1. `count` < `max_lines` - *ln = > len value=`line`* - *next = chars + ln* + **ln = > len value=`line`** + **next = chars + ln** 1. `next` > `max_chars` - *count = max_lines* + **count = max_lines** 2. * - *acc = > json.append list=`acc` item=`line`* - *chars = next* - *count = count + 1* + **acc = > json.append list=`acc` item=`line`** + **chars = next** + **count = count + 1** 2. * - *_ = 1* -**> join value=`acc` sep=`nl`** + **_ = 1** +*> join value=`acc` sep=`nl`* --- @@ -269,32 +269,32 @@ Spawn a workbook file (quiet by default), wait for `{code,value,stdout?,stderr?} + `max_lines`=40 + `max_chars`=2000 -*esc = > json.parse text={"nl":"\n"}* -*nl = > json.get value=`esc` key="nl"* -*raw = > str value=`text`* -*lines = > split value=`raw` sep=`nl`* -*n = > len value=`lines`* -*start = n - max_lines* +**esc = > json.parse text={"nl":"\n"}** +**nl = > json.get value=`esc` key="nl"** +**raw = > str value=`text`** +**lines = > split value=`raw` sep=`nl`** +**n = > len value=`lines`** +**start = n - max_lines** 1. `start` < 0 - *start = 0* + **start = 0** 2. * - *_ = 1* -*acc = > json.parse text=[]* -*i = 0* -*chars = 0* + **_ = 1** +**acc = > json.parse text=[]** +**i = 0** +**chars = 0** - [`line`](`lines`) 1. `i` >= `start` - *ln = > len value=`line`* - *next = chars + ln* + **ln = > len value=`line`** + **next = chars + ln** 1. `next` > `max_chars` - *i = n* + **i = n** 2. * - *acc = > json.append list=`acc` item=`line`* - *chars = next* + **acc = > json.append list=`acc` item=`line`** + **chars = next** 2. * - *_ = 1* - *i = i + 1* -**> join value=`acc` sep=`nl`** + **_ = 1** + **i = i + 1** +*> join value=`acc` sep=`nl`* --- @@ -303,40 +303,40 @@ Spawn a workbook file (quiet by default), wait for `{code,value,stdout?,stderr?} Drop `` blocks (including marqdo-out bodies) so parent excerpts stay structural. -*esc = > json.parse text={"nl":"\n"}* -*nl = > json.get value=`esc` key="nl"* -*raw = > str value=`text`* -*lines = > split value=`raw` sep=`nl`* -*acc = > json.parse text=[]* -*skip = None* +**esc = > json.parse text={"nl":"\n"}** +**nl = > json.get value=`esc` key="nl"** +**raw = > str value=`text`** +**lines = > split value=`raw` sep=`nl`** +**acc = > json.parse text=[]** +**skip = None** - [`line`](`lines`) 1. `skip` - *end_parts = > split value=`line` sep="-->"* - *en = > len value=`end_parts`* + **end_parts = > split value=`line` sep="-->"** + **en = > len value=`end_parts`** 1. `en` > 1 - *skip = None* + **skip = None** 2. * - *_ = 1* + **_ = 1** 2. * - *start_parts = > split value=`line` sep=""* - *en = > len value=`end_parts`* + **_ = 1** + **tail = > at value=`start_parts` index=1** + **end_parts = > split value=`tail` sep="-->"** + **en = > len value=`end_parts`** 1. `en` > 1 - *skip = None* + **skip = None** 2. * - *skip = 1* + **skip = 1** 2. * - *acc = > json.append list=`acc` item=`line`* -**> join value=`acc` sep=`nl`** + **acc = > json.append list=`acc` item=`line`** +*> join value=`acc` sep=`nl`* --- @@ -345,8 +345,8 @@ Drop `` blocks (including marqdo-out bodies) so parent excerpts stay + `max_lines`=80 + `max_chars`=4000 -*clean = > strip_html_comments text=`source`* -**> text_head_lines text=`clean` max_lines=`max_lines` max_chars=`max_chars`** +**clean = > strip_html_comments text=`source`** +*> text_head_lines text=`clean` max_lines=`max_lines` max_chars=`max_chars`* --- @@ -355,8 +355,8 @@ Drop `` blocks (including marqdo-out bodies) so parent excerpts stay + `max_lines`=80 + `max_chars`=4000 -*src = > fs.read_text path=`path`* -**> workbook_source_excerpt source=`src` max_lines=`max_lines` max_chars=`max_chars`** +**src = > fs.read_text path=`path`** +*> workbook_source_excerpt source=`src` max_lines=`max_lines` max_chars=`max_chars`* --- @@ -364,11 +364,11 @@ Drop `` blocks (including marqdo-out bodies) so parent excerpts stay + `path` + `depth`=default -*src = > fs.read_text path=`path`* +**src = > fs.read_text path=`path`** 1. `depth` == deep - **> workbook_source_excerpt source=`src` max_lines=200 max_chars=12000** + *> workbook_source_excerpt source=`src` max_lines=200 max_chars=12000* 2. * - **> workbook_source_excerpt source=`src` max_lines=80 max_chars=4000** + *> workbook_source_excerpt source=`src` max_lines=80 max_chars=4000* --- @@ -376,8 +376,8 @@ Drop `` blocks (including marqdo-out bodies) so parent excerpts stay Callable dotted names (whitelist for `CALL:lib…`) plus static module file list for workbook imports. Parent also exposes evidence tools `corpus_search` / `mcp_list_tools` / `mcp_call` (not authority). -*out = > json.parse text={"note":"Direct CALL:lib.. + optional ARGS:{json} for whitelist only. Or import via frontmatter > lib/.mq.md then PATCH / scratch_tool_write. Evidence tools: CALL:corpus_search | mcp_list_tools | mcp_call (fixture RAG/MCP) — workbook .mq.md remains authority.","files":["fs.mq.md","json.mq.md","subtask.mq.md","sys.mq.md","writeback.mq.md","text.mq.md","time.mq.md","math.mq.md","net.mq.md","table.mq.md","plugin.mq.md","foreign.mq.md"],"callable":[{"name":"lib.fs.read_text","desc":"Read UTF-8 text file"},{"name":"lib.fs.exists","desc":"Path exists?"},{"name":"lib.fs.list_dir","desc":"List directory entries"},{"name":"lib.json.parse","desc":"Parse JSON text"},{"name":"lib.json.stringify","desc":"Serialize JSON"},{"name":"lib.sys.cwd","desc":"Process working directory"},{"name":"corpus_search","desc":"Local markdown/text keyword search (evidence)"},{"name":"mcp_list_tools","desc":"List tools from MCP JSON fixture"},{"name":"mcp_call","desc":"Call a tool from MCP JSON fixture"}]}* -**out** +**out = > json.parse text={"note":"Direct CALL:lib.. + optional ARGS:{json} for whitelist only. Or import via frontmatter > lib/.mq.md then PATCH / scratch_tool_write. Evidence tools: CALL:corpus_search | mcp_list_tools | mcp_call (fixture RAG/MCP) — workbook .mq.md remains authority.","files":["fs.mq.md","json.mq.md","subtask.mq.md","sys.mq.md","writeback.mq.md","text.mq.md","time.mq.md","math.mq.md","net.mq.md","table.mq.md","plugin.mq.md","foreign.mq.md"],"callable":[{"name":"lib.fs.read_text","desc":"Read UTF-8 text file"},{"name":"lib.fs.exists","desc":"Path exists?"},{"name":"lib.fs.list_dir","desc":"List directory entries"},{"name":"lib.json.parse","desc":"Parse JSON text"},{"name":"lib.json.stringify","desc":"Serialize JSON"},{"name":"lib.sys.cwd","desc":"Process working directory"},{"name":"corpus_search","desc":"Local markdown/text keyword search (evidence)"},{"name":"mcp_list_tools","desc":"List tools from MCP JSON fixture"},{"name":"mcp_call","desc":"Call a tool from MCP JSON fixture"}]}** +*out* --- @@ -386,18 +386,18 @@ Callable dotted names (whitelist for `CALL:lib…`) plus static module file list + `root`=.marqdo/agent-corpus + `limit`=6 -Local keyword search over `.md` / `.mq.md` / `.txt` under `root`. Returns ranked excerpts. **Evidence only** — runnable workbook / OKF skill stays authority (`authority=workbook`). +Local keyword search over `.md` / `.mq.md` / `.txt` under `root`. Returns ranked excerpts. Evidence only — runnable workbook / OKF skill stays authority (`authority=workbook`). Ensures the native agent plugin is loaded so plain `marqdo run` (without constructing `# agent`) can call this. -*p = > plugin.native_path name="agent"* +**p = > plugin.native_path name="agent"** 1. `p` > plugin.load path=`p` 2. * > print text=ext/ai/agent: native agent plugin not found (build marqdo_plugin_agent or marqdo ext add agent) > sys.exit code=1 -**> agent_corpus_search query=`query` root=`root` limit=`limit`** +*> agent_corpus_search query=`query` root=`root` limit=`limit`* --- @@ -406,7 +406,7 @@ Ensures the native agent plugin is loaded so plain `marqdo run` (without constru List tools from an offline MCP-shaped JSON fixture (`tools` array). Evidence only. -**> agent_mcp_fixture action="list" fixture=`fixture`** +*> agent_mcp_fixture action="list" fixture=`fixture`* --- @@ -418,9 +418,9 @@ List tools from an offline MCP-shaped JSON fixture (`tools` array). Evidence onl Call a named tool from a MCP-shaped fixture (`results` / `calls` map). Optional `arguments` echoed; fixture results are keyed by name. Evidence only. 1. `arguments` - **> agent_mcp_fixture action="call" fixture=`fixture` name=`name` arguments=`arguments`** + *> agent_mcp_fixture action="call" fixture=`fixture` name=`name` arguments=`arguments`* 2. * - **> agent_mcp_fixture action="call" fixture=`fixture` name=`name`** + *> agent_mcp_fixture action="call" fixture=`fixture` name=`name`* --- @@ -429,42 +429,42 @@ Call a named tool from a MCP-shaped fixture (`results` / `calls` map). Optional Parse `ARGS:{…}` JSON line, or a bare `{…}` line after CALL. -*esc = > json.parse text={"nl":"\n","mark":"ARGS:","brace":"{"}* -*nl = > json.get value=`esc` key="nl"* -*mark = > json.get value=`esc` key="mark"* -*brace = > json.get value=`esc` key="brace"* -*empty = > json.parse text={}* +**esc = > json.parse text={"nl":"\n","mark":"ARGS:","brace":"{"}** +**nl = > json.get value=`esc` key="nl"** +**mark = > json.get value=`esc` key="mark"** +**brace = > json.get value=`esc` key="brace"** +**empty = > json.parse text={}** 1. `reply` - *text = > trim value=`reply`* - *lines = > split value=`text` sep=`nl`* - *found = None* + **text = > trim value=`reply`** + **lines = > split value=`text` sep=`nl`** + **found = None** - [`line`](`lines`) 1. `found` - *_ = 1* + **_ = 1** 2. * - *t = > trim value=`line`* - *chunks = > split value=`t` sep=`mark`* - *cn = > len value=`chunks`* + **t = > trim value=`line`** + **chunks = > split value=`t` sep=`mark`** + **cn = > len value=`chunks`** 1. `cn` > 1 - *rest = > at value=`chunks` index=1* - *found = > trim value=`rest`* + **rest = > at value=`chunks` index=1** + **found = > trim value=`rest`** 2. * - *chunks = > split value=`t` sep=`brace`* - *cn = > len value=`chunks`* - *prefix = > at value=`chunks` index=0* + **chunks = > split value=`t` sep=`brace`** + **cn = > len value=`chunks`** + **prefix = > at value=`chunks` index=0** 1. `cn` > 1 1. `prefix` - *_ = 1* + **_ = 1** 2. * - *found = t* + **found = t** 2. * - *_ = 1* + **_ = 1** 1. `found` - **> json.parse text=`found`** + *> json.parse text=`found`* 2. * - **empty** + *empty* 2. * - **empty** + *empty* --- @@ -475,8 +475,8 @@ Parse `ARGS:{…}` JSON line, or a bare `{…}` line after CALL. Truncate a tool result for `tool_end` events (~1KiB). 1. `value` - *s = > json.stringify value=`value`* - **> text_head_lines text=`s` max_lines=40 max_chars=`max_chars`** + **s = > json.stringify value=`value`** + *> text_head_lines text=`s` max_lines=40 max_chars=`max_chars`* 2. * **** @@ -492,21 +492,21 @@ Truncate a tool result for `tool_end` events (~1KiB). Always append `tool_start` / `tool_end` to `events` for audit / view process cards. SSE publish only when `stream=True`. -*ev = > json.parse text={}* -*ev = > json.set map=`ev` key="type" value=`type`* -*ev = > json.set map=`ev` key="name" value=`name`* -*ev = > json.set map=`ev` key="kind" value=`kind`* +**ev = > json.parse text={}** +**ev = > json.set map=`ev` key="type" value=`type`** +**ev = > json.set map=`ev` key="name" value=`name`** +**ev = > json.set map=`ev` key="kind" value=`kind`** 1. `result` - *ev = > json.set map=`ev` key="result" value=`result`* + **ev = > json.set map=`ev` key="result" value=`result`** 2. * - *_ = 1* -*events = > json.append list=`events` item=`ev`* + **_ = 1** +**events = > json.append list=`events` item=`ev`** 1. `stream` > sys.stream_publish event=`ev` 2. * - *_ = 1* + **_ = 1** -**events** +*events* --- @@ -516,29 +516,29 @@ Always append `tool_start` / `tool_end` to `events` for audit / view process car Whitelist `CALL:lib..` (+ ARGS). Rejects net/exec/write/delete. -*args = > extract_call_args reply=`reply`* -*errs = > json.parse text={"deny":"Lib CALL not allowed: "}* +**args = > extract_call_args reply=`reply`** +**errs = > json.parse text={"deny":"Lib CALL not allowed: "}** 1. `name` == lib.fs.exists - *path = > json.get value=`args` key="path"* - **> fs.exists path=`path`** + **path = > json.get value=`args` key="path"** + *> fs.exists path=`path`* 2. `name` == lib.fs.read_text - *path = > json.get value=`args` key="path"* - **> fs.read_text path=`path`** + **path = > json.get value=`args` key="path"** + *> fs.read_text path=`path`* 3. `name` == lib.fs.list_dir - *path = > json.get value=`args` key="path"* - **> fs.list_dir path=`path`** + **path = > json.get value=`args` key="path"** + *> fs.list_dir path=`path`* 4. `name` == lib.json.parse - *text = > json.get value=`args` key="text"* - **> json.parse text=`text`** + **text = > json.get value=`args` key="text"** + *> json.parse text=`text`* 5. `name` == lib.json.stringify - *value = > json.get value=`args` key="value"* - **> json.stringify value=`value`** + **value = > json.get value=`args` key="value"** + *> json.stringify value=`value`* 6. `name` == lib.sys.cwd - **> sys.cwd** + *> sys.cwd* 7. * - *deny = > json.get value=`errs` key="deny"* - **deny + name** + **deny = > json.get value=`errs` key="deny"** + *deny + name* --- @@ -548,16 +548,16 @@ Whitelist `CALL:lib..` (+ ARGS). Rejects net/exec/write/delete. Write a scratch tool workbook under `.marqdo/agent-runs/tools/.mq.md`. -*esc = > json.parse text={"a":".marqdo/agent-runs/tools/","b":".mq.md"}* -*a = > json.get value=`esc` key="a"* -*b = > json.get value=`esc` key="b"* -*dir = ".marqdo/agent-runs/tools"* +**esc = > json.parse text={"a":".marqdo/agent-runs/tools/","b":".mq.md"}** +**a = > json.get value=`esc` key="a"** +**b = > json.get value=`esc` key="b"** +**dir = ".marqdo/agent-runs/tools"** > fs.make_dir path=`dir` -*path = a + name + b* +**path = a + name + b** > fs.write_text path=`path` text=`text` -*out = > json.parse text={"ok":True}* -*out = > json.set map=`out` key="path" value=`path`* -**out** +**out = > json.parse text={"ok":True}** +**out = > json.set map=`out` key="path" value=`path`** +*out* --- @@ -568,21 +568,21 @@ Write a scratch tool workbook under `.marqdo/agent-runs/tools/.mq.md`. Budgeted marqdo skill text for prompts. `depth=deep` raises the char budget. 1. `depth` == deep - *budget = 4000* + **budget = 4000** 2. * - *budget = max_chars* -*skill = > agent_marqdo_skill* -*full = > len value=`skill`* -*ex = > text_head_lines text=`skill` max_lines=80 max_chars=`budget`* -*used = > len value=`ex`* + **budget = max_chars** +**skill = > agent_marqdo_skill** +**full = > len value=`skill`** +**ex = > text_head_lines text=`skill` max_lines=80 max_chars=`budget`** +**used = > len value=`ex`** 1. `used` < `full` - *esc = > json.parse text={"a":"\n…[truncated skill_len=","b":" budget_chars=","c":"; emit READ:skill to deepen]"}* - *a = > json.get value=`esc` key="a"* - *b = > json.get value=`esc` key="b"* - *c = > json.get value=`esc` key="c"* - **ex + a + full + b + budget + c** + **esc = > json.parse text={"a":"\n…[truncated skill_len=","b":" budget_chars=","c":"; emit READ:skill to deepen]"}** + **a = > json.get value=`esc` key="a"** + **b = > json.get value=`esc` key="b"** + **c = > json.get value=`esc` key="c"** + *ex + a + full + b + budget + c* 2. * - **ex** + *ex* --- @@ -591,23 +591,23 @@ Budgeted marqdo skill text for prompts. `depth=deep` raises the char budget. Budgeted current-module `.mq.md` source for `step` prompts. Default ~80 lines / 4KiB; `depth=deep` ~200 / 12KiB. -*src = > agent_module_source* -*full = > len value=`src`* +**src = > agent_module_source** +**full = > len value=`src`** 1. `depth` == deep - *ex = > workbook_source_excerpt source=`src` max_lines=200 max_chars=12000* - *budget = 12000* + **ex = > workbook_source_excerpt source=`src` max_lines=200 max_chars=12000** + **budget = 12000** 2. * - *ex = > workbook_source_excerpt source=`src` max_lines=80 max_chars=4000* - *budget = 4000* -*used = > len value=`ex`* + **ex = > workbook_source_excerpt source=`src` max_lines=80 max_chars=4000** + **budget = 4000** +**used = > len value=`ex`** 1. `used` < `full` - *esc = > json.parse text={"a":"\n…[truncated source_len=","b":" budget_chars=","c":"; emit READ:source to deepen]"}* - *a = > json.get value=`esc` key="a"* - *b = > json.get value=`esc` key="b"* - *c = > json.get value=`esc` key="c"* - **ex + a + full + b + budget + c** + **esc = > json.parse text={"a":"\n…[truncated source_len=","b":" budget_chars=","c":"; emit READ:source to deepen]"}** + **a = > json.get value=`esc` key="a"** + **b = > json.get value=`esc` key="b"** + **c = > json.get value=`esc` key="c"** + *ex + a + full + b + budget + c* 2. * - **ex** + *ex* --- @@ -616,44 +616,44 @@ Budgeted current-module `.mq.md` source for `step` prompts. Default ~80 lines / Parse READ:source|stderr|stdout|slots|skill (Chinese: 读取:…). -*esc = > json.parse text={"nl":"\n","fw":":"}* -*nl = > json.get value=`esc` key="nl"* -*fw = > json.get value=`esc` key="fw"* -*text = > trim value=`reply`* -*lines = > split value=`text` sep=`nl`* -*found = None* +**esc = > json.parse text={"nl":"\n","fw":":"}** +**nl = > json.get value=`esc` key="nl"** +**fw = > json.get value=`esc` key="fw"** +**text = > trim value=`reply`** +**lines = > split value=`text` sep=`nl`** +**found = None** - [`line`](`lines`) - *t = > trim value=`line`* - *parts = > split value=`t` sep=":"* - *n = > len value=`parts`* + **t = > trim value=`line`** + **parts = > split value=`t` sep=":"** + **n = > len value=`parts`** 1. `n` > 1 - *head = > at value=`parts` index=0* - *head = > trim value=`head`* - *rest = > at value=`parts` index=1* - *rest = > trim value=`rest`* + **head = > at value=`parts` index=0** + **head = > trim value=`head`** + **rest = > at value=`parts` index=1** + **rest = > trim value=`rest`** 1. `head` == READ - *found = rest* + **found = rest** 2. `head` == 读取 - *found = rest* + **found = rest** 3. * - *_ = 1* + **_ = 1** 2. * - *parts = > split value=`t` sep=`fw`* - *n = > len value=`parts`* + **parts = > split value=`t` sep=`fw`** + **n = > len value=`parts`** 1. `n` > 1 - *head = > at value=`parts` index=0* - *head = > trim value=`head`* - *rest = > at value=`parts` index=1* - *rest = > trim value=`rest`* + **head = > at value=`parts` index=0** + **head = > trim value=`head`** + **rest = > at value=`parts` index=1** + **rest = > trim value=`rest`** 1. `head` == 读取 - *found = rest* + **found = rest** 2. `head` == READ - *found = rest* + **found = rest** 3. * - *_ = 1* + **_ = 1** 2. * - *_ = 1* -**found** + **_ = 1** +*found* --- @@ -662,28 +662,28 @@ Parse READ:source|stderr|stdout|slots|skill (Chinese: 读取:…). Priority: CALL → READ → DECISION. Returns `{kind,name}`. -*tool = > extract_tool_name reply=`reply`* +**tool = > extract_tool_name reply=`reply`** 1. `tool` - *out = > json.parse text={"kind":"call"}* - *out = > json.set map=`out` key="name" value=`tool`* - **out** + **out = > json.parse text={"kind":"call"}** + **out = > json.set map=`out` key="name" value=`tool`** + *out* 2. * - *_ = 1* -*rk = > extract_plan_read reply=`reply`* + **_ = 1** +**rk = > extract_plan_read reply=`reply`** 1. `rk` - *out = > json.parse text={"kind":"read"}* - *out = > json.set map=`out` key="name" value=`rk`* - **out** + **out = > json.parse text={"kind":"read"}** + **out = > json.set map=`out` key="name" value=`rk`** + *out* 2. * - *_ = 1* -*dec = > extract_plan_decision reply=`reply`* + **_ = 1** +**dec = > extract_plan_decision reply=`reply`** 1. `dec` - *out = > json.parse text={"kind":"decision"}* - *out = > json.set map=`out` key="name" value=`dec`* - **out** + **out = > json.parse text={"kind":"decision"}** + **out = > json.set map=`out` key="name" value=`dec`** + *out* 2. * - *out = > json.parse text={"kind":"unknown"}* - **out** + **out = > json.parse text={"kind":"unknown"}** + *out* --- @@ -692,48 +692,48 @@ Priority: CALL → READ → DECISION. Returns `{kind,name}`. Parse NAME: id plus a triple-angle body after CALL:scratch_tool_write. -*esc = > json.parse text={"nl":"\n","open":"<<<","close":">>>"}* -*nl = > json.get value=`esc` key="nl"* -*open = > json.get value=`esc` key="open"* -*close = > json.get value=`esc` key="close"* -*text = > trim value=`reply`* -*lines = > split value=`text` sep=`nl`* -*name = None* -*body_lines = > json.parse text=[]* -*in_body = None* +**esc = > json.parse text={"nl":"\n","open":"<<<","close":">>>"}** +**nl = > json.get value=`esc` key="nl"** +**open = > json.get value=`esc` key="open"** +**close = > json.get value=`esc` key="close"** +**text = > trim value=`reply`** +**lines = > split value=`text` sep=`nl`** +**name = None** +**body_lines = > json.parse text=[]** +**in_body = None** - [`line`](`lines`) 1. `in_body` - *t = > trim value=`line`* + **t = > trim value=`line`** 1. `t` == `close` - *in_body = None* + **in_body = None** 2. * - *body_lines = > json.append list=`body_lines` item=`line`* + **body_lines = > json.append list=`body_lines` item=`line`** 2. * - *t = > trim value=`line`* - *parts = > split value=`t` sep=":"* - *n = > len value=`parts`* + **t = > trim value=`line`** + **parts = > split value=`t` sep=":"** + **n = > len value=`parts`** 1. `n` > 1 - *head = > at value=`parts` index=0* - *head = > trim value=`head`* - *rest = > at value=`parts` index=1* - *rest = > trim value=`rest`* + **head = > at value=`parts` index=0** + **head = > trim value=`head`** + **rest = > at value=`parts` index=1** + **rest = > trim value=`rest`** 1. `head` == NAME - *name = rest* + **name = rest** 2. `head` == 名称 - *name = rest* + **name = rest** 3. * - *_ = 1* + **_ = 1** 2. * - *_ = 1* + **_ = 1** 1. `t` == `open` - *in_body = 1* + **in_body = 1** 2. * - *_ = 1* -*body = > join value=`body_lines` sep=`nl`* -*out = > json.parse text={}* -*out = > json.set map=`out` key="name" value=`name`* -*out = > json.set map=`out` key="text" value=`body`* -**out** + **_ = 1** +**body = > join value=`body_lines` sep=`nl`** +**out = > json.parse text={}** +**out = > json.set map=`out` key="name" value=`name`** +**out = > json.set map=`out` key="text" value=`body`** +*out* --- @@ -746,72 +746,72 @@ Parse NAME: id plus a triple-angle body after CALL:scratch_tool_write. Parent Plan-and-Move tools (helpers + whitelist `CALL:lib…`). 1. `name` == workbook_read - **> workbook_read path=`path` depth="deep"** + *> workbook_read path=`path` depth="deep"* 2. `name` == workbook_excerpt - **> workbook_excerpt path=`path`** + *> workbook_excerpt path=`path`* 3. `name` == lib_catalog - **> lib_catalog** + *> lib_catalog* 4. `name` == scratch_tool_write - *parsed = > extract_scratch_tool reply=`reply`* - *tn = > json.get value=`parsed` key="name"* - *tt = > json.get value=`parsed` key="text"* - *errs = > json.parse text={"a":"scratch_tool_write needs NAME line and fenced body","b":"scratch_tool_write needs NAME id"}* + **parsed = > extract_scratch_tool reply=`reply`** + **tn = > json.get value=`parsed` key="name"** + **tt = > json.get value=`parsed` key="text"** + **errs = > json.parse text={"a":"scratch_tool_write needs NAME line and fenced body","b":"scratch_tool_write needs NAME id"}** 1. `tn` 1. `tt` - **> scratch_tool_write name=`tn` text=`tt`** + *> scratch_tool_write name=`tn` text=`tt`* 2. * - **> json.get value=`errs` key="a"** + *> json.get value=`errs` key="a"* 2. * - **> json.get value=`errs` key="b"** + *> json.get value=`errs` key="b"* 5. `name` == corpus_search - *args = > extract_call_args reply=`reply`* - *q = > json.get value=`args` key="query"* - *root = > json.get value=`args` key="root"* - *limit = > json.get value=`args` key="limit"* - *cerrs = > json.parse text={"q":"corpus_search needs ARGS.query"}* + **args = > extract_call_args reply=`reply`** + **q = > json.get value=`args` key="query"** + **root = > json.get value=`args` key="root"** + **limit = > json.get value=`args` key="limit"** + **cerrs = > json.parse text={"q":"corpus_search needs ARGS.query"}** 1. not `q` - **> json.get value=`cerrs` key="q"** + *> json.get value=`cerrs` key="q"* 2. `root` 1. `limit` - **> corpus_search query=`q` root=`root` limit=`limit`** + *> corpus_search query=`q` root=`root` limit=`limit`* 2. * - **> corpus_search query=`q` root=`root`** + *> corpus_search query=`q` root=`root`* 3. `limit` - **> corpus_search query=`q` limit=`limit`** + *> corpus_search query=`q` limit=`limit`* 4. * - **> corpus_search query=`q`** + *> corpus_search query=`q`* 6. `name` == mcp_list_tools - *args = > extract_call_args reply=`reply`* - *fx = > json.get value=`args` key="fixture"* - *merrs = > json.parse text={"f":"mcp_list_tools needs ARGS.fixture"}* + **args = > extract_call_args reply=`reply`** + **fx = > json.get value=`args` key="fixture"** + **merrs = > json.parse text={"f":"mcp_list_tools needs ARGS.fixture"}** 1. `fx` - **> mcp_list_tools fixture=`fx`** + *> mcp_list_tools fixture=`fx`* 2. * - **> json.get value=`merrs` key="f"** + *> json.get value=`merrs` key="f"* 7. `name` == mcp_call - *args = > extract_call_args reply=`reply`* - *fx = > json.get value=`args` key="fixture"* - *tn = > json.get value=`args` key="name"* - *targ = > json.get value=`args` key="arguments"* - *xerrs = > json.parse text={"f":"mcp_call needs ARGS.fixture","n":"mcp_call needs ARGS.name"}* + **args = > extract_call_args reply=`reply`** + **fx = > json.get value=`args` key="fixture"** + **tn = > json.get value=`args` key="name"** + **targ = > json.get value=`args` key="arguments"** + **xerrs = > json.parse text={"f":"mcp_call needs ARGS.fixture","n":"mcp_call needs ARGS.name"}** 1. `fx` 1. `tn` 1. `targ` - **> mcp_call name=`tn` fixture=`fx` arguments=`targ`** + *> mcp_call name=`tn` fixture=`fx` arguments=`targ`* 2. * - **> mcp_call name=`tn` fixture=`fx`** + *> mcp_call name=`tn` fixture=`fx`* 2. * - **> json.get value=`xerrs` key="n"** + *> json.get value=`xerrs` key="n"* 2. * - **> json.get value=`xerrs` key="f"** + *> json.get value=`xerrs` key="f"* 8. * - *dots = > split value=`name` sep=".*"* - *head = > at value=`dots` index=0* + **dots = > split value=`name` sep=".*"** + **head = > at value=`dots` index=0** 1. `head` == lib - **> run_lib_call name=`name` reply=`reply`** + *> run_lib_call name=`name` reply=`reply`* 2. * - *msg = "Parent tool not allowed:"* - **msg + name** + **msg = "Parent tool not allowed:"** + *msg + name* --- @@ -820,32 +820,32 @@ Parent Plan-and-Move tools (helpers + whitelist `CALL:lib…`). + `kind` + `path` -*obs = observation* +**obs = observation** 1. `kind` == source - *ex = > workbook_read path=`path` depth="deep"* - *obs = > json.set map=`obs` key="source_excerpt" value=`ex`* - *obs = > json.set map=`obs` key="read_source" value=True* + **ex = > workbook_read path=`path` depth="deep"** + **obs = > json.set map=`obs` key="source_excerpt" value=`ex`** + **obs = > json.set map=`obs` key="read_source" value=True** 2. `kind` == stderr - *err = > json.get value=`obs` key="stderr"* - *tail = > text_tail_lines text=`err` max_lines=80 max_chars=6000* - *obs = > json.set map=`obs` key="stderr_tail" value=`tail`* - *obs = > json.set map=`obs` key="read_stderr" value=True* + **err = > json.get value=`obs` key="stderr"** + **tail = > text_tail_lines text=`err` max_lines=80 max_chars=6000** + **obs = > json.set map=`obs` key="stderr_tail" value=`tail`** + **obs = > json.set map=`obs` key="read_stderr" value=True** 3. `kind` == stdout - *out = > json.get value=`obs` key="stdout"* - *tail = > text_tail_lines text=`out` max_lines=80 max_chars=6000* - *obs = > json.set map=`obs` key="stdout_tail" value=`tail`* - *obs = > json.set map=`obs` key="read_stdout" value=True* + **out = > json.get value=`obs` key="stdout"** + **tail = > text_tail_lines text=`out` max_lines=80 max_chars=6000** + **obs = > json.set map=`obs` key="stdout_tail" value=`tail`** + **obs = > json.set map=`obs` key="read_stdout" value=True** 4. `kind` == slots - *slots = > json.get value=`obs` key="slots"* - *obs = > json.set map=`obs` key="slots_detail" value=`slots`* - *obs = > json.set map=`obs` key="read_slots" value=True* + **slots = > json.get value=`obs` key="slots"** + **obs = > json.set map=`obs` key="slots_detail" value=`slots`** + **obs = > json.set map=`obs` key="read_slots" value=True** 5. `kind` == skill - *brief = > skill_brief depth="deep"* - *obs = > json.set map=`obs` key="skill_brief" value=`brief`* - *obs = > json.set map=`obs` key="read_skill" value=True* + **brief = > skill_brief depth="deep"** + **obs = > json.set map=`obs` key="skill_brief" value=`brief`** + **obs = > json.set map=`obs` key="read_skill" value=True** 6. * - *_ = 1* -**obs** + **_ = 1** +*obs* --- @@ -854,124 +854,124 @@ Parent Plan-and-Move tools (helpers + whitelist `CALL:lib…`). Bounded observation for the parent prompt (actionable, short). -*obs_path = > json.get value=`observation` key="path"* -*obs_code = > json.get value=`observation` key="exit_code"* -*obs_val = > json.get value=`observation` key="value"* -*obs_slots = > json.get value=`observation` key="slots"* -*obs_src = > json.get value=`observation` key="source"* -*obs_stdout = > json.get value=`observation` key="stdout"* -*obs_stderr = > json.get value=`observation` key="stderr"* -*src_len = 0* -*has_step = False* +**obs_path = > json.get value=`observation` key="path"** +**obs_code = > json.get value=`observation` key="exit_code"** +**obs_val = > json.get value=`observation` key="value"** +**obs_slots = > json.get value=`observation` key="slots"** +**obs_src = > json.get value=`observation` key="source"** +**obs_stdout = > json.get value=`observation` key="stdout"** +**obs_stderr = > json.get value=`observation` key="stderr"** +**src_len = 0** +**has_step = False** 1. `obs_src` - *src_len = > len value=`obs_src`* - *step_parts = > split value=`obs_src` sep="worker.step"* - *n_step = > len value=`step_parts`* + **src_len = > len value=`obs_src`** + **step_parts = > split value=`obs_src` sep="worker.step"** + **n_step = > len value=`step_parts`** 1. `n_step` > 1 - *has_step = True* + **has_step = True** 2. * - *_ = 1* + **_ = 1** 2. * - *_ = 1* + **_ = 1** -*compact = > json.parse text={"note":"Plan-and-Move: CALL/READ then DECISION. Success (exit 0 + has_value) → DONE. solidify_on_done. No long prose."}* -*compact = > json.set map=`compact` key="path" value=`obs_path`* -*compact = > json.set map=`compact` key="exit_code" value=`obs_code`* -*compact = > json.set map=`compact` key="source_len" value=`src_len`* -*compact = > json.set map=`compact` key="has_worker_step" value=`has_step`* -*compact = > json.set map=`compact` key="solidify_on_done" value=True* +**compact = > json.parse text={"note":"Plan-and-Move: CALL/READ then DECISION. Success (exit 0 + has_value) → DONE. solidify_on_done. No long prose."}** +**compact = > json.set map=`compact` key="path" value=`obs_path`** +**compact = > json.set map=`compact` key="exit_code" value=`obs_code`** +**compact = > json.set map=`compact` key="source_len" value=`src_len`** +**compact = > json.set map=`compact` key="has_worker_step" value=`has_step`** +**compact = > json.set map=`compact` key="solidify_on_done" value=True** 1. `obs_src` - *ex = > json.get value=`observation` key="source_excerpt"* + **ex = > json.get value=`observation` key="source_excerpt"** 1. `ex` - *compact = > json.set map=`compact` key="source_excerpt" value=`ex`* + **compact = > json.set map=`compact` key="source_excerpt" value=`ex`** 2. * - *ex = > workbook_source_excerpt source=`obs_src`* - *compact = > json.set map=`compact` key="source_excerpt" value=`ex`* + **ex = > workbook_source_excerpt source=`obs_src`** + **compact = > json.set map=`compact` key="source_excerpt" value=`ex`** 2. * - *_ = 1* + **_ = 1** 1. `obs_stderr` - *tail = > json.get value=`observation` key="stderr_tail"* + **tail = > json.get value=`observation` key="stderr_tail"** 1. `tail` - *compact = > json.set map=`compact` key="stderr_tail" value=`tail`* + **compact = > json.set map=`compact` key="stderr_tail" value=`tail`** 2. * - *tail = > text_tail_lines text=`obs_stderr`* - *compact = > json.set map=`compact` key="stderr_tail" value=`tail`* + **tail = > text_tail_lines text=`obs_stderr`** + **compact = > json.set map=`compact` key="stderr_tail" value=`tail`** 2. * - *_ = 1* + **_ = 1** 1. `obs_stdout` - *tail = > json.get value=`observation` key="stdout_tail"* + **tail = > json.get value=`observation` key="stdout_tail"** 1. `tail` - *compact = > json.set map=`compact` key="stdout_tail" value=`tail`* + **compact = > json.set map=`compact` key="stdout_tail" value=`tail`** 2. * - *tail = > text_tail_lines text=`obs_stdout`* - *compact = > json.set map=`compact` key="stdout_tail" value=`tail`* + **tail = > text_tail_lines text=`obs_stdout`** + **compact = > json.set map=`compact` key="stdout_tail" value=`tail`** 2. * - *_ = 1* + **_ = 1** -*val_txt = > str value=`obs_val`* -*val_len = > len value=`val_txt`* +**val_txt = > str value=`obs_val`** +**val_len = > len value=`val_txt`** 1. `obs_val` - *compact = > json.set map=`compact` key="has_value" value=True* - *compact = > json.set map=`compact` key="value_len" value=`val_len`* + **compact = > json.set map=`compact` key="has_value" value=True** + **compact = > json.set map=`compact` key="value_len" value=`val_len`** 1. `val_len` > 200 - *preview = > text_head_lines text=`val_txt` max_lines=4 max_chars=200* - *compact = > json.set map=`compact` key="value_preview" value=`preview`* + **preview = > text_head_lines text=`val_txt` max_lines=4 max_chars=200** + **compact = > json.set map=`compact` key="value_preview" value=`preview`** 2. * - *compact = > json.set map=`compact` key="value" value=`obs_val`* + **compact = > json.set map=`compact` key="value" value=`obs_val`** 2. * - *compact = > json.set map=`compact` key="has_value" value=False* + **compact = > json.set map=`compact` key="has_value" value=False** -*slots_brief = > json.parse text=[]* +**slots_brief = > json.parse text=[]** 1. `obs_slots` - [`slot`](`obs_slots`) - *sk = > json.get value=`slot` key="key"* - *sl = > json.get value=`slot` key="line"* - *sb = > json.get value=`slot` key="body"* - *sb_txt = > str value=`sb`* - *sb_len = > len value=`sb_txt`* - *brief = > json.parse text={"key":""}* - *brief = > json.set map=`brief` key="key" value=`sk`* - *brief = > json.set map=`brief` key="line" value=`sl`* - *brief = > json.set map=`brief` key="body_len" value=`sb_len`* + **sk = > json.get value=`slot` key="key"** + **sl = > json.get value=`slot` key="line"** + **sb = > json.get value=`slot` key="body"** + **sb_txt = > str value=`sb`** + **sb_len = > len value=`sb_txt`** + **brief = > json.parse text={"key":""}** + **brief = > json.set map=`brief` key="key" value=`sk`** + **brief = > json.set map=`brief` key="line" value=`sl`** + **brief = > json.set map=`brief` key="body_len" value=`sb_len`** 1. `sk` == error - *prev = > text_head_lines text=`sb_txt` max_lines=8 max_chars=400* - *brief = > json.set map=`brief` key="body_preview" value=`prev`* + **prev = > text_head_lines text=`sb_txt` max_lines=8 max_chars=400** + **brief = > json.set map=`brief` key="body_preview" value=`prev`** 2. * - *_ = 1* - *slots_brief = > json.append list=`slots_brief` item=`brief`* + **_ = 1** + **slots_brief = > json.append list=`slots_brief` item=`brief`** 2. * - *_ = 1* -*compact = > json.set map=`compact` key="slots" value=`slots_brief`* -*detail = > json.get value=`observation` key="slots_detail"* + **_ = 1** +**compact = > json.set map=`compact` key="slots" value=`slots_brief`** +**detail = > json.get value=`observation` key="slots_detail"** 1. `detail` - *compact = > json.set map=`compact` key="slots_detail" value=`detail`* + **compact = > json.set map=`compact` key="slots_detail" value=`detail`** 2. * - *_ = 1* + **_ = 1** -*tool_result = > json.get value=`observation` key="tool_result"* +**tool_result = > json.get value=`observation` key="tool_result"** 1. `tool_result` - *tr = > str value=`tool_result`* - *tr = > text_head_lines text=`tr` max_lines=40 max_chars=3000* - *compact = > json.set map=`compact` key="tool_result" value=`tr`* + **tr = > str value=`tool_result`** + **tr = > text_head_lines text=`tr` max_lines=40 max_chars=3000** + **compact = > json.set map=`compact` key="tool_result" value=`tr`** 2. * - *_ = 1* + **_ = 1** -*last_error = > json.get value=`observation` key="last_error"* +**last_error = > json.get value=`observation` key="last_error"** 1. `last_error` - *err_txt = > str value=`last_error`* - *err_len = > len value=`err_txt`* + **err_txt = > str value=`last_error`** + **err_len = > len value=`err_txt`** 1. `err_len` > 200 - *prev = > text_head_lines text=`err_txt` max_lines=8 max_chars=400* - *compact = > json.set map=`compact` key="last_error_preview" value=`prev`* - *compact = > json.set map=`compact` key="last_error_len" value=`err_len`* + **prev = > text_head_lines text=`err_txt` max_lines=8 max_chars=400** + **compact = > json.set map=`compact` key="last_error_preview" value=`prev`** + **compact = > json.set map=`compact` key="last_error_len" value=`err_len`** 2. * - *compact = > json.set map=`compact` key="last_error" value=`last_error`* + **compact = > json.set map=`compact` key="last_error" value=`last_error`** 2. * - *_ = 1* + **_ = 1** -**compact** +*compact* --- @@ -979,72 +979,72 @@ Bounded observation for the parent prompt (actionable, short). + `reply` Parse `DECISION: DONE` / `CONTINUE` / `RUN` (Chinese: `决定:完成` / `继续` / `运行`). -**First** matching DECISION / 决定 line wins (ignore later conflicting decisions in the same reply). +First matching DECISION / 决定 line wins (ignore later conflicting decisions in the same reply). -*esc = > json.parse text={"nl":"\n","fw":":"}* -*nl = > json.get value=`esc` key="nl"* -*fw = > json.get value=`esc` key="fw"* -*text = > trim value=`reply`* -*lines = > split value=`text` sep=`nl`* -*found = None* +**esc = > json.parse text={"nl":"\n","fw":":"}** +**nl = > json.get value=`esc` key="nl"** +**fw = > json.get value=`esc` key="fw"** +**text = > trim value=`reply`** +**lines = > split value=`text` sep=`nl`** +**found = None** - [`line`](`lines`) 1. `found` - *_ = 1* + **_ = 1** 2. * - *t = > trim value=`line`* - *parts = > split value=`t` sep=":"* - *n = > len value=`parts`* + **t = > trim value=`line`** + **parts = > split value=`t` sep=":"** + **n = > len value=`parts`** 1. `n` > 1 - *head = > at value=`parts` index=0* - *head = > trim value=`head`* - *rest = > at value=`parts` index=1* - *rest = > trim value=`rest`* + **head = > at value=`parts` index=0** + **head = > trim value=`head`** + **rest = > at value=`parts` index=1** + **rest = > trim value=`rest`** 1. `head` == DECISION - *found = rest* + **found = rest** 2. `head` == 决定 - *found = rest* + **found = rest** 3. * - *_ = 1* + **_ = 1** 2. * - *parts = > split value=`t` sep=`fw`* - *n = > len value=`parts`* + **parts = > split value=`t` sep=`fw`** + **n = > len value=`parts`** 1. `n` > 1 - *head = > at value=`parts` index=0* - *head = > trim value=`head`* - *rest = > at value=`parts` index=1* - *rest = > trim value=`rest`* + **head = > at value=`parts` index=0** + **head = > trim value=`head`** + **rest = > at value=`parts` index=1** + **rest = > trim value=`rest`** 1. `head` == 决定 - *found = rest* + **found = rest** 2. `head` == DECISION - *found = rest* + **found = rest** 3. * - *_ = 1* + **_ = 1** 2. * - *_ = 1* + **_ = 1** 1. `found` == DONE - **"DONE"** + *"DONE"* 2. `found` == CONTINUE - **"CONTINUE"** + *"CONTINUE"* 3. `found` == RUN - **"RUN"** + *"RUN"* 4. `found` == REUSE - **"REUSE"** + *"REUSE"* 5. `found` == NEW - **"NEW"** + *"NEW"* 6. `found` == 完成 - **"DONE"** + *"DONE"* 7. `found` == 继续 - **"CONTINUE"** + *"CONTINUE"* 8. `found` == 运行 - **"RUN"** + *"RUN"* 9. `found` == 复用 - **"REUSE"** + *"REUSE"* 10. `found` == 新建 - **"NEW"** + *"NEW"* 11. * - **found** + *found* --- @@ -1053,46 +1053,46 @@ Parse `DECISION: DONE` / `CONTINUE` / `RUN` (Chinese: `决定:完成` / `继 Parse `SLUG: …` / `标识:…` after a soft-match REUSE decision. -*esc = > json.parse text={"nl":"\n","fw":":"}* -*nl = > json.get value=`esc` key="nl"* -*fw = > json.get value=`esc` key="fw"* -*text = > trim value=`reply`* -*lines = > split value=`text` sep=`nl`* -*found = None* +**esc = > json.parse text={"nl":"\n","fw":":"}** +**nl = > json.get value=`esc` key="nl"** +**fw = > json.get value=`esc` key="fw"** +**text = > trim value=`reply`** +**lines = > split value=`text` sep=`nl`** +**found = None** - [`line`](`lines`) - *t = > trim value=`line`* - *parts = > split value=`t` sep=":"* - *n = > len value=`parts`* + **t = > trim value=`line`** + **parts = > split value=`t` sep=":"** + **n = > len value=`parts`** 1. `n` > 1 - *head = > at value=`parts` index=0* - *head = > trim value=`head`* - *rest = > at value=`parts` index=1* - *rest = > trim value=`rest`* + **head = > at value=`parts` index=0** + **head = > trim value=`head`** + **rest = > at value=`parts` index=1** + **rest = > trim value=`rest`** 1. `head` == SLUG - *found = rest* + **found = rest** 2. `head` == 标识 - *found = rest* + **found = rest** 3. * - *_ = 1* + **_ = 1** 2. * - *parts = > split value=`t` sep=`fw`* - *n = > len value=`parts`* + **parts = > split value=`t` sep=`fw`** + **n = > len value=`parts`** 1. `n` > 1 - *head = > at value=`parts` index=0* - *head = > trim value=`head`* - *rest = > at value=`parts` index=1* - *rest = > trim value=`rest`* + **head = > at value=`parts` index=0** + **head = > trim value=`head`** + **rest = > at value=`parts` index=1** + **rest = > trim value=`rest`** 1. `head` == 标识 - *found = rest* + **found = rest** 2. `head` == SLUG - *found = rest* + **found = rest** 3. * - *_ = 1* + **_ = 1** 2. * - *_ = 1* + **_ = 1** -**found** +*found* --- @@ -1102,50 +1102,50 @@ Parse `SLUG: …` / `标识:…` after a soft-match REUSE decision. Short parent prompt: REUSE+SLUG or NEW only. Candidates may include lexical `score` (prefer higher). `list_tasks` rows may also carry `description` / `status` / `llm_free`. -*esc = > json.parse text={"a":"\n\n--- goal ---\n","b":"\n\n--- candidate tasks (slug | title | meta) ---\n","c":"\n\n--- how to act ---\nExact reuse miss; candidates are ranked by local n-gram score when present. Prefer higher scores and llm_free=true skills. Reply with ONE protocol only:\nDECISION: REUSE\nSLUG: \nor\nDECISION: NEW\nNo other prose.\n","nl":"\n","sep":" | ","sp":"score=","st":"status=","lf":"llm_free="}* -*a = > json.get value=`esc` key="a"* -*b = > json.get value=`esc` key="b"* -*c = > json.get value=`esc` key="c"* -*nl = > json.get value=`esc` key="nl"* -*sep = > json.get value=`esc` key="sep"* -*sp = > json.get value=`esc` key="sp"* -*st = > json.get value=`esc` key="st"* -*lf = > json.get value=`esc` key="lf"* -*lines = > json.parse text=[]* +**esc = > json.parse text={"a":"\n\n--- goal ---\n","b":"\n\n--- candidate tasks (slug | title | meta) ---\n","c":"\n\n--- how to act ---\nExact reuse miss; candidates are ranked by local n-gram score when present. Prefer higher scores and llm_free=true skills. Reply with ONE protocol only:\nDECISION: REUSE\nSLUG: \nor\nDECISION: NEW\nNo other prose.\n","nl":"\n","sep":" | ","sp":"score=","st":"status=","lf":"llm_free="}** +**a = > json.get value=`esc` key="a"** +**b = > json.get value=`esc` key="b"** +**c = > json.get value=`esc` key="c"** +**nl = > json.get value=`esc` key="nl"** +**sep = > json.get value=`esc` key="sep"** +**sp = > json.get value=`esc` key="sp"** +**st = > json.get value=`esc` key="st"** +**lf = > json.get value=`esc` key="lf"** +**lines = > json.parse text=[]** - [`t`](`tasks`) - *slug = > json.get value=`t` key="slug"* - *title = > json.get value=`t` key="title"* - *row = slug + sep + title* - *score = > json.get value=`t` key="score"* + **slug = > json.get value=`t` key="slug"** + **title = > json.get value=`t` key="title"** + **row = slug + sep + title** + **score = > json.get value=`t` key="score"** 1. `score` - *row = row + sep + sp + score* + **row = row + sep + sp + score** 2. * - *_ = 1* - *status = > json.get value=`t` key="status"* + **_ = 1** + **status = > json.get value=`t` key="status"** 1. `status` - *row = row + sep + st + status* + **row = row + sep + st + status** 2. * - *_ = 1* - *free = > json.get value=`t` key="llm_free"* + **_ = 1** + **free = > json.get value=`t` key="llm_free"** 1. `free` == True - *row = row + sep + lf + "true"* + **row = row + sep + lf + "true"** 2. `free` == true - *row = row + sep + lf + "true"* + **row = row + sep + lf + "true"** 3. `free` == False - *row = row + sep + lf + "false"* + **row = row + sep + lf + "false"** 4. `free` == false - *row = row + sep + lf + "false"* + **row = row + sep + lf + "false"** 5. * - *_ = 1* - *desc = > json.get value=`t` key="description"* + **_ = 1** + **desc = > json.get value=`t` key="description"** 1. `desc` - *row = row + sep + desc* + **row = row + sep + desc** 2. * - *_ = 1* - *lines = > json.append list=`lines` item=`row`* -*catalog = > join value=`lines` sep=`nl`* -*p = "Soft-match: same task intent?"* -**p + a + goal + b + catalog + c** + **_ = 1** + **lines = > json.append list=`lines` item=`row`** +**catalog = > join value=`lines` sep=`nl`** +**p = "Soft-match: same task intent?"** +*p + a + goal + b + catalog + c* --- @@ -1154,49 +1154,49 @@ Short parent prompt: REUSE+SLUG or NEW only. Candidates may include lexical `sco First `SUMMARY:` / `汇总:` / `汇总:` line body, else trimmed reply. -*esc = > json.parse text={"nl":"\n","fw":":"}* -*nl = > json.get value=`esc` key="nl"* -*fw = > json.get value=`esc` key="fw"* -*text = > trim value=`reply`* -*lines = > split value=`text` sep=`nl`* -*found = None* +**esc = > json.parse text={"nl":"\n","fw":":"}** +**nl = > json.get value=`esc` key="nl"** +**fw = > json.get value=`esc` key="fw"** +**text = > trim value=`reply`** +**lines = > split value=`text` sep=`nl`** +**found = None** - [`line`](`lines`) - *t = > trim value=`line`* - *parts = > split value=`t` sep=":"* - *n = > len value=`parts`* + **t = > trim value=`line`** + **parts = > split value=`t` sep=":"** + **n = > len value=`parts`** 1. `n` > 1 - *head = > at value=`parts` index=0* - *head = > trim value=`head`* - *rest = > at value=`parts` index=1* - *rest = > trim value=`rest`* + **head = > at value=`parts` index=0** + **head = > trim value=`head`** + **rest = > at value=`parts` index=1** + **rest = > trim value=`rest`** 1. `head` == SUMMARY - *found = rest* + **found = rest** 2. `head` == 汇总 - *found = rest* + **found = rest** 3. * - *_ = 1* + **_ = 1** 2. * - *parts = > split value=`t` sep=`fw`* - *n = > len value=`parts`* + **parts = > split value=`t` sep=`fw`** + **n = > len value=`parts`** 1. `n` > 1 - *head = > at value=`parts` index=0* - *head = > trim value=`head`* - *rest = > at value=`parts` index=1* - *rest = > trim value=`rest`* + **head = > at value=`parts` index=0** + **head = > trim value=`head`** + **rest = > at value=`parts` index=1** + **rest = > trim value=`rest`** 1. `head` == 汇总 - *found = rest* + **found = rest** 2. `head` == SUMMARY - *found = rest* + **found = rest** 3. * - *_ = 1* + **_ = 1** 2. * - *_ = 1* + **_ = 1** 1. `found` - **found** + *found* 2. * - **text** + *text* --- @@ -1210,44 +1210,44 @@ First `SUMMARY:` / `汇总:` / `汇总:` line body, else trimmed reply. Parent Plan-and-Move prompt. Short protocol only — no long monologues. -*standing = > json.get value=`agent` key="standing"* +**standing = > json.get value=`agent` key="standing"** 1. `standing` - *up = standing* + **up = standing** 2. * - *up = None* + **up = None** -*skill_from_obs = > json.get value=`observation` key="skill_brief"* +**skill_from_obs = > json.get value=`observation` key="skill_brief"** 1. `skill_from_obs` - *skill = skill_from_obs* + **skill = skill_from_obs** 2. * - *skill = > skill_brief* -*compact = > compact_plan_observation observation=`observation`* -*obs_s = > json.stringify value=`compact`* -*goal_s = > json.stringify value=`goal`* -*esc = > json.parse text={"a":"\n\n--- standing ---\n","b":"\n\n--- goal ---\n","c":"\n\n--- observation ---\n","d":"\n\n--- skill brief ---\n","tools":"\n\n--- parent tools ---\nCALL:workbook_read | workbook_excerpt | lib_catalog | scratch_tool_write\nCALL:corpus_search | mcp_list_tools | mcp_call (ARGS:{…}; evidence only — workbook authority)\nCALL:lib.fs.read_text|exists|list_dir | lib.json.parse|stringify | lib.sys.cwd (+ ARGS:{json})\nREAD:source | stderr | stdout | slots | skill\nCreate tools: CONTINUE PATCH add ##, or CALL:scratch_tool_write with NAME line and fenced body.\n","e_rev":"\n\n--- how to act ---\nPlan-and-Move parent. Reply with ONE protocol only (no long reasoning). Exactly one DECISION line.\n1) exit_code=0 and has_value → DECISION: DONE + one-line SUMMARY. solidify_on_done. Do not CONTINUE just because has_worker_step.\n2) Need more evidence → READ:kind or CALL:tool (then you will be re-prompted).\n3) Failure / wrong value → DECISION: CONTINUE + short PATCH (<20 lines). Never paste user prose into REPLACE.\n4) Do NOT CONTINUE only to rewrite frontmatter imports; skeleton already uses import llm:/agent:/json:….\nPATCH must use triple-angle blocks only:\n<<<\nFIND\n\n===\nREPLACE\n\n>>>\nDo not use \u0060\u0060\u0060find, \u0060\u0060\u0060replace, or *** Begin Patch ***.\nProtocols:\nCALL:name\nREAD:kind\nDECISION: DONE\nSUMMARY: one line\nDECISION: CONTINUE\n","e_dec":"\n\n--- how to act ---\nPRE-RUN decompose. Reply with ONE protocol only (no long reasoning). Exactly one DECISION line.\n1) Skeleton OK → DECISION: RUN (preferred). Do not rewrite imports; they are already import llm:/agent:/….\n2) Need evidence → READ:source or READ:skill or CALL:workbook_read / lib_catalog / corpus_search / mcp_call.\n3) Reshape body/logic only → DECISION: CONTINUE + short PATCH (<20 lines).\n4) Fixed answer without LLM → PATCH to return, then RUN or DONE.\nPATCH must use <<< FIND === REPLACE >>> only (no \u0060\u0060\u0060find / Begin Patch).\nProtocols:\nCALL:name\nREAD:kind\nDECISION: RUN\nDECISION: DONE\nSUMMARY: one line\nDECISION: CONTINUE\n","f":"\n\n--- explore ---\n"}* -*a = > json.get value=`esc` key="a"* -*b = > json.get value=`esc` key="b"* -*c = > json.get value=`esc` key="c"* -*d = > json.get value=`esc` key="d"* -*tools = > json.get value=`esc` key="tools"* -*f = > json.get value=`esc` key="f"* + **skill = > skill_brief** +**compact = > compact_plan_observation observation=`observation`** +**obs_s = > json.stringify value=`compact`** +**goal_s = > json.stringify value=`goal`** +**esc = > json.parse text={"a":"\n\n--- standing ---\n","b":"\n\n--- goal ---\n","c":"\n\n--- observation ---\n","d":"\n\n--- skill brief ---\n","tools":"\n\n--- parent tools ---\nCALL:workbook_read | workbook_excerpt | lib_catalog | scratch_tool_write\nCALL:corpus_search | mcp_list_tools | mcp_call (ARGS:{…}; evidence only — workbook authority)\nCALL:lib.fs.read_text|exists|list_dir | lib.json.parse|stringify | lib.sys.cwd (+ ARGS:{json})\nREAD:source | stderr | stdout | slots | skill\nCreate tools: CONTINUE PATCH add ##, or CALL:scratch_tool_write with NAME line and fenced body.\n","e_rev":"\n\n--- how to act ---\nPlan-and-Move parent. Reply with ONE protocol only (no long reasoning). Exactly one DECISION line.\n1) exit_code=0 and has_value → DECISION: DONE + one-line SUMMARY. solidify_on_done. Do not CONTINUE just because has_worker_step.\n2) Need more evidence → READ:kind or CALL:tool (then you will be re-prompted).\n3) Failure / wrong value → DECISION: CONTINUE + short PATCH (<20 lines). Never paste user prose into REPLACE.\n4) Do NOT CONTINUE only to rewrite frontmatter imports; skeleton already uses import llm:/agent:/json:….\nPATCH must use triple-angle blocks only:\n<<<\nFIND\n\n===\nREPLACE\n\n>>>\nDo not use \u0060\u0060\u0060find, \u0060\u0060\u0060replace, or *** Begin Patch ***.\nProtocols:\nCALL:name\nREAD:kind\nDECISION: DONE\nSUMMARY: one line\nDECISION: CONTINUE\n","e_dec":"\n\n--- how to act ---\nPRE-RUN decompose. Reply with ONE protocol only (no long reasoning). Exactly one DECISION line.\n1) Skeleton OK → DECISION: RUN (preferred). Do not rewrite imports; they are already import llm:/agent:/….\n2) Need evidence → READ:source or READ:skill or CALL:workbook_read / lib_catalog / corpus_search / mcp_call.\n3) Reshape body/logic only → DECISION: CONTINUE + short PATCH (<20 lines).\n4) Fixed answer without LLM → PATCH to return, then RUN or DONE.\nPATCH must use <<< FIND === REPLACE >>> only (no \u0060\u0060\u0060find / Begin Patch).\nProtocols:\nCALL:name\nREAD:kind\nDECISION: RUN\nDECISION: DONE\nSUMMARY: one line\nDECISION: CONTINUE\n","f":"\n\n--- explore ---\n"}** +**a = > json.get value=`esc` key="a"** +**b = > json.get value=`esc` key="b"** +**c = > json.get value=`esc` key="c"** +**d = > json.get value=`esc` key="d"** +**tools = > json.get value=`esc` key="tools"** +**f = > json.get value=`esc` key="f"** 1. `phase` == decompose - *e = > json.get value=`esc` key="e_dec"* - *p = "Plan-and-Move: decompose before first run."* + **e = > json.get value=`esc` key="e_dec"** + **p = "Plan-and-Move: decompose before first run."** 2. * - *e = > json.get value=`esc` key="e_rev"* - *p = "Plan-and-Move: revise after child run."* -*p = p + a + up + b + goal_s + c + obs_s + tools + d + skill + e* + **e = > json.get value=`esc` key="e_rev"** + **p = "Plan-and-Move: revise after child run."** +**p = p + a + up + b + goal_s + c + obs_s + tools + d + skill + e** 1. `explore_attempt` - *p = p + f* - *p = p + "Attempt"* - *p = p + explore_attempt* - *p = p + "of"* - *p = p + explore_n* - *p = p + ". Different path; prefer code when fixed."* + **p = p + f** + **p = p + "Attempt"** + **p = p + explore_attempt** + **p = p + "of"** + **p = p + explore_n** + **p = p + ". Different path; prefer code when fixed."** 2. * - *_ = 1* -**p** + **_ = 1** +*p* --- @@ -1266,55 +1266,55 @@ Parent Plan-and-Move prompt. Short protocol only — no long monologues. LLM Plan → CALL/READ/DECISION loop. Returns `{decision,reply,observation,events}`. -*model = > json.get value=`agent` key="model"* -*last_obs = observation* -*left = max_acts* -*decision = None* -*last_reply = None* -*evs_all = events* +**model = > json.get value=`agent` key="model"** +**last_obs = observation** +**left = max_acts** +**decision = None** +**last_reply = None** +**evs_all = events** - `left` > 0 1. `decision` - *left = 0* + **left = 0** 2. * - *ctx = > build_plan_context agent=`agent` goal=`goal` observation=`last_obs` explore_attempt=`explore_attempt` explore_n=`explore_n` phase=`phase`* + **ctx = > build_plan_context agent=`agent` goal=`goal` observation=`last_obs` explore_attempt=`explore_attempt` explore_n=`explore_n` phase=`phase`** 1. `stream` - *evs = > model.complete prompt=`ctx` stream=True echo=`echo`* - *last_reply = > llm.stream_result events=`evs`* - *evs_all = > plan_merge_deltas events=`evs_all` from=`evs` stream=`stream`* + **evs = > model.complete prompt=`ctx` stream=True echo=`echo`** + **last_reply = > llm.stream_result events=`evs`** + **evs_all = > plan_merge_deltas events=`evs_all` from=`evs` stream=`stream`** 2. * - *last_reply = > model.complete prompt=`ctx`* - *last_reply = > trim value=`last_reply`* - *act = > extract_plan_act reply=`last_reply`* - *kind = > json.get value=`act` key="kind"* - *name = > json.get value=`act` key="name"* + **last_reply = > model.complete prompt=`ctx`** + **last_reply = > trim value=`last_reply`** + **act = > extract_plan_act reply=`last_reply`** + **kind = > json.get value=`act` key="kind"** + **name = > json.get value=`act` key="name"** 1. `kind` == call - *evs_all = > plan_append_tool events=`evs_all` type="tool_start" name=`name` kind="call" stream=`stream`* - *tool_out = > run_parent_tool name=`name` path=`path` observation=`last_obs` reply=`last_reply`* - *brief = > tool_result_brief value=`tool_out`* - *evs_all = > plan_append_tool events=`evs_all` type="tool_end" name=`name` kind="call" result=`brief` stream=`stream`* - *last_obs = > json.set map=`last_obs` key="tool_result" value=`tool_out`* - *left = left - 1* + **evs_all = > plan_append_tool events=`evs_all` type="tool_start" name=`name` kind="call" stream=`stream`** + **tool_out = > run_parent_tool name=`name` path=`path` observation=`last_obs` reply=`last_reply`** + **brief = > tool_result_brief value=`tool_out`** + **evs_all = > plan_append_tool events=`evs_all` type="tool_end" name=`name` kind="call" result=`brief` stream=`stream`** + **last_obs = > json.set map=`last_obs` key="tool_result" value=`tool_out`** + **left = left - 1** 2. `kind` == read - *evs_all = > plan_append_tool events=`evs_all` type="tool_start" name=`name` kind="read" stream=`stream`* - *last_obs = > plan_read_deepen observation=`last_obs` kind=`name` path=`path`* - *brief = > tool_result_brief value=`last_obs`* - *evs_all = > plan_append_tool events=`evs_all` type="tool_end" name=`name` kind="read" result=`brief` stream=`stream`* - *left = left - 1* + **evs_all = > plan_append_tool events=`evs_all` type="tool_start" name=`name` kind="read" stream=`stream`** + **last_obs = > plan_read_deepen observation=`last_obs` kind=`name` path=`path`** + **brief = > tool_result_brief value=`last_obs`** + **evs_all = > plan_append_tool events=`evs_all` type="tool_end" name=`name` kind="read" result=`brief` stream=`stream`** + **left = left - 1** 3. `kind` == decision - *decision = name* - *evs_all = > plan_append_decision events=`evs_all` decision=`decision` stream=`stream`* - *left = 0* + **decision = name** + **evs_all = > plan_append_decision events=`evs_all` decision=`decision` stream=`stream`** + **left = 0** 4. * - *decision = "unknown"* - *left = 0* + **decision = "unknown"** + **left = 0** -*out = > json.parse text={}* -*out = > json.set map=`out` key="decision" value=`decision`* -*out = > json.set map=`out` key="reply" value=`last_reply`* -*out = > json.set map=`out` key="observation" value=`last_obs`* -*out = > json.set map=`out` key="events" value=`evs_all`* -**out** +**out = > json.parse text={}** +**out = > json.set map=`out` key="decision" value=`decision`** +**out = > json.set map=`out` key="reply" value=`last_reply`** +**out = > json.set map=`out` key="observation" value=`last_obs`** +**out = > json.set map=`out` key="events" value=`evs_all`** +*out* --- @@ -1326,14 +1326,14 @@ LLM Plan → CALL/READ/DECISION loop. Returns `{decision,reply,observation,event Pre-run parent decompose marker. With `stream=True`, publish `{type:decompose}` so view is not silent before the first child. 1. `stream` - *ev = > json.parse text={"type":"decompose"}* - *ev = > json.set map=`ev` key="workbook" value=`workbook`* + **ev = > json.parse text={"type":"decompose"}** + **ev = > json.set map=`ev` key="workbook" value=`workbook`** > sys.stream_publish event=`ev` 1. `echo` > print text=plan:decompose 2. * - *_ = 1* - **ev** + **_ = 1** + *ev* 2. * **** @@ -1346,16 +1346,16 @@ Pre-run parent decompose marker. With `stream=True`, publish `{type:decompose}` Marker before `await_workbook`. With `stream=True`, publish `{type:await,round,workbook}` so the Stream panel shows progress while the quiet child runs (TTY `echo` optional). 1. `stream` - *ev = > json.parse text={"type":"await"}* - *ev = > json.set map=`ev` key="round" value=`round`* - *ev = > json.set map=`ev` key="workbook" value=`workbook`* + **ev = > json.parse text={"type":"await"}** + **ev = > json.set map=`ev` key="round" value=`round`** + **ev = > json.set map=`ev` key="workbook" value=`workbook`** > sys.stream_publish event=`ev` 1. `echo` > print text=plan:await > print text=`round` 2. * - *_ = 1* - **ev** + **_ = 1** + *ev* 2. * **** @@ -1364,17 +1364,17 @@ Marker before `await_workbook`. With `stream=True`, publish `{type:await,round,w True when source still contains `worker.step` or `.单步`. -*src = > fs.read_text path=`path`* -*a = > split value=`src` sep="worker.step"* -*na = > len value=`a`* -*b = > split value=`src` sep=".单步"* -*nb = > len value=`b`* +**src = > fs.read_text path=`path`** +**a = > split value=`src` sep="worker.step"** +**na = > len value=`a`** +**b = > split value=`src` sep=".单步"** +**nb = > len value=`b`** 1. `na` > 1 - **1** + *1* 2. `nb` > 1 - **1** + *1* 3. * - **0** + *0* ## plan_append_round + `events` @@ -1387,25 +1387,25 @@ True when source still contains `worker.step` or `.单步`. Always append a `round` event (child workbook finished) for audit / view. Optional `result` is the child `# main` return. SSE + optional TTY `plan:round` only when `stream` / `echo`. -*ev = > json.parse text={"type":"round"}* -*ev = > json.set map=`ev` key="round" value=`round`* -*ev = > json.set map=`ev` key="workbook" value=`workbook`* -*ev = > json.set map=`ev` key="exit_code" value=`exit_code`* +**ev = > json.parse text={"type":"round"}** +**ev = > json.set map=`ev` key="round" value=`round`** +**ev = > json.set map=`ev` key="workbook" value=`workbook`** +**ev = > json.set map=`ev` key="exit_code" value=`exit_code`** 1. `result` - *ev = > json.set map=`ev` key="result" value=`result`* + **ev = > json.set map=`ev` key="result" value=`result`** 2. * - *_ = 1* -*events = > json.append list=`events` item=`ev`* + **_ = 1** +**events = > json.append list=`events` item=`ev`** 1. `stream` > sys.stream_publish event=`ev` 2. * - *_ = 1* + **_ = 1** 1. `echo` > print text=plan:round 2. * - *_ = 1* + **_ = 1** -**events** +*events* ## plan_append_decision + `events` @@ -1415,19 +1415,19 @@ Always append a `round` event (child workbook finished) for audit / view. Option Always append a `decision` event. SSE publish only when `stream=True`. -*ev = > json.parse text={"type":"decision"}* -*ev = > json.set map=`ev` key="decision" value=`decision`* +**ev = > json.parse text={"type":"decision"}** +**ev = > json.set map=`ev` key="decision" value=`decision`** 1. `summary` - *ev = > json.set map=`ev` key="summary" value=`summary`* + **ev = > json.set map=`ev` key="summary" value=`summary`** 2. * - *_ = 1* -*events = > json.append list=`events` item=`ev`* + **_ = 1** +**events = > json.append list=`events` item=`ev`** 1. `stream` > sys.stream_publish event=`ev` 2. * - *_ = 1* + **_ = 1** -**events** +*events* ## plan_merge_deltas + `events` @@ -1437,17 +1437,17 @@ 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`) - *t = > json.get value=`ev` key="type"* + **t = > json.get value=`ev` key="type"** 1. `t` == delta - *events = > json.append list=`events` item=`ev`* + **events = > json.append list=`events` item=`ev`** 2. `t` == reasoning - *events = > json.append list=`events` item=`ev`* + **events = > json.append list=`events` item=`ev`** 3. `t` == error - *events = > json.append list=`events` item=`ev`* + **events = > json.append list=`events` item=`ev`** 4. * - *_ = 1* + **_ = 1** -**events** +*events* ## plan_finish_stream + `out` @@ -1458,25 +1458,25 @@ Bubble parent `complete stream=True` reasoning/deltas (and errors) into the plan Always append `done` and attach `events` on the result map (process audit even when not streaming). SSE publish of `done` only when `stream=True`. Optional `trace=True` writes the event list to writeback slot `trace`. -*ev = > json.parse text={"type":"done"}* +**ev = > json.parse text={"type":"done"}** 1. `result` - *ev = > json.set map=`ev` key="result" value=`result`* + **ev = > json.set map=`ev` key="result" value=`result`** 2. * - *_ = 1* -*events = > json.append list=`events` item=`ev`* + **_ = 1** +**events = > json.append list=`events` item=`ev`** 1. `stream` > sys.stream_publish event=`ev` 2. * - *_ = 1* -*out = > json.set map=`out` key="events" value=`events`* + **_ = 1** +**out = > json.set map=`out` key="events" value=`events`** 1. `trace` - *body = > json.stringify value=`events`* + **body = > json.stringify value=`events`** > wb.record value=`body` key="trace" 2. * - *_ = 1* + **_ = 1** -**out** +*out* --- @@ -1487,31 +1487,31 @@ Always append `done` and attach `events` on the result map (process audit even w Load ABI v2 agent plugin once (session bag + context queries). -*p = > plugin.native_path name="agent"* +**p = > plugin.native_path name="agent"** 1. `p` > plugin.load path=`p` 2. * > print text=ext/ai/agent: native agent plugin not found (build marqdo_plugin_agent or marqdo ext add agent) > sys.exit code=1 -*id = > agent_alloc* -*h = > json.parse text={"_type":"agent"}* -*h = > json.set map=`h` key="id" value=`id`* -*h = > json.set map=`h` key="model" value=`model`* -*h = > json.set map=`h` key="tools" value=`tools`* +**id = > agent_alloc** +**h = > json.parse text={"_type":"agent"}** +**h = > json.set map=`h` key="id" value=`id`** +**h = > json.set map=`h` key="model" value=`model`** +**h = > json.set map=`h` key="tools" value=`tools`** 1. `standing` - *h = > json.set map=`h` key="standing" value=`standing`* + **h = > json.set map=`h` key="standing" value=`standing`** 2. * - *_ = 1* + **_ = 1** -**h** +*h* ## clear_history Clear the plugin session bag for this agent id. -*id = > json.get value=`self` key="id"* +**id = > json.get value=`self` key="id"** > agent_history_clear id=`id` **** @@ -1522,106 +1522,106 @@ Clear the plugin session bag for this agent id. + `echo`=False + `max_reads`=2 -One atomic turn: budgeted context → LLM → optional `READ:` deepen → optional tool via subtask. Returns a **map** (`status`, `task`, `decision`, and on success `result` plus optional `tool` / `tool_result`; on failure `error`). By default (`writeback=True`) persists that map under named slots `ok` / `error` at the call site; pass `writeback=False` to skip. +One atomic turn: budgeted context → LLM → optional `READ:` deepen → optional tool via subtask. Returns a *map* (`status`, `task`, `decision`, and on success `result` plus optional `tool` / `tool_result`; on failure `error`). By default (`writeback=True`) persists that map under named slots `ok` / `error` at the call site; pass `writeback=False` to skip. With `stream=True`, the model call uses SSE; `echo=True` prints delta text to stdout as it arrives. The returned map is unchanged (final `result` string). Context source/skill start at default budget; up to `max_reads` of `READ:source` / `READ:skill` deepen before CALL/answer. -*id = > json.get value=`self` key="id"* -*model = > json.get value=`self` key="model"* -*tools = > json.get value=`self` key="tools"* +**id = > json.get value=`self` key="id"** +**model = > json.get value=`self` key="model"** +**tools = > json.get value=`self` key="tools"** -*user_turn = > json.parse text={"role":"user"}* -*user_turn = > json.set map=`user_turn` key="content" value=`task`* +**user_turn = > json.parse text={"role":"user"}** +**user_turn = > json.set map=`user_turn` key="content" value=`task`** > agent_history_append id=`id` item=`user_turn` -*source_depth = "default"* -*skill_depth = "default"* -*reads_left = max_reads* -*reply = None* -*decision = None* +**source_depth = "default"** +**skill_depth = "default"** +**reads_left = max_reads** +**reply = None** +**decision = None** - `reads_left` > 0 1. `decision` - *reads_left = 0* + **reads_left = 0** 2. * - *ctx = > build_step_context agent=`self` task=`task` source_depth=`source_depth` skill_depth=`skill_depth`* + **ctx = > build_step_context agent=`self` task=`task` source_depth=`source_depth` skill_depth=`skill_depth`** 1. `stream` - *evs = > model.complete prompt=`ctx` stream=True echo=`echo`* - *reply = > llm.stream_result events=`evs`* + **evs = > model.complete prompt=`ctx` stream=True echo=`echo`** + **reply = > llm.stream_result events=`evs`** 2. * - *reply = > model.complete prompt=`ctx`* - *reply = > trim value=`reply`* - *rk = > extract_plan_read reply=`reply`* + **reply = > model.complete prompt=`ctx`** + **reply = > trim value=`reply`** + **rk = > extract_plan_read reply=`reply`** 1. `rk` == source - *source_depth = "deep"* - *reads_left = reads_left - 1* + **source_depth = "deep"** + **reads_left = reads_left - 1** 2. `rk` == skill - *skill_depth = "deep"* - *reads_left = reads_left - 1* + **skill_depth = "deep"** + **reads_left = reads_left - 1** 3. * - *decision = reply* - *reads_left = 0* + **decision = reply** + **reads_left = 0** -*reply = > trim value=`reply`* -*decision = reply* -*tool_name = > extract_tool_name reply=`reply`* -*out = > json.parse text={"status":"ok"}* -*out = > json.set map=`out` key="task" value=`task`* -*out = > json.set map=`out` key="decision" value=`decision`* +**reply = > trim value=`reply`** +**decision = reply** +**tool_name = > extract_tool_name reply=`reply`** +**out = > json.parse text={"status":"ok"}** +**out = > json.set map=`out` key="task" value=`task`** +**out = > json.set map=`out` key="decision" value=`decision`** 1. `tool_name` - *tool_out = > run_tool tools=`tools` name=`tool_name`* - *tool_s = > json.stringify value=`tool_out`* - *deny = > split value=`tool_s` sep="Tool not allowed"* - *deny_n = > len value=`deny`* + **tool_out = > run_tool tools=`tools` name=`tool_name`** + **tool_s = > json.stringify value=`tool_out`** + **deny = > split value=`tool_s` sep="Tool not allowed"** + **deny_n = > len value=`deny`** 1. `deny_n` > 1 - *task_s = > json.stringify value=`task`* - *fp = "Tool CALL was rejected (not on the tools whitelist). Do NOT emit CALL. Answer the user task directly with the final answer only.\n\nUser task:\n"* - *fp = fp + task_s* + **task_s = > json.stringify value=`task`** + **fp = "Tool CALL was rejected (not on the tools whitelist). Do NOT emit CALL. Answer the user task directly with the final answer only.\n\nUser task:\n"** + **fp = fp + task_s** 1. `stream` - *evs_retry = > model.complete prompt=`fp` stream=True echo=`echo`* - *reply = > llm.stream_result events=`evs_retry`* + **evs_retry = > model.complete prompt=`fp` stream=True echo=`echo`** + **reply = > llm.stream_result events=`evs_retry`** 2. * - *reply = > model.complete prompt=`fp`* - *out = > json.set map=`out` key="status" value="ok"* - *out = > json.set map=`out` key="decision" value=`decision`* - *out = > json.set map=`out` key="denied_tool" value=`tool_name`* - *out = > json.set map=`out` key="result" value=`reply`* + **reply = > model.complete prompt=`fp`** + **out = > json.set map=`out` key="status" value="ok"** + **out = > json.set map=`out` key="decision" value=`decision`** + **out = > json.set map=`out` key="denied_tool" value=`tool_name`** + **out = > json.set map=`out` key="result" value=`reply`** 2. * - *task_s = > json.stringify value=`task`* - *fp = "The user asked:"* - *fp = fp + task_s* - *fp = fp + ". Tool"* - *fp = fp + tool_name* - *fp = fp + "ran via subtask and returned:"* - *fp = fp + tool_s* - *fp = fp + ". Reply to the user briefly."* + **task_s = > json.stringify value=`task`** + **fp = "The user asked:"** + **fp = fp + task_s** + **fp = fp + ". Tool"** + **fp = fp + tool_name** + **fp = fp + "ran via subtask and returned:"** + **fp = fp + tool_s** + **fp = fp + ". Reply to the user briefly."** 1. `stream` - *evs2 = > model.complete prompt=`fp` stream=True echo=`echo`* - *reply = > llm.stream_result events=`evs2`* + **evs2 = > model.complete prompt=`fp` stream=True echo=`echo`** + **reply = > llm.stream_result events=`evs2`** 2. * - *reply = > model.complete prompt=`fp`* - *out = > json.set map=`out` key="tool" value=`tool_name`* - *out = > json.set map=`out` key="tool_result" value=`tool_s`* - *out = > json.set map=`out` key="result" value=`reply`* + **reply = > model.complete prompt=`fp`** + **out = > json.set map=`out` key="tool" value=`tool_name`** + **out = > json.set map=`out` key="tool_result" value=`tool_s`** + **out = > json.set map=`out` key="result" value=`reply`** 2. * - *out = > json.set map=`out` key="result" value=`reply`* + **out = > json.set map=`out` key="result" value=`reply`** -*as_turn = > json.parse text={"role":"assistant"}* -*as_turn = > json.set map=`as_turn` key="content" value=`reply`* +**as_turn = > json.parse text={"role":"assistant"}** +**as_turn = > json.set map=`as_turn` key="content" value=`reply`** > agent_history_append id=`id` item=`as_turn` 1. `writeback` - *body = > json.stringify value=`out`* - *st = > json.get value=`out` key="status"* + **body = > json.stringify value=`out`** + **st = > json.get value=`out` key="status"** 1. `st` == "ok" > wb.record value=`body` key="ok" 2. * > wb.record value=`body` key="error" 2. * - *_ = 1* + **_ = 1** -**out** +*out* ## plan + `goal` @@ -1647,485 +1647,485 @@ With `stream=True`, the model call uses SSE; `echo=True` prints delta text to st Multi-step with OKF agent-kb. Default workbook is `kb_dir/resources/.mq.md`. While task file count `< explore_n` and skill is not llm_free, force a new explore variant under `kb_dir/explore//`. Code-first: llm_free hits skip parent LLM. File children return via `# main`; `plan` exposes that as `result`. -Reuse lookup: exact → alias → canonicalize → optional local n-gram `near` when `near_match=True` and score ≥ `near_threshold`. Non-hit path: optional `soft_match=True` parent REUSE/NEW over ranked `agent_kb_near_match` candidates; else **decompose** before first child spawn (`DECISION: RUN` / `CONTINUE`+patch / solidified `DONE`). Then `await` → revise loop. Process events (`decision` / `round` / `done` / tools) are **always** attached on the result map for audit and view process cards; `stream=True` additionally SSE-publishes them (and parent `delta`). `echo=True` prints `plan:decompose` / `plan:await` / deltas. `trace=True` writes events to writeback slot `trace`. Quiet child subtasks stay quiet. +Reuse lookup: exact → alias → canonicalize → optional local n-gram `near` when `near_match=True` and score ≥ `near_threshold`. Non-hit path: optional `soft_match=True` parent REUSE/NEW over ranked `agent_kb_near_match` candidates; else decompose before first child spawn (`DECISION: RUN` / `CONTINUE`+patch / solidified `DONE`). Then `await` → revise loop. Process events (`decision` / `round` / `done` / tools) are always attached on the result map for audit and view process cards; `stream=True` additionally SSE-publishes them (and parent `delta`). `echo=True` prints `plan:decompose` / `plan:await` / deltas. `trace=True` writes events to writeback slot `trace`. Quiet child subtasks stay quiet. -*tools = > json.get value=`self` key="tools"* -*cache = "miss"* -*path = None* -*improve = None* -*explore = None* -*explore_attempt = None* -*skel_kind = skeleton* -*events = > json.parse text=[]* +**tools = > json.get value=`self` key="tools"** +**cache = "miss"** +**path = None** +**improve = None** +**explore = None** +**explore_attempt = None** +**skel_kind = skeleton** +**events = > json.parse text=[]** -*tf = > agent_kb_task_files kb_dir=`kb_dir` goal=`goal` tools=`tools`* -*nfiles = > json.get value=`tf` key="count"* +**tf = > agent_kb_task_files kb_dir=`kb_dir` goal=`goal` tools=`tools`** +**nfiles = > json.get value=`tf` key="count"** 1. `force` - *_ = 1* + **_ = 1** 2. `optimize` - *_ = 1* + **_ = 1** 3. `reuse` - *hit = > agent_kb_lookup kb_dir=`kb_dir` goal=`goal` tools=`tools` near_match=`near_match` near_threshold=`near_threshold`* + **hit = > agent_kb_lookup kb_dir=`kb_dir` goal=`goal` tools=`tools` near_match=`near_match` near_threshold=`near_threshold`** 1. `hit` - *match_kind = > json.get value=`hit` key="match"* + **match_kind = > json.get value=`hit` key="match"** 1. `match_kind` == alias - *cache_label = "soft-hit"* + **cache_label = "soft-hit"** 2. `match_kind` == canonical - *cache_label = "soft-hit"* - *hit_slug = > json.get value=`hit` key="slug"* + **cache_label = "soft-hit"** + **hit_slug = > json.get value=`hit` key="slug"** > agent_kb_add_alias kb_dir=`kb_dir` slug=`hit_slug` alias=`goal` 3. `match_kind` == near - *cache_label = "soft-hit"* - *hit_slug = > json.get value=`hit` key="slug"* + **cache_label = "soft-hit"** + **hit_slug = > json.get value=`hit` key="slug"** > agent_kb_add_alias kb_dir=`kb_dir` slug=`hit_slug` alias=`goal` 4. `match_kind` == soft - *cache_label = "soft-hit"* + **cache_label = "soft-hit"** 5. * - *cache_label = "hit"* - *lf = > json.get value=`hit` key="llm_free"* + **cache_label = "hit"** + **lf = > json.get value=`hit` key="llm_free"** 1. `lf` - *path = > json.get value=`hit` key="resource"* - *aw = > await_workbook path=`path`* - *code = > json.get value=`aw` key="code"* - *child_val = > json.get value=`aw` key="value"* - *last_obs = > json.get value=`aw` key="observation"* + **path = > json.get value=`hit` key="resource"** + **aw = > await_workbook path=`path`** + **code = > json.get value=`aw` key="code"** + **child_val = > json.get value=`aw` key="value"** + **last_obs = > json.get value=`aw` key="observation"** 1. `code` == 0 > agent_kb_record_hit kb_dir=`kb_dir` goal=`goal` tools=`tools` improve_every=`improve_every` - *cache = cache_label* - *out = > json.parse text={"status":"ok"}* - *out = > json.set map=`out` key="status" value="ok"* - *out = > json.set map=`out` key="goal" value=`goal`* - *out = > json.set map=`out` key="workbook" value=`path`* - *out = > json.set map=`out` key="rounds" value=1* - *out = > json.set map=`out` key="cache" value=`cache_label`* - *out = > json.set map=`out` key="match" value=`match_kind`* - *hit_score = > json.get value=`hit` key="score"* + **cache = cache_label** + **out = > json.parse text={"status":"ok"}** + **out = > json.set map=`out` key="status" value="ok"** + **out = > json.set map=`out` key="goal" value=`goal`** + **out = > json.set map=`out` key="workbook" value=`path`** + **out = > json.set map=`out` key="rounds" value=1** + **out = > json.set map=`out` key="cache" value=`cache_label`** + **out = > json.set map=`out` key="match" value=`match_kind`** + **hit_score = > json.get value=`hit` key="score"** 1. `hit_score` - *out = > json.set map=`out` key="score" value=`hit_score`* + **out = > json.set map=`out` key="score" value=`hit_score`** 2. * - *_ = 1* - *sk = > json.get value=`hit` key="skill"* - *out = > json.set map=`out` key="skill" value=`sk`* - *st = > json.get value=`hit` key="status"* - *out = > json.set map=`out` key="skill_status" value=`st`* - *sum = > json.parse text={"a":"OKF llm_free skill hit (","b":"); spawned resource"}* - *suma = > json.get value=`sum` key="a"* - *sumb = > json.get value=`sum` key="b"* - *sum = suma + match_kind + sumb* - *out = > json.set map=`out` key="summary" value=`sum`* - *out = > json.set map=`out` key="observation" value=`last_obs`* - *out = > json.set map=`out` key="result" value=`child_val`* - *events = > plan_append_decision events=`events` decision="REUSE" stream=`stream` summary=`sum`* - *events = > plan_append_round events=`events` round=1 workbook=`path` exit_code=`code` result=`child_val` stream=`stream` echo=`echo`* + **_ = 1** + **sk = > json.get value=`hit` key="skill"** + **out = > json.set map=`out` key="skill" value=`sk`** + **st = > json.get value=`hit` key="status"** + **out = > json.set map=`out` key="skill_status" value=`st`** + **sum = > json.parse text={"a":"OKF llm_free skill hit (","b":"); spawned resource"}** + **suma = > json.get value=`sum` key="a"** + **sumb = > json.get value=`sum` key="b"** + **sum = suma + match_kind + sumb** + **out = > json.set map=`out` key="summary" value=`sum`** + **out = > json.set map=`out` key="observation" value=`last_obs`** + **out = > json.set map=`out` key="result" value=`child_val`** + **events = > plan_append_decision events=`events` decision="REUSE" stream=`stream` summary=`sum`** + **events = > plan_append_round events=`events` round=1 workbook=`path` exit_code=`code` result=`child_val` stream=`stream` echo=`echo`** 1. `writeback` - *body = > json.stringify value=`out`* + **body = > json.stringify value=`out`** > wb.record value=`body` key="ok" 2. * - *_ = 1* - *out = > plan_finish_stream out=`out` events=`events` stream=`stream` trace=`trace` result=`child_val`* - **out** + **_ = 1** + **out = > plan_finish_stream out=`out` events=`events` stream=`stream` trace=`trace` result=`child_val`** + *out* 2. * - *path = None* + **path = None** 2. `nfiles` < `explore_n` - *explore = 1* - *cache = "explore"* - *path = None* - *explore_attempt = nfiles + 1* + **explore = 1** + **cache = "explore"** + **path = None** + **explore_attempt = nfiles + 1** 1. `explore_attempt` == 2 - *skel_kind = "dual"* + **skel_kind = "dual"** 2. * - *skel_kind = skeleton* + **skel_kind = skeleton** 3. * - *path = > json.get value=`hit` key="resource"* - *aw = > await_workbook path=`path`* - *code = > json.get value=`aw` key="code"* - *child_val = > json.get value=`aw` key="value"* - *last_obs = > json.get value=`aw` key="observation"* + **path = > json.get value=`hit` key="resource"** + **aw = > await_workbook path=`path`** + **code = > json.get value=`aw` key="code"** + **child_val = > json.get value=`aw` key="value"** + **last_obs = > json.get value=`aw` key="observation"** 1. `code` == 0 - *rec = > agent_kb_record_hit kb_dir=`kb_dir` goal=`goal` tools=`tools` improve_every=`improve_every`* - *due = > json.get value=`rec` key="improve_due"* + **rec = > agent_kb_record_hit kb_dir=`kb_dir` goal=`goal` tools=`tools` improve_every=`improve_every`** + **due = > json.get value=`rec` key="improve_due"** 1. `due` - *improve = 1* - *cache = "improve"* + **improve = 1** + **cache = "improve"** 2. * - *cache = cache_label* - *out = > json.parse text={"status":"ok"}* - *out = > json.set map=`out` key="status" value="ok"* - *out = > json.set map=`out` key="goal" value=`goal`* - *out = > json.set map=`out` key="workbook" value=`path`* - *out = > json.set map=`out` key="rounds" value=1* - *out = > json.set map=`out` key="cache" value=`cache_label`* - *out = > json.set map=`out` key="match" value=`match_kind`* - *hit_score = > json.get value=`hit` key="score"* + **cache = cache_label** + **out = > json.parse text={"status":"ok"}** + **out = > json.set map=`out` key="status" value="ok"** + **out = > json.set map=`out` key="goal" value=`goal`** + **out = > json.set map=`out` key="workbook" value=`path`** + **out = > json.set map=`out` key="rounds" value=1** + **out = > json.set map=`out` key="cache" value=`cache_label`** + **out = > json.set map=`out` key="match" value=`match_kind`** + **hit_score = > json.get value=`hit` key="score"** 1. `hit_score` - *out = > json.set map=`out` key="score" value=`hit_score`* + **out = > json.set map=`out` key="score" value=`hit_score`** 2. * - *_ = 1* - *sk = > json.get value=`hit` key="skill"* - *out = > json.set map=`out` key="skill" value=`sk`* - *st = > json.get value=`hit` key="status"* - *out = > json.set map=`out` key="skill_status" value=`st`* - *sum = > json.parse text={"a":"OKF skill hit (","b":"); spawned resource"}* - *suma = > json.get value=`sum` key="a"* - *sumb = > json.get value=`sum` key="b"* - *sum = suma + match_kind + sumb* - *out = > json.set map=`out` key="summary" value=`sum`* - *out = > json.set map=`out` key="observation" value=`last_obs`* - *out = > json.set map=`out` key="result" value=`child_val`* - *events = > plan_append_decision events=`events` decision="REUSE" stream=`stream` summary=`sum`* - *events = > plan_append_round events=`events` round=1 workbook=`path` exit_code=`code` result=`child_val` stream=`stream` echo=`echo`* + **_ = 1** + **sk = > json.get value=`hit` key="skill"** + **out = > json.set map=`out` key="skill" value=`sk`** + **st = > json.get value=`hit` key="status"** + **out = > json.set map=`out` key="skill_status" value=`st`** + **sum = > json.parse text={"a":"OKF skill hit (","b":"); spawned resource"}** + **suma = > json.get value=`sum` key="a"** + **sumb = > json.get value=`sum` key="b"** + **sum = suma + match_kind + sumb** + **out = > json.set map=`out` key="summary" value=`sum`** + **out = > json.set map=`out` key="observation" value=`last_obs`** + **out = > json.set map=`out` key="result" value=`child_val`** + **events = > plan_append_decision events=`events` decision="REUSE" stream=`stream` summary=`sum`** + **events = > plan_append_round events=`events` round=1 workbook=`path` exit_code=`code` result=`child_val` stream=`stream` echo=`echo`** 1. `writeback` - *body = > json.stringify value=`out`* + **body = > json.stringify value=`out`** > wb.record value=`body` key="ok" 2. * - *_ = 1* - *out = > plan_finish_stream out=`out` events=`events` stream=`stream` trace=`trace` result=`child_val`* - **out** + **_ = 1** + **out = > plan_finish_stream out=`out` events=`events` stream=`stream` trace=`trace` result=`child_val`** + *out* 2. * - *path = None* + **path = None** 2. * 1. `soft_match` - *near = > agent_kb_near_match kb_dir=`kb_dir` goal=`goal`* - *tasks = > json.get value=`near` key="candidates"* - *tn = > len value=`tasks`* + **near = > agent_kb_near_match kb_dir=`kb_dir` goal=`goal`** + **tasks = > json.get value=`near` key="candidates"** + **tn = > len value=`tasks`** 1. `tn` < 1 - *listed = > agent_kb_list_tasks kb_dir=`kb_dir`* - *tasks = > json.get value=`listed` key="tasks"* - *tn = > len value=`tasks`* + **listed = > agent_kb_list_tasks kb_dir=`kb_dir`** + **tasks = > json.get value=`listed` key="tasks"** + **tn = > len value=`tasks`** 2. * - *_ = 1* + **_ = 1** 1. `tn` > 0 - *soft_prompt = > build_soft_match_prompt goal=`goal` tasks=`tasks`* - *model = > json.get value=`self` key="model"* + **soft_prompt = > build_soft_match_prompt goal=`goal` tasks=`tasks`** + **model = > json.get value=`self` key="model"** 1. `stream` - *evs = > model.complete prompt=`soft_prompt` stream=True echo=`echo`* - *soft_reply = > llm.stream_result events=`evs`* - *events = > plan_merge_deltas events=`events` from=`evs` stream=`stream`* + **evs = > model.complete prompt=`soft_prompt` stream=True echo=`echo`** + **soft_reply = > llm.stream_result events=`evs`** + **events = > plan_merge_deltas events=`events` from=`evs` stream=`stream`** 2. * - *soft_reply = > model.complete prompt=`soft_prompt`* - *soft_reply = > trim value=`soft_reply`* - *soft_dec = > extract_plan_decision reply=`soft_reply`* - *events = > plan_append_decision events=`events` decision=`soft_dec` stream=`stream`* + **soft_reply = > model.complete prompt=`soft_prompt`** + **soft_reply = > trim value=`soft_reply`** + **soft_dec = > extract_plan_decision reply=`soft_reply`** + **events = > plan_append_decision events=`events` decision=`soft_dec` stream=`stream`** 1. `soft_dec` == REUSE - *reuse_slug = > extract_soft_match_slug reply=`soft_reply`* + **reuse_slug = > extract_soft_match_slug reply=`soft_reply`** 1. `reuse_slug` - *hit = > agent_kb_lookup kb_dir=`kb_dir` slug=`reuse_slug` goal=`goal` tools=`tools`* + **hit = > agent_kb_lookup kb_dir=`kb_dir` slug=`reuse_slug` goal=`goal` tools=`tools`** 1. `hit` > agent_kb_add_alias kb_dir=`kb_dir` slug=`reuse_slug` alias=`goal` - *cache_label = "soft-hit"* - *path = > json.get value=`hit` key="resource"* - *aw = > await_workbook path=`path`* - *code = > json.get value=`aw` key="code"* - *child_val = > json.get value=`aw` key="value"* - *last_obs = > json.get value=`aw` key="observation"* + **cache_label = "soft-hit"** + **path = > json.get value=`hit` key="resource"** + **aw = > await_workbook path=`path`** + **code = > json.get value=`aw` key="code"** + **child_val = > json.get value=`aw` key="value"** + **last_obs = > json.get value=`aw` key="observation"** 1. `code` == 0 > agent_kb_record_hit kb_dir=`kb_dir` goal=`goal` tools=`tools` improve_every=`improve_every` - *cache = "soft-hit"* - *out = > json.parse text={"status":"ok"}* - *out = > json.set map=`out` key="status" value="ok"* - *out = > json.set map=`out` key="goal" value=`goal`* - *out = > json.set map=`out` key="workbook" value=`path`* - *out = > json.set map=`out` key="rounds" value=1* - *out = > json.set map=`out` key="cache" value="soft-hit"* - *out = > json.set map=`out` key="match" value="soft"* - *sk = > json.get value=`hit` key="skill"* - *out = > json.set map=`out` key="skill" value=`sk`* - *st = > json.get value=`hit` key="status"* - *out = > json.set map=`out` key="skill_status" value=`st`* - *sum = "OKF soft_match REUSE; spawned resource"* - *out = > json.set map=`out` key="summary" value=`sum`* - *out = > json.set map=`out` key="observation" value=`last_obs`* - *out = > json.set map=`out` key="result" value=`child_val`* - *events = > plan_append_decision events=`events` decision="REUSE" stream=`stream` summary=`sum`* - *events = > plan_append_round events=`events` round=1 workbook=`path` exit_code=`code` result=`child_val` stream=`stream` echo=`echo`* + **cache = "soft-hit"** + **out = > json.parse text={"status":"ok"}** + **out = > json.set map=`out` key="status" value="ok"** + **out = > json.set map=`out` key="goal" value=`goal`** + **out = > json.set map=`out` key="workbook" value=`path`** + **out = > json.set map=`out` key="rounds" value=1** + **out = > json.set map=`out` key="cache" value="soft-hit"** + **out = > json.set map=`out` key="match" value="soft"** + **sk = > json.get value=`hit` key="skill"** + **out = > json.set map=`out` key="skill" value=`sk`** + **st = > json.get value=`hit` key="status"** + **out = > json.set map=`out` key="skill_status" value=`st`** + **sum = "OKF soft_match REUSE; spawned resource"** + **out = > json.set map=`out` key="summary" value=`sum`** + **out = > json.set map=`out` key="observation" value=`last_obs`** + **out = > json.set map=`out` key="result" value=`child_val`** + **events = > plan_append_decision events=`events` decision="REUSE" stream=`stream` summary=`sum`** + **events = > plan_append_round events=`events` round=1 workbook=`path` exit_code=`code` result=`child_val` stream=`stream` echo=`echo`** 1. `writeback` - *body = > json.stringify value=`out`* + **body = > json.stringify value=`out`** > wb.record value=`body` key="ok" 2. * - *_ = 1* - *out = > plan_finish_stream out=`out` events=`events` stream=`stream` trace=`trace` result=`child_val`* - **out** + **_ = 1** + **out = > plan_finish_stream out=`out` events=`events` stream=`stream` trace=`trace` result=`child_val`** + *out* 2. * - *path = None* + **path = None** 2. * - *_ = 1* + **_ = 1** 2. * - *_ = 1* + **_ = 1** 2. * - *_ = 1* + **_ = 1** 2. * - *_ = 1* + **_ = 1** 2. * - *_ = 1* + **_ = 1** 1. `nfiles` < `explore_n` - *explore = 1* - *cache = "explore"* - *explore_attempt = nfiles + 1* + **explore = 1** + **cache = "explore"** + **explore_attempt = nfiles + 1** 1. `explore_attempt` == 2 - *skel_kind = "dual"* + **skel_kind = "dual"** 2. * - *skel_kind = skeleton* + **skel_kind = skeleton** 2. * - *_ = 1* + **_ = 1** 4. * 1. `nfiles` < `explore_n` - *explore = 1* - *cache = "explore"* - *explore_attempt = nfiles + 1* + **explore = 1** + **cache = "explore"** + **explore_attempt = nfiles + 1** 2. * - *_ = 1* + **_ = 1** -*skel = > render_workbook_skeleton goal=`goal` skeleton=`skel_kind`* +**skel = > render_workbook_skeleton goal=`goal` skeleton=`skel_kind`** 1. `workbook` - *path = workbook* - *ex = > fs.exists path=`path`* + **path = workbook** + **ex = > fs.exists path=`path`** 1. `ex` - *_ = 1* + **_ = 1** 2. * > fs.write_text path=`path` text=`skel` 2. * 1. `path` - *_ = 1* + **_ = 1** 2. * - *slug = > agent_goal_slug goal=`goal`* + **slug = > agent_goal_slug goal=`goal`** 1. `workbook_dir` > fs.make_dir path=`workbook_dir` - *ts = > time.now_ms* - *parts = > json.parse text={"a":"/workbook-","b":"-","c":".mq.md"}* - *a = > json.get value=`parts` key="a"* - *b = > json.get value=`parts` key="b"* - *c = > json.get value=`parts` key="c"* - *path = workbook_dir + a + slug + b + ts + c* + **ts = > time.now_ms** + **parts = > json.parse text={"a":"/workbook-","b":"-","c":".mq.md"}** + **a = > json.get value=`parts` key="a"** + **b = > json.get value=`parts` key="b"** + **c = > json.get value=`parts` key="c"** + **path = workbook_dir + a + slug + b + ts + c** 2. `explore` - *parts = > json.parse text={"a":"/explore/","b":"/","c":".mq.md"}* - *a = > json.get value=`parts` key="a"* - *b = > json.get value=`parts` key="b"* - *c = > json.get value=`parts` key="c"* - *path = kb_dir + a + slug + b + explore_attempt + c* + **parts = > json.parse text={"a":"/explore/","b":"/","c":".mq.md"}** + **a = > json.get value=`parts` key="a"** + **b = > json.get value=`parts` key="b"** + **c = > json.get value=`parts` key="c"** + **path = kb_dir + a + slug + b + explore_attempt + c** 3. * - *parts = > json.parse text={"a":"/resources/","b":".mq.md"}* - *a = > json.get value=`parts` key="a"* - *b = > json.get value=`parts` key="b"* - *path = kb_dir + a + slug + b* + **parts = > json.parse text={"a":"/resources/","b":".mq.md"}** + **a = > json.get value=`parts` key="a"** + **b = > json.get value=`parts` key="b"** + **path = kb_dir + a + slug + b** > fs.write_text path=`path` text=`skel` 1. `confirm` - *out = > json.parse text={"status":"pending"}* - *out = > json.set map=`out` key="goal" value=`goal`* - *out = > json.set map=`out` key="workbook" value=`path`* - *out = > json.set map=`out` key="summary" value="workbook created; confirm to run"* - *out = > json.set map=`out` key="cache" value="bypass"* + **out = > json.parse text={"status":"pending"}** + **out = > json.set map=`out` key="goal" value=`goal`** + **out = > json.set map=`out` key="workbook" value=`path`** + **out = > json.set map=`out` key="summary" value="workbook created; confirm to run"** + **out = > json.set map=`out` key="cache" value="bypass"** 1. `writeback` - *body = > json.stringify value=`out`* + **body = > json.stringify value=`out`** > wb.record value=`body` key="ok" 2. * - *_ = 1* - *out = > plan_finish_stream out=`out` events=`events` stream=`stream` trace=`trace`* - **out** + **_ = 1** + **out = > plan_finish_stream out=`out` events=`events` stream=`stream` trace=`trace`** + *out* 2. * - *_ = 1* + **_ = 1** -*model = > json.get value=`self` key="model"* -*round = 0* -*last_obs = None* -*last_reply = None* -*child_val = None* -*done = None* -*summary = None* -*status = "error"* -*err = "max_rounds exhausted"* -*skip_loop = None* +**model = > json.get value=`self` key="model"** +**round = 0** +**last_obs = None** +**last_reply = None** +**child_val = None** +**done = None** +**summary = None** +**status = "error"** +**err = "max_rounds exhausted"** +**skip_loop = None** > plan_echo_decompose workbook=`path` stream=`stream` echo=`echo` -*last_obs = > inspect_workbook path=`path`* -*turn = > plan_llm_act_loop agent=`self` goal=`goal` path=`path` observation=`last_obs` phase="decompose" explore_attempt=`explore_attempt` explore_n=`explore_n` stream=`stream` echo=`echo` events=`events`* -*dec = > json.get value=`turn` key="decision"* -*last_reply = > json.get value=`turn` key="reply"* -*last_obs = > json.get value=`turn` key="observation"* -*events = > json.get value=`turn` key="events"* +**last_obs = > inspect_workbook path=`path`** +**turn = > plan_llm_act_loop agent=`self` goal=`goal` path=`path` observation=`last_obs` phase="decompose" explore_attempt=`explore_attempt` explore_n=`explore_n` stream=`stream` echo=`echo` events=`events`** +**dec = > json.get value=`turn` key="decision"** +**last_reply = > json.get value=`turn` key="reply"** +**last_obs = > json.get value=`turn` key="observation"** +**events = > json.get value=`turn` key="events"** 1. `dec` == CONTINUE - *n = > fs.apply_patch_blocks path=`path` text=`last_reply` soft=True* + **n = > fs.apply_patch_blocks path=`path` text=`last_reply` soft=True** 1. `n` - *_ = 1* + **_ = 1** 2. * - *done = 1* - *status = "error"* - *err = "no patches applied"* - *summary = > extract_plan_summary reply=`last_reply`* - *skip_loop = 1* + **done = 1** + **status = "error"** + **err = "no patches applied"** + **summary = > extract_plan_summary reply=`last_reply`** + **skip_loop = 1** 2. `dec` == RUN - *_ = 1* + **_ = 1** 3. `dec` == DONE - *has_step = > workbook_has_worker_step path=`path`* + **has_step = > workbook_has_worker_step path=`path`** 1. `has_step` - *_ = 1* + **_ = 1** 2. * > plan_echo_await round=1 workbook=`path` stream=`stream` echo=`echo` - *aw = > await_workbook path=`path`* - *code = > json.get value=`aw` key="code"* - *child_val = > json.get value=`aw` key="value"* - *last_obs = > json.get value=`aw` key="observation"* - *round = 1* - *events = > plan_append_round events=`events` round=1 workbook=`path` exit_code=`code` result=`child_val` stream=`stream` echo=`echo`* + **aw = > await_workbook path=`path`** + **code = > json.get value=`aw` key="code"** + **child_val = > json.get value=`aw` key="value"** + **last_obs = > json.get value=`aw` key="observation"** + **round = 1** + **events = > plan_append_round events=`events` round=1 workbook=`path` exit_code=`code` result=`child_val` stream=`stream` echo=`echo`** 1. `code` == 0 - *done = 1* - *status = "ok"* - *summary = > extract_plan_summary reply=`last_reply`* - *err = None* - *skip_loop = 1* + **done = 1** + **status = "ok"** + **summary = > extract_plan_summary reply=`last_reply`** + **err = None** + **skip_loop = 1** 2. * - *_ = 1* + **_ = 1** 4. * - *done = 1* - *status = "error"* - *err = "unrecognized plan decision"* - *summary = last_reply* - *skip_loop = 1* + **done = 1** + **status = "error"** + **err = "unrecognized plan decision"** + **summary = last_reply** + **skip_loop = 1** 1. `skip_loop` - *left = 0* + **left = 0** 2. `improve` - *left = 1* + **left = 1** 3. * - *left = max_rounds* + **left = max_rounds** - `left` > 0 1. `done` - *left = 0* + **left = 0** 2. * - *round = round + 1* + **round = round + 1** > plan_echo_await round=`round` workbook=`path` stream=`stream` echo=`echo` - *aw = > await_workbook path=`path`* - *code = > json.get value=`aw` key="code"* - *child_val = > json.get value=`aw` key="value"* - *last_obs = > json.get value=`aw` key="observation"* - *events = > plan_append_round events=`events` round=`round` workbook=`path` exit_code=`code` result=`child_val` stream=`stream` echo=`echo`* + **aw = > await_workbook path=`path`** + **code = > json.get value=`aw` key="code"** + **child_val = > json.get value=`aw` key="value"** + **last_obs = > json.get value=`aw` key="observation"** + **events = > plan_append_round events=`events` round=`round` workbook=`path` exit_code=`code` result=`child_val` stream=`stream` echo=`echo`** Deterministic success stop (loop engineering): when the child already returned a value, do not ask the parent LLM to invent solidify patches — DONE + runtime solidify. 1. `code` == 0 1. `child_val` 1. `improve` - *auto_done = None* + **auto_done = None** 2. * - *auto_done = 1* + **auto_done = 1** 2. * - *auto_done = None* + **auto_done = None** 2. * - *auto_done = None* + **auto_done = None** 1. `auto_done` > agent_workbook_solidify path=`path` observation=`last_obs` - *done = 1* - *status = "ok"* - *summary = "child returned value; solidified"* - *err = None* - *dec = "DONE"* - *events = > plan_append_decision events=`events` decision=`dec` stream=`stream` summary=`summary`* - *left = 0* + **done = 1** + **status = "ok"** + **summary = "child returned value; solidified"** + **err = None** + **dec = "DONE"** + **events = > plan_append_decision events=`events` decision=`dec` stream=`stream` summary=`summary`** + **left = 0** 2. * - *turn = > plan_llm_act_loop agent=`self` goal=`goal` path=`path` observation=`last_obs` phase="revise" explore_attempt=`explore_attempt` explore_n=`explore_n` stream=`stream` echo=`echo` events=`events`* - *dec = > json.get value=`turn` key="decision"* - *last_reply = > json.get value=`turn` key="reply"* - *last_obs = > json.get value=`turn` key="observation"* - *events = > json.get value=`turn` key="events"* + **turn = > plan_llm_act_loop agent=`self` goal=`goal` path=`path` observation=`last_obs` phase="revise" explore_attempt=`explore_attempt` explore_n=`explore_n` stream=`stream` echo=`echo` events=`events`** + **dec = > json.get value=`turn` key="decision"** + **last_reply = > json.get value=`turn` key="reply"** + **last_obs = > json.get value=`turn` key="observation"** + **events = > json.get value=`turn` key="events"** 1. `dec` == DONE > agent_workbook_solidify path=`path` observation=`last_obs` - *done = 1* - *status = "ok"* - *summary = > extract_plan_summary reply=`last_reply`* - *err = None* - *left = 0* + **done = 1** + **status = "ok"** + **summary = > extract_plan_summary reply=`last_reply`** + **err = None** + **left = 0** 2. `dec` == CONTINUE - *n = > fs.apply_patch_blocks path=`path` text=`last_reply` soft=True* + **n = > fs.apply_patch_blocks path=`path` text=`last_reply` soft=True** 1. `n` - *left = left - 1* + **left = left - 1** 2. * - *done = 1* - *status = "error"* - *err = "no patches applied"* - *summary = > extract_plan_summary reply=`last_reply`* - *left = 0* + **done = 1** + **status = "error"** + **err = "no patches applied"** + **summary = > extract_plan_summary reply=`last_reply`** + **left = 0** 3. `dec` == RUN - *left = left - 1* + **left = left - 1** 4. * - *done = 1* - *status = "error"* - *err = "unrecognized plan decision"* - *summary = last_reply* - *left = 0* + **done = 1** + **status = "error"** + **err = "unrecognized plan decision"** + **summary = last_reply** + **left = 0** 1. `status` == "ok" 1. `promote` - *prom = > agent_kb_promote kb_dir=`kb_dir` goal=`goal` workbook=`path` tools=`tools`* - *cache = "refreshed"* + **prom = > agent_kb_promote kb_dir=`kb_dir` goal=`goal` workbook=`path` tools=`tools`** + **cache = "refreshed"** 2. * - *cache = "miss"* + **cache = "miss"** 2. * - *_ = 1* + **_ = 1** -*out = > json.parse text={"status":"ok"}* -*out = > json.set map=`out` key="status" value=`status`* -*out = > json.set map=`out` key="goal" value=`goal`* -*out = > json.set map=`out` key="workbook" value=`path`* -*out = > json.set map=`out` key="rounds" value=`round`* -*out = > json.set map=`out` key="cache" value=`cache`* +**out = > json.parse text={"status":"ok"}** +**out = > json.set map=`out` key="status" value=`status`** +**out = > json.set map=`out` key="goal" value=`goal`** +**out = > json.set map=`out` key="workbook" value=`path`** +**out = > json.set map=`out` key="rounds" value=`round`** +**out = > json.set map=`out` key="cache" value=`cache`** 1. `summary` - *out = > json.set map=`out` key="summary" value=`summary`* + **out = > json.set map=`out` key="summary" value=`summary`** 2. * - *_ = 1* + **_ = 1** 1. `err` - *out = > json.set map=`out` key="error" value=`err`* + **out = > json.set map=`out` key="error" value=`err`** 2. * - *_ = 1* + **_ = 1** 1. `last_obs` - *out = > json.set map=`out` key="observation" value=`last_obs`* + **out = > json.set map=`out` key="observation" value=`last_obs`** 2. * - *_ = 1* + **_ = 1** 1. `child_val` - *out = > json.set map=`out` key="result" value=`child_val`* - *plan_result = child_val* + **out = > json.set map=`out` key="result" value=`child_val`** + **plan_result = child_val** 2. `summary` - *out = > json.set map=`out` key="result" value=`summary`* - *plan_result = summary* + **out = > json.set map=`out` key="result" value=`summary`** + **plan_result = summary** 3. * - *plan_result = None* + **plan_result = None** 1. `writeback` - *body = > json.stringify value=`out`* + **body = > json.stringify value=`out`** 1. `status` == "ok" > wb.record value=`body` key="ok" 2. * > wb.record value=`body` key="error" 2. * - *_ = 1* + **_ = 1** -*out = > plan_finish_stream out=`out` events=`events` stream=`stream` trace=`trace` result=`plan_result`* -**out** +**out = > plan_finish_stream out=`out` events=`events` stream=`stream` trace=`trace` result=`plan_result`** +*out* --- # mcp_server + `name`=marqdo -Minimal MCP **Server** host (stdio JSON-RPC). Tools point at entry-module `lib.member` functions (same bridge as `ext/web` invoke). Evidence/results may carry `authority=workbook`. +Minimal MCP Server host (stdio JSON-RPC). Tools point at entry-module `lib.member` functions (same bridge as `ext/web` invoke). Evidence/results may carry `authority=workbook`. -*p = > plugin.native_path name="agent"* +**p = > plugin.native_path name="agent"** 1. `p` > plugin.load path=`p` 2. * > print text=ext/ai/agent: native agent plugin not found (build marqdo_plugin_agent or marqdo ext add agent) > sys.exit code=1 -*h = > json.parse text={"_type":"mcp_server","tools":[]}* -*h = > json.set map=`h` key="name" value=`name`* -**h** +**h = > json.parse text={"_type":"mcp_server","tools":[]}** +**h = > json.set map=`h` key="name" value=`name`** +*h* ## tool + `name` @@ -2134,20 +2134,20 @@ Minimal MCP **Server** host (stdio JSON-RPC). Tools point at entry-module `lib.m Register one tool. `fn` must be `lib.member` imported on the entry workbook. -*tools = > json.get value=`self` key="tools"* -*row = > json.parse text={"name":"","fn":"","description":""}* -*row = > json.set map=`row` key="name" value=`name`* -*row = > json.set map=`row` key="fn" value=`fn`* -*row = > json.set map=`row` key="description" value=`description`* -*tools = > json.append list=`tools` item=`row`* -*h = > json.set map=`self` key="tools" value=`tools`* -**h** +**tools = > json.get value=`self` key="tools"** +**row = > json.parse text={"name":"","fn":"","description":""}** +**row = > json.set map=`row` key="name" value=`name`** +**row = > json.set map=`row` key="fn" value=`fn`** +**row = > json.set map=`row` key="description" value=`description`** +**tools = > json.append list=`tools` item=`row`** +**h = > json.set map=`self` key="tools" value=`tools`** +*h* ## serve + `transport`=stdio Block on stdio MCP (`initialize` / `tools/list` / `tools/call`). HTTP transport is H4b. -*name = > json.get value=`self` key="name"* -*tools = > json.get value=`self` key="tools"* -**> agent_mcp_serve name=`name` tools=`tools` transport=`transport`** +**name = > json.get value=`self` key="name"** +**tools = > json.get value=`self` key="tools"** +*> agent_mcp_serve name=`name` tools=`tools` transport=`transport`* diff --git a/ext/ai/llm.mq.md b/ext/ai/llm.mq.md index 214a8b1..79a8a67 100644 --- a/ext/ai/llm.mq.md +++ b/ext/ai/llm.mq.md @@ -12,50 +12,50 @@ import table:lib/table.mq.md Load `.env` from cwd (optional named arg `path=`). Does not override existing variables. -**> sys.load_dotenv path=`path`** +*> sys.load_dotenv path=`path`* ## stream_result + `events` Reduce a `complete stream=True` event list to the final `done.result` text (or `error.message`). Unknown types (e.g. `reasoning`) are ignored. -*answer = ""* +**answer = ""** - [ev](events) - *t = ev[^type]* + **t = ev[^type]** 1. `t` == "done" - *answer = ev[^result]* + **answer = ev[^result]** 2. `t` == "error" - *answer = ev[^message]* + **answer = ev[^message]** 3. `t` == "delta" 4. * - *_ = 1* + **_ = 1** -**answer** +*answer* # llm Construct an LLM handle from `OPENAI_*` / `MARQDO_LLM_*`. -*api_key = > sys.env_get name="OPENAI_API_KEY"* +**api_key = > sys.env_get name="OPENAI_API_KEY"** 1. not `api_key` - *api_key = > sys.env_get name="MARQDO_LLM_API_KEY"* + **api_key = > sys.env_get name="MARQDO_LLM_API_KEY"** 1. not `api_key` > print text=ext/ai/llm: set OPENAI_API_KEY or MARQDO_LLM_API_KEY > sys.exit code=1 -*base_url = > sys.env_get name="OPENAI_BASE_URL"* +**base_url = > sys.env_get name="OPENAI_BASE_URL"** 1. not `base_url` - *base_url = > sys.env_get name="MARQDO_LLM_BASE_URL"* + **base_url = > sys.env_get name="MARQDO_LLM_BASE_URL"** 1. not `base_url` - *base_url = "https://api.openai.com/v1"* + **base_url = "https://api.openai.com/v1"** -*model = > sys.env_get name="OPENAI_MODEL"* +**model = > sys.env_get name="OPENAI_MODEL"** 1. not `model` - *model = > sys.env_get name="MARQDO_LLM_MODEL"* + **model = > sys.env_get name="MARQDO_LLM_MODEL"** 1. not `model` - *model = "gpt-4o-mini"* + **model = "gpt-4o-mini"** `h` = @@ -63,7 +63,7 @@ Construct an LLM handle from `OPENAI_*` / `MARQDO_LLM_*`. |---------|----------|-------|--------|--------| | `api_key` | `base_url` | `model` | /chat/completions | "Bearer " | -**h** +*h* ## complete + `prompt` @@ -74,9 +74,9 @@ Chat completion using `self` handle fields. Wire body is `{model, messages:[{role,content}], stream?}`. Messages are an `@` row table; headers and optional `stream` use `table.put`. `json` is only for stringify/parse. -*url = self[^base_url] + self[^suffix]* -*auth = self[^bearer] + self[^api_key]* -*headers = > table.put in=None at="Authorization" value=`auth`* +**url = self[^base_url] + self[^suffix]** +**auth = self[^bearer] + self[^api_key]** +**headers = > table.put in=None at="Authorization" value=`auth`** `messages` = @@ -91,21 +91,21 @@ Wire body is `{model, messages:[{role,content}], stream?}`. Messages are an `@` | self[^model] | `messages` | 1. `stream` - *req = > table.put in=`req` at="stream" value=True* - *body = > json.stringify value=`req`* - *resp = > net.http_post_sse url=`url` body=`body` headers=`headers` echo=`echo`* + **req = > table.put in=`req` at="stream" value=True** + **body = > json.stringify value=`req`** + **resp = > net.http_post_sse url=`url` body=`body` headers=`headers` echo=`echo`** 1. resp[^status] == 200 - **resp[^events]** + *resp[^events]* 2. * > print text=ext/ai/llm: HTTP error (stream) > print text=resp[^status] > sys.exit code=1 2. * - *body = > json.stringify value=`req`* - *resp = > net.http_post url=`url` body=`body` headers=`headers`* + **body = > json.stringify value=`req`** + **resp = > net.http_post url=`url` body=`body` headers=`headers`** 1. resp[^status] == 200 - *data = > json.parse text=resp[^body]* - **data[^choices][^1][^message][^content]** + **data = > json.parse text=resp[^body]** + *data[^choices][^1][^message][^content]* 2. * > print text=ext/ai/llm: HTTP error > print text=resp[^status] @@ -121,4 +121,4 @@ Wire body is `{model, messages:[{role,content}], stream?}`. Messages are an `@` Alias for `complete`. -**> self.complete prompt=`prompt` stream=`stream` echo=`echo`** +*> self.complete prompt=`prompt` stream=`stream` echo=`echo`* diff --git a/ext/ai/大模型.mq.md b/ext/ai/大模型.mq.md index 87185e8..059adc1 100644 --- a/ext/ai/大模型.mq.md +++ b/ext/ai/大模型.mq.md @@ -12,50 +12,50 @@ import json:lib/json.mq.md 从工作目录加载 `.env`(可选命名实参 `路径=`)。不覆盖已有变量。 -**> 系统.加载环境 路径=`路径`** +*> 系统.加载环境 路径=`路径`* ## 流式结果 + `事件` 把 `运行 流式=真` 的事件列表收成最终 `done.result`(或 `error.message`)。未知类型(如 `reasoning`)忽略。 -*answer = ""* +**answer = ""** - [ev](事件) - *t = ev[^type]* + **t = ev[^type]** 1. `t` == "done" - *answer = ev[^result]* + **answer = ev[^result]** 2. `t` == "error" - *answer = ev[^message]* + **answer = ev[^message]** 3. `t` == "delta" 4. * - *_ = 1* + **_ = 1** -**answer** +*answer* # 大模型 从 `OPENAI_*` / `MARQDO_LLM_*` 构造句柄。 -*api_key = > 系统.取环境 名="OPENAI_API_KEY"* +**api_key = > 系统.取环境 名="OPENAI_API_KEY"** 1. 非 `api_key` - *api_key = > 系统.取环境 名="MARQDO_LLM_API_KEY"* + **api_key = > 系统.取环境 名="MARQDO_LLM_API_KEY"** 1. 非 `api_key` > 打印 内容=ext/ai/大模型: 请设置 OPENAI_API_KEY 或 MARQDO_LLM_API_KEY > 系统.退出 码=1 -*base_url = > 系统.取环境 名="OPENAI_BASE_URL"* +**base_url = > 系统.取环境 名="OPENAI_BASE_URL"** 1. 非 `base_url` - *base_url = > 系统.取环境 名="MARQDO_LLM_BASE_URL"* + **base_url = > 系统.取环境 名="MARQDO_LLM_BASE_URL"** 1. 非 `base_url` - *base_url = "https://api.openai.com/v1"* + **base_url = "https://api.openai.com/v1"** -*model = > 系统.取环境 名="OPENAI_MODEL"* +**model = > 系统.取环境 名="OPENAI_MODEL"** 1. 非 `model` - *model = > 系统.取环境 名="MARQDO_LLM_MODEL"* + **model = > 系统.取环境 名="MARQDO_LLM_MODEL"** 1. 非 `model` - *model = "gpt-4o-mini"* + **model = "gpt-4o-mini"** `h` = @@ -63,7 +63,7 @@ import json:lib/json.mq.md |---------|----------|-------|--------|--------| | `api_key` | `base_url` | `model` | /chat/completions | "Bearer " | -**h** +*h* ## 运行 + `提示` @@ -74,9 +74,9 @@ import json:lib/json.mq.md 线上 body 为 `{model, messages:[{role,content}], stream?}`。消息用 `@` 行向表;headers 与可选 `stream` 用 `表.改`。`json` 只做 stringify/parse。 -*url = 自[^base_url] + 自[^suffix]* -*auth = 自[^bearer] + 自[^api_key]* -*headers = > 表.改 入=None 于="Authorization" 值=`auth`* +**url = 自[^base_url] + 自[^suffix]** +**auth = 自[^bearer] + 自[^api_key]** +**headers = > 表.改 入=None 于="Authorization" 值=`auth`** `messages` = @@ -91,21 +91,21 @@ import json:lib/json.mq.md | 自[^model] | `messages` | 1. `流式` - *req = > 表.改 入=`req` 于="stream" 值=True* - *body = > json.stringify value=`req`* - *resp = > 网络.提交流式 地址=`url` 内容=`body` headers=`headers` 打印增量=`打印增量`* + **req = > 表.改 入=`req` 于="stream" 值=True** + **body = > json.stringify value=`req`** + **resp = > 网络.提交流式 地址=`url` 内容=`body` headers=`headers` 打印增量=`打印增量`** 1. resp[^status] == 200 - **resp[^events]** + *resp[^events]* 2. * > 打印 内容=ext/ai/大模型: HTTP 错误(流式) > 打印 内容=resp[^status] > 系统.退出 码=1 2. * - *body = > json.stringify value=`req`* - *resp = > 网络.提交 地址=`url` 内容=`body` headers=`headers`* + **body = > json.stringify value=`req`** + **resp = > 网络.提交 地址=`url` 内容=`body` headers=`headers`** 1. resp[^status] == 200 - *data = > json.parse text=resp[^body]* - **data[^choices][^1][^message][^content]** + **data = > json.parse text=resp[^body]** + *data[^choices][^1][^message][^content]* 2. * > 打印 内容=ext/ai/大模型: HTTP 错误 > 打印 内容=resp[^status] @@ -121,4 +121,4 @@ import json:lib/json.mq.md 运行 的别名。 -**> 自.运行 提示=`提示` 流式=`流式` 打印增量=`打印增量`** +*> 自.运行 提示=`提示` 流式=`流式` 打印增量=`打印增量`* diff --git a/ext/ai/智能体.mq.md b/ext/ai/智能体.mq.md index 9b8ee63..e92d66d 100644 --- a/ext/ai/智能体.mq.md +++ b/ext/ai/智能体.mq.md @@ -16,11 +16,11 @@ import json:lib/json.mq.md + `源码深度`=default + `技能深度`=default -组装可读提示:站立提示、任务、**调用位置**、工具、**预算**源码 + Skill,以及人可见的行动约定。 +组装可读提示:站立提示、任务、*调用位置*、工具、*预算*源码 + Skill,以及人可见的行动约定。 编排 `.mq.md` 即真相源(代码即文档)。默认预算防爆窗;可先 `读取:source|skill` 加深再答或 `调用:`。 实现委托 `agent.build_step_context`(与英文版同源)。 -**> agent.build_step_context agent=`智能体` task=`任务` source_depth=`源码深度` skill_depth=`技能深度`** +*> agent.build_step_context agent=`智能体` task=`任务` source_depth=`源码深度` skill_depth=`技能深度`* --- @@ -29,31 +29,31 @@ import json:lib/json.mq.md 解析人可读调用行:`CALL:<名>` 或 `调用:<名>` / `调用:<名>`。 -*esc = > json.parse text={"nl":"\n"}* -*nl = > json.get value=`esc` key="nl"* -*text = > trim value=`回复`* -*lines = > split value=`text` sep=`nl`* -*found = 空* +**esc = > json.parse text={"nl":"\n"}** +**nl = > json.get value=`esc` key="nl"** +**text = > trim value=`回复`** +**lines = > split value=`text` sep=`nl`** +**found = 空** - [`line`](`lines`) - *t = > trim value=`line`* - *parts = > split value=`t` sep=:* - *n = > len value=`parts`* + **t = > trim value=`line`** + **parts = > split value=`t` sep=:** + **n = > len value=`parts`** 1. `n` > 1 - *head = > at value=`parts` index=0* - *head = > trim value=`head`* - *rest = > at value=`parts` index=1* - *rest = > trim value=`rest`* + **head = > at value=`parts` index=0** + **head = > trim value=`head`** + **rest = > at value=`parts` index=1** + **rest = > trim value=`rest`** 1. `head` == CALL - *found = rest* + **found = rest** 2. `head` == 调用 - *found = rest* + **found = rest** 3. * - *_ = 1* + **_ = 1** 2. * - *_ = 1* + **_ = 1** -**found** +*found* --- @@ -63,13 +63,13 @@ import json:lib/json.mq.md 白名单校验后,经 `lib/子任务`(`启动 函数=` → `等待`)调用 runbook 中的 `##`。 -*allowed = > agent_tool_allowed tools=`工具` name=`名`* +**allowed = > agent_tool_allowed tools=`工具` name=`名`** 1. `allowed` - *id = > 子任务.启动 函数=`名`* - **> 子任务.等待 id=`id`** + **id = > 子任务.启动 函数=`名`** + *> 子任务.等待 id=`id`* 2. * - *msg = "Tool not allowed:"* - **msg + `名`** + **msg = "Tool not allowed:"** + *msg + `名`* # 智能体 + `大模型` @@ -78,31 +78,31 @@ import json:lib/json.mq.md 加载 ABI v2 agent 插件(会话袋 + 上下文查询)。 -*p = > 插件.原生路径 名="agent"* +**p = > 插件.原生路径 名="agent"** 1. `p` > 插件.加载 路径=`p` 2. * > 打印 内容=ext/ai/智能体: 未找到原生 agent 插件(请先 cargo build -p marqdo_plugin_agent 或 marqdo ext add agent) > 系统.退出 码=1 -*id = > agent_alloc* -*h = > json.parse text={"_type":"智能体"}* -*h = > json.set map=`h` key="id" value=`id`* -*h = > json.set map=`h` key="model" value=`大模型`* -*h = > json.set map=`h` key="tools" value=`工具`* +**id = > agent_alloc** +**h = > json.parse text={"_type":"智能体"}** +**h = > json.set map=`h` key="id" value=`id`** +**h = > json.set map=`h` key="model" value=`大模型`** +**h = > json.set map=`h` key="tools" value=`工具`** 1. `站立提示` - *h = > json.set map=`h` key="standing" value=`站立提示`* + **h = > json.set map=`h` key="standing" value=`站立提示`** 2. * - *_ = 1* + **_ = 1** -**h** +*h* ## 清空历史 清空本智能体 id 的插件会话袋。 -*id = > json.get value=`自` key="id"* +**id = > json.get value=`自` key="id"** > agent_history_clear id=`id` **** @@ -112,76 +112,76 @@ import json:lib/json.mq.md + `流式`=假 + `打印增量`=假 -原子一轮:上下文 → 大模型 → 可选子任务调工具。返回 **map**(`status`、`task`、`decision`;成功含 `result`,可选 `tool` / `tool_result`;失败含 `error`)。默认(`写回=真`)将结果写入调用行下的命名槽 `ok` / `error`;传 `写回=假` 可关闭。 +原子一轮:上下文 → 大模型 → 可选子任务调工具。返回 *map*(`status`、`task`、`decision`;成功含 `result`,可选 `tool` / `tool_result`;失败含 `error`)。默认(`写回=真`)将结果写入调用行下的命名槽 `ok` / `error`;传 `写回=假` 可关闭。 流式=真 时走 SSE;打印增量=真 边读边打印。返回 map 仍是最终 result 文本。 -*ctx = > 构建单步上下文 智能体=`自` 任务=`任务`* -*id = > json.get value=`自` key="id"* -*model = > json.get value=`自` key="model"* -*tools = > json.get value=`自` key="tools"* +**ctx = > 构建单步上下文 智能体=`自` 任务=`任务`** +**id = > json.get value=`自` key="id"** +**model = > json.get value=`自` key="model"** +**tools = > json.get value=`自` key="tools"** -*user_turn = > json.parse text={"role":"user"}* -*user_turn = > json.set map=`user_turn` key="content" value=`任务`* +**user_turn = > json.parse text={"role":"user"}** +**user_turn = > json.set map=`user_turn` key="content" value=`任务`** > agent_history_append id=`id` item=`user_turn` 1. `流式` - *evs = > model.运行 提示=`ctx` 流式=真 打印增量=`打印增量`* - *reply = > 大模型.流式结果 事件=`evs`* + **evs = > model.运行 提示=`ctx` 流式=真 打印增量=`打印增量`** + **reply = > 大模型.流式结果 事件=`evs`** 2. * - *reply = > model.运行 提示=`ctx`* + **reply = > model.运行 提示=`ctx`** -*reply = > trim value=`reply`* -*decision = reply* -*tool_name = > 提取工具名 回复=`reply`* -*out = > json.parse text={"status":"ok"}* -*out = > json.set map=`out` key="task" value=`任务`* -*out = > json.set map=`out` key="decision" value=`decision`* +**reply = > trim value=`reply`** +**decision = reply** +**tool_name = > 提取工具名 回复=`reply`** +**out = > json.parse text={"status":"ok"}** +**out = > json.set map=`out` key="task" value=`任务`** +**out = > json.set map=`out` key="decision" value=`decision`** 1. `tool_name` - *tool_out = > 运行工具 工具=`tools` 名=`tool_name`* - *tool_s = > json.stringify value=`tool_out`* - *deny = > split value=`tool_s` sep="Tool not allowed"* - *deny_n = > len value=`deny`* + **tool_out = > 运行工具 工具=`tools` 名=`tool_name`** + **tool_s = > json.stringify value=`tool_out`** + **deny = > split value=`tool_s` sep="Tool not allowed"** + **deny_n = > len value=`deny`** 1. `deny_n` > 1 - *out = > json.set map=`out` key="status" value="error"* - *out = > json.set map=`out` key="error" value=`tool_s`* - *reply = tool_s* + **out = > json.set map=`out` key="status" value="error"** + **out = > json.set map=`out` key="error" value=`tool_s`** + **reply = tool_s** 2. * - *task_s = > json.stringify value=`任务`* - *fp = "The user asked:"* - *fp = fp + task_s* - *fp = fp + ". Tool"* - *fp = fp + tool_name* - *fp = fp + "ran via subtask and returned:"* - *fp = fp + tool_s* - *fp = fp + ". Reply to the user briefly."* + **task_s = > json.stringify value=`任务`** + **fp = "The user asked:"** + **fp = fp + task_s** + **fp = fp + ". Tool"** + **fp = fp + tool_name** + **fp = fp + "ran via subtask and returned:"** + **fp = fp + tool_s** + **fp = fp + ". Reply to the user briefly."** 1. `流式` - *evs2 = > model.运行 提示=`fp` 流式=真 打印增量=`打印增量`* - *reply = > 大模型.流式结果 事件=`evs2`* + **evs2 = > model.运行 提示=`fp` 流式=真 打印增量=`打印增量`** + **reply = > 大模型.流式结果 事件=`evs2`** 2. * - *reply = > model.运行 提示=`fp`* - *out = > json.set map=`out` key="tool" value=`tool_name`* - *out = > json.set map=`out` key="tool_result" value=`tool_s`* - *out = > json.set map=`out` key="result" value=`reply`* + **reply = > model.运行 提示=`fp`** + **out = > json.set map=`out` key="tool" value=`tool_name`** + **out = > json.set map=`out` key="tool_result" value=`tool_s`** + **out = > json.set map=`out` key="result" value=`reply`** 2. * - *out = > json.set map=`out` key="result" value=`reply`* + **out = > json.set map=`out` key="result" value=`reply`** -*as_turn = > json.parse text={"role":"assistant"}* -*as_turn = > json.set map=`as_turn` key="content" value=`reply`* +**as_turn = > json.parse text={"role":"assistant"}** +**as_turn = > json.set map=`as_turn` key="content" value=`reply`** > agent_history_append id=`id` item=`as_turn` 1. `写回` - *body = > json.stringify value=`out`* - *st = > json.get value=`out` key="status"* + **body = > json.stringify value=`out`** + **st = > json.get value=`out` key="status"** 1. `st` == "ok" > 自写回.写回 值=`body` 键="ok" 2. * > 自写回.写回 值=`body` 键="error" 2. * - *_ = 1* + **_ = 1** -**out** +*out* ## 多步 + `目标` @@ -207,8 +207,8 @@ import json:lib/json.mq.md 多步工作簿默认写入 OKF `知识库目录/resources/.mq.md`;仅当传入 `工作簿目录` 时才用临时 runs。转发至英文 `agent.plan`。`流式` / `打印增量` / `轨迹` 对应 `stream` / `echo` / `trace`;`软命中` → `soft_match`;`近义命中` / `近义阈值` → `near_match` / `near_threshold`。 -*model = > json.get value=`self` key="model"* -*tools = > json.get value=`self` key="tools"* -*standing = > json.get value=`self` key="standing"* -*en = > agent.agent model=`model` tools=`tools` standing=`standing`* -**> en.plan goal=`目标` workbook_dir=`工作簿目录` workbook=`工作簿` max_rounds=`最大轮次` confirm=`确认分解` writeback=`写回` skeleton=`骨架` reuse=`复用` optimize=`优化` force=`强制` soft_match=`软命中` near_match=`近义命中` near_threshold=`近义阈值` promote=`晋升` kb_dir=`知识库目录` improve_every=`改进周期` explore_n=`探索次数` stream=`流式` echo=`打印增量` trace=`轨迹`** +**model = > json.get value=`self` key="model"** +**tools = > json.get value=`self` key="tools"** +**standing = > json.get value=`self` key="standing"** +**en = > agent.agent model=`model` tools=`tools` standing=`standing`** +*> en.plan goal=`目标` workbook_dir=`工作簿目录` workbook=`工作簿` max_rounds=`最大轮次` confirm=`确认分解` writeback=`写回` skeleton=`骨架` reuse=`复用` optimize=`优化` force=`强制` soft_match=`软命中` near_match=`近义命中` near_threshold=`近义阈值` promote=`晋升` kb_dir=`知识库目录` improve_every=`改进周期` explore_n=`探索次数` stream=`流式` echo=`打印增量` trace=`轨迹`* diff --git a/ext/linalg/linalg.mq.md b/ext/linalg/linalg.mq.md index 710c7d1..6530417 100644 --- a/ext/linalg/linalg.mq.md +++ b/ext/linalg/linalg.mq.md @@ -9,7 +9,7 @@ import sys:lib/sys.mq.md Load the ABI v2 `linalg` plugin once. -*p = > plugin.native_path name="linalg"* +**p = > plugin.native_path name="linalg"** 1. `p` > plugin.load path=`p` 2. * @@ -20,7 +20,7 @@ Load the ABI v2 `linalg` plugin once. ## ping > ensure_plugin -**> linalg_ping** +*> linalg_ping* ## mul + `a` @@ -29,27 +29,27 @@ Load the ABI v2 `linalg` plugin once. Matrix product (lazy MatMul; shape-checked). > ensure_plugin -**> linalg_mul a=`a` b=`b`** +*> linalg_mul a=`a` b=`b`* ## add + `a` + `b` > ensure_plugin -**> linalg_add a=`a` b=`b`** +*> linalg_add a=`a` b=`b`* ## sub + `a` + `b` > ensure_plugin -**> linalg_sub a=`a` b=`b`** +*> linalg_sub a=`a` b=`b`* ## transpose + `expr` > ensure_plugin -**> linalg_transpose expr=`expr`** +*> linalg_transpose expr=`expr`* ## inv + `expr` @@ -57,7 +57,7 @@ Matrix product (lazy MatMul; shape-checked). Symbolic inverse (lazy). > ensure_plugin -**> linalg_inv expr=`expr`** +*> linalg_inv expr=`expr`* ## simplify + `expr` @@ -65,29 +65,29 @@ Symbolic inverse (lazy). Apply MatExpr rewrite rules (R1–R5). > ensure_plugin -**> linalg_simplify expr=`expr`** +*> linalg_simplify expr=`expr`* ## ascii + `expr` + `raw`=False -Display ASCII (default **simplify** first). Pass `raw=True` to keep the written tree. +Display ASCII (default simplify first). Pass `raw=True` to keep the written tree. > ensure_plugin -**> linalg_ascii expr=`expr` raw=`raw`** +*> linalg_ascii expr=`expr` raw=`raw`* ## latex + `expr` + `raw`=False > ensure_plugin -**> linalg_latex expr=`expr` raw=`raw`** +*> linalg_latex expr=`expr` raw=`raw`* ## shape + `expr` > ensure_plugin -**> linalg_shape expr=`expr`** +*> linalg_shape expr=`expr`* ## show + `expr` @@ -97,20 +97,20 @@ Display ASCII (default **simplify** first). Pass `raw=True` to keep the written Record a formula SVG via host plot channel (default simplify). Returns the expr map. > ensure_plugin -**> linalg_show expr=`expr` path=`path` raw=`raw`** +*> linalg_show expr=`expr` path=`path` raw=`raw`* ## eye + `n` > ensure_plugin -**> linalg_eye n=`n`** +*> linalg_eye n=`n`* ## zeros + `rows` + `cols` > ensure_plugin -**> linalg_zeros rows=`rows` cols=`cols`** +*> linalg_zeros rows=`rows` cols=`cols`* ## from_list + `data` @@ -118,7 +118,7 @@ Record a formula SVG via host plot channel (default simplify). Returns the expr Dense leaf from nested list. > ensure_plugin -**> linalg_from_list data=`data`** +*> linalg_from_list data=`data`* ## from_formula + `formula` @@ -126,28 +126,28 @@ Dense leaf from nested list. Absorb a `$$` numeric matrix formula (or nested list / dense map) as a dense leaf. > ensure_plugin -**> linalg_from_formula formula=`formula`** +*> linalg_from_formula formula=`formula`* ## explicit + `expr` + `raw`=False -Evaluate to dense (default **simplify** first). +Evaluate to dense (default simplify first). > ensure_plugin -**> linalg_explicit expr=`expr` raw=`raw`** +*> linalg_explicit expr=`expr` raw=`raw`* ## det + `expr` > ensure_plugin -**> linalg_det expr=`expr`** +*> linalg_det expr=`expr`* ## trace + `expr` > ensure_plugin -**> linalg_trace expr=`expr`** +*> linalg_trace expr=`expr`* ## solve + `a`=None @@ -157,7 +157,7 @@ Evaluate to dense (default **simplify** first). Solve `a x = b` (Gaussian elimination), or reuse `factorize kind=lu` via `factor` + `b`. > ensure_plugin -**> linalg_solve a=`a` b=`b` factor=`factor`** +*> linalg_solve a=`a` b=`b` factor=`factor`* ## matmul + `a` @@ -166,7 +166,7 @@ Solve `a x = b` (Gaussian elimination), or reuse `factorize kind=lu` via `factor Dense matrix product → `linalg_dense`. > ensure_plugin -**> linalg_matmul a=`a` b=`b`** +*> linalg_matmul a=`a` b=`b`* ## kron + `a` @@ -175,7 +175,7 @@ Dense matrix product → `linalg_dense`. Lazy Kronecker product (does not expand). > ensure_plugin -**> linalg_kron a=`a` b=`b`** +*> linalg_kron a=`a` b=`b`* ## block + `blocks` @@ -183,7 +183,7 @@ Lazy Kronecker product (does not expand). Block matrix from a nested list of expressions. > ensure_plugin -**> linalg_block blocks=`blocks`** +*> linalg_block blocks=`blocks`* ## collapse + `expr` @@ -191,7 +191,7 @@ Block matrix from a nested list of expressions. Block-level collapse (`Block*Block` → block of products). > ensure_plugin -**> linalg_collapse expr=`expr`** +*> linalg_collapse expr=`expr`* ## factorize + `matrix` @@ -200,7 +200,7 @@ Block-level collapse (`Block*Block` → block of products). Dense factorization → `linalg_factor` (`kind` = `lu` | `qr` | `svd` | `eig` | `chol`). > ensure_plugin -**> linalg_factorize matrix=`matrix` kind=`kind`** +*> linalg_factorize matrix=`matrix` kind=`kind`* ## draw + `factor` @@ -211,7 +211,7 @@ Dense factorization → `linalg_factor` (`kind` = `lu` | `qr` | `svd` | `eig` | Structure SVG (`eig` | `svd` | `qr` | `lu` | `ge` | `chol` | `structure` | `heatmap` | `hinton`). Theme tokens match quantum Q8: `light` | `dark` | `bw`. > ensure_plugin -**> linalg_draw factor=`factor` kind=`kind` path=`path` theme=`theme`** +*> linalg_draw factor=`factor` kind=`kind` path=`path` theme=`theme`* ## lstsq + `a` @@ -220,7 +220,7 @@ Structure SVG (`eig` | `svd` | `qr` | `lu` | `ge` | `chol` | `structure` | `heat Least squares `min ||a x - b||` (QR if tall, SVD if wide). > ensure_plugin -**> linalg_lstsq a=`a` b=`b`** +*> linalg_lstsq a=`a` b=`b`* ## norm + `expr` @@ -229,7 +229,7 @@ Least squares `min ||a x - b||` (QR if tall, SVD if wide). Matrix norm: `fro` | `1` | `inf` | `2`. Complex dense supports `fro` only. > ensure_plugin -**> linalg_norm expr=`expr` ord=`ord`** +*> linalg_norm expr=`expr` ord=`ord`* ## cond + `expr` @@ -237,7 +237,7 @@ Matrix norm: `fro` | `1` | `inf` | `2`. Complex dense supports `fro` only. Spectral condition number via SVD (`ord=2`). > ensure_plugin -**> linalg_cond expr=`expr`** +*> linalg_cond expr=`expr`* ## rank + `expr` @@ -245,7 +245,7 @@ Spectral condition number via SVD (`ord=2`). Numerical rank (SVD). > ensure_plugin -**> linalg_rank expr=`expr`** +*> linalg_rank expr=`expr`* ## declare + `table` @@ -253,7 +253,7 @@ Numerical rank (SVD). Declare several matrix symbols from an `@` record table (`name` / `rows` / `cols`). Returns a map env. > ensure_plugin -**> linalg_declare table=`table` type_tag="matrix"** +*> linalg_declare table=`table` type_tag="matrix"* ## symbol + `name` @@ -263,7 +263,7 @@ Declare several matrix symbols from an `@` record table (`name` / `rows` / `cols Abstract matrix symbol. Returns a `# matrix` instance (supports `+` / `*` and methods). > ensure_plugin -**> matrix name=`name` rows=`rows` cols=`cols`** +*> matrix name=`name` rows=`rows` cols=`cols`* # matrix + `name`=None @@ -277,96 +277,96 @@ Matrix value (`_type=matrix`). Prefer infix `A + B` / `A * B`, or methods `` `A` > ensure_plugin 1. `formula` - **> linalg_from_formula formula=`formula`** + *> linalg_from_formula formula=`formula`* 2. `data` - **> linalg_from_list data=`data`** + *> linalg_from_list data=`data`* 3. `name` - **> linalg_symbol name=`name` rows=`rows` cols=`cols`** + *> linalg_symbol name=`name` rows=`rows` cols=`cols`* 4. `n` - **> linalg_eye n=`n`** + *> linalg_eye n=`n`* 5. `rows` - **> linalg_zeros rows=`rows` cols=`cols`** + *> linalg_zeros rows=`rows` cols=`cols`* 6. * > print text=ext/linalg: matrix needs name= / data= / formula= / n= / rows= - **None** + *None* ## T -**> linalg_transpose expr=`self`** +*> linalg_transpose expr=`self`* ## T_ascii Transpose then display ASCII (auto-simplified). Handy for lecture identities. -*`Pt` = > linalg_transpose expr=`self`* -**> linalg_ascii expr=`Pt` raw=False** +**`Pt` = > linalg_transpose expr=`self`** +*> linalg_ascii expr=`Pt` raw=False* ## add + `b` -**> linalg_add a=`self` b=`b`** +*> linalg_add a=`self` b=`b`* ## sub + `b` -**> linalg_sub a=`self` b=`b`** +*> linalg_sub a=`self` b=`b`* ## mul + `b` -**> linalg_mul a=`self` b=`b`** +*> linalg_mul a=`self` b=`b`* ## inv -**> linalg_inv expr=`self`** +*> linalg_inv expr=`self`* ## simplify -**> linalg_simplify expr=`self`** +*> linalg_simplify expr=`self`* ## ascii -**> linalg_ascii expr=`self` raw=False** +*> linalg_ascii expr=`self` raw=False* ## latex -**> linalg_latex expr=`self` raw=False** +*> linalg_latex expr=`self` raw=False* ## explicit -**> linalg_explicit expr=`self` raw=False** +*> linalg_explicit expr=`self` raw=False* ## det -**> linalg_det expr=`self`** +*> linalg_det expr=`self`* ## trace -**> linalg_trace expr=`self`** +*> linalg_trace expr=`self`* ## show + `path`=None + `raw`=False -**> linalg_show expr=`self` path=`path` raw=`raw`** +*> linalg_show expr=`self` path=`path` raw=`raw`* ## eye + `n` -**> linalg_eye n=`n`** +*> linalg_eye n=`n`* ## zeros + `rows` + `cols` -**> linalg_zeros rows=`rows` cols=`cols`** +*> linalg_zeros rows=`rows` cols=`cols`* ## from_list + `data` -**> linalg_from_list data=`data`** +*> linalg_from_list data=`data`* ## from_formula + `formula` -**> linalg_from_formula formula=`formula`** +*> linalg_from_formula formula=`formula`* diff --git a/ext/linalg/线性代数.mq.md b/ext/linalg/线性代数.mq.md index 361e410..eaa975c 100644 --- a/ext/linalg/线性代数.mq.md +++ b/ext/linalg/线性代数.mq.md @@ -9,7 +9,7 @@ import sys:lib/sys.mq.md 加载 ABI v2 `linalg` 插件一次。 -*p = > plugin.native_path name="linalg"* +**p = > plugin.native_path name="linalg"** 1. `p` > plugin.load path=`p` 2. * @@ -20,7 +20,7 @@ import sys:lib/sys.mq.md ## 探测 > 确保插件 -**> linalg_ping** +*> linalg_ping* ## 乘 + `左` @@ -29,33 +29,33 @@ import sys:lib/sys.mq.md 矩阵乘(惰性;检查形状)。 > 确保插件 -**> linalg_mul a=`左` b=`右`** +*> linalg_mul a=`左` b=`右`* ## 加 + `左` + `右` > 确保插件 -**> linalg_add a=`左` b=`右`** +*> linalg_add a=`左` b=`右`* ## 减 + `左` + `右` > 确保插件 -**> linalg_sub a=`左` b=`右`** +*> linalg_sub a=`左` b=`右`* ## 转置 + `式` > 确保插件 -**> linalg_transpose expr=`式`** +*> linalg_transpose expr=`式`* ## 逆 + `式` > 确保插件 -**> linalg_inv expr=`式`** +*> linalg_inv expr=`式`* ## 化简 + `式` @@ -63,29 +63,29 @@ import sys:lib/sys.mq.md 应用矩阵表达式重写规则(R1–R5)。 > 确保插件 -**> linalg_simplify expr=`式`** +*> linalg_simplify expr=`式`* ## 文本 + `式` + `原始`=False -展示 ASCII(默认先 **化简**)。`原始=True` 保留书写树。 +展示 ASCII(默认先 化简)。`原始=True` 保留书写树。 > 确保插件 -**> linalg_ascii expr=`式` raw=`原始`** +*> linalg_ascii expr=`式` raw=`原始`* ## 乳胶 + `式` + `原始`=False > 确保插件 -**> linalg_latex expr=`式` raw=`原始`** +*> linalg_latex expr=`式` raw=`原始`* ## 形状 + `式` > 确保插件 -**> linalg_shape expr=`式`** +*> linalg_shape expr=`式`* ## 展示 + `式` @@ -95,26 +95,26 @@ import sys:lib/sys.mq.md 写入公式 SVG(默认化简)。 > 确保插件 -**> linalg_show expr=`式` path=`路径` raw=`原始`** +*> linalg_show expr=`式` path=`路径` raw=`原始`* ## 单位 + `阶` > 确保插件 -**> linalg_eye n=`阶`** +*> linalg_eye n=`阶`* ## 零阵 + `行` + `列` > 确保插件 -**> linalg_zeros rows=`行` cols=`列`** +*> linalg_zeros rows=`行` cols=`列`* ## 自列表 + `数据` > 确保插件 -**> linalg_from_list data=`数据`** +*> linalg_from_list data=`数据`* ## 自公式 + `公式` @@ -122,28 +122,28 @@ import sys:lib/sys.mq.md 吸收 `$$` 数值矩阵公式为稠密叶。 > 确保插件 -**> linalg_from_formula formula=`公式`** +*> linalg_from_formula formula=`公式`* ## 求值 + `式` + `原始`=False -求成稠密(默认先 **化简**)。 +求成稠密(默认先 化简)。 > 确保插件 -**> linalg_explicit expr=`式` raw=`原始`** +*> linalg_explicit expr=`式` raw=`原始`* ## 行列式 + `式` > 确保插件 -**> linalg_det expr=`式`** +*> linalg_det expr=`式`* ## 迹 + `式` > 确保插件 -**> linalg_trace expr=`式`** +*> linalg_trace expr=`式`* ## 求解 + `左`=None @@ -153,14 +153,14 @@ import sys:lib/sys.mq.md 解 `左 · x = 右`,或复用 `分解`(`kind=lu`)+ `右`。 > 确保插件 -**> linalg_solve a=`左` b=`右` factor=`分解`** +*> linalg_solve a=`左` b=`右` factor=`分解`* ## 稠密乘 + `左` + `右` > 确保插件 -**> linalg_matmul a=`左` b=`右`** +*> linalg_matmul a=`左` b=`右`* ## 克罗内克 + `左` @@ -169,7 +169,7 @@ import sys:lib/sys.mq.md 惰性 Kronecker 积(默认不展开)。 > 确保插件 -**> linalg_kron a=`左` b=`右`** +*> linalg_kron a=`左` b=`右`* ## 分块 + `块` @@ -177,7 +177,7 @@ import sys:lib/sys.mq.md 由嵌套表达式列表构造分块矩阵。 > 确保插件 -**> linalg_block blocks=`块`** +*> linalg_block blocks=`块`* ## 分块化简 + `式` @@ -185,7 +185,7 @@ import sys:lib/sys.mq.md 分块级塌缩(`Block*Block` → 块乘加)。 > 确保插件 -**> linalg_collapse expr=`式`** +*> linalg_collapse expr=`式`* ## 分解 + `矩阵` @@ -194,7 +194,7 @@ import sys:lib/sys.mq.md 稠密分解 → `linalg_factor`(`类型` = `lu` | `qr` | `svd` | `eig` | `chol`)。 > 确保插件 -**> linalg_factorize matrix=`矩阵` kind=`类型`** +*> linalg_factorize matrix=`矩阵` kind=`类型`* ## 绘图 + `分解` @@ -205,7 +205,7 @@ import sys:lib/sys.mq.md 结构 SVG(`eig` | `svd` | `qr` | `lu` | `ge` | `chol` | `structure` | `heatmap` | `hinton`)。主题与 quantum Q8 对齐:`light` | `dark` | `bw`。 > 确保插件 -**> linalg_draw factor=`分解` kind=`类型` path=`路径` theme=`主题`** +*> linalg_draw factor=`分解` kind=`类型` path=`路径` theme=`主题`* ## 最小二乘 + `左` @@ -214,7 +214,7 @@ import sys:lib/sys.mq.md 最小二乘 `min ||左 · x - 右||`(高瘦用 QR,宽用 SVD)。 > 确保插件 -**> linalg_lstsq a=`左` b=`右`** +*> linalg_lstsq a=`左` b=`右`* ## 范数 + `式` @@ -223,7 +223,7 @@ import sys:lib/sys.mq.md 矩阵范数:`fro` | `1` | `inf` | `2`。复数稠密暂仅 `fro`。 > 确保插件 -**> linalg_norm expr=`式` ord=`范数`** +*> linalg_norm expr=`式` ord=`范数`* ## 条件数 + `式` @@ -231,7 +231,7 @@ import sys:lib/sys.mq.md 谱条件数(SVD,`ord=2`)。 > 确保插件 -**> linalg_cond expr=`式`** +*> linalg_cond expr=`式`* ## 秩 + `式` @@ -239,7 +239,7 @@ import sys:lib/sys.mq.md 数值秩(SVD)。 > 确保插件 -**> linalg_rank expr=`式`** +*> linalg_rank expr=`式`* ## 声明 + `表` @@ -247,7 +247,7 @@ import sys:lib/sys.mq.md 用 `@` 记录表一次声明多个符号矩阵(`名` / `行` / `列`)。返回环境 map。 > 确保插件 -**> linalg_declare table=`表` type_tag="矩阵"** +*> linalg_declare table=`表` type_tag="矩阵"* ## 符号 + `名` @@ -257,7 +257,7 @@ import sys:lib/sys.mq.md 抽象矩阵符号。返回 `# 矩阵` 实例(可用 `+` / `*` 与方法)。 > 确保插件 -**> 矩阵 名=`名` 行=`行` 列=`列`** +*> 矩阵 名=`名` 行=`行` 列=`列`* # 矩阵 + `名`=None @@ -271,97 +271,97 @@ import sys:lib/sys.mq.md > 确保插件 1. `公式` - **> linalg_from_formula formula=`公式`** + *> linalg_from_formula formula=`公式`* 2. `数据` - **> linalg_from_list data=`数据`** + *> linalg_from_list data=`数据`* 3. `名` - **> linalg_symbol name=`名` rows=`行` cols=`列`** + *> linalg_symbol name=`名` rows=`行` cols=`列`* 4. `阶` - **> linalg_eye n=`阶`** + *> linalg_eye n=`阶`* 5. `行` - **> linalg_zeros rows=`行` cols=`列`** + *> linalg_zeros rows=`行` cols=`列`* 6. * > print text=ext/linalg: 矩阵需要 名= / 数据= / 公式= / 阶= / 行= - **None** + *None* ## 转置 -**> linalg_transpose expr=`self`** +*> linalg_transpose expr=`self`* ## 转置文本 转置后输出 ASCII(默认化简)。适合讲义恒等式验收。 -*`转` = > linalg_transpose expr=`self`* -**> linalg_ascii expr=`转` raw=False** +**`转` = > linalg_transpose expr=`self`** +*> linalg_ascii expr=`转` raw=False* ## 加 + `右` -**> linalg_add a=`self` b=`右`** +*> linalg_add a=`self` b=`右`* ## 减 + `右` -**> linalg_sub a=`self` b=`右`** +*> linalg_sub a=`self` b=`右`* ## 乘 + `右` -**> linalg_mul a=`self` b=`右`** +*> linalg_mul a=`self` b=`右`* ## 逆 -**> linalg_inv expr=`self`** +*> linalg_inv expr=`self`* ## 化简 -**> linalg_simplify expr=`self`** +*> linalg_simplify expr=`self`* ## 文本 -**> linalg_ascii expr=`self` raw=False** +*> linalg_ascii expr=`self` raw=False* ## 乳胶 -**> linalg_latex expr=`self` raw=False** +*> linalg_latex expr=`self` raw=False* ## 求值 + `原始`=False -**> linalg_explicit expr=`self` raw=`原始`** +*> linalg_explicit expr=`self` raw=`原始`* ## 行列式 -**> linalg_det expr=`self`** +*> linalg_det expr=`self`* ## 迹 -**> linalg_trace expr=`self`** +*> linalg_trace expr=`self`* ## 展示 + `路径`=None + `原始`=False -**> linalg_show expr=`self` path=`路径` raw=`原始`** +*> linalg_show expr=`self` path=`路径` raw=`原始`* ## 单位 + `阶` -**> linalg_eye n=`阶`** +*> linalg_eye n=`阶`* ## 零阵 + `行` + `列` -**> linalg_zeros rows=`行` cols=`列`** +*> linalg_zeros rows=`行` cols=`列`* ## 自列表 + `数据` -**> linalg_from_list data=`数据`** +*> linalg_from_list data=`数据`* ## 自公式 + `公式` -**> linalg_from_formula formula=`公式`** +*> linalg_from_formula formula=`公式`* diff --git a/ext/quantum/quantum.mq.md b/ext/quantum/quantum.mq.md index fbaa186..026a107 100644 --- a/ext/quantum/quantum.mq.md +++ b/ext/quantum/quantum.mq.md @@ -10,7 +10,7 @@ import json:lib/json.mq.md Load the ABI v2 `quantum` plugin once. -*p = > plugin.native_path name="quantum"* +**p = > plugin.native_path name="quantum"** 1. `p` > plugin.load path=`p` 2. * @@ -25,7 +25,7 @@ Load the ABI v2 `quantum` plugin once. Tensor product of two states or square matrices. > ensure_plugin -**> quantum_kron a=`a` b=`b`** +*> quantum_kron a=`a` b=`b`* ## schmidt + `state` @@ -34,7 +34,7 @@ Tensor product of two states or square matrices. Schmidt decomposition of a pure state / circuit across `cut` (subsystem A = low qubits). > ensure_plugin -**> quantum_schmidt state=`state` cut=`cut`** +*> quantum_schmidt state=`state` cut=`cut`* ## fidelity + `a` @@ -43,7 +43,7 @@ Schmidt decomposition of a pure state / circuit across `cut` (subsystem A = low Pure-state fidelity |⟨a|b⟩|². > ensure_plugin -**> quantum_fidelity a=`a` b=`b`** +*> quantum_fidelity a=`a` b=`b`* # circuit + `qubits`=1 @@ -52,98 +52,98 @@ Pure-state fidelity |⟨a|b⟩|². State-vector circuit (default |0…0⟩). Optional `steps=` gate table (column or row records). Methods append gates and return an updated handle. > ensure_plugin -**> quantum_circuit_new qubits=`qubits` steps=`steps`** +*> quantum_circuit_new qubits=`qubits` steps=`steps`* ## h + `qubit`=0 -**> quantum_h circuit=`self` qubit=`qubit`** +*> quantum_h circuit=`self` qubit=`qubit`* ## x + `qubit`=0 -**> quantum_x circuit=`self` qubit=`qubit`** +*> quantum_x circuit=`self` qubit=`qubit`* ## y + `qubit`=0 -**> quantum_y circuit=`self` qubit=`qubit`** +*> quantum_y circuit=`self` qubit=`qubit`* ## z + `qubit`=0 -**> quantum_z circuit=`self` qubit=`qubit`** +*> quantum_z circuit=`self` qubit=`qubit`* ## s + `qubit`=0 -**> quantum_s circuit=`self` qubit=`qubit`** +*> quantum_s circuit=`self` qubit=`qubit`* ## t + `qubit`=0 -**> quantum_t circuit=`self` qubit=`qubit`** +*> quantum_t circuit=`self` qubit=`qubit`* ## i + `qubit`=0 -**> quantum_i circuit=`self` qubit=`qubit`** +*> quantum_i circuit=`self` qubit=`qubit`* ## rx + `qubit`=0 + `theta` -**> quantum_rx circuit=`self` qubit=`qubit` theta=`theta`** +*> quantum_rx circuit=`self` qubit=`qubit` theta=`theta`* ## ry + `qubit`=0 + `theta` -**> quantum_ry circuit=`self` qubit=`qubit` theta=`theta`** +*> quantum_ry circuit=`self` qubit=`qubit` theta=`theta`* ## rz + `qubit`=0 + `theta` -**> quantum_rz circuit=`self` qubit=`qubit` theta=`theta`** +*> quantum_rz circuit=`self` qubit=`qubit` theta=`theta`* ## cx + `control`=0 + `target`=1 -**> quantum_cx circuit=`self` control=`control` target=`target`** +*> quantum_cx circuit=`self` control=`control` target=`target`* ## cz + `control`=0 + `target`=1 -**> quantum_cz circuit=`self` control=`control` target=`target`** +*> quantum_cz circuit=`self` control=`control` target=`target`* ## swap + `a`=0 + `b`=1 -**> quantum_swap circuit=`self` a=`a` b=`b`** +*> quantum_swap circuit=`self` a=`a` b=`b`* ## barrier Visual separator only (no state change). -**> quantum_barrier circuit=`self`** +*> quantum_barrier circuit=`self`* ## measure + `qubits`=None Mark computational-basis readout (`None` / empty = all qubits). Affects which bits `run` reports. -**> quantum_measure circuit=`self` qubits=`qubits`** +*> quantum_measure circuit=`self` qubits=`qubits`* ## append + `op` Append another circuit's ops or a `{gate,qubits}` op map. -**> quantum_append circuit=`self` op=`op`** +*> quantum_append circuit=`self` op=`op`* ## apply + `gate` @@ -151,7 +151,7 @@ Append another circuit's ops or a `{gate,qubits}` op map. Apply a gate handle (named or custom `matrix=`) on `qubits` (int or list). -**> quantum_apply circuit=`self` gate=`gate` qubits=`qubits`** +*> quantum_apply circuit=`self` gate=`gate` qubits=`qubits`* ## noise + `kind` @@ -159,25 +159,25 @@ Apply a gate handle (named or custom `matrix=`) on `qubits` (int or list). Teaching noise for `run` trajectories (`bitflip` / `depolarizing` / `amplitude_damping`). Ignored by `simulate` / `probabilities`. -**> quantum_noise circuit=`self` kind=`kind` p=`p`** +*> quantum_noise circuit=`self` kind=`kind` p=`p`* ## simulate Return state vector amplitudes `{re,im}` (ideal; no noise). -**> quantum_simulate circuit=`self`** +*> quantum_simulate circuit=`self`* ## state Ideal state vector (same amplitudes as `simulate`). -**> quantum_state circuit=`self`** +*> quantum_state circuit=`self`* ## probabilities Return map of basis label → probability (qubit 0 = rightmost bit). Ideal; ignores noise. -**> quantum_probabilities circuit=`self`** +*> quantum_probabilities circuit=`self`* ## run + `shots`=1024 @@ -185,7 +185,7 @@ Return map of basis label → probability (qubit 0 = rightmost bit). Ideal; igno Sample computational-basis shots (deterministic with `seed=`). Applies circuit `noise` if set. -**> quantum_run circuit=`self` shots=`shots` seed=`seed`** +*> quantum_run circuit=`self` shots=`shots` seed=`seed`* ## draw + `path`=None @@ -195,27 +195,27 @@ Sample computational-basis shots (deterministic with `seed=`). Applies circuit ` Circuit rail / probability bars / Bloch / advanced state plots (`kind=circuit|probs|bloch|hinton|city|density|paulivec|qsphere|multibloch`). Theme `dark` (default tech lab) / `light` / `bw`. Records into view/CLI plots via host `record_plot`. -**> quantum_draw_circuit circuit=`self` path=`path` kind=`kind` qubit=`qubit` theme=`theme`** +*> quantum_draw_circuit circuit=`self` path=`path` kind=`kind` qubit=`qubit` theme=`theme`* ## density Pure-state density matrix ρ=|ψ⟩⟨ψ| after ideal simulate. -**> density state=`self`** +*> density state=`self`* ## expect + `obs` Pauli string (left = high bit) or matrix expectation on the ideal state. -**> quantum_density_expect density=`self` obs=`obs`** +*> quantum_density_expect density=`self` obs=`obs`* ## schmidt + `cut`=1 Schmidt / singular values across a bipartition (`cut` = qubits in subsystem A, low bits). -**> quantum_schmidt state=`self` cut=`cut`** +*> quantum_schmidt state=`self` cut=`cut`* # gate + `name`=None @@ -225,17 +225,17 @@ Schmidt / singular values across a bipartition (`cut` = qubits in subsystem A, l Named built-in gate (`name=H`) or custom unitary from `matrix=` (nested list or formula matrix fence). Optional `name=` label for custom gates (default `U`). > ensure_plugin -**> quantum_gate_new name=`name` theta=`theta` matrix=`matrix`** +*> quantum_gate_new name=`name` theta=`theta` matrix=`matrix`* ## matrix -**> quantum_gate_matrix gate=`self`** +*> quantum_gate_matrix gate=`self`* ## matches_matrix + `matrix` + `tol`=0.000000001 -**> quantum_gate_matches_matrix gate=`self` matrix=`matrix` tol=`tol`** +*> quantum_gate_matches_matrix gate=`self` matrix=`matrix` tol=`tol`* ## draw + `path`=None @@ -243,7 +243,7 @@ Named built-in gate (`name=H`) or custom unitary from `matrix=` (nested list or Gate glyph or complex-matrix heatmap (`kind=gate|matrix`). Records via host `record_plot`. -**> quantum_gate_draw gate=`self` path=`path` kind=`kind`** +*> quantum_gate_draw gate=`self` path=`path` kind=`kind`* # density + `state`=None @@ -253,37 +253,37 @@ Density matrix from a state/circuit (`state=`) or an explicit Hermitian `matrix= > ensure_plugin 1. `matrix` - **> quantum_density_from_matrix matrix=`matrix`** + *> quantum_density_from_matrix matrix=`matrix`* 2. * - **> quantum_density_from_state state=`state`** + *> quantum_density_from_state state=`state`* ## matrix -**> quantum_density_matrix density=`self`** +*> quantum_density_matrix density=`self`* ## purity Tr(ρ²). -**> quantum_density_purity density=`self`** +*> quantum_density_purity density=`self`* ## partial_trace + `keep` Keep listed qubits (LSB=0); trace out the rest. -**> quantum_density_partial_trace density=`self` keep=`keep`** +*> quantum_density_partial_trace density=`self` keep=`keep`* ## eig Hermitian spectrum → `{eigenvalues, eigenvectors}`. -**> quantum_density_eig density=`self`** +*> quantum_density_eig density=`self`* ## expect + `obs` -**> quantum_density_expect density=`self` obs=`obs`** +*> quantum_density_expect density=`self` obs=`obs`* ## draw + `path`=None @@ -291,4 +291,4 @@ Hermitian spectrum → `{eigenvalues, eigenvectors}`. Hinton / city / density-cells / Pauli vector SVG (`kind=hinton` or city or density or paulivec). -**> quantum_density_draw density=`self` path=`path` kind=`kind`** +*> quantum_density_draw density=`self` path=`path` kind=`kind`* diff --git a/ext/quantum/量子.mq.md b/ext/quantum/量子.mq.md index a393b0a..54b8c6f 100644 --- a/ext/quantum/量子.mq.md +++ b/ext/quantum/量子.mq.md @@ -10,7 +10,7 @@ import json:lib/json.mq.md 加载 ABI v2 `quantum` 插件。 -*p = > plugin.native_path name="quantum"* +**p = > plugin.native_path name="quantum"** 1. `p` > plugin.load path=`p` 2. * @@ -25,14 +25,14 @@ import json:lib/json.mq.md 两态或方阵的张量积。 > 确保插件 -**> quantum_kron a=`左` b=`右`** +*> quantum_kron a=`左` b=`右`* ## 施密特分解 + `态` + `分割`=1 > 确保插件 -**> quantum_schmidt state=`态` cut=`分割`** +*> quantum_schmidt state=`态` cut=`分割`* ## 保真度 + `左` @@ -41,7 +41,7 @@ import json:lib/json.mq.md 纯态保真度 |⟨a|b⟩|²。 > 确保插件 -**> quantum_fidelity a=`左` b=`右`** +*> quantum_fidelity a=`左` b=`右`* # 电路 + `比特数`=1 @@ -50,98 +50,98 @@ import json:lib/json.mq.md 状态向量电路(默认 |0…0⟩)。可选 `步骤=` 门序列表。方法追加门并返回更新后的句柄。 > 确保插件 -**> quantum_circuit_new qubits=`比特数` steps=`步骤`** +*> quantum_circuit_new qubits=`比特数` steps=`步骤`* ## 哈达玛 + `比特`=0 -**> quantum_h circuit=`self` qubit=`比特`** +*> quantum_h circuit=`self` qubit=`比特`* ## 泡利X + `比特`=0 -**> quantum_x circuit=`self` qubit=`比特`** +*> quantum_x circuit=`self` qubit=`比特`* ## 泡利Y + `比特`=0 -**> quantum_y circuit=`self` qubit=`比特`** +*> quantum_y circuit=`self` qubit=`比特`* ## 泡利Z + `比特`=0 -**> quantum_z circuit=`self` qubit=`比特`** +*> quantum_z circuit=`self` qubit=`比特`* ## 相位S + `比特`=0 -**> quantum_s circuit=`self` qubit=`比特`** +*> quantum_s circuit=`self` qubit=`比特`* ## 相位T + `比特`=0 -**> quantum_t circuit=`self` qubit=`比特`** +*> quantum_t circuit=`self` qubit=`比特`* ## 单位 + `比特`=0 -**> quantum_i circuit=`self` qubit=`比特`** +*> quantum_i circuit=`self` qubit=`比特`* ## 绕X + `比特`=0 + `参数` -**> quantum_rx circuit=`self` qubit=`比特` theta=`参数`** +*> quantum_rx circuit=`self` qubit=`比特` theta=`参数`* ## 绕Y + `比特`=0 + `参数` -**> quantum_ry circuit=`self` qubit=`比特` theta=`参数`** +*> quantum_ry circuit=`self` qubit=`比特` theta=`参数`* ## 绕Z + `比特`=0 + `参数` -**> quantum_rz circuit=`self` qubit=`比特` theta=`参数`** +*> quantum_rz circuit=`self` qubit=`比特` theta=`参数`* ## 控非 + `控制`=0 + `目标`=1 -**> quantum_cx circuit=`self` control=`控制` target=`目标`** +*> quantum_cx circuit=`self` control=`控制` target=`目标`* ## 控相 + `控制`=0 + `目标`=1 -**> quantum_cz circuit=`self` control=`控制` target=`目标`** +*> quantum_cz circuit=`self` control=`控制` target=`目标`* ## 交换 + `比特甲`=0 + `比特乙`=1 -**> quantum_swap circuit=`self` a=`比特甲` b=`比特乙`** +*> quantum_swap circuit=`self` a=`比特甲` b=`比特乙`* ## 屏障 仅可视化分隔(不改态)。 -**> quantum_barrier circuit=`self`** +*> quantum_barrier circuit=`self`* ## 测量 + `比特`=None 标记计算基读出(空 = 全部比特)。影响 `运行` 报告哪些位。 -**> quantum_measure circuit=`self` qubits=`比特`** +*> quantum_measure circuit=`self` qubits=`比特`* ## 追加 + `操作` 追加另一电路的 ops,或 `{gate,qubits}` 操作表。 -**> quantum_append circuit=`self` op=`操作`** +*> quantum_append circuit=`self` op=`操作`* ## 施加 + `门` @@ -149,7 +149,7 @@ import json:lib/json.mq.md 将门句柄(具名或 `矩阵=` 自定义)施加到 `比特`(整数或列表)。 -**> quantum_apply circuit=`self` gate=`门` qubits=`比特`** +*> quantum_apply circuit=`self` gate=`门` qubits=`比特`* ## 噪声 + `种类` @@ -157,25 +157,25 @@ import json:lib/json.mq.md 教学噪声,供 `运行` 轨迹使用(`bitflip` / `depolarizing` / `amplitude_damping`,或中文:比特翻转 / 退极化 / 振幅阻尼)。`模拟` / `概率` 忽略。 -**> quantum_noise circuit=`self` kind=`种类` p=`概率`** +*> quantum_noise circuit=`self` kind=`种类` p=`概率`* ## 模拟 返回态矢量振幅 `{re,im}`(理想;无噪声)。 -**> quantum_simulate circuit=`self`** +*> quantum_simulate circuit=`self`* ## 态 理想态矢量(与 `模拟` 相同振幅)。 -**> quantum_state circuit=`self`** +*> quantum_state circuit=`self`* ## 概率 基矢标签 → 概率(qubit 0 为最右侧比特)。理想;忽略噪声。 -**> quantum_probabilities circuit=`self`** +*> quantum_probabilities circuit=`self`* ## 运行 + `次数`=1024 @@ -183,7 +183,7 @@ import json:lib/json.mq.md 计算基采样(`种子=` 可复现)。若设置了电路噪声则启用。 -**> quantum_run circuit=`self` shots=`次数` seed=`种子`** +*> quantum_run circuit=`self` shots=`次数` seed=`种子`* ## 绘图 + `路径`=None @@ -193,27 +193,27 @@ import json:lib/json.mq.md 电路轨线 / 概率条 / 布洛赫 / 高级态图(种类 circuit、probs、bloch、hinton、city、density、paulivec、qsphere、multibloch)。主题 dark(默认科技感)/ light / bw。经 record_plot 进入 view/CLI plots。 -**> quantum_draw_circuit circuit=`self` path=`路径` kind=`种类` qubit=`比特` theme=`主题`** +*> quantum_draw_circuit circuit=`self` path=`路径` kind=`种类` qubit=`比特` theme=`主题`* ## 密度 理想模拟后的纯态密度矩阵 ρ=|ψ⟩⟨ψ|。 -**> 密度 态=`self`** +*> 密度 态=`self`* ## 期望 + `可观测量` Pauli 串(左端=高比特)或矩阵期望值。 -**> quantum_density_expect density=`self` obs=`可观测量`** +*> quantum_density_expect density=`self` obs=`可观测量`* ## 施密特 + `分割`=1 二分施密特分解(`分割`=子系统 A 的比特数,低位)。 -**> quantum_schmidt state=`self` cut=`分割`** +*> quantum_schmidt state=`self` cut=`分割`* # 门 + `名`=None @@ -223,17 +223,17 @@ Pauli 串(左端=高比特)或矩阵期望值。 具名内置门(`名=H`)或由 `矩阵=`(嵌套 list 或公式矩阵围栏)定义的自定义酉门。自定义门可选 `名=`(默认 `U`)。 > 确保插件 -**> quantum_gate_new name=`名` theta=`参数` matrix=`矩阵`** +*> quantum_gate_new name=`名` theta=`参数` matrix=`矩阵`* ## 矩阵 -**> quantum_gate_matrix gate=`self`** +*> quantum_gate_matrix gate=`self`* ## 匹配矩阵 + `矩阵` + `容差`=0.000000001 -**> quantum_gate_matches_matrix gate=`self` matrix=`矩阵` tol=`容差`** +*> quantum_gate_matches_matrix gate=`self` matrix=`矩阵` tol=`容差`* ## 绘图 + `路径`=None @@ -241,7 +241,7 @@ Pauli 串(左端=高比特)或矩阵期望值。 门符号或复矩阵热力图(`种类=gate|matrix`)。经 `record_plot` 记录。 -**> quantum_gate_draw gate=`self` path=`路径` kind=`种类`** +*> quantum_gate_draw gate=`self` path=`路径` kind=`种类`* # 密度 + `态`=None @@ -251,37 +251,37 @@ Pauli 串(左端=高比特)或矩阵期望值。 > 确保插件 1. `矩阵` - **> quantum_density_from_matrix matrix=`矩阵`** + *> quantum_density_from_matrix matrix=`矩阵`* 2. * - **> quantum_density_from_state state=`态`** + *> quantum_density_from_state state=`态`* ## 矩阵 -**> quantum_density_matrix density=`self`** +*> quantum_density_matrix density=`self`* ## 纯度 Tr(ρ²)。 -**> quantum_density_purity density=`self`** +*> quantum_density_purity density=`self`* ## 部分迹 + `保留` 保留所列比特(LSB=0),对其余求迹。 -**> quantum_density_partial_trace density=`self` keep=`保留`** +*> quantum_density_partial_trace density=`self` keep=`保留`* ## 本征 厄米谱 → `{eigenvalues, eigenvectors}`。 -**> quantum_density_eig density=`self`** +*> quantum_density_eig density=`self`* ## 期望 + `可观测量` -**> quantum_density_expect density=`self` obs=`可观测量`** +*> quantum_density_expect density=`self` obs=`可观测量`* ## 绘图 + `路径`=None @@ -289,4 +289,4 @@ Tr(ρ²)。 Hinton / 城市 / 密度格 / 泡利向量 SVG(`种类=hinton` 或 city / density / paulivec)。 -**> quantum_density_draw density=`self` path=`路径` kind=`种类`** +*> quantum_density_draw density=`self` path=`路径` kind=`种类`* diff --git a/ext/web/web.mq.md b/ext/web/web.mq.md index da79d71..fd1df63 100644 --- a/ext/web/web.mq.md +++ b/ext/web/web.mq.md @@ -10,7 +10,7 @@ import table:lib/table.mq.md Load the ABI v2 `web` plugin once. -*p = > plugin.native_path name="web"* +**p = > plugin.native_path name="web"** 1. `p` > plugin.load path=`p` 2. * @@ -36,7 +36,7 @@ For complex themes prefer `page.css` (raw string, no table eval) or an external them into CSS — 样式即数据、装配即函数. > ensure_plugin -**> web_style name=`name` table=`table` strict=`strict`** +*> web_style name=`name` table=`table` strict=`strict`* ## make_images + `table` @@ -47,7 +47,7 @@ Assemble a GFM image table into an HTML fragment (`div.mq-images` of `链接`/`宽度`/`高度`/`加载`/`图注`). Images stay as data — 图片即数据、装配即函数. > ensure_plugin -**> web_images table=`table`** +*> web_images table=`table`* ## make_head + `table` @@ -56,7 +56,7 @@ Assemble a Head resource table into HTML (`` / `"** + *""* 2. * - **""** + *""* 2. * - **""** + *""* ## text_patch + `sel` @@ -83,8 +83,8 @@ Run `marqdo wasm build -o static` and `app.static dir=static`. Design: [browser- Shortcut: build a `set_text` effects map `{ set_text: { sel: text } }` for browser return values. Prefer authoring with `lib/browser` + GFM tables in client `.mq.md` ([marqdo-dev](../../.cursor/skills/marqdo-dev/SKILL.md)). -*`m` = > table.put in=None at=sel value=text* -**> table.put in=None at="set_text" value=m** +**`m` = > table.put in=None at=sel value=text** +*> table.put in=None at="set_text" value=m* ## dom_patch + `set_text`=None @@ -115,58 +115,58 @@ Prefer authoring with `lib/browser` + GFM tables in client `.mq.md` ([marqdo-dev Merge browser effect keys into one return map (omit `None`). Route E/F effects included. -*`out` = > table.put in=None at="_mq" value=True* +**`out` = > table.put in=None at="_mq" value=True** 1. `set_text` != None - *`out` = > table.put in=`out` at="set_text" value=set_text* + **`out` = > table.put in=`out` at="set_text" value=set_text** 1. `set_value` != None - *`out` = > table.put in=`out` at="set_value" value=set_value* + **`out` = > table.put in=`out` at="set_value" value=set_value** 1. `set_attr` != None - *`out` = > table.put in=`out` at="set_attr" value=set_attr* + **`out` = > table.put in=`out` at="set_attr" value=set_attr** 1. `set_class` != None - *`out` = > table.put in=`out` at="set_class" value=set_class* + **`out` = > table.put in=`out` at="set_class" value=set_class** 1. `toggle_class` != None - *`out` = > table.put in=`out` at="toggle_class" value=toggle_class* + **`out` = > table.put in=`out` at="toggle_class" value=toggle_class** 1. `set_style` != None - *`out` = > table.put in=`out` at="set_style" value=set_style* + **`out` = > table.put in=`out` at="set_style" value=set_style** 1. `set_html` != None - *`out` = > table.put in=`out` at="set_html" value=set_html* + **`out` = > table.put in=`out` at="set_html" value=set_html** 1. `render_list` != None - *`out` = > table.put in=`out` at="render_list" value=render_list* + **`out` = > table.put in=`out` at="render_list" value=render_list** 1. `navigate` != None - *`out` = > table.put in=`out` at="navigate" value=navigate* + **`out` = > table.put in=`out` at="navigate" value=navigate** 1. `storage` != None - *`out` = > table.put in=`out` at="storage" value=storage* + **`out` = > table.put in=`out` at="storage" value=storage** 1. `ws` != None - *`out` = > table.put in=`out` at="ws" value=ws* + **`out` = > table.put in=`out` at="ws" value=ws** 1. `fetch` != None - *`out` = > table.put in=`out` at="fetch" value=fetch* + **`out` = > table.put in=`out` at="fetch" value=fetch** 1. `fetch_all` != None - *`out` = > table.put in=`out` at="fetch_all" value=fetch_all* + **`out` = > table.put in=`out` at="fetch_all" value=fetch_all** 1. `after` != None - *`out` = > table.put in=`out` at="after" value=after* + **`out` = > table.put in=`out` at="after" value=after** 1. `interval` != None - *`out` = > table.put in=`out` at="interval" value=interval* + **`out` = > table.put in=`out` at="interval" value=interval** 1. `clear_interval` != None - *`out` = > table.put in=`out` at="clear_interval" value=clear_interval* + **`out` = > table.put in=`out` at="clear_interval" value=clear_interval** 1. `focus` != None - *`out` = > table.put in=`out` at="focus" value=focus* + **`out` = > table.put in=`out` at="focus" value=focus** 1. `blur` != None - *`out` = > table.put in=`out` at="blur" value=blur* + **`out` = > table.put in=`out` at="blur" value=blur** 1. `scroll_into` != None - *`out` = > table.put in=`out` at="scroll_into" value=scroll_into* + **`out` = > table.put in=`out` at="scroll_into" value=scroll_into** 1. `canvas` != None - *`out` = > table.put in=`out` at="canvas" value=canvas* + **`out` = > table.put in=`out` at="canvas" value=canvas** 1. `audio` != None - *`out` = > table.put in=`out` at="audio" value=audio* + **`out` = > table.put in=`out` at="audio" value=audio** 1. `read_file` != None - *`out` = > table.put in=`out` at="read_file" value=read_file* + **`out` = > table.put in=`out` at="read_file" value=read_file** 1. `observe` != None - *`out` = > table.put in=`out` at="observe" value=observe* + **`out` = > table.put in=`out` at="observe" value=observe** 1. `unobserve` != None - *`out` = > table.put in=`out` at="unobserve" value=unobserve* + **`out` = > table.put in=`out` at="unobserve" value=unobserve** 1. `wire` != None - *`out` = > table.put in=`out` at="wire" value=wire* -**out** + **`out` = > table.put in=`out` at="wire" value=wire** +*out* ## list_html + `sel` @@ -175,10 +175,10 @@ Merge browser effect keys into one return map (omit `None`). Route E/F effects i Build a `render_list` effect: `{ render_list: { sel: { tag, items } } }`. -*`spec` = > table.put in=None at="tag" value=tag* -*`spec` = > table.put in=`spec` at="items" value=items* -*`m` = > table.put in=None at=sel value=spec* -**> table.put in=None at="render_list" value=m** +**`spec` = > table.put in=None at="tag" value=tag** +**`spec` = > table.put in=`spec` at="items" value=items** +**`m` = > table.put in=None at=sel value=spec** +*> table.put in=None at="render_list" value=m* # page + `title`="Marqdo Web" @@ -188,31 +188,31 @@ Build a `render_list` effect: `{ render_list: { sel: { tag, items } } }`. + `asset_version`=None > ensure_plugin -**> web_page_new title=`title` intro=`intro` shell_css=`shell_css` layout=`layout` asset_version=`asset_version`** +*> web_page_new title=`title` intro=`intro` shell_css=`shell_css` layout=`layout` asset_version=`asset_version`* ## shell_css + `mode`=full Framework shell CSS mode for this page: `full` (default), `minimal` (vars only), or `off`/`none`. -*`out` = > table.put in=`self` at="shell_css" value=mode* -**out** +**`out` = > table.put in=`self` at="shell_css" value=mode** +*out* ## layout + `layout`=sidebar Page chrome layout: `sidebar` (default when a side slot exists), `stacked` (single column; no `has-sidebar` grid), `bare` (main only), or `rail`. -*`out` = > table.put in=`self` at="layout" value=layout* -**out** +**`out` = > table.put in=`self` at="layout" value=layout** +*out* ## asset_version + `version`="" Default `?v=` bump for head scripts/styles that omit a per-row `version` column. -*`out` = > table.put in=`self` at="asset_version" value=version* -**out** +**`out` = > table.put in=`self` at="asset_version" value=version** +*out* ## compose_components + `components` @@ -221,14 +221,14 @@ Assemble nav / sidebar / footer from a page table (`|组件|样式|` or `|src|st Nav bind tables may include optional `媒体`/`media` (responsive show) and `当`/`when` (`auth` / `guest` / `hide`) columns — see C4 conditional nav. -**> web_compose_components page=`self` components=`components`** +*> web_compose_components page=`self` components=`components`* ## compose_main + `main` Assemble main from a bind table (`|属性|值|样式|` or `|front|back|css|`). -**> web_compose_main page=`self` main=`main`** +*> web_compose_main page=`self` main=`main`* ## query + `query` @@ -236,14 +236,14 @@ Assemble main from a bind table (`|属性|值|样式|` or `|front|back|css|`). Attach a DB where-condition map for the main bind. Values may contain `{param}` placeholders that are resolved from dynamic-route params (e.g. `/post/{slug}`). -**> web_page_query page=`self` query=`query`** +*> web_page_query page=`self` query=`query`* ## order + `order` Set a default `ORDER BY` for the main bind (e.g. `-created_at` for newest first). -**> web_page_order page=`self` order=`order`** +*> web_page_order page=`self` order=`order`* ## link_prefix + `prefix` @@ -251,16 +251,16 @@ Set a default `ORDER BY` for the main bind (e.g. `-created_at` for newest first) Prefix for card links in the main bind (default `/post/`). Cards whose bind has an `href`/`链接` field become ``. -**> web_page_link_prefix page=`self` prefix=`prefix`** +*> web_page_link_prefix page=`self` prefix=`prefix`* ## css + `css` -Append a **raw** CSS string to the page's stylesheet (`styles_css`). Skips table-cell +Append a *raw* CSS string to the page's stylesheet (`styles_css`). Skips table-cell expression evaluation — use for themes with `/`, `@keyframes`, or long media queries. Hand-written theme alongside the assembled shell; or link `static/theme.css` via `head`. -**> web_page_css page=`self` css=`css`** +*> web_page_css page=`self` css=`css`* ## detail + `detail`=True @@ -268,7 +268,7 @@ Hand-written theme alongside the assembled shell; or link `static/theme.css` via Render the main bind's first row as a full article (title/meta/tags/body) instead of a list of cards. Set on the dynamic post page so `/post/{slug}` shows one post. -**> web_page_detail page=`self` detail=`detail`** +*> web_page_detail page=`self` detail=`detail`* ## chrome + `nav_html`="" @@ -277,28 +277,28 @@ of a list of cards. Set on the dynamic post page so `/post/{slug}` shows one pos Override default header/footer list chrome with raw HTML (site navbar / footer). Optional `body_class` is appended to ``. -**> web_page_chrome page=`self` nav_html=`nav_html` footer_html=`footer_html` body_class=`body_class`** +*> web_page_chrome page=`self` nav_html=`nav_html` footer_html=`footer_html` body_class=`body_class`* ## meta + `meta` SEO / OpenGraph metadata as a data table (`|key|value|`). Keys such as `title`, `description`, `canonical`, `og:type` become `` tags at render time. Special keys `icon` / `favicon` / `apple-touch-icon` emit `` (not ``). -**> web_page_meta page=`self` meta=`meta`** +*> web_page_meta page=`self` meta=`meta`* ## head + `table` Assemble `` resources from a GFM table (`|rel|href|type|sizes|media|as|crossorigin|defer|async|version|` or ZH `|关系|地址|…|推迟|异步|版本|`). `rel=script` / `module` become `"** + *""* 2. * - **""** + *""* 2. * - **""** + *""* ## 文本补丁 + `选择器` @@ -76,8 +76,8 @@ import table:lib/table.mq.md 快捷构造 `set_text` 效应表。客户端优先 `lib/浏览器` + GFM 表格。 -*`m` = > table.put in=None at=选择器 value=文本* -**> table.put in=None at="set_text" value=m** +**`m` = > table.put in=None at=选择器 value=文本** +*> table.put in=None at="set_text" value=m* ## DOM补丁 + `set_text`=None @@ -108,58 +108,58 @@ import table:lib/table.mq.md 合并浏览器效应键(含路线 E/F)为一张返回表(跳过 `None`)。 -*`out` = > table.put in=None at="_mq" value=True* +**`out` = > table.put in=None at="_mq" value=True** 1. `set_text` != None - *`out` = > table.put in=`out` at="set_text" value=set_text* + **`out` = > table.put in=`out` at="set_text" value=set_text** 1. `set_value` != None - *`out` = > table.put in=`out` at="set_value" value=set_value* + **`out` = > table.put in=`out` at="set_value" value=set_value** 1. `set_attr` != None - *`out` = > table.put in=`out` at="set_attr" value=set_attr* + **`out` = > table.put in=`out` at="set_attr" value=set_attr** 1. `set_class` != None - *`out` = > table.put in=`out` at="set_class" value=set_class* + **`out` = > table.put in=`out` at="set_class" value=set_class** 1. `toggle_class` != None - *`out` = > table.put in=`out` at="toggle_class" value=toggle_class* + **`out` = > table.put in=`out` at="toggle_class" value=toggle_class** 1. `set_style` != None - *`out` = > table.put in=`out` at="set_style" value=set_style* + **`out` = > table.put in=`out` at="set_style" value=set_style** 1. `set_html` != None - *`out` = > table.put in=`out` at="set_html" value=set_html* + **`out` = > table.put in=`out` at="set_html" value=set_html** 1. `render_list` != None - *`out` = > table.put in=`out` at="render_list" value=render_list* + **`out` = > table.put in=`out` at="render_list" value=render_list** 1. `navigate` != None - *`out` = > table.put in=`out` at="navigate" value=navigate* + **`out` = > table.put in=`out` at="navigate" value=navigate** 1. `storage` != None - *`out` = > table.put in=`out` at="storage" value=storage* + **`out` = > table.put in=`out` at="storage" value=storage** 1. `ws` != None - *`out` = > table.put in=`out` at="ws" value=ws* + **`out` = > table.put in=`out` at="ws" value=ws** 1. `fetch` != None - *`out` = > table.put in=`out` at="fetch" value=fetch* + **`out` = > table.put in=`out` at="fetch" value=fetch** 1. `fetch_all` != None - *`out` = > table.put in=`out` at="fetch_all" value=fetch_all* + **`out` = > table.put in=`out` at="fetch_all" value=fetch_all** 1. `after` != None - *`out` = > table.put in=`out` at="after" value=after* + **`out` = > table.put in=`out` at="after" value=after** 1. `interval` != None - *`out` = > table.put in=`out` at="interval" value=interval* + **`out` = > table.put in=`out` at="interval" value=interval** 1. `clear_interval` != None - *`out` = > table.put in=`out` at="clear_interval" value=clear_interval* + **`out` = > table.put in=`out` at="clear_interval" value=clear_interval** 1. `focus` != None - *`out` = > table.put in=`out` at="focus" value=focus* + **`out` = > table.put in=`out` at="focus" value=focus** 1. `blur` != None - *`out` = > table.put in=`out` at="blur" value=blur* + **`out` = > table.put in=`out` at="blur" value=blur** 1. `scroll_into` != None - *`out` = > table.put in=`out` at="scroll_into" value=scroll_into* + **`out` = > table.put in=`out` at="scroll_into" value=scroll_into** 1. `canvas` != None - *`out` = > table.put in=`out` at="canvas" value=canvas* + **`out` = > table.put in=`out` at="canvas" value=canvas** 1. `audio` != None - *`out` = > table.put in=`out` at="audio" value=audio* + **`out` = > table.put in=`out` at="audio" value=audio** 1. `read_file` != None - *`out` = > table.put in=`out` at="read_file" value=read_file* + **`out` = > table.put in=`out` at="read_file" value=read_file** 1. `observe` != None - *`out` = > table.put in=`out` at="observe" value=observe* + **`out` = > table.put in=`out` at="observe" value=observe** 1. `unobserve` != None - *`out` = > table.put in=`out` at="unobserve" value=unobserve* + **`out` = > table.put in=`out` at="unobserve" value=unobserve** 1. `wire` != None - *`out` = > table.put in=`out` at="wire" value=wire* -**out** + **`out` = > table.put in=`out` at="wire" value=wire** +*out* ## 列表HTML + `选择器` @@ -168,10 +168,10 @@ import table:lib/table.mq.md 构造 `render_list` 效应。 -*`spec` = > table.put in=None at="tag" value=标签* -*`spec` = > table.put in=`spec` at="items" value=项* -*`m` = > table.put in=None at=选择器 value=spec* -**> table.put in=None at="render_list" value=m** +**`spec` = > table.put in=None at="tag" value=标签** +**`spec` = > table.put in=`spec` at="items" value=项** +**`m` = > table.put in=None at=选择器 value=spec** +*> table.put in=None at="render_list" value=m* # 页面 + `标题`="站点" @@ -181,76 +181,76 @@ import table:lib/table.mq.md + `资源版本`=None > 确保插件 -**> web_page_new title=`标题` intro=`引言` shell_css=`壳样式` layout=`布局` asset_version=`资源版本`** +*> web_page_new title=`标题` intro=`引言` shell_css=`壳样式` layout=`布局` asset_version=`资源版本`* ## 壳样式 + `模式`=full 框架壳 CSS:`full`(默认)/ `minimal`(仅变量)/ `off`。 -*`out` = > table.put in=`自` at="shell_css" value=模式* -**out** +**`out` = > table.put in=`自` at="shell_css" value=模式** +*out* ## 布局 + `布局`=sidebar 页面壳:`sidebar`(有侧栏时默认双列)/ `stacked`(单列、不加 has-sidebar)/ `bare`(仅 main)/ `rail`。 -*`out` = > table.put in=`自` at="layout" value=布局* -**out** +**`out` = > table.put in=`自` at="layout" value=布局** +*out* ## 资源版本 + `版本`="" 为未写 `版本` 列的 head 脚本/样式统一追加 `?v=`。 -*`out` = > table.put in=`自` at="asset_version" value=版本* -**out** +**`out` = > table.put in=`自` at="asset_version" value=版本** +*out* ## 组件装配 + `组件` -**> web_compose_components page=`self` components=`组件`** +*> web_compose_components page=`self` components=`组件`* ## 主体装配 + `主体` -**> web_compose_main page=`self` main=`主体`** +*> web_compose_main page=`self` main=`主体`* ## 查询条件 + `条件` 为主主体绑定附加 DB 条件映射。值可含 `{参数}` 占位符,由动态路由参数替换(如 `/post/{slug}`)。 -**> web_page_query page=`self` query=`条件`** +*> web_page_query page=`self` query=`条件`* ## 排序 + `排序` 设置主主体绑定的默认 `ORDER BY`(如 `-created_at` 表示最新在前)。 -**> web_page_order page=`self` order=`排序`** +*> web_page_order page=`self` order=`排序`* ## 链接前缀 + `前缀` 卡片链接前缀(默认 `/post/`)。主体绑定中含 `链接`/`href` 字段时,卡片标题会包成 ``。 -**> web_page_link_prefix page=`self` prefix=`前缀`** +*> web_page_link_prefix page=`self` prefix=`前缀`* ## 样式 + `样式` -把一段**原始** CSS 字符串追加到页面样式表(`styles_css`),不经表单元格表达式求值——适合含 `/`、`@keyframes` 或长 media 的主题。也可外链 `static/theme.css` 再经 `头装配`。 +把一段原始 CSS 字符串追加到页面样式表(`styles_css`),不经表单元格表达式求值——适合含 `/`、`@keyframes` 或长 media 的主题。也可外链 `static/theme.css` 再经 `头装配`。 -**> web_page_css page=`self` css=`样式`** +*> web_page_css page=`self` css=`样式`* ## 详情 + `详情`=True 把主体绑定的首行渲染成完整文章(标题/日期/标签/正文)而非卡片列表。用于动态文章页 `/post/{slug}`。 -**> web_page_detail page=`self` detail=`详情`** +*> web_page_detail page=`self` detail=`详情`* ## 壳HTML + `导航`="" @@ -259,28 +259,28 @@ import table:lib/table.mq.md 覆盖默认 `
    ` / `