codex-plus-patcher 0.6.0 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/README.md +3 -1
  2. package/package.json +5 -3
  3. package/src/cli.js +88 -0
  4. package/src/core/dev-mode.js +274 -0
  5. package/src/core/plugin-audit.js +1267 -0
  6. package/src/patches/26.623.41415-4505.js +44 -0
  7. package/src/patches/index.js +8 -1
  8. package/src/patches/lib/common-patches.js +411 -248
  9. package/src/patches/lib/hooks/about.js +7 -0
  10. package/src/patches/lib/hooks/diagnostics.js +7 -0
  11. package/src/patches/lib/hooks/mermaid.js +7 -0
  12. package/src/patches/lib/hooks/message-composer.js +7 -0
  13. package/src/patches/lib/hooks/native-main.js +7 -0
  14. package/src/patches/lib/hooks/project-selector.js +12 -0
  15. package/src/patches/lib/hooks/review.js +9 -0
  16. package/src/patches/lib/hooks/settings-commands.js +13 -0
  17. package/src/patches/lib/hooks/sidebar.js +7 -0
  18. package/src/patches/lib/hooks/thread-header.js +7 -0
  19. package/src/patches/lib/hooks/worker.js +7 -0
  20. package/src/patches/lib/project-selector-shortcut-patch.js +84 -8
  21. package/src/runtime/api/about.js +16 -0
  22. package/src/runtime/api/commands.js +85 -0
  23. package/src/runtime/api/composer.js +14 -0
  24. package/src/runtime/api/diagnostics.js +38 -0
  25. package/src/runtime/api/errors.js +20 -0
  26. package/src/runtime/api/index.js +82 -0
  27. package/src/runtime/api/mermaid.js +14 -0
  28. package/src/runtime/api/message.js +14 -0
  29. package/src/runtime/api/modules.js +57 -0
  30. package/src/runtime/api/native.js +14 -0
  31. package/src/runtime/api/patches.js +31 -0
  32. package/src/runtime/api/review.js +20 -0
  33. package/src/runtime/api/settings.js +76 -0
  34. package/src/runtime/api/sidebar.js +24 -0
  35. package/src/runtime/api/styles.js +28 -0
  36. package/src/runtime/api/threadHeader.js +41 -0
  37. package/src/runtime/assets.js +59 -18
  38. package/src/runtime/host/messageComposer.js +16 -0
  39. package/src/runtime/host/nativeMain.js +159 -0
  40. package/src/runtime/host/projectSelector.js +58 -0
  41. package/src/runtime/host/review.js +62 -0
  42. package/src/runtime/host/sidebar.js +21 -0
  43. package/src/runtime/host/threadHeader.js +9 -0
  44. package/src/runtime/{worker.js → host/worker.js} +7 -0
  45. package/src/runtime/plugins/mermaidFullscreen.js +19 -6
  46. package/src/runtime/plugins/nestedRepositories.js +72 -11
  47. package/src/runtime/plugins/projectColors.js +94 -7
  48. package/src/runtime/plugins/projectSelectorShortcut.js +67 -12
  49. package/src/runtime/plugins/sidebarNameBlur.js +1 -1
  50. package/src/runtime/runtime.js +23 -441
@@ -1,7 +1,18 @@
1
1
  const { codexPlusRuntimeAssets } = require("../../runtime/assets");
2
2
  const { replaceOnce } = require("./replace");
3
3
  const { makePatchSet } = require("./make-patch-set");
4
+ const { aboutMetadataRequire } = require("./hooks/about");
5
+ const { diagnosticDetailsHook } = require("./hooks/diagnostics");
6
+ const { mermaidDiagramHook } = require("./hooks/mermaid");
7
+ const { messageComposerHook } = require("./hooks/message-composer");
8
+ const { nativeMainHook } = require("./hooks/native-main");
9
+ const { reviewHook } = require("./hooks/review");
10
+ const { projectColorHook } = require("./hooks/sidebar");
11
+ const { appearanceSettingsHook, commandMenuItemsExpression } = require("./hooks/settings-commands");
12
+ const { threadHeaderHook } = require("./hooks/thread-header");
13
+ const { workerHook } = require("./hooks/worker");
4
14
  const {
15
+ patchHomeProjectDropdownProjectSelectorShortcut,
5
16
  patchLocalActiveWorkspaceRootDropdownProjectSelectorShortcut,
6
17
  patchRunCommandProjectSelectorShortcut,
7
18
  } = require("./project-selector-shortcut-patch");
@@ -20,7 +31,6 @@ function buildCodexPlusPatchSet(config) {
20
31
  const appShellFile = files.appShell;
21
32
  const errorBoundaryFile = files.errorBoundary;
22
33
  const generalSettingsFile = files.generalSettings;
23
- const sidebarProjectHoverCardSourceRowsFile = files.sidebarProjectHoverCardSourceRows;
24
34
  const headerFile = files.header;
25
35
  const threadPageHeaderFile = files.threadPageHeader;
26
36
  const localConversationPageFile = files.localConversationPage;
@@ -30,25 +40,31 @@ function buildCodexPlusPatchSet(config) {
30
40
  const userMessageAttachmentsFile = files.userMessageAttachments;
31
41
  const composerFile = files.composer;
32
42
  const localActiveWorkspaceRootDropdownFile = files.localActiveWorkspaceRootDropdown;
43
+ const homeProjectDropdownFile = files.homeProjectDropdown;
33
44
  const runCommandFile = files.runCommand;
34
45
  const localTaskRowFile = files.localTaskRow;
35
46
  const mermaidDiagramShellFile = files.mermaidDiagramShell;
36
47
  const electronMenuShortcutsFile = files.electronMenuShortcuts;
37
48
  const keyboardShortcutsSearchInputFile = files.keyboardShortcutsSearchInput;
49
+ const statsigStartupFile = files.statsigStartup;
38
50
  const srcFile = files.src;
39
51
  const sidebarThreadKeysFile = files.sidebarThreadKeys;
40
52
  const sidebarThreadRowSignalsFile = files.sidebarThreadRowSignals;
41
53
  const branchPickerDropdownContentFile = files.branchPickerDropdownContent;
42
54
 
43
- function codexPlusWorkerHelpers() {
44
- return `
45
- const CPXWorkerBridge=require(\"./codex-plus-worker.js\");function CPX_traceRequest(e){return CPXWorkerBridge.traceRequest(e)}async function CPX_repositoryTargets(e,t,n,r){return CPXWorkerBridge.repositoryTargets(e,t,n,r,(i,a)=>pae(e.getWorktreeRepositoryForRoot(i,n),a))}function CPX_isReadOnlyBranchRequest(e,t){return CPXWorkerBridge.isReadOnlyBranchRequest(e,t)}`;
46
- }
47
-
48
55
  function patchTitle(text) {
49
56
  return replaceOnce(text, oldTitle, newTitle, `${oldTitle} in ${titleFile}`);
50
57
  }
51
58
 
59
+ function patchDevModeStatsigFallback(text) {
60
+ return replaceOnce(
61
+ text,
62
+ "function Ske(e){let t=(0,J1.c)(27),{auth:n,appVersion:r,currentAccount:i,hostBuildFlavor:a,plan:o,statsigClientKey:s,systemName:c,systemVersion:l,children:u}=e,d=o===void 0?null:o,f=s===void 0?F1:s,p,m,h;if",
63
+ "function Ske(e){let t=(0,J1.c)(27),{auth:n,appVersion:r,currentAccount:i,hostBuildFlavor:a,plan:o,statsigClientKey:s,systemName:c,systemVersion:l,children:u}=e,d=o===void 0?null:o,f=s===void 0?F1:s,p,m,h;if(window.__CodexPlusRuntimeConfig?.devModeStatsigFallback)return u;if",
64
+ "dev mode statsig fallback anchor",
65
+ );
66
+ }
67
+
52
68
  function patchAboutDialog(text, context = {}) {
53
69
  const aboutContext = {
54
70
  patcherRepoUrl: context.patcherRepoUrl || "https://github.com/michaelw/codex-plus-patcher",
@@ -56,10 +72,62 @@ function patchAboutDialog(text, context = {}) {
56
72
  sourceAsarSha256: context.sourceAsarSha256 || "unknown",
57
73
  appliedPatches: context.appliedPatches || [],
58
74
  };
75
+ if (text.includes("function Q4({appDisplayName:e,buildInfoLabel:t,buildInfoText:n,iconDataUrl:r,isDark:i,okLabel:a,title:o})")) {
76
+ let patched = replaceOnce(
77
+ text,
78
+ "let i=a.app.getName(),o=a.app.getVersion()",
79
+ `let CPXAbout=${aboutMetadataRequire()}.aboutPayload(${JSON.stringify(aboutContext)}),i=CPXAbout.appDisplayName,o=a.app.getVersion()`,
80
+ "about dialog app name anchor",
81
+ );
82
+ patched = replaceOnce(
83
+ patched,
84
+ "g=d.formatMessage({messageId:I4,defaultMessage:L4}),_=q4(o),v=_.length===0?h:[h,``,..._].join(`\n`),",
85
+ "g=d.formatMessage({messageId:I4,defaultMessage:L4}),_=CPXAbout.buildInfoLines,v=_.length===0?h:[h,``,..._].join(`\n`),",
86
+ "about dialog build information anchor",
87
+ );
88
+ patched = replaceOnce(
89
+ patched,
90
+ "Q4({appDisplayName:i,buildInfoLabel:g,buildInfoText:v,iconDataUrl:f.htmlIconDataUrl,isDark:b,okLabel:m,title:p})",
91
+ "Q4({appDisplayName:i,buildInfoLabel:g,buildInfoText:v,codexPlusDisclaimerHeading:CPXAbout.disclaimerHeading,codexPlusDisclaimerBody:CPXAbout.disclaimerBody,iconDataUrl:f.htmlIconDataUrl,isDark:b,okLabel:m,title:p})",
92
+ "about dialog renderer call anchor",
93
+ );
94
+ patched = replaceOnce(
95
+ patched,
96
+ "function Q4({appDisplayName:e,buildInfoLabel:t,buildInfoText:n,iconDataUrl:r,isDark:i,okLabel:a,title:o}){let s=r==null?``:",
97
+ "function Q4({appDisplayName:e,buildInfoLabel:t,buildInfoText:n,codexPlusDisclaimerHeading:D,codexPlusDisclaimerBody:O,iconDataUrl:r,isDark:i,okLabel:a,title:o}){let CPXAboutMetadata=" +
98
+ aboutMetadataRequire() +
99
+ ",q=CPXAboutMetadata.disclaimerMarkup({escape:sV.default,heading:D,body:O}),s=r==null?``:",
100
+ "about dialog renderer signature anchor",
101
+ );
102
+ patched = replaceOnce(
103
+ patched,
104
+ " .build-info {\n width: 100%;\n margin: 0;\n line-height: 1.45;",
105
+ "${CPXAboutMetadata.disclaimerStyles()}\n\n .build-info {\n width: 100%;\n margin: 0;\n line-height: 1.45;",
106
+ "about dialog disclaimer styles anchor",
107
+ );
108
+ patched = replaceOnce(
109
+ patched,
110
+ " color: var(--muted-text);\n white-space: pre-wrap;",
111
+ " color: var(--muted-text);\n text-align: left;\n white-space: pre-wrap;",
112
+ "about dialog build info left align anchor",
113
+ );
114
+ patched = replaceOnce(
115
+ patched,
116
+ " .app-name,\n .build-info,\n .copyright {",
117
+ " .app-name,\n .codex-plus-disclaimer,\n .build-info,\n .copyright {",
118
+ "about dialog selectable disclaimer anchor",
119
+ );
120
+ return replaceOnce(
121
+ patched,
122
+ ' <div class="app-name" id="app-name">${(0,sV.default)(e)}</div>\n <pre class="build-info" aria-label="${(0,sV.default)(t)}">${(0,sV.default)(n)}</pre>',
123
+ ' <div class="app-name" id="app-name">${(0,sV.default)(e)}</div>\n ${q}\n <pre class="build-info" aria-label="${(0,sV.default)(t)}">${(0,sV.default)(n)}</pre>',
124
+ "about dialog disclaimer insertion anchor",
125
+ );
126
+ }
59
127
  let patched = replaceOnce(
60
128
  text,
61
129
  "let i=a.app.getName(),o=a.app.getVersion()",
62
- `let CPXAbout=require("./codex-plus-aboutMetadata.js").aboutPayload(${JSON.stringify(aboutContext)}),i=CPXAbout.appDisplayName,o=a.app.getVersion()`,
130
+ `let CPXAbout=${aboutMetadataRequire()}.aboutPayload(${JSON.stringify(aboutContext)}),i=CPXAbout.appDisplayName,o=a.app.getVersion()`,
63
131
  "about dialog app name anchor",
64
132
  );
65
133
  patched = replaceOnce(
@@ -77,7 +145,9 @@ function patchAboutDialog(text, context = {}) {
77
145
  patched = replaceOnce(
78
146
  patched,
79
147
  "function K0({appDisplayName:e,buildInfoLabel:t,buildInfoText:n,iconDataUrl:r,isDark:i,okLabel:a,title:o}){let s=r==null?``:",
80
- "function K0({appDisplayName:e,buildInfoLabel:t,buildInfoText:n,codexPlusDisclaimerHeading:D,codexPlusDisclaimerBody:O,iconDataUrl:r,isDark:i,okLabel:a,title:o}){let CPXAboutMetadata=require(\"./codex-plus-aboutMetadata.js\"),q=CPXAboutMetadata.disclaimerMarkup({escape:zz.default,heading:D,body:O}),s=r==null?``:",
148
+ "function K0({appDisplayName:e,buildInfoLabel:t,buildInfoText:n,codexPlusDisclaimerHeading:D,codexPlusDisclaimerBody:O,iconDataUrl:r,isDark:i,okLabel:a,title:o}){let CPXAboutMetadata=" +
149
+ aboutMetadataRequire() +
150
+ ",q=CPXAboutMetadata.disclaimerMarkup({escape:zz.default,heading:D,body:O}),s=r==null?``:",
81
151
  "about dialog renderer signature anchor",
82
152
  );
83
153
  patched = replaceOnce(
@@ -107,22 +177,48 @@ function patchAboutDialog(text, context = {}) {
107
177
  }
108
178
 
109
179
  function patchWorker(text) {
180
+ if (text.includes("function yae(e,t){return e.queryClient.fetchQuery")) {
181
+ let patched = replaceOnce(
182
+ text,
183
+ "var d2=gG(`git`),",
184
+ 'const CPXW=require("./codex-plus-worker.js"),CPXT=e=>CPXW.traceRequest(e),CPXR=(e,t,n,r)=>CPXW.repositoryTargetsFromHost(e,t,n,r,yae),CPXB=e=>CPXW.isReadOnlyBranchRequest(e?.requestKind,e?.source);var d2=gG(`git`),',
185
+ "worker helper insertion anchor",
186
+ );
187
+ patched = replaceOnce(
188
+ patched,
189
+ "if(!Z0(y)&&!t2(n))return",
190
+ "if(!Z0(y)&&!CPXB(y)&&!t2(n))return",
191
+ "codex plus branch picker git allowlist anchor",
192
+ );
193
+ patched = replaceOnce(
194
+ patched,
195
+ "case`commit-message-diff`:a=X(await o7(nae(e.params.cwd,e.params.includeUnstaged,this.gitManager,r),t.signal));break;case`submodule-paths`:a=X({paths:await yae(this.gitManager.getWorktreeRepositoryForRoot(e.params.root,r),t.signal)});break;",
196
+ "case`commit-message-diff`:a=X(await o7(nae(e.params.cwd,e.params.includeUnstaged,this.gitManager,r),t.signal));break;case`codex-plus-trace`:a=X(CPXT(e.params));break;case`repository-targets`:a=X(await CPXR(this.gitManager,e.params,r,t.signal));break;case`submodule-paths`:a=X({paths:await yae(this.gitManager.getWorktreeRepositoryForRoot(e.params.root,r),t.signal)});break;",
197
+ "repository-targets worker switch anchor",
198
+ );
199
+ return replaceOnce(
200
+ patched,
201
+ "case`review-patch`:case`commit-message-diff`:case`submodule-paths`:case`cat-file`:",
202
+ "case`review-patch`:case`commit-message-diff`:case`codex-plus-trace`:case`repository-targets`:case`submodule-paths`:case`cat-file`:",
203
+ "repository-targets worker readonly method anchor",
204
+ );
205
+ }
110
206
  let patched = replaceOnce(
111
207
  text,
112
208
  "function pae(e,t){return e.queryClient.fetchQuery",
113
- `${codexPlusWorkerHelpers()}function pae(e,t){return e.queryClient.fetchQuery`,
209
+ `${workerHook()}function pae(e,t){return e.queryClient.fetchQuery`,
114
210
  "worker helper insertion anchor",
115
211
  );
116
212
  patched = replaceOnce(
117
213
  patched,
118
214
  "case`submodule-paths`:a=X({paths:await pae(this.gitManager.getWorktreeRepositoryForRoot(e.params.root,r),t.signal)});break;",
119
- "case`codex-plus-trace`:a=X(CPX_traceRequest(e.params));break;case`repository-targets`:a=X(await CPX_repositoryTargets(this.gitManager,e.params,r,t.signal));break;case`submodule-paths`:a=X({paths:await pae(this.gitManager.getWorktreeRepositoryForRoot(e.params.root,r),t.signal)});break;",
215
+ "case`codex-plus-trace`:a=X(CPXT(e.params));break;case`repository-targets`:a=X(await CPXR(this.gitManager,e.params,r,t.signal));break;case`submodule-paths`:a=X({paths:await pae(this.gitManager.getWorktreeRepositoryForRoot(e.params.root,r),t.signal)});break;",
120
216
  "repository-targets worker switch anchor",
121
217
  );
122
218
  patched = replaceOnce(
123
219
  patched,
124
220
  "function u2({requestKind:e,source:t}){return l2.has(e??``)||d2(t)}",
125
- "function u2({requestKind:e,source:t}){return l2.has(e??``)||d2(t)||CPX_isReadOnlyBranchRequest(e,t)}",
221
+ "function u2({requestKind:e,source:t}){return l2.has(e??``)||d2(t)||CPXB(e,t)}",
126
222
  "codex plus branch picker git allowlist anchor",
127
223
  );
128
224
  return replaceOnce(
@@ -133,25 +229,21 @@ function patchWorker(text) {
133
229
  );
134
230
  }
135
231
 
136
- const codexPlusReviewHelpers = `
137
- function CPXReviewMux(e){let t=e.mainReviewContent??(0,$.jsx)(of,e);return window.CodexPlus?.ui?.review?.renderBody?.({props:e,deps:{jsx:$.jsx,jsxs:$.jsxs,Fragment:$.Fragment,createElement:Q.createElement,React:Q,useStore:s,useAtom:l,routeAtom:ft,cwdAtom:Or,hostIdAtom:Dr,hostConfigAtom:kr,conversationIdAtom:jr,gitRequest:y,pathValue:B,DefaultReview:of,Button:Y,Tooltip:Ae,Icon:Je,Dropdown:yi,DropdownMenu:vi,BranchPickerDropdownContent:CPXBranchPickerDropdownContent,ReviewToolbar:dp,parseDiff:xr,DiffCard:Ma},defaultBody:t})??t}`;
138
-
139
- const codexPlusSubrepoDiffHelpers = `
140
- `;
141
-
142
- const codexPlusDiagnosticHelpers = `
143
- function CPXDiagnosticDetails(e){return window.CodexPlus?.ui?.errors?.renderDetails?.(e)??null}`;
144
-
145
- const codexPlusMermaidHelpers = `
146
- function CPXMermaidDiagramProps(e){return window.CodexPlus?.ui?.mermaid?.diagramProps?.(e)}`;
147
-
148
- const codexPlusThreadHeaderHelpers = `
149
- function CPXThreadHeaderAccessories(e){return window.CodexPlus?.ui?.threadHeader?.renderAccessories?.(e)??null}`;
150
-
151
- const codexPlusNativeMainHelpers = `
152
- let CPXNativeMenuItems=[],CPXRefreshApplicationMenu=null;function CPXMenuSnapshot(e){return e?.items?.map(e=>({id:e.id,label:e.label,enabled:e.enabled,visible:e.visible,accelerator:e.accelerator,submenu:CPXMenuSnapshot(e.submenu)}))}function CPXLogMenuDiagnostics(){try{let e=CPXMenuSnapshot(a.Menu.getApplicationMenu())??[],t=JSON.stringify(e),n=t.includes(\`codexPlusOpenDevTools\`)||t.includes(\`Open Developer Tools\`);if(process.env.CODEX_PLUS_MENU_DIAGNOSTICS===\`1\`||!n)console.log(\`[Codex Plus menu diagnostics] \${JSON.stringify({hasOpenDeveloperTools:n,menu:e})}\`)}catch(e){console.log(\`[Codex Plus menu diagnostics] \${JSON.stringify({error:String(e?.message??e)})}\`)}}function CPXOpenDevTools(e){try{let t=e?.sender;if(typeof t?.openDevTools!==\`function\`)return{ok:!1};return t.openDevTools(),{ok:!0}}catch{return{ok:!1}}}function CPXFocusedEvent(){let e=a.BrowserWindow.getFocusedWindow();return e&&!e.isDestroyed()?{sender:e.webContents}:null}function CPXRunNativeMenuRequest(e){switch(e?.method){case\`devtools/open\`:return CPXOpenDevTools(CPXFocusedEvent());default:return{ok:!1}}}function CPXNativeMenuTemplateItems(e){return CPXNativeMenuItems.filter(t=>t.menuId===e).map(e=>({id:e.id,label:e.label,click:()=>{CPXRunNativeMenuRequest(e.nativeRequest)}}))}function CPXRegisterNativeMenuItem(e){if(e?.id==null||e?.menuId==null||e?.label==null||e?.nativeRequest?.method==null)return{ok:!1};let t={id:String(e.id),menuId:String(e.menuId),label:String(e.label),nativeRequest:{method:String(e.nativeRequest.method),params:e.nativeRequest.params},afterId:e.afterId==null?null:String(e.afterId),afterLabel:e.afterLabel==null?null:String(e.afterLabel)};CPXNativeMenuItems=CPXNativeMenuItems.filter(e=>e.id!==t.id),CPXNativeMenuItems.push(t);try{CPXRefreshApplicationMenu?.()}catch{}return CPXLogMenuDiagnostics(),{ok:!0}}function CPXOpenMermaidViewer(e){let t=e?.html;if(typeof t!==\`string\`||t.length===0)return{ok:!1};let n=(0,s.join)((0,o.tmpdir)(),\`codex-plus-mermaid-\${(0,u.randomUUID)()}.html\`);(0,l.writeFileSync)(n,t,\`utf8\`);let r=new a.BrowserWindow({height:900,resizable:!0,show:!0,title:\`Mermaid diagram viewer\`,webPreferences:{contextIsolation:!0,nodeIntegration:!1,sandbox:!0},width:1400});return r.webContents.setWindowOpenHandler(e=>{try{let t=new URL(e.url);if(t.protocol===\`https:\`&&t.hostname===\`mermaid.live\`)a.shell.openExternal(e.url)}catch{}return{action:\`deny\`}}),r.on(\`closed\`,()=>{try{(0,l.unlinkSync)(n)}catch{}}),r.loadURL((0,S.pathToFileURL)(n).toString()).catch(()=>{}),{ok:!0}}function CPXRegisterNativeRequest(e){return a.ipcMain.handle(\`codex_plus:native-request\`,async(t,n)=>{if(!e.isTrustedIpcEvent(t))return{ok:!1};switch(n?.method){case\`native-menu/register-item\`:return CPXRegisterNativeMenuItem(n.params);case\`devtools/open\`:return CPXOpenDevTools(t);case\`mermaid/openViewer\`:return CPXOpenMermaidViewer(n.params);default:return{ok:!1}}})}`;
153
-
154
232
  function patchThreadSidePanelTabs(text) {
233
+ if (text.includes("function oDn(e){let t=(0,sDn.c)(14),{expandedActionsPortalTarget:n,setTabState:r,tabState:i}=e")) {
234
+ let patched = replaceOnce(
235
+ text,
236
+ "function oDn(e){let t=(0,sDn.c)(14),{expandedActionsPortalTarget:n,setTabState:r,tabState:i}=e",
237
+ `${reviewHook("[JX,typeof PJ!==`undefined`?PJ:null,Kn,Nn,Xd,SA,CA,wA,null,Fe,Ue,cxn,null,null,null,null,null,null,null,typeof yA!==`undefined`?yA:null,typeof Gcn!==`undefined`?Gcn:null]")}function oDn(e){let t=(0,sDn.c)(14),{expandedActionsPortalTarget:n,setTabState:r,tabState:i}=e`,
238
+ "review host hook insertion anchor",
239
+ );
240
+ return replaceOnce(
241
+ patched,
242
+ "let s;t[1]!==a||t[2]!==r||t[3]!==i?(s=(0,JX.jsx)(cxn,{diffMode:a,setTabState:r,tabState:i}),t[1]=a,t[2]=r,t[3]=i,t[4]=s):s=t[4];let c;",
243
+ "let s;t[1]!==a||t[2]!==r||t[3]!==i?(s=(0,JX.jsx)(CPXRM,{mainReviewContent:(0,JX.jsx)(cxn,{diffMode:a,setTabState:r,tabState:i}),diffMode:a,setTabState:r,tabState:i}),t[1]=a,t[2]=r,t[3]=i,t[4]=s):s=t[4];let c;",
244
+ "review body mux anchor",
245
+ );
246
+ }
155
247
  let patched = replaceOnce(
156
248
  text,
157
249
  "import{r as vi,t as yi}from\"./dropdown-CTBRoADH.js\";",
@@ -161,21 +253,41 @@ function patchThreadSidePanelTabs(text) {
161
253
  patched = replaceOnce(
162
254
  patched,
163
255
  "function uf({cwd:e,fileEntries:t,generatedPathsReady:n,hasUnhandledAttributesFiles:r,isCappedMode:i,repositorySource:a,reviewSummarySource:o}){",
164
- `${codexPlusReviewHelpers}function uf({cwd:e,fileEntries:t,generatedPathsReady:n,hasUnhandledAttributesFiles:r,isCappedMode:i,repositorySource:a,reviewSummarySource:o}){`,
256
+ `${reviewHook()}function uf({cwd:e,fileEntries:t,generatedPathsReady:n,hasUnhandledAttributesFiles:r,isCappedMode:i,repositorySource:a,reviewSummarySource:o}){`,
165
257
  "review host hook insertion anchor",
166
258
  );
167
259
  return replaceOnce(
168
260
  patched,
169
261
  "let s;t[1]!==a||t[2]!==r||t[3]!==i?(s=(0,$.jsx)(Tf,{diffMode:a,setTabState:r,tabState:i}),t[1]=a,t[2]=r,t[3]=i,t[4]=s):s=t[4];let c;",
170
- "let s;t[1]!==a||t[2]!==r||t[3]!==i?(s=(0,$.jsx)(CPXReviewMux,{mainReviewContent:(0,$.jsx)(Tf,{diffMode:a,setTabState:r,tabState:i}),diffMode:a,setTabState:r,tabState:i}),t[1]=a,t[2]=r,t[3]=i,t[4]=s):s=t[4];let c;",
262
+ "let s;t[1]!==a||t[2]!==r||t[3]!==i?(s=(0,$.jsx)(CPXRM,{mainReviewContent:(0,$.jsx)(Tf,{diffMode:a,setTabState:r,tabState:i}),diffMode:a,setTabState:r,tabState:i}),t[1]=a,t[2]=r,t[3]=i,t[4]=s):s=t[4];let c;",
171
263
  "review body mux anchor",
172
264
  );
173
265
  }
174
266
  function patchAppShell(text) {
267
+ if (text.includes("function xdn(e){let t=(0,Cdn.c)(4),{onRetry:n}=e")) {
268
+ let patched = replaceOnce(
269
+ text,
270
+ "function xdn(e){let t=(0,Cdn.c)(4),{onRetry:n}=e",
271
+ `${diagnosticDetailsHook()}function xdn(e){let t=(0,Cdn.c)(4),{onRetry:n,error:CPX_error}=e`,
272
+ "app shell error fallback prop anchor",
273
+ );
274
+ patched = replaceOnce(
275
+ patched,
276
+ "children:[r,(0,NK.jsx)(Ud,{color:`secondary`,size:`default`,onClick:n,children:i})]",
277
+ "children:[r,CPXDiagnosticDetails({jsx:NK.jsx,error:CPX_error}),(0,NK.jsx)(Ud,{color:`secondary`,size:`default`,onClick:n,children:i})]",
278
+ "app shell error detail insertion anchor",
279
+ );
280
+ return replaceOnce(
281
+ patched,
282
+ "fallback:e=>(0,NK.jsx)(xdn,{onRetry:()=>{e.resetError()}})",
283
+ "fallback:e=>(0,NK.jsx)(xdn,{error:e.error,onRetry:()=>{e.resetError()}})",
284
+ "app shell boundary error prop anchor",
285
+ );
286
+ }
175
287
  let patched = replaceOnce(
176
288
  text,
177
289
  "function En(e){return(0,Q.jsx)(wn,{onRetry:()=>{e.resetError()}})}",
178
- `${codexPlusDiagnosticHelpers}function En(e){return(0,Q.jsx)(wn,{error:e.error,onRetry:()=>{e.resetError()}})}`,
290
+ `${diagnosticDetailsHook()}function En(e){return(0,Q.jsx)(wn,{error:e.error,onRetry:()=>{e.resetError()}})}`,
179
291
  "app shell error fallback prop anchor",
180
292
  );
181
293
  patched = replaceOnce(
@@ -184,25 +296,20 @@ function patchAppShell(text) {
184
296
  "children:[r,CPXDiagnosticDetails({jsx:Q.jsx,error:e.error}),(0,Q.jsx)(Le,{color:`secondary`,size:`default`,onClick:n,children:i})]",
185
297
  "app shell error detail insertion anchor",
186
298
  );
187
- patched = replaceOnce(
188
- patched,
189
- "return t[2]===n?a=t[3]:(a=(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col items-center justify-center gap-3 p-4 text-center text-sm text-token-text-secondary`,children:",
190
- "return t[2]===n&&t[3]===e.error?a=t[4]:(a=(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col items-center justify-center gap-3 p-4 text-center text-sm text-token-text-secondary`,children:",
191
- "app shell error cache condition anchor",
192
- );
193
- return replaceOnce(
194
- patched,
195
- "}),t[2]=n,t[3]=a),a}function Tn(e){return e.composedPath().some",
196
- "}),t[2]=n,t[3]=e.error,t[4]=a),a}function Tn(e){return e.composedPath().some",
197
- "app shell error cache assignment anchor",
198
- );
299
+ return patched;
199
300
  }
200
301
 
201
302
  function patchErrorBoundary(text) {
303
+ if (
304
+ !text.includes("function Xf(e){let t=(0,Vf.c)(9),{resetError:n}=e,r=ee(),i,a;") &&
305
+ text.includes("function xdn(e){let t=(0,Cdn.c)(")
306
+ ) {
307
+ return text;
308
+ }
202
309
  let patched = replaceOnce(
203
310
  text,
204
311
  "function Xf(e){let t=(0,Vf.c)(9),{resetError:n}=e,r=ee(),i,a;",
205
- `${codexPlusDiagnosticHelpers}function Xf(e){let t=(0,Vf.c)(9),{resetError:n,error:CPX_error,componentStack:CPX_componentStack}=e,r=ee(),i,a;`,
312
+ `${diagnosticDetailsHook()}function Xf(e){let t=(0,Vf.c)(9),{resetError:n,error:CPX_error,componentStack:CPX_componentStack}=e,r=ee(),i,a;`,
206
313
  "webview error boundary fallback prop anchor",
207
314
  );
208
315
  patched = replaceOnce(
@@ -220,58 +327,62 @@ function patchErrorBoundary(text) {
220
327
  }
221
328
 
222
329
  function patchAppMainProjectColors(text) {
330
+ if (text.includes("function gg(e){let t=(0,Rg.c)(44),{threadKeys:n,")) {
331
+ let patched = replaceOnce(
332
+ text,
333
+ "function gg(e){let t=(0,Rg.c)(44),",
334
+ `${projectColorHook()}function gg(e){let t=(0,Rg.c)(44),`,
335
+ "project color app main helper insertion anchor",
336
+ );
337
+ patched = replaceOnce(
338
+ patched,
339
+ "X=(0,$.jsx)(`div`,{...H,children:ne})",
340
+ "X=(0,$.jsx)(`div`,{...H,...CPXPR(a),children:ne})",
341
+ "project group color render anchor",
342
+ );
343
+ return replaceOnce(
344
+ patched,
345
+ "(te=(0,Fh.jsxs)(`div`,{...v,...O,ref:n,className:j,role:`button`,tabIndex:M,",
346
+ "(te=(0,Fh.jsxs)(`div`,{...v,...O,...CPXPR({projectId:_,label:p}),ref:n,className:j,role:`button`,tabIndex:M,",
347
+ "current project header row color attributes anchor",
348
+ );
349
+ }
223
350
  let patched = replaceOnce(
224
351
  text,
225
352
  "function Pk(e){let t=(0,Q.c)(45),",
226
- `${codexPlusProjectColorHelpers}function Pk(e){let t=(0,Q.c)(46),`,
353
+ `${projectColorHook()}function Pk(e){let t=(0,Q.c)(45),`,
227
354
  "project color app main helper insertion anchor",
228
355
  );
229
356
  patched = replaceOnce(
230
357
  patched,
231
- "H=Ha.sidebarProjectList({projectId:i.projectId,showAll:x})",
232
- "H=Ha.sidebarProjectList({projectId:i.projectId,showAll:x})",
233
- "project group color marker anchor",
234
- );
235
- patched = replaceOnce(
236
- patched,
237
- "q={onActivateGroup:V,onStartNewConversation:a,isGrouped:!0,hideRemoteHostEnvIcon:!0,hideTimestamp:l,locationId:b,floatStatusIconsRight:s,showPinActionOnHover:o}",
238
- "q={onActivateGroup:V,onStartNewConversation:a,isGrouped:!0,hideRemoteHostEnvIcon:!0,hideTimestamp:l,locationId:b,floatStatusIconsRight:s,showPinActionOnHover:o,dataAttributes:CPXHostThreadRowProps(i)}",
239
- "project thread row color key anchor",
240
- );
241
- patched = replaceOnce(
242
- patched,
243
- "t[19]!==V||t[20]!==s||t[21]!==l||t[22]!==b||t[23]!==o||t[24]!==a?",
244
- "t[19]!==V||t[20]!==s||t[21]!==l||t[22]!==b||t[23]!==o||t[24]!==a||t[45]!==i?",
245
- "project thread row color cache dependency anchor",
246
- );
247
- patched = replaceOnce(
248
- patched,
249
- "t[19]=V,t[20]=s,t[21]=l,t[22]=b,t[23]=o,t[24]=a,t[25]=q):q=t[25]",
250
- "t[19]=V,t[20]=s,t[21]=l,t[22]=b,t[23]=o,t[24]=a,t[45]=i,t[25]=q):q=t[25]",
251
- "project thread row color cache write anchor",
252
- );
253
- patched = replaceOnce(
254
- patched,
255
- "ie=(0,Z.jsx)(`div`,{...H,children:re})",
256
358
  "ie=(0,Z.jsx)(`div`,{...H,children:re})",
359
+ "ie=(0,Z.jsx)(`div`,{...H,...CPXPR(i),children:re})",
257
360
  "project group color render anchor",
258
361
  );
259
362
  patched = replaceOnce(
260
363
  patched,
261
- "O=(0,Z.jsx)(NO,{action:T,actionTooltipContent:h,actionTooltipDisabled:p,indicator:E,isMenuOpen:g,menu:D})",
262
- "O=(0,Z.jsx)(NO,{action:T,actionTooltipContent:h,actionTooltipDisabled:p,indicator:E,isMenuOpen:g,menu:D})",
263
- "project header action render anchor",
364
+ "Ke=(0,Z.jsx)(Oe,{rowAttributes:ke,className:Ae,collapsed:L,contentClassName:je,",
365
+ "Ke=(0,Z.jsx)(Oe,{rowAttributes:{...ke,...CPXPR(n)},className:Ae,collapsed:L,contentClassName:je,",
366
+ "project header row color attributes anchor",
264
367
  );
265
368
  patched = replaceOnce(
266
369
  patched,
267
- "Ke=(0,Z.jsx)(Oe,{rowAttributes:ke,className:Ae,collapsed:L,contentClassName:je,",
268
- "Ke=(0,Z.jsx)(Oe,{rowAttributes:{...ke,...CPXHostProjectRowProps(n)},className:Ae,collapsed:L,contentClassName:je,",
269
- "project header row color attributes anchor",
370
+ "(te=(0,Fh.jsxs)(`div`,{...v,...O,ref:n,className:j,role:`button`,tabIndex:M,",
371
+ "(te=(0,Fh.jsxs)(`div`,{...v,...O,...CPXPR({projectId:_,label:p}),ref:n,className:j,role:`button`,tabIndex:M,",
372
+ "current project header row color attributes anchor",
270
373
  );
271
374
  return patched;
272
375
  }
273
376
 
274
377
  function patchAppMainSidebarBlur(text) {
378
+ if (!text.includes("openFolder:$y,toggleSidebar:$i,toggleTerminal:Md,")) {
379
+ return replaceOnce(
380
+ text,
381
+ "se=(0,$.jsx)(`span`,{className:`flex min-w-0 flex-1 items-center gap-2 whitespace-nowrap`,children:(0,$.jsx)(lg,{label:O,labelEnd:ae,labelTooltipContent:oe})})",
382
+ "se=(0,$.jsx)(`span`,{\"data-codex-plus-sidebar-name\":``,className:`flex min-w-0 flex-1 items-center gap-2 whitespace-nowrap`,children:(0,$.jsx)(lg,{label:O,labelEnd:ae,labelTooltipContent:oe})})",
383
+ "project header sidebar blur label anchor",
384
+ );
385
+ }
275
386
  let patched = text;
276
387
  patched = replaceOnce(
277
388
  patched,
@@ -288,118 +399,26 @@ function patchAppMainSidebarBlur(text) {
288
399
  return replaceOnce(
289
400
  patched,
290
401
  "children:[l,u,(0,Z.jsx)(H_,{route:a,children:C})]",
291
- "children:[l,u,...(window.CodexPlus?.ui?.commands?.renderMenuItems?.({group:`suggested`,deps:{jsx:Z.jsx,MenuItem:Zy,register:Hp}})??[]),(0,Z.jsx)(H_,{route:a,children:C})]",
402
+ `children:[l,u,...(${commandMenuItemsExpression("suggested", "Z.jsx", "Zy", "Hp")}),(0,Z.jsx)(H_,{route:a,children:C})]`,
292
403
  "sidebar name blur command mount anchor",
293
404
  );
294
405
  }
295
406
 
296
- function patchSidebarProjectHoverCardSourceRows(text) {
297
- let patched = text;
298
- patched = replaceOnce(
299
- patched,
300
- "var En=(0,Vt.memo)(function(e){let t=(0,zt.c)(40),{threadKey:n,canPin:r,disableHoverCard:a,floatStatusIconsRight:o,isGrouped:s,hideRemoteHostEnvIcon:c,hideTimestamp:l,locationId:u,onActivateGroup:d,onStartNewConversation:f,showPinActionOnHover:p,variant:m,shortcutLabel:h,onArchiveStart:g,onArchiveSuccess:_,onArchiveError:v}=e,",
301
- "var En=(0,Vt.memo)(function(e){let t=(0,zt.c)(41),{threadKey:n,canPin:r,disableHoverCard:a,floatStatusIconsRight:o,isGrouped:s,hideRemoteHostEnvIcon:c,hideTimestamp:l,locationId:u,onActivateGroup:d,onStartNewConversation:f,showPinActionOnHover:p,variant:m,shortcutLabel:h,onArchiveStart:g,onArchiveSuccess:_,onArchiveError:v,dataAttributes:CPX_rowDataAttributes}=e,",
302
- "sidebar row component data attributes prop anchor",
303
- );
304
- patched = replaceOnce(
305
- patched,
306
- "t[12]!==A||t[13]!==y||t[14]!==b||t[15]!==F||t[16]!==x||t[17]!==B||t[18]!==L||t[19]!==z||t[20]!==ee||t[21]!==te||t[22]!==j||t[23]!==M||t[24]!==N||t[25]!==P||t[26]!==k||t[27]!==S||t[28]!==C||t[29]!==d||t[30]!==f||t[31]!==h||t[32]!==w||t[33]!==V||t[34]!==T?",
307
- "t[12]!==A||t[13]!==y||t[14]!==b||t[15]!==F||t[16]!==x||t[17]!==B||t[18]!==L||t[19]!==z||t[20]!==ee||t[21]!==te||t[22]!==j||t[23]!==M||t[24]!==N||t[25]!==P||t[26]!==k||t[27]!==S||t[28]!==C||t[29]!==d||t[30]!==f||t[31]!==h||t[32]!==w||t[33]!==V||t[34]!==T||t[40]!==CPX_rowDataAttributes?",
308
- "sidebar row component data attributes memo dependency anchor",
309
- );
310
- patched = replaceOnce(
311
- patched,
312
- "onArchiveStart:L,onArchiveSuccess:z,onArchiveError:B}",
313
- "onArchiveStart:L,onArchiveSuccess:z,onArchiveError:B,dataAttributes:CPX_rowDataAttributes}",
314
- "sidebar row component data attributes object anchor",
315
- );
316
- patched = replaceOnce(
317
- patched,
318
- "t[32]=w,t[33]=V,t[34]=T,t[35]=H):H=t[35]",
319
- "t[32]=w,t[33]=V,t[34]=T,t[40]=CPX_rowDataAttributes,t[35]=H):H=t[35]",
320
- "sidebar row component data attributes memo write anchor",
321
- );
322
- patched = replaceOnce(
323
- patched,
324
- "function On(e){let t=(0,zt.c)(121),{entry:n,isPinned:r,isAutomationRun:a,automationDisplayName:o,isActive:s,canPin:c,disableHoverCard:u,floatStatusIconsRight:f,isGrouped:p,hideRemoteHostEnvIcon:m,hideTimestamp:h,locationId:g,onActivateGroup:y,onStartNewConversation:b,showPinActionOnHover:te,variant:C,shortcutLabel:T,hoverCardHostConfig:E,hoverCardProjectId:D,hoverCardProjectLabel:A,hoverCardRepositoryLabel:j,displayCwd:M,onArchiveStart:N,onArchiveSuccess:P,onArchiveError:F}=e,",
325
- "function On(e){let t=(0,zt.c)(124),{entry:n,isPinned:r,isAutomationRun:a,automationDisplayName:o,isActive:s,canPin:c,disableHoverCard:u,floatStatusIconsRight:f,isGrouped:p,hideRemoteHostEnvIcon:m,hideTimestamp:h,locationId:g,onActivateGroup:y,onStartNewConversation:b,showPinActionOnHover:te,variant:C,shortcutLabel:T,hoverCardHostConfig:E,hoverCardProjectId:D,hoverCardProjectLabel:A,hoverCardRepositoryLabel:j,displayCwd:M,onArchiveStart:N,onArchiveSuccess:P,onArchiveError:F,dataAttributes:CPX_rowDataAttributes}=e,",
326
- "sidebar row dispatcher data attributes prop anchor",
327
- );
328
- patched = replaceOnce(
329
- patched,
330
- "dataAttributes:ae.sidebarThreadRow({active:s,hostId:t.hostId,id:n,kind:`pending-worktree`,pinned:r,title:t.label})",
331
- "dataAttributes:window.CodexPlus?.ui?.sidebar?.mergeDataAttributes?.(ae.sidebarThreadRow({active:s,hostId:t.hostId,id:n,kind:`pending-worktree`,pinned:r,title:t.label}),CPX_rowDataAttributes)",
332
- "pending worktree sidebar row data attributes merge anchor",
333
- );
334
- patched = replaceOnce(
335
- patched,
336
- "dataAttributes:ae.sidebarThreadRow({active:s,hostId:null,id:t,kind:`remote`,pinned:r,title:e.task.title??``})",
337
- "dataAttributes:window.CodexPlus?.ui?.sidebar?.mergeDataAttributes?.(ae.sidebarThreadRow({active:s,hostId:null,id:t,kind:`remote`,pinned:r,title:e.task.title??``}),CPX_rowDataAttributes)",
338
- "remote sidebar row data attributes merge anchor",
339
- );
340
- patched = replaceOnce(
341
- patched,
342
- "dataAttributes:ae.sidebarThreadRow({active:s,hostId:f,id:i,kind:`local`,pinned:r,title:x})",
343
- "dataAttributes:window.CodexPlus?.ui?.sidebar?.mergeDataAttributes?.(ae.sidebarThreadRow({active:s,hostId:f,id:i,kind:`local`,pinned:r,title:x}),CPX_rowDataAttributes)",
344
- "local sidebar row data attributes merge anchor",
345
- );
346
- patched = replaceOnce(
347
- patched,
348
- "t[22]=c,t[23]=se,t[24]=Ne,t[25]=L,t[26]=Je,t[27]=J,t[28]=oe,t[29]=V,t[30]=G,t[31]=s,t[32]=z,t[33]=r,t[34]=g,t[35]=K,t[36]=y,t[37]=P,t[38]=le,t[39]=W,t[40]=ue,t[41]=et,t[42]=H,t[43]=U,t[44]=st):st=t[44]",
349
- "t[22]=c,t[23]=se,t[24]=Ne,t[25]=L,t[26]=Je,t[27]=J,t[28]=oe,t[29]=V,t[30]=G,t[31]=s,t[32]=z,t[33]=r,t[34]=g,t[35]=K,t[36]=y,t[37]=P,t[38]=le,t[39]=W,t[40]=ue,t[41]=et,t[42]=H,t[43]=U,t[121]=CPX_rowDataAttributes,t[44]=st):st=t[44]",
350
- "pending worktree sidebar row data attributes memo write anchor",
351
- );
352
- patched = replaceOnce(
353
- patched,
354
- "t[45]!==c||t[46]!==Ne||t[47]!==Fe||t[48]!==L||t[49]!==Je||t[50]!==J||t[51]!==oe||t[52]!==V||t[53]!==G||t[54]!==s||t[55]!==z||t[56]!==r||t[57]!==g||t[58]!==F||t[59]!==P||t[60]!==nt||t[61]!==Q||t[62]!==We||t[63]!==W||t[64]!==Xe||t[65]!==et||t[66]!==H||t[67]!==U?",
355
- "t[45]!==c||t[46]!==Ne||t[47]!==Fe||t[48]!==L||t[49]!==Je||t[50]!==J||t[51]!==oe||t[52]!==V||t[53]!==G||t[54]!==s||t[55]!==z||t[56]!==r||t[57]!==g||t[58]!==F||t[59]!==P||t[60]!==nt||t[61]!==Q||t[62]!==We||t[63]!==W||t[64]!==Xe||t[65]!==et||t[66]!==H||t[67]!==U||t[122]!==CPX_rowDataAttributes?",
356
- "remote sidebar row data attributes memo dependency anchor",
357
- );
358
- patched = replaceOnce(
359
- patched,
360
- "t[63]=W,t[64]=Xe,t[65]=et,t[66]=H,t[67]=U,t[68]=ht):ht=t[68]",
361
- "t[63]=W,t[64]=Xe,t[65]=et,t[66]=H,t[67]=U,t[122]=CPX_rowDataAttributes,t[68]=ht):ht=t[68]",
362
- "remote sidebar row data attributes memo write anchor",
363
- );
364
- patched = replaceOnce(
365
- patched,
366
- "t[69]!==o||t[70]!==c||t[71]!==I||t[72]!==ot||t[73]!==M||t[74]!==Pe||t[75]!==Ne||t[76]!==Fe||t[77]!==L||t[78]!==Je||t[79]!==J||t[80]!==ne||t[81]!==oe||t[82]!==V||t[83]!==E||t[84]!==A||t[85]!==G||t[86]!==s||t[87]!==a||t[88]!==z||t[89]!==r||t[90]!==pe||t[91]!==fe||t[92]!==he||t[93]!==Be||t[94]!==De||t[95]!==null||t[96]!==_e||t[97]!==me||t[98]!==ge||t[99]!==g||t[100]!==y||t[101]!==F||t[102]!==P||t[103]!==nt||t[104]!==Q||t[105]!==W||t[106]!==Xe||t[107]!==et||t[108]!==H||t[109]!==be||t[110]!==U?",
367
- "t[69]!==o||t[70]!==c||t[71]!==I||t[72]!==ot||t[73]!==M||t[74]!==Pe||t[75]!==Ne||t[76]!==Fe||t[77]!==L||t[78]!==Je||t[79]!==J||t[80]!==ne||t[81]!==oe||t[82]!==V||t[83]!==E||t[84]!==A||t[85]!==G||t[86]!==s||t[87]!==a||t[88]!==z||t[89]!==r||t[90]!==pe||t[91]!==fe||t[92]!==he||t[93]!==Be||t[94]!==De||t[95]!==null||t[96]!==_e||t[97]!==me||t[98]!==ge||t[99]!==g||t[100]!==y||t[101]!==F||t[102]!==P||t[103]!==nt||t[104]!==Q||t[105]!==W||t[106]!==Xe||t[107]!==et||t[108]!==H||t[109]!==be||t[110]!==U||t[123]!==CPX_rowDataAttributes?",
368
- "local sidebar row data attributes memo dependency anchor",
369
- );
370
- patched = replaceOnce(
371
- patched,
372
- "t[108]=H,t[109]=be,t[110]=U,t[111]=vt):vt=t[111]",
373
- "t[108]=H,t[109]=be,t[110]=U,t[123]=CPX_rowDataAttributes,t[111]=vt):vt=t[111]",
374
- "local sidebar row data attributes memo write anchor",
375
- );
376
- patched = replaceOnce(
377
- patched,
378
- "t[14]!==l?.canPin||t[15]!==l?.disableHoverCard||t[16]!==l?.floatStatusIconsRight||t[17]!==l?.hideRemoteHostEnvIcon||t[18]!==l?.hideTimestamp||t[19]!==l?.isGrouped||t[20]!==l?.locationId||t[21]!==l?.onActivateGroup||t[22]!==l?.onStartNewConversation||t[23]!==l?.showPinActionOnHover||t[24]!==l?.variant||t[25]!==b?",
379
- "t[14]!==l?.canPin||t[15]!==l?.disableHoverCard||t[16]!==l?.floatStatusIconsRight||t[17]!==l?.hideRemoteHostEnvIcon||t[18]!==l?.hideTimestamp||t[19]!==l?.isGrouped||t[20]!==l?.locationId||t[21]!==l?.onActivateGroup||t[22]!==l?.onStartNewConversation||t[23]!==l?.showPinActionOnHover||t[24]!==l?.variant||t[25]!==b||t[43]!==l?.dataAttributes?",
380
- "thread list row options data attributes memo dependency anchor",
381
- );
382
- patched = replaceOnce(
383
- patched,
384
- "showPinActionOnHover:l?.showPinActionOnHover,variant:l?.variant,shortcutLabel:b?.get(e)}),",
385
- "showPinActionOnHover:l?.showPinActionOnHover,variant:l?.variant,shortcutLabel:b?.get(e),dataAttributes:l?.dataAttributes}),",
386
- "thread list row options data attributes prop anchor",
387
- );
388
- patched = replaceOnce(
389
- patched,
390
- "t[24]=l?.variant,t[25]=b,t[26]=j):j=t[26]",
391
- "t[24]=l?.variant,t[25]=b,t[43]=l?.dataAttributes,t[26]=j):j=t[26]",
392
- "thread list row options data attributes memo write anchor",
393
- );
394
- return replaceOnce(
395
- patched,
396
- "function Rn(e){let t=(0,zt.c)(43),",
397
- "function Rn(e){let t=(0,zt.c)(44),",
398
- "thread list memo cache size anchor",
399
- );
400
- }
401
-
402
407
  function patchHeader(text) {
408
+ if (text.includes("function Jn(e){let t=(0,$n.c)(66),")) {
409
+ let patched = replaceOnce(
410
+ text,
411
+ "function Jn(e){let t=(0,$n.c)(66),",
412
+ `${threadHeaderHook()}function Jn(e){let t=(0,$n.c)(66),`,
413
+ "thread header accessory helper insertion anchor",
414
+ );
415
+ return replaceOnce(
416
+ patched,
417
+ "let x;t[35]!==c||t[36]!==g||t[37]!==i?(x=(0,$.jsx)(`div`,{className:`mr-3 line-clamp-1 flex min-w-0 flex-1 items-center gap-1 truncate`,style:{viewTransitionName:`header-title`},children:i?(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1`,children:[(0,$.jsx)(Qn,{onClick:c}),(0,$.jsx)(q,{color:`ghostActive`,type:`button`,onClick:u,className:`min-w-0 flex-1 truncate !px-0 !py-0 text-left text-sm text-token-foreground hover:!bg-transparent hover:opacity-80 electron:font-medium`,children:(0,$.jsx)(`span`,{className:`truncate`,children:i})})]}):(0,$.jsx)(`span`,{className:`text-token-description-foreground`,children:(0,$.jsx)(Zn,{mergedTasks:g,onBack:c,showBackButton:!0})})}),t[35]=c,t[36]=g,t[37]=i,t[38]=x):x=t[38];",
418
+ "let CPX_headerContext={cwd:null,hostId:null,header:{surface:`header`,titleText:typeof i==`string`?i:null}},CPX_headerAccessories=CPXThreadHeaderAccessories({context:CPX_headerContext,deps:{jsx:$.jsx,jsxs:$.jsxs,Tooltip:me}});let x;t[35]!==c||t[36]!==g||t[37]!==i?(x=(0,$.jsx)(`div`,{className:`mr-3 line-clamp-1 flex min-w-0 flex-1 items-center gap-1 truncate`,style:{viewTransitionName:`header-title`},children:i?(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1`,children:[(0,$.jsx)(Qn,{onClick:c}),(0,$.jsx)(q,{color:`ghostActive`,type:`button`,onClick:u,className:`min-w-0 flex-1 truncate !px-0 !py-0 text-left text-sm text-token-foreground hover:!bg-transparent hover:opacity-80 electron:font-medium`,children:(0,$.jsx)(`span`,{className:`truncate`,children:i})}),CPX_headerAccessories]}):(0,$.jsx)(`span`,{className:`text-token-description-foreground`,children:(0,$.jsx)(Zn,{mergedTasks:g,onBack:c,showBackButton:!0})})}),t[35]=c,t[36]=g,t[37]=i,t[38]=x):x=t[38];",
419
+ "thread header accessory render anchor",
420
+ );
421
+ }
403
422
  let patched = replaceOnce(
404
423
  text,
405
424
  `import{Z as r,a as i,s as a}from"./app-scope-CWE-zIhQ.js";`,
@@ -421,21 +440,15 @@ function patchHeader(text) {
421
440
  patched = replaceOnce(
422
441
  patched,
423
442
  "function lt(e){let t=(0,Z.c)(68),",
424
- `${codexPlusThreadHeaderHelpers}function lt(e){let t=(0,Z.c)(72),`,
443
+ `${threadHeaderHook()}function lt(e){let t=(0,Z.c)(68),`,
425
444
  "thread header accessory helper insertion anchor",
426
445
  );
427
446
  patched = replaceOnce(
428
447
  patched,
429
448
  "let C;t[36]!==c||t[37]!==g||t[38]!==i?(C=(0,Q.jsx)(`div`,{className:`mr-3 line-clamp-1 flex min-w-0 flex-1 items-center gap-1 truncate`,style:{viewTransitionName:`header-title`},children:i?(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1`,children:[(0,Q.jsx)(mt,{onClick:c}),(0,Q.jsx)(x,{color:`ghostActive`,type:`button`,onClick:u,className:`min-w-0 flex-1 truncate !px-0 !py-0 text-left text-sm text-token-foreground hover:!bg-transparent hover:opacity-80 electron:font-medium`,children:(0,Q.jsx)(`span`,{className:`truncate`,children:i})})]}):(0,Q.jsx)(`span`,{className:`text-token-description-foreground`,children:(0,Q.jsx)(pt,{mergedTasks:g,onBack:c,showBackButton:!0})})}),t[36]=c,t[37]=g,t[38]=i,t[39]=C):C=t[39];",
430
- "let CPX_headerContext={cwd:CPX_readAtom(CPX_headerCwd),hostId:CPX_readAtom(CPX_headerHostId)},CPX_headerAccessories=CPXThreadHeaderAccessories({context:CPX_headerContext,deps:{jsx:Q.jsx,jsxs:Q.jsxs,Tooltip:CPX_Tooltip}});let C;t[36]!==c||t[37]!==g||t[38]!==i||t[68]!==CPX_headerAccessories?(C=(0,Q.jsx)(`div`,{className:`mr-3 line-clamp-1 flex min-w-0 flex-1 items-center gap-1 truncate`,style:{viewTransitionName:`header-title`},children:i?(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1`,children:[(0,Q.jsx)(mt,{onClick:c}),(0,Q.jsx)(x,{color:`ghostActive`,type:`button`,onClick:u,className:`min-w-0 flex-1 truncate !px-0 !py-0 text-left text-sm text-token-foreground hover:!bg-transparent hover:opacity-80 electron:font-medium`,children:(0,Q.jsx)(`span`,{className:`truncate`,children:i})}),CPX_headerAccessories]}):(0,Q.jsx)(`span`,{className:`text-token-description-foreground`,children:(0,Q.jsx)(pt,{mergedTasks:g,onBack:c,showBackButton:!0})})}),t[36]=c,t[37]=g,t[38]=i,t[68]=CPX_headerAccessories,t[39]=C):C=t[39];",
449
+ "let CPX_headerContext={cwd:CPX_readAtom(CPX_headerCwd),hostId:CPX_readAtom(CPX_headerHostId)},CPX_headerAccessories=CPXThreadHeaderAccessories({context:CPX_headerContext,deps:{jsx:Q.jsx,jsxs:Q.jsxs,Tooltip:CPX_Tooltip}});let C;t[36]!==c||t[37]!==g||t[38]!==i?(C=(0,Q.jsx)(`div`,{className:`mr-3 line-clamp-1 flex min-w-0 flex-1 items-center gap-1 truncate`,style:{viewTransitionName:`header-title`},children:i?(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1`,children:[(0,Q.jsx)(mt,{onClick:c}),(0,Q.jsx)(x,{color:`ghostActive`,type:`button`,onClick:u,className:`min-w-0 flex-1 truncate !px-0 !py-0 text-left text-sm text-token-foreground hover:!bg-transparent hover:opacity-80 electron:font-medium`,children:(0,Q.jsx)(`span`,{className:`truncate`,children:i})}),CPX_headerAccessories]}):(0,Q.jsx)(`span`,{className:`text-token-description-foreground`,children:(0,Q.jsx)(pt,{mergedTasks:g,onBack:c,showBackButton:!0})})}),t[36]=c,t[37]=g,t[38]=i,t[39]=C):C=t[39];",
431
450
  "thread header accessory render anchor",
432
451
  );
433
- patched = replaceOnce(
434
- patched,
435
- "t[53]!==A||t[54]!==b||t[55]!==S||t[56]!==C?(M=(0,Q.jsxs)(`div`,{className:b,children:[S,C,A]}),t[53]=A,t[54]=b,t[55]=S,t[56]=C,t[57]=M):M=t[57]",
436
- "t[53]!==A||t[54]!==b||t[55]!==S||t[56]!==C?(M=(0,Q.jsxs)(`div`,{className:b,children:[S,C,A]}),t[53]=A,t[54]=b,t[55]=S,t[56]=C,t[57]=M):M=t[57]",
437
- "thread header accessory mount anchor",
438
- );
439
452
  return patched;
440
453
  }
441
454
 
@@ -444,57 +457,91 @@ function patchThreadPageHeader(text) {
444
457
  patched = replaceOnce(
445
458
  patched,
446
459
  "function c(e){let t=(0,o.c)(21),",
447
- `${codexPlusThreadHeaderHelpers}function c(e){let t=(0,o.c)(24),`,
460
+ `${threadHeaderHook()}function c(e){let t=(0,o.c)(21),`,
448
461
  "thread page header helper insertion anchor",
449
462
  );
450
463
  patched = replaceOnce(
451
464
  patched,
452
- "let t=(0,o.c)(24),{start:c,startActions:l,env:u,secondary:d,trailing:f,hostConfig:p}=e,m;",
453
- "let t=(0,o.c)(24),{start:c,startActions:l,env:u,secondary:d,trailing:f,hostConfig:p,cwd:CPX_headerCwd}=e,CPX_headerContext={cwd:CPX_headerCwd,hostId:p?.id??null,header:{env:u,hostDisplayName:p?.display_name??null,startText:typeof c==`string`?c:null,secondaryText:typeof d==`string`?d:null,hasTrailing:f!=null}},CPX_headerAccessories=CPXThreadHeaderAccessories({context:CPX_headerContext,deps:{jsx:s.jsx,jsxs:s.jsxs}}),m;",
465
+ "let t=(0,o.c)(21),{start:c,startActions:l,env:u,secondary:d,trailing:f,hostConfig:p}=e,m;",
466
+ "let t=(0,o.c)(21),{start:c,startActions:l,env:u,secondary:d,trailing:f,hostConfig:p,cwd:CPX_headerCwd}=e,CPX_headerContext={cwd:CPX_headerCwd,hostId:p?.id??null,header:{env:u,hostDisplayName:p?.display_name??null,startText:typeof c==`string`?c:null,secondaryText:typeof d==`string`?d:null,hasTrailing:f!=null}},CPX_headerAccessories=CPXThreadHeaderAccessories({context:CPX_headerContext,deps:{jsx:s.jsx,jsxs:s.jsxs}}),m;",
454
467
  "thread page header accessory render anchor",
455
468
  );
456
469
  patched = replaceOnce(
457
470
  patched,
458
471
  "t[8]!==l||t[9]!==v||t[10]!==y||t[11]!==b?(x=(0,s.jsxs)(`div`,{className:`text-md flex min-w-0 items-center gap-2 truncate text-base electron:font-medium`,children:[v,y,b,l]}),t[8]=l,t[9]=v,t[10]=y,t[11]=b,t[12]=x):x=t[12]",
459
- "t[8]!==l||t[9]!==v||t[10]!==y||t[11]!==b||t[21]!==CPX_headerAccessories?(x=(0,s.jsxs)(`div`,{className:`text-md flex min-w-0 items-center gap-2 truncate text-base electron:font-medium`,children:[v,y,b,CPX_headerAccessories,l]}),t[8]=l,t[9]=v,t[10]=y,t[11]=b,t[21]=CPX_headerAccessories,t[12]=x):x=t[12]",
472
+ "t[8]!==l||t[9]!==v||t[10]!==y||t[11]!==b?(x=(0,s.jsxs)(`div`,{className:`text-md flex min-w-0 items-center gap-2 truncate text-base electron:font-medium`,children:[v,y,b,CPX_headerAccessories,l]}),t[8]=l,t[9]=v,t[10]=y,t[11]=b,t[12]=x):x=t[12]",
460
473
  "thread page header accessory mount anchor",
461
474
  );
462
475
  return patched;
463
476
  }
464
477
 
465
478
  function patchLocalConversationPageHeader(text) {
479
+ if (text.includes("function mi(e){let t=(0,U.c)(32),")) {
480
+ let patched = replaceOnce(
481
+ text,
482
+ "function mi(e){let t=(0,U.c)(32),",
483
+ `${threadHeaderHook()}function mi(e){let t=(0,U.c)(32),`,
484
+ "local conversation header helper insertion anchor",
485
+ );
486
+ patched = replaceOnce(
487
+ patched,
488
+ "let t=(0,U.c)(32),{conversationId:n,getConversationMarkdown:r,markdownParentConversationId:i,projectIcon:a,projectHoverCardContent:s,projectName:c,title:l,titleSuffix:u,cwd:d,canPin:f,hideForkActions:p}=e,g=f===void 0?!0:f,_=N(),v=h(),y;",
489
+ "let t=(0,U.c)(32),{conversationId:n,getConversationMarkdown:r,markdownParentConversationId:i,projectIcon:a,projectHoverCardContent:s,projectName:c,title:l,titleSuffix:u,cwd:d,canPin:f,hideForkActions:p}=e,CPX_headerContext={cwd:d,hostId:null,header:{surface:`local-conversation`,titleText:typeof l==`string`?l:null,projectName:c??null}},CPX_headerAccessories=CPXThreadHeaderAccessories({context:CPX_headerContext,deps:{jsx:W.jsx,jsxs:W.jsxs,Tooltip:wt}}),g=f===void 0?!0:f,_=N(),v=h(),y;",
490
+ "local conversation header accessory render anchor",
491
+ );
492
+ patched = replaceOnce(
493
+ patched,
494
+ "let O;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(O=null,t[26]=O):O=t[26];",
495
+ "let O=CPX_headerAccessories;",
496
+ "local conversation header accessory slot anchor",
497
+ );
498
+ return replaceOnce(
499
+ patched,
500
+ "let k;return t[27]!==C||t[28]!==T||t[29]!==E||t[30]!==D?(k=(0,W.jsx)(`div`,{className:`draggable grid w-full min-w-0 grid-cols-[minmax(0,1fr)] items-center gap-x-4 electron:h-toolbar extension:py-row-y`,children:(0,W.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 truncate text-base electron:font-medium`,children:[C,T,E,D,O]})}),t[27]=C,t[28]=T,t[29]=E,t[30]=D,t[31]=k):k=t[31],k}",
501
+ "let k;return t[27]!==C||t[28]!==T||t[29]!==E||t[30]!==D?(k=(0,W.jsx)(`div`,{className:`draggable grid w-full min-w-0 grid-cols-[minmax(0,1fr)] items-center gap-x-4 electron:h-toolbar extension:py-row-y`,children:(0,W.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 truncate text-base electron:font-medium`,children:[C,T,E,D,O]})}),t[27]=C,t[28]=T,t[29]=E,t[30]=D,t[31]=k):k=t[31],k}",
502
+ "local conversation header accessory mount anchor",
503
+ );
504
+ }
466
505
  let patched = replaceOnce(
467
506
  text,
468
507
  "function Tt(e){let t=(0,Y.c)(42),",
469
- `${codexPlusThreadHeaderHelpers}function Tt(e){let t=(0,Y.c)(45),`,
508
+ `${threadHeaderHook()}function Tt(e){let t=(0,Y.c)(42),`,
470
509
  "local conversation header helper insertion anchor",
471
510
  );
472
511
  patched = replaceOnce(
473
512
  patched,
474
- "let t=(0,Y.c)(45),{conversationId:n,getConversationMarkdown:r,markdownParentConversationId:a,title:o,titleSuffix:s,cwd:c,canPin:l,hideProjectMetadata:d,hideForkActions:f}=e,p=l===void 0?!0:l,m=d===void 0?!1:d,h=A(),g;",
475
- "let t=(0,Y.c)(45),{conversationId:n,getConversationMarkdown:r,markdownParentConversationId:a,title:o,titleSuffix:s,cwd:c,canPin:l,hideProjectMetadata:d,hideForkActions:f}=e,CPX_headerContext={cwd:c,hostId:u(i(O,n)).id,header:{surface:`local-conversation`,titleText:typeof o==`string`?o:null}},CPX_headerAccessories=CPXThreadHeaderAccessories({context:CPX_headerContext,deps:{jsx:Z.jsx,jsxs:Z.jsxs}}),p=l===void 0?!0:l,m=d===void 0?!1:d,h=A(),g;",
513
+ "let t=(0,Y.c)(42),{conversationId:n,getConversationMarkdown:r,markdownParentConversationId:a,title:o,titleSuffix:s,cwd:c,canPin:l,hideProjectMetadata:d,hideForkActions:f}=e,p=l===void 0?!0:l,m=d===void 0?!1:d,h=A(),g;",
514
+ "let t=(0,Y.c)(42),{conversationId:n,getConversationMarkdown:r,markdownParentConversationId:a,title:o,titleSuffix:s,cwd:c,canPin:l,hideProjectMetadata:d,hideForkActions:f}=e,CPX_headerContext={cwd:c,hostId:u(i(O,n)).id,header:{surface:`local-conversation`,titleText:typeof o==`string`?o:null}},CPX_headerAccessories=CPXThreadHeaderAccessories({context:CPX_headerContext,deps:{jsx:Z.jsx,jsxs:Z.jsxs}}),p=l===void 0?!0:l,m=d===void 0?!1:d,h=A(),g;",
476
515
  "local conversation header accessory render anchor",
477
516
  );
478
517
  patched = replaceOnce(
479
518
  patched,
480
519
  "t[38]!==F||t[39]!==I||t[40]!==L?(z=(0,Z.jsx)(`div`,{className:`draggable grid w-full min-w-0 grid-cols-[minmax(0,1fr)] items-center gap-x-4 electron:h-toolbar extension:py-row-y`,children:(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 truncate text-base electron:font-medium`,children:[F,I,L,R]})}),t[38]=F,t[39]=I,t[40]=L,t[41]=z):z=t[41]",
481
- "t[38]!==F||t[39]!==I||t[40]!==L||t[42]!==CPX_headerAccessories?(z=(0,Z.jsx)(`div`,{className:`draggable grid w-full min-w-0 grid-cols-[minmax(0,1fr)] items-center gap-x-4 electron:h-toolbar extension:py-row-y`,children:(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 truncate text-base electron:font-medium`,children:[F,I,L,CPX_headerAccessories,R]})}),t[38]=F,t[39]=I,t[40]=L,t[42]=CPX_headerAccessories,t[41]=z):z=t[41]",
520
+ "t[38]!==F||t[39]!==I||t[40]!==L?(z=(0,Z.jsx)(`div`,{className:`draggable grid w-full min-w-0 grid-cols-[minmax(0,1fr)] items-center gap-x-4 electron:h-toolbar extension:py-row-y`,children:(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 truncate text-base electron:font-medium`,children:[F,I,L,CPX_headerAccessories,R]})}),t[38]=F,t[39]=I,t[40]=L,t[41]=z):z=t[41]",
482
521
  "local conversation header accessory mount anchor",
483
522
  );
484
523
  return patched;
485
524
  }
486
525
 
487
- const codexPlusProjectColorHelpers = `
488
- function CPXHostProjectRowProps(e){return window.CodexPlus?.ui?.sidebar?.projectRowProps?.({project:e})}function CPXHostThreadRowProps(e){return window.CodexPlus?.ui?.sidebar?.threadRowProps?.({project:e})}function CPXHostUserBubbleProps(e){return window.CodexPlus?.ui?.message?.userBubbleProps?.(e)}function CPXHostComposerSurfaceProps(e){return window.CodexPlus?.ui?.composer?.surfaceProps?.(e)}`;
489
-
490
- const codexPlusAppearanceSettingsHelpers = `
491
- function CPXAppearanceRows(e){return window.CodexPlus?.ui?.settings?.appearance?.renderRows?.({deps:{React:X,jsx:Z.jsx,SettingRow:J,ColorInput:sn,Switch:q},variant:e})??[]}`;
492
-
493
526
  function patchGeneralSettingsUserBubbleColors(text) {
527
+ if (text.includes("function Lr({showCodeFont:e,showTranslucentSidebarToggle:t,variant:n}){")) {
528
+ let patched = replaceOnce(
529
+ text,
530
+ "function Lr({showCodeFont:e,showTranslucentSidebarToggle:t,variant:n}){",
531
+ `${appearanceSettingsHook("{React:ti,jsx:J.jsx,SettingRow:L,ColorInput:Hr,Switch:Ze}")}function Lr({showCodeFont:e,showTranslucentSidebarToggle:t,variant:n}){`,
532
+ "user bubble settings helper insertion anchor",
533
+ );
534
+ return replaceOnce(
535
+ patched,
536
+ "children:[T.map(e=>(0,J.jsx)(L,{control:(0,J.jsx)(Hr,{ariaLabel:e.ariaLabel,value:y[e.role],onChange:t=>{k(e.role,t)}}),label:e.label,variant:`nested`},e.role)),E.map",
537
+ "children:[T.map(e=>(0,J.jsx)(L,{control:(0,J.jsx)(Hr,{ariaLabel:e.ariaLabel,value:y[e.role],onChange:t=>{k(e.role,t)}}),label:e.label,variant:`nested`},e.role)),...CPXAppearanceRows(n),E.map",
538
+ "user bubble settings row anchor",
539
+ );
540
+ }
494
541
  let patched = replaceOnce(
495
542
  text,
496
543
  "function tn({showCodeFont:e,showTranslucentSidebarToggle:t,variant:n}){",
497
- `${codexPlusAppearanceSettingsHelpers}function tn({showCodeFont:e,showTranslucentSidebarToggle:t,variant:n}){`,
544
+ `${appearanceSettingsHook()}function tn({showCodeFont:e,showTranslucentSidebarToggle:t,variant:n}){`,
498
545
  "user bubble settings helper insertion anchor",
499
546
  );
500
547
  return replaceOnce(
@@ -505,20 +552,37 @@ function patchGeneralSettingsUserBubbleColors(text) {
505
552
  );
506
553
  }
507
554
 
508
- const codexPlusUserBubbleHelpers = `
509
- ${codexPlusProjectColorHelpers}function CPX_installHostSurfaceProps(){}CPX_installHostSurfaceProps();`;
510
-
511
555
  function patchUserMessageAttachmentsBubbleColors(text) {
556
+ if (text.includes("function qVn({cwd:e,hostId:t,initialMessage:n,onCancel:r,onDraftChange:i,onSubmit:a}){")) {
557
+ let patched = replaceOnce(
558
+ text,
559
+ "function qVn({cwd:e,hostId:t,initialMessage:n,onCancel:r,onDraftChange:i,onSubmit:a}){",
560
+ `${messageComposerHook()}function qVn({cwd:e,hostId:t,initialMessage:n,onCancel:r,onDraftChange:i,onSubmit:a}){`,
561
+ "user bubble helper insertion anchor",
562
+ );
563
+ patched = replaceOnce(
564
+ patched,
565
+ "return(0,b1.jsx)(`form`,{className:`relative flex w-full flex-col rounded-3xl bg-token-foreground/5`,onSubmit:e=>{e.preventDefault(),v()},children:",
566
+ "return(0,b1.jsx)(`form`,{\"data-codex-plus-user-entry\":!0,className:`relative flex w-full flex-col rounded-3xl bg-token-foreground/5`,onSubmit:e=>{e.preventDefault(),v()},children:",
567
+ "edit user message entry marker anchor",
568
+ );
569
+ return replaceOnce(
570
+ patched,
571
+ "me=B?(0,S1.jsx)(`div`,{className:`w-full p-px`,children:(0,S1.jsx)(qVn,{cwd:x??null,hostId:S,initialMessage:z.trim(),onCancel:()=>{ie(null)},onDraftChange:e=>{ie(e)},onSubmit:oe})}):G?(0,S1.jsx)(`div`,{\"data-user-message-bubble\":!0,role:I?`button`:void 0,tabIndex:0,className:Y(e,`text-left focus-visible:ring-2 focus-visible:ring-token-focus-border focus-visible:outline-none`,I&&`cursor-interaction`),",
572
+ "me=B?(0,S1.jsx)(`div`,{className:`w-full p-px`,children:(0,S1.jsx)(qVn,{cwd:x??null,hostId:S,initialMessage:z.trim(),onCancel:()=>{ie(null)},onDraftChange:e=>{ie(e)},onSubmit:oe})}):G?(0,S1.jsx)(`div`,{\"data-user-message-bubble\":!0,...CPXBubbleProps({}),role:I?`button`:void 0,tabIndex:0,className:Y(e,`text-left focus-visible:ring-2 focus-visible:ring-token-focus-border focus-visible:outline-none`,I&&`cursor-interaction`),",
573
+ "user bubble marker attribute anchor",
574
+ );
575
+ }
512
576
  let patched = replaceOnce(
513
577
  text,
514
578
  "var Z=i(),Q=e(n(),1),$=r();function Ue(e){",
515
- `var Z=i(),Q=e(n(),1),$=r();${codexPlusUserBubbleHelpers}function Ue(e){`,
579
+ `var Z=i(),Q=e(n(),1),$=r();${messageComposerHook()}function Ue(e){`,
516
580
  "user bubble helper insertion anchor",
517
581
  );
518
582
  patched = replaceOnce(
519
583
  patched,
520
584
  "Se=W?(0,$.jsx)(`div`,{className:`w-full p-px`,children:(0,$.jsx)(it,{cwd:T??null,hostId:k,initialMessage:U.trim(),onCancel:()=>{q(null)},onDraftChange:e=>{q(e)},onSubmit:ge})}):le?(0,$.jsx)(`div`,{\"data-user-message-bubble\":!0,role:H?`button`:void 0,tabIndex:0,className:D(e,`text-left focus-visible:ring-2 focus-visible:ring-token-focus-border focus-visible:outline-none`,H&&`cursor-interaction`),",
521
- "Se=W?(0,$.jsx)(`div`,{className:`w-full p-px`,children:(0,$.jsx)(it,{cwd:T??null,hostId:k,initialMessage:U.trim(),onCancel:()=>{q(null)},onDraftChange:e=>{q(e)},onSubmit:ge})}):le?(0,$.jsx)(`div`,{\"data-user-message-bubble\":!0,...CPXHostUserBubbleProps({}),role:H?`button`:void 0,tabIndex:0,className:D(e,`text-left focus-visible:ring-2 focus-visible:ring-token-focus-border focus-visible:outline-none`,H&&`cursor-interaction`),",
585
+ "Se=W?(0,$.jsx)(`div`,{className:`w-full p-px`,children:(0,$.jsx)(it,{cwd:T??null,hostId:k,initialMessage:U.trim(),onCancel:()=>{q(null)},onDraftChange:e=>{q(e)},onSubmit:ge})}):le?(0,$.jsx)(`div`,{\"data-user-message-bubble\":!0,...CPXBubbleProps({}),role:H?`button`:void 0,tabIndex:0,className:D(e,`text-left focus-visible:ring-2 focus-visible:ring-token-focus-border focus-visible:outline-none`,H&&`cursor-interaction`),",
522
586
  "user bubble marker attribute anchor",
523
587
  );
524
588
  return replaceOnce(
@@ -530,6 +594,14 @@ function patchUserMessageAttachmentsBubbleColors(text) {
530
594
  }
531
595
 
532
596
  function patchUserMessageAttachmentsProjectColors(text) {
597
+ if (text.includes("\"data-user-message-bubble\":!0,...CPXBubbleProps({}),role:I?`button`:void 0,")) {
598
+ return replaceOnce(
599
+ text,
600
+ "\"data-user-message-bubble\":!0,...CPXBubbleProps({}),role:I?`button`:void 0,",
601
+ "\"data-user-message-bubble\":!0,...CPXBubbleProps({project:{cwd:x,hostId:S}}),role:I?`button`:void 0,",
602
+ "user bubble project marker attribute anchor",
603
+ );
604
+ }
533
605
  let patched = replaceOnce(
534
606
  text,
535
607
  `import{Aa as x,Ta as S}from"./${srcFile}";`,
@@ -544,35 +616,70 @@ function patchUserMessageAttachmentsProjectColors(text) {
544
616
  );
545
617
  return replaceOnce(
546
618
  patched,
547
- "\"data-user-message-bubble\":!0,...CPXHostUserBubbleProps({}),role:H?`button`:void 0,",
548
- "\"data-user-message-bubble\":!0,...CPXHostUserBubbleProps({project:CPX_userMessageProjectId}),role:H?`button`:void 0,",
619
+ "\"data-user-message-bubble\":!0,...CPXBubbleProps({}),role:H?`button`:void 0,",
620
+ "\"data-user-message-bubble\":!0,...CPXBubbleProps({project:CPX_userMessageProjectId}),role:H?`button`:void 0,",
549
621
  "user bubble project marker attribute anchor",
550
622
  );
551
623
  }
552
624
 
553
625
  function patchComposerBubbleColors(text) {
626
+ if (text.includes("function Wbe(e){let t=(0,gW.c)(13),")) {
627
+ let patched = replaceOnce(
628
+ text,
629
+ "function Wbe(e){let t=(0,gW.c)(13),",
630
+ `${messageComposerHook()}function Wbe(e){let t=(0,gW.c)(13),`,
631
+ "composer user bubble helper insertion anchor",
632
+ );
633
+ patched = replaceOnce(
634
+ patched,
635
+ "function Wbe(e){let t=(0,gW.c)(13),{children:n,className:r,externalFooterVariant:i,inert:a,isDragActive:o,layout:s,onDragEnter:c,onDragLeave:l,onDragOver:u,onDrop:d}=e,",
636
+ "function Wbe(e){let t=(0,gW.c)(13),{children:n,className:r,externalFooterVariant:i,inert:a,isDragActive:o,layout:s,onDragEnter:c,onDragLeave:l,onDragOver:u,onDrop:d,codexPlusProps:CPX_surfaceProps}=e,CPX_resolvedSurfaceProps=CPX_surfaceProps??CPXSurfaceProps({}),",
637
+ "composer host surface props anchor",
638
+ );
639
+ return replaceOnce(
640
+ patched,
641
+ "return t[5]!==n||t[6]!==a||t[7]!==c||t[8]!==l||t[9]!==u||t[10]!==d||t[11]!==v?(y=(0,_W.jsx)(Su.div,{inert:a,className:v,onDragEnter:c,onDragOver:u,onDragLeave:l,onDrop:d,children:n}),t[5]=n,t[6]=a,t[7]=c,t[8]=l,t[9]=u,t[10]=d,t[11]=v,t[12]=y):y=t[12],y}",
642
+ "return t[5]!==n||t[6]!==a||t[7]!==c||t[8]!==l||t[9]!==u||t[10]!==d||t[11]!==v?(y=(0,_W.jsx)(Su.div,{inert:a,...CPX_resolvedSurfaceProps,className:v,onDragEnter:c,onDragOver:u,onDragLeave:l,onDrop:d,children:n}),t[5]=n,t[6]=a,t[7]=c,t[8]=l,t[9]=u,t[10]=d,t[11]=v,t[12]=y):y=t[12],y}",
643
+ "composer user entry marker render anchor",
644
+ );
645
+ }
554
646
  let patched = replaceOnce(
555
647
  text,
556
648
  "function oh(e){let t=(0,$.c)(13),",
557
- `${codexPlusUserBubbleHelpers}function oh(e){let t=(0,$.c)(14),`,
649
+ `${messageComposerHook()}function oh(e){let t=(0,$.c)(13),`,
558
650
  "composer user bubble helper insertion anchor",
559
651
  );
560
652
  patched = replaceOnce(
561
653
  patched,
562
- "function oh(e){let t=(0,$.c)(14),{children:n,className:r,externalFooterVariant:i,inert:a,isDragActive:o,layout:s,onDragEnter:c,onDragLeave:l,onDragOver:u,onDrop:d}=e,",
563
- "function oh(e){let t=(0,$.c)(14),{children:n,className:r,externalFooterVariant:i,inert:a,isDragActive:o,layout:s,onDragEnter:c,onDragLeave:l,onDragOver:u,onDrop:d,codexPlusProps:CPX_hostSurfaceProps}=e,CPX_surfaceProps=CPX_hostSurfaceProps??CPXHostComposerSurfaceProps({}),",
654
+ "function oh(e){let t=(0,$.c)(13),{children:n,className:r,externalFooterVariant:i,inert:a,isDragActive:o,layout:s,onDragEnter:c,onDragLeave:l,onDragOver:u,onDrop:d}=e,",
655
+ "function oh(e){let t=(0,$.c)(13),{children:n,className:r,externalFooterVariant:i,inert:a,isDragActive:o,layout:s,onDragEnter:c,onDragLeave:l,onDragOver:u,onDrop:d,codexPlusProps:CPX_surfaceProps}=e,CPX_resolvedSurfaceProps=CPX_surfaceProps??CPXSurfaceProps({}),",
564
656
  "composer host surface props anchor",
565
657
  );
566
658
  patched = replaceOnce(
567
659
  patched,
568
660
  "return t[5]!==n||t[6]!==a||t[7]!==c||t[8]!==l||t[9]!==u||t[10]!==d||t[11]!==v?(y=(0,Q.jsx)(Jt.div,{inert:a,className:v,onDragEnter:c,onDragOver:u,onDragLeave:l,onDrop:d,children:n}),t[5]=n,t[6]=a,t[7]=c,t[8]=l,t[9]=u,t[10]=d,t[11]=v,t[12]=y):y=t[12],y}",
569
- "return t[5]!==n||t[6]!==a||t[7]!==c||t[8]!==l||t[9]!==u||t[10]!==d||t[11]!==v||t[12]!==CPX_surfaceProps?(y=(0,Q.jsx)(Jt.div,{inert:a,...CPX_surfaceProps,className:v,onDragEnter:c,onDragOver:u,onDragLeave:l,onDrop:d,children:n}),t[5]=n,t[6]=a,t[7]=c,t[8]=l,t[9]=u,t[10]=d,t[11]=v,t[12]=CPX_surfaceProps,t[13]=y):y=t[13],y}",
661
+ "return t[5]!==n||t[6]!==a||t[7]!==c||t[8]!==l||t[9]!==u||t[10]!==d||t[11]!==v?(y=(0,Q.jsx)(Jt.div,{inert:a,...CPX_resolvedSurfaceProps,className:v,onDragEnter:c,onDragOver:u,onDragLeave:l,onDrop:d,children:n}),t[5]=n,t[6]=a,t[7]=c,t[8]=l,t[9]=u,t[10]=d,t[11]=v,t[12]=y):y=t[12],y}",
570
662
  "composer user entry marker render anchor",
571
663
  );
572
664
  return patched;
573
665
  }
574
666
 
575
667
  function patchComposerProjectColors(text) {
668
+ if (text.includes("function Wbe(e){let t=(0,gW.c)(13),") && text.includes("CPX_resolvedSurfaceProps=CPX_surfaceProps??CPXSurfaceProps({})")) {
669
+ let patched = text;
670
+ patched = replaceOnce(
671
+ patched,
672
+ anchors.composerProjectStyleCaller,
673
+ anchors.composerProjectStyleCaller.replace(";return", ",CPX_composerSurfaceProps=CPXSurfaceProps({project:{cwd:ln??an,hostId:$n}});return"),
674
+ "composer project style hook-safe caller anchor",
675
+ );
676
+ return replaceOnce(
677
+ patched,
678
+ "(0,PY.jsx)(sEe,{className:w,externalFooterVariant:C,hasDropTargetPortal:As,",
679
+ "(0,PY.jsx)(sEe,{key:CPX_composerSurfaceProps?.[`data-codex-plus-project-color`]??``,className:w,externalFooterVariant:C,codexPlusProps:CPX_composerSurfaceProps,hasDropTargetPortal:As,",
680
+ "composer project accent style caller anchor",
681
+ );
682
+ }
576
683
  let patched = replaceOnce(
577
684
  text,
578
685
  anchors.composerProjectImports,
@@ -582,13 +689,13 @@ function patchComposerProjectColors(text) {
582
689
  patched = replaceOnce(
583
690
  patched,
584
691
  anchors.composerProjectStyleCaller,
585
- anchors.composerProjectStyleCaller.replace(";return", ",CPX_composerThreadProjectId=a(CPX_threadProjectId,G==null?null:CPX_localThreadKey(G)),CPX_composerSurfaceProps=CPXHostComposerSurfaceProps({project:G==null?On?{hostId:On.hostId,path:On.remotePath,projectId:kn,label:On.label??On.name}:x??void 0:CPX_composerThreadProjectId});return"),
692
+ anchors.composerProjectStyleCaller.replace(";return", ",CPX_composerThreadProjectId=a(CPX_threadProjectId,G==null?null:CPX_localThreadKey(G)),CPX_composerSurfaceProps=CPXSurfaceProps({project:G==null?On?{hostId:On.hostId,path:On.remotePath,projectId:kn,label:On.label??On.name}:x??void 0:CPX_composerThreadProjectId});return"),
586
693
  "composer project style hook-safe caller anchor",
587
694
  );
588
695
  return replaceOnce(
589
696
  patched,
590
697
  anchors.composerProjectAccentCaller,
591
- anchors.composerProjectAccentCaller.replace(",onDragEnter:", ",codexPlusProps:!Ge&&!Hn?CPX_composerSurfaceProps:void 0,onDragEnter:"),
698
+ anchors.composerProjectAccentCaller.replace(",onDragEnter:", ",key:CPX_composerSurfaceProps?.[`data-codex-plus-project-color`]??``,codexPlusProps:!Ge&&!Hn?CPX_composerSurfaceProps:void 0,onDragEnter:"),
592
699
  "composer project accent style caller anchor",
593
700
  );
594
701
  }
@@ -597,12 +704,20 @@ function patchElectronMenuShortcuts(text) {
597
704
  return replaceOnce(
598
705
  text,
599
706
  "{id:`toggleSidebar`,titleIntlId:`codex.command.toggleSidebar`,descriptionIntlId:`codex.commandDescription.toggleSidebar`,commandMenuGroupKey:`panels`,commandMenu:!0,electron:{menuTitle:`Toggle Sidebar`,menuTitleIntlId:`codex.commandMenuTitle.toggleSidebar`,defaultKeybindings:[{key:`CmdOrCtrl+B`}]}},{id:`toggleBottomPanel`,",
600
- "{id:`toggleSidebar`,titleIntlId:`codex.command.toggleSidebar`,descriptionIntlId:`codex.commandDescription.toggleSidebar`,commandMenuGroupKey:`panels`,commandMenu:!0,electron:{menuTitle:`Toggle Sidebar`,menuTitleIntlId:`codex.commandMenuTitle.toggleSidebar`,defaultKeybindings:[{key:`CmdOrCtrl+B`}]}},{id:`codexPlus.focusProjectSelector`,title:`Focus project selector`,description:`Focus or open the new chat project selector`,commandMenuGroupKey:`workspace`,commandMenu:!0,electron:{menuTitle:`Focus project selector`,defaultKeybindings:[{key:`CmdOrCtrl+.`}]}},...(window.CodexPlus?.ui?.commands?.commandMetadata?.()?.filter?.(e=>e.id!==`codexPlus.focusProjectSelector`)??[]),{id:`toggleBottomPanel`,",
707
+ "{id:`toggleSidebar`,titleIntlId:`codex.command.toggleSidebar`,descriptionIntlId:`codex.commandDescription.toggleSidebar`,commandMenuGroupKey:`panels`,commandMenu:!0,electron:{menuTitle:`Toggle Sidebar`,menuTitleIntlId:`codex.commandMenuTitle.toggleSidebar`,defaultKeybindings:[{key:`CmdOrCtrl+B`}]}},{id:`codexPlus.focusProjectSelector`,title:`Focus project selector`,description:`Focus or open the new chat project selector`,commandMenuGroupKey:`workspace`,commandMenu:!0,electron:{menuTitle:`Focus project selector`,defaultKeybindings:[{key:`CmdOrCtrl+.`}]}},{id:`codexPlusToggleSidebarNameBlur`,title:`Toggle sidebar blur`,description:`Blur or show sidebar chat and project names`,commandMenuGroupKey:`panels`,commandMenu:!0,electron:{menuTitle:`Toggle sidebar blur`,defaultKeybindings:[]}},...(globalThis.CodexPlus?.ui?.commands?.commandMetadata?.()?.filter?.(e=>e.id!==`codexPlus.focusProjectSelector`&&e.id!==`codexPlusToggleSidebarNameBlur`)??[]),{id:`toggleBottomPanel`,",
601
708
  "sidebar blur command palette metadata anchor",
602
709
  );
603
710
  }
604
711
 
605
712
  function patchKeyboardShortcutsSearchInput(text) {
713
+ if (text.includes("function Kke(e,t){return`titleIntlId`in e?")) {
714
+ return replaceOnce(
715
+ text,
716
+ "function Kke(e,t){return`titleIntlId`in e?S0(C0,e.titleIntlId)?t.formatMessage(C0[e.titleIntlId]):``:t.formatMessage(w0[e.electron.menuTitleIntlId])}",
717
+ "function Kke(e,t){return`titleIntlId`in e?S0(C0,e.titleIntlId)?t.formatMessage(C0[e.titleIntlId]):``:e.title??e.electron?.menuTitle??t.formatMessage(w0[e.electron.menuTitleIntlId])}",
718
+ "generic command metadata title fallback anchor",
719
+ );
720
+ }
606
721
  return replaceOnce(
607
722
  text,
608
723
  "function d(e,t){return`titleIntlId`in e?t.formatMessage(c[e.titleIntlId]):t.formatMessage(l[e.electron.menuTitleIntlId])}",
@@ -611,44 +726,65 @@ function patchKeyboardShortcutsSearchInput(text) {
611
726
  );
612
727
  }
613
728
 
729
+ function patchCommandMenuRuntimeCommands(text) {
730
+ return replaceOnce(
731
+ text,
732
+ "let M=j,N;t[11]===o?N=t[12]:",
733
+ "let M=[...j,...(globalThis.CodexPlus?.ui?.commands?.commandMetadata?.()?.filter?.(e=>!j.some(t=>t.id===e.id))??[])],N;t[11]===o?N=t[12]:",
734
+ "command menu runtime command metadata anchor",
735
+ );
736
+ }
737
+
614
738
  function patchLocalTaskRow(text) {
739
+ if (text.includes("function _p(e){let t=(0,yp.c)(134),")) {
740
+ let patched = replaceOnce(
741
+ text,
742
+ "function _p(e){let t=(0,yp.c)(134),",
743
+ `${projectColorHook()}function _p(e){let t=(0,yp.c)(134),`,
744
+ "local task row project color helper insertion anchor",
745
+ );
746
+ patched = replaceOnce(
747
+ patched,
748
+ "threadSummary:le,dataAttributes:ue}=e,de=c===void 0?!1:c,",
749
+ "threadSummary:le,dataAttributes:ue=CPXPR({projectId:oe,label:se,path:r,cwd:r,hostId:R?.id})}=e,de=c===void 0?!1:c,",
750
+ "local task row project assignment anchor",
751
+ );
752
+ return patched;
753
+ }
615
754
  let patched = replaceOnce(
616
755
  text,
617
756
  "function fn(e){let t=(0,K.c)(124),",
618
- `${codexPlusProjectColorHelpers}function fn(e){let t=(0,K.c)(124),`,
757
+ `${projectColorHook()}function fn(e){let t=(0,K.c)(124),`,
619
758
  "local task row project color helper insertion anchor",
620
759
  );
621
760
  patched = replaceOnce(
622
761
  patched,
623
762
  "threadSummary:Ne,dataAttributes:Fe}=e,Ie=g===void 0?!1:g,",
624
- "threadSummary:Ne,dataAttributes:Fe}=e,CPX_rowDataAttributes=Fe??CPXHostProjectRowProps(Oe),Ie=g===void 0?!1:g,",
763
+ "threadSummary:Ne,dataAttributes:Fe=CPXPR(Oe)}=e,Ie=g===void 0?!1:g,",
625
764
  "local task row project assignment anchor",
626
765
  );
627
- patched = replaceOnce(
628
- patched,
629
- "t[87]!==Fe",
630
- "t[87]!==CPX_rowDataAttributes",
631
- "local task row memo dependency anchor",
632
- );
633
- patched = replaceOnce(
634
- patched,
635
- "dataAttributes:Fe,archiveAriaLabel:hn",
636
- "dataAttributes:CPX_rowDataAttributes,archiveAriaLabel:hn",
637
- "local task row data attributes anchor",
638
- );
639
- return replaceOnce(
640
- patched,
641
- "t[87]=Fe",
642
- "t[87]=CPX_rowDataAttributes",
643
- "local task row memo assignment anchor",
644
- );
766
+ return patched;
645
767
  }
646
768
 
647
769
  function patchMermaidDiagramShell(text) {
770
+ if (text.includes("function or({blockRef:e,code:t,isCodeFenceOpen:n,isDark:r,isVisible:i,onError:a,onRendered:o,renderKey:s}){")) {
771
+ let patched = replaceOnce(
772
+ text,
773
+ "function or({blockRef:e,code:t,isCodeFenceOpen:n,isDark:r,isVisible:i,onError:a,onRendered:o,renderKey:s}){",
774
+ `${mermaidDiagramHook()}function or({blockRef:e,code:t,isCodeFenceOpen:n,isDark:r,isVisible:i,onError:a,onRendered:o,renderKey:s}){`,
775
+ "mermaid diagram shell helper insertion anchor",
776
+ );
777
+ return replaceOnce(
778
+ patched,
779
+ "(0,X.jsx)(`div`,{ref:u,className:re(vr,!i&&`invisible`,m?`max-h-[var(--markdown-wide-block-max-height)] overflow-auto`:`overflow-x-auto`),\"aria-hidden\":!i||void 0,",
780
+ "(0,X.jsx)(`div`,{ref:u,...CPXMermaidDiagramProps({code:t}),className:re(vr,!i&&`invisible`,m?`max-h-[var(--markdown-wide-block-max-height)] overflow-auto`:`overflow-x-auto`),\"aria-hidden\":!i||void 0,",
781
+ "mermaid diagram shell host props anchor",
782
+ );
783
+ }
648
784
  let patched = replaceOnce(
649
785
  text,
650
786
  "function d(e){let t=(0,s.c)(18),{Renderer:n,className:r,code:i,fallback:d,isCodeFenceOpen:f,wideBlockKind:p}=e,",
651
- `${codexPlusMermaidHelpers}function d(e){let t=(0,s.c)(18),{Renderer:n,className:r,code:i,fallback:d,isCodeFenceOpen:f,wideBlockKind:p}=e,`,
787
+ `${mermaidDiagramHook()}function d(e){let t=(0,s.c)(18),{Renderer:n,className:r,code:i,fallback:d,isCodeFenceOpen:f,wideBlockKind:p}=e,`,
652
788
  "mermaid diagram shell helper insertion anchor",
653
789
  );
654
790
  return replaceOnce(
@@ -669,16 +805,30 @@ function patchPreloadNativeBridge(text) {
669
805
  }
670
806
 
671
807
  function patchMainNativeBridge(text) {
808
+ if (text.includes("function y4(e){let{") && text.includes("G2(l,k),V2(k);let A=!1;")) {
809
+ let patched = replaceOnce(
810
+ text,
811
+ "function y4(e){let{",
812
+ `${nativeMainHook()}function y4(e){let{`,
813
+ "codex plus native main helper insertion anchor",
814
+ );
815
+ return replaceOnce(
816
+ patched,
817
+ "G2(l,k),V2(k);let A=!1;",
818
+ "G2(l,k),V2(k),CPXNative.registerNativeRequest({isTrustedIpcEvent:k});let A=!1;",
819
+ "codex plus native main registration anchor",
820
+ );
821
+ }
672
822
  let patched = replaceOnce(
673
823
  text,
674
824
  "function z1(e){return a.ipcMain.handle(Tl,async(t,n)=>{",
675
- `${codexPlusNativeMainHelpers}function z1(e){return a.ipcMain.handle(Tl,async(t,n)=>{`,
825
+ `${nativeMainHook()}function z1(e){return a.ipcMain.handle(Tl,async(t,n)=>{`,
676
826
  "codex plus native main helper insertion anchor",
677
827
  );
678
828
  return replaceOnce(
679
829
  patched,
680
830
  "v0({buildFlavor:i,getContextForWebContents:N.getContextForWebContents,isTrustedIpcEvent:te,usesOwlAppShell:y}),a.ipcMain.on(kl,",
681
- "v0({buildFlavor:i,getContextForWebContents:N.getContextForWebContents,isTrustedIpcEvent:te,usesOwlAppShell:y}),CPXRegisterNativeRequest({isTrustedIpcEvent:te}),a.ipcMain.on(kl,",
831
+ "v0({buildFlavor:i,getContextForWebContents:N.getContextForWebContents,isTrustedIpcEvent:te,usesOwlAppShell:y}),CPXNative.registerNativeRequest({isTrustedIpcEvent:te}),a.ipcMain.on(kl,",
682
832
  "codex plus native main registration anchor",
683
833
  );
684
834
  }
@@ -693,13 +843,21 @@ function patchMainMenuDiagnostics(text) {
693
843
  patched = replaceOnce(
694
844
  patched,
695
845
  "He,We,{type:`separator`}",
696
- "He,We,...CPXNativeMenuTemplateItems(`view-menu`),{type:`separator`}",
846
+ "He,We,...CPXNative.templateItems(`view-menu`),{type:`separator`}",
697
847
  "codex plus view menu template items anchor",
698
848
  );
849
+ if (patched.includes("fe.refreshApplicationMenu(),w(`application menu refreshed`,A),")) {
850
+ return replaceOnce(
851
+ patched,
852
+ "fe.refreshApplicationMenu(),w(`application menu refreshed`,A),",
853
+ "CPXNative.setRefreshApplicationMenu(()=>fe.refreshApplicationMenu()),fe.refreshApplicationMenu(),CPXNative.logMenuDiagnostics(),w(`application menu refreshed`,A),",
854
+ "codex plus menu diagnostics refresh anchor",
855
+ );
856
+ }
699
857
  return replaceOnce(
700
858
  patched,
701
859
  "me.refreshApplicationMenu(),w(`application menu refreshed`,A),",
702
- "CPXRefreshApplicationMenu=()=>me.refreshApplicationMenu(),me.refreshApplicationMenu(),CPXLogMenuDiagnostics(),w(`application menu refreshed`,A),",
860
+ "CPXNative.setRefreshApplicationMenu(()=>me.refreshApplicationMenu()),me.refreshApplicationMenu(),CPXNative.logMenuDiagnostics(),w(`application menu refreshed`,A),",
703
861
  "codex plus menu diagnostics refresh anchor",
704
862
  );
705
863
  }
@@ -709,7 +867,7 @@ return makePatchSet({
709
867
  codexVersion: config.codexVersion,
710
868
  bundleVersion: config.bundleVersion,
711
869
  asarSha256: config.asarSha256,
712
- assetFiles: codexPlusRuntimeAssets(),
870
+ assetFiles: codexPlusRuntimeAssets(config.runtimeConfig),
713
871
  patches: [
714
872
  {
715
873
  id: "bundle-identity",
@@ -751,7 +909,6 @@ return makePatchSet({
751
909
  id: "project-colors",
752
910
  fileTransforms: [
753
911
  [appMainFile, patchAppMainProjectColors],
754
- [sidebarProjectHoverCardSourceRowsFile, patchSidebarProjectHoverCardSourceRows],
755
912
  [localTaskRowFile, patchLocalTaskRow],
756
913
  [userMessageAttachmentsFile, patchUserMessageAttachmentsProjectColors],
757
914
  [composerFile, patchComposerProjectColors],
@@ -771,15 +928,21 @@ return makePatchSet({
771
928
  [appMainFile, patchAppMainSidebarBlur],
772
929
  [electronMenuShortcutsFile, patchElectronMenuShortcuts],
773
930
  [keyboardShortcutsSearchInputFile, patchKeyboardShortcutsSearchInput],
931
+ [keyboardShortcutsSearchInputFile, patchCommandMenuRuntimeCommands],
774
932
  ],
775
933
  },
776
934
  {
777
935
  id: "project-selector-shortcut",
778
936
  fileTransforms: [
779
937
  [localActiveWorkspaceRootDropdownFile, patchLocalActiveWorkspaceRootDropdownProjectSelectorShortcut],
938
+ ...(homeProjectDropdownFile ? [[homeProjectDropdownFile, patchHomeProjectDropdownProjectSelectorShortcut]] : []),
780
939
  [runCommandFile, patchRunCommandProjectSelectorShortcut],
781
940
  ],
782
941
  },
942
+ ...(statsigStartupFile ? [{
943
+ id: "dev-mode-statsig-fallback",
944
+ fileTransforms: [[statsigStartupFile, patchDevModeStatsigFallback]],
945
+ }] : []),
783
946
  ...(mainFile ? [{
784
947
  id: "codex-plus-native-bridge",
785
948
  fileTransforms: [