Drop redundant backticks in *…* / **…** code segments

Value-expression variables inside *…* / **…** segments no longer need
backticks (the segment markers already mark code). Drop trailing spaces
and de-tick value-expression variable names in tests and skill docs;
keep backticks for string interpolation, call args, and method receivers.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
cflmyandCursor committed 2026-08-17 17:22:45 +08:00
1 parent 1bf414c745
commit f275d1e030
112 files changed
+762 -761

No files matched your search

+10 -9
View File
@@ -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).
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 * ``.
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.
@@ -41,8 +41,8 @@ Canonical design (repo): `doc/design/markdown-mapping.md`, `doc/design/keywords.
| Frontmatter `import bind:path.mq.md` / `导入` | Import file (bind library name) |
| Frontmatter `import bind:lib.member` / `导入` | Short name for a library member (same keyword; no separate `use`) |
| `> lib.member …` / `> lib.Type.member …` | Call via bare dotted path (instance methods need `` `var`.m ``) |
| `*…*` | Statement (bind / expr) |
| `**…**` | Return value |
| `*…*` | Statement (bind / expr) — closing `*` touches last token, **no trailing space**; bare ids are variables |
| `**…**` | Return value — closing `**` touches last token, **no trailing space**; bare ids are variables |
| `****` or `**` + spaces + `**` | Return `None` and end function body |
| Lone `---` / `***` in function body | End function body (no value) |
| GFM table after empty RHS bind | Collection (1-col list / ≥2-col map / `@`·`行`·`row` → list of maps); `` `x`[^1] `` / `` `m`[^key] `` |
@@ -90,17 +90,17 @@ Chinese builtins (same functions, no import):
## Statements, returns, branches
```markdown
*`x` = 1*
*`y` = `x` + 2*
*x = 1*
*y = x + 2*
## add_one
+ `n`
**`n` + 1**
**n + 1**
```
```markdown
*`n` = 0*
*n = 0*
1. `n` > 0
> print text=positive
@@ -123,9 +123,9 @@ 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 *
*t = > clock.now_unix*
```
- Import **English** or **Chinese** library file; call that file’s API names via `lib.member` (do not mix languages).
@@ -155,6 +155,7 @@ 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 `*` / `**` |
| 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 文本) |
+19 -19
View File
@@ -38,14 +38,14 @@ Greeting via a nested function:
```markdown
# main
*`a` = 2*
*`b` = > add_one n=`a`*
*a = 2*
*b = > add_one n=`a`*
> print text=`b`
## add_one
+ `n`
**`n` + 1**
**n + 1**
```
## 5. Branch with else
@@ -53,7 +53,7 @@ Greeting via a nested function:
```markdown
# main
*`n` = 0*
*n = 0*
1. `n` > 0
> print text=positive
@@ -89,10 +89,10 @@ Greeting via a nested function:
|------|------|
| 水果 | 蔬菜 |
*`种` = 分类[^苹果] *
*种 = 分类[^苹果]*
> print text=`种`
*`第一` = 篮子[^1] *
*第一 = 篮子[^1]*
```
One column → list; ≥2 columns + one data row → map; ≥2 columns + many rows → map of lists. Data cells are expressions (same as call-arg values): bare words, numbers, `` `var` ``, quoted strings; URLs and `gpt-4o-mini` stay text via path/hyphen folding. Footnotes: lists use 1-based digit indices; maps use key text (including digit keys like `[^00]`). Foreach on a map walks **keys**.
@@ -106,7 +106,7 @@ Row-oriented records (SQL-like): first header `@` / `行` / `row` → list of ma
|----|------|------|
| 1 | 苹果 | 2 |
*`名` = `订单`[^1][^品名] *
*名 = 订单[^1][^品名]*
```
## 7. Import text stdlib
@@ -119,7 +119,7 @@ import text:lib/text.mq.md
# main
*`parts` = > split value=a,b,c sep=,*
*parts = > split value=a,b,c sep=,*
> print text=`parts`
```
@@ -129,7 +129,7 @@ import text:lib/text.mq.md
# main
This whole paragraph is a comment, including lines that look like code:
*`not_executed` = 1*
*not_executed = 1*
> print text=also still comment
After a blank line, code runs:
@@ -147,7 +147,7 @@ import math:lib/math.mq.md
# main
*`t` = > num value=3.5*
*t = > num value=3.5*
> print text=`t`
```
@@ -163,16 +163,16 @@ See `tests/structure/object-handle.mq.md` and `ext/llm.mq.md`: `# Type` construc
## hello
+ `who`
*`msg` = "Hello, `who`!" *
**`msg`**
*msg = "Hello, `who`!"*
**msg**
# Loud = > Greeter
## hello
+ `who`
*`msg` = "HELLO, `who`!" *
**`msg`**
*msg = "HELLO, `who`!"*
**msg**
```
`_type` stays the most specific name (`Loud`). Methods walk the base chain; same-name `##` on the child overrides. **No implicit super** — if the child needs parent fields, call the parent explicitly:
@@ -181,9 +181,9 @@ See `tests/structure/object-handle.mq.md` and `ext/llm.mq.md`: `# Type` construc
# Child = > Parent
+ `name`
*`self` = > Parent name=`name` *
*`self` = > json.set map=`self` key=extra value=1 *
**`self`**
*self = > Parent name=`name`*
*self = > json.set map=`self` key=extra value=1*
**self**
```
## 11. Agent layout (ABI)
@@ -197,8 +197,8 @@ import agent:ext/agent.mq.md
> load_native
*`ws` = > agent *
*`n` = > `ws`.ensure_layout *
*ws = > agent*
*n = > `ws`.ensure_layout*
> print text=`n`
```
+1 -1
View File
@@ -71,7 +71,7 @@ $$
x^2 - 2
$$
*`_svg` = > plot formula=`f` var=x min=-3 max=3 *
*_svg = > plot formula=`f` var=x min=-3 max=3*
```
Empty RHS assignment + following `$$…$$` binds a formula value. Narrative-only `$$` without binding is display, not assignment.
+1 -1
View File
@@ -4,4 +4,4 @@ title: bad int
# main
*`x` = > int not-a-number*
*x = > int not-a-number*
+1 -1
View File
@@ -4,4 +4,4 @@ title: empty split sep
# main
*`xs` = > split value=ab sep=*
*xs = > split value=ab sep=*
+1 -1
View File
@@ -4,6 +4,6 @@ title: division by zero
# main
*`x` = 1 / 0*
*x = 1 / 0*
> print text=`x`
+1 -1
View File
@@ -10,6 +10,6 @@ title: footnote missing map key
|------|------|
| 水果 | 蔬菜 |
*`x` = `分类`[^香蕉] *
*x = 分类[^香蕉]*
> print text=`x`
+1 -1
View File
@@ -10,6 +10,6 @@ title: footnote list out of range
|----|
| 苹果 |
*`x` = `篮子`[^2] *
*x = 篮子[^2]*
> print text=`x`
+1 -1
View File
@@ -10,6 +10,6 @@ title: footnote [^0] invalid
|----|
| 苹果 |
*`x` = `篮子`[^0] *
*x = 篮子[^0]*
> print text=`x`
+10 -10
View File
@@ -8,23 +8,23 @@ 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 *
*`body` = > json.parse text={"t":"# main\n\n> print text=hi\n<!-- marqdo-out ok\n{\"status\":\"ok\",\"result\":\"done\"}\n-->\n<!-- marqdo-out error\npending\n-->\n"} *
*`t` = > json.get value=`body` key=t *
*paths = > json.parse text={"f":".marqdo/agent-runs/inspect-fixture.mq.md"}*
*fixture = > json.get value=`paths` key=f*
*body = > json.parse text={"t":"# main\n\n> print text=hi\n<!-- marqdo-out ok\n{\"status\":\"ok\",\"result\":\"done\"}\n-->\n<!-- marqdo-out error\npending\n-->\n"}*
*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 *
*obs = > agent.inspect_workbook path=`fixture` exit_code=0*
*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 *
*`n` = > len value=`has` *
*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`
+32 -32
View File
@@ -10,83 +10,83 @@ 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. *
> print text=no-agent-plugin
> sys.exit code=1
*`kb` = ".marqdo/agent-kb-alias-test" *
*`wb` = ".marqdo/agent-runs/alias-pong.mq.md" *
*`goal` = "Reply with exactly the word pong and nothing else." *
*`alias` = "say pong only" *
*`body` = "---\ntitle: pong skill\n---\n\n# main\n\n*msg = \"pong\"*\n\n**msg**\n" *
*kb = ".marqdo/agent-kb-alias-test"*
*wb = ".marqdo/agent-runs/alias-pong.mq.md"*
*goal = "Reply with exactly the word pong and nothing else."*
*alias = "say pong only"*
*body = "---\ntitle: pong skill\n---\n\n# main\n\n*msg = \"pong\"*\n\n**msg**\n"*
> 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 *
*prom = > agent_kb_promote kb_dir=`kb` goal=`goal` workbook=`wb` aliases=`alias`*
*okp = > json.get value=`prom` key=promoted*
1. `okp`
> print text=promoted
2. *
> print text=promote-fail
*`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 *
*`task` = `kb` + `a` + `slug` + `b` *
*`src` = > fs.read_text path=`task` *
*`has` = > split value=`src` sep=say pong only *
*`hn` = > len value=`has` *
*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*
*task = kb + a + slug + b*
*src = > fs.read_text path=`task`*
*has = > split value=`src` sep=say pong only*
*hn = > len value=`has`*
1. `hn` > 1
> print text=alias-written
2. *
> print text=alias-missing
*`hit` = > agent_kb_lookup kb_dir=`kb` goal=`alias` *
*hit = > agent_kb_lookup kb_dir=`kb` goal=`alias`*
1. `hit`
> print text=alias-ok
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 *
*exact = > agent_kb_lookup kb_dir=`kb` goal=`goal`*
*mk2 = > json.get value=`exact` key=match*
> print text=`mk2`
*`g_trip` = "帮我规划明天的行程" *
*`wb2` = ".marqdo/agent-runs/alias-trip.mq.md" *
*`body2` = "---\ntitle: trip\n---\n\n# main\n\n*msg = \"trip-ok\"*\n\n**msg**\n" *
*g_trip = "帮我规划明天的行程"*
*wb2 = ".marqdo/agent-runs/alias-trip.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 *
*prom2 = > agent_kb_promote kb_dir=`kb` goal=`g_trip` workbook=`wb2`*
*ok2 = > json.get value=`prom2` key=promoted*
1. `ok2`
> print text=trip-promoted
2. *
> print text=trip-promote-fail
*`g_canon` = "你是一个智能体,帮我规划明天的行程" *
*`c` = > agent_kb_canonicalize goal=`g_canon` *
*g_canon = "你是一个智能体,帮我规划明天的行程"*
*c = > agent_kb_canonicalize goal=`g_canon`*
> print text=`c`
*`hit_c` = > agent_kb_lookup kb_dir=`kb` goal=`g_canon` *
*hit_c = > agent_kb_lookup kb_dir=`kb` goal=`g_canon`*
1. `hit_c`
> 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 *
*listed = > agent_kb_list_tasks kb_dir=`kb`*
*tc = > json.get value=`listed` key=count*
1. `tc` > 1
> print text=list-ok
2. *
+22 -22
View File
@@ -10,67 +10,67 @@ 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. *
> print text=no-agent-plugin
> sys.exit code=1
*`kb` = ".marqdo/agent-kb-near-test" *
*`wb` = ".marqdo/agent-runs/near-trip.mq.md" *
*`goal` = "帮我规划明天的行程" *
*`body` = "---\ntitle: trip\n---\n\n# main\n\n*msg = \"trip-ok\"*\n\n**msg**\n" *
*kb = ".marqdo/agent-kb-near-test"*
*wb = ".marqdo/agent-runs/near-trip.mq.md"*
*goal = "帮我规划明天的行程"*
*body = "---\ntitle: trip\n---\n\n# main\n\n*msg = \"trip-ok\"*\n\n**msg**\n"*
> fs.write_text path=`wb` text=`body`
*`prom` = > agent_kb_promote kb_dir=`kb` goal=`goal` workbook=`wb` *
*`okp` = > json.get value=`prom` key=promoted *
*prom = > agent_kb_promote kb_dir=`kb` goal=`goal` workbook=`wb`*
*okp = > json.get value=`prom` key=promoted*
1. `okp`
> print text=promoted
2. *
> print text=promote-fail
*`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 *
*g1 = "帮我规划明天行程"*
*hit1 = > agent_kb_lookup kb_dir=`kb` goal=`g1` near_match=True near_threshold=0.78*
1. `hit1`
> 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. *
> print text=slug-drift
*`off` = > agent_kb_lookup kb_dir=`kb` goal=`g1` near_match=False *
*off = > agent_kb_lookup kb_dir=`kb` goal=`g1` near_match=False*
1. `off`
> print text=off-hit
2. *
> print text=off-miss
*`g2` = "明天做什么好" *
*`hit2` = > agent_kb_lookup kb_dir=`kb` goal=`g2` near_match=True near_threshold=0.78 *
*g2 = "明天做什么好"*
*hit2 = > agent_kb_lookup kb_dir=`kb` goal=`g2` near_match=True near_threshold=0.78*
1. `hit2`
> print text=neg-hit
2. *
> 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 *
*ranked = > agent_kb_near_match kb_dir=`kb` goal=`g1`*
*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 *
*`prompt` = > agent.build_soft_match_prompt goal=`g1` tasks=`tasks` *
*`has` = > split value=`prompt` sep=score= *
*`hn` = > len value=`has` *
*tasks = > json.get value=`ranked` key=candidates*
*prompt = > agent.build_soft_match_prompt goal=`g1` tasks=`tasks`*
*has = > split value=`prompt` sep=score=*
*hn = > len value=`has`*
1. `hn` > 1
> print text=prompt-score-ok
2. *
+20 -20
View File
@@ -11,56 +11,56 @@ 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. *
> print text=no-agent-plugin
> 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 *
*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*
> fs.write_text path=`wb` text=`body`
*`sig` = > agent_goal_sig goal=`goal` *
*sig = > agent_goal_sig goal=`goal`*
> print text=`sig`
*`slug0` = > agent_goal_slug goal=`goal` *
*slug0 = > agent_goal_slug goal=`goal`*
> print text=`slug0`
*`prom` = > agent_kb_promote kb_dir=`kb` goal=`goal` workbook=`wb` *
*`okp` = > json.get value=`prom` key=promoted *
*prom = > agent_kb_promote kb_dir=`kb` goal=`goal` workbook=`wb`*
*okp = > json.get value=`prom` key=promoted*
1. `okp`
> print text=promoted
2. *
> print text=promote-fail
*`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` *
*hit = > agent_kb_lookup kb_dir=`kb` goal=`goal`*
1. `hit`
> print text=lookup-ok
2. *
> print text=lookup-miss
*`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 *
*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*
> print text=`code`
> print text=`val`
*`hit2` = > agent_kb_lookup kb_dir=`kb` goal=`goal` *
*`res2` = > json.get value=`hit2` key=resource *
*hit2 = > agent_kb_lookup kb_dir=`kb` goal=`goal`*
*res2 = > json.get value=`hit2` key=resource*
1. `res` == `res2`
> print text=stable-path
2. *
+17 -17
View File
@@ -9,36 +9,36 @@ 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 *
*`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 *
*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*
*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*
> 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 *
*`sep` = > json.parse text={"s":"not allowed"} *
*`s` = > json.get value=`sep` key=s *
*`dparts` = > split value=`deny` sep=`s` *
*`pn` = > len value=`dparts` *
*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*
*dparts = > split value=`deny` sep=`s`*
*pn = > len value=`dparts`*
1. `pn` > 1
> print text=deny-ok
2. *
> print text=deny-bad
*`cat` = > agent.lib_catalog *
*`callable` = > json.get value=`cat` key=callable *
*`cn` = > len value=`callable` *
*cat = > agent.lib_catalog*
*callable = > json.get value=`cat` key=callable*
*cn = > len value=`callable`*
1. `cn` > 3
> print text=callable-ok
2. *
+10 -10
View File
@@ -11,25 +11,25 @@ import fs:lib/fs.mq.md
> llm.load_env path=.env
*`model` = > llm.llm *
*`tools` = > json.parse text=[] *
*`助手` = > agent.agent model=`model` tools=`tools` standing=offline plan confirm *
*model = > llm.llm*
*tools = > json.parse text=[]*
*助手 = > 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 *
*`ex` = > fs.exists path=`path` *
*path = > json.get value=`out` key=workbook*
*ex = > fs.exists path=`path`*
1. `ex`
> print text=workbook-ok
2. *
> print text=workbook-missing
*`src` = > fs.read_text path=`path` *
*`parts` = > split value=`src` sep=agent.agent *
*`n` = > len value=`parts` *
*src = > fs.read_text path=`path`*
*parts = > split value=`src` sep=agent.agent*
*n = > len value=`parts`*
1. `n` > 1
> print text=skeleton-ok
2. *
+46 -46
View File
@@ -8,97 +8,97 @@ 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 *
*`r1` = > agent.extract_plan_decision reply=`d1` *
*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*
*r1 = > agent.extract_plan_decision reply=`d1`*
> print text=`r1`
*`s1` = > agent.extract_plan_summary reply=`d1` *
*s1 = > agent.extract_plan_summary reply=`d1`*
> print text=`s1`
*`d2` = > json.get value=`samples` key=cont *
*`r2` = > agent.extract_plan_decision reply=`d2` *
*d2 = > json.get value=`samples` key=cont*
*r2 = > agent.extract_plan_decision reply=`d2`*
> print text=`r2`
*`d3` = > json.get value=`samples` key=zh *
*`r3` = > agent.extract_plan_decision reply=`d3` *
*d3 = > json.get value=`samples` key=zh*
*r3 = > agent.extract_plan_decision reply=`d3`*
> print text=`r3`
*`d4` = > json.get value=`samples` key=run *
*`r4` = > agent.extract_plan_decision reply=`d4` *
*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 *
*`r5` = > agent.extract_plan_decision reply=`d5` *
*d5 = > json.get value=`samples` key=zh_run*
*r5 = > agent.extract_plan_decision reply=`d5`*
> print text=`r5`
*`d6` = "DECISION: DONE\nSUMMARY: first wins\nDECISION: CONTINUE\nPATCH:\nbogus\n" *
*`r6` = > agent.extract_plan_decision reply=`d6` *
*d6 = "DECISION: DONE\nSUMMARY: first wins\nDECISION: CONTINUE\nPATCH:\nbogus\n"*
*r6 = > agent.extract_plan_decision reply=`d6`*
> print text=`r6`
*`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 *
*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*
> 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 *
*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*
> print text=`a2k`
> print text=`a2n`
*`act_dec` = > json.get value=`samples` key=done *
*`a3` = > agent.extract_plan_act reply=`act_dec` *
*`a3k` = > json.get value=`a3` key=kind *
*act_dec = > json.get value=`samples` key=done*
*a3 = > agent.extract_plan_act reply=`act_dec`*
*a3k = > json.get value=`a3` key=kind*
> print text=`a3k`
*`cat` = > agent.lib_catalog *
*`files` = > json.get value=`cat` key=files *
*`nf` = > len value=`files` *
*cat = > agent.lib_catalog*
*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 *
*`n_r` = > len value=`has_r` *
*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 *
*`n_s` = > len value=`has_s` *
*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 *
*`n_imp` = > len value=`has_imp` *
*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
2. *
> 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 *
*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*
> fs.write_text path=`path` text=`seed`
*`n` = > fs.apply_patch_blocks path=`path` text=`d2` *
*n = > fs.apply_patch_blocks path=`path` text=`d2`*
> print text=`n`
*`out` = > fs.read_text path=`path` *
*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 *
*`n2` = > fs.apply_patch_blocks path=`path2` text=`fence_reply` *
*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*
*n2 = > fs.apply_patch_blocks path=`path2` text=`fence_reply`*
> print text=`n2`
*`out2` = > fs.read_text path=`path2` *
*out2 = > fs.read_text path=`path2`*
> print text=`out2`
+12 -12
View File
@@ -11,33 +11,33 @@ import fs:lib/fs.mq.md
> llm.load_env path=.env
*`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. *
*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.*
*`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 *
*`ex` = > fs.exists path=`path` *
*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`
+12 -12
View File
@@ -7,30 +7,30 @@ 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 *
*`seed` = > json.parse text={"t":"---\ntitle: fixture\n---\n\n# main\n\n<!-- marqdo-out ok\nHUGE_BODY_SHOULD_BE_STRIPPED\n-->\n\n*msg = \"ok\"*\n\n**msg**\n"} *
*`text` = > json.get value=`seed` key=t *
*paths = > json.parse text={"p":".marqdo/agent-runs/observe-fixture.mq.md"}*
*path = > json.get value=`paths` key=p*
*seed = > json.parse text={"t":"---\ntitle: fixture\n---\n\n# main\n\n<!-- marqdo-out ok\nHUGE_BODY_SHOULD_BE_STRIPPED\n-->\n\n*msg = \"ok\"*\n\n**msg**\n"}*
*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 *
*`compact` = > agent.compact_plan_observation observation=`obs` *
*`ex` = > json.get value=`compact` key=source_excerpt *
*`parts` = > split value=`ex` sep=HUGE_BODY *
*`n` = > len value=`parts` *
*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*
*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. *
+33 -33
View File
@@ -9,63 +9,63 @@ 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 *
*`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 *
*`out` = > json.parse text={"status":"ok"} *
*`out` = > agent.plan_finish_stream out=`out` events=`events` stream=True result=child *
*events = > json.parse text=[]*
*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*
*out = > json.parse text={"status":"ok"}*
*out = > agent.plan_finish_stream out=`out` events=`events` stream=True result=child*
*`evs` = > json.get value=`out` key=events *
*`n` = > len value=`evs` *
*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 *
*e0 = > at value=`evs` index=0*
*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 *
*e1 = > at value=`evs` index=1*
*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 *
*e2 = > at value=`evs` index=2*
*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 *
*e3 = > at value=`evs` index=3*
*t3 = > json.get value=`e3` key=type*
*r3 = > json.get value=`e3` key=result*
> print text=`t3`
> print text=`r3`
> llm.load_env path=.env
*`model` = > llm.llm *
*`tools` = > json.parse text=[] *
*`助手` = > agent.agent model=`model` tools=`tools` standing=offline plan stream *
*model = > llm.llm*
*tools = > json.parse text=[]*
*助手 = > 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 *
*`pn` = > len value=`pevs` *
*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 *
*plast = > at value=`pevs` index=0*
*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`
+14 -14
View File
@@ -10,46 +10,46 @@ import agent:ext/ai/agent.mq.md
## 获取时间
*`u` = > time.now_unix *
*`s` = > time.format unix=`u` pattern=%Y-%m-%d *
**`s`**
*u = > time.now_unix*
*s = > time.format unix=`u` pattern=%Y-%m-%d*
**s**
# main
> llm.load_env path=.env
*`模型` = > llm.llm *
*模型 = > llm.llm*
`工具表` =
| 工具 |
|------|
| 获取时间 |
*`助手` = > 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=请调用获取时间工具,然后用一句话告诉用户今天的日期。*
<!-- marqdo-out ok
{"decision":"CALL:获取时间","result":"今天是2026年8月7日。","status":"ok","task":"请调用获取时间工具,然后用一句话告诉用户今天的日期。","tool":"获取时间","tool_result":"\"2026-08-07\""}
-->
*`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 *
*`历史` = > agent_history_get id=`id` *
*`条数` = > len value=`历史` *
*id = > json.get value=`助手` key=id*
*历史 = > agent_history_get id=`id`*
*条数 = > len value=`历史`*
> print text=`条数`
> `助手`.clear_history
*`历史2` = > agent_history_get id=`id` *
*`条数2` = > len value=`历史2` *
*历史2 = > agent_history_get id=`id`*
*条数2 = > len value=`历史2`*
> print text=`条数2`
+27 -27
View File
@@ -8,7 +8,7 @@ import agent:ext/ai/agent.mq.md
## 获取时间
*`esc` = > json.parse text={"v":"ok-time"} *
*esc = > json.parse text={"v":"ok-time"}*
**> json.get value=`esc` key=v**
# main
@@ -20,68 +20,68 @@ import agent:ext/ai/agent.mq.md
|------|
| 获取时间 |
*`模型` = > llm.llm *
*`助手` = > agent.agent model=`模型` tools=`工具表` standing=you are a readable Marqdo agent *
*模型 = > llm.llm*
*助手 = > 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 *
*`sk_n` = > len value=`has_skill` *
*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=获取时间 *
*`tool_n` = > len value=`has_tools` *
*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 *
*`src_n` = > len value=`has_src` *
*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: *
*`act_n` = > len value=`has_act` *
*has_act = > split value=`ctx` sep=CALL:*
*act_n = > len value=`has_act`*
1. `act_n` > 1
> print text=protocol-ok
2. *
> print text=protocol-missing
*`samples` = > json.parse text={"r":"CALL:获取时间","m":"think\nCALL:获取时间"} *
*`raw1` = > json.get value=`samples` key=r *
*`name1` = > agent.extract_tool_name reply=`raw1` *
*samples = > json.parse text={"r":"CALL:获取时间","m":"think\nCALL:获取时间"}*
*raw1 = > json.get value=`samples` key=r*
*name1 = > agent.extract_tool_name reply=`raw1`*
> print text=`name1`
*`raw2` = > json.get value=`samples` key=m *
*`name2` = > agent.extract_tool_name reply=`raw2` *
*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"} *
*turn = > json.parse text={"role":"user","content":"one"}*
> agent_history_append id=`id` item=`turn`
*`turn2` = > json.parse text={"role":"assistant","content":"two"} *
*turn2 = > json.parse text={"role":"assistant","content":"two"}*
> agent_history_append id=`id` item=`turn2`
*`h1` = > agent_history_get id=`id` *
*`n1` = > len value=`h1` *
*h1 = > agent_history_get id=`id`*
*n1 = > len value=`h1`*
> print text=`n1`
> `助手`.clear_history
*`h2` = > agent_history_get id=`id` *
*`n2` = > len value=`h2` *
*h2 = > agent_history_get id=`id`*
*n2 = > len value=`h2`*
> print text=`n2`
*`site` = > agent_call_site *
*`fn` = > json.get value=`site` key=function *
*site = > agent_call_site*
*fn = > json.get value=`site` key=function*
> print text=`fn`
+13 -13
View File
@@ -7,27 +7,27 @@ 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 *
*`d1` = > agent.extract_plan_decision reply=`r1` *
*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*
*d1 = > agent.extract_plan_decision reply=`r1`*
> print text=`d1`
*`s1` = > agent.extract_soft_match_slug reply=`r1` *
*s1 = > agent.extract_soft_match_slug reply=`r1`*
> print text=`s1`
*`r2` = > json.get value=`samples` key=new *
*`d2` = > agent.extract_plan_decision reply=`r2` *
*r2 = > json.get value=`samples` key=new*
*d2 = > agent.extract_plan_decision reply=`r2`*
> print text=`d2`
*`r3` = > json.get value=`samples` key=zh *
*`d3` = > agent.extract_plan_decision reply=`r3` *
*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` *
*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 *
*`n` = > len value=`has` *
*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*
*n = > len value=`has`*
1. `n` > 1
> print text=prompt-ok
2. *
+8 -8
View File
@@ -6,18 +6,18 @@ 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 *
*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*
> fs.write_text path=`path` text=`seed`
> fs.text_patch path=`path` find=beta replace=BETA
*`s1` = > fs.read_text path=`path` *
*s1 = > fs.read_text path=`path`*
> 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 *
*`n` = > fs.apply_patch_blocks path=`path` text=`t` *
*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*
*n = > fs.apply_patch_blocks path=`path` text=`t`*
> print text=`n`
*`s2` = > fs.read_text path=`path` *
*s2 = > fs.read_text path=`path`*
> print text=`s2`
+2 -2
View File
@@ -8,8 +8,8 @@ import llm:ext/ai/llm.mq.md
> llm.load_env path=.env
*`model` = > llm.llm *
*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`
+1 -1
View File
@@ -6,6 +6,6 @@ import llm:ext/ai/llm.mq.md
# main
*`model` = > llm.llm *
*model = > llm.llm*
> print text=`model`[^model]
> print text=`model`[^suffix]
+4 -4
View File
@@ -9,11 +9,11 @@ import json:lib/json.mq.md
> llm.load_env path=.env
*`model` = > llm.llm *
*model = > llm.llm*
*`events` = > `model`.complete prompt=Reply with exactly one English word: pong stream=True echo=True *
*`n` = > len value=`events` *
*events = > `model`.complete prompt=Reply with exactly one English word: pong stream=True echo=True*
*n = > len value=`events`*
> print text=`n`
*`answer` = > llm.stream_result events=`events` *
*answer = > llm.stream_result events=`events`*
> print text=`answer`
+3 -3
View File
@@ -7,8 +7,8 @@ import net:lib/net.mq.md
# main
*`fixture` = "data: {\"choices\":[{\"delta\":{\"content\":\"Hi\"}}]}\n\ndata: {\"choices\":[{\"delta\":{\"content\":\"!\"}}]}\n\ndata: [DONE]\n" *
*fixture = "data: {\"choices\":[{\"delta\":{\"content\":\"Hi\"}}]}\n\ndata: {\"choices\":[{\"delta\":{\"content\":\"!\"}}]}\n\ndata: [DONE]\n"*
*`events` = > net.openai_sse_parse text=`fixture` *
*`answer` = > llm.stream_result events=`events` *
*events = > net.openai_sse_parse text=`fixture`*
*answer = > llm.stream_result events=`events`*
> print text=`answer`
+5 -5
View File
@@ -6,11 +6,11 @@ import quantum:ext/quantum/quantum.mq.md
# main
*`qc` = > quantum.circuit qubits=1 *
*`qc` = > `qc`.x qubit=0 *
*`qc` = > `qc`.noise kind=amplitude_damping p=1 *
*`r` = > `qc`.run shots=32 seed=7 *
*`c0` = `r`[^counts][^0] *
*qc = > quantum.circuit qubits=1*
*qc = > `qc`.x qubit=0*
*qc = > `qc`.noise kind=amplitude_damping p=1*
*r = > `qc`.run shots=32 seed=7*
*c0 = r[^counts][^0]*
1. `c0` == 32
> print text=amp-ok
+5 -5
View File
@@ -6,11 +6,11 @@ description: 泡利X 后 振幅阻尼 p=1 全部落回 |0⟩.
# main
*`qc` = > 量子.电路 比特数=1 *
*`qc` = > `qc`.泡利X 比特=0 *
*`qc` = > `qc`.噪声 种类=振幅阻尼 概率=1 *
*`r` = > `qc`.运行 次数=32 种子=7 *
*`c0` = `r`[^counts][^0] *
*qc = > 量子.电路 比特数=1*
*qc = > `qc`.泡利X 比特=0*
*qc = > `qc`.噪声 种类=振幅阻尼 概率=1*
*r = > `qc`.运行 次数=32 种子=7*
*c0 = r[^counts][^0]*
1. `c0` == 32
> print text=amp-ok
+14 -14
View File
@@ -6,31 +6,31 @@ import quantum:ext/quantum/quantum.mq.md
# main
*`qc` = > quantum.circuit qubits=2 *
*`qc` = > `qc`.h qubit=0 *
*`qc` = > `qc`.barrier *
*`qc` = > `qc`.cx control=0 target=1 *
*`qc` = > `qc`.measure *
*qc = > quantum.circuit qubits=2*
*qc = > `qc`.h qubit=0*
*qc = > `qc`.barrier*
*qc = > `qc`.cx control=0 target=1*
*qc = > `qc`.measure*
*`st` = > `qc`.state *
*`dim` = `st`[^dim] *
*st = > `qc`.state*
*dim = st[^dim]*
1. `dim` == 4
> print text=state-ok
2. *
> print text=state-fail
*`img` = > `qc`.draw path=quantum-author-draw.svg *
*`kind` = `img`[^kind] *
*img = > `qc`.draw path=quantum-author-draw.svg*
*kind = img[^kind]*
1. `kind` == circuit
> print text=draw-ok
2. *
> print text=draw-fail
*`other` = > quantum.circuit qubits=2 *
*`other` = > `other`.x qubit=1 *
*`qc2` = > `qc`.append op=`other` *
*`ops` = `qc2`[^ops] *
*`n` = > len `ops` *
*other = > quantum.circuit qubits=2*
*other = > `other`.x qubit=1*
*qc2 = > `qc`.append op=`other`*
*ops = qc2[^ops]*
*n = > len `ops`*
1. `n` == 5
> print text=append-ok
2. *
+14 -14
View File
@@ -6,31 +6,31 @@ description: 屏障 / 测量 / 追加 / 态 / 绘图.
# main
*`qc` = > 量子.电路 比特数=2 *
*`qc` = > `qc`.哈达玛 比特=0 *
*`qc` = > `qc`.屏障 *
*`qc` = > `qc`.控非 控制=0 目标=1 *
*`qc` = > `qc`.测量 *
*qc = > 量子.电路 比特数=2*
*qc = > `qc`.哈达玛 比特=0*
*qc = > `qc`.屏障*
*qc = > `qc`.控非 控制=0 目标=1*
*qc = > `qc`.测量*
*`st` = > `qc`.态 *
*`dim` = `st`[^dim] *
*st = > `qc`.态*
*dim = st[^dim]*
1. `dim` == 4
> print text=state-ok
2. *
> print text=state-fail
*`img` = > `qc`.绘图 路径=quantum-author-zh-draw.svg *
*`kind` = `img`[^kind] *
*img = > `qc`.绘图 路径=quantum-author-zh-draw.svg*
*kind = img[^kind]*
1. `kind` == circuit
> print text=draw-ok
2. *
> print text=draw-fail
*`other` = > 量子.电路 比特数=2 *
*`other` = > `other`.泡利X 比特=1 *
*`qc2` = > `qc`.追加 操作=`other` *
*`ops` = `qc2`[^ops] *
*`n` = > len `ops` *
*other = > 量子.电路 比特数=2*
*other = > `other`.泡利X 比特=1*
*qc2 = > `qc`.追加 操作=`other`*
*ops = qc2[^ops]*
*n = > len `ops`*
1. `n` == 5
> print text=append-ok
2. *
+10 -10
View File
@@ -7,15 +7,15 @@ import math:lib/math.mq.md
# main
*`qc` = > quantum.circuit qubits=2 *
*`qc` = > `qc`.h qubit=0 *
*`qc` = > `qc`.cx control=0 target=1 *
*`p` = > `qc`.probabilities *
*qc = > quantum.circuit qubits=2*
*qc = > `qc`.h qubit=0*
*qc = > `qc`.cx control=0 target=1*
*p = > `qc`.probabilities*
*`p00` = `p`[^00] *
*`p11` = `p`[^11] *
*`lo` = > math.div a=2 b=5 *
*`hi` = > math.div a=3 b=5 *
*p00 = p[^00]*
*p11 = p[^11]*
*lo = > math.div a=2 b=5*
*hi = > math.div a=3 b=5*
1. `p00` > `lo`
1. `p00` < `hi`
@@ -33,8 +33,8 @@ import math:lib/math.mq.md
2. *
> print text=p11-fail
*`ping` = > quantum_ping *
*`ok` = `ping`[^ok] *
*ping = > quantum_ping*
*ok = ping[^ok]*
1. `ok`
> print text=ping-ok
2. *
+7 -7
View File
@@ -12,13 +12,13 @@ $$
\frac{1}{\sqrt{2}}\begin{pmatrix}1&1\\1&-1\end{pmatrix}
$$
*`U` = > quantum.gate matrix=`H_matrix` name=U *
*`qc` = > quantum.circuit qubits=1 *
*`qc` = > `qc`.apply gate=`U` qubits=0 *
*`p` = > `qc`.probabilities *
*`p0` = `p`[^0] *
*`lo` = > math.div a=4 b=10 *
*`hi` = > math.div a=6 b=10 *
*U = > quantum.gate matrix=`H_matrix` name=U*
*qc = > quantum.circuit qubits=1*
*qc = > `qc`.apply gate=`U` qubits=0*
*p = > `qc`.probabilities*
*p0 = p[^0]*
*lo = > math.div a=4 b=10*
*hi = > math.div a=6 b=10*
1. `p0` > `lo`
1. `p0` < `hi`
+7 -7
View File
@@ -12,13 +12,13 @@ $$
\frac{1}{\sqrt{2}}\begin{pmatrix}1&1\\1&-1\end{pmatrix}
$$
*`U` = > 量子.门 矩阵=`H矩阵` 名=U *
*`qc` = > 量子.电路 比特数=1 *
*`qc` = > `qc`.施加 门=`U` 比特=0 *
*`p` = > `qc`.概率 *
*`p0` = `p`[^0] *
*`lo` = > math.div a=4 b=10 *
*`hi` = > math.div a=6 b=10 *
*U = > 量子.门 矩阵=`H矩阵` 名=U*
*qc = > 量子.电路 比特数=1*
*qc = > `qc`.施加 门=`U` 比特=0*
*p = > `qc`.概率*
*p0 = p[^0]*
*lo = > math.div a=4 b=10*
*hi = > math.div a=6 b=10*
1. `p0` > `lo`
1. `p0` < `hi`
+7 -7
View File
@@ -13,19 +13,19 @@ import quantum:ext/quantum/quantum.mq.md
| 1 | H | 0 |
| 2 | CX | 0,1 |
*`qc` = > quantum.circuit qubits=2 steps=`steps` *
*`img` = > `qc`.draw kind=probs path=quantum-draw-probs.svg *
*`kind` = `img`[^kind] *
*qc = > quantum.circuit qubits=2 steps=`steps`*
*img = > `qc`.draw kind=probs path=quantum-draw-probs.svg*
*kind = img[^kind]*
1. `kind` == probs
> print text=probs-ok
2. *
> print text=probs-fail
*`qc1` = > quantum.circuit qubits=1 *
*`qc1` = > `qc1`.h qubit=0 *
*`bloch` = > `qc1`.draw kind=bloch path=quantum-draw-bloch.svg *
*`bk` = `bloch`[^kind] *
*qc1 = > quantum.circuit qubits=1*
*qc1 = > `qc1`.h qubit=0*
*bloch = > `qc1`.draw kind=bloch path=quantum-draw-bloch.svg*
*bk = bloch[^kind]*
1. `bk` == bloch
> print text=bloch-ok
+3 -3
View File
@@ -6,9 +6,9 @@ import quantum:ext/quantum/quantum.mq.md
# main
*`H` = > quantum.gate name=H *
*`img` = > `H`.draw kind=matrix path=quantum-gate-heatmap.svg *
*`kind` = `img`[^kind] *
*H = > quantum.gate name=H*
*img = > `H`.draw kind=matrix path=quantum-gate-heatmap.svg*
*kind = img[^kind]*
1. `kind` == matrix
> print text=heatmap-ok
+5 -5
View File
@@ -7,17 +7,17 @@ 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 *
*`ok` = > `H`.matches_matrix matrix=`H_matrix` *
*H_matrix = > json.parse text=[[0.7071067811865475,0.7071067811865475],[0.7071067811865475,-0.7071067811865475]]*
*H = > quantum.gate name=H*
*ok = > `H`.matches_matrix matrix=`H_matrix`*
1. `ok`
> print text=match-ok
2. *
> print text=match-fail
*`bad` = > json.parse text=[[1,0],[0,1]] *
*`no` = > `H`.matches_matrix matrix=`bad` *
*bad = > json.parse text=[[1,0],[0,1]]*
*no = > `H`.matches_matrix matrix=`bad`*
1. not `no`
> print text=reject-ok
+20 -20
View File
@@ -9,13 +9,13 @@ import math:lib/math.mq.md
H-Z-H on |0⟩ → |1⟩.
*`qc` = > quantum.circuit qubits=1 *
*`qc` = > `qc`.h qubit=0 *
*`qc` = > `qc`.z qubit=0 *
*`qc` = > `qc`.h qubit=0 *
*`p` = > `qc`.probabilities *
*`p1` = `p`[^1] *
*`lo` = > math.div a=9 b=10 *
*qc = > quantum.circuit qubits=1*
*qc = > `qc`.h qubit=0*
*qc = > `qc`.z qubit=0*
*qc = > `qc`.h qubit=0*
*p = > `qc`.probabilities*
*p1 = p[^1]*
*lo = > math.div a=9 b=10*
1. `p1` > `lo`
> print text=z-sandwich-ok
@@ -24,11 +24,11 @@ H-Z-H on |0⟩ → |1⟩.
Ry(π) on |0⟩ → |1⟩.
*`pi` = > math.pi *
*`ry` = > quantum.circuit qubits=1 *
*`ry` = > `ry`.ry qubit=0 theta=`pi` *
*`rp` = > `ry`.probabilities *
*`rp1` = `rp`[^1] *
*pi = > math.pi*
*ry = > quantum.circuit qubits=1*
*ry = > `ry`.ry qubit=0 theta=`pi`*
*rp = > `ry`.probabilities*
*rp1 = rp[^1]*
1. `rp1` > `lo`
> print text=ry-ok
@@ -37,14 +37,14 @@ Ry(π) on |0⟩ → |1⟩.
Bell run with fixed seed: both 00 and 11 appear; shots sum.
*`bell` = > quantum.circuit qubits=2 *
*`bell` = > `bell`.h qubit=0 *
*`bell` = > `bell`.cx control=0 target=1 *
*`res` = > `bell`.run shots=200 seed=42 *
*`counts` = `res`[^counts] *
*`c00` = `counts`[^00] *
*`c11` = `counts`[^11] *
*`shots` = `res`[^shots] *
*bell = > quantum.circuit qubits=2*
*bell = > `bell`.h qubit=0*
*bell = > `bell`.cx control=0 target=1*
*res = > `bell`.run shots=200 seed=42*
*counts = res[^counts]*
*c00 = counts[^00]*
*c11 = counts[^11]*
*shots = res[^shots]*
1. `c00`
1. `c11`
+5 -5
View File
@@ -6,11 +6,11 @@ import quantum:ext/quantum/quantum.mq.md
# main
*`qc` = > quantum.circuit qubits=1 *
*`qc` = > `qc`.i qubit=0 *
*`qc` = > `qc`.noise kind=bitflip p=1 *
*`r` = > `qc`.run shots=32 seed=3 *
*`c1` = `r`[^counts][^1] *
*qc = > quantum.circuit qubits=1*
*qc = > `qc`.i qubit=0*
*qc = > `qc`.noise kind=bitflip p=1*
*r = > `qc`.run shots=32 seed=3*
*c1 = r[^counts][^1]*
1. `c1` == 32
> print text=noise-ok
+5 -5
View File
@@ -6,11 +6,11 @@ description: 噪声 bitflip p=1 后 I 使全部射中 |1⟩.
# main
*`qc` = > 量子.电路 比特数=1 *
*`qc` = > `qc`.单位 比特=0 *
*`qc` = > `qc`.噪声 种类=bitflip 概率=1 *
*`r` = > `qc`.运行 次数=32 种子=3 *
*`c1` = `r`[^counts][^1] *
*qc = > 量子.电路 比特数=1*
*qc = > `qc`.单位 比特=0*
*qc = > `qc`.噪声 种类=bitflip 概率=1*
*r = > `qc`.运行 次数=32 种子=3*
*c1 = r[^counts][^1]*
1. `c1` == 32
> print text=noise-ok
+7 -7
View File
@@ -14,11 +14,11 @@ import math:lib/math.mq.md
| 1 | H | 0 |
| 2 | CX | 0,1 |
*`qc` = > quantum.circuit qubits=2 steps=`steps` *
*`p` = > `qc`.probabilities *
*`p00` = `p`[^00] *
*`lo` = > math.div a=2 b=5 *
*`hi` = > math.div a=3 b=5 *
*qc = > quantum.circuit qubits=2 steps=`steps`*
*p = > `qc`.probabilities*
*p00 = p[^00]*
*lo = > math.div a=2 b=5*
*hi = > math.div a=3 b=5*
1. `p00` > `lo`
1. `p00` < `hi`
@@ -28,8 +28,8 @@ import math:lib/math.mq.md
2. *
> print text=steps-fail
*`img` = > `qc`.draw path=quantum-steps-draw.svg *
*`kind` = `img`[^kind] *
*img = > `qc`.draw path=quantum-steps-draw.svg*
*kind = img[^kind]*
1. `kind` == circuit
> print text=draw-ok
+7 -7
View File
@@ -7,13 +7,13 @@ import math:lib/math.mq.md
# main
*`电路` = > 量子.电路 比特数=1 *
*`电路` = > `电路`.哈达玛 比特=0 *
*`电路` = > `电路`.泡利Z 比特=0 *
*`电路` = > `电路`.哈达玛 比特=0 *
*`概率` = > `电路`.概率 *
*`p1` = `概率`[^1] *
*`lo` = > math.div a=9 b=10 *
*电路 = > 量子.电路 比特数=1*
*电路 = > `电路`.哈达玛 比特=0*
*电路 = > `电路`.泡利Z 比特=0*
*电路 = > `电路`.哈达玛 比特=0*
*概率 = > `电路`.概率*
*p1 = 概率[^1]*
*lo = > math.div a=9 b=10*
1. `p1` > `lo`
> print text=zh-ok
+20 -20
View File
@@ -8,24 +8,24 @@ import json:lib/json.mq.md
# main
*`store` = > web.db url="sqlite:web-fixtures/data/admin-smoke.db" *
*`schema` = > articles.schema *
*store = > web.db url="sqlite:web-fixtures/data/admin-smoke.db"*
*schema = > articles.schema*
> `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 *
*`n` = > len value=`cols` *
*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 *
*`nf` = > len value=`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
2. *
@@ -37,36 +37,36 @@ 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 *
*sub = > web_form_submit form=`fnew` data=`row` url=`url`*
*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 |
|-------|------|
| Admin edited | body updated |
*`up` = > web_form_submit form=`fedit` data=`patch` url=`url` *
*`uok` = > json.get value=`up` key=ok *
*up = > web_form_submit form=`fedit` data=`patch` url=`url`*
*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. *
@@ -78,8 +78,8 @@ import json:lib/json.mq.md
|-------|------|
| | |
*`bad` = > web_form_submit form=`fnew` data=`empty` url=`url` *
*`bok` = > json.get value=`bad` key=ok *
*bad = > web_form_submit form=`fnew` data=`empty` url=`url`*
*bok = > json.get value=`bad` key=ok*
1. `bok`
> print text=required-should-fail
2. *
+1 -1
View File
@@ -6,4 +6,4 @@
|------|-----|------|
| Foot | / | |
**`foot`**
**foot**
+1 -1
View File
@@ -7,4 +7,4 @@
| Home | / | |
| Docs | /docs | |
**`nav`**
**nav**
+1 -1
View File
@@ -7,4 +7,4 @@
| Side | / | |
| Docs | https://github.com | |
**`side`**
**side**
+2 -2
View File
@@ -8,7 +8,7 @@
| title | text | false |
| body | text | true |
**`fields`**
**fields**
## seed
@@ -19,4 +19,4 @@
| 1 | Hello Marqdo | First article from a GFM table. |
| 2 | Code as docs | The page table is the program. |
**`rows`**
**rows**
+4 -4
View File
@@ -6,7 +6,7 @@
|------|-----|
| background | #fff |
**`topnav`**
**topnav**
## side_panel
@@ -16,7 +16,7 @@
|------|-----|
| background | #f5f5f4 |
**`side_panel`**
**side_panel**
## card_title
@@ -26,7 +26,7 @@
|------|-----|
| font-weight | 600 |
**`card_title`**
**card_title**
## card_body
@@ -36,4 +36,4 @@
|------|-----|
| color | #57534e |
**`card_body`**
**card_body**
+6 -6
View File
@@ -14,19 +14,19 @@ import json:lib/json.mq.md
| title | Title | text | true | |
| body | Body | textarea | false | |
*`f` = > web.form table=articles action=insert *
*`f` = > `f`.fields fields=`fields` *
*f = > web.form table=articles action=insert*
*f = > `f`.fields fields=`fields`*
*`page` = > web.page title="Compose" intro="<h1>Compose</h1>" *
*`page` = > `page`.compose_form id=article form=`f` *
*page = > web.page title="Compose" intro="<h1>Compose</h1>"*
*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. *
> print text=form-id-fail
*`html` = > `page`.render *
*html = > `page`.render*
1. `html`
> print text=render-ok
2. *
+12 -12
View File
@@ -8,8 +8,8 @@ import json:lib/json.mq.md
# main
*`store` = > web.db url="sqlite:web-fixtures/data/form-smoke.db" *
*`schema` = > articles.schema *
*store = > web.db url="sqlite:web-fixtures/data/form-smoke.db"*
*schema = > articles.schema*
> `store`.init name=articles fields=`schema`
`fields` =
@@ -26,9 +26,9 @@ 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` = > `f`.fields fields=`fields` *
*`f` = > `f`.rules rules=`rules` *
*f = > web.form table=articles action=insert*
*f = > `f`.fields fields=`fields`*
*f = > `f`.rules rules=`rules`*
`bad` =
@@ -36,8 +36,8 @@ import json:lib/json.mq.md
|-------|------|
| | hello |
*`v` = > `f`.validate data=`bad` *
*`ok` = > json.get value=`v` key=ok *
*v = > `f`.validate data=`bad`*
*ok = > json.get value=`v` key=ok*
1. `ok`
> print text=validate-should-fail
2. *
@@ -49,21 +49,21 @@ 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 *
*sub = > `f`.submit data=`good` db=`store`*
*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 *
*`n` = > len value=`rows` *
*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. *
+15 -15
View File
@@ -18,34 +18,34 @@ import json:lib/json.mq.md
| side.`side` | |
| foot.`foot` | |
*`home` = > web.page title="Home" intro="<h1>Home</h1>" *
*`home` = > `home`.compose_components components=`layout` *
*home = > web.page title="Home" intro="<h1>Home</h1>"*
*home = > `home`.compose_components components=`layout`*
*`about` = > web.page title="About" intro="<h1>About</h1>" *
*`about` = > `about`.compose_components components=`layout` *
*about = > web.page title="About" intro="<h1>About</h1>"*
*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 = > web.app page=`home` host=127.0.0.1 port=18081*
*app = > `app`.route path=/about page=`about`*
*`routes` = > json.get value=`app` key=routes *
*`routed` = > json.get value=`routes` key="/about" *
*`route` = > json.get value=`routed` key=_route *
*routes = > json.get value=`app` key=routes*
*routed = > json.get value=`routes` key="/about"*
*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/ *
*`hn` = > len value=`home_chunks` *
*home_html = > `home`.render*
*home_chunks = > split value=`home_html` sep=/_part/*
*hn = > len value=`home_chunks`*
1. `hn` >= 2
> print text=home-part-ok
2. *
> print text=home-part-fail
*`about_html` = > `routed`.render *
*`about_chunks` = > split value=`about_html` sep=/about/_part/ *
*`an` = > len value=`about_chunks` *
*about_html = > `routed`.render*
*about_chunks = > split value=`about_html` sep=/about/_part/*
*an = > len value=`about_chunks`*
1. `an` >= 2
> print text=route-part-ok
2. *
+9 -9
View File
@@ -7,15 +7,15 @@ import json:lib/json.mq.md
# main
*`home` = > web.page title="Home" intro="<h1>Home</h1>" *
*`about` = > web.page title="About" intro="<h1>About</h1>" *
*`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` *
*home = > web.page title="Home" intro="<h1>Home</h1>"*
*about = > web.page title="About" intro="<h1>About</h1>"*
*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`*
*`routes` = > json.get value=`app` key=routes *
*`about_page` = > json.get value=`routes` key="/about" *
*`docs_page` = > json.get value=`routes` key="/docs" *
*routes = > json.get value=`app` key=routes*
*about_page = > json.get value=`routes` key="/about"*
*docs_page = > json.get value=`routes` key="/docs"*
1. `about_page`
> print text=about-ok
@@ -27,7 +27,7 @@ import json:lib/json.mq.md
2. *
> print text=docs-fail
*`html` = > `about`.render *
*html = > `about`.render*
1. `html`
> print text=render-ok
2. *
+8 -8
View File
@@ -8,8 +8,8 @@ import json:lib/json.mq.md
# main
*`store` = > web.db url="sqlite:web-fixtures/data/select-smoke.db" *
*`schema` = > articles.schema *
*store = > web.db url="sqlite:web-fixtures/data/select-smoke.db"*
*schema = > articles.schema*
> `store`.init name=articles fields=`schema`
> `store`.exec sql="DELETE FROM articles"
@@ -29,8 +29,8 @@ import json:lib/json.mq.md
|-------|------|
| Alpha | first |
*`hit` = > `store`.select table=articles where=`eq` limit=50 *
*`n` = > len value=`hit` *
*hit = > `store`.select table=articles where=`eq` limit=50*
*n = > len value=`hit`*
1. `n` == 1
> print text=map-where-ok
2. *
@@ -42,15 +42,15 @@ import json:lib/json.mq.md
|------|------|-----|
| title | like | %Alpha% |
*`like_rows` = > `store`.select table=articles where=`filt` limit=50 *
*`ln` = > len value=`like_rows` *
*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 *
*`an` = > len value=`all` *
*all = > `store`.select table=articles limit=50*
*an = > len value=`all`*
1. `an` == 3
> print text=all-ok
2. *
+16 -16
View File
@@ -13,14 +13,14 @@ import json:lib/json.mq.md
# main
*`store` = > web.db url="sqlite:web-fixtures/data/smoke.db" *
*`fields` = > articles.schema *
*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*
*_ = 1*
2. *
*`seed` = > articles.seed *
*seed = > articles.seed*
> `store`.insert table=articles rows=`seed`
`home` =
@@ -38,43 +38,43 @@ import json:lib/json.mq.md
| title | articles.`articles`.title | shell.`card_title` |
| body | articles.`articles`.body | shell.`card_body` |
*`page` = > web.page title="smoke" intro="<h1>smoke</h1>" *
*`page` = > `page`.compose_components components=`home` *
*`page` = > `page`.compose_main main=`index` *
*`html` = > `page`.render db=`store` *
*page = > web.page title="smoke" intro="<h1>smoke</h1>"*
*page = > `page`.compose_components components=`home`*
*page = > `page`.compose_main main=`index`*
*html = > `page`.render db=`store`*
1. `html`
> print text=render-ok
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. *
+7 -7
View File
@@ -7,24 +7,24 @@ import json:lib/json.mq.md
# main
*`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 *
*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*
*`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. *
+16 -16
View File
@@ -11,8 +11,8 @@ import json:lib/json.mq.md
# main
*`store` = > 网页.数据库 地址="sqlite:web-fixtures/data/zh-smoke.db" *
*`schema` = > articles.schema *
*store = > 网页.数据库 地址="sqlite:web-fixtures/data/zh-smoke.db"*
*schema = > articles.schema*
> `store`.初始化 名=articles 字段=`schema`
> `store`.执行 sql="DELETE FROM articles"
> `store`.执行 sql="DELETE FROM sqlite_sequence WHERE name='articles'"
@@ -40,17 +40,17 @@ import json:lib/json.mq.md
> `store`.插入 表=articles 行=`seed`
*`page` = > 网页.页面 标题="中文烟测" 引言="<h1>中文</h1>" *
*`page` = > `page`.组件装配 组件=`layout` *
*`page` = > `page`.主体装配 主体=`index` *
*page = > 网页.页面 标题="中文烟测" 引言="<h1>中文</h1>"*
*page = > `page`.组件装配 组件=`layout`*
*page = > `page`.主体装配 主体=`index`*
*`html` = > `page`.渲染 数据库=`store` *
*html = > `page`.渲染 数据库=`store`*
1. `html`
> print text=render-ok
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,20 +62,20 @@ import json:lib/json.mq.md
|------|------|------|------|------|
| title | 标题 | text | true | |
*`f` = > 网页.表单 表=articles 动作=插入 *
*`f` = > `f`.字段 字段=`fields` *
*`page` = > `page`.表单装配 id=article 表单=`f` *
*`fid` = > json.get value=`page` key=form_id *
*f = > 网页.表单 表=articles 动作=插入*
*f = > `f`.字段 字段=`fields`*
*page = > `page`.表单装配 id=article 表单=`f`*
*fid = > json.get value=`page` key=form_id*
1. `fid` == "article"
> print text=form-ok
2. *
> print text=form-fail
*`app` = > 网页.应用 页面=`page` 数据库=`store` 主机=127.0.0.1 端口=18082 *
*`about` = > 网页.页面 标题="关于" 引言="<p>关于</p>" *
*`app` = > `app`.路由 路径=/about 页面=`about` *
*`routes` = > json.get value=`app` key=routes *
*`routed` = > json.get value=`routes` key="/about" *
*app = > 网页.应用 页面=`page` 数据库=`store` 主机=127.0.0.1 端口=18082*
*about = > 网页.页面 标题="关于" 引言="<p>关于</p>"*
*app = > `app`.路由 路径=/about 页面=`about`*
*routes = > json.get value=`app` key=routes*
*routed = > json.get value=`routes` key="/about"*
1. `routed`
> print text=route-ok
2. *
+3 -3
View File
@@ -4,15 +4,15 @@ title: 布尔与逻辑关键字
# main
*`a` = True*
*`b` = False*
*a = True*
*b = False*
1. `a` and not `b`
> print text=ok
2. *
> print text=fail
*`probe` = 1*
*probe = 1*
1. None
> print text=none-truthy
+1 -1
View File
@@ -5,6 +5,6 @@ stdin: Ada
# main
*`name` = > input prompt="Name:\n"*
*name = > input prompt="Name:\n"*
> print text=Hello `name`!
+1 -1
View File
@@ -5,6 +5,6 @@ description: Read one stdin line (optional prompt)
# main
*`name` = > input prompt=Name: *
*name = > input prompt=Name:*
> print text=Hello `name`!
+1 -1
View File
@@ -4,6 +4,6 @@ title: quoted string literal
# main
*`s` = "a\nb"*
*s = "a\nb"*
> print text=`s`
+7 -7
View File
@@ -5,26 +5,26 @@ description: trim split join at type + lib imports
# main
*`raw` = " hi " *
*raw = " hi "*
*`t` = > trim `raw`*
*t = > trim `raw`*
> print text=`t`
*`parts` = > split value=a,b,c sep=,*
*parts = > split value=a,b,c sep=,*
*`n` = > len `parts`*
*n = > len `parts`*
> print text=`n`
*`mid` = > at value=`parts` index=1*
*mid = > at value=`parts` index=1*
> print text=`mid`
*`joined` = > join value=`parts` sep=-*
*joined = > join value=`parts` sep=-*
> print text=`joined`
*`ty` = > type `parts`*
*ty = > type `parts`*
> print text=`ty`
+6 -6
View File
@@ -5,9 +5,9 @@ description: Built-in conversions and length
# main
*`s` = "hello"*
*s = "hello"*
*`n` = > len `s`*
*n = > len `s`*
> print text=`n`
@@ -19,18 +19,18 @@ description: Built-in conversions and length
| b |
| c |
*`m` = > len `xs`*
*m = > len `xs`*
> print text=`m`
*`t` = > str 42*
*t = > str 42*
> print text=`t`
*`i` = > int `t`*
*i = > int `t`*
> print text=`i`
*`j` = > int True*
*j = > int True*
> print text=`j`
+3 -3
View File
@@ -4,15 +4,15 @@ title: 中文布尔与逻辑
# main
*`a` = 真*
*`b` = 假*
*a = 真*
*b = 假*
1. `a` 且 非 `b`
> 打印 内容=ok
2. *
> 打印 内容=fail
*`probe` = 1*
*probe = 1*
1. 空
> 打印 内容=none-truthy
+4 -4
View File
@@ -5,14 +5,14 @@ description: 打印 / 长度 / 文本 / 整数(与英文别名等价)
# main
*`s` = "hello"*
*s = "hello"*
*`n` = > 长度 值=`s`*
*n = > 长度 值=`s`*
> 打印 内容=`n`
*`t` = > 文本 值=7*
*t = > 文本 值=7*
*`i` = > 整数 值=`t`*
*i = > 整数 值=`t`*
> 打印 内容=`i`
+1 -1
View File
@@ -10,6 +10,6 @@ import foreign:lib/foreign.mq.md
print("hello-from-python")
```
*`out` = > foreign.run code=`hi` *
*out = > foreign.run code=`hi`*
> print text=`out`
+1 -1
View File
@@ -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`
+2 -2
View File
@@ -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`
+1 -1
View File
@@ -5,6 +5,6 @@ import json:lib/json.mq.md
# main
*`q` = > json.quote text=hi *
*q = > json.quote text=hi*
> print text=`q`
+5 -5
View File
@@ -6,18 +6,18 @@ 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` *
*obj = > json.parse text=`raw`*
*`ty` = > type `obj` *
*ty = > type `obj`*
> print text=`ty`
*`a` = > json.get value=`obj` key=a *
*a = > json.get value=`obj` key=a*
> print text=`a`
*`out` = > json.stringify value=`obj` *
*out = > json.stringify value=`obj`*
> print text=`out`
+4 -4
View File
@@ -10,16 +10,16 @@ $$
x^3
$$
*`df` = > math.diff formula=`f` var=x *
*df = > math.diff formula=`f` var=x*
*`ty` = > type `df` *
*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`
+4 -4
View File
@@ -10,18 +10,18 @@ $$
x^2 - 2
$$
*`ty` = > type `f` *
*ty = > type `f`*
> 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`
+2 -2
View File
@@ -10,8 +10,8 @@ $$
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` *
*ok = > type `svg`*
> print text=`ok`
+3 -3
View File
@@ -7,13 +7,13 @@ import math:lib/math.mq.md
> math.seed value=42
*`a` = > math.random_int min=1 max=10 *
*a = > math.random_int min=1 max=10*
*`b` = > math.random_int min=1 max=10 *
*b = > math.random_int min=1 max=10*
> math.seed value=42
*`c` = > math.random_int min=1 max=10 *
*c = > math.random_int min=1 max=10*
> print text=`a`
+1 -1
View File
@@ -5,6 +5,6 @@ import net:lib/net.mq.md
# main
*`e` = > net.url_encode text=a b *
*e = > net.url_encode text=a b*
> print text=`e`
+12 -12
View File
@@ -7,26 +7,26 @@ import json:lib/json.mq.md
# main
*`fixture` = "data: {\"choices\":[{\"delta\":{\"reasoning_content\":\"think\"}}]}\n\ndata: {\"choices\":[{\"delta\":{\"content\":\"Hi\"}}]}\n\ndata: [DONE]\n" *
*fixture = "data: {\"choices\":[{\"delta\":{\"reasoning_content\":\"think\"}}]}\n\ndata: {\"choices\":[{\"delta\":{\"content\":\"Hi\"}}]}\n\ndata: [DONE]\n"*
*`events` = > net.openai_sse_parse text=`fixture` *
*`n` = > len value=`events` *
*events = > net.openai_sse_parse text=`fixture`*
*n = > len value=`events`*
> print text=`n`
*`e0` = > at value=`events` index=0 *
*`t0` = > json.get value=`e0` key=type *
*`x0` = > json.get value=`e0` key=text *
*e0 = > at value=`events` index=0*
*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 *
*e1 = > at value=`events` index=1*
*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 *
*e2 = > at value=`events` index=2*
*t2 = > json.get value=`e2` key=type*
*r2 = > json.get value=`e2` key=result*
> print text=`t2`
> print text=`r2`
+5 -5
View File
@@ -6,17 +6,17 @@ import json:lib/json.mq.md
# main
*`fixture` = "data: {\"choices\":[{\"delta\":{\"content\":\"Hel\"}}]}\n\ndata: {\"choices\":[{\"delta\":{\"content\":\"lo\"}}]}\n\ndata: [DONE]\n" *
*fixture = "data: {\"choices\":[{\"delta\":{\"content\":\"Hel\"}}]}\n\ndata: {\"choices\":[{\"delta\":{\"content\":\"lo\"}}]}\n\ndata: [DONE]\n"*
*`events` = > net.openai_sse_parse text=`fixture` *
*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
+3 -3
View File
@@ -7,14 +7,14 @@ 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`
*`sum` = > demo_add a=1 b=2 *
*sum = > demo_add a=1 b=2*
> print text=`sum`
*`echo` = > demo_echo text=ok *
*echo = > demo_echo text=ok*
> print text=`echo`
+4 -4
View File
@@ -6,11 +6,11 @@ import json:lib/json.mq.md
# main
*`args` = > json.parse text={"n":21} *
*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` *
*v = > subtask.wait id=`id`*
> print text=`v`
@@ -19,4 +19,4 @@ import json:lib/json.mq.md
## worker
+ `n`
**`n` * 2**
**n * 2**
+2 -2
View File
@@ -10,8 +10,8 @@ import subtask:lib/subtask.mq.md
print(7 + 8)
```
*`id` = > subtask.spawn code=`py` *
*id = > subtask.spawn code=`py`*
*`out` = > subtask.wait id=`id` *
*out = > subtask.wait id=`id`*
> print text=`out`
+5 -5
View File
@@ -6,11 +6,11 @@ import json:lib/json.mq.md
# main
*`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 *
*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*
1. `code` == 0
1. `val` == "child_ok"
+8 -8
View File
@@ -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 *
*waited = > subtask.wait id=`id`*
*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 *
*waited2 = > subtask.wait id=`id2`*
*code2 = > json.get value=`waited2` key=code*
*val2 = > json.get value=`waited2` key=value*
1. `code2` == 0
1. `val2` == "child_ok"
+2 -2
View File
@@ -5,9 +5,9 @@ import sys:lib/sys.mq.md
# main
*`d` = > sys.cwd *
*d = > sys.cwd*
*`n` = > len `d` *
*n = > len `d`*
1. `n` > 0
> print text=cwd-ok
+1 -1
View File
@@ -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`
+13 -13
View File
@@ -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,22 +26,22 @@ 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*
*`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*
*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*
> print text=`req`[^messages][^1][^content]
> print text=`req`[^stream]
*`xs` = > table.append list=`xs` item=c*
*`n` = > table.len xs=`xs`*
*xs = > table.append list=`xs` item=c*
*n = > table.len xs=`xs`*
> print text=`n`
*`m` = > table.merge a=`h` b=`msg`*
*`ks` = > table.keys map=`m`*
*m = > table.merge a=`h` b=`msg`*
*ks = > table.keys map=`m`*
> print text=`ks`
*`empty` = > table.empty_map*
*`sz` = > table.size map=`empty`*
*empty = > table.empty_map*
*sz = > table.size map=`empty`*
> print text=`sz`
+2 -2
View File
@@ -5,11 +5,11 @@ import time:lib/time.mq.md
# main
*`s` = > time.format unix=0 pattern=%Y-%m-%d *
*s = > time.format unix=0 pattern=%Y-%m-%d*
> print text=`s`
*`u` = > time.parse text=1970-01-01 00:00:00 pattern=%Y-%m-%d %H:%M:%S *
*u = > time.parse text=1970-01-01 00:00:00 pattern=%Y-%m-%d %H:%M:%S*
> print text=`u`
+3 -3
View File
@@ -18,7 +18,7 @@ import json:lib/json.mq.md
# main
*`anchor` = > host_outer_call_line *
*anchor = > host_outer_call_line*
<!-- marqdo-out ok
async-ok
-->
@@ -30,8 +30,8 @@ async-ok
pending
-->
*`wb` = > json.parse text={"key":"ok","value":"async-ok"} *
*`wb` = > json.set map=`wb` key=line value=`anchor` *
*wb = > json.parse text={"key":"ok","value":"async-ok"}*
*wb = > json.set map=`wb` key=line value=`anchor`*
> subtask.spawn fn=persist_slot args=`wb`
> print text=spawned
+1 -1
View File
@@ -5,7 +5,7 @@ import writeback:lib/writeback.mq.md
# main
*`out` = > writeback.get *
*out = > writeback.get*
<!-- marqdo-out
hello-writeback
+1 -1
View File
@@ -10,6 +10,6 @@ title: foreign zh
print("中文外联")
```
*`out` = > 外联.运行 代码=`hi` *
*out = > 外联.运行 代码=`hi`*
> print text=`out`
+3 -3
View File
@@ -5,12 +5,12 @@ title: math num + zh
# main
*`p` = > 数学.圆周率 *
*p = > 数学.圆周率*
*`t` = > type `p` *
*t = > type `p`*
> print text=`t`
*`s` = > 数学.正弦 value=0 *
*s = > 数学.正弦 value=0*
> print text=`s`
+2 -2
View File
@@ -5,13 +5,13 @@ title: 中文文件库
# main
*`有` = > 文件.存在 路径=hello.txt *
*有 = > 文件.存在 路径=hello.txt*
1. `有`
> 打印 内容=存在
2. *
> 打印 内容=缺失
*`t` = > 文件.读文本 路径=hello.txt *
*t = > 文件.读文本 路径=hello.txt*
> 打印 内容=`t`
+4 -4
View File
@@ -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*
*`n` = > 表.长度 xs=`xs`*
*xs = > 表.追加 list=`xs` item=c*
*n = > 表.长度 xs=`xs`*
> 打印 内容=`n`
+5 -5
View File
@@ -7,20 +7,20 @@ description: Inside *…* / **…**, bare ids are variables; strings need quotes
*answer = 1*
*n = answer + 1*
*`ticked` = 2*
*`s` = 'quoted'*
*ticked = 2*
*s = 'quoted'*
> print text=`n`
> print text=`ticked`
> print text=`s`
*`a` = > ret_var x=7*
*a = > ret_var x=7*
> print text=`a`
*`b` = > ret_str*
*b = > ret_str*
> print text=`b`
*`c` = > ret_single*
*c = > ret_single*
> print text=`c`
## ret_var
+2 -2
View File
@@ -5,8 +5,8 @@ description: Same-indent `1.` after a completed list is a new Branch, not more a
# main
*`a` = True*
*`b` = True*
*a = True*
*b = True*
1. `a`
> print text=A
+1 -1
View File
@@ -4,7 +4,7 @@ title: 分支示例
# main
*`x` = 0*
*x = 0*
1. `x` > 0
> print text=正数
+2 -2
View File
@@ -5,8 +5,8 @@ description: Data cells evaluate like call-arg values (`var`, paths, hyphen pros
# main
*`secret` = "sk-live" *
*`name` = "gpt-4o-mini" *
*secret = "sk-live"*
*name = "gpt-4o-mini"*
`cfg` =
+3 -3
View File
@@ -11,14 +11,14 @@ title: 横表多行 → 字典套列表
| 红富士 | 青瓜 |
| 嘎啦 | 黄瓜条 |
*`第一种苹果` = `货架`[^苹果][^1] *
*第一种苹果 = 货架[^苹果][^1]*
> print text=`第一种苹果`
*`列` = `货架`[^苹果] *
*列 = 货架[^苹果]*
> print text=`列`
*`第二种黄瓜` = `货架`[^黄瓜][^2] *
*第二种黄瓜 = 货架[^黄瓜][^2]*
> print text=`第二种黄瓜`
+3 -3
View File
@@ -10,15 +10,15 @@ title: 横表单行 → 字典
|------|------|------|
| 水果 | 蔬菜 | 数码用品 |
*`种` = `分类`[^苹果] *
*种 = 分类[^苹果]*
> print text=`种`
*`种` = `分类`[^黄瓜] *
*种 = 分类[^黄瓜]*
> print text=`种`
*`种` = `分类`[^鼠标] *
*种 = 分类[^鼠标]*
> print text=`种`
+2 -2
View File
@@ -11,10 +11,10 @@ title: row records with @ marker
| 1 | apple | 2 |
| 2 | pear | 3 |
*`n` = `orders`[^1][^name] *
*n = orders[^1][^name]*
> print text=`n`
*`q` = `orders`[^2][^qty] *
*q = orders[^2][^qty]*
> print text=`q`
+3 -3
View File
@@ -11,15 +11,15 @@ title: 行向记录表(首列 行 / @)
| 1 | 苹果 | 2 |
| 2 | 梨 | 3 |
*`第一` = `订单`[^1] *
*第一 = 订单[^1]*
> print text=`第一`
*`名` = `订单`[^1][^品名] *
*名 = 订单[^1][^品名]*
> print text=`名`
*`量` = `订单`[^2][^数量] *
*量 = 订单[^2][^数量]*
> print text=`量`
+3 -3
View File
@@ -12,14 +12,14 @@ title: 脚注取元(列表下标)
| 梨 |
| 桃 |
*`第一` = 篮子[^1] *
*第一 = 篮子[^1]*
> print text=`第一`
*`第二` = `篮子`[^2] *
*第二 = 篮子[^2]*
> print text=`第二`
*`第三` = 篮子[^3] *
*第三 = 篮子[^3]*
> print text=`第三`
Loaded 100 of 112 files, more files were not shown because too many files have changed in this diff. Show more