@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
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { NotifyToolAccessChanged } from '@jini-ai/core/tool-access-change';
|
|
2
|
+
/**
|
|
3
|
+
* @file The ONE composition that turns "enable/disable this Agent Plugin" into a durable decision:
|
|
4
|
+
* verify the id is actually installed in this workspace, then write the activation record.
|
|
5
|
+
*
|
|
6
|
+
* ---------------------------------------------------------------------------
|
|
7
|
+
* Why this file exists rather than a second copy of the same three lines
|
|
8
|
+
* ---------------------------------------------------------------------------
|
|
9
|
+
* `setAgentPluginActivation` (`activation.ts`) is the WRITER. It is deliberately incurious: it
|
|
10
|
+
* validates the name grammar and writes, and it will happily mint a record for a plugin id that is
|
|
11
|
+
* not installed anywhere. Everything that makes a toggle *correct* — that the id names a real
|
|
12
|
+
* installed package in THIS workspace, so no activation can be recorded for something that does not
|
|
13
|
+
* exist — lives one layer above it, and until 2026-09-09 that layer existed exactly once, inline in
|
|
14
|
+
* `server/inbound/admin-http/routes/agent-plugins/set-enabled.ts` (`AGENT_PLUGIN_SET_ENABLED`,
|
|
15
|
+
* commit `34640b70`).
|
|
16
|
+
*
|
|
17
|
+
* `plugins_set_enabled`'s Agent Plugin branch (`features/plugin-runtime/tool-registrations.ts`) is
|
|
18
|
+
* the second caller of that same layer. Re-typing the precondition there would have made two places
|
|
19
|
+
* that each decide what "installed" means, and the failure mode of them drifting is a tool that
|
|
20
|
+
* records activations for plugins the admin screen says are not there. So the route's own
|
|
21
|
+
* composition moved here and both callers share it — the admin route keeps its response projection
|
|
22
|
+
* and its HTTP status mapping, which are genuinely its own.
|
|
23
|
+
*
|
|
24
|
+
* ---------------------------------------------------------------------------
|
|
25
|
+
* The installed-check reads `listInstalledPlugins`, NOT the search read model
|
|
26
|
+
* ---------------------------------------------------------------------------
|
|
27
|
+
* The route asks `loadAgentPluginSearchCandidates` (`agent-plugins/tool-registrations.ts`) because
|
|
28
|
+
* it needs that read model's full row — description, keywords, skills, mcp server ids — to send
|
|
29
|
+
* back. This module needs one bit ("is this id installed here?"), and takes it from the primitive
|
|
30
|
+
* that read model is itself built on. That keeps a DOMAIN module off a TOOL-WIRING module: nothing
|
|
31
|
+
* here imports `tool-registrations.ts` in either feature, so the tool branch that calls this file
|
|
32
|
+
* introduces no `plugin-runtime -> agent-plugins/tool-registrations` edge.
|
|
33
|
+
*
|
|
34
|
+
* Architectural role:
|
|
35
|
+
* `features/agent-plugins` business rule. Filesystem only, via `layout.ts`'s `forWorkspace()` root —
|
|
36
|
+
* the same tenant-isolation guarantee every other path in this feature goes through.
|
|
37
|
+
*/
|
|
38
|
+
import type { createAgentPluginLifecycle } from "../lifecycle/index.js";
|
|
39
|
+
import type { SetAgentPluginEnabledResult } from "@jini-ai/core/contracts/site/agent-plugins-lifecycle";
|
|
40
|
+
import type { ProviderFacePorts } from "@jini-ai/agent-plugins/site/provider-plugin-link";
|
|
41
|
+
import type { SetAgentPluginEnabledInput } from '@jini-ai/core/contracts/headless/plugin-host';
|
|
42
|
+
/**
|
|
43
|
+
* Records an operator's enable/disable decision for one installed Agent Plugin.
|
|
44
|
+
*
|
|
45
|
+
* @throws {AgentPluginNotReadyError} Turning on a Soon plugin (`soon-lock.ts`); nothing is written.
|
|
46
|
+
* @throws {AgentPluginLinkedError} The id is a provider plugin's face; that plugin's switch decides.
|
|
47
|
+
* @throws {AgentPluginNotInstalledError} The id is not installed in this workspace. Nothing is
|
|
48
|
+
* written, so no activation record can exist for a package that does not.
|
|
49
|
+
* @throws {Error} If `pluginId` does not match the Agent Plugins name grammar (re-asserted
|
|
50
|
+
* independently by `setAgentPluginActivation`, so a caller cannot skip it).
|
|
51
|
+
* @complexity O(d) in installed-digest count for the precondition, plus one whole-file rewrite of
|
|
52
|
+
* the (small) activations record.
|
|
53
|
+
*/
|
|
54
|
+
export declare function setAgentPluginEnabled(input: SetAgentPluginEnabledInput & {
|
|
55
|
+
lifecycles: WeakMap<SetAgentPluginEnabledInput['agentPluginLayout'], Pick<ReturnType<typeof createAgentPluginLifecycle>, 'setAgentPluginEnabled'>>;
|
|
56
|
+
createLifecycle(input: {
|
|
57
|
+
layout: SetAgentPluginEnabledInput['agentPluginLayout'];
|
|
58
|
+
}): Pick<ReturnType<typeof createAgentPluginLifecycle>, 'setAgentPluginEnabled'>;
|
|
59
|
+
bindProviderFacePorts(input: {
|
|
60
|
+
workspaceRoot(): string;
|
|
61
|
+
}): Pick<ProviderFacePorts, 'links'>;
|
|
62
|
+
assertAgentPluginReady(input: {
|
|
63
|
+
workspaceRoot: string;
|
|
64
|
+
pluginId: string;
|
|
65
|
+
}): Promise<void>;
|
|
66
|
+
AgentPluginLinkedError: new (input: {
|
|
67
|
+
pluginId: string;
|
|
68
|
+
providerPluginId: string;
|
|
69
|
+
}) => Error;
|
|
70
|
+
}, options?: {
|
|
71
|
+
/** Serving hosts await Stop/cleanup after the durable OFF decision. */
|
|
72
|
+
readonly notifyRosterChanged?: NotifyToolAccessChanged;
|
|
73
|
+
readonly links?: Pick<ProviderFacePorts, "links">;
|
|
74
|
+
/** Reuse boot queues and tracking while retaining this host's linked-face guard. */
|
|
75
|
+
readonly lifecycle?: Pick<ReturnType<typeof createAgentPluginLifecycle>, "setAgentPluginEnabled">;
|
|
76
|
+
/** A system enable (a sign-in's connect defaults): same checks, but an operator's own "off" stays (Jini's conditional write). */
|
|
77
|
+
readonly unlessOperatorDisabled?: boolean;
|
|
78
|
+
}): Promise<SetAgentPluginEnabledResult>;
|
|
79
|
+
export declare function createSetAgentPluginEnabled(required: Pick<Parameters<typeof setAgentPluginEnabled>[0], 'createLifecycle' | 'bindProviderFacePorts' | 'assertAgentPluginReady' | 'AgentPluginLinkedError'>, _optional?: {}): (input: SetAgentPluginEnabledInput, options?: Parameters<typeof setAgentPluginEnabled>[1]) => Promise<SetAgentPluginEnabledResult>;
|
|
80
|
+
//# sourceMappingURL=set-enabled.d.ts.map
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { linkedProviderOf } from "../core/provider-plugin-link.js";
|
|
2
|
+
/**
|
|
3
|
+
* Records an operator's enable/disable decision for one installed Agent Plugin.
|
|
4
|
+
*
|
|
5
|
+
* @throws {AgentPluginNotReadyError} Turning on a Soon plugin (`soon-lock.ts`); nothing is written.
|
|
6
|
+
* @throws {AgentPluginLinkedError} The id is a provider plugin's face; that plugin's switch decides.
|
|
7
|
+
* @throws {AgentPluginNotInstalledError} The id is not installed in this workspace. Nothing is
|
|
8
|
+
* written, so no activation record can exist for a package that does not.
|
|
9
|
+
* @throws {Error} If `pluginId` does not match the Agent Plugins name grammar (re-asserted
|
|
10
|
+
* independently by `setAgentPluginActivation`, so a caller cannot skip it).
|
|
11
|
+
* @complexity O(d) in installed-digest count for the precondition, plus one whole-file rewrite of
|
|
12
|
+
* the (small) activations record.
|
|
13
|
+
*/
|
|
14
|
+
// A stable owner context per booted layout preserves its queues without selecting a site again.
|
|
15
|
+
export async function setAgentPluginEnabled(input, options = {}) {
|
|
16
|
+
const { lifecycles, createLifecycle, bindProviderFacePorts, assertAgentPluginReady, AgentPluginLinkedError } = input;
|
|
17
|
+
// A provider plugin's assistant face has no switch of its own (`provider-plugin-link.ts`).
|
|
18
|
+
const links = options.links ?? bindProviderFacePorts({ workspaceRoot: () => input.agentPluginLayout.forWorkspace({ workspaceId: input.workspaceId }).root });
|
|
19
|
+
const providerPluginId = await linkedProviderOf({ ports: links, pluginId: input.pluginId });
|
|
20
|
+
if (providerPluginId !== undefined) {
|
|
21
|
+
// A Soon face says it isn't ready rather than pointing at a provider switch that can't help.
|
|
22
|
+
if (input.enabled)
|
|
23
|
+
await assertAgentPluginReady({ workspaceRoot: input.agentPluginLayout.forWorkspace({ workspaceId: input.workspaceId }).root, pluginId: input.pluginId });
|
|
24
|
+
throw new AgentPluginLinkedError({ pluginId: input.pluginId, providerPluginId });
|
|
25
|
+
}
|
|
26
|
+
const conditional = options.unlessOperatorDisabled ? { unlessOperatorDisabled: true } : {};
|
|
27
|
+
let lifecycle = options.lifecycle ?? lifecycles.get(input.agentPluginLayout);
|
|
28
|
+
if (!lifecycle) {
|
|
29
|
+
const created = createLifecycle({ layout: input.agentPluginLayout });
|
|
30
|
+
lifecycles.set(input.agentPluginLayout, created);
|
|
31
|
+
lifecycle = created;
|
|
32
|
+
}
|
|
33
|
+
const result = await lifecycle.setAgentPluginEnabled(input, conditional);
|
|
34
|
+
if (!result.enabled)
|
|
35
|
+
await options.notifyRosterChanged?.({ lowered: { pluginIds: [input.pluginId] } });
|
|
36
|
+
return result;
|
|
37
|
+
}
|
|
38
|
+
export function createSetAgentPluginEnabled(required, _optional = {}) {
|
|
39
|
+
const lifecycles = new WeakMap();
|
|
40
|
+
return (input, options = {}) => setAgentPluginEnabled({ ...input, ...required, lifecycles }, options);
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=set-enabled.js.map
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import type { AgentPluginIdentityReadOptions } from "../core/identity-namespace.js";
|
|
2
|
+
import type { PluginMaturity } from "@jini-ai/core/contracts/site/lifecycle-host-tools";
|
|
3
|
+
/** Recorded as `updatedBy` when boot switches a Soon plugin off, so the audit says why. */
|
|
4
|
+
export declare const SOON_LOCK_ACTOR = "system:soon-lock";
|
|
5
|
+
/** Turning on a Soon plugin was refused. Nothing was written. */
|
|
6
|
+
export declare class AgentPluginNotReadyError extends Error {
|
|
7
|
+
readonly code = "AGENT_PLUGIN_NOT_READY";
|
|
8
|
+
readonly pluginId: string;
|
|
9
|
+
constructor({ pluginId, name }: {
|
|
10
|
+
pluginId: string;
|
|
11
|
+
name: string;
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
/** The manifest's maturity flag wins; an unflagged plugin on the host's list reads "soon".
|
|
15
|
+
* Jini's reader takes no plugin id, so the host list is applied here, not in `identity.ts`.
|
|
16
|
+
* @complexity O(1). */
|
|
17
|
+
export declare function readHostPluginMaturity({ manifest, pluginId, hostSoonPluginIds }: {
|
|
18
|
+
manifest: unknown;
|
|
19
|
+
pluginId: string;
|
|
20
|
+
hostSoonPluginIds: ReadonlySet<string>;
|
|
21
|
+
}, options?: Pick<AgentPluginIdentityReadOptions, "legacyIdentity"> & {
|
|
22
|
+
warn?: (message: string) => void;
|
|
23
|
+
}): PluginMaturity | undefined;
|
|
24
|
+
type SoonPlugin = {
|
|
25
|
+
readonly pluginId: string;
|
|
26
|
+
readonly displayName?: string | undefined;
|
|
27
|
+
};
|
|
28
|
+
/** The installed packages of one workspace and their manifests: the lifecycle owner's own reads. */
|
|
29
|
+
export interface SoonCatalogPort<P extends SoonPlugin = SoonPlugin> {
|
|
30
|
+
readonly list: (required: {
|
|
31
|
+
readonly workspaceRoot: string;
|
|
32
|
+
}) => Promise<readonly P[]>;
|
|
33
|
+
readonly readManifest: (required: {
|
|
34
|
+
readonly plugin: P;
|
|
35
|
+
}) => Promise<string>;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The Soon plugin `pluginId` names, or undefined when it may be switched on. Any installed revision
|
|
39
|
+
* flagged "soon" locks the id; an unreadable manifest reads as unflagged (the host list still applies),
|
|
40
|
+
* and an id not installed here is judged by the host list alone.
|
|
41
|
+
* @complexity One package listing plus one manifest read per installed revision of `pluginId`.
|
|
42
|
+
*/
|
|
43
|
+
export declare function findSoonAgentPlugin<P extends SoonPlugin>({ catalog, workspaceRoot, pluginId, hostSoonPluginIds }: {
|
|
44
|
+
catalog: SoonCatalogPort<P>;
|
|
45
|
+
workspaceRoot: string;
|
|
46
|
+
pluginId: string;
|
|
47
|
+
hostSoonPluginIds: ReadonlySet<string>;
|
|
48
|
+
}, optional?: Pick<AgentPluginIdentityReadOptions, "legacyIdentity">): Promise<{
|
|
49
|
+
readonly name: string;
|
|
50
|
+
} | undefined>;
|
|
51
|
+
/** @throws {AgentPluginNotReadyError} `pluginId` is a Soon plugin. @complexity As {@link findSoonAgentPlugin}. */
|
|
52
|
+
export declare function assertAgentPluginReady<P extends SoonPlugin>(required: {
|
|
53
|
+
catalog: SoonCatalogPort<P>;
|
|
54
|
+
workspaceRoot: string;
|
|
55
|
+
pluginId: string;
|
|
56
|
+
hostSoonPluginIds: ReadonlySet<string>;
|
|
57
|
+
}, optional?: Pick<AgentPluginIdentityReadOptions, "legacyIdentity">): Promise<void>;
|
|
58
|
+
/**
|
|
59
|
+
* Boot: switches off every installed Soon plugin that is currently on (an older build, a retirement
|
|
60
|
+
* successor, an import, or a record that never existed, which reads as on). Nothing is uninstalled.
|
|
61
|
+
* @returns The plugin ids it switched off. @complexity O(p) installed packages, one manifest read each.
|
|
62
|
+
*/
|
|
63
|
+
export declare function lockSoonAgentPlugins<P extends SoonPlugin>({ catalog, activations, workspaceRoot, hostSoonPluginIds }: {
|
|
64
|
+
catalog: SoonCatalogPort<P>;
|
|
65
|
+
activations: {
|
|
66
|
+
readonly resolveAgentPluginActivation: (required: {
|
|
67
|
+
workspaceRoot: string;
|
|
68
|
+
pluginId: string;
|
|
69
|
+
}) => Promise<{
|
|
70
|
+
readonly verdict: string;
|
|
71
|
+
}>;
|
|
72
|
+
readonly setAgentPluginActivation: (required: {
|
|
73
|
+
workspaceRoot: string;
|
|
74
|
+
pluginId: string;
|
|
75
|
+
enabled: boolean;
|
|
76
|
+
actor: string;
|
|
77
|
+
}) => Promise<unknown>;
|
|
78
|
+
};
|
|
79
|
+
workspaceRoot: string;
|
|
80
|
+
hostSoonPluginIds: ReadonlySet<string>;
|
|
81
|
+
}, optional?: Pick<AgentPluginIdentityReadOptions, "legacyIdentity">): Promise<readonly string[]>;
|
|
82
|
+
export {};
|
|
83
|
+
//# sourceMappingURL=soon-lock.d.ts.map
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file "Soon" Agent Plugins are locked off (owner, 2026-11-10). The owner has not tested them and does
|
|
3
|
+
* not want anyone trying them, so nothing may switch one on: the admin switch, `plugins_set_enabled`,
|
|
4
|
+
* a sign-in's connect defaults and a provider plugin's face mirror all refuse, a backup import writes
|
|
5
|
+
* them off, and boot switches off any that an older build left on. "untested" stays a warning only.
|
|
6
|
+
* The files stay installed, so people can still open the plugin and read them.
|
|
7
|
+
*
|
|
8
|
+
* Maturity is the manifest flag (Jini's `readPluginMaturity`) plus the host's own list of Soon plugin
|
|
9
|
+
* ids (`hostSoonPluginIds`, injected from the host's bundled catalog). This module imports no lifecycle
|
|
10
|
+
* code: the host's lifecycle binds it into the enable paths of the activation owner, and boot passes the
|
|
11
|
+
* same ports.
|
|
12
|
+
*/
|
|
13
|
+
import { readPluginMaturity } from "../lifecycle/host-tools/identity.js";
|
|
14
|
+
import { orFallback } from "@jini-ai/core/errors/idioms";
|
|
15
|
+
/** Recorded as `updatedBy` when boot switches a Soon plugin off, so the audit says why. */
|
|
16
|
+
export const SOON_LOCK_ACTOR = "system:soon-lock";
|
|
17
|
+
/** Turning on a Soon plugin was refused. Nothing was written. */
|
|
18
|
+
export class AgentPluginNotReadyError extends Error {
|
|
19
|
+
code = "AGENT_PLUGIN_NOT_READY";
|
|
20
|
+
pluginId;
|
|
21
|
+
constructor({ pluginId, name }) {
|
|
22
|
+
super(`${name} isn't ready yet, so it can't be turned on. You can still view its files.`);
|
|
23
|
+
this.name = "AgentPluginNotReadyError";
|
|
24
|
+
this.pluginId = pluginId;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/** The manifest's maturity flag wins; an unflagged plugin on the host's list reads "soon".
|
|
28
|
+
* Jini's reader takes no plugin id, so the host list is applied here, not in `identity.ts`.
|
|
29
|
+
* @complexity O(1). */
|
|
30
|
+
export function readHostPluginMaturity({ manifest, pluginId, hostSoonPluginIds }, options = {}) {
|
|
31
|
+
return readPluginMaturity({ manifest }, options) ?? (hostSoonPluginIds.has(pluginId) ? "soon" : undefined);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The Soon plugin `pluginId` names, or undefined when it may be switched on. Any installed revision
|
|
35
|
+
* flagged "soon" locks the id; an unreadable manifest reads as unflagged (the host list still applies),
|
|
36
|
+
* and an id not installed here is judged by the host list alone.
|
|
37
|
+
* @complexity One package listing plus one manifest read per installed revision of `pluginId`.
|
|
38
|
+
*/
|
|
39
|
+
export async function findSoonAgentPlugin({ catalog, workspaceRoot, pluginId, hostSoonPluginIds }, optional = {}) {
|
|
40
|
+
const revisions = (await catalog.list({ workspaceRoot })).filter(plugin => plugin.pluginId === pluginId);
|
|
41
|
+
const name = revisions.find(plugin => plugin.displayName)?.displayName ?? pluginId;
|
|
42
|
+
if (revisions.length === 0)
|
|
43
|
+
return readHostPluginMaturity({ manifest: undefined, pluginId, hostSoonPluginIds }, optional) === "soon" ? { name } : undefined;
|
|
44
|
+
for (const plugin of revisions) {
|
|
45
|
+
const manifest = await orFallback({
|
|
46
|
+
work: async () => JSON.parse(await catalog.readManifest({ plugin })),
|
|
47
|
+
fallback: undefined,
|
|
48
|
+
step: "read plugin maturity manifest",
|
|
49
|
+
});
|
|
50
|
+
if (readHostPluginMaturity({ manifest, pluginId, hostSoonPluginIds }, optional) === "soon")
|
|
51
|
+
return { name };
|
|
52
|
+
}
|
|
53
|
+
return undefined;
|
|
54
|
+
}
|
|
55
|
+
/** @throws {AgentPluginNotReadyError} `pluginId` is a Soon plugin. @complexity As {@link findSoonAgentPlugin}. */
|
|
56
|
+
export async function assertAgentPluginReady(required, optional = {}) {
|
|
57
|
+
const soon = await findSoonAgentPlugin(required, optional);
|
|
58
|
+
if (soon)
|
|
59
|
+
throw new AgentPluginNotReadyError({ pluginId: required.pluginId, name: soon.name });
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Boot: switches off every installed Soon plugin that is currently on (an older build, a retirement
|
|
63
|
+
* successor, an import, or a record that never existed, which reads as on). Nothing is uninstalled.
|
|
64
|
+
* @returns The plugin ids it switched off. @complexity O(p) installed packages, one manifest read each.
|
|
65
|
+
*/
|
|
66
|
+
export async function lockSoonAgentPlugins({ catalog, activations, workspaceRoot, hostSoonPluginIds }, optional = {}) {
|
|
67
|
+
const switched = [];
|
|
68
|
+
for (const pluginId of new Set((await catalog.list({ workspaceRoot })).map(plugin => plugin.pluginId))) {
|
|
69
|
+
if (!(await findSoonAgentPlugin({ catalog, workspaceRoot, pluginId, hostSoonPluginIds }, optional)))
|
|
70
|
+
continue;
|
|
71
|
+
if ((await activations.resolveAgentPluginActivation({ workspaceRoot, pluginId })).verdict === "inactive")
|
|
72
|
+
continue;
|
|
73
|
+
await activations.setAgentPluginActivation({ workspaceRoot, pluginId, enabled: false, actor: SOON_LOCK_ACTOR });
|
|
74
|
+
switched.push(pluginId);
|
|
75
|
+
}
|
|
76
|
+
return switched;
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=soon-lock.js.map
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { AgentPluginIdentityReadOptions } from "../core/identity-namespace.js";
|
|
2
|
+
import type { orFallback } from "@jini-ai/core/errors/idioms";
|
|
3
|
+
import type { TrustedPluginPackage, TrustedPluginVerdict } from "../lifecycle/index.js";
|
|
4
|
+
/** One descriptor id the successor provides instead of the named packages. */
|
|
5
|
+
export interface SupersededContribution {
|
|
6
|
+
readonly fromPlugins: readonly string[];
|
|
7
|
+
readonly descriptorId: string;
|
|
8
|
+
/** Singular noun for refusal text, e.g. `"deploy target"`. */
|
|
9
|
+
readonly label: string;
|
|
10
|
+
}
|
|
11
|
+
/** What one trusted plugin declares it supersedes. */
|
|
12
|
+
export interface PluginSupersession {
|
|
13
|
+
readonly successorId: string;
|
|
14
|
+
readonly packages: readonly string[];
|
|
15
|
+
readonly contributions: readonly SupersededContribution[];
|
|
16
|
+
}
|
|
17
|
+
/** Reads a trusted plugin's manifest text; either may reject, which reads as "no declaration". */
|
|
18
|
+
export interface SupersessionManifestsPort {
|
|
19
|
+
readonly readInstalled: (required: {
|
|
20
|
+
readonly plugin: TrustedPluginPackage;
|
|
21
|
+
}) => Promise<string>;
|
|
22
|
+
readonly readBundledSource: (required: {
|
|
23
|
+
readonly pluginId: string;
|
|
24
|
+
}) => Promise<string>;
|
|
25
|
+
}
|
|
26
|
+
/** The manifest's declaration, or `undefined` when it has none or any part is malformed — a
|
|
27
|
+
* half-understood declaration must never refuse contributions it did not clearly name.
|
|
28
|
+
* @complexity O(n) in the declaration's entries. */
|
|
29
|
+
export declare function parseSupersedes(required: {
|
|
30
|
+
readonly manifestText: string | undefined;
|
|
31
|
+
}, optional?: Pick<AgentPluginIdentityReadOptions, "legacyIdentity">): Omit<PluginSupersession, "successorId"> | undefined;
|
|
32
|
+
/** The host-bound fallback runner (Core's `orFallback`), injected so this policy reports a failed read
|
|
33
|
+
* through the host's own notifier rather than a module-level import. */
|
|
34
|
+
export type SupersessionOrFallback = typeof orFallback;
|
|
35
|
+
/** Every trusted verdict's declaration, in verdict order. Refusal verdicts never supersede.
|
|
36
|
+
* @complexity O(v) manifest reads, at most two per trusted verdict. */
|
|
37
|
+
export declare function readSupersessions(required: {
|
|
38
|
+
readonly verdicts: readonly TrustedPluginVerdict[];
|
|
39
|
+
readonly manifests: SupersessionManifestsPort;
|
|
40
|
+
readonly orFallback: SupersessionOrFallback;
|
|
41
|
+
}, optional?: Pick<AgentPluginIdentityReadOptions, "legacyIdentity">): Promise<readonly PluginSupersession[]>;
|
|
42
|
+
/** The refusal for a whole superseded package, or `undefined`. */
|
|
43
|
+
export declare function supersededPackageRefusal(required: {
|
|
44
|
+
readonly supersessions: readonly PluginSupersession[];
|
|
45
|
+
readonly pluginId: string;
|
|
46
|
+
}, _optional?: Record<string, never>): string | undefined;
|
|
47
|
+
/** The refusal for one superseded descriptor from a named package, or `undefined`. */
|
|
48
|
+
export declare function supersededDescriptorRefusal(required: {
|
|
49
|
+
readonly supersessions: readonly PluginSupersession[];
|
|
50
|
+
readonly pluginId: string;
|
|
51
|
+
readonly descriptor: unknown;
|
|
52
|
+
}, _optional?: Record<string, never>): string | undefined;
|
|
53
|
+
/** Reads `<sourceRoot>/<pluginId>/plugin.json`. An id that is not a single path segment is refused
|
|
54
|
+
* so a manifest read can never leave the bundled source root. The host supplies the build's
|
|
55
|
+
* resolved bundled source root because a feature must not import the composition root. */
|
|
56
|
+
export declare function createBundledSourceManifestReader(required: {
|
|
57
|
+
readonly bundledSourceRoot: string;
|
|
58
|
+
}, optional?: {
|
|
59
|
+
readonly readText?: (filePath: string) => Promise<string>;
|
|
60
|
+
}): SupersessionManifestsPort["readBundledSource"];
|
|
61
|
+
//# sourceMappingURL=supersession.d.ts.map
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { readAgentPluginPortableExtension } from "../lifecycle/manifest.js";
|
|
2
|
+
/**
|
|
3
|
+
* @file Trusted-replacement supersession, declared by the replacing plugin and read generically.
|
|
4
|
+
*
|
|
5
|
+
* A bundled plugin that replaces older packages names them in its own `plugin.json` under
|
|
6
|
+
* `extensions.jini.supersedes`:
|
|
7
|
+
*
|
|
8
|
+
* ```json
|
|
9
|
+
* "supersedes": {
|
|
10
|
+
* "packages": ["old-package"],
|
|
11
|
+
* "contributions": [{ "fromPlugins": ["old-package", "other"], "descriptorId": "x", "label": "deploy target" }]
|
|
12
|
+
* }
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* `packages` refuses every contribution from those packages; `contributions` refuses one descriptor
|
|
16
|
+
* id from the named packages. Both apply only while the declaring plugin is a TRUSTED verdict for the
|
|
17
|
+
* seam, so core never names a vendor — the knowledge lives in the plugin that owns it.
|
|
18
|
+
*
|
|
19
|
+
* Architectural role: `features/agent-plugins` policy over the lifecycle owner's trust verdicts.
|
|
20
|
+
* Depends on injected manifest readers only; `lifecycle.ts` binds the production ones.
|
|
21
|
+
*/
|
|
22
|
+
import { readFile } from "node:fs/promises";
|
|
23
|
+
import path from "node:path";
|
|
24
|
+
function isRecord(value) {
|
|
25
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
26
|
+
}
|
|
27
|
+
function stringList({ value }, _optional = {}) {
|
|
28
|
+
return Array.isArray(value) && value.every(item => typeof item === "string") ? value : undefined;
|
|
29
|
+
}
|
|
30
|
+
function parseContribution({ value }, _optional = {}) {
|
|
31
|
+
if (!isRecord(value))
|
|
32
|
+
return undefined;
|
|
33
|
+
const fromPlugins = stringList({ value: value.fromPlugins });
|
|
34
|
+
const { descriptorId, label } = value;
|
|
35
|
+
if (fromPlugins === undefined || typeof descriptorId !== "string" || typeof label !== "string")
|
|
36
|
+
return undefined;
|
|
37
|
+
return { fromPlugins, descriptorId, label };
|
|
38
|
+
}
|
|
39
|
+
function parseJson({ text }, _optional = {}) {
|
|
40
|
+
try {
|
|
41
|
+
return JSON.parse(text);
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
return undefined;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function declaredSupersedes({ manifest }, optional = {}) {
|
|
48
|
+
return readAgentPluginPortableExtension({ value: manifest }, optional)?.supersedes;
|
|
49
|
+
}
|
|
50
|
+
/** The manifest's declaration, or `undefined` when it has none or any part is malformed — a
|
|
51
|
+
* half-understood declaration must never refuse contributions it did not clearly name.
|
|
52
|
+
* @complexity O(n) in the declaration's entries. */
|
|
53
|
+
export function parseSupersedes(required, optional = {}) {
|
|
54
|
+
const declared = declaredSupersedes({ manifest: required.manifestText === undefined ? undefined : parseJson({ text: required.manifestText }) }, optional);
|
|
55
|
+
if (!isRecord(declared))
|
|
56
|
+
return undefined;
|
|
57
|
+
const packages = stringList({ value: declared.packages ?? [] });
|
|
58
|
+
const rawContributions = declared.contributions ?? [];
|
|
59
|
+
if (packages === undefined || !Array.isArray(rawContributions))
|
|
60
|
+
return undefined;
|
|
61
|
+
const contributions = rawContributions.map((value) => parseContribution({ value }));
|
|
62
|
+
if (contributions.some(entry => entry === undefined))
|
|
63
|
+
return undefined;
|
|
64
|
+
return { packages, contributions: contributions };
|
|
65
|
+
}
|
|
66
|
+
async function readOrUndefined({ read, orFallback }, _optional = {}) {
|
|
67
|
+
return orFallback({ work: read, fallback: undefined, step: "read plugin supersession manifest" });
|
|
68
|
+
}
|
|
69
|
+
async function declaredBy(required, optional = {}) {
|
|
70
|
+
const { plugin, manifests, orFallback } = required;
|
|
71
|
+
const installed = parseSupersedes({ manifestText: await readOrUndefined({ read: () => manifests.readInstalled({ plugin }), orFallback }) }, optional);
|
|
72
|
+
if (installed !== undefined)
|
|
73
|
+
return installed;
|
|
74
|
+
// A trusted package can predate its own declaration: the trust gate accepts the digest the
|
|
75
|
+
// bundled-digest ledger last recorded, and a boot whose seed of the new version failed keeps the
|
|
76
|
+
// previous one. The build's own source manifest for the same id is then the declaration.
|
|
77
|
+
return parseSupersedes({ manifestText: await readOrUndefined({ read: () => manifests.readBundledSource({ pluginId: plugin.pluginId }), orFallback }) }, optional);
|
|
78
|
+
}
|
|
79
|
+
/** Every trusted verdict's declaration, in verdict order. Refusal verdicts never supersede.
|
|
80
|
+
* @complexity O(v) manifest reads, at most two per trusted verdict. */
|
|
81
|
+
export async function readSupersessions(required, optional = {}) {
|
|
82
|
+
const supersessions = [];
|
|
83
|
+
for (const verdict of required.verdicts) {
|
|
84
|
+
if (!("trusted" in verdict))
|
|
85
|
+
continue;
|
|
86
|
+
const declared = await declaredBy({ plugin: verdict.trusted, manifests: required.manifests, orFallback: required.orFallback }, optional);
|
|
87
|
+
if (declared !== undefined)
|
|
88
|
+
supersessions.push({ successorId: verdict.trusted.pluginId, ...declared });
|
|
89
|
+
}
|
|
90
|
+
return supersessions;
|
|
91
|
+
}
|
|
92
|
+
/** The refusal for a whole superseded package, or `undefined`. */
|
|
93
|
+
export function supersededPackageRefusal(required, _optional = {}) {
|
|
94
|
+
const successor = required.supersessions.find(entry => entry.packages.includes(required.pluginId));
|
|
95
|
+
return successor === undefined ? undefined : `contributions from '${required.pluginId}' were superseded by trusted '${successor.successorId}'`;
|
|
96
|
+
}
|
|
97
|
+
function descriptorIdOf({ descriptor }, _optional = {}) {
|
|
98
|
+
return isRecord(descriptor) ? descriptor.id : undefined;
|
|
99
|
+
}
|
|
100
|
+
/** The refusal for one superseded descriptor from a named package, or `undefined`. */
|
|
101
|
+
export function supersededDescriptorRefusal(required, _optional = {}) {
|
|
102
|
+
const id = descriptorIdOf({ descriptor: required.descriptor });
|
|
103
|
+
for (const successor of required.supersessions) {
|
|
104
|
+
const hit = successor.contributions.find(entry => entry.descriptorId === id && entry.fromPlugins.includes(required.pluginId));
|
|
105
|
+
if (hit !== undefined)
|
|
106
|
+
return `${hit.label} '${hit.descriptorId}' is provided by the trusted '${successor.successorId}' replacement`;
|
|
107
|
+
}
|
|
108
|
+
return undefined;
|
|
109
|
+
}
|
|
110
|
+
/** Reads `<sourceRoot>/<pluginId>/plugin.json`. An id that is not a single path segment is refused
|
|
111
|
+
* so a manifest read can never leave the bundled source root. The host supplies the build's
|
|
112
|
+
* resolved bundled source root because a feature must not import the composition root. */
|
|
113
|
+
export function createBundledSourceManifestReader(required, optional = {}) {
|
|
114
|
+
const readText = optional.readText ?? (filePath => readFile(filePath, "utf8"));
|
|
115
|
+
return async ({ pluginId }) => {
|
|
116
|
+
if (pluginId === "" || path.basename(pluginId) !== pluginId || pluginId === "." || pluginId === "..") {
|
|
117
|
+
throw new Error(`'${pluginId}' is not a bundled plugin directory name`);
|
|
118
|
+
}
|
|
119
|
+
return readText(path.join(required.bundledSourceRoot, pluginId, "plugin.json"));
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=supersession.js.map
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { type ToolExecutionOptions, type ToolExecutionContext, type ToolHandler } from "@jini-ai/core";
|
|
2
|
+
import type { AssistantSurfaceDeps } from "@jini-ai/core/contracts/site/daemon-surface-exchanges";
|
|
3
|
+
import type { AgentPluginUninstallPreview } from "@jini-ai/core/contracts/site/agent-plugins-lifecycle";
|
|
4
|
+
import type { HumanConfirmSpec } from "@jini-ai/core/contracts/site/human-confirm";
|
|
5
|
+
/**
|
|
6
|
+
* @file The Agent Plugin family's half of `plugins_uninstall` (S4, 2026-09-24).
|
|
7
|
+
*
|
|
8
|
+
* Before this file existed, this was its own standalone tool, `agent_plugins_uninstall`
|
|
9
|
+
* (`features/agent-plugins/tool-registrations.ts`). `features/plugin-runtime/tool-registrations.ts`
|
|
10
|
+
* already has `plugins_uninstall` for the OTHER plugin system (the host's own site/runtime plugin package format),
|
|
11
|
+
* and a model choosing between two near-identically-named uninstall tools is the exact confusion
|
|
12
|
+
* `plugins_set_enabled`'s own family merge (2026-09-09) already fixed for enable/disable — uninstall
|
|
13
|
+
* had the identical problem and got the identical fix: ONE tool, a required `family` argument, this
|
|
14
|
+
* module supplying the Agent Plugin branch.
|
|
15
|
+
*
|
|
16
|
+
* `runAgentPluginUninstall` below is everything `plugins_uninstall`'s handler
|
|
17
|
+
* (`plugin-runtime/tool-registrations.ts`) needs to run the Agent Plugin branch: permission check,
|
|
18
|
+
* preview-or-refusal, the confirmation dialog, and the confirmed write. Behavior is UNCHANGED from the
|
|
19
|
+
* deleted standalone tool — same permanent removal, same dialog, same refusals — only the id it is
|
|
20
|
+
* reached through changed. See that file's own header for the full design this mirrors (no
|
|
21
|
+
* cross-workspace "enabled somewhere else" precondition; bundled is refused for permanence, not mere
|
|
22
|
+
* absence).
|
|
23
|
+
*
|
|
24
|
+
* Deliberately does NOT import `agent-plugins/tool-registrations.ts` — that file's own header states
|
|
25
|
+
* "no plugin-runtime -> agent-plugins/tool-registrations edge", and this module is `plugin-runtime`'s
|
|
26
|
+
* new entry point into this family, so it must not create the edge from the other side either.
|
|
27
|
+
*
|
|
28
|
+
* Risk classification: `deletes-durable-state`, same as the deleted standalone tool. See
|
|
29
|
+
* `plugin-runtime/tool-registrations.ts`'s `pluginsDerivedRisk` for where that is now declared for the
|
|
30
|
+
* merged `plugins_uninstall` id — one id, one risk band, covering the worse of the two families' blast
|
|
31
|
+
* radii (site plugins go to the Trash; Agent Plugins do not).
|
|
32
|
+
*/
|
|
33
|
+
import type { AgentPluginUninstallToolDeps as HostUninstallDeps } from '@jini-ai/core/contracts/headless/plugin-host';
|
|
34
|
+
/** The lifecycle request both the preview and the confirmed write take (the host's layout shape). */
|
|
35
|
+
export type UninstallAgentPluginRequired = Parameters<UninstallAgentPlugin>[0];
|
|
36
|
+
/** The lifecycle owner's confirmed write, as the host binds it. */
|
|
37
|
+
export type UninstallAgentPlugin = NonNullable<HostUninstallDeps['uninstallAgentPlugin']>;
|
|
38
|
+
/** A not-confirmed approval outcome: declined, expired, or closed because the run ended. */
|
|
39
|
+
export type AgentPluginUninstallNotConfirmed = {
|
|
40
|
+
confirmed: false;
|
|
41
|
+
reason: 'declined' | 'expired' | 'abandoned';
|
|
42
|
+
};
|
|
43
|
+
/** The model-facing names this branch's notes use. The engine names no product and no host tool of
|
|
44
|
+
* its own in text a model reads, so the host supplies them. */
|
|
45
|
+
export interface AgentPluginUninstallCopy {
|
|
46
|
+
/** The product the model is told about, e.g. "restart <productName>". */
|
|
47
|
+
readonly productName: string;
|
|
48
|
+
/** The host's merged uninstall tool id the model calls again (and the server log names). */
|
|
49
|
+
readonly uninstallToolName: string;
|
|
50
|
+
/** Where an operator disables or deletes an external MCP connection, e.g. "Settings → External MCP". */
|
|
51
|
+
readonly externalMcpSettingsPath: string;
|
|
52
|
+
}
|
|
53
|
+
/** The host's approval owner, specialised to this branch: it asks the human through `surfaces`,
|
|
54
|
+
* using the dialog `describe` returns, and returns `declined`'s result when nobody confirms. */
|
|
55
|
+
export type AgentPluginUninstallApprovalHandler = (required: {
|
|
56
|
+
surfaces: AssistantSurfaceDeps;
|
|
57
|
+
prepare: (required: {
|
|
58
|
+
ctx: ToolExecutionContext;
|
|
59
|
+
}, optional: ToolExecutionOptions) => Promise<AgentPluginUninstallPreview>;
|
|
60
|
+
describe: (required: {
|
|
61
|
+
ctx: ToolExecutionContext;
|
|
62
|
+
prepared: AgentPluginUninstallPreview;
|
|
63
|
+
}) => HumanConfirmSpec | Promise<HumanConfirmSpec>;
|
|
64
|
+
run: (required: {
|
|
65
|
+
ctx: ToolExecutionContext;
|
|
66
|
+
prepared: AgentPluginUninstallPreview;
|
|
67
|
+
choice?: string;
|
|
68
|
+
}, optional: ToolExecutionOptions) => Promise<unknown>;
|
|
69
|
+
}, optional: {
|
|
70
|
+
flag?: string;
|
|
71
|
+
declined?: (required: {
|
|
72
|
+
reason: AgentPluginUninstallNotConfirmed['reason'];
|
|
73
|
+
}) => unknown;
|
|
74
|
+
}) => ToolHandler;
|
|
75
|
+
/** What the host binds for this branch: its lifecycle owner, approval owner, dialog and copy. */
|
|
76
|
+
export interface AgentPluginUninstallHost {
|
|
77
|
+
readonly previewAgentPluginUninstall: (request: UninstallAgentPluginRequired) => Promise<AgentPluginUninstallPreview>;
|
|
78
|
+
/** The confirmed write used when `uninstallAgentPlugin` on the deps is absent. */
|
|
79
|
+
readonly uninstallAgentPlugin: UninstallAgentPlugin;
|
|
80
|
+
readonly approvalToolHandler: AgentPluginUninstallApprovalHandler;
|
|
81
|
+
readonly notConfirmedResult: (outcome: AgentPluginUninstallNotConfirmed) => {
|
|
82
|
+
cancelled: boolean;
|
|
83
|
+
reason?: 'expired' | 'abandoned';
|
|
84
|
+
note: string;
|
|
85
|
+
};
|
|
86
|
+
readonly describeApproval: (required: {
|
|
87
|
+
preview: AgentPluginUninstallPreview;
|
|
88
|
+
}, optional: {
|
|
89
|
+
locale?: string;
|
|
90
|
+
}) => HumanConfirmSpec;
|
|
91
|
+
readonly copy: AgentPluginUninstallCopy;
|
|
92
|
+
/** The host's server log for a not-removed refusal whose error names a host path (a lock file or
|
|
93
|
+
* activations.json). The engine never logs or formats that text itself: the model only gets the
|
|
94
|
+
* path-free `note`, and how (or whether) the raw error is written is the host's call. */
|
|
95
|
+
readonly reportRefusal: (refusal: AgentPluginUninstallRefusalReport) => void;
|
|
96
|
+
}
|
|
97
|
+
/** One not-removed refusal handed to {@link AgentPluginUninstallHost.reportRefusal}: which plugin,
|
|
98
|
+
* which result `reason` the model got, and the raw lifecycle error behind it. */
|
|
99
|
+
export interface AgentPluginUninstallRefusalReport {
|
|
100
|
+
readonly pluginId: string;
|
|
101
|
+
readonly reason: 'activations-busy' | 'plugin-busy' | 'activations-unreadable';
|
|
102
|
+
readonly error: Error;
|
|
103
|
+
}
|
|
104
|
+
/** The lifecycle inputs and principal-bound locale resolver this branch consumes. */
|
|
105
|
+
export interface AgentPluginUninstallToolDeps extends Pick<HostUninstallDeps, 'agentPluginLayout' | 'authorize' | 'workspaceId' | 'uninstallAgentPlugin'> {
|
|
106
|
+
readonly preferences: {
|
|
107
|
+
locale(input: {
|
|
108
|
+
workspaceId: string;
|
|
109
|
+
principalId: string;
|
|
110
|
+
}, options?: Record<string, never>): Promise<string>;
|
|
111
|
+
};
|
|
112
|
+
/** The host's lifecycle owner, approval owner, dialog and model-facing copy. */
|
|
113
|
+
readonly uninstallHost: AgentPluginUninstallHost;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Runs the Agent Plugin branch of `plugins_uninstall` end to end: permission, preview-or-refusal,
|
|
117
|
+
* confirm, write. `plugin-runtime/tool-registrations.ts`'s handler calls this directly when
|
|
118
|
+
* `family === "agent-plugin"` — see this file's header for why the permission check lives here rather
|
|
119
|
+
* than being hoisted above the family branch (unlike `plugins_set_enabled`'s single pre-branch check):
|
|
120
|
+
* this mirrors the deleted standalone tool's own order exactly, permission then preview then confirm
|
|
121
|
+
* then write, with nothing shared between the two families' checks to hoist.
|
|
122
|
+
*
|
|
123
|
+
* Order is load-bearing, same as the site-runtime branch: parse -> authorize -> preview (so an unknown
|
|
124
|
+
* or bundled id, or an unreadable/busy activations.json, is refused or returned as a not-removed
|
|
125
|
+
* result before any human is asked anything) -> confirm -> re-check and write only if the plugin is
|
|
126
|
+
* still what the dialog showed (t91 F2.2).
|
|
127
|
+
*
|
|
128
|
+
* @complexity O(1) beyond `previewAgentPluginUninstall`/`uninstallAgentPlugin`.
|
|
129
|
+
*/
|
|
130
|
+
export declare function runAgentPluginUninstall({ routeDeps, surfaces, ctx, pluginId }: {
|
|
131
|
+
routeDeps: AgentPluginUninstallToolDeps;
|
|
132
|
+
surfaces: AssistantSurfaceDeps;
|
|
133
|
+
ctx: ToolExecutionContext;
|
|
134
|
+
pluginId: string;
|
|
135
|
+
}, optional?: ToolExecutionOptions): Promise<unknown>;
|
|
136
|
+
//# sourceMappingURL=uninstall-tool.d.ts.map
|