Files
openclaw/src/plugins/hook-skill.types.ts
Vincent Koc 14940edf15 feat(skills): add Skill Workshop lifecycle hooks (#115606)
* feat(skills): add lifecycle hook contracts

* feat(plugins): expose skill hook contracts

* feat(plugins): identify skill evaluators

* feat(skills): persist proposal evaluation lifecycle

* feat(skills): add agent evaluation action

* feat(skills): emit committed skill lifecycle changes

* feat(gateway): expose skill proposal evaluation lifecycle

* feat(ui): add Skill Workshop evaluations

* fix(skills): bind lifecycle state to proposal revisions

* fix(skills): preserve lifecycle events without artifacts

* feat(cli): evaluate skill proposals

* fix(ui): bind evaluations to proposal revisions

* docs(skills): document lifecycle hook primitives

* chore(plugin-sdk): refresh skill hook surface

* fix(skills): harden proposal evaluator execution

* fix(plugins): isolate skill evaluator inputs

* fix(cli): align skill lifecycle deadlines

* fix(skills): preserve evaluation replay invariants

* test(ui): capture Skill Workshop evaluation proof

* fix(skills): bind apply to evaluated target tree

* fix(skills): preserve evaluation contract edges

* fix(skills): bound evaluation event storage

* chore(skills): keep lifecycle helpers internal

* refactor(skills): isolate evaluation persistence

* fix(skills): satisfy lifecycle validation gates

* chore(protocol): refresh Skill Workshop clients

* docs: refresh Skill Workshop map

* chore: keep release notes in PR metadata

* docs: refresh merged docs map

* fix(ci): type Code Mode catch errors

* fix(skills): freeze lifecycle observation payloads

* fix(protocol): keep proposal inspect backward-decodable

* fix(skills): enforce final evaluator bundle limits

* fix(skills): preserve lifecycle caller attribution

* chore: drop subsumed Code Mode formatting

* test(plugins): adapt lifecycle hook mocks
2026-07-29 15:49:44 +08:00

134 lines
3.3 KiB
TypeScript

export type PluginHookSkillProposalKind = "create" | "update";
export type PluginHookSkillBundleFile = {
path: string;
content: string;
encoding: "utf8" | "base64";
sha256: string;
sizeBytes: number;
};
export type PluginHookSkillBundleSnapshot = {
skillMd: PluginHookSkillBundleFile;
files: PluginHookSkillBundleFile[];
treeSha256: string;
};
export type PluginHookSkillProposalEvaluateEvent = {
proposal: {
id: string;
kind: PluginHookSkillProposalKind;
revision: string;
revisionSha256: string;
targetCurrentSha256?: string;
};
skill: {
name: string;
skillKey: string;
description: string;
source?: string;
};
candidate: PluginHookSkillBundleSnapshot;
baseline?: PluginHookSkillBundleSnapshot;
reason: "created" | "revised" | "manual" | "apply";
};
export type PluginHookSkillEvaluationFinding = {
ruleId: string;
severity: "info" | "warn" | "critical";
message: string;
file?: string;
line?: number;
};
export type PluginHookSkillProposalEvaluateResult = {
summary?: string;
findings?: PluginHookSkillEvaluationFinding[];
metrics?: Record<string, string | number | boolean>;
/** Version of the underlying evaluator or ruleset, separate from the plugin package. */
evaluatorVersion?: string;
/** Bounded evaluator mode label such as `static`, `llm`, or `baseline-comparison`. */
mode?: string;
decision?: "pass" | "revise" | "block";
decisionReason?: string;
};
type PluginHookSkillProposalEvaluationAttribution = {
evaluatorId: string;
pluginId: string;
pluginVersion?: string;
};
export type PluginHookSkillProposalEvaluationOutcome =
| (PluginHookSkillProposalEvaluationAttribution & {
status: "completed";
result: PluginHookSkillProposalEvaluateResult;
})
| (PluginHookSkillProposalEvaluationAttribution & {
status: "skipped";
})
| (PluginHookSkillProposalEvaluationAttribution & {
status: "error";
error: string;
});
export type PluginHookSkillArtifact = {
name: string;
skillKey: string;
description?: string;
skillFile: string;
skillDir: string;
source: string;
revision: {
declaredVersion?: string;
contentSha256: string;
treeSha256: string;
sourceVersion?: string;
};
};
export type PluginHookSkillChangedEvent = {
action: "created" | "updated" | "removed";
source: "workshop" | "clawhub" | "source-install" | "upload";
occurredAt: string;
before?: PluginHookSkillArtifact;
after?: PluginHookSkillArtifact;
proposal?: {
id: string;
revision: string;
revisionSha256: string;
};
};
export type PluginHookSkillProposalChangedEvent = {
eventId: string;
sequence: number;
action:
| "created"
| "revised"
| "evaluation_completed"
| "applied"
| "rejected"
| "quarantined"
| "stale";
occurredAt: string;
correlationId?: string;
proposal: {
id: string;
kind: PluginHookSkillProposalKind;
status: "pending" | "applied" | "rejected" | "quarantined" | "stale";
revision: string;
revisionSha256: string;
skillName: string;
skillKey: string;
skillFile: string;
source?: string;
};
evaluations?: readonly PluginHookSkillProposalEvaluationOutcome[];
};
export type PluginHookSkillContext = {
workspaceDir: string;
agentId?: string;
};