Implement streaming S0-S2: SSE complete, step/plan events.

Add net/llm SSE primitives and optional stream/echo/trace on step and plan so callers can watch deltas and rounds without changing final return values.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
cflmyandCursor committed 2026-08-10 11:03:04 +08:00
1 parent 5456d9ff83
commit b6bb42e460
18 files changed
+809 -64

No files matched your search

+19
View File
@@ -21,6 +21,25 @@ Default content type is JSON. Optional `content_type=` / `headers=` (map).
**> host_http_post url=`url` body=`body` content_type=`content_type` headers=`headers`**
## http_post_sse
+ `url`
+ `body`
+ `content_type`=None
+ `headers`=None
+ `echo`=False
POST and consume OpenAI-compatible SSE. Returns `{status, events}` where `events` is a list of `{type, …}` maps (`delta` / `done` / `error`). Optional `echo=True` prints delta text to stdout as chunks arrive.
**> host_http_post_sse url=`url` body=`body` content_type=`content_type` headers=`headers` echo=`echo`**
## openai_sse_parse
+ `text`
+ `echo`=False
Offline: parse an OpenAI chat SSE body into the same event list (no network).
**> host_openai_sse_parse text=`text` echo=`echo`**
## http_request
+ `method`
+ `url`
+19
View File
@@ -21,6 +21,25 @@ description: 中文 HTTP(S) 包装。可选 headers / content_type 经宿主别
**> host_http_post url=`地址` body=`内容` content_type=`content_type` headers=`headers`**
## 提交流式
+ `地址`
+ `内容`
+ `content_type`=None
+ `headers`=None
+ `打印增量`=False
POST 并消费 OpenAI 兼容 SSE。返回 `{status, events}`(`delta` / `done` / `error`)。`打印增量=真` 时边读边打印增量文本。
**> host_http_post_sse url=`地址` body=`内容` content_type=`content_type` headers=`headers` echo=`打印增量`**
## 解析流式
+ `内容`
+ `打印增量`=False
离线解析 OpenAI 聊天 SSE 正文为事件列表(不联网)。
**> host_openai_sse_parse text=`内容` echo=`打印增量`**
## 请求
+ `方法`
+ `地址`