@claudexor/harness-cursor 1.0.0 → 2.1.2
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/auth.d.ts +55 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +137 -0
- package/dist/auth.js.map +1 -0
- package/dist/index.d.ts +8 -20
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +193 -183
- package/dist/index.js.map +1 -1
- package/dist/parse.d.ts +3 -2
- package/dist/parse.d.ts.map +1 -1
- package/dist/parse.js +126 -14
- package/dist/parse.js.map +1 -1
- package/package.json +8 -5
package/dist/auth.d.ts
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { AuthPreference, CredentialProfile, CredentialProfileStatus } from "@claudexor/schema";
|
|
2
|
+
import { runCapture } from "@claudexor/core";
|
|
3
|
+
export interface CursorNativeAuthProbe {
|
|
4
|
+
authed: boolean;
|
|
5
|
+
probeError: string | null;
|
|
6
|
+
}
|
|
7
|
+
/** Probe only Cursor's vendor-owned native session in the supplied run env. */
|
|
8
|
+
export declare function probeCursorNativeAuth(env?: Record<string, string | null | undefined>, abortSignal?: AbortSignal, capture?: typeof runCapture): Promise<CursorNativeAuthProbe>;
|
|
9
|
+
export declare function cursorStatusAuthenticated(code: number | null, text: string): boolean;
|
|
10
|
+
export declare function cursorStatusLoggedOut(text: string): boolean;
|
|
11
|
+
export type CursorAuthRoute = "api_key" | "local_session" | "unavailable";
|
|
12
|
+
/** Explicit preferences are strict; auto is invariantly native-first. */
|
|
13
|
+
export declare function selectCursorAuthRoute(input: {
|
|
14
|
+
authPreference: AuthPreference;
|
|
15
|
+
hasKey: boolean;
|
|
16
|
+
apiKeyReady: boolean;
|
|
17
|
+
nativeAuthed: boolean;
|
|
18
|
+
scopedHome: boolean;
|
|
19
|
+
}): CursorAuthRoute;
|
|
20
|
+
export declare function shouldDiscloseCursorAutoApiRoute(input: {
|
|
21
|
+
authPreference: AuthPreference;
|
|
22
|
+
route: CursorAuthRoute;
|
|
23
|
+
nativeAuthed: boolean;
|
|
24
|
+
}): boolean;
|
|
25
|
+
/** A probe error is unknown, not proof that native is unavailable. */
|
|
26
|
+
export declare function shouldSmokeCursorApiKey(input: {
|
|
27
|
+
hasKey: boolean;
|
|
28
|
+
authPreference: AuthPreference;
|
|
29
|
+
nativeAuthed: boolean;
|
|
30
|
+
nativeProbeError: string | null;
|
|
31
|
+
}): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* INV-135: a cursor profile is exactly its secret-ref API key; other kinds,
|
|
34
|
+
* a non-namespaced or foreign-slot ref (which would alias the engine default
|
|
35
|
+
* or route another provider's key), and a missing secret are a typed refusal,
|
|
36
|
+
* never the default ladder. ONE owner for the run route and the doctor probe.
|
|
37
|
+
*/
|
|
38
|
+
export declare function cursorProfileKeyOrRefusal(profile: {
|
|
39
|
+
profile_id: string;
|
|
40
|
+
credential_kind: string;
|
|
41
|
+
secret_ref: string | null;
|
|
42
|
+
}, resolve?: (ref: string) => string | null): {
|
|
43
|
+
key: string;
|
|
44
|
+
} | {
|
|
45
|
+
refusal: string;
|
|
46
|
+
reason: "misconfigured" | "missing_secret";
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Doctor projection for one cursor profile (INV-135, release wave round-15
|
|
50
|
+
* #1): the SAME resolution the run route uses, mapped to a status. PRESENCE
|
|
51
|
+
* is the honest doctor fact for a stored key; liveness stays the API-key
|
|
52
|
+
* smoke's job at run time.
|
|
53
|
+
*/
|
|
54
|
+
export declare function probeCursorCredentialProfile(profile: CredentialProfile, resolve?: (ref: string) => string | null): CredentialProfileStatus;
|
|
55
|
+
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,mBAAm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ED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,EAAE;IACP,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B,EACD,OAAO,GAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,GAAG,IAAoB,GACtD;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,eAAe,GAAG,gBAAgB,CAAA;CAAE,CAmBnF;AAED;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,iBAAiB,EAC1B,OAAO,GAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,GAAG,IAAoB,GACtD,uBAAuB,CAyBzB"}
|
package/dist/auth.js
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { namespacedSecretRefBase, resolveSecret } from "@claudexor/secrets";
|
|
2
|
+
import { CredentialProfileStatus as CredentialProfileStatusSchema } from "@claudexor/schema";
|
|
3
|
+
import { runCapture } from "@claudexor/core";
|
|
4
|
+
import { redactSecrets } from "@claudexor/util";
|
|
5
|
+
const BIN = process.env.CLAUDEXOR_CURSOR_BIN || "cursor-agent";
|
|
6
|
+
const CURSOR_LOGGED_OUT = /not logged in|not authenticated|unauthenticated|authentication required|no account|account\s*:\s*(?:none|unknown|not configured|-)(?:\s|$)|authenticated\s*:\s*(?:false|no|none|0)|logged in\s*:\s*(?:false|no|none|0)/i;
|
|
7
|
+
/** Probe only Cursor's vendor-owned native session in the supplied run env. */
|
|
8
|
+
export async function probeCursorNativeAuth(env, abortSignal, capture = runCapture) {
|
|
9
|
+
try {
|
|
10
|
+
const result = await capture(BIN, ["status"], {
|
|
11
|
+
env,
|
|
12
|
+
timeoutMs: 10_000,
|
|
13
|
+
abortSignal,
|
|
14
|
+
cancelSignal: "SIGTERM",
|
|
15
|
+
cancelKillDelayMs: 0,
|
|
16
|
+
});
|
|
17
|
+
const text = `${result.stdout}\n${result.stderr}`;
|
|
18
|
+
if (cursorStatusAuthenticated(result.code, text))
|
|
19
|
+
return { authed: true, probeError: null };
|
|
20
|
+
if (cursorStatusLoggedOut(text))
|
|
21
|
+
return { authed: false, probeError: null };
|
|
22
|
+
// Status output can contain the signed-in account principal. Unknown
|
|
23
|
+
// output is not evidence and must not be copied into doctor/setup logs.
|
|
24
|
+
const verdict = result.code === 0 ? "returned unrecognized output" : "failed";
|
|
25
|
+
const detail = `cursor-agent status ${verdict} (${result.code ?? result.signal ?? "unknown result"})`;
|
|
26
|
+
return { authed: false, probeError: detail };
|
|
27
|
+
}
|
|
28
|
+
catch (err) {
|
|
29
|
+
return {
|
|
30
|
+
authed: false,
|
|
31
|
+
probeError: redactSecrets(err instanceof Error ? err.message : String(err)).slice(0, 500),
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
export function cursorStatusAuthenticated(code, text) {
|
|
36
|
+
if (code !== 0)
|
|
37
|
+
return false;
|
|
38
|
+
if (cursorStatusLoggedOut(text))
|
|
39
|
+
return false;
|
|
40
|
+
// Accepted grammar is intentionally narrow and vendor-facing: an explicit
|
|
41
|
+
// "logged in" / "authenticated" verdict, or an Account field containing an
|
|
42
|
+
// email-shaped principal. Bare "account" prose is never readiness proof.
|
|
43
|
+
return text
|
|
44
|
+
.replaceAll("\r", "")
|
|
45
|
+
.split("\n")
|
|
46
|
+
.some((rawLine) => {
|
|
47
|
+
const line = rawLine.trim().replace(/^✓\s+/, "");
|
|
48
|
+
return (/^logged in(?:\s+as\s+\S+)?[.!]?$/i.test(line) ||
|
|
49
|
+
/^authenticated[.!]?$/i.test(line) ||
|
|
50
|
+
/^account\s*:\s*[^\s@]+@[^\s@]+\.[^\s@]+$/i.test(line));
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
export function cursorStatusLoggedOut(text) {
|
|
54
|
+
return CURSOR_LOGGED_OUT.test(text);
|
|
55
|
+
}
|
|
56
|
+
/** Explicit preferences are strict; auto is invariantly native-first. */
|
|
57
|
+
export function selectCursorAuthRoute(input) {
|
|
58
|
+
const keyRouteReady = input.hasKey && input.apiKeyReady;
|
|
59
|
+
if (input.authPreference === "api_key")
|
|
60
|
+
return keyRouteReady ? "api_key" : "unavailable";
|
|
61
|
+
if (input.authPreference === "subscription")
|
|
62
|
+
return input.nativeAuthed ? "local_session" : "unavailable";
|
|
63
|
+
if (input.nativeAuthed)
|
|
64
|
+
return "local_session";
|
|
65
|
+
return keyRouteReady ? "api_key" : "unavailable";
|
|
66
|
+
}
|
|
67
|
+
export function shouldDiscloseCursorAutoApiRoute(input) {
|
|
68
|
+
return input.authPreference === "auto" && input.route === "api_key";
|
|
69
|
+
}
|
|
70
|
+
/** A probe error is unknown, not proof that native is unavailable. */
|
|
71
|
+
export function shouldSmokeCursorApiKey(input) {
|
|
72
|
+
if (!input.hasKey || input.authPreference === "subscription")
|
|
73
|
+
return false;
|
|
74
|
+
if (input.authPreference === "api_key")
|
|
75
|
+
return true;
|
|
76
|
+
return !input.nativeAuthed && input.nativeProbeError === null;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* INV-135: a cursor profile is exactly its secret-ref API key; other kinds,
|
|
80
|
+
* a non-namespaced or foreign-slot ref (which would alias the engine default
|
|
81
|
+
* or route another provider's key), and a missing secret are a typed refusal,
|
|
82
|
+
* never the default ladder. ONE owner for the run route and the doctor probe.
|
|
83
|
+
*/
|
|
84
|
+
export function cursorProfileKeyOrRefusal(profile, resolve = resolveSecret) {
|
|
85
|
+
if (profile.credential_kind !== "api_key")
|
|
86
|
+
return {
|
|
87
|
+
refusal: `credential profile "${profile.profile_id}": cursor supports only the api_key transport`,
|
|
88
|
+
reason: "misconfigured",
|
|
89
|
+
};
|
|
90
|
+
const ref = profile.secret_ref ?? "";
|
|
91
|
+
if (namespacedSecretRefBase(ref) !== "cursor")
|
|
92
|
+
return {
|
|
93
|
+
refusal: `credential profile "${profile.profile_id}": api_key secret_ref must use a namespaced cursor slot (base:profile, e.g. cursor:${profile.profile_id}; got "${ref}")`,
|
|
94
|
+
reason: "misconfigured",
|
|
95
|
+
};
|
|
96
|
+
const key = resolve(ref);
|
|
97
|
+
if (!key)
|
|
98
|
+
return {
|
|
99
|
+
refusal: `credential profile "${profile.profile_id}": secret "${ref}" is not stored`,
|
|
100
|
+
reason: "missing_secret",
|
|
101
|
+
};
|
|
102
|
+
return { key };
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Doctor projection for one cursor profile (INV-135, release wave round-15
|
|
106
|
+
* #1): the SAME resolution the run route uses, mapped to a status. PRESENCE
|
|
107
|
+
* is the honest doctor fact for a stored key; liveness stays the API-key
|
|
108
|
+
* smoke's job at run time.
|
|
109
|
+
*/
|
|
110
|
+
export function probeCursorCredentialProfile(profile, resolve = resolveSecret) {
|
|
111
|
+
const base = { profile_id: profile.profile_id, harness_id: "cursor" };
|
|
112
|
+
try {
|
|
113
|
+
const gate = cursorProfileKeyOrRefusal(profile, resolve);
|
|
114
|
+
if ("refusal" in gate)
|
|
115
|
+
return CredentialProfileStatusSchema.parse({
|
|
116
|
+
...base,
|
|
117
|
+
availability: "unavailable",
|
|
118
|
+
verification: gate.reason === "missing_secret" ? "not_run" : "failed",
|
|
119
|
+
detail: gate.refusal,
|
|
120
|
+
});
|
|
121
|
+
return CredentialProfileStatusSchema.parse({
|
|
122
|
+
...base,
|
|
123
|
+
availability: "available",
|
|
124
|
+
verification: "not_run",
|
|
125
|
+
detail: `secret "${profile.secret_ref}" is stored`,
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
catch (err) {
|
|
129
|
+
return CredentialProfileStatusSchema.parse({
|
|
130
|
+
...base,
|
|
131
|
+
availability: "unavailable",
|
|
132
|
+
verification: "failed",
|
|
133
|
+
detail: redactSecrets(err instanceof Error ? err.message : String(err)).slice(0, 300),
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
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AK,CAAC;YACzC,GAAG,IAAI;YACP,YAAY,EAAE,aAAa;YAC3B,YAAY,EAAE,QAAQ;YACtB,MAAM,EAAE,aAAa,CAAC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC;SACtF,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { HarnessModel } from "@claudexor/schema";
|
|
2
2
|
import type { HarnessAdapter } from "@claudexor/core";
|
|
3
3
|
import { runCapture, runCliHarness as runCliHarnessDefault } from "@claudexor/core";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export
|
|
4
|
+
export { parseCursorModelList } from "./parse.js";
|
|
5
|
+
import { probeCursorNativeAuth } from "./auth.js";
|
|
6
|
+
export { cursorStatusAuthenticated, cursorStatusLoggedOut, selectCursorAuthRoute, shouldDiscloseCursorAutoApiRoute, } from "./auth.js";
|
|
7
|
+
declare function detectVersion(abortSignal?: AbortSignal): Promise<string | null>;
|
|
7
8
|
declare function cursorApiKey(env?: Record<string, string | null | undefined>): string | null;
|
|
8
|
-
type CursorAuthRoute = "api_key" | "local_session" | "unavailable";
|
|
9
9
|
type CursorApiSmokeResult = {
|
|
10
10
|
ok: boolean;
|
|
11
11
|
detail: string;
|
|
@@ -21,7 +21,7 @@ type CursorApiSmokeOptions = {
|
|
|
21
21
|
};
|
|
22
22
|
type CursorRuntimeDeps = {
|
|
23
23
|
detectVersion: typeof detectVersion;
|
|
24
|
-
nativeAuthOk: typeof
|
|
24
|
+
nativeAuthOk: typeof probeCursorNativeAuth;
|
|
25
25
|
cursorApiKey: typeof cursorApiKey;
|
|
26
26
|
listCursorModels: typeof listCursorModels;
|
|
27
27
|
smokeIsolatedApiKey: typeof smokeIsolatedApiKey;
|
|
@@ -30,20 +30,9 @@ type CursorRuntimeDeps = {
|
|
|
30
30
|
apiSmokeFailureCacheTtlMs: number;
|
|
31
31
|
nowMs: () => number;
|
|
32
32
|
runCliHarness: typeof runCliHarnessDefault;
|
|
33
|
+
/** INV-062: profile secrets are resolved transiently, never logged. */
|
|
34
|
+
resolveProfileSecret: (ref: string) => string | null;
|
|
33
35
|
};
|
|
34
|
-
export declare function selectCursorAuthRoute(input: {
|
|
35
|
-
authPreference: AuthPreference;
|
|
36
|
-
hasKey: boolean;
|
|
37
|
-
apiKeyReady: boolean;
|
|
38
|
-
nativeAuthed: boolean;
|
|
39
|
-
scopedHome: boolean;
|
|
40
|
-
}): CursorAuthRoute;
|
|
41
|
-
export declare function shouldDiscloseCursorAutoApiRoute(input: {
|
|
42
|
-
authPreference: AuthPreference;
|
|
43
|
-
route: CursorAuthRoute;
|
|
44
|
-
nativeAuthed: boolean;
|
|
45
|
-
}): boolean;
|
|
46
|
-
export declare function parseCursorModelList(text: string): HarnessModel[];
|
|
47
36
|
export declare function cursorApiSmokeFinalText(stdout: string): string | null;
|
|
48
37
|
export declare function cursorApiSmokeUsedEnvKey(stdout: string): boolean;
|
|
49
38
|
export declare function cursorApiSmokePassed(code: number | null, stdout: string): boolean;
|
|
@@ -55,5 +44,4 @@ export declare function cleanupCursorSmokeBase(base: string, opts?: {
|
|
|
55
44
|
export declare function smokeIsolatedApiKey(key?: string | null, options?: CursorApiSmokeOptions): Promise<CursorApiSmokeResult>;
|
|
56
45
|
declare function listCursorModels(env?: Record<string, string | null | undefined>): Promise<HarnessModel[]>;
|
|
57
46
|
export declare function createCursorAdapter(deps?: Partial<CursorRuntimeDeps>): HarnessAdapter;
|
|
58
|
-
export {};
|
|
59
47
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAA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