@vetta-org/plugin-sdk 0.2.0 → 0.3.0
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/dist/agent.d.ts +0 -12
- package/dist/agent.d.ts.map +1 -1
- package/dist/agent.js.map +1 -1
- package/dist/ai.d.ts +13 -0
- package/dist/ai.d.ts.map +1 -1
- package/dist/ai.js.map +1 -1
- package/dist/app-actions.d.ts +0 -1
- package/dist/app-actions.d.ts.map +1 -1
- package/dist/app-actions.js.map +1 -1
- package/dist/cli-provider.d.ts +18 -0
- package/dist/cli-provider.d.ts.map +1 -0
- package/dist/cli-provider.js +2 -0
- package/dist/cli-provider.js.map +1 -0
- package/dist/context.d.ts +13 -2
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js.map +1 -1
- package/dist/index.d.ts +10 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/manifest-schema.d.ts +454 -51
- package/dist/manifest-schema.d.ts.map +1 -1
- package/dist/manifest-schema.js +139 -33
- package/dist/manifest-schema.js.map +1 -1
- package/dist/manifest.d.ts +2 -2
- package/dist/manifest.d.ts.map +1 -1
- package/dist/manifest.js +164 -38
- package/dist/manifest.js.map +1 -1
- package/dist/models.d.ts +35 -0
- package/dist/models.d.ts.map +1 -0
- package/dist/models.js +2 -0
- package/dist/models.js.map +1 -0
- package/dist/ocr.d.ts +78 -0
- package/dist/ocr.d.ts.map +1 -0
- package/dist/ocr.js +2 -0
- package/dist/ocr.js.map +1 -0
- package/dist/official.d.ts +1 -0
- package/dist/official.d.ts.map +1 -1
- package/dist/official.js.map +1 -1
- package/dist/permissions.d.ts +1 -1
- package/dist/permissions.d.ts.map +1 -1
- package/dist/permissions.js +8 -0
- package/dist/permissions.js.map +1 -1
- package/dist/secrets.d.ts +27 -0
- package/dist/secrets.d.ts.map +1 -0
- package/dist/secrets.js +2 -0
- package/dist/secrets.js.map +1 -0
- package/dist/service-provider.d.ts +62 -0
- package/dist/service-provider.d.ts.map +1 -0
- package/dist/service-provider.js +2 -0
- package/dist/service-provider.js.map +1 -0
- package/dist/storage.d.ts +39 -6
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js +8 -1
- package/dist/storage.js.map +1 -1
- package/dist/ui.d.ts +118 -7
- package/dist/ui.d.ts.map +1 -1
- package/dist/ui.js.map +1 -1
- package/package.json +2 -1
- package/dist/settings.d.ts +0 -13
- package/dist/settings.d.ts.map +0 -1
- package/dist/settings.js +0 -2
- package/dist/settings.js.map +0 -1
package/dist/manifest.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Value } from "@sinclair/typebox/value";
|
|
2
2
|
import { PluginCommandNamesSchema, PluginIdSchema, PluginManifestSchema, PluginMcpServerConfigSchema, PluginVersionSchema, } from "./manifest-schema.js";
|
|
3
3
|
import "./permissions.js";
|
|
4
|
-
export { PluginAgentManifestSchema, PluginBrowserManifestSchema, PluginCommandNameSchema, PluginCommandNamesSchema, PluginIdSchema, PluginManifestSchema, PluginMcpHttpServerConfigSchema, PluginMcpServerConfigSchema, PluginMcpStdioServerConfigSchema, PluginModuleFederationManifestSchema, PluginNetworkManifestSchema,
|
|
4
|
+
export { PluginAgentManifestSchema, PluginAgentProfileManifestSchema, PluginAgentTeamManifestSchema, PluginAgentTeamMemberManifestSchema, PluginBrowserManifestSchema, PluginCommandNameSchema, PluginCommandNamesSchema, PluginCliProviderManifestSchema, PluginServiceArtifactSchema, PluginServicePlatformSchema, PluginServiceProviderManifestSchema, PluginIdSchema, PluginManifestSchema, PluginMcpHttpServerConfigSchema, PluginMcpServerConfigSchema, PluginMcpStdioServerConfigSchema, PluginMcpServiceServerConfigSchema, PluginSkillPresentationRuleSchema, PluginSkillPresentationSchema, PluginModuleFederationManifestSchema, PluginNetworkManifestSchema, PluginProvidersManifestSchema, PluginPermissionSchema, PluginVersionSchema, } from "./manifest-schema.js";
|
|
5
5
|
export { PLUGIN_PERMISSIONS } from "./permissions.js";
|
|
6
6
|
function schemaErrorPath(path) {
|
|
7
7
|
if (!path)
|
|
@@ -43,37 +43,6 @@ function normalizeOptionalAgentModes(value) {
|
|
|
43
43
|
return undefined;
|
|
44
44
|
return Array.isArray(value) ? normalizeStringArray(value) : trimString(value);
|
|
45
45
|
}
|
|
46
|
-
function normalizeSetting(setting) {
|
|
47
|
-
const common = {
|
|
48
|
-
key: trimString(setting.key),
|
|
49
|
-
description: setting.description,
|
|
50
|
-
default: setting.default,
|
|
51
|
-
enum: setting.enum?.map(trimString),
|
|
52
|
-
visibleWhen: setting.visibleWhen
|
|
53
|
-
? {
|
|
54
|
-
key: trimString(setting.visibleWhen.key),
|
|
55
|
-
in: setting.visibleWhen.in.map(trimString),
|
|
56
|
-
}
|
|
57
|
-
: undefined,
|
|
58
|
-
};
|
|
59
|
-
if (setting.type === "desc") {
|
|
60
|
-
return {
|
|
61
|
-
...common,
|
|
62
|
-
type: "desc",
|
|
63
|
-
title: setting.title === undefined ? undefined : trimString(setting.title),
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
return {
|
|
67
|
-
...common,
|
|
68
|
-
type: setting.type,
|
|
69
|
-
title: trimString(setting.title),
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
function normalizeSettings(settings) {
|
|
73
|
-
if (!settings || settings.length === 0)
|
|
74
|
-
return undefined;
|
|
75
|
-
return settings.map(normalizeSetting);
|
|
76
|
-
}
|
|
77
46
|
function normalizePermissions(permissions) {
|
|
78
47
|
return Array.from(new Set(permissions ?? []));
|
|
79
48
|
}
|
|
@@ -147,10 +116,134 @@ function normalizeAgentManifest(agent) {
|
|
|
147
116
|
}
|
|
148
117
|
: undefined,
|
|
149
118
|
skillPaths: normalizeStringArray(agent.skillPaths).map((path) => validatePluginRelativePath(path, "agent.skillPaths")),
|
|
119
|
+
skillPresentation: normalizeSkillPresentation(agent.skillPresentation),
|
|
150
120
|
mcpServers: normalizeMcpServers(agent.mcpServers),
|
|
151
121
|
toolPolicy: normalizeToolPolicy(agent.toolPolicy),
|
|
122
|
+
agents: agent.agents?.map((profile) => ({
|
|
123
|
+
...profile,
|
|
124
|
+
// 路径都要过越界校验:manifest 里写 `../` 不该能读到插件目录之外。
|
|
125
|
+
avatar: profile.avatar ? validatePluginRelativePath(profile.avatar, "agent.agents.avatar") : undefined,
|
|
126
|
+
systemPromptPath: profile.systemPromptPath
|
|
127
|
+
? validatePluginRelativePath(profile.systemPromptPath, "agent.agents.systemPromptPath")
|
|
128
|
+
: undefined,
|
|
129
|
+
})),
|
|
130
|
+
teams: agent.teams?.map((team) => ({
|
|
131
|
+
...team,
|
|
132
|
+
workflowPath: team.workflowPath
|
|
133
|
+
? validatePluginRelativePath(team.workflowPath, "agent.teams.workflowPath")
|
|
134
|
+
: undefined,
|
|
135
|
+
})),
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
function normalizeSkillPresentation(presentation) {
|
|
139
|
+
if (!presentation)
|
|
140
|
+
return undefined;
|
|
141
|
+
const normalizeRule = (rule) => ({
|
|
142
|
+
defaultVisibility: rule.defaultVisibility,
|
|
143
|
+
surfaces: rule.surfaces ? { ...rule.surfaces } : undefined,
|
|
144
|
+
displayName: rule.displayName?.trim(),
|
|
145
|
+
displayDescription: rule.displayDescription?.trim(),
|
|
146
|
+
});
|
|
147
|
+
return {
|
|
148
|
+
defaultVisibility: presentation.defaultVisibility,
|
|
149
|
+
surfaces: presentation.surfaces ? { ...presentation.surfaces } : undefined,
|
|
150
|
+
skills: presentation.skills
|
|
151
|
+
? Object.fromEntries(Object.entries(presentation.skills).map(([name, rule]) => [name.trim(), normalizeRule(rule)]))
|
|
152
|
+
: undefined,
|
|
152
153
|
};
|
|
153
154
|
}
|
|
155
|
+
function normalizeCliProviders(providers) {
|
|
156
|
+
if (!providers || providers.length === 0)
|
|
157
|
+
return undefined;
|
|
158
|
+
const ids = new Set();
|
|
159
|
+
return providers.map((provider) => {
|
|
160
|
+
if (ids.has(provider.id))
|
|
161
|
+
throw new Error(`Duplicate CLI provider id: ${provider.id}`);
|
|
162
|
+
ids.add(provider.id);
|
|
163
|
+
return {
|
|
164
|
+
id: provider.id,
|
|
165
|
+
command: provider.command,
|
|
166
|
+
probe: provider.probe
|
|
167
|
+
? { args: provider.probe.args ? [...provider.probe.args] : undefined, timeoutMs: provider.probe.timeoutMs }
|
|
168
|
+
: undefined,
|
|
169
|
+
install: {
|
|
170
|
+
command: provider.install.command,
|
|
171
|
+
args: provider.install.args ? [...provider.install.args] : undefined,
|
|
172
|
+
timeoutMs: provider.install.timeoutMs,
|
|
173
|
+
},
|
|
174
|
+
};
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
function normalizeServiceProviders(providers) {
|
|
178
|
+
if (!providers || providers.length === 0)
|
|
179
|
+
return undefined;
|
|
180
|
+
const ids = new Set();
|
|
181
|
+
return providers.map((provider) => {
|
|
182
|
+
if (ids.has(provider.id))
|
|
183
|
+
throw new Error(`Duplicate service provider id: ${provider.id}`);
|
|
184
|
+
ids.add(provider.id);
|
|
185
|
+
const runtimeKind = provider.runtime.kind ?? "managed-binary";
|
|
186
|
+
const entry = provider.runtime.entry
|
|
187
|
+
? validatePluginRelativePath(provider.runtime.entry, `providers.services.${provider.id}.runtime.entry`)
|
|
188
|
+
: undefined;
|
|
189
|
+
if (runtimeKind === "host-node" && !entry) {
|
|
190
|
+
throw new Error(`Host-node service must declare runtime.entry: ${provider.id}`);
|
|
191
|
+
}
|
|
192
|
+
const platforms = {};
|
|
193
|
+
for (const [platformTag, platform] of Object.entries(provider.runtime.platforms)) {
|
|
194
|
+
const destinations = new Set();
|
|
195
|
+
platforms[platformTag] = {
|
|
196
|
+
executable: validatePluginRelativePath(platform.executable, `providers.services.${provider.id}.executable`),
|
|
197
|
+
artifacts: platform.artifacts.map((artifact) => {
|
|
198
|
+
const destination = validatePluginRelativePath(artifact.destination, `providers.services.${provider.id}.artifacts.destination`);
|
|
199
|
+
if (destinations.has(destination)) {
|
|
200
|
+
throw new Error(`Duplicate service artifact destination: ${provider.id}/${platformTag}/${destination}`);
|
|
201
|
+
}
|
|
202
|
+
destinations.add(destination);
|
|
203
|
+
return { ...artifact, destination };
|
|
204
|
+
}),
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
if (Object.keys(platforms).length === 0) {
|
|
208
|
+
throw new Error(`Service provider must declare at least one platform: ${provider.id}`);
|
|
209
|
+
}
|
|
210
|
+
const credentialIds = new Set();
|
|
211
|
+
const credentials = provider.credentials?.map((credential) => {
|
|
212
|
+
if (credentialIds.has(credential.id))
|
|
213
|
+
throw new Error(`Duplicate service credential id: ${provider.id}/${credential.id}`);
|
|
214
|
+
credentialIds.add(credential.id);
|
|
215
|
+
return { id: credential.id, bytes: credential.bytes };
|
|
216
|
+
});
|
|
217
|
+
if (provider.health.credentialId && !credentialIds.has(provider.health.credentialId)) {
|
|
218
|
+
throw new Error(`Unknown service health credential: ${provider.id}/${provider.health.credentialId}`);
|
|
219
|
+
}
|
|
220
|
+
const templateDestinations = new Set();
|
|
221
|
+
const templates = provider.templates?.map((template) => {
|
|
222
|
+
const source = validatePluginRelativePath(template.source, `providers.services.${provider.id}.templates.source`);
|
|
223
|
+
const destination = validatePluginRelativePath(template.destination, `providers.services.${provider.id}.templates.destination`);
|
|
224
|
+
if (templateDestinations.has(destination))
|
|
225
|
+
throw new Error(`Duplicate service template destination: ${provider.id}/${destination}`);
|
|
226
|
+
templateDestinations.add(destination);
|
|
227
|
+
return { source, destination, mode: template.mode };
|
|
228
|
+
});
|
|
229
|
+
const normalizedRuntime = {
|
|
230
|
+
version: provider.runtime.version,
|
|
231
|
+
platforms,
|
|
232
|
+
...(runtimeKind === "host-node" ? { kind: runtimeKind, entry } : provider.runtime.kind ? { kind: runtimeKind } : {}),
|
|
233
|
+
};
|
|
234
|
+
return {
|
|
235
|
+
id: provider.id,
|
|
236
|
+
runtime: normalizedRuntime,
|
|
237
|
+
credentials,
|
|
238
|
+
templates,
|
|
239
|
+
process: {
|
|
240
|
+
args: provider.process.args ? [...provider.process.args] : undefined,
|
|
241
|
+
env: provider.process.env ? { ...provider.process.env } : undefined,
|
|
242
|
+
},
|
|
243
|
+
health: { ...provider.health },
|
|
244
|
+
};
|
|
245
|
+
});
|
|
246
|
+
}
|
|
154
247
|
function normalizePluginMcpServerConfig(config) {
|
|
155
248
|
const common = {
|
|
156
249
|
disabled: config.disabled,
|
|
@@ -161,6 +254,14 @@ function normalizePluginMcpServerConfig(config) {
|
|
|
161
254
|
description: config.description,
|
|
162
255
|
agent_mode: normalizeOptionalAgentModes(config.agent_mode),
|
|
163
256
|
};
|
|
257
|
+
if (config.type === "service") {
|
|
258
|
+
return {
|
|
259
|
+
type: "service",
|
|
260
|
+
serviceId: trimString(config.serviceId),
|
|
261
|
+
path: trimString(config.path),
|
|
262
|
+
...common,
|
|
263
|
+
};
|
|
264
|
+
}
|
|
164
265
|
if (config.type === "http") {
|
|
165
266
|
return {
|
|
166
267
|
type: "http",
|
|
@@ -258,6 +359,12 @@ export function parsePluginManifest(raw) {
|
|
|
258
359
|
if (permissions.includes("browser.interact") && !permissions.includes("browser.read")) {
|
|
259
360
|
throw new Error("Plugin browser.interact requires browser.read");
|
|
260
361
|
}
|
|
362
|
+
const normalizedServices = raw.providers ? normalizeServiceProviders(raw.providers.services) : undefined;
|
|
363
|
+
for (const [name, server] of Object.entries(raw.agent?.mcpServers && typeof raw.agent.mcpServers !== "string" ? raw.agent.mcpServers : {})) {
|
|
364
|
+
if (server.type === "service" && !normalizedServices?.some((service) => service.id === server.serviceId)) {
|
|
365
|
+
throw new Error(`Plugin MCP server '${name}' references unknown service '${server.serviceId}'`);
|
|
366
|
+
}
|
|
367
|
+
}
|
|
261
368
|
return {
|
|
262
369
|
id: raw.id,
|
|
263
370
|
name: trimString(raw.name),
|
|
@@ -266,17 +373,17 @@ export function parsePluginManifest(raw) {
|
|
|
266
373
|
entry: validatePluginRelativePath(trimString(raw.entry), "entry"),
|
|
267
374
|
moduleFederation: normalizeModuleFederation(raw.moduleFederation),
|
|
268
375
|
agent: normalizeAgentManifest(raw.agent),
|
|
376
|
+
providers: raw.providers
|
|
377
|
+
? {
|
|
378
|
+
cli: normalizeCliProviders(raw.providers.cli),
|
|
379
|
+
services: normalizedServices,
|
|
380
|
+
}
|
|
381
|
+
: undefined,
|
|
269
382
|
styles: normalizeStringArray(raw.styles).map((style) => validatePluginRelativePath(style, "styles")),
|
|
270
383
|
permissions,
|
|
271
384
|
network,
|
|
272
385
|
browser,
|
|
273
386
|
commands: commands.length > 0 ? commands : undefined,
|
|
274
|
-
contributes: raw.contributes
|
|
275
|
-
? (() => {
|
|
276
|
-
const settings = normalizeSettings(raw.contributes.settings);
|
|
277
|
-
return settings ? { settings } : undefined;
|
|
278
|
-
})()
|
|
279
|
-
: undefined,
|
|
280
387
|
description: raw.description,
|
|
281
388
|
author: raw.author,
|
|
282
389
|
icon: icon === undefined || isPluginPassthroughIconRef(icon)
|
|
@@ -306,9 +413,28 @@ export function listPluginManifestResources(manifest) {
|
|
|
306
413
|
for (const skillPath of manifest.agent?.skillPaths ?? []) {
|
|
307
414
|
resources.push({ field: "agent.skillPaths", path: skillPath, kind: "file-or-directory" });
|
|
308
415
|
}
|
|
416
|
+
for (const agent of manifest.agent?.agents ?? []) {
|
|
417
|
+
// 人设与头像是插件包里的真实文件:不登记就不会被打进包,装到用户机器上时这个
|
|
418
|
+
// 智能体会因为「提示词读不出来」被整个跳过。
|
|
419
|
+
if (agent.avatar)
|
|
420
|
+
resources.push({ field: "agent.agents.avatar", path: agent.avatar, kind: "file" });
|
|
421
|
+
if (agent.systemPromptPath) {
|
|
422
|
+
resources.push({ field: "agent.agents.systemPromptPath", path: agent.systemPromptPath, kind: "file" });
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
for (const team of manifest.agent?.teams ?? []) {
|
|
426
|
+
if (team.workflowPath) {
|
|
427
|
+
resources.push({ field: "agent.teams.workflowPath", path: team.workflowPath, kind: "file" });
|
|
428
|
+
}
|
|
429
|
+
}
|
|
309
430
|
if (typeof manifest.agent?.mcpServers === "string") {
|
|
310
431
|
resources.push({ field: "agent.mcpServers", path: manifest.agent.mcpServers, kind: "file" });
|
|
311
432
|
}
|
|
433
|
+
for (const service of manifest.providers?.services ?? []) {
|
|
434
|
+
for (const template of service.templates ?? []) {
|
|
435
|
+
resources.push({ field: `providers.services.${service.id}.templates.source`, path: template.source, kind: "file" });
|
|
436
|
+
}
|
|
437
|
+
}
|
|
312
438
|
return resources;
|
|
313
439
|
}
|
|
314
440
|
function parseApiVersion(value) {
|
package/dist/manifest.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manifest.js","sourceRoot":"","sources":["../src/manifest.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAChD,OAAO,EAEN,wBAAwB,EACxB,cAAc,EACd,oBAAoB,EACpB,2BAA2B,EAC3B,mBAAmB,GAQnB,MAAM,sBAAsB,CAAC;AAC9B,OAA0D,kBAAkB,CAAC;AAE7E,OAAO,EACN,yBAAyB,EACzB,2BAA2B,EAC3B,uBAAuB,EACvB,wBAAwB,EACxB,cAAc,EACd,oBAAoB,EACpB,+BAA+B,EAC/B,2BAA2B,EAC3B,gCAAgC,EAChC,oCAAoC,EACpC,2BAA2B,EAC3B,sBAAsB,EACtB,6BAA6B,EAC7B,mBAAmB,GACnB,MAAM,sBAAsB,CAAC;AAU9B,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAStD,SAAS,eAAe,CAAC,IAAY,EAAU;IAC9C,IAAI,CAAC,IAAI;QAAE,OAAO,EAAE,CAAC;IACrB,OAAO,IAAI;SACT,KAAK,CAAC,GAAG,CAAC;SACV,KAAK,CAAC,CAAC,CAAC;SACR,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,K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AC;IAC1C,IAAI,KAAK;QAAE,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,kBAAkB,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;IAC/E,MAAM,KAAK,GAAG,UAAU,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC5F,IAAI,KAAK;QAAE,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,kBAAkB,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;IAC/E,IAAI,UAAU,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,UAAU,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI;QAAE,OAAO,IAAI,CAAC;IAC/E,MAAM,OAAO,GAAG,UAAU,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC/F,OAAO,OAAO,KAAK,SAAS,IAAI,kBAAkB,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;AAAA,CACvE","sourcesContent":["import { type Static, type TSchema } from \"@sinclair/typebox\";\nimport type { ValueError } from \"@sinclair/typebox/errors\";\nimport { Value } from \"@sinclair/typebox/value\";\nimport {\n\tPluginCommandNameSchema,\n\tPluginCommandNamesSchema,\n\tPluginIdSchema,\n\tPluginManifestSchema,\n\tPluginMcpServerConfigSchema,\n\tPluginVersionSchema,\n\ttype PluginAgentManifest,\n\ttype PluginBrowserManifest,\n\ttype PluginManifest,\n\ttype PluginManifestInput,\n\ttype PluginMcpServerConfig,\n\ttype PluginNetworkManifest,\n\ttype PluginSettingSchema,\n} from \"./manifest-schema.js\";\nimport { PLUGIN_PERMISSIONS, type PluginPermission } from \"./permissions.js\";\n\nexport {\n\tPluginAgentManifestSchema,\n\tPluginBrowserManifestSchema,\n\tPluginCommandNameSchema,\n\tPluginCommandNamesSchema,\n\tPluginIdSchema,\n\tPluginManifestSchema,\n\tPluginMcpHttpServerConfigSchema,\n\tPluginMcpServerConfigSchema,\n\tPluginMcpStdioServerConfigSchema,\n\tPluginModuleFederationManifestSchema,\n\tPluginNetworkManifestSchema,\n\tPluginPermissionSchema,\n\tPluginSettingDefinitionSchema,\n\tPluginVersionSchema,\n} from \"./manifest-schema.js\";\nexport type {\n\tPluginAgentManifest,\n\tPluginBrowserManifest,\n\tPluginManifest,\n\tPluginManifestInput,\n\tPluginMcpServerConfig,\n\tPluginNetworkManifest,\n\tPluginSettingSchema,\n} from \"./manifest-schema.js\";\nexport { PLUGIN_PERMISSIONS } from \"./permissions.js\";\nexport type { PluginPermission } from \"./permissions.js\";\n\nexport interface PluginManifestResourceReference {\n\tfield: string;\n\tpath: string;\n\tkind: \"file\" | \"file-or-directory\";\n}\n\nfunction schemaErrorPath(path: string): string {\n\tif (!path) return \"\";\n\treturn path\n\t\t.split(\"/\")\n\t\t.slice(1)\n\t\t.map((segment) => segment.replace(/~1/g, \"/\").replace(/~0/g, \"~\"))\n\t\t.map((segment) => {\n\t\t\tif (segment === \"\") return '[\"\"]';\n\t\t\treturn /^\\d+$/.test(segment) ? `[${segment}]` : `.${segment}`;\n\t\t})\n\t\t.join(\"\");\n}\n\nfunction mostSpecificSchemaError(issue: ValueError): ValueError {\n\tconst nested = issue.errors.flatMap((iterator) =>\n\t\t[...iterator].map((child) => mostSpecificSchemaError(child)),\n\t);\n\tconst deeper = nested.filter((child) => child.path.length > issue.path.length);\n\tif (deeper.length === 0) return issue;\n\treturn deeper.reduce((best, child) => (child.path.length > best.path.length ? child : best));\n}\n\nfunction assertSchema<Schema extends TSchema>(\n\tschema: Schema,\n\tvalue: unknown,\n\tfieldName: string,\n): asserts value is Static<Schema> {\n\tif (Value.Check(schema, value)) return;\n\tconst firstIssue = Value.Errors(schema, value).First();\n\tconst issue = firstIssue ? mostSpecificSchemaError(firstIssue) : undefined;\n\tconst location = `${fieldName}${schemaErrorPath(issue?.path ?? \"\")}`;\n\tthrow new Error(`Invalid plugin ${location}: ${issue?.message ?? \"schema validation failed\"}`);\n}\n\nfunction trimString(value: string): string {\n\treturn value.trim();\n}\n\nfunction normalizeStringArray(values: string[] | undefined): string[] {\n\treturn (values ?? []).map(trimString);\n}\n\nfunction normalizeOptionalAgentModes(value: string | string[] | undefined): string | string[] | undefined {\n\tif (value === undefined) return undefined;\n\treturn Array.isArray(value) ? normalizeStringArray(value) : trimString(value);\n}\n\nfunction normalizeSetting(setting: PluginSettingSchema): PluginSettingSchema {\n\tconst common = {\n\t\tkey: trimString(setting.key),\n\t\tdescription: setting.description,\n\t\tdefault: setting.default,\n\t\tenum: setting.enum?.map(trimString),\n\t\tvisibleWhen: setting.visibleWhen\n\t\t\t? {\n\t\t\t\t\tkey: trimString(setting.visibleWhen.key),\n\t\t\t\t\tin: setting.visibleWhen.in.map(trimString),\n\t\t\t\t}\n\t\t\t: undefined,\n\t};\n\tif (setting.type === \"desc\") {\n\t\treturn {\n\t\t\t...common,\n\t\t\ttype: \"desc\",\n\t\t\ttitle: setting.title === undefined ? undefined : trimString(setting.title),\n\t\t};\n\t}\n\treturn {\n\t\t...common,\n\t\ttype: setting.type,\n\t\ttitle: trimString(setting.title),\n\t};\n}\n\nfunction normalizeSettings(settings: PluginSettingSchema[] | undefined): PluginSettingSchema[] | undefined {\n\tif (!settings || settings.length === 0) return undefined;\n\treturn settings.map(normalizeSetting);\n}\n\nfunction normalizePermissions(permissions: PluginPermission[] | undefined): PluginPermission[] {\n\treturn Array.from(new Set(permissions ?? []));\n}\n\nfunction normalizeAllowedHost(value: string, fieldName: \"network\" | \"browser\"): string {\n\tconst raw = trimString(value).toLowerCase();\n\tif (raw === \"*\") return raw;\n\tconst wildcard = raw.startsWith(\"*.\");\n\tconst candidate = wildcard ? raw.slice(2) : raw;\n\tif (!candidate || candidate.includes(\"*\") || /[\\\\/?#@]/.test(candidate)) {\n\t\tthrow new Error(`Invalid plugin ${fieldName}.allowedHosts entry: ${value}`);\n\t}\n\tconst unwrapped = candidate.startsWith(\"[\") && candidate.endsWith(\"]\") ? candidate.slice(1, -1) : candidate;\n\tif (wildcard && unwrapped.includes(\":\")) {\n\t\tthrow new Error(`Invalid plugin ${fieldName}.allowedHosts entry: ${value}`);\n\t}\n\ttry {\n\t\tconst parsed = new URL(`http://${unwrapped.includes(\":\") ? `[${unwrapped}]` : unwrapped}`);\n\t\tconst hostname = parsed.hostname.replace(/^\\[|\\]$/g, \"\").replace(/\\.$/, \"\").toLowerCase();\n\t\tif (!hostname || parsed.port || parsed.username || parsed.password) throw new Error(\"invalid host\");\n\t\treturn wildcard ? `*.${hostname}` : hostname;\n\t} catch {\n\t\tthrow new Error(`Invalid plugin ${fieldName}.allowedHosts entry: ${value}`);\n\t}\n}\n\nfunction normalizeNetworkManifest(network: PluginNetworkManifest | undefined): PluginNetworkManifest | undefined {\n\tif (!network) return undefined;\n\treturn { allowedHosts: Array.from(new Set(network.allowedHosts.map((host) => normalizeAllowedHost(host, \"network\")))) };\n}\n\nfunction normalizeBrowserManifest(browser: PluginBrowserManifest | undefined): PluginBrowserManifest | undefined {\n\tif (!browser) return undefined;\n\treturn { allowedHosts: Array.from(new Set(browser.allowedHosts.map((host) => normalizeAllowedHost(host, \"browser\")))) };\n}\n\nfunction normalizeModuleFederation(\n\tmoduleFederation: PluginManifestInput[\"moduleFederation\"],\n): PluginManifest[\"moduleFederation\"] {\n\treturn {\n\t\tremoteName: trimString(moduleFederation.remoteName),\n\t\texpose: trimString(moduleFederation.expose),\n\t};\n}\n\nfunction normalizeToolPolicy(\n\ttoolPolicy: PluginAgentManifest[\"toolPolicy\"],\n): PluginAgentManifest[\"toolPolicy\"] {\n\tif (!toolPolicy) return undefined;\n\treturn {\n\t\tallow: normalizeStringArray(toolPolicy.allow),\n\t\tdeny: normalizeStringArray(toolPolicy.deny),\n\t};\n}\n\nfunction normalizeMcpServers(\n\tmcpServers: PluginAgentManifest[\"mcpServers\"],\n): PluginAgentManifest[\"mcpServers\"] {\n\tif (mcpServers === undefined) return undefined;\n\tif (typeof mcpServers === \"string\") {\n\t\treturn validatePluginRelativePath(trimString(mcpServers), \"agent.mcpServers\");\n\t}\n\tconst result: Record<string, PluginMcpServerConfig> = {};\n\tfor (const [name, config] of Object.entries(mcpServers)) {\n\t\tresult[trimString(name)] = normalizePluginMcpServerConfig(config);\n\t}\n\treturn result;\n}\n\nfunction normalizeAgentManifest(agent: PluginAgentManifest | undefined): PluginAgentManifest | undefined {\n\tif (!agent) return undefined;\n\treturn {\n\t\tsystemPrompt: agent.systemPrompt\n\t\t\t? {\n\t\t\t\t\tpromptPaths: normalizeStringArray(agent.systemPrompt.promptPaths).map((path) =>\n\t\t\t\t\t\tvalidatePluginRelativePath(path, \"agent.systemPrompt.promptPaths\"),\n\t\t\t\t\t),\n\t\t\t\t}\n\t\t\t: undefined,\n\t\tskillPaths: normalizeStringArray(agent.skillPaths).map((path) =>\n\t\t\tvalidatePluginRelativePath(path, \"agent.skillPaths\"),\n\t\t),\n\t\tmcpServers: normalizeMcpServers(agent.mcpServers),\n\t\ttoolPolicy: normalizeToolPolicy(agent.toolPolicy),\n\t};\n}\n\nfunction normalizePluginMcpServerConfig(config: PluginMcpServerConfig): PluginMcpServerConfig {\n\tconst common = {\n\t\tdisabled: config.disabled,\n\t\tautoApprove: config.autoApprove?.map(trimString),\n\t\tstartupTimeout: config.startupTimeout,\n\t\tdebug: config.debug,\n\t\tdisplayName: config.displayName,\n\t\tdescription: config.description,\n\t\tagent_mode: normalizeOptionalAgentModes(config.agent_mode),\n\t};\n\tif (config.type === \"http\") {\n\t\treturn {\n\t\t\ttype: \"http\",\n\t\t\turl: trimString(config.url),\n\t\t\theaders: config.headers ? { ...config.headers } : undefined,\n\t\t\toauthClientId: config.oauthClientId,\n\t\t\toauthDeviceFlow: config.oauthDeviceFlow,\n\t\t\toauthScopes: config.oauthScopes,\n\t\t\t...common,\n\t\t};\n\t}\n\treturn {\n\t\ttype: config.type,\n\t\tcommand: trimString(config.command),\n\t\targs: config.args ? [...config.args] : undefined,\n\t\tenv: config.env ? { ...config.env } : undefined,\n\t\tcwd: config.cwd,\n\t\t...common,\n\t};\n}\n\nexport function validatePluginId(id: string): void {\n\tif (!Value.Check(PluginIdSchema, id)) {\n\t\tthrow new Error(\"Plugin id must be 1-64 chars: lowercase letters, numbers, dot, underscore, or dash\");\n\t}\n}\n\nexport function validatePluginVersion(version: string): void {\n\tif (!Value.Check(PluginVersionSchema, version)) {\n\t\tthrow new Error(\"Plugin version must be 1-64 chars and cannot contain path separators\");\n\t}\n}\n\nexport function validatePluginRelativePath(value: string, fieldName: string): string {\n\tif (value.startsWith(\"/\") || /^[a-zA-Z]:/.test(value)) {\n\t\tthrow new Error(`Invalid plugin ${fieldName}`);\n\t}\n\tconst parts: string[] = [];\n\tfor (const part of value.replace(/\\\\/g, \"/\").split(\"/\")) {\n\t\tif (part === \"\" || part === \".\") continue;\n\t\tif (part === \"..\") {\n\t\t\tif (parts.length === 0) throw new Error(`Invalid plugin ${fieldName}`);\n\t\t\tparts.pop();\n\t\t\tcontinue;\n\t\t}\n\t\tparts.push(part);\n\t}\n\tconst normalized = parts.join(\"/\");\n\tif (!normalized) throw new Error(`Invalid plugin ${fieldName}`);\n\treturn normalized;\n}\n\nexport function parsePluginCommandNames(value: unknown): string[] {\n\tif (value === undefined) return [];\n\tassertSchema(PluginCommandNamesSchema, value, \"commands\");\n\treturn Array.from(new Set(value));\n}\n\n/** @deprecated agent_mode 已无任何运行时语义(ADR-0071),保留仅为容忍既有 manifest。 */\nexport function normalizePluginAgentModes(value: unknown): string[] | undefined {\n\tif (value === undefined || value === null) return undefined;\n\tconst values = Array.isArray(value) ? value : [value];\n\tconst modes = values.map((item) => String(item).trim()).filter(Boolean);\n\treturn modes.length > 0 ? modes : undefined;\n}\n\nexport function parsePluginMcpServerConfig(name: string, raw: unknown): PluginMcpServerConfig {\n\tassertSchema(PluginMcpServerConfigSchema, raw, `MCP server '${name}'`);\n\treturn normalizePluginMcpServerConfig(raw);\n}\n\nexport function isPluginPassthroughIconRef(icon: string): boolean {\n\treturn (\n\t\ticon.startsWith(\"http://\") ||\n\t\ticon.startsWith(\"https://\") ||\n\t\t/^[a-z0-9]+(?:-[a-z0-9]+)*:[a-z0-9]+(?:-[a-z0-9]+)*$/.test(icon)\n\t);\n}\n\nexport function isPluginPackagedIconPath(icon: string): boolean {\n\treturn !isPluginPassthroughIconRef(icon);\n}\n\nexport function parsePluginManifest(raw: unknown): PluginManifest {\n\tif (typeof raw === \"object\" && raw !== null && \"runtime\" in raw) {\n\t\tthrow new Error(\n\t\t\t'Invalid plugin manifest.runtime: runtime selection is unsupported; plugins use Module Federation.',\n\t\t);\n\t}\n\tassertSchema(PluginManifestSchema, raw, \"manifest\");\n\tconst commands = parsePluginCommandNames(raw.commands);\n\tconst icon = raw.icon === undefined ? undefined : trimString(raw.icon);\n\tconst permissions = normalizePermissions(raw.permissions);\n\tconst network = normalizeNetworkManifest(raw.network);\n\tconst browser = normalizeBrowserManifest(raw.browser);\n\tif (permissions.includes(\"network.fetch\") && !network) {\n\t\tthrow new Error(\"Plugin network.allowedHosts is required with network.fetch\");\n\t}\n\tconst browserPermissions = permissions.filter((permission) => permission.startsWith(\"browser.\"));\n\tif (browserPermissions.length > 0 && !browser) {\n\t\tthrow new Error(\"Plugin browser.allowedHosts is required with browser permissions\");\n\t}\n\tif (permissions.includes(\"browser.interact\") && !permissions.includes(\"browser.read\")) {\n\t\tthrow new Error(\"Plugin browser.interact requires browser.read\");\n\t}\n\treturn {\n\t\tid: raw.id,\n\t\tname: trimString(raw.name),\n\t\tversion: raw.version,\n\t\tpluginApiVersion: trimString(raw.pluginApiVersion),\n\t\tentry: validatePluginRelativePath(trimString(raw.entry), \"entry\"),\n\t\tmoduleFederation: normalizeModuleFederation(raw.moduleFederation),\n\t\tagent: normalizeAgentManifest(raw.agent),\n\t\tstyles: normalizeStringArray(raw.styles).map((style) => validatePluginRelativePath(style, \"styles\")),\n\t\tpermissions,\n\t\tnetwork,\n\t\tbrowser,\n\t\tcommands: commands.length > 0 ? commands : undefined,\n\t\tcontributes: raw.contributes\n\t\t\t? (() => {\n\t\t\t\t\tconst settings = normalizeSettings(raw.contributes.settings);\n\t\t\t\t\treturn settings ? { settings } : undefined;\n\t\t\t\t})()\n\t\t\t: undefined,\n\t\tdescription: raw.description,\n\t\tauthor: raw.author,\n\t\ticon:\n\t\t\ticon === undefined || isPluginPassthroughIconRef(icon)\n\t\t\t\t? icon\n\t\t\t\t: validatePluginRelativePath(icon, \"icon\"),\n\t\tguidingWords: raw.guidingWords?.map(trimString),\n\t\tdefaultLocale: raw.defaultLocale ?? \"zh\",\n\t\tcontributionMode: raw.contributionMode\n\t\t\t? { hardIsolation: raw.contributionMode.hardIsolation === true }\n\t\t\t: undefined,\n\t\tagent_mode: normalizePluginAgentModes(raw.agent_mode),\n\t};\n}\n\nexport function listPluginManifestResources(\n\tmanifest: PluginManifest,\n): PluginManifestResourceReference[] {\n\tconst resources: PluginManifestResourceReference[] = [\n\t\t{ field: \"entry\", path: manifest.entry, kind: \"file\" },\n\t];\n\tfor (const stylePath of manifest.styles ?? []) {\n\t\tresources.push({ field: \"styles\", path: stylePath, kind: \"file\" });\n\t}\n\tif (manifest.icon && isPluginPackagedIconPath(manifest.icon)) {\n\t\tresources.push({ field: \"icon\", path: manifest.icon, kind: \"file\" });\n\t}\n\tfor (const promptPath of manifest.agent?.systemPrompt?.promptPaths ?? []) {\n\t\tresources.push({ field: \"agent.systemPrompt.promptPaths\", path: promptPath, kind: \"file-or-directory\" });\n\t}\n\tfor (const skillPath of manifest.agent?.skillPaths ?? []) {\n\t\tresources.push({ field: \"agent.skillPaths\", path: skillPath, kind: \"file-or-directory\" });\n\t}\n\tif (typeof manifest.agent?.mcpServers === \"string\") {\n\t\tresources.push({ field: \"agent.mcpServers\", path: manifest.agent.mcpServers, kind: \"file\" });\n\t}\n\treturn resources;\n}\n\nfunction parseApiVersion(value: string): readonly [number, number, number] | undefined {\n\tconst match = /^(\\d+)\\.(\\d+)\\.(\\d+)$/.exec(value);\n\tif (!match) return undefined;\n\treturn [Number(match[1]), Number(match[2]), Number(match[3])];\n}\n\nfunction compareApiVersions(\n\tleft: readonly [number, number, number],\n\tright: readonly [number, number, number],\n): number {\n\tfor (let index = 0; index < left.length; index += 1) {\n\t\tif (left[index] !== right[index]) return left[index] - right[index];\n\t}\n\treturn 0;\n}\n\nexport function isPluginApiCompatible(hostVersion: string, range: string): boolean {\n\tconst host = parseApiVersion(hostVersion);\n\tif (!host) return false;\n\tconst normalized = range.trim();\n\tconst exact = parseApiVersion(normalized);\n\tif (exact) return exact[0] === host[0] && compareApiVersions(host, exact) >= 0;\n\tconst caret = normalized.startsWith(\"^\") ? parseApiVersion(normalized.slice(1)) : undefined;\n\tif (caret) return caret[0] === host[0] && compareApiVersions(host, caret) >= 0;\n\tif (normalized === `^${host[0]}` || normalized === `${host[0]}.x`) return true;\n\tconst minimum = normalized.startsWith(\">=\") ? parseApiVersion(normalized.slice(2)) : undefined;\n\treturn minimum !== undefined && compareApiVersions(host, minimum) >= 0;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"manifest.js","sourceRoot":"","sources":["../src/manifest.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAChD,OAAO,EAEN,wBAAwB,EAGxB,cAAc,EACd,oBAAoB,EACpB,2BAA2B,EAI3B,mBAAmB,GAenB,MAAM,sBAAsB,CAAC;AAC9B,OAA0D,kBAAkB,CAAC;AAE7E,OAAO,EACN,yBAAyB,EACzB,gCAAgC,EAChC,6BAA6B,EAC7B,mCAAmC,EACnC,2BAA2B,EAC3B,uBAAuB,EACvB,wBAAwB,EAC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C,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC5F,IAAI,KAAK;QAAE,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,kBAAkB,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;IAC/E,IAAI,UAAU,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,UAAU,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI;QAAE,OAAO,IAAI,CAAC;IAC/E,MAAM,OAAO,GAAG,UAAU,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC/F,OAAO,OAAO,KAAK,SAAS,IAAI,kBAAkB,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;AAAA,CACvE","sourcesContent":["import { type Static, type TSchema } from \"@sinclair/typebox\";\nimport type { ValueError } from \"@sinclair/typebox/errors\";\nimport { Value } from \"@sinclair/typebox/value\";\nimport {\n\tPluginCommandNameSchema,\n\tPluginCommandNamesSchema,\n\tPluginCliProviderManifestSchema,\n\tPluginServiceProviderManifestSchema,\n\tPluginIdSchema,\n\tPluginManifestSchema,\n\tPluginMcpServerConfigSchema,\n\tPluginMcpServiceServerConfigSchema,\n\tPluginSkillPresentationRuleSchema,\n\tPluginSkillPresentationSchema,\n\tPluginVersionSchema,\n\ttype PluginAgentManifest,\n\ttype PluginAgentProfileManifest,\n\ttype PluginAgentTeamManifest,\n\ttype PluginAgentTeamMemberManifest,\n\ttype PluginBrowserManifest,\n\ttype PluginCliProviderManifest,\n\ttype PluginServiceProviderManifest,\n\ttype PluginServiceRuntimeKind,\n\ttype PluginManifest,\n\ttype PluginManifestInput,\n\ttype PluginMcpServerConfig,\n\ttype PluginSkillPresentation,\n\ttype PluginSkillPresentationRule,\n\ttype PluginNetworkManifest,\n} from \"./manifest-schema.js\";\nimport { PLUGIN_PERMISSIONS, type PluginPermission } from \"./permissions.js\";\n\nexport {\n\tPluginAgentManifestSchema,\n\tPluginAgentProfileManifestSchema,\n\tPluginAgentTeamManifestSchema,\n\tPluginAgentTeamMemberManifestSchema,\n\tPluginBrowserManifestSchema,\n\tPluginCommandNameSchema,\n\tPluginCommandNamesSchema,\n\tPluginCliProviderManifestSchema,\n\tPluginServiceArtifactSchema,\n\tPluginServicePlatformSchema,\n\tPluginServiceProviderManifestSchema,\n\tPluginIdSchema,\n\tPluginManifestSchema,\n\tPluginMcpHttpServerConfigSchema,\n\tPluginMcpServerConfigSchema,\n\tPluginMcpStdioServerConfigSchema,\n\tPluginMcpServiceServerConfigSchema,\n\tPluginSkillPresentationRuleSchema,\n\tPluginSkillPresentationSchema,\n\tPluginModuleFederationManifestSchema,\n\tPluginNetworkManifestSchema,\n\tPluginProvidersManifestSchema,\n\tPluginPermissionSchema,\n\tPluginVersionSchema,\n} from \"./manifest-schema.js\";\nexport type {\n\tPluginAgentManifest,\n\tPluginAgentProfileManifest,\n\tPluginAgentTeamManifest,\n\tPluginAgentTeamMemberManifest,\n\tPluginBrowserManifest,\n\tPluginCliProviderManifest,\n\tPluginServiceArtifact,\n\tPluginServicePlatform,\n\tPluginServiceProviderManifest,\n\tPluginServiceRuntimeKind,\n\tPluginManifest,\n\tPluginManifestInput,\n\tPluginMcpServerConfig,\n\tPluginSkillPresentation,\n\tPluginSkillPresentationRule,\n\tPluginNetworkManifest,\n} from \"./manifest-schema.js\";\nexport { PLUGIN_PERMISSIONS } from \"./permissions.js\";\nexport type { PluginPermission } from \"./permissions.js\";\n\nexport interface PluginManifestResourceReference {\n\tfield: string;\n\tpath: string;\n\tkind: \"file\" | \"file-or-directory\";\n}\n\nfunction schemaErrorPath(path: string): string {\n\tif (!path) return \"\";\n\treturn path\n\t\t.split(\"/\")\n\t\t.slice(1)\n\t\t.map((segment) => segment.replace(/~1/g, \"/\").replace(/~0/g, \"~\"))\n\t\t.map((segment) => {\n\t\t\tif (segment === \"\") return '[\"\"]';\n\t\t\treturn /^\\d+$/.test(segment) ? `[${segment}]` : `.${segment}`;\n\t\t})\n\t\t.join(\"\");\n}\n\nfunction mostSpecificSchemaError(issue: ValueError): ValueError {\n\tconst nested = issue.errors.flatMap((iterator) =>\n\t\t[...iterator].map((child) => mostSpecificSchemaError(child)),\n\t);\n\tconst deeper = nested.filter((child) => child.path.length > issue.path.length);\n\tif (deeper.length === 0) return issue;\n\treturn deeper.reduce((best, child) => (child.path.length > best.path.length ? child : best));\n}\n\nfunction assertSchema<Schema extends TSchema>(\n\tschema: Schema,\n\tvalue: unknown,\n\tfieldName: string,\n): asserts value is Static<Schema> {\n\tif (Value.Check(schema, value)) return;\n\tconst firstIssue = Value.Errors(schema, value).First();\n\tconst issue = firstIssue ? mostSpecificSchemaError(firstIssue) : undefined;\n\tconst location = `${fieldName}${schemaErrorPath(issue?.path ?? \"\")}`;\n\tthrow new Error(`Invalid plugin ${location}: ${issue?.message ?? \"schema validation failed\"}`);\n}\n\nfunction trimString(value: string): string {\n\treturn value.trim();\n}\n\nfunction normalizeStringArray(values: string[] | undefined): string[] {\n\treturn (values ?? []).map(trimString);\n}\n\nfunction normalizeOptionalAgentModes(value: string | string[] | undefined): string | string[] | undefined {\n\tif (value === undefined) return undefined;\n\treturn Array.isArray(value) ? normalizeStringArray(value) : trimString(value);\n}\n\nfunction normalizePermissions(permissions: PluginPermission[] | undefined): PluginPermission[] {\n\treturn Array.from(new Set(permissions ?? []));\n}\n\nfunction normalizeAllowedHost(value: string, fieldName: \"network\" | \"browser\"): string {\n\tconst raw = trimString(value).toLowerCase();\n\tif (raw === \"*\") return raw;\n\tconst wildcard = raw.startsWith(\"*.\");\n\tconst candidate = wildcard ? raw.slice(2) : raw;\n\tif (!candidate || candidate.includes(\"*\") || /[\\\\/?#@]/.test(candidate)) {\n\t\tthrow new Error(`Invalid plugin ${fieldName}.allowedHosts entry: ${value}`);\n\t}\n\tconst unwrapped = candidate.startsWith(\"[\") && candidate.endsWith(\"]\") ? candidate.slice(1, -1) : candidate;\n\tif (wildcard && unwrapped.includes(\":\")) {\n\t\tthrow new Error(`Invalid plugin ${fieldName}.allowedHosts entry: ${value}`);\n\t}\n\ttry {\n\t\tconst parsed = new URL(`http://${unwrapped.includes(\":\") ? `[${unwrapped}]` : unwrapped}`);\n\t\tconst hostname = parsed.hostname.replace(/^\\[|\\]$/g, \"\").replace(/\\.$/, \"\").toLowerCase();\n\t\tif (!hostname || parsed.port || parsed.username || parsed.password) throw new Error(\"invalid host\");\n\t\treturn wildcard ? `*.${hostname}` : hostname;\n\t} catch {\n\t\tthrow new Error(`Invalid plugin ${fieldName}.allowedHosts entry: ${value}`);\n\t}\n}\n\nfunction normalizeNetworkManifest(network: PluginNetworkManifest | undefined): PluginNetworkManifest | undefined {\n\tif (!network) return undefined;\n\treturn { allowedHosts: Array.from(new Set(network.allowedHosts.map((host) => normalizeAllowedHost(host, \"network\")))) };\n}\n\nfunction normalizeBrowserManifest(browser: PluginBrowserManifest | undefined): PluginBrowserManifest | undefined {\n\tif (!browser) return undefined;\n\treturn { allowedHosts: Array.from(new Set(browser.allowedHosts.map((host) => normalizeAllowedHost(host, \"browser\")))) };\n}\n\nfunction normalizeModuleFederation(\n\tmoduleFederation: PluginManifestInput[\"moduleFederation\"],\n): PluginManifest[\"moduleFederation\"] {\n\treturn {\n\t\tremoteName: trimString(moduleFederation.remoteName),\n\t\texpose: trimString(moduleFederation.expose),\n\t};\n}\n\nfunction normalizeToolPolicy(\n\ttoolPolicy: PluginAgentManifest[\"toolPolicy\"],\n): PluginAgentManifest[\"toolPolicy\"] {\n\tif (!toolPolicy) return undefined;\n\treturn {\n\t\tallow: normalizeStringArray(toolPolicy.allow),\n\t\tdeny: normalizeStringArray(toolPolicy.deny),\n\t};\n}\n\nfunction normalizeMcpServers(\n\tmcpServers: PluginAgentManifest[\"mcpServers\"],\n): PluginAgentManifest[\"mcpServers\"] {\n\tif (mcpServers === undefined) return undefined;\n\tif (typeof mcpServers === \"string\") {\n\t\treturn validatePluginRelativePath(trimString(mcpServers), \"agent.mcpServers\");\n\t}\n\tconst result: Record<string, PluginMcpServerConfig> = {};\n\tfor (const [name, config] of Object.entries(mcpServers)) {\n\t\tresult[trimString(name)] = normalizePluginMcpServerConfig(config);\n\t}\n\treturn result;\n}\n\nfunction normalizeAgentManifest(agent: PluginAgentManifest | undefined): PluginAgentManifest | undefined {\n\tif (!agent) return undefined;\n\treturn {\n\t\tsystemPrompt: agent.systemPrompt\n\t\t\t? {\n\t\t\t\t\tpromptPaths: normalizeStringArray(agent.systemPrompt.promptPaths).map((path) =>\n\t\t\t\t\t\tvalidatePluginRelativePath(path, \"agent.systemPrompt.promptPaths\"),\n\t\t\t\t\t),\n\t\t\t\t}\n\t\t\t: undefined,\n\t\tskillPaths: normalizeStringArray(agent.skillPaths).map((path) =>\n\t\t\tvalidatePluginRelativePath(path, \"agent.skillPaths\"),\n\t\t),\n\t\tskillPresentation: normalizeSkillPresentation(agent.skillPresentation),\n\t\tmcpServers: normalizeMcpServers(agent.mcpServers),\n\t\ttoolPolicy: normalizeToolPolicy(agent.toolPolicy),\n\t\tagents: agent.agents?.map((profile) => ({\n\t\t\t...profile,\n\t\t\t// 路径都要过越界校验:manifest 里写 `../` 不该能读到插件目录之外。\n\t\t\tavatar: profile.avatar ? validatePluginRelativePath(profile.avatar, \"agent.agents.avatar\") : undefined,\n\t\t\tsystemPromptPath: profile.systemPromptPath\n\t\t\t\t? validatePluginRelativePath(profile.systemPromptPath, \"agent.agents.systemPromptPath\")\n\t\t\t\t: undefined,\n\t\t})),\n\t\tteams: agent.teams?.map((team) => ({\n\t\t\t...team,\n\t\t\tworkflowPath: team.workflowPath\n\t\t\t\t? validatePluginRelativePath(team.workflowPath, \"agent.teams.workflowPath\")\n\t\t\t\t: undefined,\n\t\t})),\n\t};\n}\n\nfunction normalizeSkillPresentation(\n\tpresentation: PluginSkillPresentation | undefined,\n): PluginSkillPresentation | undefined {\n\tif (!presentation) return undefined;\n\tconst normalizeRule = (rule: PluginSkillPresentationRule): PluginSkillPresentationRule => ({\n\t\tdefaultVisibility: rule.defaultVisibility,\n\t\tsurfaces: rule.surfaces ? { ...rule.surfaces } : undefined,\n\t\tdisplayName: rule.displayName?.trim(),\n\t\tdisplayDescription: rule.displayDescription?.trim(),\n\t});\n\treturn {\n\t\tdefaultVisibility: presentation.defaultVisibility,\n\t\tsurfaces: presentation.surfaces ? { ...presentation.surfaces } : undefined,\n\t\tskills: presentation.skills\n\t\t\t? Object.fromEntries(\n\t\t\t\t\tObject.entries(presentation.skills).map(([name, rule]) => [name.trim(), normalizeRule(rule)]),\n\t\t\t\t)\n\t\t\t: undefined,\n\t};\n}\n\nfunction normalizeCliProviders(providers: PluginCliProviderManifest[] | undefined): PluginCliProviderManifest[] | undefined {\n\tif (!providers || providers.length === 0) return undefined;\n\tconst ids = new Set<string>();\n\treturn providers.map((provider) => {\n\t\tif (ids.has(provider.id)) throw new Error(`Duplicate CLI provider id: ${provider.id}`);\n\t\tids.add(provider.id);\n\t\treturn {\n\t\t\tid: provider.id,\n\t\t\tcommand: provider.command,\n\t\t\tprobe: provider.probe\n\t\t\t\t? { args: provider.probe.args ? [...provider.probe.args] : undefined, timeoutMs: provider.probe.timeoutMs }\n\t\t\t\t: undefined,\n\t\t\tinstall: {\n\t\t\t\tcommand: provider.install.command,\n\t\t\t\targs: provider.install.args ? [...provider.install.args] : undefined,\n\t\t\t\ttimeoutMs: provider.install.timeoutMs,\n\t\t\t},\n\t\t};\n\t});\n}\n\nfunction normalizeServiceProviders(\n\tproviders: PluginServiceProviderManifest[] | undefined,\n): PluginServiceProviderManifest[] | undefined {\n\tif (!providers || providers.length === 0) return undefined;\n\tconst ids = new Set<string>();\n\treturn providers.map((provider) => {\n\t\tif (ids.has(provider.id)) throw new Error(`Duplicate service provider id: ${provider.id}`);\n\t\tids.add(provider.id);\n\t\tconst runtimeKind: PluginServiceRuntimeKind = provider.runtime.kind ?? \"managed-binary\";\n\t\tconst entry = provider.runtime.entry\n\t\t\t? validatePluginRelativePath(provider.runtime.entry, `providers.services.${provider.id}.runtime.entry`)\n\t\t\t: undefined;\n\t\tif (runtimeKind === \"host-node\" && !entry) {\n\t\t\tthrow new Error(`Host-node service must declare runtime.entry: ${provider.id}`);\n\t\t}\n\t\tconst platforms: PluginServiceProviderManifest[\"runtime\"][\"platforms\"] = {};\n\t\tfor (const [platformTag, platform] of Object.entries(provider.runtime.platforms)) {\n\t\t\tconst destinations = new Set<string>();\n\t\t\tplatforms[platformTag] = {\n\t\t\t\texecutable: validatePluginRelativePath(platform.executable, `providers.services.${provider.id}.executable`),\n\t\t\t\tartifacts: platform.artifacts.map((artifact) => {\n\t\t\t\t\tconst destination = validatePluginRelativePath(\n\t\t\t\t\t\tartifact.destination,\n\t\t\t\t\t\t`providers.services.${provider.id}.artifacts.destination`,\n\t\t\t\t\t);\n\t\t\t\t\tif (destinations.has(destination)) {\n\t\t\t\t\t\tthrow new Error(`Duplicate service artifact destination: ${provider.id}/${platformTag}/${destination}`);\n\t\t\t\t\t}\n\t\t\t\t\tdestinations.add(destination);\n\t\t\t\t\treturn { ...artifact, destination };\n\t\t\t\t}),\n\t\t\t};\n\t\t}\n\t\tif (Object.keys(platforms).length === 0) {\n\t\t\tthrow new Error(`Service provider must declare at least one platform: ${provider.id}`);\n\t\t}\n\t\tconst credentialIds = new Set<string>();\n\t\tconst credentials = provider.credentials?.map((credential) => {\n\t\t\tif (credentialIds.has(credential.id)) throw new Error(`Duplicate service credential id: ${provider.id}/${credential.id}`);\n\t\t\tcredentialIds.add(credential.id);\n\t\t\treturn { id: credential.id, bytes: credential.bytes };\n\t\t});\n\t\tif (provider.health.credentialId && !credentialIds.has(provider.health.credentialId)) {\n\t\t\tthrow new Error(`Unknown service health credential: ${provider.id}/${provider.health.credentialId}`);\n\t\t}\n\t\tconst templateDestinations = new Set<string>();\n\t\tconst templates = provider.templates?.map((template) => {\n\t\t\tconst source = validatePluginRelativePath(template.source, `providers.services.${provider.id}.templates.source`);\n\t\t\tconst destination = validatePluginRelativePath(\n\t\t\t\ttemplate.destination,\n\t\t\t\t`providers.services.${provider.id}.templates.destination`,\n\t\t\t);\n\t\t\tif (templateDestinations.has(destination)) throw new Error(`Duplicate service template destination: ${provider.id}/${destination}`);\n\t\t\ttemplateDestinations.add(destination);\n\t\t\treturn { source, destination, mode: template.mode };\n\t\t});\n\t\tconst normalizedRuntime: PluginServiceProviderManifest[\"runtime\"] = {\n\t\t\tversion: provider.runtime.version,\n\t\t\tplatforms,\n\t\t\t...(runtimeKind === \"host-node\" ? { kind: runtimeKind, entry } : provider.runtime.kind ? { kind: runtimeKind } : {}),\n\t\t};\n\t\treturn {\n\t\t\tid: provider.id,\n\t\t\truntime: normalizedRuntime,\n\t\t\tcredentials,\n\t\t\ttemplates,\n\t\t\tprocess: {\n\t\t\t\targs: provider.process.args ? [...provider.process.args] : undefined,\n\t\t\t\tenv: provider.process.env ? { ...provider.process.env } : undefined,\n\t\t\t},\n\t\t\thealth: { ...provider.health },\n\t\t};\n\t});\n}\n\nfunction normalizePluginMcpServerConfig(config: PluginMcpServerConfig): PluginMcpServerConfig {\n\tconst common = {\n\t\tdisabled: config.disabled,\n\t\tautoApprove: config.autoApprove?.map(trimString),\n\t\tstartupTimeout: config.startupTimeout,\n\t\tdebug: config.debug,\n\t\tdisplayName: config.displayName,\n\t\tdescription: config.description,\n\t\tagent_mode: normalizeOptionalAgentModes(config.agent_mode),\n\t};\n\tif (config.type === \"service\") {\n\t\treturn {\n\t\t\ttype: \"service\",\n\t\t\tserviceId: trimString(config.serviceId),\n\t\t\tpath: trimString(config.path),\n\t\t\t...common,\n\t\t};\n\t}\n\tif (config.type === \"http\") {\n\t\treturn {\n\t\t\ttype: \"http\",\n\t\t\turl: trimString(config.url),\n\t\t\theaders: config.headers ? { ...config.headers } : undefined,\n\t\t\toauthClientId: config.oauthClientId,\n\t\t\toauthDeviceFlow: config.oauthDeviceFlow,\n\t\t\toauthScopes: config.oauthScopes,\n\t\t\t...common,\n\t\t};\n\t}\n\treturn {\n\t\ttype: config.type,\n\t\tcommand: trimString(config.command),\n\t\targs: config.args ? [...config.args] : undefined,\n\t\tenv: config.env ? { ...config.env } : undefined,\n\t\tcwd: config.cwd,\n\t\t...common,\n\t};\n}\n\nexport function validatePluginId(id: string): void {\n\tif (!Value.Check(PluginIdSchema, id)) {\n\t\tthrow new Error(\"Plugin id must be 1-64 chars: lowercase letters, numbers, dot, underscore, or dash\");\n\t}\n}\n\nexport function validatePluginVersion(version: string): void {\n\tif (!Value.Check(PluginVersionSchema, version)) {\n\t\tthrow new Error(\"Plugin version must be 1-64 chars and cannot contain path separators\");\n\t}\n}\n\nexport function validatePluginRelativePath(value: string, fieldName: string): string {\n\tif (value.startsWith(\"/\") || /^[a-zA-Z]:/.test(value)) {\n\t\tthrow new Error(`Invalid plugin ${fieldName}`);\n\t}\n\tconst parts: string[] = [];\n\tfor (const part of value.replace(/\\\\/g, \"/\").split(\"/\")) {\n\t\tif (part === \"\" || part === \".\") continue;\n\t\tif (part === \"..\") {\n\t\t\tif (parts.length === 0) throw new Error(`Invalid plugin ${fieldName}`);\n\t\t\tparts.pop();\n\t\t\tcontinue;\n\t\t}\n\t\tparts.push(part);\n\t}\n\tconst normalized = parts.join(\"/\");\n\tif (!normalized) throw new Error(`Invalid plugin ${fieldName}`);\n\treturn normalized;\n}\n\nexport function parsePluginCommandNames(value: unknown): string[] {\n\tif (value === undefined) return [];\n\tassertSchema(PluginCommandNamesSchema, value, \"commands\");\n\treturn Array.from(new Set(value));\n}\n\n/** @deprecated agent_mode 已无任何运行时语义(ADR-0071),保留仅为容忍既有 manifest。 */\nexport function normalizePluginAgentModes(value: unknown): string[] | undefined {\n\tif (value === undefined || value === null) return undefined;\n\tconst values = Array.isArray(value) ? value : [value];\n\tconst modes = values.map((item) => String(item).trim()).filter(Boolean);\n\treturn modes.length > 0 ? modes : undefined;\n}\n\nexport function parsePluginMcpServerConfig(name: string, raw: unknown): PluginMcpServerConfig {\n\tassertSchema(PluginMcpServerConfigSchema, raw, `MCP server '${name}'`);\n\treturn normalizePluginMcpServerConfig(raw);\n}\n\nexport function isPluginPassthroughIconRef(icon: string): boolean {\n\treturn (\n\t\ticon.startsWith(\"http://\") ||\n\t\ticon.startsWith(\"https://\") ||\n\t\t/^[a-z0-9]+(?:-[a-z0-9]+)*:[a-z0-9]+(?:-[a-z0-9]+)*$/.test(icon)\n\t);\n}\n\nexport function isPluginPackagedIconPath(icon: string): boolean {\n\treturn !isPluginPassthroughIconRef(icon);\n}\n\nexport function parsePluginManifest(raw: unknown): PluginManifest {\n\tif (typeof raw === \"object\" && raw !== null && \"runtime\" in raw) {\n\t\tthrow new Error(\n\t\t\t'Invalid plugin manifest.runtime: runtime selection is unsupported; plugins use Module Federation.',\n\t\t);\n\t}\n\tassertSchema(PluginManifestSchema, raw, \"manifest\");\n\tconst commands = parsePluginCommandNames(raw.commands);\n\tconst icon = raw.icon === undefined ? undefined : trimString(raw.icon);\n\tconst permissions = normalizePermissions(raw.permissions);\n\tconst network = normalizeNetworkManifest(raw.network);\n\tconst browser = normalizeBrowserManifest(raw.browser);\n\tif (permissions.includes(\"network.fetch\") && !network) {\n\t\tthrow new Error(\"Plugin network.allowedHosts is required with network.fetch\");\n\t}\n\tconst browserPermissions = permissions.filter((permission) => permission.startsWith(\"browser.\"));\n\tif (browserPermissions.length > 0 && !browser) {\n\t\tthrow new Error(\"Plugin browser.allowedHosts is required with browser permissions\");\n\t}\n\tif (permissions.includes(\"browser.interact\") && !permissions.includes(\"browser.read\")) {\n\t\tthrow new Error(\"Plugin browser.interact requires browser.read\");\n\t}\n\tconst normalizedServices = raw.providers ? normalizeServiceProviders(raw.providers.services) : undefined;\n\tfor (const [name, server] of Object.entries(raw.agent?.mcpServers && typeof raw.agent.mcpServers !== \"string\" ? raw.agent.mcpServers : {})) {\n\t\tif (server.type === \"service\" && !normalizedServices?.some((service) => service.id === server.serviceId)) {\n\t\t\tthrow new Error(`Plugin MCP server '${name}' references unknown service '${server.serviceId}'`);\n\t\t}\n\t}\n\treturn {\n\t\tid: raw.id,\n\t\tname: trimString(raw.name),\n\t\tversion: raw.version,\n\t\tpluginApiVersion: trimString(raw.pluginApiVersion),\n\t\tentry: validatePluginRelativePath(trimString(raw.entry), \"entry\"),\n\t\tmoduleFederation: normalizeModuleFederation(raw.moduleFederation),\n\t\tagent: normalizeAgentManifest(raw.agent),\n\t\tproviders: raw.providers\n\t\t\t? {\n\t\t\t\t\tcli: normalizeCliProviders(raw.providers.cli),\n\t\t\t\t\tservices: normalizedServices,\n\t\t\t\t}\n\t\t\t: undefined,\n\t\tstyles: normalizeStringArray(raw.styles).map((style) => validatePluginRelativePath(style, \"styles\")),\n\t\tpermissions,\n\t\tnetwork,\n\t\tbrowser,\n\t\tcommands: commands.length > 0 ? commands : undefined,\n\t\tdescription: raw.description,\n\t\tauthor: raw.author,\n\t\ticon:\n\t\t\ticon === undefined || isPluginPassthroughIconRef(icon)\n\t\t\t\t? icon\n\t\t\t\t: validatePluginRelativePath(icon, \"icon\"),\n\t\tguidingWords: raw.guidingWords?.map(trimString),\n\t\tdefaultLocale: raw.defaultLocale ?? \"zh\",\n\t\tcontributionMode: raw.contributionMode\n\t\t\t? { hardIsolation: raw.contributionMode.hardIsolation === true }\n\t\t\t: undefined,\n\t\tagent_mode: normalizePluginAgentModes(raw.agent_mode),\n\t};\n}\n\nexport function listPluginManifestResources(\n\tmanifest: PluginManifest,\n): PluginManifestResourceReference[] {\n\tconst resources: PluginManifestResourceReference[] = [\n\t\t{ field: \"entry\", path: manifest.entry, kind: \"file\" },\n\t];\n\tfor (const stylePath of manifest.styles ?? []) {\n\t\tresources.push({ field: \"styles\", path: stylePath, kind: \"file\" });\n\t}\n\tif (manifest.icon && isPluginPackagedIconPath(manifest.icon)) {\n\t\tresources.push({ field: \"icon\", path: manifest.icon, kind: \"file\" });\n\t}\n\tfor (const promptPath of manifest.agent?.systemPrompt?.promptPaths ?? []) {\n\t\tresources.push({ field: \"agent.systemPrompt.promptPaths\", path: promptPath, kind: \"file-or-directory\" });\n\t}\n\tfor (const skillPath of manifest.agent?.skillPaths ?? []) {\n\t\tresources.push({ field: \"agent.skillPaths\", path: skillPath, kind: \"file-or-directory\" });\n\t}\n\tfor (const agent of manifest.agent?.agents ?? []) {\n\t\t// 人设与头像是插件包里的真实文件:不登记就不会被打进包,装到用户机器上时这个\n\t\t// 智能体会因为「提示词读不出来」被整个跳过。\n\t\tif (agent.avatar) resources.push({ field: \"agent.agents.avatar\", path: agent.avatar, kind: \"file\" });\n\t\tif (agent.systemPromptPath) {\n\t\t\tresources.push({ field: \"agent.agents.systemPromptPath\", path: agent.systemPromptPath, kind: \"file\" });\n\t\t}\n\t}\n\tfor (const team of manifest.agent?.teams ?? []) {\n\t\tif (team.workflowPath) {\n\t\t\tresources.push({ field: \"agent.teams.workflowPath\", path: team.workflowPath, kind: \"file\" });\n\t\t}\n\t}\n\tif (typeof manifest.agent?.mcpServers === \"string\") {\n\t\tresources.push({ field: \"agent.mcpServers\", path: manifest.agent.mcpServers, kind: \"file\" });\n\t}\n\tfor (const service of manifest.providers?.services ?? []) {\n\t\tfor (const template of service.templates ?? []) {\n\t\t\tresources.push({ field: `providers.services.${service.id}.templates.source`, path: template.source, kind: \"file\" });\n\t\t}\n\t}\n\treturn resources;\n}\n\nfunction parseApiVersion(value: string): readonly [number, number, number] | undefined {\n\tconst match = /^(\\d+)\\.(\\d+)\\.(\\d+)$/.exec(value);\n\tif (!match) return undefined;\n\treturn [Number(match[1]), Number(match[2]), Number(match[3])];\n}\n\nfunction compareApiVersions(\n\tleft: readonly [number, number, number],\n\tright: readonly [number, number, number],\n): number {\n\tfor (let index = 0; index < left.length; index += 1) {\n\t\tif (left[index] !== right[index]) return left[index] - right[index];\n\t}\n\treturn 0;\n}\n\nexport function isPluginApiCompatible(hostVersion: string, range: string): boolean {\n\tconst host = parseApiVersion(hostVersion);\n\tif (!host) return false;\n\tconst normalized = range.trim();\n\tconst exact = parseApiVersion(normalized);\n\tif (exact) return exact[0] === host[0] && compareApiVersions(host, exact) >= 0;\n\tconst caret = normalized.startsWith(\"^\") ? parseApiVersion(normalized.slice(1)) : undefined;\n\tif (caret) return caret[0] === host[0] && compareApiVersions(host, caret) >= 0;\n\tif (normalized === `^${host[0]}` || normalized === `${host[0]}.x`) return true;\n\tconst minimum = normalized.startsWith(\">=\") ? parseApiVersion(normalized.slice(2)) : undefined;\n\treturn minimum !== undefined && compareApiVersions(host, minimum) >= 0;\n}\n"]}
|
package/dist/models.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export interface PluginModelDefinition {
|
|
2
|
+
id: string;
|
|
3
|
+
name?: string;
|
|
4
|
+
api?: string;
|
|
5
|
+
reasoning?: boolean;
|
|
6
|
+
contextWindow?: number;
|
|
7
|
+
maxTokens?: number;
|
|
8
|
+
}
|
|
9
|
+
export interface PluginModelProviderConfig {
|
|
10
|
+
baseUrl?: string;
|
|
11
|
+
apiKey?: string;
|
|
12
|
+
api?: string;
|
|
13
|
+
displayName?: string;
|
|
14
|
+
authHeader?: boolean;
|
|
15
|
+
headers?: Record<string, string>;
|
|
16
|
+
models?: PluginModelDefinition[];
|
|
17
|
+
}
|
|
18
|
+
/** Reconciles the complete set of provider ids owned by the calling plugin. */
|
|
19
|
+
export interface PluginModelsApi {
|
|
20
|
+
replaceOwnedProviders(providers: Record<string, PluginModelProviderConfig>): Promise<void>;
|
|
21
|
+
/**
|
|
22
|
+
* Reads back what the host currently holds for this plugin, keyed by the same
|
|
23
|
+
* local provider ids `replaceOwnedProviders` accepts.
|
|
24
|
+
*
|
|
25
|
+
* `replaceOwnedProviders` deletes by omission, so a plugin that cannot read its
|
|
26
|
+
* own published state can only clobber it — every write has to reconstruct the
|
|
27
|
+
* whole truth from whatever its (often eventually consistent) upstream happens
|
|
28
|
+
* to report at that instant. Read this first and reconcile against it, so a
|
|
29
|
+
* model that is merely not visible yet is not mistaken for one the user lost.
|
|
30
|
+
*
|
|
31
|
+
* `apiKey` comes back masked; supply the real credential on the next write.
|
|
32
|
+
*/
|
|
33
|
+
listOwnedProviders(): Promise<Record<string, PluginModelProviderConfig>>;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=models.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../src/models.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,qBAAqB;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,yBAAyB;IACzC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,MAAM,CAAC,EAAE,qBAAqB,EAAE,CAAC;CACjC;AAED,+EAA+E;AAC/E,MAAM,WAAW,eAAe;IAC/B,qBAAqB,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,yBAAyB,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3F;;;;;;;;;;;OAWG;IACH,kBAAkB,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,yBAAyB,CAAC,CAAC,CAAC;CACzE","sourcesContent":["export interface PluginModelDefinition {\n\tid: string;\n\tname?: string;\n\tapi?: string;\n\treasoning?: boolean;\n\tcontextWindow?: number;\n\tmaxTokens?: number;\n}\n\nexport interface PluginModelProviderConfig {\n\tbaseUrl?: string;\n\tapiKey?: string;\n\tapi?: string;\n\tdisplayName?: string;\n\tauthHeader?: boolean;\n\theaders?: Record<string, string>;\n\tmodels?: PluginModelDefinition[];\n}\n\n/** Reconciles the complete set of provider ids owned by the calling plugin. */\nexport interface PluginModelsApi {\n\treplaceOwnedProviders(providers: Record<string, PluginModelProviderConfig>): Promise<void>;\n\t/**\n\t * Reads back what the host currently holds for this plugin, keyed by the same\n\t * local provider ids `replaceOwnedProviders` accepts.\n\t *\n\t * `replaceOwnedProviders` deletes by omission, so a plugin that cannot read its\n\t * own published state can only clobber it — every write has to reconstruct the\n\t * whole truth from whatever its (often eventually consistent) upstream happens\n\t * to report at that instant. Read this first and reconcile against it, so a\n\t * model that is merely not visible yet is not mistaken for one the user lost.\n\t *\n\t * `apiKey` comes back masked; supply the real credential on the next write.\n\t */\n\tlistOwnedProviders(): Promise<Record<string, PluginModelProviderConfig>>;\n}\n"]}
|
package/dist/models.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"models.js","sourceRoot":"","sources":["../src/models.ts"],"names":[],"mappings":"","sourcesContent":["export interface PluginModelDefinition {\n\tid: string;\n\tname?: string;\n\tapi?: string;\n\treasoning?: boolean;\n\tcontextWindow?: number;\n\tmaxTokens?: number;\n}\n\nexport interface PluginModelProviderConfig {\n\tbaseUrl?: string;\n\tapiKey?: string;\n\tapi?: string;\n\tdisplayName?: string;\n\tauthHeader?: boolean;\n\theaders?: Record<string, string>;\n\tmodels?: PluginModelDefinition[];\n}\n\n/** Reconciles the complete set of provider ids owned by the calling plugin. */\nexport interface PluginModelsApi {\n\treplaceOwnedProviders(providers: Record<string, PluginModelProviderConfig>): Promise<void>;\n\t/**\n\t * Reads back what the host currently holds for this plugin, keyed by the same\n\t * local provider ids `replaceOwnedProviders` accepts.\n\t *\n\t * `replaceOwnedProviders` deletes by omission, so a plugin that cannot read its\n\t * own published state can only clobber it — every write has to reconstruct the\n\t * whole truth from whatever its (often eventually consistent) upstream happens\n\t * to report at that instant. Read this first and reconcile against it, so a\n\t * model that is merely not visible yet is not mistaken for one the user lost.\n\t *\n\t * `apiKey` comes back masked; supply the real credential on the next write.\n\t */\n\tlistOwnedProviders(): Promise<Record<string, PluginModelProviderConfig>>;\n}\n"]}
|
package/dist/ocr.d.ts
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import type { OcrBlock, OcrErrorCode, OcrItemResult, OcrProviderDescriptor, OcrRequest as DomainOcrRequest, OcrResult } from "@vetta-org/capability-sdk";
|
|
2
|
+
import type { Disposable } from "./disposable.js";
|
|
3
|
+
export type { OcrBlock, OcrErrorCode, OcrItemResult, OcrProviderDescriptor, OcrResult };
|
|
4
|
+
export type OcrInput = {
|
|
5
|
+
id?: string;
|
|
6
|
+
mimeType?: string;
|
|
7
|
+
source: {
|
|
8
|
+
type: "plugin-blob";
|
|
9
|
+
blobId: string;
|
|
10
|
+
} | {
|
|
11
|
+
type: "workspace-file";
|
|
12
|
+
path: string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
/** Public consumer request. Ownership and storage namespaces are supplied by the host. */
|
|
16
|
+
export type OcrRequest = Omit<DomainOcrRequest, "ownerId" | "providerId" | "inputs"> & {
|
|
17
|
+
readonly inputs: readonly OcrInput[];
|
|
18
|
+
};
|
|
19
|
+
export type OcrProgress = {
|
|
20
|
+
phase: "queued" | "uploading" | "processing" | "finalizing";
|
|
21
|
+
completed: number;
|
|
22
|
+
total: number;
|
|
23
|
+
itemId?: string;
|
|
24
|
+
};
|
|
25
|
+
export type OcrProviderRequest = Omit<DomainOcrRequest, "ownerId" | "providerId" | "inputs"> & {
|
|
26
|
+
readonly inputs: readonly OcrProviderInput[];
|
|
27
|
+
};
|
|
28
|
+
export type OcrProviderInput = {
|
|
29
|
+
id: string;
|
|
30
|
+
mimeType?: string;
|
|
31
|
+
};
|
|
32
|
+
export type OcrUploadRequest = {
|
|
33
|
+
url: string;
|
|
34
|
+
fieldName: string;
|
|
35
|
+
fileName?: string;
|
|
36
|
+
fields?: Record<string, string>;
|
|
37
|
+
headers?: Record<string, string>;
|
|
38
|
+
timeoutMs?: number;
|
|
39
|
+
};
|
|
40
|
+
export type OcrTransferResponse<T = unknown> = {
|
|
41
|
+
ok: boolean;
|
|
42
|
+
status: number;
|
|
43
|
+
statusText: string;
|
|
44
|
+
headers: Record<string, string>;
|
|
45
|
+
body: T;
|
|
46
|
+
};
|
|
47
|
+
export type OcrProviderContext = {
|
|
48
|
+
readonly signal: AbortSignal;
|
|
49
|
+
readonly invocationId: string;
|
|
50
|
+
getInputUrl(inputId: string): Promise<string>;
|
|
51
|
+
uploadInput<T = unknown>(inputId: string, request: OcrUploadRequest): Promise<OcrTransferResponse<T>>;
|
|
52
|
+
reportProgress(event: OcrProgress): void;
|
|
53
|
+
};
|
|
54
|
+
export type OcrProviderRegistration = {
|
|
55
|
+
readonly id: string;
|
|
56
|
+
readonly displayName: string;
|
|
57
|
+
readonly protocolVersion: 1;
|
|
58
|
+
readonly processing: OcrProviderDescriptor["processing"];
|
|
59
|
+
readonly execution: OcrProviderDescriptor["execution"];
|
|
60
|
+
readonly input: OcrProviderDescriptor["input"];
|
|
61
|
+
readonly output: OcrProviderDescriptor["output"];
|
|
62
|
+
readonly network?: OcrProviderDescriptor["network"];
|
|
63
|
+
readonly configuration?: OcrProviderDescriptor["configuration"];
|
|
64
|
+
recognize(request: OcrProviderRequest, context: OcrProviderContext): Promise<OcrProviderResult>;
|
|
65
|
+
dispose?(): void | Promise<void>;
|
|
66
|
+
};
|
|
67
|
+
export type OcrProviderResult = Omit<OcrResult, "providerId">;
|
|
68
|
+
export type OcrClient = {
|
|
69
|
+
registerProvider(registration: OcrProviderRegistration): Disposable;
|
|
70
|
+
listProviders(): Promise<readonly OcrProviderDescriptor[]>;
|
|
71
|
+
onProvidersChanged(listener: () => void): Disposable;
|
|
72
|
+
recognize(request: OcrRequest, options?: {
|
|
73
|
+
providerId?: string;
|
|
74
|
+
signal?: AbortSignal;
|
|
75
|
+
onProgress?: (event: OcrProgress) => void;
|
|
76
|
+
}): Promise<OcrResult>;
|
|
77
|
+
};
|
|
78
|
+
//# sourceMappingURL=ocr.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ocr.d.ts","sourceRoot":"","sources":["../src/ocr.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,QAAQ,EACR,YAAY,EACZ,aAAa,EACb,qBAAqB,EACrB,UAAU,IAAI,gBAAgB,EAC9B,SAAS,EACT,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,YAAY,EAAE,QAAQ,EAAE,YAAY,EAAE,aAAa,EAAE,qBAAqB,EAAE,SAAS,EAAE,CAAC;AAExF,MAAM,MAAM,QAAQ,GAAG;IACtB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,EACH;QAAE,IAAI,EAAE,aAAa,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GACvC;QAAE,IAAI,EAAE,gBAAgB,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;CAC5C,CAAC;AAEF,0FAA0F;AAC1F,MAAM,MAAM,UAAU,GAAG,IAAI,CAAC,gBAAgB,EAAE,SAAS,GAAG,YAAY,GAAG,QAAQ,CAAC,GAAG;IACtF,QAAQ,CAAC,MAAM,EAAE,SAAS,QAAQ,EAAE,CAAC;CACrC,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACzB,KAAK,EAAE,QAAQ,GAAG,WAAW,GAAG,YAAY,GAAG,YAAY,CAAC;IAC5D,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,IAAI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O,CAAC,SAAS,CAAC,CAAC;CACvB,CAAC","sourcesContent":["import type {\n\tOcrBlock,\n\tOcrErrorCode,\n\tOcrItemResult,\n\tOcrProviderDescriptor,\n\tOcrRequest as DomainOcrRequest,\n\tOcrResult,\n} from \"@vetta-org/capability-sdk\";\nimport type { Disposable } from \"./disposable.js\";\n\nexport type { OcrBlock, OcrErrorCode, OcrItemResult, OcrProviderDescriptor, OcrResult };\n\nexport type OcrInput = {\n\tid?: string;\n\tmimeType?: string;\n\tsource:\n\t\t| { type: \"plugin-blob\"; blobId: string }\n\t\t| { type: \"workspace-file\"; path: string };\n};\n\n/** Public consumer request. Ownership and storage namespaces are supplied by the host. */\nexport type OcrRequest = Omit<DomainOcrRequest, \"ownerId\" | \"providerId\" | \"inputs\"> & {\n\treadonly inputs: readonly OcrInput[];\n};\n\nexport type OcrProgress = {\n\tphase: \"queued\" | \"uploading\" | \"processing\" | \"finalizing\";\n\tcompleted: number;\n\ttotal: number;\n\titemId?: string;\n};\n\nexport type OcrProviderRequest = Omit<DomainOcrRequest, \"ownerId\" | \"providerId\" | \"inputs\"> & {\n\treadonly inputs: readonly OcrProviderInput[];\n};\n\nexport type OcrProviderInput = {\n\tid: string;\n\tmimeType?: string;\n};\n\nexport type OcrUploadRequest = {\n\turl: string;\n\tfieldName: string;\n\tfileName?: string;\n\tfields?: Record<string, string>;\n\theaders?: Record<string, string>;\n\ttimeoutMs?: number;\n};\n\nexport type OcrTransferResponse<T = unknown> = {\n\tok: boolean;\n\tstatus: number;\n\tstatusText: string;\n\theaders: Record<string, string>;\n\tbody: T;\n};\n\nexport type OcrProviderContext = {\n\treadonly signal: AbortSignal;\n\treadonly invocationId: string;\n\tgetInputUrl(inputId: string): Promise<string>;\n\tuploadInput<T = unknown>(inputId: string, request: OcrUploadRequest): Promise<OcrTransferResponse<T>>;\n\treportProgress(event: OcrProgress): void;\n};\n\nexport type OcrProviderRegistration = {\n\treadonly id: string;\n\treadonly displayName: string;\n\treadonly protocolVersion: 1;\n\treadonly processing: OcrProviderDescriptor[\"processing\"];\n\treadonly execution: OcrProviderDescriptor[\"execution\"];\n\treadonly input: OcrProviderDescriptor[\"input\"];\n\treadonly output: OcrProviderDescriptor[\"output\"];\n\treadonly network?: OcrProviderDescriptor[\"network\"];\n\treadonly configuration?: OcrProviderDescriptor[\"configuration\"];\n\trecognize(request: OcrProviderRequest, context: OcrProviderContext): Promise<OcrProviderResult>;\n\tdispose?(): void | Promise<void>;\n};\n\nexport type OcrProviderResult = Omit<OcrResult, \"providerId\">;\n\nexport type OcrClient = {\n\tregisterProvider(registration: OcrProviderRegistration): Disposable;\n\tlistProviders(): Promise<readonly OcrProviderDescriptor[]>;\n\tonProvidersChanged(listener: () => void): Disposable;\n\trecognize(request: OcrRequest, options?: {\n\t\tproviderId?: string;\n\t\tsignal?: AbortSignal;\n\t\tonProgress?: (event: OcrProgress) => void;\n\t}): Promise<OcrResult>;\n};\n"]}
|
package/dist/ocr.js
ADDED
package/dist/ocr.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ocr.js","sourceRoot":"","sources":["../src/ocr.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n\tOcrBlock,\n\tOcrErrorCode,\n\tOcrItemResult,\n\tOcrProviderDescriptor,\n\tOcrRequest as DomainOcrRequest,\n\tOcrResult,\n} from \"@vetta-org/capability-sdk\";\nimport type { Disposable } from \"./disposable.js\";\n\nexport type { OcrBlock, OcrErrorCode, OcrItemResult, OcrProviderDescriptor, OcrResult };\n\nexport type OcrInput = {\n\tid?: string;\n\tmimeType?: string;\n\tsource:\n\t\t| { type: \"plugin-blob\"; blobId: string }\n\t\t| { type: \"workspace-file\"; path: string };\n};\n\n/** Public consumer request. Ownership and storage namespaces are supplied by the host. */\nexport type OcrRequest = Omit<DomainOcrRequest, \"ownerId\" | \"providerId\" | \"inputs\"> & {\n\treadonly inputs: readonly OcrInput[];\n};\n\nexport type OcrProgress = {\n\tphase: \"queued\" | \"uploading\" | \"processing\" | \"finalizing\";\n\tcompleted: number;\n\ttotal: number;\n\titemId?: string;\n};\n\nexport type OcrProviderRequest = Omit<DomainOcrRequest, \"ownerId\" | \"providerId\" | \"inputs\"> & {\n\treadonly inputs: readonly OcrProviderInput[];\n};\n\nexport type OcrProviderInput = {\n\tid: string;\n\tmimeType?: string;\n};\n\nexport type OcrUploadRequest = {\n\turl: string;\n\tfieldName: string;\n\tfileName?: string;\n\tfields?: Record<string, string>;\n\theaders?: Record<string, string>;\n\ttimeoutMs?: number;\n};\n\nexport type OcrTransferResponse<T = unknown> = {\n\tok: boolean;\n\tstatus: number;\n\tstatusText: string;\n\theaders: Record<string, string>;\n\tbody: T;\n};\n\nexport type OcrProviderContext = {\n\treadonly signal: AbortSignal;\n\treadonly invocationId: string;\n\tgetInputUrl(inputId: string): Promise<string>;\n\tuploadInput<T = unknown>(inputId: string, request: OcrUploadRequest): Promise<OcrTransferResponse<T>>;\n\treportProgress(event: OcrProgress): void;\n};\n\nexport type OcrProviderRegistration = {\n\treadonly id: string;\n\treadonly displayName: string;\n\treadonly protocolVersion: 1;\n\treadonly processing: OcrProviderDescriptor[\"processing\"];\n\treadonly execution: OcrProviderDescriptor[\"execution\"];\n\treadonly input: OcrProviderDescriptor[\"input\"];\n\treadonly output: OcrProviderDescriptor[\"output\"];\n\treadonly network?: OcrProviderDescriptor[\"network\"];\n\treadonly configuration?: OcrProviderDescriptor[\"configuration\"];\n\trecognize(request: OcrProviderRequest, context: OcrProviderContext): Promise<OcrProviderResult>;\n\tdispose?(): void | Promise<void>;\n};\n\nexport type OcrProviderResult = Omit<OcrResult, \"providerId\">;\n\nexport type OcrClient = {\n\tregisterProvider(registration: OcrProviderRegistration): Disposable;\n\tlistProviders(): Promise<readonly OcrProviderDescriptor[]>;\n\tonProvidersChanged(listener: () => void): Disposable;\n\trecognize(request: OcrRequest, options?: {\n\t\tproviderId?: string;\n\t\tsignal?: AbortSignal;\n\t\tonProgress?: (event: OcrProgress) => void;\n\t}): Promise<OcrResult>;\n};\n"]}
|
package/dist/official.d.ts
CHANGED
|
@@ -529,6 +529,7 @@ export interface PluginOfficialApi {
|
|
|
529
529
|
defaultModel: string;
|
|
530
530
|
}>;
|
|
531
531
|
upsertProvider(provider: string, data: PluginOfficialProviderUpsertData): Promise<PluginOfficialProviderDetail>;
|
|
532
|
+
/** Removes the provider when present. Repeated removal is an idempotent no-op. */
|
|
532
533
|
removeProvider(provider: string): Promise<void>;
|
|
533
534
|
};
|
|
534
535
|
projects: {
|