diff-chat 0.1.0__py3-none-any.whl

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 (91) hide show
  1. adapters/README.md +28 -0
  2. adapters/__init__.py +48 -0
  3. adapters/_base.py +102 -0
  4. adapters/_cli.py +405 -0
  5. adapters/claude.py +141 -0
  6. adapters/gemini.py +323 -0
  7. adapters/gpt.py +217 -0
  8. adapters/local.py +146 -0
  9. adapters/registry.py +33 -0
  10. api_fallback.py +189 -0
  11. app.py +827 -0
  12. app_preferences.py +205 -0
  13. archive_schema.py +142 -0
  14. attachments.py +129 -0
  15. chat_titles.py +60 -0
  16. connection_handoff.py +64 -0
  17. context_engine.py +256 -0
  18. conversation_actions.py +160 -0
  19. diff_chat-0.1.0.dist-info/METADATA +101 -0
  20. diff_chat-0.1.0.dist-info/RECORD +91 -0
  21. diff_chat-0.1.0.dist-info/WHEEL +4 -0
  22. diff_chat-0.1.0.dist-info/entry_points.txt +2 -0
  23. diff_chat-0.1.0.dist-info/licenses/LICENSE +21 -0
  24. diff_chat_assets/memory.example.md +1 -0
  25. diff_chat_assets/prompts/about_you_export.md +19 -0
  26. diff_chat_assets/settings.json +6 -0
  27. diff_chat_assets/static/about-you-parser.js +46 -0
  28. diff_chat_assets/static/about-you.js +171 -0
  29. diff_chat_assets/static/actions.css +275 -0
  30. diff_chat_assets/static/actions.js +650 -0
  31. diff_chat_assets/static/app.css +345 -0
  32. diff_chat_assets/static/app.js +1344 -0
  33. diff_chat_assets/static/attachments.js +80 -0
  34. diff_chat_assets/static/brand/favicon-32.png +0 -0
  35. diff_chat_assets/static/brand/icon.svg +11 -0
  36. diff_chat_assets/static/brand/wordmark-dark.svg +15 -0
  37. diff_chat_assets/static/brand/wordmark-light.svg +13 -0
  38. diff_chat_assets/static/characters/CREDITS.md +7 -0
  39. diff_chat_assets/static/characters/characters.css +37 -0
  40. diff_chat_assets/static/characters/claude.json +507 -0
  41. diff_chat_assets/static/characters/claude.png +0 -0
  42. diff_chat_assets/static/characters/claude.webp +0 -0
  43. diff_chat_assets/static/characters/gemini.json +54 -0
  44. diff_chat_assets/static/characters/gemini.png +0 -0
  45. diff_chat_assets/static/characters/gemini.webp +0 -0
  46. diff_chat_assets/static/characters/gpt.json +507 -0
  47. diff_chat_assets/static/characters/gpt.png +0 -0
  48. diff_chat_assets/static/characters/gpt.webp +0 -0
  49. diff_chat_assets/static/characters/local.json +387 -0
  50. diff_chat_assets/static/characters/local.png +0 -0
  51. diff_chat_assets/static/characters/local.webp +0 -0
  52. diff_chat_assets/static/characters/player.js +318 -0
  53. diff_chat_assets/static/chat-filing.js +84 -0
  54. diff_chat_assets/static/controls.js +194 -0
  55. diff_chat_assets/static/corners.css +59 -0
  56. diff_chat_assets/static/craft.css +246 -0
  57. diff_chat_assets/static/drafts.js +41 -0
  58. diff_chat_assets/static/index.html +208 -0
  59. diff_chat_assets/static/library.css +30 -0
  60. diff_chat_assets/static/library.js +181 -0
  61. diff_chat_assets/static/memory.js +81 -0
  62. diff_chat_assets/static/preference-dialog.js +21 -0
  63. diff_chat_assets/static/preferences.css +56 -0
  64. diff_chat_assets/static/session.js +46 -0
  65. diff_chat_assets/static/settings.css +111 -0
  66. diff_chat_assets/static/settings.js +463 -0
  67. diff_chat_assets/static/setup.js +238 -0
  68. diff_chat_assets/static/utility.js +64 -0
  69. diff_chat_assets/static/vendor/LICENSES.txt +531 -0
  70. diff_chat_assets/static/vendor/highlight.min.js +1262 -0
  71. diff_chat_assets/static/vendor/markdown-it.min.js +13 -0
  72. diff_chat_assets/static/vendor/plex-mono.woff2 +0 -0
  73. diff_chat_assets/static/vendor/plex-sans.woff2 +0 -0
  74. diff_launcher.py +93 -0
  75. discussion.py +239 -0
  76. history_search.py +68 -0
  77. library_manager.py +251 -0
  78. model_options.py +132 -0
  79. plan_usage.py +72 -0
  80. private_store.py +71 -0
  81. probe.py +195 -0
  82. runtime_paths.py +195 -0
  83. server_security.py +100 -0
  84. setup_status.py +123 -0
  85. shared_memory.py +189 -0
  86. storage.py +185 -0
  87. usage_budget.py +77 -0
  88. usage_claude.py +110 -0
  89. usage_codex.py +170 -0
  90. usage_gemini.py +70 -0
  91. utility_models.py +104 -0
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+
3
+ (() => {
4
+ const dialog=element("dialog","filing-dialog");
5
+ const title=element("h2"), description=element("p"), field=element("input");
6
+ title.id="filing-heading";dialog.setAttribute("aria-labelledby",title.id);
7
+ const actions=element("div","dialog-actions"), cancel=element("button","","Cancel"), okay=element("button","settings-action");
8
+ cancel.type=okay.type="button";actions.append(cancel,okay);dialog.append(title,description,field,actions);document.body.append(dialog);
9
+ cancel.onclick=()=>dialog.close("cancel");okay.onclick=()=>dialog.close("accept");
10
+ field.onkeydown=e=>{if(e.key==="Enter"&&!e.isComposing&&!okay.disabled){e.preventDefault();okay.click();}};
11
+ function ask(label, text, action, mode, initial="") {
12
+ if(dialog.open)return Promise.resolve(null);
13
+ title.textContent=label;description.textContent=text;description.hidden=!text;okay.textContent=action;
14
+ field.hidden=mode==="none";field.value=mode==="edit"?initial:"";field.setAttribute("aria-label",label);
15
+ const check=()=>{okay.disabled=mode==="confirm"?field.value!==initial:mode==="edit"?!field.value.trim():false;};
16
+ field.oninput=check;check();dialog.returnValue="cancel";dialog.showModal();
17
+ if(field.hidden)cancel.focus();else{field.focus();field.select();}
18
+ return new Promise(resolve=>dialog.addEventListener("close",()=>resolve(dialog.returnValue==="accept"?(mode==="edit"?field.value.trim():true):null),{once:true}));
19
+ }
20
+ window.diffConfirm=(label,text,action,typed)=>ask(label,text,action,typed?"confirm":"none",typed);
21
+ window.checkUsageBudget=async providers=>{
22
+ if(!window.diffSettings?.usage_warning)return true;
23
+ try {
24
+ const data=await api("/api/usage/estimate",{replies:providers.filter(p=>models.includes(p))});
25
+ if(!data.warnings.length)return true;
26
+ const text=data.warnings.map(item=>item.remaining===0?`${names[item.provider]} has no 5-hour plan allowance remaining.`:
27
+ `${names[item.provider]} may use about ${number.format(item.fraction)}% of its remaining 5-hour allowance, based on recent replies.`).join(" ");
28
+ return Boolean(await window.diffConfirm("Continue this action?",text,"Continue"));
29
+ } catch(error) {feedback("Usage estimate unavailable. "+error.message);return true;}
30
+ };
31
+
32
+ const menu=element("div","chat-menu"); menu.setAttribute("popover","auto");menu.setAttribute("role","menu");menu.setAttribute("aria-label","Chat actions");document.body.append(menu);
33
+ let previous,toastTimer;
34
+ function report(error){feedback(error.message);}
35
+ async function update(item,change) {
36
+ const updated=await api("/api/chats/"+item.id+"/details",change,"PATCH");
37
+ if(chat?.id===item.id) {chat=updated;renderTranscript();}
38
+ await window.refreshDiffLibrary();
39
+ }
40
+ function notice(item,token) {
41
+ document.querySelector(".filing-toast")?.remove();clearTimeout(toastTimer);
42
+ const toast=element("div","filing-toast");toast.setAttribute("role","status");toast.append("Chat deleted");
43
+ const undo=element("button","quiet-button","Undo");undo.type="button";toast.append(undo);document.body.append(toast);
44
+ toastTimer=setTimeout(()=>toast.remove(),5000);
45
+ undo.onclick=async()=>{
46
+ clearTimeout(toastTimer);toast.remove();
47
+ try{await api("/api/chats/"+item.id+"/restore",{token});await openChat(item.id);}catch(error){report(error);}
48
+ };
49
+ }
50
+ function show(anchor,item,x,y) {
51
+ if(menu.matches(":popover-open"))menu.hidePopover();
52
+ previous=anchor;anchor.setAttribute("aria-expanded","true");menu.replaceChildren();
53
+ const entries=[
54
+ ["Rename",async()=>{const title=await ask("Rename chat","","Rename","edit",item.title);if(title)await update(item,{title});}],
55
+ [item.pinned?"Unpin":"Pin",()=>update(item,{pinned:!item.pinned})],
56
+ ["Delete",async()=>{const result=await api("/api/chats/"+item.id+"/delete",{});notice(item,result.token);if(chat?.id===item.id)await openChat();else await window.refreshDiffLibrary();}],
57
+ ];
58
+ for(const [name,run] of entries) {
59
+ const b=element("button","",name);b.type="button";b.setAttribute("role","menuitem");
60
+ b.onclick=async()=>{menu.hidePopover();try{await run();}catch(error){report(error);}};menu.append(b);
61
+ }
62
+ menu.showPopover();
63
+ const rect=anchor.getBoundingClientRect();
64
+ const left=Math.min(x??rect.left,window.innerWidth-menu.offsetWidth-8);
65
+ const top=Math.max(4,Math.min(y??rect.bottom,window.innerHeight-menu.offsetHeight-8));
66
+ menu.style.left=Math.max(4,left)+"px";menu.style.top=top+"px";menu.firstElementChild.focus();
67
+ }
68
+ menu.addEventListener("toggle",()=>{if(!menu.matches(":popover-open"))previous?.setAttribute("aria-expanded","false");});
69
+ menu.onkeydown=e=>{
70
+ const items=[...menu.children];let i=items.indexOf(document.activeElement);
71
+ if(e.key==="ArrowDown")i=(i+1)%items.length;else if(e.key==="ArrowUp")i=(i-1+items.length)%items.length;
72
+ else if(e.key==="Home")i=0;else if(e.key==="End")i=items.length-1;else if(e.key==="Escape"){menu.hidePopover();previous?.focus();return;}else return;
73
+ e.preventDefault();items[i].focus();
74
+ };
75
+ window.addChatMenu=(row,item)=>{
76
+ if(item.chars<0)return;
77
+ const button=element("button","chat-menu-button");
78
+ button.type="button";button.setAttribute("aria-label","Actions for "+item.title);button.setAttribute("aria-haspopup","menu");button.setAttribute("aria-expanded","false");
79
+ button.innerHTML='<svg class="icon" aria-hidden="true"><use href="#i-more"/></svg>';
80
+ button.onclick=e=>{e.stopPropagation();show(button,item);};
81
+ row.oncontextmenu=e=>{e.preventDefault();show(button,item,e.clientX,e.clientY);};row.append(button);
82
+ };
83
+ renderChatList();
84
+ })();
@@ -0,0 +1,194 @@
1
+ "use strict";
2
+
3
+ window.diffIcon = function(name) {
4
+ const ns = "http://www.w3.org/2000/svg";
5
+ const icon = document.createElementNS(ns, "svg");
6
+ const use = document.createElementNS(ns, "use");
7
+ icon.setAttribute("class", "icon");
8
+ icon.setAttribute("aria-hidden", "true");
9
+ use.setAttribute("href", "#i-" + name);
10
+ icon.append(use);
11
+ return icon;
12
+ };
13
+
14
+ (() => {
15
+ const triggers = new WeakMap();
16
+ let active = null;
17
+ let sequence = 0;
18
+ let typed = "";
19
+ let lastKey = 0;
20
+
21
+ function sync(select) {
22
+ const trigger = triggers.get(select);
23
+ if (!trigger) return;
24
+ const value = select.selectedOptions[0]?.text || "Choose…";
25
+ const explicit = select.getAttribute("aria-label");
26
+ const labelNode = select.labels?.[0];
27
+ const label = explicit || (labelNode?.firstChild?.textContent || "").trim();
28
+ trigger.setAttribute("aria-label", label ? label + ", " + value : value);
29
+ trigger.firstChild.textContent = value;
30
+ trigger.disabled = select.disabled || select.matches(":disabled");
31
+ if (active?.select === select) close(false);
32
+ }
33
+
34
+ function close(focus) {
35
+ if (!active) return;
36
+ const {trigger, menu} = active;
37
+ active = null;
38
+ typed = "";
39
+ trigger.setAttribute("aria-expanded", "false");
40
+ trigger.removeAttribute("aria-controls");
41
+ menu.remove();
42
+ if (focus && trigger.isConnected) trigger.focus({preventScroll:true});
43
+ }
44
+
45
+ function move(index) {
46
+ if (!active?.items.length) return;
47
+ const count = active.items.length;
48
+ active.index = (index + count) % count;
49
+ const option = active.items[active.index];
50
+ option.focus({preventScroll:true});
51
+ option.scrollIntoView({block:"nearest"});
52
+ }
53
+
54
+ function choose(option) {
55
+ const {select, trigger} = active;
56
+ const changed = select.value !== option.value;
57
+ select.value = option.value;
58
+ close(false);
59
+ if (changed) {
60
+ select.dispatchEvent(new Event("input", {bubbles:true}));
61
+ select.dispatchEvent(new Event("change", {bubbles:true}));
62
+ }
63
+ sync(select);
64
+ if (trigger.isConnected) trigger.focus({preventScroll:true});
65
+ }
66
+
67
+ function position() {
68
+ if (!active) return;
69
+ const {trigger, menu} = active;
70
+ const rect = trigger.getBoundingClientRect();
71
+ if (!trigger.isConnected || !rect.width) { close(false); return; }
72
+ const gutter = 8;
73
+ menu.style.minWidth = Math.min(rect.width, innerWidth - gutter*2) + "px";
74
+ const below = innerHeight - rect.bottom - gutter;
75
+ const above = rect.top - gutter;
76
+ const up = menu.scrollHeight > below && above > below;
77
+ menu.style.maxHeight = Math.min(320, Math.max(40, up ? above - 4 : below - 4)) + "px";
78
+ menu.style.left = Math.max(gutter, Math.min(rect.right - menu.offsetWidth, innerWidth - menu.offsetWidth - gutter)) + "px";
79
+ menu.style.top = (up ? Math.max(gutter, rect.top - 4 - menu.offsetHeight) : rect.bottom + 4) + "px";
80
+ }
81
+
82
+ function open(select, direction = 0) {
83
+ const trigger = triggers.get(select);
84
+ if (trigger.disabled) return;
85
+ if (active?.trigger === trigger) {close(true); return;}
86
+ close(false);
87
+ const menu = document.createElement("div");
88
+ menu.className = "select-popover";
89
+ menu.id = "select-options-" + (++sequence);
90
+ menu.popover = "manual";
91
+ menu.setAttribute("role", "listbox");
92
+ menu.setAttribute("aria-label", trigger.getAttribute("aria-label"));
93
+ const items = [];
94
+ for (const option of select.options) {
95
+ const row = document.createElement("button");
96
+ row.type = "button";
97
+ row.tabIndex = -1;
98
+ row.setAttribute("role", "option");
99
+ row.setAttribute("aria-selected", String(option.selected));
100
+ row.disabled = option.disabled || Boolean(option.parentElement?.disabled && option.parentElement.tagName === "OPTGROUP");
101
+ row.append(document.createTextNode(option.text));
102
+ if (option.selected) row.append(window.diffIcon("check"));
103
+ row.addEventListener("click", () => choose(option));
104
+ if (!row.disabled) items.push(row);
105
+ menu.append(row);
106
+ }
107
+ if (!items.length) return;
108
+ trigger.after(menu);
109
+ menu.showPopover();
110
+ trigger.setAttribute("aria-controls", menu.id);
111
+ trigger.setAttribute("aria-expanded", "true");
112
+ active = {select, trigger, menu, items, index:0};
113
+ position();
114
+ const selected = items.findIndex(o => o.getAttribute("aria-selected") === "true");
115
+ move(selected >= 0 ? selected : direction < 0 ? items.length - 1 : 0);
116
+ menu.addEventListener("keydown", event => {
117
+ if (!active) return;
118
+ const {index} = active;
119
+ if (event.key === "ArrowDown") move(index + 1);
120
+ else if (event.key === "ArrowUp") move(index - 1);
121
+ else if (event.key === "Home") move(0);
122
+ else if (event.key === "End") move(items.length - 1);
123
+ else if (event.key === "Escape") close(true);
124
+ else if (event.key === "Tab") {close(true); return;}
125
+ else if (event.key === " " || event.key === "Enter") items[index].click();
126
+ else if (event.key.length === 1 && !event.ctrlKey && !event.metaKey && !event.altKey) {
127
+ const now = performance.now();
128
+ typed = (now - lastKey > 650 ? "" : typed) + event.key.toLowerCase();
129
+ lastKey = now;
130
+ const query = [...typed].every(c => c === typed[0]) ? typed[0] : typed;
131
+ for (let step = 1; step <= items.length; step++) {
132
+ const candidate = (index + step) % items.length;
133
+ if (items[candidate].textContent.toLowerCase().startsWith(query)) {move(candidate); break;}
134
+ }
135
+ } else return;
136
+ event.preventDefault();
137
+ event.stopPropagation();
138
+ });
139
+ }
140
+
141
+ function upgrade(select) {
142
+ if (triggers.has(select) || select.multiple || select.size > 1) return;
143
+ const trigger = document.createElement("button");
144
+ trigger.type = "button";
145
+ trigger.className = "select-trigger";
146
+ trigger.setAttribute("role", "combobox");
147
+ trigger.setAttribute("aria-haspopup", "listbox");
148
+ trigger.setAttribute("aria-expanded", "false");
149
+ trigger.append(document.createElement("span"), window.diffIcon("chevron"));
150
+ select.hidden = true;
151
+ select.after(trigger);
152
+ triggers.set(select, trigger);
153
+ sync(select);
154
+ trigger.addEventListener("click", () => open(select));
155
+ trigger.addEventListener("keydown", e => {
156
+ if (["ArrowDown","ArrowUp","Home","End"].includes(e.key)) {
157
+ e.preventDefault();
158
+ open(select, e.key === "ArrowUp" ? -1 : 1);
159
+ if (e.key === "Home" || e.key === "End") move(e.key === "Home" ? 0 : -1);
160
+ } else if (e.key.length === 1 && e.key !== " " && !e.metaKey && !e.ctrlKey && !e.altKey) {
161
+ e.preventDefault(); open(select);
162
+ active?.menu.dispatchEvent(new KeyboardEvent("keydown", {key:e.key, bubbles:true}));
163
+ }
164
+ });
165
+ select.addEventListener("change", () => sync(select));
166
+ select.addEventListener("diff-select-sync", () => sync(select));
167
+ }
168
+ const sizes = new ResizeObserver(changes => {
169
+ for (const {target} of changes) target.classList.toggle("fades", target.scrollWidth > target.clientWidth + 1);
170
+ });
171
+ function discover(root) {
172
+ if (!(root instanceof Element)) return;
173
+ if (root.matches("select")) upgrade(root);
174
+ root.querySelectorAll("select").forEach(upgrade);
175
+ if (root.matches(".list-name,#chat-title")) sizes.observe(root);
176
+ root.querySelectorAll(".list-name,#chat-title").forEach(node => sizes.observe(node));
177
+ }
178
+ discover(document.body);
179
+ new MutationObserver(records => {
180
+ for (const record of records) {
181
+ const select = record.target.closest?.("select");
182
+ if (select) sync(select);
183
+ for (const node of record.addedNodes) discover(node);
184
+ if (record.target.id === "chat-title") record.target.classList.toggle("fades", record.target.scrollWidth > record.target.clientWidth + 1);
185
+ }
186
+ if (active && !active.trigger.isConnected) close(false);
187
+ }).observe(document.body, {childList:true, subtree:true, attributes:true, attributeFilter:["disabled","selected","aria-label"]});
188
+ document.addEventListener("pointerdown", e => {
189
+ if (active && !active.menu.contains(e.target) && !active.trigger.contains(e.target)) close(false);
190
+ }, true);
191
+ document.addEventListener("scroll", e => { if (active && !active.menu.contains(e.target)) position(); }, true);
192
+ window.addEventListener("resize", position);
193
+ document.addEventListener("close", () => close(false), true);
194
+ })();
@@ -0,0 +1,59 @@
1
+ /* Each surface supplies its design radius. At 60% smoothing the curve meets
2
+ each straight edge 1.6 radii from the corner and retains a 36° circular arc. */
3
+ :where(button, select, textarea, .role-custom, .settings-pane input:not([type=checkbox]),
4
+ .filing-dialog input, .history-search input, .settings-action, kbd, #search-shortcut,
5
+ dialog, #compose-form, .message.me, .message.combined, .attachment-chip, .message-tools,
6
+ .diff-summary, .combine-popover, .command-options, .select-popover, .chat-menu,
7
+ .connection-command, .settings-inset, .filing-toast, .code-block, .prose :not(pre) > code) {
8
+ --corner-radius: 0px;
9
+ border-radius: var(--corner-radius);
10
+
11
+ /* A short edge can accommodate at most half its length per corner. */
12
+ --curve-radius: min(var(--corner-radius), 31.25%);
13
+ --reach: calc(1.6 * var(--curve-radius));
14
+ --a: calc(.5600525 * var(--curve-radius));
15
+ --ab: calc(.8400788 * var(--curve-radius));
16
+ --c: calc(.2139117 * var(--curve-radius));
17
+ --bc: calc(.4939380 * var(--curve-radius));
18
+ --long: calc(1.0539905 * var(--curve-radius));
19
+ --short: calc(.1089935 * var(--curve-radius));
20
+ --step: calc(.4370160 * var(--curve-radius));
21
+ --corner-edges:
22
+ hline to calc(100% - var(--reach)),
23
+ curve by var(--long) var(--short) with var(--a) 0 from start / var(--ab) 0 from start,
24
+ arc by var(--step) var(--step) of var(--curve-radius) var(--curve-radius) cw,
25
+ curve by var(--short) var(--long) with var(--short) var(--c) from start / var(--short) var(--bc) from start,
26
+ vline to calc(100% - var(--reach)),
27
+ curve by calc(-1 * var(--short)) var(--long) with 0 var(--a) from start / 0 var(--ab) from start,
28
+ arc by calc(-1 * var(--step)) var(--step) of var(--curve-radius) var(--curve-radius) cw,
29
+ curve by calc(-1 * var(--long)) var(--short) with calc(-1 * var(--c)) var(--short) from start / calc(-1 * var(--bc)) var(--short) from start,
30
+ hline to var(--reach),
31
+ curve by calc(-1 * var(--long)) calc(-1 * var(--short)) with calc(-1 * var(--a)) 0 from start / calc(-1 * var(--ab)) 0 from start,
32
+ arc by calc(-1 * var(--step)) calc(-1 * var(--step)) of var(--curve-radius) var(--curve-radius) cw,
33
+ curve by calc(-1 * var(--short)) calc(-1 * var(--long)) with calc(-1 * var(--short)) calc(-1 * var(--c)) from start / calc(-1 * var(--short)) calc(-1 * var(--bc)) from start,
34
+ vline to var(--reach),
35
+ curve by var(--short) calc(-1 * var(--long)) with 0 calc(-1 * var(--a)) from start / 0 calc(-1 * var(--ab)) from start,
36
+ arc by var(--step) calc(-1 * var(--step)) of var(--curve-radius) var(--curve-radius) cw,
37
+ curve by var(--long) calc(-1 * var(--short)) with var(--c) calc(-1 * var(--short)) from start / var(--bc) calc(-1 * var(--short)) from start,
38
+ close;
39
+
40
+ @supports (corner-shape: superellipse(1.8205)) {
41
+ /* A native superellipse fitted to the same curve for engines without border-shape.
42
+ Maximum radial deviation is under 0.18 CSS px at a 16px design radius. */
43
+ corner-shape: superellipse(1.8205);
44
+ border-radius: calc(1.6 * var(--corner-radius));
45
+ }
46
+
47
+ @supports (border-shape: shape(from 0 0, line to 1px 1px, close)) {
48
+ border-shape: shape(from var(--reach) 0, var(--corner-edges));
49
+ }
50
+ @supports not (corner-shape: superellipse(1.8205)) {
51
+ @supports (clip-path: shape(evenodd from 0 0, hline to 100%, close)) {
52
+ /* Cut only the four corner wedges. The exterior stays open for menus and focus rings. */
53
+ clip-path: shape(evenodd from -100vmax -100vmax, hline to calc(100% + 100vmax),
54
+ vline to calc(100% + 100vmax), hline to -100vmax, close,
55
+ move to 0 0, hline to 100%, vline to 100%, hline to 0, close,
56
+ move to var(--reach) 0, var(--corner-edges));
57
+ }
58
+ }
59
+ }
@@ -0,0 +1,246 @@
1
+ :root {
2
+ --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
3
+ --paper: light-dark(#fdfdfc, #1c1d1f);
4
+ --reading-width: 736px;
5
+ --gutter: 32px;
6
+ --inspector-size: clamp(264px, 19vw, 296px);
7
+ --bold-weight: 600;
8
+ font-variant-numeric: tabular-nums;
9
+ }
10
+ body, button, input, textarea, select, time, progress { font-variant-numeric: tabular-nums; }
11
+ body { font-size: 13px; line-height: 1.5; }
12
+ :root:is([data-theme="dark"], [data-theme="codex"]) { --bold-weight: 500; }
13
+ @media (prefers-color-scheme: dark) {
14
+ :root:not([data-theme="light"]) { --bold-weight: 500; }
15
+ }
16
+ b, strong, th { font-weight: var(--bold-weight); }
17
+ button, input { font-family: var(--ui); }
18
+ button, summary, a { transition: color 120ms ease-out, background-color 120ms ease-out; }
19
+ button { gap: 8px; padding: 4px 8px; --corner-radius: 8px; font-size: 13px; }
20
+ button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--muted); outline-offset: 2px; }
21
+ summary { cursor: pointer; }
22
+ summary:hover, .prose a:hover, .settings-pane a:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
23
+ .icon, .send .icon, .message-tools .icon { width: 16px; height: 16px; stroke-width: 1.5; color: var(--muted); }
24
+ .send .icon { color: currentColor; }
25
+ .workspace { border: 0; }
26
+ .header {
27
+ min-height: 76px; border: 0; padding-right: 20px;
28
+ padding-left: max(var(--gutter), calc((100% - var(--visible-inspector, 0px) - var(--reading-width)) / 2));
29
+ }
30
+ @media (min-width: 1101px) {
31
+ .workspace:has(.stage.inspector-open) { --visible-inspector: var(--inspector-size); }
32
+ }
33
+ #chat-title { font: 500 20px/1.4 var(--ui); letter-spacing: -.035em; text-overflow: clip; }
34
+ .list-name { text-overflow: clip; }
35
+ .fades { mask-image: linear-gradient(to right, black calc(100% - 20px), transparent); }
36
+ .column { width: min(var(--reading-width), calc(100% - 2 * var(--gutter))); }
37
+ #reader {
38
+ mask-image: linear-gradient(to bottom, transparent, black 24px);
39
+ scroll-padding-block-start: 24px;
40
+ }
41
+ .transcript { padding-block: 28px 40px; }
42
+ .library-head { min-height: 76px; padding: 20px 16px 16px 24px; }
43
+ .wordmark { width: 96px; height: 24px; }
44
+ .new-chat { padding: 8px 12px; margin-inline: 12px; gap: 12px; font-size: 13px; }
45
+ #chat-list { padding: 28px 12px 16px; }
46
+ .chat-link { padding: 8px 12px; font-size: 13px; }
47
+ .chat-link[aria-current="page"] { background: color-mix(in srgb, var(--selected) 78%, var(--library)); }
48
+ .list-group + .list-group { margin-top: 24px; }
49
+ .list-heading { margin: 0 0 8px; padding: 0 12px; }
50
+ .library-foot { border: 0; margin: 4px 12px 0; padding: 4px 0 max(12px,env(safe-area-inset-bottom)); }
51
+ #export-chat { margin-bottom: 0; }
52
+ #search-shortcut, kbd {
53
+ padding: 0 4px; border: 1px solid var(--edge); --corner-radius: 4px;
54
+ color: var(--muted); background: var(--surface); font: 400 11px/16px var(--mono);
55
+ }
56
+ #chat-stats, .list-heading, .list-time, .speaker, .stamp, .elapsed, .reply-choice, .reply-workflow,
57
+ .round-stamp, .composer-meta, .usage-asof, .usage-reset, .percentage, .code-tools, .source-label,
58
+ .summary-marker, .outcome-head, .outcome-head strong, .plan-head h4 {
59
+ font: 400 11px/16px var(--mono); text-transform: uppercase; letter-spacing: .045em;
60
+ font-variant-numeric: tabular-nums;
61
+ }
62
+ #chat-stats { margin-top: 4px; }
63
+ .byline { align-items: center; gap: 4px 12px; }
64
+ .message .speaker { font-weight: 500; letter-spacing: .06em; gap: 8px; }
65
+ .message[data-participant] .speaker { color: var(--model); }
66
+ #entries { gap: 32px; }
67
+ article.message { padding-block: 0; }
68
+ .message.me { --corner-radius: 8px; padding: 12px 16px; }
69
+ .message.me .prose { margin-top: 4px; }
70
+ .prose, :root[data-font] .prose, :root[data-theme="codex"][data-font="theme"] .prose,
71
+ .discussion-outcome p, .prose :is(h1,h2,h3,h4,h5,h6), .empty {
72
+ font: 400 15px/1.6 var(--sans);
73
+ }
74
+ .prose { margin-top: 8px; }
75
+ .prose :is(h1,h2,h3,h4,h5,h6) { font-weight: var(--bold-weight); margin: 16px 0 4px; }
76
+ .prose :is(h1,h2,h3,h4,h5,h6):first-child { margin-top: 0; }
77
+ .prose :is(p,ul,ol,blockquote,.code-block,.table-scroll) { margin-bottom: 12px; }
78
+ .prose li + li, .prose li > p { margin-top: 4px; }
79
+ .prose ul, .prose ol { padding-left: 24px; }
80
+ .prose :last-child { margin-bottom: 0; }
81
+ .prose .hljs-keyword, .prose .hljs-literal, .prose .hljs-title, .prose .hljs-selector-tag { font-weight: 500; }
82
+ .prose .hljs-strong, .prose th { font-weight: var(--bold-weight); }
83
+ .code-block { border: 0; --corner-radius: 8px; }
84
+ .code-tools { padding: 8px 12px 0; }
85
+ .code-block pre { padding: 4px 12px 12px; }
86
+ .table-scroll :is(th,td) { padding: 8px 12px; }
87
+ .sources { gap: 4px 8px; margin-top: 8px; font-size: 13px; }
88
+ .discussion-outcome { border: 0; padding: 12px 0 0; }
89
+ .discussion-outcome p { margin: 8px 0 0; }
90
+ .outcome-head { color: var(--muted); gap: 4px 8px; }
91
+ .summary-marker::after { content: none; }
92
+ .empty { color: var(--muted); letter-spacing: 0; }
93
+ .composer { padding: 12px 0 max(16px,env(safe-area-inset-bottom)); }
94
+ #compose-form { padding: 12px; --corner-radius: 12px; background: var(--surface); transition: border-color 150ms ease-out; }
95
+ #compose-form:is(:focus-within,:has(textarea:focus-visible),.dragging) { border-color: var(--muted); box-shadow: none; }
96
+ #compose-form.dragging { background: var(--inset); }
97
+ #draft { min-height: 44px; padding: 4px; --corner-radius: 4px; font: 400 15px/24px var(--sans); }
98
+ #draft::placeholder { color: var(--muted); }
99
+ .compose-toolbar { column-gap: 8px; row-gap: 4px; margin-top: 8px; }
100
+ .participants-tools, .submit-tools { gap: 4px; }
101
+ .model-toggle { padding: 4px 8px; gap: 8px; }
102
+ .model-toggle[aria-pressed="true"] { color: var(--model); background: color-mix(in srgb, var(--model-fill) 8%, var(--surface)); }
103
+ .model-toggle[aria-pressed="true"]:hover { background: color-mix(in srgb, var(--model-fill) 16%, var(--surface)); }
104
+ .submit-tools .send { --corner-radius: 8px; padding: 4px 12px; }
105
+ #send { background: #1c1b19; color: #fdfcf8; border: 1px solid light-dark(transparent, #6b6964); }
106
+ #send:enabled:hover { background: #353330; }
107
+ #send:disabled { opacity: .35; }
108
+ .elapsed { text-transform: none; }
109
+ .key-hint { margin-left: auto; }
110
+ .model-section-head { list-style:none; min-height:32px; }
111
+ .model-section-head::-webkit-details-marker { display:none; }
112
+ .model-section-head:hover { text-decoration:none; background:var(--inset); }
113
+ .model-section-head > .icon { width:14px; height:14px; transform:rotate(-90deg); }
114
+ .model-section[open] > .model-section-head > .icon { transform:none; }
115
+ .model-section:not([open]) { padding-block:8px; }
116
+ .model-section:not([open]) > .model-section-head { margin-bottom:0; }
117
+ .compose-toolbar { flex-wrap:wrap; }
118
+ .participants-tools { flex-wrap:wrap; }
119
+ @container (max-width: 450px) {
120
+ .participants-tools:has(.model-toggle:nth-child(3)) {
121
+ order:-1; flex:1 0 100%; min-width:0; flex-wrap:nowrap; overflow-x:auto; scrollbar-width:thin;
122
+ }
123
+ .participants-tools .model-toggle { flex:none; }
124
+ .participants-tools .model-toggle { padding-inline:4px; gap:4px; }
125
+ }
126
+ .composer-meta { margin-top: 4px; padding: 4px 0 0; min-height: 20px; }
127
+ #attach-files { width: 32px; min-height: 32px; padding: 8px; }
128
+ .attachment-tray, .message-attachments { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 8px; }
129
+ .message-attachments { margin: 8px 0 4px; }
130
+ .attachment-chip { max-width: 100%; display: inline-flex; align-items: center; gap: 4px; padding: 4px 8px; --corner-radius: 8px; background: var(--inset); color: var(--secondary); font-size: 13px; }
131
+ .attachment-chip > span { overflow-wrap: anywhere; }
132
+ .attachment-chip button { padding: 0; }
133
+ .inspector { flex-basis: var(--inspector-size); padding: 0 20px; border: 0; }
134
+ .inspector-toolbar { position: sticky; top: 0; z-index: 1; background: var(--library); }
135
+ .inspector-head { border: 0; padding: 16px 0 12px; }
136
+ .inspector h2, .inspector h3 { font-size: 13px; font-weight: 500; letter-spacing: 0; }
137
+ .quiet-button, .usage-caption, .usage-note, .catalog-detail { font-size: 13px; }
138
+ .model-section { padding: 20px 0 8px; }
139
+ .model-section + .model-section, .inspector-foot, .search-setting, .inspector-links { border: 0; }
140
+ .model-section-head { margin-bottom: 8px; gap: 12px; }
141
+ .model-section-head h3, .settings-group[data-participant] > h4, .connection-row h3 { color: var(--model); }
142
+ .model-field { grid-template-columns: minmax(60px,.75fr) minmax(0,1.6fr); gap: 4px; min-height: 32px; }
143
+ .account-usage { margin-top: 16px; }
144
+ .usage-window { margin-top: 8px; }
145
+ .usage-reset { margin-top: 4px; }
146
+ .usage-bar { height: 3px; margin-top: 4px; color: var(--model-fill,var(--secondary)); border-radius: 3px; }
147
+ .usage-bar::-webkit-progress-bar { background: var(--rule); border-radius: 3px; }
148
+ .usage-bar::-webkit-progress-value { background: var(--model-fill,var(--secondary)); border-radius: 3px; }
149
+ .usage-bar::-moz-progress-bar { background: var(--model-fill,var(--secondary)); border-radius: 3px; }
150
+ .inspector-links { padding: 16px 0 0; }
151
+ .inspector-foot { padding: 4px 0 12px; }
152
+ .participant-switch { gap: 8px; }
153
+ .track, input[type="checkbox"]:not([hidden]) {
154
+ appearance: none; display: inline-block; flex: none; width: 28px; height: 16px;
155
+ position: relative; border-radius: 12px; border: 1px solid var(--edge); background: var(--inset);
156
+ transition: background-color 150ms ease-out, border-color 150ms ease-out;
157
+ }
158
+ input[type="checkbox"]:not([hidden]) { cursor: pointer; padding: 0; margin: 0; }
159
+ .track::after, input[type="checkbox"]:not([hidden])::after {
160
+ content: ""; position: absolute; width: 10px; height: 10px; left: 2px; top: 2px; right: auto; border-radius: 50%;
161
+ background: var(--muted); transition: transform 150ms ease-out, background-color 150ms ease-out;
162
+ }
163
+ [role="switch"][aria-checked="true"] .track, input[type="checkbox"]:checked { border-color: var(--model-fill,var(--secondary)); background: var(--model-fill,var(--secondary)); }
164
+ [role="switch"][aria-checked="true"] .track::after, input[type="checkbox"]:checked::after { inset: 2px auto auto 2px; transform: translateX(12px); background: var(--surface); }
165
+ .select-wrap::after { content: none; }
166
+ .select-trigger {
167
+ display: inline-flex; align-items: center; gap: 4px; min-width: 0; max-width: 100%; min-height: 28px;
168
+ padding: 4px 8px; border: 0; --corner-radius: 8px; color: var(--ink); background: var(--inset); font: 400 13px/20px var(--ui);
169
+ }
170
+ .select-trigger:hover:enabled, .select-trigger[aria-expanded="true"] { background: var(--selected); }
171
+ .select-trigger:disabled { opacity: .65; }
172
+ .select-trigger span { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
173
+ .select-wrap > .select-trigger { width: 100%; justify-content: space-between; }
174
+ .select-popover {
175
+ position: fixed; inset: auto; margin: 0; width: max-content; max-width: min(352px,calc(100vw - 16px)); padding: 4px;
176
+ overflow: auto; overscroll-behavior: contain; border: 1px solid var(--edge); --corner-radius: 8px; background: var(--surface);
177
+ color: var(--ink); box-shadow: 0 1px 2px rgb(0 0 0 / 8%);
178
+ }
179
+ .select-popover button { width: 100%; min-height: 28px; text-align: left; justify-content: space-between; padding: 4px 8px; --corner-radius: 4px; font: 400 13px/20px var(--ui); }
180
+ .select-popover button:is(:focus,:hover) { background: var(--inset); outline: 0; }
181
+ .select-popover button[aria-selected="true"] { font-weight: 500; }
182
+ .history-search, .preference-dialog { font-size: 13px; }
183
+ .search-title, .search-notice, .preference-hint { font-size: 13px; }
184
+ .search-title, .search-top h2, .search-hit mark { font-weight: 500; }
185
+ .search-top h2 { font-size: 13px; }
186
+ @keyframes message-in { from {opacity:0;transform:translateY(4px)} to {opacity:1;transform:translateY(0)} }
187
+ .message { animation: message-in 160ms ease-out; }
188
+ .stream-piece { animation: chunk-in 150ms ease-out; }
189
+ @keyframes chunk-in { from { opacity:.25; } to { opacity:1; } }
190
+ @media (prefers-reduced-motion:no-preference) {
191
+ .library, .inspector { transition: opacity 180ms ease-out, transform 180ms ease-out, display 180ms allow-discrete; }
192
+ .library { transform: translateX(0); }
193
+ .inspector { transform: translateX(0); }
194
+ .desk.panel-hidden .library { opacity: 0; transform: translateX(-16px); }
195
+ .inspector[hidden] { opacity: 0; transform: translateX(16px); }
196
+ @starting-style { .desk:not(.panel-hidden) .library { opacity:0; transform:translateX(-16px); } .inspector:not([hidden]) { opacity:0; transform:translateX(16px); } }
197
+ }
198
+ @media(max-width:699px) {
199
+ :root { --gutter: 16px; }
200
+ .library { border: 0; box-shadow: 4px 0 20px rgb(0 0 0 / 6%); }
201
+ .header { min-height: 64px; padding-inline: var(--gutter); }
202
+ .header button { min-width: 32px; padding: 8px; }
203
+ #open-chats, #inspect { font-size: 0; gap: 0; }
204
+ #inspect span { display:none; }
205
+ .header-actions { gap: 4px; }
206
+ .transcript { padding-block: 24px 28px; }
207
+ .composer { padding-bottom: max(8px,env(safe-area-inset-bottom)); }
208
+ #compose-form { padding: 8px; }
209
+ .message.me { padding: 12px; }
210
+ .byline { gap: 4px 8px; }
211
+ #entries { gap: 24px; }
212
+ }
213
+ @media(prefers-reduced-motion:reduce) {
214
+ *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
215
+ }
216
+
217
+ .stream-tail { white-space: pre-wrap; overflow-wrap: anywhere; }
218
+ .stream-block + :is(.stream-block,.stream-tail):not(:empty) { margin-top: 12px; }
219
+
220
+ /* Hover tools float beside the byline, so a narrower column never reserves an empty line. */
221
+ @media (hover:hover) {
222
+ .message > .byline { position: relative; }
223
+ .message .message-tools {
224
+ position: absolute; inset: 50% 0 auto auto; transform: translateY(-50%);
225
+ padding-left: 4px; --corner-radius: 4px; background: var(--paper);
226
+ }
227
+ .message:is(.me,.combined) .message-tools { background: var(--library); }
228
+ .message:not(:hover):not(:focus-within) .message-tools { pointer-events:none; }
229
+ }
230
+ .chat-role > .settings-row {
231
+ display: grid; grid-template-columns: minmax(60px,.75fr) minmax(0,1.6fr);
232
+ min-height: 32px; gap: 4px; padding: 0;
233
+ }
234
+ .chat-role > .settings-row > .select-trigger { justify-content: space-between; max-width: 100%; }
235
+ .model-toggle .check {
236
+ position: relative; width: 28px; height: 16px; border: 1px solid var(--edge); border-radius: 8px; background: var(--inset);
237
+ transition: background-color 150ms ease-out,border-color 150ms ease-out;
238
+ }
239
+ .model-toggle .check::after {
240
+ content: ""; position:absolute; top:2px; left:2px; width:10px; height:10px; border-radius:50%;
241
+ background:var(--muted); transition:transform 150ms ease-out,background-color 150ms ease-out;
242
+ }
243
+ .model-toggle[aria-pressed="true"] .check { background: var(--model-fill); border-color: var(--model-fill); }
244
+ .model-toggle[aria-pressed="true"] .check::after { transform: translateX(12px); background: var(--surface); }
245
+ /* Font shorthands reset numeric variants, including in Markdown and model names. */
246
+ *, *::before, *::after { font-variant-numeric: tabular-nums !important; }
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+
3
+ function createDraftStore() {
4
+ const unsaved = new Map();
5
+ let reported = false;
6
+ function key(id) { return "transcript.draft." + id; }
7
+
8
+ return {
9
+ get(id) {
10
+ if (unsaved.has(id)) return unsaved.get(id).value;
11
+ try { return localStorage.getItem(key(id)) || ""; }
12
+ catch { return ""; }
13
+ },
14
+ set(id, value) {
15
+ let previous;
16
+ try {
17
+ previous = localStorage.getItem(key(id));
18
+ if (value) localStorage.setItem(key(id), value);
19
+ else localStorage.removeItem(key(id));
20
+ unsaved.delete(id);
21
+ reported = false;
22
+ } catch {
23
+ unsaved.set(id, { value, previous });
24
+ if (!reported) {
25
+ reported = true;
26
+ feedback("Browser storage is unavailable. This draft is saved in this tab until you reload.");
27
+ }
28
+ }
29
+ },
30
+ delete(id, sentText) {
31
+ const pending = unsaved.get(id);
32
+ unsaved.delete(id);
33
+ try {
34
+ const stored = localStorage.getItem(key(id));
35
+ if (stored === sentText || (pending && pending.value === sentText && stored === pending.previous)) {
36
+ localStorage.removeItem(key(id));
37
+ }
38
+ } catch { /* The sent message already belongs to the saved chat. */ }
39
+ },
40
+ };
41
+ }