feat(parse): use nested YAML import: maps instead of one-liner binds
Frontmatter imports are now valid YAML (`import:` / `导入:` with bind→target entries), removing spaced keys. Add `marqdo migrate imports`, hard-error the old one-liner form, and migrate lib/ext/examples/tests/docs accordingly. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
8bbe017a5e
commit
687c168014
364 files changed
+1870
-1004
No files matched your search
@@ -144,7 +144,7 @@ Matching surrounding **legacy** `json.set` in `ext/ai/*.mq.md` is **not** compli
|
||||
7. **Do not use `##` inside `# main` for document sectioning** — those become nested functions. Use paragraphs / `---` breaks instead.
|
||||
8. **Index:** prefer `[键](集合)` / `` [`名`](集合) `` over footnote `` m[^k] ``.
|
||||
|
||||
Browser client programs: prefer `import browser:lib/browser.mq.md` (no native plugin). Server sites: Artifact Metadata (`type: web|endpoint`) + `ext/web` facade + `ext/data` / `ext/security` / `ext/net` — see [ext-web-artifact.md](../../doc/design/ext-web-artifact.md). **Never** restore `compose_*` / `app.configure`.
|
||||
Browser client programs: prefer nested `import:` with `browser: lib/browser.mq.md` (no native plugin). Server sites: Artifact Metadata (`type: web|endpoint`) + `ext/web` facade + `ext/data` / `ext/security` / `ext/net` — see [ext-web-artifact.md](../../doc/design/ext-web-artifact.md). **Never** restore `compose_*` / `app.configure`.
|
||||
|
||||
## Developing libraries (`lib/*`, `ext/*`)
|
||||
|
||||
@@ -186,7 +186,7 @@ When editing a file full of `json.set`:
|
||||
1. Turn static structures into GFM tables.
|
||||
2. Replace repeated effect shapes with `browser.*` / `web.text_patch` / `web.dom_patch`.
|
||||
3. Leave at most sparse `table.put` for dynamic keys.
|
||||
4. Drop `import json:…` if unused.
|
||||
4. Drop unused `json:` (or other) entries under nested `import:`.
|
||||
|
||||
## Anti-patterns
|
||||
|
||||
|
||||
@@ -49,8 +49,7 @@ Canonical design (repo): `doc/design/markdown-mapping.md`, `doc/design/keywords.
|
||||
| Line `N. *` | Else arm |
|
||||
| `> fn args` | Call (named `k=v` or positional) |
|
||||
| `` > `obj`.method args `` | Method call (`obj` must be a map with `_type`) |
|
||||
| Frontmatter `import bind:path.mq.md` / `导入` | Import file (bind library name) |
|
||||
| Frontmatter `import bind:lib.member` / `导入` | Short name for a library member (same keyword; no separate `use`) |
|
||||
| Frontmatter nested `import:` / `导入:` map | Import file (`bind: path.mq.md`) or short name (`bind: lib.member`) |
|
||||
| `> lib.member …` / `> lib.Type.member …` | Call via bare dotted path (instance methods need `` `var`.m ``) |
|
||||
| `*…*` | Statement (bind / expr) — closing `*` touches last token, **no trailing space**; bare ids are variables |
|
||||
| `**…**` | Return value — closing `**` touches last token, **no trailing space**; bare ids are variables |
|
||||
@@ -136,13 +135,14 @@ Chinese builtins (same functions, no import):
|
||||
|
||||
## Frontmatter imports + stdlib
|
||||
|
||||
Imports use `import bind:target` (`导入` equivalent): file (`.mq.md`) or short name (`lib.member`). Members are **not** flattened into the caller. Call with a bare dotted path:
|
||||
Imports use nested YAML `import:` (`导入:` equivalent): file (`.mq.md`) or short name (`lib.member`). Members are **not** flattened into the caller. Call with a bare dotted path:
|
||||
|
||||
```markdown
|
||||
---
|
||||
title: example
|
||||
import text:lib/text.mq.md
|
||||
import clock:lib/time.mq.md
|
||||
import:
|
||||
text: lib/text.mq.md
|
||||
clock: lib/time.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
@@ -141,7 +141,8 @@ Row-oriented records (SQL-like): first header `@` / `行` / `row` → list of ma
|
||||
|
||||
```markdown
|
||||
---
|
||||
import browser:lib/browser.mq.md
|
||||
import:
|
||||
browser: lib/browser.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
@@ -168,7 +169,8 @@ Return and soft-error packs are **tables**, not `json.set` pipelines. Full style
|
||||
|
||||
```markdown
|
||||
---
|
||||
import table:lib/table.mq.md
|
||||
import:
|
||||
table: lib/table.mq.md
|
||||
---
|
||||
|
||||
## step_ok
|
||||
@@ -217,7 +219,8 @@ Do **not** mirror legacy `ext/ai/agent.mq.md` `json.parse`+`json.set` chains whe
|
||||
```markdown
|
||||
---
|
||||
title: split demo
|
||||
import text:lib/text.mq.md
|
||||
import:
|
||||
text: lib/text.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
@@ -230,8 +233,9 @@ import text:lib/text.mq.md
|
||||
|
||||
```markdown
|
||||
---
|
||||
import re:lib/re.mq.md
|
||||
import enc:lib/encoding.mq.md
|
||||
import:
|
||||
re: lib/re.mq.md
|
||||
enc: lib/encoding.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
@@ -246,8 +250,9 @@ import enc:lib/encoding.mq.md
|
||||
|
||||
```markdown
|
||||
---
|
||||
import log:lib/log.mq.md
|
||||
import uuid:lib/uuid.mq.md
|
||||
import:
|
||||
log: lib/log.mq.md
|
||||
uuid: lib/uuid.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
@@ -278,7 +283,8 @@ After a blank line, code runs:
|
||||
```markdown
|
||||
---
|
||||
description: loads math
|
||||
import math:lib/math.mq.md
|
||||
import:
|
||||
math: lib/math.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
@@ -326,7 +332,8 @@ See `tests/structure/object-handle.mq.md` and `ext/ai/llm.mq.md`: `# Type` const
|
||||
|
||||
```markdown
|
||||
---
|
||||
import agent:ext/agent.mq.md
|
||||
import:
|
||||
agent: ext/agent.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
@@ -378,8 +385,9 @@ if x > 0:
|
||||
```markdown
|
||||
---
|
||||
title: hello-site
|
||||
import web:ext/web/web.mq.md
|
||||
import db:db/index.mq.md
|
||||
import:
|
||||
web: ext/web/web.mq.md
|
||||
db: db/index.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
@@ -416,7 +424,8 @@ import db:db/index.mq.md
|
||||
|
||||
```markdown
|
||||
---
|
||||
import quantum:ext/quantum/quantum.mq.md
|
||||
import:
|
||||
quantum: ext/quantum/quantum.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
@@ -445,7 +454,8 @@ import quantum:ext/quantum/quantum.mq.md
|
||||
|
||||
```markdown
|
||||
---
|
||||
import la:ext/linalg/linalg.mq.md
|
||||
import:
|
||||
la: ext/linalg/linalg.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
@@ -122,7 +122,8 @@ Examples: `examples/linalg-svd/`, `examples/linalg-least-squares/`. Design: `doc
|
||||
|
||||
```markdown
|
||||
---
|
||||
import math:lib/math.mq.md
|
||||
import:
|
||||
math: lib/math.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
@@ -141,7 +142,8 @@ Empty RHS assignment + following `$$…$$` binds a formula value. Narrative-only
|
||||
|
||||
```markdown
|
||||
---
|
||||
import foreign:lib/foreign.mq.md
|
||||
import:
|
||||
foreign: lib/foreign.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
@@ -36,7 +36,8 @@ type: llm
|
||||
model: ${env.OPENAI_MODEL ?? "gpt-4o-mini"}
|
||||
api_key: ${secret.OPENAI_API_KEY!}
|
||||
base_url: ${env.OPENAI_BASE_URL ?? "https://api.openai.com/v1"}
|
||||
import sys:lib/sys.mq.md
|
||||
import:
|
||||
sys: lib/sys.mq.md
|
||||
---
|
||||
```
|
||||
|
||||
|
||||
@@ -156,7 +156,8 @@ source: &str (+ optional import map)
|
||||
|
||||
```markdown
|
||||
---
|
||||
import json:lib/json.mq.md
|
||||
import:
|
||||
json: lib/json.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
@@ -80,7 +80,7 @@ Marqdo 换 **Rust 或 C++** 都不改变「主前端不该是 Flex/Bison」这
|
||||
| **pulldown-cmark** *或* **comrak** | GFM 事件/AST | 标题、列表、表格、emphasis/strong;Spike 已证明「库 + 行扫描」可行。二选一做 Spike 对比后钉死 |
|
||||
| **thiserror** / **anyhow** | 错误类型 | 诊断与 CLI 报错 |
|
||||
| **clap** | CLI | `marqdo run [path]` |
|
||||
| **serde** + **serde_yaml** | 元信息 | 仅解析 frontmatter 中的 YAML **键值**;`import x:x.mq.md` 仍按**行**抽取(见 Spike) |
|
||||
| **serde** + **serde_yaml** | 元信息 | 仅解析 frontmatter 中的 YAML **键值**;嵌套 `import:` 映射与其它 YAML 键一并解析 |
|
||||
| **ureq** (=2.9.7) | HTTP(S) | `lib/net`;为 Cargo 1.81 另钉 `idna_adapter`/`zeroize`(见根 `Cargo.toml`) |
|
||||
| **regex** (=1.13.1) | 正则 | Mid M1 `lib/re`;`default-features=false` + `std`/`unicode`;无回溯引用 |
|
||||
| **sha2** (=0.10.9) / **sha1** (=0.10.6) / **md-5** (=0.10.6) / **hmac** (=0.12.1) | 摘要 | Mid M3 `lib/hash` |
|
||||
|
||||
@@ -112,7 +112,8 @@ parse/check/catalog 保留整个 `Named<T>`。所以循环不会被误判成“
|
||||
```markdown
|
||||
---
|
||||
id: knowledge.people.li-bai
|
||||
import li_bai:knowledge/people/li-bai.mq.md
|
||||
import:
|
||||
li_bai: knowledge/people/li-bai.mq.md
|
||||
---
|
||||
|
||||
# 回答
|
||||
|
||||
@@ -61,7 +61,8 @@ Unknown names fail. Queries are only valid during a plugin function call (host s
|
||||
|
||||
```markdown
|
||||
---
|
||||
import plugin:lib/plugin.mq.md
|
||||
import:
|
||||
plugin: lib/plugin.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
@@ -159,11 +159,12 @@ REPLACE
|
||||
```markdown
|
||||
---
|
||||
title: agent-run-…
|
||||
import llm:ext/ai/llm.mq.md
|
||||
import agent:ext/ai/agent.mq.md
|
||||
import json:lib/json.mq.md
|
||||
import writeback:lib/writeback.mq.md
|
||||
import subtask:lib/subtask.mq.md
|
||||
import:
|
||||
llm: ext/ai/llm.mq.md
|
||||
agent: ext/ai/agent.mq.md
|
||||
json: lib/json.mq.md
|
||||
writeback: lib/writeback.mq.md
|
||||
subtask: lib/subtask.mq.md
|
||||
---
|
||||
|
||||
# 总目标
|
||||
|
||||
@@ -72,10 +72,11 @@ Marqdo 的宪法是 **代码即文档、文档即知识库**:
|
||||
|
||||
```markdown
|
||||
---
|
||||
导入 智能体:ext/ai/智能体.mq.md
|
||||
导入 大模型:ext/ai/大模型.mq.md
|
||||
导入 自写回:lib/自写回.mq.md
|
||||
导入 时间:lib/时间.mq.md
|
||||
导入:
|
||||
智能体: ext/ai/智能体.mq.md
|
||||
大模型: ext/ai/大模型.mq.md
|
||||
自写回: lib/自写回.mq.md
|
||||
时间: lib/时间.mq.md
|
||||
---
|
||||
|
||||
## 获取时间
|
||||
|
||||
@@ -197,7 +197,8 @@
|
||||
|
||||
````markdown
|
||||
---
|
||||
import la:ext/linalg/linalg.mq.md
|
||||
import:
|
||||
la: ext/linalg/linalg.mq.md
|
||||
---
|
||||
|
||||
# 转置反序
|
||||
|
||||
@@ -201,8 +201,9 @@ $$
|
||||
|
||||
````markdown
|
||||
---
|
||||
import la:ext/linalg/linalg.mq.md
|
||||
import table:lib/table.mq.md
|
||||
import:
|
||||
la: ext/linalg/linalg.mq.md
|
||||
table: lib/table.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
@@ -20,7 +20,8 @@ Import:
|
||||
|
||||
```markdown
|
||||
---
|
||||
import llm:ext/ai/llm.mq.md
|
||||
import:
|
||||
llm: ext/ai/llm.mq.md
|
||||
---
|
||||
```
|
||||
|
||||
|
||||
@@ -101,7 +101,8 @@ marqdo ext add quantum
|
||||
|
||||
```markdown
|
||||
---
|
||||
import quantum:ext/quantum/quantum.mq.md
|
||||
import:
|
||||
quantum: ext/quantum/quantum.mq.md
|
||||
---
|
||||
```
|
||||
|
||||
@@ -341,7 +342,8 @@ Q5 教学噪声 + barrier/measure/append/state — 见 [ext-quantum-q5.md](ext-
|
||||
```markdown
|
||||
---
|
||||
title: Bell state
|
||||
import quantum:ext/quantum/quantum.mq.md
|
||||
import:
|
||||
quantum: ext/quantum/quantum.mq.md
|
||||
---
|
||||
|
||||
# Bell |Φ+⟩
|
||||
|
||||
@@ -62,8 +62,9 @@ route: /
|
||||
method: GET
|
||||
data_source: posts
|
||||
data_order: -created_at
|
||||
import web:ext/web/web.mq.md
|
||||
import data:ext/data/db.mq.md
|
||||
import:
|
||||
web: ext/web/web.mq.md
|
||||
data: ext/data/db.mq.md
|
||||
---
|
||||
|
||||
# Marqdo
|
||||
@@ -106,7 +107,8 @@ path: /api/posts
|
||||
request: json
|
||||
response: json
|
||||
auth: member
|
||||
import data:ext/data/db.mq.md
|
||||
import:
|
||||
data: ext/data/db.mq.md
|
||||
---
|
||||
|
||||
**post = > data.db.insert …**
|
||||
|
||||
@@ -49,7 +49,8 @@
|
||||
英文:
|
||||
|
||||
```markdown
|
||||
import web:ext/web/web.mq.md
|
||||
import:
|
||||
web: ext/web/web.mq.md
|
||||
|
||||
# main
|
||||
|
||||
|
||||
+16
-14
@@ -128,13 +128,14 @@ myapp/
|
||||
---
|
||||
title: web-site
|
||||
description: Home = page table; main may be inline; class methods assemble.
|
||||
import web:ext/web/web.mq.md
|
||||
import shell:styles/shell.mq.md
|
||||
import nav:components/nav.mq.md
|
||||
import side:components/side.mq.md
|
||||
import foot:components/foot.mq.md
|
||||
import articles:db/articles.mq.md
|
||||
import db:db/index.mq.md
|
||||
import:
|
||||
web: ext/web/web.mq.md
|
||||
shell: styles/shell.mq.md
|
||||
nav: components/nav.mq.md
|
||||
side: components/side.mq.md
|
||||
foot: components/foot.mq.md
|
||||
articles: db/articles.mq.md
|
||||
db: db/index.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
@@ -171,13 +172,14 @@ Main content is not a reusable component, so it is authored here.
|
||||
```markdown
|
||||
---
|
||||
title: 站点
|
||||
导入 网页:ext/web/网页.mq.md
|
||||
import shell:styles/shell.mq.md
|
||||
import nav:components/nav.mq.md
|
||||
import side:components/side.mq.md
|
||||
import foot:components/foot.mq.md
|
||||
import articles:db/articles.mq.md
|
||||
import db:db/index.mq.md
|
||||
导入:
|
||||
网页: ext/web/网页.mq.md
|
||||
shell: styles/shell.mq.md
|
||||
nav: components/nav.mq.md
|
||||
side: components/side.mq.md
|
||||
foot: components/foot.mq.md
|
||||
articles: db/articles.mq.md
|
||||
db: db/index.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
@@ -678,7 +678,8 @@ L1 完成后 AI 就能静态查链接;L2/L3 才是执行与呈现。
|
||||
```markdown
|
||||
---
|
||||
markup: occlusion
|
||||
import libai:libai.mq.md
|
||||
import:
|
||||
libai: libai.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
| 状态 | **Accepted;统一 `import bind:target` 已锁定** |
|
||||
| 状态 | **Accepted;嵌套 YAML `import:` / `导入:` 映射已锁定** |
|
||||
| 日期 | 2026-08-13 |
|
||||
| 相关 | [stdlib-modules.md](stdlib-modules.md) · [stdlib-i18n.md](stdlib-i18n.md) · [markdown-mapping.md](markdown-mapping.md) · [objects.md](objects.md) · [call-arguments.md](call-arguments.md) · [ext-agent.md](ext-agent.md) |
|
||||
|
||||
@@ -16,9 +16,9 @@
|
||||
|
||||
- `lib/json` 的 `parse` 与 `lib/time` 的 `parse` 不能共存。
|
||||
- 官方 ext / 多库编排无法按大型语言习惯书写 `time.parse` / `json.parse`。
|
||||
- 旧 frontmatter `import path:path.mq.md` 对 Markdown / 编辑器不友好,且与调用标记 `>` 抢外形。
|
||||
- 旧 frontmatter 一行式 `import bind:target` 在 YAML 里会变成带空格的键,与正规元信息不兼容。
|
||||
|
||||
**结论**:模块命名空间 + 点号寻址;frontmatter 导入统一为可读的 `import bind:target`。
|
||||
**结论**:模块命名空间 + 点号寻址;frontmatter 导入统一为嵌套 YAML 映射 `import:\n bind: target`。
|
||||
|
||||
---
|
||||
|
||||
@@ -29,8 +29,8 @@
|
||||
1. **导入绑定库名**:导入一个 `.mq.md` 得到一个**库(模块)绑定**,成员不倒进全局。
|
||||
2. **点号寻址调用**:`库.成员`、`库.对象.成员`;`.` 表示定义树寻址。
|
||||
3. **库名不是变量**:路径段为**裸标识符**,不加反引号。
|
||||
4. **短名与文件导入同形**:`import fmt:time.format`,废除独立 `use` 关键字。
|
||||
5. **中英对等**:`import` / `导入`。
|
||||
4. **短名与文件导入同形**:同在 `import:` 映射下写 `fmt: time.format`,废除独立 `use` 关键字。
|
||||
5. **中英对等**:`import:` / `导入:`。
|
||||
|
||||
### 2.2 非目标
|
||||
|
||||
@@ -54,27 +54,38 @@
|
||||
|
||||
### 3.2 导入句法(frontmatter)
|
||||
|
||||
仍只出现在文件头成对 `---` 内。**调用**仍用 `> print`(不变)。
|
||||
仍只出现在文件头成对 `---` 内。**调用**仍用 `> print`(不变)。键为合法 YAML:`import:` / `导入:`,值为嵌套映射。
|
||||
|
||||
```yaml
|
||||
---
|
||||
import:
|
||||
utils: utils.mq.md
|
||||
json: lib/json.mq.md
|
||||
fmt: time.format
|
||||
---
|
||||
```
|
||||
|
||||
| 含义 | 英文 | 中文 |
|
||||
|------|------|------|
|
||||
| 导入文件 | `import utils:utils.mq.md` | `导入 utils:utils.mq.md` |
|
||||
| 标准库 | `import json:lib/json.mq.md` | `导入 json:lib/json.mq.md` |
|
||||
| 短名(成员) | `import fmt:time.format` | `导入 fmt:时间.格式化` |
|
||||
| 导入文件 | `import:` → `utils: utils.mq.md` | `导入:` → `utils: utils.mq.md` |
|
||||
| 标准库 | `json: lib/json.mq.md` | 同左(或中文库路径) |
|
||||
| 短名(成员) | `fmt: time.format` | `fmt: 时间.格式化` |
|
||||
|
||||
规则:
|
||||
|
||||
- **绑定名必填**,在 `:` 左侧(裸名,无反引号)。
|
||||
- `:` 右侧 `target`:
|
||||
- **绑定名必填**,为映射键(裸名,无反引号);冒号后须有空格(正规 YAML)。
|
||||
- 映射值 `target`:
|
||||
- 以 `.mq.md` 结尾 → **文件导入**;
|
||||
- 否则为 **点号路径**(≥2 段),把该成员绑为本地短名(须先有对应文件导入)。
|
||||
- 同一文件内绑定名不得冲突(文件库名与短名共用命名空间)→ 硬错误。
|
||||
- 旧写法 `> ….mq.md`、`> … as …`、`> use …`、`> 使用 …` → **硬错误**,并提示新句法。
|
||||
- 同一文件不得同时出现 `import:` 与 `导入:`。
|
||||
- 旧写法一行式 `import bind:target`、`> ….mq.md`、`> use …` → **硬错误**;可用 `marqdo migrate imports --write` 迁移。
|
||||
|
||||
### 3.3 废除的旧规则
|
||||
|
||||
不再支持:
|
||||
|
||||
- 一行式 `import bind:target` / `导入 bind:target`;
|
||||
- 省略绑定名时用文件名茎作库名;
|
||||
- 导入侧 `as` / `作为`;
|
||||
- 独立关键字 `use` / `使用`。
|
||||
@@ -101,8 +112,9 @@ path_callee ::= ident ('.' ident)+
|
||||
|
||||
```markdown
|
||||
---
|
||||
import time:lib/time.mq.md
|
||||
import json:lib/json.mq.md
|
||||
import:
|
||||
time: lib/time.mq.md
|
||||
json: lib/json.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
@@ -139,8 +151,9 @@ import json:lib/json.mq.md
|
||||
|
||||
```markdown
|
||||
---
|
||||
import time:lib/time.mq.md
|
||||
import fmt:time.format
|
||||
import:
|
||||
time: lib/time.mq.md
|
||||
fmt: time.format
|
||||
---
|
||||
|
||||
# main
|
||||
@@ -153,10 +166,11 @@ import fmt:time.format
|
||||
|
||||
```markdown
|
||||
---
|
||||
import time:lib/time.mq.md
|
||||
import writeback:lib/writeback.mq.md
|
||||
import agent:ext/ai/agent.mq.md
|
||||
import json:lib/json.mq.md
|
||||
import:
|
||||
time: lib/time.mq.md
|
||||
writeback: lib/writeback.mq.md
|
||||
agent: ext/ai/agent.mq.md
|
||||
json: lib/json.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
@@ -179,13 +193,12 @@ import json:lib/json.mq.md
|
||||
|
||||
| 旧 | 新 |
|
||||
|----|----|
|
||||
| `import time:lib/time.mq.md` | `import time:lib/time.mq.md` |
|
||||
| `import t`:lib/time.mq.md | `import t:lib/time.mq.md` |
|
||||
| `import fmt`:time.format
|
||||
| `import time:lib/time.mq.md` | `import:` → `time: lib/time.mq.md` |
|
||||
| `import fmt:time.format` | `import:` → `fmt: time.format` |
|
||||
| 茎名默认库名 | 绑定名始终显式 |
|
||||
| 扁平合并进全局 | 仅库绑定 + 可选短名 |
|
||||
|
||||
不提供旧 `>` 导入过渡开关。
|
||||
不提供旧一行式 / `>` 导入过渡开关;`marqdo migrate imports --write` 可机械迁移。
|
||||
|
||||
---
|
||||
|
||||
@@ -201,20 +214,20 @@ import json:lib/json.mq.md
|
||||
|
||||
## 8. 实现要点
|
||||
|
||||
1. frontmatter 只解析 `import` / `导入` 行;右侧分流文件 / 成员。
|
||||
1. frontmatter 解析嵌套 `import:` / `导入:` 映射;子项分流文件 / 成员。
|
||||
2. AST 仍用 `Import`(文件)与 `Use`(短名)存储,对外无 `use` 关键字。
|
||||
3. 金样例:`tests/structure/import/`、`tests/structure/ns/`。
|
||||
|
||||
| 阶段 | 内容 |
|
||||
|------|------|
|
||||
| M1+M2 | 点号路径 + 短名 — 已落地 |
|
||||
| **Import 句法** | 统一 `import bind:target` — **本波次** |
|
||||
| **Import 句法** | 嵌套 YAML `import:` — **本波次** |
|
||||
|
||||
---
|
||||
|
||||
## 9. 决议摘要
|
||||
|
||||
1. 导入 = `import bind:target`(`导入` 等价)。
|
||||
1. 导入 = 嵌套 `import:` / `导入:` 映射(`bind: target`)。
|
||||
2. target = `.mq.md` 文件 **或** `库.成员` 点号路径。
|
||||
3. 调用以裸名点号路径寻址;实例方法用反引号接收者(仅独立 `>` 调用;`*…*`/`**…**` 段内接收者不加反引号)。
|
||||
4. 裸点号 `a.b`:`a` 为局部变量 → 方法调用,否则 → 库路径(Python 统一命名空间)。
|
||||
@@ -35,7 +35,8 @@
|
||||
|
||||
```markdown
|
||||
---
|
||||
import text:lib/text.mq.md
|
||||
import:
|
||||
text: lib/text.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
@@ -44,7 +45,8 @@ import text:lib/text.mq.md
|
||||
|
||||
```markdown
|
||||
---
|
||||
导入 文本:lib/文本.mq.md
|
||||
导入:
|
||||
文本: lib/文本.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
@@ -17,7 +17,8 @@
|
||||
|
||||
```markdown
|
||||
---
|
||||
import table:lib/table.mq.md
|
||||
import:
|
||||
table: lib/table.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
@@ -51,8 +51,9 @@ Frontmatter 导入**绑定库名**(默认 = 文件名茎;`as` / `作为` 可
|
||||
|
||||
```markdown
|
||||
---
|
||||
import text:lib/text.mq.md
|
||||
import table:lib/table.mq.md
|
||||
import:
|
||||
text: lib/text.mq.md
|
||||
table: lib/table.mq.md
|
||||
---
|
||||
```
|
||||
|
||||
|
||||
@@ -79,7 +79,8 @@ Marqdo 用 `#` 标题定义**对象 / 类型**,用 `##` 定义其下的**方
|
||||
|
||||
```markdown
|
||||
---
|
||||
import json:lib/json.mq.md
|
||||
import:
|
||||
json: lib/json.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
+16
-10
@@ -17,8 +17,9 @@ description: 描述文字
|
||||
|
||||
```markdown
|
||||
---
|
||||
import text:lib/text.mq.md
|
||||
import time:lib/time.mq.md
|
||||
import:
|
||||
text: lib/text.mq.md
|
||||
time: lib/time.mq.md
|
||||
---
|
||||
```
|
||||
|
||||
@@ -35,8 +36,9 @@ import time:lib/time.mq.md
|
||||
|
||||
```markdown
|
||||
---
|
||||
import time:lib/time.mq.md
|
||||
import json:lib/json.mq.md
|
||||
import:
|
||||
time: lib/time.mq.md
|
||||
json: lib/json.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
@@ -55,7 +57,8 @@ import json:lib/json.mq.md
|
||||
|
||||
```markdown
|
||||
---
|
||||
import agent:ext/ai/agent.mq.md
|
||||
import:
|
||||
agent: ext/ai/agent.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
@@ -71,8 +74,9 @@ import agent:ext/ai/agent.mq.md
|
||||
|
||||
```markdown
|
||||
---
|
||||
import time:lib/time.mq.md
|
||||
import fmt:time.format
|
||||
import:
|
||||
time: lib/time.mq.md
|
||||
fmt: time.format
|
||||
---
|
||||
|
||||
# main
|
||||
@@ -98,7 +102,8 @@ import fmt:time.format
|
||||
|
||||
```markdown
|
||||
---
|
||||
import agent:ext/ai/agent.mq.md
|
||||
import:
|
||||
agent: ext/ai/agent.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
@@ -143,8 +148,9 @@ project/
|
||||
|
||||
```markdown
|
||||
---
|
||||
import 数学:lib/数学.mq.md
|
||||
import 问候:lib/问候.mq.md
|
||||
import:
|
||||
数学: lib/数学.mq.md
|
||||
问候: lib/问候.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
+10
-5
@@ -56,7 +56,8 @@ Marqdo 内置函数无需导入即可使用;更丰富的能力通过导入 `li
|
||||
|
||||
```markdown
|
||||
---
|
||||
import json:lib/json.mq.md
|
||||
import:
|
||||
json: lib/json.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
@@ -85,7 +86,8 @@ import json:lib/json.mq.md
|
||||
|
||||
```markdown
|
||||
---
|
||||
import text:lib/text.mq.md
|
||||
import:
|
||||
text: lib/text.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
@@ -101,7 +103,8 @@ import text:lib/text.mq.md
|
||||
|
||||
```markdown
|
||||
---
|
||||
import math:lib/math.mq.md
|
||||
import:
|
||||
math: lib/math.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
@@ -114,7 +117,8 @@ import math:lib/math.mq.md
|
||||
|
||||
```markdown
|
||||
---
|
||||
import math:lib/math.mq.md
|
||||
import:
|
||||
math: lib/math.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
@@ -145,7 +149,8 @@ marqdo ext add quantum
|
||||
|
||||
```markdown
|
||||
---
|
||||
import llm:ext/llm.mq.md
|
||||
import:
|
||||
llm: ext/llm.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
@@ -29,7 +29,8 @@ marqdo ext add web
|
||||
|
||||
```markdown
|
||||
---
|
||||
import net:lib/net.mq.md
|
||||
import:
|
||||
net: lib/net.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
@@ -84,7 +85,8 @@ route: /
|
||||
method: GET
|
||||
data_source: posts
|
||||
data_order: -created_at
|
||||
import web:ext/web/web.mq.md
|
||||
import:
|
||||
web: ext/web/web.mq.md
|
||||
---
|
||||
|
||||
# 我的站点
|
||||
@@ -118,8 +120,9 @@ response: json
|
||||
|
||||
```markdown
|
||||
---
|
||||
import web:ext/web/web.mq.md
|
||||
import posts:db/posts.mq.md
|
||||
import:
|
||||
web: ext/web/web.mq.md
|
||||
posts: db/posts.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
@@ -145,7 +148,8 @@ import posts:db/posts.mq.md
|
||||
|
||||
```markdown
|
||||
---
|
||||
import data:ext/data/db.mq.md
|
||||
import:
|
||||
data: ext/data/db.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
@@ -162,7 +166,8 @@ HTTP 门禁与登录走 `ext/security`(`auth` / `rbac` / `oidc`),再用 `w
|
||||
|
||||
```markdown
|
||||
---
|
||||
import rbac:ext/security/rbac.mq.md
|
||||
import:
|
||||
rbac: ext/security/rbac.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
@@ -318,7 +318,8 @@ error: cannot resolve import `../execution/docgate.mq.md` from
|
||||
**跨目录**才用 `..`:
|
||||
|
||||
```markdown
|
||||
import ctx:../knowledge/context.mq.md
|
||||
import:
|
||||
ctx: ../knowledge/context.mq.md
|
||||
```
|
||||
|
||||
### 5.2 库名必须导入,不能用裸名
|
||||
@@ -328,7 +329,8 @@ error: unknown library `json` (import it in frontmatter)
|
||||
```
|
||||
|
||||
```markdown
|
||||
import json:lib/json.mq.md
|
||||
import:
|
||||
json: lib/json.mq.md
|
||||
```
|
||||
|
||||
标准库函数要**带库名前缀**:`json.parse`、`txt.contains`、`table.put`。
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
---
|
||||
title: agent-okf-flywheel (Wave B0)
|
||||
description: Promote solidified workbook; second plan is cache=hit — document as knowledge base (OKF).
|
||||
import llm:ext/ai/llm.mq.md
|
||||
import agent:ext/ai/agent.mq.md
|
||||
import fs:lib/fs.mq.md
|
||||
import json:lib/json.mq.md
|
||||
import plugin:lib/plugin.mq.md
|
||||
import sys:lib/sys.mq.md
|
||||
import:
|
||||
llm: ext/ai/llm.mq.md
|
||||
agent: ext/ai/agent.mq.md
|
||||
fs: lib/fs.mq.md
|
||||
json: lib/json.mq.md
|
||||
plugin: lib/plugin.mq.md
|
||||
sys: lib/sys.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
@@ -3,12 +3,13 @@ title: agent-pong (Wave B0)
|
||||
description: >-
|
||||
Constitution demo — call_site + source in step context; optional live CALL via .env.
|
||||
Code is documentation; tools are ## in this same file.
|
||||
import llm:ext/ai/llm.mq.md
|
||||
import agent:ext/ai/agent.mq.md
|
||||
import json:lib/json.mq.md
|
||||
import plugin:lib/plugin.mq.md
|
||||
import sys:lib/sys.mq.md
|
||||
import time:lib/time.mq.md
|
||||
import:
|
||||
llm: ext/ai/llm.mq.md
|
||||
agent: ext/ai/agent.mq.md
|
||||
json: lib/json.mq.md
|
||||
plugin: lib/plugin.mq.md
|
||||
sys: lib/sys.mq.md
|
||||
time: lib/time.mq.md
|
||||
---
|
||||
|
||||
## 获取时间
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
title: agent-sandbox-okf — trial then commit
|
||||
description: >
|
||||
O1 example: opt-in sandbox trial with GFM-table returns and link-index reads.
|
||||
import agent:ext/ai/agent.mq.md
|
||||
import fs:lib/fs.mq.md
|
||||
import:
|
||||
agent: ext/ai/agent.mq.md
|
||||
fs: lib/fs.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
markup: occlusion
|
||||
title: components/feed
|
||||
description: 帖子列表 / 新闻时间线 / 板块栏 HTML 片段(对齐 Django feed 与 home 局部模板)。
|
||||
import table:lib/table.mq.md
|
||||
import text:lib/text.mq.md
|
||||
import:
|
||||
table: lib/table.mq.md
|
||||
text: lib/text.mq.md
|
||||
---
|
||||
|
||||
## 帖子列表HTML
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
---
|
||||
title: components/fragments
|
||||
description: AJAX 片段 — /post/ten、/news/five。
|
||||
导入 网页:ext/web/网页.mq.md
|
||||
import db:../db/index.mq.md
|
||||
import feed:feed.mq.md
|
||||
导入:
|
||||
网页: ext/web/网页.mq.md
|
||||
db: ../db/index.mq.md
|
||||
feed: feed.mq.md
|
||||
---
|
||||
|
||||
## 帖子十
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
---
|
||||
title: components/home_body
|
||||
description: 首页主体 HTML — hero + 公告 + 新闻时间线 + 论坛帖子(对齐 Django home.html,无外层导航)。
|
||||
导入 网页:ext/web/网页.mq.md
|
||||
import table:lib/table.mq.md
|
||||
import text:lib/text.mq.md
|
||||
import feed:feed.mq.md
|
||||
导入:
|
||||
网页: ext/web/网页.mq.md
|
||||
table: lib/table.mq.md
|
||||
text: lib/text.mq.md
|
||||
feed: feed.mq.md
|
||||
---
|
||||
|
||||
## 装配
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
---
|
||||
title: components/page
|
||||
description: 用原站 chrome 包一层完整 HTML 引言(bare 布局)。
|
||||
import text:lib/text.mq.md
|
||||
import chrome:chrome.mq.md
|
||||
import:
|
||||
text: lib/text.mq.md
|
||||
chrome: chrome.mq.md
|
||||
---
|
||||
|
||||
## 包装
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
---
|
||||
title: db/index
|
||||
description: 打开库、建全表、幂等种子、帖子全文索引。
|
||||
导入 网页:ext/web/网页.mq.md
|
||||
import schema:schema.mq.md
|
||||
import seed:seed.mq.md
|
||||
导入:
|
||||
网页: ext/web/网页.mq.md
|
||||
schema: schema.mq.md
|
||||
seed: seed.mq.md
|
||||
---
|
||||
|
||||
## 打开
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
---
|
||||
title: 暗恋见君 · Marqdo
|
||||
description: 对齐 Django 暗恋见君:原站 CSS/DOM、首页四段、列表详情、发帖门禁、聊天室、专题、搜索、API 指南。
|
||||
导入 网页:ext/web/网页.mq.md
|
||||
import table:lib/table.mq.md
|
||||
import text:lib/text.mq.md
|
||||
import chrome:components/chrome.mq.md
|
||||
import page:components/page.mq.md
|
||||
import home:components/home_body.mq.md
|
||||
import feed:components/feed.mq.md
|
||||
import fragments:components/fragments.mq.md
|
||||
import db:db/index.mq.md
|
||||
导入:
|
||||
网页: ext/web/网页.mq.md
|
||||
table: lib/table.mq.md
|
||||
text: lib/text.mq.md
|
||||
chrome: components/chrome.mq.md
|
||||
page: components/page.mq.md
|
||||
home: components/home_body.mq.md
|
||||
feed: components/feed.mq.md
|
||||
fragments: components/fragments.mq.md
|
||||
db: db/index.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
---
|
||||
title: anlian-mq offline smoke
|
||||
description: 不 listen:装配库表/页面/门禁/WS 路由袋,验证可读路径可构造。
|
||||
导入 网页:ext/web/网页.mq.md
|
||||
import shell:styles/shell.mq.md
|
||||
import nav:components/nav.mq.md
|
||||
import foot:components/foot.mq.md
|
||||
import db:db/index.mq.md
|
||||
import sys:lib/sys.mq.md
|
||||
导入:
|
||||
网页: ext/web/网页.mq.md
|
||||
shell: styles/shell.mq.md
|
||||
nav: components/nav.mq.md
|
||||
foot: components/foot.mq.md
|
||||
db: db/index.mq.md
|
||||
sys: lib/sys.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
---
|
||||
title: styles/shell
|
||||
description: 暗恋见君壳样式——对照 Django 原站粉玻璃 + 动效,用表格声明。
|
||||
导入 网页:ext/web/网页.mq.md
|
||||
import text:lib/text.mq.md
|
||||
导入:
|
||||
网页: ext/web/网页.mq.md
|
||||
text: lib/text.mq.md
|
||||
---
|
||||
|
||||
对照原站 `config/static/front/css/{base,feed_common,footer,index/hero}.css`:
|
||||
|
||||
@@ -2,9 +2,10 @@
|
||||
markup: occlusion
|
||||
title: browser-app (route E+)
|
||||
description: list CRUD, storage, navigate, interval, fetch_all, ws — GFM + lib/browser
|
||||
import browser:lib/browser.mq.md
|
||||
import table:lib/table.mq.md
|
||||
import text:lib/text.mq.md
|
||||
import:
|
||||
browser: lib/browser.mq.md
|
||||
table: lib/table.mq.md
|
||||
text: lib/text.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
---
|
||||
title: browser counter (C3)
|
||||
description: wire table + browser.set_text — no json glue
|
||||
import browser:lib/browser.mq.md
|
||||
import:
|
||||
browser: lib/browser.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
---
|
||||
title: browser fetch (C4)
|
||||
description: fetch/after effects via lib/browser — no json glue
|
||||
import browser:lib/browser.mq.md
|
||||
import:
|
||||
browser: lib/browser.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
---
|
||||
title: browser form (D3)
|
||||
description: input wire passes value; effects via lib/browser
|
||||
import browser:lib/browser.mq.md
|
||||
import table:lib/table.mq.md
|
||||
import:
|
||||
browser: lib/browser.mq.md
|
||||
table: lib/table.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
@@ -197,6 +197,20 @@ export function eventArgsFromDom(ev, valueFromSel) {
|
||||
args.fields = fields;
|
||||
}
|
||||
}
|
||||
if (ev && (ev.type === "scroll" || ev.type === "resize")) {
|
||||
try {
|
||||
const doc = typeof document !== "undefined" ? document.documentElement : null;
|
||||
const body = typeof document !== "undefined" ? document.body : null;
|
||||
const scrollTop = (doc && (doc.scrollTop || 0)) || (body && body.scrollTop) || 0;
|
||||
const height = doc ? (doc.scrollHeight - doc.clientHeight) || 1 : 1;
|
||||
const ratio = Math.max(0, Math.min(1, scrollTop / height));
|
||||
args.scroll_top = scrollTop;
|
||||
args.scroll_max = height;
|
||||
args.scroll_ratio = ratio;
|
||||
} catch (_) {
|
||||
/* ignore */
|
||||
}
|
||||
}
|
||||
return args;
|
||||
}
|
||||
|
||||
@@ -721,75 +735,88 @@ function runObserveEffect(exports, spec, onError) {
|
||||
const kind = String(spec.kind || spec.type || "intersect").toLowerCase();
|
||||
const sel = String(spec.sel || "");
|
||||
const thenFn = spec.then;
|
||||
const id = String(spec.id || `obs${++observeSeq}`);
|
||||
const el = qsOne(sel);
|
||||
if (!el || !thenFn) return;
|
||||
const baseId = String(spec.id || `obs${++observeSeq}`);
|
||||
const nodes = qsAll(sel);
|
||||
if (!nodes.length || (!thenFn && !spec.add_class)) return;
|
||||
|
||||
const prev = observeHandles.get(id);
|
||||
if (prev) {
|
||||
try {
|
||||
prev.disconnect();
|
||||
} catch (_) {
|
||||
/* ignore */
|
||||
}
|
||||
}
|
||||
|
||||
const fire = (payload) => {
|
||||
try {
|
||||
const result = call(exports, thenFn, payload);
|
||||
if (!result.ok) {
|
||||
if (onError) onError(result.error);
|
||||
return;
|
||||
nodes.forEach((el, idx) => {
|
||||
const id = nodes.length === 1 ? baseId : `${baseId}_${idx}`;
|
||||
const prev = observeHandles.get(id);
|
||||
if (prev) {
|
||||
try {
|
||||
prev.disconnect();
|
||||
} catch (_) {
|
||||
/* ignore */
|
||||
}
|
||||
applyEffects(exports, result.value, { onError });
|
||||
} catch (e) {
|
||||
if (onError) onError(String(e));
|
||||
}
|
||||
};
|
||||
|
||||
if (kind === "resize" && typeof ResizeObserver !== "undefined") {
|
||||
const ro = new ResizeObserver((entries) => {
|
||||
const en = entries[0];
|
||||
const cr = en?.contentRect;
|
||||
fire({
|
||||
ok: true,
|
||||
kind: "resize",
|
||||
id,
|
||||
width: cr ? cr.width : 0,
|
||||
height: cr ? cr.height : 0,
|
||||
});
|
||||
});
|
||||
ro.observe(el);
|
||||
observeHandles.set(id, ro);
|
||||
return;
|
||||
}
|
||||
const fire = (payload) => {
|
||||
try {
|
||||
const result = call(exports, thenFn, payload);
|
||||
if (!result.ok) {
|
||||
if (onError) onError(result.error);
|
||||
return;
|
||||
}
|
||||
applyEffects(exports, result.value, { onError });
|
||||
} catch (e) {
|
||||
if (onError) onError(String(e));
|
||||
}
|
||||
};
|
||||
|
||||
if (typeof IntersectionObserver !== "undefined") {
|
||||
const io = new IntersectionObserver(
|
||||
(entries) => {
|
||||
if (kind === "resize" && typeof ResizeObserver !== "undefined") {
|
||||
const ro = new ResizeObserver((entries) => {
|
||||
const en = entries[0];
|
||||
if (!en) return;
|
||||
const cr = en?.contentRect;
|
||||
fire({
|
||||
ok: true,
|
||||
kind: "intersect",
|
||||
kind: "resize",
|
||||
id,
|
||||
intersecting: !!en.isIntersecting,
|
||||
ratio: en.intersectionRatio,
|
||||
width: cr ? cr.width : 0,
|
||||
height: cr ? cr.height : 0,
|
||||
});
|
||||
if (spec.once && en.isIntersecting) {
|
||||
try {
|
||||
io.disconnect();
|
||||
} catch (_) {
|
||||
/* ignore */
|
||||
});
|
||||
ro.observe(el);
|
||||
observeHandles.set(id, ro);
|
||||
return;
|
||||
}
|
||||
|
||||
if (typeof IntersectionObserver !== "undefined") {
|
||||
const opts = { threshold: spec.threshold != null ? Number(spec.threshold) : 0.1 };
|
||||
if (spec.rootMargin != null) opts.rootMargin = String(spec.rootMargin);
|
||||
const io = new IntersectionObserver(
|
||||
(entries) => {
|
||||
const en = entries[0];
|
||||
if (!en) return;
|
||||
if (en.isIntersecting && spec.add_class) {
|
||||
for (const c of String(spec.add_class).split(/\s+/).filter(Boolean)) {
|
||||
el.classList.add(c);
|
||||
}
|
||||
}
|
||||
observeHandles.delete(id);
|
||||
}
|
||||
},
|
||||
{ threshold: spec.threshold != null ? Number(spec.threshold) : 0.1 },
|
||||
);
|
||||
io.observe(el);
|
||||
observeHandles.set(id, io);
|
||||
}
|
||||
if (thenFn) {
|
||||
fire({
|
||||
ok: true,
|
||||
kind: "intersect",
|
||||
id,
|
||||
intersecting: !!en.isIntersecting,
|
||||
ratio: en.intersectionRatio,
|
||||
target_id: el.id || "",
|
||||
});
|
||||
}
|
||||
if (spec.once && en.isIntersecting) {
|
||||
try {
|
||||
io.disconnect();
|
||||
} catch (_) {
|
||||
/* ignore */
|
||||
}
|
||||
observeHandles.delete(id);
|
||||
}
|
||||
},
|
||||
opts,
|
||||
);
|
||||
io.observe(el);
|
||||
observeHandles.set(id, io);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function buildFetchInit(spec) {
|
||||
@@ -921,8 +948,23 @@ function runIntervalEffect(exports, spec, onError) {
|
||||
intervalHandles.set(id, handle);
|
||||
}
|
||||
|
||||
const memoryKV = new Map();
|
||||
|
||||
function storageStore(scope) {
|
||||
if (scope === "cookie") return null;
|
||||
if (scope === "memory" || scope === "mem" || scope === "内存") {
|
||||
return {
|
||||
getItem(key) {
|
||||
return memoryKV.has(key) ? memoryKV.get(key) : null;
|
||||
},
|
||||
setItem(key, value) {
|
||||
memoryKV.set(key, String(value));
|
||||
},
|
||||
removeItem(key) {
|
||||
memoryKV.delete(key);
|
||||
},
|
||||
};
|
||||
}
|
||||
if (typeof localStorage === "undefined") return null;
|
||||
return scope === "session" ? sessionStorage : localStorage;
|
||||
}
|
||||
@@ -1371,12 +1413,24 @@ export async function autoMount(doc) {
|
||||
|
||||
const g = typeof globalThis !== "undefined" ? globalThis : undefined;
|
||||
if (g && g.document) {
|
||||
// Defer WASM boot until after first paint / load so LCP images are not
|
||||
// contending with a ~1.6MB wasm download on the critical path.
|
||||
const start = () => {
|
||||
autoMount(g.document).catch((e) => console.error("marqdo autoMount:", e));
|
||||
const run = () => {
|
||||
autoMount(g.document).catch((e) => console.error("marqdo autoMount:", e));
|
||||
};
|
||||
const schedule = () => {
|
||||
if (typeof g.requestIdleCallback === "function") {
|
||||
g.requestIdleCallback(() => run(), { timeout: 1500 });
|
||||
} else {
|
||||
g.setTimeout(run, 0);
|
||||
}
|
||||
};
|
||||
if (g.document.readyState === "complete") {
|
||||
schedule();
|
||||
} else {
|
||||
g.addEventListener("load", schedule, { once: true });
|
||||
}
|
||||
};
|
||||
if (g.document.readyState === "loading") {
|
||||
g.document.addEventListener("DOMContentLoaded", start);
|
||||
} else {
|
||||
queueMicrotask(start);
|
||||
}
|
||||
start();
|
||||
}
|
||||
@@ -1,8 +1,9 @@
|
||||
---
|
||||
title: browser-media (route F)
|
||||
description: file / canvas / audio / observers / drag — GFM tables + lib/browser
|
||||
import browser:lib/browser.mq.md
|
||||
import table:lib/table.mq.md
|
||||
import:
|
||||
browser: lib/browser.mq.md
|
||||
table: lib/table.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
---
|
||||
id: capability.order-pricing
|
||||
type: Capability
|
||||
import tax:../knowledge/tax-2026.mq.md
|
||||
import order:../schema/order.mq.md
|
||||
import:
|
||||
tax: ../knowledge/tax-2026.mq.md
|
||||
order: ../schema/order.mq.md
|
||||
---
|
||||
|
||||
# 订单定价
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
---
|
||||
id: document.invoice-answer
|
||||
type: Answer
|
||||
import pricing:../capabilities/order-pricing.mq.md
|
||||
import:
|
||||
pricing: ../capabilities/order-pricing.mq.md
|
||||
---
|
||||
|
||||
# 发票回答
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
type: Fact
|
||||
id: libai
|
||||
title: 李白
|
||||
import poet:poet.mq.md
|
||||
import:
|
||||
poet: poet.mq.md
|
||||
---
|
||||
|
||||
# 李白 = > 诗人
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
---
|
||||
import libai:libai.mq.md
|
||||
import:
|
||||
libai: libai.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
---
|
||||
title: Least squares via lstsq
|
||||
description: Overdetermined Ax≈b with ext/linalg lstsq + heatmap.
|
||||
import la:ext/linalg/linalg.mq.md
|
||||
import math:lib/math.mq.md
|
||||
import:
|
||||
la: ext/linalg/linalg.mq.md
|
||||
math: lib/math.mq.md
|
||||
---
|
||||
|
||||
# Least squares from a runnable document
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
---
|
||||
title: SVD structure demo
|
||||
description: Diagonal SVD + structure SVG via ext/linalg.
|
||||
import la:ext/linalg/linalg.mq.md
|
||||
import:
|
||||
la: ext/linalg/linalg.mq.md
|
||||
---
|
||||
|
||||
# SVD from a runnable document
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
---
|
||||
title: Transpose identity (formula document)
|
||||
description: (AB)^T = B^T A^T as a runnable lecture fragment.
|
||||
import la:ext/linalg/linalg.mq.md
|
||||
import:
|
||||
la: ext/linalg/linalg.mq.md
|
||||
---
|
||||
|
||||
# Transpose reverses products
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
---
|
||||
markup: occlusion
|
||||
import libai:libai.mq.md
|
||||
import:
|
||||
libai: libai.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
---
|
||||
title: blog posts schema
|
||||
import data:ext/data/db.mq.md
|
||||
import:
|
||||
data: ext/data/db.mq.md
|
||||
---
|
||||
|
||||
## schema
|
||||
|
||||
@@ -7,7 +7,8 @@ data_source: posts
|
||||
data_order: -created_at
|
||||
description: >-
|
||||
Document Artifact 首页(ADR 0007):正文即文档,列表来自 data_source。
|
||||
导入 网页:ext/web/网页.mq.md
|
||||
导入:
|
||||
网页: ext/web/网页.mq.md
|
||||
---
|
||||
|
||||
# Marqdo 博客
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
---
|
||||
title: marqdo-blog serve
|
||||
description: Scan Artifact documents/endpoints and listen (ADR 0007).
|
||||
import web:ext/web/web.mq.md
|
||||
import posts:db/posts.mq.md
|
||||
import:
|
||||
web: ext/web/web.mq.md
|
||||
posts: db/posts.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
---
|
||||
title: styles/theme
|
||||
description: 博客主题:样式即数据表格,装配即函数。
|
||||
import 网页:ext/web/网页.mq.md
|
||||
import text:lib/text.mq.md
|
||||
import:
|
||||
网页: ext/web/网页.mq.md
|
||||
text: lib/text.mq.md
|
||||
---
|
||||
|
||||
博客主题的样式即数据表格:每个 `## 段` 导出一张 GFM 样式表(`|选择器|属性|值|`,
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
---
|
||||
title: 贝尔态:两个量子比特如何一起回答
|
||||
description: 从一条假设开始,搭电路、看概率、画图,并用断言验收。
|
||||
import quantum:ext/quantum/quantum.mq.md
|
||||
import:
|
||||
quantum: ext/quantum/quantum.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
---
|
||||
title: 一份可执行的求导讲义
|
||||
description: 公式、求导、求根、求值与绘图,在同一条叙述里完成。
|
||||
import math:lib/math.mq.md
|
||||
import:
|
||||
math: lib/math.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
markup: occlusion
|
||||
title: 外联:把 Node 当作文档里的计算车间
|
||||
description: 一次性执行、持久会话、显式传值,以及可读的结果。
|
||||
import foreign:lib/foreign.mq.md
|
||||
import:
|
||||
foreign: lib/foreign.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
---
|
||||
title: Bell state
|
||||
description: H then CX; probabilities ≈ 1/2; circuit SVG.
|
||||
import quantum:ext/quantum/quantum.mq.md
|
||||
import math:lib/math.mq.md
|
||||
import json:lib/json.mq.md
|
||||
import:
|
||||
quantum: ext/quantum/quantum.mq.md
|
||||
math: lib/math.mq.md
|
||||
json: lib/json.mq.md
|
||||
---
|
||||
|
||||
# Bell |Φ+⟩
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
---
|
||||
title: Entanglement lab
|
||||
description: Bell state — density, partial trace, Schmidt, themed SVG (Q7/Q8).
|
||||
import quantum:ext/quantum/quantum.mq.md
|
||||
import math:lib/math.mq.md
|
||||
import:
|
||||
quantum: ext/quantum/quantum.mq.md
|
||||
math: lib/math.mq.md
|
||||
---
|
||||
|
||||
# Entanglement from a runnable document
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
---
|
||||
title: GHZ state
|
||||
description: 3-qubit GHZ; |000⟩/|111⟩ ≈ 1/2; probs + H matrix heatmap.
|
||||
import quantum:ext/quantum/quantum.mq.md
|
||||
import:
|
||||
quantum: ext/quantum/quantum.mq.md
|
||||
---
|
||||
|
||||
# GHZ
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
---
|
||||
markup: occlusion
|
||||
import table:lib/table.mq.md
|
||||
import:
|
||||
table: lib/table.mq.md
|
||||
title: Marqdo 语法全景(v1.6 现状)
|
||||
description: 一页看完全部现行语法:遮蔽、调用、取值、循环、分支、表格、契约
|
||||
---
|
||||
|
||||
@@ -4,7 +4,8 @@ title: Marqdo client site
|
||||
route: /
|
||||
method: GET
|
||||
description: SSR Document + client_embed auto-mount; author zero JS (ADR 0007).
|
||||
import web:ext/web/web.mq.md
|
||||
import:
|
||||
web: ext/web/web.mq.md
|
||||
---
|
||||
|
||||
# Marqdo client site
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
---
|
||||
title: web-client-site serve
|
||||
import web:ext/web/web.mq.md
|
||||
import:
|
||||
web: ext/web/web.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
---
|
||||
title: client counter (route D)
|
||||
description: wired by client_embed auto-mount; GFM + lib/browser
|
||||
import browser:lib/browser.mq.md
|
||||
import table:lib/table.mq.md
|
||||
import:
|
||||
browser: lib/browser.mq.md
|
||||
table: lib/table.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
---
|
||||
title: web-collab-doc
|
||||
description: Two-browser collaborative plain-text editor over WS room (LWW snapshot sync)
|
||||
import web:ext/web/web.mq.md
|
||||
import:
|
||||
web: ext/web/web.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
---
|
||||
title: collab client
|
||||
description: LWW text sync over WS room + presence (DOC\\t protocol)
|
||||
import browser:lib/browser.mq.md
|
||||
import table:lib/table.mq.md
|
||||
import text:lib/text.mq.md
|
||||
import:
|
||||
browser: lib/browser.mq.md
|
||||
table: lib/table.mq.md
|
||||
text: lib/text.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
---
|
||||
title: db/index
|
||||
description: 打开 sqlite、建表、幂等种子。
|
||||
导入 网页:ext/web/网页.mq.md
|
||||
import articles:articles.mq.md
|
||||
导入:
|
||||
网页: ext/web/网页.mq.md
|
||||
articles: articles.mq.md
|
||||
---
|
||||
|
||||
## 打开
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
---
|
||||
title: 网络扩展站(中文)
|
||||
description: 首页 + /about + /new(表单)+ /tools(lib/net)+ /admin(登录鉴权)+ /live(WebSocket)。
|
||||
导入 网页:ext/web/网页.mq.md
|
||||
import net:lib/网络.mq.md
|
||||
import text:lib/text.mq.md
|
||||
import shell:styles/shell.mq.md
|
||||
import nav:components/nav.mq.md
|
||||
import side:components/side.mq.md
|
||||
import foot:components/foot.mq.md
|
||||
import articles:db/articles.mq.md
|
||||
import db:db/index.mq.md
|
||||
导入:
|
||||
网页: ext/web/网页.mq.md
|
||||
net: lib/网络.mq.md
|
||||
text: lib/text.mq.md
|
||||
shell: styles/shell.mq.md
|
||||
nav: components/nav.mq.md
|
||||
side: components/side.mq.md
|
||||
foot: components/foot.mq.md
|
||||
articles: db/articles.mq.md
|
||||
db: db/index.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
---
|
||||
title: db/index
|
||||
description: Open sqlite, init articles, seed once.
|
||||
import web:ext/web/web.mq.md
|
||||
import articles:articles.mq.md
|
||||
import:
|
||||
web: ext/web/web.mq.md
|
||||
articles: articles.mq.md
|
||||
---
|
||||
|
||||
## open
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
---
|
||||
title: web-net-site
|
||||
description: Home + /about + /new (form) + /tools (net lib) + /admin (auth) + /live (WebSocket).
|
||||
import web:ext/web/web.mq.md
|
||||
import net:lib/net.mq.md
|
||||
import text:lib/text.mq.md
|
||||
import shell:styles/shell.mq.md
|
||||
import nav:components/nav.mq.md
|
||||
import side:components/side.mq.md
|
||||
import foot:components/foot.mq.md
|
||||
import articles:db/articles.mq.md
|
||||
import db:db/index.mq.md
|
||||
import:
|
||||
web: ext/web/web.mq.md
|
||||
net: lib/net.mq.md
|
||||
text: lib/text.mq.md
|
||||
shell: styles/shell.mq.md
|
||||
nav: components/nav.mq.md
|
||||
side: components/side.mq.md
|
||||
foot: components/foot.mq.md
|
||||
articles: db/articles.mq.md
|
||||
db: db/index.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
---
|
||||
title: db/index
|
||||
description: 打开 sqlite、建表、幂等种子。
|
||||
导入 网页:ext/web/网页.mq.md
|
||||
import articles:articles.mq.md
|
||||
导入:
|
||||
网页: ext/web/网页.mq.md
|
||||
articles: articles.mq.md
|
||||
---
|
||||
|
||||
## open
|
||||
|
||||
@@ -2,14 +2,15 @@
|
||||
title: 中文站点示例
|
||||
description: >-
|
||||
与 examples/web-site 对等的 WWW Demo 样站:表驱动全站;作者业务 JS=0;作者 .css=0。
|
||||
导入 网页:ext/web/网页.mq.md
|
||||
import shell:styles/shell.mq.md
|
||||
import nav:components/nav.mq.md
|
||||
import side:components/side.mq.md
|
||||
import foot:components/foot.mq.md
|
||||
import desk:components/desk.mq.md
|
||||
import articles:db/articles.mq.md
|
||||
import db:db/index.mq.md
|
||||
导入:
|
||||
网页: ext/web/网页.mq.md
|
||||
shell: styles/shell.mq.md
|
||||
nav: components/nav.mq.md
|
||||
side: components/side.mq.md
|
||||
foot: components/foot.mq.md
|
||||
desk: components/desk.mq.md
|
||||
articles: db/articles.mq.md
|
||||
db: db/index.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
@@ -3,8 +3,9 @@ title: styles/shell
|
||||
description: >-
|
||||
Literary dark theme for examples/web-site — ink / wine / gold after the
|
||||
anlian.cyou Zhang Ailing topic. GFM tables only; no author .css.
|
||||
import web:ext/web/web.mq.md
|
||||
import text:lib/text.mq.md
|
||||
import:
|
||||
web: ext/web/web.mq.md
|
||||
text: lib/text.mq.md
|
||||
---
|
||||
|
||||
Authors style the site with **GFM tables** only. App pages use `shell_css=off`
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
---
|
||||
title: db/index
|
||||
description: Open sqlite, init articles, seed once.
|
||||
import web:ext/web/web.mq.md
|
||||
import articles:articles.mq.md
|
||||
import fs:lib/fs.mq.md
|
||||
import:
|
||||
web: ext/web/web.mq.md
|
||||
articles: articles.mq.md
|
||||
fs: lib/fs.mq.md
|
||||
---
|
||||
|
||||
## open
|
||||
|
||||
@@ -3,14 +3,15 @@ title: web-site
|
||||
description: >-
|
||||
WWW Demo sample — GFM tables for shell, schema, forms, styles, and admin.
|
||||
Author business JavaScript: none. Author hand-written .css: none.
|
||||
import web:ext/web/web.mq.md
|
||||
import shell:styles/shell.mq.md
|
||||
import nav:components/nav.mq.md
|
||||
import side:components/side.mq.md
|
||||
import foot:components/foot.mq.md
|
||||
import desk:components/desk.mq.md
|
||||
import articles:db/articles.mq.md
|
||||
import db:db/index.mq.md
|
||||
import:
|
||||
web: ext/web/web.mq.md
|
||||
shell: styles/shell.mq.md
|
||||
nav: components/nav.mq.md
|
||||
side: components/side.mq.md
|
||||
foot: components/foot.mq.md
|
||||
desk: components/desk.mq.md
|
||||
articles: db/articles.mq.md
|
||||
db: db/index.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
@@ -3,8 +3,9 @@ title: styles/shell
|
||||
description: >-
|
||||
Literary dark theme for examples/web-site — ink / wine / gold after the
|
||||
anlian.cyou Zhang Ailing topic. GFM tables only; no author .css.
|
||||
import web:ext/web/web.mq.md
|
||||
import text:lib/text.mq.md
|
||||
import:
|
||||
web: ext/web/web.mq.md
|
||||
text: lib/text.mq.md
|
||||
---
|
||||
|
||||
Authors style the site with **GFM tables** only. App pages use `shell_css=off`
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
---
|
||||
title: web-spa-app
|
||||
description: Native Marqdo SPA — list/detail/edit via WASM client routes + memory store
|
||||
import web:ext/web/web.mq.md
|
||||
import:
|
||||
web: ext/web/web.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
@@ -2,9 +2,10 @@
|
||||
markup: occlusion
|
||||
title: spa client
|
||||
description: routes table + memory store; list / detail / edit
|
||||
import browser:lib/browser.mq.md
|
||||
import table:lib/table.mq.md
|
||||
import text:lib/text.mq.md
|
||||
import:
|
||||
browser: lib/browser.mq.md
|
||||
table: lib/table.mq.md
|
||||
text: lib/text.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
---
|
||||
title: web-tenant-saas demo
|
||||
description: Dual-tenant isolation via ?t= query + tenant_scope JSON API.
|
||||
import web:ext/web/web.mq.md
|
||||
import:
|
||||
web: ext/web/web.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
---
|
||||
title: web-ws-room demo
|
||||
description: Dynamic room WS with presence (G-WS1/2 bag). Open / and connect via bridge or wscat.
|
||||
import web:ext/web/web.mq.md
|
||||
import:
|
||||
web: ext/web/web.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
+13
-12
@@ -1,16 +1,17 @@
|
||||
---
|
||||
title: ext/ai/agent
|
||||
description: Document-driven agent v2 — step / plan / run; Skill Compilation via ABI plugin (episodes → learn → llm_free).
|
||||
import llm:ext/ai/llm.mq.md
|
||||
import json:lib/json.mq.md
|
||||
import sys:lib/sys.mq.md
|
||||
import fs:lib/fs.mq.md
|
||||
import time:lib/time.mq.md
|
||||
import wb:lib/writeback.mq.md
|
||||
import subtask:lib/subtask.mq.md
|
||||
import plugin:lib/plugin.mq.md
|
||||
import sandbox:ext/ai/sandbox.mq.md
|
||||
import table:lib/table.mq.md
|
||||
import:
|
||||
llm: ext/ai/llm.mq.md
|
||||
json: lib/json.mq.md
|
||||
sys: lib/sys.mq.md
|
||||
fs: lib/fs.mq.md
|
||||
time: lib/time.mq.md
|
||||
wb: lib/writeback.mq.md
|
||||
subtask: lib/subtask.mq.md
|
||||
plugin: lib/plugin.mq.md
|
||||
sandbox: ext/ai/sandbox.mq.md
|
||||
table: lib/table.mq.md
|
||||
---
|
||||
|
||||
## build_step_context
|
||||
@@ -181,7 +182,7 @@ 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\u002a\u0060model\u0060 = > llm.llm\u002a\u002a\n","s2":"\u002a\u002a\u0060tools\u0060 = > table.empty_list\u002a\u002a\n","s3":"\u002a\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\u002a\n","s4":"\u002a\u002a\u0060wrap\u0060 = > json.parse text={\"task\":","s5":"}\u002a\u002a\n","s6":"\u002a\u002a\u0060task\u0060 = > json.get value=\u0060wrap\u0060 key=task\u002a\u002a\n","s7":"\u002a\u002a\u0060out\u0060 = > \u0060worker\u0060.step task=\u0060task\u0060 stream=False\u002a\u002a\n","s7b":"\u002a\u002a\u0060text\u0060 = > json.get value=\u0060out\u0060 key=result\u002a\u002a\n","s8":"\u002a\u002a\u0060text\u0060\u002a\u002a\n","d3":"\u002a\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\u002a\n","d3b":"\u002a\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\u002a\n","d4":"\u002a\u002a\u0060wrap\u0060 = > json.parse text={\"task\":","d5":"}\u002a\u002a\n","d6":"\u002a\u002a\u0060task\u0060 = > json.get value=\u0060wrap\u0060 key=task\u002a\u002a\n","d7":"\u002a\u002a\u0060notes\u0060 = > \u0060research\u0060.step task=\u0060task\u0060 stream=False\u002a\u002a\n","d8":"\u002a\u002a\u0060ns\u0060 = > json.stringify value=\u0060notes\u0060\u002a\u002a\n","d9":"\u002a\u002a\u0060wt\u0060 = Write the final answer. Research notes:\u002a\u002a\n","d10":"\u002a\u002a\u0060wt\u0060 = \u0060wt\u0060 + \u0060ns\u0060\u002a\u002a\n","d11":"\u002a\u002a\u0060out\u0060 = > \u0060writer\u0060.step task=\u0060wt\u0060 stream=False\u002a\u002a\n","d11b":"\u002a\u002a\u0060text\u0060 = > json.get value=\u0060out\u0060 key=result\u002a\u002a\n","d12":"\u002a\u002a\u0060text\u0060\u002a\u002a\n"}**
|
||||
**esc = > json.parse text={"h":"---\ntitle: agent workbook\nimport:\n llm: ext/ai/llm.mq.md\n agent: ext/ai/agent.mq.md\n json: lib/json.mq.md\n sys: lib/sys.mq.md\n wb: lib/writeback.mq.md\n 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\u002a\u0060model\u0060 = > llm.llm\u002a\u002a\n","s2":"\u002a\u002a\u0060tools\u0060 = > table.empty_list\u002a\u002a\n","s3":"\u002a\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\u002a\n","s4":"\u002a\u002a\u0060wrap\u0060 = > json.parse text={\"task\":","s5":"}\u002a\u002a\n","s6":"\u002a\u002a\u0060task\u0060 = > json.get value=\u0060wrap\u0060 key=task\u002a\u002a\n","s7":"\u002a\u002a\u0060out\u0060 = > \u0060worker\u0060.step task=\u0060task\u0060 stream=False\u002a\u002a\n","s7b":"\u002a\u002a\u0060text\u0060 = > json.get value=\u0060out\u0060 key=result\u002a\u002a\n","s8":"\u002a\u002a\u0060text\u0060\u002a\u002a\n","d3":"\u002a\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\u002a\n","d3b":"\u002a\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\u002a\n","d4":"\u002a\u002a\u0060wrap\u0060 = > json.parse text={\"task\":","d5":"}\u002a\u002a\n","d6":"\u002a\u002a\u0060task\u0060 = > json.get value=\u0060wrap\u0060 key=task\u002a\u002a\n","d7":"\u002a\u002a\u0060notes\u0060 = > \u0060research\u0060.step task=\u0060task\u0060 stream=False\u002a\u002a\n","d8":"\u002a\u002a\u0060ns\u0060 = > json.stringify value=\u0060notes\u0060\u002a\u002a\n","d9":"\u002a\u002a\u0060wt\u0060 = Write the final answer. Research notes:\u002a\u002a\n","d10":"\u002a\u002a\u0060wt\u0060 = \u0060wt\u0060 + \u0060ns\u0060\u002a\u002a\n","d11":"\u002a\u002a\u0060out\u0060 = > \u0060writer\u0060.step task=\u0060wt\u0060 stream=False\u002a\u002a\n","d11b":"\u002a\u002a\u0060text\u0060 = > json.get value=\u0060out\u0060 key=result\u002a\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"**
|
||||
@@ -1531,7 +1532,7 @@ Parent Plan-and-Move prompt. Short protocol only — no long monologues.
|
||||
**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<exact old>\n===\nREPLACE\n<new>\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"}**
|
||||
**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 nested import: map (llm/agent/json…).\nPATCH must use triple-angle blocks only:\n<<<\nFIND\n<exact old>\n===\nREPLACE\n<new>\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 nested 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"**
|
||||
|
||||
+7
-6
@@ -3,12 +3,13 @@ title: ext/ai/llm
|
||||
description: >-
|
||||
Marqdo LLM intelligence primitive — ask / stream / collect / named handles.
|
||||
OpenAI-compatible and Ollama HTTP stay behind the semantic surface.
|
||||
import sys:lib/sys.mq.md
|
||||
import json:lib/json.mq.md
|
||||
import table:lib/table.mq.md
|
||||
import fs:lib/fs.mq.md
|
||||
import text:lib/text.mq.md
|
||||
import openai:ext/ai/llm/openai.mq.md
|
||||
import:
|
||||
sys: lib/sys.mq.md
|
||||
json: lib/json.mq.md
|
||||
table: lib/table.mq.md
|
||||
fs: lib/fs.mq.md
|
||||
text: lib/text.mq.md
|
||||
openai: ext/ai/llm/openai.mq.md
|
||||
---
|
||||
|
||||
## load_env
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
title: ext/ai/llm/ollama
|
||||
description: >-
|
||||
Ollama backend defaults. Transport reuses openai-compatible /v1 chat completions.
|
||||
import openai:ext/ai/llm/openai.mq.md
|
||||
import sys:lib/sys.mq.md
|
||||
import:
|
||||
openai: ext/ai/llm/openai.mq.md
|
||||
sys: lib/sys.mq.md
|
||||
---
|
||||
|
||||
## resolve
|
||||
|
||||
@@ -6,11 +6,12 @@ description: >-
|
||||
Prefers optional plugins/llm ABI when present; falls back to lib/net.
|
||||
Used by ext/ai/llm; authors should prefer llm.ask / llm.stream.
|
||||
Result packs are GFM tables / table.put (code-as-documentation).
|
||||
import net:lib/net.mq.md
|
||||
import json:lib/json.mq.md
|
||||
import table:lib/table.mq.md
|
||||
import sys:lib/sys.mq.md
|
||||
import plugin:lib/plugin.mq.md
|
||||
import:
|
||||
net: lib/net.mq.md
|
||||
json: lib/json.mq.md
|
||||
table: lib/table.mq.md
|
||||
sys: lib/sys.mq.md
|
||||
plugin: lib/plugin.mq.md
|
||||
---
|
||||
|
||||
## usage_from
|
||||
|
||||
@@ -4,10 +4,11 @@ title: ext/ai/sandbox
|
||||
description: >-
|
||||
CoW trial workspace for AI-generated Marqdo: open / run / diff / commit.
|
||||
Native work lives in plugins/agent (`sandbox_*` → host_query).
|
||||
import plugin:lib/plugin.mq.md
|
||||
import sys:lib/sys.mq.md
|
||||
import table:lib/table.mq.md
|
||||
import fs:lib/fs.mq.md
|
||||
import:
|
||||
plugin: lib/plugin.mq.md
|
||||
sys: lib/sys.mq.md
|
||||
table: lib/table.mq.md
|
||||
fs: lib/fs.mq.md
|
||||
---
|
||||
|
||||
Load the agent plugin once per call (same pattern as other `ext/ai` helpers).
|
||||
|
||||
+6
-5
@@ -3,11 +3,12 @@ title: ext/ai/大模型
|
||||
description: >-
|
||||
Marqdo 大模型智能原语 — 提问 / 流式 / 收集 / 命名句柄。
|
||||
OpenAI 兼容与 Ollama HTTP 藏在语义面之后。
|
||||
导入 系统:lib/系统.mq.md
|
||||
import json:lib/json.mq.md
|
||||
导入 文件:lib/文件.mq.md
|
||||
导入 文本:lib/文本.mq.md
|
||||
import openai:ext/ai/llm/openai.mq.md
|
||||
导入:
|
||||
系统: lib/系统.mq.md
|
||||
json: lib/json.mq.md
|
||||
文件: lib/文件.mq.md
|
||||
文本: lib/文本.mq.md
|
||||
openai: ext/ai/llm/openai.mq.md
|
||||
---
|
||||
|
||||
## 加载环境
|
||||
|
||||
+10
-9
@@ -1,15 +1,16 @@
|
||||
---
|
||||
title: ext/ai/智能体
|
||||
description: 文档驱动智能体 v2 — 单步 / 多步 / 运行;技能编译经 ABI v2 agent 插件(情景 → 学习 → llm_free)。
|
||||
导入 大模型:ext/ai/大模型.mq.md
|
||||
import agent:ext/ai/agent.mq.md
|
||||
import sandbox:ext/ai/sandbox.mq.md
|
||||
import table:lib/table.mq.md
|
||||
import json:lib/json.mq.md
|
||||
导入 系统:lib/系统.mq.md
|
||||
导入 自写回:lib/自写回.mq.md
|
||||
导入 子任务:lib/子任务.mq.md
|
||||
导入 插件:lib/插件.mq.md
|
||||
导入:
|
||||
大模型: ext/ai/大模型.mq.md
|
||||
agent: ext/ai/agent.mq.md
|
||||
sandbox: ext/ai/sandbox.mq.md
|
||||
table: lib/table.mq.md
|
||||
json: lib/json.mq.md
|
||||
系统: lib/系统.mq.md
|
||||
自写回: lib/自写回.mq.md
|
||||
子任务: lib/子任务.mq.md
|
||||
插件: lib/插件.mq.md
|
||||
---
|
||||
|
||||
## 构建单步上下文
|
||||
|
||||
+2
-1
@@ -2,7 +2,8 @@
|
||||
title: ext/ai/沙盒
|
||||
description: >-
|
||||
AI 试跑 CoW 工作区:打开 / 运行 / 差异 / 提交(中文面,委托英文 sandbox 模块)。
|
||||
import sandbox:ext/ai/sandbox.mq.md
|
||||
import:
|
||||
sandbox: ext/ai/sandbox.mq.md
|
||||
---
|
||||
|
||||
## 打开
|
||||
|
||||
@@ -2,9 +2,10 @@
|
||||
markup: occlusion
|
||||
title: ext/data/cache
|
||||
description: Cache Resource (ADR 0007).
|
||||
import plugin:lib/plugin.mq.md
|
||||
import sys:lib/sys.mq.md
|
||||
import table:lib/table.mq.md
|
||||
import:
|
||||
plugin: lib/plugin.mq.md
|
||||
sys: lib/sys.mq.md
|
||||
table: lib/table.mq.md
|
||||
---
|
||||
|
||||
## _load
|
||||
|
||||
+4
-3
@@ -2,9 +2,10 @@
|
||||
markup: occlusion
|
||||
title: ext/data/db
|
||||
description: Database Resource — CRUD, txn, migrate, FTS (ADR 0007).
|
||||
import plugin:lib/plugin.mq.md
|
||||
import sys:lib/sys.mq.md
|
||||
import table:lib/table.mq.md
|
||||
import:
|
||||
plugin: lib/plugin.mq.md
|
||||
sys: lib/sys.mq.md
|
||||
table: lib/table.mq.md
|
||||
---
|
||||
|
||||
## _load
|
||||
|
||||
+4
-3
@@ -2,9 +2,10 @@
|
||||
markup: occlusion
|
||||
title: ext/data/form
|
||||
description: Form Resource — fields, validate, submit (ADR 0007).
|
||||
import plugin:lib/plugin.mq.md
|
||||
import sys:lib/sys.mq.md
|
||||
import table:lib/table.mq.md
|
||||
import:
|
||||
plugin: lib/plugin.mq.md
|
||||
sys: lib/sys.mq.md
|
||||
table: lib/table.mq.md
|
||||
---
|
||||
|
||||
## _load
|
||||
|
||||
@@ -2,9 +2,10 @@
|
||||
markup: occlusion
|
||||
title: ext/data/storage
|
||||
description: Object storage Resource (ADR 0007).
|
||||
import plugin:lib/plugin.mq.md
|
||||
import sys:lib/sys.mq.md
|
||||
import table:lib/table.mq.md
|
||||
import:
|
||||
plugin: lib/plugin.mq.md
|
||||
sys: lib/sys.mq.md
|
||||
table: lib/table.mq.md
|
||||
---
|
||||
|
||||
## _load
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
---
|
||||
title: ext/linalg/linalg
|
||||
description: Formula-first linear algebra (English). MatExpr simplify + display; ABI plugin.
|
||||
import plugin:lib/plugin.mq.md
|
||||
import sys:lib/sys.mq.md
|
||||
import:
|
||||
plugin: lib/plugin.mq.md
|
||||
sys: lib/sys.mq.md
|
||||
---
|
||||
|
||||
Formula-first linear algebra (English). MatExpr simplify + display; ABI plugin.
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
---
|
||||
title: ext/linalg/线性代数
|
||||
description: 公式优先的线性代数(中文)。矩阵表达式化简与展示;ABI 插件。
|
||||
import plugin:lib/plugin.mq.md
|
||||
import sys:lib/sys.mq.md
|
||||
import:
|
||||
plugin: lib/plugin.mq.md
|
||||
sys: lib/sys.mq.md
|
||||
---
|
||||
|
||||
公式优先的线性代数(中文)。矩阵表达式化简与展示;ABI 插件。
|
||||
|
||||
+3
-2
@@ -1,8 +1,9 @@
|
||||
---
|
||||
title: ext/net/http
|
||||
description: HTTP primitives surface for Web Runtime (ADR 0007). Prefer Document/Endpoint Artifacts over raw calls.
|
||||
import plugin:lib/plugin.mq.md
|
||||
import sys:lib/sys.mq.md
|
||||
import:
|
||||
plugin: lib/plugin.mq.md
|
||||
sys: lib/sys.mq.md
|
||||
---
|
||||
|
||||
## _load
|
||||
|
||||
+2
-1
@@ -1,7 +1,8 @@
|
||||
---
|
||||
title: ext/net/url
|
||||
description: URL helpers (stdlib wrappers). ADR 0007.
|
||||
import net:lib/net.mq.md
|
||||
import:
|
||||
net: lib/net.mq.md
|
||||
---
|
||||
|
||||
## encode
|
||||
|
||||
@@ -2,9 +2,10 @@
|
||||
markup: occlusion
|
||||
title: ext/net/websocket
|
||||
description: WebSocket client Resource (ADR 0007).
|
||||
import plugin:lib/plugin.mq.md
|
||||
import sys:lib/sys.mq.md
|
||||
import table:lib/table.mq.md
|
||||
import:
|
||||
plugin: lib/plugin.mq.md
|
||||
sys: lib/sys.mq.md
|
||||
table: lib/table.mq.md
|
||||
---
|
||||
|
||||
## _load
|
||||
|
||||
Loaded 100 of 364 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user