From bd5555afaa1f64db54f3a810768b8913f2291625 Mon Sep 17 00:00:00 2001 From: cflmy Date: Tue, 18 Aug 2026 11:20:46 +0800 Subject: [PATCH] =?UTF-8?q?Unify=20bare-identifier=20semantics=20in=20*?= =?UTF-8?q?=E2=80=A6*=20/=20**=E2=80=A6**=20(Python=20namespace)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Inside italic/bold code segments every bare word is a variable — including call arguments and method-call receivers — so text literals must be quoted and receivers no longer need backticks. A bare dotted callee `a.b` resolves as a method call when `a` is a local variable, otherwise as a library path (Python-style unified namespace), in both the tree-walk and bytecode backends. Migrate ~70 tests plus ext/web, ext/quantum, ext/ai and the example projects to the new idiom; update SKILL.md and the design docs; fix the web/quantum example data model (db/index.mq.md). Unit and gold suites pass; only the 3 network-live tests fail offline. Co-authored-by: Cursor --- .cursor/skills/marqdo/SKILL.md | 7 +- doc/design/call-arguments.md | 2 + doc/design/markdown-mapping.md | 8 +- doc/design/module-namespace.md | 28 +- doc/design/objects.md | 20 +- examples/quantum-bell/index.mq.md | 8 +- examples/quantum-ghz/index.mq.md | 12 +- examples/web-site-zh/db/index.mq.md | 12 +- examples/web-site-zh/index.mq.md | 36 +- examples/web-site/db/index.mq.md | 12 +- examples/web-site/index.mq.md | 36 +- ext/ai/agent.mq.md | 1892 +++++++++--------- ext/ai/llm.mq.md | 18 +- ext/ai/大模型.mq.md | 18 +- ext/ai/智能体.mq.md | 200 +- ext/quantum/quantum.mq.md | 2 +- ext/quantum/量子.mq.md | 2 +- ext/web/web.mq.md | 28 +- ext/web/网页.mq.md | 28 +- src/bytecode/compile.rs | 6 + src/interp.rs | 7 + src/parse/expr.rs | 65 +- src/parse/mod.rs | 7 +- tests/errors/bad-split-sep.mq.md | 2 +- tests/ext/agent-inspect-fixture.mq.md | 12 +- tests/ext/agent-kb-alias.mq.md | 24 +- tests/ext/agent-kb-near.mq.md | 18 +- tests/ext/agent-kb-reuse.mq.md | 24 +- tests/ext/agent-lib-call.mq.md | 18 +- tests/ext/agent-plan-confirm.mq.md | 10 +- tests/ext/agent-plan-decision.mq.md | 42 +- tests/ext/agent-plan-live.mq.md | 18 +- tests/ext/agent-plan-observe.mq.md | 16 +- tests/ext/agent-plan-stream-offline.mq.md | 40 +- tests/ext/agent-run-live.mq.md | 14 +- tests/ext/agent-smoke.mq.md | 24 +- tests/ext/agent-soft-match.mq.md | 10 +- tests/ext/fs-text-patch.mq.md | 6 +- tests/ext/llm-complete.mq.md | 2 +- tests/ext/llm-stream-live.mq.md | 2 +- tests/ext/quantum-amp-damp-smoke.mq.md | 2 +- tests/ext/quantum-amp-damp-zh-smoke.mq.md | 2 +- tests/ext/quantum-author-api-smoke.mq.md | 2 +- tests/ext/quantum-author-api-zh-smoke.mq.md | 2 +- tests/ext/quantum-custom-gate-smoke.mq.md | 2 +- tests/ext/quantum-custom-gate-zh-smoke.mq.md | 2 +- tests/ext/quantum-draw-smoke.mq.md | 4 +- tests/ext/quantum-gate-heatmap-smoke.mq.md | 4 +- tests/ext/quantum-gate-matrix-smoke.mq.md | 2 +- tests/ext/quantum-noise-smoke.mq.md | 2 +- tests/ext/quantum-noise-zh-smoke.mq.md | 2 +- tests/ext/quantum-steps-smoke.mq.md | 2 +- tests/ext/web-admin-smoke.mq.md | 26 +- tests/ext/web-form-embed-smoke.mq.md | 6 +- tests/ext/web-form-smoke.mq.md | 10 +- tests/ext/web-part-smoke.mq.md | 10 +- tests/ext/web-route-smoke.mq.md | 6 +- tests/ext/web-select-smoke.mq.md | 6 +- tests/ext/web-smoke.mq.md | 16 +- tests/ext/web-static-smoke.mq.md | 10 +- tests/ext/web-zh-smoke.mq.md | 12 +- tests/keywords/input.mq.md | 2 +- tests/lib/foreign-run-lang.mq.md | 2 +- tests/lib/fs-read.mq.md | 4 +- tests/lib/json-quote.mq.md | 2 +- tests/lib/json-roundtrip.mq.md | 4 +- tests/lib/math-formula-chain.mq.md | 6 +- tests/lib/math-formula.mq.md | 6 +- tests/lib/math-plot.mq.md | 2 +- tests/lib/net-openai-sse-reasoning.mq.md | 12 +- tests/lib/net-openai-sse.mq.md | 6 +- tests/lib/plugin-demo.mq.md | 4 +- tests/lib/subtask-fn.mq.md | 2 +- tests/lib/subtask-quiet-io.mq.md | 8 +- tests/lib/subtask-spawn.mq.md | 12 +- tests/lib/sys-dotenv.mq.md | 2 +- tests/lib/table-collections.mq.md | 14 +- tests/lib/文件-读.mq.md | 4 +- tests/lib/表-集合.mq.md | 6 +- tests/structure/import-lib.mq.md | 2 +- tests/structure/inherit-explicit-super.mq.md | 12 +- tests/structure/inherit-override.mq.md | 4 +- tests/structure/inherit-parent-method.mq.md | 4 +- tests/structure/ns/path3.mq.md | 2 +- tests/structure/ns/use.mq.md | 2 +- tests/structure/object-handle.mq.md | 16 +- 86 files changed, 1539 insertions(+), 1467 deletions(-) diff --git a/.cursor/skills/marqdo/SKILL.md b/.cursor/skills/marqdo/SKILL.md index 11e96a9..ab3fea1 100644 --- a/.cursor/skills/marqdo/SKILL.md +++ b/.cursor/skills/marqdo/SKILL.md @@ -20,7 +20,7 @@ Canonical design (repo): `doc/design/markdown-mapping.md`, `doc/design/keywords. 2. **Output is not `**bold**`.** Print with `> print text=…` (or `> 打印 内容=…`). Bold `**…**` is **return value only**. 3. **Prose vs code:** after a blank line, an unmarked first line starts a **comment paragraph**; every following non-blank line stays comment until the next blank line. Put a **blank line** between narration and executable lines. 4. **Do not invent keywords** `if` / `else` / `while` / `for` / `def` / `return`. Control flow is Markdown: **`+` params** (under heading), **`1.` `2.` … branches**, **`-` loops**, arm `N. *` = else, `#` = **object/type**, `##`+ = **function/method**, `**…**` = return. -5. **Identifiers use backticks** — params `` + `name` ``. **Exemptions:** foreach `` - [item](coll) ``; footnote `` name[^key] ``; **inside italic `*…*` / bold `**…**`**, bare ids are variables (strings need `"…"` / `'…'`; ticks still ok). **Drop the backticks on value-expression variable names inside `*…*` / `**…**`** — they are redundant once the `*…*`/`**…**` markers mark the segment as code: `*分类 = 分类[^苹果]*`, `**n * 2**`. **Still required** where a bare word is *not* a variable: inside `"…"` / `'…'` interpolation (`` "Hello, `who`!" ``), inside `> call args` (`` > str `n` ``), and on method-call receivers (`` > `obj`.method ``). **No trailing space** inside `*…*` / `**…**` wrapped code: the closing marker must touch the last token directly (`*`a` = 1*`, `**n**`), never `` *`a` = 1 * ``. +5. **Identifiers use backticks** — params `` + `name` ``. **Exemptions:** foreach `` - [item](coll) ``; footnote `` name[^key] ``; **inside italic `*…*` / bold `**…**`**, bare ids are **variables** (Python-style unified namespace) and method-call receivers are bare too. **Drop the backticks on value-expression variable names and method receivers inside `*…*` / `**…**`** — they are redundant once the `*…*`/`**…**` markers mark the segment as code: `*分类 = 分类[^苹果]*`, `**n * 2**`, `*p = > page.主体装配 组件=home*`. **Text literals must be quoted**: `*a = > text.split value=src sep=","*`. Backticks **still required** where a bare word is *not* a variable in **standalone `>` calls** (bare = text there): `` > str `n` ``, `` > `obj`.method ``. **No trailing space** inside `*…*` / `**…**` wrapped code: the closing marker must touch the last token directly (`*a = 1*`, `**n**`), never `` *a = 1 * ``. 6. **Structure lines are not wrapped in italics.** `#` `>` `+` `-` `|` lines stand alone; use `*…*` only for general statements (bindings / expressions). 7. **Paths:** In bare *expressions* `/` is division. In **call args / param defaults**, unspaced `a/b` and quoted `".marqdo/agent-kb"` are path text — no `json.parse` needed. 8. Prefer ending side-effect-only function bodies with a lone `---` or `***` line (or `****` empty return) so later siblings are not swallowed. @@ -123,7 +123,7 @@ import clock:lib/time.mq.md # main -*xs = > text.split value=a,b,c sep=,* +*xs = > text.split value="a,b,c" sep=","* > print text=`xs` *t = > clock.now_unix* ``` @@ -155,7 +155,8 @@ Stdlib map: [reference.md](reference.md). | `# main` then prose then code with no blank line | Blank line before code | | `if x > 0:` | `1. `x` > 0` | | `* > print text=hi *` | `> print text=hi` | -| `` *`a` = 1 * `` (trailing space) | `` *`a` = 1* `` — no trailing space before `*` / `**` | +| `` *`a` = 1 * `` (trailing space + backticks) | `*a = 1*` — bare bind, no trailing space before `*` / `**` | +| `*xs = > text.split value=a,b sep=,*` (bare text args) | `*xs = > text.split value="a,b" sep=","*` — quote text literals; bare words are variables | | Forgetting `---` after nested `##` helper | Add `---` / `***` / `****` | | Import `lib/text` then call bare `split` | `> text.split …` (qualified) | | Import `lib/text` then call `拆分` | Match file language (`text.split`, not 文本) | diff --git a/doc/design/call-arguments.md b/doc/design/call-arguments.md index c833c46..e4d8ab0 100644 --- a/doc/design/call-arguments.md +++ b/doc/design/call-arguments.md @@ -32,6 +32,8 @@ positional ::= value_token - `value`(具名右侧):可含空格与 `` `var` `` 插值,直到下一个 `ident=` 边界。 - `value_token`(位置):空白分隔的一个词法单元——数字、`` `名` ``、标识/文本词;**不含空格**。多词字符串请用具名,例如 `> print text=Hello World!`。 +- **独立 `>` 调用**:裸词 = 文本字面量。 +- **`*…*` / `**…**` 段内的调用**(如 `*x = > text.split value=src sep=","*`):裸词 = **变量**(Python 统一命名空间),文本字面量必须加引号(`value="a,b"`);`` `名` `` 变量形式仍合法。 - 内置 `print` / `打印` 形参:`text` ≡ `内容`。 - `input` / `输入`:`prompt` ≡ `提示`。 - `len` / `长度`、`str` / `文本`、`int` / `整数`:`value` ≡ `值`。 diff --git a/doc/design/markdown-mapping.md b/doc/design/markdown-mapping.md index c8b2f05..50345a3 100644 --- a/doc/design/markdown-mapping.md +++ b/doc/design/markdown-mapping.md @@ -21,7 +21,7 @@ Markdown **标记即语法**。输出**不是**语言架构原语,而是内置 **豁免:** - foreach 头 `` - [项](集合) `` 允许裸名或反引号(可混用),推荐裸名;循环体内引用仍用 `` `名` ``。 - 脚注取元 `` 名[^键] ``:基名在紧跟 `` [^…] `` 时可省略反引号(`` `名`[^键] `` 仍合法);链式同理。 - - **斜体语句 / 粗体返回内部**:裸标识符默认是**变量**;字符串须 `"…"` 或 `'…'`;`` `名` `` 仍合法。 + - **斜体语句 / 粗体返回内部**:裸标识符默认是**变量**(含调用实参与方法接收者);文本字面量须 `"…"` 或 `'…'` 或引号实参(`key="文本"`);`` `名` `` 仍合法。这是 **Python 统一命名空间**:裸点号 `a.b` 在 `a` 为局部变量时为方法调用,否则为库路径。 --- @@ -50,7 +50,7 @@ Markdown **标记即语法**。输出**不是**语言架构原语,而是内置 | 体内 `-` | **循环**(`while` 条件,或 `[项](集合)` / `` [`项`](`集合`) `` 遍历) | | 分支臂头整行恰为 `*`(在 `N.` 后) | else,如 `2. *` | | `> 函数 形参=实参` 或 `> 函数 实参` | 调用(具名 / 位置,见 [call-arguments.md](call-arguments.md)) | -| `` > `对象`.方法 … `` | 方法调用(实例 map 须含 `_type`) | +| `` > `对象`.方法 … `` | 方法调用(独立 `>`;实例 map 须含 `_type`)。`*…*` 段内接收者裸名:`*x = > 对象.方法 …*` | | frontmatter `import bind:path.mq.md` / `导入` | 导入文件并绑定库名 | | frontmatter `import bind:lib.member` / `导入` | 将库路径成员绑为本地短名(与文件导入同形) | | `> lib.member …` / `> lib.Type.member …` | 点号路径调用(路径段裸名、无反引号) | @@ -93,7 +93,7 @@ Markdown **标记即语法**。输出**不是**语言架构原语,而是内置 *x = 1* *y = x + 2* *answer = ev[^message]* -*`亦可用` = 1* +*亦可用 = 1* ``` 斜体内部:裸标识符 = 变量;字符串写 `"…"` / `'…'`。行首已是结构标记的构造(`#` `>` `+` `-` `|`、`1.`)**不必**再包一层斜体;斜体用于「一般语句」槽位。 @@ -129,7 +129,7 @@ Markdown **标记即语法**。输出**不是**语言架构原语,而是内置 ## 5. Frontmatter 与跨文件 -文件头 `---` 对为元信息。其中 `import bind:path.mq.md` / `导入` 为**文件导入**;`import bind:lib.member` 为**短名**(废除独立 `use` 与 frontmatter `>` 导入)。调用经裸点号路径(`time.parse`、`agent.agent`);实例方法须 `` > `var`.method ``。详见 [module-namespace.md](module-namespace.md)。 +文件头 `---` 对为元信息。其中 `import bind:path.mq.md` / `导入` 为**文件导入**;`import bind:lib.member` 为**短名**(废除独立 `use` 与 frontmatter `>` 导入)。调用经裸点号路径(`time.parse`、`agent.agent`);实例方法在独立 `>` 调用须 `` > `var`.method ``(`*…*` 段内接收者裸名)。详见 [module-namespace.md](module-namespace.md)。 **函数体内的** `---` / `***` 不解释为 frontmatter(见 §11)。 diff --git a/doc/design/module-namespace.md b/doc/design/module-namespace.md index d72272c..ddb9bc8 100644 --- a/doc/design/module-namespace.md +++ b/doc/design/module-namespace.md @@ -107,10 +107,10 @@ import json:lib/json.mq.md # main -*`t` = > time.now_unix * -*`s` = > time.format unix=`t` pattern=%Y-%m-%d * -*`obj` = > json.parse text={"a":1} * -*`a` = > json.get value=`obj` key=a * +*t = > time.now_unix* +*s = > time.format unix=`t` pattern="%Y-%m-%d"* +*obj = > json.parse text={"a":1}* +*a = > json.get value=`obj` key="a"* > print text=`s` ``` @@ -122,12 +122,18 @@ import json:lib/json.mq.md 实例方法须 `` > `var`.method ``;无接收者的 `库.类型.方法` → 硬错误。 -### 4.4 变量 / 实例 vs 库路径 +### 4.4 变量 / 实例 vs 库路径(Python 统一命名空间) | 写法 | 含义 | |------|------| -| `time.parse` | 库路径(裸名) | -| `` > `助手`.step `` | 实例方法(接收者反引号) | +| `time.parse` | 库路径(裸名,第一段非变量) | +| `` > `助手`.step `` | 独立 `>` 调用:实例方法(接收者反引号) | +| `*回复 = > 助手.step …*` | `*…*` 段内:若 `助手` 是变量 → 实例方法;否则 → 库路径 | + +**统一规则**(与 Python 一致):对裸点号 `a.b`,当 `a` 是当前作用域**局部变量**时解释为**方法调用**(`a` 为接收者);否则解释为**库路径**(`lib.a.b`)。此规则同时应用于树遍历与字节码两后端。 + +- 在**独立 `>` 调用**中裸词 = 文本,故方法接收者仍须反引号:`` > `助手`.step ``。 +- 在 **`*…*` / `**…**` 段内**裸词 = 变量,接收者不加反引号:`*回复 = 助手.step …*`。 ### 4.5 短名示例 @@ -139,8 +145,8 @@ import fmt:time.format # main -*`t` = > time.now_unix * -*`s` = > fmt unix=`t` pattern=%Y-%m-%d * +*t = > time.now_unix* +*s = > fmt unix=`t` pattern="%Y-%m-%d"* ``` ### 4.6 应用侧完整示例 @@ -210,5 +216,5 @@ import json:lib/json.mq.md 1. 导入 = `import bind:target`(`导入` 等价)。 2. target = `.mq.md` 文件 **或** `库.成员` 点号路径。 -3. 调用以裸名点号路径寻址;实例方法用反引号接收者。 -4. 废除 frontmatter `>` 导入与独立 `use`。 +3. 调用以裸名点号路径寻址;实例方法用反引号接收者(仅独立 `>` 调用;`*…*`/`**…**` 段内接收者不加反引号)。 +4. 裸点号 `a.b`:`a` 为局部变量 → 方法调用,否则 → 库路径(Python 统一命名空间)。 diff --git a/doc/design/objects.md b/doc/design/objects.md index f7c5167..af1a50d 100644 --- a/doc/design/objects.md +++ b/doc/design/objects.md @@ -33,24 +33,24 @@ # 大模型 + `模型名` -*`自` = …配置 map…* -**`自`** +*自 = …配置 map…* +**自** ## 运行 + `提示` …使用 `自` … -**`内容`** +**内容** # main -*`模型` = > 大模型 模型名=gpt-4o-mini * -*`回复` = > `模型`.运行 提示=你好 * +*模型 = > 大模型 模型名="gpt-4o-mini"* +*回复 = > 模型.运行 提示="你好"* > print text=`回复` ``` - `> 大模型 …` — 构造 -- `` > `模型`.运行 … `` — 方法(接收者 + `.` + 方法名) +- `` > `模型`.运行 … `` — 方法(接收者 + `.` + 方法名;**独立 `>` 调用**需反引号接收者 `` `模型` ``;**在 `*…*` / `**…**` 段内**接收者不加反引号:`*回复 = > 模型.运行 提示="你好"*`) - `## 自由函数` 挂在模块顶层(非某对象子标题)— 与旧版顶层 `# http_get` 对等,现写为 `## http_get` ## 4. 标准库 @@ -66,16 +66,16 @@ ## hello + `who` -*`msg` = "Hello, `who`!" * -**`msg`** +*msg = "Hello, `who`!"* +**msg** # Loud = > Greeter ## hello + `who` -*`msg` = "HELLO, `who`!" * -**`msg`** +*msg = "HELLO, `who`!"* +**msg** ``` | 规则 | 说明 | diff --git a/examples/quantum-bell/index.mq.md b/examples/quantum-bell/index.mq.md index ead26f3..61a0f63 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-ghz/index.mq.md b/examples/quantum-ghz/index.mq.md index dcd8963..767b80c 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-site-zh/db/index.mq.md b/examples/web-site-zh/db/index.mq.md index 036609d..f66ba24 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 c77f19b..dec6521 100644 --- a/examples/web-site-zh/index.mq.md +++ b/examples/web-site-zh/index.mq.md @@ -24,8 +24,8 @@ import db:db/index.mq.md | 属性 | 值 | 样式 | |------|-----|------| -| `title` | articles.`articles`.title | shell.`card_title` | -| `body` | articles.`articles`.body | shell.`card_body` | +| title | articles.`articles`.title | shell.`card_title` | +| body | articles.`articles`.body | shell.`card_body` | `article_fields` = @@ -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/db/index.mq.md b/examples/web-site/db/index.mq.md index d9486af..b24991c 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 082c41a..5e7f063 100644 --- a/examples/web-site/index.mq.md +++ b/examples/web-site/index.mq.md @@ -26,8 +26,8 @@ Main content is not a reusable component, so it is authored here. | 属性 | 值 | 样式 | |------|-----|------| -| `title` | articles.`articles`.title | shell.`card_title` | -| `body` | articles.`articles`.body | shell.`card_body` | +| title | articles.`articles`.title | shell.`card_title` | +| body | articles.`articles`.body | shell.`card_body` | Article create form (design §5.5): field table + rules table. @@ -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/ext/ai/agent.mq.md b/ext/ai/agent.mq.md index 226955f..c8edc22 100644 --- a/ext/ai/agent.mq.md +++ b/ext/ai/agent.mq.md @@ -17,32 +17,32 @@ import plugin:lib/plugin.mq.md Assemble a readable prompt: standing, task, tools, call site, source, skill, and the act protocol (human-visible). -*`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` = > agent_module_source * -*`site` = > agent_call_site * -*`site_s` = > json.stringify value=`site` * -*`skill` = > agent_marqdo_skill * -*`task_s` = > json.stringify value=`task` * +*tools = > json.get value=`agent` key="tools"* +*tools_s = > agent_format_tools tools=`tools`* +*src = > agent_module_source* +*site = > agent_call_site* +*site_s = > json.stringify value=`site`* +*skill = > agent_marqdo_skill* +*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.).\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.).\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. The runbook source is your ground truth — code is documentation." * -*`p` = `p` + `a` + `up` + `b` + `task_s` + `c` + `tools_s` + `g` + `d` + `site_s` + `e` + `src` + `f` + `skill` * -**`p`** +*p = "You are a Marqdo agent. The runbook source is your ground truth — code is documentation."* +*p = p + a + up + b + task_s + c + tools_s + g + d + site_s + e + src + f + skill* +**p** --- @@ -51,31 +51,31 @@ Assemble a readable prompt: standing, task, tools, call site, source, skill, and 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** --- @@ -85,13 +85,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` * + *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` @@ -99,35 +99,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 writeback: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 writeback: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** --- @@ -140,49 +140,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` = > writeback.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 = > writeback.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** --- @@ -191,18 +191,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** --- @@ -211,25 +211,25 @@ 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* + *_ = 1* **> join value=`acc` sep=`nl`** --- @@ -239,31 +239,31 @@ 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* + *_ = 1* + *i = i + 1* **> join value=`acc` sep=`nl`** --- @@ -273,39 +273,39 @@ 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` * + *acc = > json.append list=`acc` item=`line`* **> join value=`acc` sep=`nl`** --- @@ -315,7 +315,7 @@ Drop `` blocks (including marqdo-out bodies) so parent excerpts stay + `max_lines`=80 + `max_chars`=4000 -*`clean` = > strip_html_comments text=`source` * +*clean = > strip_html_comments text=`source`* **> text_head_lines text=`clean` max_lines=`max_lines` max_chars=`max_chars`** --- @@ -325,7 +325,7 @@ Drop `` blocks (including marqdo-out bodies) so parent excerpts stay + `max_lines`=80 + `max_chars`=4000 -*`src` = > fs.read_text path=`path` * +*src = > fs.read_text path=`path`* **> workbook_source_excerpt source=`src` max_lines=`max_lines` max_chars=`max_chars`** --- @@ -334,7 +334,7 @@ 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** 2. * @@ -346,8 +346,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. -*`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.","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"}]} * -**`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.","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"}]}* +**out** --- @@ -356,42 +356,42 @@ Callable dotted names (whitelist for `CALL:lib…`) plus static module file list 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`** 2. * - **`empty`** + **empty** 2. * - **`empty`** + **empty** --- @@ -402,7 +402,7 @@ 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` * + *s = > json.stringify value=`value`* **> text_head_lines text=`s` max_lines=40 max_chars=`max_chars`** 2. * **** @@ -420,20 +420,20 @@ Truncate a tool result for `tool_end` events (~1KiB). Publish `tool_start` / `tool_end` when `stream=True`. 1. `stream` - *`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`* > sys.stream_publish event=`ev` 2. * - *`_` = 1* + *_ = 1* -**`events`** +**events** --- @@ -443,29 +443,29 @@ Publish `tool_start` / `tool_end` when `stream=True`. 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 * + *path = > json.get value=`args` key="path"* **> fs.exists path=`path`** 2. `name` == lib.fs.read_text - *`path` = > json.get value=`args` key=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 * + *path = > json.get value=`args` key="path"* **> fs.list_dir path=`path`** 4. `name` == lib.json.parse - *`text` = > json.get value=`args` key=text * + *text = > json.get value=`args` key="text"* **> json.parse text=`text`** 5. `name` == lib.json.stringify - *`value` = > json.get value=`args` key=value * + *value = > json.get value=`args` key="value"* **> json.stringify value=`value`** 6. `name` == lib.sys.cwd **> sys.cwd** 7. * - *`deny` = > json.get value=`errs` key=deny * - **`deny` + `name`** + *deny = > json.get value=`errs` key="deny"* + **deny + name** --- @@ -475,23 +475,23 @@ 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** --- ## skill_brief + `max_chars`=1200 -*`skill` = > agent_marqdo_skill * +*skill = > agent_marqdo_skill* **> text_head_lines text=`skill` max_lines=40 max_chars=`max_chars`** --- @@ -501,44 +501,44 @@ Write a scratch tool workbook under `.marqdo/agent-runs/tools/.mq.md`. Parse READ:source|stderr|stdout|slots (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** --- @@ -547,28 +547,28 @@ Parse READ:source|stderr|stdout|slots (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** --- @@ -577,48 +577,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** --- @@ -631,31 +631,31 @@ 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`** 3. `name` == 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`** 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. * - *`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`** 2. * - *`msg` = "Parent tool not allowed:" * - **`msg` + `name`** + *msg = "Parent tool not allowed:"* + **msg + name** --- @@ -664,28 +664,28 @@ 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. * - *`_` = 1* -**`obs`** + *_ = 1* +**obs** --- @@ -694,124 +694,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** --- @@ -821,47 +821,47 @@ Bounded observation for the parent prompt (actionable, short). Parse `DECISION: DONE` / `CONTINUE` / `RUN` (Chinese: `决定:完成` / `继续` / `运行`). **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"** @@ -884,7 +884,7 @@ Parse `DECISION: DONE` / `CONTINUE` / `RUN` (Chinese: `决定:完成` / `继 10. `found` == 新建 **"NEW"** 11. * - **`found`** + **found** --- @@ -893,46 +893,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** --- @@ -942,26 +942,26 @@ Parse `SLUG: …` / `标识:…` after a soft-match REUSE decision. Short parent prompt: REUSE+SLUG or NEW only. Candidates may include lexical `score` (prefer higher). -*`esc` = > json.parse text={"a":"\n\n--- goal ---\n","b":"\n\n--- candidate tasks (slug | title | score) ---\n","c":"\n\n--- how to act ---\nExact reuse miss; candidates are ranked by local n-gram score when present. Prefer higher scores. Reply with ONE protocol only:\nDECISION: REUSE\nSLUG: \nor\nDECISION: NEW\nNo other prose.\n","nl":"\n","sep":" | ","sp":"score="} * -*`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 * -*`lines` = > json.parse text=[] * +*esc = > json.parse text={"a":"\n\n--- goal ---\n","b":"\n\n--- candidate tasks (slug | title | score) ---\n","c":"\n\n--- how to act ---\nExact reuse miss; candidates are ranked by local n-gram score when present. Prefer higher scores. Reply with ONE protocol only:\nDECISION: REUSE\nSLUG: \nor\nDECISION: NEW\nNo other prose.\n","nl":"\n","sep":" | ","sp":"score="}* +*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"* +*lines = > json.parse text=[]* - [`t`](`tasks`) - *`slug` = > json.get value=`t` key=slug * - *`title` = > json.get value=`t` key=title * - *`score` = > json.get value=`t` key=score * + *slug = > json.get value=`t` key="slug"* + *title = > json.get value=`t` key="title"* + *score = > json.get value=`t` key="score"* 1. `score` - *`row` = `slug` + `sep` + `title` + `sep` + `sp` + `score` * + *row = slug + sep + title + sep + sp + score* 2. * - *`row` = `slug` + `sep` + `title` * - *`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`** + *row = slug + sep + title* + *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** --- @@ -970,49 +970,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** --- @@ -1026,40 +1026,40 @@ 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` = > 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:lib.fs.read_text|exists|list_dir | lib.json.parse|stringify | lib.sys.cwd (+ ARGS:{json})\nREAD:source | stderr | stdout | slots\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 CALL:workbook_read / lib_catalog.\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:lib.fs.read_text|exists|list_dir | lib.json.parse|stringify | lib.sys.cwd (+ ARGS:{json})\nREAD:source | stderr | stdout | slots\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 CALL:workbook_read / lib_catalog.\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** --- @@ -1078,55 +1078,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** --- @@ -1138,14 +1138,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. * **** @@ -1158,16 +1158,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. * **** @@ -1176,11 +1176,11 @@ 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** 2. `nb` > 1 @@ -1200,24 +1200,24 @@ True when source still contains `worker.step` or `.单步`. Append a `round` event when `stream=True`. Optional `result` is the child `# main` return (for view Child cards). Optional `echo` prints a short TTY marker (not the full workbook path). 1. `stream` - *`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`* > sys.stream_publish event=`ev` 1. `echo` > print text=plan:round 2. * - *`_` = 1* + *_ = 1* 2. * - *`_` = 1* + *_ = 1* -**`events`** +**events** ## plan_append_decision + `events` @@ -1226,18 +1226,18 @@ Append a `round` event when `stream=True`. Optional `result` is the child `# mai + `summary`=None 1. `stream` - *`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`* > sys.stream_publish event=`ev` 2. * - *`_` = 1* + *_ = 1* -**`events`** +**events** ## plan_merge_deltas + `events` @@ -1248,19 +1248,19 @@ Bubble parent `complete stream=True` reasoning/deltas (and errors) into the plan 1. `stream` - [`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* 2. * - *`_` = 1* + *_ = 1* -**`events`** +**events** ## plan_finish_stream + `out` @@ -1272,24 +1272,24 @@ Bubble parent `complete stream=True` reasoning/deltas (and errors) into the plan When `stream=True`, append `done` and attach `events` on the result map. Optional `trace=True` writes the event list to writeback slot `trace`. 1. `stream` - *`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`* > sys.stream_publish event=`ev` - *`out` = > json.set map=`out` key=events value=`events` * + *out = > json.set map=`out` key="events" value=`events`* 2. * - *`_` = 1* + *_ = 1* 1. `trace` - *`body` = > json.stringify value=`events` * + *body = > json.stringify value=`events`* > writeback.record value=`body` key=trace 2. * - *`_` = 1* + *_ = 1* -**`out`** +**out** --- @@ -1300,31 +1300,31 @@ When `stream=True`, append `done` and attach `events` on the result map. Optiona 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` **** @@ -1338,81 +1338,81 @@ One atomic turn: context → LLM → optional tool via subtask. Returns a **map* 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). -*`ctx` = > build_step_context agent=`self` task=`task` * -*`id` = > json.get value=`self` key=id * -*`model` = > json.get value=`self` key=model * -*`tools` = > json.get value=`self` key=tools * +*ctx = > build_step_context agent=`self` task=`task`* +*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` 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 = > model.complete prompt=`ctx`* -*`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 > writeback.record value=`body` key=ok 2. * > writeback.record value=`body` key=error 2. * - *`_` = 1* + *_ = 1* -**`out`** +**out** ## plan + `goal` @@ -1440,433 +1440,433 @@ Multi-step with OKF agent-kb. Default workbook is `kb_dir/resources/.mq.md 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. With `stream=True`, emit parent `delta` / `decision` / `tool_start`/`tool_end` / `round` / `done` on `events`. `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` * - *`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 llm_free skill hit; 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_round events=`events` round=1 workbook=`path` exit_code=`code` result=`child_val` stream=`stream` echo=`echo` * + *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`* + *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 llm_free skill hit; 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_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`* > writeback.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` * - *`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 skill hit; 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_round events=`events` round=1 workbook=`path` exit_code=`code` result=`child_val` stream=`stream` echo=`echo` * + *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`* + *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 skill hit; 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_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`* > writeback.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 * - *`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_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"* + *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_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`* > writeback.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`* > writeback.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 * - *`_` = 1* + *n = > fs.apply_patch_blocks path=`path` text=`last_reply` soft=True* + *_ = 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 > writeback.record value=`body` key=ok 2. * > writeback.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** diff --git a/ext/ai/llm.mq.md b/ext/ai/llm.mq.md index 164984f..3f54c60 100644 --- a/ext/ai/llm.mq.md +++ b/ext/ai/llm.mq.md @@ -39,23 +39,23 @@ Reduce a `complete stream=True` event list to the final `done.result` text (or ` 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"* -*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"* @@ -78,7 +78,7 @@ Wire body is `{model, messages:[{role,content}], stream?}`. Messages are an `@` *url = self[^base_url] + self[^suffix]* *auth = self[^bearer] + self[^api_key]* -*headers = > table.put in=None at=Authorization value=`auth`* +*headers = > table.put in=None at="Authorization" value=`auth`* `messages` = @@ -93,7 +93,7 @@ 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* + *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 @@ -123,4 +123,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 72309c1..7480783 100644 --- a/ext/ai/大模型.mq.md +++ b/ext/ai/大模型.mq.md @@ -39,23 +39,23 @@ import json:lib/json.mq.md 从 `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"* -*model = > 系统.取环境 名=OPENAI_MODEL* +*model = > 系统.取环境 名="OPENAI_MODEL"* 1. 非 `model` - *model = > 系统.取环境 名=MARQDO_LLM_MODEL* + *model = > 系统.取环境 名="MARQDO_LLM_MODEL"* 1. 非 `model` *model = "gpt-4o-mini"* @@ -78,7 +78,7 @@ import json:lib/json.mq.md *url = 自[^base_url] + 自[^suffix]* *auth = 自[^bearer] + 自[^api_key]* -*headers = > 表.改 入=None 于=Authorization 值=`auth`* +*headers = > 表.改 入=None 于="Authorization" 值=`auth`* `messages` = @@ -93,7 +93,7 @@ import json:lib/json.mq.md | 自[^model] | `messages` | 1. `流式` - *req = > 表.改 入=`req` 于=stream 值=True* + *req = > 表.改 入=`req` 于="stream" 值=True* *body = > json.stringify value=`req`* *resp = > 网络.提交流式 地址=`url` 内容=`body` headers=`headers` 打印增量=`打印增量`* 1. resp[^status] == 200 @@ -123,4 +123,4 @@ import json:lib/json.mq.md 运行 的别名。 -**> `自`.运行 提示=`提示` 流式=`流式` 打印增量=`打印增量`** +**> 自.运行 提示=`提示` 流式=`流式` 打印增量=`打印增量`** diff --git a/ext/ai/智能体.mq.md b/ext/ai/智能体.mq.md index 8086d68..67202eb 100644 --- a/ext/ai/智能体.mq.md +++ b/ext/ai/智能体.mq.md @@ -16,32 +16,32 @@ import json:lib/json.mq.md 组装可读提示:站立提示、任务、工具、调用位置、源码、Skill,以及人可见的行动约定。 -*`standing` = > json.get value=`智能体` key=standing * +*standing = > json.get value=`智能体` key="standing"* 1. `standing` - *`up` = `standing`* + *up = standing* 2. * - *`up` = 空* + *up = 空* -*`tools` = > json.get value=`智能体` key=tools * -*`tools_s` = > agent_format_tools tools=`tools` * -*`src` = > agent_module_source * -*`site` = > agent_call_site * -*`site_s` = > json.stringify value=`site` * -*`skill` = > agent_marqdo_skill * -*`task_s` = > json.stringify value=`任务` * +*tools = > json.get value=`智能体` key="tools"* +*tools_s = > agent_format_tools tools=`tools`* +*src = > agent_module_source* +*site = > agent_call_site* +*site_s = > json.stringify value=`site`* +*skill = > agent_marqdo_skill* +*task_s = > json.stringify value=`任务`* -*`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 ---\nTools are ## functions in the source above. To call one, 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 ---\nTools are ## functions in the source above. To call one, 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. The runbook source is your ground truth — code is documentation." * -*`p` = `p` + `a` + `up` + `b` + `task_s` + `c` + `tools_s` + `g` + `d` + `site_s` + `e` + `src` + `f` + `skill` * -**`p`** +*p = "You are a Marqdo agent. The runbook source is your ground truth — code is documentation."* +*p = p + a + up + b + task_s + c + tools_s + g + d + site_s + e + src + f + skill* +**p** --- @@ -50,31 +50,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** --- @@ -84,13 +84,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`** 2. * - *`msg` = "Tool not allowed:" * - **`msg` + `名`** + *msg = "Tool not allowed:"* + **msg + `名`** # 智能体 + `大模型` @@ -99,31 +99,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` **** @@ -137,72 +137,72 @@ import json:lib/json.mq.md 流式=真 时走 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** ## 多步 + `目标` @@ -228,8 +228,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/quantum/quantum.mq.md b/ext/quantum/quantum.mq.md index 26a2276..a1febfc 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. * diff --git a/ext/quantum/量子.mq.md b/ext/quantum/量子.mq.md index cfb67db..f5b2028 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. * diff --git a/ext/web/web.mq.md b/ext/web/web.mq.md index ef4b318..2584dee 100644 --- a/ext/web/web.mq.md +++ b/ext/web/web.mq.md @@ -10,7 +10,7 @@ import json:lib/json.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. * @@ -53,7 +53,7 @@ Embed a form into the page main slot. `listen` auto-registers `GET|POST /_form/{ Offline HTML for tests / previews. 1. `db` - *`url` = > json.get value=`db` key=url * + *url = > json.get value=`db` key="url"* **> web_render page=`self` url=`url`** 2. * **> web_render page=`self`** @@ -63,14 +63,14 @@ Offline HTML for tests / previews. Style tables live as `##` exports in site style modules; compose resolves them by path. -**`self`** +**self** ## process + `style`=None + `name`=None + `path`=None -**`self`** +**self** # db + `url`="sqlite:site.db" @@ -82,14 +82,14 @@ Style tables live as `##` exports in site style modules; compose resolves them b + `name` + `fields` -*`url` = > json.get value=`self` key=url * +*url = > json.get value=`self` key="url"* **> web_db_init url=`url` name=`name` fields=`fields`** ## insert + `table` + `rows` -*`url` = > json.get value=`self` key=url * +*url = > json.get value=`self` key="url"* **> web_db_insert url=`url` table=`table` rows=`rows`** ## select @@ -99,15 +99,15 @@ Style tables live as `##` exports in site style modules; compose resolves them b Simple filters: one-row map of column→value (AND `=`), or rows `|字段|操作|值|` (`=` `!=` `>` `>=` `<` `<=` `like`). -*`url` = > json.get value=`self` key=url * -*`r` = > web_db_select url=`url` table=`table` where=`where` limit=`limit` * -**> json.get value=`r` key=rows** +*url = > json.get value=`self` key="url"* +*r = > web_db_select url=`url` table=`table` where=`where` limit=`limit`* +**> json.get value=`r` key="rows"** ## get + `table` + `id` -*`url` = > json.get value=`self` key=url * +*url = > json.get value=`self` key="url"* **> web_db_get url=`url` table=`table` id=`id`** ## update @@ -115,21 +115,21 @@ Simple filters: one-row map of column→value (AND `=`), or rows `|字段|操作 + `id` + `row` -*`url` = > json.get value=`self` key=url * +*url = > json.get value=`self` key="url"* **> web_db_update url=`url` table=`table` id=`id` row=`row`** ## delete + `table` + `id` -*`url` = > json.get value=`self` key=url * +*url = > json.get value=`self` key="url"* **> web_db_delete url=`url` table=`table` id=`id`** ## exec + `sql` + `args`=None -*`url` = > json.get value=`self` key=url * +*url = > json.get value=`self` key="url"* **> web_db_exec url=`url` sql=`sql` args=`args`** # form @@ -169,7 +169,7 @@ Field table + rules table; submit writes through `# db`. + `data` + `db` -*`url` = > json.get value=`db` key=url * +*url = > json.get value=`db` key="url"* **> web_form_submit form=`self` data=`data` url=`url`** # app diff --git a/ext/web/网页.mq.md b/ext/web/网页.mq.md index 50627f5..48bedcc 100644 --- a/ext/web/网页.mq.md +++ b/ext/web/网页.mq.md @@ -10,7 +10,7 @@ import json:lib/json.mq.md 加载 ABI v2 `web` 插件。 -*`p` = > plugin.native_path name=web * +*p = > plugin.native_path name="web"* 1. `p` > plugin.load path=`p` 2. * @@ -47,7 +47,7 @@ import json:lib/json.mq.md + `数据库`=None 1. `数据库` - *`url` = > json.get value=`数据库` key=url * + *url = > json.get value=`数据库` key="url"* **> web_render page=`self` url=`url`** 2. * **> web_render page=`self`** @@ -55,14 +55,14 @@ import json:lib/json.mq.md # 样式 + `名`="" -**`self`** +**self** ## 样式处理 + `样式`=None + `名`=None + `路径`=None -**`self`** +**self** # 数据库 + `地址`="sqlite:site.db" @@ -74,14 +74,14 @@ import json:lib/json.mq.md + `名` + `字段` -*`url` = > json.get value=`self` key=url * +*url = > json.get value=`self` key="url"* **> web_db_init url=`url` name=`名` fields=`字段`** ## 插入 + `表` + `行` -*`url` = > json.get value=`self` key=url * +*url = > json.get value=`self` key="url"* **> web_db_insert url=`url` table=`表` rows=`行`** ## 查询 @@ -91,15 +91,15 @@ import json:lib/json.mq.md 简单条件:单行列→值映射(AND `=`),或 `|字段|操作|值|` 表(`=` `!=` `>` `>=` `<` `<=` `like`)。 -*`url` = > json.get value=`self` key=url * -*`r` = > web_db_select url=`url` table=`表` where=`条件` limit=`上限` * -**> json.get value=`r` key=rows** +*url = > json.get value=`self` key="url"* +*r = > web_db_select url=`url` table=`表` where=`条件` limit=`上限`* +**> json.get value=`r` key="rows"** ## 获取 + `表` + `id` -*`url` = > json.get value=`self` key=url * +*url = > json.get value=`self` key="url"* **> web_db_get url=`url` table=`表` id=`id`** ## 更新 @@ -107,21 +107,21 @@ import json:lib/json.mq.md + `id` + `行` -*`url` = > json.get value=`self` key=url * +*url = > json.get value=`self` key="url"* **> web_db_update url=`url` table=`表` id=`id` row=`行`** ## 删除 + `表` + `id` -*`url` = > json.get value=`self` key=url * +*url = > json.get value=`self` key="url"* **> web_db_delete url=`url` table=`表` id=`id`** ## 执行 + `sql` + `参数`=None -*`url` = > json.get value=`self` key=url * +*url = > json.get value=`self` key="url"* **> web_db_exec url=`url` sql=`sql` args=`参数`** # 表单 @@ -161,7 +161,7 @@ import json:lib/json.mq.md + `数据` + `数据库` -*`url` = > json.get value=`数据库` key=url * +*url = > json.get value=`数据库` key="url"* **> web_form_submit form=`self` data=`数据` url=`url`** # 应用 diff --git a/src/bytecode/compile.rs b/src/bytecode/compile.rs index 7d1372b..4f10cfc 100644 --- a/src/bytecode/compile.rs +++ b/src/bytecode/compile.rs @@ -436,6 +436,12 @@ impl<'a> FnCompiler<'a> { fn compile_call(&mut self, call: &CallExpr, as_stmt: bool) -> Result<()> { let mut call = call.clone(); if let Some(path) = &call.path { + // Bare dotted callee `a.b`: if `a` is a local variable, it is a method + // receiver (Python-style unified namespace); otherwise it's a library path. + if path.len() == 2 && self.locals.contains_key(&path[0]) { + let recv = path[0].clone(); + return self.compile_method_call(&recv, &call, as_stmt); + } return self.compile_path_call(path, &call, as_stmt); } if let Some(path) = self.flat[self.fn_id].uses.get(&call.callee).cloned() { diff --git a/src/interp.rs b/src/interp.rs index 4c254ce..f95e933 100644 --- a/src/interp.rs +++ b/src/interp.rs @@ -546,6 +546,13 @@ impl Interpreter { } if let Some(path) = &call.path { + // Bare dotted callee `a.b`: if `a` is a local variable, it is a method + // receiver (Python-style unified namespace); otherwise it's a library path. + if path.len() == 2 && env.get(&path[0]).is_some() { + let recv = path[0].clone(); + let method = path[1].clone(); + return self.eval_method_call(module, fun, env, &recv, &method, &ev_args); + } return self.eval_path_call(module, path, &ev_args); } diff --git a/src/parse/expr.rs b/src/parse/expr.rs index 87cb651..db4f4d0 100644 --- a/src/parse/expr.rs +++ b/src/parse/expr.rs @@ -77,6 +77,36 @@ pub fn parse_call_arg_value(input: &str) -> Result { } } +/// Like [`parse_call_arg_value`], but for call args inside `*…*` / `**…**` +/// value-expression segments: a bare word is a **variable** (not a text literal). +/// Quoted strings, hyphenated prose, and `/path` prose stay text; `` `x` `` still works. +pub fn parse_call_arg_value_prefer_var(input: &str) -> Result { + let s = input.trim(); + if s.is_empty() { + return Ok(Expr::Literal(Literal::Text(String::new()))); + } + if s.starts_with('"') || s.starts_with('\'') { + return match parse_expr(s) { + Ok(e) => Ok(e), + Err(_) => Ok(parse_interp(s)), + }; + } + if has_hyphenated_prose(s) { + return Ok(parse_interp(s)); + } + match parse_expr_prefer_var(s) { + Ok(e) => Ok(e), + Err(_) => { + // `/about`, `.marqdo/x`, `nav.`nav`` etc. → prose text, not variables. + if s.starts_with('/') || s.contains(".`") { + Ok(Expr::Literal(Literal::Text(s.to_string()))) + } else { + Ok(parse_interp(s)) + } + } + } +} + fn is_text_only_div_chain(e: &Expr) -> bool { match e { Expr::Literal(Literal::Text(_)) => true, @@ -393,10 +423,13 @@ impl<'a> Parser<'a> { if self.eat(">") { // Inline call: `> name k=v` self.skip_ws(); - return Ok(Expr::Call(parse_call_tail(self.rest()).map(|(c, consumed)| { - self.i += consumed; - c - })?)); + let prefer_var = self.prefer_var; + return Ok(Expr::Call(parse_call_tail(self.rest(), prefer_var).map( + |(c, consumed)| { + self.i += consumed; + c + }, + )?)); } if self.starts_with("True") && is_word_end(self.rest(), 4) { self.i += 4; @@ -591,7 +624,9 @@ fn is_word_end(s: &str, len: usize) -> bool { /// Parse `name key=val …` / positional args; returns call + bytes consumed. /// Callee may be a bare name, library path `time.parse`, or method `` `recv`.method ``. -pub fn parse_call_tail(s: &str) -> Result<(CallExpr, usize)> { +/// When `prefer_var`, bare call-arg words parse as variables and bare dotted +/// callees are allowed to be method receivers. +pub fn parse_call_tail(s: &str, prefer_var: bool) -> Result<(CallExpr, usize)> { use crate::ast::Arg; let s = s.trim_start(); @@ -627,9 +662,14 @@ pub fn parse_call_tail(s: &str) -> Result<(CallExpr, usize)> { seen_named = true; let val_end = find_next_arg_boundary(after_eq); let val_raw = after_eq[..val_end].trim_end(); + let value = if prefer_var { + parse_call_arg_value_prefer_var(val_raw)? + } else { + parse_call_arg_value(val_raw)? + }; args.push(Arg::Named { name: key, - value: parse_call_arg_value(val_raw)?, + value, }); args_str = after_eq[val_end..].trim_start(); } else { @@ -640,7 +680,12 @@ pub fn parse_call_tail(s: &str) -> Result<(CallExpr, usize)> { if tok.is_empty() { break; } - args.push(Arg::Positional(parse_call_arg_value(tok)?)); + let value = if prefer_var { + parse_call_arg_value_prefer_var(tok)? + } else { + parse_call_arg_value(tok)? + }; + args.push(Arg::Positional(value)); args_str = rest.trim_start(); } } @@ -804,8 +849,10 @@ fn end_of_quoted_string(s: &str) -> Option { } /// Parse `> callee args` call expression/statement text (without leading `>`). -pub fn parse_call_after_gt(after_gt: &str) -> Result { - let (call, _) = parse_call_tail(after_gt.trim())?; +/// When `prefer_var` (inside `*…*` / `**…**`), bare call-arg words are variables +/// and a bare dotted callee may be a method receiver (resolved at eval/compile). +pub fn parse_call_after_gt(after_gt: &str, prefer_var: bool) -> Result { + let (call, _) = parse_call_tail(after_gt.trim(), prefer_var)?; Ok(call) } diff --git a/src/parse/mod.rs b/src/parse/mod.rs index 8d3f07f..5b77191 100644 --- a/src/parse/mod.rs +++ b/src/parse/mod.rs @@ -278,7 +278,7 @@ impl<'a> Cursor<'a> { // Call > if trimmed.starts_with('>') { - let call = call_after_gt(trimmed[1..].trim())?; + let call = call_after_gt(trimmed[1..].trim(), false)?; return Ok(Stmt::Call { call, span }); } @@ -365,7 +365,10 @@ impl<'a> Cursor<'a> { return Ok((expr, span.line)); } if rhs.starts_with('>') { - return Ok((Expr::Call(call_after_gt(rhs[1..].trim())?), span.line)); + return Ok(( + Expr::Call(call_after_gt(rhs[1..].trim(), prefer_var)?), + span.line, + )); } let value = if prefer_var { parse_expr_prefer_var(rhs)? diff --git a/tests/errors/bad-split-sep.mq.md b/tests/errors/bad-split-sep.mq.md index d2667c3..55d9156 100644 --- a/tests/errors/bad-split-sep.mq.md +++ b/tests/errors/bad-split-sep.mq.md @@ -4,4 +4,4 @@ title: empty split sep # main -*xs = > split value=ab sep=* +*xs = > split value="ab" sep=* diff --git a/tests/ext/agent-inspect-fixture.mq.md b/tests/ext/agent-inspect-fixture.mq.md index d9ed87e..911b0ae 100644 --- a/tests/ext/agent-inspect-fixture.mq.md +++ b/tests/ext/agent-inspect-fixture.mq.md @@ -9,22 +9,22 @@ import fs:lib/fs.mq.md # main *paths = > json.parse text={"f":".marqdo/agent-runs/inspect-fixture.mq.md"}* -*fixture = > json.get value=`paths` key=f* +*fixture = > json.get value=`paths` key="f"* *body = > json.parse text={"t":"# main\n\n> print text=hi\n\n\n"}* -*t = > json.get value=`body` key=t* +*t = > json.get value=`body` key="t"* > fs.write_text path=`fixture` text=`t` *obs = > agent.inspect_workbook path=`fixture` exit_code=0* -*code = > json.get value=`obs` key=exit_code* +*code = > json.get value=`obs` key="exit_code"* > print text=`code` -*ok = > json.get value=`obs` key=last_ok* -*has = > split value=`ok` sep=done* +*ok = > json.get value=`obs` key="last_ok"* +*has = > split value=`ok` sep="done"* *n = > len value=`has`* 1. `n` > 1 > print text=ok-slot 2. * > print text=ok-missing -*err = > json.get value=`obs` key=last_error* +*err = > json.get value=`obs` key="last_error"* > print text=`err` diff --git a/tests/ext/agent-kb-alias.mq.md b/tests/ext/agent-kb-alias.mq.md index 6182bc7..bdbec24 100644 --- a/tests/ext/agent-kb-alias.mq.md +++ b/tests/ext/agent-kb-alias.mq.md @@ -10,7 +10,7 @@ import sys:lib/sys.mq.md # main -*p = > plugin.native_path name=agent* +*p = > plugin.native_path name="agent"* 1. `p` > plugin.load path=`p` 2. * @@ -25,19 +25,19 @@ import sys:lib/sys.mq.md > fs.write_text path=`wb` text=`body` *prom = > agent_kb_promote kb_dir=`kb` goal=`goal` workbook=`wb` aliases=`alias`* -*okp = > json.get value=`prom` key=promoted* +*okp = > json.get value=`prom` key="promoted"* 1. `okp` > print text=promoted 2. * > print text=promote-fail -*slug = > json.get value=`prom` key=slug* +*slug = > json.get value=`prom` key="slug"* *parts = > json.parse text={"a":"/concepts/tasks/","b":".md"}* -*a = > json.get value=`parts` key=a* -*b = > json.get value=`parts` key=b* +*a = > json.get value=`parts` key="a"* +*b = > json.get value=`parts` key="b"* *task = kb + a + slug + b* *src = > fs.read_text path=`task`* -*has = > split value=`src` sep=say pong only* +*has = > split value=`src` sep="say pong only"* *hn = > len value=`has`* 1. `hn` > 1 > print text=alias-written @@ -50,17 +50,17 @@ import sys:lib/sys.mq.md 2. * > print text=alias-miss -*mk = > json.get value=`hit` key=match* +*mk = > json.get value=`hit` key="match"* > print text=`mk` -*slug_hit = > json.get value=`hit` key=slug* +*slug_hit = > json.get value=`hit` key="slug"* 1. `slug` == `slug_hit` > print text=same-slug 2. * > print text=slug-drift *exact = > agent_kb_lookup kb_dir=`kb` goal=`goal`* -*mk2 = > json.get value=`exact` key=match* +*mk2 = > json.get value=`exact` key="match"* > print text=`mk2` *g_trip = "帮我规划明天的行程"* @@ -68,7 +68,7 @@ import sys:lib/sys.mq.md *body2 = "---\ntitle: trip\n---\n\n# main\n\n*msg = \"trip-ok\"*\n\n**msg**\n"* > fs.write_text path=`wb2` text=`body2` *prom2 = > agent_kb_promote kb_dir=`kb` goal=`g_trip` workbook=`wb2`* -*ok2 = > json.get value=`prom2` key=promoted* +*ok2 = > json.get value=`prom2` key="promoted"* 1. `ok2` > print text=trip-promoted 2. * @@ -82,11 +82,11 @@ import sys:lib/sys.mq.md > print text=canonical-ok 2. * > print text=canonical-miss -*mk3 = > json.get value=`hit_c` key=match* +*mk3 = > json.get value=`hit_c` key="match"* > print text=`mk3` *listed = > agent_kb_list_tasks kb_dir=`kb`* -*tc = > json.get value=`listed` key=count* +*tc = > json.get value=`listed` key="count"* 1. `tc` > 1 > print text=list-ok 2. * diff --git a/tests/ext/agent-kb-near.mq.md b/tests/ext/agent-kb-near.mq.md index d2c6df5..0fa47b4 100644 --- a/tests/ext/agent-kb-near.mq.md +++ b/tests/ext/agent-kb-near.mq.md @@ -10,7 +10,7 @@ import sys:lib/sys.mq.md # main -*p = > plugin.native_path name=agent* +*p = > plugin.native_path name="agent"* 1. `p` > plugin.load path=`p` 2. * @@ -24,13 +24,13 @@ import sys:lib/sys.mq.md > 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* +*okp = > json.get value=`prom` key="promoted"* 1. `okp` > print text=promoted 2. * > print text=promote-fail -*slug = > json.get value=`prom` key=slug* +*slug = > json.get value=`prom` key="slug"* *g1 = "帮我规划明天行程"* *hit1 = > agent_kb_lookup kb_dir=`kb` goal=`g1` near_match=True near_threshold=0.78* @@ -38,9 +38,9 @@ import sys:lib/sys.mq.md > print text=near-ok 2. * > print text=near-miss -*mk1 = > json.get value=`hit1` key=match* +*mk1 = > json.get value=`hit1` key="match"* > print text=`mk1` -*slug1 = > json.get value=`hit1` key=slug* +*slug1 = > json.get value=`hit1` key="slug"* 1. `slug` == `slug1` > print text=same-slug 2. * @@ -60,16 +60,16 @@ import sys:lib/sys.mq.md > print text=neg-miss *ranked = > agent_kb_near_match kb_dir=`kb` goal=`g1`* -*best = > json.get value=`ranked` key=best* -*bs = > json.get value=`best` key=slug* +*best = > json.get value=`ranked` key="best"* +*bs = > json.get value=`best` key="slug"* 1. `bs` == `slug` > print text=rank-ok 2. * > print text=rank-bad -*tasks = > json.get value=`ranked` key=candidates* +*tasks = > json.get value=`ranked` key="candidates"* *prompt = > agent.build_soft_match_prompt goal=`g1` tasks=`tasks`* -*has = > split value=`prompt` sep=score=* +*has = > split value=`prompt` sep="score="* *hn = > len value=`has`* 1. `hn` > 1 > print text=prompt-score-ok diff --git a/tests/ext/agent-kb-reuse.mq.md b/tests/ext/agent-kb-reuse.mq.md index c37751f..2f3ef8b 100644 --- a/tests/ext/agent-kb-reuse.mq.md +++ b/tests/ext/agent-kb-reuse.mq.md @@ -11,7 +11,7 @@ import sys:lib/sys.mq.md # main -*p = > plugin.native_path name=agent* +*p = > plugin.native_path name="agent"* 1. `p` > plugin.load path=`p` 2. * @@ -19,10 +19,10 @@ import sys:lib/sys.mq.md > sys.exit code=1 *paths = > json.parse text={"kb":".marqdo/agent-kb","wb":".marqdo/agent-runs/pong-solid.mq.md","goal":"Reply with exactly the word pong and nothing else.","body":"---\ntitle: pong skill\n---\n\n# main\n\n*msg = \"pong\"*\n\n**msg**\n"}* -*kb = > json.get value=`paths` key=kb* -*wb = > json.get value=`paths` key=wb* -*goal = > json.get value=`paths` key=goal* -*body = > json.get value=`paths` key=body* +*kb = > json.get value=`paths` key="kb"* +*wb = > json.get value=`paths` key="wb"* +*goal = > json.get value=`paths` key="goal"* +*body = > json.get value=`paths` key="body"* > fs.write_text path=`wb` text=`body` @@ -33,16 +33,16 @@ import sys:lib/sys.mq.md > print text=`slug0` *prom = > agent_kb_promote kb_dir=`kb` goal=`goal` workbook=`wb`* -*okp = > json.get value=`prom` key=promoted* +*okp = > json.get value=`prom` key="promoted"* 1. `okp` > print text=promoted 2. * > print text=promote-fail -*st = > json.get value=`prom` key=status* +*st = > json.get value=`prom` key="status"* > print text=`st` -*slug = > json.get value=`prom` key=slug* +*slug = > json.get value=`prom` key="slug"* > print text=`slug` *hit = > agent_kb_lookup kb_dir=`kb` goal=`goal`* @@ -51,16 +51,16 @@ import sys:lib/sys.mq.md 2. * > print text=lookup-miss -*res = > json.get value=`hit` key=resource* +*res = > json.get value=`hit` key="resource"* *id = > subtask.spawn path=`res`* *waited = > subtask.wait id=`id`* -*code = > json.get value=`waited` key=code* -*val = > json.get value=`waited` key=value* +*code = > json.get value=`waited` key="code"* +*val = > json.get value=`waited` key="value"* > print text=`code` > print text=`val` *hit2 = > agent_kb_lookup kb_dir=`kb` goal=`goal`* -*res2 = > json.get value=`hit2` key=resource* +*res2 = > json.get value=`hit2` key="resource"* 1. `res` == `res2` > print text=stable-path 2. * diff --git a/tests/ext/agent-lib-call.mq.md b/tests/ext/agent-lib-call.mq.md index 821ebbd..a79a748 100644 --- a/tests/ext/agent-lib-call.mq.md +++ b/tests/ext/agent-lib-call.mq.md @@ -10,25 +10,25 @@ import sys:lib/sys.mq.md # main *parts = > json.parse text={"a":"CALL:lib.fs.exists","b":"ARGS:{\"path\":\".\"}","nl":"\n"}* -*a = > json.get value=`parts` key=a* -*b = > json.get value=`parts` key=b* -*nl = > json.get value=`parts` key=nl* +*a = > json.get value=`parts` key="a"* +*b = > json.get value=`parts` key="b"* +*nl = > json.get value=`parts` key="nl"* *t_ok = a + nl + b + nl* *act = > agent.extract_plan_act reply=`t_ok`* -*kind = > json.get value=`act` key=kind* -*name = > json.get value=`act` key=name* +*kind = > json.get value=`act` key="kind"* +*name = > json.get value=`act` key="name"* > print text=`kind` > print text=`name` -*out = > agent.run_parent_tool name=`name` path=. reply=`t_ok`* +*out = > agent.run_parent_tool name=`name` path="." reply=`t_ok`* 1. `out` > print text=exists-ok 2. * > print text=exists-bad -*deny = > agent.run_parent_tool name=lib.net.get path=. reply=CALL:lib.net.get* +*deny = > agent.run_parent_tool name="lib.net.get" path="." reply="CALL:lib.net.get"* *sep = > json.parse text={"s":"not allowed"}* -*s = > json.get value=`sep` key=s* +*s = > json.get value=`sep` key="s"* *dparts = > split value=`deny` sep=`s`* *pn = > len value=`dparts`* 1. `pn` > 1 @@ -37,7 +37,7 @@ import sys:lib/sys.mq.md > print text=deny-bad *cat = > agent.lib_catalog* -*callable = > json.get value=`cat` key=callable* +*callable = > json.get value=`cat` key="callable"* *cn = > len value=`callable`* 1. `cn` > 3 > print text=callable-ok diff --git a/tests/ext/agent-plan-confirm.mq.md b/tests/ext/agent-plan-confirm.mq.md index 41e5aad..9f51593 100644 --- a/tests/ext/agent-plan-confirm.mq.md +++ b/tests/ext/agent-plan-confirm.mq.md @@ -13,14 +13,14 @@ import fs:lib/fs.mq.md *model = > llm.llm* *tools = > json.parse text=[]* -*助手 = > agent.agent model=`model` tools=`tools` standing=offline plan confirm* +*助手 = > agent.agent model=`model` tools=`tools` standing="offline plan confirm"* -*out = > `助手`.plan goal=say hi confirm=True workbook_dir=".marqdo/agent-runs" writeback=False* +*out = > `助手`.plan goal="say hi" confirm=True workbook_dir=".marqdo/agent-runs" writeback=False* -*st = > json.get value=`out` key=status* +*st = > json.get value=`out` key="status"* > print text=`st` -*path = > json.get value=`out` key=workbook* +*path = > json.get value=`out` key="workbook"* *ex = > fs.exists path=`path`* 1. `ex` > print text=workbook-ok @@ -28,7 +28,7 @@ import fs:lib/fs.mq.md > print text=workbook-missing *src = > fs.read_text path=`path`* -*parts = > split value=`src` sep=agent.agent* +*parts = > split value=`src` sep="agent.agent"* *n = > len value=`parts`* 1. `n` > 1 > print text=skeleton-ok diff --git a/tests/ext/agent-plan-decision.mq.md b/tests/ext/agent-plan-decision.mq.md index fa704f8..b1eadf3 100644 --- a/tests/ext/agent-plan-decision.mq.md +++ b/tests/ext/agent-plan-decision.mq.md @@ -9,25 +9,25 @@ import fs:lib/fs.mq.md # main *samples = > json.parse text={"done":"DECISION: DONE\nSUMMARY: all good\n","cont":"DECISION: CONTINUE\nPATCH:\n<<<\nFIND\nold\n===\nREPLACE\nnew\n>>>\n","zh":"决定:完成\n汇总:好了\n","run":"DECISION: RUN\n","zh_run":"决定:运行\n"}* -*d1 = > json.get value=`samples` key=done* +*d1 = > json.get value=`samples` key="done"* *r1 = > agent.extract_plan_decision reply=`d1`* > print text=`r1` *s1 = > agent.extract_plan_summary reply=`d1`* > print text=`s1` -*d2 = > json.get value=`samples` key=cont* +*d2 = > json.get value=`samples` key="cont"* *r2 = > agent.extract_plan_decision reply=`d2`* > print text=`r2` -*d3 = > json.get value=`samples` key=zh* +*d3 = > json.get value=`samples` key="zh"* *r3 = > agent.extract_plan_decision reply=`d3`* > print text=`r3` -*d4 = > json.get value=`samples` key=run* +*d4 = > json.get value=`samples` key="run"* *r4 = > agent.extract_plan_decision reply=`d4`* > print text=`r4` -*d5 = > json.get value=`samples` key=zh_run* +*d5 = > json.get value=`samples` key="zh_run"* *r5 = > agent.extract_plan_decision reply=`d5`* > print text=`r5` @@ -37,47 +37,47 @@ import fs:lib/fs.mq.md *act_call = "CALL:lib_catalog"* *a1 = > agent.extract_plan_act reply=`act_call`* -*a1k = > json.get value=`a1` key=kind* -*a1n = > json.get value=`a1` key=name* +*a1k = > json.get value=`a1` key="kind"* +*a1n = > json.get value=`a1` key="name"* > print text=`a1k` > print text=`a1n` *act_read = "READ:stderr"* *a2 = > agent.extract_plan_act reply=`act_read`* -*a2k = > json.get value=`a2` key=kind* -*a2n = > json.get value=`a2` key=name* +*a2k = > json.get value=`a2` key="kind"* +*a2n = > json.get value=`a2` key="name"* > print text=`a2k` > print text=`a2n` -*act_dec = > json.get value=`samples` key=done* +*act_dec = > json.get value=`samples` key="done"* *a3 = > agent.extract_plan_act reply=`act_dec`* -*a3k = > json.get value=`a3` key=kind* +*a3k = > json.get value=`a3` key="kind"* > print text=`a3k` *cat = > agent.lib_catalog* -*files = > json.get value=`cat` key=files* +*files = > json.get value=`cat` key="files"* *nf = > len value=`files`* 1. `nf` > 5 > print text=catalog-ok 2. * > print text=catalog-bad -*dual = > agent.render_workbook_skeleton goal=demo skeleton=dual* -*has_r = > split value=`dual` sep=research* +*dual = > agent.render_workbook_skeleton goal="demo" skeleton="dual"* +*has_r = > split value=`dual` sep="research"* *n_r = > len value=`has_r`* 1. `n_r` > 1 > print text=dual-ok 2. * > print text=dual-missing -*has_s = > split value=`dual` sep=Solidify* +*has_s = > split value=`dual` sep="Solidify"* *n_s = > len value=`has_s`* 1. `n_s` > 1 > print text=solidify-ok 2. * > print text=solidify-missing -*has_imp = > split value=`dual` sep=import llm:ext/ai/llm.mq.md* +*has_imp = > split value=`dual` sep="import llm:ext/ai/llm.mq.md"* *n_imp = > len value=`has_imp`* 1. `n_imp` > 1 > print text=import-ok @@ -85,19 +85,19 @@ import fs:lib/fs.mq.md > print text=import-missing *paths = > json.parse text={"p":".marqdo/agent-runs/decision-patch.md","t":"keep old keep","fence":"alpha beta","p2":".marqdo/agent-runs/decision-fence.md"}* -*path = > json.get value=`paths` key=p* -*seed = > json.get value=`paths` key=t* +*path = > json.get value=`paths` key="p"* +*seed = > json.get value=`paths` key="t"* > fs.write_text path=`path` text=`seed` *n = > fs.apply_patch_blocks path=`path` text=`d2`* > print text=`n` *out = > fs.read_text path=`path`* > print text=`out` -*path2 = > json.get value=`paths` key=p2* -*seed2 = > json.get value=`paths` key=fence* +*path2 = > json.get value=`paths` key="p2"* +*seed2 = > json.get value=`paths` key="fence"* > fs.write_text path=`path2` text=`seed2` *fence_pack = > json.parse text={"t":"DECISION: CONTINUE\n\u0060\u0060\u0060find\nalpha\n\u0060\u0060\u0060\n\u0060\u0060\u0060replace\nALPHA\n\u0060\u0060\u0060\n"}* -*fence_reply = > json.get value=`fence_pack` key=t* +*fence_reply = > json.get value=`fence_pack` key="t"* *n2 = > fs.apply_patch_blocks path=`path2` text=`fence_reply`* > print text=`n2` *out2 = > fs.read_text path=`path2`* diff --git a/tests/ext/agent-plan-live.mq.md b/tests/ext/agent-plan-live.mq.md index 6730d5d..cdb11e4 100644 --- a/tests/ext/agent-plan-live.mq.md +++ b/tests/ext/agent-plan-live.mq.md @@ -13,31 +13,31 @@ import fs:lib/fs.mq.md *model = > llm.llm* *tools = > json.parse text=[]* -*助手 = > agent.agent model=`model` tools=`tools` standing=You are a Marqdo agent-development master. Prefer DONE when the workbook already satisfies the goal.* +*助手 = > agent.agent model=`model` tools=`tools` standing="You are a Marqdo agent-development master. Prefer DONE when the workbook already satisfies the goal."* -*out = > `助手`.plan goal=Reply with exactly the word pong and nothing else. max_rounds=3 writeback=False* +*out = > `助手`.plan goal="Reply with exactly the word pong and nothing else." max_rounds=3 writeback=False* -*st = > json.get value=`out` key=status* +*st = > json.get value=`out` key="status"* > print text=`st` -*sum = > json.get value=`out` key=summary* +*sum = > json.get value=`out` key="summary"* 1. `sum` > print text=`sum` 2. * > print text=no-summary -*cache = > json.get value=`out` key=cache* +*cache = > json.get value=`out` key="cache"* > print text=`cache` -*path = > json.get value=`out` key=workbook* +*path = > json.get value=`out` key="workbook"* *ex = > fs.exists path=`path`* 1. `ex` > print text=workbook-ok 2. * > print text=workbook-missing -*out2 = > `助手`.plan goal=Reply with exactly the word pong and nothing else. max_rounds=3 writeback=False* -*st2 = > json.get value=`out2` key=status* +*out2 = > `助手`.plan goal="Reply with exactly the word pong and nothing else." max_rounds=3 writeback=False* +*st2 = > json.get value=`out2` key="status"* > print text=`st2` -*cache2 = > json.get value=`out2` key=cache* +*cache2 = > json.get value=`out2` key="cache"* > print text=`cache2` diff --git a/tests/ext/agent-plan-observe.mq.md b/tests/ext/agent-plan-observe.mq.md index c518895..f893b25 100644 --- a/tests/ext/agent-plan-observe.mq.md +++ b/tests/ext/agent-plan-observe.mq.md @@ -8,29 +8,29 @@ import fs:lib/fs.mq.md # main *paths = > json.parse text={"p":".marqdo/agent-runs/observe-fixture.mq.md"}* -*path = > json.get value=`paths` key=p* +*path = > json.get value=`paths` key="p"* *seed = > json.parse text={"t":"---\ntitle: fixture\n---\n\n# main\n\n\n\n*msg = \"ok\"*\n\n**msg**\n"}* -*text = > json.get value=`seed` key=t* +*text = > json.get value=`seed` key="t"* > fs.write_text path=`path` text=`text` -*obs = > agent.inspect_workbook path=`path` exit_code=0 value=ok* +*obs = > agent.inspect_workbook path=`path` exit_code=0 value="ok"* *compact = > agent.compact_plan_observation observation=`obs`* -*ex = > json.get value=`compact` key=source_excerpt* -*parts = > split value=`ex` sep=HUGE_BODY* +*ex = > json.get value=`compact` key="source_excerpt"* +*parts = > split value=`ex` sep="HUGE_BODY"* *n = > len value=`parts`* 1. `n` == 1 > print text=excerpt-stripped 2. * > print text=excerpt-leak -*has = > json.get value=`compact` key=has_value* +*has = > json.get value=`compact` key="has_value"* 1. `has` > print text=has-value-ok 2. * > print text=has-value-bad -*deep = > agent.plan_read_deepen observation=`obs` kind=source path=`path`* -*ex2 = > json.get value=`deep` key=source_excerpt* +*deep = > agent.plan_read_deepen observation=`obs` kind="source" path=`path`* +*ex2 = > json.get value=`deep` key="source_excerpt"* 1. `ex2` > print text=read-source-ok 2. * diff --git a/tests/ext/agent-plan-stream-offline.mq.md b/tests/ext/agent-plan-stream-offline.mq.md index 9d21609..31c0f85 100644 --- a/tests/ext/agent-plan-stream-offline.mq.md +++ b/tests/ext/agent-plan-stream-offline.mq.md @@ -10,34 +10,34 @@ import fs:lib/fs.mq.md # main *events = > json.parse text=[]* -*events = > agent.plan_append_round events=`events` round=1 workbook=wb.mq.md exit_code=0 stream=True* +*events = > agent.plan_append_round events=`events` round=1 workbook="wb.mq.md" exit_code=0 stream=True* *from = > json.parse text=[{"type":"delta","text":"Hi"},{"type":"done","result":"Hi"}]* *events = > agent.plan_merge_deltas events=`events` from=`from` stream=True* -*events = > agent.plan_append_decision events=`events` decision=DONE stream=True summary=ok* +*events = > agent.plan_append_decision events=`events` decision="DONE" stream=True summary="ok"* *out = > json.parse text={"status":"ok"}* -*out = > agent.plan_finish_stream out=`out` events=`events` stream=True result=child* +*out = > agent.plan_finish_stream out=`out` events=`events` stream=True result="child"* -*evs = > json.get value=`out` key=events* +*evs = > json.get value=`out` key="events"* *n = > len value=`evs`* > print text=`n` *e0 = > at value=`evs` index=0* -*t0 = > json.get value=`e0` key=type* +*t0 = > json.get value=`e0` key="type"* > print text=`t0` *e1 = > at value=`evs` index=1* -*t1 = > json.get value=`e1` key=type* -*x1 = > json.get value=`e1` key=text* +*t1 = > json.get value=`e1` key="type"* +*x1 = > json.get value=`e1` key="text"* > print text=`t1` > print text=`x1` *e2 = > at value=`evs` index=2* -*t2 = > json.get value=`e2` key=type* +*t2 = > json.get value=`e2` key="type"* > print text=`t2` *e3 = > at value=`evs` index=3* -*t3 = > json.get value=`e3` key=type* -*r3 = > json.get value=`e3` key=result* +*t3 = > json.get value=`e3` key="type"* +*r3 = > json.get value=`e3` key="result"* > print text=`t3` > print text=`r3` @@ -45,27 +45,27 @@ import fs:lib/fs.mq.md *model = > llm.llm* *tools = > json.parse text=[]* -*助手 = > agent.agent model=`model` tools=`tools` standing=offline plan stream* +*助手 = > agent.agent model=`model` tools=`tools` standing="offline plan stream"* -*pout = > `助手`.plan goal=say hi confirm=True workbook_dir=".marqdo/agent-runs" writeback=False stream=True* +*pout = > `助手`.plan goal="say hi" confirm=True workbook_dir=".marqdo/agent-runs" writeback=False stream=True* -*st = > json.get value=`pout` key=status* +*st = > json.get value=`pout` key="status"* > print text=`st` -*pevs = > json.get value=`pout` key=events* +*pevs = > json.get value=`pout` key="events"* *pn = > len value=`pevs`* > print text=`pn` *plast = > at value=`pevs` index=0* -*pt = > json.get value=`plast` key=type* +*pt = > json.get value=`plast` key="type"* > print text=`pt` -*aev = > agent.plan_echo_await round=2 workbook=wb.mq.md stream=True* -*at = > json.get value=`aev` key=type* +*aev = > agent.plan_echo_await round=2 workbook="wb.mq.md" stream=True* +*at = > json.get value=`aev` key="type"* > print text=`at` -*ar = > json.get value=`aev` key=round* +*ar = > json.get value=`aev` key="round"* > print text=`ar` -*dev = > agent.plan_echo_decompose workbook=wb.mq.md stream=True* -*dt = > json.get value=`dev` key=type* +*dev = > agent.plan_echo_decompose workbook="wb.mq.md" stream=True* +*dt = > json.get value=`dev` key="type"* > print text=`dt` diff --git a/tests/ext/agent-run-live.mq.md b/tests/ext/agent-run-live.mq.md index bb57e61..64aca4a 100644 --- a/tests/ext/agent-run-live.mq.md +++ b/tests/ext/agent-run-live.mq.md @@ -11,7 +11,7 @@ import agent:ext/ai/agent.mq.md ## 获取时间 *u = > time.now_unix* -*s = > time.format unix=`u` pattern=%Y-%m-%d* +*s = > time.format unix=`u` pattern="%Y-%m-%d"* **s** # main @@ -25,25 +25,25 @@ import agent:ext/ai/agent.mq.md |------| | 获取时间 | -*助手 = > agent.agent model=`模型` tools=`工具表` standing=You are a Marqdo agent. When you need the current date, reply with exactly one line CALL:获取时间 and nothing else.* +*助手 = > agent.agent model=`模型` tools=`工具表` standing="You are a Marqdo agent. When you need the current date, reply with exactly one line CALL:获取时间 and nothing else."* -*out = > `助手`.step task=请调用获取时间工具,然后用一句话告诉用户今天的日期。* +*out = > `助手`.step task="请调用获取时间工具,然后用一句话告诉用户今天的日期。"* -*status = > json.get value=`out` key=status* -*回复 = > json.get value=`out` key=result* +*status = > json.get value=`out` key="status"* +*回复 = > json.get value=`out` key="result"* > print text=`回复` -*cached = > writeback.get key=ok* +*cached = > writeback.get key="ok"* 1. `cached` > print text=writeback-ok 2. * > print text=writeback-missing -*id = > json.get value=`助手` key=id* +*id = > json.get value=`助手` key="id"* *历史 = > agent_history_get id=`id`* *条数 = > len value=`历史`* > print text=`条数` diff --git a/tests/ext/agent-smoke.mq.md b/tests/ext/agent-smoke.mq.md index f092145..d692c53 100644 --- a/tests/ext/agent-smoke.mq.md +++ b/tests/ext/agent-smoke.mq.md @@ -9,7 +9,7 @@ import agent:ext/ai/agent.mq.md ## 获取时间 *esc = > json.parse text={"v":"ok-time"}* -**> json.get value=`esc` key=v** +**> json.get value=`esc` key="v"** # main @@ -21,34 +21,34 @@ import agent:ext/ai/agent.mq.md | 获取时间 | *模型 = > llm.llm* -*助手 = > agent.agent model=`模型` tools=`工具表` standing=you are a readable Marqdo agent* +*助手 = > agent.agent model=`模型` tools=`工具表` standing="you are a readable Marqdo agent"* -*id = > json.get value=`助手` key=id* +*id = > json.get value=`助手` key="id"* -*ctx = > agent.build_step_context agent=`助手` task=probe* +*ctx = > agent.build_step_context agent=`助手` task="probe"* -*has_skill = > split value=`ctx` sep=Marqdo* +*has_skill = > split value=`ctx` sep="Marqdo"* *sk_n = > len value=`has_skill`* 1. `sk_n` > 1 > print text=skill-ok 2. * > print text=skill-missing -*has_tools = > split value=`ctx` sep=获取时间* +*has_tools = > split value=`ctx` sep="获取时间"* *tool_n = > len value=`has_tools`* 1. `tool_n` > 1 > print text=tools-ok 2. * > print text=tools-missing -*has_src = > split value=`ctx` sep=probe* +*has_src = > split value=`ctx` sep="probe"* *src_n = > len value=`has_src`* 1. `src_n` > 1 > print text=source-ok 2. * > print text=source-missing -*has_act = > split value=`ctx` sep=CALL:* +*has_act = > split value=`ctx` sep="CALL:"* *act_n = > len value=`has_act`* 1. `act_n` > 1 > print text=protocol-ok @@ -56,15 +56,15 @@ import agent:ext/ai/agent.mq.md > print text=protocol-missing *samples = > json.parse text={"r":"CALL:获取时间","m":"think\nCALL:获取时间"}* -*raw1 = > json.get value=`samples` key=r* +*raw1 = > json.get value=`samples` key="r"* *name1 = > agent.extract_tool_name reply=`raw1`* > print text=`name1` -*raw2 = > json.get value=`samples` key=m* +*raw2 = > json.get value=`samples` key="m"* *name2 = > agent.extract_tool_name reply=`raw2`* > print text=`name2` -*tool_out = > agent.run_tool tools=`工具表` name=获取时间* +*tool_out = > agent.run_tool tools=`工具表` name="获取时间"* > print text=`tool_out` *turn = > json.parse text={"role":"user","content":"one"}* @@ -83,5 +83,5 @@ import agent:ext/ai/agent.mq.md > print text=`n2` *site = > agent_call_site* -*fn = > json.get value=`site` key=function* +*fn = > json.get value=`site` key="function"* > print text=`fn` diff --git a/tests/ext/agent-soft-match.mq.md b/tests/ext/agent-soft-match.mq.md index 85cf2da..f931a22 100644 --- a/tests/ext/agent-soft-match.mq.md +++ b/tests/ext/agent-soft-match.mq.md @@ -8,25 +8,25 @@ import json:lib/json.mq.md # main *samples = > json.parse text={"reuse":"DECISION: REUSE\nSLUG: trip-plan\n","new":"DECISION: NEW\n","zh":"决定:复用\n标识:行程-a\n"}* -*r1 = > json.get value=`samples` key=reuse* +*r1 = > json.get value=`samples` key="reuse"* *d1 = > agent.extract_plan_decision reply=`r1`* > print text=`d1` *s1 = > agent.extract_soft_match_slug reply=`r1`* > print text=`s1` -*r2 = > json.get value=`samples` key=new* +*r2 = > json.get value=`samples` key="new"* *d2 = > agent.extract_plan_decision reply=`r2`* > print text=`d2` -*r3 = > json.get value=`samples` key=zh* +*r3 = > json.get value=`samples` key="zh"* *d3 = > agent.extract_plan_decision reply=`r3`* > print text=`d3` *s3 = > agent.extract_soft_match_slug reply=`r3`* > print text=`s3` *tasks = > json.parse text=[{"slug":"a","title":"Alpha"},{"slug":"b","title":"Beta"}]* -*prompt = > agent.build_soft_match_prompt goal=demo tasks=`tasks`* -*has = > split value=`prompt` sep=DECISION: REUSE* +*prompt = > agent.build_soft_match_prompt goal="demo" tasks=`tasks`* +*has = > split value=`prompt` sep="DECISION: REUSE"* *n = > len value=`has`* 1. `n` > 1 > print text=prompt-ok diff --git a/tests/ext/fs-text-patch.mq.md b/tests/ext/fs-text-patch.mq.md index 0105d2e..2241f0c 100644 --- a/tests/ext/fs-text-patch.mq.md +++ b/tests/ext/fs-text-patch.mq.md @@ -7,8 +7,8 @@ import json:lib/json.mq.md # main *paths = > json.parse text={"p":".marqdo/agent-runs/patch-demo.md","t":"alpha beta gamma"}* -*path = > json.get value=`paths` key=p* -*seed = > json.get value=`paths` key=t* +*path = > json.get value=`paths` key="p"* +*seed = > json.get value=`paths` key="t"* > fs.write_text path=`path` text=`seed` > fs.text_patch path=`path` find=beta replace=BETA @@ -16,7 +16,7 @@ import json:lib/json.mq.md > print text=`s1` *reply = > json.parse text={"t":"DECISION: CONTINUE\n<<<\nFIND\nalpha\n===\nREPLACE\nALPHA\n>>>\n<<<\nFIND\ngamma\n===\nREPLACE\nGAMMA\n>>>\n"}* -*t = > json.get value=`reply` key=t* +*t = > json.get value=`reply` key="t"* *n = > fs.apply_patch_blocks path=`path` text=`t`* > print text=`n` *s2 = > fs.read_text path=`path`* diff --git a/tests/ext/llm-complete.mq.md b/tests/ext/llm-complete.mq.md index b596d86..9b9b5f1 100644 --- a/tests/ext/llm-complete.mq.md +++ b/tests/ext/llm-complete.mq.md @@ -10,6 +10,6 @@ import llm:ext/ai/llm.mq.md *model = > llm.llm* -*reply = > `model`.complete prompt=Reply with exactly one English word: pong* +*reply = > `model`.complete prompt="Reply with exactly one English word: pong"* > print text=`reply` diff --git a/tests/ext/llm-stream-live.mq.md b/tests/ext/llm-stream-live.mq.md index 1ea5226..0db5210 100644 --- a/tests/ext/llm-stream-live.mq.md +++ b/tests/ext/llm-stream-live.mq.md @@ -11,7 +11,7 @@ import json:lib/json.mq.md *model = > llm.llm* -*events = > `model`.complete prompt=Reply with exactly one English word: pong stream=True echo=True* +*events = > `model`.complete prompt="Reply with exactly one English word: pong" stream=True echo=True* *n = > len value=`events`* > print text=`n` diff --git a/tests/ext/quantum-amp-damp-smoke.mq.md b/tests/ext/quantum-amp-damp-smoke.mq.md index 5087341..e4a5750 100644 --- a/tests/ext/quantum-amp-damp-smoke.mq.md +++ b/tests/ext/quantum-amp-damp-smoke.mq.md @@ -8,7 +8,7 @@ import quantum:ext/quantum/quantum.mq.md *qc = > quantum.circuit qubits=1* *qc = > `qc`.x qubit=0* -*qc = > `qc`.noise kind=amplitude_damping p=1* +*qc = > `qc`.noise kind="amplitude_damping" p=1* *r = > `qc`.run shots=32 seed=7* *c0 = r[^counts][^0]* diff --git a/tests/ext/quantum-amp-damp-zh-smoke.mq.md b/tests/ext/quantum-amp-damp-zh-smoke.mq.md index 0cd3ba2..a448569 100644 --- a/tests/ext/quantum-amp-damp-zh-smoke.mq.md +++ b/tests/ext/quantum-amp-damp-zh-smoke.mq.md @@ -8,7 +8,7 @@ description: 泡利X 后 振幅阻尼 p=1 全部落回 |0⟩. *qc = > 量子.电路 比特数=1* *qc = > `qc`.泡利X 比特=0* -*qc = > `qc`.噪声 种类=振幅阻尼 概率=1* +*qc = > `qc`.噪声 种类="振幅阻尼" 概率=1* *r = > `qc`.运行 次数=32 种子=7* *c0 = r[^counts][^0]* diff --git a/tests/ext/quantum-author-api-smoke.mq.md b/tests/ext/quantum-author-api-smoke.mq.md index 4b122d4..f340340 100644 --- a/tests/ext/quantum-author-api-smoke.mq.md +++ b/tests/ext/quantum-author-api-smoke.mq.md @@ -19,7 +19,7 @@ import quantum:ext/quantum/quantum.mq.md 2. * > print text=state-fail -*img = > `qc`.draw path=quantum-author-draw.svg* +*img = > `qc`.draw path="quantum-author-draw.svg"* *kind = img[^kind]* 1. `kind` == circuit > print text=draw-ok diff --git a/tests/ext/quantum-author-api-zh-smoke.mq.md b/tests/ext/quantum-author-api-zh-smoke.mq.md index e4a5297..5e5db79 100644 --- a/tests/ext/quantum-author-api-zh-smoke.mq.md +++ b/tests/ext/quantum-author-api-zh-smoke.mq.md @@ -19,7 +19,7 @@ description: 屏障 / 测量 / 追加 / 态 / 绘图. 2. * > print text=state-fail -*img = > `qc`.绘图 路径=quantum-author-zh-draw.svg* +*img = > `qc`.绘图 路径="quantum-author-zh-draw.svg"* *kind = img[^kind]* 1. `kind` == circuit > print text=draw-ok diff --git a/tests/ext/quantum-custom-gate-smoke.mq.md b/tests/ext/quantum-custom-gate-smoke.mq.md index 6abc85a..bb60008 100644 --- a/tests/ext/quantum-custom-gate-smoke.mq.md +++ b/tests/ext/quantum-custom-gate-smoke.mq.md @@ -12,7 +12,7 @@ $$ \frac{1}{\sqrt{2}}\begin{pmatrix}1&1\\1&-1\end{pmatrix} $$ -*U = > quantum.gate matrix=`H_matrix` name=U* +*U = > quantum.gate matrix=`H_matrix` name="U"* *qc = > quantum.circuit qubits=1* *qc = > `qc`.apply gate=`U` qubits=0* *p = > `qc`.probabilities* diff --git a/tests/ext/quantum-custom-gate-zh-smoke.mq.md b/tests/ext/quantum-custom-gate-zh-smoke.mq.md index f9c7f03..ebeb15d 100644 --- a/tests/ext/quantum-custom-gate-zh-smoke.mq.md +++ b/tests/ext/quantum-custom-gate-zh-smoke.mq.md @@ -12,7 +12,7 @@ $$ \frac{1}{\sqrt{2}}\begin{pmatrix}1&1\\1&-1\end{pmatrix} $$ -*U = > 量子.门 矩阵=`H矩阵` 名=U* +*U = > 量子.门 矩阵=`H矩阵` 名="U"* *qc = > 量子.电路 比特数=1* *qc = > `qc`.施加 门=`U` 比特=0* *p = > `qc`.概率* diff --git a/tests/ext/quantum-draw-smoke.mq.md b/tests/ext/quantum-draw-smoke.mq.md index 5569a80..39f54ab 100644 --- a/tests/ext/quantum-draw-smoke.mq.md +++ b/tests/ext/quantum-draw-smoke.mq.md @@ -14,7 +14,7 @@ import quantum:ext/quantum/quantum.mq.md | 2 | CX | 0,1 | *qc = > quantum.circuit qubits=2 steps=`steps`* -*img = > `qc`.draw kind=probs path=quantum-draw-probs.svg* +*img = > `qc`.draw kind="probs" path="quantum-draw-probs.svg"* *kind = img[^kind]* 1. `kind` == probs @@ -24,7 +24,7 @@ import quantum:ext/quantum/quantum.mq.md *qc1 = > quantum.circuit qubits=1* *qc1 = > `qc1`.h qubit=0* -*bloch = > `qc1`.draw kind=bloch path=quantum-draw-bloch.svg* +*bloch = > `qc1`.draw kind="bloch" path="quantum-draw-bloch.svg"* *bk = bloch[^kind]* 1. `bk` == bloch diff --git a/tests/ext/quantum-gate-heatmap-smoke.mq.md b/tests/ext/quantum-gate-heatmap-smoke.mq.md index bb8e228..826657e 100644 --- a/tests/ext/quantum-gate-heatmap-smoke.mq.md +++ b/tests/ext/quantum-gate-heatmap-smoke.mq.md @@ -6,8 +6,8 @@ import quantum:ext/quantum/quantum.mq.md # main -*H = > quantum.gate name=H* -*img = > `H`.draw kind=matrix path=quantum-gate-heatmap.svg* +*H = > quantum.gate name="H"* +*img = > `H`.draw kind="matrix" path="quantum-gate-heatmap.svg"* *kind = img[^kind]* 1. `kind` == matrix diff --git a/tests/ext/quantum-gate-matrix-smoke.mq.md b/tests/ext/quantum-gate-matrix-smoke.mq.md index c50cafb..9aec0bd 100644 --- a/tests/ext/quantum-gate-matrix-smoke.mq.md +++ b/tests/ext/quantum-gate-matrix-smoke.mq.md @@ -8,7 +8,7 @@ import json:lib/json.mq.md # main *H_matrix = > json.parse text=[[0.7071067811865475,0.7071067811865475],[0.7071067811865475,-0.7071067811865475]]* -*H = > quantum.gate name=H* +*H = > quantum.gate name="H"* *ok = > `H`.matches_matrix matrix=`H_matrix`* 1. `ok` diff --git a/tests/ext/quantum-noise-smoke.mq.md b/tests/ext/quantum-noise-smoke.mq.md index 5491594..8b6c310 100644 --- a/tests/ext/quantum-noise-smoke.mq.md +++ b/tests/ext/quantum-noise-smoke.mq.md @@ -8,7 +8,7 @@ import quantum:ext/quantum/quantum.mq.md *qc = > quantum.circuit qubits=1* *qc = > `qc`.i qubit=0* -*qc = > `qc`.noise kind=bitflip p=1* +*qc = > `qc`.noise kind="bitflip" p=1* *r = > `qc`.run shots=32 seed=3* *c1 = r[^counts][^1]* diff --git a/tests/ext/quantum-noise-zh-smoke.mq.md b/tests/ext/quantum-noise-zh-smoke.mq.md index 07e80d6..0487dc0 100644 --- a/tests/ext/quantum-noise-zh-smoke.mq.md +++ b/tests/ext/quantum-noise-zh-smoke.mq.md @@ -8,7 +8,7 @@ description: 噪声 bitflip p=1 后 I 使全部射中 |1⟩. *qc = > 量子.电路 比特数=1* *qc = > `qc`.单位 比特=0* -*qc = > `qc`.噪声 种类=bitflip 概率=1* +*qc = > `qc`.噪声 种类="bitflip" 概率=1* *r = > `qc`.运行 次数=32 种子=3* *c1 = r[^counts][^1]* diff --git a/tests/ext/quantum-steps-smoke.mq.md b/tests/ext/quantum-steps-smoke.mq.md index eb13cea..3221e25 100644 --- a/tests/ext/quantum-steps-smoke.mq.md +++ b/tests/ext/quantum-steps-smoke.mq.md @@ -28,7 +28,7 @@ import math:lib/math.mq.md 2. * > print text=steps-fail -*img = > `qc`.draw path=quantum-steps-draw.svg* +*img = > `qc`.draw path="quantum-steps-draw.svg"* *kind = img[^kind]* 1. `kind` == circuit diff --git a/tests/ext/web-admin-smoke.mq.md b/tests/ext/web-admin-smoke.mq.md index 710761c..6984ed1 100644 --- a/tests/ext/web-admin-smoke.mq.md +++ b/tests/ext/web-admin-smoke.mq.md @@ -13,18 +13,18 @@ import json:lib/json.mq.md > `store`.init name=articles fields=`schema` > `store`.exec sql="DELETE FROM articles" > `store`.exec sql="DELETE FROM sqlite_sequence WHERE name='articles'" -*url = > json.get value=`store` key=url* +*url = > json.get value=`store` key="url"* -*info = > web_db_table_info url=`url` table=articles* -*cols = > json.get value=`info` key=columns* +*info = > web_db_table_info url=`url` table="articles"* +*cols = > json.get value=`info` key="columns"* *n = > len value=`cols`* 1. `n` >= 2 > print text=schema-ok 2. * > print text=schema-fail -*fnew = > web_form_from_schema url=`url` table=articles action=insert* -*fields = > json.get value=`fnew` key=fields* +*fnew = > web_form_from_schema url=`url` table="articles" action="insert"* +*fields = > json.get value=`fnew` key="fields"* *nf = > len value=`fields`* 1. `nf` >= 1 > print text=new-form-ok @@ -38,20 +38,20 @@ import json:lib/json.mq.md | Admin create | via schema form | *sub = > web_form_submit form=`fnew` data=`row` url=`url`* -*sok = > json.get value=`sub` key=ok* +*sok = > json.get value=`sub` key="ok"* 1. `sok` > print text=insert-ok 2. * > print text=insert-fail -*got = > `store`.get table=articles id=1* -*title = > json.get value=`got` key=title* +*got = > `store`.get table="articles" id=1* +*title = > json.get value=`got` key="title"* 1. `title` == "Admin create" > print text=get-ok 2. * > print text=get-fail -*fedit = > web_form_from_schema url=`url` table=articles action=update id=1* +*fedit = > web_form_from_schema url=`url` table="articles" action="update" id=1* `patch` = | title | body | @@ -59,14 +59,14 @@ import json:lib/json.mq.md | Admin edited | body updated | *up = > web_form_submit form=`fedit` data=`patch` url=`url`* -*uok = > json.get value=`up` key=ok* +*uok = > json.get value=`up` key="ok"* 1. `uok` > print text=update-ok 2. * > print text=update-fail -*got2 = > `store`.get table=articles id=1* -*title2 = > json.get value=`got2` key=title* +*got2 = > `store`.get table="articles" id=1* +*title2 = > json.get value=`got2` key="title"* 1. `title2` == "Admin edited" > print text=edit-ok 2. * @@ -79,7 +79,7 @@ import json:lib/json.mq.md | | | *bad = > web_form_submit form=`fnew` data=`empty` url=`url`* -*bok = > json.get value=`bad` key=ok* +*bok = > json.get value=`bad` key="ok"* 1. `bok` > print text=required-should-fail 2. * diff --git a/tests/ext/web-form-embed-smoke.mq.md b/tests/ext/web-form-embed-smoke.mq.md index bef4fca..c185223 100644 --- a/tests/ext/web-form-embed-smoke.mq.md +++ b/tests/ext/web-form-embed-smoke.mq.md @@ -14,13 +14,13 @@ import json:lib/json.mq.md | title | Title | text | true | | | body | Body | textarea | false | | -*f = > web.form table=articles action=insert* +*f = > web.form table="articles" action="insert"* *f = > `f`.fields fields=`fields`* *page = > web.page title="Compose" intro="

Compose

"* -*page = > `page`.compose_form id=article form=`f`* +*page = > `page`.compose_form id="article" form=`f`* -*fid = > json.get value=`page` key=form_id* +*fid = > json.get value=`page` key="form_id"* 1. `fid` > print text=form-id-ok 2. * diff --git a/tests/ext/web-form-smoke.mq.md b/tests/ext/web-form-smoke.mq.md index c80967f..c250a49 100644 --- a/tests/ext/web-form-smoke.mq.md +++ b/tests/ext/web-form-smoke.mq.md @@ -26,7 +26,7 @@ import json:lib/json.mq.md | title | required | Title is required | | title | max:120 | Title is too long | -*f = > web.form table=articles action=insert* +*f = > web.form table="articles" action="insert"* *f = > `f`.fields fields=`fields`* *f = > `f`.rules rules=`rules`* @@ -37,7 +37,7 @@ import json:lib/json.mq.md | | hello | *v = > `f`.validate data=`bad`* -*ok = > json.get value=`v` key=ok* +*ok = > json.get value=`v` key="ok"* 1. `ok` > print text=validate-should-fail 2. * @@ -50,20 +50,20 @@ import json:lib/json.mq.md | From form | Body via submit | *sub = > `f`.submit data=`good` db=`store`* -*sok = > json.get value=`sub` key=ok* +*sok = > json.get value=`sub` key="ok"* 1. `sok` > print text=submit-ok 2. * > print text=submit-fail -*rows = > `store`.select table=articles limit=10* +*rows = > `store`.select table="articles" limit=10* *n = > len value=`rows`* 1. `n` >= 1 > print text=db-ok 2. * > print text=db-fail -*html = > `f`.render id=article* +*html = > `f`.render id="article"* 1. `html` > print text=render-ok 2. * diff --git a/tests/ext/web-part-smoke.mq.md b/tests/ext/web-part-smoke.mq.md index 7943a0a..f75475f 100644 --- a/tests/ext/web-part-smoke.mq.md +++ b/tests/ext/web-part-smoke.mq.md @@ -25,18 +25,18 @@ import json:lib/json.mq.md *about = > `about`.compose_components components=`layout`* *app = > web.app page=`home` host=127.0.0.1 port=18081* -*app = > `app`.route path=/about page=`about`* +*app = > `app`.route path="/about" page=`about`* -*routes = > json.get value=`app` key=routes* +*routes = > json.get value=`app` key="routes"* *routed = > json.get value=`routes` key="/about"* -*route = > json.get value=`routed` key=_route* +*route = > json.get value=`routed` key="_route"* 1. `route` == "/about" > print text=route-stamp-ok 2. * > print text=route-stamp-fail *home_html = > `home`.render* -*home_chunks = > split value=`home_html` sep=/_part/* +*home_chunks = > split value=`home_html` sep="/_part/"* *hn = > len value=`home_chunks`* 1. `hn` >= 2 > print text=home-part-ok @@ -44,7 +44,7 @@ import json:lib/json.mq.md > print text=home-part-fail *about_html = > `routed`.render* -*about_chunks = > split value=`about_html` sep=/about/_part/* +*about_chunks = > split value=`about_html` sep="/about/_part/"* *an = > len value=`about_chunks`* 1. `an` >= 2 > print text=route-part-ok diff --git a/tests/ext/web-route-smoke.mq.md b/tests/ext/web-route-smoke.mq.md index ab36a5b..3f1d50f 100644 --- a/tests/ext/web-route-smoke.mq.md +++ b/tests/ext/web-route-smoke.mq.md @@ -10,10 +10,10 @@ import json:lib/json.mq.md *home = > web.page title="Home" intro="

Home

"* *about = > web.page title="About" intro="

About

"* *app = > web.app page=`home` host=127.0.0.1 port=18081* -*app = > `app`.route path=/about page=`about`* -*app = > `app`.route path=docs page=`about`* +*app = > `app`.route path="/about" page=`about`* +*app = > `app`.route path="docs" page=`about`* -*routes = > json.get value=`app` key=routes* +*routes = > json.get value=`app` key="routes"* *about_page = > json.get value=`routes` key="/about"* *docs_page = > json.get value=`routes` key="/docs"* diff --git a/tests/ext/web-select-smoke.mq.md b/tests/ext/web-select-smoke.mq.md index 3462a2b..004dd97 100644 --- a/tests/ext/web-select-smoke.mq.md +++ b/tests/ext/web-select-smoke.mq.md @@ -29,7 +29,7 @@ import json:lib/json.mq.md |-------|------| | Alpha | first | -*hit = > `store`.select table=articles where=`eq` limit=50* +*hit = > `store`.select table="articles" where=`eq` limit=50* *n = > len value=`hit`* 1. `n` == 1 > print text=map-where-ok @@ -42,14 +42,14 @@ import json:lib/json.mq.md |------|------|-----| | title | like | %Alpha% | -*like_rows = > `store`.select table=articles where=`filt` limit=50* +*like_rows = > `store`.select table="articles" where=`filt` limit=50* *ln = > len value=`like_rows`* 1. `ln` == 2 > print text=like-ok 2. * > print text=like-fail -*all = > `store`.select table=articles limit=50* +*all = > `store`.select table="articles" limit=50* *an = > len value=`all`* 1. `an` == 3 > print text=all-ok diff --git a/tests/ext/web-smoke.mq.md b/tests/ext/web-smoke.mq.md index 2f58ad2..42a3695 100644 --- a/tests/ext/web-smoke.mq.md +++ b/tests/ext/web-smoke.mq.md @@ -16,7 +16,7 @@ import json:lib/json.mq.md *store = > web.db url="sqlite:web-fixtures/data/smoke.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` *_ = 1* 2. * @@ -48,33 +48,33 @@ import json:lib/json.mq.md 2. * > print text=render-fail -*nav = > json.get value=`page` key=nav* +*nav = > json.get value=`page` key="nav"* 1. `nav` > print text=compose-nav-ok 2. * > print text=compose-nav-fail -*side = > json.get value=`page` key=sidebar* +*side = > json.get value=`page` key="sidebar"* 1. `side` > print text=compose-side-ok 2. * > print text=compose-side-fail -*css = > json.get value=`page` key=styles_css* +*css = > json.get value=`page` key="styles_css"* 1. `css` > print text=styles-ok 2. * > print text=styles-fail -*parts = > json.get value=`page` key=parts* -*index_part = > json.get value=`parts` key=index* +*parts = > json.get value=`page` key="parts"* +*index_part = > json.get value=`parts` key="index"* 1. `index_part` > print text=compose-ok 2. * > print text=compose-fail -*got = > `store`.get table=articles id=1* -*title = > json.get value=`got` key=title* +*got = > `store`.get table="articles" id=1* +*title = > json.get value=`got` key="title"* 1. `title` == "Hello Marqdo" > print text=db-ok 2. * diff --git a/tests/ext/web-static-smoke.mq.md b/tests/ext/web-static-smoke.mq.md index ff0b7f5..7beb9fc 100644 --- a/tests/ext/web-static-smoke.mq.md +++ b/tests/ext/web-static-smoke.mq.md @@ -9,22 +9,22 @@ import json:lib/json.mq.md *home = > web.page title="Home"* *app = > web.app page=`home` host=127.0.0.1 port=18081* -*app = > `app`.static dir=web-fixtures/public mount=/static* +*app = > `app`.static dir="web-fixtures/public" mount="/static"* -*dir = > json.get value=`app` key=static_dir* +*dir = > json.get value=`app` key="static_dir"* 1. `dir` == "web-fixtures/public" > print text=dir-ok 2. * > print text=dir-fail -*mount = > json.get value=`app` key=static_mount* +*mount = > json.get value=`app` key="static_mount"* 1. `mount` == "/static" > print text=mount-ok 2. * > print text=mount-fail -*app2 = > `app`.static dir=assets mount=/assets* -*m2 = > json.get value=`app2` key=static_mount* +*app2 = > `app`.static dir="assets" mount="/assets"* +*m2 = > json.get value=`app2` key="static_mount"* 1. `m2` == "/assets" > print text=custom-ok 2. * diff --git a/tests/ext/web-zh-smoke.mq.md b/tests/ext/web-zh-smoke.mq.md index ac01295..aeb49e0 100644 --- a/tests/ext/web-zh-smoke.mq.md +++ b/tests/ext/web-zh-smoke.mq.md @@ -50,7 +50,7 @@ import json:lib/json.mq.md 2. * > print text=render-fail -*nav = > json.get value=`page` key=nav* +*nav = > json.get value=`page` key="nav"* 1. `nav` > print text=compose-ok 2. * @@ -62,10 +62,10 @@ import json:lib/json.mq.md |------|------|------|------|------| | title | 标题 | text | true | | -*f = > 网页.表单 表=articles 动作=插入* +*f = > 网页.表单 表="articles" 动作="插入"* *f = > `f`.字段 字段=`fields`* -*page = > `page`.表单装配 id=article 表单=`f`* -*fid = > json.get value=`page` key=form_id* +*page = > `page`.表单装配 id="article" 表单=`f`* +*fid = > json.get value=`page` key="form_id"* 1. `fid` == "article" > print text=form-ok 2. * @@ -73,8 +73,8 @@ import json:lib/json.mq.md *app = > 网页.应用 页面=`page` 数据库=`store` 主机=127.0.0.1 端口=18082* *about = > 网页.页面 标题="关于" 引言="

关于

"* -*app = > `app`.路由 路径=/about 页面=`about`* -*routes = > json.get value=`app` key=routes* +*app = > `app`.路由 路径="/about" 页面=`about`* +*routes = > json.get value=`app` key="routes"* *routed = > json.get value=`routes` key="/about"* 1. `routed` > print text=route-ok diff --git a/tests/keywords/input.mq.md b/tests/keywords/input.mq.md index 475be85..8af5770 100644 --- a/tests/keywords/input.mq.md +++ b/tests/keywords/input.mq.md @@ -5,6 +5,6 @@ description: Read one stdin line (optional prompt) # main -*name = > input prompt=Name:* +*name = > input prompt="Name:"* > print text=Hello `name`! diff --git a/tests/lib/foreign-run-lang.mq.md b/tests/lib/foreign-run-lang.mq.md index e61bfab..4a32bf9 100644 --- a/tests/lib/foreign-run-lang.mq.md +++ b/tests/lib/foreign-run-lang.mq.md @@ -5,6 +5,6 @@ import foreign:lib/foreign.mq.md # main -*out = > foreign.run_lang lang=python source=print(2+2)* +*out = > foreign.run_lang lang="python" source=print(2+2)* > print text=`out` diff --git a/tests/lib/fs-read.mq.md b/tests/lib/fs-read.mq.md index eead508..e60ecca 100644 --- a/tests/lib/fs-read.mq.md +++ b/tests/lib/fs-read.mq.md @@ -5,13 +5,13 @@ import fs:lib/fs.mq.md # main -*ok = > fs.exists path=hello.txt* +*ok = > fs.exists path="hello.txt"* 1. `ok` > print text=exists 2. * > print text=missing -*t = > fs.read_text path=hello.txt* +*t = > fs.read_text path="hello.txt"* > print text=`t` diff --git a/tests/lib/json-quote.mq.md b/tests/lib/json-quote.mq.md index e6e300e..2e4f2b8 100644 --- a/tests/lib/json-quote.mq.md +++ b/tests/lib/json-quote.mq.md @@ -5,6 +5,6 @@ import json:lib/json.mq.md # main -*q = > json.quote text=hi* +*q = > json.quote text="hi"* > print text=`q` diff --git a/tests/lib/json-roundtrip.mq.md b/tests/lib/json-roundtrip.mq.md index 036b3f7..c7b863c 100644 --- a/tests/lib/json-roundtrip.mq.md +++ b/tests/lib/json-roundtrip.mq.md @@ -6,7 +6,7 @@ import json:lib/json.mq.md # main -*raw = > fs.read_text path=sample.json* +*raw = > fs.read_text path="sample.json"* *obj = > json.parse text=`raw`* @@ -14,7 +14,7 @@ import json:lib/json.mq.md > print text=`ty` -*a = > json.get value=`obj` key=a* +*a = > json.get value=`obj` key="a"* > print text=`a` diff --git a/tests/lib/math-formula-chain.mq.md b/tests/lib/math-formula-chain.mq.md index 2e11404..91ce9c0 100644 --- a/tests/lib/math-formula-chain.mq.md +++ b/tests/lib/math-formula-chain.mq.md @@ -10,16 +10,16 @@ $$ x^3 $$ -*df = > math.diff formula=`f` var=x* +*df = > math.diff formula=`f` var="x"* *ty = > type `df`* > print text=`ty` -*df2 = > math.diff formula=`df` var=x* +*df2 = > math.diff formula=`df` var="x"* > print text=`df2` -*y = > math.eval formula=`df` var=x value=2* +*y = > math.eval formula=`df` var="x" value=2* > print text=`y` diff --git a/tests/lib/math-formula.mq.md b/tests/lib/math-formula.mq.md index 3ee512f..1c2931f 100644 --- a/tests/lib/math-formula.mq.md +++ b/tests/lib/math-formula.mq.md @@ -14,14 +14,14 @@ $$ > print text=`ty` -*df = > math.diff formula=`f` var=x* +*df = > math.diff formula=`f` var="x"* > print text=`df` -*roots = > math.solve formula=`f` var=x* +*roots = > math.solve formula=`f` var="x"* > print text=`roots` -*y = > math.eval formula=`f` var=x value=3* +*y = > math.eval formula=`f` var="x" value=3* > print text=`y` diff --git a/tests/lib/math-plot.mq.md b/tests/lib/math-plot.mq.md index 2c05834..7133f2e 100644 --- a/tests/lib/math-plot.mq.md +++ b/tests/lib/math-plot.mq.md @@ -10,7 +10,7 @@ $$ x^2 $$ -*svg = > math.plot formula=`f` var=x min=-2 max=2* +*svg = > math.plot formula=`f` var="x" min=-2 max=2* *ok = > type `svg`* diff --git a/tests/lib/net-openai-sse-reasoning.mq.md b/tests/lib/net-openai-sse-reasoning.mq.md index c2a3152..64b31bb 100644 --- a/tests/lib/net-openai-sse-reasoning.mq.md +++ b/tests/lib/net-openai-sse-reasoning.mq.md @@ -14,19 +14,19 @@ import json:lib/json.mq.md > print text=`n` *e0 = > at value=`events` index=0* -*t0 = > json.get value=`e0` key=type* -*x0 = > json.get value=`e0` key=text* +*t0 = > json.get value=`e0` key="type"* +*x0 = > json.get value=`e0` key="text"* > print text=`t0` > print text=`x0` *e1 = > at value=`events` index=1* -*t1 = > json.get value=`e1` key=type* -*x1 = > json.get value=`e1` key=text* +*t1 = > json.get value=`e1` key="type"* +*x1 = > json.get value=`e1` key="text"* > print text=`t1` > print text=`x1` *e2 = > at value=`events` index=2* -*t2 = > json.get value=`e2` key=type* -*r2 = > json.get value=`e2` key=result* +*t2 = > json.get value=`e2` key="type"* +*r2 = > json.get value=`e2` key="result"* > print text=`t2` > print text=`r2` diff --git a/tests/lib/net-openai-sse.mq.md b/tests/lib/net-openai-sse.mq.md index 4f5a988..19ddf97 100644 --- a/tests/lib/net-openai-sse.mq.md +++ b/tests/lib/net-openai-sse.mq.md @@ -11,12 +11,12 @@ import json:lib/json.mq.md *events = > net.openai_sse_parse text=`fixture`* - [`ev`](`events`) - *t = > json.get value=`ev` key=type* + *t = > json.get value=`ev` key="type"* 1. `t` == "delta" - *chunk = > json.get value=`ev` key=text* + *chunk = > json.get value=`ev` key="text"* > print text=`chunk` 2. `t` == "done" - *answer = > json.get value=`ev` key=result* + *answer = > json.get value=`ev` key="result"* > print text=`answer` 3. * > print text=bad diff --git a/tests/lib/plugin-demo.mq.md b/tests/lib/plugin-demo.mq.md index bfe2cc6..939e0f1 100644 --- a/tests/lib/plugin-demo.mq.md +++ b/tests/lib/plugin-demo.mq.md @@ -7,7 +7,7 @@ import sys:lib/sys.mq.md # main -*p = > sys.env_get name=MARQDO_TEST_PLUGIN* +*p = > sys.env_get name="MARQDO_TEST_PLUGIN"* > plugin.load path=`p` @@ -15,6 +15,6 @@ import sys:lib/sys.mq.md > print text=`sum` -*echo = > demo_echo text=ok* +*echo = > demo_echo text="ok"* > print text=`echo` diff --git a/tests/lib/subtask-fn.mq.md b/tests/lib/subtask-fn.mq.md index cfb31f5..ba38c8c 100644 --- a/tests/lib/subtask-fn.mq.md +++ b/tests/lib/subtask-fn.mq.md @@ -8,7 +8,7 @@ import json:lib/json.mq.md *args = > json.parse text={"n":21}* -*id = > subtask.spawn fn=worker args=`args`* +*id = > subtask.spawn fn="worker" args=`args`* *v = > subtask.wait id=`id`* diff --git a/tests/lib/subtask-quiet-io.mq.md b/tests/lib/subtask-quiet-io.mq.md index 230c7d5..8e4c5cb 100644 --- a/tests/lib/subtask-quiet-io.mq.md +++ b/tests/lib/subtask-quiet-io.mq.md @@ -6,11 +6,11 @@ import json:lib/json.mq.md # main -*id = > subtask.spawn path=subtask-child-print.mq.md* +*id = > subtask.spawn path="subtask-child-print.mq.md"* *waited = > subtask.wait id=`id`* -*code = > json.get value=`waited` key=code* -*val = > json.get value=`waited` key=value* -*stdout = > json.get value=`waited` key=stdout* +*code = > json.get value=`waited` key="code"* +*val = > json.get value=`waited` key="value"* +*stdout = > json.get value=`waited` key="stdout"* 1. `code` == 0 1. `val` == "child_ok" diff --git a/tests/lib/subtask-spawn.mq.md b/tests/lib/subtask-spawn.mq.md index 9822b89..f05c02a 100644 --- a/tests/lib/subtask-spawn.mq.md +++ b/tests/lib/subtask-spawn.mq.md @@ -6,11 +6,11 @@ import json:lib/json.mq.md # main -*id = > subtask.spawn path=subtask-child.mq.md quiet=False* +*id = > subtask.spawn path="subtask-child.mq.md" quiet=False* *waited = > subtask.wait id=`id`* -*code = > json.get value=`waited` key=code* -*val = > json.get value=`waited` key=value* +*code = > json.get value=`waited` key="code"* +*val = > json.get value=`waited` key="value"* 1. `code` == 0 > print text=`val` @@ -19,11 +19,11 @@ import json:lib/json.mq.md > print text=done -*id2 = > subtask.spawn path=subtask-child.mq.md* +*id2 = > subtask.spawn path="subtask-child.mq.md"* *waited2 = > subtask.wait id=`id2`* -*code2 = > json.get value=`waited2` key=code* -*val2 = > json.get value=`waited2` key=value* +*code2 = > json.get value=`waited2` key="code"* +*val2 = > json.get value=`waited2` key="value"* 1. `code2` == 0 1. `val2` == "child_ok" diff --git a/tests/lib/sys-dotenv.mq.md b/tests/lib/sys-dotenv.mq.md index bc5453a..958a1bf 100644 --- a/tests/lib/sys-dotenv.mq.md +++ b/tests/lib/sys-dotenv.mq.md @@ -10,6 +10,6 @@ import fs:lib/fs.mq.md > sys.load_dotenv path=dotenv-fixture.env -*v = > sys.env_get name=MARQDO_DOTENV_FIXTURE* +*v = > sys.env_get name="MARQDO_DOTENV_FIXTURE"* > print text=`v` diff --git a/tests/lib/table-collections.mq.md b/tests/lib/table-collections.mq.md index 0c61095..f669fcf 100644 --- a/tests/lib/table-collections.mq.md +++ b/tests/lib/table-collections.mq.md @@ -6,7 +6,7 @@ import table:lib/table.mq.md # main -*h = > table.put in=None at=Authorization value=Bearer-x* +*h = > table.put in=None at="Authorization" value="Bearer-x"* > print text=`h`[^Authorization] `xs` = @@ -16,7 +16,7 @@ import table:lib/table.mq.md | a | | b | -*xs = > table.put in=`xs` at=1 value=A* +*xs = > table.put in=`xs` at=1 value="A"* > print text=`xs`[^1] > print text=`xs`[^2] @@ -26,15 +26,15 @@ import table:lib/table.mq.md |-------|----------| | m1 | None | -*msg = > table.put in=None at=role value=user* -*msg = > table.put in=`msg` at=content value=hi* +*msg = > table.put in=None at="role" value="user"* +*msg = > table.put in=`msg` at="content" value="hi"* *messages = > table.append list=None item=`msg`* -*req = > table.put in=`req` at=messages value=`messages`* -*req = > table.put in=`req` at=stream value=True* +*req = > table.put in=`req` at="messages" value=`messages`* +*req = > table.put in=`req` at="stream" value=True* > print text=`req`[^messages][^1][^content] > print text=`req`[^stream] -*xs = > table.append list=`xs` item=c* +*xs = > table.append list=`xs` item="c"* *n = > table.len xs=`xs`* > print text=`n` diff --git a/tests/lib/文件-读.mq.md b/tests/lib/文件-读.mq.md index 86ae6a8..a8fc712 100644 --- a/tests/lib/文件-读.mq.md +++ b/tests/lib/文件-读.mq.md @@ -5,13 +5,13 @@ title: 中文文件库 # main -*有 = > 文件.存在 路径=hello.txt* +*有 = > 文件.存在 路径="hello.txt"* 1. `有` > 打印 内容=存在 2. * > 打印 内容=缺失 -*t = > 文件.读文本 路径=hello.txt* +*t = > 文件.读文本 路径="hello.txt"* > 打印 内容=`t` diff --git a/tests/lib/表-集合.mq.md b/tests/lib/表-集合.mq.md index 785e55f..15265b3 100644 --- a/tests/lib/表-集合.mq.md +++ b/tests/lib/表-集合.mq.md @@ -6,7 +6,7 @@ description: 改 + 列表字典 # main -*h = > 表.改 入=None 于=Authorization 值=Bearer-x* +*h = > 表.改 入=None 于="Authorization" 值="Bearer-x"* > 打印 内容=`h`[^Authorization] `xs` = @@ -16,9 +16,9 @@ description: 改 + 列表字典 | a | | b | -*xs = > 表.改 入=`xs` 于=1 值=A* +*xs = > 表.改 入=`xs` 于=1 值="A"* > 打印 内容=`xs`[^1] -*xs = > 表.追加 list=`xs` item=c* +*xs = > 表.追加 list=`xs` item="c"* *n = > 表.长度 xs=`xs`* > 打印 内容=`n` diff --git a/tests/structure/import-lib.mq.md b/tests/structure/import-lib.mq.md index 6c7bf4e..871d56f 100644 --- a/tests/structure/import-lib.mq.md +++ b/tests/structure/import-lib.mq.md @@ -6,7 +6,7 @@ title: import official lib (Chinese) # main -*t = > 文本.去空白 s= x* +*t = > 文本.去空白 s=" x"* > 打印 内容=`t` diff --git a/tests/structure/inherit-explicit-super.mq.md b/tests/structure/inherit-explicit-super.mq.md index ee49e3c..80a3cb2 100644 --- a/tests/structure/inherit-explicit-super.mq.md +++ b/tests/structure/inherit-explicit-super.mq.md @@ -7,22 +7,22 @@ import json:lib/json.mq.md + `name` *out = > json.parse text={"role":"parent"}* -*out = > json.set map=`out` key=name value=`name`* +*out = > json.set map=`out` key="name" value=`name`* **out** # Child = > Parent + `name` *self = > Parent name=`name`* -*self = > json.set map=`self` key=role value=child* +*self = > json.set map=`self` key="role" value="child"* **self** # main -*c = > Child name=Ada* -*ty = > json.get value=`c` key=_type* -*role = > json.get value=`c` key=role* -*name = > json.get value=`c` key=name* +*c = > Child name="Ada"* +*ty = > json.get value=`c` key="_type"* +*role = > json.get value=`c` key="role"* +*name = > json.get value=`c` key="name"* > print text=`ty` > print text=`role` > print text=`name` diff --git a/tests/structure/inherit-override.mq.md b/tests/structure/inherit-override.mq.md index c5ea106..c333b1b 100644 --- a/tests/structure/inherit-override.mq.md +++ b/tests/structure/inherit-override.mq.md @@ -21,8 +21,8 @@ title: inherit method override # main *g = > Greeter* -*m = > `g`.hello who=world* +*m = > `g`.hello who="world"* > print text=`m` *l = > Loud* -*m2 = > `l`.hello who=world* +*m2 = > `l`.hello who="world"* > print text=`m2` diff --git a/tests/structure/inherit-parent-method.mq.md b/tests/structure/inherit-parent-method.mq.md index 135f0f0..fa1d578 100644 --- a/tests/structure/inherit-parent-method.mq.md +++ b/tests/structure/inherit-parent-method.mq.md @@ -16,7 +16,7 @@ import json:lib/json.mq.md # main *l = > Loud* -*ty = > json.get value=`l` key=_type* +*ty = > json.get value=`l` key="_type"* > print text=`ty` -*m = > `l`.hello who=world* +*m = > `l`.hello who="world"* > print text=`m` diff --git a/tests/structure/ns/path3.mq.md b/tests/structure/ns/path3.mq.md index 031ac25..780ec0e 100644 --- a/tests/structure/ns/path3.mq.md +++ b/tests/structure/ns/path3.mq.md @@ -5,7 +5,7 @@ import helpers:helpers.mq.md # main -*v = > helpers.pack.label s=ok* +*v = > helpers.pack.label s="ok"* > print text=`v` diff --git a/tests/structure/ns/use.mq.md b/tests/structure/ns/use.mq.md index 10b945e..8a954d5 100644 --- a/tests/structure/ns/use.mq.md +++ b/tests/structure/ns/use.mq.md @@ -6,6 +6,6 @@ import trim_text:text.str_trim # main -*t = > trim_text s= hi* +*t = > trim_text s=" hi"* > print text=`t` diff --git a/tests/structure/object-handle.mq.md b/tests/structure/object-handle.mq.md index c76018b..dedff91 100644 --- a/tests/structure/object-handle.mq.md +++ b/tests/structure/object-handle.mq.md @@ -8,19 +8,19 @@ import json:lib/json.mq.md *t = > json.parse text={"p":"{\"n\":","s":"}"}* *qn = > str `n`* -*p = > json.get value=`t` key=p* -*s = > json.get value=`t` key=s* +*p = > json.get value=`t` key="p"* +*s = > json.get value=`t` key="s"* *raw = p + qn + s* **> json.parse text=`raw`** ## bump -*n = > json.get value=`self` key=n* +*n = > json.get value=`self` key="n"* *n2 = n + 1* *t = > json.parse text={"p":"{\"n\":","s":"}"}* *qn = > str `n2`* -*p = > json.get value=`t` key=p* -*s = > json.get value=`t` key=s* +*p = > json.get value=`t` key="p"* +*s = > json.get value=`t` key="s"* *raw = p + qn + s* *m = > json.parse text=`raw`* **m** @@ -28,10 +28,10 @@ import json:lib/json.mq.md # main *c = > counter n=3* -*ty = > json.get value=`c` key=_type* +*ty = > json.get value=`c` key="_type"* > print text=`ty` -*n = > json.get value=`c` key=n* +*n = > json.get value=`c` key="n"* > print text=`n` *c2 = > `c`.bump* -*n2 = > json.get value=`c2` key=n* +*n2 = > json.get value=`c2` key="n"* > print text=`n2`