@n24q02m/hull 0.4.0 → 0.5.0-beta.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/README.md +47 -16
- package/build/cli/build-cli.d.ts +5 -6
- package/build/cli/build-cli.d.ts.map +1 -1
- package/build/cli/build-cli.js +4 -61
- package/build/cli/build-cli.js.map +1 -1
- package/build/crypto/index.d.ts +1 -1
- package/build/crypto/index.d.ts.map +1 -1
- package/build/crypto/index.js +1 -1
- package/build/crypto/index.js.map +1 -1
- package/build/crypto/kdf.d.ts +0 -13
- package/build/crypto/kdf.d.ts.map +1 -1
- package/build/crypto/kdf.js +3 -18
- package/build/crypto/kdf.js.map +1 -1
- package/build/index.d.ts +1 -11
- package/build/index.d.ts.map +1 -1
- package/build/index.js +4 -16
- package/build/index.js.map +1 -1
- package/build/storage/account-registry.d.ts +53 -0
- package/build/storage/account-registry.d.ts.map +1 -0
- package/build/storage/account-registry.js +148 -0
- package/build/storage/account-registry.js.map +1 -0
- package/build/storage/backends.d.ts +0 -26
- package/build/storage/backends.d.ts.map +1 -1
- package/build/storage/backends.js +0 -65
- package/build/storage/backends.js.map +1 -1
- package/build/storage/config-file.d.ts +2 -19
- package/build/storage/config-file.d.ts.map +1 -1
- package/build/storage/config-file.js +2 -23
- package/build/storage/config-file.js.map +1 -1
- package/build/storage/credential-store.d.ts +1 -9
- package/build/storage/credential-store.d.ts.map +1 -1
- package/build/storage/credential-store.js +4 -16
- package/build/storage/credential-store.js.map +1 -1
- package/build/storage/data-dir.d.ts +2 -2
- package/build/storage/data-dir.js +2 -2
- package/build/storage/encryption.d.ts.map +1 -1
- package/build/storage/encryption.js +4 -0
- package/build/storage/encryption.js.map +1 -1
- package/build/storage/index.d.ts +5 -3
- package/build/storage/index.d.ts.map +1 -1
- package/build/storage/index.js +5 -3
- package/build/storage/index.js.map +1 -1
- package/build/storage/key-pool-crypto.d.ts +44 -0
- package/build/storage/key-pool-crypto.d.ts.map +1 -0
- package/build/storage/key-pool-crypto.js +132 -0
- package/build/storage/key-pool-crypto.js.map +1 -0
- package/build/storage/key-pool-store.d.ts +134 -0
- package/build/storage/key-pool-store.d.ts.map +1 -0
- package/build/storage/key-pool-store.js +470 -0
- package/build/storage/key-pool-store.js.map +1 -0
- package/build/storage/key-pool.d.ts +172 -0
- package/build/storage/key-pool.d.ts.map +1 -0
- package/build/storage/key-pool.js +374 -0
- package/build/storage/key-pool.js.map +1 -0
- package/build/storage/resolver.js +1 -1
- package/build/storage/resolver.js.map +1 -1
- package/build/token-auth/index.d.ts +1 -1
- package/build/token-auth/index.js +1 -1
- package/build/transport/index.d.ts +1 -2
- package/build/transport/index.d.ts.map +1 -1
- package/build/transport/index.js +1 -2
- package/build/transport/index.js.map +1 -1
- package/build/transport/local-server.d.ts +12 -128
- package/build/transport/local-server.d.ts.map +1 -1
- package/build/transport/local-server.js +20 -262
- package/build/transport/local-server.js.map +1 -1
- package/build/transport/streamable-http.d.ts +6 -7
- package/build/transport/streamable-http.d.ts.map +1 -1
- package/build/transport/streamable-http.js +6 -6
- package/build/transport/streamable-http.js.map +1 -1
- package/build/util/browser.d.ts.map +1 -0
- package/build/{relay → util}/browser.js +2 -2
- package/build/util/browser.js.map +1 -0
- package/package.json +4 -21
- package/build/auth/credential-form.d.ts +0 -163
- package/build/auth/credential-form.d.ts.map +0 -1
- package/build/auth/credential-form.js +0 -1869
- package/build/auth/credential-form.js.map +0 -1
- package/build/auth/delegated-oauth-app.d.ts +0 -90
- package/build/auth/delegated-oauth-app.d.ts.map +0 -1
- package/build/auth/delegated-oauth-app.js +0 -881
- package/build/auth/delegated-oauth-app.js.map +0 -1
- package/build/auth/index.d.ts +0 -12
- package/build/auth/index.d.ts.map +0 -1
- package/build/auth/index.js +0 -12
- package/build/auth/index.js.map +0 -1
- package/build/auth/local-oauth-app.d.ts +0 -152
- package/build/auth/local-oauth-app.d.ts.map +0 -1
- package/build/auth/local-oauth-app.js +0 -975
- package/build/auth/local-oauth-app.js.map +0 -1
- package/build/auth/relay-login.d.ts +0 -46
- package/build/auth/relay-login.d.ts.map +0 -1
- package/build/auth/relay-login.js +0 -197
- package/build/auth/relay-login.js.map +0 -1
- package/build/auth/router.d.ts +0 -18
- package/build/auth/router.d.ts.map +0 -1
- package/build/auth/router.js +0 -62
- package/build/auth/router.js.map +0 -1
- package/build/auth/session-store.d.ts +0 -49
- package/build/auth/session-store.d.ts.map +0 -1
- package/build/auth/session-store.js +0 -94
- package/build/auth/session-store.js.map +0 -1
- package/build/auth/stable-sub.d.ts +0 -27
- package/build/auth/stable-sub.d.ts.map +0 -1
- package/build/auth/stable-sub.js +0 -38
- package/build/auth/stable-sub.js.map +0 -1
- package/build/auth/well-known.d.ts +0 -4
- package/build/auth/well-known.d.ts.map +0 -1
- package/build/auth/well-known.js +0 -26
- package/build/auth/well-known.js.map +0 -1
- package/build/oauth/cache.d.ts +0 -22
- package/build/oauth/cache.d.ts.map +0 -1
- package/build/oauth/cache.js +0 -24
- package/build/oauth/cache.js.map +0 -1
- package/build/oauth/index.d.ts +0 -6
- package/build/oauth/index.d.ts.map +0 -1
- package/build/oauth/index.js +0 -6
- package/build/oauth/index.js.map +0 -1
- package/build/oauth/jwt-issuer.d.ts +0 -87
- package/build/oauth/jwt-issuer.d.ts.map +0 -1
- package/build/oauth/jwt-issuer.js +0 -205
- package/build/oauth/jwt-issuer.js.map +0 -1
- package/build/oauth/pkce.d.ts +0 -10
- package/build/oauth/pkce.d.ts.map +0 -1
- package/build/oauth/pkce.js +0 -34
- package/build/oauth/pkce.js.map +0 -1
- package/build/oauth/provider.d.ts +0 -52
- package/build/oauth/provider.d.ts.map +0 -1
- package/build/oauth/provider.js +0 -98
- package/build/oauth/provider.js.map +0 -1
- package/build/oauth/user-store.d.ts +0 -25
- package/build/oauth/user-store.d.ts.map +0 -1
- package/build/oauth/user-store.js +0 -85
- package/build/oauth/user-store.js.map +0 -1
- package/build/relay/browser.d.ts.map +0 -1
- package/build/relay/browser.js.map +0 -1
- package/build/relay/client.d.ts +0 -36
- package/build/relay/client.d.ts.map +0 -1
- package/build/relay/client.js +0 -135
- package/build/relay/client.js.map +0 -1
- package/build/relay/session.d.ts +0 -12
- package/build/relay/session.d.ts.map +0 -1
- package/build/relay/session.js +0 -55
- package/build/relay/session.js.map +0 -1
- package/build/relay/tool-helpers.d.ts +0 -85
- package/build/relay/tool-helpers.d.ts.map +0 -1
- package/build/relay/tool-helpers.js +0 -103
- package/build/relay/tool-helpers.js.map +0 -1
- package/build/relay/wordlist.d.ts +0 -2
- package/build/relay/wordlist.d.ts.map +0 -1
- package/build/relay/wordlist.js +0 -7782
- package/build/relay/wordlist.js.map +0 -1
- package/build/schema/types.d.ts +0 -67
- package/build/schema/types.d.ts.map +0 -1
- package/build/schema/types.js +0 -2
- package/build/schema/types.js.map +0 -1
- package/build/storage/mode.d.ts +0 -23
- package/build/storage/mode.d.ts.map +0 -1
- package/build/storage/mode.js +0 -46
- package/build/storage/mode.js.map +0 -1
- package/build/storage/session-lock.d.ts +0 -19
- package/build/storage/session-lock.d.ts.map +0 -1
- package/build/storage/session-lock.js +0 -105
- package/build/storage/session-lock.js.map +0 -1
- package/build/transport/oauth-middleware.d.ts +0 -45
- package/build/transport/oauth-middleware.d.ts.map +0 -1
- package/build/transport/oauth-middleware.js +0 -86
- package/build/transport/oauth-middleware.js.map +0 -1
- /package/build/{relay → util}/browser.d.ts +0 -0
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Helper to register `config__open_relay` MCP tool — HTTP-only mode.
|
|
3
|
-
*
|
|
4
|
-
* After the stdio-pure + http-multi-user split, the relay config form is
|
|
5
|
-
* served by the HTTP server itself at ``<PUBLIC_URL>/authorize``. The
|
|
6
|
-
* ``config__open_relay`` tool directs the user to that URL.
|
|
7
|
-
*
|
|
8
|
-
* When the connected client declares URL-mode elicitation
|
|
9
|
-
* (``capabilities.elicitation.url``, SEP-1036), the tool asks the client to
|
|
10
|
-
* present a consent prompt and open the URL via ``Server.elicitInput`` so the
|
|
11
|
-
* credential form is opened out-of-band without the LLM in the loop. Clients
|
|
12
|
-
* that do NOT declare the capability fall back to the legacy behaviour: the
|
|
13
|
-
* tool returns the URL and best-effort opens the user's default browser
|
|
14
|
-
* server-side. There is no daemon-bridge discovery, no respawn, and no
|
|
15
|
-
* session deduplication — the HTTP server's own session tracking handles
|
|
16
|
-
* concurrent setup attempts.
|
|
17
|
-
*
|
|
18
|
-
* In stdio mode, the relay form does not exist; the tool returns
|
|
19
|
-
* ``stdio_unsupported`` so plugin code can render a "switch to HTTP mode"
|
|
20
|
-
* message instead of misleading the user with an unreachable URL.
|
|
21
|
-
*/
|
|
22
|
-
import { randomUUID } from 'node:crypto';
|
|
23
|
-
import { tryOpenBrowser } from './browser.js';
|
|
24
|
-
// Maps the client's ElicitResult.action to the tool's outcome field.
|
|
25
|
-
const ELICIT_ACTION_MAP = {
|
|
26
|
-
accept: 'accepted',
|
|
27
|
-
decline: 'declined',
|
|
28
|
-
cancel: 'cancelled'
|
|
29
|
-
};
|
|
30
|
-
function clientSupportsUrlElicitation(server) {
|
|
31
|
-
return server.getClientCapabilities()?.elicitation?.url != null;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Build the `open_relay` handler closure. Tests can call
|
|
35
|
-
* ``buildOpenRelayHandler({ serverName, publicUrl })`` directly without
|
|
36
|
-
* needing a real MCP server instance.
|
|
37
|
-
*
|
|
38
|
-
* When `elicitation` is supplied AND the client declared URL-mode
|
|
39
|
-
* elicitation, the handler drives `elicitInput` and returns the accept /
|
|
40
|
-
* decline / cancel outcome. Otherwise it returns the legacy dict
|
|
41
|
-
* (`{ url, browserOpened, status }`) unchanged.
|
|
42
|
-
*/
|
|
43
|
-
export function buildOpenRelayHandler(options) {
|
|
44
|
-
return async function openRelay() {
|
|
45
|
-
if (!options.publicUrl) {
|
|
46
|
-
return { url: '', browserOpened: false, status: 'stdio_unsupported' };
|
|
47
|
-
}
|
|
48
|
-
const url = `${options.publicUrl.replace(/\/$/, '')}/authorize`;
|
|
49
|
-
const { elicitation } = options;
|
|
50
|
-
if (elicitation && clientSupportsUrlElicitation(elicitation)) {
|
|
51
|
-
const message = `Open the ${options.serverName} configuration page to enter your credentials securely in your browser.`;
|
|
52
|
-
const result = await elicitation.elicitInput({
|
|
53
|
-
mode: 'url',
|
|
54
|
-
message,
|
|
55
|
-
url,
|
|
56
|
-
elicitationId: randomUUID()
|
|
57
|
-
});
|
|
58
|
-
return {
|
|
59
|
-
url,
|
|
60
|
-
browserOpened: false,
|
|
61
|
-
status: 'unconfigured',
|
|
62
|
-
elicitation: ELICIT_ACTION_MAP[result.action] ?? 'accepted'
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
const opened = await tryOpenBrowser(url);
|
|
66
|
-
return { url, browserOpened: !!opened, status: 'unconfigured' };
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Register `config__open_relay` on the given MCP server instance.
|
|
71
|
-
*
|
|
72
|
-
* Consumer servers add this single line in their tool registry after the
|
|
73
|
-
* other `config__*` registrations:
|
|
74
|
-
*
|
|
75
|
-
* ```ts
|
|
76
|
-
* import { registerOpenRelayTool } from '@n24q02m/hull'
|
|
77
|
-
* registerOpenRelayTool(mcp, SERVER_NAME, PUBLIC_URL, mcp.server)
|
|
78
|
-
* ```
|
|
79
|
-
*
|
|
80
|
-
* Pass ``null`` for ``publicUrl`` when the server is running in stdio mode;
|
|
81
|
-
* the tool will return ``status: 'stdio_unsupported'`` so the caller can
|
|
82
|
-
* surface a clear "switch to HTTP mode" message.
|
|
83
|
-
*
|
|
84
|
-
* Pass the low-level `Server` (`mcp.server`) as ``elicitation`` to enable
|
|
85
|
-
* URL-mode elicitation for capable clients. When omitted, the tool keeps
|
|
86
|
-
* the legacy browser-open behaviour for every client.
|
|
87
|
-
*/
|
|
88
|
-
export function registerOpenRelayTool(mcp, serverName, publicUrl, elicitation) {
|
|
89
|
-
const handler = buildOpenRelayHandler({ serverName, publicUrl, elicitation });
|
|
90
|
-
mcp.tool({
|
|
91
|
-
name: 'config__open_relay',
|
|
92
|
-
// Deliberately conditional. The handler returns `browserOpened: false`
|
|
93
|
-
// whenever no browser could be launched (headless, CI, the env-guard, no
|
|
94
|
-
// desktop session), and this text is read by a model that then speaks for
|
|
95
|
-
// the tool. "Open the ... form in the user's browser" reads as a
|
|
96
|
-
// guarantee, so a model can report "opened it in your browser" while the
|
|
97
|
-
// result says otherwise -- the user is then waiting on a tab that will
|
|
98
|
-
// never appear. The URL is what the tool always delivers; the browser is
|
|
99
|
-
// a convenience on top, and the wording says so in that order.
|
|
100
|
-
description: `Get the relay configuration URL for ${serverName}, opening it in the user's browser when possible.`
|
|
101
|
-
}, handler);
|
|
102
|
-
}
|
|
103
|
-
//# sourceMappingURL=tool-helpers.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tool-helpers.js","sourceRoot":"","sources":["../../src/relay/tool-helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAExC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAyB7C,qEAAqE;AACrE,MAAM,iBAAiB,GAA0D;IAC/E,MAAM,EAAE,UAAU;IAClB,OAAO,EAAE,UAAU;IACnB,MAAM,EAAE,WAAW;CACpB,CAAA;AAED,SAAS,4BAA4B,CAAC,MAAyB;IAC7D,OAAO,MAAM,CAAC,qBAAqB,EAAE,EAAE,WAAW,EAAE,GAAG,IAAI,IAAI,CAAA;AACjE,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,qBAAqB,CAAC,OAAgC;IACpE,OAAO,KAAK,UAAU,SAAS;QAC7B,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;YACvB,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,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