fix(agent): preserve llm_free resources under plan force
Stop plan from clobbering an existing resources workbook with an explore skeleton. Add llm.prompt helpers and agent-plan-preserve gold. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
d8d435fead
commit
4a2d89406b
10 files changed
+151
-28
No files matched your search
+11
-1
@@ -2250,18 +2250,28 @@ Reuse lookup: exact → alias → canonicalize → optional local n-gram `near`
|
||||
**b = > json.get value=`parts` key="b"**
|
||||
**c = > json.get value=`parts` key="c"**
|
||||
**path = workbook_dir + a + slug + b + ts + c**
|
||||
> fs.write_text path=`path` text=`skel`
|
||||
2. `explore`
|
||||
**parts = > json.parse text={"a":"/explore/","b":"/","c":".mq.md"}**
|
||||
**a = > json.get value=`parts` key="a"**
|
||||
**b = > json.get value=`parts` key="b"**
|
||||
**c = > json.get value=`parts` key="c"**
|
||||
**path = kb_dir + a + slug + b + explore_attempt + c**
|
||||
**ex = > fs.exists path=`path`**
|
||||
1. `ex`
|
||||
**_ = 1**
|
||||
2. *
|
||||
> fs.write_text path=`path` text=`skel`
|
||||
3. *
|
||||
**parts = > json.parse text={"a":"/resources/","b":".mq.md"}**
|
||||
**a = > json.get value=`parts` key="a"**
|
||||
**b = > json.get value=`parts` key="b"**
|
||||
**path = kb_dir + a + slug + b**
|
||||
> fs.write_text path=`path` text=`skel`
|
||||
**ex = > fs.exists path=`path`**
|
||||
1. `ex`
|
||||
**_ = 1**
|
||||
2. *
|
||||
> fs.write_text path=`path` text=`skel`
|
||||
|
||||
1. `confirm`
|
||||
**out = > json.parse text={"status":"pending"}**
|
||||
|
||||
+30
-10
@@ -96,21 +96,19 @@ Named strong/reasoning handle. Model from arg, else `MARQDO_LLM_REASONING_MODEL`
|
||||
|
||||
*> create model=`mdl` base_url=`base_url` api_key=`api_key` name="reasoning" backend="openai-compatible"*
|
||||
|
||||
## prompt_load
|
||||
+ `path`
|
||||
## prompt_body
|
||||
+ `src`
|
||||
|
||||
Load a prompt artifact (`.mq.md` / `.md`) from disk for `ask`.
|
||||
If frontmatter declares `type: prompt` (or `类型: 提示`), return the body after the closing `---`; otherwise the full file text.
|
||||
If `src` starts with YAML frontmatter declaring `type: prompt` / `类型: 提示`, return the body after the closing `---`; otherwise return `src` unchanged.
|
||||
|
||||
**raw = > fs.read_text path=`path`**
|
||||
**sw = > text.starts_with text=`raw` prefix="---"**
|
||||
**sw = > text.starts_with text=`src` prefix="---"**
|
||||
1. not `sw`
|
||||
*raw*
|
||||
*src*
|
||||
2. *
|
||||
**parts = > split value=`raw` sep="\n---\n"**
|
||||
**parts = > split value=`src` sep="\n---\n"**
|
||||
**n = > len value=`parts`**
|
||||
1. `n` < 2
|
||||
*raw*
|
||||
*src*
|
||||
2. *
|
||||
**fm = > at value=`parts` index=0**
|
||||
**is_p = > text.contains text=`fm` sub="type: prompt"**
|
||||
@@ -122,7 +120,29 @@ If frontmatter declares `type: prompt` (or `类型: 提示`), return the body af
|
||||
**body = > at value=`parts` index=1**
|
||||
*> text.str_trim s=`body`*
|
||||
2. *
|
||||
*raw*
|
||||
*src*
|
||||
|
||||
## prompt_load
|
||||
+ `path`
|
||||
|
||||
Load a prompt artifact (`.mq.md` / `.md`) from disk for `ask`.
|
||||
|
||||
**raw = > fs.read_text path=`path`**
|
||||
*> prompt_body src=`raw`*
|
||||
|
||||
## prompt
|
||||
+ `path`=None
|
||||
+ `text`=None
|
||||
|
||||
Prompt artifact helper: `path=` loads a file; `text=` strips `type: prompt` frontmatter from an in-memory string.
|
||||
|
||||
1. `path`
|
||||
*> prompt_load path=`path`*
|
||||
2. `text`
|
||||
*> prompt_body src=`text`*
|
||||
3. *
|
||||
> print text=ext/ai/llm.prompt: pass path= or text=
|
||||
> sys.exit code=1
|
||||
|
||||
## ask
|
||||
+ `prompt`=None
|
||||
|
||||
+25
-10
@@ -82,20 +82,17 @@ import openai:ext/ai/llm/openai.mq.md
|
||||
|
||||
*> 创建 模型=`mdl` 基址=`基址` 密钥=`密钥` 名="reasoning" 后端="openai-compatible"*
|
||||
|
||||
## 加载提示
|
||||
+ `路径`
|
||||
## 提示正文
|
||||
+ `源`
|
||||
|
||||
加载提示文档。若 frontmatter 含 `type: prompt` / `类型: 提示`,返回闭合 `---` 后的正文。
|
||||
|
||||
**raw = > 文件.读文本 路径=`路径`**
|
||||
**sw = > 文本.开头是 内容=`raw` 前缀="---"**
|
||||
**sw = > 文本.开头是 内容=`源` 前缀="---"**
|
||||
1. 非 `sw`
|
||||
*raw*
|
||||
*源*
|
||||
2. *
|
||||
**parts = > split value=`raw` sep="\n---\n"**
|
||||
**parts = > split value=`源` sep="\n---\n"**
|
||||
**n = > len value=`parts`**
|
||||
1. `n` < 2
|
||||
*raw*
|
||||
*源*
|
||||
2. *
|
||||
**fm = > at value=`parts` index=0**
|
||||
**is_p = > 文本.包含 内容=`fm` 子串="type: prompt"**
|
||||
@@ -107,7 +104,25 @@ import openai:ext/ai/llm/openai.mq.md
|
||||
**body = > at value=`parts` index=1**
|
||||
*> 文本.去空白 s=`body`*
|
||||
2. *
|
||||
*raw*
|
||||
*源*
|
||||
|
||||
## 加载提示
|
||||
+ `路径`
|
||||
|
||||
**raw = > 文件.读文本 路径=`路径`**
|
||||
*> 提示正文 源=`raw`*
|
||||
|
||||
## 提示
|
||||
+ `路径`=None
|
||||
+ `文本`=None
|
||||
|
||||
1. `路径`
|
||||
*> 加载提示 路径=`路径`*
|
||||
2. `文本`
|
||||
*> 提示正文 源=`文本`*
|
||||
3. *
|
||||
> 打印 内容=ext/ai/大模型.提示: 请传 路径= 或 文本=
|
||||
> 系统.退出 码=1
|
||||
|
||||
## 提问
|
||||
+ `提示`=None
|
||||
|
||||
Reference in new issue
Block a user