@jini-ai/agent-plugins 0.7.3-next.1 → 0.7.3-next.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (233) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/README.md +22 -4
  3. package/calendly/README.md +29 -0
  4. package/calendly/mcp.json +1 -1
  5. package/cloudflare/lib/assets.mjs +1 -1
  6. package/cloudflare/lib/cms-forms.mjs +1 -1
  7. package/core/persistent-state.d.ts +4 -1
  8. package/core/persistent-state.js +55 -21
  9. package/dist/admin-surfaces/callback-field-inbox.d.ts +1 -6
  10. package/dist/admin-surfaces/connections/connections.d.ts +2 -6
  11. package/dist/admin-surfaces/connections/index.d.ts +3 -2
  12. package/dist/admin-surfaces/index.d.ts +3 -1
  13. package/dist/connect/access-token-tool.d.ts +1 -1
  14. package/dist/connect/access-token-tool.js +1 -1
  15. package/dist/connect/catalog.d.ts +26 -0
  16. package/dist/connect/catalog.js +42 -0
  17. package/dist/connect/connect-tool.d.ts +2 -294
  18. package/dist/connect/connect-tool.js +2 -53
  19. package/dist/connect/contracts.d.ts +257 -0
  20. package/dist/connect/contracts.js +2 -0
  21. package/dist/connect/credential-cards.d.ts +2 -0
  22. package/dist/connect/credential-cards.js +7 -4
  23. package/dist/connect/grant-signed-in-defaults.js +1 -1
  24. package/dist/connect/host-deps.d.ts +32 -0
  25. package/dist/connect/host-deps.js +35 -0
  26. package/dist/connect/import-access-token.js +1 -1
  27. package/dist/connect/index.d.ts +7 -2
  28. package/dist/connect/index.js +5 -2
  29. package/dist/connect/installed-plugin.d.ts +28 -0
  30. package/dist/connect/installed-plugin.js +19 -0
  31. package/dist/connect/new-site-agent-plugin-tokens.d.ts +88 -0
  32. package/dist/connect/new-site-agent-plugin-tokens.js +107 -0
  33. package/dist/connect/plugin-host/index.d.ts +2 -2
  34. package/dist/connect/plugin-host/index.js +19 -10
  35. package/dist/connect/token-sign-in.d.ts +1 -14
  36. package/dist/connect/token-sign-in.js +4 -23
  37. package/dist/core/export-props.d.ts +10 -0
  38. package/dist/core/export-props.js +31 -0
  39. package/dist/core/folder-zip-error.d.ts +5 -0
  40. package/dist/core/folder-zip-error.js +8 -0
  41. package/dist/core/host-incompatible-error.d.ts +8 -0
  42. package/dist/core/host-incompatible-error.js +9 -0
  43. package/dist/core/identity-namespace.d.ts +27 -16
  44. package/dist/core/identity-namespace.js +25 -22
  45. package/dist/core/plugin-display-name.d.ts +7 -0
  46. package/dist/core/plugin-display-name.js +11 -0
  47. package/dist/core/provider-plugin-link.d.ts +7 -0
  48. package/dist/core/provider-plugin-link.js +5 -0
  49. package/dist/{connect → core}/token-map.d.ts +11 -1
  50. package/dist/{connect → core}/token-map.js +15 -0
  51. package/dist/core/token-sign-in-list.d.ts +18 -0
  52. package/dist/core/token-sign-in-list.js +23 -0
  53. package/dist/core/update-error.d.ts +8 -0
  54. package/dist/core/update-error.js +9 -0
  55. package/dist/{lifecycle → core}/update-plan.d.ts +1 -1
  56. package/dist/ffmpeg-transcode/adapter.d.ts +74 -0
  57. package/dist/ffmpeg-transcode/adapter.js +155 -0
  58. package/dist/folder-zip-node.d.ts +2 -1
  59. package/dist/folder-zip-node.js +6 -5
  60. package/dist/folder-zip.d.ts +0 -4
  61. package/dist/folder-zip.js +1 -7
  62. package/dist/index.d.ts +3 -1
  63. package/dist/lifecycle/activation.d.ts +39 -3
  64. package/dist/lifecycle/activation.js +467 -418
  65. package/dist/lifecycle/automatic-use-offer.d.ts +62 -0
  66. package/dist/lifecycle/automatic-use-offer.js +52 -0
  67. package/dist/lifecycle/automatic-use.d.ts +33 -1
  68. package/dist/lifecycle/automatic-use.js +157 -38
  69. package/dist/lifecycle/bundled-source-archive.d.ts +1 -1
  70. package/dist/lifecycle/capability-projection.d.ts +0 -1
  71. package/dist/lifecycle/capability-projection.js +92 -23
  72. package/dist/lifecycle/compatibility-metadata.d.ts +1 -0
  73. package/dist/lifecycle/compatibility-metadata.js +6 -1
  74. package/dist/lifecycle/compatibility.d.ts +1 -8
  75. package/dist/lifecycle/compatibility.js +1 -8
  76. package/dist/lifecycle/credential-card-metadata.d.ts +2 -2
  77. package/dist/lifecycle/exports.d.ts +2 -45
  78. package/dist/lifecycle/exports.js +1 -30
  79. package/dist/lifecycle/host-tools/identity.d.ts +5 -4
  80. package/dist/lifecycle/host-tools/identity.js +5 -5
  81. package/dist/lifecycle/host-tools/ports.d.ts +10 -1
  82. package/dist/lifecycle/host-tools/search-tool.d.ts +4 -2
  83. package/dist/lifecycle/host-tools/search-tool.js +19 -8
  84. package/dist/lifecycle/host-tools/skill-tool.js +1 -1
  85. package/dist/lifecycle/index.d.ts +20 -17
  86. package/dist/lifecycle/index.js +5 -4
  87. package/dist/lifecycle/install-from-url.d.ts +1 -2
  88. package/dist/lifecycle/install.d.ts +4 -34
  89. package/dist/lifecycle/install.js +3 -3
  90. package/dist/lifecycle/installed-package-index.d.ts +1 -1
  91. package/dist/lifecycle/installed-package-index.js +4 -4
  92. package/dist/lifecycle/layout.d.ts +21 -25
  93. package/dist/lifecycle/layout.js +79 -0
  94. package/dist/lifecycle/manifest.d.ts +10 -7
  95. package/dist/lifecycle/manifest.js +20 -15
  96. package/dist/lifecycle/mcp-provisioning.d.ts +1 -1
  97. package/dist/lifecycle/metadata.d.ts +6 -3
  98. package/dist/lifecycle/metadata.js +2 -1
  99. package/dist/lifecycle/package-paths.js +59 -56
  100. package/dist/lifecycle/persistent-state.d.ts +10 -1
  101. package/dist/lifecycle/persistent-state.js +4 -2
  102. package/dist/lifecycle/ports.d.ts +18 -6
  103. package/dist/lifecycle/resolve-agent-plugin-refs.d.ts +2 -14
  104. package/dist/lifecycle/retire-bundled.d.ts +1 -1
  105. package/dist/lifecycle/search-projection.d.ts +3 -1
  106. package/dist/lifecycle/search-projection.js +7 -3
  107. package/dist/lifecycle/search.d.ts +1 -0
  108. package/dist/lifecycle/seed-bundled.d.ts +86 -1
  109. package/dist/lifecycle/seed-bundled.js +48 -84
  110. package/dist/lifecycle/set-enabled.d.ts +1 -13
  111. package/dist/lifecycle/set-enabled.js +11 -7
  112. package/dist/lifecycle/trusted-plugin-files.d.ts +1 -1
  113. package/dist/lifecycle/trusted-plugin-files.js +33 -30
  114. package/dist/lifecycle/types.d.ts +13 -34
  115. package/dist/lifecycle/uninstall.d.ts +1 -33
  116. package/dist/lifecycle/update-store.d.ts +0 -7
  117. package/dist/lifecycle/update-store.js +1 -8
  118. package/dist/lifecycle/update.d.ts +1 -1
  119. package/dist/lifecycle/update.js +60 -10
  120. package/dist/lifecycle/yauzl-archive-reader.d.ts +7 -2
  121. package/dist/lifecycle/yauzl-archive-reader.js +11 -6
  122. package/dist/manifest.d.ts +4 -8
  123. package/dist/react/AgentPluginDetailsModal.d.ts +187 -0
  124. package/dist/react/AgentPluginDetailsModal.js +29 -0
  125. package/dist/react/agent-plugin-install-port.d.ts +24 -0
  126. package/dist/react/agent-plugin-install-port.js +15 -0
  127. package/dist/react/installed-skills-composer-source.d.ts +60 -0
  128. package/dist/react/installed-skills-composer-source.js +111 -0
  129. package/dist/react/use-agent-plugins.hooks.d.ts +211 -0
  130. package/dist/react/use-agent-plugins.hooks.js +128 -0
  131. package/dist/site/activation-effects.d.ts +17 -0
  132. package/dist/site/activation-effects.js +31 -0
  133. package/dist/site/admin-surfaces/capabilities.d.ts +29 -0
  134. package/dist/site/admin-surfaces/capabilities.js +30 -0
  135. package/dist/site/admin-surfaces/delivery-bindings.d.ts +81 -0
  136. package/dist/site/admin-surfaces/delivery-bindings.js +161 -0
  137. package/dist/site/admin-surfaces/forms.d.ts +28 -0
  138. package/dist/site/admin-surfaces/forms.js +29 -0
  139. package/dist/site/admin-surfaces/handlers.d.ts +61 -0
  140. package/dist/site/admin-surfaces/handlers.js +35 -0
  141. package/dist/site/admin-surfaces/public-config.d.ts +12 -0
  142. package/dist/site/admin-surfaces/public-config.js +28 -0
  143. package/dist/site/analytics-provider-registry.d.ts +87 -0
  144. package/dist/site/analytics-provider-registry.js +87 -0
  145. package/dist/site/archive-reader-abi.d.ts +35 -0
  146. package/dist/site/archive-reader-abi.js +25 -0
  147. package/dist/site/auth-schemes.d.ts +110 -0
  148. package/dist/site/auth-schemes.js +119 -0
  149. package/dist/site/automatic-agent-plugins.d.ts +200 -0
  150. package/dist/site/automatic-agent-plugins.js +277 -0
  151. package/dist/site/bundled-contribution-sources.d.ts +24 -0
  152. package/dist/site/bundled-contribution-sources.js +17 -0
  153. package/dist/site/bundled-id-upgrade.d.ts +115 -0
  154. package/dist/site/bundled-id-upgrade.js +169 -0
  155. package/dist/site/customize-tool.d.ts +39 -0
  156. package/dist/site/customize-tool.js +31 -0
  157. package/dist/site/deploy-split-activation.d.ts +28 -0
  158. package/dist/site/deploy-split-activation.js +21 -0
  159. package/dist/site/exports/diagnostics.d.ts +37 -0
  160. package/dist/site/exports/diagnostics.js +55 -0
  161. package/dist/site/exports/runtime.d.ts +54 -0
  162. package/dist/site/exports/runtime.js +196 -0
  163. package/dist/site/exports/source.d.ts +42 -0
  164. package/dist/site/exports/source.js +58 -0
  165. package/dist/site/host-plugin-guidance.d.ts +137 -0
  166. package/dist/site/host-plugin-guidance.js +223 -0
  167. package/dist/site/host-signals.d.ts +78 -0
  168. package/dist/site/host-signals.js +83 -0
  169. package/dist/site/install-tool.d.ts +69 -0
  170. package/dist/site/install-tool.js +192 -0
  171. package/dist/site/install-upload.d.ts +175 -0
  172. package/dist/site/install-upload.js +324 -0
  173. package/dist/site/memory-i18n.d.ts +5 -0
  174. package/dist/site/memory-i18n.js +176 -0
  175. package/dist/site/memory.d.ts +80 -0
  176. package/dist/site/memory.js +83 -0
  177. package/dist/site/plugin-memory.d.ts +80 -0
  178. package/dist/site/plugin-memory.js +86 -0
  179. package/dist/site/provider-plugin-link.d.ts +112 -0
  180. package/dist/site/provider-plugin-link.js +100 -0
  181. package/dist/site/retired-plugin-tool-aliases.d.ts +40 -0
  182. package/dist/site/retired-plugin-tool-aliases.js +41 -0
  183. package/dist/site/service-ports.d.ts +108 -0
  184. package/dist/site/service-ports.js +2 -0
  185. package/dist/site/set-enabled.d.ts +80 -0
  186. package/dist/site/set-enabled.js +42 -0
  187. package/dist/site/soon-lock.d.ts +83 -0
  188. package/dist/site/soon-lock.js +78 -0
  189. package/dist/site/supersession.d.ts +61 -0
  190. package/dist/site/supersession.js +122 -0
  191. package/dist/site/uninstall-tool.d.ts +136 -0
  192. package/dist/site/uninstall-tool.js +203 -0
  193. package/dist/site/update-effects.d.ts +47 -0
  194. package/dist/site/update-effects.js +49 -0
  195. package/ffmpeg-transcode/plugin.json +16 -0
  196. package/github/source-control/backup-push.mjs +66 -46
  197. package/github/source-control/commit-site.mjs +124 -67
  198. package/github/source-control/write-files.mjs +86 -53
  199. package/github-pages/targets/github-pages.mjs +294 -233
  200. package/google-workspace/form-destinations/mapping.mjs +15 -7
  201. package/google-workspace/form-destinations/sheets.mjs +4 -2
  202. package/google-workspace/plugin.json +1 -0
  203. package/kuinetic/CHANGELOG.md +4 -0
  204. package/kuinetic/plugin.json +4 -1
  205. package/kuinetic/skills/kuinetic/SKILL.md +1 -2
  206. package/package.json +297 -20
  207. package/persistent-state.d.ts +4 -1
  208. package/resend/adapters/resend.mjs +5 -2
  209. package/resend/plugin.json +1 -1
  210. package/s3-compatible/jini-deploy-targets.json +1 -1
  211. package/s3-compatible/object-stores/s3-compatible.mjs +27 -4
  212. package/s3-compatible/targets/s3-compatible.mjs +3 -3
  213. package/site-import/plugin.json +3 -3
  214. package/site-import/skills/site-import/SKILL.md +62 -54
  215. package/site-import/skills/site-import/references/content-mapping.md +26 -20
  216. package/slide-design/plugin.json +1 -1
  217. package/slide-design/skills/slide-design/SKILL.md +8 -2
  218. package/ui-ux-design/CHANGELOG.md +6 -0
  219. package/ui-ux-design/plugin.json +1 -1
  220. package/ui-ux-design/skills/gstack-design/SKILL.md +6 -6
  221. package/ui-ux-design/skills/ui-ux-design/SKILL.md +3 -2
  222. package/ui-ux-design/skills/ui-ux-design/references/chrome-mobile-test-matrix.md +14 -12
  223. package/ui-ux-design/skills/ui-ux-design/references/ui-loop.md +16 -17
  224. package/vercel/NOTES.md +2 -1
  225. package/vercel/object-stores/vercel-blob.mjs +3 -4
  226. package/vercel/targets/vercel.mjs +425 -351
  227. package/core/commerce-server.d.ts +0 -2
  228. package/core/commerce-server.mjs +0 -2
  229. package/dist/admin-surfaces/connections/ports.d.ts +0 -110
  230. package/dist/admin-surfaces/connections/ports.js +0 -2
  231. /package/dist/{lifecycle → core}/install-errors.d.ts +0 -0
  232. /package/dist/{lifecycle → core}/install-errors.js +0 -0
  233. /package/dist/{lifecycle → core}/update-plan.js +0 -0
@@ -3,10 +3,13 @@ import { parsePluginCredentialCards } from '../lifecycle/credential-card-metadat
3
3
  // Declaration parsing stays here; the host binds trusted contributions and mail-card precedence.
4
4
  export { parsePluginCredentialCards, parseCredentialCardUsedFor } from '../lifecycle/credential-card-metadata.js';
5
5
  /** Reuse Jini's active, trusted-package gate and contained manifest read. */
6
- export const credentialCardsContribution = {
7
- filename: 'plugin.json', contribution: 'credential cards', kind: 'data',
8
- parse: input => parsePluginCredentialCards(input), load: ({ descriptor, plugin }) => ({ ...descriptor, pluginId: plugin.pluginId }),
9
- };
6
+ export function createCredentialCardsContribution(required, _optional = {}) {
7
+ return {
8
+ filename: 'plugin.json', contribution: 'credential cards', kind: 'data',
9
+ parse: input => parsePluginCredentialCards(input, required), load: ({ descriptor, plugin }) => ({ ...descriptor, pluginId: plugin.pluginId }),
10
+ };
11
+ }
12
+ export const credentialCardsContribution = createCredentialCardsContribution({});
10
13
  /** Preserve mail objects and ordering; duplicate targets retain mail priority, while conflicting
11
14
  * API label owners are all refused. O(cards) time and space; no persistent ownership registry.
12
15
  */
@@ -1,6 +1,6 @@
1
1
  import { ToolInputError, describeErrorForLog, redactSecrets } from '@jini-ai/core';
2
2
  import { createApplyConnectDefaults } from "./apply-connect-defaults.js";
3
- import { hasStoredAgentPluginCredential } from "./connect-tool.js";
3
+ import { hasStoredAgentPluginCredential } from "./catalog.js";
4
4
  import { deriveAgentPluginConnectionId } from "./federate-mcp.js";
5
5
  /** Bind the existing sign-in grant to its explicit approval occasion; test ports retain precedence.
6
6
  * @complexity O(1) construction, no I/O.
@@ -0,0 +1,32 @@
1
+ import type { AgentPluginLayout } from "@jini-ai/core/contracts/headless/plugin-host";
2
+ import type { ConnectDeps } from "./contracts.js";
3
+ import type { AgentPluginMcpProjectionPorts } from "./ports.js";
4
+ import type { AgentPluginMcpContext } from "../site/service-ports.js";
5
+ export declare function resolveAgentPluginConnectRedirectUri({ configuredOrigin, derivedOrigin, serverId, callbackPath }: {
6
+ configuredOrigin: string | undefined;
7
+ derivedOrigin: string | undefined;
8
+ serverId: string;
9
+ callbackPath: string;
10
+ }, _optional?: {}): string | undefined;
11
+ /** Old deps -> portable deps: projections bound once (same pair/identity rule as the host shims), the
12
+ * activation/installed defaults read lazily exactly as the pre-seam body did. Getters stay lazy:
13
+ * `routeDeps.mcp` is first read on first use, i.e. after the permission check, as before the seam. */
14
+ export declare function createAgentPluginConnectDeps(required: {
15
+ host: ConnectDeps["host"];
16
+ isPluginEnabled: (required: {
17
+ workspaceRoot: string;
18
+ pluginId: string;
19
+ }) => Promise<boolean>;
20
+ resolveInstalledPlugin: (required: {
21
+ workspaceId: string;
22
+ pluginId: string;
23
+ agentPluginLayout: AgentPluginLayout;
24
+ }) => ReturnType<ConnectDeps["resolveInstalledPlugin"]>;
25
+ projectMcp(context: Omit<ConnectDeps["mcp"], keyof AgentPluginMcpProjectionPorts> & AgentPluginMcpContext): ConnectDeps["mcp"];
26
+ }, _optional?: {}): (routeDeps: Omit<ConnectDeps, "host" | "isPluginEnabled" | "resolveInstalledPlugin" | "mcp"> & {
27
+ agentPluginLayout: AgentPluginLayout;
28
+ isPluginEnabled?: ConnectDeps["isPluginEnabled"];
29
+ resolveInstalledPlugin?: ConnectDeps["resolveInstalledPlugin"];
30
+ mcp: Omit<ConnectDeps["mcp"], keyof AgentPluginMcpProjectionPorts> & AgentPluginMcpContext;
31
+ }, _optional?: {}) => ConnectDeps;
32
+ //# sourceMappingURL=host-deps.d.ts.map
@@ -0,0 +1,35 @@
1
+ export function resolveAgentPluginConnectRedirectUri({ configuredOrigin, derivedOrigin, serverId, callbackPath }, _optional = {}) {
2
+ const configured = configuredOrigin?.trim();
3
+ let origin;
4
+ if (configured) {
5
+ try {
6
+ const url = new URL(configured);
7
+ // `URL.origin` is the string "null" for a non-http(s) scheme — never a usable redirect origin.
8
+ origin = url.protocol === "http:" || url.protocol === "https:" ? url.origin : undefined;
9
+ }
10
+ catch {
11
+ origin = undefined;
12
+ }
13
+ }
14
+ origin ??= derivedOrigin || undefined;
15
+ if (!origin)
16
+ return undefined;
17
+ return `${origin}${callbackPath}/${encodeURIComponent(serverId)}`;
18
+ }
19
+ /** Old deps -> portable deps: projections bound once (same pair/identity rule as the host shims), the
20
+ * activation/installed defaults read lazily exactly as the pre-seam body did. Getters stay lazy:
21
+ * `routeDeps.mcp` is first read on first use, i.e. after the permission check, as before the seam. */
22
+ export function createAgentPluginConnectDeps(required, _optional = {}) {
23
+ return (routeDeps, _optional = {}) => {
24
+ let mcp;
25
+ const deps = Object.assign(Object.defineProperties({}, Object.getOwnPropertyDescriptors(routeDeps)), {
26
+ isPluginEnabled: (pluginId) => routeDeps.isPluginEnabled ? routeDeps.isPluginEnabled(pluginId)
27
+ : required.isPluginEnabled({ workspaceRoot: routeDeps.agentPluginLayout.forWorkspace({ workspaceId: routeDeps.workspaceId }).root, pluginId }),
28
+ resolveInstalledPlugin: (pluginId) => routeDeps.resolveInstalledPlugin ? routeDeps.resolveInstalledPlugin(pluginId)
29
+ : required.resolveInstalledPlugin({ workspaceId: routeDeps.workspaceId, pluginId, agentPluginLayout: routeDeps.agentPluginLayout }),
30
+ host: required.host,
31
+ });
32
+ return Object.defineProperty(deps, "mcp", { get: () => (mcp ??= required.projectMcp(routeDeps.mcp)), enumerable: true, configurable: true });
33
+ };
34
+ }
35
+ //# sourceMappingURL=host-deps.js.map
@@ -1,6 +1,6 @@
1
1
  import { resolveTarget, saveStaticAccessToken } from "./access-token-tool.js";
2
2
  import { describeErrorForLog } from "@jini-ai/core";
3
- import { hasStoredAgentPluginCredential } from "./connect-tool.js";
3
+ import { hasStoredAgentPluginCredential } from "./catalog.js";
4
4
  /**
5
5
  * Seals `token` onto `pluginId`'s token-auth row unless that row already has a credential, then
6
6
  * switches the plugin on (also when it already had one, to finish an earlier interrupted import).
@@ -1,6 +1,6 @@
1
1
  export { createCredentialSaveTools, type CredentialSaveMessages, type CredentialSaveAdapters } from './credential-save-tool.js';
2
2
  export { createPluginCredentialCardOperations, findPluginCredentialCard, loadPluginCredentialCardsSafely, type LoadPluginCredentialCards, type PluginCredentialCardPorts } from './plugin-credential-card.js';
3
- export { parsePluginCredentialCards, parseCredentialCardUsedFor, credentialCardsContribution, mergePluginCredentialCards } from './credential-cards.js';
3
+ export { parsePluginCredentialCards, parseCredentialCardUsedFor, createCredentialCardsContribution, credentialCardsContribution, mergePluginCredentialCards } from './credential-cards.js';
4
4
  export * from './ports.js';
5
5
  export * from './federate-mcp.js';
6
6
  export * from './enable-access.js';
@@ -11,10 +11,15 @@ export * from './connect-card-ui.js';
11
11
  export * from './connect-destination.js';
12
12
  export * from './connect-sign-in-wait.js';
13
13
  export * from './connect-tool.js';
14
+ export type { ResolvedAgentPluginForConnect } from './installed-plugin.js';
15
+ export { agentPluginConnectAgentToolCatalogFor, agentPluginConnectDerivedRiskFor, hasStoredAgentPluginCredential } from './catalog.js';
16
+ export type { AgentPluginConnectSignInPort, AgentPluginConnectApiConnectionsPort, AgentPluginConnectApprovalsPort, AgentPluginAccessApprovalDescription, AgentPluginConnectMessages, AgentPluginConnectHost, AgentPluginConnectDeps, AgentPluginConnectOptions, AgentPluginConnectResult } from './contracts.js';
14
17
  export * from './access-token-tool.js';
15
18
  export * from './token-sign-in.js';
16
- export * from './token-map.js';
19
+ export { listTokenSignInPlugins } from '../core/token-sign-in-list.js';
20
+ export * from '../core/token-map.js';
17
21
  export * from './import-access-token.js';
18
22
  export * from './grant-signed-in-defaults.js';
19
23
  export * from './apply-tool-renames.js';
24
+ export { titleCaseFromPluginId } from '../core/plugin-display-name.js';
20
25
  //# sourceMappingURL=index.d.ts.map
@@ -1,6 +1,6 @@
1
1
  export { createCredentialSaveTools } from './credential-save-tool.js';
2
2
  export { createPluginCredentialCardOperations, findPluginCredentialCard, loadPluginCredentialCardsSafely } from './plugin-credential-card.js';
3
- export { parsePluginCredentialCards, parseCredentialCardUsedFor, credentialCardsContribution, mergePluginCredentialCards } from './credential-cards.js';
3
+ export { parsePluginCredentialCards, parseCredentialCardUsedFor, createCredentialCardsContribution, credentialCardsContribution, mergePluginCredentialCards } from './credential-cards.js';
4
4
  export * from './ports.js';
5
5
  export * from './federate-mcp.js';
6
6
  export * from './enable-access.js';
@@ -11,10 +11,13 @@ export * from './connect-card-ui.js';
11
11
  export * from './connect-destination.js';
12
12
  export * from './connect-sign-in-wait.js';
13
13
  export * from './connect-tool.js';
14
+ export { agentPluginConnectAgentToolCatalogFor, agentPluginConnectDerivedRiskFor, hasStoredAgentPluginCredential } from './catalog.js';
14
15
  export * from './access-token-tool.js';
15
16
  export * from './token-sign-in.js';
16
- export * from './token-map.js';
17
+ export { listTokenSignInPlugins } from '../core/token-sign-in-list.js';
18
+ export * from '../core/token-map.js';
17
19
  export * from './import-access-token.js';
18
20
  export * from './grant-signed-in-defaults.js';
19
21
  export * from './apply-tool-renames.js';
22
+ export { titleCaseFromPluginId } from '../core/plugin-display-name.js';
20
23
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,28 @@
1
+ import type { parsePluginCredentialCards } from './credential-cards.js';
2
+ import type { AgentPluginInstalledMcpReads } from './federate-mcp.js';
3
+ import type { createAgentPluginLifecycle } from '../lifecycle/index.js';
4
+ import type { AgentPluginLayout } from '@jini-ai/core/contracts/headless/plugin-host';
5
+ import type { PluginCredentialCard } from '@jini-ai/core/contracts/credentials';
6
+ import type { McpServerConfig } from '../lifecycle/manifest.js';
7
+ /** One installed plugin's declared MCP servers — the slice `agent_plugin_connect` needs. Kept
8
+ * narrower than `InstalledAgentPlugin` (no version/keywords/skills: this tool cares only about
9
+ * what it can connect). */
10
+ /** @agent-note A fresh trusted installed declaration from your lifecycle owner, shared with
11
+ * provisioning/approval. Credential cards contain safe display copy, never saved credentials. */
12
+ export interface ResolvedAgentPluginForConnect {
13
+ readonly credentialCards?: readonly PluginCredentialCard[];
14
+ readonly servers: Readonly<Record<string, McpServerConfig>>;
15
+ }
16
+ /** The real, on-disk resolution — the SAME walk `federate-mcp.ts`'s `resolveAgentPluginMcpServers`
17
+ * performs, restated here rather than imported so this tool does not need to import a second
18
+ * plugin's worth of exports just to reach the one function; both read `mcp.json` off the winning
19
+ * (bundled-preferred) installed digest for a pluginId. Returns `null` for a pluginId not installed
20
+ * in this workspace. */
21
+ export declare function resolveInstalledAgentPlugin(input: {
22
+ workspaceId: string;
23
+ pluginId: string;
24
+ agentPluginLayout: AgentPluginLayout;
25
+ parseCredentialCards: typeof parsePluginCredentialCards;
26
+ lifecycle: AgentPluginInstalledMcpReads & Pick<ReturnType<typeof createAgentPluginLifecycle>, "readTrustedPluginFile">;
27
+ }, _options?: {}): Promise<ResolvedAgentPluginForConnect | null>;
28
+ //# sourceMappingURL=installed-plugin.d.ts.map
@@ -0,0 +1,19 @@
1
+ /** The real, on-disk resolution — the SAME walk `federate-mcp.ts`'s `resolveAgentPluginMcpServers`
2
+ * performs, restated here rather than imported so this tool does not need to import a second
3
+ * plugin's worth of exports just to reach the one function; both read `mcp.json` off the winning
4
+ * (bundled-preferred) installed digest for a pluginId. Returns `null` for a pluginId not installed
5
+ * in this workspace. */
6
+ export async function resolveInstalledAgentPlugin(input, _options = {}) {
7
+ const { listInstalledPlugins, readBundledAgentPluginDigests, preferBundledAgentPluginDigests, readTrustedPluginFile, readInstalledMcpServers } = input.lifecycle;
8
+ const workspaceLayout = input.agentPluginLayout.forWorkspace({ workspaceId: input.workspaceId });
9
+ const installed = preferBundledAgentPluginDigests({
10
+ installed: await listInstalledPlugins({ workspaceRoot: workspaceLayout.root }),
11
+ bundled: await readBundledAgentPluginDigests({ workspaceRoot: workspaceLayout.root }),
12
+ });
13
+ const plugin = installed.find((candidate) => candidate.pluginId === input.pluginId);
14
+ if (!plugin)
15
+ return null;
16
+ const cards = input.parseCredentialCards({ raw: await readTrustedPluginFile({ plugin, filename: "plugin.json" }) });
17
+ return { servers: await readInstalledMcpServers({ packageRoot: plugin.packageRoot }), credentialCards: cards.ok ? cards.descriptors : [] };
18
+ }
19
+ //# sourceMappingURL=installed-plugin.js.map
@@ -0,0 +1,88 @@
1
+ import type { Dirent } from "node:fs";
2
+ import { type TokenMapLimits } from "../core/token-map.js";
3
+ import type { TokenCheckOutcome, TokenSignInPlugin } from "./token-sign-in.js";
4
+ import type { ResolvedAgentPluginForConnect } from "./installed-plugin.js";
5
+ import type { createAgentPluginLifecycle } from "../lifecycle/index.js";
6
+ import type { InstalledAgentPluginServers } from "./import-access-token.js";
7
+ /**
8
+ * @file The rules for access tokens given while CREATING a site, shared by every create path: the
9
+ * admin's `POST .../system/sites` (`routes/system/sites.ts`) and the host CLI's create command
10
+ * (`cli/commands/init.ts`, which the desktop app's "Create website" runs). Added 2026-09-29 so the
11
+ * desktop create form offers the same optional "Connect services" step as the admin's.
12
+ *
13
+ * Generic: keyed by plugin id; a plugin qualifies by declaring `tokenAuth` (`token-sign-in.ts`).
14
+ * Nothing here ever returns or logs a token.
15
+ */
16
+ /**
17
+ * `{ [pluginId]: token }`, trimmed, blanks dropped. `null`/`undefined` is "none given".
18
+ * @complexity O(n) in the entry count (bounded).
19
+ */
20
+ export declare function parseNewSiteAgentPluginTokens({ raw, limits: TOKEN_LIMITS, shapeError: NEW_SITE_AGENT_PLUGIN_TOKENS_SHAPE_ERROR }: {
21
+ raw: unknown;
22
+ limits: TokenMapLimits;
23
+ shapeError: string;
24
+ }, _optional?: Record<string, never>): {
25
+ ok: true;
26
+ tokens: Record<string, string>;
27
+ } | {
28
+ ok: false;
29
+ error: string;
30
+ };
31
+ /** Why a token given at create time stops the create, or `null` when it may be stored. A token the
32
+ * vendor could not be reached to check is still stored: the new site's first use tells. */
33
+ export declare function describeNewSiteAgentPluginTokenRefusal({ pluginId, outcome, copy }: {
34
+ pluginId: string;
35
+ outcome: TokenCheckOutcome;
36
+ copy: Record<"refused" | "invalid" | "unsupported", (input: {
37
+ name: string;
38
+ }) => string>;
39
+ }, _optional?: Record<string, never>): {
40
+ code: "AGENT_PLUGIN_TOKEN_INVALID" | "AGENT_PLUGIN_TOKEN_REFUSED" | "AGENT_PLUGIN_TOKEN_UNSUPPORTED";
41
+ error: string;
42
+ } | null;
43
+ /**
44
+ * The first refusal across `tokens`, checked in order, or `null` when every token may be stored.
45
+ * @complexity One check (at most one outbound GET) per token.
46
+ */
47
+ export declare function firstNewSiteAgentPluginTokenRefusal({ check, tokens, copy }: {
48
+ copy: Parameters<typeof describeNewSiteAgentPluginTokenRefusal>[0]["copy"];
49
+ check: (input: {
50
+ pluginId: string;
51
+ token: string;
52
+ }) => Promise<TokenCheckOutcome>;
53
+ tokens: Readonly<Record<string, string>>;
54
+ }, _optional?: Record<string, never>): Promise<{
55
+ pluginId: string;
56
+ code: string;
57
+ error: string;
58
+ } | null>;
59
+ /**
60
+ * The bundled plugins shipped with this host (`content/agent-plugins/`, `deps.ts`'s
61
+ * `bundledAgentPluginsDir()`), for a create path that runs before the new site has a workspace to
62
+ * install them into — the new site's first boot seeds exactly these. An absent dir is an empty list.
63
+ * The host supplies its bundled-source override, else `<product>/content/agent-plugins`;
64
+ * importing composition here would pull its whole server graph into a feature for one path.
65
+ *
66
+ * @complexity O(p) plugin dirs, one manifest and one `mcp.json` read each.
67
+ */
68
+ export declare function listBundledAgentPluginServers(required: {
69
+ bundledSourceRoot: string;
70
+ retired: Pick<ReadonlySet<string>, 'has'>;
71
+ pluginIdPattern: RegExp;
72
+ readdir(path: string, options: {
73
+ withFileTypes: true;
74
+ }): Promise<Dirent[]>;
75
+ readFile(path: string, encoding: 'utf8'): Promise<string>;
76
+ readInstalledMcpServers: ReturnType<typeof createAgentPluginLifecycle>['readInstalledMcpServers'];
77
+ }, _optional?: {}): Promise<readonly InstalledAgentPluginServers[]>;
78
+ /** `checkAgentPluginAccessToken`'s `resolveInstalledPlugin`, answered from the bundled plugins. */
79
+ export declare function resolveBundledAgentPlugin(paths: Parameters<typeof listBundledAgentPluginServers>[0], _optional?: {}): (pluginId: string) => Promise<ResolvedAgentPluginForConnect | null>;
80
+ /**
81
+ * The plugins a NEW site can be connected to with a pasted token: the bundled ones its first boot
82
+ * seeds. Not the creating site's installs — a plugin only that site has would be offered, pass the
83
+ * check, and then never exist on the new site.
84
+ *
85
+ * @complexity O(p) bundled plugin dirs.
86
+ */
87
+ export declare function listNewSiteAgentPluginTokenSignInPlugins(paths: Parameters<typeof listBundledAgentPluginServers>[0], _optional?: {}): Promise<readonly TokenSignInPlugin[]>;
88
+ //# sourceMappingURL=new-site-agent-plugin-tokens.d.ts.map
@@ -0,0 +1,107 @@
1
+ import path from "node:path";
2
+ import { parsePluginTokenMap } from "../core/token-map.js";
3
+ import { orFallback } from "@jini-ai/core/errors/idioms";
4
+ import { titleCaseFromPluginId } from "../core/plugin-display-name.js";
5
+ import { listTokenSignInPlugins } from "../core/token-sign-in-list.js";
6
+ /**
7
+ * @file The rules for access tokens given while CREATING a site, shared by every create path: the
8
+ * admin's `POST .../system/sites` (`routes/system/sites.ts`) and the host CLI's create command
9
+ * (`cli/commands/init.ts`, which the desktop app's "Create website" runs). Added 2026-09-29 so the
10
+ * desktop create form offers the same optional "Connect services" step as the admin's.
11
+ *
12
+ * Generic: keyed by plugin id; a plugin qualifies by declaring `tokenAuth` (`token-sign-in.ts`).
13
+ * Nothing here ever returns or logs a token.
14
+ */
15
+ /**
16
+ * `{ [pluginId]: token }`, trimmed, blanks dropped. `null`/`undefined` is "none given".
17
+ * @complexity O(n) in the entry count (bounded).
18
+ */
19
+ export function parseNewSiteAgentPluginTokens({ raw, limits: TOKEN_LIMITS, shapeError: NEW_SITE_AGENT_PLUGIN_TOKENS_SHAPE_ERROR }, _optional = {}) {
20
+ const parsed = parsePluginTokenMap({ raw, limits: TOKEN_LIMITS }, {});
21
+ return parsed.ok ? { ok: true, tokens: { ...parsed.tokens } } : { ok: false, error: NEW_SITE_AGENT_PLUGIN_TOKENS_SHAPE_ERROR };
22
+ }
23
+ /** Why a token given at create time stops the create, or `null` when it may be stored. A token the
24
+ * vendor could not be reached to check is still stored: the new site's first use tells. */
25
+ export function describeNewSiteAgentPluginTokenRefusal({ pluginId, outcome, copy }, _optional = {}) {
26
+ const name = titleCaseFromPluginId({ pluginId });
27
+ // A purpose refusal must still stop a pre-save check, without mislabelling a usable key.
28
+ if (outcome === "refused") {
29
+ return { code: "AGENT_PLUGIN_TOKEN_REFUSED", error: copy.refused({ name }) };
30
+ }
31
+ if (outcome === "invalid") {
32
+ return { code: "AGENT_PLUGIN_TOKEN_INVALID", error: copy.invalid({ name }) };
33
+ }
34
+ if (outcome === "unsupported") {
35
+ return { code: "AGENT_PLUGIN_TOKEN_UNSUPPORTED", error: copy.unsupported({ name }) };
36
+ }
37
+ return null;
38
+ }
39
+ /**
40
+ * The first refusal across `tokens`, checked in order, or `null` when every token may be stored.
41
+ * @complexity One check (at most one outbound GET) per token.
42
+ */
43
+ export async function firstNewSiteAgentPluginTokenRefusal({ check, tokens, copy }, _optional = {}) {
44
+ for (const [pluginId, token] of Object.entries(tokens)) {
45
+ const refusal = describeNewSiteAgentPluginTokenRefusal({ pluginId, outcome: await check({ pluginId, token }), copy });
46
+ if (refusal)
47
+ return { pluginId, ...refusal };
48
+ }
49
+ return null;
50
+ }
51
+ /** The plugin's manifest `name`, or `null` when `plugin.json` is missing or unreadable. */
52
+ async function readBundledPluginId({ pluginDir, readFile, pluginIdPattern: PLUGIN_ID_PATTERN }, _optional = {}) {
53
+ return orFallback({
54
+ work: async () => {
55
+ const manifest = JSON.parse(await readFile(path.join(pluginDir, "plugin.json"), "utf8"));
56
+ return typeof manifest.name === "string" && PLUGIN_ID_PATTERN.test(manifest.name) ? manifest.name : null;
57
+ },
58
+ fallback: null,
59
+ step: "read bundled token plugin ID",
60
+ });
61
+ }
62
+ /**
63
+ * The bundled plugins shipped with this host (`content/agent-plugins/`, `deps.ts`'s
64
+ * `bundledAgentPluginsDir()`), for a create path that runs before the new site has a workspace to
65
+ * install them into — the new site's first boot seeds exactly these. An absent dir is an empty list.
66
+ * The host supplies its bundled-source override, else `<product>/content/agent-plugins`;
67
+ * importing composition here would pull its whole server graph into a feature for one path.
68
+ *
69
+ * @complexity O(p) plugin dirs, one manifest and one `mcp.json` read each.
70
+ */
71
+ export async function listBundledAgentPluginServers(required, _optional = {}) {
72
+ const { bundledSourceRoot: sourceRoot, retired: RETIRED_BUNDLED_AGENT_PLUGINS, readdir, readInstalledMcpServers } = required;
73
+ const entries = await orFallback({
74
+ work: () => readdir(sourceRoot, { withFileTypes: true }),
75
+ fallback: [],
76
+ step: "list bundled token plugins",
77
+ });
78
+ const out = [];
79
+ for (const entry of entries) {
80
+ // Same skip as `seed-bundled.ts`: a retired id is never seeded, so it is never offered.
81
+ if (!entry.isDirectory() || RETIRED_BUNDLED_AGENT_PLUGINS.has(entry.name))
82
+ continue;
83
+ const pluginDir = path.join(sourceRoot, entry.name);
84
+ const pluginId = await readBundledPluginId({ pluginDir, readFile: required.readFile, pluginIdPattern: required.pluginIdPattern });
85
+ if (pluginId !== null)
86
+ out.push({ pluginId, servers: await readInstalledMcpServers({ packageRoot: pluginDir }) });
87
+ }
88
+ return out;
89
+ }
90
+ /** `checkAgentPluginAccessToken`'s `resolveInstalledPlugin`, answered from the bundled plugins. */
91
+ export function resolveBundledAgentPlugin(paths, _optional = {}) {
92
+ return async (pluginId) => {
93
+ const found = (await listBundledAgentPluginServers(paths)).find((plugin) => plugin.pluginId === pluginId);
94
+ return found ? { servers: found.servers } : null;
95
+ };
96
+ }
97
+ /**
98
+ * The plugins a NEW site can be connected to with a pasted token: the bundled ones its first boot
99
+ * seeds. Not the creating site's installs — a plugin only that site has would be offered, pass the
100
+ * check, and then never exist on the new site.
101
+ *
102
+ * @complexity O(p) bundled plugin dirs.
103
+ */
104
+ export function listNewSiteAgentPluginTokenSignInPlugins(paths, _optional = {}) {
105
+ return listTokenSignInPlugins({ workspaceId: "new-site", listPlugins: () => listBundledAgentPluginServers(paths) });
106
+ }
107
+ //# sourceMappingURL=new-site-agent-plugin-tokens.js.map
@@ -8,12 +8,11 @@ import type { Clock } from "@jini-ai/core/primitives";
8
8
  import { type AccessApprovalResource } from '@jini-ai/core';
9
9
  import type { Logger } from '@jini-ai/core/primitives';
10
10
  import { readPluginIdentity, type PluginIdentityCandidate, type PluginLookupPort } from '@jini-ai/core/plugin-directory';
11
- import type { InstalledAgentPlugin } from '../../lifecycle/types.js';
12
- import type { SetAgentPluginEnabledInput, SetAgentPluginEnabledResult } from '../../lifecycle/set-enabled.js';
13
11
  import { provisionAgentPluginMcpServers, resolveAgentPluginMcpServers, type AgentPluginInstalledMcpReads, type AgentPluginMcpTrustClassifier } from '../federate-mcp.js';
14
12
  import { type AgentPluginEnableAccessMessages } from '../enable-access.js';
15
13
  import type { AgentPluginMcpPort, AgentPluginMcpProjectionPorts } from '../ports.js';
16
14
  import type { McpServerConfig } from '../../lifecycle/manifest.js';
15
+ import type { InstalledAgentPlugin, SetAgentPluginEnabledInput, SetAgentPluginEnabledResult } from "@jini-ai/core/contracts/site/agent-plugins-lifecycle";
17
16
  type AgentPluginLayoutInput = Parameters<typeof resolveAgentPluginMcpServers>[0]['agentPluginLayout'];
18
17
  type ProvisioningFailure = Awaited<ReturnType<typeof provisionAgentPluginMcpServers>>['failed'][number];
19
18
  /** The one discovery field set the host decisions read; a narrow local copy so the portable host
@@ -99,6 +98,7 @@ export interface PluginHostDeps<UninstallInput, Layout extends AgentPluginLayout
99
98
  /** @agent-note Your app's id; it is the namespace of every plugin identity this host reads and
100
99
  * admits, so it must not change between installs. */
101
100
  readonly namespace: string;
101
+ readonly legacySiteIdentityNamespace?: string;
102
102
  /** @agent-note Provider: the site-runtime plugin discovery owner. Metadata only, fresh per call. */
103
103
  readonly discoverPlugins: () => Promise<readonly PluginHostDiscoveryRecord[]>;
104
104
  /** @agent-note Provider: the site-runtime activation repo point read (same repo the runtime uses). */
@@ -29,7 +29,7 @@ async function listSiteProviders({ deps, forAdmission }) {
29
29
  }
30
30
  let parsed;
31
31
  try {
32
- parsed = readPluginIdentity({ manifest: record.manifest, name: record.id, namespace: deps.namespace });
32
+ parsed = readPluginIdentity({ manifest: record.manifest, name: record.id, namespace: deps.namespace, legacyNamespace: deps.legacySiteIdentityNamespace });
33
33
  }
34
34
  catch {
35
35
  warn(`Plugin '${record.id}': installed identity manifest is unreadable or invalid; omitted from metadata lookup.`);
@@ -113,17 +113,26 @@ async function provisionPluginMcp({ deps, optional, pluginId, principalId, execu
113
113
  }, { skipServerKeys: result.failed.map(failure => failure.serverKey), ...(approvedEnable ? { approvedEnable } : {}) });
114
114
  }
115
115
  catch (error) {
116
- const detail = describeErrorForLog({ err: error });
117
- if (execution.approvedEnable)
118
- throw new ToolInputError({ message: redactSecrets({ input: deps.messages.approvedLoadFailed({ detail }) }) });
119
- // An injected reporter receives the caught value itself; the default channel logs its class only.
120
- const logger = deps.report;
121
- if (logger)
122
- logger.warn({ message: `Plugin '${pluginId}': MCP provisioning could not run.` }, { error });
123
- else
124
- warn(redactSecrets({ input: `Plugin '${pluginId}': MCP provisioning could not run — ${detail}` }));
116
+ handleProvisioningError({ deps, pluginId, approved: execution.approvedEnable === true, error });
125
117
  }
126
118
  }
119
+ /** An approved enable refuses to the owner; otherwise provisioning stays best-effort and only warns. */
120
+ function handleProvisioningError({ deps, pluginId, approved, error }, _optional = {}) {
121
+ // A ToolInputError here is one of our own deliberate, owner-facing refusals (missing snapshot, the
122
+ // failed server and its redacted reason, the grant owner's "changed after approval"): its message
123
+ // already says what to do, so the generic load failure below must not replace it with a class name.
124
+ if (approved && error instanceof ToolInputError)
125
+ throw error;
126
+ const detail = describeErrorForLog({ err: error });
127
+ if (approved)
128
+ throw new ToolInputError({ message: redactSecrets({ input: deps.messages.approvedLoadFailed({ detail }) }) });
129
+ // An injected reporter receives the caught value itself; the default channel logs its class only.
130
+ const { report: logger, warn } = deps;
131
+ if (logger)
132
+ logger.warn({ message: `Plugin '${pluginId}': MCP provisioning could not run.` }, { error });
133
+ else
134
+ warn(redactSecrets({ input: `Plugin '${pluginId}': MCP provisioning could not run — ${detail}` }));
135
+ }
127
136
  /** Bind both plugin families to one workspace. Read manifests through the same installed-package
128
137
  * index.
129
138
  * @throws Unreadable activation (fail closed).
@@ -1,6 +1,5 @@
1
1
  import { type AgentPluginTokenCredentialsPort, type AgentPluginTokenValidator } from "./access-token-tool.js";
2
- import { type ResolvedAgentPluginForConnect } from "./connect-tool.js";
3
- import type { McpServerConfig } from "../lifecycle/manifest.js";
2
+ import type { ResolvedAgentPluginForConnect } from "./installed-plugin.js";
4
3
  /**
5
4
  * @file Which installed Agent Plugins can be connected with a pasted access token, and a check of one
6
5
  * token before anything is saved — for create-site onboarding, which offers "connect <plugin> now"
@@ -16,18 +15,6 @@ export interface TokenSignInPlugin {
16
15
  /** Where the person creates a token (the plugin's own `tokenAuth.helpUrl`). */
17
16
  readonly helpUrl: string;
18
17
  }
19
- /**
20
- * The installed plugins that take a pasted token, sorted by id.
21
- * @complexity O(p·s) over installed plugins and their servers.
22
- */
23
- export declare function listTokenSignInPlugins(required: {
24
- readonly workspaceId: string;
25
- /** @agent-note Second host: your installed-plugin read (declared servers per plugin id); no filesystem default here. */
26
- readonly listPlugins: (workspaceId: string) => Promise<readonly {
27
- readonly pluginId: string;
28
- readonly servers: Readonly<Record<string, McpServerConfig>>;
29
- }[]>;
30
- }, _optional?: Record<string, never>): Promise<readonly TokenSignInPlugin[]>;
31
18
  /** @agent-note The host validator/probe decides this bounded safe outcome. No token, response body
32
19
  * or provider fault text is returned or persisted by the check. */
33
20
  export type TokenCheckOutcome = "ok" | "invalid" | "refused" | "unavailable" | "unsupported";
@@ -1,26 +1,5 @@
1
+ import { soleTokenAuth } from "../core/token-sign-in-list.js";
1
2
  import { probeToken } from "./access-token-tool.js";
2
- import { titleCaseFromPluginId } from "./connect-tool.js";
3
- /** The plugin's one token-auth declaration, or `null` for none or more than one (the same rule
4
- * `agent_plugin_set_access_token` refuses on). */
5
- function soleTokenAuth(servers) {
6
- const declared = Object.values(servers).flatMap((config) => (config.type !== "stdio" && config.tokenAuth ? [config.tokenAuth] : []));
7
- // Exactly one element was just checked, so `declared[0]` is present; the cast only narrows the
8
- // index type (no fallback branch can ever run).
9
- return declared.length === 1 ? declared[0] : null;
10
- }
11
- /**
12
- * The installed plugins that take a pasted token, sorted by id.
13
- * @complexity O(p·s) over installed plugins and their servers.
14
- */
15
- export async function listTokenSignInPlugins(required, _optional = {}) {
16
- const plugins = await required.listPlugins(required.workspaceId);
17
- return plugins
18
- .flatMap(({ pluginId, servers }) => {
19
- const auth = soleTokenAuth(servers);
20
- return auth ? [{ pluginId, displayName: titleCaseFromPluginId({ pluginId }), helpUrl: auth.helpUrl }] : [];
21
- })
22
- .sort((a, b) => a.pluginId.localeCompare(b.pluginId));
23
- }
24
3
  /**
25
4
  * Checks `token` against the plugin's declared probe URL (one GET; 401/403 refused). Never throws,
26
5
  * never returns or logs the token. `unsupported`: the plugin is not installed or takes no token.
@@ -38,6 +17,8 @@ export async function checkAgentPluginAccessToken(required, _optional = {}) {
38
17
  const auth = plugin ? soleTokenAuth(plugin.servers) : null;
39
18
  if (!auth)
40
19
  return "unsupported";
41
- return probeToken({ probeUrl: auth.probeUrl, token: input.token, credentials: deps.credentials, tokenValidator: deps.tokenValidator });
20
+ // A probe/credential fault (e.g. a closed socket) is an unreachable check, not a thrown error.
21
+ return probeToken({ probeUrl: auth.probeUrl, token: input.token, credentials: deps.credentials, tokenValidator: deps.tokenValidator })
22
+ .catch(() => "unavailable");
42
23
  }
43
24
  //# sourceMappingURL=token-sign-in.js.map
@@ -0,0 +1,10 @@
1
+ import type { AgentPluginExport } from "@jini-ai/core/contracts/site/agent-plugins-manifest";
2
+ export type Entry = Readonly<Record<string, unknown>>;
3
+ /** Save and render share the existing bounded schema/value policy; messages never echo prop values.
4
+ * @returns First validation reason, or null on success. No side effects. @complexity O(p) prop values.
5
+ */
6
+ export declare function validateAgentPluginExportProps({ definition, props }: {
7
+ readonly definition: AgentPluginExport;
8
+ readonly props: unknown;
9
+ }, _optional?: Record<string, never>): string | null;
10
+ //# sourceMappingURL=export-props.d.ts.map
@@ -0,0 +1,31 @@
1
+ import { exceedsAdminSurfacePayloadLimit, validateAdminSurfaceActionValue } from "../contracts/admin-surface-action-schema.js";
2
+ /** Save and render share the existing bounded schema/value policy; messages never echo prop values.
3
+ * @returns First validation reason, or null on success. No side effects. @complexity O(p) prop values.
4
+ */
5
+ export function validateAgentPluginExportProps({ definition, props }, _optional = {}) {
6
+ if (exceedsAdminSurfacePayloadLimit({ payload: props }))
7
+ return 'props exceed the payload limit';
8
+ return validateAdminSurfaceActionValue({ schema: definition.props, value: props }) ?? checkUrlPropValues({ definition, props });
9
+ }
10
+ function isPageOn({ value, hosts }, _optional = {}) {
11
+ if (typeof value !== 'string')
12
+ return false;
13
+ try {
14
+ const url = new URL(value);
15
+ return url.protocol === 'https:' && !url.username && !url.password && url.pathname !== '/' && hosts.includes(url.origin);
16
+ }
17
+ catch {
18
+ return false;
19
+ }
20
+ }
21
+ /** Runs after the schema, so props is a closed object. Reasons name the host, never the value. */
22
+ function checkUrlPropValues({ definition, props }, _optional = {}) {
23
+ const hosts = definition.externalHosts?.frame ?? [];
24
+ for (const name of definition.urlProps ?? []) {
25
+ const value = props[name];
26
+ if (value !== undefined && !isPageOn({ value, hosts }))
27
+ return `${name} must be an https link to a page on ${hosts.join(' or ')}`;
28
+ }
29
+ return null;
30
+ }
31
+ //# sourceMappingURL=export-props.js.map
@@ -0,0 +1,5 @@
1
+ export declare class FolderZipError extends Error {
2
+ readonly reason: "empty" | "too-large" | "too-many" | "unreadable";
3
+ constructor(reason: "empty" | "too-large" | "too-many" | "unreadable", message: string);
4
+ }
5
+ //# sourceMappingURL=folder-zip-error.d.ts.map
@@ -0,0 +1,8 @@
1
+ export class FolderZipError extends Error {
2
+ reason;
3
+ constructor(reason, message) {
4
+ super(message);
5
+ this.reason = reason;
6
+ }
7
+ }
8
+ //# sourceMappingURL=folder-zip-error.js.map
@@ -0,0 +1,8 @@
1
+ /** Named refusal shared by HTTP and tool adapters. */
2
+ export declare class AgentPluginHostIncompatibleError extends Error {
3
+ readonly code = "PLUGIN_HOST_INCOMPATIBLE";
4
+ constructor(required: {
5
+ pluginId: string;
6
+ }, _optional?: Record<string, never>);
7
+ }
8
+ //# sourceMappingURL=host-incompatible-error.d.ts.map
@@ -0,0 +1,9 @@
1
+ /** Named refusal shared by HTTP and tool adapters. */
2
+ export class AgentPluginHostIncompatibleError extends Error {
3
+ code = 'PLUGIN_HOST_INCOMPATIBLE';
4
+ constructor(required, _optional = {}) {
5
+ super(`Plugin '${required.pluginId}' is not compatible with this host's Agent Plugin contract.`);
6
+ this.name = 'AgentPluginHostIncompatibleError';
7
+ }
8
+ }
9
+ //# sourceMappingURL=host-incompatible-error.js.map