@vellumai/assistant 0.12.2-staging.5 → 0.12.2-staging.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Dockerfile +7 -7
- package/openapi.yaml +151 -53
- package/package.json +5 -4
- package/scripts/bundled-plugin-packages.ts +154 -0
- package/scripts/generate-bundled-plugin-packages.ts +29 -0
- package/scripts/test.ts +15 -13
- package/src/__tests__/managed-store.test.ts +121 -0
- package/src/__tests__/scaffold-managed-skill-tool.test.ts +88 -0
- package/src/calls/__tests__/voice-control-protocol.test.ts +24 -2
- package/src/calls/__tests__/voice-session-bridge.test.ts +22 -2
- package/src/calls/voice-control-protocol.ts +13 -4
- package/src/calls/voice-session-bridge.ts +27 -6
- package/src/cli/commands/__tests__/plugins.test.ts +66 -0
- package/src/cli/commands/plugins.ts +50 -18
- package/src/cli/lib/__tests__/install-from-github.test.ts +67 -0
- package/src/cli/lib/__tests__/local-plugin-upgrade.test.ts +169 -0
- package/src/cli/lib/__tests__/plugin-catalog-cache.test.ts +57 -0
- package/src/cli/lib/__tests__/plugin-catalog-platform.test.ts +14 -0
- package/src/cli/lib/__tests__/plugin-catalog-resolve.test.ts +27 -1
- package/src/cli/lib/__tests__/plugin-details.test.ts +9 -2
- package/src/cli/lib/__tests__/plugin-marketplace.test.ts +20 -0
- package/src/cli/lib/__tests__/plugins-install-offline.test.ts +43 -0
- package/src/cli/lib/__tests__/search-plugins.test.ts +31 -0
- package/src/cli/lib/bundled-plugin-packages.json +4 -0
- package/src/cli/lib/bundled-plugin-packages.ts +87 -0
- package/src/cli/lib/diff-plugin.ts +1 -1
- package/src/cli/lib/inspect-plugin.ts +80 -12
- package/src/cli/lib/install-from-github.ts +133 -76
- package/src/cli/lib/plugin-catalog-cache.ts +22 -3
- package/src/cli/lib/plugin-catalog-local.ts +13 -3
- package/src/cli/lib/plugin-catalog-platform.ts +6 -1
- package/src/cli/lib/plugin-catalog-resolve.ts +20 -0
- package/src/cli/lib/plugin-details.ts +12 -0
- package/src/cli/lib/plugin-marketplace.ts +121 -21
- package/src/cli/lib/plugin-pin-history.ts +5 -2
- package/src/cli/lib/search-plugins.ts +58 -16
- package/src/cli/lib/upgrade-plugin.ts +48 -3
- package/src/config/bundled-skills/skill-management/SKILL.md +1 -1
- package/src/config/bundled-skills/skill-management/TOOLS.json +6 -6
- package/src/daemon/conversation-tool-setup.ts +4 -22
- package/src/live-voice/__tests__/live-voice-vad.test.ts +624 -3
- package/src/live-voice/__tests__/session-controls.test.ts +18 -0
- package/src/live-voice/live-voice-session.ts +575 -53
- package/src/live-voice/session-controls.ts +7 -3
- package/src/monitoring/plugin-auto-update.ts +6 -0
- package/src/plugins/defaults/memory/__tests__/memory-retrospective-prompt.test.ts +5 -0
- package/src/plugins/defaults/memory/memory-retrospective-prompt.ts +1 -1
- package/src/runtime/routes/__tests__/plugins-routes.test.ts +102 -0
- package/src/runtime/routes/plugins-routes.ts +69 -49
- package/src/skills/managed-store.ts +98 -32
- package/src/tools/skills/find-similar-skills.test.ts +3 -0
- package/src/tools/skills/resolve-execute-invocation.ts +24 -0
- package/src/tools/skills/scaffold-managed.ts +16 -13
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
NORMAL_UPDATES_MARKER,
|
|
9
9
|
parseTerminalSessionControl,
|
|
10
10
|
type SessionControlRequest,
|
|
11
|
+
TASK_STOP_MARKER,
|
|
11
12
|
} from "../calls/voice-control-protocol.js";
|
|
12
13
|
import type { VoiceProgressConfig } from "../config/schemas/voice.js";
|
|
13
14
|
import type { LiveVoiceSessionControl } from "./protocol.js";
|
|
@@ -86,6 +87,8 @@ export function lookFollowUpNote(action: LookSessionControl): string {
|
|
|
86
87
|
// to carry it out.
|
|
87
88
|
const UPDATES_LINE = `- To hear fewer spoken progress updates while you work (for example "don't give me updates so often"), confirm that you will only check in now and then and will tell them when it is done, then end your reply with ${FEWER_UPDATES_MARKER}. If they later want regular updates back, confirm and end with ${NORMAL_UPDATES_MARKER}.`;
|
|
88
89
|
|
|
90
|
+
const TASK_STOP_LINE = `- To abandon the unfinished task while keeping the call open (for example "stop that" or "never mind about that task"), confirm briefly, then end your reply with ${TASK_STOP_MARKER}. Use this only when they want the task abandoned, not when they interrupt with a question or correction.`;
|
|
91
|
+
|
|
89
92
|
/**
|
|
90
93
|
* The control-prompt block that teaches the session controls: the ones the
|
|
91
94
|
* client declared plus the progress-update cadence. Every leg gets it,
|
|
@@ -98,7 +101,7 @@ const UPDATES_LINE = `- To hear fewer spoken progress updates while you work (fo
|
|
|
98
101
|
export function sessionControlTeaching(
|
|
99
102
|
controls: readonly LiveVoiceSessionControl[],
|
|
100
103
|
leg: { frontDoor?: boolean },
|
|
101
|
-
client: { lookFrames?: boolean } = {},
|
|
104
|
+
client: { lookFrames?: boolean; unfinishedTaskPending?: boolean } = {},
|
|
102
105
|
): string {
|
|
103
106
|
const lines =
|
|
104
107
|
client.lookFrames === true
|
|
@@ -109,6 +112,7 @@ export function sessionControlTeaching(
|
|
|
109
112
|
...controls.map((control) => lines[control]),
|
|
110
113
|
...lookGuidance(controls),
|
|
111
114
|
UPDATES_LINE,
|
|
115
|
+
...(client.unfinishedTaskPending === true ? [TASK_STOP_LINE] : []),
|
|
112
116
|
`The marker must be the very last thing in your reply. It is never spoken and does nothing anywhere else.${leg.frontDoor === true ? "" : " Never emit any other bracketed marker."}`,
|
|
113
117
|
].join("\n");
|
|
114
118
|
}
|
|
@@ -137,7 +141,7 @@ function lookGuidance(controls: readonly LiveVoiceSessionControl[]): string[] {
|
|
|
137
141
|
/** A session control the client carries out, sent as a `session_control` frame. */
|
|
138
142
|
export type ClientSessionControlRequest = Exclude<
|
|
139
143
|
SessionControlRequest,
|
|
140
|
-
{ action: "updates" }
|
|
144
|
+
{ action: "updates" } | { action: "task_stop" }
|
|
141
145
|
>;
|
|
142
146
|
|
|
143
147
|
/**
|
|
@@ -154,7 +158,7 @@ export function requestedSessionControl(
|
|
|
154
158
|
if (request === null) {
|
|
155
159
|
return null;
|
|
156
160
|
}
|
|
157
|
-
if (request.action === "updates") {
|
|
161
|
+
if (request.action === "updates" || request.action === "task_stop") {
|
|
158
162
|
return request;
|
|
159
163
|
}
|
|
160
164
|
return controls.includes(request.action) ? request : null;
|
|
@@ -155,6 +155,12 @@ function tracksCuratedSource(inspection: PluginInspection): boolean {
|
|
|
155
155
|
if (!remote) {
|
|
156
156
|
return false;
|
|
157
157
|
}
|
|
158
|
+
if (source.kind === "local") {
|
|
159
|
+
return remote.kind === "local" && source.path === remote.path;
|
|
160
|
+
}
|
|
161
|
+
if (remote.kind === "local") {
|
|
162
|
+
return false;
|
|
163
|
+
}
|
|
158
164
|
return (
|
|
159
165
|
`${source.owner}/${source.repo}`.toLowerCase() ===
|
|
160
166
|
remote.repo.toLowerCase() && (source.path ?? "") === remote.path
|
|
@@ -125,6 +125,11 @@ For everything else in your review window, use the \`remember\` tool on facts, p
|
|
|
125
125
|
expect(out).toContain(
|
|
126
126
|
"restate `current.activation_hints` (revised only if the procedure's triggers changed",
|
|
127
127
|
);
|
|
128
|
+
// The store keeps omitted frontmatter on an overwrite, so the pass is told
|
|
129
|
+
// to leave unchanged fields out rather than restate them from memory.
|
|
130
|
+
expect(out).toContain(
|
|
131
|
+
"an omitted field keeps its current value and an empty one clears it",
|
|
132
|
+
);
|
|
128
133
|
// An UPDATE is announced by a notice whose only account of the change is
|
|
129
134
|
// what the pass passes here, so the instruction has to ask for it.
|
|
130
135
|
expect(out).toContain(
|
|
@@ -223,7 +223,7 @@ If your review window contains a PROCEDURE you actually carried out — a sequen
|
|
|
223
223
|
|
|
224
224
|
When you do capture a procedure:
|
|
225
225
|
|
|
226
|
-
1. Deduplicate against existing skills first. Call \`find_similar_skills\` with the procedure's goal as its \`goal\` argument. Each hit carries a \`source\` (bundled, managed, plugin, workspace, or extra), and a managed hit also carries \`author\` (\`"assistant"\` if you authored it, \`"user"\` if a person did, omitted if untagged). You may only overwrite or refine a skill YOU authored: a hit with \`source: "managed"\` AND \`author: "assistant"\`. ANY other hit means the procedure is ALREADY COVERED: a non-managed source (bundled, plugin, workspace, or extra), OR a managed skill that is NOT \`author: "assistant"\` (a person wrote it, or it is untagged). For an ALREADY COVERED hit do not \`overwrite\` it, do not shadow it by creating a skill with its \`skill_id\`, and do not create a near-duplicate. Skip it. Only when a returned skill is one of your own (\`source: "managed"\`, \`author: "assistant"\`) and is the SAME procedure, UPDATE it. Such a hit carries \`current\`: the skill as it is now, in \`scaffold_managed_skill\`'s own argument names. Call \`scaffold_managed_skill\` with that \`skill_id\` and \`overwrite: true\`, rewriting \`body_markdown\` from \`current.body_markdown\` plus what you actually observed in the trace (keep the steps the trace did not contradict; correct or add the ones it did), restate \`current.activation_hints\` (revised only if the procedure's triggers changed; they are the skill's retrieval signal, not something to regenerate) and
|
|
226
|
+
1. Deduplicate against existing skills first. Call \`find_similar_skills\` with the procedure's goal as its \`goal\` argument. Each hit carries a \`source\` (bundled, managed, plugin, workspace, or extra), and a managed hit also carries \`author\` (\`"assistant"\` if you authored it, \`"user"\` if a person did, omitted if untagged). You may only overwrite or refine a skill YOU authored: a hit with \`source: "managed"\` AND \`author: "assistant"\`. ANY other hit means the procedure is ALREADY COVERED: a non-managed source (bundled, plugin, workspace, or extra), OR a managed skill that is NOT \`author: "assistant"\` (a person wrote it, or it is untagged). For an ALREADY COVERED hit do not \`overwrite\` it, do not shadow it by creating a skill with its \`skill_id\`, and do not create a near-duplicate. Skip it. Only when a returned skill is one of your own (\`source: "managed"\`, \`author: "assistant"\`) and is the SAME procedure, UPDATE it. Such a hit carries \`current\`: the skill as it is now, in \`scaffold_managed_skill\`'s own argument names. Call \`scaffold_managed_skill\` with that \`skill_id\` and \`overwrite: true\`, rewriting \`body_markdown\` from \`current.body_markdown\` plus what you actually observed in the trace (keep the steps the trace did not contradict; correct or add the ones it did), restate \`current.activation_hints\` (revised only if the procedure's triggers changed; they are the skill's retrieval signal, not something to regenerate) and leave out any other \`current\` field you are not changing (\`emoji\`, \`category\`, \`includes\`, \`avoid_when\`): an omitted field keeps its current value and an empty one clears it, and pass \`change_summary\` (the update is rejected without it): one or two short sentences (under 200 characters) for the person who reads the "Skill updated" notice, naming what you changed and what in the trace prompted it (for example "Added the retry after an expired session and the export endpoint that held steady."). The notice shows nothing else about the change, so name the concrete step, value, or gotcha rather than saying the skill was refined. Only CREATE a new skill (fresh \`skill_id\`) when no existing skill of any source covers the procedure. Bias strongly toward reusing or refining your own skills over spawning near-duplicates.
|
|
227
227
|
|
|
228
228
|
2. Capture procedure-scoped knowledge alongside the body. Failure modes, gotchas, and cached values you observed in the trace (error signatures and how you recovered, preconditions, IDs/paths/endpoints that held steady) belong in companion files passed via \`scaffold_managed_skill\`'s \`files\` input (for example \`references/failure-modes.md\`), and the SKILL.md body should reference them so a future load surfaces them.
|
|
229
229
|
|
|
@@ -1082,6 +1082,64 @@ describe("GET /v1/plugins/search", () => {
|
|
|
1082
1082
|
expect("icon" in byName.get("plain-plugin")!).toBe(false);
|
|
1083
1083
|
});
|
|
1084
1084
|
|
|
1085
|
+
test("preserves a bundled MCP package source and integration metadata", async () => {
|
|
1086
|
+
getCatalogSpy.mockImplementation(async (ref) =>
|
|
1087
|
+
catalog(ref, [
|
|
1088
|
+
{
|
|
1089
|
+
name: "fathom",
|
|
1090
|
+
path: "local:plugins/mcp-catalog/fathom@1.0.0",
|
|
1091
|
+
description: "Search meeting transcripts.",
|
|
1092
|
+
category: null,
|
|
1093
|
+
integration: {
|
|
1094
|
+
kind: "mcp",
|
|
1095
|
+
displayName: "Fathom",
|
|
1096
|
+
documentationUrl: "https://example.com/fathom/docs",
|
|
1097
|
+
verifiedAt: "2026-09-15",
|
|
1098
|
+
verification: "documentation-only",
|
|
1099
|
+
setup: {
|
|
1100
|
+
mode: "oauth",
|
|
1101
|
+
instructions: "Connect your Fathom account.",
|
|
1102
|
+
},
|
|
1103
|
+
logo: "fathom.png",
|
|
1104
|
+
},
|
|
1105
|
+
source: {
|
|
1106
|
+
kind: "local",
|
|
1107
|
+
path: "plugins/mcp-catalog/fathom",
|
|
1108
|
+
version: "1.0.0",
|
|
1109
|
+
},
|
|
1110
|
+
},
|
|
1111
|
+
]),
|
|
1112
|
+
);
|
|
1113
|
+
|
|
1114
|
+
const result = await invokeSearch({ queryParams: { q: "fathom" } });
|
|
1115
|
+
|
|
1116
|
+
expect(result.matches).toEqual([
|
|
1117
|
+
{
|
|
1118
|
+
name: "fathom",
|
|
1119
|
+
path: "local:plugins/mcp-catalog/fathom@1.0.0",
|
|
1120
|
+
description: "Search meeting transcripts.",
|
|
1121
|
+
category: null,
|
|
1122
|
+
integration: {
|
|
1123
|
+
kind: "mcp",
|
|
1124
|
+
displayName: "Fathom",
|
|
1125
|
+
documentationUrl: "https://example.com/fathom/docs",
|
|
1126
|
+
verifiedAt: "2026-09-15",
|
|
1127
|
+
verification: "documentation-only",
|
|
1128
|
+
setup: {
|
|
1129
|
+
mode: "oauth",
|
|
1130
|
+
instructions: "Connect your Fathom account.",
|
|
1131
|
+
},
|
|
1132
|
+
logo: "fathom.png",
|
|
1133
|
+
},
|
|
1134
|
+
source: {
|
|
1135
|
+
kind: "local",
|
|
1136
|
+
path: "plugins/mcp-catalog/fathom",
|
|
1137
|
+
version: "1.0.0",
|
|
1138
|
+
},
|
|
1139
|
+
},
|
|
1140
|
+
]);
|
|
1141
|
+
});
|
|
1142
|
+
|
|
1085
1143
|
test("normalizes match categories to the Skills taxonomy (`developer` → `development`, `hobby` → null)", async () => {
|
|
1086
1144
|
getCatalogSpy.mockImplementation(async (ref) =>
|
|
1087
1145
|
catalog(ref, [
|
|
@@ -1607,6 +1665,50 @@ describe("POST /v1/plugins/install", () => {
|
|
|
1607
1665
|
}
|
|
1608
1666
|
});
|
|
1609
1667
|
|
|
1668
|
+
test("installs a bundled package from the exact catalog source", async () => {
|
|
1669
|
+
getCatalogSpy.mockImplementation(async (ref) =>
|
|
1670
|
+
catalog(ref, [
|
|
1671
|
+
{
|
|
1672
|
+
name: "fathom",
|
|
1673
|
+
path: "local:plugins/mcp-catalog/fathom@1.0.0",
|
|
1674
|
+
category: null,
|
|
1675
|
+
source: {
|
|
1676
|
+
kind: "local",
|
|
1677
|
+
path: "plugins/mcp-catalog/fathom",
|
|
1678
|
+
version: "1.0.0",
|
|
1679
|
+
},
|
|
1680
|
+
},
|
|
1681
|
+
]),
|
|
1682
|
+
);
|
|
1683
|
+
installSpy.mockImplementation(async (opts) => ({
|
|
1684
|
+
name: opts.name,
|
|
1685
|
+
target: `/workspace/.vellum/plugins/${opts.name}`,
|
|
1686
|
+
fileCount: 2,
|
|
1687
|
+
ref: "1.0.0",
|
|
1688
|
+
commit: null,
|
|
1689
|
+
committedAt: null,
|
|
1690
|
+
}));
|
|
1691
|
+
|
|
1692
|
+
const result = await invokeInstall({ body: { name: "fathom" } });
|
|
1693
|
+
|
|
1694
|
+
expect(installSpy.mock.calls[0]?.[0]).toEqual({
|
|
1695
|
+
name: "fathom",
|
|
1696
|
+
force: undefined,
|
|
1697
|
+
trustedSource: {
|
|
1698
|
+
kind: "local",
|
|
1699
|
+
path: "plugins/mcp-catalog/fathom",
|
|
1700
|
+
version: "1.0.0",
|
|
1701
|
+
},
|
|
1702
|
+
});
|
|
1703
|
+
expect(result).toEqual({
|
|
1704
|
+
ok: true,
|
|
1705
|
+
name: "fathom",
|
|
1706
|
+
target: "/workspace/.vellum/plugins/fathom",
|
|
1707
|
+
fileCount: 2,
|
|
1708
|
+
ref: "1.0.0",
|
|
1709
|
+
});
|
|
1710
|
+
});
|
|
1711
|
+
|
|
1610
1712
|
test("publishes sync_changed(plugins:list) on a successful install", async () => {
|
|
1611
1713
|
installSpy.mockImplementation(async (opts) => trustedInstallResult(opts));
|
|
1612
1714
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Route handlers for the assistant plugins surface.
|
|
3
3
|
*
|
|
4
4
|
* GET /v1/plugins — list installed plugins under `<workspaceDir>/plugins/`.
|
|
5
|
-
* GET /v1/plugins/search
|
|
5
|
+
* GET /v1/plugins/search - search the reviewed catalog of installable plugins.
|
|
6
6
|
* GET /v1/plugins/:name — resolve a single plugin's detail view (metadata + README).
|
|
7
7
|
* POST /v1/plugins/install — install a plugin by name from the canonical source.
|
|
8
8
|
* DELETE /v1/plugins/:name — uninstall a plugin from `<workspaceDir>/plugins/<name>/`.
|
|
@@ -192,30 +192,47 @@ const pluginsListResponseSchema = z.object({
|
|
|
192
192
|
});
|
|
193
193
|
|
|
194
194
|
const pluginMatchSourceSchema = z
|
|
195
|
-
.
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
195
|
+
.discriminatedUnion("kind", [
|
|
196
|
+
z.object({
|
|
197
|
+
kind: z.literal("github"),
|
|
198
|
+
repo: z
|
|
199
|
+
.string()
|
|
200
|
+
.describe("`owner/repo` of the external plugin repository."),
|
|
201
|
+
path: z
|
|
202
|
+
.string()
|
|
203
|
+
.optional()
|
|
204
|
+
.describe(
|
|
205
|
+
"Directory within the repo, when the plugin is not at the root.",
|
|
206
|
+
),
|
|
207
|
+
ref: z.string().describe("Pinned git ref the plugin is fetched from."),
|
|
208
|
+
}),
|
|
209
|
+
z.object({
|
|
210
|
+
kind: z.literal("local"),
|
|
211
|
+
path: z.string().describe("Package key in the assistant bundle."),
|
|
212
|
+
version: z.string().describe("Bundled package version."),
|
|
213
|
+
}),
|
|
214
|
+
])
|
|
215
|
+
.describe("Reviewed source of the marketplace entry.");
|
|
216
|
+
|
|
217
|
+
const mcpPluginIntegrationSchema = z.object({
|
|
218
|
+
kind: z.literal("mcp"),
|
|
219
|
+
displayName: z.string(),
|
|
220
|
+
documentationUrl: z.string(),
|
|
221
|
+
verifiedAt: z.string(),
|
|
222
|
+
verification: z.literal("documentation-only"),
|
|
223
|
+
setup: z.object({
|
|
224
|
+
mode: z.enum(["oauth", "manual"]),
|
|
225
|
+
instructions: z.string(),
|
|
226
|
+
}),
|
|
227
|
+
logo: z.string(),
|
|
228
|
+
oauthProvider: z.string().optional(),
|
|
229
|
+
});
|
|
209
230
|
|
|
210
231
|
const pluginSearchMatchSchema = z.object({
|
|
211
232
|
name: z
|
|
212
233
|
.string()
|
|
213
234
|
.describe("Install name. Matches `assistant plugins install <name>`."),
|
|
214
|
-
path: z
|
|
215
|
-
.string()
|
|
216
|
-
.describe(
|
|
217
|
-
"Human-readable origin: a `github:owner/repo@ref` locator for the external plugin.",
|
|
218
|
-
),
|
|
235
|
+
path: z.string().describe("Human-readable catalog origin locator."),
|
|
219
236
|
description: z
|
|
220
237
|
.string()
|
|
221
238
|
.optional()
|
|
@@ -232,6 +249,7 @@ const pluginSearchMatchSchema = z.object({
|
|
|
232
249
|
.describe(
|
|
233
250
|
"Marketplace category slug (Skills taxonomy); null when the entry declares none.",
|
|
234
251
|
),
|
|
252
|
+
integration: mcpPluginIntegrationSchema.optional(),
|
|
235
253
|
source: pluginMatchSourceSchema,
|
|
236
254
|
});
|
|
237
255
|
|
|
@@ -418,22 +436,20 @@ const fingerprintComparisonSchema = z
|
|
|
418
436
|
);
|
|
419
437
|
|
|
420
438
|
const installMetaSourceSchema = z
|
|
421
|
-
.
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
.string()
|
|
427
|
-
.
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
),
|
|
431
|
-
|
|
432
|
-
.string()
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
),
|
|
436
|
-
})
|
|
439
|
+
.discriminatedUnion("kind", [
|
|
440
|
+
z.object({
|
|
441
|
+
kind: z.literal("github"),
|
|
442
|
+
owner: z.string(),
|
|
443
|
+
repo: z.string(),
|
|
444
|
+
path: z.string().optional(),
|
|
445
|
+
ref: z.string(),
|
|
446
|
+
}),
|
|
447
|
+
z.object({
|
|
448
|
+
kind: z.literal("local"),
|
|
449
|
+
path: z.string(),
|
|
450
|
+
version: z.string(),
|
|
451
|
+
}),
|
|
452
|
+
])
|
|
437
453
|
.describe(
|
|
438
454
|
"Source coordinates recorded in the install-time provenance sidecar.",
|
|
439
455
|
);
|
|
@@ -489,6 +505,7 @@ const pluginLocalInfoSchema = z
|
|
|
489
505
|
|
|
490
506
|
const pluginRemoteInfoSchema = z
|
|
491
507
|
.object({
|
|
508
|
+
kind: z.literal("local").optional(),
|
|
492
509
|
repo: z
|
|
493
510
|
.string()
|
|
494
511
|
.describe("`owner/repo` of the external plugin repository."),
|
|
@@ -517,6 +534,7 @@ const pluginRemoteInfoSchema = z
|
|
|
517
534
|
.describe(
|
|
518
535
|
"Ref of the canonical repo the marketplace manifest was read from.",
|
|
519
536
|
),
|
|
537
|
+
version: z.string().optional().describe("Bundled package version."),
|
|
520
538
|
})
|
|
521
539
|
.describe("The marketplace's current pin and advertised metadata.");
|
|
522
540
|
|
|
@@ -870,7 +888,8 @@ interface PluginMatchView {
|
|
|
870
888
|
description?: string;
|
|
871
889
|
icon?: string;
|
|
872
890
|
category: string | null;
|
|
873
|
-
|
|
891
|
+
integration?: PluginSearchMatch["integration"];
|
|
892
|
+
source: PluginSearchMatch["source"];
|
|
874
893
|
}
|
|
875
894
|
|
|
876
895
|
/**
|
|
@@ -886,12 +905,7 @@ function projectMatch(
|
|
|
886
905
|
name: m.name,
|
|
887
906
|
path: m.path,
|
|
888
907
|
category: normalizeMarketplaceCategory(m.category, validSlugs),
|
|
889
|
-
source: {
|
|
890
|
-
kind: "github",
|
|
891
|
-
repo: m.source.repo,
|
|
892
|
-
ref: m.source.ref,
|
|
893
|
-
...(m.source.path !== undefined ? { path: m.source.path } : {}),
|
|
894
|
-
},
|
|
908
|
+
source: { ...m.source },
|
|
895
909
|
};
|
|
896
910
|
if (m.description !== undefined) {
|
|
897
911
|
view.description = m.description;
|
|
@@ -899,6 +913,9 @@ function projectMatch(
|
|
|
899
913
|
if (m.icon !== undefined) {
|
|
900
914
|
view.icon = m.icon;
|
|
901
915
|
}
|
|
916
|
+
if (m.integration !== undefined) {
|
|
917
|
+
view.integration = m.integration;
|
|
918
|
+
}
|
|
902
919
|
return view;
|
|
903
920
|
}
|
|
904
921
|
|
|
@@ -1276,12 +1293,15 @@ async function handleInstallPlugin({ body = {}, headers }: RouteHandlerArgs) {
|
|
|
1276
1293
|
{
|
|
1277
1294
|
name,
|
|
1278
1295
|
force,
|
|
1279
|
-
trustedSource:
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1296
|
+
trustedSource:
|
|
1297
|
+
source.kind === "local"
|
|
1298
|
+
? source
|
|
1299
|
+
: {
|
|
1300
|
+
owner: source.owner,
|
|
1301
|
+
repo: source.repo,
|
|
1302
|
+
rootPath: source.path,
|
|
1303
|
+
ref: source.ref,
|
|
1304
|
+
},
|
|
1285
1305
|
},
|
|
1286
1306
|
{ fetch: globalThis.fetch.bind(globalThis) },
|
|
1287
1307
|
);
|
|
@@ -18,6 +18,7 @@ import { parseFrontmatter } from "../config/skills.js";
|
|
|
18
18
|
import { deleteSkillCapabilityNode } from "../plugins/defaults/memory/graph/capability-seed.js";
|
|
19
19
|
import { isDeniedBasename } from "../tools/shared/filesystem/path-policy.js";
|
|
20
20
|
import { getLogger } from "../util/logger.js";
|
|
21
|
+
import { isPlainObject } from "../util/object.js";
|
|
21
22
|
import { getWorkspaceDir, getWorkspaceSkillsDir } from "../util/platform.js";
|
|
22
23
|
import { parseFrontmatterFields } from "./frontmatter.js";
|
|
23
24
|
import { writeInstallMeta } from "./install-meta.js";
|
|
@@ -212,11 +213,48 @@ interface BuildSkillMarkdownInput {
|
|
|
212
213
|
name: string;
|
|
213
214
|
description: string;
|
|
214
215
|
bodyMarkdown: string;
|
|
216
|
+
/**
|
|
217
|
+
* The five fields the scaffold tool owns. `undefined` leaves whatever
|
|
218
|
+
* `preserve` carries for that field (nothing, on a create); an empty value
|
|
219
|
+
* clears it; a value sets it.
|
|
220
|
+
*/
|
|
215
221
|
emoji?: string;
|
|
216
222
|
includes?: string[];
|
|
217
223
|
activationHints?: string[];
|
|
218
224
|
avoidWhen?: string[];
|
|
219
225
|
category?: string;
|
|
226
|
+
/**
|
|
227
|
+
* The skill's existing frontmatter, as parsed from disk, for an overwrite.
|
|
228
|
+
* Every key survives except `name`, `description`, and the five fields
|
|
229
|
+
* above, so a `platforms` gate, a `display-name`, or custom metadata a
|
|
230
|
+
* person added by hand is not lost to a call that never mentions it.
|
|
231
|
+
*/
|
|
232
|
+
preserve?: Record<string, unknown>;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Apply one tool-owned field to the vellum block: an input left `undefined`
|
|
237
|
+
* keeps the preserved value, an input given but empty (`value` undefined)
|
|
238
|
+
* clears it, and a value sets it.
|
|
239
|
+
*/
|
|
240
|
+
function setOrClear(
|
|
241
|
+
target: Record<string, unknown>,
|
|
242
|
+
key: string,
|
|
243
|
+
value: unknown,
|
|
244
|
+
input: unknown,
|
|
245
|
+
): void {
|
|
246
|
+
if (input === undefined) {
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
if (value === undefined) {
|
|
250
|
+
delete target[key];
|
|
251
|
+
} else {
|
|
252
|
+
target[key] = value;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
function nonEmptyList(list: string[] | undefined): string[] | undefined {
|
|
257
|
+
return list && list.length > 0 ? list : undefined;
|
|
220
258
|
}
|
|
221
259
|
|
|
222
260
|
export function buildSkillMarkdown(input: BuildSkillMarkdownInput): string {
|
|
@@ -230,40 +268,55 @@ export function buildSkillMarkdown(input: BuildSkillMarkdownInput): string {
|
|
|
230
268
|
lines.push(`name: "${esc(input.name)}"`);
|
|
231
269
|
lines.push(`description: "${esc(input.description)}"`);
|
|
232
270
|
|
|
233
|
-
//
|
|
234
|
-
//
|
|
235
|
-
//
|
|
236
|
-
//
|
|
237
|
-
const vellum: Record<string, unknown> = {};
|
|
238
|
-
if (input.emoji) {
|
|
239
|
-
vellum.emoji = input.emoji;
|
|
240
|
-
}
|
|
241
|
-
if (input.includes && input.includes.length > 0) {
|
|
242
|
-
vellum.includes = input.includes;
|
|
243
|
-
}
|
|
244
|
-
// Kebab-case keys match what parseFrontmatter reads back
|
|
245
|
-
// (config/skills.ts: vellum["activation-hints"] / vellum["avoid-when"]).
|
|
246
|
-
// These flow through stringifyYaml below, which escapes/quotes values, so no
|
|
271
|
+
// Everything but name and description is emitted from one object: the
|
|
272
|
+
// preserved frontmatter with the tool-owned fields applied over it, under
|
|
273
|
+
// `metadata.vellum` where parseFrontmatter reads them back (kebab-case for
|
|
274
|
+
// the two list fields). stringifyYaml quotes and escapes values, so no
|
|
247
275
|
// manual sanitization is needed here.
|
|
248
|
-
|
|
249
|
-
|
|
276
|
+
const rest: Record<string, unknown> = structuredClone(input.preserve ?? {});
|
|
277
|
+
delete rest.name;
|
|
278
|
+
delete rest.description;
|
|
279
|
+
const metadata = isPlainObject(rest.metadata) ? rest.metadata : {};
|
|
280
|
+
const vellum = isPlainObject(metadata.vellum) ? metadata.vellum : {};
|
|
281
|
+
setOrClear(vellum, "emoji", input.emoji?.trim() || undefined, input.emoji);
|
|
282
|
+
// An emoji at the legacy `metadata.emoji` location wins over an absent
|
|
283
|
+
// vellum one on read, so a call that states the emoji retires it.
|
|
284
|
+
if (input.emoji !== undefined) {
|
|
285
|
+
delete metadata.emoji;
|
|
250
286
|
}
|
|
251
|
-
|
|
252
|
-
|
|
287
|
+
setOrClear(vellum, "includes", nonEmptyList(input.includes), input.includes);
|
|
288
|
+
setOrClear(
|
|
289
|
+
vellum,
|
|
290
|
+
"activation-hints",
|
|
291
|
+
nonEmptyList(input.activationHints),
|
|
292
|
+
input.activationHints,
|
|
293
|
+
);
|
|
294
|
+
setOrClear(
|
|
295
|
+
vellum,
|
|
296
|
+
"avoid-when",
|
|
297
|
+
nonEmptyList(input.avoidWhen),
|
|
298
|
+
input.avoidWhen,
|
|
299
|
+
);
|
|
300
|
+
// The web Skills UI buckets skills by this value; a blank one is a clear,
|
|
301
|
+
// never an empty bucket in the file.
|
|
302
|
+
setOrClear(
|
|
303
|
+
vellum,
|
|
304
|
+
"category",
|
|
305
|
+
input.category?.trim() || undefined,
|
|
306
|
+
input.category,
|
|
307
|
+
);
|
|
308
|
+
if (Object.keys(vellum).length > 0) {
|
|
309
|
+
metadata.vellum = vellum;
|
|
310
|
+
} else {
|
|
311
|
+
delete metadata.vellum;
|
|
253
312
|
}
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
313
|
+
if (Object.keys(metadata).length > 0) {
|
|
314
|
+
rest.metadata = metadata;
|
|
315
|
+
} else {
|
|
316
|
+
delete rest.metadata;
|
|
258
317
|
}
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
const metadata = { vellum };
|
|
262
|
-
const yamlBlock = stringifyYaml(metadata, { indent: 2 });
|
|
263
|
-
lines.push("metadata:");
|
|
264
|
-
for (const yamlLine of yamlBlock.trimEnd().split("\n")) {
|
|
265
|
-
lines.push(` ${yamlLine}`);
|
|
266
|
-
}
|
|
318
|
+
if (Object.keys(rest).length > 0) {
|
|
319
|
+
lines.push(stringifyYaml(rest, { indent: 2 }).trimEnd());
|
|
267
320
|
}
|
|
268
321
|
|
|
269
322
|
lines.push("---");
|
|
@@ -350,7 +403,8 @@ export function createManagedSkill(
|
|
|
350
403
|
const skillDir = getManagedSkillDir(params.id);
|
|
351
404
|
const skillFilePath = join(skillDir, "SKILL.md");
|
|
352
405
|
|
|
353
|
-
|
|
406
|
+
const skillExists = existsSync(skillFilePath);
|
|
407
|
+
if (skillExists && !params.overwrite) {
|
|
354
408
|
return {
|
|
355
409
|
created: false,
|
|
356
410
|
path: skillFilePath,
|
|
@@ -358,6 +412,14 @@ export function createManagedSkill(
|
|
|
358
412
|
};
|
|
359
413
|
}
|
|
360
414
|
|
|
415
|
+
// An overwrite replaces the body and patches the frontmatter: a field the
|
|
416
|
+
// call leaves undefined keeps its current value, an explicit empty value
|
|
417
|
+
// clears it, and frontmatter the tool does not own passes through. Callers
|
|
418
|
+
// rarely hold every field (the retrospective sees a skill through a
|
|
419
|
+
// similarity hit; a user edit is "change step 3"), so a field they do not
|
|
420
|
+
// pass is kept rather than dropped.
|
|
421
|
+
const existing = skillExists ? readStoredManagedSkill(params.id) : null;
|
|
422
|
+
|
|
361
423
|
// Resolve and validate every companion path before any write so an invalid
|
|
362
424
|
// path leaves no partial files behind.
|
|
363
425
|
const companionWrites: Array<{ resolvedPath: string; content: string }> = [];
|
|
@@ -413,6 +475,7 @@ export function createManagedSkill(
|
|
|
413
475
|
activationHints: params.activationHints,
|
|
414
476
|
avoidWhen: params.avoidWhen,
|
|
415
477
|
category: params.category,
|
|
478
|
+
preserve: existing?.frontmatter,
|
|
416
479
|
});
|
|
417
480
|
|
|
418
481
|
mkdirSync(skillDir, { recursive: true });
|
|
@@ -461,11 +524,13 @@ export function createManagedSkill(
|
|
|
461
524
|
* `{workspaceDir}` and strips feature-gated sections, and a caller that wrote
|
|
462
525
|
* that output back would bake absolute paths into the skill; and a first line
|
|
463
526
|
* that opens an indented code block must keep its indentation or a copy turns
|
|
464
|
-
* it into prose.
|
|
527
|
+
* it into prose. `frontmatter` is the whole block as written, for an
|
|
528
|
+
* overwrite to carry keys through that the typed fields do not cover.
|
|
465
529
|
*/
|
|
466
530
|
export interface StoredManagedSkill {
|
|
467
531
|
name: string;
|
|
468
532
|
description: string;
|
|
533
|
+
frontmatter: Record<string, unknown>;
|
|
469
534
|
emoji?: string;
|
|
470
535
|
includes?: string[];
|
|
471
536
|
activationHints?: string[];
|
|
@@ -493,6 +558,7 @@ export function readStoredManagedSkill(
|
|
|
493
558
|
return {
|
|
494
559
|
name: parsed.name,
|
|
495
560
|
description: parsed.description,
|
|
561
|
+
frontmatter: raw.fields,
|
|
496
562
|
emoji: parsed.emoji,
|
|
497
563
|
includes: parsed.includes,
|
|
498
564
|
activationHints: parsed.activationHints,
|
|
@@ -257,6 +257,7 @@ describe("find_similar_skills: current skill for a refinable hit", () => {
|
|
|
257
257
|
"weekly-export": {
|
|
258
258
|
name: "Weekly Report Export",
|
|
259
259
|
description: "Export the weekly usage report",
|
|
260
|
+
frontmatter: {},
|
|
260
261
|
emoji: "📊",
|
|
261
262
|
category: "productivity",
|
|
262
263
|
includes: ["csv-basics"],
|
|
@@ -267,11 +268,13 @@ describe("find_similar_skills: current skill for a refinable hit", () => {
|
|
|
267
268
|
"user-skill": {
|
|
268
269
|
name: "User Skill",
|
|
269
270
|
description: "A person wrote this",
|
|
271
|
+
frontmatter: {},
|
|
270
272
|
body: "Do the user's thing.",
|
|
271
273
|
},
|
|
272
274
|
"clean-disk": {
|
|
273
275
|
name: "Clean Disk",
|
|
274
276
|
description: "Free up disk space",
|
|
277
|
+
frontmatter: {},
|
|
275
278
|
body: "Delete caches.",
|
|
276
279
|
},
|
|
277
280
|
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { getTool } from "../registry.js";
|
|
2
|
+
import { resolveToolInvocationAlias } from "../tool-name-aliases.js";
|
|
3
|
+
import {
|
|
4
|
+
recoverSkillExecuteEnvelope,
|
|
5
|
+
resolveSkillExecuteInput,
|
|
6
|
+
} from "./execute.js";
|
|
7
|
+
|
|
8
|
+
export function resolveSkillExecuteInvocation(
|
|
9
|
+
input: Record<string, unknown>,
|
|
10
|
+
allowedToolNames?: ReadonlySet<string>,
|
|
11
|
+
): { name: string; input: Record<string, unknown> } {
|
|
12
|
+
const envelope = recoverSkillExecuteEnvelope(input);
|
|
13
|
+
const rawToolName = typeof envelope.tool === "string" ? envelope.tool : "";
|
|
14
|
+
const innerSchema = rawToolName
|
|
15
|
+
? getTool(rawToolName)?.input_schema
|
|
16
|
+
: undefined;
|
|
17
|
+
const rawToolInput = resolveSkillExecuteInput(envelope, innerSchema);
|
|
18
|
+
|
|
19
|
+
return resolveToolInvocationAlias(
|
|
20
|
+
rawToolName,
|
|
21
|
+
{ ...rawToolInput },
|
|
22
|
+
allowedToolNames,
|
|
23
|
+
);
|
|
24
|
+
}
|