package core import "encoding/json" // 插件 manifest(4.6):插件 = manifest + 声明资产 + 可选代码。 // 校验失败整批拒绝(fail-closed);卸载注销注册项,在途引用按定义缺失稳定报错。 const PluginAPIVersion = "1.0" type PluginManifest struct { ID string `json:"id"` Name string `json:"name"` Version string `json:"version"` APIVersion string `json:"apiVersion"` Requires PluginRequires `json:"requires,omitempty"` Provides PluginProvides `json:"provides"` } type PluginRequires struct { Network []string `json:"network,omitempty"` // 允许访问的域名(展示用,v1 自装自审) } type PluginProvides struct { Tools []string `json:"tools,omitempty"` // tools/ 目录下的资产名 Workflows []string `json:"workflows,omitempty"` Intents []string `json:"intents,omitempty"` Prompts []string `json:"prompts,omitempty"` Panels []string `json:"panels,omitempty"` Cards []string `json:"cards,omitempty"` Settings []string `json:"settings,omitempty"` } // PluginPanel:右栏面板声明(UI schema 静态骨架 + 可选数据提供者)。 type PluginPanel struct { ID string `json:"id"` Title string `json:"title"` Icon string `json:"icon,omitempty"` Body []UINode `json:"body"` // Tool 绑定:面板挂载时调用该工具刷新 Body 中的动态区(v1 简化为整体刷新)。 RefreshTool string `json:"refreshTool,omitempty"` } // WorkflowDef:工作流即数据(4.6)。Step 可产 HITL 卡片、调工具、产出工件。 type WorkflowDef struct { ID string `json:"id"` Title string `json:"title"` Description string `json:"description,omitempty"` IntentID string `json:"intentId,omitempty"` // 绑定意图(命中即启动) Steps []WorkflowStep `json:"steps"` } type WorkflowStep struct { ID string `json:"id"` Title string `json:"title"` Kind string `json:"kind"` // prompt | tool | hitl | artifact Prompt string `json:"prompt,omitempty"` // prompt: 发给模型的指令模板 Tool string `json:"tool,omitempty"` // tool: 工具名 Args json.RawMessage `json:"args,omitempty"` // tool: 参数模板 Hitl *HITLCardTemplate `json:"hitl,omitempty"` // hitl: 卡片模板 Artifact string `json:"artifact,omitempty"` // artifact: 产出工件名模板 } type HITLCardTemplate struct { Question string `json:"question"` Kind HITLKind `json:"kind"` Choices []HITLChoice `json:"choices,omitempty"` AllowFreeInput bool `json:"allowFreeInput"` FreeInputHint string `json:"freeInputHint,omitempty"` }