Files
marqdo/tests/ext/agent-plan-stream-offline.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

72 lines
2.2 KiB
Markdown

---
title: agent plan stream helpers + confirm (offline)
description: plan_append_*/plan_finish_stream; confirm=True with stream attaches done event.
import llm:ext/ai/llm.mq.md
import agent:ext/ai/agent.mq.md
import json:lib/json.mq.md
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"*
*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"*
> print text=`t0`
*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"*
> print text=`t2`
*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"*
*pout = > `助手`.plan goal="say hi" confirm=True workbook_dir=".marqdo/agent-runs" writeback=False stream=True*
*st = > json.get value=`pout` key="status"*
> print text=`st`
*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"*
> print text=`pt`
*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"*
> print text=`ar`
*dev = > agent.plan_echo_decompose workbook="wb.mq.md" stream=True*
*dt = > json.get value=`dev` key="type"*
> print text=`dt`