minecodex 2.0.33 → 2.0.35

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.
@@ -0,0 +1,93 @@
1
+ Copyright 2001 The Silkscreen Project Authors (https://github.com/googlefonts/silkscreen)
2
+
3
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
4
+ This license is copied below, and is also available with a FAQ at:
5
+ https://scripts.sil.org/OFL
6
+
7
+
8
+ -----------------------------------------------------------
9
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10
+ -----------------------------------------------------------
11
+
12
+ PREAMBLE
13
+ The goals of the Open Font License (OFL) are to stimulate worldwide
14
+ development of collaborative font projects, to support the font creation
15
+ efforts of academic and linguistic communities, and to provide a free and
16
+ open framework in which fonts may be shared and improved in partnership
17
+ with others.
18
+
19
+ The OFL allows the licensed fonts to be used, studied, modified and
20
+ redistributed freely as long as they are not sold by themselves. The
21
+ fonts, including any derivative works, can be bundled, embedded,
22
+ redistributed and/or sold with any software provided that any reserved
23
+ names are not used by derivative works. The fonts and derivatives,
24
+ however, cannot be released under any other type of license. The
25
+ requirement for fonts to remain under this license does not apply
26
+ to any document created using the fonts or their derivatives.
27
+
28
+ DEFINITIONS
29
+ "Font Software" refers to the set of files released by the Copyright
30
+ Holder(s) under this license and clearly marked as such. This may
31
+ include source files, build scripts and documentation.
32
+
33
+ "Reserved Font Name" refers to any names specified as such after the
34
+ copyright statement(s).
35
+
36
+ "Original Version" refers to the collection of Font Software components as
37
+ distributed by the Copyright Holder(s).
38
+
39
+ "Modified Version" refers to any derivative made by adding to, deleting,
40
+ or substituting -- in part or in whole -- any of the components of the
41
+ Original Version, by changing formats or by porting the Font Software to a
42
+ new environment.
43
+
44
+ "Author" refers to any designer, engineer, programmer, technical
45
+ writer or other person who contributed to the Font Software.
46
+
47
+ PERMISSION & CONDITIONS
48
+ Permission is hereby granted, free of charge, to any person obtaining
49
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
50
+ redistribute, and sell modified and unmodified copies of the Font
51
+ Software, subject to the following conditions:
52
+
53
+ 1) Neither the Font Software nor any of its individual components,
54
+ in Original or Modified Versions, may be sold by itself.
55
+
56
+ 2) Original or Modified Versions of the Font Software may be bundled,
57
+ redistributed and/or sold with any software, provided that each copy
58
+ contains the above copyright notice and this license. These can be
59
+ included either as stand-alone text files, human-readable headers or
60
+ in the appropriate machine-readable metadata fields within text or
61
+ binary files as long as those fields can be easily viewed by the user.
62
+
63
+ 3) No Modified Version of the Font Software may use the Reserved Font
64
+ Name(s) unless explicit written permission is granted by the corresponding
65
+ Copyright Holder. This restriction only applies to the primary font name as
66
+ presented to the users.
67
+
68
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69
+ Software shall not be used to promote, endorse or advertise any
70
+ Modified Version, except to acknowledge the contribution(s) of the
71
+ Copyright Holder(s) and the Author(s) or with their explicit written
72
+ permission.
73
+
74
+ 5) The Font Software, modified or unmodified, in part or in whole,
75
+ must be distributed entirely under this license, and must not be
76
+ distributed under any other license. The requirement for fonts to
77
+ remain under this license does not apply to any document created
78
+ using the Font Software.
79
+
80
+ TERMINATION
81
+ This license becomes null and void if any of the above conditions are
82
+ not met.
83
+
84
+ DISCLAIMER
85
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93
+ OTHER DEALINGS IN THE FONT SOFTWARE.
@@ -1,3 +1,10 @@
1
+ @font-face {
2
+ font-family: "Silkscreen";
3
+ src: url("/assets/silkscreen.ttf?v=bold") format("truetype");
4
+ font-weight: 700;
5
+ font-display: swap;
6
+ }
7
+
1
8
  /* Dashboard 独立视觉快照;不从宿主变量取值。来源见 DESIGN.md。 */
2
9
  :root {
3
10
  color-scheme: light;
@@ -17,6 +24,9 @@
17
24
  --shadow: 0 4px 16px -6px #00000012;
18
25
  --focus: 0 0 0 3px #3a83f766;
19
26
  --card-radius: 20px;
27
+ --word-face: #f7f7f7;
28
+ --word-edge: #0d0d0d;
29
+ --word-depth: #a3a3a3;
20
30
  --grid-gap: 24px;
21
31
  --card-padding: 24px;
22
32
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
@@ -25,6 +35,9 @@
25
35
  :root[data-theme="dark"] {
26
36
  color-scheme: dark;
27
37
  --canvas: #181818;
38
+ --word-face: #ffffff;
39
+ --word-edge: #080808;
40
+ --word-depth: #000000;
28
41
  --surface: #181818;
29
42
  --surface-muted: #141414;
30
43
  --surface-elevated: #2d2d2d;
@@ -80,12 +93,16 @@ button:focus-visible, input:focus-visible + .switch-track {
80
93
  align-items: center;
81
94
  }
82
95
 
83
- .page-header { flex-direction: column; gap: 10px; margin: 24px 0 40px; text-align: center; }
96
+ .page-header { flex-direction: column; gap: 10px; margin: 40px 0 64px; text-align: center; }
84
97
  h1, h2, h3, p { margin: 0; }
85
- h1 { display: flex; flex-direction: column; align-items: center; gap: 16px; font-size: 32px; line-height: 1.2; font-weight: 600; }
86
- .brand-name { letter-spacing: -.04em; }
87
- .brand-slogan { margin-top: 4px; font-size: 16px; line-height: 1.5; }
88
- .brand-description { color: var(--ink-secondary); font-size: 13px; line-height: 1.6; }
98
+ h1 { display: flex; flex-direction: column; align-items: center; gap: 20px; font-size: clamp(28px, 5.3vw, 64px); line-height: 1.3; font-weight: 700; }
99
+ .brand-name {
100
+ font-family:"Silkscreen", monospace; font-weight:700; letter-spacing:-.07em;
101
+ color:var(--word-face); -webkit-text-stroke:1px var(--word-edge);
102
+ text-shadow:1px 1px 0 var(--word-edge), 2px 2px 0 var(--word-edge), 3px 3px 0 var(--word-edge), 4px 4px 0 var(--word-edge), 5px 5px 0 var(--word-depth);
103
+ }
104
+ .brand-slogan { margin-top: 12px; font-size: 22px; line-height: 1.5; }
105
+ .brand-description { max-width:600px; color: var(--ink-secondary); font-size: 16px; line-height: 1.6; }
89
106
  .brand-icon {
90
107
  display: inline-block;
91
108
  width: 64px;
@@ -225,9 +242,11 @@ h2 { font-size: 14px; font-weight: 620; }
225
242
  @media (max-width: 960px) { .plugin-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
226
243
  @media (max-width: 600px) {
227
244
  .shell { width: calc(100% - 32px); padding-top: 28px; }
228
- h1 { font-size: 28px; gap: 12px; }
245
+ h1 { gap: 16px; }
246
+ .brand-slogan { font-size:20px; }
247
+ .brand-description { font-size:15px; }
229
248
  .brand-icon { width: 48px; height: 48px; flex-basis: 48px; }
230
- .page-header { margin: 24px 0 32px; }
249
+ .page-header { margin: 32px 0 48px; }
231
250
  .header-actions .button { padding: 6px 9px; font-size: 12px; }
232
251
  .plugin-list { grid-template-columns: 1fr; }
233
252
  .plugin-card { min-height: 204px; }
@@ -8,7 +8,7 @@ import { loadNativeMarkdownRichText, installMarkdownRichText } from './rich-text
8
8
 
9
9
  // 每个 Preview 共用换行状态,虚拟滚动重挂载的块也读取当前值。
10
10
  export function createMarkdownWrapState() {
11
- let enabled = false;
11
+ let enabled = true;
12
12
  const listeners = new Set();
13
13
  return {
14
14
  get: () => enabled,
@@ -150,9 +150,13 @@ export function installMarkdownTables(view, api, wrapState) {
150
150
  const content = view.contentDOM;
151
151
  const scroller = view.scrollDOM;
152
152
  const padding = getComputedStyle(scroller);
153
+ const wrapping = wrapState.get();
154
+ measure.style.width = wrapping
155
+ ? `${scroller.clientWidth - parseFloat(padding.paddingLeft) - parseFloat(padding.paddingRight)}px`
156
+ : "";
153
157
  const available = measure.clientWidth;
154
158
  const inset = (scroller.clientWidth - available) / 2;
155
- const breakout = Math.max(0, parseFloat(padding.paddingLeft) - inset);
159
+ const breakout = wrapping ? 0 : Math.max(0, parseFloat(padding.paddingLeft) - inset);
156
160
  for (const [id, table] of tables) {
157
161
  table.style.inlineSize = wrapState.get() ? '100%' : 'max-content';
158
162
  for (const cell of table.querySelectorAll('td,th'))
@@ -115,16 +115,39 @@ export function createModelRules() {
115
115
  return authoritative || modelIdentity(raw).provider ? raw : nativeSlug ?? catalogSlug ?? raw;
116
116
  }
117
117
 
118
- function nativeGptSortRank(rawValue) {
119
- const known = new Map([
120
- ["gpt-6-astra", 1], ["gpt-5.6-sol", 2], ["gpt-5.6-terra", 3], ["gpt-5.6-luna", 4],
121
- ["gpt-5.5", 5], ["gpt-5.4", 6], ["gpt-5.4-mini", 7], ["gpt-5.3-codex-spark", 8],
122
- ]);
123
- const raw = String(rawValue ?? "").trim();
124
- const knownRank = known.get(raw);
125
- if (knownRank != null) return { official: true, rank: knownRank };
126
- const identity = modelIdentity(raw);
127
- return identity.provider ? null : { official: true, rank: 100 };
118
+ function modelSortKey(rawValue, selector) {
119
+ const identity = modelIdentity(rawValue);
120
+ const backend = identity.backend.slice(identity.backend.lastIndexOf("/") + 1).toLowerCase();
121
+ // 厂商由模型本身识别,接入 provider 不参与分组。
122
+ const brand = selector.brands?.find(brand => brand.keywords.some(keyword =>
123
+ backend.includes(keyword.slice(keyword.lastIndexOf("/") + 1).toLowerCase())
124
+ ));
125
+ const group = /^gpt[-\s]/.test(backend) ? "openai"
126
+ : brand?.id ?? backend.split(/\d/)[0].replace(/[-._\s]+$/, "");
127
+ const tier = /^gpt[-\s]/.test(backend)
128
+ ? ["astra", "sol", "terra", "luna"].indexOf(backend.match(/(?:^|[-\s])(astra|sol|terra|luna)(?:$|[-\s])/)?.[1])
129
+ : -1;
130
+ // 点号与连字符版本都逐段比较,4-10 比 4-6 新。
131
+ const version = backend.match(/\d+(?:[._-]\d+)*/)?.[0].split(/[._-]/).map(Number) ?? [];
132
+ return { group, tier: tier < 0 ? 4 : tier, version };
133
+ }
134
+
135
+ function compareModelIds(left, right, selector) {
136
+ const a = modelSortKey(left, selector), b = modelSortKey(right, selector);
137
+ if (a.group !== b.group) {
138
+ const groups = ["openai", ...(selector.brands ?? []).map(brand => brand.id).filter(id => id !== "openai")];
139
+ const rank = group => { const index = groups.indexOf(group); return index < 0 ? groups.length : index; };
140
+ return rank(a.group) - rank(b.group) || a.group.localeCompare(b.group);
141
+ }
142
+ if (a.group === "openai") {
143
+ if (a.tier !== b.tier) return a.tier - b.tier;
144
+ }
145
+ if (Boolean(a.version.length) !== Boolean(b.version.length)) return a.version.length ? -1 : 1;
146
+ for (let index = 0; index < Math.max(a.version.length, b.version.length); index++) {
147
+ const difference = (b.version[index] ?? 0) - (a.version[index] ?? 0);
148
+ if (difference) return difference;
149
+ }
150
+ return 0;
128
151
  }
129
152
 
130
153
  function visibleControllerModels(controller) {
@@ -144,5 +167,5 @@ export function createModelRules() {
144
167
  );
145
168
  });
146
169
  }
147
- return { favoriteModelId, modelIdentity, formatIdentifier, providerLabel, compactModelLabel, brandForModel, comparableModelLabel, catalogModelFor, resolveModelAlias, modelWithOpenCodexEfforts, nativeGptSortRank, visibleControllerModels };
170
+ return { favoriteModelId, modelIdentity, formatIdentifier, providerLabel, compactModelLabel, brandForModel, comparableModelLabel, catalogModelFor, resolveModelAlias, modelWithOpenCodexEfforts, compareModelIds, visibleControllerModels };
148
171
  }
@@ -2,7 +2,7 @@
2
2
  export function installModelSlider(signal, { feature, ui, createIcon, requestRefresh, locale, codex, requestAction }, rules, createModelControllerAdapter) {
3
3
  const modelSelectorFeature = feature;
4
4
  const featureUI = ui, createMarkupIcon = createIcon, queueEnsure = requestRefresh;
5
- const { favoriteModelId, modelIdentity, formatIdentifier, providerLabel, compactModelLabel, brandForModel, comparableModelLabel, catalogModelFor, resolveModelAlias, modelWithOpenCodexEfforts, nativeGptSortRank, visibleControllerModels } = rules;
5
+ const { favoriteModelId, modelIdentity, formatIdentifier, providerLabel, compactModelLabel, brandForModel, comparableModelLabel, catalogModelFor, resolveModelAlias, modelWithOpenCodexEfforts, compareModelIds, visibleControllerModels } = rules;
6
6
  const modelSelectorOriginalToggleLabels = new Map();
7
7
  const modelSelectorGenericContainers = new Map();
8
8
  const modelSelectorNativeToggleHandlers = new Map();
@@ -649,15 +649,11 @@ export function installModelSlider(signal, { feature, ui, createIcon, requestRef
649
649
  }, 260);
650
650
  }
651
651
 
652
- function compareEnhancedModelItems(a, b, favorites) {
652
+ function compareEnhancedModelItems(a, b, favorites, selector) {
653
653
  const favA = Number(favorites.has(a.dataset.codexModelSliderRaw));
654
654
  const favB = Number(favorites.has(b.dataset.codexModelSliderRaw));
655
655
  if (favA !== favB) return favB - favA;
656
- const rankA = nativeGptSortRank(a.dataset.codexModelSliderRaw);
657
- const rankB = nativeGptSortRank(b.dataset.codexModelSliderRaw);
658
- if (Boolean(rankA) !== Boolean(rankB)) return rankA ? -1 : 1;
659
- if (rankA && rankB) return rankA.rank - rankB.rank;
660
- return 0;
656
+ return compareModelIds(a.dataset.codexModelSliderRaw, b.dataset.codexModelSliderRaw, selector);
661
657
  }
662
658
 
663
659
  function renderEnhancedModelMenu(menu, selector) {
@@ -683,7 +679,7 @@ export function installModelSlider(signal, { feature, ui, createIcon, requestRef
683
679
  const visible = items.filter((item) => item.style.display !== "none");
684
680
  const starred = visible.filter((item) => favorites.has(item.dataset.codexModelSliderRaw));
685
681
  const ordinary = visible.filter((item) => !favorites.has(item.dataset.codexModelSliderRaw));
686
- const desired = items.slice().sort((a, b) => compareEnhancedModelItems(a, b, favorites));
682
+ const desired = items.slice().sort((a, b) => compareEnhancedModelItems(a, b, favorites, selector));
687
683
  const parent = items[0].parentElement;
688
684
  if (!parent || !desired.every((item) => item.parentElement === parent)) return;
689
685
  const current = Array.from(parent.children).filter((child) => child.hasAttribute?.("data-codex-model-slider-item"));
@@ -1036,10 +1032,59 @@ export function installModelSlider(signal, { feature, ui, createIcon, requestRef
1036
1032
  record.motionTimer = setTimeout(onFinish, 320);
1037
1033
  }
1038
1034
 
1035
+ function prepareSelectedModelReveal(record) {
1036
+ const { menu } = record;
1037
+ const interaction = new AbortController();
1038
+ let frame = null;
1039
+ const cancel = () => {
1040
+ interaction.abort();
1041
+ if (frame !== null) cancelAnimationFrame(frame);
1042
+ frame = null;
1043
+ };
1044
+ for (const type of ["wheel", "touchstart", "pointerdown", "keydown", "input", "click"]) {
1045
+ document.addEventListener(type, cancel, { capture: true, passive: true, signal: interaction.signal });
1046
+ }
1047
+ menu.scrollTop = 0;
1048
+ return {
1049
+ cancel,
1050
+ finishOpening() {
1051
+ if (interaction.signal.aborted || !menu.isConnected) return;
1052
+ // 先呈现列表顶部,再在下一帧检查选中项;sticky 搜索栏不算可见内容区。
1053
+ frame = requestAnimationFrame(() => {
1054
+ const selected = menu.querySelector("[data-codex-model-slider-selected]");
1055
+ if (!selected) return cancel();
1056
+ const zoom = menu.currentCSSZoom || 1;
1057
+ const bounds = menu.getBoundingClientRect();
1058
+ const top = menu.querySelector("[data-codex-model-slider-search-header]").getBoundingClientRect().bottom;
1059
+ const bottom = bounds.bottom - (parseFloat(getComputedStyle(menu).paddingBottom) || 0) * zoom;
1060
+ const item = selected.getBoundingClientRect();
1061
+ if (item.top >= top && item.bottom <= bottom) return cancel();
1062
+ const from = menu.scrollTop;
1063
+ const to = Math.max(0, Math.min(menu.scrollHeight - menu.clientHeight,
1064
+ from + ((item.top + item.bottom - top - bottom) / 2) / zoom));
1065
+ if (matchMedia("(prefers-reduced-motion: reduce)").matches) {
1066
+ menu.scrollTop = to;
1067
+ return cancel();
1068
+ }
1069
+ const start = performance.now();
1070
+ const scroll = now => {
1071
+ if (!menu.isConnected) return cancel();
1072
+ const progress = Math.min(1, (now - start) / 400);
1073
+ menu.scrollTop = from + (to - from) * (1 - (1 - progress) ** 3);
1074
+ if (progress < 1) frame = requestAnimationFrame(scroll);
1075
+ else cancel();
1076
+ };
1077
+ frame = requestAnimationFrame(scroll);
1078
+ });
1079
+ },
1080
+ };
1081
+ }
1082
+
1039
1083
  function closeControllerModelMenu({ immediate = false } = {}) {
1040
1084
  const record = modelSelectorControllerMenu;
1041
1085
  if (!record) return false;
1042
1086
  if (record.closing && !immediate) return true;
1087
+ record.reveal?.cancel();
1043
1088
  const placeholder = document.querySelector(
1044
1089
  '[data-codex-intelligence-trigger] [class*="_ModelPickerTriggerPlaceholder_"]',
1045
1090
  );
@@ -1253,12 +1298,14 @@ export function installModelSlider(signal, { feature, ui, createIcon, requestRef
1253
1298
  search.focus({ preventScroll: true });
1254
1299
  const record = modelSelectorControllerMenu;
1255
1300
  record.listHeight = Number.parseFloat(getComputedStyle(menu).height);
1301
+ record.reveal = prepareSelectedModelReveal(record);
1256
1302
  animateControllerModelMenu(record, true, () => {
1257
1303
  if (modelSelectorControllerMenu !== record || record.closing) return;
1258
1304
  record.animations.forEach((animation) => animation.cancel());
1259
1305
  record.animations = [];
1260
1306
  menu.style.overflowY = "auto";
1261
1307
  sizeModelMenuViewport(menu, selector.maxVisibleItems);
1308
+ record.reveal.finishOpening();
1262
1309
  });
1263
1310
  }
1264
1311
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "minecodex",
3
- "version": "2.0.33",
3
+ "version": "2.0.35",
4
4
  "description": "Lightweight, local-first plugins for the Codex desktop app.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -21,6 +21,7 @@ const CONTENT_TYPES = new Map([
21
21
  [".js", "text/javascript; charset=utf-8"],
22
22
  [".mjs", "text/javascript; charset=utf-8"],
23
23
  [".svg", "image/svg+xml"],
24
+ [".ttf", "font/ttf"],
24
25
  [".json", "application/json; charset=utf-8"],
25
26
  [".mp4", "video/mp4"],
26
27
  [".webm", "video/webm"],
@@ -1,6 +1,6 @@
1
1
  import { readFile } from "node:fs/promises";
2
2
  import path from "node:path";
3
- const mime = { ".svg": "image/svg+xml" };
3
+ const mime = { ".svg": "image/svg+xml", ".ttf": "font/ttf" };
4
4
  export async function createAppHtml(packageRoot) {
5
5
  const directory = path.join(packageRoot, "apps/dashboard");
6
6
  let html = await readFile(path.join(directory, "index.html"), "utf8");