@antasphere/cli-core 0.4.0 → 0.5.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.
@@ -3,25 +3,36 @@ import {
3
3
  HUB_TOOL,
4
4
  loadConfig,
5
5
  lookupConnectKey,
6
- saveConfig,
6
+ removeConnectKey,
7
7
  storeConnectKey
8
8
  } from './config.js';
9
- import type { CliEnv } from './config.js';
9
+ import type { CliEnv, CliProfile } from './config.js';
10
10
  import { CliConnectClient, CliConnectError } from './connect.js';
11
11
  import type { CliConnectResult } from './connect.js';
12
- import { CliUsageError, DEFAULT_PROFILE, resolveProfile } from './resolve.js';
12
+ import {
13
+ CliUsageError,
14
+ firstSet,
15
+ normalizeUrl,
16
+ profileUrl,
17
+ resolveProfile,
18
+ sameInstance
19
+ } from './resolve.js';
13
20
  import type { ResolvedProfile } from './resolve.js';
14
21
 
15
22
  /**
16
23
  * Connect-on-demand (binding patterns §7, gcloud model), extracted from the
17
24
  * Slideless CLI so every Antasphere tool CLI inherits "one `antasphere login`
18
25
  * serves every federated tool". When a tool CLI resolves NO credential of its
19
- * own, it calls `connectOnDemand`:
26
+ * own, it calls `connectOnDemand` with the profile it selected
27
+ * (`selectProfile`: the profile IS the instance):
20
28
  *
21
29
  * 0. The cache is consulted FIRST: a key minted earlier for THIS instance
22
30
  * under the active hub profile is USER-scoped (hub ADR 014) — it serves
23
31
  * every subsequent run and every org, with zero network (no probe, no
24
- * hub round-trip, no fresh mint).
32
+ * hub round-trip, no fresh mint). It is read on the selected profile
33
+ * only when that profile is at the resolved instance (its `baseUrl`,
34
+ * else the tool's `cloudUrl` when the profile has none), so a cached
35
+ * key never travels to another origin. `cached: false` skips this step.
25
36
  * 1. On a miss, discovery gates the flow: only an Antasphere-CLOUD
26
37
  * instance can mint keys through the hub (unauthenticated GET
27
38
  * /instance — never guess). Unreachable, foreign, or self-hosted
@@ -32,13 +43,22 @@ import type { ResolvedProfile } from './resolve.js';
32
43
  * never a hardcoded constant here.
33
44
  * 3. `CliConnectClient.exchange` trades it for a tool-local key (one
34
45
  * re-exchange retry when the 120 s JWT dies in transit; a rejected hub
35
- * credential maps to guided `antasphere login` advice).
36
- * 4. The minted key is cached per (tool, HUB PROFILE) — but only onto a
37
- * profile that names THIS instance (a fresh profile gets pinned to it);
38
- * a profile pointing elsewhere never receives it.
46
+ * credential maps to guided `antasphere login` advice on either
47
+ * attempt; a hub REFUSAL, a 403 that is not the scope case, propagates
48
+ * as its `CliConnectError` with the hub's own sentence and `exitCode`
49
+ * 3).
50
+ * 4. The minted key is cached on the SELECTED profile under the hub
51
+ * profile's name. A profile not on disk yet is created with this
52
+ * instance's URL, and made active only when the tool had no profile at
53
+ * all; an existing profile is never renamed or repointed, and one that
54
+ * is at another instance never receives the key.
55
+ *
56
+ * A stranded key recovers: on a 401 with a key that came from the cache,
57
+ * the tool CLI calls `refreshConnectKey` once (evict, exchange again with
58
+ * `cached: false`) and retries its request once; a second 401 fails.
39
59
  *
40
- * A new tool needs only its namespace, base URL, and copy — the flow itself
41
- * is tool-agnostic.
60
+ * A new tool needs only its namespace, its cloud URL, and copy — the flow
61
+ * itself is tool-agnostic.
42
62
  */
43
63
 
44
64
  /** What the unauthenticated discovery probe learned about a tool instance. */
@@ -101,12 +121,13 @@ export interface ConnectNoticeFacts {
101
121
  toolBaseUrl: string;
102
122
  /** The signed-in account's email at mint. */
103
123
  email: string;
104
- /** Whether the minted key was persisted for the next run (per
105
- * (tool, hub profile)); false = the profile names another instance. */
124
+ /** Whether the minted key was persisted for the next run (on the
125
+ * selected profile, under the hub profile's name); false = the profile
126
+ * is at another instance. */
106
127
  stored: boolean;
107
128
  /** The tool profile the cache targeted. */
108
129
  profileName: string;
109
- /** When NOT stored: the other instance the profile points at. */
130
+ /** When NOT stored: the other instance the profile is at. */
110
131
  profileBaseUrl?: string;
111
132
  }
112
133
 
@@ -151,17 +172,28 @@ export interface ConnectOnDemandOptions {
151
172
  tool: string;
152
173
  /** The resolved tool instance origin the CLI is talking to. */
153
174
  toolBaseUrl: string;
175
+ /** The tool's cloud URL, the same value `selectProfile` got: what a
176
+ * profile with no `baseUrl` of its own is at. Omit only for a tool with
177
+ * no cloud instance. */
178
+ cloudUrl?: string | undefined;
154
179
  /** The exchange resource URL; default = this instance's MCP endpoint,
155
180
  * `${toolBaseUrl}/mcp` (the tool's registered resource URL). */
156
181
  resource?: string;
157
- /** The tool profile the minted key is cached on; default `DEFAULT_PROFILE`. */
158
- profileName?: string;
182
+ /** The tool profile the CLI selected for this run (`selectProfile`), the
183
+ * one the minted key is cached on. Not on disk yet → created with
184
+ * `toolBaseUrl` on first contact; at another instance → the key is
185
+ * returned but never stored. cli-core never guesses it. */
186
+ profileName: string;
159
187
  env: CliEnv;
160
188
  fetch?: typeof globalThis.fetch;
161
189
  /** Receives the human "Connected to …" notice (tools wire their stderr);
162
190
  * omitted = silent. Cache hits are always silent either way. */
163
191
  notify?: (line: string) => void;
164
192
  messages?: ConnectOnDemandMessages;
193
+ /** false = do not read the cache: run the exchange even when a key is
194
+ * cached (the one re-exchange after a 401 on a cached key;
195
+ * `refreshConnectKey` sets it). Default true. */
196
+ cached?: boolean;
165
197
  }
166
198
 
167
199
  export type ConnectOnDemandOutcome =
@@ -169,13 +201,14 @@ export type ConnectOnDemandOutcome =
169
201
  outcome: 'connected';
170
202
  /** The tool-local key — this invocation's credential. */
171
203
  key: string;
172
- /** true = served from the (tool, hub profile) config cache: zero
173
- * network, nothing minted. false = a fresh exchange ran. */
204
+ /** true = served from the (tool profile, hub profile) config cache:
205
+ * zero network, nothing minted. false = a fresh exchange ran. A 401
206
+ * on a `cached: true` key is what warrants `refreshConnectKey`. */
174
207
  cached: boolean;
175
208
  /** Fresh exchanges only: the full result (user, key meta). */
176
209
  result?: CliConnectResult;
177
210
  /** Fresh exchanges only: whether the minted key was persisted for
178
- * the next run (false = the profile names another instance). */
211
+ * the next run (false = the profile is at another instance). */
179
212
  stored?: boolean;
180
213
  }
181
214
  | {
@@ -184,29 +217,50 @@ export type ConnectOnDemandOutcome =
184
217
  outcome: 'not_cloud';
185
218
  };
186
219
 
220
+ /**
221
+ * Where the selected profile stands with respect to the resolved instance:
222
+ * `here` (its `baseUrl`, else the tool's cloud URL, is this instance),
223
+ * `elsewhere` (it is at another instance), or `free` (absent, or with no
224
+ * instance at all: no `baseUrl` and no cloud URL known). The cache is read
225
+ * only when `here`; a key is stored unless `elsewhere`; a key is evicted
226
+ * only when `here`.
227
+ */
228
+ function placeOf(
229
+ existing: CliProfile | undefined,
230
+ toolBaseUrl: string,
231
+ cloudUrl: string | undefined
232
+ ): { place: 'here' | 'elsewhere' | 'free'; at?: string } {
233
+ const at = existing ? profileUrl(existing, cloudUrl) : undefined;
234
+ if (!existing || at === undefined) return { place: 'free' };
235
+ return sameInstance(at, toolBaseUrl) ? { place: 'here', at } : { place: 'elsewhere', at };
236
+ }
237
+
187
238
  /**
188
239
  * The hub → tool exchange fallback a tool CLI runs when no direct credential
189
240
  * resolved. Serves the cached user-scoped key when one exists for this
190
- * (instance, hub profile); otherwise returns `not_cloud` when the instance
191
- * is not an Antasphere-cloud one (or unreachable). Throws a guided
192
- * `CliUsageError` when the instance IS cloud but the hub login is missing or
193
- * rejected; every other exchange failure propagates as its `CliConnectError`.
241
+ * (instance, hub profile) on the selected profile; otherwise returns
242
+ * `not_cloud` when the instance is not an Antasphere-cloud one (or
243
+ * unreachable). Throws a guided `CliUsageError` when the instance IS cloud
244
+ * but the hub login is missing or rejected; a refusal and every other
245
+ * exchange failure propagate as their `CliConnectError` (`exitCode` says 3
246
+ * for the refusal, `message` is the server's own sentence).
194
247
  */
195
248
  export async function connectOnDemand(opts: ConnectOnDemandOptions): Promise<ConnectOnDemandOutcome> {
196
249
  assertToolNamespace(opts.tool);
197
- const toolBaseUrl = opts.toolBaseUrl.replace(/\/+$/, '');
250
+ const toolBaseUrl = normalizeUrl(opts.toolBaseUrl);
198
251
  const messages = opts.messages ?? {};
199
- const profileName = opts.profileName ?? DEFAULT_PROFILE;
252
+ const { profileName } = opts;
200
253
 
201
254
  // 0. The cache: a key minted earlier by the active hub profile is
202
255
  // user-scoped — it serves every run and every org (hub ADR 014; the
203
256
  // org is a per-request parameter, never part of the credential). Only
204
- // a profile that names THIS instance is trusted: a cached key never
205
- // travels to a different instance. A hit costs zero network.
257
+ // the selected profile is read, and only when it is at THIS instance:
258
+ // a cached key never travels to a different instance. A hit costs zero
259
+ // network. `cached: false` (the re-exchange after a 401) skips it.
206
260
  const hub = activeHubProfile(opts.env);
207
261
  const existing = loadConfig(opts.env, opts.tool).profiles[profileName];
208
- const pinnedHere = existing?.baseUrl?.replace(/\/+$/, '') === toolBaseUrl;
209
- if (pinnedHere && hub.name) {
262
+ const { place, at } = placeOf(existing, toolBaseUrl, opts.cloudUrl);
263
+ if (opts.cached !== false && place === 'here' && hub.name) {
210
264
  const cachedKey = lookupConnectKey(existing, hub.name);
211
265
  if (cachedKey) return { outcome: 'connected', key: cachedKey, cached: true };
212
266
  }
@@ -219,8 +273,9 @@ export async function connectOnDemand(opts: ConnectOnDemandOptions): Promise<Con
219
273
  // 2. The hub credential is what `antasphere login` stored on the hub
220
274
  // profile (HUB_TOOL namespace) — one login for the whole tool family.
221
275
  // The hub URL comes from that same profile, never from a constant here.
222
- const hubKey = hub.profile?.apiKey;
223
- const hubBaseUrl = hub.profile?.baseUrl;
276
+ // A blank field is no field (the package's one blank rule, firstSet).
277
+ const hubKey = firstSet(hub.profile?.apiKey);
278
+ const hubBaseUrl = firstSet(hub.profile?.baseUrl);
224
279
  if (!hubKey || !hubBaseUrl || !hub.name) {
225
280
  throw new CliUsageError(messages.missingHubLogin ?? defaultMissingHubLogin(opts.tool));
226
281
  }
@@ -235,38 +290,44 @@ export async function connectOnDemand(opts: ConnectOnDemandOptions): Promise<Con
235
290
  ...(opts.fetch ? { fetch: opts.fetch } : {})
236
291
  });
237
292
  const body = { resource };
293
+ // One attempt, with the hub's verdict on the KEY mapped to the guided
294
+ // login error whichever attempt it comes on. A refusal (403 that is not
295
+ // the scope case) and every wire error propagate as they are: the error
296
+ // carries the server's own sentence and its exit code.
297
+ const attempt = async (): Promise<CliConnectResult> => {
298
+ try {
299
+ return await connect.exchange(hubKey, body);
300
+ } catch (e) {
301
+ if (e instanceof CliConnectError && e.needsHubLogin) {
302
+ throw new CliUsageError(messages.hubLoginRejected ?? DEFAULT_HUB_LOGIN_REJECTED);
303
+ }
304
+ throw e;
305
+ }
306
+ };
238
307
  let result: CliConnectResult;
239
308
  try {
240
- result = await connect.exchange(hubKey, body);
309
+ result = await attempt();
241
310
  } catch (e) {
242
- if (e instanceof CliConnectError && e.needsReExchange) {
243
- // The 120 s JWT died in transit (expired/replayed) — one fresh
244
- // exchange; a second rejection propagates.
245
- result = await connect.exchange(hubKey, body);
246
- } else if (e instanceof CliConnectError && e.needsHubLogin) {
247
- throw new CliUsageError(messages.hubLoginRejected ?? DEFAULT_HUB_LOGIN_REJECTED);
248
- } else {
249
- throw e;
250
- }
311
+ if (!(e instanceof CliConnectError && e.needsReExchange)) throw e;
312
+ // The 120 s JWT died in transit (expired/replayed) — one fresh
313
+ // exchange; a second rejection propagates.
314
+ result = await attempt();
251
315
  }
252
316
 
253
- // 4. Cache the minted key per (tool, hub profile) — but only onto a
254
- // profile that names THIS instance (or a fresh one, which gets pinned
255
- // to it), never onto a profile pointing somewhere else.
256
- const stored = !existing?.baseUrl || pinnedHere;
317
+ // 4. Cache the minted key on the SELECTED profile under the hub profile's
318
+ // name. A profile not on disk yet, or one with no instance of its own,
319
+ // takes this instance's URL; a profile at another instance never
320
+ // receives the key and is never repointed.
321
+ const stored = place !== 'elsewhere';
257
322
  if (stored) {
258
- storeConnectKey(opts.env, opts.tool, profileName, hub.name, {
259
- apiKey: result.key,
260
- email: result.user.email,
261
- mintedAt: new Date().toISOString()
262
- });
263
- if (!existing?.baseUrl) {
264
- // First contact: pin the profile to this instance so the next
265
- // invocation resolves the URL and the cached key with no flags.
266
- const cfg = loadConfig(opts.env, opts.tool);
267
- cfg.profiles[profileName] = { ...cfg.profiles[profileName], baseUrl: toolBaseUrl };
268
- saveConfig(opts.env, opts.tool, cfg);
269
- }
323
+ storeConnectKey(
324
+ opts.env,
325
+ opts.tool,
326
+ profileName,
327
+ hub.name,
328
+ { apiKey: result.key, email: result.user.email, mintedAt: new Date().toISOString() },
329
+ { baseUrl: toolBaseUrl }
330
+ );
270
331
  }
271
332
 
272
333
  const facts: ConnectNoticeFacts = {
@@ -274,10 +335,30 @@ export async function connectOnDemand(opts: ConnectOnDemandOptions): Promise<Con
274
335
  email: result.user.email,
275
336
  stored,
276
337
  profileName,
277
- // `stored` is false only when the profile names another instance.
278
- ...(stored ? {} : { profileBaseUrl: existing?.baseUrl })
338
+ // `stored` is false only when the profile is at another instance.
339
+ ...(stored ? {} : { profileBaseUrl: at })
279
340
  };
280
341
  opts.notify?.((messages.connected ?? defaultConnected)(facts));
281
342
 
282
343
  return { outcome: 'connected', key: result.key, result, cached: false, stored };
283
344
  }
345
+
346
+ /**
347
+ * The stranded-key recovery: what a tool CLI calls once when a request
348
+ * answered 401 with a key that `connectOnDemand` served from the cache
349
+ * (`cached: true`). Evicts that key from the selected profile (the hub
350
+ * revoked it, or a membership was swept), only when that profile is at
351
+ * this instance (a key of another instance is never touched), and runs the
352
+ * exchange again with the cache skipped. The caller retries its request
353
+ * once with the new key and fails on a second 401; `not_cloud` means there
354
+ * is nothing to recover with, and the caller fails with its 401 as it
355
+ * stands.
356
+ */
357
+ export async function refreshConnectKey(opts: ConnectOnDemandOptions): Promise<ConnectOnDemandOutcome> {
358
+ assertToolNamespace(opts.tool);
359
+ const hub = activeHubProfile(opts.env);
360
+ const existing = loadConfig(opts.env, opts.tool).profiles[opts.profileName];
361
+ const { place } = placeOf(existing, normalizeUrl(opts.toolBaseUrl), opts.cloudUrl);
362
+ if (hub.name && place === 'here') removeConnectKey(opts.env, opts.tool, opts.profileName, hub.name);
363
+ return connectOnDemand({ ...opts, cached: false });
364
+ }
package/src/connect.ts CHANGED
@@ -11,7 +11,9 @@ import { CliAuthError, type CliAuthMintedKey } from './auth.js';
11
11
  * offline grant for live as-the-user hub reads). Both are OPAQUE to
12
12
  * this client: relayed hub → tool, never inspected or stored. The
13
13
  * exchange names NO organization (hub ADR 014): the credential
14
- * identifies the user; any org is a per-request selection tool-side.
14
+ * identifies the user; the organization is a per-request parameter
15
+ * tool-side, the hub's server-side default unless `--org` says
16
+ * otherwise.
15
17
  * 2. POST {tool}/api/v1/sso/cli-connect — NO auth header (the JWT is
16
18
  * the credential), body `{ token, hubRefreshToken }` → the tool
17
19
  * verifies, JIT-provisions, stores the grant, and mints an ordinary
@@ -20,9 +22,10 @@ import { CliAuthError, type CliAuthMintedKey } from './auth.js';
20
22
  * The hub key is sent to the HUB only — it never reaches the tool. The
21
23
  * hubRefreshToken is sent to the TOOL only (it is that tool's own grant;
22
24
  * redeeming it needs the tool client's credentials) and never persisted by
23
- * the CLI. The minted key is cached per (tool, hub profile) in the tool's
24
- * config namespace (config.ts `connectKeys`); day-to-day tool CLI calls
25
- * then take the ordinary local API-key path with the hub out of the loop.
25
+ * the CLI. The minted key is cached per (tool profile, hub profile) in the
26
+ * tool's config namespace (config.ts `connectKeys`), on the profile of the
27
+ * instance it was minted for; day-to-day tool CLI calls then take the
28
+ * ordinary local API-key path with the hub out of the loop.
26
29
  */
27
30
 
28
31
  export type CliConnectStage = 'hub' | 'tool';
@@ -34,6 +37,8 @@ export type CliConnectStage = 'hub' | 'tool';
34
37
  * - hub 400 `unknown_resource` — the resource URL is not in the registry.
35
38
  * - `needsHubLogin` — the hub rejected the KEY itself; re-run
36
39
  * `antasphere login`.
40
+ * - `refusal` — the account was refused (403), not the key: print the
41
+ * server's own sentence and exit 3. No login fixes it.
37
42
  * - `needsReExchange` — the tool rejected the 120 s JWT (expired/replayed
38
43
  * in transit); run the exchange again.
39
44
  * - tool 429 `rate_limited` — back off and retry.
@@ -66,6 +71,22 @@ export class CliConnectError extends CliAuthError {
66
71
  get needsReExchange(): boolean {
67
72
  return this.stage === 'tool' && this.status === 401;
68
73
  }
74
+
75
+ /**
76
+ * The person was refused, not the credential: a 403 that is not the
77
+ * scope case, from either side (`tool_access_denied` on a restricted
78
+ * tool, `unverified_email`, a grant the tool will not take). `message`
79
+ * is the server's own sentence; a runner prints it as is and exits
80
+ * `exitCode`, 3, the code the tool docs promise for a refusal.
81
+ */
82
+ get refusal(): boolean {
83
+ return this.status === 403 && !this.needsHubLogin;
84
+ }
85
+
86
+ /** The exit code a runner uses for this error: 3 for a refusal, 1 otherwise. */
87
+ get exitCode(): number {
88
+ return this.refusal ? 3 : 1;
89
+ }
69
90
  }
70
91
 
71
92
  export interface CliToolTokenBody {
@@ -101,7 +122,7 @@ export interface CliConnected {
101
122
 
102
123
  /** The flattened outcome of a full exchange. */
103
124
  export interface CliConnectResult {
104
- /** Full tool-local key — user-scoped: ONE per (tool, hub profile),
125
+ /** Full tool-local key — user-scoped: ONE per (tool profile, hub profile),
105
126
  * valid for every org the user can select per request (config.ts). */
106
127
  key: string;
107
128
  apiKey: CliAuthMintedKey;
@@ -130,7 +151,7 @@ export class CliConnectClient {
130
151
  this.fetchImpl = options.fetch ?? globalThis.fetch.bind(globalThis);
131
152
  }
132
153
 
133
- /** Step 1 — the hub mints the 120 s single-org JWT for the tool's resource. */
154
+ /** Step 1 — the hub mints the 120 s user-scoped JWT for the tool's resource. */
134
155
  toolToken(hubApiKey: string, body: CliToolTokenBody): Promise<CliToolTokenMinted> {
135
156
  return this.call('hub', `${this.hubBaseUrl}/api/v1/sso/tool-token`, body, hubApiKey);
136
157
  }
package/src/index.ts CHANGED
@@ -1,12 +1,16 @@
1
1
  /**
2
2
  * @antasphere/cli-core — the shared foundation every Antasphere tool CLI
3
3
  * builds on (hub-architecture §8): the `~/.config/antasphere/` config home
4
- * with tool-namespaced profiles, the flag → env → profile → default URL
5
- * resolution order, the instance email-OTP auth client, the hub→tool
6
- * cross-tool connect exchange (+ its per-(tool, hub profile) user-scoped
7
- * key cache, the hub-profile org context, and the connect-on-demand seam a
8
- * tool CLI runs when no direct credential resolved), and the CliIo prompt
9
- * seam. Tool
4
+ * with tool-namespaced profiles where A PROFILE IS AN INSTANCE (named for
5
+ * its host, the implicit `cloud` profile at the tool's cloud URL), the
6
+ * profile selection rule (--profile → instance URL → active → cloud), the
7
+ * flag → env → profile → cloud URL resolution order, the per-command
8
+ * organization override (`resolveOrg`; the hub's server-side default
9
+ * organization applies otherwise), the instance email-OTP auth client, the
10
+ * hub→tool cross-tool connect exchange (user-scoped, no org in the
11
+ * exchange) with its per-(tool profile, hub profile) key cache, the
12
+ * connect-on-demand seam a tool CLI runs when no direct credential
13
+ * resolved, the stranded-key recovery, and the CliIo prompt seam. Tool
10
14
  * commands, wire types, and API surfaces live in the tools; this package
11
15
  * carries only config/login plumbing, never secrets.
12
16
  */
@@ -19,18 +23,47 @@ export {
19
23
  loadConfig,
20
24
  lookupConnectKey,
21
25
  parseConfig,
26
+ profileCredential,
22
27
  redactKey,
23
28
  removeConnectKey,
24
29
  saveConfig,
25
30
  storeConnectKey
26
31
  } from './config.js';
27
- export type { CliConfig, CliConnectKey, CliEnv, CliProfile } from './config.js';
32
+ export type {
33
+ CliConfig,
34
+ CliConnectKey,
35
+ CliEnv,
36
+ CliProfile,
37
+ ProfileCredential,
38
+ StoreConnectKeyOptions
39
+ } from './config.js';
28
40
 
29
41
  export { ask, printJson } from './io.js';
30
42
  export type { CliIo } from './io.js';
31
43
 
32
- export { CliUsageError, DEFAULT_PROFILE, resolveApiKey, resolveBaseUrl, resolveProfile } from './resolve.js';
33
- export type { ResolveApiKeyOptions, ResolveBaseUrlOptions, ResolvedProfile } from './resolve.js';
44
+ export {
45
+ CLOUD_PROFILE,
46
+ CliUsageError,
47
+ firstSet,
48
+ normalizeUrl,
49
+ profileNameFor,
50
+ profileUrl,
51
+ resolveApiKey,
52
+ resolveBaseUrl,
53
+ resolveOrg,
54
+ resolveProfile,
55
+ sameInstance,
56
+ selectProfile
57
+ } from './resolve.js';
58
+ export type {
59
+ ProfileSource,
60
+ ResolveApiKeyOptions,
61
+ ResolveBaseUrlOptions,
62
+ ResolveOrgOptions,
63
+ ResolvedProfile,
64
+ SelectProfileOptions,
65
+ SelectedProfile
66
+ } from './resolve.js';
34
67
 
35
68
  export { CliAuthClient, CliAuthError } from './auth.js';
36
69
  export type {
@@ -53,7 +86,12 @@ export type {
53
86
  CliToolTokenMinted
54
87
  } from './connect.js';
55
88
 
56
- export { activeHubProfile, connectOnDemand, probeToolInstance } from './connect-on-demand.js';
89
+ export {
90
+ activeHubProfile,
91
+ connectOnDemand,
92
+ probeToolInstance,
93
+ refreshConnectKey
94
+ } from './connect-on-demand.js';
57
95
  export type {
58
96
  ConnectNoticeFacts,
59
97
  ConnectOnDemandMessages,
@@ -62,8 +100,5 @@ export type {
62
100
  ToolInstanceProbe
63
101
  } from './connect-on-demand.js';
64
102
 
65
- export { getActiveWorkspace, resolveTargetWorkspace, setActiveWorkspace } from './org.js';
66
- export type { OrgContextOptions, ResolveTargetWorkspaceOptions } from './org.js';
67
-
68
103
  export { migrateLegacyConfig } from './migrate.js';
69
104
  export type { LegacyMigrationSpec, MigrationResult } from './migrate.js';