codex-overleaf-link 2.3.2 → 2.3.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 +23 -23
- package/extension/bootstrap/manifest.template.json +1 -1
- package/extension/src/content/contentRuntime.js +1 -0
- package/extension/src/content/generated/content.bundle.js +80 -4
- package/extension/src/content/generated/content.bundle.meta.json +3 -3
- package/extension/src/content/markdownDomRenderer.js +70 -0
- package/extension/src/content/pendingInputView.js +16 -3
- package/extension/src/content/providerSettingsDialog.js +1 -0
- package/extension/src/content/runTimelineView.js +3 -0
- package/extension/src/shared/compatibility.js +1 -1
- package/extension/styles/panel.css +171 -31
- package/native-host/src/codexRuntimeIdentity.js +79 -4
- package/native-host/src/nativeEnvironment.js +4 -1
- package/native-host/src/textPatch.js +707 -259
- package/package.json +1 -1
|
@@ -177,19 +177,51 @@
|
|
|
177
177
|
--provider-muted: #a0a59f;
|
|
178
178
|
--provider-accent: #79d58a;
|
|
179
179
|
--provider-danger: #ef8176;
|
|
180
|
+
--provider-text: var(--provider-panel-color, #eef0ec);
|
|
181
|
+
--provider-field-label: #dfe3dd;
|
|
182
|
+
--provider-control-bg: rgba(255, 255, 255, 0.035);
|
|
183
|
+
--provider-hover: rgba(255, 255, 255, 0.07);
|
|
184
|
+
--provider-sidebar-bg: rgba(0, 0, 0, 0.09);
|
|
185
|
+
--provider-footer-bg: rgba(0, 0, 0, 0.08);
|
|
186
|
+
--provider-select-bg: rgba(7, 12, 10, 0.58);
|
|
187
|
+
--provider-backdrop: rgba(4, 7, 5, 0.68);
|
|
188
|
+
--provider-glow: rgba(83, 177, 105, 0.13);
|
|
189
|
+
--provider-shadow: 0 28px 80px rgba(0, 0, 0, 0.48);
|
|
190
|
+
--provider-disabled-opacity: 0.5;
|
|
180
191
|
position: fixed;
|
|
181
192
|
inset: 0;
|
|
182
193
|
z-index: 2147483600;
|
|
183
|
-
color: var(--provider-
|
|
194
|
+
color: var(--provider-text);
|
|
184
195
|
font-family: "Aptos", "SF Pro Text", sans-serif;
|
|
185
196
|
}
|
|
186
197
|
|
|
198
|
+
.codex-provider-dialog-root[data-theme="light"] {
|
|
199
|
+
--provider-bg: #f4f6f7;
|
|
200
|
+
--provider-surface: #ffffff;
|
|
201
|
+
--provider-surface-raised: #e9edf0;
|
|
202
|
+
--provider-line: rgba(31, 35, 40, 0.16);
|
|
203
|
+
--provider-muted: #5f6873;
|
|
204
|
+
--provider-accent: #247d3b;
|
|
205
|
+
--provider-danger: #bd352f;
|
|
206
|
+
--provider-text: #252a30;
|
|
207
|
+
--provider-field-label: #343b44;
|
|
208
|
+
--provider-control-bg: #ffffff;
|
|
209
|
+
--provider-hover: rgba(31, 35, 40, 0.065);
|
|
210
|
+
--provider-sidebar-bg: #e8ebee;
|
|
211
|
+
--provider-footer-bg: #eceff1;
|
|
212
|
+
--provider-select-bg: #ffffff;
|
|
213
|
+
--provider-backdrop: rgba(31, 35, 40, 0.38);
|
|
214
|
+
--provider-glow: rgba(53, 139, 74, 0.09);
|
|
215
|
+
--provider-shadow: 0 24px 64px rgba(31, 35, 40, 0.24);
|
|
216
|
+
--provider-disabled-opacity: 0.68;
|
|
217
|
+
}
|
|
218
|
+
|
|
187
219
|
.codex-provider-dialog-root[hidden] { display: none !important; }
|
|
188
220
|
|
|
189
221
|
.codex-provider-dialog-backdrop {
|
|
190
222
|
position: absolute;
|
|
191
223
|
inset: 0;
|
|
192
|
-
background:
|
|
224
|
+
background: var(--provider-backdrop);
|
|
193
225
|
backdrop-filter: blur(3px);
|
|
194
226
|
}
|
|
195
227
|
|
|
@@ -207,9 +239,9 @@
|
|
|
207
239
|
border: 1px solid var(--provider-line);
|
|
208
240
|
border-radius: 16px;
|
|
209
241
|
background:
|
|
210
|
-
radial-gradient(circle at 92% -8%,
|
|
242
|
+
radial-gradient(circle at 92% -8%, var(--provider-glow), transparent 34%),
|
|
211
243
|
var(--provider-bg);
|
|
212
|
-
box-shadow:
|
|
244
|
+
box-shadow: var(--provider-shadow);
|
|
213
245
|
}
|
|
214
246
|
|
|
215
247
|
.codex-provider-dialog-head,
|
|
@@ -259,7 +291,7 @@
|
|
|
259
291
|
cursor: pointer;
|
|
260
292
|
}
|
|
261
293
|
|
|
262
|
-
.codex-provider-dialog-close:hover { background:
|
|
294
|
+
.codex-provider-dialog-close:hover { background: var(--provider-hover); color: inherit; }
|
|
263
295
|
|
|
264
296
|
.codex-provider-dialog-body {
|
|
265
297
|
min-height: 0;
|
|
@@ -273,7 +305,7 @@
|
|
|
273
305
|
padding: 14px 10px;
|
|
274
306
|
overflow: auto;
|
|
275
307
|
border-right: 1px solid var(--provider-line);
|
|
276
|
-
background:
|
|
308
|
+
background: var(--provider-sidebar-bg);
|
|
277
309
|
}
|
|
278
310
|
|
|
279
311
|
.codex-provider-row,
|
|
@@ -297,7 +329,7 @@
|
|
|
297
329
|
}
|
|
298
330
|
|
|
299
331
|
.codex-provider-row:hover,
|
|
300
|
-
.codex-provider-row[aria-current="true"] { background:
|
|
332
|
+
.codex-provider-row[aria-current="true"] { background: var(--provider-hover); }
|
|
301
333
|
.codex-provider-row[aria-current="true"] { box-shadow: inset 2px 0 var(--provider-accent); }
|
|
302
334
|
.codex-provider-row-main { display: block; width: 100%; min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: 13px; font-weight: 650; white-space: nowrap; }
|
|
303
335
|
.codex-provider-row-status { color: var(--provider-muted); font-size: 11px; }
|
|
@@ -341,7 +373,7 @@
|
|
|
341
373
|
display: flex;
|
|
342
374
|
flex-direction: column;
|
|
343
375
|
gap: 7px;
|
|
344
|
-
color:
|
|
376
|
+
color: var(--provider-field-label);
|
|
345
377
|
font-size: 12px;
|
|
346
378
|
font-weight: 650;
|
|
347
379
|
}
|
|
@@ -358,7 +390,7 @@
|
|
|
358
390
|
border: 1px solid var(--provider-line);
|
|
359
391
|
border-radius: 8px;
|
|
360
392
|
outline: 0;
|
|
361
|
-
background:
|
|
393
|
+
background: var(--provider-control-bg);
|
|
362
394
|
color: inherit;
|
|
363
395
|
font: inherit;
|
|
364
396
|
font-weight: 450;
|
|
@@ -438,7 +470,7 @@
|
|
|
438
470
|
border-radius: 9px;
|
|
439
471
|
appearance: none;
|
|
440
472
|
-webkit-appearance: none;
|
|
441
|
-
background:
|
|
473
|
+
background: var(--provider-select-bg);
|
|
442
474
|
color: var(--provider-text);
|
|
443
475
|
color-scheme: dark;
|
|
444
476
|
font: inherit;
|
|
@@ -506,7 +538,7 @@
|
|
|
506
538
|
padding-bottom: 14px;
|
|
507
539
|
border-top: 1px solid var(--provider-line);
|
|
508
540
|
border-bottom: 0;
|
|
509
|
-
background:
|
|
541
|
+
background: var(--provider-footer-bg);
|
|
510
542
|
}
|
|
511
543
|
|
|
512
544
|
.codex-provider-operation-status { min-width: 0; color: var(--provider-muted); font-size: 11px; }
|
|
@@ -524,7 +556,7 @@
|
|
|
524
556
|
padding: 0 13px;
|
|
525
557
|
border: 1px solid var(--provider-line);
|
|
526
558
|
border-radius: 8px;
|
|
527
|
-
background:
|
|
559
|
+
background: var(--provider-control-bg);
|
|
528
560
|
color: inherit;
|
|
529
561
|
font: inherit;
|
|
530
562
|
font-size: 12px;
|
|
@@ -544,7 +576,7 @@
|
|
|
544
576
|
}
|
|
545
577
|
.codex-provider-secondary-button[data-provider-action="save"]:disabled {
|
|
546
578
|
border-color: var(--provider-line);
|
|
547
|
-
background:
|
|
579
|
+
background: var(--provider-control-bg);
|
|
548
580
|
color: var(--provider-muted);
|
|
549
581
|
box-shadow: none;
|
|
550
582
|
}
|
|
@@ -553,7 +585,22 @@
|
|
|
553
585
|
.codex-provider-dialog-root button:disabled,
|
|
554
586
|
.codex-provider-dialog-root input:disabled,
|
|
555
587
|
.codex-provider-dialog-root select:disabled,
|
|
556
|
-
.codex-provider-dialog-root textarea:disabled { cursor: not-allowed; opacity:
|
|
588
|
+
.codex-provider-dialog-root textarea:disabled { cursor: not-allowed; opacity: var(--provider-disabled-opacity); }
|
|
589
|
+
|
|
590
|
+
.codex-provider-dialog-root[data-theme="light"] .codex-provider-experimental-badge {
|
|
591
|
+
border-color: rgba(148, 102, 8, 0.34);
|
|
592
|
+
background: rgba(148, 102, 8, 0.08);
|
|
593
|
+
color: #855d09;
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
.codex-provider-dialog-root[data-theme="light"] .codex-provider-test-select-shell select {
|
|
597
|
+
color-scheme: light;
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
.codex-provider-dialog-root[data-theme="light"] .codex-provider-disclosure {
|
|
601
|
+
background: rgba(148, 102, 8, 0.08);
|
|
602
|
+
color: #72500b;
|
|
603
|
+
}
|
|
557
604
|
|
|
558
605
|
.codex-provider-builtin { max-width: 430px; padding-top: 34px; }
|
|
559
606
|
.codex-provider-builtin-mark { display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: 18px; border-radius: 14px; background: linear-gradient(145deg, #3f8d51, #255932); color: #fff; font-size: 21px; font-weight: 800; }
|
|
@@ -2949,6 +2996,62 @@
|
|
|
2949
2996
|
font-weight: 600;
|
|
2950
2997
|
}
|
|
2951
2998
|
|
|
2999
|
+
#codex-overleaf-panel .run-final-answer .run-system-label {
|
|
3000
|
+
color: var(--tl-accent);
|
|
3001
|
+
font-weight: 650;
|
|
3002
|
+
letter-spacing: 0.01em;
|
|
3003
|
+
}
|
|
3004
|
+
|
|
3005
|
+
#codex-overleaf-panel .run-completion-report[data-status="failed"] .run-system-label[data-system-label="conclusion"] {
|
|
3006
|
+
color: var(--tl-fail);
|
|
3007
|
+
}
|
|
3008
|
+
|
|
3009
|
+
#codex-overleaf-panel .run-final-answer .run-change-summary {
|
|
3010
|
+
display: flex;
|
|
3011
|
+
align-items: center;
|
|
3012
|
+
gap: 6px;
|
|
3013
|
+
margin: 7px 0 8px;
|
|
3014
|
+
color: var(--tl-ok);
|
|
3015
|
+
font-size: 12px;
|
|
3016
|
+
}
|
|
3017
|
+
|
|
3018
|
+
#codex-overleaf-panel .run-final-answer .run-change-summary__check {
|
|
3019
|
+
font-weight: 650;
|
|
3020
|
+
}
|
|
3021
|
+
|
|
3022
|
+
#codex-overleaf-panel .run-final-answer .run-change-receipts {
|
|
3023
|
+
display: flex;
|
|
3024
|
+
flex-wrap: wrap;
|
|
3025
|
+
gap: 6px 13px;
|
|
3026
|
+
margin: 0;
|
|
3027
|
+
padding: 0;
|
|
3028
|
+
list-style: none;
|
|
3029
|
+
}
|
|
3030
|
+
|
|
3031
|
+
#codex-overleaf-panel .run-final-answer .run-change-receipt {
|
|
3032
|
+
display: flex;
|
|
3033
|
+
flex-wrap: wrap;
|
|
3034
|
+
align-items: baseline;
|
|
3035
|
+
gap: 0.32em;
|
|
3036
|
+
margin: 0;
|
|
3037
|
+
min-width: 0;
|
|
3038
|
+
}
|
|
3039
|
+
|
|
3040
|
+
#codex-overleaf-panel .run-final-answer .run-change-receipt + .run-change-receipt {
|
|
3041
|
+
margin-top: 0;
|
|
3042
|
+
}
|
|
3043
|
+
|
|
3044
|
+
#codex-overleaf-panel .run-final-answer .run-change-receipt__file {
|
|
3045
|
+
color: var(--tl-fg-1);
|
|
3046
|
+
font: 600 0.94em/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
|
3047
|
+
overflow-wrap: anywhere;
|
|
3048
|
+
}
|
|
3049
|
+
|
|
3050
|
+
#codex-overleaf-panel .run-final-answer .run-change-receipt__operation {
|
|
3051
|
+
color: var(--tl-fg-3);
|
|
3052
|
+
font-size: 0.88em;
|
|
3053
|
+
}
|
|
3054
|
+
|
|
2952
3055
|
#codex-overleaf-panel .run-final-answer p + p,
|
|
2953
3056
|
#codex-overleaf-panel .run-final-answer p + ul,
|
|
2954
3057
|
#codex-overleaf-panel .run-final-answer p + ol,
|
|
@@ -3789,8 +3892,10 @@
|
|
|
3789
3892
|
|
|
3790
3893
|
#codex-overleaf-panel .codex-pending-inputs {
|
|
3791
3894
|
display: grid;
|
|
3792
|
-
gap:
|
|
3793
|
-
|
|
3895
|
+
gap: 0;
|
|
3896
|
+
margin: 0 6px 7px;
|
|
3897
|
+
padding: 7px 4px 0;
|
|
3898
|
+
border-top: 1px solid var(--tl-border);
|
|
3794
3899
|
}
|
|
3795
3900
|
|
|
3796
3901
|
#codex-overleaf-panel .codex-pending-inputs[hidden] {
|
|
@@ -3799,38 +3904,56 @@
|
|
|
3799
3904
|
|
|
3800
3905
|
#codex-overleaf-panel .codex-pending-input {
|
|
3801
3906
|
display: grid;
|
|
3802
|
-
grid-template-columns: minmax(0, 1fr) auto;
|
|
3907
|
+
grid-template-columns: 20px minmax(0, 1fr) auto;
|
|
3803
3908
|
align-items: center;
|
|
3804
|
-
gap:
|
|
3909
|
+
gap: 7px;
|
|
3805
3910
|
min-width: 0;
|
|
3806
|
-
padding: 8px
|
|
3807
|
-
border: 1px solid var(--tl-border);
|
|
3808
|
-
|
|
3809
|
-
|
|
3911
|
+
padding: 8px 5px;
|
|
3912
|
+
border-top: 1px solid var(--tl-border);
|
|
3913
|
+
background: transparent;
|
|
3914
|
+
}
|
|
3915
|
+
|
|
3916
|
+
#codex-overleaf-panel .codex-pending-input:first-of-type {
|
|
3917
|
+
border-top: 0;
|
|
3810
3918
|
}
|
|
3811
3919
|
|
|
3812
|
-
#codex-overleaf-panel .codex-pending-input
|
|
3813
|
-
|
|
3920
|
+
#codex-overleaf-panel .codex-pending-input:hover,
|
|
3921
|
+
#codex-overleaf-panel .codex-pending-input:focus-within {
|
|
3922
|
+
border-radius: 8px;
|
|
3923
|
+
background: var(--tl-hover);
|
|
3924
|
+
}
|
|
3925
|
+
|
|
3926
|
+
#codex-overleaf-panel .codex-pending-input-marker {
|
|
3927
|
+
display: inline-grid;
|
|
3928
|
+
place-items: center;
|
|
3929
|
+
color: var(--tl-fg-3);
|
|
3930
|
+
}
|
|
3931
|
+
|
|
3932
|
+
#codex-overleaf-panel .codex-pending-input[data-status="paused"] .codex-pending-input-marker {
|
|
3933
|
+
color: var(--tl-warn);
|
|
3934
|
+
}
|
|
3935
|
+
|
|
3936
|
+
#codex-overleaf-panel .codex-pending-input[data-status="steering"] .codex-pending-input-marker,
|
|
3937
|
+
#codex-overleaf-panel .codex-pending-input[data-status="executing"] .codex-pending-input-marker {
|
|
3938
|
+
color: var(--tl-accent);
|
|
3814
3939
|
}
|
|
3815
3940
|
|
|
3816
3941
|
#codex-overleaf-panel .codex-pending-input-copy {
|
|
3817
3942
|
display: grid;
|
|
3818
3943
|
min-width: 0;
|
|
3819
|
-
gap:
|
|
3944
|
+
gap: 3px;
|
|
3820
3945
|
}
|
|
3821
3946
|
|
|
3822
3947
|
#codex-overleaf-panel .codex-pending-input-status {
|
|
3823
3948
|
color: var(--tl-fg-3);
|
|
3824
|
-
font-size:
|
|
3825
|
-
font-weight:
|
|
3826
|
-
letter-spacing: 0.06em;
|
|
3827
|
-
text-transform: uppercase;
|
|
3949
|
+
font-size: 10.5px;
|
|
3950
|
+
font-weight: 500;
|
|
3828
3951
|
}
|
|
3829
3952
|
|
|
3830
3953
|
#codex-overleaf-panel .codex-pending-input-text {
|
|
3831
3954
|
color: var(--tl-fg-1);
|
|
3832
|
-
font-size:
|
|
3833
|
-
line-height: 1.
|
|
3955
|
+
font-size: 13px;
|
|
3956
|
+
line-height: 1.4;
|
|
3834
3957
|
overflow-wrap: anywhere;
|
|
3835
3958
|
white-space: pre-wrap;
|
|
3836
3959
|
}
|
|
@@ -3838,6 +3961,13 @@
|
|
|
3838
3961
|
#codex-overleaf-panel .codex-pending-input-actions {
|
|
3839
3962
|
display: inline-flex;
|
|
3840
3963
|
gap: 4px;
|
|
3964
|
+
color: var(--tl-fg-3);
|
|
3965
|
+
opacity: 0.72;
|
|
3966
|
+
}
|
|
3967
|
+
|
|
3968
|
+
#codex-overleaf-panel .codex-pending-input:hover .codex-pending-input-actions,
|
|
3969
|
+
#codex-overleaf-panel .codex-pending-input:focus-within .codex-pending-input-actions {
|
|
3970
|
+
opacity: 1;
|
|
3841
3971
|
}
|
|
3842
3972
|
|
|
3843
3973
|
#codex-overleaf-panel .codex-pending-input-actions button {
|
|
@@ -3879,6 +4009,16 @@
|
|
|
3879
4009
|
stroke-linejoin: round;
|
|
3880
4010
|
}
|
|
3881
4011
|
|
|
4012
|
+
#codex-overleaf-panel .codex-pending-input-marker svg {
|
|
4013
|
+
width: 15px;
|
|
4014
|
+
height: 15px;
|
|
4015
|
+
fill: none;
|
|
4016
|
+
stroke: currentColor;
|
|
4017
|
+
stroke-width: 1.55;
|
|
4018
|
+
stroke-linecap: round;
|
|
4019
|
+
stroke-linejoin: round;
|
|
4020
|
+
}
|
|
4021
|
+
|
|
3882
4022
|
#codex-overleaf-panel .codex-pending-input-icon[data-action="guide"]:hover {
|
|
3883
4023
|
color: var(--tl-accent);
|
|
3884
4024
|
}
|
|
@@ -22,24 +22,99 @@ function buildCodexRuntimeIdentity(options = {}) {
|
|
|
22
22
|
const candidatePaths = selectedPath
|
|
23
23
|
? [selectedPath, ...discovered.filter(candidate => !sameExecutablePath(candidate, selectedPath, platform))]
|
|
24
24
|
: discovered;
|
|
25
|
-
const candidates = candidatePaths.slice(0, MAX_CODEX_CANDIDATES).map(
|
|
25
|
+
const candidates = candidatePaths.slice(0, MAX_CODEX_CANDIDATES).map(candidatePath => ({
|
|
26
26
|
path: candidatePath,
|
|
27
27
|
displayPath: compactHomePath(candidatePath, env, platform),
|
|
28
28
|
version: readCodexVersion(candidatePath, { env, platform }),
|
|
29
29
|
source: classifyCodexSource(candidatePath),
|
|
30
|
-
selected:
|
|
30
|
+
selected: false
|
|
31
31
|
}));
|
|
32
|
-
const
|
|
32
|
+
const selectedIndex = selectCodexCandidateIndex(candidates, {
|
|
33
|
+
selectedPath,
|
|
34
|
+
selectionPolicy: options.selectionPolicy,
|
|
35
|
+
platform
|
|
36
|
+
});
|
|
37
|
+
if (selectedIndex >= 0) {
|
|
38
|
+
candidates[selectedIndex].selected = true;
|
|
39
|
+
}
|
|
40
|
+
const selected = selectedIndex >= 0 ? candidates[selectedIndex] : null;
|
|
33
41
|
|
|
34
42
|
return {
|
|
35
43
|
schemaVersion: 1,
|
|
36
44
|
selected,
|
|
37
45
|
candidates,
|
|
38
46
|
multipleInstallations: candidates.length > 1,
|
|
39
|
-
selectedBy: selected
|
|
47
|
+
selectedBy: selected
|
|
48
|
+
? options.selectionPolicy === 'newest-version' ? 'newest-version' : options.selectionPolicy === 'explicit-path' ? 'explicit-path' : 'path-order'
|
|
49
|
+
: 'not-found'
|
|
40
50
|
};
|
|
41
51
|
}
|
|
42
52
|
|
|
53
|
+
function selectCodexCandidateIndex(candidates, options = {}) {
|
|
54
|
+
if (!candidates.length) return -1;
|
|
55
|
+
if (options.selectionPolicy !== 'newest-version') {
|
|
56
|
+
if (!options.selectedPath) return -1;
|
|
57
|
+
return candidates.findIndex(candidate => sameExecutablePath(
|
|
58
|
+
candidate.path,
|
|
59
|
+
options.selectedPath,
|
|
60
|
+
options.platform
|
|
61
|
+
));
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
let selectedIndex = 0;
|
|
65
|
+
for (let index = 1; index < candidates.length; index += 1) {
|
|
66
|
+
if (compareCodexVersions(candidates[index].version, candidates[selectedIndex].version) > 0) {
|
|
67
|
+
selectedIndex = index;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return selectedIndex;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function compareCodexVersions(left, right) {
|
|
74
|
+
const leftVersion = parseCodexVersion(left);
|
|
75
|
+
const rightVersion = parseCodexVersion(right);
|
|
76
|
+
if (!leftVersion && !rightVersion) return 0;
|
|
77
|
+
if (!leftVersion) return -1;
|
|
78
|
+
if (!rightVersion) return 1;
|
|
79
|
+
|
|
80
|
+
for (let index = 0; index < 3; index += 1) {
|
|
81
|
+
if (leftVersion.core[index] !== rightVersion.core[index]) {
|
|
82
|
+
return leftVersion.core[index] - rightVersion.core[index];
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
if (!leftVersion.prerelease && rightVersion.prerelease) return 1;
|
|
86
|
+
if (leftVersion.prerelease && !rightVersion.prerelease) return -1;
|
|
87
|
+
if (!leftVersion.prerelease && !rightVersion.prerelease) return 0;
|
|
88
|
+
return comparePrerelease(leftVersion.prerelease, rightVersion.prerelease);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function parseCodexVersion(value) {
|
|
92
|
+
const match = String(value || '').trim().match(/^(\d+)\.(\d+)\.(\d+)(?:-([^+]+))?/);
|
|
93
|
+
if (!match) return null;
|
|
94
|
+
return {
|
|
95
|
+
core: [Number(match[1]), Number(match[2]), Number(match[3])],
|
|
96
|
+
prerelease: match[4] || ''
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function comparePrerelease(left, right) {
|
|
101
|
+
const leftParts = left.split('.');
|
|
102
|
+
const rightParts = right.split('.');
|
|
103
|
+
const length = Math.max(leftParts.length, rightParts.length);
|
|
104
|
+
for (let index = 0; index < length; index += 1) {
|
|
105
|
+
if (leftParts[index] === undefined) return -1;
|
|
106
|
+
if (rightParts[index] === undefined) return 1;
|
|
107
|
+
if (leftParts[index] === rightParts[index]) continue;
|
|
108
|
+
const leftNumber = /^\d+$/.test(leftParts[index]) ? Number(leftParts[index]) : null;
|
|
109
|
+
const rightNumber = /^\d+$/.test(rightParts[index]) ? Number(rightParts[index]) : null;
|
|
110
|
+
if (leftNumber !== null && rightNumber !== null) return leftNumber - rightNumber;
|
|
111
|
+
if (leftNumber !== null) return -1;
|
|
112
|
+
if (rightNumber !== null) return 1;
|
|
113
|
+
return leftParts[index].localeCompare(rightParts[index]);
|
|
114
|
+
}
|
|
115
|
+
return 0;
|
|
116
|
+
}
|
|
117
|
+
|
|
43
118
|
function discoverCodexCandidates(pathValue, options = {}) {
|
|
44
119
|
const platform = options.platform || process.platform;
|
|
45
120
|
const delimiter = options.delimiter || (platform === 'win32' ? ';' : path.delimiter);
|
|
@@ -16,6 +16,7 @@ const SUPPORTED_PLATFORMS = new Set(['darwin', 'linux', 'win32']);
|
|
|
16
16
|
|
|
17
17
|
function buildNativeRuntimeEnv(baseEnv = process.env, options = {}) {
|
|
18
18
|
const env = { ...baseEnv };
|
|
19
|
+
const explicitCodexPath = String(baseEnv.CODEX_OVERLEAF_CODEX_PATH || '').trim();
|
|
19
20
|
const runtimeOptions = { ...options, platform: getNativeRuntimePlatform(options) };
|
|
20
21
|
const loginShellEnv = options.readLoginShellEnv
|
|
21
22
|
? options.readLoginShellEnv(baseEnv, runtimeOptions)
|
|
@@ -38,12 +39,14 @@ function buildNativeRuntimeEnv(baseEnv = process.env, options = {}) {
|
|
|
38
39
|
env[getToolEnvName(tool)] = resolveExecutable(tool, env.PATH, { ...runtimeOptions, env }) || '';
|
|
39
40
|
}
|
|
40
41
|
const codexRuntime = buildCodexRuntimeIdentity({
|
|
41
|
-
selectedPath: env.CODEX_OVERLEAF_CODEX_PATH,
|
|
42
|
+
selectedPath: explicitCodexPath || env.CODEX_OVERLEAF_CODEX_PATH,
|
|
43
|
+
selectionPolicy: explicitCodexPath ? 'explicit-path' : 'newest-version',
|
|
42
44
|
pathValue: env.PATH,
|
|
43
45
|
delimiter: runtimeOptions.delimiter,
|
|
44
46
|
env,
|
|
45
47
|
platform: runtimeOptions.platform
|
|
46
48
|
});
|
|
49
|
+
env.CODEX_OVERLEAF_CODEX_PATH = codexRuntime.selected?.path || '';
|
|
47
50
|
env.CODEX_OVERLEAF_CODEX_RUNTIME_JSON = serializeCodexRuntimeIdentity(codexRuntime);
|
|
48
51
|
env.CODEX_OVERLEAF_CODEX_VERSION = codexRuntime.selected?.version || '';
|
|
49
52
|
env.CODEX_OVERLEAF_CODEX_SOURCE = codexRuntime.selected?.source || '';
|