@jini-ai/integrations 0.6.19 → 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.
- package/CHANGELOG.md +48 -0
- package/dist/api-connections/access-token.js +4 -14
- package/dist/api-connections/account-actions.d.ts +6 -1
- package/dist/api-connections/attempt-state.d.ts +2 -2
- package/dist/api-connections/attempt-state.js +10 -11
- package/dist/api-connections/authorization.js +13 -20
- package/dist/api-connections/budgets.d.ts +91 -0
- package/dist/api-connections/budgets.js +87 -0
- package/dist/api-connections/byo-client.d.ts +38 -0
- package/dist/api-connections/byo-client.js +28 -0
- package/dist/api-connections/connect.d.ts +87 -0
- package/dist/api-connections/connect.js +143 -0
- package/dist/api-connections/declarations.d.ts +68 -0
- package/dist/api-connections/declarations.js +178 -0
- package/dist/api-connections/deps.d.ts +4 -1
- package/dist/api-connections/descriptor.d.ts +15 -0
- package/dist/api-connections/descriptor.js +1 -5
- package/dist/api-connections/finish-authorization.d.ts +1 -1
- package/dist/api-connections/hook-http.d.ts +20 -0
- package/dist/api-connections/hook-http.js +27 -0
- package/dist/api-connections/host-ports.d.ts +244 -0
- package/dist/api-connections/host-ports.js +2 -0
- package/dist/api-connections/host.d.ts +81 -0
- package/dist/api-connections/host.js +320 -0
- package/dist/api-connections/hosted-mcp/contracts.d.ts +291 -0
- package/dist/api-connections/hosted-mcp/contracts.js +2 -0
- package/dist/api-connections/hosted-mcp/index.d.ts +5 -0
- package/dist/api-connections/hosted-mcp/index.js +3 -0
- package/dist/api-connections/hosted-mcp/shared-sign-in.d.ts +167 -0
- package/dist/api-connections/hosted-mcp/shared-sign-in.js +293 -0
- package/dist/api-connections/hosted-mcp/sign-in.d.ts +25 -0
- package/dist/api-connections/hosted-mcp/sign-in.js +889 -0
- package/dist/api-connections/hosted-sign-in.d.ts +48 -0
- package/dist/api-connections/hosted-sign-in.js +51 -0
- package/dist/api-connections/index.d.ts +23 -1
- package/dist/api-connections/index.js +15 -0
- package/dist/api-connections/install-credential.d.ts +1 -1
- package/dist/api-connections/oauth-capabilities.d.ts +63 -0
- package/dist/api-connections/oauth-capabilities.js +2 -0
- package/dist/api-connections/ports.d.ts +1 -1
- package/dist/api-connections/request-checks.d.ts +11 -1
- package/dist/api-connections/request-checks.js +2 -3
- package/dist/api-connections/shared.d.ts +79 -0
- package/dist/api-connections/shared.js +106 -0
- package/dist/api-connections/token-store/record.d.ts +2 -2
- package/dist/api-connections/token-store/vault-token-store.d.ts +30 -4
- package/dist/api-connections/token-store/vault-token-store.js +1 -4
- package/dist/credentialed-http/sets/host.d.ts +146 -0
- package/dist/credentialed-http/sets/host.js +2 -0
- package/dist/credentialed-http/sets/index.d.ts +24 -0
- package/dist/credentialed-http/sets/index.js +24 -0
- package/dist/credentialed-http/sets/store.d.ts +193 -0
- package/dist/credentialed-http/sets/store.js +489 -0
- package/dist/credentialed-http/sets/vault-repo.d.ts +81 -0
- package/dist/credentialed-http/sets/vault-repo.js +147 -0
- package/dist/credentialed-http/tools/credential-copy-tool.d.ts +34 -0
- package/dist/credentialed-http/tools/credential-copy-tool.js +132 -0
- package/dist/credentialed-http/tools/credential-tool-host.d.ts +152 -0
- package/dist/credentialed-http/tools/credential-tool-host.js +2 -0
- package/dist/credentialed-http/tools/credential-tool-operations.d.ts +370 -0
- package/dist/credentialed-http/tools/credential-tool-operations.js +2 -0
- package/dist/credentialed-http/tools/index.d.ts +7 -0
- package/dist/credentialed-http/tools/index.js +4 -0
- package/dist/credentialed-http/tools/tool-registrations.d.ts +55 -0
- package/dist/credentialed-http/tools/tool-registrations.js +729 -0
- package/dist/webhooks/signing.js +2 -1
- package/package.json +34 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,53 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.7.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [873f10c]
|
|
8
|
+
- @jini-ai/core@0.7.1
|
|
9
|
+
|
|
10
|
+
## 0.7.0
|
|
11
|
+
|
|
12
|
+
### Minor Changes
|
|
13
|
+
|
|
14
|
+
- 46039c5: Expose API-connection host storage, loader, identity, shared-consumer and BYO credential
|
|
15
|
+
ports. Move the scoped hook HTTP and BYO-client resolution behind host-supplied credential
|
|
16
|
+
projection and refusal ports, preserving saved labels and exact host behavior through shims.
|
|
17
|
+
- ce9e9dc: Expose the injected API host and connection sign-in flow from integrations/api-connections,
|
|
18
|
+
and the persisted plugin-state store from the universal agent-plugins/admin-surfaces entry.
|
|
19
|
+
Hosts bind their existing storage, state, callbacks, links, app identity and wording.
|
|
20
|
+
- 1838089: Add the core-vault-only AdminSurfacePluginStatePersistence contract and API-host runtime
|
|
21
|
+
ports for an already-built state store, callback inbox/path, loopback receiver and exact
|
|
22
|
+
host messages. Sign-in links and model-facing refusal wording are host-supplied.
|
|
23
|
+
- b2017d9: Restore the bring-your-own OAuth client's previous error behaviour in `resolveByoClient` (`@jini-ai/integrations/api-connections`). `ApiConnectionByoCredential.allowedOrigins` is now a deferred function (`() => readonly string[]`) that `resolveByoClient` calls only after the credential read has resolved, outside the read's "unreadable" catch. A failure while projecting a saved credential's origins (for example a malformed saved base URL) once again rejects with the host's raw error instead of being reported as an unreadable credential; read failures, wrong-origin and missing-client-id refusals are unchanged. Hosts implementing `ApiConnectionByoCredentials.read` return `allowedOrigins: () => origins` instead of the array.
|
|
24
|
+
- 63e11c5: Add the `@jini-ai/integrations/credentialed-http/sets` entry: credential-set validation and CRUD
|
|
25
|
+
over a host-supplied vault (`CredentialSetVaultRepo`, create/update/delete/list/describe/resolve
|
|
26
|
+
operations, canonical credential-set error classes) and its host-input contracts. Every owner,
|
|
27
|
+
metadata, category, scope, error and wording value is a required host input. The existing
|
|
28
|
+
`./credentialed-http` entry is unchanged.
|
|
29
|
+
- 27063ef: Add the type-only entry `@jini-ai/integrations/api-connections/hosted-mcp` with the hosted MCP sign-in contracts (device authorization store, sign-in dependencies with a host-supplied shared-owner type, and the sign-in service).
|
|
30
|
+
- f1e5364: `@jini-ai/integrations/api-connections` no longer imports `@jini-ai/oauth` or `@jini-ai/platform`: hosts pass a required `oauth: ApiConnectionOAuthCapabilities` (real OAuth exports) to the API host, service deps and `createSignInHandoffs`, and a required `isVaultConflict` classifier to `createVaultOAuthTokenStore`; `parseApiConnectionDescriptor` takes a required `callbackFieldRules` input.
|
|
31
|
+
- 50f6e4c: Add `createHostedMcpSignInService`, `createDeviceAuthorizationStore` and `createSharedExternalMcpOAuth` (+ shared sign-in owner ports) to `@jini-ai/integrations/api-connections/hosted-mcp`: the hosted MCP sign-in service on injected `HostedMcpSignInPorts`.
|
|
32
|
+
|
|
33
|
+
### Patch Changes
|
|
34
|
+
|
|
35
|
+
- ed7901c: Expose credential-tool orchestration through a core-only host contract and required vocabulary/card/operation ports.
|
|
36
|
+
- Updated dependencies [8fe045b]
|
|
37
|
+
- Updated dependencies [c393010]
|
|
38
|
+
- Updated dependencies [41ff2ff]
|
|
39
|
+
- Updated dependencies [a266ba8]
|
|
40
|
+
- Updated dependencies [2364f89]
|
|
41
|
+
- Updated dependencies [27063ef]
|
|
42
|
+
- Updated dependencies [6ab1d81]
|
|
43
|
+
- Updated dependencies [6ab1d81]
|
|
44
|
+
- Updated dependencies [699b478]
|
|
45
|
+
- Updated dependencies [39cf677]
|
|
46
|
+
- @jini-ai/core@0.7.0
|
|
47
|
+
- @jini-ai/platform@0.7.0
|
|
48
|
+
- @jini-ai/db@0.7.0
|
|
49
|
+
- @jini-ai/oauth@0.7.0
|
|
50
|
+
|
|
3
51
|
## 0.6.17
|
|
4
52
|
|
|
5
53
|
### Patch Changes
|
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Serves access tokens for a connection, refreshing through the OAuth core's refresher.
|
|
3
|
-
*
|
|
4
|
-
* Exists so plugin tool and delivery code never touch refresh tokens: they ask for an access
|
|
5
|
-
* token by `connectionRef` immediately before an HTTP call. Only `connected` records are served,
|
|
6
|
-
* an optional frozen account id stops a binding from silently following an account switch (checked
|
|
7
|
-
* again after the token is read, so a switch landing in between cannot leak through), and a
|
|
8
|
-
* rejected refresh or unreadable credential moves the record to `reconnect-required`. Unreadable
|
|
9
|
-
* credentials are preserved, and their internal store errors become a clear reconnect instruction.
|
|
10
|
-
*/
|
|
11
|
-
import { createTokenRefresher, OAuthError, refreshAccessToken } from '@jini-ai/oauth';
|
|
12
1
|
import { ApiConnectionError } from './errors.js';
|
|
13
2
|
import { loadOwnedRecord, writeRecord } from './records.js';
|
|
14
3
|
import { isUnreadableTokenRecord } from './token-store/errors.js';
|
|
@@ -63,12 +52,12 @@ function refreshPort(deps) {
|
|
|
63
52
|
},
|
|
64
53
|
...(tokens.tryAcquireRefreshLease ? { tryAcquireRefreshLease: tokens.tryAcquireRefreshLease.bind(tokens) } : {}),
|
|
65
54
|
...(tokens.releaseRefreshLease ? { releaseRefreshLease: tokens.releaseRefreshLease.bind(tokens) } : {}),
|
|
66
|
-
refresh: ({ refreshToken }) => refreshAccessToken({ fetchFn: deps.fetchFn, guard: deps.guard, clock: deps.clock,
|
|
55
|
+
refresh: ({ refreshToken }) => deps.oauth.flow.refreshAccessToken({ fetchFn: deps.fetchFn, guard: deps.guard, clock: deps.clock,
|
|
67
56
|
tokenEndpoint: deps.descriptor.tokenEndpoint, client: deps.client, refreshToken }),
|
|
68
57
|
};
|
|
69
58
|
}
|
|
70
59
|
export function createApiConnectionAccessTokens(deps) {
|
|
71
|
-
const refresher = createTokenRefresher({ clock: deps.clock, sleep: deps.sleep, port: refreshPort(deps) });
|
|
60
|
+
const refresher = deps.oauth.flow.createTokenRefresher({ clock: deps.clock, sleep: deps.sleep, port: refreshPort(deps) });
|
|
72
61
|
return {
|
|
73
62
|
async getAccessToken(requiredArgs, optionalArgs = {}) {
|
|
74
63
|
const { expectedAccountId } = optionalArgs;
|
|
@@ -79,7 +68,8 @@ export function createApiConnectionAccessTokens(deps) {
|
|
|
79
68
|
await markReconnectRequired(deps, record.key, { expectedGeneration: record.generation });
|
|
80
69
|
throw new ApiConnectionError(REFUSALS['reconnect-required'], { cause: error });
|
|
81
70
|
}
|
|
82
|
-
|
|
71
|
+
const classified = { value: error };
|
|
72
|
+
if (deps.oauth.isOAuthError(classified) && classified.value.code === 'OAUTH_INVALID_GRANT') {
|
|
83
73
|
throw new ApiConnectionError(REFUSALS['reconnect-required'], { cause: error });
|
|
84
74
|
}
|
|
85
75
|
throw error;
|
|
@@ -10,6 +10,11 @@
|
|
|
10
10
|
import type { ApiConnectionServiceDeps } from './deps.js';
|
|
11
11
|
import { type OwnedRecordArgs } from './records.js';
|
|
12
12
|
import { type ApiConnectionStatusView } from './status.js';
|
|
13
|
+
/** Only the lifecycle ports needed to stop use and revoke an already-issued credential. */
|
|
14
|
+
export type ApiConnectionDisconnectDeps = Pick<ApiConnectionServiceDeps, 'descriptor' | 'records' | 'clock'> & {
|
|
15
|
+
readonly tokens: Pick<ApiConnectionServiceDeps['tokens'], 'loadForRevocation' | 'delete'>;
|
|
16
|
+
readonly hooks: Pick<ApiConnectionServiceDeps['hooks'], 'revoke'>;
|
|
17
|
+
};
|
|
13
18
|
/**
|
|
14
19
|
* `not-needed` when no credential existed locally, so nothing could be revoked. `pending` with
|
|
15
20
|
* status `revocation-pending` means the disabled credential is kept and disconnecting again
|
|
@@ -36,5 +41,5 @@ export declare function confirmSwitchAccount(deps: ApiConnectionServiceDeps, req
|
|
|
36
41
|
*/
|
|
37
42
|
export declare function cancelSwitchAccount(deps: ApiConnectionServiceDeps, requiredArgs: OwnedRecordArgs): Promise<ApiConnectionDisconnectResult>;
|
|
38
43
|
/** Disconnect and revoke the live and any staged credential; call again to retry a `pending` revocation. */
|
|
39
|
-
export declare function disconnectApiConnection(deps:
|
|
44
|
+
export declare function disconnectApiConnection(deps: ApiConnectionDisconnectDeps, requiredArgs: OwnedRecordArgs): Promise<ApiConnectionDisconnectResult>;
|
|
40
45
|
//# sourceMappingURL=account-actions.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { SealedAuthorizationState } from '@jini-ai/core/contracts/oauth';
|
|
2
2
|
import type { ApiConnectionServiceDeps } from './deps.js';
|
|
3
3
|
import type { ApiConnectionAttempt } from './types.js';
|
|
4
4
|
/** Long enough for consent and multi-factor prompts; abandoned attempts die quickly. */
|
|
@@ -11,7 +11,7 @@ export declare const BROWSER_BINDING_BYTES = 32;
|
|
|
11
11
|
*/
|
|
12
12
|
export declare function hashBrowserBinding(value: unknown): string;
|
|
13
13
|
type AttemptDraft = Omit<ApiConnectionAttempt, 'state' | 'codeVerifier' | 'redirectUri' | 'createdAt' | 'expiresAt'>;
|
|
14
|
-
type AttemptDeps = Pick<ApiConnectionServiceDeps, 'records' | 'clock' | 'randomBytesFn'>;
|
|
14
|
+
type AttemptDeps = Pick<ApiConnectionServiceDeps, 'records' | 'clock' | 'randomBytesFn' | 'oauth'>;
|
|
15
15
|
/** Seal side: store the attempt under fresh random state. */
|
|
16
16
|
export declare function attemptSealer(deps: AttemptDeps, requiredArgs: {
|
|
17
17
|
readonly draft: AttemptDraft;
|
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
* indistinguishable invalid-state.
|
|
9
9
|
*/
|
|
10
10
|
import { createHash } from 'node:crypto';
|
|
11
|
-
import { invalidPendingAuthorizationState, PENDING_AUTHORIZATION_STATE_BYTES, generateOAuthState, secureEqualsForOwnerBinding } from '@jini-ai/oauth';
|
|
12
11
|
import { nowIso } from '@jini-ai/core/primitives';
|
|
13
12
|
/** Long enough for consent and multi-factor prompts; abandoned attempts die quickly. */
|
|
14
13
|
export const ATTEMPT_TTL_MS = 10 * 60 * 1000;
|
|
@@ -28,8 +27,8 @@ function toPending(attempt, providerId) {
|
|
|
28
27
|
};
|
|
29
28
|
}
|
|
30
29
|
/** Each adapter serves one direction; reaching the other means the core changed its contract. */
|
|
31
|
-
async function refuseUnexpected() {
|
|
32
|
-
throw
|
|
30
|
+
async function refuseUnexpected(deps) {
|
|
31
|
+
throw deps.oauth.invalidPendingState({});
|
|
33
32
|
}
|
|
34
33
|
/** Seal side: store the attempt under fresh random state. */
|
|
35
34
|
export function attemptSealer(deps, requiredArgs) {
|
|
@@ -38,32 +37,32 @@ export function attemptSealer(deps, requiredArgs) {
|
|
|
38
37
|
const createdAt = nowIso({ clock: deps.clock });
|
|
39
38
|
const attempt = {
|
|
40
39
|
...requiredArgs.draft, codeVerifier: entry.codeVerifier, redirectUri: entry.redirectUri, createdAt,
|
|
41
|
-
state:
|
|
40
|
+
state: deps.oauth.generateState({ randomBytesFn: deps.randomBytesFn }, { stateBytes: deps.oauth.pendingStateBytes }),
|
|
42
41
|
expiresAt: new Date(Date.parse(createdAt) + ATTEMPT_TTL_MS).toISOString(),
|
|
43
42
|
};
|
|
44
43
|
await deps.records.putAttempt({ attempt });
|
|
45
44
|
return toPending(attempt, entry.providerId);
|
|
46
45
|
},
|
|
47
|
-
open: refuseUnexpected,
|
|
46
|
+
open: () => refuseUnexpected(deps),
|
|
48
47
|
};
|
|
49
48
|
}
|
|
50
|
-
function matchesBinding(attempt, expected, nowMs) {
|
|
49
|
+
function matchesBinding(deps, attempt, expected, nowMs) {
|
|
51
50
|
return Date.parse(attempt.expiresAt) > nowMs
|
|
52
|
-
&&
|
|
51
|
+
&& deps.oauth.secureEquals({ a: attempt.ownerKey, b: expected.ownerKey })
|
|
53
52
|
// The owner key alone cannot bind a hosted callback: a cookie-less callback route can only learn
|
|
54
53
|
// the identities from the attempt itself. The browser binding is what the redirected browser carries.
|
|
55
|
-
&&
|
|
54
|
+
&& deps.oauth.secureEquals({ a: attempt.browserBindingHash, b: hashBrowserBinding(expected.browserBinding) })
|
|
56
55
|
&& attempt.redirectUri === expected.redirectUri;
|
|
57
56
|
}
|
|
58
57
|
/** Open side: consume first, then check binding, so a probe burns the state it guessed. */
|
|
59
58
|
export function attemptOpener(deps, requiredArgs) {
|
|
60
59
|
const { browserBinding } = requiredArgs;
|
|
61
60
|
return {
|
|
62
|
-
seal: refuseUnexpected,
|
|
61
|
+
seal: () => refuseUnexpected(deps),
|
|
63
62
|
async open({ state, ownerKey, providerId, redirectUri }) {
|
|
64
63
|
const attempt = await deps.records.takeAttempt({ state });
|
|
65
|
-
if (attempt === null || !matchesBinding(attempt, { ownerKey, redirectUri, browserBinding }, deps.clock.nowMs())) {
|
|
66
|
-
throw
|
|
64
|
+
if (attempt === null || !matchesBinding(deps, attempt, { ownerKey, redirectUri, browserBinding }, deps.clock.nowMs())) {
|
|
65
|
+
throw deps.oauth.invalidPendingState({});
|
|
67
66
|
}
|
|
68
67
|
requiredArgs.onOpen({ attempt });
|
|
69
68
|
return toPending(attempt, providerId);
|
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Starts and completes an API-connection sign-in (authorization code + PKCE S256).
|
|
3
|
-
*
|
|
4
|
-
* Exists to bind the OAuth core's browser grant to a plugin connection: start records an
|
|
5
|
-
* expiring single-use attempt bound to workspace, actor, plugin connection, requested scopes,
|
|
6
|
-
* callback URI, credential generation and the starting browser; complete redeems it exactly once,
|
|
7
|
-
* exchanges the code, and hands the token set to `finishAuthorization` for the grant, identity and
|
|
8
|
-
* commit checks.
|
|
9
|
-
*/
|
|
10
|
-
import { beginAuthorizationCode, completeAuthorizationCode, generateOAuthState, OAuthError } from '@jini-ai/oauth';
|
|
11
1
|
import { ApiConnectionError, invalidAttempt } from './errors.js';
|
|
12
2
|
import { attemptOpener, attemptSealer, BROWSER_BINDING_BYTES, hashBrowserBinding } from './attempt-state.js';
|
|
13
3
|
import { finishAuthorization, loadReadableTokens } from './finish-authorization.js';
|
|
@@ -62,9 +52,11 @@ async function clientKindParams(deps, record, intent) {
|
|
|
62
52
|
return renewable ? fixed : { ...fixed, ...deps.descriptor.forceConsentParams };
|
|
63
53
|
}
|
|
64
54
|
/** Map OAuth core failures to connection codes; the core's messages are already token-free. */
|
|
65
|
-
function toConnectionError(
|
|
66
|
-
|
|
67
|
-
|
|
55
|
+
function toConnectionError(deps, raw) {
|
|
56
|
+
const classified = { value: raw };
|
|
57
|
+
if (!deps.oauth.isOAuthError(classified))
|
|
58
|
+
return raw;
|
|
59
|
+
const error = classified.value;
|
|
68
60
|
if (error.code === 'OAUTH_INVALID_STATE')
|
|
69
61
|
return invalidAttempt({}, { cause: error });
|
|
70
62
|
const code = error.code === 'OAUTH_ACCESS_DENIED' ? 'access-denied' : 'authorization-failed';
|
|
@@ -83,15 +75,15 @@ export async function startApiConnectionAuthorization(deps, requiredArgs, option
|
|
|
83
75
|
const requestedScopes = checkScopes(await deps.hooks.resolveScopes({ scopeSetIds: [...requiredArgs.scopeSetIds] }));
|
|
84
76
|
const kindParams = await clientKindParams(deps, record, intent);
|
|
85
77
|
const ownerKey = ownerKeyFor(deps, { workspaceId, actorId });
|
|
86
|
-
const attemptId =
|
|
87
|
-
const browserBinding =
|
|
78
|
+
const attemptId = deps.oauth.generateState({ randomBytesFn: deps.randomBytesFn }, { stateBytes: ATTEMPT_ID_BYTES });
|
|
79
|
+
const browserBinding = deps.oauth.generateState({ randomBytesFn: deps.randomBytesFn }, { stateBytes: BROWSER_BINDING_BYTES });
|
|
88
80
|
const draft = { key, attemptId, ownerKey, browserBindingHash: hashBrowserBinding(browserBinding), workspaceId, actorId, pluginId: deps.descriptor.pluginId,
|
|
89
81
|
connectionId: deps.descriptor.connectionId, intent, requestedScopes, generation: record?.generation ?? 0 };
|
|
90
|
-
const begun = await beginAuthorizationCode({
|
|
82
|
+
const begun = await deps.oauth.flow.beginAuthorizationCode({
|
|
91
83
|
provider: providerFor(deps), stateless: attemptSealer(deps, { draft }), randomBytesFn: deps.randomBytesFn, guard: deps.guard,
|
|
92
84
|
options: deps.appOptions, ownerKey, client: deps.client, redirectUri: requiredArgs.redirectUri,
|
|
93
85
|
}, { scopes: requestedScopes, extraAuthorizationParams: { ...kindParams, ...startParams } })
|
|
94
|
-
.catch((error) => { throw toConnectionError(error); });
|
|
86
|
+
.catch((error) => { throw toConnectionError(deps, error); });
|
|
95
87
|
return { connectionRef: key, authorizationUrl: begun.authorizationUrl, state: begun.state, attemptId, browserBinding,
|
|
96
88
|
expiresAt: begun.expiresAt };
|
|
97
89
|
}
|
|
@@ -106,14 +98,15 @@ export async function completeApiConnectionAuthorization(deps, requiredArgs) {
|
|
|
106
98
|
assertId(requiredArgs.actorId, 'actorId');
|
|
107
99
|
if (!URL.canParse(requiredArgs.redirectUri))
|
|
108
100
|
throw requestInvalid('redirectUri');
|
|
109
|
-
const params = checkCallbackParams(requiredArgs.callbackParams
|
|
101
|
+
const params = checkCallbackParams(requiredArgs.callbackParams, { maxAuthorizationStateLength: deps.oauth.maxAuthorizationStateLength,
|
|
102
|
+
maxCallbackFieldLength: deps.oauth.callbackFieldRules.maxLength });
|
|
110
103
|
const callbackFields = pickBoundedFields(deps.descriptor.callbackFields, requiredArgs.callbackParams, 'callback field');
|
|
111
104
|
let attempt;
|
|
112
|
-
const tokens = await completeAuthorizationCode({
|
|
105
|
+
const tokens = await deps.oauth.flow.completeAuthorizationCode({
|
|
113
106
|
provider: providerFor(deps), stateless: attemptOpener(deps, { browserBinding: requiredArgs.browserBinding, onOpen: opened => { attempt = opened.attempt; } }),
|
|
114
107
|
redirectUri: new URL(requiredArgs.redirectUri).href, ownerKey: ownerKeyFor(deps, requiredArgs), client: deps.client, params,
|
|
115
108
|
fetchFn: deps.fetchFn, guard: deps.guard, clock: deps.clock,
|
|
116
|
-
}).catch((error) => { throw toConnectionError(error); });
|
|
109
|
+
}).catch((error) => { throw toConnectionError(deps, error); });
|
|
117
110
|
// completeAuthorizationCode only reaches the exchange after `open` returned an attempt.
|
|
118
111
|
return finishAuthorization(deps, { attempt: attempt, tokens, callbackFields });
|
|
119
112
|
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import type { Clock } from '@jini-ai/core/primitives';
|
|
2
|
+
/**
|
|
3
|
+
* @file Per-minute request budgets a plugin declares on one of its API connections (`budgets` in
|
|
4
|
+
* the plugin's connections file), parsed, clamped and enforced by the host through its own
|
|
5
|
+
* fixed-window limiter (the `createLimiter` port).
|
|
6
|
+
*
|
|
7
|
+
* Exists so a plugin can stay under its provider's quota without trusting the plugin to pace
|
|
8
|
+
* itself: every token read for a connection (one per authenticated request, by the host's
|
|
9
|
+
* capability rule) is charged here first, for chat tools, admin-surface actions and form delivery
|
|
10
|
+
* alike. Budgets are keyed by workspace, plugin and connection, so a plugin can never spend another
|
|
11
|
+
* plugin's or the host's budget, and every value is clamped to {@link HOST_BUDGET_MAXIMUM}. Counters
|
|
12
|
+
* live in this process's memory: each process that composes the host keeps its own.
|
|
13
|
+
*/
|
|
14
|
+
/** `instance`: this site's share, all accounts of one declared connection. `connection`: one signed-in account. */
|
|
15
|
+
export type ConnectionBudgetScope = "instance" | "connection";
|
|
16
|
+
export interface ConnectionBudget {
|
|
17
|
+
readonly scope: ConnectionBudgetScope;
|
|
18
|
+
readonly perMinute: number;
|
|
19
|
+
/** Extra calls allowed in a window on top of `perMinute` (http-kit counts `max + burst`). */
|
|
20
|
+
readonly burst: number;
|
|
21
|
+
}
|
|
22
|
+
/** The most any plugin may declare per scope; also the instance budget of a connection that declares none. */
|
|
23
|
+
export declare const HOST_BUDGET_MAXIMUM: Readonly<{
|
|
24
|
+
perMinute: 240;
|
|
25
|
+
burst: 40;
|
|
26
|
+
}>;
|
|
27
|
+
/**
|
|
28
|
+
* A declaration's `budgets`, clamped, always with an instance budget (the host maximum when the
|
|
29
|
+
* plugin declares none), or why they are invalid. An invalid entry refuses the declaration rather
|
|
30
|
+
* than loading the connection unbounded.
|
|
31
|
+
* @complexity O(b), b ≤ 2 entries.
|
|
32
|
+
*/
|
|
33
|
+
export declare function parseConnectionBudgets(required: {
|
|
34
|
+
readonly value: unknown;
|
|
35
|
+
readonly at: string;
|
|
36
|
+
}, _optional?: Record<string, never>): readonly ConnectionBudget[] | string;
|
|
37
|
+
/** A charge the budget refused. Nothing was sent, so the caller may retry after `retryAfterMs`. */
|
|
38
|
+
export declare class ConnectionBudgetExceededError extends Error {
|
|
39
|
+
readonly code = "rate-limited";
|
|
40
|
+
readonly retryable = true;
|
|
41
|
+
readonly retryAfterMs: number;
|
|
42
|
+
readonly outcome = "not-applied";
|
|
43
|
+
constructor(required: {
|
|
44
|
+
readonly retryAfterMs: number;
|
|
45
|
+
}, _optional?: Record<string, never>);
|
|
46
|
+
}
|
|
47
|
+
/** What one charge spends: the calling plugin's connection and the account its ref names. */
|
|
48
|
+
export interface ConnectionBudgetTarget {
|
|
49
|
+
readonly workspaceId: string;
|
|
50
|
+
readonly pluginId: string;
|
|
51
|
+
readonly connectionId: string;
|
|
52
|
+
/** Must already be verified as this plugin's own ref, so forged refs never create counters. */
|
|
53
|
+
readonly connectionRef: string;
|
|
54
|
+
readonly budgets: readonly ConnectionBudget[];
|
|
55
|
+
}
|
|
56
|
+
/** The fixed-window profile one limiter enforces: `max + burst` calls per `windowSeconds`. */
|
|
57
|
+
export interface ConnectionBudgetLimiterProfile {
|
|
58
|
+
readonly windowSeconds: number;
|
|
59
|
+
readonly max: number;
|
|
60
|
+
readonly burst: number;
|
|
61
|
+
}
|
|
62
|
+
/** The host's fixed-window limiter, as much of it as budgets use. `check` evaluates and records one call. */
|
|
63
|
+
export interface ConnectionBudgetLimiter {
|
|
64
|
+
check(required: {
|
|
65
|
+
readonly key: string;
|
|
66
|
+
}): Promise<{
|
|
67
|
+
readonly allowed: true;
|
|
68
|
+
} | {
|
|
69
|
+
readonly allowed: false;
|
|
70
|
+
readonly retryAfterSeconds: number;
|
|
71
|
+
}>;
|
|
72
|
+
}
|
|
73
|
+
/** Port: builds one in-memory limiter for a profile over the host's clock. */
|
|
74
|
+
export type CreateConnectionBudgetLimiter = (required: {
|
|
75
|
+
readonly profile: ConnectionBudgetLimiterProfile;
|
|
76
|
+
readonly clock: Clock;
|
|
77
|
+
}) => ConnectionBudgetLimiter;
|
|
78
|
+
/**
|
|
79
|
+
* The host's budget enforcer. One limiter per distinct clamped profile (bounded by the maxima).
|
|
80
|
+
* The per-account budget is checked first, so a busy account's refused calls never spend the
|
|
81
|
+
* instance budget its siblings share.
|
|
82
|
+
* @complexity O(b) limiter checks per charge.
|
|
83
|
+
*/
|
|
84
|
+
export declare function createConnectionBudgets(required: {
|
|
85
|
+
readonly clock: Clock;
|
|
86
|
+
readonly createLimiter: CreateConnectionBudgetLimiter;
|
|
87
|
+
}, _optional?: Record<string, never>): {
|
|
88
|
+
charge(target: ConnectionBudgetTarget, _options?: Record<string, never>): Promise<void>;
|
|
89
|
+
};
|
|
90
|
+
export type ConnectionBudgets = ReturnType<typeof createConnectionBudgets>;
|
|
91
|
+
//# sourceMappingURL=budgets.d.ts.map
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/** The most any plugin may declare per scope; also the instance budget of a connection that declares none. */
|
|
2
|
+
export const HOST_BUDGET_MAXIMUM = Object.freeze({ perMinute: 240, burst: 40 });
|
|
3
|
+
const SCOPES = ["instance", "connection"];
|
|
4
|
+
function isCount(value, minimum) {
|
|
5
|
+
return Number.isSafeInteger(value) && value >= minimum;
|
|
6
|
+
}
|
|
7
|
+
/** One entry, clamped, or why it is invalid. @complexity O(1). */
|
|
8
|
+
function parseBudget(entry, at) {
|
|
9
|
+
if (typeof entry !== "object" || entry === null)
|
|
10
|
+
return `${at} must be an object`;
|
|
11
|
+
const { scope, perMinute, burst = 0 } = entry;
|
|
12
|
+
if (!SCOPES.includes(scope))
|
|
13
|
+
return `${at}.scope must be "instance" or "connection"`;
|
|
14
|
+
if (!isCount(perMinute, 1) || !isCount(burst, 0))
|
|
15
|
+
return `${at}.perMinute must be a whole number of at least 1, and burst a whole number of at least 0`;
|
|
16
|
+
return { scope: scope, perMinute: Math.min(perMinute, HOST_BUDGET_MAXIMUM.perMinute), burst: Math.min(burst, HOST_BUDGET_MAXIMUM.burst) };
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* A declaration's `budgets`, clamped, always with an instance budget (the host maximum when the
|
|
20
|
+
* plugin declares none), or why they are invalid. An invalid entry refuses the declaration rather
|
|
21
|
+
* than loading the connection unbounded.
|
|
22
|
+
* @complexity O(b), b ≤ 2 entries.
|
|
23
|
+
*/
|
|
24
|
+
export function parseConnectionBudgets(required, _optional = {}) {
|
|
25
|
+
const { value, at } = required;
|
|
26
|
+
if (value === undefined)
|
|
27
|
+
return [{ scope: "instance", ...HOST_BUDGET_MAXIMUM }];
|
|
28
|
+
if (!Array.isArray(value) || value.length > SCOPES.length)
|
|
29
|
+
return `${at} must be a list of at most ${SCOPES.length} budgets`;
|
|
30
|
+
const budgets = [];
|
|
31
|
+
for (const [index, entry] of value.entries()) {
|
|
32
|
+
const budget = parseBudget(entry, `${at}[${index}]`);
|
|
33
|
+
if (typeof budget === "string")
|
|
34
|
+
return budget;
|
|
35
|
+
if (budgets.some((seen) => seen.scope === budget.scope))
|
|
36
|
+
return `${at}[${index}].scope "${budget.scope}" is declared twice`;
|
|
37
|
+
budgets.push(budget);
|
|
38
|
+
}
|
|
39
|
+
return budgets.some((budget) => budget.scope === "instance") ? budgets : [{ scope: "instance", ...HOST_BUDGET_MAXIMUM }, ...budgets];
|
|
40
|
+
}
|
|
41
|
+
/** A charge the budget refused. Nothing was sent, so the caller may retry after `retryAfterMs`. */
|
|
42
|
+
export class ConnectionBudgetExceededError extends Error {
|
|
43
|
+
code = "rate-limited";
|
|
44
|
+
retryable = true;
|
|
45
|
+
retryAfterMs;
|
|
46
|
+
outcome = "not-applied";
|
|
47
|
+
constructor(required, _optional = {}) {
|
|
48
|
+
super("This plugin reached its per-minute request budget for this service. Nothing was sent; retry after the wait.");
|
|
49
|
+
this.name = "ConnectionBudgetExceededError";
|
|
50
|
+
this.retryAfterMs = required.retryAfterMs;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* The host's budget enforcer. One limiter per distinct clamped profile (bounded by the maxima).
|
|
55
|
+
* The per-account budget is checked first, so a busy account's refused calls never spend the
|
|
56
|
+
* instance budget its siblings share.
|
|
57
|
+
* @complexity O(b) limiter checks per charge.
|
|
58
|
+
*/
|
|
59
|
+
export function createConnectionBudgets(required, _optional = {}) {
|
|
60
|
+
const limiters = new Map();
|
|
61
|
+
function limiterFor(budget) {
|
|
62
|
+
const id = `${budget.perMinute}/${budget.burst}`;
|
|
63
|
+
let limiter = limiters.get(id);
|
|
64
|
+
if (!limiter) {
|
|
65
|
+
const profile = { windowSeconds: 60, max: budget.perMinute, burst: budget.burst };
|
|
66
|
+
limiter = required.createLimiter({ profile, clock: required.clock });
|
|
67
|
+
limiters.set(id, limiter);
|
|
68
|
+
}
|
|
69
|
+
return limiter;
|
|
70
|
+
}
|
|
71
|
+
return {
|
|
72
|
+
async charge(target, _options = {}) {
|
|
73
|
+
const ordered = [...target.budgets].sort((a, b) => SCOPES.indexOf(b.scope) - SCOPES.indexOf(a.scope));
|
|
74
|
+
for (const budget of ordered) {
|
|
75
|
+
// NUL cannot appear in a workspace, plugin or connection id, so no key can name another's budget.
|
|
76
|
+
// The account segment is empty only for `instance`: an owned ref is never empty, so the two
|
|
77
|
+
// scopes' keys differ even when their profiles (and so their limiter) are the same.
|
|
78
|
+
const account = budget.scope === "connection" ? target.connectionRef : "";
|
|
79
|
+
const key = [target.workspaceId, target.pluginId, target.connectionId, account].join("\u0000");
|
|
80
|
+
const verdict = await limiterFor(budget).check({ key });
|
|
81
|
+
if (!verdict.allowed)
|
|
82
|
+
throw new ConnectionBudgetExceededError({ retryAfterMs: verdict.retryAfterSeconds * 1000 });
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=budgets.js.map
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ApiConnectionError } from "./errors.js";
|
|
2
|
+
import type { ApiConnectionByoCredentials, DeclaredApiConnection } from "./host-ports.js";
|
|
3
|
+
/**
|
|
4
|
+
* @file Bring-your-own OAuth client: a workspace admin's own client id + secret for a plugin
|
|
5
|
+
* connection that declares `byoClient: true`, saved through the EXISTING secure credential capture
|
|
6
|
+
* (Admin -> Access Tokens -> "Add custom provider", or the in-chat `custom_credential_create` card),
|
|
7
|
+
* so the secret is typed into a masked field, sealed in the vault, and never passes through chat or
|
|
8
|
+
* a tool argument. The saved custom credential is found by a label the host derives from the plugin
|
|
9
|
+
* and connection ids ({@link byoClientLabel}); its username holds the client id (not a secret) and
|
|
10
|
+
* its token the client secret. Its base URL must be on the connection's token endpoint origin: a
|
|
11
|
+
* custom credential's allowed origins are where its secret may be sent, and the token endpoint is
|
|
12
|
+
* the only place a client secret goes.
|
|
13
|
+
*
|
|
14
|
+
* Why a saved credential that is present but unusable is an error rather than "no BYO": the admin
|
|
15
|
+
* chose their own client, so silently signing in with the host-owned one instead would bind the
|
|
16
|
+
* account to a client they did not pick.
|
|
17
|
+
*/
|
|
18
|
+
/** A usable BYO client. Kept server-side only; the secret is sent to the token endpoint and nowhere else. */
|
|
19
|
+
export interface ByoClient {
|
|
20
|
+
readonly clientId: string;
|
|
21
|
+
readonly clientSecret: string;
|
|
22
|
+
}
|
|
23
|
+
/** The custom-credential label an admin saves a connection's own OAuth client under. @complexity O(1). */
|
|
24
|
+
export declare function byoClientLabel(required: {
|
|
25
|
+
readonly pluginId: string;
|
|
26
|
+
readonly connectionId: string;
|
|
27
|
+
}, _optional?: Record<string, never>): string;
|
|
28
|
+
/**
|
|
29
|
+
* The connection's BYO client in this workspace: undefined when the connection does not allow one
|
|
30
|
+
* or none is saved; an error (never the secret) when the saved credential cannot be used.
|
|
31
|
+
* @complexity O(n) custom credentials of the workspace (metadata), plus one envelope open.
|
|
32
|
+
*/
|
|
33
|
+
export declare function resolveByoClient(required: {
|
|
34
|
+
readonly byoCredentials: ApiConnectionByoCredentials;
|
|
35
|
+
readonly workspaceId: string;
|
|
36
|
+
readonly connection: DeclaredApiConnection;
|
|
37
|
+
}, _optional?: Record<string, never>): Promise<ByoClient | ApiConnectionError | undefined>;
|
|
38
|
+
//# sourceMappingURL=byo-client.d.ts.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ApiConnectionError } from "./errors.js";
|
|
2
|
+
/** The custom-credential label an admin saves a connection's own OAuth client under. @complexity O(1). */
|
|
3
|
+
export function byoClientLabel(required, _optional = {}) {
|
|
4
|
+
return `${required.pluginId}/${required.connectionId} OAuth client`;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* The connection's BYO client in this workspace: undefined when the connection does not allow one
|
|
8
|
+
* or none is saved; an error (never the secret) when the saved credential cannot be used.
|
|
9
|
+
* @complexity O(n) custom credentials of the workspace (metadata), plus one envelope open.
|
|
10
|
+
*/
|
|
11
|
+
export async function resolveByoClient(required, _optional = {}) {
|
|
12
|
+
const { connection } = required;
|
|
13
|
+
if (!connection.byoClient)
|
|
14
|
+
return undefined;
|
|
15
|
+
const label = byoClientLabel({ pluginId: connection.pluginId, connectionId: connection.descriptor.connectionId });
|
|
16
|
+
const saved = await required.byoCredentials.read({ workspaceId: required.workspaceId, label })
|
|
17
|
+
.catch(() => required.byoCredentials.refuse({ connection, label, problem: "unreadable" }));
|
|
18
|
+
if (saved === null || saved instanceof ApiConnectionError)
|
|
19
|
+
return saved ?? undefined;
|
|
20
|
+
const tokenOrigin = new URL(connection.descriptor.tokenEndpoint).origin;
|
|
21
|
+
if (!saved.allowedOrigins().includes(tokenOrigin))
|
|
22
|
+
return required.byoCredentials.refuse({ connection, label, problem: "wrong-origin", tokenOrigin });
|
|
23
|
+
const clientId = saved.connection.username?.trim();
|
|
24
|
+
if (!clientId)
|
|
25
|
+
return required.byoCredentials.refuse({ connection, label, problem: "missing-client-id" });
|
|
26
|
+
return { clientId, clientSecret: saved.connection.token };
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=byo-client.js.map
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type { ApiConnectionIntent } from './types.js';
|
|
2
|
+
import type { CompletedAuthorization } from './finish-authorization.js';
|
|
3
|
+
import type { ApiConnectionSignInLink, ApiConnectionConnectMessages, DeclaredApiConnection } from './host-ports.js';
|
|
4
|
+
import type { ApiConnectionHost } from "./host.js";
|
|
5
|
+
/**
|
|
6
|
+
* @file The plugin-declared API-connection branch of `agent_plugin_connect` (the single sign-in
|
|
7
|
+
* entry point): start the generic sign-in, hand the card its link, and wait for the result.
|
|
8
|
+
*
|
|
9
|
+
* Hosted: the card links to the host's sign-in link (`browser-binding.ts`), which binds the browser
|
|
10
|
+
* and redirects to the provider; the provider returns to the public callback route, which completes the sign-in; this call
|
|
11
|
+
* watches the connection record until its credential generation moves past the one it started from
|
|
12
|
+
* and it reads `connected`. Desktop: an ephemeral 127.0.0.1 loopback listener (Jini's installed-app
|
|
13
|
+
* receiver) catches the redirect and this call completes it itself. The card's link opens in the
|
|
14
|
+
* system browser through the desktop shell's existing external-link policy, so nothing here launches
|
|
15
|
+
* a browser. Results carry a status and the opaque `connectionRef` only, never a token, code or URL. At most one desktop listener
|
|
16
|
+
* per connection is pending: a newer sign-in closes the previous one.
|
|
17
|
+
*/
|
|
18
|
+
export interface ApiConnectionConnectDeps {
|
|
19
|
+
readonly host: ApiConnectionHost;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* `connectionRef` is the opaque, plugin-scoped key the plugin's tools take as input. It is not a
|
|
23
|
+
* secret: the host refuses it for any plugin that does not declare the connection in this workspace.
|
|
24
|
+
* Returned in both states so a later call can use it once the person finishes signing in.
|
|
25
|
+
*/
|
|
26
|
+
export type ApiConnectionConnectStatus = {
|
|
27
|
+
readonly status: "connected" | "waiting-for-sign-in";
|
|
28
|
+
readonly connectionRef: string;
|
|
29
|
+
};
|
|
30
|
+
interface ConnectRun {
|
|
31
|
+
readonly signInLink: ApiConnectionSignInLink;
|
|
32
|
+
readonly messages: ApiConnectionConnectMessages;
|
|
33
|
+
readonly deps: ApiConnectionConnectDeps;
|
|
34
|
+
readonly connection: DeclaredApiConnection;
|
|
35
|
+
readonly actorId: string;
|
|
36
|
+
readonly destination?: "site" | "shared" | undefined;
|
|
37
|
+
/** Shows the waiting card with the sign-in link; returns once it is on screen. */
|
|
38
|
+
readonly showSignIn: (input: {
|
|
39
|
+
readonly signInUrl: string;
|
|
40
|
+
}) => Promise<void>;
|
|
41
|
+
readonly signal: AbortSignal;
|
|
42
|
+
readonly pollIntervalMs: number;
|
|
43
|
+
readonly waitTimeoutMs: number;
|
|
44
|
+
}
|
|
45
|
+
/** A started sign-in. Desktop also carries its own completion; hosted completes at the public callback. */
|
|
46
|
+
export interface ApiConnectionSignInStart {
|
|
47
|
+
/** The link the person opens: desktop, the provider's URL (system browser); hosted, this host's sign-in link. */
|
|
48
|
+
readonly authorizationUrl: string;
|
|
49
|
+
/** The service's opaque attempt id: what plugin code and frames get, never the OAuth `state`. */
|
|
50
|
+
readonly attemptId: string;
|
|
51
|
+
readonly expiresAt: string;
|
|
52
|
+
/** Desktop only: the redeemed sign-in, or null when the loopback callback never came (timeout, abort, refusal). */
|
|
53
|
+
readonly completion?: Promise<CompletedAuthorization | null>;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Starts one sign-in for a declared connection: the generic start with the caller's declared start
|
|
57
|
+
* parameters (Jini refuses undeclared ones), on the runtime's redirect. Desktop arms Jini's
|
|
58
|
+
* 127.0.0.1 loopback receiver first (it closes on its callback, `timeoutMs` or `signal`) and
|
|
59
|
+
* redeems the callback itself, returning the plugin's declared callback fields with the result.
|
|
60
|
+
* Shared by `agent_plugin_connect` and the admin-surface connection port.
|
|
61
|
+
* @complexity One start; desktop adds one loopback listener and, later, one exchange.
|
|
62
|
+
*/
|
|
63
|
+
export declare function startApiConnectionSignIn(required: SignInRequest, optional?: SignInOptions): Promise<ApiConnectionSignInStart>;
|
|
64
|
+
interface SignInRequest {
|
|
65
|
+
readonly signInLink: ApiConnectionSignInLink;
|
|
66
|
+
readonly messages: ApiConnectionConnectMessages;
|
|
67
|
+
readonly host: ApiConnectionHost;
|
|
68
|
+
readonly connection: DeclaredApiConnection;
|
|
69
|
+
readonly actorId: string;
|
|
70
|
+
readonly destination?: "site" | "shared" | undefined;
|
|
71
|
+
readonly intent: ApiConnectionIntent;
|
|
72
|
+
readonly scopeSetIds: readonly string[];
|
|
73
|
+
}
|
|
74
|
+
interface SignInOptions {
|
|
75
|
+
readonly startParams?: Readonly<Record<string, string>>;
|
|
76
|
+
readonly timeoutMs?: number;
|
|
77
|
+
readonly signal?: AbortSignal;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Connects one declared API connection. Already connected with every scope it would request:
|
|
81
|
+
* returns `connected` with no sign-in, like the MCP branch does for a connected server.
|
|
82
|
+
* @throws {ToolInputError} The connection refused to start or complete (safe message, next step).
|
|
83
|
+
* @complexity One status read, one sign-in round trip bounded by `waitTimeoutMs`.
|
|
84
|
+
*/
|
|
85
|
+
export declare function runApiConnectionConnect(required: ConnectRun, _optional?: Record<string, never>): Promise<ApiConnectionConnectStatus>;
|
|
86
|
+
export {};
|
|
87
|
+
//# sourceMappingURL=connect.d.ts.map
|