@agentconnect/cli 0.1.5 → 0.1.6

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/dist/index.js CHANGED
@@ -938,6 +938,12 @@ async function getClaudeStatus() {
938
938
  const updateInfo = installed ? getClaudeUpdateSnapshot(resolved || null) : {};
939
939
  return { installed, loggedIn, version: versionCheck.version || void 0, ...updateInfo };
940
940
  }
941
+ async function getClaudeFastStatus() {
942
+ const command2 = getClaudeCommand();
943
+ const installed = commandExists(command2);
944
+ const loggedIn = installed ? await hasClaudeAuth() : false;
945
+ return { installed, loggedIn };
946
+ }
941
947
  async function updateClaude() {
942
948
  const command2 = getClaudeCommand();
943
949
  if (!commandExists(command2)) {
@@ -1670,6 +1676,12 @@ ${result.stderr}`.toLowerCase();
1670
1676
  const updateInfo = installed ? getCodexUpdateSnapshot(resolved || null) : {};
1671
1677
  return { installed, loggedIn, version: versionCheck.version || void 0, ...updateInfo };
1672
1678
  }
1679
+ async function getCodexFastStatus() {
1680
+ const command2 = getCodexCommand();
1681
+ const loggedIn = await hasCodexAuth();
1682
+ const installed = commandExists(command2) || loggedIn;
1683
+ return { installed, loggedIn };
1684
+ }
1673
1685
  async function updateCodex() {
1674
1686
  const command2 = getCodexCommand();
1675
1687
  if (!commandExists(command2)) {
@@ -2545,6 +2557,14 @@ ${result.stderr}`;
2545
2557
  const updateInfo = installed ? getCursorUpdateSnapshot(resolved || null) : {};
2546
2558
  return { installed, loggedIn, version: versionCheck.version || void 0, ...updateInfo };
2547
2559
  }
2560
+ async function getCursorFastStatus() {
2561
+ const command2 = getCursorCommand();
2562
+ const installed = commandExists(command2);
2563
+ if (!installed) {
2564
+ return { installed: false, loggedIn: false };
2565
+ }
2566
+ return { installed: true, loggedIn: true };
2567
+ }
2548
2568
  async function updateCursor() {
2549
2569
  const command2 = getCursorCommand();
2550
2570
  if (!commandExists(command2)) {
@@ -3117,6 +3137,7 @@ var providers = {
3117
3137
  id: "claude",
3118
3138
  name: "Claude",
3119
3139
  ensureInstalled: ensureClaudeInstalled,
3140
+ fastStatus: getClaudeFastStatus,
3120
3141
  status: getClaudeStatus,
3121
3142
  update: updateClaude,
3122
3143
  login: loginClaude,
@@ -3128,6 +3149,7 @@ var providers = {
3128
3149
  id: "codex",
3129
3150
  name: "Codex",
3130
3151
  ensureInstalled: ensureCodexInstalled,
3152
+ fastStatus: getCodexFastStatus,
3131
3153
  status: getCodexStatus,
3132
3154
  update: updateCodex,
3133
3155
  login: loginCodex,
@@ -3139,6 +3161,7 @@ var providers = {
3139
3161
  id: "cursor",
3140
3162
  name: "Cursor",
3141
3163
  ensureInstalled: ensureCursorInstalled,
3164
+ fastStatus: getCursorFastStatus,
3142
3165
  status: getCursorStatus,
3143
3166
  update: updateCursor,
3144
3167
  login: loginCursor,
@@ -3408,7 +3431,7 @@ function startDevHost({
3408
3431
  if (!providerId) return;
3409
3432
  recordCapability(`model.${providerId}`);
3410
3433
  }
3411
- async function getCachedStatus(provider) {
3434
+ async function getCachedStatus(provider, options = {}) {
3412
3435
  const cached = statusCache.get(provider.id);
3413
3436
  const now = Date.now();
3414
3437
  if (cached && now - cached.at < statusCacheTtlMs) {
@@ -3416,6 +3439,26 @@ function startDevHost({
3416
3439
  }
3417
3440
  const existing = statusInFlight.get(provider.id);
3418
3441
  if (existing) return existing;
3442
+ if (options.allowFast && provider.fastStatus) {
3443
+ try {
3444
+ const fast = await provider.fastStatus();
3445
+ const startedAt2 = Date.now();
3446
+ const promise2 = provider.status().then((status) => {
3447
+ debugLog("Providers", "status-check", {
3448
+ providerId: provider.id,
3449
+ durationMs: Date.now() - startedAt2,
3450
+ completedAt: (/* @__PURE__ */ new Date()).toISOString()
3451
+ });
3452
+ statusCache.set(provider.id, { status, at: Date.now() });
3453
+ return status;
3454
+ }).finally(() => {
3455
+ statusInFlight.delete(provider.id);
3456
+ });
3457
+ statusInFlight.set(provider.id, promise2);
3458
+ return fast;
3459
+ } catch {
3460
+ }
3461
+ }
3419
3462
  const startedAt = Date.now();
3420
3463
  const promise = provider.status().then((status) => {
3421
3464
  debugLog("Providers", "status-check", {
@@ -3470,7 +3513,7 @@ function startDevHost({
3470
3513
  const statusEntries = await Promise.all(
3471
3514
  Object.values(providers).map(async (provider) => {
3472
3515
  try {
3473
- return [provider.id, await getCachedStatus(provider)];
3516
+ return [provider.id, await getCachedStatus(provider, { allowFast: true })];
3474
3517
  } catch {
3475
3518
  return [provider.id, { installed: false, loggedIn: false }];
3476
3519
  }
@@ -3491,7 +3534,7 @@ function startDevHost({
3491
3534
  replyError(socket, id, "AC_ERR_UNSUPPORTED", "Unknown provider");
3492
3535
  return;
3493
3536
  }
3494
- const status = await getCachedStatus(provider);
3537
+ const status = await getCachedStatus(provider, { allowFast: true });
3495
3538
  reply(socket, id, {
3496
3539
  provider: {
3497
3540
  id: provider.id,
@@ -4,6 +4,7 @@ export declare function listClaudeModels(): Promise<ModelInfo[]>;
4
4
  export declare function listClaudeRecentModels(): Promise<ModelInfo[]>;
5
5
  export declare function ensureClaudeInstalled(): Promise<InstallResult>;
6
6
  export declare function getClaudeStatus(): Promise<ProviderStatus>;
7
+ export declare function getClaudeFastStatus(): Promise<ProviderStatus>;
7
8
  export declare function updateClaude(): Promise<ProviderStatus>;
8
9
  export declare function loginClaude(options?: ProviderLoginOptions): Promise<{
9
10
  loggedIn: boolean;
@@ -2,6 +2,7 @@ import type { ProviderStatus, ModelInfo, RunPromptOptions, RunPromptResult, Inst
2
2
  export declare function getCodexCommand(): string;
3
3
  export declare function ensureCodexInstalled(): Promise<InstallResult>;
4
4
  export declare function getCodexStatus(): Promise<ProviderStatus>;
5
+ export declare function getCodexFastStatus(): Promise<ProviderStatus>;
5
6
  export declare function updateCodex(): Promise<ProviderStatus>;
6
7
  export declare function loginCodex(): Promise<{
7
8
  loggedIn: boolean;
@@ -3,6 +3,7 @@ export declare function getCursorCommand(): string;
3
3
  export declare function listCursorModels(): Promise<ModelInfo[]>;
4
4
  export declare function ensureCursorInstalled(): Promise<InstallResult>;
5
5
  export declare function getCursorStatus(): Promise<ProviderStatus>;
6
+ export declare function getCursorFastStatus(): Promise<ProviderStatus>;
6
7
  export declare function updateCursor(): Promise<ProviderStatus>;
7
8
  export declare function loginCursor(options?: ProviderLoginOptions): Promise<{
8
9
  loggedIn: boolean;
package/dist/types.d.ts CHANGED
@@ -169,6 +169,7 @@ export interface Provider {
169
169
  id: ProviderId;
170
170
  name: string;
171
171
  ensureInstalled(): Promise<InstallResult>;
172
+ fastStatus?(): Promise<ProviderStatus>;
172
173
  status(): Promise<ProviderStatus>;
173
174
  update(): Promise<ProviderStatus>;
174
175
  login(options?: ProviderLoginOptions): Promise<{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentconnect/cli",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "homepage": "https://github.com/rayzhudev/agent-connect",