managed-deepagents 0.5.3-dev.111 → 0.5.3-dev.113
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/README.md +20 -17
- package/dist/channels/manifest.d.ts +0 -2
- package/dist/channels/manifest.d.ts.map +1 -1
- package/dist/channels/slack/http.d.ts.map +1 -1
- package/dist/channels/slack/http.js +3 -48
- package/dist/channels/slack/http.js.map +1 -1
- package/dist/channels/slack/index.d.ts +2 -3
- package/dist/channels/slack/index.d.ts.map +1 -1
- package/dist/channels/slack/index.js +2 -3
- package/dist/channels/slack/index.js.map +1 -1
- package/dist/connectors/mcp/index.d.ts.map +1 -1
- package/dist/connectors/mcp/index.js +5 -1
- package/dist/connectors/mcp/index.js.map +1 -1
- package/dist/connectors/mcp/load.js +3 -0
- package/dist/connectors/mcp/load.js.map +1 -1
- package/dist/connectors/tool-selection.d.ts +13 -18
- package/dist/connectors/tool-selection.d.ts.map +1 -1
- package/dist/connectors/tool-selection.js +10 -13
- package/dist/connectors/tool-selection.js.map +1 -1
- package/dist/extension.d.ts +5 -5
- package/dist/extension.js +5 -5
- package/dist/identity/index.d.ts +2 -11
- package/dist/identity/index.d.ts.map +1 -1
- package/dist/identity/index.js +8 -66
- package/dist/identity/index.js.map +1 -1
- package/dist/identity/options.d.ts +3 -3
- package/dist/identity/options.js +7 -8
- package/dist/identity/options.js.map +1 -1
- package/dist/identity/slack/links.d.ts +1 -2
- package/dist/identity/slack/links.d.ts.map +1 -1
- package/dist/identity/slack/links.js +1 -2
- package/dist/identity/slack/links.js.map +1 -1
- package/dist/identity/supabase.d.ts.map +1 -1
- package/dist/identity/supabase.js +2 -0
- package/dist/identity/supabase.js.map +1 -1
- package/dist/identity/types.d.ts +8 -81
- package/dist/identity/types.d.ts.map +1 -1
- package/dist/index.d.ts +2 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/namespaces.d.ts +5 -183
- package/dist/namespaces.d.ts.map +1 -1
- package/dist/namespaces.js +1 -63
- package/dist/namespaces.js.map +1 -1
- package/dist/runtime/auth.d.ts +11 -14
- package/dist/runtime/auth.d.ts.map +1 -1
- package/dist/runtime/auth.js +15 -54
- package/dist/runtime/auth.js.map +1 -1
- package/dist/runtime/cors.d.ts +5 -4
- package/dist/runtime/cors.d.ts.map +1 -1
- package/dist/runtime/cors.js +5 -9
- package/dist/runtime/cors.js.map +1 -1
- package/dist/runtime/identity-http.d.ts.map +1 -1
- package/dist/runtime/identity-http.js +0 -69
- package/dist/runtime/identity-http.js.map +1 -1
- package/dist/runtime/identity-runtime.d.ts +2 -10
- package/dist/runtime/identity-runtime.d.ts.map +1 -1
- package/dist/runtime/identity-runtime.js +2 -38
- package/dist/runtime/identity-runtime.js.map +1 -1
- package/dist/runtime/index.d.ts +15 -11
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +8 -44
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/managed-middleware.d.ts +2 -3
- package/dist/runtime/managed-middleware.d.ts.map +1 -1
- package/dist/runtime/managed-middleware.js +12 -12
- package/dist/runtime/managed-middleware.js.map +1 -1
- package/dist/runtime/managed-tools.d.ts +4 -11
- package/dist/runtime/managed-tools.d.ts.map +1 -1
- package/dist/runtime/managed-tools.js +11 -18
- package/dist/runtime/managed-tools.js.map +1 -1
- package/dist/runtime/memory/context-io.d.ts +0 -1
- package/dist/runtime/memory/context-io.d.ts.map +1 -1
- package/dist/runtime/memory/context-io.js +0 -10
- package/dist/runtime/memory/context-io.js.map +1 -1
- package/dist/runtime/memory/mounts.d.ts.map +1 -1
- package/dist/runtime/memory/mounts.js +0 -10
- package/dist/runtime/memory/mounts.js.map +1 -1
- package/dist/runtime/validated-token.d.ts.map +1 -1
- package/dist/runtime/validated-token.js +7 -1
- package/dist/runtime/validated-token.js.map +1 -1
- package/package.json +10 -11
- package/dist/channels/index.d.ts +0 -25
- package/dist/channels/index.d.ts.map +0 -1
- package/dist/channels/index.js +0 -18
- package/dist/channels/index.js.map +0 -1
- package/dist/connectors/marketplace/catalog.d.ts +0 -96
- package/dist/connectors/marketplace/catalog.d.ts.map +0 -1
- package/dist/connectors/marketplace/catalog.js +0 -213
- package/dist/connectors/marketplace/catalog.js.map +0 -1
- package/dist/connectors/marketplace/fleet-mcp.d.ts +0 -62
- package/dist/connectors/marketplace/fleet-mcp.d.ts.map +0 -1
- package/dist/connectors/marketplace/fleet-mcp.js +0 -215
- package/dist/connectors/marketplace/fleet-mcp.js.map +0 -1
- package/dist/connectors/marketplace/index.d.ts +0 -31
- package/dist/connectors/marketplace/index.d.ts.map +0 -1
- package/dist/connectors/marketplace/index.js +0 -39
- package/dist/connectors/marketplace/index.js.map +0 -1
- package/dist/connectors/marketplace/load.d.ts +0 -14
- package/dist/connectors/marketplace/load.d.ts.map +0 -1
- package/dist/connectors/marketplace/load.js +0 -206
- package/dist/connectors/marketplace/load.js.map +0 -1
- package/dist/connectors/slack/index.d.ts +0 -24
- package/dist/connectors/slack/index.d.ts.map +0 -1
- package/dist/connectors/slack/index.js +0 -64
- package/dist/connectors/slack/index.js.map +0 -1
- package/dist/connectors/toolserver/catalog.d.ts +0 -326
- package/dist/connectors/toolserver/catalog.d.ts.map +0 -1
- package/dist/connectors/toolserver/catalog.js +0 -415
- package/dist/connectors/toolserver/catalog.js.map +0 -1
- package/dist/connectors/toolserver/connectors.d.ts +0 -698
- package/dist/connectors/toolserver/connectors.d.ts.map +0 -1
- package/dist/connectors/toolserver/connectors.js +0 -13
- package/dist/connectors/toolserver/connectors.js.map +0 -1
- package/dist/connectors/toolserver/index.d.ts +0 -142
- package/dist/connectors/toolserver/index.d.ts.map +0 -1
- package/dist/connectors/toolserver/index.js +0 -105
- package/dist/connectors/toolserver/index.js.map +0 -1
- package/dist/connectors/toolserver/integrations.d.ts +0 -103
- package/dist/connectors/toolserver/integrations.d.ts.map +0 -1
- package/dist/connectors/toolserver/integrations.js +0 -288
- package/dist/connectors/toolserver/integrations.js.map +0 -1
- package/dist/connectors/toolserver/load.d.ts +0 -55
- package/dist/connectors/toolserver/load.d.ts.map +0 -1
- package/dist/connectors/toolserver/load.js +0 -289
- package/dist/connectors/toolserver/load.js.map +0 -1
- package/dist/identity/actor-subject.d.ts +0 -60
- package/dist/identity/actor-subject.d.ts.map +0 -1
- package/dist/identity/actor-subject.js +0 -107
- package/dist/identity/actor-subject.js.map +0 -1
- package/dist/identity/byo-oauth.d.ts +0 -105
- package/dist/identity/byo-oauth.d.ts.map +0 -1
- package/dist/identity/byo-oauth.js +0 -190
- package/dist/identity/byo-oauth.js.map +0 -1
- package/dist/identity/connect-inference.d.ts +0 -37
- package/dist/identity/connect-inference.d.ts.map +0 -1
- package/dist/identity/connect-inference.js +0 -53
- package/dist/identity/connect-inference.js.map +0 -1
- package/dist/identity/connect-paths.d.ts +0 -8
- package/dist/identity/connect-paths.d.ts.map +0 -1
- package/dist/identity/connect-paths.js +0 -11
- package/dist/identity/connect-paths.js.map +0 -1
- package/dist/identity/connect-provider-types.d.ts +0 -97
- package/dist/identity/connect-provider-types.d.ts.map +0 -1
- package/dist/identity/connect-provider-types.js +0 -10
- package/dist/identity/connect-provider-types.js.map +0 -1
- package/dist/identity/connect-provider.d.ts +0 -35
- package/dist/identity/connect-provider.d.ts.map +0 -1
- package/dist/identity/connect-provider.js +0 -148
- package/dist/identity/connect-provider.js.map +0 -1
- package/dist/identity/credential-resolvers.d.ts +0 -33
- package/dist/identity/credential-resolvers.d.ts.map +0 -1
- package/dist/identity/credential-resolvers.js +0 -62
- package/dist/identity/credential-resolvers.js.map +0 -1
- package/dist/identity/define-fleet-connect.d.ts +0 -53
- package/dist/identity/define-fleet-connect.d.ts.map +0 -1
- package/dist/identity/define-fleet-connect.js +0 -76
- package/dist/identity/define-fleet-connect.js.map +0 -1
- package/dist/identity/fleet-connect-hint.d.ts +0 -41
- package/dist/identity/fleet-connect-hint.d.ts.map +0 -1
- package/dist/identity/fleet-connect-hint.js +0 -190
- package/dist/identity/fleet-connect-hint.js.map +0 -1
- package/dist/identity/fleet-connect.d.ts +0 -93
- package/dist/identity/fleet-connect.d.ts.map +0 -1
- package/dist/identity/fleet-connect.js +0 -256
- package/dist/identity/fleet-connect.js.map +0 -1
- package/dist/identity/fleet-integration-connect.d.ts +0 -32
- package/dist/identity/fleet-integration-connect.d.ts.map +0 -1
- package/dist/identity/fleet-integration-connect.js +0 -35
- package/dist/identity/fleet-integration-connect.js.map +0 -1
- package/dist/identity/fleet.d.ts +0 -56
- package/dist/identity/fleet.d.ts.map +0 -1
- package/dist/identity/fleet.js +0 -131
- package/dist/identity/fleet.js.map +0 -1
- package/dist/identity/github/connect-http.d.ts +0 -37
- package/dist/identity/github/connect-http.d.ts.map +0 -1
- package/dist/identity/github/connect-http.js +0 -128
- package/dist/identity/github/connect-http.js.map +0 -1
- package/dist/identity/github/credentials-store.d.ts +0 -76
- package/dist/identity/github/credentials-store.d.ts.map +0 -1
- package/dist/identity/github/credentials-store.js +0 -270
- package/dist/identity/github/credentials-store.js.map +0 -1
- package/dist/identity/github/credentials.d.ts +0 -87
- package/dist/identity/github/credentials.d.ts.map +0 -1
- package/dist/identity/github/credentials.js +0 -201
- package/dist/identity/github/credentials.js.map +0 -1
- package/dist/identity/github/index.d.ts +0 -7
- package/dist/identity/github/index.d.ts.map +0 -1
- package/dist/identity/github/index.js +0 -6
- package/dist/identity/github/index.js.map +0 -1
- package/dist/identity/github/oauth.d.ts +0 -47
- package/dist/identity/github/oauth.d.ts.map +0 -1
- package/dist/identity/github/oauth.js +0 -124
- package/dist/identity/github/oauth.js.map +0 -1
- package/dist/identity/google/connect-http.d.ts +0 -37
- package/dist/identity/google/connect-http.d.ts.map +0 -1
- package/dist/identity/google/connect-http.js +0 -42
- package/dist/identity/google/connect-http.js.map +0 -1
- package/dist/identity/google/index.d.ts +0 -7
- package/dist/identity/google/index.d.ts.map +0 -1
- package/dist/identity/google/index.js +0 -6
- package/dist/identity/google/index.js.map +0 -1
- package/dist/identity/google/oauth.d.ts +0 -22
- package/dist/identity/google/oauth.d.ts.map +0 -1
- package/dist/identity/google/oauth.js +0 -48
- package/dist/identity/google/oauth.js.map +0 -1
- package/dist/identity/linkedin/connect-http.d.ts +0 -37
- package/dist/identity/linkedin/connect-http.d.ts.map +0 -1
- package/dist/identity/linkedin/connect-http.js +0 -41
- package/dist/identity/linkedin/connect-http.js.map +0 -1
- package/dist/identity/linkedin/index.d.ts +0 -7
- package/dist/identity/linkedin/index.d.ts.map +0 -1
- package/dist/identity/linkedin/index.js +0 -6
- package/dist/identity/linkedin/index.js.map +0 -1
- package/dist/identity/linkedin/oauth.d.ts +0 -22
- package/dist/identity/linkedin/oauth.d.ts.map +0 -1
- package/dist/identity/linkedin/oauth.js +0 -47
- package/dist/identity/linkedin/oauth.js.map +0 -1
- package/dist/identity/marketplace/connect-hint.d.ts +0 -31
- package/dist/identity/marketplace/connect-hint.d.ts.map +0 -1
- package/dist/identity/marketplace/connect-hint.js +0 -59
- package/dist/identity/marketplace/connect-hint.js.map +0 -1
- package/dist/identity/marketplace/connect.d.ts +0 -51
- package/dist/identity/marketplace/connect.d.ts.map +0 -1
- package/dist/identity/marketplace/connect.js +0 -88
- package/dist/identity/marketplace/connect.js.map +0 -1
- package/dist/identity/marketplace/index.d.ts +0 -9
- package/dist/identity/marketplace/index.d.ts.map +0 -1
- package/dist/identity/marketplace/index.js +0 -9
- package/dist/identity/marketplace/index.js.map +0 -1
- package/dist/identity/microsoft/connect-http.d.ts +0 -38
- package/dist/identity/microsoft/connect-http.d.ts.map +0 -1
- package/dist/identity/microsoft/connect-http.js +0 -42
- package/dist/identity/microsoft/connect-http.js.map +0 -1
- package/dist/identity/microsoft/index.d.ts +0 -7
- package/dist/identity/microsoft/index.d.ts.map +0 -1
- package/dist/identity/microsoft/index.js +0 -6
- package/dist/identity/microsoft/index.js.map +0 -1
- package/dist/identity/microsoft/oauth.d.ts +0 -24
- package/dist/identity/microsoft/oauth.d.ts.map +0 -1
- package/dist/identity/microsoft/oauth.js +0 -65
- package/dist/identity/microsoft/oauth.js.map +0 -1
- package/dist/identity/oauth-env.d.ts +0 -43
- package/dist/identity/oauth-env.d.ts.map +0 -1
- package/dist/identity/oauth-env.js +0 -66
- package/dist/identity/oauth-env.js.map +0 -1
- package/dist/identity/oauth-tickets.d.ts +0 -37
- package/dist/identity/oauth-tickets.d.ts.map +0 -1
- package/dist/identity/oauth-tickets.js +0 -114
- package/dist/identity/oauth-tickets.js.map +0 -1
- package/dist/identity/slack/connect-http.d.ts +0 -35
- package/dist/identity/slack/connect-http.d.ts.map +0 -1
- package/dist/identity/slack/connect-http.js +0 -115
- package/dist/identity/slack/connect-http.js.map +0 -1
- package/dist/identity/slack/index.d.ts +0 -8
- package/dist/identity/slack/index.d.ts.map +0 -1
- package/dist/identity/slack/index.js +0 -7
- package/dist/identity/slack/index.js.map +0 -1
- package/dist/identity/slack/oauth.d.ts +0 -28
- package/dist/identity/slack/oauth.d.ts.map +0 -1
- package/dist/identity/slack/oauth.js +0 -87
- package/dist/identity/slack/oauth.js.map +0 -1
- package/dist/identity/x/connect-http.d.ts +0 -38
- package/dist/identity/x/connect-http.d.ts.map +0 -1
- package/dist/identity/x/connect-http.js +0 -41
- package/dist/identity/x/connect-http.js.map +0 -1
- package/dist/identity/x/index.d.ts +0 -6
- package/dist/identity/x/index.d.ts.map +0 -1
- package/dist/identity/x/index.js +0 -5
- package/dist/identity/x/index.js.map +0 -1
- package/dist/runtime/credentials.d.ts +0 -68
- package/dist/runtime/credentials.d.ts.map +0 -1
- package/dist/runtime/credentials.js +0 -235
- package/dist/runtime/credentials.js.map +0 -1
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Connect-with-X plugin contract.
|
|
3
|
-
*
|
|
4
|
-
* List providers on `identity.connect` (e.g. `connect.github()`) to mount
|
|
5
|
-
* `/identity/{id}/{status,connect,callback,link}` from the managed HTTP app.
|
|
6
|
-
* Built-in providers also mount when the deployment implies them (see
|
|
7
|
-
* {@link IdentityConnectMountContext}).
|
|
8
|
-
*/
|
|
9
|
-
import type { IdentityConfig } from "./types.js";
|
|
10
|
-
/** Context for deciding whether a provider's routes should mount. */
|
|
11
|
-
export interface IdentityConnectMountContext {
|
|
12
|
-
/** Compiled channel manifests (file stem → manifest). */
|
|
13
|
-
channels?: Record<string, {
|
|
14
|
-
provider?: string;
|
|
15
|
-
}>;
|
|
16
|
-
/** True when the project declared managed identity. */
|
|
17
|
-
hasIdentity: boolean;
|
|
18
|
-
/**
|
|
19
|
-
* True when this provider appears on `identity.connect`. False when it is
|
|
20
|
-
* offered as a built-in candidate, in which case the provider's own predicate
|
|
21
|
-
* decides whether the deployment needs it.
|
|
22
|
-
*/
|
|
23
|
-
declared?: boolean;
|
|
24
|
-
/** The deployment's resolved isolation axes. */
|
|
25
|
-
scope?: IdentityConfig["scope"];
|
|
26
|
-
/**
|
|
27
|
-
* The deployment's credential config, when one is declared: a single resolver
|
|
28
|
-
* or a per-target map. Prefer `credentialConnectIds(ctx.credentials)` over
|
|
29
|
-
* reading it directly, so both forms are handled.
|
|
30
|
-
*/
|
|
31
|
-
credentials?: IdentityConfig["credentials"];
|
|
32
|
-
/**
|
|
33
|
-
* Connector `kind` values discovered for the deployment (toolserver slugs,
|
|
34
|
-
* `github`, `slack`, …). Used to infer Connect-with-X from matching
|
|
35
|
-
* connectors (GitHub, Google, Microsoft, LinkedIn) without listing
|
|
36
|
-
* `connect.<provider>()` on identity.
|
|
37
|
-
*/
|
|
38
|
-
connectorKinds?: readonly (string | undefined)[];
|
|
39
|
-
}
|
|
40
|
-
/** JSON object returned by status / error payloads. */
|
|
41
|
-
export type IdentityConnectJson = Record<string, unknown>;
|
|
42
|
-
export type IdentityConnectAuthorizeResult = {
|
|
43
|
-
authorizeUrl: string;
|
|
44
|
-
} | {
|
|
45
|
-
notConfigured: true;
|
|
46
|
-
error: string;
|
|
47
|
-
};
|
|
48
|
-
export type IdentityConnectCallbackResult = {
|
|
49
|
-
/** Absolute URL to redirect the browser after a successful link. */
|
|
50
|
-
successRedirect: string;
|
|
51
|
-
};
|
|
52
|
-
/** Inputs for resolving the OAuth `redirect_uri` base (no path). */
|
|
53
|
-
export interface IdentityConnectRedirectBaseOptions {
|
|
54
|
-
requestUrl: string;
|
|
55
|
-
headers?: Headers | {
|
|
56
|
-
get(name: string): string | null | undefined;
|
|
57
|
-
};
|
|
58
|
-
deploymentBaseUrl?: string;
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Pluggable Connect-with-X provider.
|
|
62
|
-
*
|
|
63
|
-
* OAuth/OIDC exchange and persistence stay in the provider module; the shared
|
|
64
|
-
* scaffold only owns HTTP choreography.
|
|
65
|
-
*/
|
|
66
|
-
export interface IdentityConnectProvider {
|
|
67
|
-
/** Path segment under `/identity/{id}/…` (e.g. `"slack"`, `"stripe"`). */
|
|
68
|
-
readonly id: string;
|
|
69
|
-
/**
|
|
70
|
-
* Query key for post-OAuth settings redirects (`/settings?{key}=connected`).
|
|
71
|
-
* Defaults to {@link id}.
|
|
72
|
-
*/
|
|
73
|
-
readonly settingsQueryKey?: string;
|
|
74
|
-
/** Whether to mount this provider's four routes for the current project. */
|
|
75
|
-
shouldMount(ctx: IdentityConnectMountContext): boolean;
|
|
76
|
-
/** Secured status payload for the authenticated user. */
|
|
77
|
-
status(userId: string): IdentityConnectJson | Promise<IdentityConnectJson>;
|
|
78
|
-
/** Begin OAuth — return authorize URL or a not-configured error. */
|
|
79
|
-
startAuthorize(userId: string, redirectUri: string): IdentityConnectAuthorizeResult | Promise<IdentityConnectAuthorizeResult>;
|
|
80
|
-
/**
|
|
81
|
-
* Finish OAuth callback. Throw on failure; the scaffold redirects to
|
|
82
|
-
* `/settings?{settingsQueryKey}=error`.
|
|
83
|
-
*/
|
|
84
|
-
completeCallback(code: string, state: string, redirectUri: string): IdentityConnectCallbackResult | Promise<IdentityConnectCallbackResult>;
|
|
85
|
-
/** Remove the user's link / stored credentials. */
|
|
86
|
-
unlink(userId: string): void | Promise<void>;
|
|
87
|
-
/** Resolve the public Agent Server base for `redirect_uri`. */
|
|
88
|
-
resolveRedirectBase(options: IdentityConnectRedirectBaseOptions): string;
|
|
89
|
-
/** Public app origin for settings fail/success redirects when available. */
|
|
90
|
-
resolvePublicAppUrl?(): string | undefined;
|
|
91
|
-
/**
|
|
92
|
-
* Optional: resolve a caller from a signed `?ticket=` on the connect start
|
|
93
|
-
* route (channel actors without a browser session). Returns the actor user id.
|
|
94
|
-
*/
|
|
95
|
-
resolveConnectTicket?(ticket: string): string | Promise<string>;
|
|
96
|
-
}
|
|
97
|
-
//# sourceMappingURL=connect-provider-types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"connect-provider-types.d.ts","sourceRoot":"","sources":["../../src/identity/connect-provider-types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,qEAAqE;AACrE,MAAM,WAAW,2BAA2B;IAC1C,yDAAyD;IACzD,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACjD,uDAAuD;IACvD,WAAW,EAAE,OAAO,CAAC;IACrB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,gDAAgD;IAChD,KAAK,CAAC,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC;IAChC;;;;OAIG;IACH,WAAW,CAAC,EAAE,cAAc,CAAC,aAAa,CAAC,CAAC;IAC5C;;;;;OAKG;IACH,cAAc,CAAC,EAAE,SAAS,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,CAAC;CAClD;AAED,uDAAuD;AACvD,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE1D,MAAM,MAAM,8BAA8B,GACtC;IAAE,YAAY,EAAE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,4EAA4E;IAC5E,mBAAmB,CAAC,IAAI,MAAM,GAAG,SAAS,CAAC;IAC3C;;;OAGG;IACH,oBAAoB,CAAC,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CACjE"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Connect-with-X plugin contract.
|
|
3
|
-
*
|
|
4
|
-
* List providers on `identity.connect` (e.g. `connect.github()`) to mount
|
|
5
|
-
* `/identity/{id}/{status,connect,callback,link}` from the managed HTTP app.
|
|
6
|
-
* Built-in providers also mount when the deployment implies them (see
|
|
7
|
-
* {@link IdentityConnectMountContext}).
|
|
8
|
-
*/
|
|
9
|
-
export {};
|
|
10
|
-
//# sourceMappingURL=connect-provider-types.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"connect-provider-types.js","sourceRoot":"","sources":["../../src/identity/connect-provider-types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared Connect-with-X HTTP scaffold.
|
|
3
|
-
*
|
|
4
|
-
* Authors opt in via `identity.connect` (see {@link mountIdentityConnectProviders}).
|
|
5
|
-
*/
|
|
6
|
-
import type { Hono } from "hono";
|
|
7
|
-
import type { IdentityConfig } from "./index.js";
|
|
8
|
-
import type { IdentityConnectMountContext, IdentityConnectProvider } from "./connect-provider-types.js";
|
|
9
|
-
export type { IdentityConnectAuthorizeResult, IdentityConnectCallbackResult, IdentityConnectJson, IdentityConnectMountContext, IdentityConnectProvider, IdentityConnectRedirectBaseOptions, } from "./connect-provider-types.js";
|
|
10
|
-
export { identityConnectPaths } from "./connect-paths.js";
|
|
11
|
-
/** A route recorded for build/startup visibility. */
|
|
12
|
-
export interface IdentityConnectMountedRoute {
|
|
13
|
-
connector: string;
|
|
14
|
-
method: string;
|
|
15
|
-
path: string;
|
|
16
|
-
secured: boolean;
|
|
17
|
-
}
|
|
18
|
-
export declare function identityConnectSettingsQueryKey(provider: IdentityConnectProvider): string;
|
|
19
|
-
/**
|
|
20
|
-
* Mount Connect-with-X routes.
|
|
21
|
-
*
|
|
22
|
-
* Declared providers (`defineIdentity({ connect: [connect.github(), …] })`) are
|
|
23
|
-
* offered first, then any `candidates` the deployment did not list. Every
|
|
24
|
-
* provider still decides for itself via `shouldMount`, which sees whether it was
|
|
25
|
-
* declared — so a built-in can mount because the rest of the identity implies it
|
|
26
|
-
* without ever mounting on a deployment that has no use for it.
|
|
27
|
-
*/
|
|
28
|
-
export declare function mountIdentityConnectProviders(app: Hono, cfg: IdentityConfig, ctx: IdentityConnectMountContext, mounted: IdentityConnectMountedRoute[], options?: {
|
|
29
|
-
deploymentBaseUrl?: string;
|
|
30
|
-
/** Providers from `identity.connect`. */
|
|
31
|
-
providers?: IdentityConnectProvider[];
|
|
32
|
-
/** Built-in providers to offer when the deployment did not list them. */
|
|
33
|
-
candidates?: IdentityConnectProvider[];
|
|
34
|
-
}): void;
|
|
35
|
-
//# sourceMappingURL=connect-provider.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"connect-provider.d.ts","sourceRoot":"","sources":["../../src/identity/connect-provider.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAEjC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,OAAO,KAAK,EACV,2BAA2B,EAC3B,uBAAuB,EACxB,MAAM,6BAA6B,CAAC;AAIrC,YAAY,EACV,8BAA8B,EAC9B,6BAA6B,EAC7B,mBAAmB,EACnB,2BAA2B,EAC3B,uBAAuB,EACvB,kCAAkC,GACnC,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE1D,qDAAqD;AACrD,MAAM,WAAW,2BAA2B;IAC1C,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,wBAAgB,+BAA+B,CAC7C,QAAQ,EAAE,uBAAuB,GAChC,MAAM,CAER;AAED;;;;;;;;GAQG;AACH,wBAAgB,6BAA6B,CAC3C,GAAG,EAAE,IAAI,EACT,GAAG,EAAE,cAAc,EACnB,GAAG,EAAE,2BAA2B,EAChC,OAAO,EAAE,2BAA2B,EAAE,EACtC,OAAO,GAAE;IACP,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,yCAAyC;IACzC,SAAS,CAAC,EAAE,uBAAuB,EAAE,CAAC;IACtC,yEAAyE;IACzE,UAAU,CAAC,EAAE,uBAAuB,EAAE,CAAC;CACnC,GACL,IAAI,CAeN"}
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared Connect-with-X HTTP scaffold.
|
|
3
|
-
*
|
|
4
|
-
* Authors opt in via `identity.connect` (see {@link mountIdentityConnectProviders}).
|
|
5
|
-
*/
|
|
6
|
-
import { identityConnectPaths } from "./connect-paths.js";
|
|
7
|
-
import { resolveRequestIdentity } from "../runtime/auth.js";
|
|
8
|
-
import { MDA_PUBLIC_APP_URL_ENV } from "./oauth-env.js";
|
|
9
|
-
export { identityConnectPaths } from "./connect-paths.js";
|
|
10
|
-
export function identityConnectSettingsQueryKey(provider) {
|
|
11
|
-
return provider.settingsQueryKey?.trim() || provider.id;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Mount Connect-with-X routes.
|
|
15
|
-
*
|
|
16
|
-
* Declared providers (`defineIdentity({ connect: [connect.github(), …] })`) are
|
|
17
|
-
* offered first, then any `candidates` the deployment did not list. Every
|
|
18
|
-
* provider still decides for itself via `shouldMount`, which sees whether it was
|
|
19
|
-
* declared — so a built-in can mount because the rest of the identity implies it
|
|
20
|
-
* without ever mounting on a deployment that has no use for it.
|
|
21
|
-
*/
|
|
22
|
-
export function mountIdentityConnectProviders(app, cfg, ctx, mounted, options = {}) {
|
|
23
|
-
const declared = options.providers ?? [];
|
|
24
|
-
const declaredIds = new Set(declared.map((provider) => provider.id));
|
|
25
|
-
const offered = [
|
|
26
|
-
...declared.map((provider) => ({ provider, declared: true })),
|
|
27
|
-
...(options.candidates ?? [])
|
|
28
|
-
.filter((provider) => !declaredIds.has(provider.id))
|
|
29
|
-
.map((provider) => ({ provider, declared: false })),
|
|
30
|
-
];
|
|
31
|
-
for (const { provider, declared: isDeclared } of offered) {
|
|
32
|
-
if (!provider.shouldMount({ ...ctx, declared: isDeclared })) {
|
|
33
|
-
continue;
|
|
34
|
-
}
|
|
35
|
-
mountOneIdentityConnectProvider(app, cfg, provider, mounted, options);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
function mountOneIdentityConnectProvider(app, cfg, provider, mounted, options) {
|
|
39
|
-
const paths = identityConnectPaths(provider.id);
|
|
40
|
-
const settingsKey = identityConnectSettingsQueryKey(provider);
|
|
41
|
-
const label = `identity:${provider.id}-connect`;
|
|
42
|
-
for (const route of [
|
|
43
|
-
{ method: "get", path: paths.status, secured: true },
|
|
44
|
-
{ method: "get", path: paths.connect, secured: true },
|
|
45
|
-
{ method: "get", path: paths.callback, secured: false },
|
|
46
|
-
{ method: "delete", path: paths.link, secured: true },
|
|
47
|
-
]) {
|
|
48
|
-
mounted.push({
|
|
49
|
-
connector: label,
|
|
50
|
-
method: route.method,
|
|
51
|
-
path: route.path,
|
|
52
|
-
secured: route.secured,
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
app.get(paths.status, async (c) => {
|
|
56
|
-
const identity = await resolveOrUnauthorized(cfg, c.req.raw);
|
|
57
|
-
if (identity instanceof Response) {
|
|
58
|
-
return identity;
|
|
59
|
-
}
|
|
60
|
-
return c.json(await provider.status(identity.user.id));
|
|
61
|
-
});
|
|
62
|
-
app.get(paths.connect, async (c) => {
|
|
63
|
-
const ticket = c.req.query("ticket")?.trim();
|
|
64
|
-
let userId;
|
|
65
|
-
if (ticket && provider.resolveConnectTicket) {
|
|
66
|
-
try {
|
|
67
|
-
userId = await provider.resolveConnectTicket(ticket);
|
|
68
|
-
}
|
|
69
|
-
catch (error) {
|
|
70
|
-
const message = error instanceof Error && error.message
|
|
71
|
-
? error.message
|
|
72
|
-
: "invalid connect ticket";
|
|
73
|
-
return c.json({ error: message }, 401);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
else {
|
|
77
|
-
const identity = await resolveOrUnauthorized(cfg, c.req.raw);
|
|
78
|
-
if (identity instanceof Response) {
|
|
79
|
-
return identity;
|
|
80
|
-
}
|
|
81
|
-
userId = identity.user.id;
|
|
82
|
-
}
|
|
83
|
-
const redirectUri = callbackRedirectUri(provider, c.req.raw, options.deploymentBaseUrl);
|
|
84
|
-
const result = await provider.startAuthorize(userId, redirectUri);
|
|
85
|
-
if ("notConfigured" in result) {
|
|
86
|
-
return c.json({ error: result.error }, 503);
|
|
87
|
-
}
|
|
88
|
-
const wantsJson = c.req.query("format") === "json" ||
|
|
89
|
-
(c.req.header("accept") ?? "").includes("application/json");
|
|
90
|
-
if (wantsJson) {
|
|
91
|
-
return c.json({ authorizeUrl: result.authorizeUrl });
|
|
92
|
-
}
|
|
93
|
-
return c.redirect(result.authorizeUrl, 302);
|
|
94
|
-
});
|
|
95
|
-
app.get(paths.callback, async (c) => {
|
|
96
|
-
const publicApp = provider.resolvePublicAppUrl?.() ??
|
|
97
|
-
process.env[MDA_PUBLIC_APP_URL_ENV]?.replace(/\/$/, "");
|
|
98
|
-
const failRedirect = publicApp
|
|
99
|
-
? `${publicApp}/settings?${settingsKey}=error`
|
|
100
|
-
: "/";
|
|
101
|
-
try {
|
|
102
|
-
const code = c.req.query("code");
|
|
103
|
-
const state = c.req.query("state");
|
|
104
|
-
if (!code || !state) {
|
|
105
|
-
throw new Error("missing code or state");
|
|
106
|
-
}
|
|
107
|
-
const redirectUri = callbackRedirectUri(provider, c.req.raw, options.deploymentBaseUrl);
|
|
108
|
-
const { successRedirect } = await provider.completeCallback(code, state, redirectUri);
|
|
109
|
-
return c.redirect(successRedirect, 302);
|
|
110
|
-
}
|
|
111
|
-
catch (error) {
|
|
112
|
-
console.error(`[mda] ${provider.id} OAuth callback failed:`, error);
|
|
113
|
-
return c.redirect(failRedirect, 302);
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
app.delete(paths.link, async (c) => {
|
|
117
|
-
const identity = await resolveOrUnauthorized(cfg, c.req.raw);
|
|
118
|
-
if (identity instanceof Response) {
|
|
119
|
-
return identity;
|
|
120
|
-
}
|
|
121
|
-
await provider.unlink(identity.user.id);
|
|
122
|
-
return c.json({ linked: false });
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
function callbackRedirectUri(provider, request, deploymentBaseUrl) {
|
|
126
|
-
const base = provider.resolveRedirectBase({
|
|
127
|
-
requestUrl: request.url,
|
|
128
|
-
headers: request.headers,
|
|
129
|
-
deploymentBaseUrl,
|
|
130
|
-
});
|
|
131
|
-
return `${base}${identityConnectPaths(provider.id).callback}`;
|
|
132
|
-
}
|
|
133
|
-
async function resolveOrUnauthorized(cfg, request) {
|
|
134
|
-
try {
|
|
135
|
-
return await resolveRequestIdentity(cfg, request);
|
|
136
|
-
}
|
|
137
|
-
catch (error) {
|
|
138
|
-
const status = typeof error.status === "number"
|
|
139
|
-
? error.status
|
|
140
|
-
: 401;
|
|
141
|
-
const message = error instanceof Error && error.message ? error.message : "unauthorized";
|
|
142
|
-
return new Response(JSON.stringify({ error: message }), {
|
|
143
|
-
status,
|
|
144
|
-
headers: { "content-type": "application/json" },
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
//# sourceMappingURL=connect-provider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"connect-provider.js","sourceRoot":"","sources":["../../src/identity/connect-provider.ts"],"names":[],"mappings":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0B;IAE1B,MAAM,IAAI,GAAG,QAAQ,CAAC,mBAAmB,CAAC;QACxC,UAAU,EAAE,OAAO,CAAC,GAAG;QACvB,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,iBAAiB;KAClB,CAAC,CAAC;IACH,OAAO,GAAG,IAAI,GAAG,oBAAoB,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC;AAChE,CAAC;AAED,KAAK,UAAU,qBAAqB,CAClC,GAAmB,EACnB,OAAgB;IAEhB,IAAI,CAAC;QACH,OAAO,MAAM,sBAAsB,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IACpD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,MAAM,GACV,OAAQ,KAA8B,CAAC,MAAM,KAAK,QAAQ;YACxD,CAAC,CAAE,KAA4B,CAAC,MAAM;YACtC,CAAC,CAAC,GAAG,CAAC;QACV,MAAM,OAAO,GACX,KAAK,YAAY,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,cAAc,CAAC;QAC3E,OAAO,IAAI,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,EAAE;YACtD,MAAM;YACN,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;SAChD,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shape helpers for the two `credentials` forms, shared by authoring validation,
|
|
3
|
-
* normalization, and the runtime resolver so all three agree on which form a
|
|
4
|
-
* config is.
|
|
5
|
-
*
|
|
6
|
-
* A single resolver handles every target itself. A per-target map lets one
|
|
7
|
-
* deployment integrate several platforms without hand-writing the dispatch — and
|
|
8
|
-
* without losing the Connect-with-X routes each entry declares, which is the
|
|
9
|
-
* failure mode a hand-written dispatcher has.
|
|
10
|
-
*/
|
|
11
|
-
import type { IdentityConnectProvider } from "./connect-provider-types.js";
|
|
12
|
-
import type { CredentialResolverConfig, CredentialResolvers } from "./types.js";
|
|
13
|
-
/**
|
|
14
|
-
* True when `value` is a single {@link CredentialResolverConfig} rather than a
|
|
15
|
-
* per-target map.
|
|
16
|
-
*
|
|
17
|
-
* Discriminates on the *type* of `resolve`/`endpoint`, not merely their
|
|
18
|
-
* presence, so a target legitimately named `"resolve"` or `"endpoint"` in a map
|
|
19
|
-
* is not mistaken for the single form.
|
|
20
|
-
*/
|
|
21
|
-
export declare function isSingleCredentialResolver(value: CredentialResolverConfig | CredentialResolvers): value is CredentialResolverConfig;
|
|
22
|
-
/** The target names a per-target map resolves, in declaration order. */
|
|
23
|
-
export declare function credentialTargetNames(value: CredentialResolverConfig | CredentialResolvers): string[];
|
|
24
|
-
/**
|
|
25
|
-
* Every Connect-with-X provider the config depends on, deduplicated by id and in
|
|
26
|
-
* declaration order.
|
|
27
|
-
*
|
|
28
|
-
* Unioning across map entries is what keeps inference working for a
|
|
29
|
-
* multi-platform deployment: each entry declares its own routes, and the author
|
|
30
|
-
* repeats none of them.
|
|
31
|
-
*/
|
|
32
|
-
export declare function credentialConnectProviders(value: CredentialResolverConfig | CredentialResolvers | undefined): IdentityConnectProvider[];
|
|
33
|
-
//# sourceMappingURL=credential-resolvers.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"credential-resolvers.d.ts","sourceRoot":"","sources":["../../src/identity/credential-resolvers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,KAAK,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEhF;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,wBAAwB,GAAG,mBAAmB,GACpD,KAAK,IAAI,wBAAwB,CAWnC;AAED,wEAAwE;AACxE,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,wBAAwB,GAAG,mBAAmB,GACpD,MAAM,EAAE,CAEV;AAED;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,wBAAwB,GAAG,mBAAmB,GAAG,SAAS,GAChE,uBAAuB,EAAE,CAgB3B"}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shape helpers for the two `credentials` forms, shared by authoring validation,
|
|
3
|
-
* normalization, and the runtime resolver so all three agree on which form a
|
|
4
|
-
* config is.
|
|
5
|
-
*
|
|
6
|
-
* A single resolver handles every target itself. A per-target map lets one
|
|
7
|
-
* deployment integrate several platforms without hand-writing the dispatch — and
|
|
8
|
-
* without losing the Connect-with-X routes each entry declares, which is the
|
|
9
|
-
* failure mode a hand-written dispatcher has.
|
|
10
|
-
*/
|
|
11
|
-
/**
|
|
12
|
-
* True when `value` is a single {@link CredentialResolverConfig} rather than a
|
|
13
|
-
* per-target map.
|
|
14
|
-
*
|
|
15
|
-
* Discriminates on the *type* of `resolve`/`endpoint`, not merely their
|
|
16
|
-
* presence, so a target legitimately named `"resolve"` or `"endpoint"` in a map
|
|
17
|
-
* is not mistaken for the single form.
|
|
18
|
-
*/
|
|
19
|
-
export function isSingleCredentialResolver(value) {
|
|
20
|
-
const candidate = value;
|
|
21
|
-
if (typeof candidate.resolve === "function") {
|
|
22
|
-
return true;
|
|
23
|
-
}
|
|
24
|
-
const endpoint = candidate.endpoint;
|
|
25
|
-
return (typeof endpoint === "object" &&
|
|
26
|
-
endpoint !== null &&
|
|
27
|
-
typeof endpoint.url === "string");
|
|
28
|
-
}
|
|
29
|
-
/** The target names a per-target map resolves, in declaration order. */
|
|
30
|
-
export function credentialTargetNames(value) {
|
|
31
|
-
return isSingleCredentialResolver(value) ? [] : Object.keys(value);
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Every Connect-with-X provider the config depends on, deduplicated by id and in
|
|
35
|
-
* declaration order.
|
|
36
|
-
*
|
|
37
|
-
* Unioning across map entries is what keeps inference working for a
|
|
38
|
-
* multi-platform deployment: each entry declares its own routes, and the author
|
|
39
|
-
* repeats none of them.
|
|
40
|
-
*/
|
|
41
|
-
export function credentialConnectProviders(value) {
|
|
42
|
-
if (value === undefined || value === null || typeof value !== "object") {
|
|
43
|
-
return [];
|
|
44
|
-
}
|
|
45
|
-
const configs = isSingleCredentialResolver(value)
|
|
46
|
-
? [value]
|
|
47
|
-
: Object.values(value);
|
|
48
|
-
const out = [];
|
|
49
|
-
for (const config of configs) {
|
|
50
|
-
for (const provider of declaredConnect(config)) {
|
|
51
|
-
if (!out.some((existing) => existing.id === provider.id)) {
|
|
52
|
-
out.push(provider);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
return out;
|
|
57
|
-
}
|
|
58
|
-
function declaredConnect(config) {
|
|
59
|
-
const connect = config?.connect;
|
|
60
|
-
return Array.isArray(connect) ? connect : [];
|
|
61
|
-
}
|
|
62
|
-
//# sourceMappingURL=credential-resolvers.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"credential-resolvers.js","sourceRoot":"","sources":["../../src/identity/credential-resolvers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAKH;;;;;;;GAOG;AACH,MAAM,UAAU,0BAA0B,CACxC,KAAqD;IAErD,MAAM,SAAS,GAAG,KAAkD,CAAC;IACrE,IAAI,OAAO,SAAS,CAAC,OAAO,KAAK,UAAU,EAAE,CAAC;QAC5C,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,QAAQ,GAAG,SAAS,CAAC,QAAQ,CAAC;IACpC,OAAO,CACL,OAAO,QAAQ,KAAK,QAAQ;QAC5B,QAAQ,KAAK,IAAI;QACjB,OAAQ,QAA8B,CAAC,GAAG,KAAK,QAAQ,CACxD,CAAC;AACJ,CAAC;AAED,wEAAwE;AACxE,MAAM,UAAU,qBAAqB,CACn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ants, actor-subject
|
|
5
|
-
* toggles, and `connect()` wiring — only the integration + BYO client differ.
|
|
6
|
-
* X is the vault-only variant (no local BYO client).
|
|
7
|
-
*/
|
|
8
|
-
import type { FleetOAuthIntegration } from "../connectors/toolserver/integrations.js";
|
|
9
|
-
import type { ByoOauthClient } from "./byo-oauth.js";
|
|
10
|
-
import { identityConnectPaths } from "./connect-paths.js";
|
|
11
|
-
import type { IdentityConnectMountContext, IdentityConnectProvider } from "./connect-provider-types.js";
|
|
12
|
-
import { type FleetVaultConnectProviderOptions } from "./fleet-connect.js";
|
|
13
|
-
import { type FleetIntegrationConnectProviderOptions } from "./fleet-integration-connect.js";
|
|
14
|
-
/** Shared surface returned by {@link defineFleetIntegrationConnect}. */
|
|
15
|
-
export interface FleetIntegrationConnectAdapter {
|
|
16
|
-
readonly paths: ReturnType<typeof identityConnectPaths>;
|
|
17
|
-
isActorSubjectEnabled(): boolean;
|
|
18
|
-
enableActorSubject(): void;
|
|
19
|
-
enableActorSubjectFromConnectors(connectorKinds: readonly (string | undefined)[] | undefined, scope?: IdentityConnectMountContext["scope"]): void;
|
|
20
|
-
resetActorSubjectEnabledForTests(): void;
|
|
21
|
-
isConnectConfigured(env?: NodeJS.ProcessEnv): boolean;
|
|
22
|
-
connectUrl(publicAppUrl: string): string;
|
|
23
|
-
createProvider(options?: FleetIntegrationConnectProviderOptions): IdentityConnectProvider;
|
|
24
|
-
readonly provider: IdentityConnectProvider;
|
|
25
|
-
connect(options?: FleetIntegrationConnectProviderOptions): IdentityConnectProvider;
|
|
26
|
-
}
|
|
27
|
-
/** Shared surface returned by {@link defineFleetVaultConnect}. */
|
|
28
|
-
export interface FleetVaultConnectAdapter {
|
|
29
|
-
readonly paths: ReturnType<typeof identityConnectPaths>;
|
|
30
|
-
isActorSubjectEnabled(): boolean;
|
|
31
|
-
enableActorSubject(): void;
|
|
32
|
-
enableActorSubjectFromConnectors(connectorKinds: readonly (string | undefined)[] | undefined, scope?: IdentityConnectMountContext["scope"]): void;
|
|
33
|
-
resetActorSubjectEnabledForTests(): void;
|
|
34
|
-
isConnectConfigured(env?: NodeJS.ProcessEnv): boolean;
|
|
35
|
-
connectUrl(publicAppUrl: string): string;
|
|
36
|
-
createProvider(options?: Pick<FleetVaultConnectProviderOptions, "providerSlug" | "scopes" | "fleet">): IdentityConnectProvider;
|
|
37
|
-
readonly provider: IdentityConnectProvider;
|
|
38
|
-
connect(options?: Pick<FleetVaultConnectProviderOptions, "providerSlug" | "scopes" | "fleet">): IdentityConnectProvider;
|
|
39
|
-
}
|
|
40
|
-
/** Build the Google/Microsoft/LinkedIn-style BYO + Fleet Connect adapter. */
|
|
41
|
-
export declare function defineFleetIntegrationConnect(options: {
|
|
42
|
-
integration: FleetOAuthIntegration;
|
|
43
|
-
byoClient: ByoOauthClient;
|
|
44
|
-
fallbackScopes?: readonly string[];
|
|
45
|
-
}): FleetIntegrationConnectAdapter;
|
|
46
|
-
/**
|
|
47
|
-
* Build a vault-only Connect adapter (no local BYO client), e.g. Connect-with-X.
|
|
48
|
-
*/
|
|
49
|
-
export declare function defineFleetVaultConnect(options: {
|
|
50
|
-
integration: FleetOAuthIntegration;
|
|
51
|
-
resolveProviderSlug: () => string;
|
|
52
|
-
}): FleetVaultConnectAdapter;
|
|
53
|
-
//# sourceMappingURL=define-fleet-connect.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"define-fleet-connect.d.ts","sourceRoot":"","sources":["../../src/identity/define-fleet-connect.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AAOtF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,KAAK,EACV,2BAA2B,EAC3B,uBAAuB,EACxB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAIL,KAAK,gCAA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AC,YAAY,EAAE,MAAM,GAAG,MAAM,CAAC;IACzC,cAAc,CACZ,OAAO,CAAC,EAAE,IAAI,CACZ,gCAAgC,EAChC,cAAc,GAAG,QAAQ,GAAG,OAAO,CACpC,GACA,uBAAuB,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,uBAAuB,CAAC;IAC3C,OAAO,CACL,OAAO,CAAC,EAAE,IAAI,CACZ,gCAAgC,EAChC,cAAc,GAAG,QAAQ,GAAG,OAAO,CACpC,GACA,uBAAuB,CAAC;CAC5B;AAED,6EAA6E;AAC7E,wBAAgB,6BAA6B,CAAC,OAAO,EAAE;IACrD,WAAW,EAAE,qBAAqB,CAAC;IACnC,SAAS,EAAE,cAAc,CAAC;IAC1B,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACpC,GAAG,8BAA8B,CA0CjC;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE;IAC/C,WAAW,EAAE,qBAAqB,CAAC;IACnC,mBAAmB,EAAE,MAAM,MAAM,CAAC;CACnC,GAAG,wBAAwB,CAmD3B"}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Factory for thin Connect-with-X adapters over Fleet vault integrations.
|
|
3
|
-
*
|
|
4
|
-
* Google / Microsoft / LinkedIn share the same PATH constants, actor-subject
|
|
5
|
-
* toggles, and `connect()` wiring — only the integration + BYO client differ.
|
|
6
|
-
* X is the vault-only variant (no local BYO client).
|
|
7
|
-
*/
|
|
8
|
-
import { enableActorSubjectIntegration, enableActorSubjectIntegrationFromConnectors, isActorSubjectIntegrationEnabled, resetActorSubjectEnabledForTests, } from "./actor-subject.js";
|
|
9
|
-
import { identityConnectPaths } from "./connect-paths.js";
|
|
10
|
-
import { createFleetVaultConnectProvider, fleetConnectUrl, isFleetVaultConnectConfigured, } from "./fleet-connect.js";
|
|
11
|
-
import { createFleetIntegrationConnectProvider, fleetIntegrationConnectUrl, isFleetIntegrationConnectConfigured, } from "./fleet-integration-connect.js";
|
|
12
|
-
import { MDA_PUBLIC_APP_URL_ENV, resolveOauthRedirectBase, } from "./oauth-env.js";
|
|
13
|
-
/** Build the Google/Microsoft/LinkedIn-style BYO + Fleet Connect adapter. */
|
|
14
|
-
export function defineFleetIntegrationConnect(options) {
|
|
15
|
-
const { integration, byoClient, fallbackScopes } = options;
|
|
16
|
-
const paths = identityConnectPaths(integration.connectId);
|
|
17
|
-
function createProvider(providerOptions = {}) {
|
|
18
|
-
return createFleetIntegrationConnectProvider(integration, byoClient, providerOptions, fallbackScopes);
|
|
19
|
-
}
|
|
20
|
-
const provider = createProvider();
|
|
21
|
-
return {
|
|
22
|
-
paths,
|
|
23
|
-
isActorSubjectEnabled: () => isActorSubjectIntegrationEnabled(integration.connectId),
|
|
24
|
-
enableActorSubject: () => enableActorSubjectIntegration(integration.connectId),
|
|
25
|
-
enableActorSubjectFromConnectors(connectorKinds, scope) {
|
|
26
|
-
enableActorSubjectIntegrationFromConnectors(integration, connectorKinds, scope);
|
|
27
|
-
},
|
|
28
|
-
resetActorSubjectEnabledForTests,
|
|
29
|
-
isConnectConfigured: (env = process.env) => isFleetIntegrationConnectConfigured(byoClient, env),
|
|
30
|
-
connectUrl: (publicAppUrl) => fleetIntegrationConnectUrl(integration, publicAppUrl),
|
|
31
|
-
createProvider,
|
|
32
|
-
provider,
|
|
33
|
-
connect(providerOptions) {
|
|
34
|
-
enableActorSubjectIntegration(integration.connectId);
|
|
35
|
-
return providerOptions ? createProvider(providerOptions) : provider;
|
|
36
|
-
},
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Build a vault-only Connect adapter (no local BYO client), e.g. Connect-with-X.
|
|
41
|
-
*/
|
|
42
|
-
export function defineFleetVaultConnect(options) {
|
|
43
|
-
const { integration, resolveProviderSlug } = options;
|
|
44
|
-
const paths = identityConnectPaths(integration.connectId);
|
|
45
|
-
function createProvider(providerOptions = {}) {
|
|
46
|
-
return createFleetVaultConnectProvider({
|
|
47
|
-
integration,
|
|
48
|
-
providerSlug: providerOptions.providerSlug?.trim() || resolveProviderSlug(),
|
|
49
|
-
...(providerOptions.scopes ? { scopes: providerOptions.scopes } : {}),
|
|
50
|
-
...(providerOptions.fleet ? { fleet: providerOptions.fleet } : {}),
|
|
51
|
-
resolveRedirectBase: resolveOauthRedirectBase,
|
|
52
|
-
resolvePublicAppUrl() {
|
|
53
|
-
return process.env[MDA_PUBLIC_APP_URL_ENV]?.replace(/\/$/, "");
|
|
54
|
-
},
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
const provider = createProvider();
|
|
58
|
-
return {
|
|
59
|
-
paths,
|
|
60
|
-
isActorSubjectEnabled: () => isActorSubjectIntegrationEnabled(integration.connectId),
|
|
61
|
-
enableActorSubject: () => enableActorSubjectIntegration(integration.connectId),
|
|
62
|
-
enableActorSubjectFromConnectors(connectorKinds, scope) {
|
|
63
|
-
enableActorSubjectIntegrationFromConnectors(integration, connectorKinds, scope);
|
|
64
|
-
},
|
|
65
|
-
resetActorSubjectEnabledForTests,
|
|
66
|
-
isConnectConfigured: (env = process.env) => isFleetVaultConnectConfigured(undefined, env),
|
|
67
|
-
connectUrl: (publicAppUrl) => fleetConnectUrl(integration, publicAppUrl),
|
|
68
|
-
createProvider,
|
|
69
|
-
provider,
|
|
70
|
-
connect(providerOptions) {
|
|
71
|
-
enableActorSubjectIntegration(integration.connectId);
|
|
72
|
-
return providerOptions ? createProvider(providerOptions) : provider;
|
|
73
|
-
},
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
//# sourceMappingURL=define-fleet-connect.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"define-fleet-connect.js","sourceRoot":"","sources":["../../src/identity/define-fleet-connect.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EACL,6BAA6B,EAC7B,2CAA2C,EAC3C,gCAAgC,EAChC,gCAAgC,GACjC,MAAM,oBAAoB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,KAAK,CACN,CAAC;QACJ,CAAC;QACD,gCAAgC;QAChC,mBAAmB,EAAE,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,EAAE,CACzC,6BAA6B,CAAC,SAAS,EAAE,GAAG,CAAC;QAC/C,UAAU,EAAE,CAAC,YAAY,EAAE,EAAE,CAAC,eAAe,CAAC,WAAW,EAAE,YAAY,CAAC;QACxE,cAAc;QACd,QAAQ;QACR,OAAO,CAAC,eAAe;YACrB,6BAA6B,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;YACrD,OAAO,eAAe,CAAC,CAAC,CAAC,cAAc,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;QACtE,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Runtime hint when the caller has not completed Connect-with-X for a Fleet
|
|
3
|
-
* vault integration yet.
|
|
4
|
-
*
|
|
5
|
-
* Prefers Connect status over toolserver 428 (agent subjects skip that today).
|
|
6
|
-
*/
|
|
7
|
-
import { type FleetOAuthIntegration } from "../connectors/toolserver/integrations.js";
|
|
8
|
-
import type { ManagedMiddleware } from "../runtime/managed-middleware.js";
|
|
9
|
-
import { listAgentConnections, type FleetClientOptions } from "./fleet.js";
|
|
10
|
-
export interface FleetConnectHintMiddlewareOptions {
|
|
11
|
-
integration: FleetOAuthIntegration;
|
|
12
|
-
providerSlug?: string;
|
|
13
|
-
fleet?: FleetClientOptions & {
|
|
14
|
-
list?: typeof listAgentConnections;
|
|
15
|
-
};
|
|
16
|
-
/** Override status lookup (tests). */
|
|
17
|
-
isConnected?: (userId: string) => Promise<boolean>;
|
|
18
|
-
/** Optional public-app resolver (BYO OAuth publicAppUrl). */
|
|
19
|
-
resolvePublicAppUrl?: (env?: NodeJS.ProcessEnv) => string | undefined;
|
|
20
|
-
}
|
|
21
|
-
/** Drop cached Connect status (tests only). */
|
|
22
|
-
export declare function clearFleetConnectHintCacheForTests(): void;
|
|
23
|
-
/**
|
|
24
|
-
* Absolute Connect start URL for agent hints.
|
|
25
|
-
*
|
|
26
|
-
* Prefers the Agent Server origin (`MDA_PUBLIC_API_URL`) where
|
|
27
|
-
* `/identity/{id}/*` is mounted. Falls back to `MDA_PUBLIC_APP_URL`.
|
|
28
|
-
*
|
|
29
|
-
* When `userId` and a signing key are available, appends a short-lived
|
|
30
|
-
* `?ticket=` so the browser session binds OAuth to that actor.
|
|
31
|
-
*/
|
|
32
|
-
export declare function fleetConnectHintUrl(integration: FleetOAuthIntegration, env?: NodeJS.ProcessEnv, userId?: string, resolvePublicAppUrl?: (env?: NodeJS.ProcessEnv) => string | undefined): Promise<string>;
|
|
33
|
-
/**
|
|
34
|
-
* Middleware that injects a system hint when actor-subject mode is on for
|
|
35
|
-
* `integration` and the current caller has no LangSmith vault connection.
|
|
36
|
-
*/
|
|
37
|
-
export declare function createFleetConnectHintMiddleware(options: FleetConnectHintMiddlewareOptions): ManagedMiddleware;
|
|
38
|
-
/** Rewrite tool errors that look like a missing Fleet vault connection. */
|
|
39
|
-
export declare function rewriteFleetToolError(error: unknown, integration: FleetOAuthIntegration, resolvePublicAppUrl?: (env?: NodeJS.ProcessEnv) => string | undefined): Error;
|
|
40
|
-
export declare function isFleetConnectHint(message: string, integration: FleetOAuthIntegration): boolean;
|
|
41
|
-
//# sourceMappingURL=fleet-connect-hint.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fleet-connect-hint.d.ts","sourceRoot":"","sources":["../../src/identity/fleet-connect-hint.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAEL,KAAK,qBAAqB,EAC3B,MAAM,0CAA0C,CAAC;AAClD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAS1E,OAAO,EAAE,oBAAoB,EAAE,KAAK,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAQ3E,MAAM,WAAW,iCAAiC;IAChD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