Files
marqdo/tests/ext/agent-lib-call.mq.md
T
cflmyandCursor bd5555afaa 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>
2026-08-18 11:20:46 +08:00

46 lines
1.2 KiB
Markdown

---
title: Parent CALL:lib whitelist (offline)
description: lib.fs.exists + ARGS; reject lib.net; catalog callable.
import agent:ext/ai/agent.mq.md
import json:lib/json.mq.md
import fs:lib/fs.mq.md
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"*
> print text=`kind`
> print text=`name`
*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`*
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`*
1. `cn` > 3
> print text=callable-ok
2. *
> print text=callable-bad