@jini-ai/agent-plugins 0.6.23 → 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 +47 -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,78 @@
1
+ import type { MailAdapterModule, MailProviderSetup } from "@jini-ai/core/contracts/mail";
2
+ /**
3
+ * Validates a v2 descriptor's declared setup against its credential keys.
4
+ * @agent-note Setup validation is supplied by the host runtime (e.g. `@jini-ai/platform/mail`'s
5
+ * `parseMailProviderSetupProperty`); this package keeps no copy. Without one, every schemaVersion 2
6
+ * descriptor is refused with "this host supplies no mail setup validator"; schemaVersion 1 needs none.
7
+ */
8
+ export type ParseMailSetup = (required: {
9
+ value: unknown;
10
+ at: string;
11
+ credentialKeys: readonly string[];
12
+ }) => {
13
+ setup?: MailProviderSetup;
14
+ } | string;
15
+ export interface MailAdapterDescriptor {
16
+ /** 1 or 2; v1 descriptors carry neither `credentialKeys` nor `feedback`. */
17
+ readonly schemaVersion?: 1 | 2;
18
+ readonly id: string;
19
+ readonly label: string;
20
+ /** Plugin-relative path of the `.mjs` module. */
21
+ readonly module: string;
22
+ /** Exact `custom_credential_sets.label` the provider's key is saved under. */
23
+ readonly credentialLabel: string;
24
+ /** v2: credential fields the provider reads (`token`, `baseUrl`, `username`). */
25
+ readonly credentialKeys?: readonly string[];
26
+ /** v2: whether the module ships a delivery-feedback parser. */
27
+ readonly feedback?: boolean;
28
+ /** v2, optional: declarative setup-form metadata (`@jini-ai/platform/mail`'s `parseMailProviderSetup`). */
29
+ readonly setup?: MailProviderSetup;
30
+ /** v2: the plugin's own key card copy; core fills in the saved label and category. */
31
+ readonly credentialCard?: MailCredentialCard;
32
+ /** Why a declared `credentialCard` was ignored; surfaced in the registry's `refusals`. */
33
+ readonly credentialCardRefusal?: string;
34
+ }
35
+ /** Plugin-declared key card copy (https URLs only; the base URL is where the saved key is used). */
36
+ export interface MailCredentialCard {
37
+ readonly title: string;
38
+ readonly intro?: string;
39
+ readonly helpUrl?: string;
40
+ readonly helpLabel?: string;
41
+ readonly keyHint?: string;
42
+ /** Display-only purpose copy, validated by the same parser as manifest credential cards. */
43
+ readonly usedFor?: readonly string[];
44
+ readonly baseUrl: string;
45
+ }
46
+ export type MailAdaptersParseResult = {
47
+ readonly ok: true;
48
+ readonly descriptors: readonly MailAdapterDescriptor[];
49
+ } | {
50
+ readonly ok: false;
51
+ readonly reason: string;
52
+ };
53
+ /** Validate the default export after the host's contained import. @complexity O(1). */
54
+ export declare function asMailAdapterModule<M extends object = MailAdapterModule>(required: {
55
+ readonly exported: unknown;
56
+ }, _optional?: Record<string, never>): M | string;
57
+ /**
58
+ * Parses a plugin's mail-adapters file. Pure. Unknown keys are ignored.
59
+ *
60
+ * @param required.parseSetup - The host's setup validator; absent, a v2 descriptor is refused.
61
+ * @param optional.defaultCredentialLabel - The label a v2 descriptor without one is saved under;
62
+ * host text. Absent, {@link defaultMailCredentialLabel}.
63
+ *
64
+ * @complexity O(a) in the declared adapter count.
65
+ */
66
+ export declare function parseMailAdaptersFile(required: {
67
+ readonly raw: string;
68
+ readonly parseSetup?: ParseMailSetup;
69
+ }, optional?: {
70
+ readonly defaultCredentialLabel?: (input: {
71
+ label: string;
72
+ }) => string;
73
+ }): MailAdaptersParseResult;
74
+ /** The neutral credential label a v2 descriptor without one uses when the host names none. */
75
+ export declare function defaultMailCredentialLabel({ label }: {
76
+ label: string;
77
+ }, _optional?: Record<string, never>): string;
78
+ //# sourceMappingURL=adapter-descriptors.d.ts.map
@@ -0,0 +1,155 @@
1
+ /**
2
+ * @file The pure half of the mail-adapters Agent Plugin contribution: descriptor types, the file
3
+ * parser (schemaVersion 1 and 2, optional `setup` and `credentialCard`) and the module rule. The host
4
+ * names the file, supplies its default credential label, and loads each contained `.mjs` module
5
+ * through its own lifecycle; nothing here reads the disk.
6
+ */
7
+ import path from "node:path";
8
+ import { PROVIDER_ID_PATTERN } from "@jini-ai/core/provider-registry";
9
+ import { parseCredentialCardUsedFor } from "../credential-card-metadata.js";
10
+ const MAX_LABEL_LENGTH = 100;
11
+ /** The refusal for a schemaVersion 2 descriptor parsed without a host setup validator. */
12
+ const NO_SETUP_VALIDATOR = "this host supplies no mail setup validator";
13
+ /** Validate the default export after the host's contained import. @complexity O(1). */
14
+ export function asMailAdapterModule(required, _optional = {}) {
15
+ const candidate = required.exported;
16
+ if (!isPlainObject(candidate) || typeof candidate.create !== "function")
17
+ return "its module has no create() function";
18
+ return candidate;
19
+ }
20
+ /**
21
+ * Parses a plugin's mail-adapters file. Pure. Unknown keys are ignored.
22
+ *
23
+ * @param required.parseSetup - The host's setup validator; absent, a v2 descriptor is refused.
24
+ * @param optional.defaultCredentialLabel - The label a v2 descriptor without one is saved under;
25
+ * host text. Absent, {@link defaultMailCredentialLabel}.
26
+ *
27
+ * @complexity O(a) in the declared adapter count.
28
+ */
29
+ export function parseMailAdaptersFile(required, optional = {}) {
30
+ let value;
31
+ try {
32
+ value = JSON.parse(required.raw);
33
+ }
34
+ catch {
35
+ return { ok: false, reason: "not valid JSON" };
36
+ }
37
+ if (!isPlainObject(value) || (value.schemaVersion !== 1 && value.schemaVersion !== 2))
38
+ return { ok: false, reason: "schemaVersion must be 1 or 2" };
39
+ if (!Array.isArray(value.adapters))
40
+ return { ok: false, reason: "adapters must be an array" };
41
+ return parseAdapterDescriptors({ parseSetup: required.parseSetup, adapters: value.adapters, version: value.schemaVersion, defaultLabel: optional.defaultCredentialLabel ?? defaultMailCredentialLabel });
42
+ }
43
+ function parseAdapterDescriptors({ adapters, version, defaultLabel, parseSetup }, _options = {}) {
44
+ const descriptors = [];
45
+ for (const [index, entry] of adapters.entries()) {
46
+ const result = version === 1 ? parseDescriptor(entry, `adapters[${index}]`) : parseDescriptorV2({ entry, at: `adapters[${index}]`, defaultLabel, parseSetup });
47
+ if (typeof result === "string")
48
+ return { ok: false, reason: result };
49
+ if (descriptors.some((seen) => seen.id === result.id))
50
+ return { ok: false, reason: `adapters[${index}].id '${result.id}' is declared twice` };
51
+ descriptors.push(result);
52
+ }
53
+ return { ok: true, descriptors };
54
+ }
55
+ /** One descriptor entry, or the reason it is invalid. @complexity O(1). */
56
+ function parseDescriptor(entry, at) {
57
+ if (!isPlainObject(entry))
58
+ return `${at} must be an object`;
59
+ const { id, label, module, credentialLabel } = entry;
60
+ // IDs pass unchanged into the keyed registry; accepting a different grammar loads unusable adapters.
61
+ if (typeof id !== "string" || !PROVIDER_ID_PATTERN.test(id))
62
+ return `${at}.id must match ${PROVIDER_ID_PATTERN.source}`;
63
+ if (!isLabel(label))
64
+ return `${at}.label must be a non-empty string`;
65
+ if (typeof module !== "string" || !module.endsWith(".mjs") || path.posix.isAbsolute(module))
66
+ return `${at}.module must be a relative path ending in .mjs`;
67
+ if (!isLabel(credentialLabel))
68
+ return `${at}.credentialLabel must be a non-empty string`;
69
+ return { id, label, module, credentialLabel };
70
+ }
71
+ /** The neutral credential label a v2 descriptor without one uses when the host names none. */
72
+ export function defaultMailCredentialLabel({ label }, _optional = {}) {
73
+ return `Mail — ${label} API`;
74
+ }
75
+ /** One v2 entry, or why it is invalid; a bad optional card only adds a note. @complexity O(k + f) credential keys and setup fields. */
76
+ function parseDescriptorV2({ entry, at, defaultLabel, parseSetup }, _options = {}) {
77
+ if (!isPlainObject(entry))
78
+ return `${at} must be an object`;
79
+ const { id, label, module, credentialLabel, credentialKeys, feedback, setup } = entry;
80
+ if (typeof id !== "string" || !PROVIDER_ID_PATTERN.test(id))
81
+ return `${at}.id must match ${PROVIDER_ID_PATTERN.source}`;
82
+ const base = parseDescriptor({ id: "v2", label, module, credentialLabel: credentialLabel ?? "v2" }, at);
83
+ if (typeof base === "string")
84
+ return base;
85
+ if (!isCredentialKeys(credentialKeys))
86
+ return `${at}.credentialKeys must be an array of field names`;
87
+ if (typeof feedback !== "boolean")
88
+ return `${at}.feedback must be true or false`;
89
+ const savedUnder = typeof credentialLabel === "string" ? base.credentialLabel : defaultLabel({ label: base.label });
90
+ const card = parseCredentialCardProperty({ value: entry.credentialCard, at: `${at}.credentialCard` });
91
+ return withSetup({ descriptor: { schemaVersion: 2, id, label: base.label, module: base.module, credentialLabel: savedUnder, credentialKeys, feedback, ...card }, setup, at, parseSetup });
92
+ }
93
+ /** Narrow credential keys before passing them to setup validation. @complexity O(k) keys. */
94
+ function isCredentialKeys(value) {
95
+ return Array.isArray(value) && value.every((key) => typeof key === "string" && key !== "");
96
+ }
97
+ /** Keep absent cards absent; validate declared cards through the live parser. @complexity O(1). */
98
+ function parseCredentialCardProperty({ value, at }, _options = {}) {
99
+ return value === undefined ? {} : parseCredentialCard(value, at);
100
+ }
101
+ const MAX_CARD_TEXT_LENGTH = 500;
102
+ const MAX_URL_LENGTH = 500;
103
+ /** A declared key card, or the note saying why it is ignored. Unknown keys are ignored. @complexity O(1). */
104
+ function parseCredentialCard(value, at) {
105
+ if (!isPlainObject(value))
106
+ return { credentialCardRefusal: `${at} must be an object` };
107
+ const card = {};
108
+ for (const [key, required, valid, rule] of [
109
+ ["title", true, isLabel, "a non-empty string"],
110
+ ["intro", false, isCardText, "a non-empty string"],
111
+ ["helpUrl", false, isHttpsUrl, "an https URL"],
112
+ ["helpLabel", false, isLabel, "a non-empty string"],
113
+ ["keyHint", false, isCardText, "a non-empty string"],
114
+ ["baseUrl", true, isHttpsUrl, "an https URL"],
115
+ ]) {
116
+ const field = value[key];
117
+ if (field === undefined && !required)
118
+ continue;
119
+ if (!valid(field))
120
+ return { credentialCardRefusal: `${at}.${key} must be ${rule}` };
121
+ card[key] = field;
122
+ }
123
+ try {
124
+ const usedFor = parseCredentialCardUsedFor({ value: value.usedFor });
125
+ if (usedFor !== undefined)
126
+ card.usedFor = usedFor;
127
+ }
128
+ catch {
129
+ // Bad optional copy must not disable a provider that can still send mail.
130
+ return { credentialCardRefusal: `${at}.usedFor must be an array of at most 8 non-empty strings (at most 120 characters each)` };
131
+ }
132
+ return { credentialCard: card };
133
+ }
134
+ function isCardText(value) {
135
+ return typeof value === "string" && value.trim() !== "" && value.length <= MAX_CARD_TEXT_LENGTH;
136
+ }
137
+ function isHttpsUrl(value) {
138
+ if (typeof value !== "string" || value.length > MAX_URL_LENGTH || !URL.canParse(value))
139
+ return false;
140
+ return new URL(value).protocol === "https:";
141
+ }
142
+ /** Parse optional setup without losing the card or its refusal note. @complexity O(f) setup fields. */
143
+ function withSetup({ descriptor, setup, at, parseSetup }, _options = {}) {
144
+ if (!parseSetup)
145
+ return NO_SETUP_VALIDATOR;
146
+ const declared = parseSetup({ value: setup, at, credentialKeys: descriptor.credentialKeys });
147
+ return typeof declared === "string" ? declared : { ...descriptor, ...declared };
148
+ }
149
+ function isLabel(value) {
150
+ return typeof value === "string" && value.trim() !== "" && value.length <= MAX_LABEL_LENGTH;
151
+ }
152
+ function isPlainObject(value) {
153
+ return typeof value === "object" && value !== null && !Array.isArray(value);
154
+ }
155
+ //# sourceMappingURL=adapter-descriptors.js.map
@@ -0,0 +1,116 @@
1
+ import type { MailAdapterCredential, MailProviderModule, MailProviderRegistry, MailProviderSetup } from "@jini-ai/core/contracts/mail";
2
+ import type { PluginCredentialCard } from "@jini-ai/core/contracts/credentials";
3
+ import type { MailAdapterRegistry } from "./contribution.js";
4
+ export interface MailCatalogDeps {
5
+ loadMailAdapters: () => Promise<MailAdapterRegistry>;
6
+ createSmtpTransport: (config: {
7
+ host: string;
8
+ port: number;
9
+ secure: boolean;
10
+ auth: {
11
+ user: string;
12
+ pass: string;
13
+ };
14
+ }) => {
15
+ sendMail(mail: SmtpPayload): Promise<{
16
+ messageId: string;
17
+ }>;
18
+ };
19
+ log?: ((line: string) => void) | undefined;
20
+ resolvePluginAccountToken?: ((required: {
21
+ pluginId: string;
22
+ serverId: string;
23
+ }) => Promise<string | null>) | undefined;
24
+ }
25
+ interface SmtpPayload {
26
+ from: {
27
+ name?: string;
28
+ address: string;
29
+ };
30
+ to: {
31
+ name?: string;
32
+ address: string;
33
+ };
34
+ replyTo?: {
35
+ name?: string;
36
+ address: string;
37
+ };
38
+ subject: string;
39
+ html?: string;
40
+ text?: string;
41
+ headers?: Readonly<Record<string, string>>;
42
+ attachments?: {
43
+ filename: string;
44
+ content: string;
45
+ encoding: "base64";
46
+ contentType: string;
47
+ }[];
48
+ }
49
+ type Clock = {
50
+ nowMs(): number;
51
+ };
52
+ export interface MailProviderCatalog {
53
+ readonly registry: MailProviderRegistry;
54
+ /** Plugin provider ids in registry order (plugin id, then declaration order). */
55
+ readonly pluginIds: readonly string[];
56
+ /** Saved-credential label per provider; undefined for a provider that needs none (console, or a
57
+ * plugin declaring no credential keys) and for an id that is not registered. */
58
+ credentialLabelFor(required: {
59
+ id: string;
60
+ }): string | undefined;
61
+ /** Plugin adapters/providers that were not loaded, and why (log-safe). */
62
+ readonly refusals: readonly string[];
63
+ /** The provider's declarative setup form; no fields for one that needs no saved key. */
64
+ setupFor(required: {
65
+ id: string;
66
+ }): MailProviderSetup;
67
+ }
68
+ /** @agent-note The host supplies mail engine effects and exact product text; no platform runtime is imported. */
69
+ export declare function createMailCatalog(requiredHost: {
70
+ mailEngine: {
71
+ createRegistry: (required: Record<string, never>, optional: {
72
+ builtins: readonly MailProviderModule[];
73
+ }) => MailProviderRegistry;
74
+ builtins: {
75
+ console: (required: {
76
+ clock: Clock;
77
+ }, optional?: {
78
+ log?: (line: string) => void;
79
+ }) => MailProviderModule;
80
+ smtp: (required: {
81
+ clock: Clock;
82
+ createTransport: (config: Parameters<MailCatalogDeps["createSmtpTransport"]>[0]) => {
83
+ sendMail(required: {
84
+ mail: SmtpPayload;
85
+ }): Promise<{
86
+ messageId: string;
87
+ }>;
88
+ };
89
+ }) => MailProviderModule;
90
+ };
91
+ };
92
+ mailHostText: {
93
+ smtpCredentialLabel: string;
94
+ smtpSetup: MailProviderSetup;
95
+ credentialCategory: PluginCredentialCard["category"];
96
+ };
97
+ defaultSetup: (required: {
98
+ credentialKeys: readonly string[];
99
+ }) => MailProviderSetup;
100
+ contributeMailProviders: (required: {
101
+ registry: MailProviderRegistry;
102
+ adapters: MailAdapterRegistry;
103
+ }) => {
104
+ accepted: readonly string[];
105
+ refusals: readonly string[];
106
+ };
107
+ }, _optional?: Record<string, never>): {
108
+ loadMailProviderCatalog: (deps: MailCatalogDeps, _optional?: Record<string, never>) => Promise<MailProviderCatalog>;
109
+ loadMailCredentialCards: (required: Pick<MailCatalogDeps, "loadMailAdapters">, _optional?: Record<string, never>) => Promise<readonly PluginCredentialCard[]>;
110
+ resolveMailDomainReadCredential: (required: {
111
+ deps: MailCatalogDeps;
112
+ id: string;
113
+ }, _options?: Record<string, never>) => Promise<MailAdapterCredential | null>;
114
+ };
115
+ export {};
116
+ //# sourceMappingURL=catalog.d.ts.map
@@ -0,0 +1,72 @@
1
+ /** @agent-note The host supplies mail engine effects and exact product text; no platform runtime is imported. */
2
+ export function createMailCatalog(requiredHost, _optional = {}) {
3
+ function builtins(deps) {
4
+ const clock = { nowMs: () => Date.now() };
5
+ const createTransport = deps.createSmtpTransport;
6
+ // The host's transport takes the payload positionally; Jini's SMTP adapter calls it with `{mail}`.
7
+ const smtp = requiredHost.mailEngine.builtins.smtp({ clock, createTransport: (config) => {
8
+ const transport = createTransport(config);
9
+ return { sendMail: ({ mail }) => transport.sendMail(mail) };
10
+ } });
11
+ return [smtp, requiredHost.mailEngine.builtins.console({ clock }, deps.log ? { log: deps.log } : {})];
12
+ }
13
+ /** Plugin registry, or an empty one plus the reason it could not be read. */
14
+ async function loadAdapters(deps) {
15
+ try {
16
+ return await deps.loadMailAdapters();
17
+ }
18
+ catch (err) {
19
+ return { list: () => [], refusals: [`the plugin mail adapters could not be listed (${err instanceof Error ? err.message : String(err)})`] };
20
+ }
21
+ }
22
+ /**
23
+ * Builds the catalog fresh (plugins can be installed after boot). Never throws for a plugin fault.
24
+ * @complexity O(a) plugin adapters.
25
+ */
26
+ async function loadMailProviderCatalog(deps, _optional = {}) {
27
+ const registry = requiredHost.mailEngine.createRegistry({}, { builtins: builtins(deps) });
28
+ const adapters = await loadAdapters(deps);
29
+ const { accepted, refusals } = requiredHost.contributeMailProviders({ registry, adapters });
30
+ const labels = new Map([["smtp", requiredHost.mailHostText.smtpCredentialLabel]]);
31
+ const setups = new Map([["smtp", requiredHost.mailHostText.smtpSetup]]);
32
+ for (const adapter of adapters.list()) {
33
+ // Only providers that read a credential get a label; label presence is "needs a saved key".
34
+ const keys = adapter.descriptor.credentialKeys ?? ["token"];
35
+ if (!accepted.includes(adapter.descriptor.id) || keys.length === 0)
36
+ continue;
37
+ labels.set(adapter.descriptor.id, adapter.descriptor.credentialLabel);
38
+ setups.set(adapter.descriptor.id, adapter.descriptor.setup ?? requiredHost.defaultSetup({ credentialKeys: keys }));
39
+ }
40
+ return { registry, pluginIds: accepted, refusals, credentialLabelFor: ({ id }) => labels.get(id), setupFor: ({ id }) => setups.get(id) ?? { fields: [] } };
41
+ }
42
+ /**
43
+ * The key cards mail plugins declare (`credentialCard` in their descriptor), each filed under the
44
+ * adapter's own credential label and the mail category, so `credential_save` `{kind:"plugin-provider"}`
45
+ * saves the key exactly where the adapter reads it. Never throws: an unreadable list has no cards.
46
+ * @complexity O(a) plugin adapters.
47
+ */
48
+ async function loadMailCredentialCards(required, _optional = {}) {
49
+ return (await loadAdapters(required)).list().flatMap(({ descriptor, pluginId }) => descriptor.credentialCard
50
+ ? [{ pluginId, providerId: descriptor.id, label: descriptor.credentialLabel, category: requiredHost.mailHostText.credentialCategory, ...descriptor.credentialCard }]
51
+ : []);
52
+ }
53
+ /** Resolve a trusted plugin's domain-read key without changing its sending credential.
54
+ * @complexity O(a) loaded adapters, one account lookup and at most one decrypt. */
55
+ async function resolveMailDomainReadCredential(required, _options = {}) {
56
+ const { deps, id } = required;
57
+ const owner = (await loadMailProviderCatalog(deps)).registry.get({ id })?.pluginId;
58
+ if (!owner)
59
+ return null;
60
+ const adapter = (await loadAdapters(deps)).list().find(item => item.descriptor.id === id && item.pluginId === owner);
61
+ const connection = adapter?.module.domainReadConnection;
62
+ if (!adapter || !connection || !deps.resolvePluginAccountToken)
63
+ return null;
64
+ // The account key goes only to the plugin-declared API, never a sending key's custom base URL.
65
+ if (new URL(connection.baseUrl).protocol !== "https:")
66
+ return null;
67
+ const token = await deps.resolvePluginAccountToken({ pluginId: adapter.pluginId, serverId: connection.serverId });
68
+ return token ? { token, baseUrl: connection.baseUrl } : null;
69
+ }
70
+ return { loadMailProviderCatalog, loadMailCredentialCards, resolveMailDomainReadCredential };
71
+ }
72
+ //# sourceMappingURL=catalog.js.map
@@ -0,0 +1,25 @@
1
+ import type { MailProviderSetting, MailProviderConfigurationReport } from "@jini-ai/core/contracts/mail";
2
+ import type { MailProviderCatalog } from "./catalog.js";
3
+ /** Metadata only: no credential values cross this configuration projection. */
4
+ export interface MailCredentialRow {
5
+ id: string;
6
+ label: string;
7
+ username?: string | null;
8
+ updatedAt: string;
9
+ }
10
+ /** @agent-note Refusal copy is host product wording, supplied without defaults. */
11
+ export declare function createMailConfiguration(requiredHost: {
12
+ mailHostText: {
13
+ localOnly: string;
14
+ missingCredential: (required: {
15
+ label: string | undefined;
16
+ }) => string;
17
+ };
18
+ }, _optional?: Record<string, never>): {
19
+ describeMailProviders: (required: {
20
+ catalog: MailProviderCatalog;
21
+ records: readonly MailCredentialRow[];
22
+ setting: MailProviderSetting;
23
+ }, _optional?: Record<string, never>) => MailProviderConfigurationReport;
24
+ };
25
+ //# sourceMappingURL=configuration.d.ts.map
@@ -0,0 +1,62 @@
1
+ /** @agent-note Refusal copy is host product wording, supplied without defaults. */
2
+ export function createMailConfiguration(requiredHost, _optional = {}) {
3
+ /**
4
+ * @file The safe provider configuration DTO the admin Email page, `mail_list_providers` and
5
+ * `system_get_mail_status` share (email phase 2, 2026-10-22). Pure over already-read facts: the
6
+ * catalog, the workspace's credential rows (metadata only — nothing here decrypts or returns a
7
+ * secret, and the saved username is reduced to presence) and the `core.mail.provider` setting.
8
+ *
9
+ * "Saved" is a presence check, cheap enough for every status read. Activation (`checkProvider`)
10
+ * still decrypts the key before it lets a provider send, so a saved-but-unreadable key is caught there.
11
+ */
12
+ /** Lanes `id` currently sends for. @complexity O(1). */
13
+ function lanesFor({ setting, id }, _options = {}) {
14
+ return ["transactional", "bulk"].filter((lane) => setting[lane] === id);
15
+ }
16
+ /** A saved row counts once it holds every field the provider reads beyond the always-stored token/origin. */
17
+ function rowComplete(provider, record) {
18
+ return !provider.credentialKeys.includes("username") || Boolean(record.username);
19
+ }
20
+ /** Credential presence, never its value. @complexity O(c) rows. */
21
+ function credentialFacts(required, _options = {}) {
22
+ const { label, provider } = required;
23
+ if (label === undefined)
24
+ return { required: false, saved: false };
25
+ const record = required.records.find((row) => row.label === label);
26
+ if (!record)
27
+ return { required: true, saved: false, label };
28
+ return { required: true, saved: rowComplete(provider, record), label, credentialId: record.id, updatedAt: record.updatedAt };
29
+ }
30
+ /** Why `mail_set_provider` would refuse it, judged by presence; undefined = selectable. */
31
+ function refusalFor(provider, credential) {
32
+ if (!provider.capabilities.hosted)
33
+ return requiredHost.mailHostText.localOnly;
34
+ if (credential.required && !credential.saved)
35
+ return requiredHost.mailHostText.missingCredential({ label: credential.label });
36
+ return undefined;
37
+ }
38
+ function describeOne(required, _options = {}) {
39
+ const { catalog, entry, setting } = required;
40
+ const { provider } = entry;
41
+ const credential = credentialFacts({ label: catalog.credentialLabelFor({ id: entry.id }), provider, records: required.records });
42
+ const refusal = refusalFor(provider, credential);
43
+ const { feedback, domainVerification, rateLimit } = provider.capabilities;
44
+ return {
45
+ id: entry.id, label: provider.label, origin: entry.origin, hosted: provider.capabilities.hosted, lanes: lanesFor({ setting: setting, id: entry.id }),
46
+ ...(entry.pluginId ? { pluginId: entry.pluginId } : {}),
47
+ capabilities: { feedback, domainVerification, ...(rateLimit ? { rateLimit: { perSecond: rateLimit.perSecond, burst: rateLimit.burst } } : {}) },
48
+ credential, selectable: refusal === undefined, ...(refusal ? { refusal } : {}), setup: catalog.setupFor({ id: entry.id }),
49
+ };
50
+ }
51
+ /**
52
+ * Every installed provider's safe configuration, in registry order.
53
+ * @complexity O(p * c) providers by credential rows, both small.
54
+ */
55
+ function describeMailProviders(required, _optional = {}) {
56
+ const { catalog, records, setting } = required;
57
+ const providers = catalog.registry.list().map((entry) => describeOne({ catalog, entry, records, setting }));
58
+ return { setting: { transactional: setting.transactional, bulk: setting.bulk }, providers, refusals: catalog.refusals };
59
+ }
60
+ return { describeMailProviders };
61
+ }
62
+ //# sourceMappingURL=configuration.js.map
@@ -0,0 +1,89 @@
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 type { MailProviderRegistry, MailAdapterCredential, PositionalMailer, PluginMailHttpClient, MailerPort } from "@jini-ai/core/contracts/mail";
31
+ import type { HttpClientPort } from "@jini-ai/core/primitives";
32
+ import { type createPluginContributionLoader } from "../contribution-loader.js";
33
+ import type { TrustedPluginPackage } from "../trusted-plugin-files.js";
34
+ import { type ParseMailSetup, type MailAdapterDescriptor } from "./adapter-descriptors.js";
35
+ export interface MailAdapterCreateContext {
36
+ readonly credential: MailAdapterCredential;
37
+ readonly kit: {
38
+ readonly httpClient: PluginMailHttpClient;
39
+ };
40
+ }
41
+ export interface MailAdapterModule extends Pick<import("@jini-ai/core/contracts/mail").MailAdapterModule, "domainReadConnection"> {
42
+ create(context: MailAdapterCreateContext): PositionalMailer;
43
+ }
44
+ export interface LoadedMailAdapter {
45
+ readonly descriptor: MailAdapterDescriptor;
46
+ readonly pluginId: string;
47
+ readonly module: MailAdapterModule;
48
+ }
49
+ export interface MailAdapterRegistry {
50
+ /** Every loaded adapter, in a stable order (plugin id, then declaration order). */
51
+ list(): readonly LoadedMailAdapter[];
52
+ /** Log-safe, one sentence per plugin or adapter that was NOT loaded, and why. */
53
+ readonly refusals: readonly string[];
54
+ }
55
+ type Loader = ReturnType<typeof createPluginContributionLoader>;
56
+ type LoadPluginContributions = Loader["loadPluginContributions"];
57
+ /** @agent-note The host supplies its filename, setup validator, guarded ABI, and trusted source loader. */
58
+ export declare function createMailContributions(requiredHost: {
59
+ filename: string;
60
+ parseSetup: ParseMailSetup;
61
+ defaultCredentialLabel: (required: {
62
+ label: string;
63
+ }) => string;
64
+ abi: {
65
+ fromPositionalMailer: (required: {
66
+ mailer: PositionalMailer;
67
+ }) => MailerPort;
68
+ toPluginHttpClient: (required: {
69
+ httpClient: HttpClientPort;
70
+ }) => PluginMailHttpClient;
71
+ };
72
+ loadFromSource: Loader["loadPluginContributionsFromSource"];
73
+ }, _optional?: Record<string, never>): {
74
+ loadMailAdapterRegistry: (ctx: {
75
+ readonly workspaceId: string;
76
+ }, required: {
77
+ readonly loadContributions: LoadPluginContributions;
78
+ }) => Promise<MailAdapterRegistry>;
79
+ loadMailAdapterRegistryFromSource: (plugin: TrustedPluginPackage, _optional?: Record<string, never>) => Promise<MailAdapterRegistry>;
80
+ contributeMailProviders: (required: {
81
+ registry: MailProviderRegistry;
82
+ adapters: MailAdapterRegistry;
83
+ }, _optional?: Record<string, never>) => {
84
+ accepted: readonly string[];
85
+ refusals: readonly string[];
86
+ };
87
+ };
88
+ export {};
89
+ //# sourceMappingURL=contribution.d.ts.map