feat(llm): semantic ask/stream/collect surface (005)

Lift ext/ai/llm from OpenAI HTTP client to an intelligence primitive;
keep complete as compat. Add unified ai-stack roadmap linking agent + llm.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
cflmyandCursor committed 2026-09-24 13:35:38 +08:00
1 parent a9ee858f53
commit 1f8e61f3bf
11 files changed
+1581 -115

No files matched your search

+3
View File
@@ -1,6 +1,7 @@
---
title: Agent Framework P4 — Adaptive Routing + Policy Compilation (offline)
description: Learn skill, compile policy from skill-tagged episodes, route via marqdo backend without Jev/LLM.
import fs:lib/fs.mq.md
import json:lib/json.mq.md
import plugin:lib/plugin.mq.md
import sys:lib/sys.mq.md
@@ -21,6 +22,8 @@ import sys:lib/sys.mq.md
**task = > json.get value=`paths` key="task"**
**skill = > json.get value=`paths` key="skill"**
> fs.remove_tree path=`mem`
> fs.remove_tree path=`kb`
> agent_memory_ensure memory_dir=`mem`
**ep1 = > agent_record_episode task=`task` status="ok" result="pong" mode="explore" skill=`skill` llm_calls=2 memory_dir=`mem`**
+2
View File
@@ -22,6 +22,8 @@ import sys:lib/sys.mq.md
**kb = > json.get value=`paths` key="kb"**
**task = > json.get value=`paths` key="task"**
> fs.remove_tree path=`mem`
> fs.remove_tree path=`kb`
> agent_memory_ensure memory_dir=`mem`
**ep1 = > agent_record_episode task=`task` status="ok" result="pong" mode="explore" llm_calls=2 memory_dir=`mem`**
+19
View File
@@ -0,0 +1,19 @@
---
title: llm create + collect offline
description: Factory create + collect alias; no network.
import llm:ext/ai/llm.mq.md
import net:lib/net.mq.md
---
# main
**model = > llm.create**
> print text=[model](`model`)
> print text=[backend](`model`)
**fixture = "data: {\"choices\":[{\"delta\":{\"content\":\"Hi\"}}]}\n\ndata: {\"choices\":[{\"delta\":{\"content\":\"!\"}}]}\n\ndata: [DONE]\n"**
**events = > net.openai_sse_parse text=`fixture`**
**answer = > llm.collect events=`events`**
> print text=`answer`
**alias = > llm.stream_result events=`events`**
> print text=`alias`