Compare commits

..
Author SHA1 Message Date
weichenandCursor 9b8cf79c96 Add optional tools, model, and maxTurns to prompt modules
Why: User overrides of a subagent profile need a place on the shared contract, and empty fields must stay omitted so older modules keep their meaning.
Evidence: go test ./... passed, including the new prompt_module_subagent golden.
Impact: Existing modules serialize the same. Frontend and UI contracts still need a copy of the type.
Refs: feature/agent-harness-p3b
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-01 15:21:47 +00:00
weichen 493a846f07 Accept plugin manifest apiVersion 2.0-experimental
Why: Downstream repositories need a versioned public manifest for skills, MCP, knowledge, parsers, agents, channels, and pages without forking the base.

Evidence: go test ./... passed after omitzero on empty scope and backend so the golden plugin_manifest stays stable.

Impact: apiVersion 1.0 remains accepted. New provides fields are optional. Merge without squash so Backend can pin this commit.

Refs: Agent-System-Dev feature/base-extension-roadmap
2026-10-01 10:47:10 +00:00
4 changed files with 28 additions and 0 deletions
+8
View File
@@ -60,6 +60,14 @@ func sampleRun() Run {
}
}
func TestGoldenPromptModule(t *testing.T) {
golden(t, "prompt_module_subagent", PromptModule{
ID: "agent.sub.explore", Layer: LayerAgent, Version: 1,
Title: "探索子代理", Body: "只读检索。",
Tools: []string{"knowledge_search", "web_search"}, Model: "lightweight", MaxTurns: 8,
})
}
func TestGoldenDomain(t *testing.T) {
golden(t, "message", sampleMessage())
golden(t, "run", sampleRun())
+4
View File
@@ -26,6 +26,10 @@ type PromptModule struct {
BasedOnVersion int `json:"basedOnVersion,omitempty"` // 用户副本基于的内置版本
Drifted bool `json:"drifted,omitempty"` // 用户副本落后于当前内置版本(提示用,不阻断)
Disabled bool `json:"disabled,omitempty"` // 用户停用
// 子代理 profile。只对 agent.sub.* 有意义;空字段表示沿用内置。
Tools []string `json:"tools,omitempty"`
Model string `json:"model,omitempty"` // lightweight | chat
MaxTurns int `json:"maxTurns,omitempty"`
}
// PromptTrigger 触发条件;模块命中 = 任一 trigger 命中(再过 RequiresAttachments)。
+14
View File
@@ -0,0 +1,14 @@
{
"id": "agent.sub.explore",
"layer": "agent",
"version": 1,
"title": "探索子代理",
"description": "",
"body": "只读检索。",
"tools": [
"knowledge_search",
"web_search"
],
"model": "lightweight",
"maxTurns": 8
}
+2
View File
@@ -209,6 +209,8 @@ export interface PromptModule {
body: string; outputContract?: string;
source?: 'builtin' | 'plugin' | 'user'; owner?: string;
basedOnVersion?: number; drifted?: boolean; disabled?: boolean;
/** 子代理 profile。只对 agent.sub.* 有意义;空字段表示沿用内置。 */
tools?: string[]; model?: string; maxTurns?: number;
}
export interface PromptBlock { moduleId: string; version: number; layer: string; body: string; }