@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
@@ -1,6 +1,8 @@
1
1
  import { type Runtime } from "../../contracts/runtime.js";
2
- import { type CursorSdk } from "./sdk.js";
3
- export interface CursorRuntimeOptions {
2
+ import type { CursorSdk } from "./sdk.js";
3
+ /** The default mode: the SDK runs in the host process. */
4
+ export interface CursorInProcessOptions {
5
+ readonly execution?: "in_process";
4
6
  /**
5
7
  * Loads `@cursor/sdk` 1.3.1, which the host installs (an optional peer
6
8
  * dependency of OAR): `() => import("@cursor/sdk")`. Written in the host's
@@ -10,18 +12,56 @@ export interface CursorRuntimeOptions {
10
12
  * retried by the next call.
11
13
  */
12
14
  readonly sdk: () => Promise<CursorSdk>;
15
+ /** Subprocess mode only: in process, the SDK's tools always see the host's environment. */
16
+ readonly envBase?: never;
13
17
  }
18
+ /** Each session, and each model listing, login, logout and status call, runs the SDK in a Node child process of its own. */
19
+ export interface CursorSubprocessOptions {
20
+ readonly execution: "subprocess";
21
+ /**
22
+ * What the child passes to `import()` to load `@cursor/sdk` 1.3.1: a file
23
+ * URL, e.g. `import.meta.resolve("@cursor/sdk")` in the host's own code.
24
+ * The host never loads the SDK itself in this mode, so nothing checks the
25
+ * module's types against `CursorSdk` at compile time.
26
+ */
27
+ readonly sdkModule: string;
28
+ /**
29
+ * What a child's environment starts from before the session's or call's
30
+ * `env` is applied. `inherit` (the default): the host's whole
31
+ * `process.env`, as for process runtimes. `clean`: nothing; the child gets
32
+ * only the string entries of `env`, plus what OAR adds to run the SDK
33
+ * (docs/runtimes/cursor.md#child-environment). A host that wants an
34
+ * allowlist uses `clean` and passes what Node and the SDK need, such as
35
+ * PATH and HOME.
36
+ */
37
+ readonly envBase?: "inherit" | "clean";
38
+ }
39
+ export type CursorRuntimeOptions = CursorInProcessOptions | CursorSubprocessOptions;
14
40
  /** A cursor runtime: its probe, model listing, login, logout, status and refusals are always there. */
15
41
  export type CursorRuntime = Runtime & Required<Pick<Runtime, "installation" | "listModels" | "login" | "logout" | "authStatus" | "refusedSessionOptions">>;
16
42
  /**
17
- * Cursor, embedded through its official SDK (`@cursor/sdk`): the agent runs
18
- * in this process, the way pi does. It is not in `defaultRuntimes`, because
19
- * the SDK is the host's to install and hand over; a host that wants cursor
20
- * adds `createCursorRuntime({ sdk })` to its own registry
21
- * (docs/design/capabilities.md#a-runtimes-own-settings). Account usage is
22
- * absent: the SDK's usage call is not available to every account
23
- * (`feature_unavailable`, probed 2026-10-03), and each run reports its own
24
- * tokens anyway. Login, logout and the status are the SDK's own
43
+ * Cursor, embedded through its official SDK (`@cursor/sdk`). It is not in
44
+ * `defaultRuntimes`, because the SDK is the host's to install and hand over;
45
+ * a host that wants cursor adds `createCursorRuntime(...)` to its own
46
+ * registry (docs/design/capabilities.md#a-runtimes-own-settings).
47
+ *
48
+ * Two execution modes (docs/runtimes/cursor.md#execution-modes):
49
+ * - `{ sdk }` (the default, `execution: "in_process"`): the agent runs in
50
+ * this process, the way pi does. Its tools inherit the host's whole
51
+ * environment, so `SessionOptions.env` is refused, and an SDK crash is the
52
+ * host's crash.
53
+ * - `{ execution: "subprocess", sdkModule }`: each session runs the SDK in
54
+ * its own Node child (`process.execPath`), whose environment is
55
+ * `SessionOptions.env` over the host's (`envBase: "inherit"`, the default)
56
+ * or over nothing (`envBase: "clean"`); a child that exits is recorded as
57
+ * `exited`, and a child whose host is gone, SIGKILL included, ends itself
58
+ * and what it started, as far as docs/runtimes/cursor.md#execution-modes
59
+ * says per platform. Model listing, login, logout and the status each run in a
60
+ * one-shot child and take `env` the same way.
61
+ *
62
+ * Account usage is absent: the SDK's usage call is not available to every
63
+ * account (`feature_unavailable`, probed 2026-10-03), and each run reports
64
+ * its own tokens anyway. Login, logout and the status are the SDK's own
25
65
  * `Cursor.auth`.
26
66
  */
27
67
  export declare function createCursorRuntime(options: CursorRuntimeOptions): CursorRuntime;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sources":["../../../src/runtimes/cursor/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAiB,KAAK,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAOzE,OAAO,EAAmB,KAAK,SAAS,EAAE,MAAM,UAAU,CAAC;AAG3D,MAAM,WAAW,oBAAoB;IACnC;;;;;;;OAOG;IACH,QAAQ,CAAC,GAAG,EAAE,MAAM,OAAO,CAAC,SAAS,CAAC,CAAC;CACxC;AAED,uGAAuG;AACvG,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,GAAG,YAAY,GAAG,OAAO,GAAG,QAAQ,GAAG,YAAY,GAAG,uBAAuB,CAAC,CAAC,CAAC;AAE3J;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,oBAAoB,GAAG,aAAa,CAchF;AAED,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sources":["../../../src/runtimes/cursor/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAiB,KAAK,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAOzE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAG1C,0DAA0D;AAC1D,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,SAAS,CAAC,EAAE,YAAY,CAAC;IAClC;;;;;;;OAOG;IACH,QAAQ,CAAC,GAAG,EAAE,MAAM,OAAO,CAAC,SAAS,CAAC,CAAC;IACvC,2FAA2F;IAC3F,QAAQ,CAAC,OAAO,CAAC,EAAE,KAAK,CAAC;CAC1B;AAED,4HAA4H;AAC5H,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,SAAS,EAAE,YAAY,CAAC;IACjC;;;;;OAKG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B;;;;;;;;OAQG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC;CACxC;AAED,MAAM,MAAM,oBAAoB,GAAG,sBAAsB,GAAG,uBAAuB,CAAC;AAEpF,uGAAuG;AACvG,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,GAAG,YAAY,GAAG,OAAO,GAAG,QAAQ,GAAG,YAAY,GAAG,uBAAuB,CAAC,CAAC,CAAC;AAE3J;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,oBAAoB,GAAG,aAAa,CAKhF;AAkBD,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC"}
@@ -1,38 +1,57 @@
1
1
  import { runtimeBrands } from "../../brands.js";
2
2
  import { defineRuntime } from "../../contracts/runtime.js";
3
+ import { inProcessAccess, subprocessAccess } from "./access.js";
3
4
  import { cursorAuthStatusWith } from "./auth-status.js";
4
- import { cursorInstallation } from "./installation.js";
5
+ import { cursorInstallationFor } from "./installation.js";
5
6
  import { cursorListModelsWith } from "./list-models.js";
6
7
  import { cursorLoginWith } from "./login.js";
7
8
  import { cursorLogoutWith } from "./logout.js";
8
- import { cursorRefusedSessionOptions } from "./model.js";
9
- import { cursorSdkLoader } from "./sdk.js";
10
9
  import { cursorSessionWith } from "./session.js";
11
10
  /**
12
- * Cursor, embedded through its official SDK (`@cursor/sdk`): the agent runs
13
- * in this process, the way pi does. It is not in `defaultRuntimes`, because
14
- * the SDK is the host's to install and hand over; a host that wants cursor
15
- * adds `createCursorRuntime({ sdk })` to its own registry
16
- * (docs/design/capabilities.md#a-runtimes-own-settings). Account usage is
17
- * absent: the SDK's usage call is not available to every account
18
- * (`feature_unavailable`, probed 2026-10-03), and each run reports its own
19
- * tokens anyway. Login, logout and the status are the SDK's own
11
+ * Cursor, embedded through its official SDK (`@cursor/sdk`). It is not in
12
+ * `defaultRuntimes`, because the SDK is the host's to install and hand over;
13
+ * a host that wants cursor adds `createCursorRuntime(...)` to its own
14
+ * registry (docs/design/capabilities.md#a-runtimes-own-settings).
15
+ *
16
+ * Two execution modes (docs/runtimes/cursor.md#execution-modes):
17
+ * - `{ sdk }` (the default, `execution: "in_process"`): the agent runs in
18
+ * this process, the way pi does. Its tools inherit the host's whole
19
+ * environment, so `SessionOptions.env` is refused, and an SDK crash is the
20
+ * host's crash.
21
+ * - `{ execution: "subprocess", sdkModule }`: each session runs the SDK in
22
+ * its own Node child (`process.execPath`), whose environment is
23
+ * `SessionOptions.env` over the host's (`envBase: "inherit"`, the default)
24
+ * or over nothing (`envBase: "clean"`); a child that exits is recorded as
25
+ * `exited`, and a child whose host is gone, SIGKILL included, ends itself
26
+ * and what it started, as far as docs/runtimes/cursor.md#execution-modes
27
+ * says per platform. Model listing, login, logout and the status each run in a
28
+ * one-shot child and take `env` the same way.
29
+ *
30
+ * Account usage is absent: the SDK's usage call is not available to every
31
+ * account (`feature_unavailable`, probed 2026-10-03), and each run reports
32
+ * its own tokens anyway. Login, logout and the status are the SDK's own
20
33
  * `Cursor.auth`.
21
34
  */
22
35
  export function createCursorRuntime(options) {
23
- const load = cursorSdkLoader(options.sdk);
24
- return defineRuntime({
36
+ if (options.execution === "subprocess") {
37
+ return cursorRuntime(subprocessAccess(options.sdkModule, options.envBase));
38
+ }
39
+ return cursorRuntime(inProcessAccess(options.sdk, true));
40
+ }
41
+ function cursorRuntime(access) {
42
+ const definition = {
25
43
  id: "cursor",
44
+ refusedSessionOptions: access.refusedSessionOptions,
26
45
  brand: runtimeBrands.cursor,
27
46
  manualCompaction: { kind: "supported", activeTurn: "reject" },
28
- installation: cursorInstallation,
29
- listModels: cursorListModelsWith(load),
30
- login: cursorLoginWith(load),
31
- logout: cursorLogoutWith(load),
32
- authStatus: cursorAuthStatusWith(load),
33
- session: cursorSessionWith(load),
34
- refusedSessionOptions: cursorRefusedSessionOptions,
35
- }, { execution: "in_process" });
47
+ installation: cursorInstallationFor(process.platform, process.arch, access.execution),
48
+ listModels: cursorListModelsWith(access),
49
+ login: cursorLoginWith(access),
50
+ logout: cursorLogoutWith(access),
51
+ authStatus: cursorAuthStatusWith(access),
52
+ session: cursorSessionWith(access),
53
+ };
54
+ return defineRuntime(definition, access.execution === "subprocess" ? { execution: "process" } : { execution: "in_process" });
36
55
  }
37
56
  export { projectCursorModels } from "./list-models.js";
38
57
  export { cursorNativeEnvironment } from "./native-environment.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/runtimes/cursor/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAgB,MAAM,4BAA4B,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,2BAA2B,EAAE,MAAM,YAAY,CAAC;AACzD,OAAO,EAAE,eAAe,EAAkB,MAAM,UAAU,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAi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BAAuB,EAAE,MAAM,yBAAyB,CAAC"}
@@ -9,6 +9,6 @@ import type { InstallationProbe } from "../../contracts/installation.js";
9
9
  * needs its native companion package, which exists only for the platforms in
10
10
  * `PLATFORMS`.
11
11
  */
12
- export declare function cursorInstallationFor(platform: string, arch: string): InstallationProbe;
12
+ export declare function cursorInstallationFor(platform: string, arch: string, execution?: "in_process" | "subprocess"): InstallationProbe;
13
13
  export declare const cursorInstallation: InstallationProbe;
14
14
  //# sourceMappingURL=installation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"installation.d.ts","sources":["../../../src/runtimes/cursor/installation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAwB,MAAM,iCAAiC,CAAC;AAK/F;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,iBAAiB,CASvF;AAED,eAAO,MAAM,kBAAkB,EAAE,iBAAyE,CAAC"}
1
+ {"version":3,"file":"installation.d.ts","sources":["../../../src/runtimes/cursor/installation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAwB,MAAM,iCAAiC,CAAC;AAK/F;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,GAAE,YAAY,GAAG,YAA2B,GAAG,iBAAiB,CAU9I;AAED,eAAO,MAAM,kBAAkB,EAAE,iBAAyE,CAAC"}
@@ -11,12 +11,15 @@ const PLATFORMS = new Set(["darwin-arm64", "darwin-x64", "linux-arm64", "linux-x
11
11
  * needs its native companion package, which exists only for the platforms in
12
12
  * `PLATFORMS`.
13
13
  */
14
- export function cursorInstallationFor(platform, arch) {
14
+ export function cursorInstallationFor(platform, arch, execution = "in_process") {
15
15
  const snapshot = PLATFORMS.has(`${platform}-${arch}`)
16
16
  ? { kind: "available", via: "bundled" }
17
17
  : { kind: "unsupported", reason: `@cursor/sdk has no native package for ${platform}-${arch}` };
18
18
  return async (options = {}) => {
19
- refuseReaderEnvironment(options.env, "Cursor installation probes the host SDK");
19
+ // In subprocess mode a session's environment is the child's; this probe reads none either way.
20
+ if (execution === "in_process") {
21
+ refuseReaderEnvironment(options.env, "Cursor installation probes the host SDK");
22
+ }
20
23
  await Promise.resolve();
21
24
  return snapshot;
22
25
  };
@@ -1 +1 @@
1
- {"version":3,"file":"installation.js","sources":["../../../src/runtimes/cursor/installation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAG7E,+EAA+E;AAC/E,MAAM,SAAS,GAAwB,IAAI,GAAG,CAAC,CAAC,cAAc,EAAE,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC,CAAC;AAExH;;;;;;;;;GASG;AACH,MAAM,UAAU,qBAAqB,CAAC,QAAgB,EAAE,IAAY;IAClE,MAAM,QAAQ,GAAyB,SAAS,CAAC,GAAG,CAAC,GAAG,QAAQ,IAAI,IAAI,EAAE,CAAC;QACzE,CAAC,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,GAAG,EAAE,SAAS,EAAE;QACvC,CAAC,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,EAAE,yCAAyC,QAAQ,IAAI,IAAI,EAAE,EAAE,CAAC;IACjG,OAAO,KAAK,EAAE,OAAO,GAAG,EAAE,EAAE,EAAE;QAC5B,uBAAuB,CAAC,OAAO,CAAC,GAAG,EAAE,yCAAyC,CAAC,CAAC;QAChF,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC;QACxB,OAAO,QAAQ,CAAC;IAClB,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,kBAAkB,GAAsB,qBAAqB,CAAC,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC"}
1
+ {"version":3,"file":"installation.js","sources":["../../../src/runtimes/cursor/installation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAG7E,+EAA+E;AAC/E,MAAM,SAAS,GAAwB,IAAI,GAAG,CAAC,CAAC,cAAc,EAAE,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC,CAAC;AAExH;;;;;;;;;GASG;AACH,MAAM,UAAU,qBAAqB,CAAC,QAAgB,EAAE,IAAY,EAAE,SAAS,GAAgC,YAAY;IACzH,MAAM,QAAQ,GAAyB,SAAS,CAAC,GAAG,CAAC,GAAG,QAAQ,IAAI,IAAI,EAAE,CAAC;QACzE,CAAC,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,GAAG,EAAE,SAAS,EAAE;QACvC,CAAC,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,EAAE,yCAAyC,QAAQ,IAAI,IAAI,EAAE,EAAE,CAAC;IACjG,OAAO,KAAK,EAAE,OAAO,GAAG,EAAE,EAAE,EAAE;QAC5B,+FAA+F;QAC/F,IAAI,SAAS,KAAK,YAAY,EAAE,CAAC;YAAC,uBAAuB,CAAC,OAAO,CAAC,GAAG,EAAE,yCAAyC,CAAC,CAAC;QAAC,CAAC;QACpH,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC;QACxB,OAAO,QAAQ,CAAC;IAClB,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,kBAAkB,GAAsB,qBAAqB,CAAC,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import type { ModelEntry, ModelLister } from "../../contracts/list-models.js";
2
- import type { CursorSdk, ModelListItem } from "./sdk.js";
2
+ import { type CursorSdkSource } from "./access.js";
3
+ import type { ModelListItem } from "./sdk.js";
3
4
  /**
4
5
  * Project `Cursor.models.list()` (SDK 1.0.35): `id` is the selector the SDK
5
6
  * accepts, the effort menu is the model's reasoning parameter
@@ -7,5 +8,6 @@ import type { CursorSdk, ModelListItem } from "./sdk.js";
7
8
  * value in the variant the catalog marks `isDefault`.
8
9
  */
9
10
  export declare function projectCursorModels(models: readonly ModelListItem[]): ModelEntry[];
10
- export declare function cursorListModelsWith(load: () => Promise<CursorSdk>): ModelLister;
11
+ /** `Cursor.models.list()`; in subprocess mode in a child of its own with `env`, stopped when the call ends. */
12
+ export declare function cursorListModelsWith(source: CursorSdkSource): ModelLister;
11
13
  //# sourceMappingURL=list-models.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"list-models.d.ts","sources":["../../../src/runtimes/cursor/list-models.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAE9E,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzD;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,aAAa,EAAE,GAAG,UAAU,EAAE,CAalF;AAYD,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,OAAO,CAAC,SAAS,CAAC,GAAG,WAAW,CA0BhF"}
1
+ {"version":3,"file":"list-models.d.ts","sources":["../../../src/runtimes/cursor/list-models.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAE9E,OAAO,EAAuD,KAAK,eAAe,EAAE,MAAM,aAAa,CAAC;AACxG,OAAO,KAAK,EAAa,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzD;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,aAAa,EAAE,GAAG,UAAU,EAAE,CAalF;AA0BD,+GAA+G;AAC/G,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,eAAe,GAAG,WAAW,CAwBzE"}
@@ -1,5 +1,6 @@
1
1
  import { refuseReaderEnvironment } from "../../shared/refuse-environment.js";
2
2
  import { cursorEffortParameter } from "./model.js";
3
+ import { callRedaction, cursorSdkAccess } from "./access.js";
3
4
  /**
4
5
  * Project `Cursor.models.list()` (SDK 1.0.35): `id` is the selector the SDK
5
6
  * accepts, the effort menu is the model's reasoning parameter
@@ -29,31 +30,47 @@ function unauthenticated(error) {
29
30
  ? error.message
30
31
  : null;
31
32
  }
32
- export function cursorListModelsWith(load) {
33
+ async function listWithin(sdk, timeoutMs) {
34
+ const deadline = Promise.withResolvers();
35
+ const timer = setTimeout(() => {
36
+ deadline.reject(new Error(`Cursor.models.list() did not answer within ${String(timeoutMs)} ms`));
37
+ }, timeoutMs);
38
+ timer.unref();
39
+ try {
40
+ const models = await Promise.race([sdk.Cursor.models.list(), deadline.promise]);
41
+ return models;
42
+ }
43
+ finally {
44
+ clearTimeout(timer);
45
+ }
46
+ }
47
+ /** `Cursor.models.list()`; in subprocess mode in a child of its own with `env`, stopped when the call ends. */
48
+ export function cursorListModelsWith(source) {
49
+ const access = cursorSdkAccess(source);
33
50
  return async (installation, options = {}) => {
34
- refuseReaderEnvironment(options.env, "cursor model listing runs in the host process");
51
+ if (access.execution === "in_process") {
52
+ refuseReaderEnvironment(options.env, "cursor model listing runs in the host process");
53
+ }
35
54
  if (installation.via !== "bundled") {
36
55
  return { kind: "unsupported", reason: "cursor model listing needs the bundled @cursor/sdk" };
37
56
  }
38
- const timeoutMs = options.timeoutMs ?? 15_000;
57
+ // Its answer and errors (with their cause, and a child's stderr tail) go through the call's credentials.
58
+ const clean = callRedaction(options.env);
59
+ let lease = null;
39
60
  try {
40
- const sdk = await load();
41
- const models = await Promise.race([
42
- sdk.Cursor.models.list(),
43
- new Promise((_resolve, reject) => {
44
- setTimeout(() => {
45
- reject(new Error(`Cursor.models.list() did not answer within ${String(timeoutMs)} ms`));
46
- }, timeoutMs).unref();
47
- }),
48
- ]);
61
+ lease = await access.lease(options.env);
62
+ const models = await listWithin(lease.sdk, options.timeoutMs ?? 15_000);
49
63
  return { kind: "ok", models: projectCursorModels(models) };
50
64
  }
51
65
  catch (error) {
52
66
  const detail = unauthenticated(error);
53
67
  if (detail !== null) {
54
- return { kind: "unauthenticated", detail };
68
+ return clean({ kind: "unauthenticated", detail });
55
69
  }
56
- throw new Error("Failed to list Cursor models", { cause: error });
70
+ throw clean(new Error("Failed to list Cursor models", { cause: error }));
71
+ }
72
+ finally {
73
+ await lease?.release();
57
74
  }
58
75
  };
59
76
  }
@@ -1 +1 @@
1
- {"version":3,"file":"list-models.js","sources":["../../../src/runtimes/cursor/list-models.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAE7E,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAGnD;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CAAC,MAAgC;IAClE,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;QAC1B,MAAM,SAAS,GAAG,qBAAqB,CAAC,KAAK,CAAC,CAAC;QAC/C,MAAM,aAAa,GAAG,SAAS,KAAK,IAAI;YACtC,CAAC,CAAC,SAAS;YACX,CAAC,CAAC,KAAK,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,SAAS,KAAK,IAAI,CAAC,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,SAAS,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC;QAC5H,OAAO;YACL,EAAE,EAAE,KAAK,CAAC,EAAE;YACZ,GAAG,CAAC,KAAK,CAAC,WAAW,KAAK,EAAE,IAAI,KAAK,CAAC,WAAW,KAAK,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,KAAK,CAAC,WAAW,EAAE,CAAC;YACzG,GAAG,CAAC,SAAS,KAAK,IAAI,IAAI,SAAS,CAAC,MAAM,CAAC,MAA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K,EAAE,CAAC;YACf,MAAM,MAAM,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC;YACtC,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;gBACpB,OAAO,KAAK,CAAC,EAAE,IAAI,EAAE,iBAAiB,EAAE,MAAM,EAAE,CAAC,CAAC;YACpD,CAAC;YACD,MAAM,KAAK,CAAC,IAAI,KAAK,CAAC,8BAA8B,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;QAC3E,CAAC;gBAAS,CAAC;YACT,MAAM,KAAK,EAAE,OAAO,EAAE,CAAC;QACzB,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
@@ -1,5 +1,10 @@
1
1
  import type { RuntimeLogin } from "../../contracts/login.js";
2
- import { type CursorSdk } from "./sdk.js";
3
- /** Signs cursor in with the SDK's own `Cursor.auth.login`, relaying its URL; the key goes to the SDK's store only. */
4
- export declare function cursorLoginWith(load: () => Promise<CursorSdk>): RuntimeLogin;
2
+ import { type CursorSdkSource } from "./access.js";
3
+ /**
4
+ * Signs cursor in with the SDK's own `Cursor.auth.login`, relaying its URL;
5
+ * the key goes to the SDK's store only. In subprocess mode the login runs in
6
+ * a child of its own with `env` over the host's environment, and the key
7
+ * never leaves that child (subprocess/child-script.ts).
8
+ */
9
+ export declare function cursorLoginWith(source: CursorSdkSource): RuntimeLogin;
5
10
  //# sourceMappingURL=login.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"login.d.ts","sources":["../../../src/runtimes/cursor/login.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAe,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAI1E,OAAO,EAML,KAAK,SAAS,EACf,MAAM,UAAU,CAAC;AAiKlB,sHAAsH;AACtH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,OAAO,CAAC,SAAS,CAAC,GAAG,YAAY,CA4B5E"}
1
+ {"version":3,"file":"login.d.ts","sources":["../../../src/runtimes/cursor/login.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAe,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAI1E,OAAO,EAA6D,KAAK,eAAe,EAAE,MAAM,aAAa,CAAC;AAoK9G;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,eAAe,GAAG,YAAY,CA6BrE"}
@@ -1,7 +1,8 @@
1
1
  import { UnsupportedOptionError } from "../../contracts/errors.js";
2
2
  import { errorMessage, LoginSecrets, loginBounds, stoppedResult } from "../../shared/login.js";
3
+ import { environmentValue } from "../../shared/environment.js";
4
+ import { callRedaction, cursorSdkAccess, IN_PROCESS_ENV, withLease } from "./access.js";
3
5
  import { readCursorAuthStatus } from "./auth-status.js";
4
- import { loadedSdk, } from "./sdk.js";
5
6
  /*
6
7
  * `Cursor.auth.login()` (@cursor/sdk 1.0.35, read in its bundle,
7
8
  * `dist/esm/index.js`: `Ne.auth`, and `./src/agent/auth/login-flow.ts`):
@@ -55,7 +56,7 @@ async function sdkLogin(auth, options) {
55
56
  return { kind: "rejected", error };
56
57
  }
57
58
  }
58
- async function runCursorLogin(auth, file, interaction, timeoutMs) {
59
+ async function runCursorLogin(auth, file, interaction, timeoutMs, env) {
59
60
  const secrets = new LoginSecrets();
60
61
  const flow = { phase: "waiting" };
61
62
  const sdkSignal = new AbortController();
@@ -93,7 +94,7 @@ async function runCursorLogin(auth, file, interaction, timeoutMs) {
93
94
  try {
94
95
  interaction.onEvent({ kind: "auth_url", url, instructions: URL_INSTRUCTIONS });
95
96
  // The SDK prefers the variable over the stored login; its value is never read.
96
- if (process.env.CURSOR_API_KEY !== undefined) {
97
+ if (environmentValue(env, "CURSOR_API_KEY") !== undefined) {
97
98
  interaction.onEvent({ kind: "info", message: ENV_KEY_NOTE });
98
99
  }
99
100
  }
@@ -134,11 +135,17 @@ async function runCursorLogin(auth, file, interaction, timeoutMs) {
134
135
  bounds.dispose();
135
136
  }
136
137
  }
137
- /** Signs cursor in with the SDK's own `Cursor.auth.login`, relaying its URL; the key goes to the SDK's store only. */
138
- export function cursorLoginWith(load) {
138
+ /**
139
+ * Signs cursor in with the SDK's own `Cursor.auth.login`, relaying its URL;
140
+ * the key goes to the SDK's store only. In subprocess mode the login runs in
141
+ * a child of its own with `env` over the host's environment, and the key
142
+ * never leaves that child (subprocess/child-script.ts).
143
+ */
144
+ export function cursorLoginWith(source) {
145
+ const access = cursorSdkAccess(source);
139
146
  return async (installation, interaction, options = {}) => {
140
- if (options.env !== undefined && Object.keys(options.env).length > 0) {
141
- throw new UnsupportedOptionError("env", "Cursor authentication runs in the host process and cannot isolate env; configure the host environment before loading the SDK.");
147
+ if (access.execution === "in_process" && options.env !== undefined && Object.keys(options.env).length > 0) {
148
+ throw new UnsupportedOptionError("env", IN_PROCESS_ENV);
142
149
  }
143
150
  if (installation.via !== "bundled") {
144
151
  return { kind: "unsupported", reason: "unsupported_installation", detail: "cursor signs in through the bundled @cursor/sdk" };
@@ -147,21 +154,21 @@ export function cursorLoginWith(load) {
147
154
  if (aborted()) {
148
155
  return { kind: "cancelled" };
149
156
  }
150
- const sdk = await loadedSdk(load);
151
- if ("failed" in sdk) {
152
- return { kind: "failed", reason: "process_failed", detail: new LoginSecrets().line(sdk.failed) };
153
- }
154
- const { auth } = sdk.Cursor;
155
- const Store = sdk.FileCredentialStore;
156
- if (auth === undefined || Store === undefined) {
157
- return { kind: "unsupported", reason: "version_unsupported", detail: "@cursor/sdk 1.3.1 is required; this one has no Cursor.auth" };
158
- }
159
- // The caller may have aborted while the SDK loaded.
160
- if (aborted()) {
161
- return { kind: "cancelled" };
162
- }
163
- const result = await runCursorLogin(auth, new Store(), interaction, options.timeoutMs ?? LOGIN_TIMEOUT_MS);
164
- return result;
157
+ const result = await withLease(access, options.env, async (sdk, lease) => {
158
+ const { auth } = sdk.Cursor;
159
+ const Store = sdk.FileCredentialStore;
160
+ if (auth === undefined || Store === undefined) {
161
+ return { kind: "unsupported", reason: "version_unsupported", detail: "@cursor/sdk 1.3.1 is required; this one has no Cursor.auth" };
162
+ }
163
+ // The caller may have aborted while the SDK loaded.
164
+ if (aborted()) {
165
+ return { kind: "cancelled" };
166
+ }
167
+ const login = await runCursorLogin(auth, new Store(), interaction, options.timeoutMs ?? LOGIN_TIMEOUT_MS, lease.env);
168
+ return login;
169
+ });
170
+ // Details can carry the SDK's or the child's words: redacted with the call's credentials too.
171
+ return callRedaction(options.env)("failed" in result ? { kind: "failed", reason: "process_failed", detail: new LoginSecrets().line(result.failed) } : result);
165
172
  };
166
173
  }
167
174
  //# sourceMappingURL=login.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"login.js","sources":["../../../src/runtimes/cursor/login.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAGnE,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAkB,MAAM,uBAAuB,CAAC;AAC/G,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EACL,SAAS,GAMV,MAAM,UAAU,CAAC;AAElB;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,kHAAkH;AAClH,MAAM,gBAAgB,GAAG,EAAE,GAAG,MAAM,CAAC;AACrC,MAAM,gBAAgB,GAAG,oFAAoF,CAAC;AAC9G,MAAM,YAAY,GAAG,qGAAqG,CAAC;AAsB3H;;;;GAIG;AACH,KAAK,UAAU,SAAS,CAAC,IAAgB,EAAE,MAA+B;IACxE,IAAI,MAAM,EAAE,OAAO,KAAK,IAAI,EAAE,CAAC;QAC7B,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC;IAC/B,CAAC;IACD,MAAM,MAAM,GAAG,MAAM,oBAAoB,CAAC,IAAI,CAAC,CAAC;IAChD,IAAI,MAAM,CAAC,IAAI,KAAK,YAAY,EAAE,CAAC;QACjC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,wEAA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"./sdk.js";
3
- /** Signs cursor out with the SDK's own `Cursor.auth.logout`; `Cursor.auth.status` decides. */
4
- export declare function cursorLogoutWith(load: () => Promise<CursorSdk>): RuntimeLogout;
2
+ import { type CursorSdkSource } from "./access.js";
3
+ /** Signs cursor out with the SDK's own `Cursor.auth.logout`; `Cursor.auth.status` decides. In subprocess mode both run in a child with `env`. */
4
+ export declare function cursorLogoutWith(source: CursorSdkSource): RuntimeLogout;
5
5
  //# sourceMappingURL=logout.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"logout.d.ts","sources":["../../../src/runtimes/cursor/logout.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAI9D,OAAO,EAAa,KAAK,SAAS,EAAE,MAAM,UAAU,CAAC;AAmCrD,8FAA8F;AAC9F,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,OAAO,CAAC,SAAS,CAAC,GAAG,aAAa,CAsB9E"}
1
+ {"version":3,"file":"logout.d.ts","sources":["../../../src/runtimes/cursor/logout.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAgB,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAI5E,OAAO,EAA6D,KAAK,eAAe,EAAE,MAAM,aAAa,CAAC;AAmC9G,iJAAiJ;AACjJ,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,eAAe,GAAG,aAAa,CAuBvE"}
@@ -2,7 +2,7 @@ import { UnsupportedOptionError } from "../../contracts/errors.js";
2
2
  import { errorMessage, LoginSecrets } from "../../shared/login.js";
3
3
  import { confirmedLogout, logoutTimedOut } from "../../shared/logout.js";
4
4
  import { readCursorAuthStatus } from "./auth-status.js";
5
- import { loadedSdk } from "./sdk.js";
5
+ import { callRedaction, cursorSdkAccess, IN_PROCESS_ENV, withLease } from "./access.js";
6
6
  /*
7
7
  * `Cursor.auth.logout(options?: { store? })` (@cursor/sdk 1.0.36, read in
8
8
  * its bundle, `dist/esm/index.js`, and `dist/esm/auth/login.d.ts`
@@ -36,28 +36,29 @@ async function sdkLogout(logout, timeoutMs) {
36
36
  clearTimeout(timer);
37
37
  }
38
38
  }
39
- /** Signs cursor out with the SDK's own `Cursor.auth.logout`; `Cursor.auth.status` decides. */
40
- export function cursorLogoutWith(load) {
39
+ /** Signs cursor out with the SDK's own `Cursor.auth.logout`; `Cursor.auth.status` decides. In subprocess mode both run in a child with `env`. */
40
+ export function cursorLogoutWith(source) {
41
+ const access = cursorSdkAccess(source);
41
42
  return async (installation, options = {}) => {
42
- if (options.env !== undefined && Object.keys(options.env).length > 0) {
43
- throw new UnsupportedOptionError("env", "Cursor authentication runs in the host process and cannot isolate env; configure the host environment before loading the SDK.");
43
+ if (access.execution === "in_process" && options.env !== undefined && Object.keys(options.env).length > 0) {
44
+ throw new UnsupportedOptionError("env", IN_PROCESS_ENV);
44
45
  }
45
46
  if (installation.via !== "bundled") {
46
47
  return { kind: "unsupported", reason: "unsupported_installation", detail: "cursor signs out through the bundled @cursor/sdk" };
47
48
  }
48
- const sdk = await loadedSdk(load);
49
- if ("failed" in sdk) {
50
- return { kind: "failed", reason: "process_failed", detail: new LoginSecrets().line(sdk.failed) };
51
- }
52
- const { auth } = sdk.Cursor;
53
- if (auth?.logout === undefined) {
54
- return { kind: "unsupported", reason: "version_unsupported", detail: "@cursor/sdk 1.3.1 is required; this one has no Cursor.auth.logout" };
55
- }
56
- // With no store: the SDK's own default, the file `status()` reads.
57
- const native = await sdkLogout(async () => {
58
- await auth.logout?.();
59
- }, options.timeoutMs ?? LOGOUT_TIMEOUT_MS);
60
- return confirmedLogout(native, await readCursorAuthStatus(auth), LOGOUT_CALL);
49
+ const result = await withLease(access, options.env, async (sdk) => {
50
+ const { auth } = sdk.Cursor;
51
+ if (auth?.logout === undefined) {
52
+ return { kind: "unsupported", reason: "version_unsupported", detail: "@cursor/sdk 1.3.1 is required; this one has no Cursor.auth.logout" };
53
+ }
54
+ // With no store: the SDK's own default, the file `status()` reads.
55
+ const native = await sdkLogout(async () => {
56
+ await auth.logout?.();
57
+ }, options.timeoutMs ?? LOGOUT_TIMEOUT_MS);
58
+ return confirmedLogout(native, await readCursorAuthStatus(auth), LOGOUT_CALL);
59
+ });
60
+ // Details can carry the SDK's or the child's words: redacted with the call's credentials too.
61
+ return callRedaction(options.env)("failed" in result ? { kind: "failed", reason: "process_failed", detail: new LoginSecrets().line(result.failed) } : result);
61
62
  };
62
63
  }
63
64
  //# sourceMappingURL=logout.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"logout.js","sources":["../../../src/runtimes/cursor/logout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAEnE,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,cAAc,EAAqB,MAAM,wBAAwB,CAAC;AAC5F,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,SAAS,EAAkB,MAAM,UAAU,CAAC;AAErD;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,GAAG,oBAAoB,CAAC;AACzC,4BAA4B;AAC5B,MAAM,iBAAiB,GAAG,MAAM,CAAC;AAEjC,uGAAuG;AACvG,KAAK,UAAU,SAAS,CAAC,MAA2B,EAAE,SAAiB;IACrE,MAAM,QAAQ,GAAG,OAAO,CAAC,aAAa,EAAe,CAAC;IACtD,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE;QAC5B,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IAChC,CAAC,EAAE,SAAS,CAAC,CAAC;IACd,KAAK,CAAC,KAAK,EAAE,CAAC;IACd,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;QAC/D,OAAO,KAAK,KAAK,WAAW,CA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AAG,EAAE,KAAK,EAAE,GAAG,EAAyB,EAAE;YACvF,MAAM,EAAE,IAAI,EAAE,GAAG,GAAG,CAAC,MAAM,CAAC;YAC5B,IAAI,IAAI,EAAE,MAAM,KAAK,SAAS,EAAE,CAAC;gBAC/B,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,EAAE,qBAAqB,EAAE,MAAM,EAAE,mEAAmE,EAAE,CAAC;YAC7I,CAAC;YACD,mEAAmE;YACnE,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,KAAK,IAAI,EAAE;gBACxC,MAAM,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC;YACxB,CAAC,EAAE,OAAO,CAAC,SAAS,IAAI,iBAAiB,CAAC,CAAC;YAC3C,OAAO,eAAe,CAAC,MAAM,EAAE,MAAM,oBAAoB,CAAC,IAAI,CAAC,EAAE,WAAW,CAAC,CAAC;QAChF,CAAC,CAAC,CAAC;QACH,8FAA8F;QAC9F,OAAO,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,QAAQ,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,EAAE,IAAI,YAAY,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;IAChK,CAAC,CAAC;AACJ,CAAC"}
@@ -15,6 +15,11 @@ export declare function cursorSelectionEffort(selection: ModelSelection | undefi
15
15
  * '--system-prompt'" (probed 2026-10-03), and there is no append.
16
16
  */
17
17
  export declare const cursorRefusedSessionOptions: RefusedSessionOptions;
18
+ /**
19
+ * The subprocess execution mode's refusals: the same, except `env`, which
20
+ * becomes the child's environment (docs/runtimes/cursor.md#execution-modes).
21
+ */
22
+ export declare const cursorSubprocessRefusedSessionOptions: RefusedSessionOptions;
18
23
  /**
19
24
  * The selection a session opens with. A local agent always needs one, and a
20
25
  * resumed agent does not restore its own, so on resume without a model the
@@ -1 +1 @@
1
- {"version":3,"file":"model.d.ts","sources":["../../../src/runtimes/cursor/model.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAExE,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAG5E,OAAO,KAAK,EAAE,WAAW,EAAE,qBAAqB,EAAE,SAAS,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAc7G,8GAA8G;AAC9G,eAAO,MAAM,oBAAoB,YAAY,CAAC;AAE9C,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,aAAa,GAAG;IAAE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,GAAG,IAAI,CAS9H;AAED,wEAAwE;AACxE,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,cAAc,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAS1F;AAMD;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,EAAE,qBAUzC,CAAC;AAEF;;;;;;;;;;GAUG;AACH,wBAAsB,oBAAoB,CAAC,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC,CAsB3G;AAmBD;oEACoE;AACpE,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAKtF;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,SAAS,SAAS,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAKrG;AAED;;;;;;GAMG;AACH,wBAAsB,eAAe,CAAC,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,WAAW,CAAC,CAuBnG"}
1
+ {"version":3,"file":"model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52,9 +52,18 @@ export const cursorRefusedSessionOptions = {
52
52
  serviceTier: "cursor exposes no verified per-session service-tier setting and readback",
53
53
  systemPrompt: "Cursor's SDK runs no system prompt override for a local agent",
54
54
  appendSystemPrompt: "Cursor's SDK runs no system prompt override for a local agent",
55
- env: "Cursor runs in this process and its SDK takes no environment for the agent's tools; SessionOptions.env is unsupported",
55
+ env: "Cursor runs in this process and its SDK takes no environment for the agent's tools; SessionOptions.env is unsupported (the subprocess execution mode takes it)",
56
56
  launchArgs: "Cursor runs in this process through its SDK; there is no runtime command line to add arguments to",
57
57
  };
58
+ /**
59
+ * The subprocess execution mode's refusals: the same, except `env`, which
60
+ * becomes the child's environment (docs/runtimes/cursor.md#execution-modes).
61
+ */
62
+ export const cursorSubprocessRefusedSessionOptions = {
63
+ ...Object.fromEntries(Object.entries(cursorRefusedSessionOptions).filter(([key]) => key !== "env")),
64
+ endTurnProcessesOnAbort: "Cursor's SDK starts its tools inside the session's own child process, and OAR reads no per-turn process tree there; only dispose ends that child's tree",
65
+ launchArgs: "Cursor runs through its SDK in a Node child process OAR starts; there is no Cursor command line to add arguments to",
66
+ };
58
67
  /**
59
68
  * The selection a session opens with. A local agent always needs one, and a
60
69
  * resumed agent does not restore its own, so on resume without a model the