@jini-ai/agent-plugins 0.6.22 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (220) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/README.md +13 -0
  3. package/calendly/exports/booking-calendar.css +7 -0
  4. package/calendly/exports/booking-calendar.html +5 -0
  5. package/calendly/mcp.json +10 -0
  6. package/calendly/plugin.json +47 -0
  7. package/calendly/skills/calendly/SKILL.md +27 -0
  8. package/charts-echarts/plugin.json +2 -2
  9. package/charts-recharts/plugin.json +2 -2
  10. package/cloudflare/lib/cms-forms.mjs +57 -0
  11. package/cloudflare/lib/forms.mjs +78 -18
  12. package/cloudflare/lib/target.mjs +17 -4
  13. package/cloudflare/plugin.json +2 -2
  14. package/cloudflare/skills/cloudflare/SKILL.md +4 -4
  15. package/cloudflare/skills/cloudflare/references/workers.md +4 -4
  16. package/cloudflare/worker/forms-receiver.mjs +81 -41
  17. package/cloudflare/worker/portable-validation.mjs +220 -0
  18. package/commerce/plugin.json +17 -0
  19. package/commerce/skills/commerce/SKILL.md +23 -0
  20. package/composio/mcp.json +1 -1
  21. package/composio/plugin.json +2 -2
  22. package/composio/skills/composio/SKILL.md +4 -4
  23. package/core/commerce-server.d.ts +2 -0
  24. package/core/commerce-server.mjs +2 -0
  25. package/dist/admin-surfaces/connections/connections.d.ts +35 -0
  26. package/dist/admin-surfaces/connections/connections.js +135 -0
  27. package/dist/admin-surfaces/connections/index.d.ts +3 -0
  28. package/dist/admin-surfaces/connections/index.js +2 -0
  29. package/dist/admin-surfaces/connections/ports.d.ts +110 -0
  30. package/dist/admin-surfaces/connections/ports.js +2 -0
  31. package/dist/admin-surfaces/index.d.ts +2 -0
  32. package/dist/admin-surfaces/index.js +1 -0
  33. package/dist/admin-surfaces/plugin-state-persistence.d.ts +27 -0
  34. package/dist/admin-surfaces/plugin-state-persistence.js +2 -0
  35. package/dist/admin-surfaces/plugin-state.d.ts +51 -0
  36. package/dist/admin-surfaces/plugin-state.js +106 -0
  37. package/dist/connect/access-token-tool.d.ts +240 -0
  38. package/dist/connect/access-token-tool.js +213 -0
  39. package/dist/connect/apply-connect-defaults.d.ts +91 -0
  40. package/dist/connect/apply-connect-defaults.js +113 -0
  41. package/dist/connect/apply-tool-renames.d.ts +72 -0
  42. package/dist/connect/apply-tool-renames.js +105 -0
  43. package/dist/connect/connect-card-ui.d.ts +143 -0
  44. package/dist/connect/connect-card-ui.js +106 -0
  45. package/dist/connect/connect-destination.d.ts +35 -0
  46. package/dist/connect/connect-destination.js +45 -0
  47. package/dist/connect/connect-sign-in-wait.d.ts +31 -0
  48. package/dist/connect/connect-sign-in-wait.js +21 -0
  49. package/dist/connect/connect-tool.d.ts +314 -0
  50. package/dist/connect/connect-tool.js +431 -0
  51. package/dist/connect/connection-status.d.ts +33 -0
  52. package/dist/connect/connection-status.js +63 -0
  53. package/dist/connect/credential-cards.d.ts +15 -0
  54. package/dist/connect/credential-cards.js +49 -0
  55. package/dist/connect/credential-save-tool.d.ts +45 -0
  56. package/dist/connect/credential-save-tool.js +156 -0
  57. package/dist/connect/enable-access.d.ts +67 -0
  58. package/dist/connect/enable-access.js +74 -0
  59. package/dist/connect/executable/approval.d.ts +58 -0
  60. package/dist/connect/executable/approval.js +40 -0
  61. package/dist/connect/executable/host-capabilities.d.ts +76 -0
  62. package/dist/connect/executable/host-capabilities.js +100 -0
  63. package/dist/connect/executable/index.d.ts +10 -0
  64. package/dist/connect/executable/index.js +9 -0
  65. package/dist/connect/executable/ports.d.ts +189 -0
  66. package/dist/connect/executable/ports.js +2 -0
  67. package/dist/connect/executable/register.d.ts +21 -0
  68. package/dist/connect/executable/register.js +125 -0
  69. package/dist/connect/federate-mcp.d.ts +190 -0
  70. package/dist/connect/federate-mcp.js +440 -0
  71. package/dist/connect/grant-signed-in-defaults.d.ts +96 -0
  72. package/dist/connect/grant-signed-in-defaults.js +100 -0
  73. package/dist/connect/import-access-token.d.ts +114 -0
  74. package/dist/connect/import-access-token.js +103 -0
  75. package/dist/connect/index.d.ts +19 -0
  76. package/dist/connect/index.js +19 -0
  77. package/dist/connect/plugin-credential-card.d.ts +46 -0
  78. package/dist/connect/plugin-credential-card.js +63 -0
  79. package/dist/connect/plugin-host/index.d.ts +203 -0
  80. package/dist/connect/plugin-host/index.js +153 -0
  81. package/dist/connect/ports.d.ts +74 -0
  82. package/dist/connect/ports.js +2 -0
  83. package/dist/connect/switch-on-saved-token.d.ts +48 -0
  84. package/dist/connect/switch-on-saved-token.js +20 -0
  85. package/dist/connect/token-sign-in.d.ts +51 -0
  86. package/dist/connect/token-sign-in.js +43 -0
  87. package/dist/core/identity-namespace.d.ts +39 -0
  88. package/dist/core/identity-namespace.js +61 -3
  89. package/dist/folder-zip-node.js +3 -1
  90. package/dist/lifecycle/automatic-use.d.ts +12 -7
  91. package/dist/lifecycle/automatic-use.js +37 -28
  92. package/dist/lifecycle/capability-projection.js +5 -1
  93. package/dist/lifecycle/contribution-loader.d.ts +2 -7
  94. package/dist/lifecycle/contribution-types.d.ts +8 -0
  95. package/dist/lifecycle/contribution-types.js +2 -0
  96. package/dist/lifecycle/credential-card-metadata.d.ts +23 -0
  97. package/dist/lifecycle/credential-card-metadata.js +184 -0
  98. package/dist/lifecycle/exports.d.ts +11 -0
  99. package/dist/lifecycle/exports.js +64 -3
  100. package/dist/lifecycle/host-tools/identity.d.ts +38 -0
  101. package/dist/lifecycle/host-tools/identity.js +58 -0
  102. package/dist/lifecycle/host-tools/index.d.ts +20 -0
  103. package/dist/lifecycle/host-tools/index.js +20 -0
  104. package/dist/lifecycle/host-tools/memory-tools.d.ts +22 -0
  105. package/dist/lifecycle/host-tools/memory-tools.js +63 -0
  106. package/dist/lifecycle/host-tools/ports.d.ts +121 -0
  107. package/dist/lifecycle/host-tools/ports.js +2 -0
  108. package/dist/lifecycle/host-tools/provider-status-tool.d.ts +88 -0
  109. package/dist/lifecycle/host-tools/provider-status-tool.js +45 -0
  110. package/dist/lifecycle/host-tools/search-tool.d.ts +74 -0
  111. package/dist/lifecycle/host-tools/search-tool.js +282 -0
  112. package/dist/lifecycle/host-tools/skill-tool.d.ts +219 -0
  113. package/dist/lifecycle/host-tools/skill-tool.js +482 -0
  114. package/dist/lifecycle/host-tools/write-note-tool.d.ts +22 -0
  115. package/dist/lifecycle/host-tools/write-note-tool.js +47 -0
  116. package/dist/lifecycle/index.d.ts +2 -1
  117. package/dist/lifecycle/install.js +2 -1
  118. package/dist/lifecycle/installed-package-index.js +5 -8
  119. package/dist/lifecycle/mail/adapter-descriptors.d.ts +78 -0
  120. package/dist/lifecycle/mail/adapter-descriptors.js +155 -0
  121. package/dist/lifecycle/mail/catalog.d.ts +116 -0
  122. package/dist/lifecycle/mail/catalog.js +72 -0
  123. package/dist/lifecycle/mail/configuration.d.ts +25 -0
  124. package/dist/lifecycle/mail/configuration.js +62 -0
  125. package/dist/lifecycle/mail/contribution.d.ts +89 -0
  126. package/dist/lifecycle/mail/contribution.js +115 -0
  127. package/dist/lifecycle/mail/host-mailer.d.ts +24 -0
  128. package/dist/lifecycle/mail/host-mailer.js +10 -0
  129. package/dist/lifecycle/mail/index.d.ts +16 -0
  130. package/dist/lifecycle/mail/index.js +16 -0
  131. package/dist/lifecycle/mail/selection.d.ts +40 -0
  132. package/dist/lifecycle/mail/selection.js +86 -0
  133. package/dist/lifecycle/manifest.d.ts +7 -2
  134. package/dist/lifecycle/manifest.js +32 -9
  135. package/dist/lifecycle/metadata.d.ts +31 -0
  136. package/dist/lifecycle/metadata.js +80 -0
  137. package/dist/lifecycle/persistent-state.js +2 -1
  138. package/dist/lifecycle/ports.d.ts +2 -0
  139. package/dist/lifecycle/resolve-agent-plugin-refs.d.ts +2 -1
  140. package/dist/lifecycle/resolve-agent-plugin-refs.js +14 -8
  141. package/dist/lifecycle/search-projection.d.ts +3 -4
  142. package/dist/lifecycle/search-projection.js +5 -7
  143. package/dist/lifecycle/search.js +3 -2
  144. package/fly/plugin.json +5 -5
  145. package/fly/skills/fly/SKILL.md +1 -1
  146. package/formspree/plugin.json +7 -0
  147. package/formspree/skills/formspree/SKILL.md +11 -0
  148. package/github/plugin.json +2 -2
  149. package/github/skills/github/SKILL.md +28 -28
  150. package/github/skills/github/references/actions.md +8 -8
  151. package/github/skills/github/references/auth-and-tokens.md +7 -7
  152. package/github/skills/github/references/repo-files.md +5 -5
  153. package/github/skills/github/references/site-backup.md +16 -16
  154. package/github/skills/github/references/source-control.md +17 -17
  155. package/github-pages/plugin.json +2 -2
  156. package/github-pages/skills/github-pages/SKILL.md +3 -3
  157. package/google-forms/plugin.json +7 -0
  158. package/google-forms/skills/google-forms/SKILL.md +15 -0
  159. package/google-login/plugin.json +3 -3
  160. package/google-login/skills/google-login/SKILL.md +17 -60
  161. package/google-workspace/plugin.json +6 -6
  162. package/google-workspace/skills/google-workspace/references/connection.md +1 -1
  163. package/google-workspace/skills/google-workspace/references/form-delivery.md +4 -4
  164. package/google-workspace/tovu-admin-surfaces.json +5 -5
  165. package/higgsfield-media/plugin.json +5 -5
  166. package/higgsfield-media/skills/higgsfield-media/SKILL.md +31 -33
  167. package/higgsfield-media/skills/higgsfield-media/references/failure-modes.md +7 -7
  168. package/higgsfield-media/skills/higgsfield-media/references/models-and-plan-gates.md +3 -3
  169. package/jev/plugin.json +2 -2
  170. package/langfuse/plugin.json +2 -2
  171. package/meilisearch/plugin.json +2 -2
  172. package/meilisearch/skills/meilisearch/SKILL.md +1 -1
  173. package/netlify/plugin.json +2 -2
  174. package/netlify/skills/netlify/SKILL.md +3 -3
  175. package/opentelemetry/plugin.json +2 -2
  176. package/opentelemetry/skills/opentelemetry/SKILL.md +7 -7
  177. package/package.json +92 -14
  178. package/posthog/plugin.json +2 -2
  179. package/posthog/skills/posthog/SKILL.md +7 -7
  180. package/railway/plugin.json +3 -3
  181. package/railway/skills/railway/SKILL.md +10 -11
  182. package/render/plugin.json +3 -3
  183. package/render/skills/render/SKILL.md +7 -8
  184. package/resend/NOTES.md +2 -2
  185. package/resend/mcp.json +1 -1
  186. package/resend/plugin.json +5 -5
  187. package/resend/skills/resend/SKILL.md +13 -13
  188. package/s3-compatible/plugin.json +2 -2
  189. package/s3-compatible/skills/s3-compatible/SKILL.md +4 -4
  190. package/sentry/plugin.json +2 -2
  191. package/sentry/skills/sentry/SKILL.md +7 -7
  192. package/shopify/plugin.json +2 -2
  193. package/site-compliance/plugin.json +2 -2
  194. package/site-compliance/skills/site-compliance/SKILL.md +3 -3
  195. package/site-compliance/skills/site-compliance/references/gdpr-eu-uk.md +1 -1
  196. package/site-import/plugin.json +2 -2
  197. package/slide-design/plugin.json +2 -2
  198. package/software-engineering/LICENSE +201 -0
  199. package/software-engineering/NOTICE +9 -0
  200. package/software-engineering/README.md +89 -0
  201. package/software-engineering/plugin.json +24 -0
  202. package/software-engineering/skills/software-engineering/SKILL.md +33 -0
  203. package/software-engineering/skills/software-engineering/references/debugging.md +54 -0
  204. package/software-engineering/skills/software-engineering/references/implementation.md +27 -0
  205. package/software-engineering/skills/software-engineering/references/planning.md +27 -0
  206. package/software-engineering/skills/software-engineering/references/prototyping.md +14 -0
  207. package/software-engineering/skills/software-engineering/references/security.md +47 -0
  208. package/software-engineering/skills/software-engineering/references/verification.md +53 -0
  209. package/stripe/plugin.json +2 -2
  210. package/supabase/mcp.json +4 -4
  211. package/supabase/plugin.json +3 -3
  212. package/supabase/skills/supabase/SKILL.md +8 -8
  213. package/supabase/skills/supabase/references/failure-modes.md +5 -5
  214. package/ui-ux-design/plugin.json +2 -2
  215. package/vercel/plugin.json +2 -2
  216. package/vercel/skills/vercel/SKILL.md +3 -3
  217. package/wordpress/plugin.json +2 -2
  218. package/wordpress/skills/wordpress/SKILL.md +3 -3
  219. package/wordpress/skills/wordpress/references/free-site-redirect.md +2 -2
  220. package/wordpress/skills/wordpress/references/subdomain.md +5 -5
@@ -0,0 +1,314 @@
1
+ import type { PluginCredentialCard } from "@jini-ai/core/contracts/credentials";
2
+ import type { ExternalMcpConnectStart } from "@jini-ai/core/contracts/hosted-mcp";
3
+ import { type DerivedRiskByToolId, type AgentToolDefinition, type AccessApprovalDescription, type ToolHandler } from "@jini-ai/core";
4
+ import { type LegacyToolAuthorizeFn as AuthorizeFn } from "@jini-ai/core";
5
+ import { type ToolExecutionOptions, type ToolExecutionContext } from "@jini-ai/core";
6
+ import { type AgentPluginMcpTrustClassifier } from "./federate-mcp.js";
7
+ import { type AgentPluginEnableAccessMessages } from "./enable-access.js";
8
+ import type { AgentPluginMcpPort, AgentPluginMcpRecord, AgentPluginMcpProjectionPorts, AgentPluginMcpProjections } from "./ports.js";
9
+ import type { McpServerConfig } from "../lifecycle/manifest.js";
10
+ /** One installed plugin's declared MCP servers — the slice `agent_plugin_connect` needs. Kept
11
+ * narrower than `InstalledAgentPlugin` (no version/keywords/skills: this tool cares only about
12
+ * what it can connect). */
13
+ /** @agent-note A fresh trusted installed declaration from your lifecycle owner, shared with
14
+ * provisioning/approval. Credential cards contain safe display copy, never saved credentials. */
15
+ export interface ResolvedAgentPluginForConnect {
16
+ readonly credentialCards?: readonly PluginCredentialCard[];
17
+ readonly servers: Readonly<Record<string, McpServerConfig>>;
18
+ }
19
+ /** "supabase" -> "Supabase", "higgsfield-media" -> "Higgsfield Media". There is no separate
20
+ * display-name field in `plugin.json` (agent-plugins.org has none) — `uninstall-confirmation-ui.ts`'s
21
+ * own dialog makes the identical choice, naming the plugin by its id. */
22
+ export declare function titleCaseFromPluginId(required: {
23
+ pluginId: string;
24
+ }, _optional?: Record<string, never>): string;
25
+ /** The sign-in start this tool needs: only a hosted `redirect_required` start opens the connect card.
26
+ * @agent-note Second host: bind your hosted-MCP OAuth service. `isSignInRefusal` is true only for a
27
+ * refusal that opened NO card (chat then offers the key-card fallback); every other fault returns false
28
+ * and propagates unchanged. Matching never makes a message safe: this tool redacts before model text. */
29
+ export interface AgentPluginConnectSignInPort {
30
+ beginConnect(input: {
31
+ serverId: string;
32
+ redirectUri?: string | undefined;
33
+ delivery?: "hosted";
34
+ }, options?: Record<string, never>): Promise<ExternalMcpConnectStart>;
35
+ isSignInRefusal(required: {
36
+ error: unknown;
37
+ }, optional?: Record<string, never>): boolean;
38
+ }
39
+ /** Declared API connections; the host retains OAuth clients, browser binding and token custody.
40
+ * @agent-note Second host: `Connection` is your own declaration record, passed through unchanged
41
+ * (this tool never reads it). `connect` resolves with a safe connect result, never a token or URL. */
42
+ export interface AgentPluginConnectApiConnectionsPort<Connection> {
43
+ /** @agent-note True only when your host can save one connection for several sites. */
44
+ readonly sharingAvailable?: boolean;
45
+ listConnections(input: {
46
+ pluginId: string;
47
+ }, options?: Record<string, never>): Promise<readonly Connection[]>;
48
+ connect(input: {
49
+ destination?: 'site' | 'shared';
50
+ connection: Connection;
51
+ actorId: string;
52
+ signal: AbortSignal;
53
+ pollIntervalMs: number;
54
+ waitTimeoutMs: number;
55
+ showSignIn: (input: {
56
+ readonly signInUrl: string;
57
+ }) => Promise<void>;
58
+ }, options?: Record<string, never>): Promise<AgentPluginConnectResult>;
59
+ }
60
+ /** The host's approval lifecycle for a fixed access change (the common access card).
61
+ * @agent-note Second host: bind your one approval owner (typically a wrapper over core's
62
+ * `createApprovalHandler`). It MUST: freeze `ctx` and bind the confirming principal before `prepare`;
63
+ * render `describe`'s access card and wait for the human; call `run` only after an explicit confirm, with
64
+ * the bound ctx (so `run` re-checks permission, activation and the `prepared.key` fingerprint itself);
65
+ * forward `emitSurface`/execution options unchanged; and call `declined` (never `run`) on decline,
66
+ * expiry or abort. `ask` false means nothing needs consent and `run` proceeds without a card. */
67
+ export interface AgentPluginConnectApprovalsPort<Surfaces> {
68
+ /** @agent-note Fail closed unless the bound authenticated approver is an active human,
69
+ * checked BEFORE disclosing the prepared access card and AGAIN after explicit confirmation,
70
+ * before `run`. The authenticated answer must bind the same tool/exchange, scope and person
71
+ * as the frozen requesting context; caller-supplied answer fields cannot establish authority.
72
+ * Missing, stale, revoked or mismatched authority must never disclose the card or run the grant.
73
+ * Recheck permission, activation and the prepared access fingerprint after confirmation too. */
74
+ accessApprovalHandler<Prepared>(required: {
75
+ surfaces: Surfaces;
76
+ prepare(required: {
77
+ ctx: ToolExecutionContext;
78
+ }, optional: ToolExecutionOptions): Promise<Prepared>;
79
+ describe(required: {
80
+ ctx: ToolExecutionContext;
81
+ prepared: Prepared;
82
+ }): AgentPluginAccessApprovalDescription;
83
+ run(required: {
84
+ ctx: ToolExecutionContext;
85
+ prepared: Prepared;
86
+ }, optional: ToolExecutionOptions): Promise<unknown>;
87
+ }, optional: {
88
+ ask(required: {
89
+ prepared: Prepared;
90
+ }): boolean;
91
+ declined(required: {
92
+ reason: 'declined' | 'expired' | 'abandoned';
93
+ prepared?: Prepared;
94
+ }): unknown;
95
+ }): ToolHandler;
96
+ /** @agent-note Your host's standard not-confirmed result (its exact bytes are merged into this tool's result). */
97
+ notConfirmedResult(required: {
98
+ reason: 'declined' | 'expired' | 'abandoned';
99
+ }): {
100
+ cancelled: boolean;
101
+ reason?: 'expired' | 'abandoned';
102
+ note: string;
103
+ };
104
+ }
105
+ /** What this tool asks the approvals port to render. Wording is neutral; ids are host input.
106
+ * @agent-note Render this fixed description through your approval owner; its display ids do not
107
+ * replace the bound principal or the prepared access fingerprint rechecked by run. */
108
+ export interface AgentPluginAccessApprovalDescription {
109
+ readonly toolId: string;
110
+ readonly errorCode: string;
111
+ readonly title: string;
112
+ readonly access?: AccessApprovalDescription;
113
+ readonly details: readonly never[];
114
+ readonly description: string;
115
+ readonly confirmLabel: string;
116
+ }
117
+ /** Product wording and tool names this tool's refusals carry; every member is required host copy.
118
+ * @agent-note Second host: name YOUR tool ids, settings screen and product; keep each refusal a plain
119
+ * sentence the model can relay. `detail` in `signInRefused` is already redacted. */
120
+ export interface AgentPluginConnectMessages {
121
+ signInRefused(required: {
122
+ detail: string;
123
+ }): string;
124
+ unsupportedSignIn(required: {
125
+ kind: string;
126
+ }): string;
127
+ connectionNotSetUp(required: {
128
+ pluginId: string;
129
+ serverKey: string;
130
+ }): string;
131
+ multipleTokenServers(required: {
132
+ pluginId: string;
133
+ }): string;
134
+ noTokenCardAdapter(): string;
135
+ /** `credentialCards` is given only for a plugin that declares no OAuth sign-in: its key cards, to name instead of a connect retry. */
136
+ pluginOff(required: {
137
+ pluginId: string;
138
+ }, optional?: {
139
+ credentialCards?: readonly PluginCredentialCard[];
140
+ }): string;
141
+ notInstalled(required: {
142
+ pluginId: string;
143
+ }): string;
144
+ noOAuthService(): string;
145
+ multipleOAuthServers(required: {
146
+ pluginId: string;
147
+ serverKeys: readonly string[];
148
+ }): string;
149
+ noConnection(required: {
150
+ pluginId: string;
151
+ }): string;
152
+ multipleApiConnections(required: {
153
+ pluginId: string;
154
+ count: number;
155
+ }): string;
156
+ /** @agent-note Shown when the context has no `emitSurface`; the same text your sign-in card host uses. */
157
+ missingEmitter(): string;
158
+ }
159
+ /** Everything product-specific this tool needs, bound once by the host.
160
+ * @agent-note Second host: none of these has a default here. `toolId` is the id your card answers and
161
+ * approvals route back to; `permissions.connect` gates the tool and its approval re-check;
162
+ * `permissions.apiConnectionWrite` gates saving a declared API connection; `entityType` and
163
+ * `approvalErrorCode` are your authorization/approval vocabulary. */
164
+ export interface AgentPluginConnectHost<Surfaces> {
165
+ readonly toolId: string;
166
+ readonly permissions: {
167
+ readonly connect: string;
168
+ readonly apiConnectionWrite: string;
169
+ };
170
+ readonly entityType: string;
171
+ readonly approvalErrorCode: string;
172
+ readonly approvals: AgentPluginConnectApprovalsPort<Surfaces>;
173
+ readonly messages: AgentPluginConnectMessages;
174
+ /** @agent-note Your public OAuth callback URL for `serverId`, or undefined when your host has no public
175
+ * origin (then `beginConnect` decides). Operator configuration precedence is yours to keep. */
176
+ readonly publicUrl: {
177
+ redirectUri(required: {
178
+ serverId: string;
179
+ derivedPublicOrigin?: string | undefined;
180
+ }): string | undefined;
181
+ };
182
+ /** @agent-note Your lifecycle trust rule and federation/enable-access refusal copy (same objects your
183
+ * provisioning and enable-access previews use, so plans and fingerprints agree). */
184
+ readonly federation: {
185
+ readonly classifyTrust: AgentPluginMcpTrustClassifier;
186
+ readonly messages: AgentPluginEnableAccessMessages;
187
+ };
188
+ /** @agent-note Actor recorded when a person declines the access card (`AgentPluginConnectActors.connectDeclined`). */
189
+ readonly actors: {
190
+ readonly connectDeclined: string;
191
+ };
192
+ /** @agent-note Your sign-in card waiter (typically `waitAtAgentPluginSignInCardWithPorts` bound to your cards,
193
+ * card identity and SAME process exchange store). Skip resolves with your skipped result. */
194
+ waitAtSignInCard(required: {
195
+ surfaces: Surfaces;
196
+ ctx: ToolExecutionContext;
197
+ pluginId: string;
198
+ pluginDisplayName: string;
199
+ credentialCard?: PluginCredentialCard | undefined;
200
+ connect: (input: {
201
+ signal: AbortSignal;
202
+ showSignIn: (input: {
203
+ signInUrl: string;
204
+ }) => Promise<void>;
205
+ }) => Promise<AgentPluginConnectResult>;
206
+ }, optional: ToolExecutionOptions): Promise<AgentPluginConnectResult>;
207
+ /** @agent-note Your destination card (typically `chooseApiConnectionDestinationWithPorts`); null = cancelled. */
208
+ chooseDestination(required: {
209
+ surfaces: Surfaces;
210
+ ctx: ToolExecutionContext;
211
+ pluginDisplayName: string;
212
+ available: boolean;
213
+ }, optional: ToolExecutionOptions): Promise<'site' | 'shared' | null>;
214
+ }
215
+ /** Consumer-owned services; composition binds persistence, secret custody and sign-in providers.
216
+ * OAuth remains optional so token-only declarations work without an OAuth service.
217
+ * @agent-note Second host: `mcp` carries your canonical projection pair (never copies); `isPluginEnabled`
218
+ * and `resolveInstalledPlugin` are your fresh activation owner and installed-declaration read (no
219
+ * filesystem default here). */
220
+ export interface AgentPluginConnectDeps<Surfaces, Connection> {
221
+ readonly ownerPrincipalId?: Promise<string>;
222
+ /** Fresh activation owner; injected so OFF-plugin refusal needs no filesystem in unit tests. */
223
+ readonly isPluginEnabled: (pluginId: string) => Promise<boolean>;
224
+ readonly credentials: {
225
+ loadSafe(input: {
226
+ workspaceId: string;
227
+ }, options?: Record<string, never>): Promise<readonly PluginCredentialCard[]>;
228
+ };
229
+ readonly workspaceId: string;
230
+ readonly authorize: AuthorizeFn;
231
+ readonly mcp: AgentPluginMcpProjectionPorts & Pick<AgentPluginMcpPort, "repo" | "saveServer" | "applyAccess"> & Partial<Pick<AgentPluginMcpPort, "notifyRosterChanged">>;
232
+ readonly externalMcpOAuth?: AgentPluginConnectSignInPort;
233
+ readonly derivedPublicOrigin?: string | undefined;
234
+ /** Injectable for tests; a real composition root omits both and gets the production cadence. */
235
+ readonly pollIntervalMs?: number;
236
+ readonly waitTimeoutMs?: number;
237
+ /** The installed plugin's declarations (a fixture in tests; the host's installed read in production). */
238
+ readonly resolveInstalledPlugin: (pluginId: string) => Promise<ResolvedAgentPluginForConnect | null>;
239
+ /** Plugin-declared OAuth API connections. Absent: only MCP servers connect. */
240
+ readonly apiConnections?: AgentPluginConnectApiConnectionsPort<Connection>;
241
+ readonly host: AgentPluginConnectHost<Surfaces>;
242
+ }
243
+ /** This tool's one-entry catalog, built from host copy (tool id, permission, description and the
244
+ * pluginId schema text are product vocabulary).
245
+ * @agent-note Second host: pass your own tool id/permission/description bytes; the schema shape is fixed. */
246
+ export declare function agentPluginConnectAgentToolCatalogFor(required: {
247
+ toolId: string;
248
+ permission: string;
249
+ description: string;
250
+ pluginIdDescription: string;
251
+ }, _optional?: Record<string, never>): AgentToolDefinition[];
252
+ /** @agent-note Second host: key by your own tool id. */
253
+ export declare function agentPluginConnectDerivedRiskFor(required: {
254
+ toolId: string;
255
+ }, _optional?: Record<string, never>): DerivedRiskByToolId;
256
+ /** Whether a plugin's row already holds a credential: a finished sign-in, or a saved access token
257
+ * (`static_env` with the token sealed in `sealedOAuth` — what `agent_plugin_set_access_token`, the
258
+ * old env var's boot import, and create-site onboarding all write; `sealedEnv` is a stdio row's env
259
+ * block and never holds it). Such a row needs no sign-in, and a token import must never overwrite it.
260
+ * @agent-note Pass the canonical store's SAME pure projection pair; this check performs no I/O,
261
+ * opens no sealed material and must not replace an existing credential with a fresh grant. */
262
+ export declare function hasStoredAgentPluginCredential(required: {
263
+ row: Pick<AgentPluginMcpRecord, "authMode" | "sealedOAuth" | "oauthStatus">;
264
+ projections: AgentPluginMcpProjections;
265
+ }, _optional?: Record<string, never>): boolean;
266
+ /** The injected adapter calls the existing token-card lifecycle without a runtime import cycle.
267
+ * @agent-note Bind your token-card owner with the SAME principal, emitter/options and exchange
268
+ * store. Only safe saved/refusal results return; plaintext tokens never pass through this adapter. */
269
+ export type AgentPluginConnectOptions = ToolExecutionOptions & {
270
+ readonly saveToken?: (input: {
271
+ readonly ctx: ToolExecutionContext;
272
+ readonly pluginId: string;
273
+ }, optional?: ToolExecutionOptions) => Promise<{
274
+ readonly saved: true;
275
+ readonly next: string;
276
+ } | {
277
+ readonly saved: false;
278
+ readonly reason: string;
279
+ readonly message?: string;
280
+ }>;
281
+ };
282
+ /** @agent-note Public connection status only. Host refusal/next-step copy must be safe; no token,
283
+ * provider response body or private sign-in state belongs in these fields. */
284
+ export interface AgentPluginConnectResult {
285
+ readonly status: "connected" | "waiting-for-sign-in" | "not-connected";
286
+ readonly cancelled?: boolean;
287
+ readonly note?: string;
288
+ readonly connectionRef?: string;
289
+ readonly reason?: string;
290
+ readonly message?: string;
291
+ readonly next?: string;
292
+ }
293
+ /**
294
+ * Runs `agent_plugin_connect`: permission, resolve, then the declared token, OAuth or API flow.
295
+ * @example runAgentPluginConnect({ routeDeps, surfaces, ctx, pluginId }, { saveToken });
296
+ *
297
+ * @returns Safe connection status; token-card failure reasons remain observable.
298
+ * @throws {import("@jini-ai/core").ToolInputError} An unknown `pluginId`, unsupported connection,
299
+ * ambiguous token servers or more than one still-unconnected OAuth server (see the header).
300
+ * @throws {Error} No `externalMcpOAuth` was wired, or this execution context has no `emitSurface` —
301
+ * both composition-root/transport gaps, not caller input.
302
+ * @complexity O(s) provisioning the plugin's declared servers, plus the poll loop (bounded by
303
+ * `waitTimeoutMs`); O(s) space for pending declarations.
304
+ * @agent-note Fulfill AgentPluginConnectDeps with one host's stores/approvals/activation owners.
305
+ * Permission and prepared-key rechecks stay in run; approval precedes provisioning/sign-in and
306
+ * the final access revalidation. Forward the caller's emitter and execution options unchanged.
307
+ */
308
+ export declare function runAgentPluginConnect<Surfaces, Connection>({ routeDeps, surfaces, ctx, pluginId }: {
309
+ routeDeps: AgentPluginConnectDeps<Surfaces, Connection>;
310
+ surfaces: Surfaces;
311
+ ctx: ToolExecutionContext;
312
+ pluginId: string;
313
+ }, optional?: AgentPluginConnectOptions): Promise<AgentPluginConnectResult>;
314
+ //# sourceMappingURL=connect-tool.d.ts.map