Skip to content

Commit 199aabe

Browse files
committed
refactor(protocol): simplify skill and reference contracts
1 parent 8905af5 commit 199aabe

45 files changed

Lines changed: 91 additions & 1226 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎V2_HTTP_API_AUDIT.md‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,15 @@ Review endpoints in document order. For each endpoint, select one disposition an
8888
| [x] 008 | `GET` | `/api/agent` | `agent.list` | Keep | Request and response accepted as-is. |
8989
| [x] 009 | `GET` | `/api/agent/{agentID}` | `agent.get` | Keep | Request, response, and not-found error accepted as-is. |
9090
| [x] 010 | `GET` | `/api/plugin` | `plugin.list` | Keep | Request and response accepted as-is. |
91-
| [ ] 012 | `POST` | `/api/plugin/check` | `plugin.check` | | |
92-
| [ ] 013 | `POST` | `/api/plugin/update` | `plugin.update` | | |
93-
| [ ] 014 | `GET` | `/api/model` | `model.list` | | |
94-
| [ ] 015 | `GET` | `/api/model/default` | `model.default` | | |
95-
| [ ] 016 | `GET` | `/api/provider` | `provider.list` | | |
96-
| [ ] 017 | `GET` | `/api/provider/{providerID}` | `provider.get` | | |
97-
| [ ] 018 | `GET` | `/api/command` | `command.list` | | |
98-
| [ ] 019 | `GET` | `/api/skill` | `skill.list` | | |
99-
| [ ] 020 | `GET` | `/api/reference` | `reference.list` | | |
91+
| [x] 012 | `POST` | `/api/plugin/check` | `plugin.check` | Keep | Request and response accepted as-is. |
92+
| [x] 013 | `POST` | `/api/plugin/update` | `plugin.update` | Keep | Request and errors accepted as-is. |
93+
| [x] 014 | `GET` | `/api/model` | `model.list` | Keep | Request and response accepted as-is. |
94+
| [x] 015 | `GET` | `/api/model/default` | `model.default` | Keep | Request and nullable response accepted as-is. |
95+
| [x] 016 | `GET` | `/api/provider` | `provider.list` | Keep | Request and response accepted as-is. |
96+
| [x] 017 | `GET` | `/api/provider/{providerID}` | `provider.get` | Keep | Request, response, and not-found error accepted as-is. |
97+
| [x] 018 | `GET` | `/api/command` | `command.list` | Keep | Request and response accepted as-is. |
98+
| [x] 019 | `GET` | `/api/skill` | `skill.list` | Keep | Renamed `location` to `path`; removed the skill-specific `slash` flag and slash-command behavior. |
99+
| [x] 020 | `GET` | `/api/reference` | `reference.list` | Keep | Removed duplicate `description` and `hidden` fields from nested `source`. |
100100
| [ ] 021 | `GET` | `/api/config` | `config.get` | | |
101101
| [ ] 022 | `GET` | `/api/config/preferences` | `config.preferences` | | |
102102
| [ ] 023 | `PATCH` | `/api/config/preferences` | `config.updatePreferences` | | |

‎packages/app/e2e/regression/composer-slash-skill.spec.ts‎

Lines changed: 0 additions & 195 deletions
This file was deleted.

‎packages/app/e2e/regression/new-session-summary.spec.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ async function openDraft(page: Page, worktree = "main", options: { git?: boolean
404404
{
405405
id: "summary-skill",
406406
name: "summary-skill",
407-
location: "/skills/summary/SKILL.md",
407+
path: "/skills/summary/SKILL.md",
408408
content: "Summary skill",
409409
},
410410
],

‎packages/app/e2e/regression/session-summary-refresh.spec.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ for (const service of services) {
4242
state: { status: "active" },
4343
},
4444
]
45-
: [{ id: service.item, name: service.item, location: "/skills/summary/SKILL.md", content: "Summary" }]
45+
: [{ id: service.item, name: service.item, path: "/skills/summary/SKILL.md", content: "Summary" }]
4646
return route.fulfill({ json: { location: { directory: fixture.directory }, data: empty ? [] : items } })
4747
},
4848
)

‎packages/app/e2e/regression/session-summary.spec.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,11 +235,11 @@ test("catalog submenus show project plugins and skills, refresh on reopen, and d
235235
json: {
236236
location: { directory: fixture.directory },
237237
data: [
238-
{ id: "find-skills", name: "find-skills", location: "/skills/find/SKILL.md", content: "Find skills" },
238+
{ id: "find-skills", name: "find-skills", path: "/skills/find/SKILL.md", content: "Find skills" },
239239
{
240240
id: "review-animations",
241241
name: "review-animations",
242-
location: "/skills/review/SKILL.md",
242+
path: "/skills/review/SKILL.md",
243243
content: "Review animations",
244244
},
245245
],

‎packages/app/src/composer/editor/actions.test.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,22 +99,22 @@ describe("Composer store", () => {
9999
expect(prompt.state.prompt).toEqual([{ type: "text", content: "old", start: 0, end: 3 }])
100100
})
101101

102-
test("prepends a slash skill to an attachment-only draft without flattening it", () => {
102+
test("prepends a skill mention to an attachment-only draft without flattening it", () => {
103103
const prompt = createPromptStore()
104104
prompt.setPrompt([{ type: "file", path: "one", content: "@one", start: 0, end: 4 }], 4)
105105
prompt.addMention(
106106
{
107107
type: "skill",
108108
id: Skill.ID.make("show-me"),
109109
name: Skill.Name.make("Show Me"),
110-
content: "/show-me",
110+
content: "@show-me",
111111
start: 0,
112112
end: 0,
113113
},
114114
{ start: 0, end: 0 },
115115
)
116116
expect(prompt.state.prompt).toMatchObject([
117-
{ type: "skill", id: "show-me", content: "/show-me", start: 0, end: 8 },
117+
{ type: "skill", id: "show-me", content: "@show-me", start: 0, end: 8 },
118118
{ type: "text", content: " ", start: 8, end: 9 },
119119
{ type: "file", path: "one", content: "@one", start: 9, end: 13 },
120120
])

‎packages/app/src/composer/model.ts‎

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import type { ImageAttachmentPart } from "./state"
2121
import type { PromptHistoryComment } from "./history/entry"
2222
import { createComposerHistory } from "./history/store"
2323
import { composerPlaceholder } from "./placeholder"
24-
import { createComposerSubmit, withSlashSkill } from "./submit"
24+
import { createComposerSubmit } from "./submit"
2525

2626
export type ComposerModel = ComposerEditorModel & {
2727
readonly model: ComposerControls["model"]
@@ -243,9 +243,6 @@ export function createComposerModel(adapter: ComposerAdapter, options?: { queue?
243243
type: "builtin" as const,
244244
})),
245245
])
246-
const slashSkills = createMemo(() =>
247-
skills().filter((skill) => skill.slash === true && !slashCommands().some((item) => item.trigger === skill.id)),
248-
)
249246
const commands = createMemo<ComposerSuggestion[]>(() => [
250247
...slashCommands().map((item) => ({
251248
id: item.id,
@@ -256,29 +253,12 @@ export function createComposerModel(adapter: ComposerAdapter, options?: { queue?
256253
description: item.description,
257254
keybind: command.keybindParts(item.id),
258255
})),
259-
...slashSkills().map((skill) => ({
260-
id: `skill:${skill.id}`,
261-
kind: "skill" as const,
262-
label: `/${skill.id}`,
263-
trigger: skill.id,
264-
title: skill.name,
265-
description: skill.description,
266-
mention: {
267-
type: "skill" as const,
268-
id: Skill.ID.make(skill.id),
269-
name: Skill.Name.make(skill.name),
270-
content: `/${skill.id}`,
271-
start: 0,
272-
end: 0,
273-
},
274-
})),
275256
])
276257
const variants = createMemo(() => ["default", ...adapter.controls().model.selection.variant.list()])
277258
const submission = createComposerSubmit({
278259
adapter,
279260
mode,
280261
commands: () => data.location.command.list({ directory: sdk().directory }),
281-
skills: slashSkills,
282262
editor: () => editor,
283263
queueScroll: () => requestAnimationFrame(() => editor?.scrollIntoView({ block: "nearest" })),
284264
addToHistory: (value, mode) => controller.addHistory(value, mode),
@@ -407,7 +387,6 @@ export function createComposerModel(adapter: ComposerAdapter, options?: { queue?
407387
// the composer value as a new prompt. Enter keeps it queued in
408388
// place; the alternate action sends it as a steer.
409389
if (queue?.editing()) {
410-
prompt.set(withSlashSkill(prompt.current(), slashSkills()))
411390
queue.confirmEdit(submitOptions?.alternate ? "steer" : "queue")
412391
return
413392
}

0 commit comments

Comments
 (0)