@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.
- package/CHANGELOG.md +2 -0
- package/README.md +22 -4
- package/calendly/README.md +29 -0
- package/calendly/mcp.json +1 -1
- package/cloudflare/lib/assets.mjs +1 -1
- package/cloudflare/lib/cms-forms.mjs +1 -1
- package/core/persistent-state.d.ts +4 -1
- package/core/persistent-state.js +55 -21
- package/dist/admin-surfaces/callback-field-inbox.d.ts +1 -6
- package/dist/admin-surfaces/connections/connections.d.ts +2 -6
- package/dist/admin-surfaces/connections/index.d.ts +3 -2
- package/dist/admin-surfaces/index.d.ts +3 -1
- package/dist/connect/access-token-tool.d.ts +1 -1
- package/dist/connect/access-token-tool.js +1 -1
- package/dist/connect/catalog.d.ts +26 -0
- package/dist/connect/catalog.js +42 -0
- package/dist/connect/connect-tool.d.ts +2 -294
- package/dist/connect/connect-tool.js +2 -53
- package/dist/connect/contracts.d.ts +257 -0
- package/dist/connect/contracts.js +2 -0
- package/dist/connect/credential-cards.d.ts +2 -0
- package/dist/connect/credential-cards.js +7 -4
- package/dist/connect/grant-signed-in-defaults.js +1 -1
- package/dist/connect/host-deps.d.ts +32 -0
- package/dist/connect/host-deps.js +35 -0
- package/dist/connect/import-access-token.js +1 -1
- package/dist/connect/index.d.ts +7 -2
- package/dist/connect/index.js +5 -2
- package/dist/connect/installed-plugin.d.ts +28 -0
- package/dist/connect/installed-plugin.js +19 -0
- package/dist/connect/new-site-agent-plugin-tokens.d.ts +88 -0
- package/dist/connect/new-site-agent-plugin-tokens.js +107 -0
- package/dist/connect/plugin-host/index.d.ts +2 -2
- package/dist/connect/plugin-host/index.js +19 -10
- package/dist/connect/token-sign-in.d.ts +1 -14
- package/dist/connect/token-sign-in.js +4 -23
- package/dist/core/export-props.d.ts +10 -0
- package/dist/core/export-props.js +31 -0
- package/dist/core/folder-zip-error.d.ts +5 -0
- package/dist/core/folder-zip-error.js +8 -0
- package/dist/core/host-incompatible-error.d.ts +8 -0
- package/dist/core/host-incompatible-error.js +9 -0
- package/dist/core/identity-namespace.d.ts +27 -16
- package/dist/core/identity-namespace.js +25 -22
- package/dist/core/plugin-display-name.d.ts +7 -0
- package/dist/core/plugin-display-name.js +11 -0
- package/dist/core/provider-plugin-link.d.ts +7 -0
- package/dist/core/provider-plugin-link.js +5 -0
- package/dist/{connect → core}/token-map.d.ts +11 -1
- package/dist/{connect → core}/token-map.js +15 -0
- package/dist/core/token-sign-in-list.d.ts +18 -0
- package/dist/core/token-sign-in-list.js +23 -0
- package/dist/core/update-error.d.ts +8 -0
- package/dist/core/update-error.js +9 -0
- package/dist/{lifecycle → core}/update-plan.d.ts +1 -1
- package/dist/ffmpeg-transcode/adapter.d.ts +74 -0
- package/dist/ffmpeg-transcode/adapter.js +155 -0
- package/dist/folder-zip-node.d.ts +2 -1
- package/dist/folder-zip-node.js +6 -5
- package/dist/folder-zip.d.ts +0 -4
- package/dist/folder-zip.js +1 -7
- package/dist/index.d.ts +3 -1
- package/dist/lifecycle/activation.d.ts +39 -3
- package/dist/lifecycle/activation.js +467 -418
- package/dist/lifecycle/automatic-use-offer.d.ts +62 -0
- package/dist/lifecycle/automatic-use-offer.js +52 -0
- package/dist/lifecycle/automatic-use.d.ts +33 -1
- package/dist/lifecycle/automatic-use.js +157 -38
- package/dist/lifecycle/bundled-source-archive.d.ts +1 -1
- package/dist/lifecycle/capability-projection.d.ts +0 -1
- package/dist/lifecycle/capability-projection.js +92 -23
- package/dist/lifecycle/compatibility-metadata.d.ts +1 -0
- package/dist/lifecycle/compatibility-metadata.js +6 -1
- package/dist/lifecycle/compatibility.d.ts +1 -8
- package/dist/lifecycle/compatibility.js +1 -8
- package/dist/lifecycle/credential-card-metadata.d.ts +2 -2
- package/dist/lifecycle/exports.d.ts +2 -45
- package/dist/lifecycle/exports.js +1 -30
- package/dist/lifecycle/host-tools/identity.d.ts +5 -4
- package/dist/lifecycle/host-tools/identity.js +5 -5
- package/dist/lifecycle/host-tools/ports.d.ts +10 -1
- package/dist/lifecycle/host-tools/search-tool.d.ts +4 -2
- package/dist/lifecycle/host-tools/search-tool.js +19 -8
- package/dist/lifecycle/host-tools/skill-tool.js +1 -1
- package/dist/lifecycle/index.d.ts +20 -17
- package/dist/lifecycle/index.js +5 -4
- package/dist/lifecycle/install-from-url.d.ts +1 -2
- package/dist/lifecycle/install.d.ts +4 -34
- package/dist/lifecycle/install.js +3 -3
- package/dist/lifecycle/installed-package-index.d.ts +1 -1
- package/dist/lifecycle/installed-package-index.js +4 -4
- package/dist/lifecycle/layout.d.ts +21 -25
- package/dist/lifecycle/layout.js +79 -0
- package/dist/lifecycle/manifest.d.ts +10 -7
- package/dist/lifecycle/manifest.js +20 -15
- package/dist/lifecycle/mcp-provisioning.d.ts +1 -1
- package/dist/lifecycle/metadata.d.ts +6 -3
- package/dist/lifecycle/metadata.js +2 -1
- package/dist/lifecycle/package-paths.js +59 -56
- package/dist/lifecycle/persistent-state.d.ts +10 -1
- package/dist/lifecycle/persistent-state.js +4 -2
- package/dist/lifecycle/ports.d.ts +18 -6
- package/dist/lifecycle/resolve-agent-plugin-refs.d.ts +2 -14
- package/dist/lifecycle/retire-bundled.d.ts +1 -1
- package/dist/lifecycle/search-projection.d.ts +3 -1
- package/dist/lifecycle/search-projection.js +7 -3
- package/dist/lifecycle/search.d.ts +1 -0
- package/dist/lifecycle/seed-bundled.d.ts +86 -1
- package/dist/lifecycle/seed-bundled.js +48 -84
- package/dist/lifecycle/set-enabled.d.ts +1 -13
- package/dist/lifecycle/set-enabled.js +11 -7
- package/dist/lifecycle/trusted-plugin-files.d.ts +1 -1
- package/dist/lifecycle/trusted-plugin-files.js +33 -30
- package/dist/lifecycle/types.d.ts +13 -34
- package/dist/lifecycle/uninstall.d.ts +1 -33
- package/dist/lifecycle/update-store.d.ts +0 -7
- package/dist/lifecycle/update-store.js +1 -8
- package/dist/lifecycle/update.d.ts +1 -1
- package/dist/lifecycle/update.js +60 -10
- package/dist/lifecycle/yauzl-archive-reader.d.ts +7 -2
- package/dist/lifecycle/yauzl-archive-reader.js +11 -6
- package/dist/manifest.d.ts +4 -8
- package/dist/react/AgentPluginDetailsModal.d.ts +187 -0
- package/dist/react/AgentPluginDetailsModal.js +29 -0
- package/dist/react/agent-plugin-install-port.d.ts +24 -0
- package/dist/react/agent-plugin-install-port.js +15 -0
- package/dist/react/installed-skills-composer-source.d.ts +60 -0
- package/dist/react/installed-skills-composer-source.js +111 -0
- package/dist/react/use-agent-plugins.hooks.d.ts +211 -0
- package/dist/react/use-agent-plugins.hooks.js +128 -0
- package/dist/site/activation-effects.d.ts +17 -0
- package/dist/site/activation-effects.js +31 -0
- package/dist/site/admin-surfaces/capabilities.d.ts +29 -0
- package/dist/site/admin-surfaces/capabilities.js +30 -0
- package/dist/site/admin-surfaces/delivery-bindings.d.ts +81 -0
- package/dist/site/admin-surfaces/delivery-bindings.js +161 -0
- package/dist/site/admin-surfaces/forms.d.ts +28 -0
- package/dist/site/admin-surfaces/forms.js +29 -0
- package/dist/site/admin-surfaces/handlers.d.ts +61 -0
- package/dist/site/admin-surfaces/handlers.js +35 -0
- package/dist/site/admin-surfaces/public-config.d.ts +12 -0
- package/dist/site/admin-surfaces/public-config.js +28 -0
- package/dist/site/analytics-provider-registry.d.ts +87 -0
- package/dist/site/analytics-provider-registry.js +87 -0
- package/dist/site/archive-reader-abi.d.ts +35 -0
- package/dist/site/archive-reader-abi.js +25 -0
- package/dist/site/auth-schemes.d.ts +110 -0
- package/dist/site/auth-schemes.js +119 -0
- package/dist/site/automatic-agent-plugins.d.ts +200 -0
- package/dist/site/automatic-agent-plugins.js +277 -0
- package/dist/site/bundled-contribution-sources.d.ts +24 -0
- package/dist/site/bundled-contribution-sources.js +17 -0
- package/dist/site/bundled-id-upgrade.d.ts +115 -0
- package/dist/site/bundled-id-upgrade.js +169 -0
- package/dist/site/customize-tool.d.ts +39 -0
- package/dist/site/customize-tool.js +31 -0
- package/dist/site/deploy-split-activation.d.ts +28 -0
- package/dist/site/deploy-split-activation.js +21 -0
- package/dist/site/exports/diagnostics.d.ts +37 -0
- package/dist/site/exports/diagnostics.js +55 -0
- package/dist/site/exports/runtime.d.ts +54 -0
- package/dist/site/exports/runtime.js +196 -0
- package/dist/site/exports/source.d.ts +42 -0
- package/dist/site/exports/source.js +58 -0
- package/dist/site/host-plugin-guidance.d.ts +137 -0
- package/dist/site/host-plugin-guidance.js +223 -0
- package/dist/site/host-signals.d.ts +78 -0
- package/dist/site/host-signals.js +83 -0
- package/dist/site/install-tool.d.ts +69 -0
- package/dist/site/install-tool.js +192 -0
- package/dist/site/install-upload.d.ts +175 -0
- package/dist/site/install-upload.js +324 -0
- package/dist/site/memory-i18n.d.ts +5 -0
- package/dist/site/memory-i18n.js +176 -0
- package/dist/site/memory.d.ts +80 -0
- package/dist/site/memory.js +83 -0
- package/dist/site/plugin-memory.d.ts +80 -0
- package/dist/site/plugin-memory.js +86 -0
- package/dist/site/provider-plugin-link.d.ts +112 -0
- package/dist/site/provider-plugin-link.js +100 -0
- package/dist/site/retired-plugin-tool-aliases.d.ts +40 -0
- package/dist/site/retired-plugin-tool-aliases.js +41 -0
- package/dist/site/service-ports.d.ts +108 -0
- package/dist/site/service-ports.js +2 -0
- package/dist/site/set-enabled.d.ts +80 -0
- package/dist/site/set-enabled.js +42 -0
- package/dist/site/soon-lock.d.ts +83 -0
- package/dist/site/soon-lock.js +78 -0
- package/dist/site/supersession.d.ts +61 -0
- package/dist/site/supersession.js +122 -0
- package/dist/site/uninstall-tool.d.ts +136 -0
- package/dist/site/uninstall-tool.js +203 -0
- package/dist/site/update-effects.d.ts +47 -0
- package/dist/site/update-effects.js +49 -0
- package/ffmpeg-transcode/plugin.json +16 -0
- package/github/source-control/backup-push.mjs +66 -46
- package/github/source-control/commit-site.mjs +124 -67
- package/github/source-control/write-files.mjs +86 -53
- package/github-pages/targets/github-pages.mjs +294 -233
- package/google-workspace/form-destinations/mapping.mjs +15 -7
- package/google-workspace/form-destinations/sheets.mjs +4 -2
- package/google-workspace/plugin.json +1 -0
- package/kuinetic/CHANGELOG.md +4 -0
- package/kuinetic/plugin.json +4 -1
- package/kuinetic/skills/kuinetic/SKILL.md +1 -2
- package/package.json +297 -20
- package/persistent-state.d.ts +4 -1
- package/resend/adapters/resend.mjs +5 -2
- package/resend/plugin.json +1 -1
- package/s3-compatible/jini-deploy-targets.json +1 -1
- package/s3-compatible/object-stores/s3-compatible.mjs +27 -4
- package/s3-compatible/targets/s3-compatible.mjs +3 -3
- package/site-import/plugin.json +3 -3
- package/site-import/skills/site-import/SKILL.md +62 -54
- package/site-import/skills/site-import/references/content-mapping.md +26 -20
- package/slide-design/plugin.json +1 -1
- package/slide-design/skills/slide-design/SKILL.md +8 -2
- package/ui-ux-design/CHANGELOG.md +6 -0
- package/ui-ux-design/plugin.json +1 -1
- package/ui-ux-design/skills/gstack-design/SKILL.md +6 -6
- package/ui-ux-design/skills/ui-ux-design/SKILL.md +3 -2
- package/ui-ux-design/skills/ui-ux-design/references/chrome-mobile-test-matrix.md +14 -12
- package/ui-ux-design/skills/ui-ux-design/references/ui-loop.md +16 -17
- package/vercel/NOTES.md +2 -1
- package/vercel/object-stores/vercel-blob.mjs +3 -4
- package/vercel/targets/vercel.mjs +425 -351
- package/core/commerce-server.d.ts +0 -2
- package/core/commerce-server.mjs +0 -2
- package/dist/admin-surfaces/connections/ports.d.ts +0 -110
- package/dist/admin-surfaces/connections/ports.js +0 -2
- /package/dist/{lifecycle → core}/install-errors.d.ts +0 -0
- /package/dist/{lifecycle → core}/install-errors.js +0 -0
- /package/dist/{lifecycle → core}/update-plan.js +0 -0
|
@@ -1,297 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type
|
|
3
|
-
import { type Logger } from "@jini-ai/core/primitives";
|
|
4
|
-
import { type DerivedRiskByToolId, type AgentToolDefinition, type AccessApprovalDescription, type ToolHandler } from "@jini-ai/core";
|
|
5
|
-
import { type LegacyToolAuthorizeFn as AuthorizeFn } from "@jini-ai/core";
|
|
6
|
-
import { type ToolExecutionOptions, type ToolExecutionContext } from "@jini-ai/core";
|
|
7
|
-
import { type AgentPluginMcpTrustClassifier } from "./federate-mcp.js";
|
|
8
|
-
import { type AgentPluginEnableAccessMessages } from "./enable-access.js";
|
|
9
|
-
import type { AgentPluginMcpPort, AgentPluginMcpRecord, AgentPluginMcpProjectionPorts, AgentPluginMcpProjections } from "./ports.js";
|
|
10
|
-
import type { McpServerConfig } from "../lifecycle/manifest.js";
|
|
11
|
-
/** One installed plugin's declared MCP servers — the slice `agent_plugin_connect` needs. Kept
|
|
12
|
-
* narrower than `InstalledAgentPlugin` (no version/keywords/skills: this tool cares only about
|
|
13
|
-
* what it can connect). */
|
|
14
|
-
/** @agent-note A fresh trusted installed declaration from your lifecycle owner, shared with
|
|
15
|
-
* provisioning/approval. Credential cards contain safe display copy, never saved credentials. */
|
|
16
|
-
export interface ResolvedAgentPluginForConnect {
|
|
17
|
-
readonly credentialCards?: readonly PluginCredentialCard[];
|
|
18
|
-
readonly servers: Readonly<Record<string, McpServerConfig>>;
|
|
19
|
-
}
|
|
20
|
-
/** "supabase" -> "Supabase", "higgsfield-media" -> "Higgsfield Media". There is no separate
|
|
21
|
-
* display-name field in `plugin.json` (agent-plugins.org has none) — `uninstall-confirmation-ui.ts`'s
|
|
22
|
-
* own dialog makes the identical choice, naming the plugin by its id. */
|
|
23
|
-
export declare function titleCaseFromPluginId(required: {
|
|
24
|
-
pluginId: string;
|
|
25
|
-
}, _optional?: Record<string, never>): string;
|
|
26
|
-
/** The sign-in start this tool needs: only a hosted `redirect_required` start opens the connect card.
|
|
27
|
-
* @agent-note Second host: bind your hosted-MCP OAuth service. `isSignInRefusal` is true only for a
|
|
28
|
-
* refusal that opened NO card (chat then offers the key-card fallback); every other fault returns false
|
|
29
|
-
* and propagates unchanged. Matching never makes a message safe: this tool redacts before model text. */
|
|
30
|
-
export interface AgentPluginConnectSignInPort {
|
|
31
|
-
beginConnect(input: {
|
|
32
|
-
serverId: string;
|
|
33
|
-
redirectUri?: string | undefined;
|
|
34
|
-
delivery?: "hosted";
|
|
35
|
-
}, options?: Record<string, never>): Promise<ExternalMcpConnectStart>;
|
|
36
|
-
isSignInRefusal(required: {
|
|
37
|
-
error: unknown;
|
|
38
|
-
}, optional?: Record<string, never>): boolean;
|
|
39
|
-
}
|
|
40
|
-
/** Declared API connections; the host retains OAuth clients, browser binding and token custody.
|
|
41
|
-
* @agent-note Second host: `Connection` is your own declaration record, passed through unchanged
|
|
42
|
-
* (this tool never reads it). `connect` resolves with a safe connect result, never a token or URL. */
|
|
43
|
-
export interface AgentPluginConnectApiConnectionsPort<Connection> {
|
|
44
|
-
/** @agent-note True only when your host can save one connection for several sites. */
|
|
45
|
-
readonly sharingAvailable?: boolean;
|
|
46
|
-
listConnections(input: {
|
|
47
|
-
pluginId: string;
|
|
48
|
-
}, options?: Record<string, never>): Promise<readonly Connection[]>;
|
|
49
|
-
connect(input: {
|
|
50
|
-
destination?: 'site' | 'shared';
|
|
51
|
-
connection: Connection;
|
|
52
|
-
actorId: string;
|
|
53
|
-
signal: AbortSignal;
|
|
54
|
-
pollIntervalMs: number;
|
|
55
|
-
waitTimeoutMs: number;
|
|
56
|
-
showSignIn: (input: {
|
|
57
|
-
readonly signInUrl: string;
|
|
58
|
-
}) => Promise<void>;
|
|
59
|
-
}, options?: Record<string, never>): Promise<AgentPluginConnectResult>;
|
|
60
|
-
}
|
|
61
|
-
/** The host's approval lifecycle for a fixed access change (the common access card).
|
|
62
|
-
* @agent-note Second host: bind your one approval owner (typically a wrapper over core's
|
|
63
|
-
* `createApprovalHandler`). It MUST: freeze `ctx` and bind the confirming principal before `prepare`;
|
|
64
|
-
* render `describe`'s access card and wait for the human; call `run` only after an explicit confirm, with
|
|
65
|
-
* the bound ctx (so `run` re-checks permission, activation and the `prepared.key` fingerprint itself);
|
|
66
|
-
* forward `emitSurface`/execution options unchanged; and call `declined` (never `run`) on decline,
|
|
67
|
-
* expiry or abort. `ask` false means nothing needs consent and `run` proceeds without a card. */
|
|
68
|
-
export interface AgentPluginConnectApprovalsPort<Surfaces> {
|
|
69
|
-
/** @agent-note Fail closed unless the bound authenticated approver is an active human,
|
|
70
|
-
* checked BEFORE disclosing the prepared access card and AGAIN after explicit confirmation,
|
|
71
|
-
* before `run`. The authenticated answer must bind the same tool/exchange, scope and person
|
|
72
|
-
* as the frozen requesting context; caller-supplied answer fields cannot establish authority.
|
|
73
|
-
* Missing, stale, revoked or mismatched authority must never disclose the card or run the grant.
|
|
74
|
-
* Recheck permission, activation and the prepared access fingerprint after confirmation too. */
|
|
75
|
-
accessApprovalHandler<Prepared>(required: {
|
|
76
|
-
surfaces: Surfaces;
|
|
77
|
-
prepare(required: {
|
|
78
|
-
ctx: ToolExecutionContext;
|
|
79
|
-
}, optional: ToolExecutionOptions): Promise<Prepared>;
|
|
80
|
-
describe(required: {
|
|
81
|
-
ctx: ToolExecutionContext;
|
|
82
|
-
prepared: Prepared;
|
|
83
|
-
}): AgentPluginAccessApprovalDescription;
|
|
84
|
-
run(required: {
|
|
85
|
-
ctx: ToolExecutionContext;
|
|
86
|
-
prepared: Prepared;
|
|
87
|
-
}, optional: ToolExecutionOptions): Promise<unknown>;
|
|
88
|
-
}, optional: {
|
|
89
|
-
ask(required: {
|
|
90
|
-
prepared: Prepared;
|
|
91
|
-
}): boolean;
|
|
92
|
-
declined(required: {
|
|
93
|
-
reason: 'declined' | 'expired' | 'abandoned';
|
|
94
|
-
prepared?: Prepared;
|
|
95
|
-
}): unknown;
|
|
96
|
-
}): ToolHandler;
|
|
97
|
-
/** @agent-note Your host's standard not-confirmed result (its exact bytes are merged into this tool's result). */
|
|
98
|
-
notConfirmedResult(required: {
|
|
99
|
-
reason: 'declined' | 'expired' | 'abandoned';
|
|
100
|
-
}): {
|
|
101
|
-
cancelled: boolean;
|
|
102
|
-
reason?: 'expired' | 'abandoned';
|
|
103
|
-
note: string;
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
/** What this tool asks the approvals port to render. Wording is neutral; ids are host input.
|
|
107
|
-
* @agent-note Render this fixed description through your approval owner; its display ids do not
|
|
108
|
-
* replace the bound principal or the prepared access fingerprint rechecked by run. */
|
|
109
|
-
export interface AgentPluginAccessApprovalDescription {
|
|
110
|
-
readonly toolId: string;
|
|
111
|
-
readonly errorCode: string;
|
|
112
|
-
readonly title: string;
|
|
113
|
-
readonly access?: AccessApprovalDescription;
|
|
114
|
-
readonly details: readonly never[];
|
|
115
|
-
readonly description: string;
|
|
116
|
-
readonly confirmLabel: string;
|
|
117
|
-
}
|
|
118
|
-
/** Product wording and tool names this tool's refusals carry; every member is required host copy.
|
|
119
|
-
* @agent-note Second host: name YOUR tool ids, settings screen and product; keep each refusal a plain
|
|
120
|
-
* sentence the model can relay. `detail` in `signInRefused` is already redacted. */
|
|
121
|
-
export interface AgentPluginConnectMessages {
|
|
122
|
-
signInRefused(required: {
|
|
123
|
-
detail: string;
|
|
124
|
-
}): string;
|
|
125
|
-
unsupportedSignIn(required: {
|
|
126
|
-
kind: string;
|
|
127
|
-
}): string;
|
|
128
|
-
connectionNotSetUp(required: {
|
|
129
|
-
pluginId: string;
|
|
130
|
-
serverKey: string;
|
|
131
|
-
}): string;
|
|
132
|
-
multipleTokenServers(required: {
|
|
133
|
-
pluginId: string;
|
|
134
|
-
}): string;
|
|
135
|
-
noTokenCardAdapter(): string;
|
|
136
|
-
/** `credentialCards` is given only for a plugin that declares no OAuth sign-in: its key cards, to name instead of a connect retry. */
|
|
137
|
-
pluginOff(required: {
|
|
138
|
-
pluginId: string;
|
|
139
|
-
}, optional?: {
|
|
140
|
-
credentialCards?: readonly PluginCredentialCard[];
|
|
141
|
-
}): string;
|
|
142
|
-
notInstalled(required: {
|
|
143
|
-
pluginId: string;
|
|
144
|
-
}): string;
|
|
145
|
-
noOAuthService(): string;
|
|
146
|
-
multipleOAuthServers(required: {
|
|
147
|
-
pluginId: string;
|
|
148
|
-
serverKeys: readonly string[];
|
|
149
|
-
}): string;
|
|
150
|
-
noConnection(required: {
|
|
151
|
-
pluginId: string;
|
|
152
|
-
}): string;
|
|
153
|
-
multipleApiConnections(required: {
|
|
154
|
-
pluginId: string;
|
|
155
|
-
count: number;
|
|
156
|
-
}): string;
|
|
157
|
-
/** @agent-note Shown when the context has no `emitSurface`; the same text your sign-in card host uses. */
|
|
158
|
-
missingEmitter(): string;
|
|
159
|
-
}
|
|
160
|
-
/** Everything product-specific this tool needs, bound once by the host.
|
|
161
|
-
* @agent-note Second host: none of these has a default here. `toolId` is the id your card answers and
|
|
162
|
-
* approvals route back to; `permissions.connect` gates the tool and its approval re-check;
|
|
163
|
-
* `permissions.apiConnectionWrite` gates saving a declared API connection; `entityType` and
|
|
164
|
-
* `approvalErrorCode` are your authorization/approval vocabulary. */
|
|
165
|
-
export interface AgentPluginConnectHost<Surfaces> {
|
|
166
|
-
readonly toolId: string;
|
|
167
|
-
readonly permissions: {
|
|
168
|
-
readonly connect: string;
|
|
169
|
-
readonly apiConnectionWrite: string;
|
|
170
|
-
};
|
|
171
|
-
readonly entityType: string;
|
|
172
|
-
readonly approvalErrorCode: string;
|
|
173
|
-
readonly approvals: AgentPluginConnectApprovalsPort<Surfaces>;
|
|
174
|
-
readonly messages: AgentPluginConnectMessages;
|
|
175
|
-
/** @agent-note Your public OAuth callback URL for `serverId`, or undefined when your host has no public
|
|
176
|
-
* origin (then `beginConnect` decides). Operator configuration precedence is yours to keep. */
|
|
177
|
-
readonly publicUrl: {
|
|
178
|
-
redirectUri(required: {
|
|
179
|
-
serverId: string;
|
|
180
|
-
derivedPublicOrigin?: string | undefined;
|
|
181
|
-
}): string | undefined;
|
|
182
|
-
};
|
|
183
|
-
/** @agent-note Your lifecycle trust rule and federation/enable-access refusal copy (same objects your
|
|
184
|
-
* provisioning and enable-access previews use, so plans and fingerprints agree). */
|
|
185
|
-
readonly federation: {
|
|
186
|
-
readonly classifyTrust: AgentPluginMcpTrustClassifier;
|
|
187
|
-
readonly messages: AgentPluginEnableAccessMessages;
|
|
188
|
-
};
|
|
189
|
-
/** @agent-note Actor recorded when a person declines the access card (`AgentPluginConnectActors.connectDeclined`). */
|
|
190
|
-
readonly actors: {
|
|
191
|
-
readonly connectDeclined: string;
|
|
192
|
-
};
|
|
193
|
-
/** @agent-note Your sign-in card waiter (typically `waitAtAgentPluginSignInCardWithPorts` bound to your cards,
|
|
194
|
-
* card identity and SAME process exchange store). Skip resolves with your skipped result. */
|
|
195
|
-
waitAtSignInCard(required: {
|
|
196
|
-
surfaces: Surfaces;
|
|
197
|
-
ctx: ToolExecutionContext;
|
|
198
|
-
pluginId: string;
|
|
199
|
-
pluginDisplayName: string;
|
|
200
|
-
credentialCard?: PluginCredentialCard | undefined;
|
|
201
|
-
connect: (input: {
|
|
202
|
-
signal: AbortSignal;
|
|
203
|
-
showSignIn: (input: {
|
|
204
|
-
signInUrl: string;
|
|
205
|
-
}) => Promise<void>;
|
|
206
|
-
}) => Promise<AgentPluginConnectResult>;
|
|
207
|
-
}, optional: ToolExecutionOptions): Promise<AgentPluginConnectResult>;
|
|
208
|
-
/** @agent-note Your destination card (typically `chooseApiConnectionDestinationWithPorts`); null = cancelled. */
|
|
209
|
-
chooseDestination(required: {
|
|
210
|
-
surfaces: Surfaces;
|
|
211
|
-
ctx: ToolExecutionContext;
|
|
212
|
-
pluginDisplayName: string;
|
|
213
|
-
available: boolean;
|
|
214
|
-
}, optional: ToolExecutionOptions): Promise<'site' | 'shared' | null>;
|
|
215
|
-
}
|
|
216
|
-
/** Consumer-owned services; composition binds persistence, secret custody and sign-in providers.
|
|
217
|
-
* OAuth remains optional so token-only declarations work without an OAuth service.
|
|
218
|
-
* @agent-note Second host: `mcp` carries your canonical projection pair (never copies); `isPluginEnabled`
|
|
219
|
-
* and `resolveInstalledPlugin` are your fresh activation owner and installed-declaration read (no
|
|
220
|
-
* filesystem default here). */
|
|
221
|
-
export interface AgentPluginConnectDeps<Surfaces, Connection> {
|
|
222
|
-
readonly report?: Pick<Logger, 'warn'>;
|
|
223
|
-
readonly ownerPrincipalId?: Promise<string>;
|
|
224
|
-
/** Fresh activation owner; injected so OFF-plugin refusal needs no filesystem in unit tests. */
|
|
225
|
-
readonly isPluginEnabled: (pluginId: string) => Promise<boolean>;
|
|
226
|
-
readonly credentials: {
|
|
227
|
-
loadSafe(input: {
|
|
228
|
-
workspaceId: string;
|
|
229
|
-
}, options?: Record<string, never>): Promise<readonly PluginCredentialCard[]>;
|
|
230
|
-
};
|
|
231
|
-
readonly workspaceId: string;
|
|
232
|
-
readonly authorize: AuthorizeFn;
|
|
233
|
-
readonly mcp: AgentPluginMcpProjectionPorts & Pick<AgentPluginMcpPort, "repo" | "saveServer" | "applyAccess"> & Partial<Pick<AgentPluginMcpPort, "notifyRosterChanged">>;
|
|
234
|
-
readonly externalMcpOAuth?: AgentPluginConnectSignInPort;
|
|
235
|
-
readonly derivedPublicOrigin?: string | undefined;
|
|
236
|
-
/** Injectable for tests; a real composition root omits both and gets the production cadence. */
|
|
237
|
-
readonly pollIntervalMs?: number;
|
|
238
|
-
readonly waitTimeoutMs?: number;
|
|
239
|
-
/** The installed plugin's declarations (a fixture in tests; the host's installed read in production). */
|
|
240
|
-
readonly resolveInstalledPlugin: (pluginId: string) => Promise<ResolvedAgentPluginForConnect | null>;
|
|
241
|
-
/** Plugin-declared OAuth API connections. Absent: only MCP servers connect. */
|
|
242
|
-
readonly apiConnections?: AgentPluginConnectApiConnectionsPort<Connection>;
|
|
243
|
-
readonly host: AgentPluginConnectHost<Surfaces>;
|
|
244
|
-
}
|
|
245
|
-
/** This tool's one-entry catalog, built from host copy (tool id, permission, description and the
|
|
246
|
-
* pluginId schema text are product vocabulary).
|
|
247
|
-
* @agent-note Second host: pass your own tool id/permission/description bytes; the schema shape is fixed. */
|
|
248
|
-
export declare function agentPluginConnectAgentToolCatalogFor(required: {
|
|
249
|
-
toolId: string;
|
|
250
|
-
permission: string;
|
|
251
|
-
description: string;
|
|
252
|
-
pluginIdDescription: string;
|
|
253
|
-
}, _optional?: Record<string, never>): AgentToolDefinition[];
|
|
254
|
-
/** @agent-note Second host: key by your own tool id. */
|
|
255
|
-
export declare function agentPluginConnectDerivedRiskFor(required: {
|
|
256
|
-
toolId: string;
|
|
257
|
-
}, _optional?: Record<string, never>): DerivedRiskByToolId;
|
|
258
|
-
/** Whether a plugin's row already holds a credential: a finished sign-in, or a saved access token
|
|
259
|
-
* (`static_env` with the token sealed in `sealedOAuth` — what `agent_plugin_set_access_token`, the
|
|
260
|
-
* old env var's boot import, and create-site onboarding all write; `sealedEnv` is a stdio row's env
|
|
261
|
-
* block and never holds it). Such a row needs no sign-in, and a token import must never overwrite it.
|
|
262
|
-
* @agent-note Pass the canonical store's SAME pure projection pair; this check performs no I/O,
|
|
263
|
-
* opens no sealed material and must not replace an existing credential with a fresh grant. */
|
|
264
|
-
export declare function hasStoredAgentPluginCredential(required: {
|
|
265
|
-
row: Pick<AgentPluginMcpRecord, "authMode" | "sealedOAuth" | "oauthStatus">;
|
|
266
|
-
projections: AgentPluginMcpProjections;
|
|
267
|
-
}, _optional?: Record<string, never>): boolean;
|
|
268
|
-
/** The injected adapter calls the existing token-card lifecycle without a runtime import cycle.
|
|
269
|
-
* @agent-note Bind your token-card owner with the SAME principal, emitter/options and exchange
|
|
270
|
-
* store. Only safe saved/refusal results return; plaintext tokens never pass through this adapter. */
|
|
271
|
-
export type AgentPluginConnectOptions = ToolExecutionOptions & {
|
|
272
|
-
readonly saveToken?: (input: {
|
|
273
|
-
readonly ctx: ToolExecutionContext;
|
|
274
|
-
readonly pluginId: string;
|
|
275
|
-
}, optional?: ToolExecutionOptions) => Promise<{
|
|
276
|
-
readonly saved: true;
|
|
277
|
-
readonly next: string;
|
|
278
|
-
} | {
|
|
279
|
-
readonly saved: false;
|
|
280
|
-
readonly reason: string;
|
|
281
|
-
readonly message?: string;
|
|
282
|
-
}>;
|
|
283
|
-
};
|
|
284
|
-
/** @agent-note Public connection status only. Host refusal/next-step copy must be safe; no token,
|
|
285
|
-
* provider response body or private sign-in state belongs in these fields. */
|
|
286
|
-
export interface AgentPluginConnectResult {
|
|
287
|
-
readonly status: "connected" | "waiting-for-sign-in" | "not-connected";
|
|
288
|
-
readonly cancelled?: boolean;
|
|
289
|
-
readonly note?: string;
|
|
290
|
-
readonly connectionRef?: string;
|
|
291
|
-
readonly reason?: string;
|
|
292
|
-
readonly message?: string;
|
|
293
|
-
readonly next?: string;
|
|
294
|
-
}
|
|
1
|
+
import type { AgentPluginConnectDeps, AgentPluginConnectOptions, AgentPluginConnectResult } from './contracts.js';
|
|
2
|
+
import { type ToolExecutionContext } from "@jini-ai/core";
|
|
295
3
|
/**
|
|
296
4
|
* Runs `agent_plugin_connect`: permission, resolve, then the declared token, OAuth or API flow.
|
|
297
5
|
* @example runAgentPluginConnect({ routeDeps, surfaces, ctx, pluginId }, { saveToken });
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import { hasStoredAgentPluginCredential } from './catalog.js';
|
|
1
2
|
import { adaptLegacyAuthorize } from "@jini-ai/core";
|
|
2
|
-
import {} from "@jini-ai/core/primitives";
|
|
3
|
-
import {} from "@jini-ai/core";
|
|
4
3
|
import { requireToolPermission } from "@jini-ai/core";
|
|
5
4
|
import { ToolInputError, redactSecrets } from "@jini-ai/core";
|
|
6
5
|
import { deriveAgentPluginConnectionId, provisionAgentPluginMcpServers } from "./federate-mcp.js";
|
|
7
6
|
import { previewAgentPluginEnableAccess } from "./enable-access.js";
|
|
8
7
|
import { recordAgentPluginAccessDeclined } from "./apply-connect-defaults.js";
|
|
8
|
+
import { titleCaseFromPluginId } from "../core/plugin-display-name.js";
|
|
9
9
|
/**
|
|
10
10
|
* @file agent_plugin_connect connects an Agent Plugin's account through
|
|
11
11
|
* one shared host flow, so plugins do not need vendor-specific connect tools.
|
|
@@ -51,16 +51,6 @@ const DEFAULT_POLL_INTERVAL_MS = 3000;
|
|
|
51
51
|
* budget. The connection watcher and the card exchange have separate owners; neither may keep
|
|
52
52
|
* the call parked beyond its own deadline. */
|
|
53
53
|
const DEFAULT_WAIT_TIMEOUT_MS = 5 * 60 * 1000;
|
|
54
|
-
/** "supabase" -> "Supabase", "higgsfield-media" -> "Higgsfield Media". There is no separate
|
|
55
|
-
* display-name field in `plugin.json` (agent-plugins.org has none) — `uninstall-confirmation-ui.ts`'s
|
|
56
|
-
* own dialog makes the identical choice, naming the plugin by its id. */
|
|
57
|
-
export function titleCaseFromPluginId(required, _optional = {}) {
|
|
58
|
-
return required.pluginId
|
|
59
|
-
.split(/[-_]+/)
|
|
60
|
-
.filter((word) => word.length > 0)
|
|
61
|
-
.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
|
|
62
|
-
.join(" ");
|
|
63
|
-
}
|
|
64
54
|
/** Only a remote server can carry `authMode` (`manifest.ts`); a stdio entry never needs a sign-in. */
|
|
65
55
|
function isOAuthServer(config) {
|
|
66
56
|
return config.type !== "stdio" && config.authMode === "oauth";
|
|
@@ -107,47 +97,6 @@ function sleepOrAbort(ms, signal) {
|
|
|
107
97
|
signal.addEventListener("abort", onAbort, { once: true });
|
|
108
98
|
});
|
|
109
99
|
}
|
|
110
|
-
/** This tool's one-entry catalog, built from host copy (tool id, permission, description and the
|
|
111
|
-
* pluginId schema text are product vocabulary).
|
|
112
|
-
* @agent-note Second host: pass your own tool id/permission/description bytes; the schema shape is fixed. */
|
|
113
|
-
export function agentPluginConnectAgentToolCatalogFor(required, _optional = {}) {
|
|
114
|
-
return [
|
|
115
|
-
{
|
|
116
|
-
name: required.toolId,
|
|
117
|
-
description: required.description,
|
|
118
|
-
sideEffects: "mutates-durable-state",
|
|
119
|
-
authorization: { permission: required.permission },
|
|
120
|
-
inputSchema: {
|
|
121
|
-
type: "object",
|
|
122
|
-
additionalProperties: false,
|
|
123
|
-
required: ["pluginId"],
|
|
124
|
-
properties: {
|
|
125
|
-
pluginId: {
|
|
126
|
-
type: "string",
|
|
127
|
-
minLength: 1,
|
|
128
|
-
description: required.pluginIdDescription,
|
|
129
|
-
},
|
|
130
|
-
},
|
|
131
|
-
},
|
|
132
|
-
},
|
|
133
|
-
];
|
|
134
|
-
}
|
|
135
|
-
/** @agent-note Second host: key by your own tool id. */
|
|
136
|
-
export function agentPluginConnectDerivedRiskFor(required, _optional = {}) {
|
|
137
|
-
return new Map([
|
|
138
|
-
[required.toolId, "mutates-durable-state"],
|
|
139
|
-
]);
|
|
140
|
-
}
|
|
141
|
-
/** Whether a plugin's row already holds a credential: a finished sign-in, or a saved access token
|
|
142
|
-
* (`static_env` with the token sealed in `sealedOAuth` — what `agent_plugin_set_access_token`, the
|
|
143
|
-
* old env var's boot import, and create-site onboarding all write; `sealedEnv` is a stdio row's env
|
|
144
|
-
* block and never holds it). Such a row needs no sign-in, and a token import must never overwrite it.
|
|
145
|
-
* @agent-note Pass the canonical store's SAME pure projection pair; this check performs no I/O,
|
|
146
|
-
* opens no sealed material and must not replace an existing credential with a fresh grant. */
|
|
147
|
-
export function hasStoredAgentPluginCredential(required, _optional = {}) {
|
|
148
|
-
const { row, projections } = required;
|
|
149
|
-
return projections.oauthStatus(row) === "connected" || projections.hasStaticAccessToken(row);
|
|
150
|
-
}
|
|
151
100
|
/** Resolves which of a plugin's declared OAuth servers still need connecting, after provisioning
|
|
152
101
|
* every one of them as an external-MCP row (idempotent — a row already `connected` is left alone).
|
|
153
102
|
* @throws {ToolInputError} A declared OAuth server has no row owned by this plugin after provisioning (provisioning
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
import type { PluginCredentialCard } from '@jini-ai/core/contracts/credentials';
|
|
2
|
+
import type { ExternalMcpConnectStart } from '@jini-ai/core/contracts/hosted-mcp';
|
|
3
|
+
import type { Logger } from '@jini-ai/core/primitives';
|
|
4
|
+
import type { LegacyToolAuthorizeFn as AuthorizeFn, AccessApprovalDescription, ToolHandler, ToolExecutionOptions, ToolExecutionContext } from '@jini-ai/core';
|
|
5
|
+
import type { AgentPluginMcpTrustClassifier } from './federate-mcp.js';
|
|
6
|
+
import type { AgentPluginEnableAccessMessages } from './enable-access.js';
|
|
7
|
+
import type { AgentPluginMcpPort, AgentPluginMcpProjectionPorts } from './ports.js';
|
|
8
|
+
import type { ResolvedAgentPluginForConnect } from './installed-plugin.js';
|
|
9
|
+
/** The sign-in start this tool needs: only a hosted `redirect_required` start opens the connect card.
|
|
10
|
+
* @agent-note Second host: bind your hosted-MCP OAuth service. `isSignInRefusal` is true only for a
|
|
11
|
+
* refusal that opened NO card (chat then offers the key-card fallback); every other fault returns false
|
|
12
|
+
* and propagates unchanged. Matching never makes a message safe: this tool redacts before model text. */
|
|
13
|
+
export interface AgentPluginConnectSignInPort {
|
|
14
|
+
beginConnect(input: {
|
|
15
|
+
serverId: string;
|
|
16
|
+
redirectUri?: string | undefined;
|
|
17
|
+
delivery?: "hosted";
|
|
18
|
+
}, options?: Record<string, never>): Promise<ExternalMcpConnectStart>;
|
|
19
|
+
isSignInRefusal(required: {
|
|
20
|
+
error: unknown;
|
|
21
|
+
}, optional?: Record<string, never>): boolean;
|
|
22
|
+
}
|
|
23
|
+
/** Declared API connections; the host retains OAuth clients, browser binding and token custody.
|
|
24
|
+
* @agent-note Second host: `Connection` is your own declaration record, passed through unchanged
|
|
25
|
+
* (this tool never reads it). `connect` resolves with a safe connect result, never a token or URL. */
|
|
26
|
+
export interface AgentPluginConnectApiConnectionsPort<Connection> {
|
|
27
|
+
/** @agent-note True only when your host can save one connection for several sites. */
|
|
28
|
+
readonly sharingAvailable?: boolean;
|
|
29
|
+
listConnections(input: {
|
|
30
|
+
pluginId: string;
|
|
31
|
+
}, options?: Record<string, never>): Promise<readonly Connection[]>;
|
|
32
|
+
connect(input: {
|
|
33
|
+
destination?: 'site' | 'shared';
|
|
34
|
+
connection: Connection;
|
|
35
|
+
actorId: string;
|
|
36
|
+
signal: AbortSignal;
|
|
37
|
+
pollIntervalMs: number;
|
|
38
|
+
waitTimeoutMs: number;
|
|
39
|
+
showSignIn: (input: {
|
|
40
|
+
readonly signInUrl: string;
|
|
41
|
+
}) => Promise<void>;
|
|
42
|
+
}, options?: Record<string, never>): Promise<AgentPluginConnectResult>;
|
|
43
|
+
}
|
|
44
|
+
/** The host's approval lifecycle for a fixed access change (the common access card).
|
|
45
|
+
* @agent-note Second host: bind your one approval owner (typically a wrapper over core's
|
|
46
|
+
* `createApprovalHandler`). It MUST: freeze `ctx` and bind the confirming principal before `prepare`;
|
|
47
|
+
* render `describe`'s access card and wait for the human; call `run` only after an explicit confirm, with
|
|
48
|
+
* the bound ctx (so `run` re-checks permission, activation and the `prepared.key` fingerprint itself);
|
|
49
|
+
* forward `emitSurface`/execution options unchanged; and call `declined` (never `run`) on decline,
|
|
50
|
+
* expiry or abort. `ask` false means nothing needs consent and `run` proceeds without a card. */
|
|
51
|
+
export interface AgentPluginConnectApprovalsPort<Surfaces> {
|
|
52
|
+
/** @agent-note Fail closed unless the bound authenticated approver is an active human,
|
|
53
|
+
* checked BEFORE disclosing the prepared access card and AGAIN after explicit confirmation,
|
|
54
|
+
* before `run`. The authenticated answer must bind the same tool/exchange, scope and person
|
|
55
|
+
* as the frozen requesting context; caller-supplied answer fields cannot establish authority.
|
|
56
|
+
* Missing, stale, revoked or mismatched authority must never disclose the card or run the grant.
|
|
57
|
+
* Recheck permission, activation and the prepared access fingerprint after confirmation too. */
|
|
58
|
+
accessApprovalHandler<Prepared>(required: {
|
|
59
|
+
surfaces: Surfaces;
|
|
60
|
+
prepare(required: {
|
|
61
|
+
ctx: ToolExecutionContext;
|
|
62
|
+
}, optional: ToolExecutionOptions): Promise<Prepared>;
|
|
63
|
+
describe(required: {
|
|
64
|
+
ctx: ToolExecutionContext;
|
|
65
|
+
prepared: Prepared;
|
|
66
|
+
}): AgentPluginAccessApprovalDescription;
|
|
67
|
+
run(required: {
|
|
68
|
+
ctx: ToolExecutionContext;
|
|
69
|
+
prepared: Prepared;
|
|
70
|
+
}, optional: ToolExecutionOptions): Promise<unknown>;
|
|
71
|
+
}, optional: {
|
|
72
|
+
ask(required: {
|
|
73
|
+
prepared: Prepared;
|
|
74
|
+
}): boolean;
|
|
75
|
+
declined(required: {
|
|
76
|
+
reason: 'declined' | 'expired' | 'abandoned';
|
|
77
|
+
prepared?: Prepared;
|
|
78
|
+
}): unknown;
|
|
79
|
+
}): ToolHandler;
|
|
80
|
+
/** @agent-note Your host's standard not-confirmed result (its exact bytes are merged into this tool's result). */
|
|
81
|
+
notConfirmedResult(required: {
|
|
82
|
+
reason: 'declined' | 'expired' | 'abandoned';
|
|
83
|
+
}): {
|
|
84
|
+
cancelled: boolean;
|
|
85
|
+
reason?: 'expired' | 'abandoned';
|
|
86
|
+
note: string;
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
/** What this tool asks the approvals port to render. Wording is neutral; ids are host input.
|
|
90
|
+
* @agent-note Render this fixed description through your approval owner; its display ids do not
|
|
91
|
+
* replace the bound principal or the prepared access fingerprint rechecked by run. */
|
|
92
|
+
export interface AgentPluginAccessApprovalDescription {
|
|
93
|
+
readonly toolId: string;
|
|
94
|
+
readonly errorCode: string;
|
|
95
|
+
readonly title: string;
|
|
96
|
+
readonly access?: AccessApprovalDescription;
|
|
97
|
+
readonly details: readonly never[];
|
|
98
|
+
readonly description: string;
|
|
99
|
+
readonly confirmLabel: string;
|
|
100
|
+
}
|
|
101
|
+
/** Product wording and tool names this tool's refusals carry; every member is required host copy.
|
|
102
|
+
* @agent-note Second host: name YOUR tool ids, settings screen and product; keep each refusal a plain
|
|
103
|
+
* sentence the model can relay. `detail` in `signInRefused` is already redacted. */
|
|
104
|
+
export interface AgentPluginConnectMessages {
|
|
105
|
+
signInRefused(required: {
|
|
106
|
+
detail: string;
|
|
107
|
+
}): string;
|
|
108
|
+
unsupportedSignIn(required: {
|
|
109
|
+
kind: string;
|
|
110
|
+
}): string;
|
|
111
|
+
connectionNotSetUp(required: {
|
|
112
|
+
pluginId: string;
|
|
113
|
+
serverKey: string;
|
|
114
|
+
}): string;
|
|
115
|
+
multipleTokenServers(required: {
|
|
116
|
+
pluginId: string;
|
|
117
|
+
}): string;
|
|
118
|
+
noTokenCardAdapter(): string;
|
|
119
|
+
/** `credentialCards` is given only for a plugin that declares no OAuth sign-in: its key cards, to name instead of a connect retry. */
|
|
120
|
+
pluginOff(required: {
|
|
121
|
+
pluginId: string;
|
|
122
|
+
}, optional?: {
|
|
123
|
+
credentialCards?: readonly PluginCredentialCard[];
|
|
124
|
+
}): string;
|
|
125
|
+
notInstalled(required: {
|
|
126
|
+
pluginId: string;
|
|
127
|
+
}): string;
|
|
128
|
+
noOAuthService(): string;
|
|
129
|
+
multipleOAuthServers(required: {
|
|
130
|
+
pluginId: string;
|
|
131
|
+
serverKeys: readonly string[];
|
|
132
|
+
}): string;
|
|
133
|
+
noConnection(required: {
|
|
134
|
+
pluginId: string;
|
|
135
|
+
}): string;
|
|
136
|
+
multipleApiConnections(required: {
|
|
137
|
+
pluginId: string;
|
|
138
|
+
count: number;
|
|
139
|
+
}): string;
|
|
140
|
+
/** @agent-note Shown when the context has no `emitSurface`; the same text your sign-in card host uses. */
|
|
141
|
+
missingEmitter(): string;
|
|
142
|
+
}
|
|
143
|
+
/** Everything product-specific this tool needs, bound once by the host.
|
|
144
|
+
* @agent-note Second host: none of these has a default here. `toolId` is the id your card answers and
|
|
145
|
+
* approvals route back to; `permissions.connect` gates the tool and its approval re-check;
|
|
146
|
+
* `permissions.apiConnectionWrite` gates saving a declared API connection; `entityType` and
|
|
147
|
+
* `approvalErrorCode` are your authorization/approval vocabulary. */
|
|
148
|
+
export interface AgentPluginConnectHost<Surfaces> {
|
|
149
|
+
readonly toolId: string;
|
|
150
|
+
readonly permissions: {
|
|
151
|
+
readonly connect: string;
|
|
152
|
+
readonly apiConnectionWrite: string;
|
|
153
|
+
};
|
|
154
|
+
readonly entityType: string;
|
|
155
|
+
readonly approvalErrorCode: string;
|
|
156
|
+
readonly approvals: AgentPluginConnectApprovalsPort<Surfaces>;
|
|
157
|
+
readonly messages: AgentPluginConnectMessages;
|
|
158
|
+
/** @agent-note Your public OAuth callback URL for `serverId`, or undefined when your host has no public
|
|
159
|
+
* origin (then `beginConnect` decides). Operator configuration precedence is yours to keep. */
|
|
160
|
+
readonly publicUrl: {
|
|
161
|
+
redirectUri(required: {
|
|
162
|
+
serverId: string;
|
|
163
|
+
derivedPublicOrigin?: string | undefined;
|
|
164
|
+
}): string | undefined;
|
|
165
|
+
};
|
|
166
|
+
/** @agent-note Your lifecycle trust rule and federation/enable-access refusal copy (same objects your
|
|
167
|
+
* provisioning and enable-access previews use, so plans and fingerprints agree). */
|
|
168
|
+
readonly federation: {
|
|
169
|
+
readonly classifyTrust: AgentPluginMcpTrustClassifier;
|
|
170
|
+
readonly messages: AgentPluginEnableAccessMessages;
|
|
171
|
+
};
|
|
172
|
+
/** @agent-note Actor recorded when a person declines the access card (`AgentPluginConnectActors.connectDeclined`). */
|
|
173
|
+
readonly actors: {
|
|
174
|
+
readonly connectDeclined: string;
|
|
175
|
+
};
|
|
176
|
+
/** @agent-note Your sign-in card waiter (typically `waitAtAgentPluginSignInCardWithPorts` bound to your cards,
|
|
177
|
+
* card identity and SAME process exchange store). Skip resolves with your skipped result. */
|
|
178
|
+
waitAtSignInCard(required: {
|
|
179
|
+
surfaces: Surfaces;
|
|
180
|
+
ctx: ToolExecutionContext;
|
|
181
|
+
pluginId: string;
|
|
182
|
+
pluginDisplayName: string;
|
|
183
|
+
credentialCard?: PluginCredentialCard | undefined;
|
|
184
|
+
connect: (input: {
|
|
185
|
+
signal: AbortSignal;
|
|
186
|
+
showSignIn: (input: {
|
|
187
|
+
signInUrl: string;
|
|
188
|
+
}) => Promise<void>;
|
|
189
|
+
}) => Promise<AgentPluginConnectResult>;
|
|
190
|
+
}, optional: ToolExecutionOptions): Promise<AgentPluginConnectResult>;
|
|
191
|
+
/** @agent-note Your destination card (typically `chooseApiConnectionDestinationWithPorts`); null = cancelled. */
|
|
192
|
+
chooseDestination(required: {
|
|
193
|
+
surfaces: Surfaces;
|
|
194
|
+
ctx: ToolExecutionContext;
|
|
195
|
+
pluginDisplayName: string;
|
|
196
|
+
available: boolean;
|
|
197
|
+
}, optional: ToolExecutionOptions): Promise<'site' | 'shared' | null>;
|
|
198
|
+
}
|
|
199
|
+
/** Consumer-owned services; composition binds persistence, secret custody and sign-in providers.
|
|
200
|
+
* OAuth remains optional so token-only declarations work without an OAuth service.
|
|
201
|
+
* @agent-note Second host: `mcp` carries your canonical projection pair (never copies); `isPluginEnabled`
|
|
202
|
+
* and `resolveInstalledPlugin` are your fresh activation owner and installed-declaration read (no
|
|
203
|
+
* filesystem default here). */
|
|
204
|
+
export interface AgentPluginConnectDeps<Surfaces, Connection> {
|
|
205
|
+
readonly report?: Pick<Logger, 'warn'>;
|
|
206
|
+
readonly ownerPrincipalId?: Promise<string>;
|
|
207
|
+
/** Fresh activation owner; injected so OFF-plugin refusal needs no filesystem in unit tests. */
|
|
208
|
+
readonly isPluginEnabled: (pluginId: string) => Promise<boolean>;
|
|
209
|
+
readonly credentials: {
|
|
210
|
+
loadSafe(input: {
|
|
211
|
+
workspaceId: string;
|
|
212
|
+
}, options?: Record<string, never>): Promise<readonly PluginCredentialCard[]>;
|
|
213
|
+
};
|
|
214
|
+
readonly workspaceId: string;
|
|
215
|
+
readonly authorize: AuthorizeFn;
|
|
216
|
+
readonly mcp: AgentPluginMcpProjectionPorts & Pick<AgentPluginMcpPort, "repo" | "saveServer" | "applyAccess"> & Partial<Pick<AgentPluginMcpPort, "notifyRosterChanged">>;
|
|
217
|
+
readonly externalMcpOAuth?: AgentPluginConnectSignInPort;
|
|
218
|
+
readonly derivedPublicOrigin?: string | undefined;
|
|
219
|
+
/** Injectable for tests; a real composition root omits both and gets the production cadence. */
|
|
220
|
+
readonly pollIntervalMs?: number;
|
|
221
|
+
readonly waitTimeoutMs?: number;
|
|
222
|
+
/** The installed plugin's declarations (a fixture in tests; the host's installed read in production). */
|
|
223
|
+
readonly resolveInstalledPlugin: (pluginId: string) => Promise<ResolvedAgentPluginForConnect | null>;
|
|
224
|
+
/** Plugin-declared OAuth API connections. Absent: only MCP servers connect. */
|
|
225
|
+
readonly apiConnections?: AgentPluginConnectApiConnectionsPort<Connection>;
|
|
226
|
+
readonly host: AgentPluginConnectHost<Surfaces>;
|
|
227
|
+
}
|
|
228
|
+
/** Internal erased view: ports are method-typed, so a host's concrete `Surfaces`/`Connection` pass through opaque. */
|
|
229
|
+
export type ConnectDeps = AgentPluginConnectDeps<unknown, unknown>;
|
|
230
|
+
/** The injected adapter calls the existing token-card lifecycle without a runtime import cycle.
|
|
231
|
+
* @agent-note Bind your token-card owner with the SAME principal, emitter/options and exchange
|
|
232
|
+
* store. Only safe saved/refusal results return; plaintext tokens never pass through this adapter. */
|
|
233
|
+
export type AgentPluginConnectOptions = ToolExecutionOptions & {
|
|
234
|
+
readonly saveToken?: (input: {
|
|
235
|
+
readonly ctx: ToolExecutionContext;
|
|
236
|
+
readonly pluginId: string;
|
|
237
|
+
}, optional?: ToolExecutionOptions) => Promise<{
|
|
238
|
+
readonly saved: true;
|
|
239
|
+
readonly next: string;
|
|
240
|
+
} | {
|
|
241
|
+
readonly saved: false;
|
|
242
|
+
readonly reason: string;
|
|
243
|
+
readonly message?: string;
|
|
244
|
+
}>;
|
|
245
|
+
};
|
|
246
|
+
/** @agent-note Public connection status only. Host refusal/next-step copy must be safe; no token,
|
|
247
|
+
* provider response body or private sign-in state belongs in these fields. */
|
|
248
|
+
export interface AgentPluginConnectResult {
|
|
249
|
+
readonly status: "connected" | "waiting-for-sign-in" | "not-connected";
|
|
250
|
+
readonly cancelled?: boolean;
|
|
251
|
+
readonly note?: string;
|
|
252
|
+
readonly connectionRef?: string;
|
|
253
|
+
readonly reason?: string;
|
|
254
|
+
readonly message?: string;
|
|
255
|
+
readonly next?: string;
|
|
256
|
+
}
|
|
257
|
+
//# sourceMappingURL=contracts.d.ts.map
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import type { AgentPluginIdentityReadOptions } from '../core/identity-namespace.js';
|
|
1
2
|
import type { PluginContributionDefinition } from '../lifecycle/contribution-loader.js';
|
|
2
3
|
import type { PluginCredentialCard } from "@jini-ai/core/contracts/credentials";
|
|
3
4
|
export { parsePluginCredentialCards, parseCredentialCardUsedFor } from '../lifecycle/credential-card-metadata.js';
|
|
4
5
|
/** Reuse Jini's active, trusted-package gate and contained manifest read. */
|
|
6
|
+
export declare function createCredentialCardsContribution(required: Pick<AgentPluginIdentityReadOptions, "legacyIdentity">, _optional?: Record<string, never>): PluginContributionDefinition<PluginCredentialCard, PluginCredentialCard>;
|
|
5
7
|
export declare const credentialCardsContribution: PluginContributionDefinition<PluginCredentialCard, PluginCredentialCard>;
|
|
6
8
|
/** Preserve mail objects and ordering; duplicate targets retain mail priority, while conflicting
|
|
7
9
|
* API label owners are all refused. O(cards) time and space; no persistent ownership registry.
|