Unify bare-identifier semantics in *…* / **…** (Python namespace)
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 <cursoragent@cursor.com>
This commit is contained in:
1 parent
f275d1e030
commit
bd5555afaa
86 files changed
+1539
-1467
No files matched your search
@@ -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<!-- marqdo-out ok\n{\"status\":\"ok\",\"result\":\"done\"}\n-->\n<!-- marqdo-out error\npending\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`
|
||||
@@ -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. *
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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. *
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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`*
|
||||
|
||||
@@ -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`
|
||||
@@ -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<!-- marqdo-out ok\nHUGE_BODY_SHOULD_BE_STRIPPED\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. *
|
||||
|
||||
@@ -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`
|
||||
@@ -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="请调用获取时间工具,然后用一句话告诉用户今天的日期。"*
|
||||
<!-- 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*
|
||||
*id = > json.get value=`助手` key="id"*
|
||||
*历史 = > agent_history_get id=`id`*
|
||||
*条数 = > len value=`历史`*
|
||||
> print text=`条数`
|
||||
|
||||
+12
-12
@@ -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`
|
||||
@@ -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
|
||||
|
||||
@@ -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`*
|
||||
|
||||
@@ -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`
|
||||
@@ -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`
|
||||
|
||||
|
||||
@@ -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]*
|
||||
|
||||
|
||||
@@ -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]*
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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*
|
||||
|
||||
@@ -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`.概率*
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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`
|
||||
|
||||
@@ -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]*
|
||||
|
||||
|
||||
@@ -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]*
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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. *
|
||||
|
||||
@@ -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="<h1>Compose</h1>"*
|
||||
*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. *
|
||||
|
||||
@@ -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. *
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -10,10 +10,10 @@ import json:lib/json.mq.md
|
||||
*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`*
|
||||
*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"*
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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. *
|
||||
|
||||
@@ -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. *
|
||||
|
||||
@@ -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 = > 网页.页面 标题="关于" 引言="<p>关于</p>"*
|
||||
*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
|
||||
|
||||
Reference in new issue
Block a user