@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
@@ -1,6 +1,7 @@
1
1
  import { agentVisiblePluginCandidate } from './search-projection.js';
2
2
  export const DEFAULT_CHAT_AGENT_PLUGINS = 'auto';
3
3
  const MAX_AUTOMATIC_GUIDANCE_BYTES = 8 * 1024;
4
+ const MAX_PRIMARY_GUIDANCE_BYTES = 16 * 1024;
4
5
  /** Use the same one-line metadata reason in consent and progressive disclosure. */
5
6
  function describeMatch({ plugin }, _options = {}) {
6
7
  return { id: plugin.pluginId, name: (plugin.displayName ?? plugin.pluginId).replace(/\s+/g, ' '),
@@ -50,7 +51,7 @@ export function readChatAgentPluginState({ value }, _options = {}) {
50
51
  const decision = record.decision;
51
52
  if (decision !== null && (!decision || !ids(decision.selected)))
52
53
  return empty;
53
- return { decision: decision ? { selected: [...new Set(decision.selected)], ...(typeof decision.asked === 'boolean' ? { asked: decision.asked } : {}) } : null, excluded: [...new Set(record.excluded)] };
54
+ return { decision: decision ? { selected: [...new Set(decision.selected)], ...(typeof decision.asked === 'boolean' ? { asked: decision.asked } : {}), ...(ids(decision.delivered) ? { delivered: [...new Set(decision.delivered)] } : {}) } : null, excluded: [...new Set(record.excluded)] };
54
55
  }
55
56
  /** Create one run's preparation owner. Calls serialize so parallel tool writes share one question.
56
57
  * @param required Host effects and the person's mode; browser state is advisory selection only.
@@ -61,7 +62,7 @@ export function readChatAgentPluginState({ value }, _options = {}) {
61
62
  export function createAutomaticAgentPluginUse({ mode, state: initialState, ports }, _options = {}) {
62
63
  let state = readChatAgentPluginState({ value: initialState });
63
64
  const delivered = new Map();
64
- const alreadyLoaded = new Set();
65
+ const alreadyLoaded = new Set(mode === 'off' ? [] : state.decision?.delivered?.filter(id => !state.excluded.includes(id)));
65
66
  let publishedSize;
66
67
  let queue = Promise.resolve();
67
68
  /** Ask mode admits only consented matches; the first non-empty match set asks the person once. */
@@ -79,11 +80,12 @@ export function createAutomaticAgentPluginUse({ mode, state: initialState, ports
79
80
  const offered = matches.map(plugin => describeMatch({ plugin }));
80
81
  const answer = await ports.ask({ matches: offered, ...(signal ? { signal } : {}) }, {});
81
82
  const selected = answer.action === 'skip' ? [] : answer.selected.filter(id => matches.some(plugin => plugin.pluginId === id));
82
- state = { decision: { selected, asked: true }, excluded: [...new Set([...state.excluded, ...matches.filter(plugin => !selected.includes(plugin.pluginId)).map(plugin => plugin.pluginId)])] };
83
+ // Failed preference persistence must leave this controller without the rejected consent.
83
84
  if (answer.action === 'auto') {
84
85
  await ports.saveAuto({}, {});
85
86
  mode = 'auto';
86
87
  }
88
+ state = { decision: { selected, asked: true }, excluded: [...new Set([...state.excluded, ...matches.filter(plugin => !selected.includes(plugin.pluginId)).map(plugin => plugin.pluginId)])] };
87
89
  // Consent changes only this person's preference, never a workspace default.
88
90
  return matches.filter(plugin => selected.includes(plugin.pluginId));
89
91
  }
@@ -115,14 +117,14 @@ export function createAutomaticAgentPluginUse({ mode, state: initialState, ports
115
117
  /** Bound automatic attachments before recording delivery; explicit loads retain complete text.
116
118
  * O(p*b) in resolved plugins and guidance bytes; a deferred plugin remains retryable.
117
119
  */
118
- async function resolveGuidance({ matches }, { signal } = {}) {
120
+ async function resolveGuidance({ matches, primaryId }, { signal } = {}) {
119
121
  const guidance = [];
120
122
  // Unloaded plugins contribute nothing; oversized guidance becomes a pointer instead of the text.
121
123
  const guidanceFor = async (match) => {
122
124
  const result = await resolveOneGuidance({ plugin: match }, { signal });
123
125
  if (result.status !== 'loaded')
124
126
  return undefined;
125
- if (new TextEncoder().encode(result.guidance).length > MAX_AUTOMATIC_GUIDANCE_BYTES) {
127
+ if (new TextEncoder().encode(result.guidance).length > (match.pluginId === primaryId ? MAX_PRIMARY_GUIDANCE_BYTES : MAX_AUTOMATIC_GUIDANCE_BYTES)) {
126
128
  const pointer = ports.formatPluginToolPointer?.({ pluginId: match.pluginId, skill: match.pluginId, file: 'SKILL.md' });
127
129
  const howToLoad = pointer === undefined ? '' : ` Load the full instructions with ${pointer}; use the same call with file '<relative path>' for supporting references.`;
128
130
  return `Agent Plugin '${match.pluginId}' guidance is deferred because it exceeds the automatic byte limit.${howToLoad}`;
@@ -139,12 +141,13 @@ export function createAutomaticAgentPluginUse({ mode, state: initialState, ports
139
141
  }
140
142
  return guidance;
141
143
  }
142
- /** Auto mode records everything delivered as selected, keeping any earlier selection and asked flag. */
143
- function rememberAutoSelection() {
144
- if (mode !== 'auto' || !delivered.size)
144
+ /** Persist actual deliveries separately from consent, using the existing chat decision. */
145
+ function rememberDelivery() {
146
+ if (!alreadyLoaded.size && !delivered.size)
145
147
  return;
146
148
  const { decision } = state;
147
- state = { ...state, decision: { selected: [...new Set([...(decision?.selected ?? []), ...delivered.keys()])], asked: decision?.asked ?? false } };
149
+ state = { ...state, decision: { selected: [...new Set([...(decision?.selected ?? []), ...(mode === 'auto' ? delivered.keys() : [])])],
150
+ asked: decision?.asked ?? false, delivered: [...new Set([...(decision?.delivered ?? []), ...alreadyLoaded, ...delivered.keys()])] } };
148
151
  }
149
152
  /** Initialize usage after a decision (including Skip), then publish only loaded-set changes.
150
153
  * Empty discovery must not consume that initial publication: a later Ask answer must persist.
@@ -160,42 +163,49 @@ export function createAutomaticAgentPluginUse({ mode, state: initialState, ports
160
163
  // Usage publication is advisory; losing its event must not discard resolved model guidance.
161
164
  }
162
165
  }
163
- /** Query preflight suggests; only a guarded capability resolves guidance here.
166
+ /** Query preflight delivers one primary; guarded capabilities resolve their providers.
164
167
  * Effects serialize with loads so a suggestion never consumes a backstop's delivery.
165
168
  */
166
169
  async function prepare(input, _options = {}) {
167
- if (mode === 'off' || input.signal?.aborted)
168
- return '';
169
170
  for (const id of input.loaded ?? [])
170
171
  alreadyLoaded.add(id);
172
+ if (mode === 'off' || input.signal?.aborted)
173
+ return '';
171
174
  const catalog = (await ports.list({}, {})).filter(plugin => !state.excluded.includes(plugin.pluginId));
172
175
  const candidates = catalog.filter(plugin => plugin.enabled);
176
+ for (const id of alreadyLoaded)
177
+ if (!candidates.some(plugin => plugin.pluginId === id))
178
+ alreadyLoaded.delete(id);
173
179
  const ranked = rankCandidates({ candidates, input, ports });
174
180
  // Owner decision 2026-10-18: no per-chat plugin count; the relevance threshold and vendor gate decide.
175
- const relevant = ranked.filter(plugin => !delivered.has(plugin.pluginId) && !alreadyLoaded.has(plugin.pluginId));
181
+ const relevant = ranked.filter(plugin => !delivered.has(plugin.pluginId) && !input.loaded?.includes(plugin.pluginId) && (!alreadyLoaded.has(plugin.pluginId) || !!input.query));
176
182
  const matches = await applyConsent({ matches: relevant }, { signal: input.signal });
177
- // Relevance is disclosure, never evidence that the model has read any guidance.
178
183
  const shouldLoad = !!input.capabilities?.length;
179
- const result = shouldLoad ? (await resolveGuidance({ matches }, { signal: input.signal })).join('\n\n') : relevantPluginNote({ matches, formatPluginToolPointer: ports.formatPluginToolPointer });
180
- rememberAutoSelection();
184
+ const primary = input.maxPromptArgBytes === undefined && input.query && !input.loaded?.length && !alreadyLoaded.has(matches[0]?.pluginId ?? '') ? matches.slice(0, 1) : [];
185
+ const result = shouldLoad ? (await resolveGuidance({ matches }, { signal: input.signal })).join('\n\n') : [
186
+ ...(await resolveGuidance({ matches: primary, primaryId: primary[0]?.pluginId }, { signal: input.signal })),
187
+ relevantPluginNote({ matches: matches.slice(primary.length), formatPluginToolPointer: ports.formatPluginToolPointer }),
188
+ ].filter(Boolean).join('\n\n');
189
+ rememberDelivery();
181
190
  await publishUsage();
182
- // Off packages never enter guidance consent or resolution. A relevant catalog line is the
183
- // only disclosure, so the model can offer the existing owner-approved enable flow.
191
+ // Preflight never resolves off packages implicitly. A catalog line offers an explicit read;
192
+ // its setup guidance may explain whether enabling or credentials are needed.
184
193
  const off = offPluginNote({ catalog, input });
185
194
  return [result, off].filter(Boolean).join('\n\n');
186
195
  }
187
- /** Rank only catalog-safe fields for off plugins; no capability-triggered disclosure. O(p*t). */
196
+ /** Rank readable metadata for off plugins; never load their tools or guidance implicitly. O(p*t). */
188
197
  function offPluginNote({ catalog, input }) {
189
198
  if (!input.query)
190
199
  return '';
191
200
  const candidates = catalog.filter(plugin => !plugin.enabled).map(candidate => agentVisiblePluginCandidate({ candidate }));
192
- return ports.rank({ query: input.query, candidates, limit: 10 }, {}).map(plugin => plugin.description ?? '').join('\n');
201
+ return ports.rank({ query: input.query, candidates, limit: 10 }, {}).map(plugin => [plugin.description,
202
+ ports.formatPluginToolPointer?.({ pluginId: plugin.pluginId, file: 'SKILL.md' })].filter(Boolean).join(' ')).join('\n');
193
203
  }
194
204
  /** Admit one explicit id using the same catalog, consent, resolver and delivery state as prepare.
195
205
  * No activation writes; unavailable guidance is retryable. O(p) local catalog lookup.
196
206
  */
197
207
  async function load({ pluginId, signal, ...request }, _options = {}) {
198
- if (mode === 'off')
208
+ if (mode === 'off' && !alreadyLoaded.has(pluginId))
199
209
  return { status: 'off', guidance: '' };
200
210
  if (signal?.aborted)
201
211
  return { status: 'cancelled', guidance: '' };
@@ -204,8 +214,6 @@ export function createAutomaticAgentPluginUse({ mode, state: initialState, ports
204
214
  const plugin = (await ports.list({}, {})).find(candidate => candidate.pluginId === pluginId);
205
215
  if (!plugin)
206
216
  return { status: 'missing', guidance: '' };
207
- if (!plugin.enabled)
208
- return { status: 'installed-but-inactive', guidance: '' };
209
217
  return loadPermitted({ plugin, ...request }, { signal });
210
218
  }
211
219
  /** The plugin's own SKILL.md, whether defaulted or named explicitly. O(1). */
@@ -216,18 +224,18 @@ export function createAutomaticAgentPluginUse({ mode, state: initialState, ports
216
224
  * Only the primary SKILL.md records full plugin delivery. O(p) consent filtering plus one read.
217
225
  */
218
226
  async function loadPermitted({ plugin, ...request }, { signal } = {}) {
219
- const requestedContent = request.skill !== undefined || request.file !== undefined;
220
- if (!requestedContent && (delivered.has(plugin.pluginId) || alreadyLoaded.has(plugin.pluginId)))
221
- return { status: 'already-loaded', guidance: '' };
222
227
  const matches = await applyConsent({ matches: [{ ...plugin, score: 4 }] }, { signal });
223
228
  if (!matches.length) {
224
229
  await publishUsage();
225
230
  return { status: 'excluded', guidance: '' };
226
231
  }
227
- const result = await resolveOneGuidance({ plugin, ...request }, { signal });
232
+ let result = await resolveOneGuidance({ plugin, ...request }, { signal });
233
+ if (!plugin.enabled && result.status === 'loaded') {
234
+ result = { status: 'installed-but-inactive', guidance: `Plugin '${plugin.pluginId}' is off; its tools are unavailable.\n\n${result.guidance}` };
235
+ }
228
236
  if (isPrimaryInstructions({ pluginId: plugin.pluginId, ...request }))
229
237
  recordDelivery({ plugin, result });
230
- rememberAutoSelection();
238
+ rememberDelivery();
231
239
  await publishUsage();
232
240
  return result;
233
241
  }
@@ -238,6 +246,7 @@ export function createAutomaticAgentPluginUse({ mode, state: initialState, ports
238
246
  return next;
239
247
  }
240
248
  return {
249
+ guidanceIds: (_required, _options = {}) => [...new Set([...alreadyLoaded, ...delivered.keys()])].filter(id => !state.excluded.includes(id)),
241
250
  /** Suggest relevant metadata for a query; capability calls load only their providers. */
242
251
  prepare: (input, _options = {}) => enqueue({ operation: () => prepare(input) }),
243
252
  /** Resolve one active, permitted id and publish usage only after real guidance is read.
@@ -1,10 +1,11 @@
1
+ import { resolveAgentPluginLifecycleNamespace } from '../core/identity-namespace.js';
1
2
  import { parseAgentPluginMcpConfig as parseAgentPluginMcpConfigValue } from "./manifest.js";
2
3
  import { createPackagePathsModule } from "./package-paths.js";
3
4
  import path from "node:path";
4
5
  import { createSkillFileReader } from "./skill-file-reader.js";
5
6
  function buildModule(ports) {
6
7
  const readFile = ports.filesystem.readFile.bind(ports.filesystem);
7
- const parseAgentPluginMcpConfig = (value, pluginManifest) => parseAgentPluginMcpConfigValue({ value, extensionNamespace: ports.extensionNamespace }, { pluginManifest, readServerMetadata: ports.readServerMetadata });
8
+ const parseAgentPluginMcpConfig = (value, pluginManifest) => parseAgentPluginMcpConfigValue({ value, extensionNamespace: resolveAgentPluginLifecycleNamespace({ value: pluginManifest, extensionNamespace: ports.extensionNamespace }) }, { pluginManifest, readServerMetadata: ports.readServerMetadata });
8
9
  const { assertContainedOnDisk } = createPackagePathsModule(ports);
9
10
  function classifyAgentPluginMcpServerTrust(server) {
10
11
  return server.type === "stdio" ? "requires-confirmation" : "auto-admit";
@@ -48,6 +49,9 @@ function buildModule(ports) {
48
49
  catch {
49
50
  }
50
51
  const result = parseAgentPluginMcpConfig(parsedJson, manifest);
52
+ if (result.ok)
53
+ for (const message of result.warnings ?? [])
54
+ ports.onEvent?.({ event: 'agent-plugin-metadata-warning', message });
51
55
  return result.ok ? result.config : null;
52
56
  }
53
57
  async function readInstalledMcpServerIds(packageRoot) {
@@ -1,11 +1,6 @@
1
1
  import type { TrustedPluginPackage, TrustedPluginPackagesQuery, TrustedPluginVerdict } from './trusted-plugin-files.js';
2
- export type PluginContributionParseResult<T> = {
3
- readonly ok: true;
4
- readonly descriptors: readonly T[];
5
- } | {
6
- readonly ok: false;
7
- readonly reason: string;
8
- };
2
+ import type { PluginContributionParseResult } from './contribution-types.js';
3
+ export type { PluginContributionParseResult } from './contribution-types.js';
9
4
  export interface PluginContributionResult<T> {
10
5
  readonly items: readonly T[];
11
6
  readonly refusals: readonly string[];
@@ -0,0 +1,8 @@
1
+ export type PluginContributionParseResult<T> = {
2
+ readonly ok: true;
3
+ readonly descriptors: readonly T[];
4
+ } | {
5
+ readonly ok: false;
6
+ readonly reason: string;
7
+ };
8
+ //# sourceMappingURL=contribution-types.d.ts.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=contribution-types.js.map
@@ -0,0 +1,23 @@
1
+ import type { PluginCredentialCard } from '@jini-ai/core/contracts/credentials';
2
+ export type { PluginCredentialField, PluginCredentialCard } from '@jini-ai/core/contracts/credentials';
3
+ import type { PluginContributionParseResult } from './contribution-types.js';
4
+ /** Shared by manifest and mail card parsers: purpose copy grants no routing or authority.
5
+ * @returns Trimmed display strings, or undefined for legacy cards.
6
+ * @throws Error for malformed or oversized copy. @complexity O(entries), capped at 8 × 120 characters.
7
+ */
8
+ export declare function parseCredentialCardUsedFor({ value }: {
9
+ value: unknown;
10
+ }, _options?: {}): readonly string[] | undefined;
11
+ /** Parse portable connection-card declarations without executing plugin modules.
12
+ * Refuse the whole batch on invalid or duplicate targets; absent declarations remain compatible.
13
+ * Legacy namespace reads warn through the host callback (console by default).
14
+ * @returns Normalized display/form metadata or a declaration-specific refusal reason.
15
+ * @complexity O(c + f), capped at 32 cards × 16 fields; no I/O or input mutation.
16
+ */
17
+ export declare function parsePluginCredentialCards({ raw }: {
18
+ raw: string;
19
+ }, options?: {
20
+ identityNamespace?: string;
21
+ onWarning?: (warning: string) => void;
22
+ }): PluginContributionParseResult<PluginCredentialCard>;
23
+ //# sourceMappingURL=credential-card-metadata.d.ts.map
@@ -0,0 +1,184 @@
1
+ import { readAgentPluginPortableExtension, readAgentPluginCompatibilityWarnings } from '../core/identity-namespace.js';
2
+ /** Supported categories for portable connection-card declarations. */
3
+ const CUSTOM_CREDENTIAL_CATEGORIES = ['source-control', 'hosting', 'media', 'ai', 'ops', 'general'];
4
+ const recordOf = ({ value }, _options = {}) => typeof value === 'object' && value !== null && !Array.isArray(value) ? value : undefined;
5
+ const saveKinds = ['api', 'publish-host', 'source-control', 'agent-plugin-token', 'oauth', 'provider-settings'];
6
+ /** Bounded display text, never a submitted value. @complexity O(1). */
7
+ function text({ value, name, required = false, maxLength = 2000 }, _options = {}) {
8
+ if (value === undefined && !required)
9
+ return undefined;
10
+ if (typeof value !== 'string' || !value.trim() || value.length > maxLength)
11
+ throw new Error(`${name} must be non-empty text (at most ${maxLength} characters)`);
12
+ return value.trim();
13
+ }
14
+ /** Shared by manifest and mail card parsers: purpose copy grants no routing or authority.
15
+ * @returns Trimmed display strings, or undefined for legacy cards.
16
+ * @throws Error for malformed or oversized copy. @complexity O(entries), capped at 8 × 120 characters.
17
+ */
18
+ export function parseCredentialCardUsedFor({ value }, _options = {}) {
19
+ if (value === undefined)
20
+ return undefined;
21
+ if (!Array.isArray(value) || value.length > 8)
22
+ throw new Error('usedFor must be an array of at most 8 entries');
23
+ return value.map(value => text({ value, name: 'usedFor entry', required: true, maxLength: 120 }));
24
+ }
25
+ /** Reject active URLs, embedded credentials and non-HTTPS origins in declarations. */
26
+ function httpsUrl({ value, name }, _options = {}) {
27
+ const result = text({ value, name });
28
+ if (result === undefined)
29
+ return undefined;
30
+ const url = new URL(result);
31
+ if (url.protocol !== 'https:' || url.username || url.password || /^https:\/\/[^/?#]*@/i.test(result))
32
+ throw new Error(`${name} must be an HTTPS URL without credentials`);
33
+ return result;
34
+ }
35
+ /** A probe is API-card metadata bound to a fixed base origin, never a submitted destination.
36
+ * @returns The declared URL, or no field for legacy cards. @throws Error for unsafe declarations.
37
+ * @complexity O(1), bounded URL text; no I/O.
38
+ */
39
+ function probeOf({ value, baseUrl }, _options = {}) {
40
+ if (value.probeUrl === undefined)
41
+ return {};
42
+ const probeUrl = httpsUrl({ value: value.probeUrl, name: 'probeUrl' });
43
+ if (!isApiCard({ value }) || !baseUrl || new URL(probeUrl).origin !== new URL(baseUrl).origin)
44
+ throw new Error('probeUrl requires an API card with a same-origin declared baseUrl');
45
+ return { probeUrl };
46
+ }
47
+ /** Non-secret supplemental inputs; domain owners still validate the submitted connection. */
48
+ function fieldsOf({ value }, _options = {}) {
49
+ if (value === undefined)
50
+ return undefined;
51
+ if (!Array.isArray(value) || value.length > 16)
52
+ throw new Error('fields must be an array of at most 16 non-secret fields');
53
+ const seen = new Set();
54
+ return value.map(entry => {
55
+ const field = recordOf({ value: entry });
56
+ if (!field || field.secret !== undefined)
57
+ throw new Error('extra fields must be non-secret');
58
+ const name = text({ value: field.name, name: 'field.name', required: true });
59
+ if (!/^[a-zA-Z][a-zA-Z0-9]*$/.test(name) || /token|password|secret|authorization|cookie/i.test(name) || seen.has(name))
60
+ throw new Error('invalid or duplicate non-secret field name');
61
+ seen.add(name);
62
+ if (field.required !== undefined && typeof field.required !== 'boolean')
63
+ throw new Error('field.required must be boolean');
64
+ return { name, label: text({ value: field.label, name: 'field.label', required: true }), ...(field.hint === undefined ? {} : { hint: text({ value: field.hint, name: 'field.hint' }) }), ...(field.required === undefined ? {} : { required: field.required }) };
65
+ });
66
+ }
67
+ /** Validate one declaration, leaving all labels and destinations under plugin ownership. */
68
+ function cardOf({ value }, _options = {}) {
69
+ const declaration = recordOf({ value });
70
+ if (!declaration)
71
+ throw new Error('credential card must be an object');
72
+ return declaredCard({ value: declaration });
73
+ }
74
+ /** Materialize the already checked object through the shared field and identity validators. */
75
+ function declaredCard({ value }, _options = {}) {
76
+ const { target, category } = cardIdentity({ value });
77
+ const fields = fieldsOf({ value: value.fields });
78
+ const usedFor = parseCredentialCardUsedFor({ value: value.usedFor });
79
+ const baseUrl = httpsUrl({ value: value.baseUrl, name: 'baseUrl' });
80
+ validateCardFields({ value, fields, baseUrl });
81
+ return { providerId: target, category, baseUrl: baseUrl ?? '', ...probeOf({ value, baseUrl }), ...cardText({ value }), ...ownedApiLabelOf({ value }), ...(usedFor === undefined ? {} : { usedFor }), ...(fields === undefined ? {} : { fields }), ...additionalOrigins({ value: value.additionalHosts }), ...(value.saveKind === undefined ? {} : { saveKind: value.saveKind }) };
82
+ }
83
+ /** A card may claim only its own API row, never grant ownership to other cards or domain stores. */
84
+ function ownedApiLabelOf({ value }, _options = {}) {
85
+ const ownedApiLabel = text({ value: value.ownedApiLabel, name: 'ownedApiLabel' });
86
+ if (ownedApiLabel === undefined)
87
+ return {};
88
+ if (!isApiCard({ value }) || ownedApiLabel !== text({ value: value.label, name: 'label', required: true }))
89
+ throw new Error('ownedApiLabel must match the API card label');
90
+ return { ownedApiLabel };
91
+ }
92
+ /** Select only supported display metadata; unknown manifest keys never reach a form or store. */
93
+ function cardText({ value }, _options = {}) {
94
+ const result = {};
95
+ for (const name of ['label', 'title', 'intro', 'keyHint'])
96
+ result[name] = text({ value: value[name], name, required: true });
97
+ for (const name of ['helpLabel', 'saveTarget', 'permissions']) {
98
+ const field = text({ value: value[name], name });
99
+ if (field !== undefined)
100
+ result[name] = field;
101
+ }
102
+ const helpUrl = httpsUrl({ value: value.helpUrl, name: 'helpUrl' });
103
+ if (helpUrl !== undefined)
104
+ result.helpUrl = helpUrl;
105
+ return result;
106
+ }
107
+ /** Parse portable connection-card declarations without executing plugin modules.
108
+ * Refuse the whole batch on invalid or duplicate targets; absent declarations remain compatible.
109
+ * Legacy namespace reads warn through the host callback (console by default).
110
+ * @returns Normalized display/form metadata or a declaration-specific refusal reason.
111
+ * @complexity O(c + f), capped at 32 cards × 16 fields; no I/O or input mutation.
112
+ */
113
+ export function parsePluginCredentialCards({ raw }, options = {}) {
114
+ try {
115
+ const manifest = recordOf({ value: JSON.parse(raw) });
116
+ if (!manifest)
117
+ throw new Error('plugin manifest must be an object');
118
+ const extension = readAgentPluginPortableExtension({ value: manifest }, options);
119
+ for (const warning of readAgentPluginCompatibilityWarnings({ value: manifest }, options))
120
+ (options.onWarning ?? console.warn)(warning);
121
+ const descriptors = parseCardBatch({ value: extension?.credentialCards });
122
+ return { ok: true, descriptors };
123
+ }
124
+ catch (error) {
125
+ return { ok: false, reason: error instanceof Error ? error.message : 'invalid credential cards' };
126
+ }
127
+ }
128
+ /** Validate collection bounds separately from manifest decoding. O(cards + fields). */
129
+ function parseCardBatch({ value }, _options = {}) {
130
+ if (value === undefined)
131
+ return [];
132
+ if (!Array.isArray(value) || value.length > 32)
133
+ throw new Error('credentialCards must be an array of at most 32 cards');
134
+ const descriptors = value.map(value => cardOf({ value }));
135
+ if (new Set(descriptors.map(card => card.providerId)).size !== descriptors.length)
136
+ throw new Error('duplicate credential card target');
137
+ return descriptors;
138
+ }
139
+ /** Extra API origins are plugin metadata, never model or iframe input. */
140
+ function additionalOrigins({ value }, _options = {}) {
141
+ if (value === undefined)
142
+ return {};
143
+ if (!Array.isArray(value) || value.length > 8)
144
+ throw new Error('additionalHosts must be at most eight HTTPS origins');
145
+ return { additionalHosts: value.map(entry => {
146
+ const url = httpsUrl({ value: entry, name: 'additionalHosts' });
147
+ if (!url || new URL(url).origin !== url)
148
+ throw new Error('additionalHosts must contain origins only');
149
+ return url;
150
+ }) };
151
+ }
152
+ /** Check target and store discriminants independently from optional form metadata. */
153
+ function cardIdentity({ value }, _options = {}) {
154
+ const target = text({ value: value.target, name: 'target', required: true });
155
+ if (!/^[a-z0-9][a-z0-9._-]{0,99}$/.test(target))
156
+ throw new Error('invalid card target');
157
+ const category = text({ value: value.category, name: 'category', required: true });
158
+ if (!CUSTOM_CREDENTIAL_CATEGORIES.includes(category))
159
+ throw new Error('invalid card category');
160
+ if (value.saveKind !== undefined && !saveKinds.includes(value.saveKind))
161
+ throw new Error('invalid saveKind');
162
+ if (value.saveTarget !== undefined && (typeof value.saveTarget !== 'string' || !/^[a-z0-9][a-z0-9._-]{0,99}$/.test(value.saveTarget)))
163
+ throw new Error('invalid saveTarget');
164
+ return { target, category };
165
+ }
166
+ /** API public inputs have corresponding store slots; domain-owned forms retain their own fields. */
167
+ function validateCardFields({ value, fields = [], baseUrl }, _options = {}) {
168
+ if (!isApiCard({ value }) && fields.length)
169
+ throw new Error('Only API cards may declare fields; domain forms own their inputs');
170
+ // A provider-settings card's fields and destinations are the provider plugin's declared settings.
171
+ if (value.saveKind === 'provider-settings')
172
+ return validateProviderSettingsDestination({ value, baseUrl });
173
+ if (!baseUrl && !fields.some(field => field.name === 'baseUrl' && field.required))
174
+ throw new Error('baseUrl or a required baseUrl field is required');
175
+ if (isApiCard({ value }) && fields.some(field => !['username', 'baseUrl'].includes(field.name)))
176
+ throw new Error('API cards support only username and baseUrl public fields');
177
+ }
178
+ function validateProviderSettingsDestination({ value, baseUrl }, _options = {}) {
179
+ if (value.saveTarget === undefined || baseUrl)
180
+ throw new Error('provider-settings cards need a saveTarget and no baseUrl');
181
+ }
182
+ /** Missing saveKind retains the original API-card contract. */
183
+ function isApiCard({ value }, _options = {}) { return value.saveKind === undefined || value.saveKind === "api"; }
184
+ //# sourceMappingURL=credential-card-metadata.js.map
@@ -2,6 +2,12 @@ import { type AdminSurfaceActionSchema } from '../contracts/admin-surface-action
2
2
  /** Matches the CMS consent vocabulary without introducing a dependency on CMS. */
3
3
  export type AgentPluginExportConsent = 'necessary' | 'functional' | 'analytics' | 'marketing';
4
4
  export type AgentPluginExportStaticMode = 'full' | 'link-only' | 'fallback-only';
5
+ /** Exact https origins an export may reach; the host adds them to the page's content-security policy. */
6
+ export interface AgentPluginExportExternalHosts {
7
+ readonly script?: readonly string[];
8
+ readonly frame?: readonly string[];
9
+ readonly connect?: readonly string[];
10
+ }
5
11
  export interface AgentPluginExport {
6
12
  readonly template: string;
7
13
  readonly props: Extract<AdminSurfaceActionSchema, {
@@ -17,6 +23,11 @@ export interface AgentPluginExport {
17
23
  readonly hostLinks?: Readonly<Record<string, string>>;
18
24
  readonly styles?: string;
19
25
  readonly assets?: Readonly<Record<string, string>>;
26
+ /** Contained .js paths or https URLs on externalHosts.script, loaded in order behind `consent`. */
27
+ readonly scripts?: readonly string[];
28
+ readonly externalHosts?: AgentPluginExportExternalHosts;
29
+ /** String props that must be an https page on one of externalHosts.frame. */
30
+ readonly urlProps?: readonly string[];
20
31
  }
21
32
  export interface AgentPluginExportMetadata {
22
33
  readonly exports?: Readonly<Record<string, AgentPluginExport>>;
@@ -1,7 +1,8 @@
1
1
  /** Declarative public-page exports. Parsing grants no trust and never reads plugin files. */
2
2
  import { validatePluginIdentity } from '@jini-ai/core/plugin-directory';
3
3
  import { checkAdminSurfaceActionSchema, exceedsAdminSurfacePayloadLimit, validateAdminSurfaceActionValue, } from '../contracts/admin-surface-action-schema.js';
4
- const KNOWN_KEYS = new Set(['template', 'props', 'consent', 'staticExport', 'version', 'minVersion', 'aliases', 'hostLinks', 'styles', 'assets']);
4
+ const KNOWN_KEYS = new Set(['template', 'props', 'consent', 'staticExport', 'version', 'minVersion', 'aliases', 'hostLinks', 'styles', 'assets', 'scripts', 'externalHosts', 'urlProps']);
5
+ const HOST_KINDS = ['script', 'frame', 'connect'];
5
6
  const isObject = (value) => typeof value === 'object' && value !== null && !Array.isArray(value);
6
7
  const isName = (value) => typeof value === 'string' && /^[a-z0-9]+(?:[.-][a-z0-9]+)*$/.test(value);
7
8
  const isVersion = (value) => Number.isSafeInteger(value) && value >= 1;
@@ -36,6 +37,45 @@ function checkFiles({ entry }, _optional = {}) {
36
37
  const validAsset = (value) => isExportFile({ value, extension: ['.png', '.svg'] });
37
38
  return checkMap({ value: entry.assets, valid: validAsset }) ? null : 'assets must map names to contained .png or .svg paths';
38
39
  }
40
+ /** Exact origins only: paths, wildcards and CSP keywords would widen what the manifest states. */
41
+ function isHttpsOrigin(value) {
42
+ return typeof value === 'string' && /^https:\/\/[a-z0-9.-]+(?::\d+)?$/.test(value) && new URL(value).origin === value;
43
+ }
44
+ function isDeclaredScriptUrl({ value, hosts }, _optional = {}) {
45
+ if (typeof value !== 'string' || !value.startsWith('https://'))
46
+ return false;
47
+ try {
48
+ const url = new URL(value);
49
+ return !url.username && !url.password && hosts.includes(url.origin);
50
+ }
51
+ catch {
52
+ return false;
53
+ }
54
+ }
55
+ /** A URL prop is only checkable against a declared frame host, and only if the schema names it. */
56
+ function checkUrlPropsDeclared({ entry }, _optional = {}) {
57
+ if (entry.urlProps === undefined)
58
+ return null;
59
+ const properties = isObject(entry.props) && isObject(entry.props.properties) ? entry.props.properties : {};
60
+ const frames = entry.externalHosts?.frame ?? [];
61
+ const valid = Array.isArray(entry.urlProps) && frames.length > 0 && entry.urlProps.every(name => typeof name === 'string' && Object.hasOwn(properties, name));
62
+ return valid ? null : 'urlProps must name declared props and needs externalHosts.frame';
63
+ }
64
+ /** Nothing loads unless named here: own files by contained path, third-party files by declared origin. */
65
+ function checkExternal({ entry }, _optional = {}) {
66
+ const hosts = entry.externalHosts;
67
+ if (hosts !== undefined && !(isObject(hosts) && Object.entries(hosts).every(([kind, origins]) => HOST_KINDS.includes(kind) && Array.isArray(origins) && origins.every(isHttpsOrigin)))) {
68
+ return 'externalHosts must map script, frame or connect to exact https origins';
69
+ }
70
+ const urlProps = checkUrlPropsDeclared({ entry });
71
+ if (urlProps !== null)
72
+ return urlProps;
73
+ if (entry.scripts === undefined)
74
+ return null;
75
+ const scriptHosts = hosts?.script ?? [];
76
+ const valid = Array.isArray(entry.scripts) && entry.scripts.every(value => isExportFile({ value, extension: ['.js'] }) || isDeclaredScriptUrl({ value, hosts: scriptHosts }));
77
+ return valid ? null : 'scripts must be contained .js paths or https URLs on externalHosts.script';
78
+ }
39
79
  function checkContract({ entry, provides }, _optional = {}) {
40
80
  if (!['necessary', 'functional', 'analytics', 'marketing'].includes(entry.consent))
41
81
  return 'consent must name a consent category';
@@ -83,7 +123,7 @@ function checkExport({ name, entry, provides, warnings }, _optional = {}) {
83
123
  if (!KNOWN_KEYS.has(key))
84
124
  warnings.push(`unrecognized exports.${name} field '${key}' (ignored)`);
85
125
  }
86
- return checkVersions({ entry }) ?? checkFiles({ entry }) ?? checkContract({ entry, provides });
126
+ return checkVersions({ entry }) ?? checkFiles({ entry }) ?? checkExternal({ entry }) ?? checkContract({ entry, provides });
87
127
  }
88
128
  /** Save and render share the existing bounded schema/value policy; messages never echo prop values.
89
129
  * @returns First validation reason, or null on success. No side effects. @complexity O(p) prop values.
@@ -91,6 +131,27 @@ function checkExport({ name, entry, provides, warnings }, _optional = {}) {
91
131
  export function validateAgentPluginExportProps({ definition, props }, _optional = {}) {
92
132
  if (exceedsAdminSurfacePayloadLimit({ payload: props }))
93
133
  return 'props exceed the payload limit';
94
- return validateAdminSurfaceActionValue({ schema: definition.props, value: props });
134
+ return validateAdminSurfaceActionValue({ schema: definition.props, value: props }) ?? checkUrlPropValues({ definition, props });
135
+ }
136
+ function isPageOn({ value, hosts }, _optional = {}) {
137
+ if (typeof value !== 'string')
138
+ return false;
139
+ try {
140
+ const url = new URL(value);
141
+ return url.protocol === 'https:' && !url.username && !url.password && url.pathname !== '/' && hosts.includes(url.origin);
142
+ }
143
+ catch {
144
+ return false;
145
+ }
146
+ }
147
+ /** Runs after the schema, so props is a closed object. Reasons name the host, never the value. */
148
+ function checkUrlPropValues({ definition, props }, _optional = {}) {
149
+ const hosts = definition.externalHosts?.frame ?? [];
150
+ for (const name of definition.urlProps ?? []) {
151
+ const value = props[name];
152
+ if (value !== undefined && !isPageOn({ value, hosts }))
153
+ return `${name} must be an https link to a page on ${hosts.join(' or ')}`;
154
+ }
155
+ return null;
95
156
  }
96
157
  //# sourceMappingURL=exports.js.map
@@ -0,0 +1,38 @@
1
+ import { type PluginIdentity } from '@jini-ai/core/plugin-directory';
2
+ import type { InstalledAgentPlugin } from '../types.js';
3
+ /** Host metadata; absence keeps the plugin's normal presentation and behavior. */
4
+ export type PluginMaturity = 'untested' | 'soon';
5
+ /** Read the selected portable extension; unknown values warn without rejecting a usable plugin.
6
+ * @returns A supported maturity or undefined. @complexity O(1).
7
+ */
8
+ export declare function readPluginMaturity({ manifest }: {
9
+ manifest: unknown;
10
+ }, options?: {
11
+ warn?: (message: string) => void;
12
+ }): PluginMaturity | undefined;
13
+ /** `extensions.jini.providerPlugin`: the provider plugin this agent plugin is the assistant face of
14
+ * (owner 2026-10-25: one vendor, one plugin). The provider plugin's switch turns both faces on and
15
+ * off (`provider-plugin-link.ts`), and the agent plugin owns that provider's settings card.
16
+ * Unknown shapes warn and read as no link, so a typo never links to a wrong plugin.
17
+ * @complexity O(1). */
18
+ export declare function readProviderPluginLink({ manifest }: {
19
+ manifest: unknown;
20
+ }, options?: {
21
+ warn?: (message: string) => void;
22
+ }): string | undefined;
23
+ /** Shared instruction for every host guidance surface, so disclosure precedes credentials/actions. */
24
+ export declare const UNTESTED_PLUGIN_GUIDANCE = "Before saving keys or acting with this plugin, tell the user this integration hasn't been tested end to end yet. It may not work.";
25
+ /** Reads metadata only from a lifecycle-validated package root; never imports executable code.
26
+ * @param optional.readText file reader port (defaults to UTF-8 `fs.readFile`).
27
+ * @throws Invalid or unreadable publisher metadata.
28
+ * @complexity One manifest read plus O(k + p) keyword/capability validation.
29
+ */
30
+ export declare function readInstalledAgentPluginIdentity({ plugin }: {
31
+ plugin: Pick<InstalledAgentPlugin, 'pluginId' | 'packageRoot'>;
32
+ }, optional?: {
33
+ readText?: (filePath: string) => Promise<string>;
34
+ }): Promise<PluginIdentity & {
35
+ readonly maturity?: PluginMaturity;
36
+ readonly providerPlugin?: string;
37
+ }>;
38
+ //# sourceMappingURL=identity.d.ts.map