@jini-ai/agent-plugins 0.6.22 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (220) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/README.md +13 -0
  3. package/calendly/exports/booking-calendar.css +7 -0
  4. package/calendly/exports/booking-calendar.html +5 -0
  5. package/calendly/mcp.json +10 -0
  6. package/calendly/plugin.json +47 -0
  7. package/calendly/skills/calendly/SKILL.md +27 -0
  8. package/charts-echarts/plugin.json +2 -2
  9. package/charts-recharts/plugin.json +2 -2
  10. package/cloudflare/lib/cms-forms.mjs +57 -0
  11. package/cloudflare/lib/forms.mjs +78 -18
  12. package/cloudflare/lib/target.mjs +17 -4
  13. package/cloudflare/plugin.json +2 -2
  14. package/cloudflare/skills/cloudflare/SKILL.md +4 -4
  15. package/cloudflare/skills/cloudflare/references/workers.md +4 -4
  16. package/cloudflare/worker/forms-receiver.mjs +81 -41
  17. package/cloudflare/worker/portable-validation.mjs +220 -0
  18. package/commerce/plugin.json +17 -0
  19. package/commerce/skills/commerce/SKILL.md +23 -0
  20. package/composio/mcp.json +1 -1
  21. package/composio/plugin.json +2 -2
  22. package/composio/skills/composio/SKILL.md +4 -4
  23. package/core/commerce-server.d.ts +2 -0
  24. package/core/commerce-server.mjs +2 -0
  25. package/dist/admin-surfaces/connections/connections.d.ts +35 -0
  26. package/dist/admin-surfaces/connections/connections.js +135 -0
  27. package/dist/admin-surfaces/connections/index.d.ts +3 -0
  28. package/dist/admin-surfaces/connections/index.js +2 -0
  29. package/dist/admin-surfaces/connections/ports.d.ts +110 -0
  30. package/dist/admin-surfaces/connections/ports.js +2 -0
  31. package/dist/admin-surfaces/index.d.ts +2 -0
  32. package/dist/admin-surfaces/index.js +1 -0
  33. package/dist/admin-surfaces/plugin-state-persistence.d.ts +27 -0
  34. package/dist/admin-surfaces/plugin-state-persistence.js +2 -0
  35. package/dist/admin-surfaces/plugin-state.d.ts +51 -0
  36. package/dist/admin-surfaces/plugin-state.js +106 -0
  37. package/dist/connect/access-token-tool.d.ts +240 -0
  38. package/dist/connect/access-token-tool.js +213 -0
  39. package/dist/connect/apply-connect-defaults.d.ts +91 -0
  40. package/dist/connect/apply-connect-defaults.js +113 -0
  41. package/dist/connect/apply-tool-renames.d.ts +72 -0
  42. package/dist/connect/apply-tool-renames.js +105 -0
  43. package/dist/connect/connect-card-ui.d.ts +143 -0
  44. package/dist/connect/connect-card-ui.js +106 -0
  45. package/dist/connect/connect-destination.d.ts +35 -0
  46. package/dist/connect/connect-destination.js +45 -0
  47. package/dist/connect/connect-sign-in-wait.d.ts +31 -0
  48. package/dist/connect/connect-sign-in-wait.js +21 -0
  49. package/dist/connect/connect-tool.d.ts +314 -0
  50. package/dist/connect/connect-tool.js +431 -0
  51. package/dist/connect/connection-status.d.ts +33 -0
  52. package/dist/connect/connection-status.js +63 -0
  53. package/dist/connect/credential-cards.d.ts +15 -0
  54. package/dist/connect/credential-cards.js +49 -0
  55. package/dist/connect/credential-save-tool.d.ts +45 -0
  56. package/dist/connect/credential-save-tool.js +156 -0
  57. package/dist/connect/enable-access.d.ts +67 -0
  58. package/dist/connect/enable-access.js +74 -0
  59. package/dist/connect/executable/approval.d.ts +58 -0
  60. package/dist/connect/executable/approval.js +40 -0
  61. package/dist/connect/executable/host-capabilities.d.ts +76 -0
  62. package/dist/connect/executable/host-capabilities.js +100 -0
  63. package/dist/connect/executable/index.d.ts +10 -0
  64. package/dist/connect/executable/index.js +9 -0
  65. package/dist/connect/executable/ports.d.ts +189 -0
  66. package/dist/connect/executable/ports.js +2 -0
  67. package/dist/connect/executable/register.d.ts +21 -0
  68. package/dist/connect/executable/register.js +125 -0
  69. package/dist/connect/federate-mcp.d.ts +190 -0
  70. package/dist/connect/federate-mcp.js +440 -0
  71. package/dist/connect/grant-signed-in-defaults.d.ts +96 -0
  72. package/dist/connect/grant-signed-in-defaults.js +100 -0
  73. package/dist/connect/import-access-token.d.ts +114 -0
  74. package/dist/connect/import-access-token.js +103 -0
  75. package/dist/connect/index.d.ts +19 -0
  76. package/dist/connect/index.js +19 -0
  77. package/dist/connect/plugin-credential-card.d.ts +46 -0
  78. package/dist/connect/plugin-credential-card.js +63 -0
  79. package/dist/connect/plugin-host/index.d.ts +203 -0
  80. package/dist/connect/plugin-host/index.js +153 -0
  81. package/dist/connect/ports.d.ts +74 -0
  82. package/dist/connect/ports.js +2 -0
  83. package/dist/connect/switch-on-saved-token.d.ts +48 -0
  84. package/dist/connect/switch-on-saved-token.js +20 -0
  85. package/dist/connect/token-sign-in.d.ts +51 -0
  86. package/dist/connect/token-sign-in.js +43 -0
  87. package/dist/core/identity-namespace.d.ts +39 -0
  88. package/dist/core/identity-namespace.js +61 -3
  89. package/dist/folder-zip-node.js +3 -1
  90. package/dist/lifecycle/automatic-use.d.ts +12 -7
  91. package/dist/lifecycle/automatic-use.js +37 -28
  92. package/dist/lifecycle/capability-projection.js +5 -1
  93. package/dist/lifecycle/contribution-loader.d.ts +2 -7
  94. package/dist/lifecycle/contribution-types.d.ts +8 -0
  95. package/dist/lifecycle/contribution-types.js +2 -0
  96. package/dist/lifecycle/credential-card-metadata.d.ts +23 -0
  97. package/dist/lifecycle/credential-card-metadata.js +184 -0
  98. package/dist/lifecycle/exports.d.ts +11 -0
  99. package/dist/lifecycle/exports.js +64 -3
  100. package/dist/lifecycle/host-tools/identity.d.ts +38 -0
  101. package/dist/lifecycle/host-tools/identity.js +58 -0
  102. package/dist/lifecycle/host-tools/index.d.ts +20 -0
  103. package/dist/lifecycle/host-tools/index.js +20 -0
  104. package/dist/lifecycle/host-tools/memory-tools.d.ts +22 -0
  105. package/dist/lifecycle/host-tools/memory-tools.js +63 -0
  106. package/dist/lifecycle/host-tools/ports.d.ts +121 -0
  107. package/dist/lifecycle/host-tools/ports.js +2 -0
  108. package/dist/lifecycle/host-tools/provider-status-tool.d.ts +88 -0
  109. package/dist/lifecycle/host-tools/provider-status-tool.js +45 -0
  110. package/dist/lifecycle/host-tools/search-tool.d.ts +74 -0
  111. package/dist/lifecycle/host-tools/search-tool.js +282 -0
  112. package/dist/lifecycle/host-tools/skill-tool.d.ts +219 -0
  113. package/dist/lifecycle/host-tools/skill-tool.js +482 -0
  114. package/dist/lifecycle/host-tools/write-note-tool.d.ts +22 -0
  115. package/dist/lifecycle/host-tools/write-note-tool.js +47 -0
  116. package/dist/lifecycle/index.d.ts +2 -1
  117. package/dist/lifecycle/install.js +2 -1
  118. package/dist/lifecycle/installed-package-index.js +5 -8
  119. package/dist/lifecycle/mail/adapter-descriptors.d.ts +78 -0
  120. package/dist/lifecycle/mail/adapter-descriptors.js +155 -0
  121. package/dist/lifecycle/mail/catalog.d.ts +116 -0
  122. package/dist/lifecycle/mail/catalog.js +72 -0
  123. package/dist/lifecycle/mail/configuration.d.ts +25 -0
  124. package/dist/lifecycle/mail/configuration.js +62 -0
  125. package/dist/lifecycle/mail/contribution.d.ts +89 -0
  126. package/dist/lifecycle/mail/contribution.js +115 -0
  127. package/dist/lifecycle/mail/host-mailer.d.ts +24 -0
  128. package/dist/lifecycle/mail/host-mailer.js +10 -0
  129. package/dist/lifecycle/mail/index.d.ts +16 -0
  130. package/dist/lifecycle/mail/index.js +16 -0
  131. package/dist/lifecycle/mail/selection.d.ts +40 -0
  132. package/dist/lifecycle/mail/selection.js +86 -0
  133. package/dist/lifecycle/manifest.d.ts +7 -2
  134. package/dist/lifecycle/manifest.js +32 -9
  135. package/dist/lifecycle/metadata.d.ts +31 -0
  136. package/dist/lifecycle/metadata.js +80 -0
  137. package/dist/lifecycle/persistent-state.js +2 -1
  138. package/dist/lifecycle/ports.d.ts +2 -0
  139. package/dist/lifecycle/resolve-agent-plugin-refs.d.ts +2 -1
  140. package/dist/lifecycle/resolve-agent-plugin-refs.js +14 -8
  141. package/dist/lifecycle/search-projection.d.ts +3 -4
  142. package/dist/lifecycle/search-projection.js +5 -7
  143. package/dist/lifecycle/search.js +3 -2
  144. package/fly/plugin.json +5 -5
  145. package/fly/skills/fly/SKILL.md +1 -1
  146. package/formspree/plugin.json +7 -0
  147. package/formspree/skills/formspree/SKILL.md +11 -0
  148. package/github/plugin.json +2 -2
  149. package/github/skills/github/SKILL.md +28 -28
  150. package/github/skills/github/references/actions.md +8 -8
  151. package/github/skills/github/references/auth-and-tokens.md +7 -7
  152. package/github/skills/github/references/repo-files.md +5 -5
  153. package/github/skills/github/references/site-backup.md +16 -16
  154. package/github/skills/github/references/source-control.md +17 -17
  155. package/github-pages/plugin.json +2 -2
  156. package/github-pages/skills/github-pages/SKILL.md +3 -3
  157. package/google-forms/plugin.json +7 -0
  158. package/google-forms/skills/google-forms/SKILL.md +15 -0
  159. package/google-login/plugin.json +3 -3
  160. package/google-login/skills/google-login/SKILL.md +17 -60
  161. package/google-workspace/plugin.json +6 -6
  162. package/google-workspace/skills/google-workspace/references/connection.md +1 -1
  163. package/google-workspace/skills/google-workspace/references/form-delivery.md +4 -4
  164. package/google-workspace/tovu-admin-surfaces.json +5 -5
  165. package/higgsfield-media/plugin.json +5 -5
  166. package/higgsfield-media/skills/higgsfield-media/SKILL.md +31 -33
  167. package/higgsfield-media/skills/higgsfield-media/references/failure-modes.md +7 -7
  168. package/higgsfield-media/skills/higgsfield-media/references/models-and-plan-gates.md +3 -3
  169. package/jev/plugin.json +2 -2
  170. package/langfuse/plugin.json +2 -2
  171. package/meilisearch/plugin.json +2 -2
  172. package/meilisearch/skills/meilisearch/SKILL.md +1 -1
  173. package/netlify/plugin.json +2 -2
  174. package/netlify/skills/netlify/SKILL.md +3 -3
  175. package/opentelemetry/plugin.json +2 -2
  176. package/opentelemetry/skills/opentelemetry/SKILL.md +7 -7
  177. package/package.json +92 -14
  178. package/posthog/plugin.json +2 -2
  179. package/posthog/skills/posthog/SKILL.md +7 -7
  180. package/railway/plugin.json +3 -3
  181. package/railway/skills/railway/SKILL.md +10 -11
  182. package/render/plugin.json +3 -3
  183. package/render/skills/render/SKILL.md +7 -8
  184. package/resend/NOTES.md +2 -2
  185. package/resend/mcp.json +1 -1
  186. package/resend/plugin.json +5 -5
  187. package/resend/skills/resend/SKILL.md +13 -13
  188. package/s3-compatible/plugin.json +2 -2
  189. package/s3-compatible/skills/s3-compatible/SKILL.md +4 -4
  190. package/sentry/plugin.json +2 -2
  191. package/sentry/skills/sentry/SKILL.md +7 -7
  192. package/shopify/plugin.json +2 -2
  193. package/site-compliance/plugin.json +2 -2
  194. package/site-compliance/skills/site-compliance/SKILL.md +3 -3
  195. package/site-compliance/skills/site-compliance/references/gdpr-eu-uk.md +1 -1
  196. package/site-import/plugin.json +2 -2
  197. package/slide-design/plugin.json +2 -2
  198. package/software-engineering/LICENSE +201 -0
  199. package/software-engineering/NOTICE +9 -0
  200. package/software-engineering/README.md +89 -0
  201. package/software-engineering/plugin.json +24 -0
  202. package/software-engineering/skills/software-engineering/SKILL.md +33 -0
  203. package/software-engineering/skills/software-engineering/references/debugging.md +54 -0
  204. package/software-engineering/skills/software-engineering/references/implementation.md +27 -0
  205. package/software-engineering/skills/software-engineering/references/planning.md +27 -0
  206. package/software-engineering/skills/software-engineering/references/prototyping.md +14 -0
  207. package/software-engineering/skills/software-engineering/references/security.md +47 -0
  208. package/software-engineering/skills/software-engineering/references/verification.md +53 -0
  209. package/stripe/plugin.json +2 -2
  210. package/supabase/mcp.json +4 -4
  211. package/supabase/plugin.json +3 -3
  212. package/supabase/skills/supabase/SKILL.md +8 -8
  213. package/supabase/skills/supabase/references/failure-modes.md +5 -5
  214. package/ui-ux-design/plugin.json +2 -2
  215. package/vercel/plugin.json +2 -2
  216. package/vercel/skills/vercel/SKILL.md +3 -3
  217. package/wordpress/plugin.json +2 -2
  218. package/wordpress/skills/wordpress/SKILL.md +3 -3
  219. package/wordpress/skills/wordpress/references/free-site-redirect.md +2 -2
  220. package/wordpress/skills/wordpress/references/subdomain.md +5 -5
@@ -0,0 +1,115 @@
1
+ /**
2
+ * @file Loads the mail adapters Agent Plugins contribute — the generic seam that lets a plugin (a
3
+ * bundled mail plugin, for instance) add a hosted mail provider without core naming one. Read by
4
+ * `server/runtime/boot/resolve-mailer.ts`.
5
+ *
6
+ * A plugin opts in by shipping {@link MAIL_ADAPTERS_FILENAME} at its root: a data-only list of
7
+ * `{ id, label, module, credentialLabel }`. `module` is a plain-JS `.mjs` file inside the plugin
8
+ * whose default export is a `MailAdapterModule` (`platform/mail/adapter-module.ts`);
9
+ * `credentialLabel` is the exact `custom_credential_sets` label its key is saved under.
10
+ *
11
+ * schemaVersion 2 (email provider contract v1, 2026-10-21) adds `credentialKeys` and `feedback`, and
12
+ * its module is a provider module (`id`, `capabilities`, optional `feedback` parser and domain
13
+ * methods) whose `module.id` must equal the descriptor's `id`. `credentialLabel` stays optional
14
+ * there; absent, it is {@link defaultCredentialLabel}. v1 keeps its create-only module format; both
15
+ * versions use the keyed registry's provider ID grammar. 2026-10-22: v2
16
+ * may also carry `setup` (field labels/types/defaults/help links, `./mail-provider-setup.ts`).
17
+ * {@link contributeMailProviders} offers every loaded adapter to Jini's keyed mail-provider registry
18
+ * so its refusals (bad id, duplicate, capability claims without code) surface with the loader's.
19
+ *
20
+ * A v2 entry may also declare `credentialCard` (2026-10-22): the copy for the plugin's own key card
21
+ * (`custom-credentials/plugin-credential-card.ts`). It is data only, never required: an invalid card
22
+ * is dropped with a note in `refusals` and the adapter still loads.
23
+ *
24
+ * TRUST RULE (fail closed), the shared gate in `./trusted-plugin-files.ts`: a module runs in this
25
+ * process, so it loads only when the plugin is ACTIVE by the fail-closed reader, its installed digest
26
+ * is the one `bundled-digests.json` records (only plugins the host shipped), and the module path stays
27
+ * inside the plugin root and ends in `.mjs`. A bad plugin drops only its
28
+ * own adapters and a bad module only itself; every drop is reported in `refusals`, never thrown.
29
+ */
30
+ import { contributeProviders } from "../provider-contribution.js";
31
+ import { defineExecutablePluginContribution } from "../contribution-loader.js";
32
+ import { asMailAdapterModule, parseMailAdaptersFile } from "./adapter-descriptors.js";
33
+ /** @agent-note The host supplies its filename, setup validator, guarded ABI, and trusted source loader. */
34
+ export function createMailContributions(requiredHost, _optional = {}) {
35
+ const adapterContribution = defineExecutablePluginContribution({
36
+ filename: requiredHost.filename, contribution: "mail adapters",
37
+ parse: ({ raw }) => parseMailAdaptersFile({ raw, parseSetup: requiredHost.parseSetup }, { defaultCredentialLabel: requiredHost.defaultCredentialLabel }), modulePath: ({ descriptor }) => descriptor.module,
38
+ validate: ({ exported }) => asMailAdapterModule({ exported }),
39
+ refusal: ({ plugin, descriptor, reason }) => `mail adapter '${descriptor.id}' from '${plugin.pluginId}' was not loaded: ${reason}`,
40
+ });
41
+ /**
42
+ * Builds this workspace's mail-adapter registry from its installed Agent Plugins. Read fresh on each
43
+ * call; Node caches each module import per file URL, and installed digest directories never change.
44
+ *
45
+ * @throws Nothing for a plugin-level fault; only a filesystem fault listing the package directory itself.
46
+ * @param required - Contribution loader from this boot's lifecycle; no site-dependent module default.
47
+ * @complexity O(p) installed plugins, one small read plus one import per declared adapter.
48
+ */
49
+ async function loadMailAdapterRegistry(ctx, required) {
50
+ const load = await required.loadContributions({ ...ctx, definition: adapterContribution }, { orderByPluginId: true });
51
+ return { list: () => load.items, refusals: [...load.refusals, ...cardNotes(load.items)] };
52
+ }
53
+ /**
54
+ * A registry read straight from a plugin's SOURCE directory, with no install, activation or digest
55
+ * gate. For tests only, where the directory is this product's own `content/agent-plugins/<id>/`.
56
+ *
57
+ * @complexity O(a) adapters, one import each.
58
+ */
59
+ async function loadMailAdapterRegistryFromSource(plugin, _optional = {}) {
60
+ const load = await requiredHost.loadFromSource({ plugin, definition: adapterContribution });
61
+ return { list: () => load.items, refusals: [...load.refusals, ...cardNotes(load.items)] };
62
+ }
63
+ /** One note per loaded adapter whose declared key card was ignored. @complexity O(a). */
64
+ function cardNotes(items) {
65
+ return items.flatMap(({ descriptor, pluginId }) => descriptor.credentialCardRefusal ? [`mail adapter '${descriptor.id}' from '${pluginId}' key card was ignored: ${descriptor.credentialCardRefusal}`] : []);
66
+ }
67
+ /** Why a v2 module disagrees with its descriptor, or undefined. @complexity O(1). */
68
+ function v2Mismatch(adapter) {
69
+ const declared = adapter.module;
70
+ if (declared.id !== adapter.descriptor.id)
71
+ return `its module id '${String(declared.id)}' does not match the descriptor id '${adapter.descriptor.id}'`;
72
+ if (adapter.descriptor.feedback !== (declared.feedback !== undefined))
73
+ return "its descriptor feedback flag does not match the module's feedback parser";
74
+ return undefined;
75
+ }
76
+ /**
77
+ * The Jini provider for one loaded adapter. The module keeps the plugin's positional mailer ABI, so
78
+ * `create` adapts it; a v1 module (create only) is a hosted provider without feedback or domains.
79
+ * @complexity O(1).
80
+ */
81
+ function providerFor(adapter) {
82
+ const { descriptor, module } = adapter;
83
+ const declared = descriptor.schemaVersion === 2 ? module : {};
84
+ return {
85
+ ...declared,
86
+ id: descriptor.id,
87
+ label: descriptor.label,
88
+ credentialKeys: descriptor.credentialKeys ?? ["token", "baseUrl"],
89
+ capabilities: declared.capabilities ?? { hosted: true, feedback: false, domainVerification: false },
90
+ // Plugins receive the host's guarded HTTP client through their positional ABI.
91
+ create: (context) => requiredHost.abi.fromPositionalMailer({ mailer: module.create({ ...context, kit: { ...context.kit, httpClient: requiredHost.abi.toPluginHttpClient({ httpClient: context.kit.httpClient }) } }) }),
92
+ };
93
+ }
94
+ /**
95
+ * Offers every loaded plugin adapter to the mail-provider registry. A v2 module whose id or
96
+ * feedback claim disagrees with its descriptor is refused before the registry sees it.
97
+ * @returns Accepted provider ids and every refusal (loader's, ours, then the registry's); never throws.
98
+ * @complexity O(a) adapters.
99
+ */
100
+ function contributeMailProviders(required, _optional = {}) {
101
+ const items = [];
102
+ const refusals = [...required.adapters.refusals];
103
+ for (const adapter of required.adapters.list()) {
104
+ const mismatch = adapter.descriptor.schemaVersion === 2 ? v2Mismatch(adapter) : undefined;
105
+ if (mismatch) {
106
+ refusals.push(`mail adapter '${adapter.descriptor.id}' from '${adapter.pluginId}' was not loaded: ${mismatch}`);
107
+ continue;
108
+ }
109
+ items.push({ contract: "mail", pluginId: adapter.pluginId, definition: { id: adapter.descriptor.id, provider: providerFor(adapter), label: adapter.descriptor.label } });
110
+ }
111
+ return contributeProviders({ registry: required.registry, loaded: { items, refusals } });
112
+ }
113
+ return { loadMailAdapterRegistry, loadMailAdapterRegistryFromSource, contributeMailProviders };
114
+ }
115
+ //# sourceMappingURL=contribution.js.map
@@ -0,0 +1,24 @@
1
+ import { type MailSelectionInput, type MailSelectionPorts } from "./selection.js";
2
+ /** Bind selection to the same live mailer instance that the host policy and operations use.
3
+ * @agent-note The host supplies its resolved mailer and operations; this glue performs no I/O at boot.
4
+ * @complexity O(1) construction, preserving the resolved instance's cache and readiness owner.
5
+ */
6
+ export declare function createHostMailer<Resolved extends {
7
+ ready: Promise<unknown>;
8
+ invalidate(): void;
9
+ }, Operations, Input extends MailSelectionInput, Written extends {
10
+ enabled: boolean;
11
+ }>(required: {
12
+ resolved: Resolved;
13
+ operations: Operations;
14
+ selection: Omit<MailSelectionPorts<Input, Written>, "mailerReady" | "invalidate">;
15
+ }, _optional?: Record<string, never>): Resolved & {
16
+ operations: Operations;
17
+ setAgentPluginEnabled: (input: Input, _optional?: object) => Promise<Written>;
18
+ selectProvider: ({ id, principalId, expectedRevisionSeq }: {
19
+ id: string;
20
+ principalId: string;
21
+ expectedRevisionSeq?: number;
22
+ }) => Promise<void>;
23
+ };
24
+ //# sourceMappingURL=host-mailer.d.ts.map
@@ -0,0 +1,10 @@
1
+ import { createMailSelection } from "./selection.js";
2
+ /** Bind selection to the same live mailer instance that the host policy and operations use.
3
+ * @agent-note The host supplies its resolved mailer and operations; this glue performs no I/O at boot.
4
+ * @complexity O(1) construction, preserving the resolved instance's cache and readiness owner.
5
+ */
6
+ export function createHostMailer(required, _optional = {}) {
7
+ const selection = createMailSelection({ ...required.selection, mailerReady: required.resolved.ready, invalidate: required.resolved.invalidate });
8
+ return { ...required.resolved, ...selection, operations: required.operations };
9
+ }
10
+ //# sourceMappingURL=host-mailer.js.map
@@ -0,0 +1,16 @@
1
+ /**
2
+ * @file Public surface of `@jini-ai/agent-plugins/lifecycle/mail`: Agent Plugin mail adapters (the
3
+ * adapter file parser and loader, the provider catalog, the configuration record, the host mailer and
4
+ * provider selection). Its runtime effects are supplied by the host. Not re-exported from `./lifecycle`, so
5
+ * a host that sends no mail never loads it.
6
+ *
7
+ * The entry exists before its contents so the export resolves; each piece arrives with the batch
8
+ * that moves it.
9
+ */
10
+ export { asMailAdapterModule, defaultMailCredentialLabel, parseMailAdaptersFile, type MailAdapterDescriptor, type MailAdaptersParseResult, type MailCredentialCard, } from "./adapter-descriptors.js";
11
+ export * from "./contribution.js";
12
+ export * from "./catalog.js";
13
+ export * from "./configuration.js";
14
+ export * from "./selection.js";
15
+ export * from "./host-mailer.js";
16
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,16 @@
1
+ /**
2
+ * @file Public surface of `@jini-ai/agent-plugins/lifecycle/mail`: Agent Plugin mail adapters (the
3
+ * adapter file parser and loader, the provider catalog, the configuration record, the host mailer and
4
+ * provider selection). Its runtime effects are supplied by the host. Not re-exported from `./lifecycle`, so
5
+ * a host that sends no mail never loads it.
6
+ *
7
+ * The entry exists before its contents so the export resolves; each piece arrives with the batch
8
+ * that moves it.
9
+ */
10
+ export { asMailAdapterModule, defaultMailCredentialLabel, parseMailAdaptersFile, } from "./adapter-descriptors.js";
11
+ export * from "./contribution.js";
12
+ export * from "./catalog.js";
13
+ export * from "./configuration.js";
14
+ export * from "./selection.js";
15
+ export * from "./host-mailer.js";
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,40 @@
1
+ import type { MailProviderSetting } from "@jini-ai/core/contracts/mail";
2
+ import type { MailProviderCatalog } from "./catalog.js";
3
+ export interface MailSelectionInput {
4
+ pluginId: string;
5
+ enabled: boolean;
6
+ actor: string;
7
+ }
8
+ /** @agent-note The host owns settings authorization, revision errors and plugin activation. */
9
+ export interface MailSelectionPorts<Input extends MailSelectionInput, Written extends {
10
+ enabled: boolean;
11
+ }> {
12
+ ready(): Promise<void>;
13
+ mailerReady: Promise<unknown>;
14
+ invalidate(): void;
15
+ loadCatalog(): Promise<MailProviderCatalog>;
16
+ readSelection(): Promise<{
17
+ setting: MailProviderSetting;
18
+ revisionSeq: number;
19
+ }>;
20
+ writeSelection(required: {
21
+ principalId: string;
22
+ value: MailProviderSetting;
23
+ expectedRevisionSeq?: number | undefined;
24
+ }): Promise<unknown>;
25
+ installedProviderIds(input: Input): Promise<readonly string[]>;
26
+ toggle(input: Input): Promise<Written>;
27
+ isRevisionConflict(error: unknown): boolean;
28
+ }
29
+ /** Keep ownership snapshots across failed cleanup, with bounded revision retries. @complexity O(1) setup. */
30
+ export declare function createMailSelection<Input extends MailSelectionInput, Written extends {
31
+ enabled: boolean;
32
+ }>(required: MailSelectionPorts<Input, Written>, _optional?: Record<string, never>): {
33
+ setAgentPluginEnabled: (input: Input, _optional?: object) => Promise<Written>;
34
+ selectProvider: ({ id, principalId, expectedRevisionSeq }: {
35
+ id: string;
36
+ principalId: string;
37
+ expectedRevisionSeq?: number;
38
+ }) => Promise<void>;
39
+ };
40
+ //# sourceMappingURL=selection.d.ts.map
@@ -0,0 +1,86 @@
1
+ /** Keep ownership snapshots across failed cleanup, with bounded revision retries. @complexity O(1) setup. */
2
+ export function createMailSelection(required, _optional = {}) {
3
+ /** Clear only this plugin's selected lanes through the settings owner; failures propagate.
4
+ * Re-read live ownership too: a conflict retry cannot clear a newly enabled plugin's same id.
5
+ * @complexity O(a + p) active adapters and provider ids, two lane checks and at most one settings write. */
6
+ const clearPluginSelectionSnapshot = async ({ providerIds, principalId, pluginId }) => {
7
+ await required.ready();
8
+ const catalog = await required.loadCatalog();
9
+ const owned = new Set([...providerIds].filter(id => {
10
+ const provider = catalog.registry.get({ id });
11
+ return !provider || provider.pluginId === pluginId;
12
+ }));
13
+ const { setting, revisionSeq } = await required.readSelection();
14
+ const value = {
15
+ transactional: owned.has(setting.transactional ?? "") ? null : setting.transactional,
16
+ bulk: owned.has(setting.bulk ?? "") ? null : setting.bulk,
17
+ };
18
+ if (value.transactional === setting.transactional && value.bulk === setting.bulk)
19
+ return;
20
+ // A provider chosen after this snapshot belongs to the newer writer, even in the other lane.
21
+ await required.writeSelection({ principalId, value, expectedRevisionSeq: revisionSeq });
22
+ };
23
+ /** Re-read after contention so a newer unrelated lane is never overwritten. Three guarded
24
+ * attempts bound work; failed ownership stays available to a subsequent disable retry.
25
+ * @complexity At most three catalog/snapshot/write attempts; O(a + p) ownership checks each. */
26
+ const clearPluginSelection = async (input) => {
27
+ for (let attempt = 0; attempt < 3; attempt++) {
28
+ try {
29
+ await clearPluginSelectionSnapshot(input);
30
+ return;
31
+ }
32
+ catch (error) {
33
+ if (!(required.isRevisionConflict(error)) || attempt === 2)
34
+ throw error;
35
+ }
36
+ }
37
+ };
38
+ // Only failed cleanup retains ownership: executable contributions disappear after OFF.
39
+ const pendingPluginSelections = new Map();
40
+ /** Retain active ownership across an interrupted cleanup; after a restart, read only the
41
+ * trusted inactive declaration when a selected provider no longer exists in the live catalog.
42
+ * @complexity O(a) active adapters plus the conditional installed-declaration lookup. */
43
+ const disabledProviderIds = async (input) => {
44
+ const catalog = await required.loadCatalog();
45
+ const providers = catalog.registry.list();
46
+ const pending = [...pendingPluginSelections.get(input.pluginId) ?? []].filter(id => {
47
+ const owner = catalog.registry.get({ id });
48
+ return !owner || owner.pluginId === input.pluginId;
49
+ });
50
+ const ids = new Set([...pending, ...providers.filter(provider => provider.pluginId === input.pluginId).map(provider => provider.id)]);
51
+ if (ids.size)
52
+ return ids;
53
+ await required.ready();
54
+ const { setting } = await required.readSelection();
55
+ const missing = Object.values(setting).some(id => id !== null && !catalog.registry.get({ id }));
56
+ return missing ? new Set((await required.installedProviderIds(input)).filter(id => !catalog.registry.get({ id }))) : ids;
57
+ };
58
+ /** Bind the plugin toggle to this site's mail settings, using plugin ownership rather than ids.
59
+ * @complexity O(a) loaded adapters; one lifecycle write and at most three guarded settings writes. */
60
+ const setPluginEnabled = async (input, _optional = {}) => {
61
+ // MOVE: Capture ownership while the plugin is active; disabling removes its executable adapters.
62
+ const providerIds = input.enabled ? new Set() : await disabledProviderIds(input);
63
+ const written = await required.toggle(input);
64
+ try {
65
+ if (!written.enabled && providerIds.size > 0) {
66
+ pendingPluginSelections.set(input.pluginId, providerIds);
67
+ await clearPluginSelection({ providerIds, principalId: input.actor, pluginId: input.pluginId });
68
+ }
69
+ pendingPluginSelections.delete(input.pluginId);
70
+ }
71
+ finally {
72
+ required.invalidate();
73
+ }
74
+ return written;
75
+ };
76
+ const selectProvider = async ({ id, principalId, expectedRevisionSeq }) => {
77
+ await required.ready();
78
+ // Finish the first-boot unconfigured write before persisting the owner's selection.
79
+ await required.mailerReady;
80
+ await required.writeSelection({ principalId, value: { transactional: id, bulk: id }, expectedRevisionSeq });
81
+ // Only after the write succeeded: a switch must reach the very next send and status read.
82
+ required.invalidate();
83
+ };
84
+ return { setAgentPluginEnabled: setPluginEnabled, selectProvider };
85
+ }
86
+ //# sourceMappingURL=selection.js.map
@@ -1,3 +1,7 @@
1
+ export { resolveAgentPluginIdentityNamespace, readAgentPluginPortableExtension, readAgentPluginCompatibilityWarnings, legacyAgentPluginMetadataWarning } from '../core/identity-namespace.js';
2
+ import { type AgentPluginMetadata } from './metadata.js';
3
+ export * from './metadata.js';
4
+ export * from './credential-card-metadata.js';
1
5
  export { isAgentPluginName } from '../core/plugin-name.js';
2
6
  import { type AgentPluginExportMetadata } from './exports.js';
3
7
  export * from './exports.js';
@@ -11,7 +15,7 @@ export type AgentPluginServerMetadataReader = (required: {
11
15
  readonly value: Readonly<Record<string, unknown>>;
12
16
  readonly server: Readonly<Record<string, unknown>>;
13
17
  }) => Readonly<Record<string, unknown>>;
14
- export interface AgentPluginManifest extends AgentPluginExportMetadata {
18
+ export interface AgentPluginManifest extends AgentPluginExportMetadata, AgentPluginMetadata {
15
19
  readonly name: string;
16
20
  readonly version?: (string) | undefined;
17
21
  readonly description?: (string) | undefined;
@@ -137,6 +141,7 @@ export interface AgentPluginMcpConfig {
137
141
  export type ParseAgentPluginMcpConfigResult = {
138
142
  readonly ok: true;
139
143
  readonly config: AgentPluginMcpConfig;
144
+ readonly warnings?: readonly string[];
140
145
  } | {
141
146
  readonly ok: false;
142
147
  readonly errors: readonly string[];
@@ -152,7 +157,7 @@ export type ParseAgentPluginMcpConfigResult = {
152
157
  */
153
158
  export declare function parseAgentPluginMcpConfig({ value, extensionNamespace }: {
154
159
  readonly value: unknown;
155
- readonly extensionNamespace: string;
160
+ readonly extensionNamespace?: string;
156
161
  }, optional?: {
157
162
  readonly pluginManifest?: unknown;
158
163
  readonly readServerMetadata?: AgentPluginServerMetadataReader | undefined;
@@ -35,9 +35,10 @@
35
35
  * credential-reference fields. Authorization discovery, user interaction, and credential storage
36
36
  * are client-managed." A plugin therefore cannot declare "this server needs OAuth" using any
37
37
  * spec-defined field — the host is the client the spec defers that decision to. This module accepts
38
- * the host-specific metadata in `plugin.json`'s `extensions.<host-namespace>.mcpServers[serverId]`, keeping
39
- * `mcp.json` transport entries closed per §7.2.1. Hosts may translate legacy auth and sign-in defaults in MCP
40
- * entries through readServerMetadata for existing packages, but those cannot supply operator read trust.
38
+ * portable metadata in `plugin.json`'s `extensions.jini.mcpServers[serverId]`, with an explicit
39
+ * namespace option for custom clients. Legacy auth and sign-in defaults in MCP entries remain
40
+ * readable automatically, but those cannot supply operator read trust. Custom clients can use
41
+ * readServerMetadata to translate their own fields before the same validators run.
41
42
  * `authMode: "oauth" | "none"` selects client auth; absent defaults to "none".
42
43
  * `defaultTools: { allow?, write?, read? }` names sign-in grants and reviewed read tools.
43
44
  * `write` requires `allow` and must be its subset; `read` must be a subset when `allow` is
@@ -55,7 +56,11 @@
55
56
  * caller that reads the file and hands the parsed value here.
56
57
  */
57
58
  import { isAgentPluginName, MAX_NAME_LENGTH } from '../core/plugin-name.js';
58
- import { resolveAgentPluginIdentityNamespace } from '../core/identity-namespace.js';
59
+ import { resolveAgentPluginIdentityNamespace, readCompatibleAgentPluginServerMetadata, hasLegacyAgentPluginServerMetadata, legacyAgentPluginMetadataWarning, readAgentPluginCompatibilityWarnings, isPortableAgentPluginNamespace } from '../core/identity-namespace.js';
60
+ export { resolveAgentPluginIdentityNamespace, readAgentPluginPortableExtension, readAgentPluginCompatibilityWarnings, legacyAgentPluginMetadataWarning } from '../core/identity-namespace.js';
61
+ import { readAgentPluginMetadata } from './metadata.js';
62
+ export * from './metadata.js';
63
+ export * from './credential-card-metadata.js';
59
64
  export { isAgentPluginName } from '../core/plugin-name.js';
60
65
  import { readAgentPluginCompatibilityMetadata } from "./compatibility-metadata.js";
61
66
  import { parseAgentPluginExports } from './exports.js';
@@ -200,7 +205,10 @@ export function parseAgentPluginManifest({ value }, optional = {}) {
200
205
  if (!exportsResult.ok)
201
206
  return { ok: false, errors: exportsResult.errors };
202
207
  warnings.push(...exportsResult.warnings);
208
+ const portable = readAgentPluginMetadata({ value }, optional);
209
+ warnings.push(...portable.warnings);
203
210
  const manifest = {
211
+ ...portable.metadata,
204
212
  ...compatibility,
205
213
  ...exportsResult.metadata,
206
214
  name: nameResult.name,
@@ -423,23 +431,38 @@ function readExtensionServers({ pluginManifest, extensionNamespace }) {
423
431
  * @complexity O(s) in the number of declared servers.
424
432
  */
425
433
  export function parseAgentPluginMcpConfig({ value, extensionNamespace }, optional = {}) {
426
- if (!extensionNamespace.trim())
434
+ if (extensionNamespace !== undefined && !extensionNamespace.trim())
427
435
  throw new Error("An extension namespace is required");
428
436
  if (!isJsonObject(value))
429
437
  return { ok: false, errors: ["mcp.json must be a JSON object"] };
430
438
  const errors = collectMcpConfigErrors({ raw: value }, { pluginManifest: optional.pluginManifest });
431
439
  if (errors.length > 0)
432
440
  return { ok: false, errors };
433
- const extensionServers = readExtensionServers({ pluginManifest: optional.pluginManifest, extensionNamespace });
434
- const entries = Object.entries(value.mcpServers);
441
+ return parseMcpServers({ raw: value, extensionNamespace }, optional);
442
+ }
443
+ /** Valid transports are independent siblings; a malformed declaration never hides their ids. */
444
+ function parseMcpServers({ raw, extensionNamespace }, optional) {
445
+ const namespace = resolveAgentPluginIdentityNamespace({ value: optional.pluginManifest }, extensionNamespace === undefined ? {} : { identityNamespace: extensionNamespace });
446
+ const extensionServers = readExtensionServers({ pluginManifest: optional.pluginManifest, extensionNamespace: namespace });
447
+ const entries = Object.entries(raw.mcpServers);
435
448
  const servers = Object.create(null);
449
+ const warnings = [...readAgentPluginCompatibilityWarnings({ value: optional.pluginManifest }, { identityNamespace: namespace })];
450
+ const portable = isPortableAgentPluginNamespace({ namespace: extensionNamespace });
451
+ const readServerMetadata = optional.readServerMetadata ?? (portable ? readCompatibleAgentPluginServerMetadata : undefined);
436
452
  for (const [serverId, rawServer] of entries) {
437
453
  const extension = Object.hasOwn(extensionServers, serverId) ? extensionServers[serverId] : undefined;
438
- const parsed = parseDeclaredServer({ serverId, rawServer, extension }, { readServerMetadata: optional.readServerMetadata });
454
+ collectLegacyServerWarning({ rawServer, extension, portable, warnings });
455
+ const parsed = parseDeclaredServer({ serverId, rawServer, extension }, { readServerMetadata });
439
456
  if (parsed)
440
457
  servers[serverId] = parsed;
441
458
  }
442
- return { ok: true, config: { serverIds: entries.map(([serverId]) => serverId), servers } };
459
+ return { ok: true, config: { serverIds: entries.map(([serverId]) => serverId), servers }, ...(warnings.length ? { warnings: [...new Set(warnings)] } : {}) };
460
+ }
461
+ function collectLegacyServerWarning({ rawServer, extension, portable, warnings }) {
462
+ if (!portable || !isJsonObject(rawServer))
463
+ return;
464
+ if (hasLegacyAgentPluginServerMetadata({ value: isJsonObject(extension) ? extension : {}, server: rawServer }))
465
+ warnings.push(legacyAgentPluginMetadataWarning);
443
466
  }
444
467
  /** Typed extension reader: unknown namespaces have no semantics until a host supplies a reader. */
445
468
  export function readAgentPluginExtension(required) {
@@ -0,0 +1,31 @@
1
+ export interface AgentPluginHostSignal {
2
+ readonly env: string;
3
+ readonly facts: {
4
+ readonly hosted?: boolean;
5
+ readonly nativeToolsRestricted?: boolean;
6
+ readonly trustProxyHops?: number;
7
+ };
8
+ readonly label?: string;
9
+ }
10
+ export interface AgentPluginMetadata {
11
+ readonly displayName?: string;
12
+ readonly summary?: string;
13
+ readonly vendorAliases?: readonly string[];
14
+ readonly toolKeywords?: Readonly<Record<string, string>>;
15
+ readonly hostSignals?: readonly AgentPluginHostSignal[];
16
+ readonly deploymentAdvice?: string;
17
+ readonly card?: Readonly<Record<string, string>>;
18
+ }
19
+ /** Presentation readers also run before full manifest loading, so name/schema are not required.
20
+ * Fields are normalized independently except host signals and their advice: invalid advice
21
+ * invalidates that complete security declaration, preserving the host's existing fallback.
22
+ * @returns Typed advisory fields and host-visible diagnostics. @complexity O(k + s) metadata keys/signals. */
23
+ export declare function readAgentPluginMetadata(required: {
24
+ readonly value: unknown;
25
+ }, optional?: {
26
+ readonly identityNamespace?: string;
27
+ }): {
28
+ readonly metadata: AgentPluginMetadata;
29
+ readonly warnings: readonly string[];
30
+ };
31
+ //# sourceMappingURL=metadata.d.ts.map
@@ -0,0 +1,80 @@
1
+ /** Portable advisory metadata. Invalid declarations warn and contribute nothing; parsing never
2
+ * executes a plugin or turns presentation copy into an authorization decision. */
3
+ import { readAgentPluginPortableExtension, readAgentPluginCompatibilityWarnings } from '../core/identity-namespace.js';
4
+ const object = (value) => typeof value === 'object' && value !== null && !Array.isArray(value);
5
+ const text = (value) => typeof value === 'string' && value.trim().length > 0 && value.length <= 2048 && !/[\x00-\x1f\x7f]/.test(value);
6
+ const texts = (value) => Array.isArray(value) && value.every(text);
7
+ const textMap = (value) => object(value) && Object.values(value).every(text);
8
+ /** Only declared boolean facts and a finite positive safe proxy-hop count can be host hints. */
9
+ function validFacts(value) {
10
+ return object(value) && Object.entries(value).every(([key, fact]) => {
11
+ if (key === 'hosted' || key === 'nativeToolsRestricted')
12
+ return typeof fact === 'boolean';
13
+ return key === 'trustProxyHops' && Number.isSafeInteger(fact) && fact > 0;
14
+ });
15
+ }
16
+ function validSignal(value) {
17
+ if (!object(value) || typeof value.env !== 'string' || !/^[A-Z_][A-Z0-9_]*$/.test(value.env))
18
+ return false;
19
+ return validFacts(value.facts) && (value.label === undefined || text(value.label));
20
+ }
21
+ /** Presentation readers also run before full manifest loading, so name/schema are not required.
22
+ * Fields are normalized independently except host signals and their advice: invalid advice
23
+ * invalidates that complete security declaration, preserving the host's existing fallback.
24
+ * @returns Typed advisory fields and host-visible diagnostics. @complexity O(k + s) metadata keys/signals. */
25
+ export function readAgentPluginMetadata(required, optional = {}) {
26
+ const extension = readAgentPluginPortableExtension(required, optional) ?? {};
27
+ const warnings = [...readAgentPluginCompatibilityWarnings(required, optional)];
28
+ const metadata = {};
29
+ for (const [key, check] of Object.entries({ vendorAliases: texts, card: textMap })) {
30
+ if (extension[key] === undefined)
31
+ continue;
32
+ if (check(extension[key]))
33
+ metadata[key] = extension[key];
34
+ else
35
+ warnings.push(`Invalid agent-plugin ${key} metadata was ignored.`);
36
+ }
37
+ Object.assign(metadata, presentationMetadata({ extension, warnings }), keywordMetadata({ extension, warnings }));
38
+ Object.assign(metadata, hostMetadata({ extension, warnings }));
39
+ return { metadata: metadata, warnings };
40
+ }
41
+ /** Cosmetic text retains the preexisting trim/cap behavior, including summary paragraphs. */
42
+ function presentationMetadata({ extension, warnings }) {
43
+ const metadata = {};
44
+ for (const [key, maxLength] of Object.entries({ displayName: 64, summary: 1200 })) {
45
+ const field = extension[key];
46
+ if (field === undefined)
47
+ continue;
48
+ if (typeof field === 'string' && field.trim())
49
+ metadata[key] = field.trim().slice(0, maxLength);
50
+ else
51
+ warnings.push(`Invalid agent-plugin ${key} metadata was ignored.`);
52
+ }
53
+ return metadata;
54
+ }
55
+ /** Keep valid keyword siblings from older partially malformed declarations. */
56
+ function keywordMetadata({ extension, warnings }) {
57
+ if (extension.toolKeywords === undefined)
58
+ return {};
59
+ if (!object(extension.toolKeywords)) {
60
+ warnings.push('Invalid agent-plugin toolKeywords metadata was ignored.');
61
+ return {};
62
+ }
63
+ const entries = Object.entries(extension.toolKeywords);
64
+ const valid = entries.filter((entry) => text(entry[1]));
65
+ if (valid.length !== entries.length)
66
+ warnings.push('Invalid agent-plugin toolKeywords entries were ignored.');
67
+ return valid.length ? { toolKeywords: Object.fromEntries(valid) } : {};
68
+ }
69
+ function hostMetadata({ extension, warnings }) {
70
+ if (extension.hostSignals === undefined)
71
+ return {};
72
+ const signals = extension.hostSignals;
73
+ const advice = extension.deploymentAdvice;
74
+ if (!Array.isArray(signals) || !signals.every(validSignal) || (advice !== undefined && !text(advice))) {
75
+ warnings.push('Invalid agent-plugin hostSignals declaration was ignored.');
76
+ return {};
77
+ }
78
+ return { hostSignals: signals, ...(advice === undefined ? {} : { deploymentAdvice: advice }) };
79
+ }
80
+ //# sourceMappingURL=metadata.js.map
@@ -1,3 +1,4 @@
1
+ import { resolveAgentPluginLifecycleNamespace } from '../core/identity-namespace.js';
1
2
  import { createPluginMemory, migratePluginLayout, assertPluginStatePath, withPluginStateLock } from '../../core/persistent-state.js';
2
3
  import path from 'node:path';
3
4
  import { withFileLock } from '@jini-ai/platform/fs/file-lock';
@@ -23,7 +24,7 @@ export function createPersistentStateModule(ports, _optional = {}) {
23
24
  assertOwnedPath: (required, optional = {}) => assertPluginStatePath({ ...effects, ...required }, optional),
24
25
  migrate: (required, optional = {}) => migratePluginLayout({ ...effects, ...required,
25
26
  parsePluginId: ({ value }) => {
26
- const parsed = parseAgentPluginManifest({ value }, { identityNamespace: ports.extensionNamespace });
27
+ const parsed = parseAgentPluginManifest({ value }, { identityNamespace: resolveAgentPluginLifecycleNamespace({ value, extensionNamespace: ports.extensionNamespace }) });
27
28
  if (!parsed.ok)
28
29
  throw new Error(parsed.errors.join('; '));
29
30
  return parsed.manifest.name;
@@ -70,9 +70,11 @@ export interface AgentPluginLifecyclePorts {
70
70
  localId: string;
71
71
  run: () => Promise<T>;
72
72
  }, optional?: Record<string, never>) => Promise<T>) | undefined;
73
+ /** Identity warnings include pluginId so the host can deduplicate repeated package indexes. */
73
74
  readonly onEvent?: ((required: {
74
75
  readonly event: string;
75
76
  readonly message: string;
77
+ readonly pluginId?: string;
76
78
  }) => void) | undefined;
77
79
  /** The host owns tool names and supports explicit skill/file pointers as well as default instructions. */
78
80
  readonly formatPluginToolPointer: (required: {
@@ -34,8 +34,9 @@ export declare function createResolveAgentPluginRefsModule(ports: AgentPluginLif
34
34
  resolveAgentPluginSelection: ({ pluginRefIds, workspaceLayout }: {
35
35
  pluginRefIds: readonly string[];
36
36
  workspaceLayout: Pick<AgentPluginWorkspaceLayout, "packages" | "root">;
37
- }, { deliveryMode, ...request }?: AgentPluginSkillRequest & {
37
+ }, { deliveryMode, allowInactiveGuidance, ...request }?: AgentPluginSkillRequest & {
38
38
  deliveryMode?: AgentPluginDeliveryMode;
39
+ allowInactiveGuidance?: boolean;
39
40
  }) => Promise<ResolveAgentPluginRefsResult>;
40
41
  listInstalledPlugins: (workspaceRoot: string) => Promise<readonly InstalledAgentPlugin[]>;
41
42
  isInstalledDigestPresent: (packagesDir: string, archiveDigest: string) => Promise<boolean>;
@@ -87,7 +87,8 @@ function buildModule(ports) {
87
87
  * (`resolveAgentPluginLayout().forWorkspace(workspaceId)`), never a shared/instance-level one —
88
88
  * see `layout.ts`'s own tenant-isolation header for why a workspace's installed packages must
89
89
  * never be resolved against another workspace's tree.
90
- * @param options - Delivery mode and optional declared skill/file selection; reads stay bounded to the skill folder.
90
+ * @param options - Delivery mode, declared skill/file selection, and explicit read-only off-plugin discovery.
91
+ * Reads stay bounded to the skill folder; off-plugin discovery grants no tool execution.
91
92
  * @returns `{ ok: true, promptPrefix }` once every ref resolves, or the FIRST `{ ok: false, reason }`
92
93
  * encountered — a run pinning two refs where the second is ambiguous still fails clearly, rather
93
94
  * than partially augmenting the prompt with only the first ref's content.
@@ -100,22 +101,25 @@ function buildModule(ports) {
100
101
  // ambiguity below, never create one.
101
102
  // See activation.ts for the shared activation rule. One small file read per pinned ref; the
102
103
  // fail-CLOSED `resolveAgentPluginActivation` (the same reader the per-call tool gate uses)
103
- // refuses on a corrupt/unreadable file instead of reading it as "nothing recorded" — injecting a
104
- // plugin's guidance SPENDS it exactly like a tool call, so this surface must refuse rather than
105
- // read a fault as consent.
106
- async function resolveAgentPluginSelection({ pluginRefIds, workspaceLayout }, { deliveryMode = resolveAgentPluginDeliveryMode(), ...request } = {}) {
104
+ // refuses on a corrupt/unreadable file instead of reading it as "nothing recorded". Run pinning
105
+ // still requires activation; explicit read-only discovery can inspect an off plugin's guidance
106
+ // without granting its tools. An unreadable activation record never becomes consent.
107
+ async function resolveAgentPluginSelection({ pluginRefIds, workspaceLayout }, { deliveryMode = resolveAgentPluginDeliveryMode(), allowInactiveGuidance = false, ...request } = {}) {
107
108
  if (pluginRefIds.length === 0)
108
109
  return { ok: true, promptPrefix: "" };
109
110
  const bundledDigests = await readBundledAgentPluginDigests(workspaceLayout.root);
110
111
  const sections = [];
111
112
  for (const pluginRefId of pluginRefIds) {
112
- const refusal = activationRefusal(pluginRefId, await resolveAgentPluginActivation(workspaceLayout.root, pluginRefId));
113
+ const activation = await resolveAgentPluginActivation(workspaceLayout.root, pluginRefId);
114
+ const inactiveRead = allowInactiveGuidance && activation.verdict === 'inactive';
115
+ const refusal = activationRefusal(pluginRefId, activation, { allowInactiveGuidance });
113
116
  if (refusal !== undefined)
114
117
  return { ok: false, reason: refusal };
115
118
  const resolved = await resolveOnePluginRef({ pluginRefId, packagesDir: workspaceLayout.root, deliveryMode, bundledDigests }, request);
116
119
  if (!resolved.ok)
117
120
  return resolved;
118
- sections.push(resolved.section);
121
+ const note = inactiveRead ? `Agent Plugin '${pluginRefId}' is installed, off. Read-only guidance follows; its tools are unavailable until enabled through the existing approval flow.\n\n` : '';
122
+ sections.push(note + resolved.section);
119
123
  }
120
124
  return { ok: true, promptPrefix: sections.join("\n\n") };
121
125
  }
@@ -125,9 +129,11 @@ function buildModule(ports) {
125
129
  // ARE here and the fix is to enable the plugin, not to install it. Telling them to install
126
130
  // something already present is the kind of wrong-but-plausible error message that costs an
127
131
  // afternoon.
128
- function activationRefusal(pluginRefId, verdict) {
132
+ function activationRefusal(pluginRefId, verdict, { allowInactiveGuidance = false } = {}) {
129
133
  if (verdict.verdict === "active")
130
134
  return undefined;
135
+ if (allowInactiveGuidance && verdict.verdict === 'inactive')
136
+ return undefined;
131
137
  if (verdict.verdict === "undetermined") {
132
138
  // Native activation-read diagnostics can name the host path; the model needs only the remedy.
133
139
  return (`Agent Plugin '${pluginRefId}' was not loaded: this workspace's activation record could not be read, so whether ` +