@aglyn/aglyn 1.26.0 → 1.26.2
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aglyn/aglyn",
|
|
3
|
-
"version": "1.26.
|
|
3
|
+
"version": "1.26.2",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"homepage": "https://aglyn.com",
|
|
6
6
|
"repository": {
|
|
@@ -37,16 +37,16 @@
|
|
|
37
37
|
"./package.json": "./package.json"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@aglyn/shared-data-enums": "1.26.
|
|
41
|
-
"@aglyn/shared-data-mdi": "1.26.
|
|
42
|
-
"@aglyn/shared-data-types": "1.26.
|
|
43
|
-
"@aglyn/shared-util-email": "1.26.
|
|
44
|
-
"@aglyn/shared-util-first-touch": "1.26.
|
|
45
|
-
"@aglyn/shared-util-http": "1.26.
|
|
46
|
-
"@aglyn/shared-util-logger": "1.26.
|
|
47
|
-
"@aglyn/shared-util-timestamp": "1.26.
|
|
48
|
-
"@aglyn/shared-util-tools": "1.26.
|
|
49
|
-
"@aglyn/shared-util-vendor": "1.26.
|
|
40
|
+
"@aglyn/shared-data-enums": "1.26.2",
|
|
41
|
+
"@aglyn/shared-data-mdi": "1.26.2",
|
|
42
|
+
"@aglyn/shared-data-types": "1.26.2",
|
|
43
|
+
"@aglyn/shared-util-email": "1.26.2",
|
|
44
|
+
"@aglyn/shared-util-first-touch": "1.26.2",
|
|
45
|
+
"@aglyn/shared-util-http": "1.26.2",
|
|
46
|
+
"@aglyn/shared-util-logger": "1.26.2",
|
|
47
|
+
"@aglyn/shared-util-timestamp": "1.26.2",
|
|
48
|
+
"@aglyn/shared-util-tools": "1.26.2",
|
|
49
|
+
"@aglyn/shared-util-vendor": "1.26.2",
|
|
50
50
|
"@data-driven-forms/react-form-renderer": "^4.2.3",
|
|
51
51
|
"@msgpack/msgpack": "^3.1.3",
|
|
52
52
|
"@types/unist": "^3.0.3",
|
|
@@ -61,6 +61,26 @@ export declare const MCP_SERVER_CARD_SCHEMA = "https://static.modelcontextprotoc
|
|
|
61
61
|
export declare const CONNECTOR_DISCOVERY_ROUTES: Readonly<Record<string, string>>;
|
|
62
62
|
/** The route handler serving `pathname`, or `null` when it is not one of the three. */
|
|
63
63
|
export declare function connectorDiscoveryRoute(pathname: string): string | null;
|
|
64
|
+
/**
|
|
65
|
+
* The domain proof OpenAI's plugin directory reads (AGL-4225).
|
|
66
|
+
*
|
|
67
|
+
* To list a connector, the directory fetches this exact path on the host that
|
|
68
|
+
* serves the MCP endpoint and expects the challenge token it issued as the
|
|
69
|
+
* whole body, in plain text. It is not a discovery document and is not in the
|
|
70
|
+
* map above: it describes nothing, and it exists only while a deployment has
|
|
71
|
+
* been given a token (`OPENAI_APPS_CHALLENGE`).
|
|
72
|
+
*/
|
|
73
|
+
export declare const OPENAI_APPS_CHALLENGE_PATH = "/.well-known/openai-apps-challenge";
|
|
74
|
+
/** The route handler the middleware rewrites {@link OPENAI_APPS_CHALLENGE_PATH} to. */
|
|
75
|
+
export declare const OPENAI_APPS_CHALLENGE_ROUTE = "/api/domain-proof/openai-apps-challenge";
|
|
76
|
+
/** The handler serving `pathname`, or `null` for every path but the exact one. */
|
|
77
|
+
export declare function connectorDomainProofRoute(pathname: string): string | null;
|
|
78
|
+
/**
|
|
79
|
+
* The token to serve for a configured value, or `null` when there is none to
|
|
80
|
+
* serve: unset, empty, or not shaped like a token. Surrounding whitespace is
|
|
81
|
+
* dropped, because a value pasted into a dashboard often carries a newline.
|
|
82
|
+
*/
|
|
83
|
+
export declare function connectorDomainProofToken(configured: string | undefined | null): string | null;
|
|
64
84
|
/** The resource identifier for the MCP endpoint on `origin`. */
|
|
65
85
|
export declare function connectorResourceFor(origin: string): string;
|
|
66
86
|
/** What a 401 from the MCP endpoint names, so a client can begin the walk. */
|
|
@@ -74,6 +74,33 @@
|
|
|
74
74
|
/** The route handler serving `pathname`, or `null` when it is not one of the three. */ export function connectorDiscoveryRoute(pathname) {
|
|
75
75
|
return Object.prototype.hasOwnProperty.call(CONNECTOR_DISCOVERY_ROUTES, pathname) ? CONNECTOR_DISCOVERY_ROUTES[pathname] : null;
|
|
76
76
|
}
|
|
77
|
+
/**
|
|
78
|
+
* The domain proof OpenAI's plugin directory reads (AGL-4225).
|
|
79
|
+
*
|
|
80
|
+
* To list a connector, the directory fetches this exact path on the host that
|
|
81
|
+
* serves the MCP endpoint and expects the challenge token it issued as the
|
|
82
|
+
* whole body, in plain text. It is not a discovery document and is not in the
|
|
83
|
+
* map above: it describes nothing, and it exists only while a deployment has
|
|
84
|
+
* been given a token (`OPENAI_APPS_CHALLENGE`).
|
|
85
|
+
*/ export const OPENAI_APPS_CHALLENGE_PATH = '/.well-known/openai-apps-challenge';
|
|
86
|
+
/** The route handler the middleware rewrites {@link OPENAI_APPS_CHALLENGE_PATH} to. */ export const OPENAI_APPS_CHALLENGE_ROUTE = '/api/domain-proof/openai-apps-challenge';
|
|
87
|
+
/** The handler serving `pathname`, or `null` for every path but the exact one. */ export function connectorDomainProofRoute(pathname) {
|
|
88
|
+
return pathname === OPENAI_APPS_CHALLENGE_PATH ? OPENAI_APPS_CHALLENGE_ROUTE : null;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* What a challenge token may be: URL-safe unreserved characters, 8 to 512 of
|
|
92
|
+
* them. The value is served verbatim as a response body, so anything else
|
|
93
|
+
* (whitespace inside it, markup, a pasted `KEY=value` line) is a
|
|
94
|
+
* misconfiguration and is refused rather than published.
|
|
95
|
+
*/ const DOMAIN_PROOF_TOKEN = /^[A-Za-z0-9._~-]{8,512}$/;
|
|
96
|
+
/**
|
|
97
|
+
* The token to serve for a configured value, or `null` when there is none to
|
|
98
|
+
* serve: unset, empty, or not shaped like a token. Surrounding whitespace is
|
|
99
|
+
* dropped, because a value pasted into a dashboard often carries a newline.
|
|
100
|
+
*/ export function connectorDomainProofToken(configured) {
|
|
101
|
+
const token = (configured != null ? configured : '').trim();
|
|
102
|
+
return DOMAIN_PROOF_TOKEN.test(token) ? token : null;
|
|
103
|
+
}
|
|
77
104
|
/** The resource identifier for the MCP endpoint on `origin`. */ export function connectorResourceFor(origin) {
|
|
78
105
|
return `${origin}${CONNECTOR_RESOURCE_PATH}`;
|
|
79
106
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../libs/aglyn/src/lib/app-utils/connector-discovery.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*==========================================\n * WHERE A CONNECTOR FINDS THE CONSOLE'S SIGN-IN (AGL-4225).\n *\n * An MCP client that is handed `<console>/api/mcp` and answered 401 reads the\n * protected-resource document the challenge names (RFC 9728), then the\n * authorization-server document (RFC 8414), and from there registers, sends\n * the person to the consent page and trades the code for credentials.\n *\n * Every address in that walk is here, in one module with no imports, because\n * the edge middleware has to know the three discovery documents by exact path\n * (it 404s the rest of `/.well-known/*`) and must not pull the server-side\n * credential code into the edge bundle to learn them. The documents\n * themselves are built by `connector-oauth.ts` in the data layer, from these\n * same constants.\n *\n * Nothing here names a host: these are paths, and the functions below take\n * the origin as an argument. Which origin is decided in ONE place, the\n * console's `connectorOrigin` — the configured console URL\n * (`NEXT_PUBLIC_CONSOLE_URL`) when it is set, and only otherwise the host the\n * deployment's proxy reports. A request header cannot choose the issuer of a\n * deployment that has configured its console URL.\n *==========================================*/\n\n/** The MCP endpoint, which is the protected resource. */\nexport const CONNECTOR_RESOURCE_PATH = '/api/mcp'\n\n/** The consent page a person is sent to. A console page, behind sign-in. */\nexport const CONNECTOR_AUTHORIZE_PATH = '/oauth/authorize'\n\n/** Dynamic client registration (RFC 7591). */\nexport const CONNECTOR_REGISTER_PATH = '/api/oauth/register'\n\n/** Code and refresh exchange. */\nexport const CONNECTOR_TOKEN_PATH = '/api/oauth/token'\n\n/** Revocation (RFC 7009). */\nexport const CONNECTOR_REVOKE_PATH = '/api/oauth/revoke'\n\n/** RFC 9728 §3: the document for the server as a whole. */\nexport const PROTECTED_RESOURCE_METADATA_PATH = '/.well-known/oauth-protected-resource'\n\n/**\n * RFC 9728 §3.1: the document for one resource, at the well-known prefix\n * followed by the resource's path. What the 401 challenge names.\n */\nexport const MCP_PROTECTED_RESOURCE_METADATA_PATH = `${PROTECTED_RESOURCE_METADATA_PATH}${CONNECTOR_RESOURCE_PATH}`\n\n/** RFC 8414 §3. The issuer has no path, so neither does this. */\nexport const AUTHORIZATION_SERVER_METADATA_PATH = '/.well-known/oauth-authorization-server'\n\n/**\n * The MCP Server Card: a static description of the MCP endpoint that a client\n * or a registry can read BEFORE connecting — where it is, which transport,\n * which protocol revisions.\n *\n * SEP-2127 (MCP Server Cards, Final, Extensions Track) reserves\n * `<streamable-http-url>/server-card` as the recommended location, and its\n * discovery document advises against `.well-known` for cards, so this sits\n * under the endpoint it describes rather than beside the OAuth documents.\n * https://modelcontextprotocol.io/seps/2127-mcp-server-cards\n */\nexport const MCP_SERVER_CARD_PATH = `${CONNECTOR_RESOURCE_PATH}/server-card`\n\n/** The card's media type, per the extension's `docs/discovery.md`. */\nexport const MCP_SERVER_CARD_MEDIA_TYPE = 'application/mcp-server-card+json'\n\n/**\n * The `$schema` a card must carry. The extension's schema pins this exact\n * URL (versioned by the `v1` segment, not by date).\n */\nexport const MCP_SERVER_CARD_SCHEMA =\n 'https://static.modelcontextprotocol.io/schemas/v1/server-card.schema.json'\n\n/**\n * The three discovery documents the console serves, by EXACT path, and the\n * route handler each is rewritten to. Exactly these: any other path under\n * `/.well-known/` still answers 404, which is the posture the namespace is\n * held to (AGL-3016).\n */\nexport const CONNECTOR_DISCOVERY_ROUTES: Readonly<Record<string, string>> = {\n [PROTECTED_RESOURCE_METADATA_PATH]: '/api/oauth/metadata/protected-resource',\n [MCP_PROTECTED_RESOURCE_METADATA_PATH]: '/api/oauth/metadata/protected-resource',\n [AUTHORIZATION_SERVER_METADATA_PATH]: '/api/oauth/metadata/authorization-server',\n}\n\n/** The route handler serving `pathname`, or `null` when it is not one of the three. */\nexport function connectorDiscoveryRoute(pathname: string): string | null {\n return Object.prototype.hasOwnProperty.call(CONNECTOR_DISCOVERY_ROUTES, pathname)\n ? CONNECTOR_DISCOVERY_ROUTES[pathname]\n : null\n}\n\n/** The resource identifier for the MCP endpoint on `origin`. */\nexport function connectorResourceFor(origin: string): string {\n return `${origin}${CONNECTOR_RESOURCE_PATH}`\n}\n\n/** What a 401 from the MCP endpoint names, so a client can begin the walk. */\nexport function connectorResourceMetadataUrl(origin: string): string {\n return `${origin}${MCP_PROTECTED_RESOURCE_METADATA_PATH}`\n}\n\n/** The authorization server's own document (RFC 8414) on `origin`. */\nexport function connectorAuthorizationServerMetadataUrl(origin: string): string {\n return `${origin}${AUTHORIZATION_SERVER_METADATA_PATH}`\n}\n\n/** The MCP Server Card (SEP-2127) on `origin`. */\nexport function mcpServerCardUrl(origin: string): string {\n return `${origin}${MCP_SERVER_CARD_PATH}`\n}\n\n/**\n * The card's `name`: reverse-DNS of the host that serves the endpoint, then\n * `/mcp`. The card schema (and the MCP Registry's `server.json`) require\n * `namespace/name` matching `^[a-zA-Z0-9.-]+/[a-zA-Z0-9._-]+$`, and a\n * reverse-DNS namespace is the one a registry can verify against the domain,\n * so a self-hosted console names itself rather than borrowing ours.\n * `app.aglyn.com` → `com.aglyn.app/mcp`.\n */\nexport function mcpServerCardName(origin: string): string {\n let host: string\n try {\n host = new URL(origin).hostname\n } catch {\n host = ''\n }\n const namespace = host\n .split('.')\n .filter(Boolean)\n .reverse()\n .join('.')\n .replace(/[^a-zA-Z0-9.-]/g, '-')\n return `${namespace || 'local'}/mcp`\n}\n"],"names":["CONNECTOR_RESOURCE_PATH","CONNECTOR_AUTHORIZE_PATH","CONNECTOR_REGISTER_PATH","CONNECTOR_TOKEN_PATH","CONNECTOR_REVOKE_PATH","PROTECTED_RESOURCE_METADATA_PATH","MCP_PROTECTED_RESOURCE_METADATA_PATH","AUTHORIZATION_SERVER_METADATA_PATH","MCP_SERVER_CARD_PATH","MCP_SERVER_CARD_MEDIA_TYPE","MCP_SERVER_CARD_SCHEMA","CONNECTOR_DISCOVERY_ROUTES","connectorDiscoveryRoute","pathname","Object","prototype","hasOwnProperty","call","connectorResourceFor","origin","connectorResourceMetadataUrl","connectorAuthorizationServerMetadataUrl","mcpServerCardUrl","mcpServerCardName","host","URL","hostname","namespace","split","filter","Boolean","reverse","join","replace"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;;;;;;;;;;;;;4CAqB4C,GAE5C,uDAAuD,GACvD,OAAO,MAAMA,0BAA0B,WAAU;AAEjD,0EAA0E,GAC1E,OAAO,MAAMC,2BAA2B,mBAAkB;AAE1D,4CAA4C,GAC5C,OAAO,MAAMC,0BAA0B,sBAAqB;AAE5D,+BAA+B,GAC/B,OAAO,MAAMC,uBAAuB,mBAAkB;AAEtD,2BAA2B,GAC3B,OAAO,MAAMC,wBAAwB,oBAAmB;AAExD,yDAAyD,GACzD,OAAO,MAAMC,mCAAmC,wCAAuC;AAEvF;;;CAGC,GACD,OAAO,MAAMC,uCAAuC,GAAGD,mCAAmCL,yBAAyB,CAAA;AAEnH,+DAA+D,GAC/D,OAAO,MAAMO,qCAAqC,0CAAyC;AAE3F;;;;;;;;;;CAUC,GACD,OAAO,MAAMC,uBAAuB,GAAGR,wBAAwB,YAAY,CAAC,CAAA;AAE5E,oEAAoE,GACpE,OAAO,MAAMS,6BAA6B,mCAAkC;AAE5E;;;CAGC,GACD,OAAO,MAAMC,yBACX,4EAA2E;AAE7E;;;;;CAKC,GACD,OAAO,MAAMC,6BAA+D;IAC1E,CAACN,iCAAiC,EAAE;IACpC,CAACC,qCAAqC,EAAE;IACxC,CAACC,mCAAmC,EAAE;AACxC,EAAC;AAED,qFAAqF,GACrF,OAAO,SAASK,wBAAwBC,QAAgB;IACtD,OAAOC,OAAOC,SAAS,CAACC,cAAc,CAACC,IAAI,CAACN,4BAA4BE,YACpEF,0BAA0B,CAACE,SAAS,GACpC;AACN;AAEA,8DAA8D,GAC9D,OAAO,SAASK,qBAAqBC,MAAc;IACjD,OAAO,GAAGA,SAASnB,yBAAyB;AAC9C;AAEA,4EAA4E,GAC5E,OAAO,SAASoB,6BAA6BD,MAAc;IACzD,OAAO,GAAGA,SAASb,sCAAsC;AAC3D;AAEA,oEAAoE,GACpE,OAAO,SAASe,wCAAwCF,MAAc;IACpE,OAAO,GAAGA,SAASZ,oCAAoC;AACzD;AAEA,gDAAgD,GAChD,OAAO,SAASe,iBAAiBH,MAAc;IAC7C,OAAO,GAAGA,SAASX,sBAAsB;AAC3C;AAEA;;;;;;;CAOC,GACD,OAAO,SAASe,kBAAkBJ,MAAc;IAC9C,IAAIK;IACJ,IAAI;QACFA,OAAO,IAAIC,IAAIN,QAAQO,QAAQ;IACjC,EAAE,eAAM;QACNF,OAAO;IACT;IACA,MAAMG,YAAYH,KACfI,KAAK,CAAC,KACNC,MAAM,CAACC,SACPC,OAAO,GACPC,IAAI,CAAC,KACLC,OAAO,CAAC,mBAAmB;IAC9B,OAAO,GAAGN,aAAa,QAAQ,IAAI,CAAC;AACtC"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../libs/aglyn/src/lib/app-utils/connector-discovery.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*==========================================\n * WHERE A CONNECTOR FINDS THE CONSOLE'S SIGN-IN (AGL-4225).\n *\n * An MCP client that is handed `<console>/api/mcp` and answered 401 reads the\n * protected-resource document the challenge names (RFC 9728), then the\n * authorization-server document (RFC 8414), and from there registers, sends\n * the person to the consent page and trades the code for credentials.\n *\n * Every address in that walk is here, in one module with no imports, because\n * the edge middleware has to know the three discovery documents by exact path\n * (it 404s the rest of `/.well-known/*`) and must not pull the server-side\n * credential code into the edge bundle to learn them. The documents\n * themselves are built by `connector-oauth.ts` in the data layer, from these\n * same constants.\n *\n * Nothing here names a host: these are paths, and the functions below take\n * the origin as an argument. Which origin is decided in ONE place, the\n * console's `connectorOrigin` — the configured console URL\n * (`NEXT_PUBLIC_CONSOLE_URL`) when it is set, and only otherwise the host the\n * deployment's proxy reports. A request header cannot choose the issuer of a\n * deployment that has configured its console URL.\n *==========================================*/\n\n/** The MCP endpoint, which is the protected resource. */\nexport const CONNECTOR_RESOURCE_PATH = '/api/mcp'\n\n/** The consent page a person is sent to. A console page, behind sign-in. */\nexport const CONNECTOR_AUTHORIZE_PATH = '/oauth/authorize'\n\n/** Dynamic client registration (RFC 7591). */\nexport const CONNECTOR_REGISTER_PATH = '/api/oauth/register'\n\n/** Code and refresh exchange. */\nexport const CONNECTOR_TOKEN_PATH = '/api/oauth/token'\n\n/** Revocation (RFC 7009). */\nexport const CONNECTOR_REVOKE_PATH = '/api/oauth/revoke'\n\n/** RFC 9728 §3: the document for the server as a whole. */\nexport const PROTECTED_RESOURCE_METADATA_PATH = '/.well-known/oauth-protected-resource'\n\n/**\n * RFC 9728 §3.1: the document for one resource, at the well-known prefix\n * followed by the resource's path. What the 401 challenge names.\n */\nexport const MCP_PROTECTED_RESOURCE_METADATA_PATH = `${PROTECTED_RESOURCE_METADATA_PATH}${CONNECTOR_RESOURCE_PATH}`\n\n/** RFC 8414 §3. The issuer has no path, so neither does this. */\nexport const AUTHORIZATION_SERVER_METADATA_PATH = '/.well-known/oauth-authorization-server'\n\n/**\n * The MCP Server Card: a static description of the MCP endpoint that a client\n * or a registry can read BEFORE connecting — where it is, which transport,\n * which protocol revisions.\n *\n * SEP-2127 (MCP Server Cards, Final, Extensions Track) reserves\n * `<streamable-http-url>/server-card` as the recommended location, and its\n * discovery document advises against `.well-known` for cards, so this sits\n * under the endpoint it describes rather than beside the OAuth documents.\n * https://modelcontextprotocol.io/seps/2127-mcp-server-cards\n */\nexport const MCP_SERVER_CARD_PATH = `${CONNECTOR_RESOURCE_PATH}/server-card`\n\n/** The card's media type, per the extension's `docs/discovery.md`. */\nexport const MCP_SERVER_CARD_MEDIA_TYPE = 'application/mcp-server-card+json'\n\n/**\n * The `$schema` a card must carry. The extension's schema pins this exact\n * URL (versioned by the `v1` segment, not by date).\n */\nexport const MCP_SERVER_CARD_SCHEMA =\n 'https://static.modelcontextprotocol.io/schemas/v1/server-card.schema.json'\n\n/**\n * The three discovery documents the console serves, by EXACT path, and the\n * route handler each is rewritten to. Exactly these: any other path under\n * `/.well-known/` still answers 404, which is the posture the namespace is\n * held to (AGL-3016).\n */\nexport const CONNECTOR_DISCOVERY_ROUTES: Readonly<Record<string, string>> = {\n [PROTECTED_RESOURCE_METADATA_PATH]: '/api/oauth/metadata/protected-resource',\n [MCP_PROTECTED_RESOURCE_METADATA_PATH]: '/api/oauth/metadata/protected-resource',\n [AUTHORIZATION_SERVER_METADATA_PATH]: '/api/oauth/metadata/authorization-server',\n}\n\n/** The route handler serving `pathname`, or `null` when it is not one of the three. */\nexport function connectorDiscoveryRoute(pathname: string): string | null {\n return Object.prototype.hasOwnProperty.call(CONNECTOR_DISCOVERY_ROUTES, pathname)\n ? CONNECTOR_DISCOVERY_ROUTES[pathname]\n : null\n}\n\n/**\n * The domain proof OpenAI's plugin directory reads (AGL-4225).\n *\n * To list a connector, the directory fetches this exact path on the host that\n * serves the MCP endpoint and expects the challenge token it issued as the\n * whole body, in plain text. It is not a discovery document and is not in the\n * map above: it describes nothing, and it exists only while a deployment has\n * been given a token (`OPENAI_APPS_CHALLENGE`).\n */\nexport const OPENAI_APPS_CHALLENGE_PATH = '/.well-known/openai-apps-challenge'\n\n/** The route handler the middleware rewrites {@link OPENAI_APPS_CHALLENGE_PATH} to. */\nexport const OPENAI_APPS_CHALLENGE_ROUTE = '/api/domain-proof/openai-apps-challenge'\n\n/** The handler serving `pathname`, or `null` for every path but the exact one. */\nexport function connectorDomainProofRoute(pathname: string): string | null {\n return pathname === OPENAI_APPS_CHALLENGE_PATH ? OPENAI_APPS_CHALLENGE_ROUTE : null\n}\n\n/**\n * What a challenge token may be: URL-safe unreserved characters, 8 to 512 of\n * them. The value is served verbatim as a response body, so anything else\n * (whitespace inside it, markup, a pasted `KEY=value` line) is a\n * misconfiguration and is refused rather than published.\n */\nconst DOMAIN_PROOF_TOKEN = /^[A-Za-z0-9._~-]{8,512}$/\n\n/**\n * The token to serve for a configured value, or `null` when there is none to\n * serve: unset, empty, or not shaped like a token. Surrounding whitespace is\n * dropped, because a value pasted into a dashboard often carries a newline.\n */\nexport function connectorDomainProofToken(configured: string | undefined | null): string | null {\n const token = (configured ?? '').trim()\n return DOMAIN_PROOF_TOKEN.test(token) ? token : null\n}\n\n/** The resource identifier for the MCP endpoint on `origin`. */\nexport function connectorResourceFor(origin: string): string {\n return `${origin}${CONNECTOR_RESOURCE_PATH}`\n}\n\n/** What a 401 from the MCP endpoint names, so a client can begin the walk. */\nexport function connectorResourceMetadataUrl(origin: string): string {\n return `${origin}${MCP_PROTECTED_RESOURCE_METADATA_PATH}`\n}\n\n/** The authorization server's own document (RFC 8414) on `origin`. */\nexport function connectorAuthorizationServerMetadataUrl(origin: string): string {\n return `${origin}${AUTHORIZATION_SERVER_METADATA_PATH}`\n}\n\n/** The MCP Server Card (SEP-2127) on `origin`. */\nexport function mcpServerCardUrl(origin: string): string {\n return `${origin}${MCP_SERVER_CARD_PATH}`\n}\n\n/**\n * The card's `name`: reverse-DNS of the host that serves the endpoint, then\n * `/mcp`. The card schema (and the MCP Registry's `server.json`) require\n * `namespace/name` matching `^[a-zA-Z0-9.-]+/[a-zA-Z0-9._-]+$`, and a\n * reverse-DNS namespace is the one a registry can verify against the domain,\n * so a self-hosted console names itself rather than borrowing ours.\n * `app.aglyn.com` → `com.aglyn.app/mcp`.\n */\nexport function mcpServerCardName(origin: string): string {\n let host: string\n try {\n host = new URL(origin).hostname\n } catch {\n host = ''\n }\n const namespace = host\n .split('.')\n .filter(Boolean)\n .reverse()\n .join('.')\n .replace(/[^a-zA-Z0-9.-]/g, '-')\n return `${namespace || 'local'}/mcp`\n}\n"],"names":["CONNECTOR_RESOURCE_PATH","CONNECTOR_AUTHORIZE_PATH","CONNECTOR_REGISTER_PATH","CONNECTOR_TOKEN_PATH","CONNECTOR_REVOKE_PATH","PROTECTED_RESOURCE_METADATA_PATH","MCP_PROTECTED_RESOURCE_METADATA_PATH","AUTHORIZATION_SERVER_METADATA_PATH","MCP_SERVER_CARD_PATH","MCP_SERVER_CARD_MEDIA_TYPE","MCP_SERVER_CARD_SCHEMA","CONNECTOR_DISCOVERY_ROUTES","connectorDiscoveryRoute","pathname","Object","prototype","hasOwnProperty","call","OPENAI_APPS_CHALLENGE_PATH","OPENAI_APPS_CHALLENGE_ROUTE","connectorDomainProofRoute","DOMAIN_PROOF_TOKEN","connectorDomainProofToken","configured","token","trim","test","connectorResourceFor","origin","connectorResourceMetadataUrl","connectorAuthorizationServerMetadataUrl","mcpServerCardUrl","mcpServerCardName","host","URL","hostname","namespace","split","filter","Boolean","reverse","join","replace"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;;;;;;;;;;;;;4CAqB4C,GAE5C,uDAAuD,GACvD,OAAO,MAAMA,0BAA0B,WAAU;AAEjD,0EAA0E,GAC1E,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