@botiverse/oar 0.100.0 → 0.101.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.
Files changed (75) hide show
  1. package/README.md +2 -2
  2. package/dist/contracts/session-options.d.ts +1 -1
  3. package/dist/runtimes/codex/installation-candidates.d.ts +31 -0
  4. package/dist/runtimes/codex/installation-candidates.d.ts.map +1 -0
  5. package/dist/runtimes/codex/installation-candidates.js +92 -0
  6. package/dist/runtimes/codex/installation-candidates.js.map +1 -0
  7. package/dist/runtimes/codex/installation.d.ts +1 -30
  8. package/dist/runtimes/codex/installation.d.ts.map +1 -1
  9. package/dist/runtimes/codex/installation.js +2 -82
  10. package/dist/runtimes/codex/installation.js.map +1 -1
  11. package/dist/runtimes/cursor/access.d.ts +68 -0
  12. package/dist/runtimes/cursor/access.d.ts.map +1 -0
  13. package/dist/runtimes/cursor/access.js +77 -0
  14. package/dist/runtimes/cursor/access.js.map +1 -0
  15. package/dist/runtimes/cursor/auth-status.d.ts +4 -3
  16. package/dist/runtimes/cursor/auth-status.d.ts.map +1 -1
  17. package/dist/runtimes/cursor/auth-status.js +20 -18
  18. package/dist/runtimes/cursor/auth-status.js.map +1 -1
  19. package/dist/runtimes/cursor/index.d.ts +50 -10
  20. package/dist/runtimes/cursor/index.d.ts.map +1 -1
  21. package/dist/runtimes/cursor/index.js +40 -21
  22. package/dist/runtimes/cursor/index.js.map +1 -1
  23. package/dist/runtimes/cursor/installation.d.ts +1 -1
  24. package/dist/runtimes/cursor/installation.d.ts.map +1 -1
  25. package/dist/runtimes/cursor/installation.js +5 -2
  26. package/dist/runtimes/cursor/installation.js.map +1 -1
  27. package/dist/runtimes/cursor/list-models.d.ts +4 -2
  28. package/dist/runtimes/cursor/list-models.d.ts.map +1 -1
  29. package/dist/runtimes/cursor/list-models.js +31 -14
  30. package/dist/runtimes/cursor/list-models.js.map +1 -1
  31. package/dist/runtimes/cursor/login.d.ts +8 -3
  32. package/dist/runtimes/cursor/login.d.ts.map +1 -1
  33. package/dist/runtimes/cursor/login.js +29 -22
  34. package/dist/runtimes/cursor/login.js.map +1 -1
  35. package/dist/runtimes/cursor/logout.d.ts +3 -3
  36. package/dist/runtimes/cursor/logout.d.ts.map +1 -1
  37. package/dist/runtimes/cursor/logout.js +19 -18
  38. package/dist/runtimes/cursor/logout.js.map +1 -1
  39. package/dist/runtimes/cursor/model.d.ts +5 -0
  40. package/dist/runtimes/cursor/model.d.ts.map +1 -1
  41. package/dist/runtimes/cursor/model.js +10 -1
  42. package/dist/runtimes/cursor/model.js.map +1 -1
  43. package/dist/runtimes/cursor/sdk.d.ts +0 -4
  44. package/dist/runtimes/cursor/sdk.d.ts.map +1 -1
  45. package/dist/runtimes/cursor/sdk.js +5 -11
  46. package/dist/runtimes/cursor/sdk.js.map +1 -1
  47. package/dist/runtimes/cursor/session-process.d.ts +31 -0
  48. package/dist/runtimes/cursor/session-process.d.ts.map +1 -0
  49. package/dist/runtimes/cursor/session-process.js +80 -0
  50. package/dist/runtimes/cursor/session-process.js.map +1 -0
  51. package/dist/runtimes/cursor/session.d.ts +2 -2
  52. package/dist/runtimes/cursor/session.d.ts.map +1 -1
  53. package/dist/runtimes/cursor/session.js +10 -10
  54. package/dist/runtimes/cursor/session.js.map +1 -1
  55. package/dist/runtimes/cursor/subprocess/channel.d.ts +37 -0
  56. package/dist/runtimes/cursor/subprocess/channel.d.ts.map +1 -0
  57. package/dist/runtimes/cursor/subprocess/channel.js +170 -0
  58. package/dist/runtimes/cursor/subprocess/channel.js.map +1 -0
  59. package/dist/runtimes/cursor/subprocess/child-script.d.ts +12 -0
  60. package/dist/runtimes/cursor/subprocess/child-script.d.ts.map +1 -0
  61. package/dist/runtimes/cursor/subprocess/child-script.js +257 -0
  62. package/dist/runtimes/cursor/subprocess/child-script.js.map +1 -0
  63. package/dist/runtimes/cursor/subprocess/proxy.d.ts +11 -0
  64. package/dist/runtimes/cursor/subprocess/proxy.d.ts.map +1 -0
  65. package/dist/runtimes/cursor/subprocess/proxy.js +242 -0
  66. package/dist/runtimes/cursor/subprocess/proxy.js.map +1 -0
  67. package/dist/shared/executable/environment-marker.d.ts +21 -0
  68. package/dist/shared/executable/environment-marker.d.ts.map +1 -0
  69. package/dist/shared/executable/environment-marker.js +137 -0
  70. package/dist/shared/executable/environment-marker.js.map +1 -0
  71. package/dist/shared/executable/node-script.d.ts +53 -0
  72. package/dist/shared/executable/node-script.d.ts.map +1 -0
  73. package/dist/shared/executable/node-script.js +131 -0
  74. package/dist/shared/executable/node-script.js.map +1 -0
  75. package/package.json +5 -1
package/README.md CHANGED
@@ -150,14 +150,14 @@ The package has these public entry points, plus `@botiverse/oar/pi-durable` ([be
150
150
  - `@botiverse/oar/observe`: the browser-safe pure derivations over `RawEvent`s and `Event`s (`eventsOf`, `graphOf`, `usageOf`, `coalesceText`, `observeAgent`, `reduceStatus`, `tasksOf`, `observeStalls`, `classifyTool`, `reduceConversation`, `viewOf`, …) with no Node or adapter imports, so a browser or Electron-renderer bundle can import it directly. The root export re-exports all of them.
151
151
  It also supplies `failureAdvice` (recovery timing per `FailureClass`) and `noticeText`, `noticeTone`, `phaseLabel`, `failureText` and `taskStatusLabel`, alongside `toolActionLabel` and `toolGroupSummary`: English display wording for OAR types, usable in JavaScriptCore too. Wording may change in a minor release; hosts must use the typed values for decisions, not parse the text ([display wording](https://github.com/botiverse/oar/blob/main/docs/spec/conversation.md#display-wording)).
152
152
  - `@botiverse/oar/kernel`: the runtime-author SPI. `createSessionKernel` is the record stream every built-in adapter is built on (dense `seq`, cursor replay, control recording, the reachability rule) and `sealSession` derives the `Session` API face over an adapter. Pair with `defineRuntime` to ship a custom runtime (a scripted runtime for a host's tests, an in-process agent) without re-implementing the stream contract. `inputImagesRefusal` and `withInputImages` are the image rules every built-in runtime keeps, so a custom runtime refuses the inputs they refuse. `withdrawHeld` is the decision behind `withdraw` for a runtime that holds its own queue.
153
- - `@botiverse/oar/agents`: subagents. `createSubagents()` starts child sessions on any runtime that takes `SessionOptions.env` (not cursor or pi-durable), returns a report for every turn they end, takes follow-ups, enforces depth and concurrency limits, and reports each child as a task. The host takes reports with `wait` / `next` or receives them through an `onReport` hook; with `formatReport` and `reportOrigin` it can `deliver` one into a parent session so it wakes. See [subagents](https://github.com/botiverse/oar/blob/main/docs/spec/subagents.md). Node-only.
153
+ - `@botiverse/oar/agents`: subagents. `createSubagents()` starts child sessions on any runtime that takes `SessionOptions.env` (not in-process cursor or pi-durable), returns a report for every turn they end, takes follow-ups, enforces depth and concurrency limits, and reports each child as a task. The host takes reports with `wait` / `next` or receives them through an `onReport` hook; with `formatReport` and `reportOrigin` it can `deliver` one into a parent session so it wakes. See [subagents](https://github.com/botiverse/oar/blob/main/docs/spec/subagents.md). Node-only.
154
154
  - `@botiverse/oar/agents/report`: `formatReport`, `parseReport`, `reportOrigin` and their types, with no Node or adapter imports, for a host forwarding or displaying reports. `parseReport` reads the existing report format into header fields, a structured outcome and the original body, or returns `null`. `@botiverse/oar/agents` loads every built-in runtime, because `createSubagents` defaults to them.
155
155
  - `@botiverse/oar/testing`: `scriptedRuntime({ turn })`, a ready-made runtime on the kernel SPI whose model is a script. It yields a real `Session` (same records, folds and control semantics) with no binary, login or provider, for hosts' tests and demos. A script can also start tasks (`turn.task`) that end after the turn, like a background command. Node-only.
156
156
  - `@botiverse/oar/forms`: runtime config forms for a host's agent-creation UI, as plain data (`configForms` and the frozen `baselineForms`, keyed by runtime id; grok only so far) with pure `validateConfig`, `toSessionOptions` and `toModelListing`. A form states what the runtime accepts; a host may only narrow it. Loads no runtime SDK and does nothing on import, so it runs in a browser. See [config form](https://github.com/botiverse/oar/blob/main/docs/spec/config-form.md).
157
157
 
158
158
  Brand SVG files are exported at `@botiverse/oar/assets/brands/<runtime-id>.svg`. Any other deep import (`@botiverse/oar/dist/...`, source paths) is internal and may break without notice.
159
159
 
160
- Antigravity, CodeBuddy, Grok, Kimi, and OpenCode share an internal ACP v1 transport and session kernel, but only their concrete runtime identities are public. The registry deliberately does not expose a generic `acp` runtime. The pi SDK (`@earendil-works/pi-coding-agent`) is a dependency of this package. `@cursor/sdk` is an optional peer dependency, and cursor is not in `defaultRuntimes`: install the SDK (`npm install @cursor/sdk@1.3.1`) and hand it over, `createRuntimeRegistry([...defaultRuntimes.list(), createCursorRuntime({ sdk: () => import("@cursor/sdk") })])`. Written in your code, that import fails your compile if the package is missing. It is Cursor's own package under Cursor's terms, and it signs in with `CURSOR_API_KEY` or its own `Cursor.auth.login()`.
160
+ Antigravity, CodeBuddy, Grok, Kimi, and OpenCode share an internal ACP v1 transport and session kernel, but only their concrete runtime identities are public. The registry deliberately does not expose a generic `acp` runtime. The pi SDK (`@earendil-works/pi-coding-agent`) is a dependency of this package. `@cursor/sdk` is an optional peer dependency, and cursor is not in `defaultRuntimes`: install the SDK (`npm install @cursor/sdk@1.3.1`) and hand it over, `createRuntimeRegistry([...defaultRuntimes.list(), createCursorRuntime({ sdk: () => import("@cursor/sdk") })])`. Written in your code, that import fails your compile if the package is missing. It is Cursor's own package under Cursor's terms, and it signs in with `CURSOR_API_KEY` or its own `Cursor.auth.login()`. `createCursorRuntime({ execution: "subprocess", sdkModule: import.meta.resolve("@cursor/sdk") })` instead runs the SDK in a Node child per session, which takes `SessionOptions.env` and whose crash is recorded as `exited` ([execution modes](https://github.com/botiverse/oar/blob/main/docs/runtimes/cursor.md#execution-modes)).
161
161
 
162
162
  Community runtimes are contributed and maintained outside the core team (each maintainer is named on its runtime page). They ship in this package from a separate entry point, `@botiverse/oar/community`, and are not in `defaultRuntimes`: `createRuntimeRegistry([...defaultRuntimes.list(), createMorphRuntime()])` adds [Mister Morph](https://github.com/botiverse/oar/blob/main/docs/runtimes/morph.md), driven through its Console Runtime API. The `oar` CLI includes them.
163
163
 
@@ -154,7 +154,7 @@ export interface SessionOptions {
154
154
  * UnsupportedOptionError. See docs/spec/runtime-matrix.md#missing-resume-targets.
155
155
  */
156
156
  readonly resume?: string;
157
- /** Environment changes for the processes THIS session spawns: a string sets the variable (including an empty string); null removes it from the inherited environment. The host environment is never changed. Subprocess runtimes: the runtime process itself (tools inherit). In-process runtimes: only the agent's tool subprocesses; provider config needs the runtime's native channel there. CAVEAT for PATH-like entries: a runtime that runs tools through a login shell (codex: zsh/bash -lc) lets profile scripts reorder or rebuild PATH (probed: codex demotes injected entries on Linux and macOS path_helper/.zprofile can drop them). Injected CLIs should be invoked by ABSOLUTE path. Pi refuses removals combined with stdio mcpServers because its MCP transport re-inherits the host environment. Refused when non-empty by cursor, whose tools run in the host process with no environment of their own: `session()` rejects with `UnsupportedOptionError` (`Runtime.refusedSessionOptions`, docs/spec/runtime-matrix.md#refused-session-options).
157
+ /** Environment changes for the processes THIS session spawns: a string sets the variable (including an empty string); null removes it from the inherited environment. The host environment is never changed. Subprocess runtimes: the runtime process itself (tools inherit). In-process runtimes: only the agent's tool subprocesses; provider config needs the runtime's native channel there. CAVEAT for PATH-like entries: a runtime that runs tools through a login shell (codex: zsh/bash -lc) lets profile scripts reorder or rebuild PATH (probed: codex demotes injected entries on Linux and macOS path_helper/.zprofile can drop them). Injected CLIs should be invoked by ABSOLUTE path. Pi refuses removals combined with stdio mcpServers because its MCP transport re-inherits the host environment. Refused when non-empty by cursor in its default in-process mode, whose tools run in the host process with no environment of their own (its subprocess mode applies it to the session's child): `session()` rejects with `UnsupportedOptionError` (`Runtime.refusedSessionOptions`, docs/spec/runtime-matrix.md#refused-session-options).
158
158
  *
159
159
  * Credential-like names with non-path values of at least eight characters,
160
160
  * plus password-bearing connection URLs, are redacted within each OAR
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Copies a process's PATH can miss. The macOS Desktop app bundles the Codex
3
+ * CLI instead of putting it on PATH; OpenAI relocated the app from Codex.app
4
+ * to ChatGPT.app, so the new bundle is tried before the legacy one, and
5
+ * system installs before per-user installs. Then the standalone installer's
6
+ * launcher (https://chatgpt.com/codex/install.sh: `$CODEX_INSTALL_DIR/codex`,
7
+ * by default `~/.local/bin/codex`, a link into
8
+ * `$CODEX_HOME/packages/standalone/current`), which it adds to PATH only in
9
+ * shell profiles.
10
+ *
11
+ * On Windows (none of them on PATH): npm's global `codex.cmd` shim in its
12
+ * default prefix (`%APPDATA%\npm`; OAR runs the shim's Node script without
13
+ * cmd.exe, windows-shim.ts), then the Codex Desktop app's CLI
14
+ * (`%LOCALAPPDATA%\Programs\OpenAI\Codex\bin\codex.exe`, or without
15
+ * `Programs` for a per-user install). Newer Desktop builds keep the CLI one
16
+ * folder down, `bin\<build>\codex.exe` (a build hash; a user saw
17
+ * `bin\5449c1f0f26f1f98\codex.exe`, 2026-11-11), and older build folders can
18
+ * remain: after each fixed path come its build folders' CLIs, the most
19
+ * recently written first, so the probe settles on the newest that works.
20
+ * Locations as Raft's own Codex driver resolves them; the
21
+ * `codex-command-runner` sandbox helper beside them is never a candidate.
22
+ */
23
+ export declare function codexInstalledExecutableCandidates(platform?: NodeJS.Platform, home?: string, env?: Readonly<NodeJS.ProcessEnv>, builds?: (bin: string) => readonly string[]): readonly string[];
24
+ /**
25
+ * `<bin>\<build>\codex.exe` for the newest build folders that have one (at
26
+ * most three, the most recently written first); none when `bin` cannot be
27
+ * read. A folder whose name starts with `.` (a sandbox helper's, like
28
+ * `.sandbox-bin`) is never a build.
29
+ */
30
+ export declare function desktopBuildExecutables(bin: string): readonly string[];
31
+ //# sourceMappingURL=installation-candidates.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"installation-candidates.d.ts","sources":["../../../src/runtimes/codex/installation-candidates.ts"],"names":[],"mappings":"AAeA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,kCAAkC,CAChD,QAAQ,GAAE,MAAM,CAAC,QAA2B,EAC5C,IAAI,GAAE,MAAkB,EACxB,GAAG,GAAE,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAe,EAC9C,MAAM,GAAE,CAAC,GAAG,EAAE,MAAM,KAAK,SAAS,MAAM,EAA4B,GACnE,SAAS,MAAM,EAAE,CA0BnB;AAKD;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAStE"}
@@ -0,0 +1,92 @@
1
+ import { readdirSync, statSync } from "node:fs";
2
+ import { homedir } from "node:os";
3
+ import path from "node:path";
4
+ import { environmentValue } from "../../shared/environment.js";
5
+ /*
6
+ * Where Codex can be installed off PATH, as plain synchronous functions with
7
+ * no side effect beyond reading directories (the Desktop build folders). Its
8
+ * own module and subpath, `@botiverse/oar/runtimes/codex/installation-candidates`,
9
+ * so a host can list the candidates without loading the runtime or probing
10
+ * anything. `codexInstallation` (installation.ts) probes them in order, after
11
+ * `OAR_CODEX_BIN` and PATH, which this list does not include, and picks the
12
+ * first that answers `codex app-server --help`.
13
+ */
14
+ /**
15
+ * Copies a process's PATH can miss. The macOS Desktop app bundles the Codex
16
+ * CLI instead of putting it on PATH; OpenAI relocated the app from Codex.app
17
+ * to ChatGPT.app, so the new bundle is tried before the legacy one, and
18
+ * system installs before per-user installs. Then the standalone installer's
19
+ * launcher (https://chatgpt.com/codex/install.sh: `$CODEX_INSTALL_DIR/codex`,
20
+ * by default `~/.local/bin/codex`, a link into
21
+ * `$CODEX_HOME/packages/standalone/current`), which it adds to PATH only in
22
+ * shell profiles.
23
+ *
24
+ * On Windows (none of them on PATH): npm's global `codex.cmd` shim in its
25
+ * default prefix (`%APPDATA%\npm`; OAR runs the shim's Node script without
26
+ * cmd.exe, windows-shim.ts), then the Codex Desktop app's CLI
27
+ * (`%LOCALAPPDATA%\Programs\OpenAI\Codex\bin\codex.exe`, or without
28
+ * `Programs` for a per-user install). Newer Desktop builds keep the CLI one
29
+ * folder down, `bin\<build>\codex.exe` (a build hash; a user saw
30
+ * `bin\5449c1f0f26f1f98\codex.exe`, 2026-11-11), and older build folders can
31
+ * remain: after each fixed path come its build folders' CLIs, the most
32
+ * recently written first, so the probe settles on the newest that works.
33
+ * Locations as Raft's own Codex driver resolves them; the
34
+ * `codex-command-runner` sandbox helper beside them is never a candidate.
35
+ */
36
+ export function codexInstalledExecutableCandidates(platform = process.platform, home = homedir(), env = process.env, builds = desktopBuildExecutables) {
37
+ if (platform === "win32") {
38
+ const win = path.win32;
39
+ // Windows variable names are case-insensitive (`AppData` is `APPDATA`).
40
+ const folder = (name, fallback) => {
41
+ const value = environmentValue(env, name, platform);
42
+ return value === undefined || value === "" ? fallback : value;
43
+ };
44
+ const roaming = folder("APPDATA", win.join(home, "AppData", "Roaming"));
45
+ const local = folder("LOCALAPPDATA", win.join(home, "AppData", "Local"));
46
+ const desktop = [win.join(local, "Programs", "OpenAI", "Codex", "bin"), win.join(local, "OpenAI", "Codex", "bin")];
47
+ const candidates = [win.join(roaming, "npm", "codex.cmd")];
48
+ for (const bin of desktop) {
49
+ candidates.push(win.join(bin, "codex.exe"), ...builds(bin));
50
+ }
51
+ return candidates;
52
+ }
53
+ const paths = path.posix;
54
+ const bundles = platform === "darwin"
55
+ ? [
56
+ "/Applications/ChatGPT.app/Contents/Resources/codex",
57
+ "/Applications/Codex.app/Contents/Resources/codex",
58
+ paths.join(home, "Applications", "ChatGPT.app", "Contents", "Resources", "codex"),
59
+ paths.join(home, "Applications", "Codex.app", "Contents", "Resources", "codex"),
60
+ ]
61
+ : [];
62
+ const installDir = env.CODEX_INSTALL_DIR === undefined || env.CODEX_INSTALL_DIR === "" ? [] : [paths.join(env.CODEX_INSTALL_DIR, "codex")];
63
+ return [...bundles, ...installDir, paths.join(home, ".local", "bin", "codex")];
64
+ }
65
+ /** At most this many build folders are probed: Raft's own driver takes the newest three. */
66
+ const DESKTOP_BUILDS = 3;
67
+ /**
68
+ * `<bin>\<build>\codex.exe` for the newest build folders that have one (at
69
+ * most three, the most recently written first); none when `bin` cannot be
70
+ * read. A folder whose name starts with `.` (a sandbox helper's, like
71
+ * `.sandbox-bin`) is never a build.
72
+ */
73
+ export function desktopBuildExecutables(bin) {
74
+ let folders = [];
75
+ try {
76
+ folders = readdirSync(bin, { withFileTypes: true }).filter((entry) => entry.isDirectory() && !entry.name.startsWith(".")).map((entry) => entry.name);
77
+ }
78
+ catch {
79
+ return [];
80
+ }
81
+ return folders.flatMap((folder) => {
82
+ // The real filesystem: the host's own separator (Windows when it matters).
83
+ const file = path.join(bin, folder, "codex.exe");
84
+ try {
85
+ return [{ file, written: statSync(file).mtimeMs }];
86
+ }
87
+ catch {
88
+ return [];
89
+ }
90
+ }).toSorted((left, right) => right.written - left.written).slice(0, DESKTOP_BUILDS).map((entry) => entry.file);
91
+ }
92
+ //# sourceMappingURL=installation-candidates.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"installation-candidates.js","sources":["../../../src/runtimes/codex/installation-candidates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAE/D;;;;;;;;GAQG;AAEH;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,UAAU,kCAAkC,CAChD,QAAQ,GAAoB,OAAO,CAAC,QAAQ,EAC5C,IAAI,GAAW,OAAO,EAAE,EACxB,GAAG,GAAgC,OAAO,CAAC,GAAG,EAC9C,MAAM,GAAuC,uBAAuB;IAEpE,IAAI,QAAQ,KAAK,OAAO,EAAE,CAAC;QACzB,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC;QACvB,wEAAwE;QACxE,MAAM,MAAM,GAAG,CAAC,IAAY,EAAE,QAAgB,EAAU,EAAE;YACxD,MAAM,KAAK,GAAG,gBAAgB,CAAC,GAAG,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;YACpD,OAAO,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC;QAChE,CAAC,CAAC;QACF,MA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AAC,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AACjH,CAAC"}
@@ -1,32 +1,3 @@
1
- /**
2
- * Copies a process's PATH can miss. The macOS Desktop app bundles the Codex
3
- * CLI instead of putting it on PATH; OpenAI relocated the app from Codex.app
4
- * to ChatGPT.app, so the new bundle is tried before the legacy one, and
5
- * system installs before per-user installs. Then the standalone installer's
6
- * launcher (https://chatgpt.com/codex/install.sh: `$CODEX_INSTALL_DIR/codex`,
7
- * by default `~/.local/bin/codex`, a link into
8
- * `$CODEX_HOME/packages/standalone/current`), which it adds to PATH only in
9
- * shell profiles.
10
- *
11
- * On Windows (none of them on PATH): npm's global `codex.cmd` shim in its
12
- * default prefix (`%APPDATA%\npm`; OAR runs the shim's Node script without
13
- * cmd.exe, windows-shim.ts), then the Codex Desktop app's CLI
14
- * (`%LOCALAPPDATA%\Programs\OpenAI\Codex\bin\codex.exe`, or without
15
- * `Programs` for a per-user install). Newer Desktop builds keep the CLI one
16
- * folder down, `bin\<build>\codex.exe` (a build hash; a user saw
17
- * `bin\5449c1f0f26f1f98\codex.exe`, 2026-11-11), and older build folders can
18
- * remain: after each fixed path come its build folders' CLIs, the most
19
- * recently written first, so the probe settles on the newest that works.
20
- * Locations as Raft's own Codex driver resolves them; the
21
- * `codex-command-runner` sandbox helper beside them is never a candidate.
22
- */
23
- export declare function codexInstalledExecutableCandidates(platform?: NodeJS.Platform, home?: string, env?: Readonly<NodeJS.ProcessEnv>, builds?: (bin: string) => readonly string[]): readonly string[];
24
- /**
25
- * `<bin>\<build>\codex.exe` for the newest build folders that have one (at
26
- * most three, the most recently written first); none when `bin` cannot be
27
- * read. A folder whose name starts with `.` (a sandbox helper's, like
28
- * `.sandbox-bin`) is never a build.
29
- */
30
- export declare function desktopBuildExecutables(bin: string): readonly string[];
1
+ export { codexInstalledExecutableCandidates, desktopBuildExecutables } from "./installation-candidates.js";
31
2
  export declare const codexInstallation: import("../../browser.js").InstallationProbe;
32
3
  //# sourceMappingURL=installation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"installation.d.ts","sources":["../../../src/runtimes/codex/installation.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,kCAAkC,CAChD,QAAQ,GAAE,MAAM,CAAC,QAA2B,EAC5C,IAAI,GAAE,MAAkB,EACxB,GAAG,GAAE,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAe,EAC9C,MAAM,GAAE,CAAC,GAAG,EAAE,MAAM,KAAK,SAAS,MAAM,EAA4B,GACnE,SAAS,MAAM,EAAE,CA0BnB;AAKD;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAStE;AAGD,eAAO,MAAM,iBAAiB,8CAK7B,CAAC"}
1
+ {"version":3,"file":"installation.d.ts","sources":["../../../src/runtimes/codex/installation.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,kCAAkC,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAG3G,eAAO,MAAM,iBAAiB,8CAK7B,CAAC"}
@@ -1,87 +1,7 @@
1
1
  import { environmentHome } from "../../shared/environment-home.js";
2
- import { environmentValue } from "../../shared/environment.js";
3
- import { readdirSync, statSync } from "node:fs";
4
- import { homedir } from "node:os";
5
- import path from "node:path";
6
2
  import { executableInstallation } from "../../shared/installation.js";
7
- /**
8
- * Copies a process's PATH can miss. The macOS Desktop app bundles the Codex
9
- * CLI instead of putting it on PATH; OpenAI relocated the app from Codex.app
10
- * to ChatGPT.app, so the new bundle is tried before the legacy one, and
11
- * system installs before per-user installs. Then the standalone installer's
12
- * launcher (https://chatgpt.com/codex/install.sh: `$CODEX_INSTALL_DIR/codex`,
13
- * by default `~/.local/bin/codex`, a link into
14
- * `$CODEX_HOME/packages/standalone/current`), which it adds to PATH only in
15
- * shell profiles.
16
- *
17
- * On Windows (none of them on PATH): npm's global `codex.cmd` shim in its
18
- * default prefix (`%APPDATA%\npm`; OAR runs the shim's Node script without
19
- * cmd.exe, windows-shim.ts), then the Codex Desktop app's CLI
20
- * (`%LOCALAPPDATA%\Programs\OpenAI\Codex\bin\codex.exe`, or without
21
- * `Programs` for a per-user install). Newer Desktop builds keep the CLI one
22
- * folder down, `bin\<build>\codex.exe` (a build hash; a user saw
23
- * `bin\5449c1f0f26f1f98\codex.exe`, 2026-11-11), and older build folders can
24
- * remain: after each fixed path come its build folders' CLIs, the most
25
- * recently written first, so the probe settles on the newest that works.
26
- * Locations as Raft's own Codex driver resolves them; the
27
- * `codex-command-runner` sandbox helper beside them is never a candidate.
28
- */
29
- export function codexInstalledExecutableCandidates(platform = process.platform, home = homedir(), env = process.env, builds = desktopBuildExecutables) {
30
- if (platform === "win32") {
31
- const win = path.win32;
32
- // Windows variable names are case-insensitive (`AppData` is `APPDATA`).
33
- const folder = (name, fallback) => {
34
- const value = environmentValue(env, name, platform);
35
- return value === undefined || value === "" ? fallback : value;
36
- };
37
- const roaming = folder("APPDATA", win.join(home, "AppData", "Roaming"));
38
- const local = folder("LOCALAPPDATA", win.join(home, "AppData", "Local"));
39
- const desktop = [win.join(local, "Programs", "OpenAI", "Codex", "bin"), win.join(local, "OpenAI", "Codex", "bin")];
40
- const candidates = [win.join(roaming, "npm", "codex.cmd")];
41
- for (const bin of desktop) {
42
- candidates.push(win.join(bin, "codex.exe"), ...builds(bin));
43
- }
44
- return candidates;
45
- }
46
- const paths = path.posix;
47
- const bundles = platform === "darwin"
48
- ? [
49
- "/Applications/ChatGPT.app/Contents/Resources/codex",
50
- "/Applications/Codex.app/Contents/Resources/codex",
51
- paths.join(home, "Applications", "ChatGPT.app", "Contents", "Resources", "codex"),
52
- paths.join(home, "Applications", "Codex.app", "Contents", "Resources", "codex"),
53
- ]
54
- : [];
55
- const installDir = env.CODEX_INSTALL_DIR === undefined || env.CODEX_INSTALL_DIR === "" ? [] : [paths.join(env.CODEX_INSTALL_DIR, "codex")];
56
- return [...bundles, ...installDir, paths.join(home, ".local", "bin", "codex")];
57
- }
58
- /** At most this many build folders are probed: Raft's own driver takes the newest three. */
59
- const DESKTOP_BUILDS = 3;
60
- /**
61
- * `<bin>\<build>\codex.exe` for the newest build folders that have one (at
62
- * most three, the most recently written first); none when `bin` cannot be
63
- * read. A folder whose name starts with `.` (a sandbox helper's, like
64
- * `.sandbox-bin`) is never a build.
65
- */
66
- export function desktopBuildExecutables(bin) {
67
- let folders = [];
68
- try {
69
- folders = readdirSync(bin, { withFileTypes: true }).filter((entry) => entry.isDirectory() && !entry.name.startsWith(".")).map((entry) => entry.name);
70
- }
71
- catch {
72
- return [];
73
- }
74
- return folders.flatMap((folder) => {
75
- // The real filesystem: the host's own separator (Windows when it matters).
76
- const file = path.join(bin, folder, "codex.exe");
77
- try {
78
- return [{ file, written: statSync(file).mtimeMs }];
79
- }
80
- catch {
81
- return [];
82
- }
83
- }).toSorted((left, right) => right.written - left.written).slice(0, DESKTOP_BUILDS).map((entry) => entry.file);
84
- }
3
+ import { codexInstalledExecutableCandidates } from "./installation-candidates.js";
4
+ export { codexInstalledExecutableCandidates, desktopBuildExecutables } from "./installation-candidates.js";
85
5
  // OAR drives Codex through its app-server surface; a codex without it is unsupported.
86
6
  export const codexInstallation = executableInstallation("OAR_CODEX_BIN", "codex", (env) => codexInstalledExecutableCandidates(process.platform, environmentHome(env), env), ["app-server", "--help"]);
87
7
  //# sourceMappingURL=installation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"installation.js","sources":["../../../src/runtimes/codex/installation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM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"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,EAAE,kCAAkC,EAAE,MAAM,8BAA8B,CAAC;AAElF,OAAO,EAAE,kCAAkC,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAE3G,sFAAsF;AACtF,MAAM,CAAC,MAAM,iBAAiB,GAAG,sBAAsB,CACrD,eAAe,EACf,OAAO,EACP,CAAC,GAAG,EAAE,EAAE,CAAC,kCAAkC,CAAC,OAAO,CAAC,QAAQ,EAAE,eAAe,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,EACxF,CAAC,YAAY,EAAE,QAAQ,CAAC,CACzB,CAAC"}
@@ -0,0 +1,68 @@
1
+ import type { RefusedSessionOptions } from "../../contracts/runtime.js";
2
+ import type { SessionOptions } from "../../contracts/session.js";
3
+ import { type CursorSdk } from "./sdk.js";
4
+ import { type CursorChildExit } from "./subprocess/channel.js";
5
+ /** The SDK for one session or one call, and what reaching it started. */
6
+ export interface CursorSdkLease {
7
+ readonly sdk: CursorSdk;
8
+ /** The environment the SDK and its tools run with. */
9
+ readonly env: Readonly<NodeJS.ProcessEnv>;
10
+ /** In subprocess mode, the child: its exit, observed once. Null in process. */
11
+ readonly child: {
12
+ onExit(listener: (exit: CursorChildExit) => void): void;
13
+ stopping(): boolean;
14
+ } | null;
15
+ /** Ends what the lease started (the child and its tree), with its exit; null in process. */
16
+ release(): Promise<CursorChildExit | null>;
17
+ }
18
+ /**
19
+ * How the adapter reaches `@cursor/sdk`. `in_process`: the host's loaded
20
+ * SDK, shared by every session and call, in the host's environment.
21
+ * `subprocess`: a fresh Node child per session or call, which imports the
22
+ * SDK itself, with its own environment (subprocess/).
23
+ */
24
+ export interface CursorSdkAccess {
25
+ readonly execution: "in_process" | "subprocess";
26
+ /** The session options this mode refuses. */
27
+ readonly refusedSessionOptions: RefusedSessionOptions;
28
+ /** The environment a lease with `env` runs in, without opening one. */
29
+ environment(env: SessionOptions["env"]): Readonly<NodeJS.ProcessEnv>;
30
+ /**
31
+ * An SDK with `env` over the host's environment; rejects when the SDK
32
+ * cannot be loaded. `session`: the lease is a session's, whose tools the
33
+ * host ends after the child (one-shot calls run no tools).
34
+ */
35
+ lease(env: SessionOptions["env"], use?: "session" | "call"): Promise<CursorSdkLease>;
36
+ }
37
+ /** Why the in-process mode refuses a nonempty `env` for login, logout and the status. */
38
+ export declare const IN_PROCESS_ENV = "Cursor authentication runs in the host process and cannot isolate env; configure the host environment before loading the SDK, or use the subprocess execution mode.";
39
+ /** The host's loaded SDK, or a whole access. A plain loader is the in-process mode. */
40
+ export type CursorSdkSource = (() => Promise<CursorSdk>) | CursorSdkAccess;
41
+ /**
42
+ * The SDK in this process, through the host's loader. `loadOnce` wraps it
43
+ * in `cursorSdkLoader` (one load, retried after a failure); tests that hand
44
+ * over a loader of their own pass false. Callers refuse a nonempty `env` first.
45
+ */
46
+ export declare function inProcessAccess(loader: () => Promise<CursorSdk>, loadOnce?: boolean): CursorSdkAccess;
47
+ /**
48
+ * One child per lease, importing `sdkModule`. Its environment is `env` over
49
+ * the host's (`inherit`), or `env`'s string entries alone (`clean`); the
50
+ * child adds only what it needs to run the SDK (subprocess/child-script.ts).
51
+ * `CURSOR_API_KEY` is taken out of that environment (every letter case on
52
+ * Windows) and handed to the SDK as `apiKey` instead (subprocess/proxy.ts),
53
+ * so the agent's tools neither inherit it nor can read it from the child's
54
+ * `/proc/<pid>/environ`.
55
+ */
56
+ export declare function subprocessAccess(sdkModule: string, envBase?: "inherit" | "clean"): CursorSdkAccess;
57
+ export declare function cursorSdkAccess(source: CursorSdkSource): CursorSdkAccess;
58
+ /**
59
+ * Redaction for one model listing, login, logout or status call: the
60
+ * credentials in that call's `env` (`CURSOR_API_KEY` among them, whatever
61
+ * its shape), the same rules sessions apply to `SessionOptions.env`.
62
+ */
63
+ export declare function callRedaction(env: SessionOptions["env"]): <T>(value: T) => T;
64
+ /** Use a lease and release it; a lease that cannot be had is `{ failed }` with its reason. */
65
+ export declare function withLease<T>(access: CursorSdkAccess, env: SessionOptions["env"], use: (sdk: CursorSdk, lease: CursorSdkLease) => Promise<T>): Promise<T | {
66
+ readonly failed: string;
67
+ }>;
68
+ //# sourceMappingURL=access.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"access.d.ts","sources":["../../../src/runtimes/cursor/access.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAIjE,OAAO,EAAmB,KAAK,SAAS,EAAE,MAAM,UAAU,CAAC;AAC3D,OAAO,EAAqB,KAAK,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAGlF,yEAAyE;AACzE,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAC;IACxB,sDAAsD;IACtD,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IAC1C,+EAA+E;IAC/E,QAAQ,CAAC,KAAK,EAAE;QACd,MAAM,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,eAAe,KAAK,IAAI,GAAG,IAAI,CAAC;QACxD,QAAQ,IAAI,OAAO,CAAC;KACrB,GAAG,IAAI,CAAC;IACT,4FAA4F;IAC5F,OAAO,IAAI,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CAAC;CAC5C;AAED;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,SAAS,EAAE,YAAY,GAAG,YAAY,CAAC;IAChD,6CAA6C;IAC7C,QAAQ,CAAC,qBAAqB,EAAE,qBAAqB,CAAC;IACtD,uEAAuE;IACvE,WAAW,CAAC,GAAG,EAAE,cAAc,CAAC,KAAK,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IACrE;;;;OAIG;IACH,KAAK,CAAC,GAAG,EAAE,cAAc,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;CACtF;AAED,yFAAyF;AACzF,eAAO,MAAM,cAAc,wKAAwK,CAAC;AAEpM,uFAAuF;AACvF,MAAM,MAAM,eAAe,GAAG,CAAC,MAAM,OAAO,CAAC,SAAS,CAAC,CAAC,GAAG,eAAe,CAAC;AAE3E;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,OAAO,CAAC,SAAS,CAAC,EAAE,QAAQ,UAAQ,GAAG,eAAe,CAWnG;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,GAAE,SAAS,GAAG,OAAmB,GAAG,eAAe,CAc7G;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,eAAe,GAAG,eAAe,CAExE;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,cAAc,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,KAAK,CAAC,CAE5E;AAED,8FAA8F;AAC9F,wBAAsB,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,eAAe,EAAE,GAAG,EAAE,cAAc,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE,SAAS,EAAE,KAAK,EAAE,cAAc,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,GAAG;IAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAY5L"}
@@ -0,0 +1,77 @@
1
+ import { sessionCredentialRedactor } from "../../shared/credential-redactor.js";
2
+ import { environmentValue, sessionEnvironment } from "../../shared/environment.js";
3
+ import { cursorRefusedSessionOptions, cursorSubprocessRefusedSessionOptions } from "./model.js";
4
+ import { cursorSdkLoader } from "./sdk.js";
5
+ import { openCursorChannel } from "./subprocess/channel.js";
6
+ import { proxySdk } from "./subprocess/proxy.js";
7
+ /** Why the in-process mode refuses a nonempty `env` for login, logout and the status. */
8
+ export const IN_PROCESS_ENV = "Cursor authentication runs in the host process and cannot isolate env; configure the host environment before loading the SDK, or use the subprocess execution mode.";
9
+ /**
10
+ * The SDK in this process, through the host's loader. `loadOnce` wraps it
11
+ * in `cursorSdkLoader` (one load, retried after a failure); tests that hand
12
+ * over a loader of their own pass false. Callers refuse a nonempty `env` first.
13
+ */
14
+ export function inProcessAccess(loader, loadOnce = false) {
15
+ const load = loadOnce ? cursorSdkLoader(loader) : loader;
16
+ return {
17
+ execution: "in_process",
18
+ refusedSessionOptions: cursorRefusedSessionOptions,
19
+ environment: () => process.env,
20
+ async lease() {
21
+ const sdk = await load();
22
+ return { sdk, env: process.env, child: null, release: async () => { await Promise.resolve(); return null; } };
23
+ },
24
+ };
25
+ }
26
+ /**
27
+ * One child per lease, importing `sdkModule`. Its environment is `env` over
28
+ * the host's (`inherit`), or `env`'s string entries alone (`clean`); the
29
+ * child adds only what it needs to run the SDK (subprocess/child-script.ts).
30
+ * `CURSOR_API_KEY` is taken out of that environment (every letter case on
31
+ * Windows) and handed to the SDK as `apiKey` instead (subprocess/proxy.ts),
32
+ * so the agent's tools neither inherit it nor can read it from the child's
33
+ * `/proc/<pid>/environ`.
34
+ */
35
+ export function subprocessAccess(sdkModule, envBase = "inherit") {
36
+ const environment = (overlay) => (envBase === "clean" ? sessionEnvironment(overlay, {}) : sessionEnvironment(overlay));
37
+ return {
38
+ execution: "subprocess",
39
+ refusedSessionOptions: cursorSubprocessRefusedSessionOptions,
40
+ environment,
41
+ async lease(overlay, use = "call") {
42
+ const env = environment(overlay);
43
+ const apiKey = environmentValue(env, "CURSOR_API_KEY");
44
+ const childEnv = apiKey === undefined ? env : sessionEnvironment({ CURSOR_API_KEY: null }, env);
45
+ const channel = await openCursorChannel(sdkModule, childEnv, use === "session");
46
+ return { sdk: proxySdk(channel, apiKey), env, child: channel, release: async () => { const exit = await channel.stop(); return exit; } };
47
+ },
48
+ };
49
+ }
50
+ export function cursorSdkAccess(source) {
51
+ return typeof source === "function" ? inProcessAccess(source) : source;
52
+ }
53
+ /**
54
+ * Redaction for one model listing, login, logout or status call: the
55
+ * credentials in that call's `env` (`CURSOR_API_KEY` among them, whatever
56
+ * its shape), the same rules sessions apply to `SessionOptions.env`.
57
+ */
58
+ export function callRedaction(env) {
59
+ return sessionCredentialRedactor(env === undefined ? {} : { env }).redactValue;
60
+ }
61
+ /** Use a lease and release it; a lease that cannot be had is `{ failed }` with its reason. */
62
+ export async function withLease(access, env, use) {
63
+ let lease = null;
64
+ try {
65
+ lease = await access.lease(env);
66
+ }
67
+ catch (error) {
68
+ return { failed: error instanceof Error ? error.message : String(error) };
69
+ }
70
+ try {
71
+ return await use(lease.sdk, lease);
72
+ }
73
+ finally {
74
+ await lease.release();
75
+ }
76
+ }
77
+ //# sourceMappingURL=access.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"access.js","sources":["../../../src/runtimes/cursor/access.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,yBAAyB,EAAE,MAAM,qCAAqC,CAAC;AAChF,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACnF,OAAO,EAAE,2BAA2B,EAAE,qCAAqC,EAAE,MAAM,YAAY,CAAC;AAChG,OAAO,EAAE,eAAe,EAAkB,MAAM,UAAU,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAwB,MAAM,yBAAyB,CAAC;AAClF,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAoCjD,yFAAyF;AACzF,MAAM,CAAC,MAAM,cAAc,GAAG,qKAAqK,CAAC;AAKpM;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,MAAgC,EAAE,QAAQ,GAAG,KAAK;IAChF,MAAM,IAAI,GAAG,QA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,KAAK,CAAC,OAAO,EAAE,CAAC;IACxB,CAAC;AACH,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import type { AuthStatus, AuthStatusReader } from "../../contracts/login.js";
2
- import { type CursorAuth, type CursorSdk } from "./sdk.js";
2
+ import { type CursorSdkSource } from "./access.js";
3
+ import type { CursorAuth } from "./sdk.js";
3
4
  /**
4
5
  * `Cursor.auth.status()` (SDK 1.3.1) reads the stored login
5
6
  * (`~/.cursor/sdk/auth.json`) and answers `{ status: "logged-out" }`, also
@@ -10,6 +11,6 @@ import { type CursorAuth, type CursorSdk } from "./sdk.js";
10
11
  export declare function projectCursorAuthStatus(status: unknown): AuthStatus;
11
12
  /** `Cursor.auth.status()` within `timeoutMs`; a failure, or no answer in time, is `unknown`. */
12
13
  export declare function readCursorAuthStatus(auth: CursorAuth, timeoutMs?: number): Promise<AuthStatus>;
13
- /** Read only: asks the SDK's `Cursor.auth.status`, never a login flow, and returns no key. */
14
- export declare function cursorAuthStatusWith(load: () => Promise<CursorSdk>): AuthStatusReader;
14
+ /** Read only: asks the SDK's `Cursor.auth.status`, never a login flow, and returns no key. In subprocess mode it asks in a child with `env`. */
15
+ export declare function cursorAuthStatusWith(source: CursorSdkSource): AuthStatusReader;
15
16
  //# sourceMappingURL=auth-status.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"auth-status.d.ts","sources":["../../../src/runtimes/cursor/auth-status.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAgB,MAAM,0BAA0B,CAAC;AAI3F,OAAO,EAAa,KAAK,UAAU,EAAE,KAAK,SAAS,EAAE,MAAM,UAAU,CAAC;AAStE;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,OAAO,GAAG,UAAU,CAmBnE;AAED,gGAAgG;AAChG,wBAAsB,oBAAoB,CAAC,IAAI,EAAE,UAAU,EAAE,SAAS,SAAoB,GAAG,OAAO,CAAC,UAAU,CAAC,CAc/G;AAED,8FAA8F;AAC9F,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,OAAO,CAAC,SAAS,CAAC,GAAG,gBAAgB,CA4BrF"}
1
+ {"version":3,"file":"auth-status.d.ts","sources":["../../../src/runtimes/cursor/auth-status.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAgB,MAAM,0BAA0B,CAAC;AAK3F,OAAO,EAA6D,KAAK,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9G,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAS3C;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,OAAO,GAAG,UAAU,CAmBnE;AAED,gGAAgG;AAChG,wBAAsB,oBAAoB,CAAC,IAAI,EAAE,UAAU,EAAE,SAAS,SAAoB,GAAG,OAAO,CAAC,UAAU,CAAC,CAc/G;AAED,gJAAgJ;AAChJ,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,eAAe,GAAG,gBAAgB,CA6B9E"}
@@ -3,7 +3,8 @@ import { UnsupportedOptionError } from "../../contracts/errors.js";
3
3
  import { utcInstantFromDate } from "../../shared/instant.js";
4
4
  import { asNumber, asRecord } from "../../shared/json.js";
5
5
  import { errorMessage, LoginSecrets } from "../../shared/login.js";
6
- import { loadedSdk } from "./sdk.js";
6
+ import { environmentValue } from "../../shared/environment.js";
7
+ import { callRedaction, cursorSdkAccess, IN_PROCESS_ENV, withLease } from "./access.js";
7
8
  const STATUS_TIMEOUT_MS = 20_000;
8
9
  const STATUS_SOURCE = "Cursor.auth.status";
9
10
  function text(value) {
@@ -54,32 +55,33 @@ export async function readCursorAuthStatus(auth, timeoutMs = STATUS_TIMEOUT_MS)
54
55
  clearTimeout(timer);
55
56
  }
56
57
  }
57
- /** Read only: asks the SDK's `Cursor.auth.status`, never a login flow, and returns no key. */
58
- export function cursorAuthStatusWith(load) {
58
+ /** Read only: asks the SDK's `Cursor.auth.status`, never a login flow, and returns no key. In subprocess mode it asks in a child with `env`. */
59
+ export function cursorAuthStatusWith(source) {
60
+ const access = cursorSdkAccess(source);
59
61
  const reader = async (installation, options = {}) => {
60
- if (options.env !== undefined && Object.keys(options.env).length > 0) {
61
- throw new UnsupportedOptionError("env", "Cursor authentication runs in the host process and cannot isolate env; configure the host environment before loading the SDK.");
62
+ if (access.execution === "in_process" && options.env !== undefined && Object.keys(options.env).length > 0) {
63
+ throw new UnsupportedOptionError("env", IN_PROCESS_ENV);
62
64
  }
63
65
  if (installation.via !== "bundled") {
64
66
  return { kind: "unknown", detail: "cursor's sign-in status needs the bundled @cursor/sdk" };
65
67
  }
66
- if (process.env.CURSOR_API_KEY !== undefined) {
68
+ if (environmentValue(access.environment(options.env), "CURSOR_API_KEY") !== undefined) {
67
69
  return { kind: "unknown", configured: ["environment: CURSOR_API_KEY"], detail: "Sessions use CURSOR_API_KEY from the environment; Cursor.auth.status neither reads nor validates that key.", source: STATUS_SOURCE };
68
70
  }
69
71
  const result = await withQueryDeadline("Cursor auth status", options.timeoutMs ?? STATUS_TIMEOUT_MS, async (signal) => {
70
- const sdk = await loadedSdk(load);
71
- signal.throwIfAborted();
72
- if ("failed" in sdk) {
73
- return { kind: "unknown", detail: new LoginSecrets().line(sdk.failed) };
74
- }
75
- const { auth } = sdk.Cursor;
76
- if (auth === undefined) {
77
- return { kind: "unknown", detail: "this @cursor/sdk has no Cursor.auth; OAR needs 1.3.1" };
78
- }
79
- const status = await readCursorAuthStatus(auth, options.timeoutMs);
80
- return status;
72
+ const status = await withLease(access, options.env, async (sdk) => {
73
+ signal.throwIfAborted();
74
+ const { auth } = sdk.Cursor;
75
+ if (auth === undefined) {
76
+ return { kind: "unknown", detail: "this @cursor/sdk has no Cursor.auth; OAR needs 1.3.1" };
77
+ }
78
+ const read = await readCursorAuthStatus(auth, options.timeoutMs);
79
+ return read;
80
+ });
81
+ return "failed" in status ? { kind: "unknown", detail: new LoginSecrets().line(status.failed) } : status;
81
82
  }, { kind: "unknown", source: STATUS_SOURCE, detail: `Cursor.auth.status did not answer within ${String(options.timeoutMs ?? STATUS_TIMEOUT_MS)} ms` });
82
- return result;
83
+ // Details can carry the SDK's or the child's words: redacted with the call's credentials too.
84
+ return callRedaction(options.env)(result);
83
85
  };
84
86
  // With no status options, the official SDK uses only its local file store.
85
87
  return Object.assign(reader, { localOnly: true });
@@ -1 +1 @@
1
- {"version":3,"file":"auth-status.js","sources":["../../../src/runtimes/cursor/auth-status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAEnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAE,SAAS,EAAmC,MAAM,UAAU,CAAC;AAEtE,MAAM,iBAAiB,GAAG,MAAM,CAAC;AACjC,MAAM,aAAa,GAAG,oBAAoB,CAAC;AAE3C,SAAS,IAAI,CAAC,KAAc;IAC1B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;AACrF,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,uBAAuB,CAAC,MAAe;IACrD,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;IAChC,IAAI,MAAM,EAAE,MAAM,KAAK,YAAY,EAAE,CAAC;QACpC,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC;IACvD,CAAC;IACD,IAAI,MAAM,EAAE,MAAM,KAAK,WAAW,EAAE,C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