codex-overleaf-link 2.3.2 → 2.3.4
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 +42 -5
- package/extension/src/content/generated/content.bundle.js +227 -11
- package/extension/src/content/generated/content.bundle.meta.json +3 -3
- package/extension/src/content/markdownDomRenderer.js +70 -0
- package/extension/src/content/modelPicker.js +1 -1
- package/extension/src/content/panelMaintenance.js +2 -0
- package/extension/src/content/panelRenderer.js +80 -1
- package/extension/src/content/pendingInputView.js +16 -3
- package/extension/src/content/providerSettingsDialog.js +1 -0
- package/extension/src/content/runController.js +35 -0
- package/extension/src/content/runTimelineView.js +3 -0
- package/extension/src/popup.js +10 -10
- package/extension/src/shared/compatibility.js +1 -1
- package/extension/styles/panel.css +243 -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; }
|
|
@@ -603,6 +650,78 @@
|
|
|
603
650
|
overflow: hidden;
|
|
604
651
|
}
|
|
605
652
|
|
|
653
|
+
#codex-overleaf-launcher {
|
|
654
|
+
position: fixed;
|
|
655
|
+
top: 50%;
|
|
656
|
+
right: 0;
|
|
657
|
+
z-index: 2147483646;
|
|
658
|
+
display: grid;
|
|
659
|
+
width: 26px;
|
|
660
|
+
height: 36px;
|
|
661
|
+
padding: 0;
|
|
662
|
+
place-items: center;
|
|
663
|
+
border: 1px solid #3a3a3a;
|
|
664
|
+
border-right: 0;
|
|
665
|
+
border-radius: 7px 0 0 7px;
|
|
666
|
+
background: #181818;
|
|
667
|
+
box-shadow: -1px 1px 5px rgba(0, 0, 0, 0.18);
|
|
668
|
+
color: #8a8a8a;
|
|
669
|
+
cursor: pointer;
|
|
670
|
+
opacity: 0.82;
|
|
671
|
+
transform: translateY(-50%);
|
|
672
|
+
transition: width 120ms ease, background 120ms ease, color 120ms ease, opacity 120ms ease;
|
|
673
|
+
appearance: none;
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
#codex-overleaf-launcher[hidden] { display: none !important; }
|
|
677
|
+
|
|
678
|
+
#codex-overleaf-launcher:hover {
|
|
679
|
+
width: 29px;
|
|
680
|
+
background: #232323;
|
|
681
|
+
color: #b7b7b7;
|
|
682
|
+
opacity: 1;
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
#codex-overleaf-launcher:active {
|
|
686
|
+
background: #2a2d2e;
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
#codex-overleaf-launcher:focus-visible {
|
|
690
|
+
outline: 2px solid #6aa4d8;
|
|
691
|
+
outline-offset: 2px;
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
#codex-overleaf-launcher .codex-icon,
|
|
695
|
+
#codex-overleaf-launcher .codex-icon svg {
|
|
696
|
+
display: block;
|
|
697
|
+
width: 14px;
|
|
698
|
+
height: 14px;
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
#codex-overleaf-launcher .codex-icon svg {
|
|
702
|
+
fill: none;
|
|
703
|
+
stroke: currentColor;
|
|
704
|
+
stroke-width: 1.45;
|
|
705
|
+
stroke-linecap: round;
|
|
706
|
+
stroke-linejoin: round;
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
#codex-overleaf-panel[data-theme="light"] ~ #codex-overleaf-launcher {
|
|
710
|
+
border-color: #d7dbe0;
|
|
711
|
+
background: #f3f4f6;
|
|
712
|
+
box-shadow: -1px 1px 5px rgba(31, 35, 40, 0.12);
|
|
713
|
+
color: #6a7280;
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
#codex-overleaf-panel[data-theme="light"] ~ #codex-overleaf-launcher:hover {
|
|
717
|
+
background: #eef0f3;
|
|
718
|
+
color: #3d4651;
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
@media (prefers-reduced-motion: reduce) {
|
|
722
|
+
#codex-overleaf-launcher { transition: none; }
|
|
723
|
+
}
|
|
724
|
+
|
|
606
725
|
:root.codex-overleaf-panel-compact body {
|
|
607
726
|
width: auto !important;
|
|
608
727
|
max-width: none !important;
|
|
@@ -2949,6 +3068,62 @@
|
|
|
2949
3068
|
font-weight: 600;
|
|
2950
3069
|
}
|
|
2951
3070
|
|
|
3071
|
+
#codex-overleaf-panel .run-final-answer .run-system-label {
|
|
3072
|
+
color: var(--tl-accent);
|
|
3073
|
+
font-weight: 650;
|
|
3074
|
+
letter-spacing: 0.01em;
|
|
3075
|
+
}
|
|
3076
|
+
|
|
3077
|
+
#codex-overleaf-panel .run-completion-report[data-status="failed"] .run-system-label[data-system-label="conclusion"] {
|
|
3078
|
+
color: var(--tl-fail);
|
|
3079
|
+
}
|
|
3080
|
+
|
|
3081
|
+
#codex-overleaf-panel .run-final-answer .run-change-summary {
|
|
3082
|
+
display: flex;
|
|
3083
|
+
align-items: center;
|
|
3084
|
+
gap: 6px;
|
|
3085
|
+
margin: 7px 0 8px;
|
|
3086
|
+
color: var(--tl-ok);
|
|
3087
|
+
font-size: 12px;
|
|
3088
|
+
}
|
|
3089
|
+
|
|
3090
|
+
#codex-overleaf-panel .run-final-answer .run-change-summary__check {
|
|
3091
|
+
font-weight: 650;
|
|
3092
|
+
}
|
|
3093
|
+
|
|
3094
|
+
#codex-overleaf-panel .run-final-answer .run-change-receipts {
|
|
3095
|
+
display: flex;
|
|
3096
|
+
flex-wrap: wrap;
|
|
3097
|
+
gap: 6px 13px;
|
|
3098
|
+
margin: 0;
|
|
3099
|
+
padding: 0;
|
|
3100
|
+
list-style: none;
|
|
3101
|
+
}
|
|
3102
|
+
|
|
3103
|
+
#codex-overleaf-panel .run-final-answer .run-change-receipt {
|
|
3104
|
+
display: flex;
|
|
3105
|
+
flex-wrap: wrap;
|
|
3106
|
+
align-items: baseline;
|
|
3107
|
+
gap: 0.32em;
|
|
3108
|
+
margin: 0;
|
|
3109
|
+
min-width: 0;
|
|
3110
|
+
}
|
|
3111
|
+
|
|
3112
|
+
#codex-overleaf-panel .run-final-answer .run-change-receipt + .run-change-receipt {
|
|
3113
|
+
margin-top: 0;
|
|
3114
|
+
}
|
|
3115
|
+
|
|
3116
|
+
#codex-overleaf-panel .run-final-answer .run-change-receipt__file {
|
|
3117
|
+
color: var(--tl-fg-1);
|
|
3118
|
+
font: 600 0.94em/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
|
3119
|
+
overflow-wrap: anywhere;
|
|
3120
|
+
}
|
|
3121
|
+
|
|
3122
|
+
#codex-overleaf-panel .run-final-answer .run-change-receipt__operation {
|
|
3123
|
+
color: var(--tl-fg-3);
|
|
3124
|
+
font-size: 0.88em;
|
|
3125
|
+
}
|
|
3126
|
+
|
|
2952
3127
|
#codex-overleaf-panel .run-final-answer p + p,
|
|
2953
3128
|
#codex-overleaf-panel .run-final-answer p + ul,
|
|
2954
3129
|
#codex-overleaf-panel .run-final-answer p + ol,
|
|
@@ -3789,8 +3964,10 @@
|
|
|
3789
3964
|
|
|
3790
3965
|
#codex-overleaf-panel .codex-pending-inputs {
|
|
3791
3966
|
display: grid;
|
|
3792
|
-
gap:
|
|
3793
|
-
|
|
3967
|
+
gap: 0;
|
|
3968
|
+
margin: 0 6px 7px;
|
|
3969
|
+
padding: 7px 4px 0;
|
|
3970
|
+
border-top: 1px solid var(--tl-border);
|
|
3794
3971
|
}
|
|
3795
3972
|
|
|
3796
3973
|
#codex-overleaf-panel .codex-pending-inputs[hidden] {
|
|
@@ -3799,38 +3976,56 @@
|
|
|
3799
3976
|
|
|
3800
3977
|
#codex-overleaf-panel .codex-pending-input {
|
|
3801
3978
|
display: grid;
|
|
3802
|
-
grid-template-columns: minmax(0, 1fr) auto;
|
|
3979
|
+
grid-template-columns: 20px minmax(0, 1fr) auto;
|
|
3803
3980
|
align-items: center;
|
|
3804
|
-
gap:
|
|
3981
|
+
gap: 7px;
|
|
3805
3982
|
min-width: 0;
|
|
3806
|
-
padding: 8px
|
|
3807
|
-
border: 1px solid var(--tl-border);
|
|
3808
|
-
|
|
3809
|
-
|
|
3983
|
+
padding: 8px 5px;
|
|
3984
|
+
border-top: 1px solid var(--tl-border);
|
|
3985
|
+
background: transparent;
|
|
3986
|
+
}
|
|
3987
|
+
|
|
3988
|
+
#codex-overleaf-panel .codex-pending-input:first-of-type {
|
|
3989
|
+
border-top: 0;
|
|
3810
3990
|
}
|
|
3811
3991
|
|
|
3812
|
-
#codex-overleaf-panel .codex-pending-input
|
|
3813
|
-
|
|
3992
|
+
#codex-overleaf-panel .codex-pending-input:hover,
|
|
3993
|
+
#codex-overleaf-panel .codex-pending-input:focus-within {
|
|
3994
|
+
border-radius: 8px;
|
|
3995
|
+
background: var(--tl-hover);
|
|
3996
|
+
}
|
|
3997
|
+
|
|
3998
|
+
#codex-overleaf-panel .codex-pending-input-marker {
|
|
3999
|
+
display: inline-grid;
|
|
4000
|
+
place-items: center;
|
|
4001
|
+
color: var(--tl-fg-3);
|
|
4002
|
+
}
|
|
4003
|
+
|
|
4004
|
+
#codex-overleaf-panel .codex-pending-input[data-status="paused"] .codex-pending-input-marker {
|
|
4005
|
+
color: var(--tl-warn);
|
|
4006
|
+
}
|
|
4007
|
+
|
|
4008
|
+
#codex-overleaf-panel .codex-pending-input[data-status="steering"] .codex-pending-input-marker,
|
|
4009
|
+
#codex-overleaf-panel .codex-pending-input[data-status="executing"] .codex-pending-input-marker {
|
|
4010
|
+
color: var(--tl-accent);
|
|
3814
4011
|
}
|
|
3815
4012
|
|
|
3816
4013
|
#codex-overleaf-panel .codex-pending-input-copy {
|
|
3817
4014
|
display: grid;
|
|
3818
4015
|
min-width: 0;
|
|
3819
|
-
gap:
|
|
4016
|
+
gap: 3px;
|
|
3820
4017
|
}
|
|
3821
4018
|
|
|
3822
4019
|
#codex-overleaf-panel .codex-pending-input-status {
|
|
3823
4020
|
color: var(--tl-fg-3);
|
|
3824
|
-
font-size:
|
|
3825
|
-
font-weight:
|
|
3826
|
-
letter-spacing: 0.06em;
|
|
3827
|
-
text-transform: uppercase;
|
|
4021
|
+
font-size: 10.5px;
|
|
4022
|
+
font-weight: 500;
|
|
3828
4023
|
}
|
|
3829
4024
|
|
|
3830
4025
|
#codex-overleaf-panel .codex-pending-input-text {
|
|
3831
4026
|
color: var(--tl-fg-1);
|
|
3832
|
-
font-size:
|
|
3833
|
-
line-height: 1.
|
|
4027
|
+
font-size: 13px;
|
|
4028
|
+
line-height: 1.4;
|
|
3834
4029
|
overflow-wrap: anywhere;
|
|
3835
4030
|
white-space: pre-wrap;
|
|
3836
4031
|
}
|
|
@@ -3838,6 +4033,13 @@
|
|
|
3838
4033
|
#codex-overleaf-panel .codex-pending-input-actions {
|
|
3839
4034
|
display: inline-flex;
|
|
3840
4035
|
gap: 4px;
|
|
4036
|
+
color: var(--tl-fg-3);
|
|
4037
|
+
opacity: 0.72;
|
|
4038
|
+
}
|
|
4039
|
+
|
|
4040
|
+
#codex-overleaf-panel .codex-pending-input:hover .codex-pending-input-actions,
|
|
4041
|
+
#codex-overleaf-panel .codex-pending-input:focus-within .codex-pending-input-actions {
|
|
4042
|
+
opacity: 1;
|
|
3841
4043
|
}
|
|
3842
4044
|
|
|
3843
4045
|
#codex-overleaf-panel .codex-pending-input-actions button {
|
|
@@ -3879,6 +4081,16 @@
|
|
|
3879
4081
|
stroke-linejoin: round;
|
|
3880
4082
|
}
|
|
3881
4083
|
|
|
4084
|
+
#codex-overleaf-panel .codex-pending-input-marker svg {
|
|
4085
|
+
width: 15px;
|
|
4086
|
+
height: 15px;
|
|
4087
|
+
fill: none;
|
|
4088
|
+
stroke: currentColor;
|
|
4089
|
+
stroke-width: 1.55;
|
|
4090
|
+
stroke-linecap: round;
|
|
4091
|
+
stroke-linejoin: round;
|
|
4092
|
+
}
|
|
4093
|
+
|
|
3882
4094
|
#codex-overleaf-panel .codex-pending-input-icon[data-action="guide"]:hover {
|
|
3883
4095
|
color: var(--tl-accent);
|
|
3884
4096
|
}
|
|
@@ -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 || '';
|