@jini-ai/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 +6 -0
- package/README.md +53 -0
- package/dist/host/activation-polling.d.ts +67 -0
- package/dist/host/activation-polling.js +113 -0
- package/dist/host/activation.d.ts +2 -30
- package/dist/host/capability-tools.d.ts +1 -0
- package/dist/host/capability-tools.js +4 -4
- package/dist/host/contributions.d.ts +2 -9
- package/dist/host/hook-refusals.d.ts +49 -0
- package/dist/host/hook-refusals.js +65 -0
- package/dist/host/index.d.ts +3 -1
- package/dist/host/index.js +1 -0
- package/dist/host/manifest.js +2 -2
- package/dist/host/node/browser-provider-assets.d.ts +2 -1
- package/dist/host/node/browser-provider-assets.js +2 -2
- package/dist/host/node/discovery.js +5 -5
- package/dist/host/node/install.d.ts +6 -1
- package/dist/host/node/install.js +22 -20
- package/dist/host/node/integrity-command.d.ts +2 -1
- package/dist/host/node/integrity-command.js +3 -3
- package/dist/host/node/loader.d.ts +3 -2
- package/dist/host/node/loader.js +6 -6
- package/dist/host/node/module-snapshot.d.ts +4 -3
- package/dist/host/node/module-snapshot.js +5 -5
- package/dist/host/node/package-files.d.ts +2 -1
- package/dist/host/node/package-files.js +6 -6
- package/dist/host/node/runtime-activation.d.ts +35 -0
- package/dist/host/node/runtime-activation.js +188 -0
- package/dist/host/node/runtime-boot.d.ts +16 -0
- package/dist/host/node/runtime-boot.js +153 -0
- package/dist/host/node/runtime-conflicts.d.ts +38 -0
- package/dist/host/node/runtime-conflicts.js +42 -0
- package/dist/host/node/runtime-contracts.d.ts +5 -3
- package/dist/host/node/runtime-core.js +65 -465
- package/dist/host/node/runtime-load-target.d.ts +14 -0
- package/dist/host/node/runtime-load-target.js +15 -0
- package/dist/host/node/runtime-reload.d.ts +12 -0
- package/dist/host/node/runtime-reload.js +107 -0
- package/dist/host/node/runtime-state.d.ts +52 -0
- package/dist/host/node/runtime-state.js +50 -0
- package/dist/host/node/source-drafts.d.ts +1 -1
- package/dist/host/node/source-drafts.js +17 -15
- package/dist/host/plugin-claims.d.ts +2 -9
- package/dist/host/plugin-format.d.ts +5 -5
- package/dist/host/plugin-format.js +9 -10
- package/dist/host/ports.d.ts +4 -28
- package/dist/host/tools/install.js +1 -1
- package/dist/host/uninstall.d.ts +2 -2
- package/dist/host/worker/import-policy.d.ts +49 -0
- package/dist/host/worker/import-policy.js +86 -0
- package/dist/host/worker/import-seam.js +21 -2
- package/dist/host/worker/index.d.ts +1 -0
- package/dist/host/worker/index.js +1 -0
- package/dist/host/worker/protocol.d.ts +4 -0
- package/dist/host/worker/run-call.js +2 -1
- package/dist/host/worker/start.d.ts +18 -1
- package/dist/host/worker/start.js +27 -6
- package/dist/react/PluginProviderSettingsDialog.d.ts +144 -0
- package/dist/react/PluginProviderSettingsDialog.js +54 -0
- package/dist/react/plugin-install-port.d.ts +29 -0
- package/dist/react/plugin-install-port.js +15 -0
- package/dist/runtime/agent-tools.d.ts +174 -0
- package/dist/runtime/agent-tools.js +121 -0
- package/dist/runtime/built-ins/word-count/count-words.d.ts +21 -0
- package/dist/runtime/built-ins/word-count/count-words.js +48 -0
- package/dist/runtime/built-ins/word-count/plugin.d.ts +6 -0
- package/dist/runtime/built-ins/word-count/plugin.js +12 -0
- package/dist/runtime/capability-card.d.ts +22 -0
- package/dist/runtime/capability-card.js +30 -0
- package/dist/runtime/enable-confirmation-ui.d.ts +28 -0
- package/dist/runtime/enable-confirmation-ui.js +54 -0
- package/dist/runtime/install-consent.d.ts +12 -0
- package/dist/runtime/install-consent.js +27 -0
- package/dist/runtime/install-source.d.ts +26 -0
- package/dist/runtime/install-source.js +61 -0
- package/dist/runtime/install-tool-catalog.d.ts +9 -0
- package/dist/runtime/install-tool-catalog.js +25 -0
- package/dist/runtime/lower-tool-access.d.ts +17 -0
- package/dist/runtime/lower-tool-access.js +14 -0
- package/dist/runtime/plugin-export.d.ts +13 -0
- package/dist/runtime/plugin-export.js +14 -0
- package/dist/runtime/plugin-host-copy.d.ts +17 -0
- package/dist/runtime/plugin-host-copy.js +7 -0
- package/dist/runtime/plugin-tool-ids.d.ts +18 -0
- package/dist/runtime/plugin-tool-ids.js +4 -0
- package/dist/runtime/plugin-tool-messages.d.ts +97 -0
- package/dist/runtime/plugin-tool-messages.js +90 -0
- package/dist/runtime/sdk-resolver.d.ts +60 -0
- package/dist/runtime/sdk-resolver.js +97 -0
- package/dist/runtime/service-ports.d.ts +43 -0
- package/dist/runtime/service-ports.js +3 -0
- package/dist/runtime/source-tool-catalog.d.ts +7 -0
- package/dist/runtime/source-tool-catalog.js +33 -0
- package/dist/runtime/uninstall-confirmation-ui.d.ts +31 -0
- package/dist/runtime/uninstall-confirmation-ui.js +38 -0
- package/dist/runtime/widget-partials.d.ts +22 -0
- package/dist/runtime/widget-partials.js +13 -0
- package/dist/site/lipay/manifest.d.ts +10 -0
- package/dist/site/lipay/manifest.js +96 -0
- package/dist/site/store/manifest.d.ts +10 -0
- package/dist/site/store/manifest.js +37 -0
- package/package.json +158 -8
- package/dist/host/provider-config-source.d.ts +0 -47
- package/dist/host/provider-config-source.js +0 -2
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** Host-owned catalog ids shared by adapters without a module-initialization cycle. */
|
|
2
|
+
export declare const pluginManagementToolIds: {
|
|
3
|
+
list: string;
|
|
4
|
+
setEnabled: string;
|
|
5
|
+
uninstall: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const pluginSourceToolIds: {
|
|
8
|
+
create: string;
|
|
9
|
+
open: string;
|
|
10
|
+
list: string;
|
|
11
|
+
read: string;
|
|
12
|
+
write: string;
|
|
13
|
+
edit: string;
|
|
14
|
+
delete: string;
|
|
15
|
+
seal: string;
|
|
16
|
+
rollback: string;
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=plugin-tool-ids.d.ts.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** Host-owned catalog ids shared by adapters without a module-initialization cycle. */
|
|
2
|
+
export const pluginManagementToolIds = { list: 'plugins_list', setEnabled: 'plugins_set_enabled', uninstall: 'plugins_uninstall' };
|
|
3
|
+
export const pluginSourceToolIds = { create: 'plugin_source_create', open: 'plugin_source_open', list: 'plugin_source_list', read: 'plugin_source_read', write: 'plugin_source_write', edit: 'plugin_source_edit', delete: 'plugin_source_delete', seal: 'plugin_source_seal', rollback: 'plugin_source_rollback' };
|
|
4
|
+
//# sourceMappingURL=plugin-tool-ids.js.map
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import type { SetEnabledRequest } from '../host/tools/index.js';
|
|
2
|
+
import type { PluginHostCopy } from "./plugin-host-copy.js";
|
|
3
|
+
export declare const familyRequired: ({ copy }: {
|
|
4
|
+
copy: PluginHostCopy;
|
|
5
|
+
}) => string;
|
|
6
|
+
/**
|
|
7
|
+
* What a caller must still do after a successful toggle, per family and direction.
|
|
8
|
+
*
|
|
9
|
+
* This exists because "enabled: true" alone was actively misleading. The activation record is
|
|
10
|
+
* durable and re-read per run, so the GATE moves immediately — but a plugin's own tool
|
|
11
|
+
* (`agent_plugin_<id>` for Agent Plugins, a capability tool for site plugins) is registered once, at
|
|
12
|
+
* agent-daemon boot, and the `search_tools` index is a one-shot snapshot taken right after
|
|
13
|
+
* (`agent-daemon-server.ts`). So a freshly enabled plugin's TOOL is not callable in the daemon that
|
|
14
|
+
* is running now. Reporting plain success and letting the operator discover that themselves is the
|
|
15
|
+
* confusion this field exists to prevent.
|
|
16
|
+
*
|
|
17
|
+
* The two directions are deliberately NOT symmetric, for BOTH families, and the notes say so. DISABLE
|
|
18
|
+
* lands immediately on the tool as well, because each tool's own `ToolPolicy` re-reads the activation
|
|
19
|
+
* record per call: `agent_plugin_<id>` via `features/agent-plugins/tool-registrations.ts`'s REVOCATION
|
|
20
|
+
* note, `plugin_capability_<id>` via `capability-tool-registrations.ts`'s "Revocation" section
|
|
21
|
+
* (t91 F1.2). ENABLE still needs a restart, because there is no registration to re-admit: an
|
|
22
|
+
* append-only `ToolRegistry` has nothing to un-skip.
|
|
23
|
+
*
|
|
24
|
+
* An Agent Plugin's provisioned connection rows and credentials survive disable: deleting those
|
|
25
|
+
* records would destroy a sign-in the owner already earned (`federate-mcp.ts`, "THE ROW SURVIVES").
|
|
26
|
+
* Retention is not permission: the connection's per-call gate now also checks the provisioning
|
|
27
|
+
* plugin's activation, and reload withdraws its frozen registrations from discovery. The note must
|
|
28
|
+
* distinguish saved credentials from callable tools so the model cannot keep using an OFF plugin.
|
|
29
|
+
* @complexity O(1).
|
|
30
|
+
*/
|
|
31
|
+
export declare function restartNote({ request, copy }: {
|
|
32
|
+
request: SetEnabledRequest;
|
|
33
|
+
copy: PluginHostCopy;
|
|
34
|
+
}, _optional?: {}): string;
|
|
35
|
+
/** Only a pending update recovers at start. Any other journal refusal (an unreadable record, an
|
|
36
|
+
* unsafe recorded path) survives a restart, so telling the user to restart would loop them.
|
|
37
|
+
* @complexity O(1). */
|
|
38
|
+
export declare function updatePendingNextStep({ error, copy }: {
|
|
39
|
+
error: {
|
|
40
|
+
code: string;
|
|
41
|
+
};
|
|
42
|
+
copy: PluginHostCopy;
|
|
43
|
+
}, _optional?: {}): string;
|
|
44
|
+
export declare function changedSinceConfirmation({ pluginId, name, version }: {
|
|
45
|
+
pluginId: string;
|
|
46
|
+
name: string;
|
|
47
|
+
version: string;
|
|
48
|
+
}): string;
|
|
49
|
+
export declare function hostIncompatibleNote({ pluginId, copy }: {
|
|
50
|
+
pluginId: string;
|
|
51
|
+
copy: PluginHostCopy;
|
|
52
|
+
}, _optional?: {}): string;
|
|
53
|
+
export declare function activationsUnreadableNote({ pluginId, enabled }: {
|
|
54
|
+
pluginId: string;
|
|
55
|
+
enabled: boolean;
|
|
56
|
+
}): string;
|
|
57
|
+
export declare function activationsBusyNote({ pluginId, enabled, copy }: {
|
|
58
|
+
pluginId: string;
|
|
59
|
+
enabled: boolean;
|
|
60
|
+
copy: PluginHostCopy;
|
|
61
|
+
}, _optional?: {}): string;
|
|
62
|
+
export declare function installedNote(plugin: {
|
|
63
|
+
name: string;
|
|
64
|
+
version: string;
|
|
65
|
+
}): string;
|
|
66
|
+
export declare const localInstallDisabledNote: ({ copy }: {
|
|
67
|
+
copy: PluginHostCopy;
|
|
68
|
+
}) => string;
|
|
69
|
+
export declare const retryInstallHint = " Call plugins_install again to install what is there now.";
|
|
70
|
+
/** The host-bound set-enabled/uninstall messages; product copy arrives through `copy`. @complexity O(1). */
|
|
71
|
+
export declare function createPluginToolMessages({ copy }: {
|
|
72
|
+
copy: PluginHostCopy;
|
|
73
|
+
}, _optional?: {}): {
|
|
74
|
+
familyRequired: string;
|
|
75
|
+
restartNote: (request: SetEnabledRequest) => string;
|
|
76
|
+
changedSinceConfirmation: typeof changedSinceConfirmation;
|
|
77
|
+
updatePendingNextStep: (error: {
|
|
78
|
+
code: string;
|
|
79
|
+
}) => string;
|
|
80
|
+
hostIncompatibleNote: ({ pluginId }: {
|
|
81
|
+
pluginId: string;
|
|
82
|
+
}) => string;
|
|
83
|
+
activationsUnreadableNote: typeof activationsUnreadableNote;
|
|
84
|
+
activationsBusyNote: ({ pluginId, enabled }: {
|
|
85
|
+
pluginId: string;
|
|
86
|
+
enabled: boolean;
|
|
87
|
+
}) => string;
|
|
88
|
+
};
|
|
89
|
+
/** The host-bound install messages; product copy arrives through `copy`. @complexity O(1). */
|
|
90
|
+
export declare function createPluginInstallMessages({ copy }: {
|
|
91
|
+
copy: PluginHostCopy;
|
|
92
|
+
}, _optional?: {}): {
|
|
93
|
+
installedNote: typeof installedNote;
|
|
94
|
+
localInstallDisabledNote: string;
|
|
95
|
+
retryInstallHint: string;
|
|
96
|
+
};
|
|
97
|
+
//# sourceMappingURL=plugin-tool-messages.d.ts.map
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
export const familyRequired = ({ copy }) => `'family' is required and must be exactly one of: 'site-runtime' (a ${copy.sitePluginFormat} site plugin, as listed by ` +
|
|
2
|
+
`${copy.pluginListToolName}) or 'agent-plugin' (an Agent Plugin, as returned by search_agent_plugin_local). ${copy.productName} has two ` +
|
|
3
|
+
"unrelated plugin systems and this tool never guesses between them — if you are unsure, call the matching list/search " +
|
|
4
|
+
"tool first and use the family whose results contained this id.";
|
|
5
|
+
/**
|
|
6
|
+
* What a caller must still do after a successful toggle, per family and direction.
|
|
7
|
+
*
|
|
8
|
+
* This exists because "enabled: true" alone was actively misleading. The activation record is
|
|
9
|
+
* durable and re-read per run, so the GATE moves immediately — but a plugin's own tool
|
|
10
|
+
* (`agent_plugin_<id>` for Agent Plugins, a capability tool for site plugins) is registered once, at
|
|
11
|
+
* agent-daemon boot, and the `search_tools` index is a one-shot snapshot taken right after
|
|
12
|
+
* (`agent-daemon-server.ts`). So a freshly enabled plugin's TOOL is not callable in the daemon that
|
|
13
|
+
* is running now. Reporting plain success and letting the operator discover that themselves is the
|
|
14
|
+
* confusion this field exists to prevent.
|
|
15
|
+
*
|
|
16
|
+
* The two directions are deliberately NOT symmetric, for BOTH families, and the notes say so. DISABLE
|
|
17
|
+
* lands immediately on the tool as well, because each tool's own `ToolPolicy` re-reads the activation
|
|
18
|
+
* record per call: `agent_plugin_<id>` via `features/agent-plugins/tool-registrations.ts`'s REVOCATION
|
|
19
|
+
* note, `plugin_capability_<id>` via `capability-tool-registrations.ts`'s "Revocation" section
|
|
20
|
+
* (t91 F1.2). ENABLE still needs a restart, because there is no registration to re-admit: an
|
|
21
|
+
* append-only `ToolRegistry` has nothing to un-skip.
|
|
22
|
+
*
|
|
23
|
+
* An Agent Plugin's provisioned connection rows and credentials survive disable: deleting those
|
|
24
|
+
* records would destroy a sign-in the owner already earned (`federate-mcp.ts`, "THE ROW SURVIVES").
|
|
25
|
+
* Retention is not permission: the connection's per-call gate now also checks the provisioning
|
|
26
|
+
* plugin's activation, and reload withdraws its frozen registrations from discovery. The note must
|
|
27
|
+
* distinguish saved credentials from callable tools so the model cannot keep using an OFF plugin.
|
|
28
|
+
* @complexity O(1).
|
|
29
|
+
*/
|
|
30
|
+
export function restartNote({ request, copy }, _optional = {}) {
|
|
31
|
+
if (request.family === 'agent-plugin') {
|
|
32
|
+
return request.enabled
|
|
33
|
+
? `Enabled and saved. Read its guidance now with load_agent_plugin({pluginId:"${request.pluginId}"}) and use ` +
|
|
34
|
+
`agent_plugin_connect for account sign-in when needed. Tool discovery refreshes without restarting; ` +
|
|
35
|
+
`search for agent_plugin_${request.pluginId} to read its guidance. Do not ask the person to restart ${copy.productName}.`
|
|
36
|
+
: 'Disabled and saved. Its guidance and provisioned external MCP tools stop immediately. ' +
|
|
37
|
+
'The connection rows and saved sign-in are retained. Ask to turn the plugin on through plugins_set_enabled before using it again.';
|
|
38
|
+
}
|
|
39
|
+
return request.enabled
|
|
40
|
+
? "Enabled and saved. The plugin's hooks are live now, but any tool it contributes is registered only when the agent " +
|
|
41
|
+
`daemon starts — tell the user ${copy.productName} has to be restarted before that tool can be called.`
|
|
42
|
+
: "Disabled and saved. This takes effect immediately, with no restart: any tool this plugin contributed stays listed " +
|
|
43
|
+
`in the running daemon until ${copy.productName} restarts, but every call to it is refused from now on.`;
|
|
44
|
+
}
|
|
45
|
+
/** Only a pending update recovers at start. Any other journal refusal (an unreadable record, an
|
|
46
|
+
* unsafe recorded path) survives a restart, so telling the user to restart would loop them.
|
|
47
|
+
* @complexity O(1). */
|
|
48
|
+
export function updatePendingNextStep({ error, copy }, _optional = {}) {
|
|
49
|
+
return error.code === "PLUGIN_UPDATE_PENDING"
|
|
50
|
+
? `Tell the user to restart ${copy.productName} (recovery runs at start) and then try again.`
|
|
51
|
+
: `Its update recovery record needs manual repair (${error.code}); restarting ${copy.productName} will not fix it. Tell the user an operator has to repair it first.`;
|
|
52
|
+
}
|
|
53
|
+
export function changedSinceConfirmation({ pluginId, name, version }) {
|
|
54
|
+
return `'${pluginId}' changed after the user was asked: the confirmation showed ${name} version ${version}, and that ` +
|
|
55
|
+
"is no longer what is installed. Nothing was removed. Call plugins_uninstall again so the user can review and confirm what is installed now.";
|
|
56
|
+
}
|
|
57
|
+
export function hostIncompatibleNote({ pluginId, copy }, _optional = {}) {
|
|
58
|
+
return `Nothing changed: '${pluginId}' is not made for this ${copy.productName} version, so it was NOT enabled. ` +
|
|
59
|
+
`Tell the user it needs a version of the plugin that supports this ${copy.productName}.`;
|
|
60
|
+
}
|
|
61
|
+
export function activationsUnreadableNote({ pluginId, enabled }) {
|
|
62
|
+
return `Nothing changed: this workspace's Agent Plugin activation record could not be read, so '${pluginId}' was NOT ` +
|
|
63
|
+
`${enabled ? "enabled" : "disabled"}. Tell the user an operator has to repair activations.json first (the server ` +
|
|
64
|
+
"log names the file and the fault); until then every Agent Plugin tool call in this workspace is refused.";
|
|
65
|
+
}
|
|
66
|
+
export function activationsBusyNote({ pluginId, enabled, copy }, _optional = {}) {
|
|
67
|
+
return `Nothing changed: another ${copy.productName} process was writing this workspace's Agent Plugin activation record at the same ` +
|
|
68
|
+
`moment, so '${pluginId}' was NOT ${enabled ? "enabled" : "disabled"}. Tell the user nothing was ` +
|
|
69
|
+
"changed and to try again in a moment; if it keeps happening, the server log names the lock file.";
|
|
70
|
+
}
|
|
71
|
+
export function installedNote(plugin) { return `Installed ${plugin.name} ${plugin.version}. It is OFF in every workspace; turn it on with plugins_set_enabled (family 'site-runtime') if the user wants it on.`; }
|
|
72
|
+
export const localInstallDisabledNote = ({ copy }) => `Nothing was installed: local plugin installs are off on this server. The owner has to start ${copy.productName} with ${copy.localInstallEnv}=1 first.`;
|
|
73
|
+
export const retryInstallHint = " Call plugins_install again to install what is there now.";
|
|
74
|
+
/** The host-bound set-enabled/uninstall messages; product copy arrives through `copy`. @complexity O(1). */
|
|
75
|
+
export function createPluginToolMessages({ copy }, _optional = {}) {
|
|
76
|
+
return {
|
|
77
|
+
familyRequired: familyRequired({ copy }),
|
|
78
|
+
restartNote: (request) => restartNote({ request, copy }),
|
|
79
|
+
changedSinceConfirmation,
|
|
80
|
+
updatePendingNextStep: (error) => updatePendingNextStep({ error, copy }),
|
|
81
|
+
hostIncompatibleNote: ({ pluginId }) => hostIncompatibleNote({ pluginId, copy }),
|
|
82
|
+
activationsUnreadableNote,
|
|
83
|
+
activationsBusyNote: ({ pluginId, enabled }) => activationsBusyNote({ pluginId, enabled, copy }),
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
/** The host-bound install messages; product copy arrives through `copy`. @complexity O(1). */
|
|
87
|
+
export function createPluginInstallMessages({ copy }, _optional = {}) {
|
|
88
|
+
return { installedNote, localInstallDisabledNote: localInstallDisabledNote({ copy }), retryInstallHint };
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=plugin-tool-messages.js.map
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file `registerPluginSdkResolver()` — the boot-time SDK module-resolution hook.
|
|
3
|
+
* The host SDK import aliases share the bundled SDK module below. They are virtual resolver
|
|
4
|
+
* contracts, not standalone plugin npm packages.
|
|
5
|
+
*
|
|
6
|
+
* Purpose:
|
|
7
|
+
* A plugin's prebuilt `server/index.mjs` does `import { definePlugin } from '<host sdk>'`, but
|
|
8
|
+
* that file is dynamically `import()`-ed from `<install-dir>/plugins/<id>/<version>/server/
|
|
9
|
+
* index.mjs` — a directory the runtime binary's own `node_modules` (where the SDK actually
|
|
10
|
+
* lives) is not an ancestor of. Ordinary Node resolution will not find it. This function
|
|
11
|
+
* registers Node's built-in module-customization hook (`node:module`'s `register()`, stable since
|
|
12
|
+
* Node 18.19/20.6) so every SDK bare-specifier resolution — regardless of the importing file's
|
|
13
|
+
* location on disk — redirects to the runtime's own bundled SDK build, `shortCircuit: true`
|
|
14
|
+
* always winning over any incidental local `node_modules` a plugin might (maliciously or
|
|
15
|
+
* accidentally) plant nearby.
|
|
16
|
+
*
|
|
17
|
+
* **Security constraint (binding):** this function must be called exactly once, synchronously,
|
|
18
|
+
* during the host's boot sequence, BEFORE any route is registered and before any code path that
|
|
19
|
+
* could reach a plugin load is wired into the running process. A plugin `import()` that occurs
|
|
20
|
+
* before this hook exists falls through to ordinary Node resolution, which could resolve the SDK
|
|
21
|
+
* to a plugin-planted local `node_modules` copy instead of the runtime's real one — defeating the
|
|
22
|
+
* deep-import blocking by construction (a fake SDK build could re-export core internals freely).
|
|
23
|
+
*
|
|
24
|
+
* The host resolves its own SDK build on disk and passes the absolute path as `sdkModulePath`:
|
|
25
|
+
* resolving a package by name from this dist would reach the wrong `node_modules`, so the path is
|
|
26
|
+
* a required argument, never a default.
|
|
27
|
+
*/
|
|
28
|
+
/** Thrown by a second `registerPluginSdkResolver()` call in the same process — distinguishes the
|
|
29
|
+
* intentional double-registration guard from any other failure, so a test can assert specifically
|
|
30
|
+
* on THIS failure mode. */
|
|
31
|
+
export declare class PluginSdkResolverAlreadyRegisteredError extends Error {
|
|
32
|
+
constructor();
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The `file://` URL the hook redirects to. A string that already is a valid `file:` URL is
|
|
36
|
+
* normalized as a URL; any other string is an absolute filesystem path. Passing a URL string to
|
|
37
|
+
* `pathToFileURL` would treat it as a path and percent-encode it into a wrong location.
|
|
38
|
+
*
|
|
39
|
+
* @throws {TypeError} If the string starts with `file:` but is not a valid URL.
|
|
40
|
+
* @complexity O(n) in the path length.
|
|
41
|
+
*/
|
|
42
|
+
export declare function sdkModuleUrl(required: {
|
|
43
|
+
sdkModulePath: string;
|
|
44
|
+
}, _optional?: Record<string, never>): string;
|
|
45
|
+
/**
|
|
46
|
+
* Registers the `module.register()` customization hook exactly once for this process. Calling
|
|
47
|
+
* this a second time is a wiring bug, not a silently-tolerated no-op: it throws clearly, so a
|
|
48
|
+
* boot-sequencing bug fails loudly rather than silently double-hooking.
|
|
49
|
+
*
|
|
50
|
+
* @param required.sdkModulePath Absolute path (or `file://` URL) to the runtime's own bundled SDK
|
|
51
|
+
* build, resolved by the host.
|
|
52
|
+
* @param required.sdkSpecifiers Every exact bare specifier redirected to that build (canonical plus
|
|
53
|
+
* any legacy aliases the host still honours).
|
|
54
|
+
* @throws If called more than once in the same process.
|
|
55
|
+
*/
|
|
56
|
+
export declare function registerPluginSdkResolver(required: {
|
|
57
|
+
sdkModulePath: string;
|
|
58
|
+
sdkSpecifiers: readonly string[];
|
|
59
|
+
}, _optional?: Record<string, never>): void;
|
|
60
|
+
//# sourceMappingURL=sdk-resolver.d.ts.map
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file `registerPluginSdkResolver()` — the boot-time SDK module-resolution hook.
|
|
3
|
+
* The host SDK import aliases share the bundled SDK module below. They are virtual resolver
|
|
4
|
+
* contracts, not standalone plugin npm packages.
|
|
5
|
+
*
|
|
6
|
+
* Purpose:
|
|
7
|
+
* A plugin's prebuilt `server/index.mjs` does `import { definePlugin } from '<host sdk>'`, but
|
|
8
|
+
* that file is dynamically `import()`-ed from `<install-dir>/plugins/<id>/<version>/server/
|
|
9
|
+
* index.mjs` — a directory the runtime binary's own `node_modules` (where the SDK actually
|
|
10
|
+
* lives) is not an ancestor of. Ordinary Node resolution will not find it. This function
|
|
11
|
+
* registers Node's built-in module-customization hook (`node:module`'s `register()`, stable since
|
|
12
|
+
* Node 18.19/20.6) so every SDK bare-specifier resolution — regardless of the importing file's
|
|
13
|
+
* location on disk — redirects to the runtime's own bundled SDK build, `shortCircuit: true`
|
|
14
|
+
* always winning over any incidental local `node_modules` a plugin might (maliciously or
|
|
15
|
+
* accidentally) plant nearby.
|
|
16
|
+
*
|
|
17
|
+
* **Security constraint (binding):** this function must be called exactly once, synchronously,
|
|
18
|
+
* during the host's boot sequence, BEFORE any route is registered and before any code path that
|
|
19
|
+
* could reach a plugin load is wired into the running process. A plugin `import()` that occurs
|
|
20
|
+
* before this hook exists falls through to ordinary Node resolution, which could resolve the SDK
|
|
21
|
+
* to a plugin-planted local `node_modules` copy instead of the runtime's real one — defeating the
|
|
22
|
+
* deep-import blocking by construction (a fake SDK build could re-export core internals freely).
|
|
23
|
+
*
|
|
24
|
+
* The host resolves its own SDK build on disk and passes the absolute path as `sdkModulePath`:
|
|
25
|
+
* resolving a package by name from this dist would reach the wrong `node_modules`, so the path is
|
|
26
|
+
* a required argument, never a default.
|
|
27
|
+
*/
|
|
28
|
+
import { register } from "node:module";
|
|
29
|
+
import { pathToFileURL } from "node:url";
|
|
30
|
+
/**
|
|
31
|
+
* The hook module's own source, registered via a `data:` URL rather than a separate file on disk.
|
|
32
|
+
* Node's `module.register()` API requires the hooks module to be a real, independently-loadable
|
|
33
|
+
* ESM module (it runs in a dedicated hooks realm, not this file's own scope) — a `data:
|
|
34
|
+
* text/javascript,...` URL is a self-contained module specifier Node's ESM loader resolves
|
|
35
|
+
* directly, so this mechanism needs no extra `.mjs` file to keep in sync with the compiled
|
|
36
|
+
* `dist/` output. `initialize(data)` receives the values this hook needs at registration time
|
|
37
|
+
* (the resolved SDK URL and accepted specifiers); `resolve()` redirects only the exact canonical
|
|
38
|
+
* and legacy SDK specifiers — deep imports still go through ordinary package export checks.
|
|
39
|
+
*/
|
|
40
|
+
const HOOK_MODULE_SOURCE = `
|
|
41
|
+
let sdkUrl;
|
|
42
|
+
let sdkSpecifiers;
|
|
43
|
+
export function initialize(data) { sdkUrl = data.sdkUrl; sdkSpecifiers = data.sdkSpecifiers; }
|
|
44
|
+
export async function resolve(specifier, context, nextResolve) {
|
|
45
|
+
if (sdkSpecifiers.includes(specifier)) { // legacy alias
|
|
46
|
+
return { url: sdkUrl, shortCircuit: true };
|
|
47
|
+
}
|
|
48
|
+
return nextResolve(specifier, context);
|
|
49
|
+
}
|
|
50
|
+
`;
|
|
51
|
+
/** Process-wide registration marker. Keyed on `globalThis` (not module state) so the
|
|
52
|
+
* exactly-once-per-process guarantee also holds if two copies of this module are loaded. */
|
|
53
|
+
const REGISTERED = Symbol.for("@jini-ai/plugins/runtime/sdk-resolver:registered");
|
|
54
|
+
const processSlots = globalThis;
|
|
55
|
+
/** Thrown by a second `registerPluginSdkResolver()` call in the same process — distinguishes the
|
|
56
|
+
* intentional double-registration guard from any other failure, so a test can assert specifically
|
|
57
|
+
* on THIS failure mode. */
|
|
58
|
+
export class PluginSdkResolverAlreadyRegisteredError extends Error {
|
|
59
|
+
constructor() {
|
|
60
|
+
super("registerPluginSdkResolver: already registered for this process — a second call is a boot-sequencing bug");
|
|
61
|
+
this.name = "PluginSdkResolverAlreadyRegisteredError";
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* The `file://` URL the hook redirects to. A string that already is a valid `file:` URL is
|
|
66
|
+
* normalized as a URL; any other string is an absolute filesystem path. Passing a URL string to
|
|
67
|
+
* `pathToFileURL` would treat it as a path and percent-encode it into a wrong location.
|
|
68
|
+
*
|
|
69
|
+
* @throws {TypeError} If the string starts with `file:` but is not a valid URL.
|
|
70
|
+
* @complexity O(n) in the path length.
|
|
71
|
+
*/
|
|
72
|
+
export function sdkModuleUrl(required, _optional = {}) {
|
|
73
|
+
return required.sdkModulePath.startsWith("file:") ? new URL(required.sdkModulePath).href : pathToFileURL(required.sdkModulePath).href;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Registers the `module.register()` customization hook exactly once for this process. Calling
|
|
77
|
+
* this a second time is a wiring bug, not a silently-tolerated no-op: it throws clearly, so a
|
|
78
|
+
* boot-sequencing bug fails loudly rather than silently double-hooking.
|
|
79
|
+
*
|
|
80
|
+
* @param required.sdkModulePath Absolute path (or `file://` URL) to the runtime's own bundled SDK
|
|
81
|
+
* build, resolved by the host.
|
|
82
|
+
* @param required.sdkSpecifiers Every exact bare specifier redirected to that build (canonical plus
|
|
83
|
+
* any legacy aliases the host still honours).
|
|
84
|
+
* @throws If called more than once in the same process.
|
|
85
|
+
*/
|
|
86
|
+
export function registerPluginSdkResolver(required, _optional = {}) {
|
|
87
|
+
// Exactly once per process — a second call is a boot-sequencing bug, never a silent no-op or a
|
|
88
|
+
// silent double-hook.
|
|
89
|
+
if (processSlots[REGISTERED]) {
|
|
90
|
+
throw new PluginSdkResolverAlreadyRegisteredError();
|
|
91
|
+
}
|
|
92
|
+
const sdkUrl = sdkModuleUrl({ sdkModulePath: required.sdkModulePath });
|
|
93
|
+
const hookModuleUrl = `data:text/javascript,${encodeURIComponent(HOOK_MODULE_SOURCE)}`;
|
|
94
|
+
register(hookModuleUrl, { data: { sdkUrl, sdkSpecifiers: [...required.sdkSpecifiers] } });
|
|
95
|
+
processSlots[REGISTERED] = true;
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=sdk-resolver.js.map
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/** Consumer-owned service boundaries for plugin execution. */
|
|
2
|
+
/** Reads a required post, preserving the post owner's existing not-found error. */
|
|
3
|
+
export interface PluginPostReadPort<Post> {
|
|
4
|
+
readRequired(input: {
|
|
5
|
+
workspaceId: string;
|
|
6
|
+
id: string;
|
|
7
|
+
}, options?: Record<string, never>): Promise<Post>;
|
|
8
|
+
}
|
|
9
|
+
/** Provider/assistant-face relationships and safe linked-switch error details. */
|
|
10
|
+
export interface PluginProviderFacesPort {
|
|
11
|
+
/** A provider switch covers itself and its linked assistant faces. Used only by explicit OFF. */
|
|
12
|
+
affectedPluginIds?(input: {
|
|
13
|
+
pluginId: string;
|
|
14
|
+
}, options?: Record<string, never>): Promise<readonly string[]>;
|
|
15
|
+
linkedProvider(input: {
|
|
16
|
+
pluginId: string;
|
|
17
|
+
}, options?: Record<string, never>): Promise<string | undefined>;
|
|
18
|
+
/** Safe preflight refusal, formatted by the same owner as linked-switch errors. */
|
|
19
|
+
describeLinkedFace(input: {
|
|
20
|
+
pluginId: string;
|
|
21
|
+
providerPluginId: string;
|
|
22
|
+
}, options?: Record<string, never>): {
|
|
23
|
+
code: string;
|
|
24
|
+
message: string;
|
|
25
|
+
providerPluginId: string;
|
|
26
|
+
};
|
|
27
|
+
describeLinkedError(input: {
|
|
28
|
+
error: unknown;
|
|
29
|
+
}, options?: Record<string, never>): {
|
|
30
|
+
code: string;
|
|
31
|
+
message: string;
|
|
32
|
+
providerPluginId: string;
|
|
33
|
+
} | undefined;
|
|
34
|
+
/** A "Soon" Agent Plugin is locked off by the host's soon-lock: the refusal to show before
|
|
35
|
+
* any confirmation, or undefined when it may be switched on. */
|
|
36
|
+
describeNotReady?(input: {
|
|
37
|
+
pluginId: string;
|
|
38
|
+
}, options?: Record<string, never>): Promise<{
|
|
39
|
+
code: string;
|
|
40
|
+
message: string;
|
|
41
|
+
} | undefined>;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=service-ports.d.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { AgentToolDefinition } from '@jini-ai/core';
|
|
2
|
+
import type { PluginHostCopy } from "./plugin-host-copy.js";
|
|
3
|
+
/** Static contract consumed by the model and the domain registration contract suite. */
|
|
4
|
+
export declare function createPluginSourceAgentToolCatalog({ copy }: {
|
|
5
|
+
copy: PluginHostCopy;
|
|
6
|
+
}, _optional?: {}): AgentToolDefinition[];
|
|
7
|
+
//# sourceMappingURL=source-tool-catalog.d.ts.map
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
const MUTATES_DURABLE_STATE = "mutates-durable-state";
|
|
2
|
+
const ENABLE_PLUGIN_PERMISSION = "admin.plugins.enable";
|
|
3
|
+
const WORKFLOW = ' Site-local workflow: plugin_source_create (scaffold) or plugin_source_open (latest installed working copy) → list/read/write/edit draft files → plugin_source_seal → plugins_set_enabled (family site-runtime). Drafts never run. Site plugins support content filters, declarative content types and fields. Use sdk.routes.add with capability http.route.register and contributes.routes (e.g. GET /items); routes mount at /api/p/<plugin-id><path> and declare public/member/admin access. Use sdk.tools.add with tools.register and contributes.tools; assistant ids are p_<plugin-id with hyphens replaced by underscores>__<name>. Use sdk.widgets.add with render.contribute and contributes.widgets for public SSR partials. Every registration must match its manifest declaration. Tier-3 runs with full server access; sandboxing is deferred by owner decision.';
|
|
4
|
+
const id = { type: 'string', pattern: '^[a-z0-9-]+$', minLength: 1, maxLength: 50, description: 'Site plugin id; not an Agent Plugin id.' };
|
|
5
|
+
const file = { type: 'string', minLength: 1, description: 'Path relative to this plugin draft, e.g. server/index.mjs. Absolute paths, .. and links are refused.' };
|
|
6
|
+
const text = { type: 'string' };
|
|
7
|
+
function schema({ properties, required }, _optional = {}) {
|
|
8
|
+
return { type: 'object', additionalProperties: false, properties: { id, ...properties }, required: ['id', ...required] };
|
|
9
|
+
}
|
|
10
|
+
/** Static contract consumed by the model and the domain registration contract suite. */
|
|
11
|
+
export function createPluginSourceAgentToolCatalog({ copy }, _optional = {}) {
|
|
12
|
+
return [
|
|
13
|
+
{ name: 'plugin_source_create', description: 'Creates a minimal valid site-local tier-3 draft with a manifest, server entry and README. Existing drafts are retained; existing installs are opened without overwrite.' + WORKFLOW,
|
|
14
|
+
sideEffects: MUTATES_DURABLE_STATE, authorization: { permission: ENABLE_PLUGIN_PERMISSION }, inputSchema: schema({ properties: { name: text, description: text }, required: ['name', 'description'] }) },
|
|
15
|
+
{ name: 'plugin_source_open', description: 'Creates a working draft from this site plugin’s latest installed version. Reopening retains all unsealed edits.' + WORKFLOW,
|
|
16
|
+
sideEffects: MUTATES_DURABLE_STATE, authorization: { permission: ENABLE_PLUGIN_PERMISSION }, inputSchema: schema({ properties: {}, required: [] }) },
|
|
17
|
+
{ name: 'plugin_source_list', description: 'Lists paths and byte sizes in an opened plugin draft. Use before guessing filenames.' + WORKFLOW,
|
|
18
|
+
sideEffects: 'none', authorization: { permission: 'admin.plugins.read' }, inputSchema: schema({ properties: {}, required: [] }) },
|
|
19
|
+
{ name: 'plugin_source_read', description: 'Reads one draft file as text, up to 1 MiB. Read first before an exact edit.' + WORKFLOW,
|
|
20
|
+
sideEffects: 'none', authorization: { permission: 'admin.plugins.read' }, inputSchema: schema({ properties: { path: file }, required: ['path'] }) },
|
|
21
|
+
{ name: 'plugin_source_write', description: 'Creates or overwrites one draft file as text (1 MiB per file; 8 MiB / 512 entries per draft). Use edit for a small change. Live installed bytes remain immutable.' + WORKFLOW,
|
|
22
|
+
sideEffects: MUTATES_DURABLE_STATE, authorization: { permission: ENABLE_PLUGIN_PERMISSION }, inputSchema: schema({ properties: { path: file, content: text }, required: ['path', 'content'] }) },
|
|
23
|
+
{ name: 'plugin_source_edit', description: 'Replaces one exact occurrence of oldString with newString. Refuses zero or multiple matches without writing; use more context or replaceAll:true. Replacement text is literal.' + WORKFLOW,
|
|
24
|
+
sideEffects: MUTATES_DURABLE_STATE, authorization: { permission: ENABLE_PLUGIN_PERMISSION }, inputSchema: schema({ properties: { path: file, oldString: { type: 'string', minLength: 1 }, newString: text, replaceAll: { type: 'boolean' } }, required: ['path', 'oldString', 'newString'] }) },
|
|
25
|
+
{ name: 'plugin_source_delete', description: 'Permanently deletes one draft file after confirmation. Does not remove installed versions; plugins_uninstall owns that. A changed file refuses the approved deletion.' + WORKFLOW,
|
|
26
|
+
sideEffects: 'deletes-durable-state', authorization: { permission: ENABLE_PLUGIN_PERMISSION }, inputSchema: schema({ properties: { path: file }, required: ['path'] }) },
|
|
27
|
+
{ name: 'plugin_source_seal', description: `Validates the draft manifest, computes integrity for every package file, uses a higher manifest version or bumps the latest patch on updates, and installs through the existing installer. Keeps active versions plus the newest three for rollback after a successful reload and reloads enabled code through the controlled loader; initially disabled plugins stay OFF. Validation errors explain what to fix. Check installed/reloaded/reloadError. Runs directly on desktop/dev; hosted installs require ${copy.localInstallEnv}=1.` + WORKFLOW,
|
|
28
|
+
sideEffects: MUTATES_DURABLE_STATE, authorization: { permission: ENABLE_PLUGIN_PERMISSION }, inputSchema: schema({ properties: {}, required: [] }) },
|
|
29
|
+
{ name: 'plugin_source_rollback', description: 'Reinstalls the previous package’s bytes as a new patch version through the same seal/installer/reload path. Preserves active versions, the newest three releases and your unsealed draft. Fails plainly when no previous version exists. If reload quarantined the plugin, enable it after rollback.' + WORKFLOW,
|
|
30
|
+
sideEffects: MUTATES_DURABLE_STATE, authorization: { permission: ENABLE_PLUGIN_PERMISSION }, inputSchema: schema({ properties: {}, required: [] }) },
|
|
31
|
+
];
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=source-tool-catalog.js.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { HumanConfirmSpec } from "@jini-ai/core/contracts/site/human-confirm";
|
|
2
|
+
import type { PluginUninstallPreview } from "../host/uninstall.js";
|
|
3
|
+
/**
|
|
4
|
+
* @file The dialog `plugins_uninstall` raises before it removes anything.
|
|
5
|
+
*
|
|
6
|
+
* Same held-open exchange as `enable-confirmation-ui.ts` (this domain's own sibling) and
|
|
7
|
+
* `agent-plugins/uninstall-confirmation-ui.ts` (the OTHER plugin family's identical dialog): the
|
|
8
|
+
* model's one call parks, and only the browser POST to `mcp-ui-tool-calls-route.ts` can resolve it
|
|
9
|
+
* (ADR-055 Decision 2; the host's `human-confirm.ts` has the full chain). So `plugins_uninstall`
|
|
10
|
+
* must also be on `assistant/mcp-ui-tool-calls.ts`'s `MCP_UI_REDEEMABLE_TOOL_IDS`, or every
|
|
11
|
+
* Confirm/Cancel click 403s.
|
|
12
|
+
*
|
|
13
|
+
* This file is deliberately its own module rather than a shared one with `agent-plugins/
|
|
14
|
+
* uninstall-confirmation-ui.ts`: the two plugin families' wording, warnings, and preview shapes
|
|
15
|
+
* genuinely differ (a site plugin's artifact is shared across every workspace this instance serves;
|
|
16
|
+
* an Agent Plugin's is per-workspace), and a shared builder would either blur that difference or grow
|
|
17
|
+
* a family-switch branch neither side asked for.
|
|
18
|
+
*/
|
|
19
|
+
/** The tool id the dialog asks the Host to call back. Single source of truth for both halves. */
|
|
20
|
+
export declare const PLUGINS_UNINSTALL_TOOL_ID = "plugins_uninstall";
|
|
21
|
+
/**
|
|
22
|
+
* Describes the uninstall-confirmation dialog for the shared approval transport.
|
|
23
|
+
*
|
|
24
|
+
* @param spec.preview - What would be removed. The plugin is NAMED, because "uninstall this plugin?"
|
|
25
|
+
* without saying which one is not consent.
|
|
26
|
+
* @complexity O(n) in the rendered field lengths.
|
|
27
|
+
*/
|
|
28
|
+
export declare function describeUninstallApproval({ preview }: {
|
|
29
|
+
preview: PluginUninstallPreview;
|
|
30
|
+
}, _optional?: {}): HumanConfirmSpec;
|
|
31
|
+
//# sourceMappingURL=uninstall-confirmation-ui.d.ts.map
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file The dialog `plugins_uninstall` raises before it removes anything.
|
|
3
|
+
*
|
|
4
|
+
* Same held-open exchange as `enable-confirmation-ui.ts` (this domain's own sibling) and
|
|
5
|
+
* `agent-plugins/uninstall-confirmation-ui.ts` (the OTHER plugin family's identical dialog): the
|
|
6
|
+
* model's one call parks, and only the browser POST to `mcp-ui-tool-calls-route.ts` can resolve it
|
|
7
|
+
* (ADR-055 Decision 2; the host's `human-confirm.ts` has the full chain). So `plugins_uninstall`
|
|
8
|
+
* must also be on `assistant/mcp-ui-tool-calls.ts`'s `MCP_UI_REDEEMABLE_TOOL_IDS`, or every
|
|
9
|
+
* Confirm/Cancel click 403s.
|
|
10
|
+
*
|
|
11
|
+
* This file is deliberately its own module rather than a shared one with `agent-plugins/
|
|
12
|
+
* uninstall-confirmation-ui.ts`: the two plugin families' wording, warnings, and preview shapes
|
|
13
|
+
* genuinely differ (a site plugin's artifact is shared across every workspace this instance serves;
|
|
14
|
+
* an Agent Plugin's is per-workspace), and a shared builder would either blur that difference or grow
|
|
15
|
+
* a family-switch branch neither side asked for.
|
|
16
|
+
*/
|
|
17
|
+
/** The tool id the dialog asks the Host to call back. Single source of truth for both halves. */
|
|
18
|
+
export const PLUGINS_UNINSTALL_TOOL_ID = "plugins_uninstall";
|
|
19
|
+
/**
|
|
20
|
+
* Describes the uninstall-confirmation dialog for the shared approval transport.
|
|
21
|
+
*
|
|
22
|
+
* @param spec.preview - What would be removed. The plugin is NAMED, because "uninstall this plugin?"
|
|
23
|
+
* without saying which one is not consent.
|
|
24
|
+
* @complexity O(n) in the rendered field lengths.
|
|
25
|
+
*/
|
|
26
|
+
export function describeUninstallApproval({ preview }, _optional = {}) {
|
|
27
|
+
return {
|
|
28
|
+
toolId: PLUGINS_UNINSTALL_TOOL_ID, errorCode: "PLUGINS",
|
|
29
|
+
title: `Move ${preview.name} to trash?`,
|
|
30
|
+
description: `This moves the site plugin "${preview.pluginId}" (version ${preview.version}) to the Trash for 60 days.`,
|
|
31
|
+
details: [{ label: "Plugin", value: preview.pluginId }, { label: "Version", value: preview.version }],
|
|
32
|
+
warning: "This removes it for all workspaces on this site. You can restore it from Admin → Trash for 60 days; " +
|
|
33
|
+
"only a human can delete it permanently.", danger: true, confirmLabel: "Move to trash",
|
|
34
|
+
// A tool action resolves the parked call at once, rather than stranding it until the deadline.
|
|
35
|
+
cancelLabel: "Cancel",
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=uninstall-confirmation-ui.js.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { renderPluginWidgetFragments, type PluginContributionRegistry } from '../host/contributions.js';
|
|
2
|
+
import type { PluginActivationRepoPort } from '@jini-ai/core/contracts/site/plugins-host';
|
|
3
|
+
export declare function renderPluginWidgetPartials(required: {
|
|
4
|
+
html: string;
|
|
5
|
+
workspaceId: string;
|
|
6
|
+
contributions: PluginContributionRegistry;
|
|
7
|
+
activationRepo: Pick<PluginActivationRepoPort, 'getActivation'>;
|
|
8
|
+
render: {
|
|
9
|
+
readNames(required: {
|
|
10
|
+
html: string;
|
|
11
|
+
}): readonly string[];
|
|
12
|
+
validateHtml: Parameters<typeof renderPluginWidgetFragments>[0]['validateHtml'];
|
|
13
|
+
expand(required: {
|
|
14
|
+
html: string;
|
|
15
|
+
partials: Readonly<Record<string, string>>;
|
|
16
|
+
slots: Record<string, {
|
|
17
|
+
source: string;
|
|
18
|
+
}>;
|
|
19
|
+
}): string;
|
|
20
|
+
};
|
|
21
|
+
}, _optional?: Record<string, never>): Promise<string>;
|
|
22
|
+
//# sourceMappingURL=widget-partials.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { renderPluginWidgetFragments } from '../host/contributions.js';
|
|
2
|
+
export async function renderPluginWidgetPartials(required, _optional = {}) {
|
|
3
|
+
const names = required.render.readNames({ html: required.html });
|
|
4
|
+
if (!names.length)
|
|
5
|
+
return required.html;
|
|
6
|
+
const partials = await renderPluginWidgetFragments({ registry: required.contributions, names, workspaceId: required.workspaceId,
|
|
7
|
+
isEnabled: async ({ pluginId }) => (await required.activationRepo.getActivation({ workspaceId: required.workspaceId, pluginId }))?.enabled === true,
|
|
8
|
+
validateHtml: required.render.validateHtml,
|
|
9
|
+
});
|
|
10
|
+
const slots = Object.fromEntries(Object.keys(partials).map(name => [name, { source: `${name}.html` }]));
|
|
11
|
+
return required.render.expand({ html: required.html, partials, slots });
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=widget-partials.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { DataModuleDecl } from "@jini-ai/core/contracts/site/db-data-modules";
|
|
2
|
+
/**
|
|
3
|
+
* The publisher is the HOST's first-party id, not the engine's: it is persisted in `_plugin_identity`
|
|
4
|
+
* and compared strictly on every boot (`checkNamespaceAdoption`), so a site that already minted the
|
|
5
|
+
* `lipay` row under its host's id must keep declaring that id. Changing it is a data migration.
|
|
6
|
+
*/
|
|
7
|
+
export declare function createLipayManifest(required: {
|
|
8
|
+
publisher: string;
|
|
9
|
+
}, _optional?: Record<string, never>): DataModuleDecl;
|
|
10
|
+
//# sourceMappingURL=manifest.d.ts.map
|