@botiverse/oar 0.100.0 → 0.101.1

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.
Files changed (79) hide show
  1. package/README.md +2 -2
  2. package/dist/contracts/session-options.d.ts +1 -1
  3. package/dist/runtimes/claude/list-models.d.ts +4 -2
  4. package/dist/runtimes/claude/list-models.d.ts.map +1 -1
  5. package/dist/runtimes/claude/list-models.js +4 -2
  6. package/dist/runtimes/claude/list-models.js.map +1 -1
  7. package/dist/runtimes/codex/installation-candidates.d.ts +32 -0
  8. package/dist/runtimes/codex/installation-candidates.d.ts.map +1 -0
  9. package/dist/runtimes/codex/installation-candidates.js +107 -0
  10. package/dist/runtimes/codex/installation-candidates.js.map +1 -0
  11. package/dist/runtimes/codex/installation.d.ts +1 -30
  12. package/dist/runtimes/codex/installation.d.ts.map +1 -1
  13. package/dist/runtimes/codex/installation.js +2 -82
  14. package/dist/runtimes/codex/installation.js.map +1 -1
  15. package/dist/runtimes/cursor/access.d.ts +68 -0
  16. package/dist/runtimes/cursor/access.d.ts.map +1 -0
  17. package/dist/runtimes/cursor/access.js +77 -0
  18. package/dist/runtimes/cursor/access.js.map +1 -0
  19. package/dist/runtimes/cursor/auth-status.d.ts +4 -3
  20. package/dist/runtimes/cursor/auth-status.d.ts.map +1 -1
  21. package/dist/runtimes/cursor/auth-status.js +20 -18
  22. package/dist/runtimes/cursor/auth-status.js.map +1 -1
  23. package/dist/runtimes/cursor/index.d.ts +50 -10
  24. package/dist/runtimes/cursor/index.d.ts.map +1 -1
  25. package/dist/runtimes/cursor/index.js +40 -21
  26. package/dist/runtimes/cursor/index.js.map +1 -1
  27. package/dist/runtimes/cursor/installation.d.ts +1 -1
  28. package/dist/runtimes/cursor/installation.d.ts.map +1 -1
  29. package/dist/runtimes/cursor/installation.js +5 -2
  30. package/dist/runtimes/cursor/installation.js.map +1 -1
  31. package/dist/runtimes/cursor/list-models.d.ts +4 -2
  32. package/dist/runtimes/cursor/list-models.d.ts.map +1 -1
  33. package/dist/runtimes/cursor/list-models.js +31 -14
  34. package/dist/runtimes/cursor/list-models.js.map +1 -1
  35. package/dist/runtimes/cursor/login.d.ts +8 -3
  36. package/dist/runtimes/cursor/login.d.ts.map +1 -1
  37. package/dist/runtimes/cursor/login.js +29 -22
  38. package/dist/runtimes/cursor/login.js.map +1 -1
  39. package/dist/runtimes/cursor/logout.d.ts +3 -3
  40. package/dist/runtimes/cursor/logout.d.ts.map +1 -1
  41. package/dist/runtimes/cursor/logout.js +19 -18
  42. package/dist/runtimes/cursor/logout.js.map +1 -1
  43. package/dist/runtimes/cursor/model.d.ts +5 -0
  44. package/dist/runtimes/cursor/model.d.ts.map +1 -1
  45. package/dist/runtimes/cursor/model.js +10 -1
  46. package/dist/runtimes/cursor/model.js.map +1 -1
  47. package/dist/runtimes/cursor/sdk.d.ts +0 -4
  48. package/dist/runtimes/cursor/sdk.d.ts.map +1 -1
  49. package/dist/runtimes/cursor/sdk.js +5 -11
  50. package/dist/runtimes/cursor/sdk.js.map +1 -1
  51. package/dist/runtimes/cursor/session-process.d.ts +31 -0
  52. package/dist/runtimes/cursor/session-process.d.ts.map +1 -0
  53. package/dist/runtimes/cursor/session-process.js +80 -0
  54. package/dist/runtimes/cursor/session-process.js.map +1 -0
  55. package/dist/runtimes/cursor/session.d.ts +2 -2
  56. package/dist/runtimes/cursor/session.d.ts.map +1 -1
  57. package/dist/runtimes/cursor/session.js +10 -10
  58. package/dist/runtimes/cursor/session.js.map +1 -1
  59. package/dist/runtimes/cursor/subprocess/channel.d.ts +37 -0
  60. package/dist/runtimes/cursor/subprocess/channel.d.ts.map +1 -0
  61. package/dist/runtimes/cursor/subprocess/channel.js +170 -0
  62. package/dist/runtimes/cursor/subprocess/channel.js.map +1 -0
  63. package/dist/runtimes/cursor/subprocess/child-script.d.ts +12 -0
  64. package/dist/runtimes/cursor/subprocess/child-script.d.ts.map +1 -0
  65. package/dist/runtimes/cursor/subprocess/child-script.js +257 -0
  66. package/dist/runtimes/cursor/subprocess/child-script.js.map +1 -0
  67. package/dist/runtimes/cursor/subprocess/proxy.d.ts +11 -0
  68. package/dist/runtimes/cursor/subprocess/proxy.d.ts.map +1 -0
  69. package/dist/runtimes/cursor/subprocess/proxy.js +242 -0
  70. package/dist/runtimes/cursor/subprocess/proxy.js.map +1 -0
  71. package/dist/shared/executable/environment-marker.d.ts +21 -0
  72. package/dist/shared/executable/environment-marker.d.ts.map +1 -0
  73. package/dist/shared/executable/environment-marker.js +137 -0
  74. package/dist/shared/executable/environment-marker.js.map +1 -0
  75. package/dist/shared/executable/node-script.d.ts +53 -0
  76. package/dist/shared/executable/node-script.d.ts.map +1 -0
  77. package/dist/shared/executable/node-script.js +131 -0
  78. package/dist/shared/executable/node-script.js.map +1 -0
  79. package/package.json +5 -1
@@ -0,0 +1,170 @@
1
+ import { spawnNodeScript } from "../../../shared/executable/node-script.js";
2
+ import { asRecord } from "../../../shared/json.js";
3
+ import { redactTokenShapes } from "../../../shared/token-redaction.js";
4
+ import { cursorChildLaunch } from "./child-script.js";
5
+ /** How long the SDK may take to load in a fresh child (a cold import of the bundle). */
6
+ const READY_TIMEOUT_MS = 60_000;
7
+ /** How long stopping a child waits for the agent closes asked before it (the SDK's own async close work). */
8
+ const CLOSE_SETTLE_MS = 5000;
9
+ /** The stderr tail kept in an exit reason. */
10
+ const REASON_STDERR_CHARS = 1000;
11
+ /** Calls that end their events with their reply. */
12
+ const EVENTS_UNTIL_REPLY = new Set(["stream", "login"]);
13
+ /** An error that crossed from the child as plain data: its name, message and scalar fields. */
14
+ export function childError(value) {
15
+ const record = asRecord(value);
16
+ const error = new Error(typeof record?.message === "string" ? record.message : "cursor's child process failed");
17
+ for (const [key, field] of Object.entries(record ?? {})) {
18
+ if (key !== "message" && (typeof field === "string" || typeof field === "number" || typeof field === "boolean")) {
19
+ Object.defineProperty(error, key, { value: field, enumerable: key !== "name", writable: true, configurable: true });
20
+ }
21
+ }
22
+ return error;
23
+ }
24
+ function exitReason(exit) {
25
+ const how = exit.signal === null ? `code ${String(exit.code)}` : `signal ${exit.signal}`;
26
+ const tail = exit.stderr.trim().slice(-REASON_STDERR_CHARS);
27
+ return redactTokenShapes(tail === "" ? `cursor's SDK child process exited with ${how}` : `cursor's SDK child process exited with ${how}; stderr ends: ${tail}`);
28
+ }
29
+ function features(value) {
30
+ const record = asRecord(value);
31
+ return { auth: record?.auth === true, logout: record?.logout === true, store: record?.store === true };
32
+ }
33
+ /**
34
+ * Start a cursor child with `env` (the session's or call's whole
35
+ * environment) and wait until it loaded the SDK from `sdkModule`. A child
36
+ * that cannot load it, or exits first, is stopped and the open rejects.
37
+ */
38
+ export async function openCursorChannel(sdkModule, env, session = false) {
39
+ const launch = cursorChildLaunch(sdkModule, env);
40
+ // The host scans for what a session's child left behind; a one-shot call's child runs no tools, and scans for itself as it exits.
41
+ const child = spawnNodeScript(launch.script, launch.argument, launch.env, session ? launch.marker : undefined);
42
+ const replies = new Map();
43
+ const events = new Map();
44
+ const exitListeners = [];
45
+ const ready = Promise.withResolvers();
46
+ let exit = null;
47
+ let stopping = false;
48
+ let next = 0;
49
+ child.onMessage((raw) => {
50
+ const message = asRecord(raw);
51
+ const id = typeof message?.id === "number" ? message.id : -1;
52
+ if (message?.t === "ready") {
53
+ if (message.e === undefined) {
54
+ ready.resolve(features(message.v));
55
+ }
56
+ else {
57
+ ready.reject(childError(message.e));
58
+ }
59
+ }
60
+ else if (message?.t === "event") {
61
+ events.get(id)?.(message.v);
62
+ }
63
+ else if (message?.t === "reply") {
64
+ const waiting = replies.get(id);
65
+ replies.delete(id);
66
+ if (message.e === undefined) {
67
+ waiting?.resolve(message.v);
68
+ }
69
+ else {
70
+ waiting?.reject(childError(message.e));
71
+ }
72
+ }
73
+ });
74
+ void (async () => {
75
+ const ended = await child.exited;
76
+ exit = { code: ended.code, reason: exitReason(ended) };
77
+ const gone = new Error(exit.reason);
78
+ ready.reject(gone);
79
+ for (const waiting of replies.values()) {
80
+ waiting.reject(gone);
81
+ }
82
+ replies.clear();
83
+ events.clear();
84
+ for (const listener of exitListeners.splice(0)) {
85
+ listener(exit);
86
+ }
87
+ })();
88
+ // Agent closes still on their way: the child is stopped after them.
89
+ const closing = new Set();
90
+ const stop = async () => {
91
+ if (closing.size > 0) {
92
+ const settled = Promise.withResolvers();
93
+ const timer = setTimeout(settled.resolve, CLOSE_SETTLE_MS);
94
+ await Promise.race([Promise.allSettled(closing), settled.promise]);
95
+ clearTimeout(timer);
96
+ }
97
+ // From here on an exit is the one asked for; one before is a crash, with its reason.
98
+ stopping = exit === null;
99
+ // The child closes what is still open and exits on its own; the tree kill is the backstop.
100
+ const ended = await child.stop(() => { child.send({ id: 0, m: "shutdown", a: [] }); }, session);
101
+ return exit ?? { code: ended.code, reason: exitReason(ended) };
102
+ };
103
+ const timer = setTimeout(() => { ready.reject(new Error(`cursor's SDK child process did not load ${sdkModule} within ${String(READY_TIMEOUT_MS / 1000)} s`)); }, READY_TIMEOUT_MS);
104
+ let loaded = null;
105
+ try {
106
+ loaded = await ready.promise;
107
+ }
108
+ catch (error) {
109
+ await stop();
110
+ throw new Error(`cursor could not load @cursor/sdk in its child process: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
111
+ }
112
+ finally {
113
+ clearTimeout(timer);
114
+ }
115
+ const start = (method, args, onEvent) => {
116
+ next += 1;
117
+ const id = next;
118
+ if (exit !== null) {
119
+ return { id, reply: Promise.reject(new Error(exit.reason)) };
120
+ }
121
+ const reply = Promise.withResolvers();
122
+ replies.set(id, reply);
123
+ if (onEvent !== undefined) {
124
+ events.set(id, onEvent);
125
+ }
126
+ child.send({ id, m: method, a: args });
127
+ if (method === "close") {
128
+ closing.add(reply.promise);
129
+ void (async () => {
130
+ try {
131
+ await reply.promise;
132
+ }
133
+ catch { /* The caller sees it. */ }
134
+ finally {
135
+ closing.delete(reply.promise);
136
+ }
137
+ })();
138
+ }
139
+ if (!EVENTS_UNTIL_REPLY.has(method)) {
140
+ return { id, reply: reply.promise };
141
+ }
142
+ return { id, reply: (async () => {
143
+ try {
144
+ return await reply.promise;
145
+ }
146
+ finally {
147
+ events.delete(id);
148
+ }
149
+ })() };
150
+ };
151
+ return {
152
+ features: loaded,
153
+ start,
154
+ async call(method, args, onEvent) {
155
+ const value = await start(method, args, onEvent).reply;
156
+ return value;
157
+ },
158
+ onExit(listener) {
159
+ if (exit === null) {
160
+ exitListeners.push(listener);
161
+ }
162
+ else {
163
+ listener(exit);
164
+ }
165
+ },
166
+ stopping: () => stopping,
167
+ stop,
168
+ };
169
+ }
170
+ //# sourceMappingURL=channel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"channel.js","sources":["../../../../src/runtimes/cursor/subprocess/channel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAuB,MAAM,2CAA2C,CAAC;AACjG,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AA8BtD,wFAAwF;AACxF,MAAM,gBAAgB,GAAG,MAAM,CAAC;AAChC,6GAA6G;AAC7G,MAAM,eAAe,GAAG,IAAI,CAAC;AAC7B,8CAA8C;AAC9C,MAAM,mBAAmB,GAAG,IAAI,CAAC;AACjC,oDAAoD;AACpD,MAAM,kBAAkB,GAAwB,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;AAE7E,+FAA+F;AAC/F,MAAM,UAAU,UAAU,CAAC,KAAc;IACvC,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC/B,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,OAAO,MAAM,EAAE,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,+BAA+B,CAAC,CAAC;IAChH,KAAK,MAAM,CAAC,GAAG,EAAE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AAC,CAAC;wBAAS,CAAC;oBAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;gBAAC,CAAC;YAC7G,CAAC,CAAC,EAAE,CAAC;QACP,CAAC;QACD,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC;YAAC,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC;QAAC,CAAC;QAC7E,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,KAAK,IAAsB,EAAE;gBAChD,IAAI,CAAC;oBAAC,OAAO,MAAM,KAAK,CAAC,OAAO,CAAC;gBAAC,CAAC;wBAAS,CAAC;oBAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;gBAAC,CAAC;YACpE,CAAC,CAAC,EAAE,EAAE,CAAC;IACT,CAAC,CAAC;IACF,OAAO;QACL,QAAQ,EAAE,MAAM;QAChB,KAAK;QACL,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,OAAO;YAC9B,MAAM,KAAK,GAAG,MAAM,KAAK,CAAC,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC;YACvD,OAAO,KAAK,CAAC;QACf,CAAC;QACD,MAAM,CAAC,QAAQ;YACb,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;gBAAC,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YAAC,CAAC;iBAAM,CAAC;gBAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YAAC,CAAC;QAC/E,CAAC;QACD,QAAQ,EAAE,GAAG,EAAE,CAAC,QAAQ;QACxB,IAAI;KACL,CAAC;AACJ,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * The launch of one cursor child: the script, its spec, and its environment
3
+ * with `ELECTRON_RUN_AS_NODE=1` and a fresh environment marker
4
+ * (`OAR_CURSOR_CHILD_<id>=1`), which everything the child starts inherits.
5
+ */
6
+ export declare function cursorChildLaunch(sdkModule: string, env: Readonly<NodeJS.ProcessEnv>): {
7
+ readonly script: string;
8
+ readonly argument: string;
9
+ readonly env: NodeJS.ProcessEnv;
10
+ readonly marker: string;
11
+ };
12
+ //# sourceMappingURL=child-script.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"child-script.d.ts","sources":["../../../../src/runtimes/cursor/subprocess/child-script.ts"],"names":[],"mappings":"AAuPA;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG;IAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAIvM"}
@@ -0,0 +1,257 @@
1
+ import path from "node:path";
2
+ import { environmentValue, sessionEnvironment } from "../../../shared/environment.js";
3
+ import { newEnvironmentMarker } from "../../../shared/executable/environment-marker.js";
4
+ import { killGraceMs } from "../../../shared/executable/index.js";
5
+ /*
6
+ * The script a cursor child runs: `process.execPath -e SCRIPT SPEC`. It is
7
+ * self-contained (Node built-ins only, nothing from OAR), because hosts bundle
8
+ * OAR and a separate file next to OAR's code may not exist; it is kept small
9
+ * for the Windows command line limit. SPEC is `[sdkModule, graceMs,
10
+ * electronRunAsNode, taskkill, marker]`.
11
+ *
12
+ * Before the SDK loads, the child puts back the environment's own
13
+ * `ELECTRON_RUN_AS_NODE` (the host set it to 1 only so an Electron
14
+ * `process.execPath` runs the script as Node), and sets the SDK's native
15
+ * companion paths the way `cursorNativeEnvironment()` resolves them, from
16
+ * `sdkModule`, unless the environment already has them.
17
+ *
18
+ * Protocol (Node IPC, plain data only). Host to child: `{ id, m, a }`, a
19
+ * call of method `m` with arguments `a`. Child to host: `{ t: "ready" }`
20
+ * once the SDK loaded (or `e`, its error), with what the SDK has in `v`;
21
+ * `{ t: "reply", id, v | e }` answering a call; `{ t: "event", id, v }`
22
+ * during a call: a send's `onDelta` updates, a stream's messages, a
23
+ * login's URL and save request. Values the SDK returns are copied through
24
+ * JSON; errors cross as their name, message and scalar fields.
25
+ *
26
+ * The login never sends its credentials: the SDK's `store.save` asks the
27
+ * host (`save`), the host answers with `commit` (save to the SDK's own
28
+ * `FileCredentialStore` in this process), then `saved`, or `refused` with
29
+ * the reason, and the login's own reply carries no value.
30
+ *
31
+ * Closing an agent awaits its `Symbol.asyncDispose` when it has one (SDK
32
+ * 1.3.1: `close()` only starts its async close work). Shutting down (the
33
+ * host's `shutdown` call, a SIGTERM, or the IPC channel disconnecting
34
+ * because the host ended or died, SIGKILL included) closes every open agent
35
+ * and waits for the closes for up to `graceMs`, then exits. On exit, also
36
+ * an exit after an uncaught exception, the child ends the descendants it
37
+ * can find by parent pid (POSIX: `/proc/<pid>/stat` on Linux, `ps -A -o
38
+ * pid=,ppid=` elsewhere), so tools that lead process groups of their own
39
+ * are reached too, plus the ones seen when the shutdown began; Windows:
40
+ * `taskkill /T /F` on itself, which walks by parent, except after a
41
+ * shutdown the host asked for (the host ends the tree it captured before,
42
+ * and the exit code stays 0). An uncaught exception is written to stderr
43
+ * synchronously first, so its text reaches the host. On Linux it also
44
+ * SIGKILLs every process of this user whose environment holds `marker`
45
+ * (environment-marker.ts), which reaches what it started and was
46
+ * reparented away from it (a shell's background job after the shell
47
+ * exited), unless that process cleared the variable; it scans again until
48
+ * a pass finds nothing, at most five times. After a disconnect, or once its
49
+ * parent pid changed (checked every second, for a host gone without the
50
+ * disconnect being seen), with no host left to do it, it also SIGKILLs its
51
+ * own process group. A child blocked in synchronous code runs neither
52
+ * check.
53
+ * Not reached: on macOS and Windows, a process reparented away from the
54
+ * child before its exit (no marker scan there); anywhere, a process that
55
+ * cleared the marker and left the child's tree or group.
56
+ */
57
+ const SCRIPT = String.raw `
58
+ const [sdkModule, graceMs, electron, taskkill, marker] = JSON.parse(process.argv[1]);
59
+ const path = require("node:path");
60
+ const fs = require("node:fs");
61
+ const { execFileSync } = require("node:child_process");
62
+ const windows = process.platform === "win32";
63
+ let stopping = false;
64
+ let orphaned = false;
65
+ let seen = new Map();
66
+ const table = () => {
67
+ if (process.platform === "linux") {
68
+ const rows = [];
69
+ for (const name of fs.readdirSync("/proc")) {
70
+ if (!/^\d+$/.test(name)) { continue; }
71
+ try {
72
+ const stat = fs.readFileSync("/proc/" + name + "/stat", "utf8");
73
+ const fields = stat.slice(stat.lastIndexOf(")") + 2).split(" ");
74
+ rows.push([Number(name), Number(fields[1]), fields[19]]);
75
+ } catch {}
76
+ }
77
+ return rows;
78
+ }
79
+ return execFileSync("/bin/ps", ["-A", "-o", "pid=,ppid=,lstart="], { encoding: "utf8", timeout: 10000 }).split("\n")
80
+ .map((line) => line.trim().split(/\s+/)).filter((cells) => cells.length > 2).map((cells) => [Number(cells[0]), Number(cells[1]), cells.slice(2).join(" ")]);
81
+ };
82
+ const descendants = (rows) => {
83
+ const below = new Map();
84
+ for (const row of rows) { below.set(row[1], [...(below.get(row[1]) ?? []), row]); }
85
+ const found = new Map();
86
+ const pending = [process.pid];
87
+ while (pending.length > 0) {
88
+ for (const row of below.get(pending.pop()) ?? []) {
89
+ if (!found.has(row[0])) { found.set(row[0], row[2]); pending.push(row[0]); }
90
+ }
91
+ }
92
+ return found;
93
+ };
94
+ const remember = () => { if (!windows) { try { seen = descendants(table()); } catch {} } };
95
+ let asked = false;
96
+ process.on("exit", () => {
97
+ // Windows, last: no process groups, so taskkill /T walks by parent, this process included (exit code 1).
98
+ // Not after a shutdown the host asked for: the host ends the tree it captured, and the exit stays 0.
99
+ if (windows) {
100
+ if (!asked) { try { execFileSync(taskkill, ["/pid", String(process.pid), "/T", "/F"], { stdio: "ignore", windowsHide: true, timeout: 10000 }); } catch {} }
101
+ return;
102
+ }
103
+ try {
104
+ const rows = table();
105
+ const now = new Map(rows.map((row) => [row[0], row[2]]));
106
+ const targets = new Map([...[...seen].filter(([pid, start]) => now.get(pid) === start), ...descendants(rows)]);
107
+ for (const pid of targets.keys()) { try { process.kill(pid, "SIGKILL"); } catch {} }
108
+ } catch {}
109
+ // What kept the marker, also reparented away from this process (Linux reads every environment).
110
+ // Again until a pass finds nothing (at most 5): a marked process may fork between the read and the kill.
111
+ for (let pass = 0; process.platform === "linux" && pass < 5; pass += 1) {
112
+ let found = 0;
113
+ for (const name of fs.readdirSync("/proc")) {
114
+ try {
115
+ if (!/^\d+$/.test(name) || Number(name) === process.pid || fs.statSync("/proc/" + name).uid !== process.getuid()) { continue; }
116
+ if (fs.readFileSync("/proc/" + name + "/environ", "latin1").split("\0").includes(marker)) { process.kill(Number(name), "SIGKILL"); found += 1; }
117
+ } catch {}
118
+ }
119
+ if (found === 0) { break; }
120
+ }
121
+ if (orphaned) { try { process.kill(-process.pid, "SIGKILL"); } catch {} }
122
+ });
123
+ const agents = new Map();
124
+ const closing = new Set();
125
+ const closeAgent = (agent) => {
126
+ const done = (async () => { if (typeof agent[Symbol.asyncDispose] === "function") { await agent[Symbol.asyncDispose](); } else { agent.close(); } })();
127
+ closing.add(done);
128
+ return done;
129
+ };
130
+ const shutdown = async (code) => {
131
+ if (stopping) { return; }
132
+ stopping = true;
133
+ asked = code === 0;
134
+ remember();
135
+ for (const agent of agents.values()) { void closeAgent(agent); }
136
+ agents.clear();
137
+ await Promise.race([Promise.allSettled([...closing]), new Promise((resolve) => { setTimeout(resolve, graceMs); })]);
138
+ process.exit(code);
139
+ };
140
+ process.on("SIGTERM", () => { void shutdown(0); });
141
+ // Written synchronously, so the error reaches the host's stderr tail before the exit hook ends anything.
142
+ process.on("uncaughtException", (error) => {
143
+ try { fs.writeSync(2, (error instanceof Error && error.stack ? error.stack : String(error)) + "\n"); } catch {}
144
+ process.exit(1);
145
+ });
146
+ process.on("disconnect", () => { orphaned = true; void shutdown(1); });
147
+ // A host gone without the disconnect reaching this process. Needs an event loop that still yields. POSIX reparents an
148
+ // orphan, so its ppid changes; Windows keeps the dead parent's pid, so there the parent pid is checked for a live process.
149
+ const parent = process.ppid;
150
+ const parentGone = () => {
151
+ if (process.ppid !== parent) { return true; }
152
+ if (!windows) { return false; }
153
+ try { process.kill(parent, 0); return false; } catch (error) { return error.code === "ESRCH"; }
154
+ };
155
+ setInterval(() => { if (parentGone()) { orphaned = true; void shutdown(1); } }, 1000).unref();
156
+ if (electron === null) { delete process.env.ELECTRON_RUN_AS_NODE; } else { process.env.ELECTRON_RUN_AS_NODE = electron; }
157
+ try {
158
+ const root = path.dirname(require("node:module").createRequire(sdkModule).resolve("@cursor/sdk-" + process.platform + "-" + process.arch + "/package.json"));
159
+ process.env.CURSOR_TREE_SITTER_VENDOR_DIR ??= path.join(root, "vendor");
160
+ process.env.CURSOR_RIPGREP_PATH ??= path.join(root, "bin", windows ? "rg.exe" : "rg");
161
+ } catch {}
162
+ const post = (message) => { if (process.connected) { process.send(message); } };
163
+ const plain = (value) => value === undefined ? undefined : JSON.parse(JSON.stringify(value));
164
+ const fault = (error) => {
165
+ if (!(error instanceof Error)) { return { name: "Error", message: String(error) }; }
166
+ const out = {};
167
+ for (const key of [...Object.keys(error), "code", "status", "operation", "isRetryable"]) {
168
+ if (["string", "number", "boolean"].includes(typeof error[key])) { out[key] = error[key]; }
169
+ }
170
+ return { ...out, name: error.name, message: error.message };
171
+ };
172
+ let sdk;
173
+ let pending;
174
+ let abort;
175
+ const runs = new Map();
176
+ const streams = new Map();
177
+ const opened = async (id, opening) => {
178
+ const agent = await opening;
179
+ agents.set(id, agent);
180
+ return { agentId: agent.agentId, model: agent.model, summarize: typeof agent.summarize === "function" };
181
+ };
182
+ const started = async (id, starting) => {
183
+ const run = await starting;
184
+ runs.set(id, run);
185
+ return { runId: run.id, steer: typeof run.steer === "function" };
186
+ };
187
+ const calls = {
188
+ models: (id, options) => sdk.Cursor.models.list(options),
189
+ listRuns: (id, agentId, options) => sdk.Agent.listRuns(agentId, options),
190
+ create: (id, options) => opened(id, sdk.Agent.create(options)),
191
+ resume: (id, agentId, options) => opened(id, sdk.Agent.resume(agentId, options)),
192
+ send: (id, agent, message, local) => started(id, agents.get(agent).send(message, { onDelta: ({ update }) => post({ t: "event", id, v: plain(update) }), ...(local ? { local } : {}) })),
193
+ summarize: (id, agent) => started(id, agents.get(agent).summarize()),
194
+ close: async (id, key) => { const agent = agents.get(key); agents.delete(key); if (agent !== undefined) { await closeAgent(agent); } },
195
+ shutdown: () => { void shutdown(0); },
196
+ wait: (id, run) => runs.get(run).wait(),
197
+ cancel: (id, run) => runs.get(run).cancel(),
198
+ steer: (id, run, text) => runs.get(run).steer(text),
199
+ stream: async (id, run) => {
200
+ const iterator = runs.get(run).stream()[Symbol.asyncIterator]();
201
+ streams.set(id, iterator);
202
+ try {
203
+ for (;;) {
204
+ const next = await iterator.next();
205
+ if (next.done) { return; }
206
+ post({ t: "event", id, v: plain(next.value) });
207
+ }
208
+ } finally { streams.delete(id); }
209
+ },
210
+ unstream: (id, stream) => { void streams.get(stream)?.return?.(); },
211
+ status: () => sdk.Cursor.auth.status(),
212
+ logout: async () => { await sdk.Cursor.auth.logout(); },
213
+ login: async (id) => {
214
+ abort = new AbortController();
215
+ const store = {
216
+ load: async () => undefined,
217
+ clear: async () => { throw new Error("oar's cursor login never clears the stored login"); },
218
+ save: (credentials) => new Promise((resolve, reject) => { pending = { credentials, resolve, reject }; post({ t: "event", id, v: { save: true } }); }),
219
+ };
220
+ await sdk.Cursor.auth.login({ openBrowser: false, signal: abort.signal, onLoginUrl: (url) => post({ t: "event", id, v: { url } }), store });
221
+ },
222
+ abortLogin: () => { abort?.abort(); },
223
+ commit: async () => { const { credentials } = pending; pending.credentials = undefined; await new sdk.FileCredentialStore().save(credentials); },
224
+ saved: () => { pending.resolve(); },
225
+ refused: (id, message) => { pending.reject(new Error(message)); },
226
+ };
227
+ process.on("message", async ({ id, m, a }) => {
228
+ try { post({ t: "reply", id, v: plain(await calls[m](id, ...a)) }); }
229
+ catch (error) { post({ t: "reply", id, e: fault(error) }); }
230
+ });
231
+ import(sdkModule).then((module) => {
232
+ sdk = module;
233
+ const auth = module.Cursor?.auth;
234
+ post({ t: "ready", v: { auth: auth !== undefined, logout: typeof auth?.logout === "function", store: typeof module.FileCredentialStore === "function" } });
235
+ }, (error) => { post({ t: "ready", e: fault(error) }); });
236
+ `;
237
+ /**
238
+ * Windows: taskkill by absolute path from the host's own `SystemRoot`, since
239
+ * the child's environment may have no PATH (`envBase: "clean"`).
240
+ */
241
+ function taskkillPath() {
242
+ if (process.platform !== "win32") {
243
+ return null;
244
+ }
245
+ return path.win32.join(environmentValue(process.env, "SystemRoot") ?? String.raw `C:\Windows`, "System32", "taskkill.exe");
246
+ }
247
+ /**
248
+ * The launch of one cursor child: the script, its spec, and its environment
249
+ * with `ELECTRON_RUN_AS_NODE=1` and a fresh environment marker
250
+ * (`OAR_CURSOR_CHILD_<id>=1`), which everything the child starts inherits.
251
+ */
252
+ export function cursorChildLaunch(sdkModule, env) {
253
+ const marker = newEnvironmentMarker();
254
+ const spec = [sdkModule, Math.floor(killGraceMs() / 2), environmentValue(env, "ELECTRON_RUN_AS_NODE") ?? null, taskkillPath(), marker.entry];
255
+ return { script: SCRIPT, argument: JSON.stringify(spec), env: sessionEnvironment({ ELECTRON_RUN_AS_NODE: "1", [marker.name]: "1" }, env), marker: marker.entry };
256
+ }
257
+ //# sourceMappingURL=child-script.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"child-script.js","sources":["../../../../src/runtimes/cursor/subprocess/child-script.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACtF,OAAO,EAAE,oBAAoB,EAAE,MAAM,kDAAkD,CAAC;AACxF,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAElE;;;;;;;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C;AACnK,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type { CursorSdk } from "../sdk.js";
2
+ import type { CursorChannel } from "./channel.js";
3
+ /**
4
+ * `CursorSdk` over one cursor child. `apiKey` is the `CURSOR_API_KEY` the
5
+ * lease took out of the child's environment: it goes to the SDK as
6
+ * `AgentOptions.apiKey` (create, resume) and `CursorRequestOptions.apiKey`
7
+ * (`Cursor.models.list`), which SDK 1.3.1 uses instead of the variable.
8
+ * Local `Agent.listRuns` reads the local store and takes none.
9
+ */
10
+ export declare function proxySdk(channel: CursorChannel, apiKey?: string): CursorSdk;
11
+ //# sourceMappingURL=proxy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proxy.d.ts","sources":["../../../../src/runtimes/cursor/subprocess/proxy.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAOV,SAAS,EAIV,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAgLlD;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,aAAa,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAoC3E"}