feat(sdk): 插件 SDK(Tool/Skill/Channel 接口 + 注册辅助 + 配置 hook)

This commit is contained in:
Aska committed 2026-09-06 04:35:31 +08:00
1 parent c52ddfd9c7
commit 7b8cfc664a
5 files changed
+409

No files matched your search

+55
View File
@@ -0,0 +1,55 @@
package sdk
// Step is one unit of a Skill's reusable workflow.
type Step struct {
// Name is a short identifier for the step.
Name string
// Prompt is the instruction the model follows for this step.
Prompt string
// Depends lists the Names of steps that must finish before this step runs.
Depends []string
}
// Ref is a reference a Skill may pull in for extra context or shared tooling.
type Ref struct {
// Name identifies the reference.
Name string
// Type is a free-form kind, for example "tool", "doc" or "file".
Type string
// Value is the reference payload or pointer.
Value string
// Optional reports whether the reference may be absent without failing.
Optional bool
}
// Guardrail is a constraint a Skill applies while running.
type Guardrail struct {
// ID names the guardrail.
ID string
// Message is the rule text enforced on the workflow.
Message string
// Enforced reports whether a violation aborts the Skill (true) or is only a
// warning (false).
Enforced bool
}
// Skill is a reusable, higher-order workflow: an ordered set of steps paired
// with prompts, references and guardrails. It is more structured than a Tool
// and typically composes several steps.
//
// Implementations must be safe for concurrent use.
type Skill interface {
// Name returns the unique skill identifier.
Name() string
// Description explains what the Skill accomplishes; the model uses it to
// select a Skill for a task.
Description() string
// Prompt returns the base system prompt for the Skill.
Prompt() string
// Steps returns the ordered workflow steps.
Steps() []Step
// Refs returns the references the Skill may draw on.
Refs() []Ref
// Guardrails returns the constraints the Skill enforces.
Guardrails() []Guardrail
}