feat(core): add native skill activation

This commit is contained in:
Dax Raad
2026-06-30 01:16:33 -04:00
parent 524ee8fc03
commit 23adaaaeab
26 changed files with 814 additions and 76 deletions
+9
View File
@@ -80,6 +80,15 @@ export class MessageNotFoundError extends Schema.TaggedErrorClass<MessageNotFoun
{ httpApiStatus: 404 },
) {}
export class SkillNotFoundError extends Schema.TaggedErrorClass<SkillNotFoundError>()(
"SkillNotFoundError",
{
skill: Schema.String,
message: Schema.String,
},
{ httpApiStatus: 404 },
) {}
export class InvalidCursorError extends Schema.TaggedErrorClass<InvalidCursorError>()(
"InvalidCursorError",
{ message: Schema.String },
+21
View File
@@ -15,6 +15,7 @@ import {
ServiceUnavailableError,
SessionBusyError,
SessionNotFoundError,
SkillNotFoundError,
UnknownError,
} from "../errors"
import { Agent } from "@opencode-ai/schema/agent"
@@ -256,6 +257,26 @@ export const makeSessionGroup = <I extends HttpApiMiddleware.AnyId, S>(sessionLo
}),
),
)
.add(
HttpApiEndpoint.post("session.skill", "/api/session/:sessionID/skill", {
params: { sessionID: Session.ID },
payload: Schema.Struct({
id: SessionMessage.ID.pipe(Schema.optional),
skill: Schema.String,
resume: Schema.Boolean.pipe(Schema.optional),
}),
success: HttpApiSchema.NoContent,
error: [SessionNotFoundError, SkillNotFoundError],
})
.middleware(sessionLocationMiddleware)
.annotateMerge(
OpenApi.annotations({
identifier: "v2.session.skill",
summary: "Activate skill",
description: "Activate a skill for a session by appending a skill message and resuming execution.",
}),
),
)
.add(
HttpApiEndpoint.post("session.compact", "/api/session/:sessionID/compact", {
params: { sessionID: Session.ID },