@jini-ai/plugins 0.6.19 → 0.7.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/CHANGELOG.md +51 -0
- package/dist/host/admin-response.d.ts +93 -0
- package/dist/host/admin-response.js +32 -0
- package/dist/host/capability-tools.d.ts +369 -0
- package/dist/host/capability-tools.js +306 -0
- package/dist/host/declarative-content-types.d.ts +245 -0
- package/dist/host/declarative-content-types.js +270 -0
- package/dist/host/index.d.ts +3 -0
- package/dist/host/index.js +3 -0
- package/dist/host/manifest.d.ts +1 -4
- package/dist/host/manifest.js +2 -5
- package/dist/host/node/archive-policy.d.ts +57 -0
- package/dist/host/node/archive-policy.js +115 -0
- package/dist/host/node/index.d.ts +3 -0
- package/dist/host/node/index.js +3 -0
- package/dist/host/node/install.d.ts +1 -4
- package/dist/host/node/install.js +2 -8
- package/dist/host/node/invocation-binding.d.ts +45 -0
- package/dist/host/node/invocation-binding.js +69 -0
- package/dist/host/node/runtime-core.d.ts +273 -0
- package/dist/host/node/runtime-core.js +613 -0
- package/dist/host/node/source-drafts.d.ts +1 -5
- package/dist/host/node/source-drafts.js +2 -8
- package/dist/host/plugin-claims.d.ts +2 -1
- package/dist/host/plugin-claims.js +1 -1
- package/dist/host/plugin-format.d.ts +4 -0
- package/dist/host/plugin-format.js +4 -0
- package/dist/host/plugin-tool-errors.d.ts +11 -0
- package/dist/host/plugin-tool-errors.js +19 -0
- package/dist/host/source-policy.d.ts +2 -2
- package/dist/host/source-policy.js +3 -3
- package/dist/host/tools/contract.d.ts +397 -0
- package/dist/host/tools/contract.js +7 -0
- package/dist/host/tools/index.d.ts +7 -0
- package/dist/host/tools/index.js +6 -0
- package/dist/host/tools/install.d.ts +12 -0
- package/dist/host/tools/install.js +71 -0
- package/dist/host/tools/management.d.ts +51 -0
- package/dist/host/tools/management.js +607 -0
- package/dist/host/tools/source.d.ts +14 -0
- package/dist/host/tools/source.js +95 -0
- package/dist/host/worker/index.d.ts +1 -0
- package/dist/host/worker/index.js +1 -0
- package/dist/host/worker/start.d.ts +44 -0
- package/dist/host/worker/start.js +31 -0
- package/package.json +16 -9
|
@@ -0,0 +1,607 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lists runtime plugins and agent plugins separately because their row shapes and activation
|
|
3
|
+
* lifecycles differ; merging discovery would offer runtime activation to packages it cannot own.
|
|
4
|
+
* Both lists use the same read permission and workspace, avoiding cross-workspace disclosure.
|
|
5
|
+
*
|
|
6
|
+
* Failure isolation: a failed agent-plugin index must not take down a working runtime-plugin
|
|
7
|
+
* list, so that entire half degrades to an empty array; failed public-export lookup alone uses
|
|
8
|
+
* an empty export map while retaining the installed rows.
|
|
9
|
+
*
|
|
10
|
+
* Agent-plugin list projections expose public ids, versions, digests, skill names, projected
|
|
11
|
+
* descriptions and export contracts; package roots, skill paths, executable handles and private
|
|
12
|
+
* error details stay with their owner.
|
|
13
|
+
* The two arrays keep each family's distinct response shape visible to callers.
|
|
14
|
+
*
|
|
15
|
+
* Family is explicit because independent namespaces can share an id and guessing can mutate the
|
|
16
|
+
* wrong lifecycle; one enable tool avoids ambiguous near-identical choices, while install and
|
|
17
|
+
* uninstall remain separate because each tool id has one risk band for its different effects.
|
|
18
|
+
*/
|
|
19
|
+
import { AGENT_TOOL_PRINCIPAL_KIND, adaptLegacyAuthorize, redactSecrets, requireToolPermission, buildDomainRegistrations, indexCatalogById, requireInputRecord, requireNoInput, requireString, ToolInputError } from '@jini-ai/core';
|
|
20
|
+
import { nowIso } from '@jini-ai/core/primitives';
|
|
21
|
+
import { withModelFacingErrors } from '@jini-ai/core/model-facing-tool-errors';
|
|
22
|
+
import { addedPluginCapabilities, pluginCapabilitySet } from '../source-policy.js';
|
|
23
|
+
import { setPluginEnabled } from '../activation.js';
|
|
24
|
+
import { toAdminPluginResponse } from '../admin-response.js';
|
|
25
|
+
import { PluginConflictError } from '../plugin-claims.js';
|
|
26
|
+
import { PluginChangedSincePreviewError, previewUninstallPlugin, uninstallPlugin } from '../uninstall.js';
|
|
27
|
+
import {} from '../discovery-types.js';
|
|
28
|
+
const AGENT_PLUGIN_FAMILY = 'agent-plugin';
|
|
29
|
+
function toAgentPluginListRow(required, _options = {}) {
|
|
30
|
+
const p = required.plugin;
|
|
31
|
+
return { pluginId: p.pluginId, version: p.version ?? null, archiveDigest: p.archiveDigest, skills: p.skills.map((s) => s.name), exports: required.exports };
|
|
32
|
+
}
|
|
33
|
+
/** Isolates the complete agent-plugin read so its failure cannot break the runtime-plugin list. */
|
|
34
|
+
async function listAgentPluginsForResponse(routeDeps) {
|
|
35
|
+
try {
|
|
36
|
+
const installed = await routeDeps.agentPlugins.listInstalled({}, {});
|
|
37
|
+
const inactive = await routeDeps.agentPlugins.inactivePluginIds?.({ strict: false }, {}) ?? new Set();
|
|
38
|
+
const exports = await routeDeps.pluginExports?.catalog({ workspaceId: routeDeps.workspaceId }).catch(() => new Map());
|
|
39
|
+
return installed.map(plugin => {
|
|
40
|
+
if (!inactive.has(plugin.pluginId))
|
|
41
|
+
return toAgentPluginListRow({ plugin, exports: exports?.get(plugin.pluginId) ?? [] });
|
|
42
|
+
const visible = routeDeps.agentPlugins.searchCandidate({ candidate: { ...plugin, enabled: false, keywords: [], skills: [], mcpServerIds: [] } });
|
|
43
|
+
return { pluginId: visible.pluginId, enabled: false, description: visible.description };
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
return [];
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* This wiring layer's OWN risk classification, authored from what each handler below actually
|
|
52
|
+
* calls. See `DerivedRiskByToolId` in the kit for why it is independent of the catalog's own
|
|
53
|
+
* `sideEffects` declaration.
|
|
54
|
+
*/
|
|
55
|
+
export function pluginManagementDerivedRiskFor({ toolIds }, _optional = {}) {
|
|
56
|
+
return new Map([
|
|
57
|
+
// -> discoverPlugins() + pluginActivationRepo.getActivation() per record: reads only.
|
|
58
|
+
[toolIds.list, "none"],
|
|
59
|
+
// Activation and its injected enable hook can mutate durable state.
|
|
60
|
+
[toolIds.setEnabled, "mutates-durable-state"],
|
|
61
|
+
// Runtime removal uses shared Trash; agent removal is permanent, so use the worse risk band.
|
|
62
|
+
[toolIds.uninstall, "deletes-durable-state"],
|
|
63
|
+
]);
|
|
64
|
+
}
|
|
65
|
+
/** Reads `family` as an explicit choice between the two real systems.
|
|
66
|
+
*
|
|
67
|
+
* A `ToolInputError`, not a bare `Error`: this genuinely IS "the caller's input was the problem, and
|
|
68
|
+
* a different input fixes it", and a bare `Error` out of a tool handler is redacted into an opaque
|
|
69
|
+
* failure by the daemon — so the one message that could tell the model which family to name would
|
|
70
|
+
* never reach it. @complexity O(1). */
|
|
71
|
+
function readFamily(input, familyRequired) {
|
|
72
|
+
const raw = input["family"];
|
|
73
|
+
if (raw === "site-runtime" || raw === AGENT_PLUGIN_FAMILY)
|
|
74
|
+
return raw;
|
|
75
|
+
throw new ToolInputError({ message: familyRequired });
|
|
76
|
+
}
|
|
77
|
+
/** @complexity O(1). */
|
|
78
|
+
function readSetEnabledRequest(rawInput, familyRequired) {
|
|
79
|
+
const input = requireInputRecord({ input: rawInput });
|
|
80
|
+
const family = readFamily(input, familyRequired);
|
|
81
|
+
const pluginId = requireString({ input: input, key: "pluginId" });
|
|
82
|
+
if (typeof input["enabled"] !== "boolean") {
|
|
83
|
+
throw new ToolInputError({ message: "'enabled' (boolean) is required — true to turn the plugin on, false to turn it off" });
|
|
84
|
+
}
|
|
85
|
+
return { family, pluginId, enabled: input["enabled"] };
|
|
86
|
+
}
|
|
87
|
+
/** Identity/version binding before and after consent. The existing MCP fingerprint owner
|
|
88
|
+
* hashes the version/digest metadata; no second hashing or approval store is introduced.
|
|
89
|
+
* Disabling removes capability, so it needs no identity grant and never raises a dialog.
|
|
90
|
+
* @complexity One family discovery scan, bounded by the installed package count. */
|
|
91
|
+
export async function pluginApprovalIdentity({ deps: routeDeps, request }, _optional = {}) {
|
|
92
|
+
let revision;
|
|
93
|
+
let version;
|
|
94
|
+
let label;
|
|
95
|
+
let discovery;
|
|
96
|
+
let schema = {};
|
|
97
|
+
let accessKey;
|
|
98
|
+
let accessResources;
|
|
99
|
+
if (request.family === AGENT_PLUGIN_FAMILY) {
|
|
100
|
+
const plugins = await routeDeps.agentPlugins.listInstalled({}, {});
|
|
101
|
+
const installed = plugins.filter(plugin => plugin.pluginId === request.pluginId);
|
|
102
|
+
if (installed.length === 0)
|
|
103
|
+
throw new ToolInputError({ message: `Agent Plugin '${request.pluginId}' is not installed` });
|
|
104
|
+
// Every installed digest participates, independent of discovery ordering.
|
|
105
|
+
revision = JSON.stringify(installed.map(plugin => [plugin.version ?? null, plugin.archiveDigest]).sort((a, b) => JSON.stringify(a).localeCompare(JSON.stringify(b))));
|
|
106
|
+
const access = await routeDeps.agentPlugins.previewEnableAccess?.({ pluginId: request.pluginId }, {});
|
|
107
|
+
if (access) {
|
|
108
|
+
revision = JSON.stringify([revision, access.key]);
|
|
109
|
+
accessKey = access.key;
|
|
110
|
+
accessResources = access.resources;
|
|
111
|
+
}
|
|
112
|
+
// The card names the copy the host's selection owner would use; several remain only when it has no winner.
|
|
113
|
+
const preferred = await routeDeps.agentPlugins.preferInstalled?.({ installed }, {}) ?? installed;
|
|
114
|
+
version = preferred.map(plugin => plugin.version).filter((value) => value !== undefined).sort().join(", ");
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
discovery = structuredClone(await routeDeps.discoverPlugins());
|
|
118
|
+
const plugin = discovery.find(plugin => plugin.id === request.pluginId);
|
|
119
|
+
if (!plugin)
|
|
120
|
+
throw new ToolInputError({ message: `plugin '${request.pluginId}' was not found in the current discovery snapshot` });
|
|
121
|
+
revision = plugin.version;
|
|
122
|
+
schema = { ...plugin.manifest };
|
|
123
|
+
version = plugin.version;
|
|
124
|
+
label = plugin.name;
|
|
125
|
+
}
|
|
126
|
+
const fingerprint = routeDeps.approvalFingerprint({ family: request.family, pluginId: request.pluginId, revision, schema });
|
|
127
|
+
return { key: fingerprint, version, label: label ?? request.pluginId, discovery, accessKey, accessResources };
|
|
128
|
+
}
|
|
129
|
+
/** A fresh `uninstallPlugin` request. Discovery is re-read on every call, so the post-confirmation write never resolves
|
|
130
|
+
* its target from the snapshot taken before a human was asked. @complexity one discovery scan. */
|
|
131
|
+
async function uninstallRequestFor(routeDeps, pluginId, principalId) {
|
|
132
|
+
const discovery = await routeDeps.discoverPlugins();
|
|
133
|
+
return {
|
|
134
|
+
deps: { repo: routeDeps.pluginActivationRepo, discovery, remove: routeDeps.removePlugin },
|
|
135
|
+
input: {
|
|
136
|
+
pluginId,
|
|
137
|
+
workspaceId: routeDeps.workspaceId,
|
|
138
|
+
at: nowIso({ clock: routeDeps.clock }),
|
|
139
|
+
actor: { principalId, pluginId: routeDeps.actorPluginId },
|
|
140
|
+
},
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* The post-confirmation half of uninstall: re-discovers, then uninstalls only if the plugin is
|
|
145
|
+
* still the name and version the dialog showed. A change is a not-removed RESULT, the same union
|
|
146
|
+
* member `expired`/`abandoned` use; every other refusal still propagates undecorated, per this file's convention.
|
|
147
|
+
* @complexity one discovery scan plus `uninstallPlugin`.
|
|
148
|
+
*/
|
|
149
|
+
async function uninstallConfirmedPlugin(routeDeps, preview, principalId) {
|
|
150
|
+
const { pluginId } = preview;
|
|
151
|
+
try {
|
|
152
|
+
const result = await uninstallPlugin(await uninstallRequestFor(routeDeps, pluginId, principalId), { confirmedPreview: preview });
|
|
153
|
+
return { pluginId, trashed: result.trashed };
|
|
154
|
+
}
|
|
155
|
+
catch (error) {
|
|
156
|
+
if (!(error instanceof PluginChangedSincePreviewError))
|
|
157
|
+
throw error;
|
|
158
|
+
return {
|
|
159
|
+
pluginId,
|
|
160
|
+
uninstalled: false,
|
|
161
|
+
cancelled: false,
|
|
162
|
+
reason: "changed-since-confirmation",
|
|
163
|
+
note: routeDeps.messages.changedSinceConfirmation({ pluginId, name: preview.name, version: preview.version }),
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Delegate to the same scoped lifecycle writer used by other host entry points so installed
|
|
169
|
+
* identity, activation and admission policy cannot drift between entry points.
|
|
170
|
+
* @complexity O(d) in installed-digest count plus one small file rewrite.
|
|
171
|
+
*/
|
|
172
|
+
async function applyAgentPluginDecision(routeDeps, principalId, request, optional = {}) {
|
|
173
|
+
try {
|
|
174
|
+
const input = {
|
|
175
|
+
workspaceId: routeDeps.workspaceId,
|
|
176
|
+
pluginId: request.pluginId,
|
|
177
|
+
enabled: request.enabled,
|
|
178
|
+
actor: principalId,
|
|
179
|
+
};
|
|
180
|
+
const result = await routeDeps.agentPlugins.setEnabled(input);
|
|
181
|
+
// Provision connections only after successful activation through the host's existing owner;
|
|
182
|
+
// otherwise the same enable decision would leave different usable capabilities by entry point.
|
|
183
|
+
if (result.enabled) {
|
|
184
|
+
await routeDeps.agentPlugins.provisionMcp({ pluginId: request.pluginId, principalId }, { approvedEnable: true, approvedEnableKey: optional.accessKey });
|
|
185
|
+
}
|
|
186
|
+
return {
|
|
187
|
+
changed: true,
|
|
188
|
+
cancelled: false,
|
|
189
|
+
family: request.family,
|
|
190
|
+
agentPlugin: { pluginId: result.pluginId, enabled: result.enabled },
|
|
191
|
+
warnings: result.warnings ?? [],
|
|
192
|
+
restartRequired: false,
|
|
193
|
+
note: routeDeps.messages.restartNote(request),
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
catch (error) {
|
|
197
|
+
// Re-classified at the tool boundary for the same reason `readFamily` throws one: an id that is
|
|
198
|
+
// not installed here IS a caller-input problem with an actionable fix (search first, then use a
|
|
199
|
+
// real id), and a bare `Error` would reach the model as an opaque failure instead. The message
|
|
200
|
+
// carries only the plugin id the caller already sent — nothing internal leaks.
|
|
201
|
+
const classified = routeDeps.agentPlugins.classifyError({ error });
|
|
202
|
+
if (classified?.kind === 'not-installed')
|
|
203
|
+
throw new ToolInputError({ message: classified.message });
|
|
204
|
+
const linkedError = routeDeps.providerFaces.describeLinkedError({ error });
|
|
205
|
+
if (linkedError !== undefined)
|
|
206
|
+
return linkedFaceResult({ request, error: linkedError });
|
|
207
|
+
// Nothing changed, so return the actionable refusal rather than an opaque failure.
|
|
208
|
+
const refusal = activationsRefusalResult(routeDeps, request, classified);
|
|
209
|
+
if (refusal !== undefined)
|
|
210
|
+
return refusal;
|
|
211
|
+
throw error;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Pre-flight for an Agent Plugin ENABLE, run before the confirmation dialog: the not-changed result when this
|
|
216
|
+
* workspace's activations.json cannot be read or cannot be locked, otherwise `undefined`.
|
|
217
|
+
*
|
|
218
|
+
* `applyAgentPluginDecision` would refuse the same write anyway, but only after a human had confirmed it — asking
|
|
219
|
+
* them to approve something that cannot happen, then reporting "nothing changed" (t91 §7.2). This reads the file
|
|
220
|
+
* with the same strict reader every writer uses, so it refuses exactly the files the write would. The file can
|
|
221
|
+
* still break while the dialog is open; `applyAgentPluginDecision`'s own catch covers that. Disabling raises no
|
|
222
|
+
* dialog, so it needs no pre-flight.
|
|
223
|
+
*
|
|
224
|
+
* @complexity One small file read, plus `assertAgentPluginActivationsWritable`'s own cross-process lock
|
|
225
|
+
* acquisition and release — not a pure read: it also creates the workspace root if it is absent.
|
|
226
|
+
*/
|
|
227
|
+
async function unwritableAgentPluginActivationsResult(routeDeps, request) {
|
|
228
|
+
try {
|
|
229
|
+
await routeDeps.agentPlugins.assertWritable({}, {});
|
|
230
|
+
return undefined;
|
|
231
|
+
}
|
|
232
|
+
catch (error) {
|
|
233
|
+
const refusal = activationsRefusalResult(routeDeps, request, routeDeps.agentPlugins.classifyError({ error }));
|
|
234
|
+
if (refusal !== undefined)
|
|
235
|
+
return refusal;
|
|
236
|
+
throw error;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Pre-flight for an Agent Plugin ENABLE, run before the confirmation dialog: the host-incompatible result when any
|
|
241
|
+
* installed revision of the plugin declares a host range this host does not satisfy, otherwise `undefined`.
|
|
242
|
+
*
|
|
243
|
+
* Same reason as {@link unwritableAgentPluginActivationsResult}: the write would refuse it anyway, but only after a
|
|
244
|
+
* human had approved something that cannot happen. Uses the lifecycle owner's own compatibility check against the
|
|
245
|
+
* same contract version, and, like its enable, requires every installed revision of the id to pass. `hostOk` does
|
|
246
|
+
* not depend on other plugins' capabilities, so none are supplied.
|
|
247
|
+
* @complexity O(p) in installed-plugin count.
|
|
248
|
+
*/
|
|
249
|
+
async function hostIncompatibleEnableResult(routeDeps, request) {
|
|
250
|
+
const revisions = (await routeDeps.agentPlugins.listInstalled({}, {})).filter(plugin => plugin.pluginId === request.pluginId);
|
|
251
|
+
const incompatible = routeDeps.agentPlugins.compatibility({ pluginId: request.pluginId, revisions });
|
|
252
|
+
return incompatible ? hostIncompatibleResult(routeDeps, request, incompatible) : undefined;
|
|
253
|
+
}
|
|
254
|
+
/** A provider plugin's assistant face has no switch of its own (the provider lifecycle owns it):
|
|
255
|
+
* nothing changed, and the note names the provider plugin to switch instead. @complexity O(1). */
|
|
256
|
+
function linkedFaceResult({ request, error }, _optional = {}) {
|
|
257
|
+
return { changed: false, cancelled: false, family: request.family, pluginId: request.pluginId, restartRequired: false,
|
|
258
|
+
reason: "linked", code: error.code, providerPluginId: error.providerPluginId, note: `Nothing changed. ${error.message}` };
|
|
259
|
+
}
|
|
260
|
+
/** Pre-flight: a linked face is refused before the confirmation dialog, not after it. A link that cannot be
|
|
261
|
+
* read here is left to the write, which checks again. @complexity One manifest read per installed revision. */
|
|
262
|
+
async function linkedFaceEnableResult(routeDeps, request) {
|
|
263
|
+
const providerPluginId = await routeDeps.providerFaces.linkedProvider({ pluginId: request.pluginId }).catch(() => undefined);
|
|
264
|
+
return providerPluginId === undefined ? undefined : linkedFaceResult({
|
|
265
|
+
request, error: routeDeps.providerFaces.describeLinkedFace({ pluginId: request.pluginId, providerPluginId }),
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
/** Every Agent Plugin enable pre-flight, in order; the first not-changed result wins. @complexity As its three checks. */
|
|
269
|
+
async function agentPluginEnablePreflight(routeDeps, request) {
|
|
270
|
+
return (await unwritableAgentPluginActivationsResult(routeDeps, request)) ?? (await linkedFaceEnableResult(routeDeps, request)) ?? hostIncompatibleEnableResult(routeDeps, request);
|
|
271
|
+
}
|
|
272
|
+
/** An interrupted update of this plugin waits for boot recovery (`PLUGIN_UPDATE_PENDING`, or an
|
|
273
|
+
* unreadable recovery record): its on/off decision is frozen until then, the same refusal used by the lifecycle writer. Nothing changed, so a not-changed result. @complexity O(1). */
|
|
274
|
+
function updatePendingResult(routeDeps, request, error) {
|
|
275
|
+
return {
|
|
276
|
+
changed: false,
|
|
277
|
+
cancelled: false,
|
|
278
|
+
family: request.family,
|
|
279
|
+
pluginId: request.pluginId,
|
|
280
|
+
restartRequired: false,
|
|
281
|
+
reason: "update-pending",
|
|
282
|
+
code: error.code,
|
|
283
|
+
note: `Nothing changed: an interrupted update of '${request.pluginId}' is still waiting to be recovered, so it was NOT ` +
|
|
284
|
+
`${request.enabled ? "enabled" : "disabled"}. ${routeDeps.messages.updatePendingNextStep(error)}`,
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
/** The plugin declares a host range this host does not satisfy, so it cannot be enabled: the canonical
|
|
288
|
+
* `PLUGIN_HOST_INCOMPATIBLE` refusal. Nothing changed, so it is
|
|
289
|
+
* a not-changed result, not a failure. @complexity O(1). */
|
|
290
|
+
function hostIncompatibleResult(routeDeps, request, error) {
|
|
291
|
+
return {
|
|
292
|
+
changed: false,
|
|
293
|
+
cancelled: false,
|
|
294
|
+
family: request.family,
|
|
295
|
+
pluginId: request.pluginId,
|
|
296
|
+
restartRequired: false,
|
|
297
|
+
reason: "host-incompatible",
|
|
298
|
+
code: error.code,
|
|
299
|
+
note: routeDeps.messages.hostIncompatibleNote(request),
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
/** Not-changed result: nothing changed, so it is a RESULT the model can relay, not a redacted
|
|
303
|
+
* failure. The host path and parse detail stay in the server log via the `console.warn` below;
|
|
304
|
+
* `note` carries only the fixed, path-free E3 text.
|
|
305
|
+
* @complexity O(1). */
|
|
306
|
+
function activationsUnreadableResult(routeDeps, request, error) {
|
|
307
|
+
console.warn(`[agent-plugins] '${request.pluginId}': ${routeDeps.toolIds.setEnabled} refused — ${redactSecrets({ input: error.message }, { redactPii: false })}`);
|
|
308
|
+
return {
|
|
309
|
+
changed: false,
|
|
310
|
+
cancelled: false,
|
|
311
|
+
family: request.family,
|
|
312
|
+
pluginId: request.pluginId,
|
|
313
|
+
restartRequired: false,
|
|
314
|
+
reason: "activations-unreadable",
|
|
315
|
+
note: routeDeps.messages.activationsUnreadableNote(request),
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
/** Another host process held the cross-process activations.json write lock and
|
|
319
|
+
* the wait timed out, or this process lost the lock before it could commit. Same not-changed
|
|
320
|
+
* shape as {@link activationsUnreadableResult}: nothing changed, so it is a RESULT the model can
|
|
321
|
+
* relay. The host lock path stays in the server log via `console.warn`; `note` is fixed and
|
|
322
|
+
* path-free.
|
|
323
|
+
* @complexity O(1). */
|
|
324
|
+
function activationsBusyResult(routeDeps, request, error) {
|
|
325
|
+
console.warn(`[agent-plugins] '${request.pluginId}': ${routeDeps.toolIds.setEnabled} refused — ${redactSecrets({ input: error.message }, { redactPii: false })}`);
|
|
326
|
+
return {
|
|
327
|
+
changed: false,
|
|
328
|
+
cancelled: false,
|
|
329
|
+
family: request.family,
|
|
330
|
+
pluginId: request.pluginId,
|
|
331
|
+
restartRequired: false,
|
|
332
|
+
reason: "activations-busy",
|
|
333
|
+
note: routeDeps.messages.activationsBusyNote(request),
|
|
334
|
+
};
|
|
335
|
+
}
|
|
336
|
+
/** Dispatches a thrown activation error to the matching not-changed RESULT — Unreadable to
|
|
337
|
+
* {@link activationsUnreadableResult}, Busy to {@link activationsBusyResult} — or `undefined` for
|
|
338
|
+
* any other error, so the caller can rethrow it unchanged. Shared by both
|
|
339
|
+
* {@link applyAgentPluginDecision} and {@link unwritableAgentPluginActivationsResult} so the two
|
|
340
|
+
* call sites classify activation failures identically.
|
|
341
|
+
* @complexity O(1). */
|
|
342
|
+
function activationsRefusalResult(routeDeps, request, error) {
|
|
343
|
+
if (error?.kind === 'host-incompatible')
|
|
344
|
+
return hostIncompatibleResult(routeDeps, request, error);
|
|
345
|
+
if (error?.kind === 'update')
|
|
346
|
+
return updatePendingResult(routeDeps, request, error);
|
|
347
|
+
if (error?.kind === 'unreadable')
|
|
348
|
+
return activationsUnreadableResult(routeDeps, request, error);
|
|
349
|
+
if (error?.kind === 'busy')
|
|
350
|
+
return activationsBusyResult(routeDeps, request, error);
|
|
351
|
+
return undefined;
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* Runtime activation uses the injected command gateway so authorization, audit and inverse/rollback
|
|
355
|
+
* remain identical across host entry points.
|
|
356
|
+
* @complexity O(p) in discovered-plugin count, plus the command gateway's own writes.
|
|
357
|
+
*/
|
|
358
|
+
async function applySiteRuntimeDecision(routeDeps, principalId, request, optional = {}) {
|
|
359
|
+
const { pluginId, enabled } = request;
|
|
360
|
+
// Reuse the manifest that passed the post-approval identity check, avoiding another discovery
|
|
361
|
+
// read between checking the approved version/digest and the activation owner loading it.
|
|
362
|
+
const discovery = optional.discovery ?? await routeDeps.discoverPlugins();
|
|
363
|
+
// Capture and restore the same prior row, including absence, through the command gateway.
|
|
364
|
+
let priorActivation = null;
|
|
365
|
+
const { result } = await routeDeps.executeCommand({
|
|
366
|
+
command: {
|
|
367
|
+
workspaceId: routeDeps.workspaceId,
|
|
368
|
+
actor: { id: principalId, kind: AGENT_TOOL_PRINCIPAL_KIND },
|
|
369
|
+
summary: `Agent set plugin '${pluginId}' enabled=${enabled}`,
|
|
370
|
+
permission: routeDeps.permissions.enable,
|
|
371
|
+
},
|
|
372
|
+
mutation: {
|
|
373
|
+
entityType: routeDeps.entityTypes.activation,
|
|
374
|
+
entityId: pluginId,
|
|
375
|
+
operation: "update",
|
|
376
|
+
captureInverse: async () => {
|
|
377
|
+
priorActivation = await routeDeps.pluginActivationRepo.getActivation({ workspaceId: routeDeps.workspaceId, pluginId });
|
|
378
|
+
return { enabled: priorActivation?.enabled ?? false };
|
|
379
|
+
},
|
|
380
|
+
execute: () => setPluginEnabled({
|
|
381
|
+
deps: {
|
|
382
|
+
clock: routeDeps.clock,
|
|
383
|
+
repo: routeDeps.pluginActivationRepo,
|
|
384
|
+
discovery,
|
|
385
|
+
onEnabled: routeDeps.onPluginEnabled,
|
|
386
|
+
onDisabled: routeDeps.onPluginDisabled,
|
|
387
|
+
},
|
|
388
|
+
input: { workspaceId: routeDeps.workspaceId, pluginId, enabled },
|
|
389
|
+
}),
|
|
390
|
+
rollback: async () => {
|
|
391
|
+
if (priorActivation) {
|
|
392
|
+
await routeDeps.pluginActivationRepo.save(priorActivation);
|
|
393
|
+
}
|
|
394
|
+
else {
|
|
395
|
+
await routeDeps.pluginActivationRepo.deleteActivation({ workspaceId: routeDeps.workspaceId, pluginId });
|
|
396
|
+
}
|
|
397
|
+
if (priorActivation?.enabled) {
|
|
398
|
+
await routeDeps.onPluginEnabled(pluginId);
|
|
399
|
+
}
|
|
400
|
+
else {
|
|
401
|
+
routeDeps.onPluginDisabled(pluginId);
|
|
402
|
+
}
|
|
403
|
+
},
|
|
404
|
+
},
|
|
405
|
+
});
|
|
406
|
+
if (!result.activation.enabled)
|
|
407
|
+
await routeDeps.lowerToolAccess({ pluginId });
|
|
408
|
+
const record = discovery.find((r) => r.id === pluginId);
|
|
409
|
+
if (!record)
|
|
410
|
+
throw new ToolInputError({ message: `plugin '${pluginId}' was not found in the current discovery snapshot` });
|
|
411
|
+
if ((priorActivation?.enabled ?? false) !== result.activation.enabled)
|
|
412
|
+
routeDeps.telemetry?.toggled({ principalId, pluginId: record.id, enabled: result.activation.enabled });
|
|
413
|
+
return {
|
|
414
|
+
changed: true,
|
|
415
|
+
cancelled: false,
|
|
416
|
+
family: request.family,
|
|
417
|
+
plugin: toAdminPluginResponse({ discovery: record, activation: result.activation }),
|
|
418
|
+
restartRequired: enabled,
|
|
419
|
+
note: routeDeps.messages.restartNote(request),
|
|
420
|
+
};
|
|
421
|
+
}
|
|
422
|
+
/** The enable-permission check every write path in this file runs, through the kit's evaluator.
|
|
423
|
+
* @complexity O(1) plus one authorization evaluation. */
|
|
424
|
+
async function requireEnablePermission(routeDeps, required) {
|
|
425
|
+
await requireToolPermission({ authorize: adaptLegacyAuthorize({ authorize: routeDeps.authorize }), workspaceId: routeDeps.workspaceId, principalId: required.principalId, permission: routeDeps.permissions.enable }, { entityType: required.entityType, entityId: required.entityId });
|
|
426
|
+
}
|
|
427
|
+
/** The set-enabled permission check, scoped to the family's own entity type. @complexity O(1) plus one evaluation. */
|
|
428
|
+
function requireSetEnabledPermission(routeDeps, required) {
|
|
429
|
+
const { principalId, request } = required;
|
|
430
|
+
return requireEnablePermission(routeDeps, { principalId, entityType: request.family === AGENT_PLUGIN_FAMILY ? routeDeps.entityTypes.agentPlugin : routeDeps.entityTypes.plugin, entityId: request.pluginId });
|
|
431
|
+
}
|
|
432
|
+
/** The site-sourced record a site-runtime ENABLE's approval identity was read from, else `undefined`
|
|
433
|
+
* (a disable, an Agent Plugin, or a built-in package). @complexity O(p) in the snapshot's plugin count. */
|
|
434
|
+
function siteRecordBeingEnabled(required) {
|
|
435
|
+
const { request, identity } = required;
|
|
436
|
+
const record = identity?.discovery?.find(record => record.id === request.pluginId);
|
|
437
|
+
return request.enabled && request.family === "site-runtime" && record?.source === "site" ? record : undefined;
|
|
438
|
+
}
|
|
439
|
+
/** Reads the capabilities beyond the owner's last approval for the
|
|
440
|
+
* record the approval identity was read from (so `record.version` IS the identity's version).
|
|
441
|
+
* @complexity O(c) in the manifest's declared capability count, plus one approval-port read. */
|
|
442
|
+
async function siteConsentFor(routeDeps, required) {
|
|
443
|
+
const { request } = required;
|
|
444
|
+
const record = siteRecordBeingEnabled(required);
|
|
445
|
+
if (record === undefined)
|
|
446
|
+
return { capabilities: undefined, added: [] };
|
|
447
|
+
const capabilities = record.manifest ? pluginCapabilitySet({ manifest: record.manifest }) : undefined;
|
|
448
|
+
const added = capabilities === undefined ? [] : addedPluginCapabilities({ approved: await routeDeps.pluginSource?.readApproval({ id: request.pluginId }, {}), next: capabilities });
|
|
449
|
+
return { capabilities, added };
|
|
450
|
+
}
|
|
451
|
+
/** parse -> authorize -> (Agent Plugin enable: activations.json writable?) -> identity -> consent
|
|
452
|
+
* inputs. See the set-enabled handler's own comment for why this order is load-bearing.
|
|
453
|
+
* @complexity One family discovery scan plus the source/policy reads in {@link siteConsentFor}. */
|
|
454
|
+
async function prepareSetEnabled(routeDeps, required) {
|
|
455
|
+
const { ctx } = required;
|
|
456
|
+
const request = readSetEnabledRequest(ctx.input, routeDeps.messages.familyRequired);
|
|
457
|
+
await requireSetEnabledPermission(routeDeps, { principalId: ctx.principal.id, request });
|
|
458
|
+
const refusal = request.enabled && request.family === AGENT_PLUGIN_FAMILY ? await agentPluginEnablePreflight(routeDeps, request) : undefined;
|
|
459
|
+
const identity = request.enabled && refusal === undefined ? await pluginApprovalIdentity({ deps: routeDeps, request }) : undefined;
|
|
460
|
+
const consent = await siteConsentFor(routeDeps, { request, identity });
|
|
461
|
+
// Consent gap (2026-10-12): the assistant can seal its own package. Always require owner
|
|
462
|
+
// consent, including unchanged versions with a previous capability approval.
|
|
463
|
+
const previousEnabled = await previousPluginEnabled({ deps: routeDeps, request });
|
|
464
|
+
return { request, identity, refusal, confirm: true, capabilities: consent.capabilities, added: consent.added, previousEnabled };
|
|
465
|
+
}
|
|
466
|
+
/** Read only the selected family, once, for the previous access value shown on the card. */
|
|
467
|
+
async function previousPluginEnabled({ deps, request }, _options = {}) {
|
|
468
|
+
if (request.family !== AGENT_PLUGIN_FAMILY)
|
|
469
|
+
return (await deps.pluginActivationRepo.getActivation({ workspaceId: deps.workspaceId, pluginId: request.pluginId }))?.enabled ?? false;
|
|
470
|
+
const inactive = await deps.agentPlugins.inactivePluginIds?.({ strict: true }, {});
|
|
471
|
+
return inactive ? !inactive.has(request.pluginId) : null;
|
|
472
|
+
}
|
|
473
|
+
/** Re-reads an enable's identity after consent; a different key means the human approved something
|
|
474
|
+
* that is no longer what is installed. Disabling binds no identity.
|
|
475
|
+
* @throws {ToolInputError} `PLUGINS_STALE_APPROVAL` when the version or digest changed.
|
|
476
|
+
* @complexity One family discovery scan. */
|
|
477
|
+
async function currentApprovedIdentity(routeDeps, required) {
|
|
478
|
+
const { request, identity } = required;
|
|
479
|
+
if (!request.enabled)
|
|
480
|
+
return undefined;
|
|
481
|
+
const current = await pluginApprovalIdentity({ deps: routeDeps, request });
|
|
482
|
+
if (current.key !== identity?.key)
|
|
483
|
+
throw new ToolInputError({ message: "PLUGINS_STALE_APPROVAL: The plugin or its connection changed. Review and approve it again. Nothing was changed." });
|
|
484
|
+
return current;
|
|
485
|
+
}
|
|
486
|
+
/** Fails CLOSED without an interactive transport: degrading to "remove it and mention we could
|
|
487
|
+
* not ask" would make confirmation decorative in precisely the contexts that most need it.
|
|
488
|
+
* A cancelled run must not leave a dialog holding a call nobody is listening to, nor hold this
|
|
489
|
+
* handler open until the idle deadline. Core/host approval ports now own that abort lifecycle.
|
|
490
|
+
* No mutation occurred: a no-answer is a RESULT, not an exception. Nothing was changed or removed
|
|
491
|
+
* either way, and the model is still alive to read this and say something sensible.
|
|
492
|
+
*
|
|
493
|
+
* The confirmed (or card-free) half: refusal -> re-authorize -> identity unchanged -> not cancelled
|
|
494
|
+
* -> record the approval -> write.
|
|
495
|
+
* @complexity One family discovery scan plus the family's own write. */
|
|
496
|
+
async function runSetEnabled(routeDeps, required) {
|
|
497
|
+
const { ctx, prepared: { request, identity, refusal, confirm, capabilities } } = required;
|
|
498
|
+
if (refusal !== undefined)
|
|
499
|
+
return refusal;
|
|
500
|
+
await requireSetEnabledPermission(routeDeps, { principalId: ctx.principal.id, request });
|
|
501
|
+
const currentIdentity = await currentApprovedIdentity(routeDeps, { request, identity });
|
|
502
|
+
// A cancelled run must neither keep a card open until the deadline nor grant capability.
|
|
503
|
+
if (ctx.signal.aborted)
|
|
504
|
+
return { changed: false, ...routeDeps.approvals.notConfirmed({ confirmed: false, reason: "abandoned" }) };
|
|
505
|
+
// The owner approved exactly these capabilities (the identity key pins the manifest). Recorded
|
|
506
|
+
// before the write so a failed record leaves the plugin off rather than enabled unrecorded.
|
|
507
|
+
if (confirm && capabilities !== undefined && routeDeps.pluginSource)
|
|
508
|
+
await routeDeps.pluginSource.recordApproval({ id: request.pluginId, capabilities }, {});
|
|
509
|
+
return request.family === AGENT_PLUGIN_FAMILY
|
|
510
|
+
? applyAgentPluginDecision(routeDeps, ctx.principal.id, request, { accessKey: identity?.accessKey })
|
|
511
|
+
: applySiteRuntimeDecision(routeDeps, ctx.principal.id, request, { discovery: currentIdentity?.discovery });
|
|
512
|
+
}
|
|
513
|
+
/**
|
|
514
|
+
* This domain's model-facing allowlist uses core's model-facing error contract. Only the
|
|
515
|
+
* conflict refusal is listed (2026-10-04): its message names plugin ids/names and the manifest's own
|
|
516
|
+
* declared names — nothing internal — and it is the one refusal an agent can act on by itself
|
|
517
|
+
* ("turn the other plugin off first"). Without the rule it reached the model as a redacted
|
|
518
|
+
* INTERNAL_ERROR, indistinguishable from a crash. Every other error here keeps its existing
|
|
519
|
+
* classification, unchanged.
|
|
520
|
+
*/
|
|
521
|
+
const PLUGINS_MODEL_FACING_ERRORS = [
|
|
522
|
+
{
|
|
523
|
+
error: PluginConflictError,
|
|
524
|
+
code: "PLUGINS_CONFLICT",
|
|
525
|
+
guidance: "Tell the user which plugin holds the name; disabling that plugin first is their call",
|
|
526
|
+
},
|
|
527
|
+
];
|
|
528
|
+
export function buildPluginManagementRegistrations(routeDeps, _optional = {}) {
|
|
529
|
+
const handlers = {
|
|
530
|
+
[routeDeps.toolIds.list]: async (ctx) => {
|
|
531
|
+
requireNoInput({ input: ctx.input });
|
|
532
|
+
await requireToolPermission({ authorize: adaptLegacyAuthorize({ authorize: routeDeps.authorize }), workspaceId: routeDeps.workspaceId, principalId: ctx.principal.id, permission: routeDeps.permissions.read });
|
|
533
|
+
const discovery = await routeDeps.discoverPlugins();
|
|
534
|
+
const conflicts = (await routeDeps.listPluginConflicts?.()) ?? new Map();
|
|
535
|
+
const plugins = await Promise.all(discovery.map(async (record) => {
|
|
536
|
+
const activation = await routeDeps.pluginActivationRepo.getActivation({ workspaceId: routeDeps.workspaceId, pluginId: record.id });
|
|
537
|
+
if (!activation?.enabled) {
|
|
538
|
+
const visible = routeDeps.agentPlugins.searchCandidate({ candidate: { pluginId: record.id, displayName: record.name, enabled: false, keywords: [], skills: [], mcpServerIds: [] } });
|
|
539
|
+
return { id: record.id, enabled: false, status: record.status, description: visible.description };
|
|
540
|
+
}
|
|
541
|
+
return toAdminPluginResponse({ discovery: record, activation }, { conflicts: conflicts.get(record.id) ?? [] });
|
|
542
|
+
}));
|
|
543
|
+
const agentPlugins = await listAgentPluginsForResponse(routeDeps);
|
|
544
|
+
return { plugins, agentPlugins };
|
|
545
|
+
},
|
|
546
|
+
/**
|
|
547
|
+
* Parse and authorize before preflight or disclosure, then confirm and write; the gateway's
|
|
548
|
+
* later authorization is still needed because a human can leave the dialog open while access
|
|
549
|
+
* changes, and the first check prevents an unauthorized principal from opening it at all.
|
|
550
|
+
*/
|
|
551
|
+
[routeDeps.toolIds.setEnabled]: routeDeps.approvals.handler({
|
|
552
|
+
prepare: ({ ctx }) => prepareSetEnabled(routeDeps, { ctx }),
|
|
553
|
+
describe: ({ ctx, prepared: { request, identity, added, refusal, previousEnabled } }) => routeDeps.descriptions.enable({
|
|
554
|
+
subject: { family: request.family, pluginId: request.pluginId, version: identity?.version, label: identity?.label, adds: added,
|
|
555
|
+
previousEnabled, revision: identity?.key, resources: identity?.accessResources },
|
|
556
|
+
...(request.enabled && refusal === undefined ? { scope: { personId: ctx.principal.id, siteId: routeDeps.workspaceId } } : {}),
|
|
557
|
+
}),
|
|
558
|
+
run: ({ ctx, prepared }) => runSetEnabled(routeDeps, { ctx, prepared }),
|
|
559
|
+
}, { flag: "changed", ask: ({ prepared }) => prepared.request.enabled && prepared.refusal === undefined && prepared.confirm,
|
|
560
|
+
// Turning a plugin back on is a new escalation. A remembered version approval must not
|
|
561
|
+
// silently turn it on after the owner switched it off.
|
|
562
|
+
declined: async ({ reason, prepared }) => {
|
|
563
|
+
if (reason === 'declined' && prepared?.request.family === AGENT_PLUGIN_FAMILY && prepared.identity?.accessKey) {
|
|
564
|
+
await routeDeps.agentPlugins.recordDeclinedAccess?.({ accessKey: prepared.identity.accessKey });
|
|
565
|
+
}
|
|
566
|
+
return { changed: false, family: prepared?.request.family,
|
|
567
|
+
pluginId: prepared?.request.pluginId, restartRequired: false, ...routeDeps.approvals.notConfirmed({ confirmed: false, reason }) };
|
|
568
|
+
},
|
|
569
|
+
}),
|
|
570
|
+
/**
|
|
571
|
+
* One uninstall tool avoids ambiguous family-specific choices while preserving each lifecycle.
|
|
572
|
+
* Runtime removal authorizes and previews before asking so built-in, enabled or unknown targets
|
|
573
|
+
* are refused before an impossible approval; after confirmation it rediscovers the shown version.
|
|
574
|
+
* Removal has no useful inverse for deleted bytes, so it uses shared Trash instead of a command
|
|
575
|
+
* rollback; confirmation is still required because revertibility and consent are independent.
|
|
576
|
+
* Agent removal delegates its entire permission, preview, confirmation and write order, using
|
|
577
|
+
* the same held-open exchange and tool id rather than constructing a second approval channel.
|
|
578
|
+
*/
|
|
579
|
+
[routeDeps.toolIds.uninstall]: async (ctx, optional = {}) => {
|
|
580
|
+
ctx = { ...ctx, input: structuredClone(ctx.input), principal: { ...ctx.principal }, run: { ...ctx.run } };
|
|
581
|
+
const input = requireInputRecord({ input: ctx.input });
|
|
582
|
+
const family = readFamily(input, routeDeps.messages.familyRequired);
|
|
583
|
+
const pluginId = requireString({ input: input, key: "pluginId" });
|
|
584
|
+
if (family === AGENT_PLUGIN_FAMILY)
|
|
585
|
+
return routeDeps.agentPlugins.uninstall({ ctx, pluginId, executionOptions: optional }, {});
|
|
586
|
+
await requireEnablePermission(routeDeps, { principalId: ctx.principal.id, entityType: routeDeps.entityTypes.plugin, entityId: pluginId });
|
|
587
|
+
const preview = await previewUninstallPlugin(await uninstallRequestFor(routeDeps, pluginId, ctx.principal.id)); // throws PluginNotFoundError/NotUninstallableError/EnabledError BEFORE any dialog
|
|
588
|
+
return routeDeps.approvals.handler({
|
|
589
|
+
prepare: async () => preview,
|
|
590
|
+
describe: ({ prepared }) => routeDeps.descriptions.uninstall({ preview: prepared }),
|
|
591
|
+
run: async ({ ctx: approvedCtx, prepared }) => {
|
|
592
|
+
await requireEnablePermission(routeDeps, { principalId: approvedCtx.principal.id, entityType: routeDeps.entityTypes.plugin, entityId: pluginId });
|
|
593
|
+
if (approvedCtx.signal.aborted)
|
|
594
|
+
return { uninstalled: false, ...routeDeps.approvals.notConfirmed({ confirmed: false, reason: "abandoned" }) };
|
|
595
|
+
return uninstallConfirmedPlugin(routeDeps, prepared, approvedCtx.principal.id);
|
|
596
|
+
},
|
|
597
|
+
}, { flag: "uninstalled", declined: ({ reason }) => ({ pluginId, uninstalled: false, ...routeDeps.approvals.notConfirmed({ confirmed: false, reason }) }) })(ctx, optional);
|
|
598
|
+
},
|
|
599
|
+
};
|
|
600
|
+
// No `unwiredToolIds`: Every supplied catalog entry must have a handler so missing wiring fails closed.
|
|
601
|
+
return buildDomainRegistrations({ ...routeDeps.registration,
|
|
602
|
+
catalog: indexCatalogById({ catalog: routeDeps.registration.catalog }),
|
|
603
|
+
handlers: withModelFacingErrors({ handlers, rules: [...routeDeps.extraModelFacingErrors, ...PLUGINS_MODEL_FACING_ERRORS] }),
|
|
604
|
+
derivedRisk: pluginManagementDerivedRiskFor({ toolIds: routeDeps.toolIds }),
|
|
605
|
+
});
|
|
606
|
+
}
|
|
607
|
+
//# sourceMappingURL=management.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type DerivedRiskByToolId, type ToolRegistration } from '@jini-ai/core';
|
|
2
|
+
import type { PluginSourceToolsRequired } from './contract.js';
|
|
3
|
+
/** Bind authenticated chat operations to the existing source owner and shared approval transport.
|
|
4
|
+
* @param required Narrow site deps and human exchange transport.
|
|
5
|
+
* @param _optional Reserved registration options.
|
|
6
|
+
* @returns Complete registrations; typed source/install refusals become actionable input errors.
|
|
7
|
+
*/
|
|
8
|
+
export declare function buildPluginSourceRegistrations<Description>(deps: PluginSourceToolsRequired<Description>, _optional?: {}): ToolRegistration[];
|
|
9
|
+
/** Independently derived from calls to the source port: reads are read-only, delete unlinks,
|
|
10
|
+
* and create/open/write/edit/seal/rollback durably publish bytes. */
|
|
11
|
+
export declare function pluginSourceDerivedRiskFor({ toolIds }: {
|
|
12
|
+
toolIds: PluginSourceToolsRequired<unknown>['toolIds'];
|
|
13
|
+
}, _optional?: {}): DerivedRiskByToolId;
|
|
14
|
+
//# sourceMappingURL=source.d.ts.map
|