Add example brief and script workflows

Why: The example plugin needs a bound intent and a plugin-shipped script so the three P4 paths can be checked against a real plugin.
Evidence: TestRepoExamplePluginLoads accepts the plugin, asks 主题是什么?, and keeps the topic slot.
Impact: demo.brief starts the five-step workflow. demo.script stays unbound and needs runtime.workflowScripts.
Refs: feature/agent-harness-p4
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-10-01 16:22:14 +00:00
co-authored by Cursor
parent 191d2de809
commit ef590bd0c3
5 changed files with 95 additions and 0 deletions
+15
View File
@@ -6,5 +6,20 @@
"description": "示例意图:命中『示例/演示』关键词(slots 声明即 HITL 该问什么;本示例无必填槽位)",
"matcher": { "includes_any": ["示例", "演示"] },
"slots": []
},
{
"id": "demo.brief",
"domain": "demo",
"version": 1,
"description": "写一份简报。必填槽位 topic,没写就问「主题是什么?」。",
"matcher": { "includes_any": ["简报"] },
"slots": [
{
"key": "topic",
"required": true,
"pattern": "主题[::]\\s*(\\S+)",
"question": "主题是什么?"
}
]
}
]
+4
View File
@@ -32,6 +32,10 @@
],
"commands": [
"demo"
],
"workflows": [
"demo-brief",
"demo-script"
]
}
}
+57
View File
@@ -0,0 +1,57 @@
{
"id": "demo.brief",
"title": "示例简报",
"description": "命中 demo.brief 后:选篇幅、起草、落成工件、发一张结果卡,再请用户确认。",
"intentId": "demo.brief",
"steps": [
{
"id": "length",
"title": "篇幅",
"kind": "hitl",
"hitl": {
"question": "要多长?",
"kind": "choice",
"allowFreeInput": false,
"choices": [
{"id": "short", "label": "短", "description": "一段", "impact": "只写一段"},
{"id": "long", "label": "长", "description": "几段", "impact": "会写得更长"}
]
}
},
{
"id": "draft",
"title": "起草",
"kind": "prompt",
"agent": "research",
"prompt": "写一份关于「{{slots.topic}}」的简报,篇幅:{{steps.length.output}}。",
"critic": {"criteria": "必须提到主题,并且是一段能读完的简报", "maxRetries": 1}
},
{
"id": "save",
"title": "成稿",
"kind": "artifact",
"artifact": "demo-brief.md",
"prompt": "{{steps.draft.output}}"
},
{
"id": "note",
"title": "收件",
"kind": "card",
"card": {"kind": "result", "title": "简报好了", "tone": "ok"}
},
{
"id": "confirm",
"title": "确认",
"kind": "hitl",
"hitl": {
"question": "这份简报可以用吗?",
"kind": "confirm",
"allowFreeInput": false,
"choices": [
{"id": "yes", "label": "可以用", "description": "结束", "impact": "不会再改"},
{"id": "no", "label": "先不用", "description": "结束", "impact": "不会再改"}
]
}
}
]
}
@@ -0,0 +1,13 @@
{
"id": "demo.script",
"title": "示例脚本",
"description": "插件自带脚本。需要打开 runtime.workflowScripts。不绑定意图,用 run_workflow 启动。",
"steps": [
{
"id": "run",
"title": "跑脚本",
"kind": "script",
"script": "workflows/scripts/demo.py"
}
]
}
@@ -0,0 +1,6 @@
import agentwf as wf
now = wf.tool("time_now", {})
answer = wf.ask("要记下来吗?", [{"id": "yes", "label": "记下", "impact": "会写入一份备忘"}])
wf.artifact("demo-script.md", "时间 " + now + "\n选择 " + answer)
wf.step("run", "跑脚本", "done")