@jini-ai/agent-plugins 0.6.23 → 0.7.1

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 +49 -0
  2. package/README.md +13 -0
  3. package/calendly/exports/booking-calendar.css +7 -0
  4. package/calendly/exports/booking-calendar.html +5 -0
  5. package/calendly/mcp.json +10 -0
  6. package/calendly/plugin.json +47 -0
  7. package/calendly/skills/calendly/SKILL.md +27 -0
  8. package/charts-echarts/plugin.json +2 -2
  9. package/charts-recharts/plugin.json +2 -2
  10. package/cloudflare/lib/cms-forms.mjs +57 -0
  11. package/cloudflare/lib/forms.mjs +78 -18
  12. package/cloudflare/lib/target.mjs +17 -4
  13. package/cloudflare/plugin.json +2 -2
  14. package/cloudflare/skills/cloudflare/SKILL.md +4 -4
  15. package/cloudflare/skills/cloudflare/references/workers.md +4 -4
  16. package/cloudflare/worker/forms-receiver.mjs +81 -41
  17. package/cloudflare/worker/portable-validation.mjs +220 -0
  18. package/commerce/plugin.json +17 -0
  19. package/commerce/skills/commerce/SKILL.md +23 -0
  20. package/composio/mcp.json +1 -1
  21. package/composio/plugin.json +2 -2
  22. package/composio/skills/composio/SKILL.md +4 -4
  23. package/core/commerce-server.d.ts +2 -0
  24. package/core/commerce-server.mjs +2 -0
  25. package/dist/admin-surfaces/connections/connections.d.ts +35 -0
  26. package/dist/admin-surfaces/connections/connections.js +135 -0
  27. package/dist/admin-surfaces/connections/index.d.ts +3 -0
  28. package/dist/admin-surfaces/connections/index.js +2 -0
  29. package/dist/admin-surfaces/connections/ports.d.ts +110 -0
  30. package/dist/admin-surfaces/connections/ports.js +2 -0
  31. package/dist/admin-surfaces/index.d.ts +2 -0
  32. package/dist/admin-surfaces/index.js +1 -0
  33. package/dist/admin-surfaces/plugin-state-persistence.d.ts +27 -0
  34. package/dist/admin-surfaces/plugin-state-persistence.js +2 -0
  35. package/dist/admin-surfaces/plugin-state.d.ts +51 -0
  36. package/dist/admin-surfaces/plugin-state.js +106 -0
  37. package/dist/connect/access-token-tool.d.ts +240 -0
  38. package/dist/connect/access-token-tool.js +213 -0
  39. package/dist/connect/apply-connect-defaults.d.ts +91 -0
  40. package/dist/connect/apply-connect-defaults.js +113 -0
  41. package/dist/connect/apply-tool-renames.d.ts +72 -0
  42. package/dist/connect/apply-tool-renames.js +105 -0
  43. package/dist/connect/connect-card-ui.d.ts +143 -0
  44. package/dist/connect/connect-card-ui.js +106 -0
  45. package/dist/connect/connect-destination.d.ts +35 -0
  46. package/dist/connect/connect-destination.js +45 -0
  47. package/dist/connect/connect-sign-in-wait.d.ts +31 -0
  48. package/dist/connect/connect-sign-in-wait.js +21 -0
  49. package/dist/connect/connect-tool.d.ts +314 -0
  50. package/dist/connect/connect-tool.js +431 -0
  51. package/dist/connect/connection-status.d.ts +33 -0
  52. package/dist/connect/connection-status.js +63 -0
  53. package/dist/connect/credential-cards.d.ts +15 -0
  54. package/dist/connect/credential-cards.js +49 -0
  55. package/dist/connect/credential-save-tool.d.ts +45 -0
  56. package/dist/connect/credential-save-tool.js +156 -0
  57. package/dist/connect/enable-access.d.ts +67 -0
  58. package/dist/connect/enable-access.js +74 -0
  59. package/dist/connect/executable/approval.d.ts +58 -0
  60. package/dist/connect/executable/approval.js +40 -0
  61. package/dist/connect/executable/host-capabilities.d.ts +76 -0
  62. package/dist/connect/executable/host-capabilities.js +100 -0
  63. package/dist/connect/executable/index.d.ts +10 -0
  64. package/dist/connect/executable/index.js +9 -0
  65. package/dist/connect/executable/ports.d.ts +189 -0
  66. package/dist/connect/executable/ports.js +2 -0
  67. package/dist/connect/executable/register.d.ts +21 -0
  68. package/dist/connect/executable/register.js +125 -0
  69. package/dist/connect/federate-mcp.d.ts +190 -0
  70. package/dist/connect/federate-mcp.js +440 -0
  71. package/dist/connect/grant-signed-in-defaults.d.ts +96 -0
  72. package/dist/connect/grant-signed-in-defaults.js +100 -0
  73. package/dist/connect/import-access-token.d.ts +114 -0
  74. package/dist/connect/import-access-token.js +103 -0
  75. package/dist/connect/index.d.ts +19 -0
  76. package/dist/connect/index.js +19 -0
  77. package/dist/connect/plugin-credential-card.d.ts +46 -0
  78. package/dist/connect/plugin-credential-card.js +63 -0
  79. package/dist/connect/plugin-host/index.d.ts +203 -0
  80. package/dist/connect/plugin-host/index.js +153 -0
  81. package/dist/connect/ports.d.ts +74 -0
  82. package/dist/connect/ports.js +2 -0
  83. package/dist/connect/switch-on-saved-token.d.ts +48 -0
  84. package/dist/connect/switch-on-saved-token.js +20 -0
  85. package/dist/connect/token-sign-in.d.ts +51 -0
  86. package/dist/connect/token-sign-in.js +43 -0
  87. package/dist/core/identity-namespace.d.ts +39 -0
  88. package/dist/core/identity-namespace.js +61 -3
  89. package/dist/folder-zip-node.js +3 -1
  90. package/dist/lifecycle/automatic-use.d.ts +12 -7
  91. package/dist/lifecycle/automatic-use.js +37 -28
  92. package/dist/lifecycle/capability-projection.js +5 -1
  93. package/dist/lifecycle/contribution-loader.d.ts +2 -7
  94. package/dist/lifecycle/contribution-types.d.ts +8 -0
  95. package/dist/lifecycle/contribution-types.js +2 -0
  96. package/dist/lifecycle/credential-card-metadata.d.ts +23 -0
  97. package/dist/lifecycle/credential-card-metadata.js +184 -0
  98. package/dist/lifecycle/exports.d.ts +11 -0
  99. package/dist/lifecycle/exports.js +64 -3
  100. package/dist/lifecycle/host-tools/identity.d.ts +38 -0
  101. package/dist/lifecycle/host-tools/identity.js +58 -0
  102. package/dist/lifecycle/host-tools/index.d.ts +20 -0
  103. package/dist/lifecycle/host-tools/index.js +20 -0
  104. package/dist/lifecycle/host-tools/memory-tools.d.ts +22 -0
  105. package/dist/lifecycle/host-tools/memory-tools.js +63 -0
  106. package/dist/lifecycle/host-tools/ports.d.ts +121 -0
  107. package/dist/lifecycle/host-tools/ports.js +2 -0
  108. package/dist/lifecycle/host-tools/provider-status-tool.d.ts +88 -0
  109. package/dist/lifecycle/host-tools/provider-status-tool.js +45 -0
  110. package/dist/lifecycle/host-tools/search-tool.d.ts +74 -0
  111. package/dist/lifecycle/host-tools/search-tool.js +282 -0
  112. package/dist/lifecycle/host-tools/skill-tool.d.ts +219 -0
  113. package/dist/lifecycle/host-tools/skill-tool.js +482 -0
  114. package/dist/lifecycle/host-tools/write-note-tool.d.ts +22 -0
  115. package/dist/lifecycle/host-tools/write-note-tool.js +47 -0
  116. package/dist/lifecycle/index.d.ts +2 -1
  117. package/dist/lifecycle/install.js +2 -1
  118. package/dist/lifecycle/installed-package-index.js +5 -8
  119. package/dist/lifecycle/mail/adapter-descriptors.d.ts +78 -0
  120. package/dist/lifecycle/mail/adapter-descriptors.js +155 -0
  121. package/dist/lifecycle/mail/catalog.d.ts +116 -0
  122. package/dist/lifecycle/mail/catalog.js +72 -0
  123. package/dist/lifecycle/mail/configuration.d.ts +25 -0
  124. package/dist/lifecycle/mail/configuration.js +62 -0
  125. package/dist/lifecycle/mail/contribution.d.ts +89 -0
  126. package/dist/lifecycle/mail/contribution.js +115 -0
  127. package/dist/lifecycle/mail/host-mailer.d.ts +24 -0
  128. package/dist/lifecycle/mail/host-mailer.js +10 -0
  129. package/dist/lifecycle/mail/index.d.ts +16 -0
  130. package/dist/lifecycle/mail/index.js +16 -0
  131. package/dist/lifecycle/mail/selection.d.ts +40 -0
  132. package/dist/lifecycle/mail/selection.js +86 -0
  133. package/dist/lifecycle/manifest.d.ts +7 -2
  134. package/dist/lifecycle/manifest.js +32 -9
  135. package/dist/lifecycle/metadata.d.ts +31 -0
  136. package/dist/lifecycle/metadata.js +80 -0
  137. package/dist/lifecycle/persistent-state.js +2 -1
  138. package/dist/lifecycle/ports.d.ts +2 -0
  139. package/dist/lifecycle/resolve-agent-plugin-refs.d.ts +2 -1
  140. package/dist/lifecycle/resolve-agent-plugin-refs.js +14 -8
  141. package/dist/lifecycle/search-projection.d.ts +3 -4
  142. package/dist/lifecycle/search-projection.js +5 -7
  143. package/dist/lifecycle/search.js +3 -2
  144. package/fly/plugin.json +5 -5
  145. package/fly/skills/fly/SKILL.md +1 -1
  146. package/formspree/plugin.json +7 -0
  147. package/formspree/skills/formspree/SKILL.md +11 -0
  148. package/github/plugin.json +2 -2
  149. package/github/skills/github/SKILL.md +28 -28
  150. package/github/skills/github/references/actions.md +8 -8
  151. package/github/skills/github/references/auth-and-tokens.md +7 -7
  152. package/github/skills/github/references/repo-files.md +5 -5
  153. package/github/skills/github/references/site-backup.md +16 -16
  154. package/github/skills/github/references/source-control.md +17 -17
  155. package/github-pages/plugin.json +2 -2
  156. package/github-pages/skills/github-pages/SKILL.md +3 -3
  157. package/google-forms/plugin.json +7 -0
  158. package/google-forms/skills/google-forms/SKILL.md +15 -0
  159. package/google-login/plugin.json +3 -3
  160. package/google-login/skills/google-login/SKILL.md +17 -60
  161. package/google-workspace/plugin.json +6 -6
  162. package/google-workspace/skills/google-workspace/references/connection.md +1 -1
  163. package/google-workspace/skills/google-workspace/references/form-delivery.md +4 -4
  164. package/google-workspace/tovu-admin-surfaces.json +5 -5
  165. package/higgsfield-media/plugin.json +5 -5
  166. package/higgsfield-media/skills/higgsfield-media/SKILL.md +31 -33
  167. package/higgsfield-media/skills/higgsfield-media/references/failure-modes.md +7 -7
  168. package/higgsfield-media/skills/higgsfield-media/references/models-and-plan-gates.md +3 -3
  169. package/jev/plugin.json +2 -2
  170. package/langfuse/plugin.json +2 -2
  171. package/meilisearch/plugin.json +2 -2
  172. package/meilisearch/skills/meilisearch/SKILL.md +1 -1
  173. package/netlify/plugin.json +2 -2
  174. package/netlify/skills/netlify/SKILL.md +3 -3
  175. package/opentelemetry/plugin.json +2 -2
  176. package/opentelemetry/skills/opentelemetry/SKILL.md +7 -7
  177. package/package.json +92 -14
  178. package/posthog/plugin.json +2 -2
  179. package/posthog/skills/posthog/SKILL.md +7 -7
  180. package/railway/plugin.json +3 -3
  181. package/railway/skills/railway/SKILL.md +10 -11
  182. package/render/plugin.json +3 -3
  183. package/render/skills/render/SKILL.md +7 -8
  184. package/resend/NOTES.md +2 -2
  185. package/resend/mcp.json +1 -1
  186. package/resend/plugin.json +5 -5
  187. package/resend/skills/resend/SKILL.md +13 -13
  188. package/s3-compatible/plugin.json +2 -2
  189. package/s3-compatible/skills/s3-compatible/SKILL.md +4 -4
  190. package/sentry/plugin.json +2 -2
  191. package/sentry/skills/sentry/SKILL.md +7 -7
  192. package/shopify/plugin.json +2 -2
  193. package/site-compliance/plugin.json +2 -2
  194. package/site-compliance/skills/site-compliance/SKILL.md +3 -3
  195. package/site-compliance/skills/site-compliance/references/gdpr-eu-uk.md +1 -1
  196. package/site-import/plugin.json +2 -2
  197. package/slide-design/plugin.json +2 -2
  198. package/software-engineering/LICENSE +201 -0
  199. package/software-engineering/NOTICE +9 -0
  200. package/software-engineering/README.md +89 -0
  201. package/software-engineering/plugin.json +24 -0
  202. package/software-engineering/skills/software-engineering/SKILL.md +33 -0
  203. package/software-engineering/skills/software-engineering/references/debugging.md +54 -0
  204. package/software-engineering/skills/software-engineering/references/implementation.md +27 -0
  205. package/software-engineering/skills/software-engineering/references/planning.md +27 -0
  206. package/software-engineering/skills/software-engineering/references/prototyping.md +14 -0
  207. package/software-engineering/skills/software-engineering/references/security.md +47 -0
  208. package/software-engineering/skills/software-engineering/references/verification.md +53 -0
  209. package/stripe/plugin.json +2 -2
  210. package/supabase/mcp.json +4 -4
  211. package/supabase/plugin.json +3 -3
  212. package/supabase/skills/supabase/SKILL.md +8 -8
  213. package/supabase/skills/supabase/references/failure-modes.md +5 -5
  214. package/ui-ux-design/plugin.json +2 -2
  215. package/vercel/plugin.json +2 -2
  216. package/vercel/skills/vercel/SKILL.md +3 -3
  217. package/wordpress/plugin.json +2 -2
  218. package/wordpress/skills/wordpress/SKILL.md +3 -3
  219. package/wordpress/skills/wordpress/references/free-site-redirect.md +2 -2
  220. package/wordpress/skills/wordpress/references/subdomain.md +5 -5
@@ -0,0 +1,72 @@
1
+ import { type Clock as ClockPort } from "@jini-ai/core/primitives";
2
+ import type { AgentPluginMcpRepo } from "./ports.js";
3
+ import type { McpServerConfig } from "../lifecycle/manifest.js";
4
+ /** One installed plugin's declared MCP servers, as the host's installed-package reads list them. */
5
+ interface InstalledAgentPluginServers {
6
+ readonly pluginId: string;
7
+ readonly servers: Readonly<Record<string, McpServerConfig>>;
8
+ }
9
+ /** Boot log the host routes to its own sink. */
10
+ interface TokenImportLog {
11
+ info(message: string): void;
12
+ warn(message: string): void;
13
+ }
14
+ /**
15
+ * @file Carries saved tool selections across a vendor's tool rename, so an operator never has to
16
+ * re-tick a tool the server now offers under a new name.
17
+ *
18
+ * A plugin's `mcp.json` declares the rename on the server entry (`renamedTools: { "get_logs":
19
+ * "query_logs" }`, parsed by `manifest.ts`). At boot, every row that plugin provisioned has each old
20
+ * name in `allowedToolNames` and `writeAllowedToolNames` replaced by the new one. Added 2026-09-29
21
+ * when Supabase renamed `get_logs` to `query_logs` and the saved dev row kept asking for a tool the
22
+ * server no longer offers.
23
+ *
24
+ * Applied only to a row that names this plugin as its provisioner AND sits at the url the plugin
25
+ * declares — the same match `apply-connect-defaults.ts` uses — so an operator's own row, or one
26
+ * pointed elsewhere, is never touched.
27
+ *
28
+ * Never widens access: a new name takes exactly the grants its old name had (read stays read, write
29
+ * stays write), and a rename whose old name is not in a list adds nothing to that list. Idempotent:
30
+ * once rewritten, the old names are gone and later boots write nothing. Reversible: declaring the
31
+ * opposite rename puts the old names back.
32
+ */
33
+ /** @agent-note Bind your canonical MCP repo, stable saved rename actor and trusted installed
34
+ * declaration reader. Renames preserve existing access and only touch the matching provisioner/URL. */
35
+ export interface ApplyAgentPluginToolRenamesDeps {
36
+ readonly workspaceId: string;
37
+ readonly externalMcpServerRepo: AgentPluginMcpRepo;
38
+ readonly clock: ClockPort;
39
+ /** Recorded as the row's write-grant attribution when a rename changes its write list.
40
+ * @agent-note Second host: a stable system actor id of YOUR vocabulary; it is saved on the row
41
+ * (`writeGrantsUpdatedByPrincipalId`), so changing it changes saved bytes for later renames. */
42
+ readonly actor: string;
43
+ /** The host's installed-plugin reads (a pre-seam default listed them from the plugin layout).
44
+ * @agent-note Second host: list only trusted installed packages; rows are matched by provisioner AND url. */
45
+ readonly listPlugins: () => Promise<readonly InstalledAgentPluginServers[]>;
46
+ /** @agent-note Bind the SAME roster notifier used by your store/sign-in owner, so changed saved
47
+ * grants reload in the running host. The host-specific import-boundary rationale stays at its binding. */
48
+ readonly notifyRosterChanged: () => Promise<void>;
49
+ }
50
+ /**
51
+ * `names` with every renamed entry replaced, order kept, duplicates dropped — or `null` when
52
+ * nothing in it was renamed.
53
+ * @complexity O(n) in the list length.
54
+ */
55
+ export declare function renameToolNames(required: {
56
+ readonly names: readonly string[];
57
+ readonly renames: Readonly<Record<string, string>>;
58
+ }, _optional?: Record<string, never>): string[] | null;
59
+ /**
60
+ * Boot: rewrites renamed tool names on every row an installed plugin provisioned. Logs each rewrite
61
+ * once (the next boot finds nothing to do) and notifies the roster when any row changed. Never
62
+ * throws: a failure is a warning and the next boot tries again.
63
+ *
64
+ * @complexity O(p·s) over installed plugins and their servers, plus one row read per declared rename
65
+ * and at most one write per row.
66
+ */
67
+ export declare function applyAgentPluginToolRenames(required: {
68
+ readonly deps: ApplyAgentPluginToolRenamesDeps;
69
+ readonly log: TokenImportLog;
70
+ }, _optional?: Record<string, never>): Promise<void>;
71
+ export {};
72
+ //# sourceMappingURL=apply-tool-renames.d.ts.map
@@ -0,0 +1,105 @@
1
+ import { nowIso as clockNowIso } from "@jini-ai/core/primitives";
2
+ import { deriveAgentPluginConnectionId } from "./federate-mcp.js";
3
+ /** A stored JSON tool list as names, or `null` when it is not a JSON array of strings (left alone). */
4
+ function readToolList(raw) {
5
+ if (!raw)
6
+ return [];
7
+ try {
8
+ const parsed = JSON.parse(raw);
9
+ return Array.isArray(parsed) && parsed.every((name) => typeof name === "string") ? parsed : null;
10
+ }
11
+ catch {
12
+ return null;
13
+ }
14
+ }
15
+ /**
16
+ * `names` with every renamed entry replaced, order kept, duplicates dropped — or `null` when
17
+ * nothing in it was renamed.
18
+ * @complexity O(n) in the list length.
19
+ */
20
+ export function renameToolNames(required, _optional = {}) {
21
+ const { names, renames } = required;
22
+ if (!names.some((name) => Object.hasOwn(renames, name)))
23
+ return null;
24
+ return [...new Set(names.map((name) => (Object.hasOwn(renames, name) ? renames[name] : name)))];
25
+ }
26
+ /** The matching provisioned row with its two tool lists renamed, or `null` when neither list
27
+ * changed (or either is unreadable). */
28
+ function renameRowTools(input, _options = {}) {
29
+ const { row, renames, clock, pluginId, url, actor } = input;
30
+ if (row.provisionedByPluginId !== pluginId || row.url !== url)
31
+ return null;
32
+ const nowIso = clockNowIso({ clock });
33
+ const allow = readToolList(row.allowedToolNames);
34
+ const write = readToolList(row.writeAllowedToolNames);
35
+ if (allow === null || write === null)
36
+ return null;
37
+ const renamedAllow = renameToolNames({ names: allow, renames });
38
+ const renamedWrite = renameToolNames({ names: write, renames });
39
+ if (renamedAllow === null && renamedWrite === null)
40
+ return null;
41
+ return {
42
+ ...row,
43
+ ...(renamedAllow === null ? {} : { allowedToolNames: JSON.stringify(renamedAllow) }),
44
+ ...(renamedWrite === null
45
+ ? {}
46
+ : { writeAllowedToolNames: JSON.stringify(renamedWrite), writeGrantsUpdatedByPrincipalId: actor, writeGrantsUpdatedAt: nowIso }),
47
+ updatedAt: nowIso,
48
+ };
49
+ }
50
+ /** Applies one declaration only to its provisioned row at the declared endpoint. */
51
+ async function applyServerToolRenames(input, _options = {}) {
52
+ const { deps, pluginId, serverKey, config, log } = input;
53
+ if (config.type === "stdio" || !config.renamedTools)
54
+ return false;
55
+ const serverId = deriveAgentPluginConnectionId({ serverKey });
56
+ if (serverId === null)
57
+ return false;
58
+ const result = { changed: false };
59
+ try {
60
+ const row = await deps.externalMcpServerRepo.findByServerId({ workspaceId: deps.workspaceId, serverId });
61
+ if (!row)
62
+ return false;
63
+ const renamed = renameRowTools({ row, renames: config.renamedTools, clock: deps.clock, actor: deps.actor, pluginId, url: config.url });
64
+ if (!renamed)
65
+ return false;
66
+ await deps.externalMcpServerRepo.upsert(renamed);
67
+ result.changed = true;
68
+ const renames = Object.entries(config.renamedTools).map(([from, to]) => `${from} -> ${to}`).join(", ");
69
+ log.info(`[agent-plugins] '${serverId}': renamed saved tools to follow the '${pluginId}' plugin (${renames}).`);
70
+ return true;
71
+ }
72
+ catch (err) {
73
+ log.warn(`[agent-plugins] could not apply the '${pluginId}' plugin's tool renames to '${serverId}': ${err instanceof Error ? err.message : String(err)}`);
74
+ }
75
+ return result.changed;
76
+ }
77
+ /**
78
+ * Boot: rewrites renamed tool names on every row an installed plugin provisioned. Logs each rewrite
79
+ * once (the next boot finds nothing to do) and notifies the roster when any row changed. Never
80
+ * throws: a failure is a warning and the next boot tries again.
81
+ *
82
+ * @complexity O(p·s) over installed plugins and their servers, plus one row read per declared rename
83
+ * and at most one write per row.
84
+ */
85
+ export async function applyAgentPluginToolRenames(required, _optional = {}) {
86
+ const { deps, log } = required;
87
+ let plugins;
88
+ try {
89
+ plugins = await deps.listPlugins();
90
+ }
91
+ catch (err) {
92
+ log.warn(`[agent-plugins] could not list plugins to apply tool renames: ${err instanceof Error ? err.message : String(err)}`);
93
+ return;
94
+ }
95
+ let changed = false;
96
+ for (const { pluginId, servers } of plugins) {
97
+ for (const [serverKey, config] of Object.entries(servers)) {
98
+ if (await applyServerToolRenames({ deps, pluginId, serverKey, config, log }))
99
+ changed = true;
100
+ }
101
+ }
102
+ if (changed)
103
+ await deps.notifyRosterChanged();
104
+ }
105
+ //# sourceMappingURL=apply-tool-renames.js.map
@@ -0,0 +1,143 @@
1
+ import type { PluginCredentialCard } from "@jini-ai/core/contracts/credentials";
2
+ import type { SurfaceCardOutcome as SurfaceOutcomeSpec, SurfaceCardApp, SurfaceCardsPort } from "@jini-ai/core/contracts/cards";
3
+ import type { SurfaceCardSecretForm as SecretCardForm } from "@jini-ai/core/contracts/cards";
4
+ /** Resource stays concrete through waitAtSignInCard's card callback.
5
+ * @agent-note Second host: bind your own card runtime (typically `@jini-ai/ui`'s mcp-ui cards); the
6
+ * waiter's `card` callback returns YOUR `Resource` unchanged, so never cast it to a UI type here. */
7
+ export type AgentPluginCardsPort<Resource> = SurfaceCardsPort<Resource>;
8
+ /** @agent-note Build-only view of {@link AgentPluginCardsPort}: card builders never wait on a human. */
9
+ export type AgentPluginCardBuilders<Resource> = Omit<AgentPluginCardsPort<Resource>, 'waitAtSignInCard'>;
10
+ /** Plugin-declared credential-card copy applied to a neutral secret form.
11
+ * @agent-note Second host: `apply` overlays the plugin's declared card (title/intro/key hint) onto the
12
+ * form and returns YOUR form type; it must keep the single masked `token` field and never prefill it. */
13
+ export interface AgentPluginCredentialCardForms<Form> {
14
+ apply(input: {
15
+ card?: PluginCredentialCard | undefined;
16
+ form: SecretCardForm;
17
+ }, options?: Record<string, never>): Form;
18
+ }
19
+ /** Card identity the host owns.
20
+ * @agent-note Your app's id; it appears in every card URI and is compared on answers. `uriNamespace`
21
+ * is ONE segment (no slashes, e.g. your product id); the fixed suffixes `agent-plugins-connect` and
22
+ * `sign-in-destination` are appended here, and every app is version "1". Changing either breaks
23
+ * answers to cards already in transcripts. */
24
+ export interface AgentPluginCardIdentity {
25
+ readonly uriNamespace: string;
26
+ readonly appNames: {
27
+ readonly connect: string;
28
+ readonly tokenForm: string;
29
+ readonly tokenOutcome: string;
30
+ };
31
+ }
32
+ /** Resolves {@link AgentPluginCardIdentity} into the per-card routes the builders below take.
33
+ * @complexity O(1). */
34
+ export declare function resolveAgentPluginCardIdentity(required: {
35
+ readonly cardIdentity: AgentPluginCardIdentity;
36
+ readonly toolId: string;
37
+ }, _optional?: Record<string, never>): {
38
+ readonly connect: {
39
+ readonly uriNamespace: `${string}/agent-plugins-connect`;
40
+ readonly toolId: string;
41
+ readonly app: {
42
+ readonly appName: string;
43
+ readonly appVersion: "1";
44
+ };
45
+ };
46
+ readonly token: {
47
+ readonly formApp: {
48
+ readonly appName: string;
49
+ readonly appVersion: "1";
50
+ };
51
+ readonly outcomeApp: {
52
+ readonly appName: string;
53
+ readonly appVersion: "1";
54
+ };
55
+ };
56
+ readonly destination: {
57
+ readonly uriNamespace: `${string}/sign-in-destination`;
58
+ readonly toolId: string;
59
+ };
60
+ };
61
+ /** Product wording on the token form.
62
+ * @agent-note Second host: name YOUR product as the one that checks the token; the text is shown to
63
+ * the human only and must not promise the assistant sees the token. */
64
+ export interface AgentPluginAccessTokenFormMessages {
65
+ description(input: {
66
+ pluginDisplayName: string;
67
+ helpUrl: string;
68
+ }): string;
69
+ }
70
+ /** @agent-note Safe card state from your connection owner; credentialCard is declaration copy,
71
+ * never credential values. Waiting/connected/skipped updates reuse the host's stable card identity. */
72
+ export type AgentPluginConnectCardSpec = {
73
+ readonly pluginId: string;
74
+ readonly pluginDisplayName: string;
75
+ readonly state: "waiting";
76
+ readonly signInUrl: string;
77
+ readonly exchangeId?: string;
78
+ readonly credentialCard?: PluginCredentialCard | undefined;
79
+ } | {
80
+ readonly pluginId: string;
81
+ readonly pluginDisplayName: string;
82
+ readonly state: "connected";
83
+ } | {
84
+ readonly pluginId: string;
85
+ readonly pluginDisplayName: string;
86
+ readonly state: "skipped";
87
+ };
88
+ /**
89
+ * Renders the connect card. Re-sent under the SAME `ui://` URI (keyed by `pluginId`) when the state
90
+ * flips from `"waiting"` to `"connected"`, so the transcript replaces the sign-in link in place —
91
+ * see `outcome.ts`'s own header for why URI reuse is the whole mechanism.
92
+ *
93
+ * @complexity O(1).
94
+ */
95
+ export declare function buildAgentPluginConnectCardWithPorts<Resource>(required: {
96
+ spec: AgentPluginConnectCardSpec;
97
+ cards: AgentPluginCardBuilders<Resource>;
98
+ identity: {
99
+ uriNamespace: string;
100
+ toolId: string;
101
+ app: SurfaceCardApp;
102
+ };
103
+ }, _optional?: Record<string, never>): Resource;
104
+ /**
105
+ * The masked access-token form `agent_plugin_set_access_token` shows (`access-token-tool.ts`), for a
106
+ * plugin whose server declares `tokenAuth`; its tokens page comes from the plugin metadata.
107
+ *
108
+ * Its one field is the only place the token exists outside the sealed ciphertext it becomes: it is
109
+ * posted straight to the tool-calls route, never through chat. Never pre-filled — every render starts
110
+ * empty. The engine's URI carries the tool/exchange identity, and the outcome reuses it so it
111
+ * replaces the form. This builder supplies domain copy only; the engine owns routing and dismissal.
112
+ *
113
+ * @returns A secret-card form spec without routing parameters or prefilled credentials.
114
+ * @example buildAgentPluginAccessTokenFormWithPorts({ app, messages, spec: { credentials, pluginDisplayName: "Supabase", helpUrl: "https://supabase.com/dashboard/account/tokens" } });
115
+ * @complexity O(1).
116
+ */
117
+ export declare function buildAgentPluginAccessTokenFormWithPorts<Form>(required: {
118
+ readonly app: SurfaceCardApp;
119
+ readonly messages: AgentPluginAccessTokenFormMessages;
120
+ readonly spec: {
121
+ readonly credentials: AgentPluginCredentialCardForms<Form>;
122
+ readonly pluginDisplayName: string;
123
+ readonly helpUrl: string;
124
+ readonly credentialCard?: PluginCredentialCard | undefined;
125
+ };
126
+ }, _optional?: Record<string, never>): Form;
127
+ /**
128
+ * The result that replaces the token form. `message` is caller-controlled and must never carry a
129
+ * token — every call site passes a fixed sentence.
130
+ *
131
+ * @returns Outcome copy; the engine supplies the form's URI when rendering it.
132
+ * @complexity O(1).
133
+ */
134
+ export declare function buildAgentPluginAccessTokenOutcomeWithPorts(required: {
135
+ readonly app: SurfaceCardApp;
136
+ readonly spec: {
137
+ readonly pluginDisplayName: string;
138
+ readonly state: "success" | "failure";
139
+ readonly title: string;
140
+ readonly message: string;
141
+ };
142
+ }, _optional?: Record<string, never>): SurfaceOutcomeSpec;
143
+ //# sourceMappingURL=connect-card-ui.d.ts.map
@@ -0,0 +1,106 @@
1
+ /** Resolves {@link AgentPluginCardIdentity} into the per-card routes the builders below take.
2
+ * @complexity O(1). */
3
+ export function resolveAgentPluginCardIdentity(required, _optional = {}) {
4
+ const { cardIdentity: { uriNamespace, appNames }, toolId } = required;
5
+ return {
6
+ connect: { uriNamespace: `${uriNamespace}/agent-plugins-connect`, toolId, app: { appName: appNames.connect, appVersion: '1' } },
7
+ token: { formApp: { appName: appNames.tokenForm, appVersion: '1' }, outcomeApp: { appName: appNames.tokenOutcome, appVersion: '1' } },
8
+ destination: { uriNamespace: `${uriNamespace}/sign-in-destination`, toolId },
9
+ };
10
+ }
11
+ /**
12
+ * @file The card `agent_plugin_connect` shows while it parks on a human's sign-in (`connect-tool.ts`).
13
+ *
14
+ * Built on `@jini-ai/ui`'s `buildOutcomeSurface`, not `buildConfirmationSurface`: there is nothing
15
+ * here for a human to confirm by tool call — the sign-in element is a link that
16
+ * opens the authenticated host sign-in link, then the plugin's real sign-in page in a new tab
17
+ * (`outcome.ts`'s `openLinkUrl`, wired to the
18
+ * bridge's `openLink` — an outbound navigation, never a delivery through `mcp-ui-tool-calls-route.ts`).
19
+ * Skip answers the existing surface exchange so the assistant can continue the turn.
20
+ * `state: "partial"` is the honest read of "waiting on the human, not failed, not done yet" —
21
+ * `outcome.ts`'s own header explains why that needs to be a real third state, not a boolean folded
22
+ * into success or failure.
23
+ *
24
+ * Plain words only: copy comes from the plugin's explicit credential-card declaration, never its
25
+ * raw plugin.json description, which can contain transport jargon. Older plugins retain the
26
+ * display-name fallback so an absent declaration never blocks a real sign-in.
27
+ * plugin.json has no display-name field; uninstall-confirmation-ui.ts makes the identical choice.
28
+ */
29
+ function agentPluginConnectSurfaceUri({ pluginId, uriNamespace }) {
30
+ return `ui://${uriNamespace}/${encodeURIComponent(pluginId)}`;
31
+ }
32
+ /**
33
+ * Renders the connect card. Re-sent under the SAME `ui://` URI (keyed by `pluginId`) when the state
34
+ * flips from `"waiting"` to `"connected"`, so the transcript replaces the sign-in link in place —
35
+ * see `outcome.ts`'s own header for why URI reuse is the whole mechanism.
36
+ *
37
+ * @complexity O(1).
38
+ */
39
+ export function buildAgentPluginConnectCardWithPorts(required, _optional = {}) {
40
+ const { spec, cards, identity } = required;
41
+ const credentialCard = spec.state === "waiting" ? spec.credentialCard : undefined;
42
+ return cards.buildSignInCard({
43
+ uri: agentPluginConnectSurfaceUri({ pluginId: spec.pluginId, uriNamespace: identity.uriNamespace }), toolId: identity.toolId,
44
+ app: identity.app,
45
+ waiting: {
46
+ title: credentialCard?.title ?? `Let's connect ${spec.pluginDisplayName}`,
47
+ description: credentialCard ? `${credentialCard.intro ?? ""} ${credentialCard.permissions ?? credentialCard.keyHint ?? ""}`.trim() : "It's free and takes about two minutes.",
48
+ message: "Waiting for you to sign in...", openLinkLabel: `Sign in to ${spec.pluginDisplayName}`, cancelLabel: "Skip",
49
+ },
50
+ connected: { title: `${spec.pluginDisplayName} connected`, message: "Connected ✓" },
51
+ skipped: { title: "Sign-in skipped", message: `Skipped connecting ${spec.pluginDisplayName}. The assistant can continue without this plugin.` },
52
+ ...spec,
53
+ });
54
+ }
55
+ /**
56
+ * The masked access-token form `agent_plugin_set_access_token` shows (`access-token-tool.ts`), for a
57
+ * plugin whose server declares `tokenAuth`; its tokens page comes from the plugin metadata.
58
+ *
59
+ * Its one field is the only place the token exists outside the sealed ciphertext it becomes: it is
60
+ * posted straight to the tool-calls route, never through chat. Never pre-filled — every render starts
61
+ * empty. The engine's URI carries the tool/exchange identity, and the outcome reuses it so it
62
+ * replaces the form. This builder supplies domain copy only; the engine owns routing and dismissal.
63
+ *
64
+ * @returns A secret-card form spec without routing parameters or prefilled credentials.
65
+ * @example buildAgentPluginAccessTokenFormWithPorts({ app, messages, spec: { credentials, pluginDisplayName: "Supabase", helpUrl: "https://supabase.com/dashboard/account/tokens" } });
66
+ * @complexity O(1).
67
+ */
68
+ export function buildAgentPluginAccessTokenFormWithPorts(required, _optional = {}) {
69
+ const { spec } = required;
70
+ const { pluginDisplayName, helpUrl } = spec;
71
+ return spec.credentials.apply({ card: spec.credentialCard, form: {
72
+ title: `Connect ${pluginDisplayName} with an access token`,
73
+ description: required.messages.description({ pluginDisplayName, helpUrl }),
74
+ submitLabel: "Save token",
75
+ fields: [
76
+ {
77
+ kind: "string",
78
+ name: "token",
79
+ label: `${pluginDisplayName} access token`,
80
+ hint: "Pasted here only. Never shown to the assistant.",
81
+ required: true,
82
+ secret: true,
83
+ },
84
+ ],
85
+ cancelLabel: "Cancel",
86
+ app: required.app,
87
+ } });
88
+ }
89
+ /**
90
+ * The result that replaces the token form. `message` is caller-controlled and must never carry a
91
+ * token — every call site passes a fixed sentence.
92
+ *
93
+ * @returns Outcome copy; the engine supplies the form's URI when rendering it.
94
+ * @complexity O(1).
95
+ */
96
+ export function buildAgentPluginAccessTokenOutcomeWithPorts(required, _optional = {}) {
97
+ const { spec } = required;
98
+ return {
99
+ title: spec.title,
100
+ details: [{ label: "Connection", value: spec.pluginDisplayName }],
101
+ state: spec.state,
102
+ message: spec.message,
103
+ app: required.app,
104
+ };
105
+ }
106
+ //# sourceMappingURL=connect-card-ui.js.map
@@ -0,0 +1,35 @@
1
+ import { type ToolExecutionContext, type ToolExecutionOptions } from '@jini-ai/core';
2
+ import type { SurfaceAnswerChannel, SurfaceAskThenReport, SurfaceExchangeStore } from '@jini-ai/core';
3
+ import type { AgentPluginCardBuilders } from './connect-card-ui.js';
4
+ /** Host wording and delivery channel for the destination card.
5
+ * @agent-note Second host: `channel` is the channel your card runtime answers on (the same one the
6
+ * callback route delivers to); the copy names where a shared connection lives on YOUR host. The
7
+ * answer still accepts only `site`/`shared` from the current human exchange. */
8
+ export interface AgentPluginDestinationCardHost {
9
+ readonly channel: SurfaceAnswerChannel;
10
+ readonly messages: {
11
+ readonly description: string;
12
+ readonly sharedOptionLabel: string;
13
+ };
14
+ }
15
+ type Destination = 'site' | 'shared';
16
+ /** Ask before sign-in, so a shared credential is issued directly into owner storage.
17
+ * The host supplies availability only for the installation owner; cancellation starts no flow.
18
+ * @returns Explicit destination, or null on cancellation/expiry/abort.
19
+ * @complexity O(1), one bounded principal-bound human exchange; no storage or provider I/O.
20
+ */
21
+ export declare function chooseApiConnectionDestinationWithPorts<Resource>(required: {
22
+ readonly cards: AgentPluginCardBuilders<Resource>;
23
+ readonly askThenReport: SurfaceAskThenReport;
24
+ readonly uriNamespace: string;
25
+ readonly toolId: string;
26
+ readonly host: AgentPluginDestinationCardHost;
27
+ readonly surfaces: {
28
+ readonly surfaceExchanges: SurfaceExchangeStore;
29
+ };
30
+ readonly ctx: ToolExecutionContext;
31
+ readonly pluginDisplayName: string;
32
+ readonly available: boolean;
33
+ }, optional?: ToolExecutionOptions): Promise<Destination | null>;
34
+ export {};
35
+ //# sourceMappingURL=connect-destination.d.ts.map
@@ -0,0 +1,45 @@
1
+ import { ToolInputError, SURFACE_DISMISSED_PARAM, SURFACE_EXCHANGE_ID_PARAM } from '@jini-ai/core';
2
+ /** Only the current human exchange can select the shared destination. */
3
+ function selectedDestination(params) {
4
+ if (Object.keys(params).some(key => !['destination', SURFACE_EXCHANGE_ID_PARAM].includes(key))
5
+ || (params.destination !== 'site' && params.destination !== 'shared')) {
6
+ throw new ToolInputError({ message: 'Choose where to save this connection in its sign-in card. No site identity or credential can be submitted.' });
7
+ }
8
+ return params.destination;
9
+ }
10
+ /** Ask before sign-in, so a shared credential is issued directly into owner storage.
11
+ * The host supplies availability only for the installation owner; cancellation starts no flow.
12
+ * @returns Explicit destination, or null on cancellation/expiry/abort.
13
+ * @complexity O(1), one bounded principal-bound human exchange; no storage or provider I/O.
14
+ */
15
+ export async function chooseApiConnectionDestinationWithPorts(required, optional = {}) {
16
+ if (!required.available)
17
+ return 'site';
18
+ if (!optional.emitSurface)
19
+ throw new ToolInputError({ message: 'Choosing where to save a connection requires the interactive sign-in card. Open this action in chat.' });
20
+ const { ctx, host } = required;
21
+ ctx.signal.throwIfAborted();
22
+ const exchange = required.surfaces.surfaceExchanges.open({ binding: { toolId: required.toolId, principalId: ctx.principal.id, channel: host.channel }, emit: optional.emitSurface });
23
+ const close = () => exchange.close({});
24
+ ctx.signal.addEventListener('abort', close, { once: true });
25
+ try {
26
+ return await required.askThenReport({ exchange,
27
+ confirmationEmission: { channel: host.channel, payload: { resource: required.cards.buildFormSurface({
28
+ uri: `ui://${required.uriNamespace}/${exchange.id}`, title: `Connect ${required.pluginDisplayName}`,
29
+ description: host.messages.description,
30
+ fields: [{ kind: 'enum', name: 'destination', label: 'Save this connection', required: true, options: [
31
+ { value: 'site', label: 'Use only on this site' }, { value: 'shared', label: host.messages.sharedOptionLabel },
32
+ ] }], submitLabel: 'Continue to sign in', toolName: required.toolId, preferredFrameSize: ['100%', '1px'],
33
+ baseParams: { [SURFACE_EXCHANGE_ID_PARAM]: exchange.id },
34
+ cancel: { label: 'Cancel', toolName: required.toolId, params: { [SURFACE_EXCHANGE_ID_PARAM]: exchange.id, [SURFACE_DISMISSED_PARAM]: true } },
35
+ }) } },
36
+ handle: async (answer) => ({ result: answer.status !== 'received' || answer.params[SURFACE_DISMISSED_PARAM] === true || ctx.signal.aborted
37
+ ? null : selectedDestination(answer.params) }),
38
+ });
39
+ }
40
+ finally {
41
+ ctx.signal.removeEventListener('abort', close);
42
+ exchange.close({});
43
+ }
44
+ }
45
+ //# sourceMappingURL=connect-destination.js.map
@@ -0,0 +1,31 @@
1
+ import type { SurfaceCardSecretDeps } from '@jini-ai/core/contracts/cards';
2
+ import { type ToolExecutionContext, type ToolExecutionOptions } from '@jini-ai/core';
3
+ import type { PluginCredentialCard } from '@jini-ai/core/contracts/credentials';
4
+ import type { AgentPluginCardsPort, AgentPluginConnectCardSpec } from './connect-card-ui.js';
5
+ /** The plugin's MCP and API sign-ins share one card/exchange lifecycle. Skip cancels only the
6
+ * sign-in watcher; the enclosing agent run continues. OAuth callback/token custody stays with
7
+ * each connection owner. @complexity One bounded connection wait and one exchange per sign-in.
8
+ * @agent-note Bind the SAME core exchange store and card runtime as the host's answer callback;
9
+ * one answer wakes this waiter. The card callback preserves YOUR opaque Resource, and skip only
10
+ * aborts the sign-in watcher, never the enclosing run or the connection owner's token custody. */
11
+ export declare function waitAtAgentPluginSignInCardWithPorts<Resource, Result extends {
12
+ status: string;
13
+ }>(required: {
14
+ surfaceExchanges: SurfaceCardSecretDeps['surfaceExchanges'];
15
+ cards: AgentPluginCardsPort<Resource>;
16
+ buildCard: (spec: AgentPluginConnectCardSpec) => Resource;
17
+ toolId: string;
18
+ missingEmitterMessage: string;
19
+ skippedResult: () => Result;
20
+ ctx: ToolExecutionContext;
21
+ pluginId: string;
22
+ pluginDisplayName: string;
23
+ credentialCard?: PluginCredentialCard | undefined;
24
+ connect: (input: {
25
+ signal: AbortSignal;
26
+ showSignIn: (input: {
27
+ signInUrl: string;
28
+ }) => Promise<void>;
29
+ }) => Promise<Result>;
30
+ }, optional?: ToolExecutionOptions): Promise<Result>;
31
+ //# sourceMappingURL=connect-sign-in-wait.d.ts.map
@@ -0,0 +1,21 @@
1
+ import {} from '@jini-ai/core';
2
+ /** The plugin's MCP and API sign-ins share one card/exchange lifecycle. Skip cancels only the
3
+ * sign-in watcher; the enclosing agent run continues. OAuth callback/token custody stays with
4
+ * each connection owner. @complexity One bounded connection wait and one exchange per sign-in.
5
+ * @agent-note Bind the SAME core exchange store and card runtime as the host's answer callback;
6
+ * one answer wakes this waiter. The card callback preserves YOUR opaque Resource, and skip only
7
+ * aborts the sign-in watcher, never the enclosing run or the connection owner's token custody. */
8
+ /* `Result` is the connect tool's result (`AgentPluginConnectResult`); it is a type parameter here so the
9
+ * connect-tool <-> sign-in-wait type cycle needs no import back (the waiter only passes it through). */
10
+ export async function waitAtAgentPluginSignInCardWithPorts(required, optional = {}) {
11
+ const { cards, ctx, pluginId, pluginDisplayName, credentialCard, connect } = required;
12
+ return cards.waitAtSignInCard({
13
+ surfaceExchanges: required.surfaceExchanges, ctx, toolId: required.toolId, connect,
14
+ card: state => required.buildCard(state.state === 'waiting'
15
+ ? { pluginId, pluginDisplayName, credentialCard, ...state }
16
+ : { pluginId, pluginDisplayName, ...state }),
17
+ missingEmitterMessage: required.missingEmitterMessage,
18
+ skippedResult: required.skippedResult,
19
+ }, optional);
20
+ }
21
+ //# sourceMappingURL=connect-sign-in-wait.js.map