feat(markup): finish v0.3 stock migration and green gold
Migrate remaining .mq.md (tests/ext/public/examples), stop elevating local assigns to params, inject form_target in Go libweb, and skip live LLM gold without a real key. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
bfb10d172b
commit
b5c07385e9
324 files changed
+4572
-4339
No files matched your search
+1123
-1123
File diff suppressed because it is too large.
Load diff
+28
-28
@@ -12,50 +12,50 @@ import table:lib/table.mq.md
|
||||
|
||||
Load `.env` from cwd (optional named arg `path=`). Does not override existing variables.
|
||||
|
||||
**> sys.load_dotenv path=`path`**
|
||||
*> sys.load_dotenv path=`path`*
|
||||
|
||||
## stream_result
|
||||
+ `events`
|
||||
|
||||
Reduce a `complete stream=True` event list to the final `done.result` text (or `error.message`). Unknown types (e.g. `reasoning`) are ignored.
|
||||
|
||||
*answer = ""*
|
||||
**answer = ""**
|
||||
|
||||
- [ev](events)
|
||||
*t = ev[^type]*
|
||||
**t = ev[^type]**
|
||||
1. `t` == "done"
|
||||
*answer = ev[^result]*
|
||||
**answer = ev[^result]**
|
||||
2. `t` == "error"
|
||||
*answer = ev[^message]*
|
||||
**answer = ev[^message]**
|
||||
3. `t` == "delta"
|
||||
4. *
|
||||
*_ = 1*
|
||||
**_ = 1**
|
||||
|
||||
**answer**
|
||||
*answer*
|
||||
|
||||
# llm
|
||||
|
||||
Construct an LLM handle from `OPENAI_*` / `MARQDO_LLM_*`.
|
||||
|
||||
*api_key = > sys.env_get name="OPENAI_API_KEY"*
|
||||
**api_key = > sys.env_get name="OPENAI_API_KEY"**
|
||||
1. not `api_key`
|
||||
*api_key = > sys.env_get name="MARQDO_LLM_API_KEY"*
|
||||
**api_key = > sys.env_get name="MARQDO_LLM_API_KEY"**
|
||||
|
||||
1. not `api_key`
|
||||
> print text=ext/ai/llm: set OPENAI_API_KEY or MARQDO_LLM_API_KEY
|
||||
> sys.exit code=1
|
||||
|
||||
*base_url = > sys.env_get name="OPENAI_BASE_URL"*
|
||||
**base_url = > sys.env_get name="OPENAI_BASE_URL"**
|
||||
1. not `base_url`
|
||||
*base_url = > sys.env_get name="MARQDO_LLM_BASE_URL"*
|
||||
**base_url = > sys.env_get name="MARQDO_LLM_BASE_URL"**
|
||||
1. not `base_url`
|
||||
*base_url = "https://api.openai.com/v1"*
|
||||
**base_url = "https://api.openai.com/v1"**
|
||||
|
||||
*model = > sys.env_get name="OPENAI_MODEL"*
|
||||
**model = > sys.env_get name="OPENAI_MODEL"**
|
||||
1. not `model`
|
||||
*model = > sys.env_get name="MARQDO_LLM_MODEL"*
|
||||
**model = > sys.env_get name="MARQDO_LLM_MODEL"**
|
||||
1. not `model`
|
||||
*model = "gpt-4o-mini"*
|
||||
**model = "gpt-4o-mini"**
|
||||
|
||||
`h` =
|
||||
|
||||
@@ -63,7 +63,7 @@ Construct an LLM handle from `OPENAI_*` / `MARQDO_LLM_*`.
|
||||
|---------|----------|-------|--------|--------|
|
||||
| `api_key` | `base_url` | `model` | /chat/completions | "Bearer " |
|
||||
|
||||
**h**
|
||||
*h*
|
||||
|
||||
## complete
|
||||
+ `prompt`
|
||||
@@ -74,9 +74,9 @@ Chat completion using `self` handle fields.
|
||||
|
||||
Wire body is `{model, messages:[{role,content}], stream?}`. Messages are an `@` row table; headers and optional `stream` use `table.put`. `json` is only for stringify/parse.
|
||||
|
||||
*url = self[^base_url] + self[^suffix]*
|
||||
*auth = self[^bearer] + self[^api_key]*
|
||||
*headers = > table.put in=None at="Authorization" value=`auth`*
|
||||
**url = self[^base_url] + self[^suffix]**
|
||||
**auth = self[^bearer] + self[^api_key]**
|
||||
**headers = > table.put in=None at="Authorization" value=`auth`**
|
||||
|
||||
`messages` =
|
||||
|
||||
@@ -91,21 +91,21 @@ Wire body is `{model, messages:[{role,content}], stream?}`. Messages are an `@`
|
||||
| self[^model] | `messages` |
|
||||
|
||||
1. `stream`
|
||||
*req = > table.put in=`req` at="stream" value=True*
|
||||
*body = > json.stringify value=`req`*
|
||||
*resp = > net.http_post_sse url=`url` body=`body` headers=`headers` echo=`echo`*
|
||||
**req = > table.put in=`req` at="stream" value=True**
|
||||
**body = > json.stringify value=`req`**
|
||||
**resp = > net.http_post_sse url=`url` body=`body` headers=`headers` echo=`echo`**
|
||||
1. resp[^status] == 200
|
||||
**resp[^events]**
|
||||
*resp[^events]*
|
||||
2. *
|
||||
> print text=ext/ai/llm: HTTP error (stream)
|
||||
> print text=resp[^status]
|
||||
> sys.exit code=1
|
||||
2. *
|
||||
*body = > json.stringify value=`req`*
|
||||
*resp = > net.http_post url=`url` body=`body` headers=`headers`*
|
||||
**body = > json.stringify value=`req`**
|
||||
**resp = > net.http_post url=`url` body=`body` headers=`headers`**
|
||||
1. resp[^status] == 200
|
||||
*data = > json.parse text=resp[^body]*
|
||||
**data[^choices][^1][^message][^content]**
|
||||
**data = > json.parse text=resp[^body]**
|
||||
*data[^choices][^1][^message][^content]*
|
||||
2. *
|
||||
> print text=ext/ai/llm: HTTP error
|
||||
> print text=resp[^status]
|
||||
@@ -121,4 +121,4 @@ Wire body is `{model, messages:[{role,content}], stream?}`. Messages are an `@`
|
||||
|
||||
Alias for `complete`.
|
||||
|
||||
**> self.complete prompt=`prompt` stream=`stream` echo=`echo`**
|
||||
*> self.complete prompt=`prompt` stream=`stream` echo=`echo`*
|
||||
+28
-28
@@ -12,50 +12,50 @@ import json:lib/json.mq.md
|
||||
|
||||
从工作目录加载 `.env`(可选命名实参 `路径=`)。不覆盖已有变量。
|
||||
|
||||
**> 系统.加载环境 路径=`路径`**
|
||||
*> 系统.加载环境 路径=`路径`*
|
||||
|
||||
## 流式结果
|
||||
+ `事件`
|
||||
|
||||
把 `运行 流式=真` 的事件列表收成最终 `done.result`(或 `error.message`)。未知类型(如 `reasoning`)忽略。
|
||||
|
||||
*answer = ""*
|
||||
**answer = ""**
|
||||
|
||||
- [ev](事件)
|
||||
*t = ev[^type]*
|
||||
**t = ev[^type]**
|
||||
1. `t` == "done"
|
||||
*answer = ev[^result]*
|
||||
**answer = ev[^result]**
|
||||
2. `t` == "error"
|
||||
*answer = ev[^message]*
|
||||
**answer = ev[^message]**
|
||||
3. `t` == "delta"
|
||||
4. *
|
||||
*_ = 1*
|
||||
**_ = 1**
|
||||
|
||||
**answer**
|
||||
*answer*
|
||||
|
||||
# 大模型
|
||||
|
||||
从 `OPENAI_*` / `MARQDO_LLM_*` 构造句柄。
|
||||
|
||||
*api_key = > 系统.取环境 名="OPENAI_API_KEY"*
|
||||
**api_key = > 系统.取环境 名="OPENAI_API_KEY"**
|
||||
1. 非 `api_key`
|
||||
*api_key = > 系统.取环境 名="MARQDO_LLM_API_KEY"*
|
||||
**api_key = > 系统.取环境 名="MARQDO_LLM_API_KEY"**
|
||||
|
||||
1. 非 `api_key`
|
||||
> 打印 内容=ext/ai/大模型: 请设置 OPENAI_API_KEY 或 MARQDO_LLM_API_KEY
|
||||
> 系统.退出 码=1
|
||||
|
||||
*base_url = > 系统.取环境 名="OPENAI_BASE_URL"*
|
||||
**base_url = > 系统.取环境 名="OPENAI_BASE_URL"**
|
||||
1. 非 `base_url`
|
||||
*base_url = > 系统.取环境 名="MARQDO_LLM_BASE_URL"*
|
||||
**base_url = > 系统.取环境 名="MARQDO_LLM_BASE_URL"**
|
||||
1. 非 `base_url`
|
||||
*base_url = "https://api.openai.com/v1"*
|
||||
**base_url = "https://api.openai.com/v1"**
|
||||
|
||||
*model = > 系统.取环境 名="OPENAI_MODEL"*
|
||||
**model = > 系统.取环境 名="OPENAI_MODEL"**
|
||||
1. 非 `model`
|
||||
*model = > 系统.取环境 名="MARQDO_LLM_MODEL"*
|
||||
**model = > 系统.取环境 名="MARQDO_LLM_MODEL"**
|
||||
1. 非 `model`
|
||||
*model = "gpt-4o-mini"*
|
||||
**model = "gpt-4o-mini"**
|
||||
|
||||
`h` =
|
||||
|
||||
@@ -63,7 +63,7 @@ import json:lib/json.mq.md
|
||||
|---------|----------|-------|--------|--------|
|
||||
| `api_key` | `base_url` | `model` | /chat/completions | "Bearer " |
|
||||
|
||||
**h**
|
||||
*h*
|
||||
|
||||
## 运行
|
||||
+ `提示`
|
||||
@@ -74,9 +74,9 @@ import json:lib/json.mq.md
|
||||
|
||||
线上 body 为 `{model, messages:[{role,content}], stream?}`。消息用 `@` 行向表;headers 与可选 `stream` 用 `表.改`。`json` 只做 stringify/parse。
|
||||
|
||||
*url = 自[^base_url] + 自[^suffix]*
|
||||
*auth = 自[^bearer] + 自[^api_key]*
|
||||
*headers = > 表.改 入=None 于="Authorization" 值=`auth`*
|
||||
**url = 自[^base_url] + 自[^suffix]**
|
||||
**auth = 自[^bearer] + 自[^api_key]**
|
||||
**headers = > 表.改 入=None 于="Authorization" 值=`auth`**
|
||||
|
||||
`messages` =
|
||||
|
||||
@@ -91,21 +91,21 @@ import json:lib/json.mq.md
|
||||
| 自[^model] | `messages` |
|
||||
|
||||
1. `流式`
|
||||
*req = > 表.改 入=`req` 于="stream" 值=True*
|
||||
*body = > json.stringify value=`req`*
|
||||
*resp = > 网络.提交流式 地址=`url` 内容=`body` headers=`headers` 打印增量=`打印增量`*
|
||||
**req = > 表.改 入=`req` 于="stream" 值=True**
|
||||
**body = > json.stringify value=`req`**
|
||||
**resp = > 网络.提交流式 地址=`url` 内容=`body` headers=`headers` 打印增量=`打印增量`**
|
||||
1. resp[^status] == 200
|
||||
**resp[^events]**
|
||||
*resp[^events]*
|
||||
2. *
|
||||
> 打印 内容=ext/ai/大模型: HTTP 错误(流式)
|
||||
> 打印 内容=resp[^status]
|
||||
> 系统.退出 码=1
|
||||
2. *
|
||||
*body = > json.stringify value=`req`*
|
||||
*resp = > 网络.提交 地址=`url` 内容=`body` headers=`headers`*
|
||||
**body = > json.stringify value=`req`**
|
||||
**resp = > 网络.提交 地址=`url` 内容=`body` headers=`headers`**
|
||||
1. resp[^status] == 200
|
||||
*data = > json.parse text=resp[^body]*
|
||||
**data[^choices][^1][^message][^content]**
|
||||
**data = > json.parse text=resp[^body]**
|
||||
*data[^choices][^1][^message][^content]*
|
||||
2. *
|
||||
> 打印 内容=ext/ai/大模型: HTTP 错误
|
||||
> 打印 内容=resp[^status]
|
||||
@@ -121,4 +121,4 @@ import json:lib/json.mq.md
|
||||
|
||||
运行 的别名。
|
||||
|
||||
**> 自.运行 提示=`提示` 流式=`流式` 打印增量=`打印增量`**
|
||||
*> 自.运行 提示=`提示` 流式=`流式` 打印增量=`打印增量`*
|
||||
+83
-83
@@ -16,11 +16,11 @@ import json:lib/json.mq.md
|
||||
+ `源码深度`=default
|
||||
+ `技能深度`=default
|
||||
|
||||
组装可读提示:站立提示、任务、**调用位置**、工具、**预算**源码 + Skill,以及人可见的行动约定。
|
||||
组装可读提示:站立提示、任务、*调用位置*、工具、*预算*源码 + Skill,以及人可见的行动约定。
|
||||
编排 `.mq.md` 即真相源(代码即文档)。默认预算防爆窗;可先 `读取:source|skill` 加深再答或 `调用:`。
|
||||
实现委托 `agent.build_step_context`(与英文版同源)。
|
||||
|
||||
**> agent.build_step_context agent=`智能体` task=`任务` source_depth=`源码深度` skill_depth=`技能深度`**
|
||||
*> agent.build_step_context agent=`智能体` task=`任务` source_depth=`源码深度` skill_depth=`技能深度`*
|
||||
|
||||
---
|
||||
|
||||
@@ -29,31 +29,31 @@ import json:lib/json.mq.md
|
||||
|
||||
解析人可读调用行:`CALL:<名>` 或 `调用:<名>` / `调用:<名>`。
|
||||
|
||||
*esc = > json.parse text={"nl":"\n"}*
|
||||
*nl = > json.get value=`esc` key="nl"*
|
||||
*text = > trim value=`回复`*
|
||||
*lines = > split value=`text` sep=`nl`*
|
||||
*found = 空*
|
||||
**esc = > json.parse text={"nl":"\n"}**
|
||||
**nl = > json.get value=`esc` key="nl"**
|
||||
**text = > trim value=`回复`**
|
||||
**lines = > split value=`text` sep=`nl`**
|
||||
**found = 空**
|
||||
|
||||
- [`line`](`lines`)
|
||||
*t = > trim value=`line`*
|
||||
*parts = > split value=`t` sep=:*
|
||||
*n = > len value=`parts`*
|
||||
**t = > trim value=`line`**
|
||||
**parts = > split value=`t` sep=:**
|
||||
**n = > len value=`parts`**
|
||||
1. `n` > 1
|
||||
*head = > at value=`parts` index=0*
|
||||
*head = > trim value=`head`*
|
||||
*rest = > at value=`parts` index=1*
|
||||
*rest = > trim value=`rest`*
|
||||
**head = > at value=`parts` index=0**
|
||||
**head = > trim value=`head`**
|
||||
**rest = > at value=`parts` index=1**
|
||||
**rest = > trim value=`rest`**
|
||||
1. `head` == CALL
|
||||
*found = rest*
|
||||
**found = rest**
|
||||
2. `head` == 调用
|
||||
*found = rest*
|
||||
**found = rest**
|
||||
3. *
|
||||
*_ = 1*
|
||||
**_ = 1**
|
||||
2. *
|
||||
*_ = 1*
|
||||
**_ = 1**
|
||||
|
||||
**found**
|
||||
*found*
|
||||
|
||||
---
|
||||
|
||||
@@ -63,13 +63,13 @@ import json:lib/json.mq.md
|
||||
|
||||
白名单校验后,经 `lib/子任务`(`启动 函数=` → `等待`)调用 runbook 中的 `##`。
|
||||
|
||||
*allowed = > agent_tool_allowed tools=`工具` name=`名`*
|
||||
**allowed = > agent_tool_allowed tools=`工具` name=`名`**
|
||||
1. `allowed`
|
||||
*id = > 子任务.启动 函数=`名`*
|
||||
**> 子任务.等待 id=`id`**
|
||||
**id = > 子任务.启动 函数=`名`**
|
||||
*> 子任务.等待 id=`id`*
|
||||
2. *
|
||||
*msg = "Tool not allowed:"*
|
||||
**msg + `名`**
|
||||
**msg = "Tool not allowed:"**
|
||||
*msg + `名`*
|
||||
|
||||
# 智能体
|
||||
+ `大模型`
|
||||
@@ -78,31 +78,31 @@ import json:lib/json.mq.md
|
||||
|
||||
加载 ABI v2 agent 插件(会话袋 + 上下文查询)。
|
||||
|
||||
*p = > 插件.原生路径 名="agent"*
|
||||
**p = > 插件.原生路径 名="agent"**
|
||||
1. `p`
|
||||
> 插件.加载 路径=`p`
|
||||
2. *
|
||||
> 打印 内容=ext/ai/智能体: 未找到原生 agent 插件(请先 cargo build -p marqdo_plugin_agent 或 marqdo ext add agent)
|
||||
> 系统.退出 码=1
|
||||
|
||||
*id = > agent_alloc*
|
||||
*h = > json.parse text={"_type":"智能体"}*
|
||||
*h = > json.set map=`h` key="id" value=`id`*
|
||||
*h = > json.set map=`h` key="model" value=`大模型`*
|
||||
*h = > json.set map=`h` key="tools" value=`工具`*
|
||||
**id = > agent_alloc**
|
||||
**h = > json.parse text={"_type":"智能体"}**
|
||||
**h = > json.set map=`h` key="id" value=`id`**
|
||||
**h = > json.set map=`h` key="model" value=`大模型`**
|
||||
**h = > json.set map=`h` key="tools" value=`工具`**
|
||||
|
||||
1. `站立提示`
|
||||
*h = > json.set map=`h` key="standing" value=`站立提示`*
|
||||
**h = > json.set map=`h` key="standing" value=`站立提示`**
|
||||
2. *
|
||||
*_ = 1*
|
||||
**_ = 1**
|
||||
|
||||
**h**
|
||||
*h*
|
||||
|
||||
## 清空历史
|
||||
|
||||
清空本智能体 id 的插件会话袋。
|
||||
|
||||
*id = > json.get value=`自` key="id"*
|
||||
**id = > json.get value=`自` key="id"**
|
||||
> agent_history_clear id=`id`
|
||||
****
|
||||
|
||||
@@ -112,76 +112,76 @@ import json:lib/json.mq.md
|
||||
+ `流式`=假
|
||||
+ `打印增量`=假
|
||||
|
||||
原子一轮:上下文 → 大模型 → 可选子任务调工具。返回 **map**(`status`、`task`、`decision`;成功含 `result`,可选 `tool` / `tool_result`;失败含 `error`)。默认(`写回=真`)将结果写入调用行下的命名槽 `ok` / `error`;传 `写回=假` 可关闭。
|
||||
原子一轮:上下文 → 大模型 → 可选子任务调工具。返回 *map*(`status`、`task`、`decision`;成功含 `result`,可选 `tool` / `tool_result`;失败含 `error`)。默认(`写回=真`)将结果写入调用行下的命名槽 `ok` / `error`;传 `写回=假` 可关闭。
|
||||
|
||||
流式=真 时走 SSE;打印增量=真 边读边打印。返回 map 仍是最终 result 文本。
|
||||
|
||||
*ctx = > 构建单步上下文 智能体=`自` 任务=`任务`*
|
||||
*id = > json.get value=`自` key="id"*
|
||||
*model = > json.get value=`自` key="model"*
|
||||
*tools = > json.get value=`自` key="tools"*
|
||||
**ctx = > 构建单步上下文 智能体=`自` 任务=`任务`**
|
||||
**id = > json.get value=`自` key="id"**
|
||||
**model = > json.get value=`自` key="model"**
|
||||
**tools = > json.get value=`自` key="tools"**
|
||||
|
||||
*user_turn = > json.parse text={"role":"user"}*
|
||||
*user_turn = > json.set map=`user_turn` key="content" value=`任务`*
|
||||
**user_turn = > json.parse text={"role":"user"}**
|
||||
**user_turn = > json.set map=`user_turn` key="content" value=`任务`**
|
||||
> agent_history_append id=`id` item=`user_turn`
|
||||
|
||||
1. `流式`
|
||||
*evs = > model.运行 提示=`ctx` 流式=真 打印增量=`打印增量`*
|
||||
*reply = > 大模型.流式结果 事件=`evs`*
|
||||
**evs = > model.运行 提示=`ctx` 流式=真 打印增量=`打印增量`**
|
||||
**reply = > 大模型.流式结果 事件=`evs`**
|
||||
2. *
|
||||
*reply = > model.运行 提示=`ctx`*
|
||||
**reply = > model.运行 提示=`ctx`**
|
||||
|
||||
*reply = > trim value=`reply`*
|
||||
*decision = reply*
|
||||
*tool_name = > 提取工具名 回复=`reply`*
|
||||
*out = > json.parse text={"status":"ok"}*
|
||||
*out = > json.set map=`out` key="task" value=`任务`*
|
||||
*out = > json.set map=`out` key="decision" value=`decision`*
|
||||
**reply = > trim value=`reply`**
|
||||
**decision = reply**
|
||||
**tool_name = > 提取工具名 回复=`reply`**
|
||||
**out = > json.parse text={"status":"ok"}**
|
||||
**out = > json.set map=`out` key="task" value=`任务`**
|
||||
**out = > json.set map=`out` key="decision" value=`decision`**
|
||||
|
||||
1. `tool_name`
|
||||
*tool_out = > 运行工具 工具=`tools` 名=`tool_name`*
|
||||
*tool_s = > json.stringify value=`tool_out`*
|
||||
*deny = > split value=`tool_s` sep="Tool not allowed"*
|
||||
*deny_n = > len value=`deny`*
|
||||
**tool_out = > 运行工具 工具=`tools` 名=`tool_name`**
|
||||
**tool_s = > json.stringify value=`tool_out`**
|
||||
**deny = > split value=`tool_s` sep="Tool not allowed"**
|
||||
**deny_n = > len value=`deny`**
|
||||
1. `deny_n` > 1
|
||||
*out = > json.set map=`out` key="status" value="error"*
|
||||
*out = > json.set map=`out` key="error" value=`tool_s`*
|
||||
*reply = tool_s*
|
||||
**out = > json.set map=`out` key="status" value="error"**
|
||||
**out = > json.set map=`out` key="error" value=`tool_s`**
|
||||
**reply = tool_s**
|
||||
2. *
|
||||
*task_s = > json.stringify value=`任务`*
|
||||
*fp = "The user asked:"*
|
||||
*fp = fp + task_s*
|
||||
*fp = fp + ". Tool"*
|
||||
*fp = fp + tool_name*
|
||||
*fp = fp + "ran via subtask and returned:"*
|
||||
*fp = fp + tool_s*
|
||||
*fp = fp + ". Reply to the user briefly."*
|
||||
**task_s = > json.stringify value=`任务`**
|
||||
**fp = "The user asked:"**
|
||||
**fp = fp + task_s**
|
||||
**fp = fp + ". Tool"**
|
||||
**fp = fp + tool_name**
|
||||
**fp = fp + "ran via subtask and returned:"**
|
||||
**fp = fp + tool_s**
|
||||
**fp = fp + ". Reply to the user briefly."**
|
||||
1. `流式`
|
||||
*evs2 = > model.运行 提示=`fp` 流式=真 打印增量=`打印增量`*
|
||||
*reply = > 大模型.流式结果 事件=`evs2`*
|
||||
**evs2 = > model.运行 提示=`fp` 流式=真 打印增量=`打印增量`**
|
||||
**reply = > 大模型.流式结果 事件=`evs2`**
|
||||
2. *
|
||||
*reply = > model.运行 提示=`fp`*
|
||||
*out = > json.set map=`out` key="tool" value=`tool_name`*
|
||||
*out = > json.set map=`out` key="tool_result" value=`tool_s`*
|
||||
*out = > json.set map=`out` key="result" value=`reply`*
|
||||
**reply = > model.运行 提示=`fp`**
|
||||
**out = > json.set map=`out` key="tool" value=`tool_name`**
|
||||
**out = > json.set map=`out` key="tool_result" value=`tool_s`**
|
||||
**out = > json.set map=`out` key="result" value=`reply`**
|
||||
2. *
|
||||
*out = > json.set map=`out` key="result" value=`reply`*
|
||||
**out = > json.set map=`out` key="result" value=`reply`**
|
||||
|
||||
*as_turn = > json.parse text={"role":"assistant"}*
|
||||
*as_turn = > json.set map=`as_turn` key="content" value=`reply`*
|
||||
**as_turn = > json.parse text={"role":"assistant"}**
|
||||
**as_turn = > json.set map=`as_turn` key="content" value=`reply`**
|
||||
> agent_history_append id=`id` item=`as_turn`
|
||||
|
||||
1. `写回`
|
||||
*body = > json.stringify value=`out`*
|
||||
*st = > json.get value=`out` key="status"*
|
||||
**body = > json.stringify value=`out`**
|
||||
**st = > json.get value=`out` key="status"**
|
||||
1. `st` == "ok"
|
||||
> 自写回.写回 值=`body` 键="ok"
|
||||
2. *
|
||||
> 自写回.写回 值=`body` 键="error"
|
||||
2. *
|
||||
*_ = 1*
|
||||
**_ = 1**
|
||||
|
||||
**out**
|
||||
*out*
|
||||
|
||||
## 多步
|
||||
+ `目标`
|
||||
@@ -207,8 +207,8 @@ import json:lib/json.mq.md
|
||||
|
||||
多步工作簿默认写入 OKF `知识库目录/resources/<slug>.mq.md`;仅当传入 `工作簿目录` 时才用临时 runs。转发至英文 `agent.plan`。`流式` / `打印增量` / `轨迹` 对应 `stream` / `echo` / `trace`;`软命中` → `soft_match`;`近义命中` / `近义阈值` → `near_match` / `near_threshold`。
|
||||
|
||||
*model = > json.get value=`self` key="model"*
|
||||
*tools = > json.get value=`self` key="tools"*
|
||||
*standing = > json.get value=`self` key="standing"*
|
||||
*en = > agent.agent model=`model` tools=`tools` standing=`standing`*
|
||||
**> en.plan goal=`目标` workbook_dir=`工作簿目录` workbook=`工作簿` max_rounds=`最大轮次` confirm=`确认分解` writeback=`写回` skeleton=`骨架` reuse=`复用` optimize=`优化` force=`强制` soft_match=`软命中` near_match=`近义命中` near_threshold=`近义阈值` promote=`晋升` kb_dir=`知识库目录` improve_every=`改进周期` explore_n=`探索次数` stream=`流式` echo=`打印增量` trace=`轨迹`**
|
||||
**model = > json.get value=`self` key="model"**
|
||||
**tools = > json.get value=`self` key="tools"**
|
||||
**standing = > json.get value=`self` key="standing"**
|
||||
**en = > agent.agent model=`model` tools=`tools` standing=`standing`**
|
||||
*> en.plan goal=`目标` workbook_dir=`工作簿目录` workbook=`工作簿` max_rounds=`最大轮次` confirm=`确认分解` writeback=`写回` skeleton=`骨架` reuse=`复用` optimize=`优化` force=`强制` soft_match=`软命中` near_match=`近义命中` near_threshold=`近义阈值` promote=`晋升` kb_dir=`知识库目录` improve_every=`改进周期` explore_n=`探索次数` stream=`流式` echo=`打印增量` trace=`轨迹`*
|
||||
Reference in new issue
Block a user