clankerbend 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -8,6 +8,7 @@ ClankerBend lets you build Codex Desktop plugins without rebuilding or re-signin
8
8
  Codex Desktop itself. It uses [CDP](https://x.com/OpenAIDevs/status/2065226355495895521)
9
9
  to provide a more stable API for tasks such as transcript navigation, chat annotation,
10
10
  attaching a file to the prompt window, opening the side panel, and so on.
11
+ [YouTube demo](https://www.youtube.com/watch?v=FcQUxiL6enc) (or click on the screenshot):
11
12
 
12
13
  <p align="center">
13
14
  <a href="https://www.youtube.com/watch?v=FcQUxiL6enc">
package/docs/protocol.md CHANGED
@@ -755,17 +755,21 @@ In either model:
755
755
  ClankerBend can launch Codex Desktop with CDP:
756
756
 
757
757
  ```sh
758
- /Applications/Codex.app/Contents/MacOS/Codex \
758
+ /Applications/ChatGPT.app/Contents/MacOS/ChatGPT \
759
759
  --remote-debugging-address=127.0.0.1 \
760
760
  --remote-debugging-port=<free> \
761
761
  --user-data-dir=<test-or-clankerbend-profile>
762
762
  ```
763
763
 
764
+ Current Desktop releases use the `ChatGPT.app` path while retaining the Codex
765
+ bundle identity and bundled `Resources/codex` CLI. ClankerBend discovers that
766
+ layout and the legacy `/Applications/Codex.app` layout automatically.
767
+
764
768
  When account profiles are enabled, the adapter also launches Desktop with the
765
769
  selected profile's `CODEX_HOME` and isolated Electron user-data directory.
766
770
  ClankerBend `0.1` runs one managed Codex Desktop instance at a time.
767
771
 
768
- The host must not patch `/Applications/Codex.app`.
772
+ The host must not patch either application bundle.
769
773
 
770
774
  ### Attach
771
775
 
@@ -1,15 +1,28 @@
1
1
  import { spawn } from "node:child_process";
2
2
  import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
3
3
  import net from "node:net";
4
- import { basename, join, resolve } from "node:path";
4
+ import { basename, dirname, join, resolve } from "node:path";
5
5
 
6
- const DEFAULT_CODEX_APP = "/Applications/Codex.app/Contents/MacOS/Codex";
7
- const DEFAULT_CODEX_CLI = "/Applications/Codex.app/Contents/Resources/codex";
6
+ const CODEX_DESKTOP_EXECUTABLES = [
7
+ "/Applications/Codex.app/Contents/MacOS/Codex",
8
+ "/Applications/ChatGPT.app/Contents/MacOS/ChatGPT"
9
+ ];
8
10
 
9
11
  export function createCodexDesktopCdpAdapter(options = {}) {
10
12
  return new CodexDesktopCdpAdapter(options);
11
13
  }
12
14
 
15
+ export function resolveCodexDesktopPaths(options = {}) {
16
+ const codexApp = options.codexApp || CODEX_DESKTOP_EXECUTABLES.find((candidate) => existsSync(candidate)) || CODEX_DESKTOP_EXECUTABLES[0];
17
+ const bundledCli = join(dirname(dirname(codexApp)), "Resources/codex");
18
+ const codexCli = options.codexCli || (existsSync(bundledCli)
19
+ ? bundledCli
20
+ : CODEX_DESKTOP_EXECUTABLES
21
+ .map((candidate) => join(dirname(dirname(candidate)), "Resources/codex"))
22
+ .find((candidate) => existsSync(candidate))) || bundledCli;
23
+ return { codexApp, codexCli };
24
+ }
25
+
13
26
  function normalizeRendererBridges(options = {}) {
14
27
  const bridges = options.rendererBridges?.length
15
28
  ? options.rendererBridges
@@ -63,8 +76,9 @@ class CodexDesktopCdpAdapter {
63
76
  this.cdp = true;
64
77
  this.rendererInjection = true;
65
78
  this.rendererFetchToLoopback = false;
66
- this.codexApp = options.codexApp || DEFAULT_CODEX_APP;
67
- this.codexCli = options.codexCli || DEFAULT_CODEX_CLI;
79
+ const desktopPaths = resolveCodexDesktopPaths(options);
80
+ this.codexApp = desktopPaths.codexApp;
81
+ this.codexCli = desktopPaths.codexCli;
68
82
  this.runDir = options.runDir ? resolve(options.runDir) : null;
69
83
  this.profileDir = options.profileDir || (this.runDir ? join(this.runDir, "codex-profile") : null);
70
84
  this.codexHome = options.codexHome ? resolve(options.codexHome) : null;
@@ -88,6 +102,12 @@ class CodexDesktopCdpAdapter {
88
102
 
89
103
  async start(host) {
90
104
  this.host = host;
105
+ if (!existsSync(this.codexApp)) {
106
+ throw new Error(`Codex Desktop executable not found. Looked for: ${CODEX_DESKTOP_EXECUTABLES.join(", ")}`);
107
+ }
108
+ if (!existsSync(this.codexCli)) {
109
+ throw new Error(`Codex CLI not found in the Codex Desktop bundle: ${this.codexCli}`);
110
+ }
91
111
  if (!this.rendererBridges.length) throw new Error("at least one renderer bridge is required");
92
112
  for (const bridge of this.rendererBridges) {
93
113
  if (!bridge.injectedScriptPath) throw new Error(`injectedScriptPath is required for ${bridge.appId || "renderer bridge"}`);
@@ -1,6 +1,6 @@
1
1
  (function installCodexVimNavigator() {
2
2
  const VIM_NAV_APP_ID = "onewill.vim-nav";
3
- const BRIDGE_VERSION = 115;
3
+ const BRIDGE_VERSION = 116;
4
4
  const RUNTIME_KEY = "__clankerbendRuntime";
5
5
  const STYLE_ID = "codex-vim-nav-style";
6
6
  const ANNOTATION_CLASS = "codex-vim-nav-annotation";
@@ -465,6 +465,7 @@
465
465
  font: 600 12px/1.25 ui-monospace, SFMono-Regular, Menlo, monospace !important;
466
466
  letter-spacing: 0 !important;
467
467
  user-select: none !important;
468
+ pointer-events: none !important;
468
469
  }
469
470
  #${MODE_BADGE_ID}.is-visible {
470
471
  display: flex !important;
@@ -494,6 +495,7 @@
494
495
  padding: 0 3px !important;
495
496
  font: 700 12px/1 ui-monospace, SFMono-Regular, Menlo, monospace !important;
496
497
  cursor: pointer !important;
498
+ pointer-events: auto !important;
497
499
  }
498
500
  #${MODE_BADGE_ID} .codex-vim-nav-dismiss:hover {
499
501
  color: #e8f6fa !important;
@@ -510,6 +512,7 @@
510
512
  padding: 0 5px !important;
511
513
  font: 700 11px/1.3 ui-monospace, SFMono-Regular, Menlo, monospace !important;
512
514
  cursor: pointer !important;
515
+ pointer-events: auto !important;
513
516
  }
514
517
  #${MODE_BADGE_ID} .codex-vim-nav-help-toggle:hover {
515
518
  border-color: rgba(143, 199, 212, .75) !important;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clankerbend",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "type": "module",
5
5
  "description": "OneWill ClankerBend protocol host and public reference apps.",
6
6
  "license": "MIT",