@claudexor/harness-cursor 1.0.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/LICENSE +21 -0
- package/README.md +7 -0
- package/dist/index.d.ts +59 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +674 -0
- package/dist/index.js.map +1 -0
- package/dist/parse.d.ts +17 -0
- package/dist/parse.d.ts.map +1 -0
- package/dist/parse.js +164 -0
- package/dist/parse.js.map +1 -0
- package/package.json +43 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 joi-lab
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# @claudexor/harness-cursor
|
|
2
|
+
|
|
3
|
+
Internal package of [Claudexor](https://github.com/razzant/claudexor) — Cursor CLI adapter (cursor-agent -p --output-format stream-json).
|
|
4
|
+
|
|
5
|
+
Published as part of the Claudexor toolchain; it follows the monorepo's
|
|
6
|
+
lockstep version and has no separate semver contract. Use the `claudexor`
|
|
7
|
+
CLI (or `@claudexor/cli`) as the supported entry point.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { AuthPreference, HarnessModel } from "@claudexor/schema";
|
|
2
|
+
import type { HarnessAdapter } from "@claudexor/core";
|
|
3
|
+
import { runCapture, runCliHarness as runCliHarnessDefault } from "@claudexor/core";
|
|
4
|
+
declare function detectVersion(): Promise<string | null>;
|
|
5
|
+
declare function nativeAuthOk(env?: Record<string, string | null | undefined>): Promise<boolean>;
|
|
6
|
+
export declare function cursorStatusAuthenticated(code: number | null, text: string): boolean;
|
|
7
|
+
declare function cursorApiKey(env?: Record<string, string | null | undefined>): string | null;
|
|
8
|
+
type CursorAuthRoute = "api_key" | "local_session" | "unavailable";
|
|
9
|
+
type CursorApiSmokeResult = {
|
|
10
|
+
ok: boolean;
|
|
11
|
+
detail: string;
|
|
12
|
+
};
|
|
13
|
+
type CursorApiSmokeCacheEntry = {
|
|
14
|
+
result: CursorApiSmokeResult;
|
|
15
|
+
expiresAtMs: number;
|
|
16
|
+
};
|
|
17
|
+
type CursorApiSmokeOptions = {
|
|
18
|
+
makeBaseDir?: () => string;
|
|
19
|
+
runCapture?: typeof runCapture;
|
|
20
|
+
cleanupBase?: typeof cleanupCursorSmokeBase;
|
|
21
|
+
};
|
|
22
|
+
type CursorRuntimeDeps = {
|
|
23
|
+
detectVersion: typeof detectVersion;
|
|
24
|
+
nativeAuthOk: typeof nativeAuthOk;
|
|
25
|
+
cursorApiKey: typeof cursorApiKey;
|
|
26
|
+
listCursorModels: typeof listCursorModels;
|
|
27
|
+
smokeIsolatedApiKey: typeof smokeIsolatedApiKey;
|
|
28
|
+
apiSmokeCache: Map<string, CursorApiSmokeCacheEntry>;
|
|
29
|
+
apiSmokeCacheTtlMs: number;
|
|
30
|
+
apiSmokeFailureCacheTtlMs: number;
|
|
31
|
+
nowMs: () => number;
|
|
32
|
+
runCliHarness: typeof runCliHarnessDefault;
|
|
33
|
+
};
|
|
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
|
+
export declare function cursorApiSmokeFinalText(stdout: string): string | null;
|
|
48
|
+
export declare function cursorApiSmokeUsedEnvKey(stdout: string): boolean;
|
|
49
|
+
export declare function cursorApiSmokePassed(code: number | null, stdout: string): boolean;
|
|
50
|
+
export declare function cleanupCursorSmokeBase(base: string, opts?: {
|
|
51
|
+
remove?: (path: string) => void;
|
|
52
|
+
sleepMs?: (ms: number) => Promise<void>;
|
|
53
|
+
retries?: number;
|
|
54
|
+
}): Promise<void>;
|
|
55
|
+
export declare function smokeIsolatedApiKey(key?: string | null, options?: CursorApiSmokeOptions): Promise<CursorApiSmokeResult>;
|
|
56
|
+
declare function listCursorModels(env?: Record<string, string | null | undefined>): Promise<HarnessModel[]>;
|
|
57
|
+
export declare function createCursorAdapter(deps?: Partial<CursorRuntimeDeps>): HarnessAdapter;
|
|
58
|
+
export {};
|
|
59
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|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,CAAC,IAAI,CAAC,CAAC;IACxC,OAAO,CAAC,EAAE,MAAM,CAAC;CACb,GACL,OAAO,CAAC,IAAI,CAAC,CAcf;AAmBD,wBAAsB,mBAAmB,CACvC,GAAG,GAAE,MAAM,GAAG,IAAqB,EACnC,OAAO,GAAE,qBAA0B,GAClC,OAAO,CAAC,oBAAoB,CAAC,CAoC/B;AAqBD,iBAAe,gBAAgB,CAC7B,GAAG,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAA6B,GACzE,OAAO,CAAC,YAAY,EAAE,CAAC,CAQzB;AA+GD,wBAAgB,mBAAmB,CAAC,IAAI,GAAE,OAAO,CAAC,iBAAiB,CAAM,GAAG,cAAc,CA4LzF"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,674 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { existsSync, mkdirSync, mkdtempSync, rmSync, symlinkSync } from "node:fs";
|
|
3
|
+
import { tmpdir } from "node:os";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
import { ConformanceReport as ConformanceReportSchema, HarnessCapabilityProfile as HarnessCapabilityProfileSchema, HarnessManifest as HarnessManifestSchema, } from "@claudexor/schema";
|
|
6
|
+
import { HarnessUnavailableError, needsScopedHomeKeychainBridge, providerScrubEnv, runCapture, runCliHarness as runCliHarnessDefault, } from "@claudexor/core";
|
|
7
|
+
import { resolveSecret } from "@claudexor/secrets";
|
|
8
|
+
import { CLAUDEXOR_VERSION, nowIso, redactSecrets } from "@claudexor/util";
|
|
9
|
+
import { createCursorParser } from "./parse.js";
|
|
10
|
+
const BIN = process.env.CLAUDEXOR_CURSOR_BIN || "cursor-agent";
|
|
11
|
+
// Long enough for one sequential reviewer panel pass; still bounded so revoked
|
|
12
|
+
// keys do not remain smoke-proven for a whole daemon lifetime.
|
|
13
|
+
const CURSOR_API_SMOKE_CACHE_TTL_MS = 60 * 60_000;
|
|
14
|
+
const CURSOR_API_SMOKE_FAILURE_CACHE_TTL_MS = 30_000;
|
|
15
|
+
const CURSOR_CAPABILITY_PROFILE = HarnessCapabilityProfileSchema.parse({
|
|
16
|
+
auth: {
|
|
17
|
+
supported_sources: ["native_session", "api_key_env"],
|
|
18
|
+
preferred_source: null,
|
|
19
|
+
credential_transports: [
|
|
20
|
+
{ source: "native_session", kind: "os_keychain", relocatable_by: ["HOME"] },
|
|
21
|
+
{ source: "api_key_env", kind: "env_var", relocatable_by: ["ENV"] },
|
|
22
|
+
],
|
|
23
|
+
},
|
|
24
|
+
access_control: { readonly_mechanism: "fs_sandbox" },
|
|
25
|
+
isolation: {
|
|
26
|
+
supported_containment: ["scoped_home_keychain_bridge", "env_or_file_injection"],
|
|
27
|
+
},
|
|
28
|
+
image_input: "none",
|
|
29
|
+
});
|
|
30
|
+
function accessArgs(access) {
|
|
31
|
+
switch (access) {
|
|
32
|
+
case "readonly":
|
|
33
|
+
return ["--sandbox", "enabled", "--trust"];
|
|
34
|
+
case "workspace_write":
|
|
35
|
+
// `--force` alone force-allows commands with NO sandbox — materially
|
|
36
|
+
// broader than claude acceptEdits / codex --sandbox workspace-write for
|
|
37
|
+
// the same profile. Keep the sandbox on for workspace_write parity.
|
|
38
|
+
return ["--force", "--sandbox", "enabled", "--trust"];
|
|
39
|
+
case "full":
|
|
40
|
+
case "external_sandbox_full":
|
|
41
|
+
return ["--force", "--sandbox", "disabled", "--trust"];
|
|
42
|
+
case "inherit_native":
|
|
43
|
+
return ["--trust"];
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
async function detectVersion() {
|
|
47
|
+
try {
|
|
48
|
+
const r = await runCapture(BIN, ["--version"], { timeoutMs: 10_000 });
|
|
49
|
+
return r.stdout.trim() || `${BIN} (version unknown)`;
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
async function nativeAuthOk(env) {
|
|
56
|
+
try {
|
|
57
|
+
const r = await runCapture(BIN, ["status"], { env, timeoutMs: 10_000 });
|
|
58
|
+
return cursorStatusAuthenticated(r.code, `${r.stdout}\n${r.stderr}`);
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
export function cursorStatusAuthenticated(code, text) {
|
|
65
|
+
if (code !== 0)
|
|
66
|
+
return false;
|
|
67
|
+
const normalized = text.toLowerCase();
|
|
68
|
+
if (normalized.includes("not logged in") || normalized.includes("authentication required"))
|
|
69
|
+
return false;
|
|
70
|
+
return (normalized.includes("logged in") ||
|
|
71
|
+
normalized.includes("authenticated") ||
|
|
72
|
+
normalized.includes("account"));
|
|
73
|
+
}
|
|
74
|
+
function cursorApiKey(env) {
|
|
75
|
+
if (env && Object.prototype.hasOwnProperty.call(env, "CLAUDEXOR_CURSOR_API_KEY"))
|
|
76
|
+
return env["CLAUDEXOR_CURSOR_API_KEY"] || null;
|
|
77
|
+
if (env && Object.prototype.hasOwnProperty.call(env, "CURSOR_API_KEY"))
|
|
78
|
+
return env["CURSOR_API_KEY"] || null;
|
|
79
|
+
return (process.env.CLAUDEXOR_CURSOR_API_KEY ||
|
|
80
|
+
resolveSecret("cursor") ||
|
|
81
|
+
process.env.CURSOR_API_KEY ||
|
|
82
|
+
null);
|
|
83
|
+
}
|
|
84
|
+
export function selectCursorAuthRoute(input) {
|
|
85
|
+
const keyRouteReady = input.hasKey && input.apiKeyReady;
|
|
86
|
+
if (input.authPreference === "api_key") {
|
|
87
|
+
if (keyRouteReady)
|
|
88
|
+
return "api_key";
|
|
89
|
+
if (input.nativeAuthed)
|
|
90
|
+
return "local_session";
|
|
91
|
+
return "unavailable";
|
|
92
|
+
}
|
|
93
|
+
if (input.authPreference === "subscription") {
|
|
94
|
+
if (input.nativeAuthed)
|
|
95
|
+
return "local_session";
|
|
96
|
+
return "unavailable";
|
|
97
|
+
}
|
|
98
|
+
if (input.scopedHome && keyRouteReady)
|
|
99
|
+
return "api_key";
|
|
100
|
+
if (input.nativeAuthed)
|
|
101
|
+
return "local_session";
|
|
102
|
+
if (keyRouteReady)
|
|
103
|
+
return "api_key";
|
|
104
|
+
return "unavailable";
|
|
105
|
+
}
|
|
106
|
+
export function shouldDiscloseCursorAutoApiRoute(input) {
|
|
107
|
+
return input.authPreference === "auto" && input.route === "api_key" && input.nativeAuthed;
|
|
108
|
+
}
|
|
109
|
+
function shouldSmokeCursorApiKey(input) {
|
|
110
|
+
if (!input.hasKey)
|
|
111
|
+
return false;
|
|
112
|
+
if (input.authPreference === "subscription")
|
|
113
|
+
return false;
|
|
114
|
+
if (input.authPreference === "api_key")
|
|
115
|
+
return true;
|
|
116
|
+
return !input.nativeAuthed || input.scopedHome;
|
|
117
|
+
}
|
|
118
|
+
function isCursorModelId(id) {
|
|
119
|
+
if (!id)
|
|
120
|
+
return false;
|
|
121
|
+
if (/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/.test(id))
|
|
122
|
+
return false;
|
|
123
|
+
for (const ch of id) {
|
|
124
|
+
if ((ch >= "a" && ch <= "z") ||
|
|
125
|
+
(ch >= "A" && ch <= "Z") ||
|
|
126
|
+
(ch >= "0" && ch <= "9") ||
|
|
127
|
+
ch === "-" ||
|
|
128
|
+
ch === "." ||
|
|
129
|
+
ch === "_" ||
|
|
130
|
+
ch === "/" ||
|
|
131
|
+
ch === ":")
|
|
132
|
+
continue;
|
|
133
|
+
return false;
|
|
134
|
+
}
|
|
135
|
+
return true;
|
|
136
|
+
}
|
|
137
|
+
export function parseCursorModelList(text) {
|
|
138
|
+
const out = [];
|
|
139
|
+
const seen = new Set();
|
|
140
|
+
for (const rawLine of text.replaceAll("\r", "").split("\n")) {
|
|
141
|
+
const line = rawLine.trim();
|
|
142
|
+
if (!line || line === "Available models" || line.startsWith("Tip:"))
|
|
143
|
+
continue;
|
|
144
|
+
const sep = line.indexOf(" - ");
|
|
145
|
+
if (sep <= 0)
|
|
146
|
+
continue;
|
|
147
|
+
const id = line.slice(0, sep).trim();
|
|
148
|
+
const label = line.slice(sep + 3).trim() || null;
|
|
149
|
+
if (!isCursorModelId(id) || seen.has(id))
|
|
150
|
+
continue;
|
|
151
|
+
seen.add(id);
|
|
152
|
+
out.push({ id, label, context_window: null });
|
|
153
|
+
}
|
|
154
|
+
return out;
|
|
155
|
+
}
|
|
156
|
+
export function cursorApiSmokeFinalText(stdout) {
|
|
157
|
+
const replies = [];
|
|
158
|
+
for (const rawLine of stdout.replaceAll("\r", "").split("\n")) {
|
|
159
|
+
const line = rawLine.trim();
|
|
160
|
+
if (!line)
|
|
161
|
+
continue;
|
|
162
|
+
let obj;
|
|
163
|
+
try {
|
|
164
|
+
obj = JSON.parse(line);
|
|
165
|
+
}
|
|
166
|
+
catch {
|
|
167
|
+
continue;
|
|
168
|
+
}
|
|
169
|
+
if (!obj || typeof obj !== "object")
|
|
170
|
+
continue;
|
|
171
|
+
const record = obj;
|
|
172
|
+
if (record["type"] === "assistant") {
|
|
173
|
+
const message = record["message"];
|
|
174
|
+
const content = message && typeof message === "object"
|
|
175
|
+
? message["content"]
|
|
176
|
+
: undefined;
|
|
177
|
+
if (!Array.isArray(content))
|
|
178
|
+
continue;
|
|
179
|
+
for (const block of content) {
|
|
180
|
+
if (!block || typeof block !== "object")
|
|
181
|
+
continue;
|
|
182
|
+
const text = block["text"];
|
|
183
|
+
if (typeof text === "string" && text.trim())
|
|
184
|
+
replies.push(text);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
else if (record["type"] === "result") {
|
|
188
|
+
const result = record["result"];
|
|
189
|
+
if (typeof result === "string" && result.trim())
|
|
190
|
+
replies.push(result);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
return replies.at(-1)?.trim() ?? null;
|
|
194
|
+
}
|
|
195
|
+
export function cursorApiSmokeUsedEnvKey(stdout) {
|
|
196
|
+
for (const rawLine of stdout.replaceAll("\r", "").split("\n")) {
|
|
197
|
+
const line = rawLine.trim();
|
|
198
|
+
if (!line)
|
|
199
|
+
continue;
|
|
200
|
+
let obj;
|
|
201
|
+
try {
|
|
202
|
+
obj = JSON.parse(line);
|
|
203
|
+
}
|
|
204
|
+
catch {
|
|
205
|
+
continue;
|
|
206
|
+
}
|
|
207
|
+
if (!obj || typeof obj !== "object")
|
|
208
|
+
continue;
|
|
209
|
+
const record = obj;
|
|
210
|
+
if (record["type"] === "system" && record["apiKeySource"] === "env")
|
|
211
|
+
return true;
|
|
212
|
+
}
|
|
213
|
+
return false;
|
|
214
|
+
}
|
|
215
|
+
export function cursorApiSmokePassed(code, stdout) {
|
|
216
|
+
return code === 0 && cursorApiSmokeUsedEnvKey(stdout) && cursorApiSmokeFinalText(stdout) === "OK";
|
|
217
|
+
}
|
|
218
|
+
export async function cleanupCursorSmokeBase(base, opts = {}) {
|
|
219
|
+
const remove = opts.remove ?? ((path) => rmSync(path, { recursive: true, force: true }));
|
|
220
|
+
const sleepMs = opts.sleepMs ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
221
|
+
const retries = opts.retries ?? 2;
|
|
222
|
+
for (let attempt = 0;; attempt += 1) {
|
|
223
|
+
try {
|
|
224
|
+
remove(base);
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
catch {
|
|
228
|
+
if (attempt >= retries)
|
|
229
|
+
return;
|
|
230
|
+
await sleepMs(25 * (attempt + 1));
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
function bridgeMacLoginKeychain(home) {
|
|
235
|
+
if (process.platform !== "darwin")
|
|
236
|
+
return;
|
|
237
|
+
const realHome = process.env.HOME;
|
|
238
|
+
if (!realHome || realHome === home)
|
|
239
|
+
return;
|
|
240
|
+
const source = join(realHome, "Library", "Keychains");
|
|
241
|
+
if (!existsSync(source))
|
|
242
|
+
return;
|
|
243
|
+
const targetParent = join(home, "Library");
|
|
244
|
+
const target = join(targetParent, "Keychains");
|
|
245
|
+
if (existsSync(target))
|
|
246
|
+
return;
|
|
247
|
+
try {
|
|
248
|
+
mkdirSync(targetParent, { recursive: true, mode: 0o700 });
|
|
249
|
+
symlinkSync(source, target, "dir");
|
|
250
|
+
}
|
|
251
|
+
catch {
|
|
252
|
+
// The smoke will fail honestly if the OS credential bridge cannot be created.
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
export async function smokeIsolatedApiKey(key = cursorApiKey(), options = {}) {
|
|
256
|
+
if (!key)
|
|
257
|
+
return { ok: false, detail: "no Cursor API key" };
|
|
258
|
+
const base = options.makeBaseDir?.() ?? mkdtempSync(join(tmpdir(), "claudexor-cursor-smoke-"));
|
|
259
|
+
const home = join(base, "home");
|
|
260
|
+
try {
|
|
261
|
+
mkdirSync(join(home, ".config"), { recursive: true, mode: 0o700 });
|
|
262
|
+
bridgeMacLoginKeychain(home);
|
|
263
|
+
const env = {
|
|
264
|
+
...providerScrubEnv(),
|
|
265
|
+
HOME: home,
|
|
266
|
+
XDG_CONFIG_HOME: join(home, ".config"),
|
|
267
|
+
CURSOR_API_KEY: key,
|
|
268
|
+
};
|
|
269
|
+
const r = await (options.runCapture ?? runCapture)(BIN, ["-p", "--output-format", "stream-json", "--mode", "plan", "--trust", "Reply exactly OK"], {
|
|
270
|
+
env,
|
|
271
|
+
timeoutMs: 45_000,
|
|
272
|
+
});
|
|
273
|
+
const text = `${r.stdout}\n${r.stderr}`;
|
|
274
|
+
if (cursorApiSmokePassed(r.code, r.stdout))
|
|
275
|
+
return { ok: true, detail: "isolated cursor-agent API-key smoke passed" };
|
|
276
|
+
return {
|
|
277
|
+
ok: false,
|
|
278
|
+
detail: `isolated cursor-agent API-key smoke failed (exit ${r.code ?? "signal"}): ${redactSecrets(text).trim().split("\n").slice(-3).join(" ").slice(0, 500)}`,
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
catch (err) {
|
|
282
|
+
return {
|
|
283
|
+
ok: false,
|
|
284
|
+
detail: `isolated cursor-agent API-key smoke failed (${err instanceof Error ? err.message.split("\n")[0] : String(err)})`,
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
finally {
|
|
288
|
+
await (options.cleanupBase ?? cleanupCursorSmokeBase)(base);
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
function cursorApiSmokeCacheKey(key) {
|
|
292
|
+
return createHash("sha256").update(key).digest("hex");
|
|
293
|
+
}
|
|
294
|
+
async function smokeCursorApiKey(deps, key) {
|
|
295
|
+
const cacheKey = cursorApiSmokeCacheKey(key);
|
|
296
|
+
const now = deps.nowMs();
|
|
297
|
+
const cached = deps.apiSmokeCache.get(cacheKey);
|
|
298
|
+
if (cached && cached.expiresAtMs > now)
|
|
299
|
+
return cached.result;
|
|
300
|
+
if (cached)
|
|
301
|
+
deps.apiSmokeCache.delete(cacheKey);
|
|
302
|
+
const result = await deps.smokeIsolatedApiKey(key);
|
|
303
|
+
const ttlMs = result.ok ? deps.apiSmokeCacheTtlMs : deps.apiSmokeFailureCacheTtlMs;
|
|
304
|
+
if (ttlMs > 0)
|
|
305
|
+
deps.apiSmokeCache.set(cacheKey, { result, expiresAtMs: now + ttlMs });
|
|
306
|
+
return result;
|
|
307
|
+
}
|
|
308
|
+
async function listCursorModels(env = { ...providerScrubEnv() }) {
|
|
309
|
+
try {
|
|
310
|
+
const r = await runCapture(BIN, ["--list-models"], { env, timeoutMs: 30_000 });
|
|
311
|
+
if (r.code !== 0)
|
|
312
|
+
return [];
|
|
313
|
+
return parseCursorModelList(r.stdout);
|
|
314
|
+
}
|
|
315
|
+
catch {
|
|
316
|
+
return [];
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
function cursorBaseEnv(env) {
|
|
320
|
+
return {
|
|
321
|
+
...(env ?? {}),
|
|
322
|
+
...providerScrubEnv(),
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
function cursorNativeEnv(env) {
|
|
326
|
+
return {
|
|
327
|
+
...cursorBaseEnv(env),
|
|
328
|
+
CURSOR_API_KEY: null,
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
function maybeBridgeScopedHome(env) {
|
|
332
|
+
const home = env["HOME"];
|
|
333
|
+
if (home && needsScopedHomeKeychainBridge(CURSOR_CAPABILITY_PROFILE))
|
|
334
|
+
bridgeMacLoginKeychain(home);
|
|
335
|
+
}
|
|
336
|
+
async function resolveCursorAuthRoute(deps, input) {
|
|
337
|
+
const env = cursorBaseEnv(input.env);
|
|
338
|
+
const scopedHome = Boolean(input.env?.["HOME"]);
|
|
339
|
+
if (scopedHome)
|
|
340
|
+
maybeBridgeScopedHome(env);
|
|
341
|
+
const key = deps.cursorApiKey(input.env);
|
|
342
|
+
const authPreference = input.authPreference ?? "auto";
|
|
343
|
+
const nativeAuthed = await deps.nativeAuthOk(env);
|
|
344
|
+
const shouldSmokeApiKey = shouldSmokeCursorApiKey({
|
|
345
|
+
hasKey: Boolean(key),
|
|
346
|
+
authPreference,
|
|
347
|
+
nativeAuthed,
|
|
348
|
+
scopedHome,
|
|
349
|
+
});
|
|
350
|
+
const apiSmoke = shouldSmokeApiKey && key
|
|
351
|
+
? await smokeCursorApiKey(deps, key)
|
|
352
|
+
: {
|
|
353
|
+
ok: false,
|
|
354
|
+
detail: key
|
|
355
|
+
? "Cursor API-key smoke not required for selected route"
|
|
356
|
+
: "no Cursor API key",
|
|
357
|
+
};
|
|
358
|
+
const route = selectCursorAuthRoute({
|
|
359
|
+
authPreference,
|
|
360
|
+
hasKey: Boolean(key),
|
|
361
|
+
apiKeyReady: apiSmoke.ok,
|
|
362
|
+
nativeAuthed,
|
|
363
|
+
scopedHome,
|
|
364
|
+
});
|
|
365
|
+
return { route, env, key, nativeAuthed, apiSmoke, scopedHome };
|
|
366
|
+
}
|
|
367
|
+
async function listCursorModelsFromReadyRoute(deps, spec) {
|
|
368
|
+
const catalogOnly = () => {
|
|
369
|
+
const key = deps.cursorApiKey(spec?.env);
|
|
370
|
+
return deps.listCursorModels({
|
|
371
|
+
...providerScrubEnv(),
|
|
372
|
+
CURSOR_API_KEY: key ?? null,
|
|
373
|
+
});
|
|
374
|
+
};
|
|
375
|
+
if (spec?.env || spec?.authPreference) {
|
|
376
|
+
const authPreference = spec.authPreference ?? "auto";
|
|
377
|
+
const resolved = await resolveCursorAuthRoute(deps, {
|
|
378
|
+
env: spec.env,
|
|
379
|
+
authPreference,
|
|
380
|
+
});
|
|
381
|
+
if (resolved.route === "local_session") {
|
|
382
|
+
const models = await deps.listCursorModels({ ...resolved.env, CURSOR_API_KEY: null });
|
|
383
|
+
if (models.length > 0)
|
|
384
|
+
return models;
|
|
385
|
+
if (authPreference === "subscription")
|
|
386
|
+
return [];
|
|
387
|
+
}
|
|
388
|
+
if (resolved.route === "api_key" && resolved.key) {
|
|
389
|
+
const models = await deps.listCursorModels({ ...resolved.env, CURSOR_API_KEY: resolved.key });
|
|
390
|
+
if (models.length > 0)
|
|
391
|
+
return models;
|
|
392
|
+
}
|
|
393
|
+
return [];
|
|
394
|
+
}
|
|
395
|
+
const nativeEnv = cursorNativeEnv();
|
|
396
|
+
if (await deps.nativeAuthOk(nativeEnv)) {
|
|
397
|
+
const nativeModels = await deps.listCursorModels(nativeEnv);
|
|
398
|
+
if (nativeModels.length > 0)
|
|
399
|
+
return nativeModels;
|
|
400
|
+
}
|
|
401
|
+
const key = deps.cursorApiKey();
|
|
402
|
+
if (!key)
|
|
403
|
+
return catalogOnly();
|
|
404
|
+
const apiSmoke = await smokeCursorApiKey(deps, key);
|
|
405
|
+
if (apiSmoke.ok) {
|
|
406
|
+
const models = await deps.listCursorModels({ ...providerScrubEnv(), CURSOR_API_KEY: key });
|
|
407
|
+
if (models.length > 0)
|
|
408
|
+
return models;
|
|
409
|
+
}
|
|
410
|
+
return catalogOnly();
|
|
411
|
+
}
|
|
412
|
+
export function createCursorAdapter(deps = {}) {
|
|
413
|
+
const runtime = {
|
|
414
|
+
detectVersion,
|
|
415
|
+
nativeAuthOk,
|
|
416
|
+
cursorApiKey,
|
|
417
|
+
listCursorModels,
|
|
418
|
+
smokeIsolatedApiKey,
|
|
419
|
+
apiSmokeCache: new Map(),
|
|
420
|
+
apiSmokeCacheTtlMs: CURSOR_API_SMOKE_CACHE_TTL_MS,
|
|
421
|
+
apiSmokeFailureCacheTtlMs: CURSOR_API_SMOKE_FAILURE_CACHE_TTL_MS,
|
|
422
|
+
nowMs: () => Date.now(),
|
|
423
|
+
runCliHarness: runCliHarnessDefault,
|
|
424
|
+
...deps,
|
|
425
|
+
};
|
|
426
|
+
return {
|
|
427
|
+
id: "cursor",
|
|
428
|
+
async discover() {
|
|
429
|
+
const version = await runtime.detectVersion();
|
|
430
|
+
if (version === null) {
|
|
431
|
+
throw new HarnessUnavailableError("cursor-agent not found on PATH (set CLAUDEXOR_CURSOR_BIN)");
|
|
432
|
+
}
|
|
433
|
+
const nativeAuthed = await runtime.nativeAuthOk(cursorNativeEnv());
|
|
434
|
+
const apiKey = runtime.cursorApiKey() !== null;
|
|
435
|
+
return HarnessManifestSchema.parse({
|
|
436
|
+
id: "cursor",
|
|
437
|
+
display_name: "Cursor CLI",
|
|
438
|
+
kind: "local_cli",
|
|
439
|
+
version,
|
|
440
|
+
adapter_version: CLAUDEXOR_VERSION,
|
|
441
|
+
provider_family: "cursor",
|
|
442
|
+
capabilities: {
|
|
443
|
+
plan: true,
|
|
444
|
+
implement: true,
|
|
445
|
+
create_from_scratch: true,
|
|
446
|
+
review: true,
|
|
447
|
+
verify: true,
|
|
448
|
+
synthesize: true,
|
|
449
|
+
read_files: true,
|
|
450
|
+
// No browser-MCP injection path exists for cursor-agent yet —
|
|
451
|
+
// honest false until that path exists + is verified.
|
|
452
|
+
browser_tool: false,
|
|
453
|
+
web_policy: "uncontrolled",
|
|
454
|
+
// cursor-agent exposes no reasoning-effort flag -> effort is not tunable.
|
|
455
|
+
effort_levels: [],
|
|
456
|
+
},
|
|
457
|
+
capability_profile: {
|
|
458
|
+
...CURSOR_CAPABILITY_PROFILE,
|
|
459
|
+
auth: {
|
|
460
|
+
...CURSOR_CAPABILITY_PROFILE.auth,
|
|
461
|
+
// Static source preference mirrors the normal non-scoped route.
|
|
462
|
+
// Scoped/envelope runs may still choose a smoke-proven API key at
|
|
463
|
+
// runtime because that decision depends on the run environment.
|
|
464
|
+
preferred_source: nativeAuthed ? "native_session" : apiKey ? "api_key_env" : null,
|
|
465
|
+
},
|
|
466
|
+
},
|
|
467
|
+
// Source AVAILABILITY truth: each mode is listed only when its source
|
|
468
|
+
// actually exists right now (a native session does not imply a key).
|
|
469
|
+
auth_modes: [
|
|
470
|
+
...(nativeAuthed ? ["local_session"] : []),
|
|
471
|
+
...(apiKey ? ["api_key"] : []),
|
|
472
|
+
],
|
|
473
|
+
access_profiles_supported: ["readonly", "workspace_write", "inherit_native"],
|
|
474
|
+
});
|
|
475
|
+
},
|
|
476
|
+
async doctor(_spec) {
|
|
477
|
+
const version = await runtime.detectVersion();
|
|
478
|
+
if (version === null) {
|
|
479
|
+
return ConformanceReportSchema.parse({
|
|
480
|
+
harness_id: "cursor",
|
|
481
|
+
status: "unavailable",
|
|
482
|
+
checks: [{ id: "installed", status: "fail", detail: "cursor-agent not found" }],
|
|
483
|
+
reasons: ["cursor-agent not found (install Cursor CLI or set CLAUDEXOR_CURSOR_BIN)"],
|
|
484
|
+
});
|
|
485
|
+
}
|
|
486
|
+
const env = cursorNativeEnv(_spec.env);
|
|
487
|
+
const scopedHome = Boolean(_spec.env?.["HOME"]);
|
|
488
|
+
const authPreference = _spec.authPreference ?? "auto";
|
|
489
|
+
if (scopedHome)
|
|
490
|
+
maybeBridgeScopedHome(env);
|
|
491
|
+
const nativeAuthed = await runtime.nativeAuthOk(env);
|
|
492
|
+
const key = runtime.cursorApiKey(_spec.env);
|
|
493
|
+
const apiKey = key !== null;
|
|
494
|
+
const shouldSmokeApiKey = shouldSmokeCursorApiKey({
|
|
495
|
+
hasKey: apiKey,
|
|
496
|
+
authPreference,
|
|
497
|
+
nativeAuthed,
|
|
498
|
+
scopedHome,
|
|
499
|
+
});
|
|
500
|
+
const apiSmoke = key && shouldSmokeApiKey
|
|
501
|
+
? await smokeCursorApiKey(runtime, key)
|
|
502
|
+
: {
|
|
503
|
+
ok: false,
|
|
504
|
+
detail: key
|
|
505
|
+
? "Cursor API-key smoke not required for selected route"
|
|
506
|
+
: "no Cursor API key",
|
|
507
|
+
};
|
|
508
|
+
// Readiness doctrine: a key string alone is source availability, not
|
|
509
|
+
// proven readiness. Native auth proves read-only/session reuse; an isolated
|
|
510
|
+
// API-key smoke proves envelope/write routes.
|
|
511
|
+
const routeableIntents = [
|
|
512
|
+
"plan",
|
|
513
|
+
"spec",
|
|
514
|
+
"implement",
|
|
515
|
+
"repair",
|
|
516
|
+
"create_from_scratch",
|
|
517
|
+
"review",
|
|
518
|
+
"verify",
|
|
519
|
+
"synthesize",
|
|
520
|
+
"explain",
|
|
521
|
+
"audit",
|
|
522
|
+
];
|
|
523
|
+
const allIntents = [
|
|
524
|
+
...routeableIntents,
|
|
525
|
+
"orchestrate",
|
|
526
|
+
];
|
|
527
|
+
// Write-class intents run in isolated envelopes with a scoped HOME where
|
|
528
|
+
// the native cursor session is unreachable — they REQUIRE the key
|
|
529
|
+
// fallback. Native-only auth honestly enables only the non-envelope
|
|
530
|
+
// (read-only) intents so doctor-ok can never precede a guaranteed run
|
|
531
|
+
// failure (readiness/routing contract).
|
|
532
|
+
const readOnlyIntents = [
|
|
533
|
+
"plan",
|
|
534
|
+
"spec",
|
|
535
|
+
"review",
|
|
536
|
+
"verify",
|
|
537
|
+
"synthesize",
|
|
538
|
+
"explain",
|
|
539
|
+
"audit",
|
|
540
|
+
];
|
|
541
|
+
const route = selectCursorAuthRoute({
|
|
542
|
+
authPreference,
|
|
543
|
+
hasKey: apiKey,
|
|
544
|
+
apiKeyReady: apiSmoke.ok,
|
|
545
|
+
nativeAuthed,
|
|
546
|
+
scopedHome,
|
|
547
|
+
});
|
|
548
|
+
const enabled = route === "api_key" ? routeableIntents : route === "local_session" ? readOnlyIntents : [];
|
|
549
|
+
const ok = route !== "unavailable";
|
|
550
|
+
return ConformanceReportSchema.parse({
|
|
551
|
+
harness_id: "cursor",
|
|
552
|
+
status: ok ? "ok" : apiKey ? "degraded" : "unavailable",
|
|
553
|
+
checks: [
|
|
554
|
+
{ id: "installed", status: "pass", detail: version },
|
|
555
|
+
{ id: "auth", status: nativeAuthed ? "pass" : "fail" },
|
|
556
|
+
{
|
|
557
|
+
id: "stored_key",
|
|
558
|
+
status: apiKey ? "pass" : "fail",
|
|
559
|
+
detail: apiKey
|
|
560
|
+
? "cursor secret/env available"
|
|
561
|
+
: "no cursor key fallback (write/envelope intents disabled)",
|
|
562
|
+
},
|
|
563
|
+
{
|
|
564
|
+
id: "isolated_api_smoke",
|
|
565
|
+
status: apiSmoke.ok ? "pass" : apiKey ? "fail" : "skip",
|
|
566
|
+
detail: apiSmoke.detail,
|
|
567
|
+
},
|
|
568
|
+
],
|
|
569
|
+
enabled_intents: enabled,
|
|
570
|
+
disabled_intents: allIntents.filter((i) => !enabled.includes(i)),
|
|
571
|
+
reasons: ok
|
|
572
|
+
? apiSmoke.ok
|
|
573
|
+
? []
|
|
574
|
+
: [
|
|
575
|
+
"native session only: isolated envelope (write) intents need a passing Cursor API-key smoke",
|
|
576
|
+
]
|
|
577
|
+
: apiKey
|
|
578
|
+
? [`cursor key present but route unproven: ${apiSmoke.detail}`]
|
|
579
|
+
: ["not authenticated (cursor-agent login or set CURSOR_API_KEY)"],
|
|
580
|
+
});
|
|
581
|
+
},
|
|
582
|
+
run(spec) {
|
|
583
|
+
return runCursor(spec, runtime);
|
|
584
|
+
},
|
|
585
|
+
review(spec) {
|
|
586
|
+
return runCursor(spec, runtime);
|
|
587
|
+
},
|
|
588
|
+
async models(spec) {
|
|
589
|
+
return listCursorModelsFromReadyRoute(runtime, spec);
|
|
590
|
+
},
|
|
591
|
+
};
|
|
592
|
+
}
|
|
593
|
+
async function* runCursor(spec, deps) {
|
|
594
|
+
if (spec.access === "full" || spec.access === "external_sandbox_full") {
|
|
595
|
+
yield {
|
|
596
|
+
type: "error",
|
|
597
|
+
session_id: spec.session_id,
|
|
598
|
+
ts: nowIso(),
|
|
599
|
+
error: "cursor full access is not conformance-proven; use workspace_write or another harness",
|
|
600
|
+
};
|
|
601
|
+
yield { type: "completed", session_id: spec.session_id, ts: nowIso() };
|
|
602
|
+
return;
|
|
603
|
+
}
|
|
604
|
+
const args = ["-p", "--output-format", "stream-json", ...accessArgs(spec.access)];
|
|
605
|
+
if (spec.model_hint)
|
|
606
|
+
args.push("--model", spec.model_hint);
|
|
607
|
+
// Resume the thread's native cursor chat as a follow-up turn.
|
|
608
|
+
if (spec.resume_session_id)
|
|
609
|
+
args.push("--resume", spec.resume_session_id);
|
|
610
|
+
args.push(spec.prompt);
|
|
611
|
+
const { route, env, key, nativeAuthed, scopedHome } = await resolveCursorAuthRoute(deps, {
|
|
612
|
+
env: spec.env,
|
|
613
|
+
authPreference: spec.auth_preference,
|
|
614
|
+
});
|
|
615
|
+
const preferApi = spec.auth_preference === "api_key";
|
|
616
|
+
if (route === "api_key" && key) {
|
|
617
|
+
env.CURSOR_API_KEY = key;
|
|
618
|
+
if (shouldDiscloseCursorAutoApiRoute({
|
|
619
|
+
authPreference: spec.auth_preference,
|
|
620
|
+
route,
|
|
621
|
+
nativeAuthed,
|
|
622
|
+
})) {
|
|
623
|
+
yield {
|
|
624
|
+
type: "message",
|
|
625
|
+
session_id: spec.session_id,
|
|
626
|
+
ts: nowIso(),
|
|
627
|
+
payload: {
|
|
628
|
+
auth_switched: true,
|
|
629
|
+
from_auth_mode: "local_session",
|
|
630
|
+
to_auth_mode: "api_key",
|
|
631
|
+
reason: "readiness_preferred",
|
|
632
|
+
},
|
|
633
|
+
};
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
else if (route === "local_session") {
|
|
637
|
+
env.CURSOR_API_KEY = null;
|
|
638
|
+
if (preferApi) {
|
|
639
|
+
yield {
|
|
640
|
+
type: "message",
|
|
641
|
+
session_id: spec.session_id,
|
|
642
|
+
ts: nowIso(),
|
|
643
|
+
payload: {
|
|
644
|
+
auth_switched: true,
|
|
645
|
+
from_auth_mode: "api_key",
|
|
646
|
+
to_auth_mode: "local_session",
|
|
647
|
+
reason: "auth_unavailable",
|
|
648
|
+
},
|
|
649
|
+
};
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
else {
|
|
653
|
+
yield {
|
|
654
|
+
type: "error",
|
|
655
|
+
session_id: spec.session_id,
|
|
656
|
+
ts: nowIso(),
|
|
657
|
+
error: scopedHome
|
|
658
|
+
? "scoped Cursor HOME requires either a bridged native session or a smoke-proven Cursor API key fallback"
|
|
659
|
+
: "Cursor requires either a native session or a smoke-proven Cursor API key fallback",
|
|
660
|
+
};
|
|
661
|
+
yield { type: "completed", session_id: spec.session_id, ts: nowIso() };
|
|
662
|
+
return;
|
|
663
|
+
}
|
|
664
|
+
yield* deps.runCliHarness({
|
|
665
|
+
bin: BIN,
|
|
666
|
+
args,
|
|
667
|
+
spec,
|
|
668
|
+
env,
|
|
669
|
+
label: "cursor-agent",
|
|
670
|
+
redact: redactSecrets,
|
|
671
|
+
parseEvent: createCursorParser(),
|
|
672
|
+
});
|
|
673
|
+
}
|
|
674
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAClF,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAWjC,OAAO,EACL,iBAAiB,IAAI,uBAAuB,EAC5C,wBAAwB,IAAI,8BAA8B,EAC1D,eAAe,IAAI,qBAAqB,GACzC,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,uBAAuB,EACvB,6B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|
1
|
+
import type { HarnessEvent } from "@claudexor/schema";
|
|
2
|
+
type Json = any;
|
|
3
|
+
export type CursorEventParser = (obj: Json, sessionId: string) => HarnessEvent[] | null;
|
|
4
|
+
/**
|
|
5
|
+
* Create a stateful per-run parser for Cursor `--output-format stream-json`.
|
|
6
|
+
*
|
|
7
|
+
* Cursor tool_call events are keyed by a variant object (e.g.
|
|
8
|
+
* `tool_call.writeToolCall.args.path`) with `subtype: "started" | "completed"`
|
|
9
|
+
* and a `call_id` — there is no flat `name` field. State maps call_id back to
|
|
10
|
+
* the originating tool so completed events become self-describing
|
|
11
|
+
* `tool_result`s instead of duplicate `tool_call`s.
|
|
12
|
+
*/
|
|
13
|
+
export declare function createCursorParser(): CursorEventParser;
|
|
14
|
+
/** Stateless convenience used by tests; resolves results within one call only. */
|
|
15
|
+
export declare function parseCursorEvent(obj: Json, sessionId: string): HarnessEvent[] | null;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=parse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../src/parse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAqB,MAAM,mBAAmB,CAAC;AAGzE,KAAK,IAAI,GAAG,GAAG,CAAC;AAwChB,MAAM,MAAM,iBAAiB,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,KAAK,YAAY,EAAE,GAAG,IAAI,CAAC;AAExF;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,IAAI,iBAAiB,CAGtD;AAED,kFAAkF;AAClF,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,GAAG,YAAY,EAAE,GAAG,IAAI,CAEpF"}
|
package/dist/parse.js
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { nowIso, redactSecrets } from "@claudexor/util";
|
|
2
|
+
const FILE_WRITE_VARIANTS = new Set(["write", "edit", "multiEdit", "delete", "create", "apply"]);
|
|
3
|
+
function variantToolName(toolCall) {
|
|
4
|
+
if (!toolCall || typeof toolCall !== "object")
|
|
5
|
+
return "tool";
|
|
6
|
+
const keys = Object.keys(toolCall);
|
|
7
|
+
const variant = keys.find((k) => k.endsWith("ToolCall")) ?? keys[0];
|
|
8
|
+
if (!variant)
|
|
9
|
+
return "tool";
|
|
10
|
+
return variant.endsWith("ToolCall") ? variant.slice(0, -"ToolCall".length) : variant;
|
|
11
|
+
}
|
|
12
|
+
function toolKindFor(name) {
|
|
13
|
+
const n = name.toLowerCase();
|
|
14
|
+
if (n.includes("websearch") || n.includes("webfetch") || n === "web" || n.includes("browser"))
|
|
15
|
+
return "web";
|
|
16
|
+
if (n.includes("shell") || n.includes("bash") || n.includes("terminal") || n.includes("command"))
|
|
17
|
+
return "command";
|
|
18
|
+
if (n.includes("glob") || n.includes("grep") || n.includes("search"))
|
|
19
|
+
return "search";
|
|
20
|
+
if (n.includes("read") || n.includes("write") || n.includes("edit") || n.includes("delete") || n === "ls" || n.includes("file"))
|
|
21
|
+
return "file";
|
|
22
|
+
if (n.includes("mcp"))
|
|
23
|
+
return "mcp";
|
|
24
|
+
return "other";
|
|
25
|
+
}
|
|
26
|
+
function argsTarget(args) {
|
|
27
|
+
if (!args || typeof args !== "object")
|
|
28
|
+
return undefined;
|
|
29
|
+
const candidates = [args.path, args.file_path, args.command, args.pattern, args.query, args.url];
|
|
30
|
+
const found = candidates.find((v) => typeof v === "string" && v.trim().length > 0);
|
|
31
|
+
return found ? redactSecrets(String(found)).slice(0, 500) : undefined;
|
|
32
|
+
}
|
|
33
|
+
function resultSummary(result) {
|
|
34
|
+
if (typeof result === "string")
|
|
35
|
+
return redactSecrets(result).trim().replace(/\s+/g, " ").slice(0, 1000);
|
|
36
|
+
if (result && typeof result === "object") {
|
|
37
|
+
const rec = result;
|
|
38
|
+
const text = typeof rec["error"] === "string" ? rec["error"] : typeof rec["output"] === "string" ? rec["output"] : typeof rec["text"] === "string" ? rec["text"] : "";
|
|
39
|
+
if (text)
|
|
40
|
+
return redactSecrets(text).trim().replace(/\s+/g, " ").slice(0, 1000);
|
|
41
|
+
return redactSecrets(JSON.stringify(result)).slice(0, 300);
|
|
42
|
+
}
|
|
43
|
+
return "";
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Create a stateful per-run parser for Cursor `--output-format stream-json`.
|
|
47
|
+
*
|
|
48
|
+
* Cursor tool_call events are keyed by a variant object (e.g.
|
|
49
|
+
* `tool_call.writeToolCall.args.path`) with `subtype: "started" | "completed"`
|
|
50
|
+
* and a `call_id` — there is no flat `name` field. State maps call_id back to
|
|
51
|
+
* the originating tool so completed events become self-describing
|
|
52
|
+
* `tool_result`s instead of duplicate `tool_call`s.
|
|
53
|
+
*/
|
|
54
|
+
export function createCursorParser() {
|
|
55
|
+
const pending = new Map();
|
|
56
|
+
return (obj, sessionId) => parseCursorEventStateful(obj, sessionId, pending);
|
|
57
|
+
}
|
|
58
|
+
/** Stateless convenience used by tests; resolves results within one call only. */
|
|
59
|
+
export function parseCursorEvent(obj, sessionId) {
|
|
60
|
+
return parseCursorEventStateful(obj, sessionId, new Map());
|
|
61
|
+
}
|
|
62
|
+
function parseCursorEventStateful(obj, sessionId, pending) {
|
|
63
|
+
const ts = nowIso();
|
|
64
|
+
const type = obj?.type;
|
|
65
|
+
if (type === "system" && obj.subtype === "init") {
|
|
66
|
+
// Cursor surfaces the chat id under different keys across versions; expose
|
|
67
|
+
// it uniformly so the engine can `--resume` this thread's native chat.
|
|
68
|
+
const nativeId = typeof obj.chatId === "string" ? obj.chatId : typeof obj.chat_id === "string" ? obj.chat_id : typeof obj.session_id === "string" ? obj.session_id : undefined;
|
|
69
|
+
return [
|
|
70
|
+
{
|
|
71
|
+
type: "started",
|
|
72
|
+
session_id: sessionId,
|
|
73
|
+
ts,
|
|
74
|
+
observed_model: typeof obj.model === "string" ? obj.model : undefined,
|
|
75
|
+
...(nativeId ? { payload: { native_session_id: nativeId } } : {}),
|
|
76
|
+
},
|
|
77
|
+
];
|
|
78
|
+
}
|
|
79
|
+
if (type === "assistant") {
|
|
80
|
+
const content = obj.message?.content ?? [];
|
|
81
|
+
const out = [];
|
|
82
|
+
for (const block of content) {
|
|
83
|
+
if (typeof block?.text === "string" && block.text) {
|
|
84
|
+
out.push({ type: "message", session_id: sessionId, ts, text: block.text });
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return out;
|
|
88
|
+
}
|
|
89
|
+
if (type === "thinking" || type === "reasoning") {
|
|
90
|
+
const text = typeof obj.text === "string" ? obj.text : typeof obj.message === "string" ? obj.message : "";
|
|
91
|
+
return text ? [{ type: "thinking", session_id: sessionId, ts, text }] : [];
|
|
92
|
+
}
|
|
93
|
+
if (type === "tool_call") {
|
|
94
|
+
const toolCall = obj.tool_call ?? {};
|
|
95
|
+
const variant = variantToolName(toolCall);
|
|
96
|
+
const inner = toolCall[Object.keys(toolCall).find((k) => k.endsWith("ToolCall")) ?? variant] ?? toolCall;
|
|
97
|
+
const args = inner?.args ?? obj.tool_call?.args ?? {};
|
|
98
|
+
const callId = typeof obj.call_id === "string" ? obj.call_id : typeof obj.id === "string" ? obj.id : undefined;
|
|
99
|
+
const subtype = String(obj.subtype ?? "started");
|
|
100
|
+
if (subtype === "started" || subtype === "updated") {
|
|
101
|
+
if (subtype === "updated")
|
|
102
|
+
return [];
|
|
103
|
+
const tool = {
|
|
104
|
+
name: variant,
|
|
105
|
+
kind: toolKindFor(variant),
|
|
106
|
+
use_id: callId,
|
|
107
|
+
target: argsTarget(args),
|
|
108
|
+
};
|
|
109
|
+
if (callId)
|
|
110
|
+
pending.set(callId, tool);
|
|
111
|
+
return [{ type: "tool_call", session_id: sessionId, ts, text: variant, tool }];
|
|
112
|
+
}
|
|
113
|
+
// completed / failed
|
|
114
|
+
const origin = callId ? pending.get(callId) : undefined;
|
|
115
|
+
if (callId)
|
|
116
|
+
pending.delete(callId);
|
|
117
|
+
const result = inner?.result ?? obj.result;
|
|
118
|
+
const rejected = Boolean(result && typeof result === "object" && "rejected" in result && result.rejected);
|
|
119
|
+
const failed = subtype === "failed" || (result && typeof result === "object" && "error" in result && result.error);
|
|
120
|
+
const detail = resultSummary(result);
|
|
121
|
+
const status = rejected ? "denied" : failed ? "error" : "ok";
|
|
122
|
+
const tool = {
|
|
123
|
+
name: origin?.name ?? variant,
|
|
124
|
+
kind: origin?.kind ?? toolKindFor(variant),
|
|
125
|
+
use_id: callId,
|
|
126
|
+
target: origin?.target ?? argsTarget(args),
|
|
127
|
+
status,
|
|
128
|
+
error_summary: status === "error" ? detail || "tool call failed" : undefined,
|
|
129
|
+
content_summary: detail || undefined,
|
|
130
|
+
};
|
|
131
|
+
const events = [
|
|
132
|
+
{
|
|
133
|
+
type: "tool_result",
|
|
134
|
+
session_id: sessionId,
|
|
135
|
+
ts,
|
|
136
|
+
text: status !== "ok" ? `tool_result: ${status}${detail ? `: ${detail}` : ""}` : "tool_result",
|
|
137
|
+
tool,
|
|
138
|
+
},
|
|
139
|
+
];
|
|
140
|
+
if (status === "ok" && FILE_WRITE_VARIANTS.has(tool.name)) {
|
|
141
|
+
const path = args?.path ?? args?.file_path;
|
|
142
|
+
events.push({ type: "file_change", session_id: sessionId, ts, tool: { name: tool.name, kind: "file", use_id: callId }, payload: { path, tool: tool.name } });
|
|
143
|
+
}
|
|
144
|
+
return events;
|
|
145
|
+
}
|
|
146
|
+
if (type === "result") {
|
|
147
|
+
const out = [];
|
|
148
|
+
if (typeof obj.total_cost_usd === "number") {
|
|
149
|
+
out.push({ type: "usage", session_id: sessionId, ts, usage: { cost_usd: obj.total_cost_usd } });
|
|
150
|
+
}
|
|
151
|
+
if (typeof obj.result === "string" && obj.result.trim()) {
|
|
152
|
+
out.push({ type: "message", session_id: sessionId, ts, text: obj.result });
|
|
153
|
+
}
|
|
154
|
+
if (obj.subtype && obj.subtype !== "success") {
|
|
155
|
+
out.push({ type: "error", session_id: sessionId, ts, error: `result subtype: ${obj.subtype}` });
|
|
156
|
+
}
|
|
157
|
+
return out;
|
|
158
|
+
}
|
|
159
|
+
if (type === "error") {
|
|
160
|
+
return [{ type: "error", session_id: sessionId, ts, error: String(obj.message ?? obj.error ?? "cursor error") }];
|
|
161
|
+
}
|
|
162
|
+
return null;
|
|
163
|
+
}
|
|
164
|
+
//# sourceMappingURL=parse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse.js","sourceRoot":"","sources":["../src/parse.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAIxD,MAAM,mBAAmB,GAAG,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;AAEjG,SAAS,eAAe,CAAC,QAAc;IACrC,IAAI,CAAC,QAAQ,IAAI,OAAO,QAAQ,KAAK,QAAQ;QAAE,OAAO,MAAM,CAAC;IAC7D,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACnC,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC;IACpE,IAAI,CAAC,OAAO;QAAE,OAAO,MAAM,CAAC;IAC5B,OAAO,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;AACvF,CAAC;AAED,SAAS,WAAW,CAAC,IAAY;IAC/B,MAAM,CAAC,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;IAC7B,IAAI,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,I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GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,EAAE,EAAE,KAAK,EAAE,mBAAmB,GAAG,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QAClG,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;IAED,IAAI,IAAI,KAAK,OAAO,EAAE,CAAC;QACrB,OAAO,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,GAAG,CAAC,OAAO,IAAI,GAAG,CAAC,KAAK,IAAI,cAAc,CAAC,EAAE,CAAC,CAAC;IACnH,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@claudexor/harness-cursor",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"description": "Cursor CLI adapter (cursor-agent -p --output-format stream-json).",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"default": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"@claudexor/core": "1.0.0",
|
|
20
|
+
"@claudexor/secrets": "1.0.0",
|
|
21
|
+
"@claudexor/schema": "1.0.0",
|
|
22
|
+
"@claudexor/util": "1.0.0"
|
|
23
|
+
},
|
|
24
|
+
"repository": {
|
|
25
|
+
"type": "git",
|
|
26
|
+
"url": "git+https://github.com/razzant/claudexor.git",
|
|
27
|
+
"directory": "packages/harness-cursor"
|
|
28
|
+
},
|
|
29
|
+
"homepage": "https://github.com/razzant/claudexor#readme",
|
|
30
|
+
"bugs": {
|
|
31
|
+
"url": "https://github.com/razzant/claudexor/issues"
|
|
32
|
+
},
|
|
33
|
+
"engines": {
|
|
34
|
+
"node": ">=20.19"
|
|
35
|
+
},
|
|
36
|
+
"publishConfig": {
|
|
37
|
+
"access": "public"
|
|
38
|
+
},
|
|
39
|
+
"scripts": {
|
|
40
|
+
"build": "tsc",
|
|
41
|
+
"typecheck": "tsc --noEmit"
|
|
42
|
+
}
|
|
43
|
+
}
|