@agentconnect/cli 0.1.5 → 0.1.7
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 +46 -9
- package/dist/providers/claude.d.ts +1 -0
- package/dist/providers/codex.d.ts +1 -0
- package/dist/providers/cursor.d.ts +1 -0
- package/dist/types.d.ts +1 -0
- package/package.json +1 -1
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)) {
|
|
@@ -2742,11 +2762,6 @@ function extractErrorMessage(ev) {
|
|
|
2742
2762
|
if (typeof ev.result === "string" && ev.type === "result") return ev.result;
|
|
2743
2763
|
return null;
|
|
2744
2764
|
}
|
|
2745
|
-
function normalizeCursorEvent(raw) {
|
|
2746
|
-
if (!raw || typeof raw !== "object") return { type: "unknown" };
|
|
2747
|
-
const type = typeof raw.type === "string" ? raw.type : "unknown";
|
|
2748
|
-
return { ...raw, type };
|
|
2749
|
-
}
|
|
2750
2765
|
function runCursorPrompt({
|
|
2751
2766
|
prompt,
|
|
2752
2767
|
resumeSessionId,
|
|
@@ -2838,7 +2853,6 @@ function runCursorPrompt({
|
|
|
2838
2853
|
emit({ type: "final", text });
|
|
2839
2854
|
};
|
|
2840
2855
|
const handleEvent = (ev) => {
|
|
2841
|
-
const normalized = normalizeCursorEvent(ev);
|
|
2842
2856
|
if (ev?.type === "system" && ev?.subtype === "init") {
|
|
2843
2857
|
debugLog("Cursor", "init", {
|
|
2844
2858
|
apiKeySource: ev.apiKeySource || null,
|
|
@@ -3117,6 +3131,7 @@ var providers = {
|
|
|
3117
3131
|
id: "claude",
|
|
3118
3132
|
name: "Claude",
|
|
3119
3133
|
ensureInstalled: ensureClaudeInstalled,
|
|
3134
|
+
fastStatus: getClaudeFastStatus,
|
|
3120
3135
|
status: getClaudeStatus,
|
|
3121
3136
|
update: updateClaude,
|
|
3122
3137
|
login: loginClaude,
|
|
@@ -3128,6 +3143,7 @@ var providers = {
|
|
|
3128
3143
|
id: "codex",
|
|
3129
3144
|
name: "Codex",
|
|
3130
3145
|
ensureInstalled: ensureCodexInstalled,
|
|
3146
|
+
fastStatus: getCodexFastStatus,
|
|
3131
3147
|
status: getCodexStatus,
|
|
3132
3148
|
update: updateCodex,
|
|
3133
3149
|
login: loginCodex,
|
|
@@ -3139,6 +3155,7 @@ var providers = {
|
|
|
3139
3155
|
id: "cursor",
|
|
3140
3156
|
name: "Cursor",
|
|
3141
3157
|
ensureInstalled: ensureCursorInstalled,
|
|
3158
|
+
fastStatus: getCursorFastStatus,
|
|
3142
3159
|
status: getCursorStatus,
|
|
3143
3160
|
update: updateCursor,
|
|
3144
3161
|
login: loginCursor,
|
|
@@ -3408,7 +3425,7 @@ function startDevHost({
|
|
|
3408
3425
|
if (!providerId) return;
|
|
3409
3426
|
recordCapability(`model.${providerId}`);
|
|
3410
3427
|
}
|
|
3411
|
-
async function getCachedStatus(provider) {
|
|
3428
|
+
async function getCachedStatus(provider, options = {}) {
|
|
3412
3429
|
const cached = statusCache.get(provider.id);
|
|
3413
3430
|
const now = Date.now();
|
|
3414
3431
|
if (cached && now - cached.at < statusCacheTtlMs) {
|
|
@@ -3416,6 +3433,26 @@ function startDevHost({
|
|
|
3416
3433
|
}
|
|
3417
3434
|
const existing = statusInFlight.get(provider.id);
|
|
3418
3435
|
if (existing) return existing;
|
|
3436
|
+
if (options.allowFast && provider.fastStatus) {
|
|
3437
|
+
try {
|
|
3438
|
+
const fast = await provider.fastStatus();
|
|
3439
|
+
const startedAt2 = Date.now();
|
|
3440
|
+
const promise2 = provider.status().then((status) => {
|
|
3441
|
+
debugLog("Providers", "status-check", {
|
|
3442
|
+
providerId: provider.id,
|
|
3443
|
+
durationMs: Date.now() - startedAt2,
|
|
3444
|
+
completedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
3445
|
+
});
|
|
3446
|
+
statusCache.set(provider.id, { status, at: Date.now() });
|
|
3447
|
+
return status;
|
|
3448
|
+
}).finally(() => {
|
|
3449
|
+
statusInFlight.delete(provider.id);
|
|
3450
|
+
});
|
|
3451
|
+
statusInFlight.set(provider.id, promise2);
|
|
3452
|
+
return fast;
|
|
3453
|
+
} catch {
|
|
3454
|
+
}
|
|
3455
|
+
}
|
|
3419
3456
|
const startedAt = Date.now();
|
|
3420
3457
|
const promise = provider.status().then((status) => {
|
|
3421
3458
|
debugLog("Providers", "status-check", {
|
|
@@ -3470,7 +3507,7 @@ function startDevHost({
|
|
|
3470
3507
|
const statusEntries = await Promise.all(
|
|
3471
3508
|
Object.values(providers).map(async (provider) => {
|
|
3472
3509
|
try {
|
|
3473
|
-
return [provider.id, await getCachedStatus(provider)];
|
|
3510
|
+
return [provider.id, await getCachedStatus(provider, { allowFast: true })];
|
|
3474
3511
|
} catch {
|
|
3475
3512
|
return [provider.id, { installed: false, loggedIn: false }];
|
|
3476
3513
|
}
|
|
@@ -3491,7 +3528,7 @@ function startDevHost({
|
|
|
3491
3528
|
replyError(socket, id, "AC_ERR_UNSUPPORTED", "Unknown provider");
|
|
3492
3529
|
return;
|
|
3493
3530
|
}
|
|
3494
|
-
const status = await getCachedStatus(provider);
|
|
3531
|
+
const status = await getCachedStatus(provider, { allowFast: true });
|
|
3495
3532
|
reply(socket, id, {
|
|
3496
3533
|
provider: {
|
|
3497
3534
|
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<{
|