@jini-ai/agent-plugins 0.7.3-next.1 → 0.7.3-next.3
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/CHANGELOG.md +2 -0
- package/README.md +22 -4
- package/calendly/README.md +29 -0
- package/calendly/mcp.json +1 -1
- package/cloudflare/lib/assets.mjs +1 -1
- package/cloudflare/lib/cms-forms.mjs +1 -1
- package/core/persistent-state.d.ts +4 -1
- package/core/persistent-state.js +55 -21
- package/dist/admin-surfaces/callback-field-inbox.d.ts +1 -6
- package/dist/admin-surfaces/connections/connections.d.ts +2 -6
- package/dist/admin-surfaces/connections/index.d.ts +3 -2
- package/dist/admin-surfaces/index.d.ts +3 -1
- package/dist/connect/access-token-tool.d.ts +1 -1
- package/dist/connect/access-token-tool.js +1 -1
- package/dist/connect/catalog.d.ts +26 -0
- package/dist/connect/catalog.js +42 -0
- package/dist/connect/connect-tool.d.ts +2 -294
- package/dist/connect/connect-tool.js +2 -53
- package/dist/connect/contracts.d.ts +257 -0
- package/dist/connect/contracts.js +2 -0
- package/dist/connect/credential-cards.d.ts +2 -0
- package/dist/connect/credential-cards.js +7 -4
- package/dist/connect/grant-signed-in-defaults.js +1 -1
- package/dist/connect/host-deps.d.ts +32 -0
- package/dist/connect/host-deps.js +35 -0
- package/dist/connect/import-access-token.js +1 -1
- package/dist/connect/index.d.ts +7 -2
- package/dist/connect/index.js +5 -2
- package/dist/connect/installed-plugin.d.ts +28 -0
- package/dist/connect/installed-plugin.js +19 -0
- package/dist/connect/new-site-agent-plugin-tokens.d.ts +88 -0
- package/dist/connect/new-site-agent-plugin-tokens.js +107 -0
- package/dist/connect/plugin-host/index.d.ts +2 -2
- package/dist/connect/plugin-host/index.js +19 -10
- package/dist/connect/token-sign-in.d.ts +1 -14
- package/dist/connect/token-sign-in.js +4 -23
- package/dist/core/export-props.d.ts +10 -0
- package/dist/core/export-props.js +31 -0
- package/dist/core/folder-zip-error.d.ts +5 -0
- package/dist/core/folder-zip-error.js +8 -0
- package/dist/core/host-incompatible-error.d.ts +8 -0
- package/dist/core/host-incompatible-error.js +9 -0
- package/dist/core/identity-namespace.d.ts +27 -16
- package/dist/core/identity-namespace.js +25 -22
- package/dist/core/plugin-display-name.d.ts +7 -0
- package/dist/core/plugin-display-name.js +11 -0
- package/dist/core/provider-plugin-link.d.ts +7 -0
- package/dist/core/provider-plugin-link.js +5 -0
- package/dist/{connect → core}/token-map.d.ts +11 -1
- package/dist/{connect → core}/token-map.js +15 -0
- package/dist/core/token-sign-in-list.d.ts +18 -0
- package/dist/core/token-sign-in-list.js +23 -0
- package/dist/core/update-error.d.ts +8 -0
- package/dist/core/update-error.js +9 -0
- package/dist/{lifecycle → core}/update-plan.d.ts +1 -1
- package/dist/ffmpeg-transcode/adapter.d.ts +74 -0
- package/dist/ffmpeg-transcode/adapter.js +155 -0
- package/dist/folder-zip-node.d.ts +2 -1
- package/dist/folder-zip-node.js +6 -5
- package/dist/folder-zip.d.ts +0 -4
- package/dist/folder-zip.js +1 -7
- package/dist/index.d.ts +3 -1
- package/dist/lifecycle/activation.d.ts +39 -3
- package/dist/lifecycle/activation.js +467 -418
- package/dist/lifecycle/automatic-use-offer.d.ts +62 -0
- package/dist/lifecycle/automatic-use-offer.js +52 -0
- package/dist/lifecycle/automatic-use.d.ts +33 -1
- package/dist/lifecycle/automatic-use.js +157 -38
- package/dist/lifecycle/bundled-source-archive.d.ts +1 -1
- package/dist/lifecycle/capability-projection.d.ts +0 -1
- package/dist/lifecycle/capability-projection.js +92 -23
- package/dist/lifecycle/compatibility-metadata.d.ts +1 -0
- package/dist/lifecycle/compatibility-metadata.js +6 -1
- package/dist/lifecycle/compatibility.d.ts +1 -8
- package/dist/lifecycle/compatibility.js +1 -8
- package/dist/lifecycle/credential-card-metadata.d.ts +2 -2
- package/dist/lifecycle/exports.d.ts +2 -45
- package/dist/lifecycle/exports.js +1 -30
- package/dist/lifecycle/host-tools/identity.d.ts +5 -4
- package/dist/lifecycle/host-tools/identity.js +5 -5
- package/dist/lifecycle/host-tools/ports.d.ts +10 -1
- package/dist/lifecycle/host-tools/search-tool.d.ts +4 -2
- package/dist/lifecycle/host-tools/search-tool.js +19 -8
- package/dist/lifecycle/host-tools/skill-tool.js +1 -1
- package/dist/lifecycle/index.d.ts +20 -17
- package/dist/lifecycle/index.js +5 -4
- package/dist/lifecycle/install-from-url.d.ts +1 -2
- package/dist/lifecycle/install.d.ts +4 -34
- package/dist/lifecycle/install.js +3 -3
- package/dist/lifecycle/installed-package-index.d.ts +1 -1
- package/dist/lifecycle/installed-package-index.js +4 -4
- package/dist/lifecycle/layout.d.ts +21 -25
- package/dist/lifecycle/layout.js +79 -0
- package/dist/lifecycle/manifest.d.ts +10 -7
- package/dist/lifecycle/manifest.js +20 -15
- package/dist/lifecycle/mcp-provisioning.d.ts +1 -1
- package/dist/lifecycle/metadata.d.ts +6 -3
- package/dist/lifecycle/metadata.js +2 -1
- package/dist/lifecycle/package-paths.js +59 -56
- package/dist/lifecycle/persistent-state.d.ts +10 -1
- package/dist/lifecycle/persistent-state.js +4 -2
- package/dist/lifecycle/ports.d.ts +18 -6
- package/dist/lifecycle/resolve-agent-plugin-refs.d.ts +2 -14
- package/dist/lifecycle/retire-bundled.d.ts +1 -1
- package/dist/lifecycle/search-projection.d.ts +3 -1
- package/dist/lifecycle/search-projection.js +7 -3
- package/dist/lifecycle/search.d.ts +1 -0
- package/dist/lifecycle/seed-bundled.d.ts +86 -1
- package/dist/lifecycle/seed-bundled.js +48 -84
- package/dist/lifecycle/set-enabled.d.ts +1 -13
- package/dist/lifecycle/set-enabled.js +11 -7
- package/dist/lifecycle/trusted-plugin-files.d.ts +1 -1
- package/dist/lifecycle/trusted-plugin-files.js +33 -30
- package/dist/lifecycle/types.d.ts +13 -34
- package/dist/lifecycle/uninstall.d.ts +1 -33
- package/dist/lifecycle/update-store.d.ts +0 -7
- package/dist/lifecycle/update-store.js +1 -8
- package/dist/lifecycle/update.d.ts +1 -1
- package/dist/lifecycle/update.js +60 -10
- package/dist/lifecycle/yauzl-archive-reader.d.ts +7 -2
- package/dist/lifecycle/yauzl-archive-reader.js +11 -6
- package/dist/manifest.d.ts +4 -8
- package/dist/react/AgentPluginDetailsModal.d.ts +187 -0
- package/dist/react/AgentPluginDetailsModal.js +29 -0
- package/dist/react/agent-plugin-install-port.d.ts +24 -0
- package/dist/react/agent-plugin-install-port.js +15 -0
- package/dist/react/installed-skills-composer-source.d.ts +60 -0
- package/dist/react/installed-skills-composer-source.js +111 -0
- package/dist/react/use-agent-plugins.hooks.d.ts +211 -0
- package/dist/react/use-agent-plugins.hooks.js +128 -0
- package/dist/site/activation-effects.d.ts +17 -0
- package/dist/site/activation-effects.js +31 -0
- package/dist/site/admin-surfaces/capabilities.d.ts +29 -0
- package/dist/site/admin-surfaces/capabilities.js +30 -0
- package/dist/site/admin-surfaces/delivery-bindings.d.ts +81 -0
- package/dist/site/admin-surfaces/delivery-bindings.js +161 -0
- package/dist/site/admin-surfaces/forms.d.ts +28 -0
- package/dist/site/admin-surfaces/forms.js +29 -0
- package/dist/site/admin-surfaces/handlers.d.ts +61 -0
- package/dist/site/admin-surfaces/handlers.js +35 -0
- package/dist/site/admin-surfaces/public-config.d.ts +12 -0
- package/dist/site/admin-surfaces/public-config.js +28 -0
- package/dist/site/analytics-provider-registry.d.ts +87 -0
- package/dist/site/analytics-provider-registry.js +87 -0
- package/dist/site/archive-reader-abi.d.ts +35 -0
- package/dist/site/archive-reader-abi.js +25 -0
- package/dist/site/auth-schemes.d.ts +110 -0
- package/dist/site/auth-schemes.js +119 -0
- package/dist/site/automatic-agent-plugins.d.ts +200 -0
- package/dist/site/automatic-agent-plugins.js +277 -0
- package/dist/site/bundled-contribution-sources.d.ts +24 -0
- package/dist/site/bundled-contribution-sources.js +17 -0
- package/dist/site/bundled-id-upgrade.d.ts +115 -0
- package/dist/site/bundled-id-upgrade.js +169 -0
- package/dist/site/customize-tool.d.ts +39 -0
- package/dist/site/customize-tool.js +31 -0
- package/dist/site/deploy-split-activation.d.ts +28 -0
- package/dist/site/deploy-split-activation.js +21 -0
- package/dist/site/exports/diagnostics.d.ts +37 -0
- package/dist/site/exports/diagnostics.js +55 -0
- package/dist/site/exports/runtime.d.ts +54 -0
- package/dist/site/exports/runtime.js +196 -0
- package/dist/site/exports/source.d.ts +42 -0
- package/dist/site/exports/source.js +58 -0
- package/dist/site/host-plugin-guidance.d.ts +137 -0
- package/dist/site/host-plugin-guidance.js +223 -0
- package/dist/site/host-signals.d.ts +78 -0
- package/dist/site/host-signals.js +83 -0
- package/dist/site/install-tool.d.ts +69 -0
- package/dist/site/install-tool.js +192 -0
- package/dist/site/install-upload.d.ts +175 -0
- package/dist/site/install-upload.js +324 -0
- package/dist/site/memory-i18n.d.ts +5 -0
- package/dist/site/memory-i18n.js +176 -0
- package/dist/site/memory.d.ts +80 -0
- package/dist/site/memory.js +83 -0
- package/dist/site/plugin-memory.d.ts +80 -0
- package/dist/site/plugin-memory.js +86 -0
- package/dist/site/provider-plugin-link.d.ts +112 -0
- package/dist/site/provider-plugin-link.js +100 -0
- package/dist/site/retired-plugin-tool-aliases.d.ts +40 -0
- package/dist/site/retired-plugin-tool-aliases.js +41 -0
- package/dist/site/service-ports.d.ts +108 -0
- package/dist/site/service-ports.js +2 -0
- package/dist/site/set-enabled.d.ts +80 -0
- package/dist/site/set-enabled.js +42 -0
- package/dist/site/soon-lock.d.ts +83 -0
- package/dist/site/soon-lock.js +78 -0
- package/dist/site/supersession.d.ts +61 -0
- package/dist/site/supersession.js +122 -0
- package/dist/site/uninstall-tool.d.ts +136 -0
- package/dist/site/uninstall-tool.js +203 -0
- package/dist/site/update-effects.d.ts +47 -0
- package/dist/site/update-effects.js +49 -0
- package/ffmpeg-transcode/plugin.json +16 -0
- package/github/source-control/backup-push.mjs +66 -46
- package/github/source-control/commit-site.mjs +124 -67
- package/github/source-control/write-files.mjs +86 -53
- package/github-pages/targets/github-pages.mjs +294 -233
- package/google-workspace/form-destinations/mapping.mjs +15 -7
- package/google-workspace/form-destinations/sheets.mjs +4 -2
- package/google-workspace/plugin.json +1 -0
- package/kuinetic/CHANGELOG.md +4 -0
- package/kuinetic/plugin.json +4 -1
- package/kuinetic/skills/kuinetic/SKILL.md +1 -2
- package/package.json +297 -20
- package/persistent-state.d.ts +4 -1
- package/resend/adapters/resend.mjs +5 -2
- package/resend/plugin.json +1 -1
- package/s3-compatible/jini-deploy-targets.json +1 -1
- package/s3-compatible/object-stores/s3-compatible.mjs +27 -4
- package/s3-compatible/targets/s3-compatible.mjs +3 -3
- package/site-import/plugin.json +3 -3
- package/site-import/skills/site-import/SKILL.md +62 -54
- package/site-import/skills/site-import/references/content-mapping.md +26 -20
- package/slide-design/plugin.json +1 -1
- package/slide-design/skills/slide-design/SKILL.md +8 -2
- package/ui-ux-design/CHANGELOG.md +6 -0
- package/ui-ux-design/plugin.json +1 -1
- package/ui-ux-design/skills/gstack-design/SKILL.md +6 -6
- package/ui-ux-design/skills/ui-ux-design/SKILL.md +3 -2
- package/ui-ux-design/skills/ui-ux-design/references/chrome-mobile-test-matrix.md +14 -12
- package/ui-ux-design/skills/ui-ux-design/references/ui-loop.md +16 -17
- package/vercel/NOTES.md +2 -1
- package/vercel/object-stores/vercel-blob.mjs +3 -4
- package/vercel/targets/vercel.mjs +425 -351
- package/core/commerce-server.d.ts +0 -2
- package/core/commerce-server.mjs +0 -2
- package/dist/admin-surfaces/connections/ports.d.ts +0 -110
- package/dist/admin-surfaces/connections/ports.js +0 -2
- /package/dist/{lifecycle → core}/install-errors.d.ts +0 -0
- /package/dist/{lifecycle → core}/install-errors.js +0 -0
- /package/dist/{lifecycle → core}/update-plan.js +0 -0
|
@@ -1,31 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file MCP transport trust classification and contained reads of installed plugin skills/config.
|
|
3
|
+
* Disk readers compose the lifecycle owner's path-containment guarantee with real file reads.
|
|
4
|
+
* See classifyAgentPluginMcpServerTrust for the local-execution and remote-tool admission boundary.
|
|
5
|
+
*
|
|
6
|
+
* The Agent Plugins v1.0.0 open standard parsed here is distinct from any host's own signed package
|
|
7
|
+
* format; their contracts cannot be unified. Only plugin.json metadata can authorize operator reads;
|
|
8
|
+
* legacy MCP entries still supply auth and sign-in grants. Remote hints may veto read trust but never
|
|
9
|
+
* supply it. Effects are supplied per host context.
|
|
10
|
+
*/
|
|
1
11
|
import { resolveAgentPluginLifecycleNamespace } from '../core/identity-namespace.js';
|
|
2
12
|
import { parseAgentPluginMcpConfig as parseAgentPluginMcpConfigValue } from "./manifest.js";
|
|
3
13
|
import { createPackagePathsModule } from "./package-paths.js";
|
|
4
14
|
import path from "node:path";
|
|
5
15
|
import { createSkillFileReader } from "./skill-file-reader.js";
|
|
6
|
-
function
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
*
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
async function readInstalledMcpConfig(packageRoot) {
|
|
16
|
+
function createInstalledMcpConfigReader({ readFile, assertContainedOnDisk, parseAgentPluginMcpConfig, ports }) {
|
|
17
|
+
/**
|
|
18
|
+
* Reads and parses one installed package's `mcp.json` — same containment guarantee as
|
|
19
|
+
* readInstalledSkillMarkdown, applied to a fixed, known-safe filename rather than a caller-supplied
|
|
20
|
+
* `skillPath`. Shared by readInstalledMcpServerIds and readInstalledMcpServers, which each reduce a
|
|
21
|
+
* different projection of the same parse.
|
|
22
|
+
*
|
|
23
|
+
* `mcp.json` is OPTIONAL per the Agent Plugins spec, so a missing file is not an error — it means
|
|
24
|
+
* this package declares no MCP servers, the common case for a skills-only package. A present but
|
|
25
|
+
* unparseable `mcp.json` (bad JSON, wrong `$schema`, malformed `mcpServers`) is ALSO tolerated rather
|
|
26
|
+
* than thrown: both readers back discovery paths whose whole purpose is staying usable even when one
|
|
27
|
+
* installed package is imperfect — the same fail-open posture `listInstalledPlugins` takes for a
|
|
28
|
+
* digest that fails to index at all (skipped, not fatal to every other plugin). Metadata warnings go
|
|
29
|
+
* to the host's `onEvent` sink as `agent-plugin-metadata-warning`; the host decides how to log them.
|
|
30
|
+
*
|
|
31
|
+
* @returns `null` for a missing file, invalid JSON, or a `mcp.json` that fails top-level validation
|
|
32
|
+
* — every one of these collapses to the same "nothing to report" outcome for both callers.
|
|
33
|
+
* @complexity O(s) in the declared server count plus one file read.
|
|
34
|
+
*/
|
|
35
|
+
return async function readInstalledMcpConfig(packageRoot) {
|
|
29
36
|
let raw;
|
|
30
37
|
try {
|
|
31
38
|
const absolute = await assertContainedOnDisk(packageRoot, "mcp.json");
|
|
@@ -41,6 +48,7 @@ function buildModule(ports) {
|
|
|
41
48
|
catch {
|
|
42
49
|
return null;
|
|
43
50
|
}
|
|
51
|
+
// Missing/malformed extensions cannot supply read trust; transport discovery still works.
|
|
44
52
|
let manifest;
|
|
45
53
|
try {
|
|
46
54
|
const absolute = await assertContainedOnDisk(packageRoot, "plugin.json");
|
|
@@ -53,11 +61,72 @@ function buildModule(ports) {
|
|
|
53
61
|
for (const message of result.warnings ?? [])
|
|
54
62
|
ports.onEvent?.({ event: 'agent-plugin-metadata-warning', message });
|
|
55
63
|
return result.ok ? result.config : null;
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
function buildModule(ports) {
|
|
67
|
+
const readFile = ports.filesystem.readFile.bind(ports.filesystem);
|
|
68
|
+
const parseAgentPluginMcpConfig = (value, pluginManifest) => parseAgentPluginMcpConfigValue({ value, extensionNamespace: resolveAgentPluginLifecycleNamespace({ value: pluginManifest, extensionNamespace: ports.extensionNamespace }, { legacyIdentity: ports.legacyIdentity }) }, { pluginManifest, readServerMetadata: ports.readServerMetadata, legacyMcpAliases: ports.legacyMcpAliases, legacyIdentity: ports.legacyIdentity });
|
|
69
|
+
const { assertContainedOnDisk } = createPackagePathsModule(ports);
|
|
70
|
+
const readInstalledMcpConfig = createInstalledMcpConfigReader({ readFile, assertContainedOnDisk, parseAgentPluginMcpConfig, ports });
|
|
71
|
+
/**
|
|
72
|
+
* A plugin must not execute arbitrary local code without explicit operator confirmation.
|
|
73
|
+
*
|
|
74
|
+
* - `stdio` declares `command`/`args` — a downloaded marketplace package choosing what process to
|
|
75
|
+
* spawn on this machine. That is exactly the local-code-execution case an operator must explicitly
|
|
76
|
+
* confirm before it ever runs; there is no secret-based mitigation for it, because the risk is not
|
|
77
|
+
* a leaked credential, it is arbitrary execution.
|
|
78
|
+
* - `streamable-http`/`sse` declare a URL the host calls over the network. There is no local
|
|
79
|
+
* execution, and (per the Agent Plugins grammar) the spec allows no embedded secret the host would
|
|
80
|
+
* need to protect — an `oauth`-mode connection mints its own token through the host's own RFC
|
|
81
|
+
* 8414/7591 flow, and a `none`-mode connection carries no credential at all. Either way,
|
|
82
|
+
* `@jini-ai/mcp`'s `federation/trust.ts` R2 default-deny allowlist still gates every individual
|
|
83
|
+
* remote TOOL independently at connect time — auto-admitting the SERVER here grants nothing beyond
|
|
84
|
+
* "this connection may be attempted."
|
|
85
|
+
*
|
|
86
|
+
* @returns `"requires-confirmation"` for `stdio` (never auto-run), `"auto-admit"` for a remote transport.
|
|
87
|
+
* @complexity O(1).
|
|
88
|
+
*/
|
|
89
|
+
function classifyAgentPluginMcpServerTrust(server) {
|
|
90
|
+
return server.type === "stdio" ? "requires-confirmation" : "auto-admit";
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Reads one installed skill's markdown through the same containment guarantee
|
|
94
|
+
* (`package-paths.ts`'s `assertContainedOnDisk`) install uses at extraction time — one
|
|
95
|
+
* implementation of "stay inside the package root," not two.
|
|
96
|
+
*
|
|
97
|
+
* @throws {PackagePathViolation} If `skillPath` resolves outside `packageRoot` (should be
|
|
98
|
+
* unreachable for a `skillPath` sourced from `InstalledAgentPlugin.skills`, which install only ever
|
|
99
|
+
* populates from paths it already walked inside an already-contained tree — defense in depth for a
|
|
100
|
+
* caller that constructs one by hand).
|
|
101
|
+
*/
|
|
102
|
+
async function readInstalledSkillMarkdown(packageRoot, skillPath) {
|
|
103
|
+
const absolute = await assertContainedOnDisk(packageRoot, skillPath);
|
|
104
|
+
return readFile(absolute, "utf8");
|
|
105
|
+
}
|
|
106
|
+
/** One shared progressive-disclosure read; the install's skillPath, never caller file input,
|
|
107
|
+
* selects the skill folder. Unknown/refused files produce a recoverable model-facing note. */
|
|
108
|
+
async function readInstalledSkillFile({ packageRoot, skillPath }, options = {}) {
|
|
109
|
+
try {
|
|
110
|
+
const skillRoot = path.dirname(await assertContainedOnDisk(packageRoot, skillPath));
|
|
111
|
+
return await createSkillFileReader({ skillRoot, filesystem: ports.filesystem }).read({}, options);
|
|
112
|
+
}
|
|
113
|
+
catch {
|
|
114
|
+
return { text: "", files: [], note: "File request refused: the installed skill folder is missing, unreadable, or outside the package. Valid supporting files: (none)." };
|
|
115
|
+
}
|
|
56
116
|
}
|
|
117
|
+
/** The server ids declared in one installed package's `mcp.json`, regardless of whether each one's
|
|
118
|
+
* own transport shape validated. Kept separate for callers that only need ids and should not pay for
|
|
119
|
+
* (or receive) transport configuration — the ids-only/full-config split between listing a server
|
|
120
|
+
* and launching one. @complexity See readInstalledMcpConfig. */
|
|
57
121
|
async function readInstalledMcpServerIds(packageRoot) {
|
|
58
122
|
const config = await readInstalledMcpConfig(packageRoot);
|
|
59
123
|
return config?.serverIds ?? [];
|
|
60
124
|
}
|
|
125
|
+
/** The full, validated transport configuration of every server whose shape validated — needed by
|
|
126
|
+
* any caller that must actually LAUNCH a server (trust classification, federation wiring). A server
|
|
127
|
+
* present in readInstalledMcpServerIds but absent here declared an unrecognized `type` or lacked a
|
|
128
|
+
* required field — fail-open per `manifest.ts`'s own contract. `{}` under every condition
|
|
129
|
+
* readInstalledMcpConfig tolerates. @complexity See readInstalledMcpConfig. */
|
|
61
130
|
async function readInstalledMcpServers(packageRoot) {
|
|
62
131
|
const config = await readInstalledMcpConfig(packageRoot);
|
|
63
132
|
return config?.servers ?? {};
|
|
@@ -13,6 +13,7 @@ export declare function readAgentPluginCompatibilityMetadata({ extension }: {
|
|
|
13
13
|
readonly extension: Readonly<Record<string, unknown>>;
|
|
14
14
|
}, _optional?: Record<string, never>): {
|
|
15
15
|
requires?: readonly string[];
|
|
16
|
+
readonly companions?: readonly string[] | undefined;
|
|
16
17
|
hostRange?: string;
|
|
17
18
|
warnings: string[];
|
|
18
19
|
};
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* import graph acyclic (`__tests__/type-cycles.test.ts`).
|
|
7
7
|
*/
|
|
8
8
|
import * as semver from 'semver';
|
|
9
|
+
import { isAgentPluginName } from '../core/plugin-name.js';
|
|
9
10
|
/** Stored in place of a present-but-unusable range so the plugin stays listable but never enables. */
|
|
10
11
|
export const INVALID_AGENT_PLUGIN_HOST_RANGE = '<invalid>';
|
|
11
12
|
/** A blank string is a semver wildcard, so blank is rejected here rather than silently allowed.
|
|
@@ -40,6 +41,10 @@ export function readAgentPluginCompatibilityMetadata({ extension }, _optional =
|
|
|
40
41
|
const warnings = [];
|
|
41
42
|
const requires = readRequires({ value: extension.requires, warnings });
|
|
42
43
|
const hostRange = readHostRange({ value: extension.hostRange, warnings });
|
|
43
|
-
|
|
44
|
+
const companions = Array.isArray(extension.companions) && extension.companions.every((value) => typeof value === 'string' && isAgentPluginName({ value }))
|
|
45
|
+
? [...new Set(extension.companions)] : undefined;
|
|
46
|
+
if (extension.companions !== undefined && companions === undefined)
|
|
47
|
+
warnings.push('companions must be an array of valid plugin names');
|
|
48
|
+
return { ...(companions === undefined ? {} : { companions }), ...(requires === undefined ? {} : { requires }), ...(hostRange === undefined ? {} : { hostRange }), warnings };
|
|
44
49
|
}
|
|
45
50
|
//# sourceMappingURL=compatibility-metadata.js.map
|
|
@@ -1,16 +1,9 @@
|
|
|
1
|
-
import type { InstalledAgentPlugin } from './types.js';
|
|
2
1
|
import type { AgentPluginActivations, AgentPluginOrigin } from './activation.js';
|
|
2
|
+
import type { InstalledAgentPlugin } from "@jini-ai/core/contracts/site/agent-plugins-lifecycle";
|
|
3
3
|
export { readAgentPluginCompatibilityMetadata, isValidAgentPluginHostRange, INVALID_AGENT_PLUGIN_HOST_RANGE } from './compatibility-metadata.js';
|
|
4
4
|
/** Host extension contract, independent of product releases and the upstream manifest schema.
|
|
5
5
|
* `hostRange` is checked against this, never against an app version. */
|
|
6
6
|
export declare const AGENT_PLUGIN_CONTRACT_VERSION = "1.0.0";
|
|
7
|
-
/** Named refusal shared by HTTP and tool adapters. */
|
|
8
|
-
export declare class AgentPluginHostIncompatibleError extends Error {
|
|
9
|
-
readonly code = "PLUGIN_HOST_INCOMPATIBLE";
|
|
10
|
-
constructor(required: {
|
|
11
|
-
pluginId: string;
|
|
12
|
-
}, _optional?: Record<string, never>);
|
|
13
|
-
}
|
|
14
7
|
export interface AgentPluginCompatibility {
|
|
15
8
|
readonly hostOk: boolean;
|
|
16
9
|
readonly missingRequires: readonly string[];
|
|
@@ -1,17 +1,10 @@
|
|
|
1
|
+
import { AgentPluginHostIncompatibleError } from "../core/host-incompatible-error.js";
|
|
1
2
|
import * as semver from 'semver';
|
|
2
3
|
import { isValidAgentPluginHostRange } from './compatibility-metadata.js';
|
|
3
4
|
export { readAgentPluginCompatibilityMetadata, isValidAgentPluginHostRange, INVALID_AGENT_PLUGIN_HOST_RANGE } from './compatibility-metadata.js';
|
|
4
5
|
/** Host extension contract, independent of product releases and the upstream manifest schema.
|
|
5
6
|
* `hostRange` is checked against this, never against an app version. */
|
|
6
7
|
export const AGENT_PLUGIN_CONTRACT_VERSION = '1.0.0';
|
|
7
|
-
/** Named refusal shared by HTTP and tool adapters. */
|
|
8
|
-
export class AgentPluginHostIncompatibleError extends Error {
|
|
9
|
-
code = 'PLUGIN_HOST_INCOMPATIBLE';
|
|
10
|
-
constructor(required, _optional = {}) {
|
|
11
|
-
super(`Plugin '${required.pluginId}' is not compatible with this host's Agent Plugin contract.`);
|
|
12
|
-
this.name = 'AgentPluginHostIncompatibleError';
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
8
|
/** Same rule as activation.ts `isAgentPluginActive`: an absent activation record means active. */
|
|
16
9
|
function isActive({ activations, pluginId }) {
|
|
17
10
|
return !Object.hasOwn(activations.plugins, pluginId) || activations.plugins[pluginId].enabled;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { PluginCredentialCard } from '@jini-ai/core/contracts/credentials';
|
|
2
2
|
export type { PluginCredentialField, PluginCredentialCard } from '@jini-ai/core/contracts/credentials';
|
|
3
|
+
import { type AgentPluginIdentityReadOptions } from '../core/identity-namespace.js';
|
|
3
4
|
import type { PluginContributionParseResult } from './contribution-types.js';
|
|
4
5
|
/** Shared by manifest and mail card parsers: purpose copy grants no routing or authority.
|
|
5
6
|
* @returns Trimmed display strings, or undefined for legacy cards.
|
|
@@ -16,8 +17,7 @@ export declare function parseCredentialCardUsedFor({ value }: {
|
|
|
16
17
|
*/
|
|
17
18
|
export declare function parsePluginCredentialCards({ raw }: {
|
|
18
19
|
raw: string;
|
|
19
|
-
}, options?: {
|
|
20
|
-
identityNamespace?: string;
|
|
20
|
+
}, options?: AgentPluginIdentityReadOptions & {
|
|
21
21
|
onWarning?: (warning: string) => void;
|
|
22
22
|
}): PluginContributionParseResult<PluginCredentialCard>;
|
|
23
23
|
//# sourceMappingURL=credential-card-metadata.d.ts.map
|
|
@@ -1,39 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
/** Matches the CMS consent vocabulary without introducing a dependency on CMS. */
|
|
3
|
-
export type AgentPluginExportConsent = 'necessary' | 'functional' | 'analytics' | 'marketing';
|
|
4
|
-
export type AgentPluginExportStaticMode = 'full' | 'link-only' | 'fallback-only';
|
|
5
|
-
/** Exact https origins an export may reach; the host adds them to the page's content-security policy. */
|
|
6
|
-
export interface AgentPluginExportExternalHosts {
|
|
7
|
-
readonly script?: readonly string[];
|
|
8
|
-
readonly frame?: readonly string[];
|
|
9
|
-
readonly connect?: readonly string[];
|
|
10
|
-
}
|
|
11
|
-
export interface AgentPluginExport {
|
|
12
|
-
readonly template: string;
|
|
13
|
-
readonly props: Extract<AdminSurfaceActionSchema, {
|
|
14
|
-
type: 'object';
|
|
15
|
-
}>;
|
|
16
|
-
readonly consent: AgentPluginExportConsent;
|
|
17
|
-
readonly staticExport: AgentPluginExportStaticMode;
|
|
18
|
-
readonly version: number;
|
|
19
|
-
/** Omitted means version 1; hosts accept minVersion <= marker version <= version. */
|
|
20
|
-
readonly minVersion?: number;
|
|
21
|
-
readonly aliases?: readonly string[];
|
|
22
|
-
/** Slot name -> capability declared by this same plugin's provides list. */
|
|
23
|
-
readonly hostLinks?: Readonly<Record<string, string>>;
|
|
24
|
-
readonly styles?: string;
|
|
25
|
-
readonly assets?: Readonly<Record<string, string>>;
|
|
26
|
-
/** Contained .js paths or https URLs on externalHosts.script, loaded in order behind `consent`. */
|
|
27
|
-
readonly scripts?: readonly string[];
|
|
28
|
-
readonly externalHosts?: AgentPluginExportExternalHosts;
|
|
29
|
-
/** String props that must be an https page on one of externalHosts.frame. */
|
|
30
|
-
readonly urlProps?: readonly string[];
|
|
31
|
-
}
|
|
32
|
-
export interface AgentPluginExportMetadata {
|
|
33
|
-
readonly exports?: Readonly<Record<string, AgentPluginExport>>;
|
|
34
|
-
/** Explicit publisher-qualified old identities; admission and ambiguity are host decisions. */
|
|
35
|
-
readonly renamedFrom?: readonly string[];
|
|
36
|
-
}
|
|
1
|
+
import type { AgentPluginExportMetadata } from "@jini-ai/core/contracts/site/agent-plugins-lifecycle";
|
|
37
2
|
export type ParseAgentPluginExportsResult = {
|
|
38
3
|
readonly ok: true;
|
|
39
4
|
readonly metadata: AgentPluginExportMetadata;
|
|
@@ -42,7 +7,7 @@ export type ParseAgentPluginExportsResult = {
|
|
|
42
7
|
readonly ok: false;
|
|
43
8
|
readonly errors: readonly string[];
|
|
44
9
|
};
|
|
45
|
-
type Entry
|
|
10
|
+
import type { Entry } from "../core/export-props.js";
|
|
46
11
|
/** Parses one namespace's exports; invalid known fields refuse the contract, unknown keys warn.
|
|
47
12
|
* File contents, trust admission, rename ambiguity and rendering remain host responsibilities.
|
|
48
13
|
* @returns Validated metadata or errors, without I/O. @complexity O(e + s + a) export, schema and alias entries.
|
|
@@ -51,12 +16,4 @@ export declare function parseAgentPluginExports({ extension, provides }: {
|
|
|
51
16
|
readonly extension: Entry;
|
|
52
17
|
readonly provides: readonly string[];
|
|
53
18
|
}, _optional?: Record<string, never>): ParseAgentPluginExportsResult;
|
|
54
|
-
/** Save and render share the existing bounded schema/value policy; messages never echo prop values.
|
|
55
|
-
* @returns First validation reason, or null on success. No side effects. @complexity O(p) prop values.
|
|
56
|
-
*/
|
|
57
|
-
export declare function validateAgentPluginExportProps({ definition, props }: {
|
|
58
|
-
readonly definition: AgentPluginExport;
|
|
59
|
-
readonly props: unknown;
|
|
60
|
-
}, _optional?: Record<string, never>): string | null;
|
|
61
|
-
export {};
|
|
62
19
|
//# sourceMappingURL=exports.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Declarative public-page exports. Parsing grants no trust and never reads plugin files. */
|
|
2
2
|
import { validatePluginIdentity } from '@jini-ai/core/plugin-directory';
|
|
3
|
-
import { checkAdminSurfaceActionSchema,
|
|
3
|
+
import { checkAdminSurfaceActionSchema, } from '../contracts/admin-surface-action-schema.js';
|
|
4
4
|
const KNOWN_KEYS = new Set(['template', 'props', 'consent', 'staticExport', 'version', 'minVersion', 'aliases', 'hostLinks', 'styles', 'assets', 'scripts', 'externalHosts', 'urlProps']);
|
|
5
5
|
const HOST_KINDS = ['script', 'frame', 'connect'];
|
|
6
6
|
const isObject = (value) => typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
@@ -130,33 +130,4 @@ function checkExport({ name, entry, provides, warnings }, _optional = {}) {
|
|
|
130
130
|
}
|
|
131
131
|
return checkVersions({ entry }) ?? checkFiles({ entry }) ?? checkExternal({ entry }) ?? checkContract({ entry, provides });
|
|
132
132
|
}
|
|
133
|
-
/** Save and render share the existing bounded schema/value policy; messages never echo prop values.
|
|
134
|
-
* @returns First validation reason, or null on success. No side effects. @complexity O(p) prop values.
|
|
135
|
-
*/
|
|
136
|
-
export function validateAgentPluginExportProps({ definition, props }, _optional = {}) {
|
|
137
|
-
if (exceedsAdminSurfacePayloadLimit({ payload: props }))
|
|
138
|
-
return 'props exceed the payload limit';
|
|
139
|
-
return validateAdminSurfaceActionValue({ schema: definition.props, value: props }) ?? checkUrlPropValues({ definition, props });
|
|
140
|
-
}
|
|
141
|
-
function isPageOn({ value, hosts }, _optional = {}) {
|
|
142
|
-
if (typeof value !== 'string')
|
|
143
|
-
return false;
|
|
144
|
-
try {
|
|
145
|
-
const url = new URL(value);
|
|
146
|
-
return url.protocol === 'https:' && !url.username && !url.password && url.pathname !== '/' && hosts.includes(url.origin);
|
|
147
|
-
}
|
|
148
|
-
catch {
|
|
149
|
-
return false;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
/** Runs after the schema, so props is a closed object. Reasons name the host, never the value. */
|
|
153
|
-
function checkUrlPropValues({ definition, props }, _optional = {}) {
|
|
154
|
-
const hosts = definition.externalHosts?.frame ?? [];
|
|
155
|
-
for (const name of definition.urlProps ?? []) {
|
|
156
|
-
const value = props[name];
|
|
157
|
-
if (value !== undefined && !isPageOn({ value, hosts }))
|
|
158
|
-
return `${name} must be an https link to a page on ${hosts.join(' or ')}`;
|
|
159
|
-
}
|
|
160
|
-
return null;
|
|
161
|
-
}
|
|
162
133
|
//# sourceMappingURL=exports.js.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type PluginIdentity } from '@jini-ai/core/plugin-directory';
|
|
2
|
-
import type
|
|
2
|
+
import { type AgentPluginIdentityReadOptions } from '../../core/identity-namespace.js';
|
|
3
|
+
import type { InstalledAgentPlugin } from "@jini-ai/core/contracts/site/agent-plugins-lifecycle";
|
|
3
4
|
/** Host metadata; absence keeps the plugin's normal presentation and behavior. */
|
|
4
5
|
export type PluginMaturity = 'untested' | 'soon';
|
|
5
6
|
/** Read the selected portable extension; unknown values warn without rejecting a usable plugin.
|
|
@@ -7,7 +8,7 @@ export type PluginMaturity = 'untested' | 'soon';
|
|
|
7
8
|
*/
|
|
8
9
|
export declare function readPluginMaturity({ manifest }: {
|
|
9
10
|
manifest: unknown;
|
|
10
|
-
}, options?: {
|
|
11
|
+
}, options?: Pick<AgentPluginIdentityReadOptions, "legacyIdentity"> & {
|
|
11
12
|
warn?: (message: string) => void;
|
|
12
13
|
}): PluginMaturity | undefined;
|
|
13
14
|
/** `extensions.jini.providerPlugin`: the provider plugin this agent plugin is the assistant face of
|
|
@@ -17,7 +18,7 @@ export declare function readPluginMaturity({ manifest }: {
|
|
|
17
18
|
* @complexity O(1). */
|
|
18
19
|
export declare function readProviderPluginLink({ manifest }: {
|
|
19
20
|
manifest: unknown;
|
|
20
|
-
}, options?: {
|
|
21
|
+
}, options?: Pick<AgentPluginIdentityReadOptions, "legacyIdentity"> & {
|
|
21
22
|
warn?: (message: string) => void;
|
|
22
23
|
}): string | undefined;
|
|
23
24
|
/** Shared instruction for every host guidance surface, so disclosure precedes credentials/actions. */
|
|
@@ -29,7 +30,7 @@ export declare const UNTESTED_PLUGIN_GUIDANCE = "Before saving keys or acting wi
|
|
|
29
30
|
*/
|
|
30
31
|
export declare function readInstalledAgentPluginIdentity({ plugin }: {
|
|
31
32
|
plugin: Pick<InstalledAgentPlugin, 'pluginId' | 'packageRoot'>;
|
|
32
|
-
}, optional?: {
|
|
33
|
+
}, optional?: Pick<AgentPluginIdentityReadOptions, "legacyIdentity"> & {
|
|
33
34
|
readText?: (filePath: string) => Promise<string>;
|
|
34
35
|
}): Promise<PluginIdentity & {
|
|
35
36
|
readonly maturity?: PluginMaturity;
|
|
@@ -10,7 +10,7 @@ import { readAgentPluginPortableExtension } from '../../core/identity-namespace.
|
|
|
10
10
|
*/
|
|
11
11
|
export function readPluginMaturity({ manifest }, options = {}) {
|
|
12
12
|
// The portable reader preserves old installed copies when the new namespace is absent.
|
|
13
|
-
const maturity = readAgentPluginPortableExtension({ value: manifest })?.maturity;
|
|
13
|
+
const maturity = readAgentPluginPortableExtension({ value: manifest }, options)?.maturity;
|
|
14
14
|
if (maturity === undefined)
|
|
15
15
|
return undefined;
|
|
16
16
|
if (maturity === 'untested' || maturity === 'soon')
|
|
@@ -26,7 +26,7 @@ const PROVIDER_PLUGIN_ID = /^[a-z0-9][a-z0-9._-]{0,99}$/;
|
|
|
26
26
|
* Unknown shapes warn and read as no link, so a typo never links to a wrong plugin.
|
|
27
27
|
* @complexity O(1). */
|
|
28
28
|
export function readProviderPluginLink({ manifest }, options = {}) {
|
|
29
|
-
const link = readAgentPluginPortableExtension({ value: manifest })?.providerPlugin;
|
|
29
|
+
const link = readAgentPluginPortableExtension({ value: manifest }, options)?.providerPlugin;
|
|
30
30
|
if (link === undefined)
|
|
31
31
|
return undefined;
|
|
32
32
|
if (typeof link === 'string' && PROVIDER_PLUGIN_ID.test(link))
|
|
@@ -50,10 +50,10 @@ export async function readInstalledAgentPluginIdentity({ plugin }, optional = {}
|
|
|
50
50
|
catch {
|
|
51
51
|
throw new Error('The installed plugin identity manifest could not be read.');
|
|
52
52
|
}
|
|
53
|
-
const extension = readAgentPluginPortableExtension({ value: manifest });
|
|
53
|
+
const extension = readAgentPluginPortableExtension({ value: manifest }, optional);
|
|
54
54
|
const identity = readPluginIdentity({ manifest: { ...manifest, extensions: { jini: extension } }, name: plugin.pluginId, namespace: 'jini' });
|
|
55
|
-
const maturity = readPluginMaturity({ manifest });
|
|
56
|
-
const providerPlugin = readProviderPluginLink({ manifest });
|
|
55
|
+
const maturity = readPluginMaturity({ manifest }, optional);
|
|
56
|
+
const providerPlugin = readProviderPluginLink({ manifest }, optional);
|
|
57
57
|
return { ...identity, ...(maturity ? { maturity } : {}), ...(providerPlugin ? { providerPlugin } : {}) };
|
|
58
58
|
}
|
|
59
59
|
//# sourceMappingURL=identity.js.map
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { LegacyAgentPluginIdentity } from "../../core/identity-namespace.js";
|
|
1
2
|
/**
|
|
2
3
|
* @file The ports the host-tools take. Each is structural, so a host binds its own lifecycle,
|
|
3
4
|
* activation effects, memory store, permission check and text without these tools importing a
|
|
@@ -8,8 +9,9 @@
|
|
|
8
9
|
import type { ToolMetadataById, ToolRegistration } from '@jini-ai/core';
|
|
9
10
|
import type { Logger } from '@jini-ai/core/primitives';
|
|
10
11
|
import type { createAgentPluginLifecycle } from '../index.js';
|
|
11
|
-
import type {
|
|
12
|
+
import type { PluginMaturity } from './identity.js';
|
|
12
13
|
import type { PluginMemory } from '../../../core/persistent-state.js';
|
|
14
|
+
import type { AgentPluginWorkspaceLayout } from "@jini-ai/core/contracts/site/agent-plugins-lifecycle";
|
|
13
15
|
type AgentPluginLifecycle = ReturnType<typeof createAgentPluginLifecycle>;
|
|
14
16
|
/** Installed-package reads, ranking and entry-path checks. */
|
|
15
17
|
export type HostToolsLifecyclePort = Pick<AgentPluginLifecycle, 'listInstalledPlugins' | 'readBundledAgentPluginDigests' | 'preferBundledAgentPluginDigests' | 'isInstalledDigestPresent' | 'readInstalledSkillMarkdown' | 'readInstalledSkillFile' | 'readInstalledMcpServerIds' | 'rankInstalledAgentPlugins' | 'normalizePackageEntryPath'>;
|
|
@@ -61,6 +63,7 @@ export interface HostToolMessages {
|
|
|
61
63
|
}
|
|
62
64
|
/** Every host-tools entry point takes this one bag. */
|
|
63
65
|
export interface AgentPluginHostToolPorts {
|
|
66
|
+
readonly legacyIdentity?: LegacyAgentPluginIdentity | undefined;
|
|
64
67
|
readonly report?: Pick<Logger, 'warn'>;
|
|
65
68
|
readonly lifecycle: HostToolsLifecyclePort;
|
|
66
69
|
readonly activations: HostToolsActivationsPort;
|
|
@@ -75,6 +78,12 @@ export interface AgentPluginHostToolPorts {
|
|
|
75
78
|
/** Host tool vocabulary and reviewed action policy, passed to `buildDomainRegistrations`. */
|
|
76
79
|
readonly metadata?: ToolMetadataById;
|
|
77
80
|
readonly messages?: HostToolMessages;
|
|
81
|
+
/** A maturity the host assigns a plugin whose manifest declares none (for example a host's own
|
|
82
|
+
* "soon" list). The manifest's own value wins. A `soon` plugin is listed as coming soon and is
|
|
83
|
+
* never offered for enable. */
|
|
84
|
+
readonly hostMaturity?: (required: {
|
|
85
|
+
readonly pluginId: string;
|
|
86
|
+
}) => PluginMaturity | undefined;
|
|
78
87
|
}
|
|
79
88
|
/** The approval families these tools register under. */
|
|
80
89
|
export type HostToolApprovalFamily = 'installed-guidance' | 'plugin-memory-read' | 'plugin-memory-write';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type AgentToolSideEffect, type ToolRegistration, type AgentToolDefinition } from "@jini-ai/core";
|
|
2
2
|
import type { AgentPluginSearchCandidate } from "../search.js";
|
|
3
3
|
import { type PluginMaturity } from "./identity.js";
|
|
4
|
-
import type { AgentPluginHostToolPorts, HostToolMessages } from "./ports.js";
|
|
4
|
+
import type { AgentPluginHostToolPorts, HostToolMessages, RequireHostToolPermission } from "./ports.js";
|
|
5
5
|
/** The narrow slice of the route-deps bag this tool's handler reads — only a workspace id, since
|
|
6
6
|
* everything else it needs (`listInstalledPlugins`, `readAgentPluginActivations`) is resolved from
|
|
7
7
|
* that id alone via `layout.ts`. Declared structurally, mirroring `PluginsToolDeps`'s own shape, so
|
|
@@ -70,5 +70,7 @@ export declare const agentPluginSearchDerivedRisk: ReadonlyMap<string, AgentTool
|
|
|
70
70
|
* @complexity O(1) to build; see {@link loadAgentPluginSearchCandidates} and
|
|
71
71
|
* {@link selectAgentPluginSearchCandidates} for the handler's per-call cost.
|
|
72
72
|
*/
|
|
73
|
-
export declare function buildAgentPluginSearchRegistrations(routeDeps: AgentPluginSearchToolDeps
|
|
73
|
+
export declare function buildAgentPluginSearchRegistrations(routeDeps: AgentPluginSearchToolDeps & {
|
|
74
|
+
requirePermission: RequireHostToolPermission;
|
|
75
|
+
}, _optional?: Record<string, never>): ToolRegistration[];
|
|
74
76
|
//# sourceMappingURL=search-tool.d.ts.map
|
|
@@ -91,7 +91,7 @@ function searchAgentPluginLocalDescription(names = {}) {
|
|
|
91
91
|
"Nonblank queries return ranked matches. " +
|
|
92
92
|
"Results are byte-bounded: id, pluginId, enabled, maturity when declared, and a short description. " +
|
|
93
93
|
(names.setEnabled ? `${names.setEnabled} changes enabled status. ` : "") +
|
|
94
|
-
"An installed, off result is only a catalog entry. Offer its enable card, then read its guidance before connecting or requesting credentials; never guess its sign-in method. " +
|
|
94
|
+
"An installed, off result is only a catalog entry. Offer its enable card (never for a coming-soon result, which cannot be turned on), then read its guidance before connecting or requesting credentials; never guess its sign-in method. " +
|
|
95
95
|
"Local packages only — never a marketplace or the web. Once you have the right id, " +
|
|
96
96
|
(names.loadGuidance ? `call ${names.loadGuidance} for that plugin's full guidance. ` : "load that plugin's full guidance. ") +
|
|
97
97
|
"Page with the returned nextOffset as offset, keeping query and limit unchanged.";
|
|
@@ -218,6 +218,7 @@ export function buildAgentPluginSearchRegistrations(routeDeps, _optional = {}) {
|
|
|
218
218
|
const input = requireInputRecord({ input: ctx.input });
|
|
219
219
|
const query = optionalString({ input, key: "query" }) ?? "";
|
|
220
220
|
const { offset, limit } = readAgentPluginSearchWindow({ input });
|
|
221
|
+
await routeDeps.requirePermission({ workspaceId: routeDeps.workspaceId, principalId: ctx.principal.id, permission: routeDeps.ports.permissions.use }, { entityType: "workspace", entityId: routeDeps.workspaceId });
|
|
221
222
|
const candidates = await loadAgentPluginSearchCandidates(routeDeps);
|
|
222
223
|
const ranked = selectAgentPluginSearchCandidates({ query, candidates, ports: routeDeps.ports });
|
|
223
224
|
return projectAgentPluginSearchPage({ candidates: ranked, offset, limit, totalInstalled: candidates.length });
|
|
@@ -258,21 +259,31 @@ async function resolveSkillsForSearchTolerant(plugin, ports) {
|
|
|
258
259
|
}
|
|
259
260
|
return skills;
|
|
260
261
|
}
|
|
261
|
-
|
|
262
|
-
const skills = await resolveSkillsForSearchTolerant(plugin, ports);
|
|
263
|
-
const mcpServerIds = await ports.lifecycle.readInstalledMcpServerIds({ packageRoot: plugin.packageRoot });
|
|
264
|
-
const identity = await readInstalledAgentPluginIdentity({ plugin });
|
|
262
|
+
function optionalPluginFields({ plugin }, _optional = {}) {
|
|
265
263
|
return {
|
|
266
|
-
pluginId: plugin.pluginId,
|
|
267
264
|
...(plugin.displayName !== undefined ? { displayName: plugin.displayName } : {}),
|
|
268
265
|
...(plugin.summary !== undefined ? { summary: plugin.summary } : {}),
|
|
269
266
|
...(plugin.version !== undefined ? { version: plugin.version } : {}),
|
|
270
267
|
...(plugin.description !== undefined ? { description: plugin.description } : {}),
|
|
268
|
+
...(plugin.requires !== undefined ? { requires: plugin.requires } : {}),
|
|
269
|
+
...(plugin.companions !== undefined ? { companions: plugin.companions } : {}),
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
async function buildSearchCandidate({ plugin, activations, ports }, _optional = {}) {
|
|
273
|
+
const skills = await resolveSkillsForSearchTolerant(plugin, ports);
|
|
274
|
+
const mcpServerIds = await ports.lifecycle.readInstalledMcpServerIds({ packageRoot: plugin.packageRoot });
|
|
275
|
+
const identity = await readInstalledAgentPluginIdentity({ plugin }, { legacyIdentity: ports.legacyIdentity });
|
|
276
|
+
const maturity = identity.maturity ?? ports.hostMaturity?.({ pluginId: plugin.pluginId });
|
|
277
|
+
const { requires, companions, ...displayFields } = optionalPluginFields({ plugin });
|
|
278
|
+
return {
|
|
279
|
+
pluginId: plugin.pluginId,
|
|
280
|
+
...displayFields,
|
|
271
281
|
id: identity.id,
|
|
272
|
-
...(
|
|
282
|
+
...(maturity ? { maturity } : {}),
|
|
273
283
|
...(identity.providerPlugin ? { providerPlugin: identity.providerPlugin } : {}),
|
|
274
284
|
provides: identity.provides,
|
|
275
|
-
...(
|
|
285
|
+
...(requires !== undefined ? { requires } : {}),
|
|
286
|
+
...(companions !== undefined ? { companions } : {}),
|
|
276
287
|
keywords: identity.keywords,
|
|
277
288
|
enabled: ports.activations.isAgentPluginActive({ activations: activations, pluginId: plugin.pluginId }),
|
|
278
289
|
skills: skills.map((skill) => ({ name: skill.name, summary: skill.summary })),
|
|
@@ -212,7 +212,7 @@ export async function loadInstalledAgentPluginToolSources(ctx, _optional = {}) {
|
|
|
212
212
|
// Empty skills leave nothing this plugin's tool could ever return.
|
|
213
213
|
if (plugin.skills.length > 0) {
|
|
214
214
|
const skills = await resolveSkillsForPlugin(plugin, ctx.ports);
|
|
215
|
-
const identity = await readInstalledAgentPluginIdentity({ plugin });
|
|
215
|
+
const identity = await readInstalledAgentPluginIdentity({ plugin }, { legacyIdentity: ctx.ports.legacyIdentity });
|
|
216
216
|
sourceByPluginId.set(plugin.pluginId, buildToolSource({ ...plugin, maturity: identity.maturity, publisherId: identity.id, keywords: identity.keywords, provides: identity.provides }, skills, ctx.ports));
|
|
217
217
|
}
|
|
218
218
|
}
|