@antasphere/cli-core 0.4.0 → 0.6.0
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 +217 -111
- package/dist/config.d.ts +63 -24
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +49 -9
- package/dist/config.js.map +1 -1
- package/dist/connect-on-demand.d.ts +101 -26
- package/dist/connect-on-demand.d.ts.map +1 -1
- package/dist/connect-on-demand.js +125 -53
- package/dist/connect-on-demand.js.map +1 -1
- package/dist/connect.d.ts +21 -6
- package/dist/connect.d.ts.map +1 -1
- package/dist/connect.js +17 -1
- package/dist/connect.js.map +1 -1
- package/dist/index.d.ts +15 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -10
- package/dist/index.js.map +1 -1
- package/dist/resolve.d.ts +125 -10
- package/dist/resolve.d.ts.map +1 -1
- package/dist/resolve.js +167 -8
- package/dist/resolve.js.map +1 -1
- package/package.json +2 -2
- package/src/config.ts +92 -25
- package/src/connect-on-demand.ts +206 -73
- package/src/connect.ts +27 -6
- package/src/index.ts +51 -13
- package/src/resolve.ts +234 -13
- package/dist/org.d.ts +0 -42
- package/dist/org.d.ts.map +0 -1
- package/dist/org.js +0 -39
- package/dist/org.js.map +0 -1
- package/src/org.ts +0 -73
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAChG,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,EAA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CAAC;QACN,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAC,GAAG,EAAE,GAAG,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;IACnE,CAAC;IACD,UAAU,CAAC,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;IAC9B,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -5,12 +5,20 @@ import type { ResolvedProfile } from './resolve.js';
|
|
|
5
5
|
* Connect-on-demand (binding patterns §7, gcloud model), extracted from the
|
|
6
6
|
* Slideless CLI so every Antasphere tool CLI inherits "one `antasphere login`
|
|
7
7
|
* serves every federated tool". When a tool CLI resolves NO credential of its
|
|
8
|
-
* own, it calls `connectOnDemand
|
|
8
|
+
* own, it calls `connectOnDemand` with the profile it selected
|
|
9
|
+
* (`selectProfile`: the profile IS the instance):
|
|
9
10
|
*
|
|
10
11
|
* 0. The cache is consulted FIRST: a key minted earlier for THIS instance
|
|
11
|
-
* under the
|
|
12
|
-
*
|
|
13
|
-
*
|
|
12
|
+
* under the hub profile (the one `ANTASPHERE_URL` names, else the
|
|
13
|
+
* active one: `selectHubProfile`) is USER-scoped (hub ADR 014) — it
|
|
14
|
+
* serves every subsequent run and every org, with zero network (no
|
|
15
|
+
* probe, no hub round-trip, no fresh mint). It is read on the selected
|
|
16
|
+
* profile only when that profile is at the resolved instance (its
|
|
17
|
+
* `baseUrl`, else the tool's `cloudUrl` when the profile has none), so
|
|
18
|
+
* a cached key never travels to another origin, and it is served only
|
|
19
|
+
* to the address that minted it: the hub profile's `email` and the
|
|
20
|
+
* cached entry's `email` must both be there and match
|
|
21
|
+
* (`cachedConnectKey`). `cached: false` skips this step.
|
|
14
22
|
* 1. On a miss, discovery gates the flow: only an Antasphere-CLOUD
|
|
15
23
|
* instance can mint keys through the hub (unauthenticated GET
|
|
16
24
|
* /instance — never guess). Unreachable, foreign, or self-hosted
|
|
@@ -18,16 +26,29 @@ import type { ResolvedProfile } from './resolve.js';
|
|
|
18
26
|
* error unchanged.
|
|
19
27
|
* 2. The hub credential is what `antasphere login` stored on the hub
|
|
20
28
|
* profile (the config home's HUB_TOOL namespace) — hub URL included,
|
|
21
|
-
* never a hardcoded constant here.
|
|
29
|
+
* never a hardcoded constant here. The hub profile is the one
|
|
30
|
+
* `ANTASPHERE_URL` names (the profile at that instance, the way the
|
|
31
|
+
* account CLI picks it), else the active one; a URL no hub profile is
|
|
32
|
+
* at has no credential, and the guided `antasphere login` error says
|
|
33
|
+
* so.
|
|
22
34
|
* 3. `CliConnectClient.exchange` trades it for a tool-local key (one
|
|
23
35
|
* re-exchange retry when the 120 s JWT dies in transit; a rejected hub
|
|
24
|
-
* credential maps to guided `antasphere login` advice
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
36
|
+
* credential maps to guided `antasphere login` advice on either
|
|
37
|
+
* attempt; a hub REFUSAL, a 403 that is not the scope case, propagates
|
|
38
|
+
* as its `CliConnectError` with the hub's own sentence and `exitCode`
|
|
39
|
+
* 3).
|
|
40
|
+
* 4. The minted key is cached on the SELECTED profile under the hub
|
|
41
|
+
* profile's name. A profile not on disk yet is created with this
|
|
42
|
+
* instance's URL, and made active only when the tool had no profile at
|
|
43
|
+
* all; an existing profile is never renamed or repointed, and one that
|
|
44
|
+
* is at another instance never receives the key.
|
|
28
45
|
*
|
|
29
|
-
* A
|
|
30
|
-
*
|
|
46
|
+
* A stranded key recovers: on a 401 with a key that came from the cache,
|
|
47
|
+
* the tool CLI calls `refreshConnectKey` once (evict, exchange again with
|
|
48
|
+
* `cached: false`) and retries its request once; a second 401 fails.
|
|
49
|
+
*
|
|
50
|
+
* A new tool needs only its namespace, its cloud URL, and copy — the flow
|
|
51
|
+
* itself is tool-agnostic.
|
|
31
52
|
*/
|
|
32
53
|
/** What the unauthenticated discovery probe learned about a tool instance. */
|
|
33
54
|
export interface ToolInstanceProbe {
|
|
@@ -46,10 +67,31 @@ export interface ToolInstanceProbe {
|
|
|
46
67
|
* callers treat both exactly like "not cloud".
|
|
47
68
|
*/
|
|
48
69
|
export declare function probeToolInstance(toolBaseUrl: string, fetchImpl?: typeof globalThis.fetch): Promise<ToolInstanceProbe | null>;
|
|
70
|
+
/** The hub's URL env var: the instance the account CLI talks to. */
|
|
71
|
+
export declare const HUB_URL_ENV = "ANTASPHERE_URL";
|
|
72
|
+
/**
|
|
73
|
+
* The hub profile the exchange uses, selected the way the account CLI
|
|
74
|
+
* selects it: when `ANTASPHERE_URL` is set, the profile at that instance
|
|
75
|
+
* (`selectProfile`'s URL rule: the active one first when several name it,
|
|
76
|
+
* then `cloud`, then the first declared); a URL nothing on disk names
|
|
77
|
+
* yields the in-memory profile `selectProfile` makes (named for its host,
|
|
78
|
+
* `cloud` for `cloudUrl`, a `baseUrl` and no key), so the caller's
|
|
79
|
+
* missing-login error fires. Without `ANTASPHERE_URL`, the active profile,
|
|
80
|
+
* and none when no profile is active (here the account CLI's rule differs:
|
|
81
|
+
* it would fall back to its cloud profile; a tool CLI asks for a login
|
|
82
|
+
* instead) (PRDCT-3392: following the active profile whatever
|
|
83
|
+
* `ANTASPHERE_URL` said asked the wrong hub). Its NAME is the connect cache's slot (config.ts
|
|
84
|
+
* `connectKeys`): stable per hub account on this machine, independent of
|
|
85
|
+
* any org selection.
|
|
86
|
+
*/
|
|
87
|
+
export declare function selectHubProfile(env: CliEnv, opts?: {
|
|
88
|
+
cloudUrl?: string | undefined;
|
|
89
|
+
}): ResolvedProfile;
|
|
49
90
|
/**
|
|
50
|
-
* The
|
|
51
|
-
*
|
|
52
|
-
*
|
|
91
|
+
* The hub profile `ANTASPHERE_URL` names, else the active one — what
|
|
92
|
+
* `antasphere login` stored. Kept for the callers of 0.5.
|
|
93
|
+
*
|
|
94
|
+
* @deprecated Use `selectHubProfile`, which also takes the hub's cloud URL.
|
|
53
95
|
*/
|
|
54
96
|
export declare function activeHubProfile(env: CliEnv): ResolvedProfile;
|
|
55
97
|
/** The facts the connected notice is rendered from (fresh exchanges only —
|
|
@@ -59,12 +101,13 @@ export interface ConnectNoticeFacts {
|
|
|
59
101
|
toolBaseUrl: string;
|
|
60
102
|
/** The signed-in account's email at mint. */
|
|
61
103
|
email: string;
|
|
62
|
-
/** Whether the minted key was persisted for the next run (
|
|
63
|
-
*
|
|
104
|
+
/** Whether the minted key was persisted for the next run (on the
|
|
105
|
+
* selected profile, under the hub profile's name); false = the profile
|
|
106
|
+
* is at another instance. */
|
|
64
107
|
stored: boolean;
|
|
65
108
|
/** The tool profile the cache targeted. */
|
|
66
109
|
profileName: string;
|
|
67
|
-
/** When NOT stored: the other instance the profile
|
|
110
|
+
/** When NOT stored: the other instance the profile is at. */
|
|
68
111
|
profileBaseUrl?: string;
|
|
69
112
|
}
|
|
70
113
|
/**
|
|
@@ -86,29 +129,47 @@ export interface ConnectOnDemandOptions {
|
|
|
86
129
|
tool: string;
|
|
87
130
|
/** The resolved tool instance origin the CLI is talking to. */
|
|
88
131
|
toolBaseUrl: string;
|
|
132
|
+
/** The tool's cloud URL, the same value `selectProfile` got: what a
|
|
133
|
+
* profile with no `baseUrl` of its own is at. Omit only for a tool with
|
|
134
|
+
* no cloud instance. */
|
|
135
|
+
cloudUrl?: string | undefined;
|
|
136
|
+
/** The hub's cloud URL, three roles: what the implicit `cloud` hub profile
|
|
137
|
+
* is at, so an `ANTASPHERE_URL` equal to it names the `cloud` slot (omit
|
|
138
|
+
* and a fresh hub profile is named for its host); where a hub profile
|
|
139
|
+
* with no `baseUrl` is placed for the selection; and the hub URL such a
|
|
140
|
+
* profile's exchange goes to. A profile's own `baseUrl` always wins. */
|
|
141
|
+
hubCloudUrl?: string | undefined;
|
|
89
142
|
/** The exchange resource URL; default = this instance's MCP endpoint,
|
|
90
143
|
* `${toolBaseUrl}/mcp` (the tool's registered resource URL). */
|
|
91
144
|
resource?: string;
|
|
92
|
-
/** The tool profile the
|
|
93
|
-
|
|
145
|
+
/** The tool profile the CLI selected for this run (`selectProfile`), the
|
|
146
|
+
* one the minted key is cached on. Not on disk yet → created with
|
|
147
|
+
* `toolBaseUrl` on first contact; at another instance → the key is
|
|
148
|
+
* returned but never stored. cli-core never guesses it. */
|
|
149
|
+
profileName: string;
|
|
94
150
|
env: CliEnv;
|
|
95
151
|
fetch?: typeof globalThis.fetch;
|
|
96
152
|
/** Receives the human "Connected to …" notice (tools wire their stderr);
|
|
97
153
|
* omitted = silent. Cache hits are always silent either way. */
|
|
98
154
|
notify?: (line: string) => void;
|
|
99
155
|
messages?: ConnectOnDemandMessages;
|
|
156
|
+
/** false = do not read the cache: run the exchange even when a key is
|
|
157
|
+
* cached (the one re-exchange after a 401 on a cached key;
|
|
158
|
+
* `refreshConnectKey` sets it). Default true. */
|
|
159
|
+
cached?: boolean;
|
|
100
160
|
}
|
|
101
161
|
export type ConnectOnDemandOutcome = {
|
|
102
162
|
outcome: 'connected';
|
|
103
163
|
/** The tool-local key — this invocation's credential. */
|
|
104
164
|
key: string;
|
|
105
|
-
/** true = served from the (tool, hub profile) config cache:
|
|
106
|
-
* network, nothing minted. false = a fresh exchange ran.
|
|
165
|
+
/** true = served from the (tool profile, hub profile) config cache:
|
|
166
|
+
* zero network, nothing minted. false = a fresh exchange ran. A 401
|
|
167
|
+
* on a `cached: true` key is what warrants `refreshConnectKey`. */
|
|
107
168
|
cached: boolean;
|
|
108
169
|
/** Fresh exchanges only: the full result (user, key meta). */
|
|
109
170
|
result?: CliConnectResult;
|
|
110
171
|
/** Fresh exchanges only: whether the minted key was persisted for
|
|
111
|
-
* the next run (false = the profile
|
|
172
|
+
* the next run (false = the profile is at another instance). */
|
|
112
173
|
stored?: boolean;
|
|
113
174
|
} | {
|
|
114
175
|
/** Not an Antasphere-cloud instance (or unreachable): the caller
|
|
@@ -118,10 +179,24 @@ export type ConnectOnDemandOutcome = {
|
|
|
118
179
|
/**
|
|
119
180
|
* The hub → tool exchange fallback a tool CLI runs when no direct credential
|
|
120
181
|
* resolved. Serves the cached user-scoped key when one exists for this
|
|
121
|
-
* (instance, hub profile)
|
|
122
|
-
* is not an Antasphere-cloud one (or
|
|
123
|
-
* `CliUsageError` when the instance IS cloud
|
|
124
|
-
*
|
|
182
|
+
* (instance, hub profile) on the selected profile; otherwise returns
|
|
183
|
+
* `not_cloud` when the instance is not an Antasphere-cloud one (or
|
|
184
|
+
* unreachable). Throws a guided `CliUsageError` when the instance IS cloud
|
|
185
|
+
* but the hub login is missing or rejected; a refusal and every other
|
|
186
|
+
* exchange failure propagate as their `CliConnectError` (`exitCode` says 3
|
|
187
|
+
* for the refusal, `message` is the server's own sentence).
|
|
125
188
|
*/
|
|
126
189
|
export declare function connectOnDemand(opts: ConnectOnDemandOptions): Promise<ConnectOnDemandOutcome>;
|
|
190
|
+
/**
|
|
191
|
+
* The stranded-key recovery: what a tool CLI calls once when a request
|
|
192
|
+
* answered 401 with a key that `connectOnDemand` served from the cache
|
|
193
|
+
* (`cached: true`). Evicts that key from the selected profile (the hub
|
|
194
|
+
* revoked it, or a membership was swept), only when that profile is at
|
|
195
|
+
* this instance (a key of another instance is never touched), and runs the
|
|
196
|
+
* exchange again with the cache skipped. The caller retries its request
|
|
197
|
+
* once with the new key and fails on a second 401; `not_cloud` means there
|
|
198
|
+
* is nothing to recover with, and the caller fails with its 401 as it
|
|
199
|
+
* stands.
|
|
200
|
+
*/
|
|
201
|
+
export declare function refreshConnectKey(opts: ConnectOnDemandOptions): Promise<ConnectOnDemandOutcome>;
|
|
127
202
|
//# sourceMappingURL=connect-on-demand.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connect-on-demand.d.ts","sourceRoot":"","sources":["../src/connect-on-demand.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"connect-on-demand.d.ts","sourceRoot":"","sources":["../src/connect-on-demand.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,MAAM,EAAc,MAAM,aAAa,CAAC;AAEtD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC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,6 +1,6 @@
|
|
|
1
|
-
import { assertToolNamespace, HUB_TOOL, loadConfig,
|
|
1
|
+
import { assertToolNamespace, cachedConnectKey, HUB_TOOL, loadConfig, removeConnectKey, storeConnectKey } from './config.js';
|
|
2
2
|
import { CliConnectClient, CliConnectError } from './connect.js';
|
|
3
|
-
import { CliUsageError,
|
|
3
|
+
import { CliUsageError, firstSet, normalizeUrl, profileUrl, resolveProfile, sameInstance, selectProfile } from './resolve.js';
|
|
4
4
|
/**
|
|
5
5
|
* Probe a tool instance's unauthenticated discovery endpoint
|
|
6
6
|
* (`GET {toolBaseUrl}/api/v1/instance`). Returns what it advertises, or
|
|
@@ -30,13 +30,40 @@ export async function probeToolInstance(toolBaseUrl, fetchImpl) {
|
|
|
30
30
|
return null;
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
+
/** The hub's URL env var: the instance the account CLI talks to. */
|
|
34
|
+
export const HUB_URL_ENV = 'ANTASPHERE_URL';
|
|
33
35
|
/**
|
|
34
|
-
* The
|
|
35
|
-
*
|
|
36
|
-
*
|
|
36
|
+
* The hub profile the exchange uses, selected the way the account CLI
|
|
37
|
+
* selects it: when `ANTASPHERE_URL` is set, the profile at that instance
|
|
38
|
+
* (`selectProfile`'s URL rule: the active one first when several name it,
|
|
39
|
+
* then `cloud`, then the first declared); a URL nothing on disk names
|
|
40
|
+
* yields the in-memory profile `selectProfile` makes (named for its host,
|
|
41
|
+
* `cloud` for `cloudUrl`, a `baseUrl` and no key), so the caller's
|
|
42
|
+
* missing-login error fires. Without `ANTASPHERE_URL`, the active profile,
|
|
43
|
+
* and none when no profile is active (here the account CLI's rule differs:
|
|
44
|
+
* it would fall back to its cloud profile; a tool CLI asks for a login
|
|
45
|
+
* instead) (PRDCT-3392: following the active profile whatever
|
|
46
|
+
* `ANTASPHERE_URL` said asked the wrong hub). Its NAME is the connect cache's slot (config.ts
|
|
47
|
+
* `connectKeys`): stable per hub account on this machine, independent of
|
|
48
|
+
* any org selection.
|
|
49
|
+
*/
|
|
50
|
+
export function selectHubProfile(env, opts = {}) {
|
|
51
|
+
const config = loadConfig(env, HUB_TOOL);
|
|
52
|
+
const apiUrl = firstSet(env[HUB_URL_ENV]);
|
|
53
|
+
if (apiUrl) {
|
|
54
|
+
const { name, profile } = selectProfile({ config, apiUrl, cloudUrl: opts.cloudUrl });
|
|
55
|
+
return { name, profile };
|
|
56
|
+
}
|
|
57
|
+
return resolveProfile(config, undefined);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* The hub profile `ANTASPHERE_URL` names, else the active one — what
|
|
61
|
+
* `antasphere login` stored. Kept for the callers of 0.5.
|
|
62
|
+
*
|
|
63
|
+
* @deprecated Use `selectHubProfile`, which also takes the hub's cloud URL.
|
|
37
64
|
*/
|
|
38
65
|
export function activeHubProfile(env) {
|
|
39
|
-
return
|
|
66
|
+
return selectHubProfile(env);
|
|
40
67
|
}
|
|
41
68
|
function defaultMissingHubLogin(tool) {
|
|
42
69
|
const envVar = `${tool.replace(/-/g, '_').toUpperCase()}_API_KEY`;
|
|
@@ -51,29 +78,48 @@ function defaultConnected(facts) {
|
|
|
51
78
|
: ` — key NOT cached: profile '${facts.profileName}' points at ${facts.profileBaseUrl}`) +
|
|
52
79
|
'.\n');
|
|
53
80
|
}
|
|
81
|
+
/**
|
|
82
|
+
* Where the selected profile stands with respect to the resolved instance:
|
|
83
|
+
* `here` (its `baseUrl`, else the tool's cloud URL, is this instance),
|
|
84
|
+
* `elsewhere` (it is at another instance), or `free` (absent, or with no
|
|
85
|
+
* instance at all: no `baseUrl` and no cloud URL known). The cache is read
|
|
86
|
+
* only when `here`; a key is stored unless `elsewhere`; a key is evicted
|
|
87
|
+
* only when `here`.
|
|
88
|
+
*/
|
|
89
|
+
function placeOf(existing, toolBaseUrl, cloudUrl) {
|
|
90
|
+
const at = existing ? profileUrl(existing, cloudUrl) : undefined;
|
|
91
|
+
if (!existing || at === undefined)
|
|
92
|
+
return { place: 'free' };
|
|
93
|
+
return sameInstance(at, toolBaseUrl) ? { place: 'here', at } : { place: 'elsewhere', at };
|
|
94
|
+
}
|
|
54
95
|
/**
|
|
55
96
|
* The hub → tool exchange fallback a tool CLI runs when no direct credential
|
|
56
97
|
* resolved. Serves the cached user-scoped key when one exists for this
|
|
57
|
-
* (instance, hub profile)
|
|
58
|
-
* is not an Antasphere-cloud one (or
|
|
59
|
-
* `CliUsageError` when the instance IS cloud
|
|
60
|
-
*
|
|
98
|
+
* (instance, hub profile) on the selected profile; otherwise returns
|
|
99
|
+
* `not_cloud` when the instance is not an Antasphere-cloud one (or
|
|
100
|
+
* unreachable). Throws a guided `CliUsageError` when the instance IS cloud
|
|
101
|
+
* but the hub login is missing or rejected; a refusal and every other
|
|
102
|
+
* exchange failure propagate as their `CliConnectError` (`exitCode` says 3
|
|
103
|
+
* for the refusal, `message` is the server's own sentence).
|
|
61
104
|
*/
|
|
62
105
|
export async function connectOnDemand(opts) {
|
|
63
106
|
assertToolNamespace(opts.tool);
|
|
64
|
-
const toolBaseUrl = opts.toolBaseUrl
|
|
107
|
+
const toolBaseUrl = normalizeUrl(opts.toolBaseUrl);
|
|
65
108
|
const messages = opts.messages ?? {};
|
|
66
|
-
const profileName = opts
|
|
67
|
-
// 0. The cache: a key minted earlier by the
|
|
68
|
-
//
|
|
69
|
-
//
|
|
70
|
-
//
|
|
71
|
-
//
|
|
72
|
-
|
|
109
|
+
const { profileName } = opts;
|
|
110
|
+
// 0. The cache: a key minted earlier by the hub profile (the one
|
|
111
|
+
// ANTASPHERE_URL names, else the active one) is user-scoped — it serves
|
|
112
|
+
// every run and every org (hub ADR 014; the org is a per-request
|
|
113
|
+
// parameter, never part of the credential). Only the selected profile
|
|
114
|
+
// is read, and only when it is at THIS instance: a cached key never
|
|
115
|
+
// travels to a different instance. It is served only to the address
|
|
116
|
+
// that minted it (both e-mails there and equal). A hit costs zero
|
|
117
|
+
// network. `cached: false` (the re-exchange after a 401) skips it.
|
|
118
|
+
const hub = selectHubProfile(opts.env, { cloudUrl: opts.hubCloudUrl });
|
|
73
119
|
const existing = loadConfig(opts.env, opts.tool).profiles[profileName];
|
|
74
|
-
const
|
|
75
|
-
if (
|
|
76
|
-
const cachedKey =
|
|
120
|
+
const { place, at } = placeOf(existing, toolBaseUrl, opts.cloudUrl);
|
|
121
|
+
if (opts.cached !== false && place === 'here' && hub.name) {
|
|
122
|
+
const cachedKey = cachedConnectKey(existing, hub.name, hub.profile?.email);
|
|
77
123
|
if (cachedKey)
|
|
78
124
|
return { outcome: 'connected', key: cachedKey, cached: true };
|
|
79
125
|
}
|
|
@@ -84,9 +130,16 @@ export async function connectOnDemand(opts) {
|
|
|
84
130
|
return { outcome: 'not_cloud' };
|
|
85
131
|
// 2. The hub credential is what `antasphere login` stored on the hub
|
|
86
132
|
// profile (HUB_TOOL namespace) — one login for the whole tool family.
|
|
87
|
-
// The hub URL comes from that same profile, never from a constant here
|
|
88
|
-
|
|
89
|
-
|
|
133
|
+
// The hub URL comes from that same profile, never from a constant here;
|
|
134
|
+
// an in-memory profile (ANTASPHERE_URL naming no profile) has no key.
|
|
135
|
+
// A blank field is no field (the package's one blank rule, firstSet).
|
|
136
|
+
const hubKey = firstSet(hub.profile?.apiKey);
|
|
137
|
+
// A hub profile with no baseUrl (a hand edit, another writer: every
|
|
138
|
+
// Antasphere login writes one) is at the hub's cloud URL when the caller
|
|
139
|
+
// names one, the same rule a tool profile has with `cloudUrl`, and the
|
|
140
|
+
// rule `selectProfile` already applies to place it; the exchange half
|
|
141
|
+
// agrees with the selection half (verifier round 1, F4; round 3, F2).
|
|
142
|
+
const hubBaseUrl = firstSet(hub.profile?.baseUrl, opts.hubCloudUrl);
|
|
90
143
|
if (!hubKey || !hubBaseUrl || !hub.name) {
|
|
91
144
|
throw new CliUsageError(messages.missingHubLogin ?? defaultMissingHubLogin(opts.tool));
|
|
92
145
|
}
|
|
@@ -100,50 +153,69 @@ export async function connectOnDemand(opts) {
|
|
|
100
153
|
...(opts.fetch ? { fetch: opts.fetch } : {})
|
|
101
154
|
});
|
|
102
155
|
const body = { resource };
|
|
156
|
+
// One attempt, with the hub's verdict on the KEY mapped to the guided
|
|
157
|
+
// login error whichever attempt it comes on. A refusal (403 that is not
|
|
158
|
+
// the scope case) and every wire error propagate as they are: the error
|
|
159
|
+
// carries the server's own sentence and its exit code.
|
|
160
|
+
const attempt = async () => {
|
|
161
|
+
try {
|
|
162
|
+
return await connect.exchange(hubKey, body);
|
|
163
|
+
}
|
|
164
|
+
catch (e) {
|
|
165
|
+
if (e instanceof CliConnectError && e.needsHubLogin) {
|
|
166
|
+
throw new CliUsageError(messages.hubLoginRejected ?? DEFAULT_HUB_LOGIN_REJECTED);
|
|
167
|
+
}
|
|
168
|
+
throw e;
|
|
169
|
+
}
|
|
170
|
+
};
|
|
103
171
|
let result;
|
|
104
172
|
try {
|
|
105
|
-
result = await
|
|
173
|
+
result = await attempt();
|
|
106
174
|
}
|
|
107
175
|
catch (e) {
|
|
108
|
-
if (e instanceof CliConnectError && e.needsReExchange)
|
|
109
|
-
// The 120 s JWT died in transit (expired/replayed) — one fresh
|
|
110
|
-
// exchange; a second rejection propagates.
|
|
111
|
-
result = await connect.exchange(hubKey, body);
|
|
112
|
-
}
|
|
113
|
-
else if (e instanceof CliConnectError && e.needsHubLogin) {
|
|
114
|
-
throw new CliUsageError(messages.hubLoginRejected ?? DEFAULT_HUB_LOGIN_REJECTED);
|
|
115
|
-
}
|
|
116
|
-
else {
|
|
176
|
+
if (!(e instanceof CliConnectError && e.needsReExchange))
|
|
117
177
|
throw e;
|
|
118
|
-
|
|
178
|
+
// The 120 s JWT died in transit (expired/replayed) — one fresh
|
|
179
|
+
// exchange; a second rejection propagates.
|
|
180
|
+
result = await attempt();
|
|
119
181
|
}
|
|
120
|
-
// 4. Cache the minted key
|
|
121
|
-
// profile
|
|
122
|
-
//
|
|
123
|
-
|
|
182
|
+
// 4. Cache the minted key on the SELECTED profile under the hub profile's
|
|
183
|
+
// name. A profile not on disk yet, or one with no instance of its own,
|
|
184
|
+
// takes this instance's URL; a profile at another instance never
|
|
185
|
+
// receives the key and is never repointed.
|
|
186
|
+
const stored = place !== 'elsewhere';
|
|
124
187
|
if (stored) {
|
|
125
|
-
storeConnectKey(opts.env, opts.tool, profileName, hub.name, {
|
|
126
|
-
apiKey: result.key,
|
|
127
|
-
email: result.user.email,
|
|
128
|
-
mintedAt: new Date().toISOString()
|
|
129
|
-
});
|
|
130
|
-
if (!existing?.baseUrl) {
|
|
131
|
-
// First contact: pin the profile to this instance so the next
|
|
132
|
-
// invocation resolves the URL and the cached key with no flags.
|
|
133
|
-
const cfg = loadConfig(opts.env, opts.tool);
|
|
134
|
-
cfg.profiles[profileName] = { ...cfg.profiles[profileName], baseUrl: toolBaseUrl };
|
|
135
|
-
saveConfig(opts.env, opts.tool, cfg);
|
|
136
|
-
}
|
|
188
|
+
storeConnectKey(opts.env, opts.tool, profileName, hub.name, { apiKey: result.key, email: result.user.email, mintedAt: new Date().toISOString() }, { baseUrl: toolBaseUrl });
|
|
137
189
|
}
|
|
138
190
|
const facts = {
|
|
139
191
|
toolBaseUrl,
|
|
140
192
|
email: result.user.email,
|
|
141
193
|
stored,
|
|
142
194
|
profileName,
|
|
143
|
-
// `stored` is false only when the profile
|
|
144
|
-
...(stored ? {} : { profileBaseUrl:
|
|
195
|
+
// `stored` is false only when the profile is at another instance.
|
|
196
|
+
...(stored ? {} : { profileBaseUrl: at })
|
|
145
197
|
};
|
|
146
198
|
opts.notify?.((messages.connected ?? defaultConnected)(facts));
|
|
147
199
|
return { outcome: 'connected', key: result.key, result, cached: false, stored };
|
|
148
200
|
}
|
|
201
|
+
/**
|
|
202
|
+
* The stranded-key recovery: what a tool CLI calls once when a request
|
|
203
|
+
* answered 401 with a key that `connectOnDemand` served from the cache
|
|
204
|
+
* (`cached: true`). Evicts that key from the selected profile (the hub
|
|
205
|
+
* revoked it, or a membership was swept), only when that profile is at
|
|
206
|
+
* this instance (a key of another instance is never touched), and runs the
|
|
207
|
+
* exchange again with the cache skipped. The caller retries its request
|
|
208
|
+
* once with the new key and fails on a second 401; `not_cloud` means there
|
|
209
|
+
* is nothing to recover with, and the caller fails with its 401 as it
|
|
210
|
+
* stands.
|
|
211
|
+
*/
|
|
212
|
+
export async function refreshConnectKey(opts) {
|
|
213
|
+
assertToolNamespace(opts.tool);
|
|
214
|
+
const hub = selectHubProfile(opts.env, { cloudUrl: opts.hubCloudUrl });
|
|
215
|
+
const existing = loadConfig(opts.env, opts.tool).profiles[opts.profileName];
|
|
216
|
+
const { place } = placeOf(existing, normalizeUrl(opts.toolBaseUrl), opts.cloudUrl);
|
|
217
|
+
if (hub.name && place === 'here')
|
|
218
|
+
removeConnectKey(opts.env, opts.tool, opts.profileName, hub.name);
|
|
219
|
+
return connectOnDemand({ ...opts, cached: false });
|
|
220
|
+
}
|
|
149
221
|
//# sourceMappingURL=connect-on-demand.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connect-on-demand.js","sourceRoot":"","sources":["../src/connect-on-demand.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,QAAQ,EACR,UAAU,EACV,gBAAgB,EAChB,
|
|
1
|
+
{"version":3,"file":"connect-on-demand.js","sourceRoot":"","sources":["../src/connect-on-demand.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,QAAQ,EACR,UAAU,EACV,gBAAgB,EAChB,eAAe,EAChB,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEjE,OAAO,EACL,aAAa,EACb,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,cAAc,EACd,YAAY,EACZ,aAAa,EACd,MAAM,cAAc,CAAC;AAgEtB;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,WAAmB,EACnB,SAAmC;IAEnC,MAAM,CAAC,GAAG,SAAS,IAAI,UAAU,CAAC,KAAK,C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GAAG,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;AACrD,CAAC"}
|
package/dist/connect.d.ts
CHANGED
|
@@ -10,7 +10,9 @@ import { CliAuthError, type CliAuthMintedKey } from './auth.js';
|
|
|
10
10
|
* offline grant for live as-the-user hub reads). Both are OPAQUE to
|
|
11
11
|
* this client: relayed hub → tool, never inspected or stored. The
|
|
12
12
|
* exchange names NO organization (hub ADR 014): the credential
|
|
13
|
-
* identifies the user;
|
|
13
|
+
* identifies the user; the organization is a per-request parameter
|
|
14
|
+
* tool-side, the hub's server-side default unless `--org` says
|
|
15
|
+
* otherwise.
|
|
14
16
|
* 2. POST {tool}/api/v1/sso/cli-connect — NO auth header (the JWT is
|
|
15
17
|
* the credential), body `{ token, hubRefreshToken }` → the tool
|
|
16
18
|
* verifies, JIT-provisions, stores the grant, and mints an ordinary
|
|
@@ -19,9 +21,10 @@ import { CliAuthError, type CliAuthMintedKey } from './auth.js';
|
|
|
19
21
|
* The hub key is sent to the HUB only — it never reaches the tool. The
|
|
20
22
|
* hubRefreshToken is sent to the TOOL only (it is that tool's own grant;
|
|
21
23
|
* redeeming it needs the tool client's credentials) and never persisted by
|
|
22
|
-
* the CLI. The minted key is cached per (tool, hub profile) in the
|
|
23
|
-
* config namespace (config.ts `connectKeys`)
|
|
24
|
-
*
|
|
24
|
+
* the CLI. The minted key is cached per (tool profile, hub profile) in the
|
|
25
|
+
* tool's config namespace (config.ts `connectKeys`), on the profile of the
|
|
26
|
+
* instance it was minted for; day-to-day tool CLI calls then take the
|
|
27
|
+
* ordinary local API-key path with the hub out of the loop.
|
|
25
28
|
*/
|
|
26
29
|
export type CliConnectStage = 'hub' | 'tool';
|
|
27
30
|
/**
|
|
@@ -31,6 +34,8 @@ export type CliConnectStage = 'hub' | 'tool';
|
|
|
31
34
|
* - hub 400 `unknown_resource` — the resource URL is not in the registry.
|
|
32
35
|
* - `needsHubLogin` — the hub rejected the KEY itself; re-run
|
|
33
36
|
* `antasphere login`.
|
|
37
|
+
* - `refusal` — the account was refused (403), not the key: print the
|
|
38
|
+
* server's own sentence and exit 3. No login fixes it.
|
|
34
39
|
* - `needsReExchange` — the tool rejected the 120 s JWT (expired/replayed
|
|
35
40
|
* in transit); run the exchange again.
|
|
36
41
|
* - tool 429 `rate_limited` — back off and retry.
|
|
@@ -46,6 +51,16 @@ export declare class CliConnectError extends CliAuthError {
|
|
|
46
51
|
get needsHubLogin(): boolean;
|
|
47
52
|
/** The tool rejected the JWT (expired/replayed) — run the exchange again. */
|
|
48
53
|
get needsReExchange(): boolean;
|
|
54
|
+
/**
|
|
55
|
+
* The person was refused, not the credential: a 403 that is not the
|
|
56
|
+
* scope case, from either side (`tool_access_denied` on a restricted
|
|
57
|
+
* tool, `unverified_email`, a grant the tool will not take). `message`
|
|
58
|
+
* is the server's own sentence; a runner prints it as is and exits
|
|
59
|
+
* `exitCode`, 3, the code the tool docs promise for a refusal.
|
|
60
|
+
*/
|
|
61
|
+
get refusal(): boolean;
|
|
62
|
+
/** The exit code a runner uses for this error: 3 for a refusal, 1 otherwise. */
|
|
63
|
+
get exitCode(): number;
|
|
49
64
|
}
|
|
50
65
|
export interface CliToolTokenBody {
|
|
51
66
|
/** The tool's registry resource URL (e.g. `https://app.slideless.ai/mcp`).
|
|
@@ -81,7 +96,7 @@ export interface CliConnected {
|
|
|
81
96
|
}
|
|
82
97
|
/** The flattened outcome of a full exchange. */
|
|
83
98
|
export interface CliConnectResult {
|
|
84
|
-
/** Full tool-local key — user-scoped: ONE per (tool, hub profile),
|
|
99
|
+
/** Full tool-local key — user-scoped: ONE per (tool profile, hub profile),
|
|
85
100
|
* valid for every org the user can select per request (config.ts). */
|
|
86
101
|
key: string;
|
|
87
102
|
apiKey: CliAuthMintedKey;
|
|
@@ -106,7 +121,7 @@ export declare class CliConnectClient {
|
|
|
106
121
|
private readonly toolBaseUrl;
|
|
107
122
|
private readonly fetchImpl;
|
|
108
123
|
constructor(options: CliConnectClientOptions);
|
|
109
|
-
/** Step 1 — the hub mints the 120 s
|
|
124
|
+
/** Step 1 — the hub mints the 120 s user-scoped JWT for the tool's resource. */
|
|
110
125
|
toolToken(hubApiKey: string, body: CliToolTokenBody): Promise<CliToolTokenMinted>;
|
|
111
126
|
/**
|
|
112
127
|
* Step 2 — the tool verifies the JWT (its only credential) and mints its
|
package/dist/connect.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connect.d.ts","sourceRoot":"","sources":["../src/connect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,KAAK,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAEhE
|
|
1
|
+
{"version":3,"file":"connect.d.ts","sourceRoot":"","sources":["../src/connect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,KAAK,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAEhE;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,MAAM,MAAM,eAAe,GAAG,KAAK,GAAG,MAAM,CAAC;AAE7C;;;;;;;;;;;;GAYG;AACH,qBAAa,eAAgB,SAAQ,YAAY;aAE7B,KAAK,EAAE,eAAe;gBAAtB,KAAK,EAAE,eAAe,EACtC,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,OAAO;IAMnB;;;;OAIG;IACH,IAAI,aAAa,IAAI,OAAO,CAK3B;IAED,6EAA6E;IAC7E,IAAI,eAAe,IAAI,OAAO,CAE7B;IAED;;;;;;OAMG;IACH,IAAI,OAAO,IAAI,OAAO,CAErB;IAED,gFAAgF;IAChF,IAAI,QAAQ,IAAI,MAAM,CAErB;CACF;AAED,MAAM,WAAW,gBAAgB;IAC/B;;+DAE2D;IAC3D,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,yEAAyE;AACzE,MAAM,WAAW,kBAAkB;IACjC,8EAA8E;IAC9E,KAAK,EAAE,MAAM,CAAC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