Compare commits

..
Author SHA1 Message Date
Cursor AgentandJulius Marminge 487295d5bf Optimize chat composer context updates
Co-authored-by: Julius Marminge <[email protected]>
2026-06-17 16:18:20 +00:00
16 changed files with 739 additions and 824 deletions

No files matched your search

@@ -99,7 +99,6 @@ export const layer = Layer.effect(
width: 12,
height: 12,
});
icon.setTemplateImage(true);
destructiveMenuIconCache = icon.isEmpty() ? Option.none() : Option.some(icon);
} catch {
destructiveMenuIconCache = Option.none();
+15 -43
View File
@@ -1,6 +1,4 @@
---
import { GITHUB_REPOSITORY_URL, MARKETING_STATS } from "../lib/site";
interface Props {
title?: string;
description?: string;
@@ -38,17 +36,17 @@ const {
</a>
<div class="nav-right">
<a
class="nav-stars"
href={GITHUB_REPOSITORY_URL}
class="nav-gh"
href="https://github.com/pingdotgg/t3code"
target="_blank"
rel="noopener noreferrer"
aria-label={`Star T3 Code on GitHub — ${MARKETING_STATS.githubStars} stars`}
>
<svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
<path d="M12 2.3l2.9 5.88 6.49.94-4.7 4.58 1.11 6.47L12 17.12l-5.8 3.05 1.11-6.47-4.7-4.58 6.49-.94L12 2.3z"/>
<path d="M12 .5C5.65.5.5 5.65.5 12a11.5 11.5 0 007.86 10.93c.58.1.79-.25.79-.56v-2c-3.2.69-3.88-1.37-3.88-1.37-.52-1.33-1.27-1.69-1.27-1.69-1.04-.71.08-.7.08-.7 1.15.08 1.76 1.18 1.76 1.18 1.02 1.76 2.68 1.25 3.33.96.1-.75.4-1.25.72-1.54-2.55-.29-5.24-1.27-5.24-5.67 0-1.25.45-2.28 1.18-3.08-.12-.29-.51-1.45.11-3.02 0 0 .96-.31 3.15 1.18a10.96 10.96 0 015.74 0c2.19-1.49 3.15-1.18 3.15-1.18.62 1.57.23 2.73.11 3.02.74.8 1.18 1.83 1.18 3.08 0 4.41-2.7 5.38-5.27 5.66.41.36.78 1.06.78 2.13v3.16c0 .31.21.67.8.56A11.5 11.5 0 0023.5 12C23.5 5.65 18.35.5 12 .5z"/>
</svg>
<span><strong>{MARKETING_STATS.githubStars}</strong> GitHub stars</span>
<span>GitHub</span>
</a>
<a class="btn btn-primary" href="/#download">Download</a>
</div>
</div>
</nav>
@@ -64,7 +62,7 @@ const {
<span>&copy; {new Date().getFullYear()} T3 Tools Inc · MIT licensed</span>
</div>
<div class="footer-links">
<a href={GITHUB_REPOSITORY_URL} target="_blank" rel="noopener noreferrer">GitHub</a>
<a href="https://github.com/pingdotgg/t3code" target="_blank" rel="noopener noreferrer">GitHub</a>
<a href="https://discord.gg/jn4EGJjrvv" target="_blank" rel="noopener noreferrer">Discord</a>
<a href="/download">Download</a>
</div>
@@ -331,36 +329,23 @@ const {
gap: 8px;
}
.nav-stars {
.nav-gh {
display: inline-flex;
align-items: center;
gap: 7px;
height: 36px;
padding: 0 14px;
gap: 6px;
padding: 7px 12px;
border: 1px solid var(--border);
border-radius: 999px;
background: rgba(255, 255, 255, 0.02);
border-radius: 8px;
color: var(--fg-muted);
font-size: 13px;
letter-spacing: -0.01em;
white-space: nowrap;
transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease;
font-family: var(--font-mono);
font-size: 12px;
transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}
.nav-stars:hover {
.nav-gh:hover {
color: var(--fg);
border-color: var(--border-strong);
background: rgba(255, 255, 255, 0.04);
}
.nav-stars strong {
color: var(--fg);
font-weight: 600;
}
.nav-stars svg {
color: var(--warn);
flex-shrink: 0;
border-color: var(--border-strong);
}
.main {
@@ -422,17 +407,4 @@ const {
padding-right: 20px;
}
}
@media (max-width: 420px) {
.nav-inner {
gap: 12px;
}
.nav-stars {
height: 34px;
gap: 6px;
padding: 0 12px;
font-size: 12px;
}
}
</style>
-6
View File
@@ -1,6 +0,0 @@
export const GITHUB_REPOSITORY_URL = "https://github.com/pingdotgg/t3code";
export const MARKETING_STATS = {
githubStars: "12k+",
users: "100,000",
} as const;
+66 -181
View File
@@ -1,6 +1,5 @@
---
import Layout from "../layouts/Layout.astro";
import { GITHUB_REPOSITORY_URL, MARKETING_STATS } from "../lib/site";
import { tweets } from "../lib/tweets";
const desktopEndorsementRows = [
@@ -56,12 +55,11 @@ const mobileEndorsementRows = [
<svg class="dl-icon dl-icon--linux" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true"><path fill="currentColor" d="M12.504 0c-.155 0-.315.008-.48.021-4.226.333-3.105 4.807-3.17 6.298-.076 1.092-.3 1.953-1.05 3.02-.885 1.051-2.127 2.75-2.716 4.521-.278.832-.41 1.684-.287 2.489a.424.424 0 00-.11.135c-.26.268-.45.6-.663.839-.199.199-.485.267-.797.4-.313.136-.658.269-.864.68-.09.189-.136.394-.132.602 0 .199.027.4.055.536.058.399.116.728.04.97-.249.68-.28 1.145-.106 1.484.174.334.535.47.94.601.81.2 1.91.135 2.774.6.926.466 1.866.67 2.616.47.526-.116.97-.464 1.208-.946.587-.003 1.23-.269 2.26-.334.699-.058 1.574.267 2.577.2.025.134.063.198.114.333l.003.003c.391.778 1.113 1.132 1.884 1.071.771-.06 1.592-.536 2.257-1.306.631-.765 1.683-1.084 2.378-1.503.348-.199.629-.469.649-.853.023-.4-.2-.811-.714-1.376v-.097l-.003-.003c-.17-.2-.25-.535-.338-.926-.085-.401-.182-.786-.492-1.046h-.003c-.059-.054-.123-.067-.188-.135a.357.357 0 00-.19-.064c.431-1.278.264-2.55-.173-3.694-.533-1.41-1.465-2.638-2.175-3.483-.796-1.005-1.576-1.957-1.56-3.368.026-2.152.236-6.133-3.544-6.139zm.529 3.405h.013c.213 0 .396.062.584.198.19.135.33.332.438.533.105.259.158.459.166.724 0-.02.006-.04.006-.06v.105a.086.086 0 01-.004-.021l-.004-.024a1.807 1.807 0 01-.15.706.953.953 0 01-.213.335.71.71 0 00-.088-.042c-.104-.045-.198-.064-.284-.133a1.312 1.312 0 00-.22-.066c.05-.06.146-.133.183-.198.053-.128.082-.264.088-.402v-.02a1.21 1.21 0 00-.061-.4c-.045-.134-.101-.2-.183-.333-.084-.066-.167-.132-.267-.132h-.016c-.093 0-.176.03-.262.132a.8.8 0 00-.205.334 1.18 1.18 0 00-.09.4v.019c.002.089.008.179.02.267-.193-.067-.438-.135-.607-.202a1.635 1.635 0 01-.018-.2v-.02a1.772 1.772 0 01.15-.768c.082-.22.232-.406.43-.533a.985.985 0 01.594-.2zm-2.962.059h.036c.142 0 .27.048.399.135.146.129.264.288.344.465.09.199.14.4.153.667v.004c.007.134.006.2-.002.266v.08c-.03.007-.056.018-.083.024-.152.055-.274.135-.393.2.012-.09.013-.18.003-.267v-.015c-.012-.133-.04-.2-.082-.333a.613.613 0 00-.166-.267.248.248 0 00-.183-.064h-.021c-.071.006-.13.04-.186.132a.552.552 0 00-.12.27.944.944 0 00-.023.33v.015c.012.135.037.2.08.334.046.134.098.2.166.268.01.009.02.018.034.024-.07.057-.117.07-.176.136a.304.304 0 01-.131.068 2.62 2.62 0 01-.275-.402 1.772 1.772 0 01-.155-.667 1.759 1.759 0 01.08-.668 1.43 1.43 0 01.283-.535c.128-.133.26-.2.418-.2zm1.37 1.706c.332 0 .733.065 1.216.399.293.2.523.269 1.052.468h.003c.255.136.405.266.478.399v-.131a.571.571 0 01.016.47c-.123.31-.516.643-1.063.842v.002c-.268.135-.501.333-.775.465-.276.135-.588.292-1.012.267a1.139 1.139 0 01-.448-.067 3.566 3.566 0 01-.322-.198c-.195-.135-.363-.332-.612-.465v-.005h-.005c-.4-.246-.616-.512-.686-.71-.07-.268-.005-.47.193-.6.224-.135.38-.271.483-.336.104-.074.143-.102.176-.131h.002v-.003c.169-.202.436-.47.839-.601.139-.036.294-.065.466-.065zm2.8 2.142c.358 1.417 1.196 3.475 1.735 4.473.286.534.855 1.659 1.102 3.024.156-.005.33.018.513.064.646-1.671-.546-3.467-1.089-3.966-.22-.2-.232-.335-.123-.335.59.534 1.365 1.572 1.646 2.757.13.535.16 1.104.021 1.67.067.028.135.06.205.067 1.032.534 1.413.938 1.23 1.537v-.043c-.06-.003-.12 0-.18 0h-.016c.151-.467-.182-.825-1.065-1.224-.915-.4-1.646-.336-1.77.465-.008.043-.013.066-.018.135-.068.023-.139.053-.209.064-.43.268-.662.669-.793 1.187-.13.533-.17 1.156-.205 1.869v.003c-.02.334-.17.838-.319 1.35-1.5 1.072-3.58 1.538-5.348.334a2.645 2.645 0 00-.402-.533 1.45 1.45 0 00-.275-.333c.182 0 .338-.03.465-.067a.615.615 0 00.314-.334c.108-.267 0-.697-.345-1.163-.345-.467-.931-.995-1.788-1.521-.63-.4-.986-.87-1.15-1.396-.165-.534-.143-1.085-.015-1.645.245-1.07.873-2.11 1.274-2.763.107-.065.037.135-.408.974-.396.751-1.14 2.497-.122 3.854a8.123 8.123 0 01.647-2.876c.564-1.278 1.743-3.504 1.836-5.268.048.036.217.135.289.202.218.133.38.333.59.465.21.201.477.335.876.335.039.003.075.006.11.006.412 0 .73-.134.997-.268.29-.134.52-.334.74-.4h.005c.467-.135.835-.402 1.044-.7zm2.185 8.958c.037.6.343 1.245.882 1.377.588.134 1.434-.333 1.791-.765l.211-.01c.315-.007.577.01.847.268l.003.003c.208.199.305.53.391.876.085.4.154.78.409 1.066.486.527.645.906.636 1.14l.003-.007v.018l-.003-.012c-.015.262-.185.396-.498.595-.63.401-1.746.712-2.457 1.57-.618.737-1.37 1.14-2.036 1.191-.664.053-1.237-.2-1.574-.898l-.005-.003c-.21-.4-.12-1.025.056-1.69.176-.668.428-1.344.463-1.897.037-.714.076-1.335.195-1.814.12-.465.308-.797.641-.984l.045-.022zm-10.814.049h.01c.053 0 .105.005.157.014.376.055.706.333 1.023.752l.91 1.664.003.003c.243.533.754 1.064 1.189 1.637.434.598.77 1.131.729 1.57v.006c-.057.744-.48 1.148-1.125 1.294-.645.135-1.52.002-2.395-.464-.968-.536-2.118-.469-2.857-.602-.369-.066-.61-.2-.723-.4-.11-.2-.113-.602.123-1.23v-.004l.002-.003c.117-.334.03-.752-.027-1.118-.055-.401-.083-.71.043-.94.16-.334.396-.4.69-.533.294-.135.64-.202.915-.47h.002v-.002c.256-.268.445-.601.668-.838.19-.201.38-.336.663-.336zm7.159-9.074c-.435.201-.945.535-1.488.535-.542 0-.97-.267-1.28-.466-.154-.134-.28-.268-.373-.335-.164-.134-.144-.333-.074-.333.109.016.129.134.199.2.096.066.215.2.3Line truncated
<span id="download-label">Download for macOS</span>
</a>
<a class="hero-source-link" href={GITHUB_REPOSITORY_URL} target="_blank" rel="noopener noreferrer">
<svg class="hero-source-mark" width="15" height="15" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
<a href="https://github.com/pingdotgg/t3code" target="_blank" rel="noopener noreferrer" class="btn btn-ghost btn-lg">
<svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
<path d="M12 .5C5.65.5.5 5.65.5 12a11.5 11.5 0 007.86 10.93c.58.1.79-.25.79-.56v-2c-3.2.69-3.88-1.37-3.88-1.37-.52-1.33-1.27-1.69-1.27-1.69-1.04-.71.08-.7.08-.7 1.15.08 1.76 1.18 1.76 1.18 1.02 1.76 2.68 1.25 3.33.96.1-.75.4-1.25.72-1.54-2.55-.29-5.24-1.27-5.24-5.67 0-1.25.45-2.28 1.18-3.08-.12-.29-.51-1.45.11-3.02 0 0 .96-.31 3.15 1.18a10.96 10.96 0 015.74 0c2.19-1.49 3.15-1.18 3.15-1.18.62 1.57.23 2.73.11 3.02.74.8 1.18 1.83 1.18 3.08 0 4.41-2.7 5.38-5.27 5.66.41.36.78 1.06.78 2.13v3.16c0 .31.21.67.8.56A11.5 11.5 0 0023.5 12C23.5 5.65 18.35.5 12 .5z"/>
</svg>
<span>Steal our code (legally)</span>
<svg class="hero-source-arrow" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M7 17L17 7M8 7h9v9"/></svg>
Star on GitHub
</a>
</div>
@@ -84,8 +82,8 @@ const mobileEndorsementRows = [
<section id="endorsements" class="sec-endorsements" aria-labelledby="endorsements-title">
<div class="container">
<div class="endorsements-head">
<h2 id="endorsements-title">Tolerated by over <span class="endorsements-count">{MARKETING_STATS.users}</span> devs</h2>
<p>Some of them even tweeted about it.</p>
<h2 id="endorsements-title">Developers love T3 Code</h2>
<p>Real reactions from people building with T3 Code today.</p>
</div>
</div>
@@ -284,6 +282,10 @@ const mobileEndorsementRows = [
<div class="section-head open-head">
<div class="eyebrow">Open source</div>
<h2>If you don't like something, fork it.</h2>
<p>
T3 Code is as open as they come. We built this app to be modifiable,
customizable, and forkable. Go nuts - that's the whole point.
</p>
</div>
<div class="open-grid">
@@ -303,44 +305,43 @@ const mobileEndorsementRows = [
</div>
</div>
<div class="tile open-pitch">
<div class="open-pitch-copy">
<ul class="open-pitch-list">
<li>
<span class="open-pitch-mark" aria-hidden="true"><svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round"><path d="M20 6 9 17l-5-5"/></svg></span>
<span><strong>Change the UI.</strong> Restyle every surface to match your taste.</span>
</li>
<li>
<span class="open-pitch-mark" aria-hidden="true"><svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round"><path d="M20 6 9 17l-5-5"/></svg></span>
<span><strong>Add an agent.</strong> Wire in your own tools, models, and flows.</span>
</li>
<li>
<span class="open-pitch-mark" aria-hidden="true"><svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round"><path d="M20 6 9 17l-5-5"/></svg></span>
<span><strong>Ship your own build.</strong> Self-host it or distribute it as your own.</span>
</li>
</ul>
<div class="open-stats">
<div class="tile open-stat">
<div class="open-stat-val">MIT</div>
<div class="open-stat-lbl">License · commercial-friendly</div>
</div>
<div class="open-pitch-footer">
<div class="open-pitch-meta">
<span>MIT licensed</span>
<span aria-hidden="true">·</span>
<span>{MARKETING_STATS.githubStars} stars</span>
</div>
<div class="open-pitch-actions">
<a class="btn btn-primary" href="https://github.com/pingdotgg/t3code/fork" target="_blank" rel="noopener noreferrer">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="6" cy="5" r="2.2"/><circle cx="18" cy="5" r="2.2"/><circle cx="12" cy="19" r="2.2"/><path d="M6 7.2v2A3 3 0 009 12.2h6A3 3 0 0018 9.2v-2M12 14v2.8"/></svg>
Fork on GitHub
</a>
<a class="open-source-link" href={GITHUB_REPOSITORY_URL} target="_blank" rel="noopener noreferrer">
Browse source
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M7 17L17 7M8 7h9v9"/></svg>
</a>
</div>
<div class="tile open-stat">
<div class="open-stat-val">TypeScript</div>
<div class="open-stat-lbl">End-to-end, strictly typed</div>
</div>
<div class="tile open-stat">
<div class="open-stat-val">1 monorepo</div>
<div class="open-stat-lbl">Desktop · web · server · harnesses</div>
</div>
<div class="tile open-stat">
<div class="open-stat-val">No telemetry</div>
<div class="open-stat-lbl">Unless you opt in. Full stop.</div>
</div>
</div>
</div>
<div class="open-ctas">
<a class="btn btn-ghost" href="https://github.com/pingdotgg/t3code" target="_blank" rel="noopener noreferrer">
<svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M12 .5C5.65.5.5 5.65.5 12a11.5 11.5 0 007.86 10.93c.58.1.79-.25.79-.56v-2c-3.2.69-3.88-1.37-3.88-1.37-.52-1.33-1.27-1.69-1.27-1.69-1.04-.71.08-.7.08-.7 1.15.08 1.76 1.18 1.76 1.18 1.02 1.76 2.68 1.25 3.33.96.1-.75.4-1.25.72-1.54-2.55-.29-5.24-1.27-5.24-5.67 0-1.25.45-2.28 1.18-3.08-.12-.29-.51-1.45.11-3.02 0 0 .96-.31 3.15 1.18a10.96 10.96 0 015.74 0c2.19-1.49 3.15-1.18 3.15-1.18.62 1.57.23 2.73.11 3.02.74.8 1.18 1.83 1.18 3.08 0 4.41-2.7 5.38-5.27 5.66.41.36.78 1.06.78 2.13v3.16c0 .31.21.67.8.56A11.5 11.5 0 0023.5 12C23.5 5.65 18.35.5 12 .5z"/></svg>
Star on GitHub
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M7 17L17 7M8 7h9v9"/></svg>
</a>
<a class="btn btn-ghost" href="https://github.com/pingdotgg/t3code/fork" target="_blank" rel="noopener noreferrer">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="6" cy="5" r="2.2"/><circle cx="18" cy="5" r="2.2"/><circle cx="12" cy="19" r="2.2"/><path d="M6 7.2v2A3 3 0 009 12.2h6A3 3 0 0018 9.2v-2M12 14v2.8"/></svg>
Fork the repo
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M7 17L17 7M8 7h9v9"/></svg>
</a>
<a class="btn btn-ghost" href="https://github.com/pingdotgg/t3code/blob/main/CONTRIBUTING.md" target="_blank" rel="noopener noreferrer">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="2.5" y="4.5" width="19" height="15" rx="2"/><path d="M7 10l3 2-3 2M12 16h5"/></svg>
Read CONTRIBUTING.md
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M7 17L17 7M8 7h9v9"/></svg>
</a>
</div>
</div>
</section>
@@ -514,7 +515,7 @@ const mobileEndorsementRows = [
.hero-title {
font-size: clamp(38px, 5.6vw, 76px);
margin: 48px auto 22px;
margin: 28px auto 22px;
max-width: 20ch;
text-wrap: balance;
}
@@ -530,42 +531,12 @@ const mobileEndorsementRows = [
.hero-actions {
display: flex;
flex-direction: column;
align-items: center;
gap: 16px;
gap: 10px;
justify-content: center;
flex-wrap: wrap;
margin-bottom: 56px;
}
.hero-source-link {
display: inline-flex;
align-items: center;
gap: 8px;
color: var(--fg-muted);
font-size: 14px;
font-weight: 500;
letter-spacing: -0.01em;
transition: color 0.18s ease;
}
.hero-source-link:hover {
color: var(--fg);
}
.hero-source-mark {
flex-shrink: 0;
}
.hero-source-arrow {
flex-shrink: 0;
opacity: 0.6;
transition: transform 0.18s ease, opacity 0.18s ease;
}
.hero-source-link:hover .hero-source-arrow {
transform: translate(2px, -2px);
opacity: 1;
}
/* Download button icons (platform-aware) */
.dl-icon {
display: none;
@@ -685,30 +656,6 @@ const mobileEndorsementRows = [
}
}
@media (max-width: 340px) {
.hero-float-mark.hf-opencode,
.hero-float-mark.hf-cursor {
top: 580px;
width: 52px;
height: 52px;
border-radius: 14px;
}
.hero-float-mark.hf-opencode {
left: 0;
}
.hero-float-mark.hf-cursor {
right: 0;
}
.hero-float-mark.hf-opencode img,
.hero-float-mark.hf-cursor img {
width: 30px;
height: 30px;
}
}
.hero-preview {
max-width: 1180px;
margin: 0 auto;
@@ -812,11 +759,6 @@ const mobileEndorsementRows = [
margin-bottom: 18px;
}
.endorsements-count {
font-weight: 600;
font-variant-numeric: tabular-nums;
}
.endorsements-head p {
color: var(--fg-muted);
font-size: 18px;
@@ -1020,11 +962,12 @@ const mobileEndorsementRows = [
text-align: center;
margin: 0 auto 56px;
}
.open-head p { margin: 0 auto; }
.open-grid {
display: grid;
grid-template-columns: 1.25fr 1fr;
gap: 20px;
gap: 20px; margin-bottom: 32px;
}
.open-term { padding: 0; overflow: hidden; }
@@ -1066,85 +1009,27 @@ const mobileEndorsementRows = [
animation: blink 1s steps(2) infinite;
}
.open-pitch {
padding: 32px;
display: flex;
flex-direction: column;
justify-content: center;
gap: 32px;
background:
radial-gradient(110% 75% at 100% 0%, var(--accent-dim), transparent 60%),
linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent);
}
.open-pitch-list {
list-style: none;
display: flex;
flex-direction: column;
gap: 16px;
}
.open-pitch-list li {
display: flex;
align-items: flex-start;
gap: 12px;
font-size: 15px;
line-height: 1.5;
color: var(--fg-muted);
}
.open-pitch-list strong {
color: var(--fg);
font-weight: 600;
}
.open-pitch-mark {
flex: none;
.open-stats {
display: grid;
place-items: center;
width: 22px;
height: 22px;
margin-top: 1px;
border-radius: 7px;
color: var(--accent);
background: var(--accent-dim);
border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
grid-template-columns: 1fr 1fr;
gap: 12px;
}
.open-stat {
padding: 22px;
display: flex; flex-direction: column; gap: 6px;
}
.open-stat-val {
font-size: 22px; font-weight: 500;
letter-spacing: -0.015em;
}
.open-stat-lbl {
font-family: var(--font-mono); font-size: 10.5px;
color: var(--fg-dim); letter-spacing: 0.04em;
}
.open-pitch-footer {
display: flex;
flex-direction: column;
gap: 18px;
}
.open-pitch-meta {
display: flex;
align-items: center;
gap: 8px;
color: var(--fg-dim);
font-family: var(--font-mono);
font-size: 11px;
}
.open-pitch-actions {
display: flex;
align-items: center;
gap: 16px;
flex-wrap: wrap;
}
.open-source-link {
display: inline-flex;
align-items: center;
gap: 6px;
color: var(--fg-muted);
font-size: 13px;
font-weight: 500;
transition: color 0.18s ease;
}
.open-source-link:hover {
color: var(--fg);
.open-ctas {
display: flex; gap: 10px;
justify-content: center; flex-wrap: wrap;
}
/* ── Final CTA ────────────────────────────────────────── */
+6 -6
View File
@@ -49,10 +49,10 @@
"@noble/hashes": "catalog:",
"@pierre/diffs": "catalog:",
"@react-native-menu/menu": "^2.0.0",
"@shikijs/core": "4.2.0",
"@shikijs/engine-javascript": "4.2.0",
"@shikijs/langs": "4.2.0",
"@shikijs/themes": "4.2.0",
"@shikijs/core": "3.23.0",
"@shikijs/engine-javascript": "3.23.0",
"@shikijs/langs": "3.23.0",
"@shikijs/themes": "3.23.0",
"@t3tools/client-runtime": "workspace:*",
"@t3tools/contracts": "workspace:*",
"@t3tools/mobile-markdown-text": "file:./modules/t3-markdown-text",
@@ -98,10 +98,10 @@
"react-native-reanimated": "4.3.1",
"react-native-safe-area-context": "~5.7.0",
"react-native-screens": "4.25.2",
"react-native-shiki-engine": "^0.3.12",
"react-native-shiki-engine": "^0.3.9",
"react-native-svg": "15.15.4",
"react-native-worklets": "0.8.3",
"shiki": "4.2.0",
"shiki": "3.23.0",
"tailwind-merge": "^3.5.0",
"uniwind": "^1.6.2"
},
+20 -34
View File
@@ -216,7 +216,7 @@ it.layer(TestLayer)("GitVcsDriver core integration", (it) => {
}),
);
it.effect("makes background upstream status fetches non-interactive", () =>
it.effect("disables SSH askpass for background upstream status fetches", () =>
Effect.gen(function* () {
const cwd = yield* makeTmpDir();
const tempDir = yield* makeTmpDir("git-vcs-driver-ssh-env-");
@@ -225,26 +225,15 @@ it.layer(TestLayer)("GitVcsDriver core integration", (it) => {
const pathService = yield* Path.Path;
const sshLogPath = pathService.join(tempDir, "ssh-env.txt");
const sshWrapperPath = pathService.join(tempDir, "ssh-wrapper.sh");
const envKeys = [
"GCM_INTERACTIVE",
"GIT_ASKPASS",
"GIT_SSH",
"GIT_TERMINAL_PROMPT",
"SSH_ASKPASS",
"SSH_ASKPASS_REQUIRE",
"T3_TEST_SSH_ASKPASS_LOG",
] as const;
const previousEnv = new Map(envKeys.map((key) => [key, process.env[key]]));
const previousGitSsh = process.env.GIT_SSH;
const previousAskpassRequire = process.env.SSH_ASKPASS_REQUIRE;
const previousAskpassLog = process.env.T3_TEST_SSH_ASKPASS_LOG;
yield* fileSystem.writeFileString(
sshWrapperPath,
[
"#!/bin/sh",
'printf "GCM_INTERACTIVE=%s\\n" "${GCM_INTERACTIVE:-}" > "$T3_TEST_SSH_ASKPASS_LOG"',
'printf "GIT_ASKPASS=%s\\n" "${GIT_ASKPASS:-}" >> "$T3_TEST_SSH_ASKPASS_LOG"',
'printf "GIT_TERMINAL_PROMPT=%s\\n" "${GIT_TERMINAL_PROMPT:-}" >> "$T3_TEST_SSH_ASKPASS_LOG"',
'printf "SSH_ASKPASS=%s\\n" "${SSH_ASKPASS:-}" >> "$T3_TEST_SSH_ASKPASS_LOG"',
'printf "SSH_ASKPASS_REQUIRE=%s\\n" "${SSH_ASKPASS_REQUIRE:-}" >> "$T3_TEST_SSH_ASKPASS_LOG"',
'printf "%s\\n" "${SSH_ASKPASS_REQUIRE:-}" > "$T3_TEST_SSH_ASKPASS_LOG"',
"exit 1",
"",
].join("\n"),
@@ -256,32 +245,29 @@ it.layer(TestLayer)("GitVcsDriver core integration", (it) => {
yield* Effect.gen(function* () {
process.env.GIT_SSH = sshWrapperPath;
process.env.GCM_INTERACTIVE = "always";
process.env.GIT_ASKPASS = "git-askpass";
process.env.GIT_TERMINAL_PROMPT = "1";
process.env.SSH_ASKPASS = "ssh-askpass";
process.env.SSH_ASKPASS_REQUIRE = "force";
process.env.T3_TEST_SSH_ASKPASS_LOG = sshLogPath;
yield* (yield* GitVcsDriver.GitVcsDriver).statusDetails(cwd);
assert.deepEqual((yield* fileSystem.readFileString(sshLogPath)).trim().split(/\r?\n/), [
"GCM_INTERACTIVE=never",
"GIT_ASKPASS=",
"GIT_TERMINAL_PROMPT=0",
"SSH_ASKPASS=",
"SSH_ASKPASS_REQUIRE=never",
]);
assert.equal((yield* fileSystem.readFileString(sshLogPath)).trim(), "never");
}).pipe(
Effect.ensuring(
Effect.sync(() => {
for (const key of envKeys) {
const previous = previousEnv.get(key);
if (previous === undefined) {
delete process.env[key];
} else {
process.env[key] = previous;
}
if (previousGitSsh === undefined) {
delete process.env.GIT_SSH;
} else {
process.env.GIT_SSH = previousGitSsh;
}
if (previousAskpassRequire === undefined) {
delete process.env.SSH_ASKPASS_REQUIRE;
} else {
process.env.SSH_ASKPASS_REQUIRE = previousAskpassRequire;
}
if (previousAskpassLog === undefined) {
delete process.env.T3_TEST_SSH_ASKPASS_LOG;
} else {
process.env.T3_TEST_SSH_ASKPASS_LOG = previousAskpassLog;
}
}),
),
-4
View File
@@ -54,10 +54,6 @@ const STATUS_UPSTREAM_REFRESH_TIMEOUT = Duration.seconds(5);
const STATUS_UPSTREAM_REFRESH_FAILURE_COOLDOWN = Duration.seconds(5);
const STATUS_UPSTREAM_REFRESH_CACHE_CAPACITY = 2_048;
const STATUS_UPSTREAM_REFRESH_ENV = Object.freeze({
GCM_INTERACTIVE: "never",
GIT_ASKPASS: "",
GIT_TERMINAL_PROMPT: "0",
SSH_ASKPASS: "",
SSH_ASKPASS_REQUIRE: "never",
} satisfies NodeJS.ProcessEnv);
const DEFAULT_BASE_BRANCH_CANDIDATES = ["main", "master"] as const;
+3 -2
View File
@@ -4903,7 +4903,9 @@ function ChatViewContent(props: ChatViewProps) {
draftId={draftId}
activeThreadId={activeThreadId}
activeThreadEnvironmentId={activeThread?.environmentId}
activeThread={activeThread}
activeThreadSessionProviderInstanceId={
activeThread?.session?.providerInstanceId
}
isServerThread={isServerThread}
isLocalDraftThread={isLocalDraftThread}
phase={phase}
@@ -4932,7 +4934,6 @@ function ChatViewContent(props: ChatViewProps) {
providerStatuses={providerStatuses as ServerProvider[]}
activeProjectDefaultModelSelection={activeProject?.defaultModelSelection}
activeThreadModelSelection={activeThread?.modelSelection}
activeThreadActivities={activeThread?.activities}
resolvedTheme={resolvedTheme}
settings={settings}
keybindings={keybindings}
+92 -57
View File
@@ -71,13 +71,13 @@ import { ComposerPrimaryActions } from "./ComposerPrimaryActions";
import { ComposerPendingApprovalPanel } from "./ComposerPendingApprovalPanel";
import { ComposerPendingUserInputPanel } from "./ComposerPendingUserInputPanel";
import { ComposerPlanFollowUpBanner } from "./ComposerPlanFollowUpBanner";
import { resolveComposerMenuActiveItemId } from "./composerMenuHighlight";
import { searchSlashCommandItems } from "./composerSlashCommandSearch";
import {
getComposerProviderState,
renderProviderTraitsMenuContent,
renderProviderTraitsPicker,
} from "./composerProviderState";
import { useComposerMenuHighlight } from "./useComposerMenuHighlight";
import { ContextWindowMeter } from "./ContextWindowMeter";
import { buildExpandedImagePreview, type ExpandedImagePreview } from "./ExpandedImagePreview";
import { basenameOfPath } from "../../pierre-icons";
@@ -111,14 +111,13 @@ import type { UnifiedSettings } from "@t3tools/contracts/settings";
import type { SessionPhase, Thread } from "../../types";
import type { PendingUserInputDraftAnswer } from "../../pendingUserInput";
import type { PendingApproval, PendingUserInput } from "../../session-logic";
import {
deriveLatestContextWindowSnapshot,
formatProviderDisplayName,
} from "../../lib/contextWindow";
import { type ContextWindowSnapshot, formatProviderDisplayName } from "../../lib/contextWindow";
import { formatProviderSkillDisplayName } from "../../providerSkillPresentation";
import { searchProviderSkills } from "../../providerSkillSearch";
import { useMediaQuery } from "../../hooks/useMediaQuery";
import type { ReviewCommentContext } from "../../reviewCommentContext";
import { useStore } from "../../store";
import { createContextWindowSnapshotSelectorByRef } from "../../storeSelectors";
const IMAGE_SIZE_LIMIT_LABEL = `${Math.round(PROVIDER_SEND_TURN_MAX_IMAGE_BYTES / (1024 * 1024))}MB`;
@@ -323,7 +322,7 @@ const ComposerFooterModeControls = memo(function ComposerFooterModeControls(prop
const ComposerFooterPrimaryActions = memo(function ComposerFooterPrimaryActions(props: {
compact: boolean;
activeContextWindow: ReturnType<typeof deriveLatestContextWindowSnapshot>;
activeContextWindow: ContextWindowSnapshot | null;
activeThreadProviderDisplayName: string | null;
isPreparingWorktree: boolean;
pendingAction: {
@@ -432,7 +431,7 @@ export interface ChatComposerProps {
// Thread context
activeThreadId: ThreadId | null;
activeThreadEnvironmentId: EnvironmentId | undefined;
activeThread: Thread | undefined;
activeThreadSessionProviderInstanceId: ProviderInstanceId | undefined;
isServerThread: boolean;
isLocalDraftThread: boolean;
@@ -481,9 +480,6 @@ export interface ChatComposerProps {
activeProjectDefaultModelSelection: ModelSelection | null | undefined;
activeThreadModelSelection: ModelSelection | null | undefined;
// Context window
activeThreadActivities: Thread["activities"] | undefined;
// Misc
resolvedTheme: "light" | "dark";
settings: UnifiedSettings;
@@ -547,7 +543,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
draftId,
activeThreadId,
activeThreadEnvironmentId: _activeThreadEnvironmentId,
activeThread,
activeThreadSessionProviderInstanceId,
isServerThread: _isServerThread,
isLocalDraftThread: _isLocalDraftThread,
phase,
@@ -576,7 +572,6 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
providerStatuses,
activeProjectDefaultModelSelection,
activeThreadModelSelection,
activeThreadActivities,
resolvedTheme,
settings,
keybindings,
@@ -663,7 +658,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
);
const selectedProviderByThreadId = composerDraft.activeProvider ?? null;
const threadProvider =
activeThread?.session?.providerInstanceId ??
activeThreadSessionProviderInstanceId ??
activeThreadModelSelection?.instanceId ??
activeProjectDefaultModelSelection?.instanceId ??
null;
@@ -677,16 +672,17 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
) ?? ProviderDriverKind.make("codex");
const selectedProvider: ProviderDriverKind = lockedProvider ?? unlockedSelectedProvider;
const lockedContinuationGroupKey = useMemo((): string | null => {
if (!lockedProvider || !activeThread) return null;
if (!lockedProvider || !activeThreadId) return null;
const lockedInstanceId =
activeThread.session?.providerInstanceId ?? activeThreadModelSelection?.instanceId;
activeThreadSessionProviderInstanceId ?? activeThreadModelSelection?.instanceId;
if (!lockedInstanceId) return null;
return (
providerInstanceEntries.find((entry) => entry.instanceId === lockedInstanceId)
?.continuationGroupKey ?? null
);
}, [
activeThread,
activeThreadId,
activeThreadSessionProviderInstanceId,
activeThreadModelSelection?.instanceId,
lockedProvider,
providerInstanceEntries,
@@ -705,7 +701,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
const selectedInstanceId = useMemo<ProviderInstanceId>(() => {
const candidates: Array<string | null | undefined> = [
composerDraft.activeProvider,
activeThread?.session?.providerInstanceId,
activeThreadSessionProviderInstanceId,
activeThreadModelSelection?.instanceId,
activeProjectDefaultModelSelection?.instanceId,
];
@@ -747,7 +743,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
);
}, [
activeProjectDefaultModelSelection?.instanceId,
activeThread?.session?.providerInstanceId,
activeThreadSessionProviderInstanceId,
activeThreadModelSelection?.instanceId,
composerDraft.activeProvider,
explicitSelectedInstanceId,
@@ -841,10 +837,11 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
// ------------------------------------------------------------------
// Context window
// ------------------------------------------------------------------
const activeContextWindow = useMemo(
() => deriveLatestContextWindowSnapshot(activeThreadActivities ?? []),
[activeThreadActivities],
const contextWindowSelector = useMemo(
() => createContextWindowSnapshotSelectorByRef(routeThreadRef),
[routeThreadRef],
);
const activeContextWindow = useStore(contextWindowSelector);
const activeThreadProviderDisplayName = useMemo(() => {
if (!activeThreadModelSelection) return null;
const entry = providerStatuses.find(
@@ -865,6 +862,10 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
const [composerTrigger, setComposerTrigger] = useState<ComposerTrigger | null>(() =>
detectComposerTrigger(prompt, prompt.length),
);
const [composerHighlightedItemId, setComposerHighlightedItemId] = useState<string | null>(null);
const [composerHighlightedSearchKey, setComposerHighlightedSearchKey] = useState<string | null>(
null,
);
const [isDragOverComposer, setIsDragOverComposer] = useState(false);
const [isComposerFooterCompact, setIsComposerFooterCompact] = useState(false);
const [isComposerPrimaryActionsCompact, setIsComposerPrimaryActionsCompact] = useState(false);
@@ -1001,19 +1002,20 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
const composerMenuSearchKey = composerTrigger
? `${composerTrigger.kind}:${composerTrigger.query.trim().toLowerCase()}`
: null;
const {
activeItemId: activeComposerMenuItemId,
nudge: nudgeStoredComposerMenuHighlight,
reset: resetComposerMenuHighlight,
setHighlightedItemId: setComposerMenuHighlightedItemId,
} = useComposerMenuHighlight({
items: composerMenuItems,
menuOpen: composerMenuOpen,
searchKey: composerMenuSearchKey,
});
const activeComposerMenuItem = useMemo(() => {
return composerMenuItems.find((item) => item.id === activeComposerMenuItemId) ?? null;
}, [activeComposerMenuItemId, composerMenuItems]);
const activeItemId = resolveComposerMenuActiveItemId({
items: composerMenuItems,
highlightedItemId: composerHighlightedItemId,
currentSearchKey: composerMenuSearchKey,
highlightedSearchKey: composerHighlightedSearchKey,
});
return composerMenuItems.find((item) => item.id === activeItemId) ?? null;
}, [
composerHighlightedItemId,
composerHighlightedSearchKey,
composerMenuItems,
composerMenuSearchKey,
]);
composerMenuOpenRef.current = composerMenuOpen;
composerMenuItemsRef.current = composerMenuItems;
@@ -1203,6 +1205,35 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
composerElementContextsRef.current = composerElementContexts;
}, [composerElementContexts, composerElementContextsRef]);
// ------------------------------------------------------------------
// Composer menu highlight sync
// ------------------------------------------------------------------
useEffect(() => {
if (!composerMenuOpen) {
setComposerHighlightedItemId(null);
setComposerHighlightedSearchKey(null);
return;
}
const nextActiveItemId = resolveComposerMenuActiveItemId({
items: composerMenuItems,
highlightedItemId: composerHighlightedItemId,
currentSearchKey: composerMenuSearchKey,
highlightedSearchKey: composerHighlightedSearchKey,
});
setComposerHighlightedItemId((existing) =>
existing === nextActiveItemId ? existing : nextActiveItemId,
);
setComposerHighlightedSearchKey((existing) =>
existing === composerMenuSearchKey ? existing : composerMenuSearchKey,
);
}, [
composerHighlightedItemId,
composerHighlightedSearchKey,
composerMenuItems,
composerMenuOpen,
composerMenuSearchKey,
]);
const lastSyncedPendingInputRef = useRef<{
requestId: string | null;
questionId: string | null;
@@ -1240,25 +1271,24 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
expandCollapsedComposerCursor(nextCustomAnswer, nextCursor),
),
);
resetComposerMenuHighlight();
setComposerHighlightedItemId(null);
}, [
activePendingProgress?.customAnswer,
activePendingProgress?.activeQuestion?.id,
activePendingUserInput?.requestId,
promptRef,
resetComposerMenuHighlight,
]);
// ------------------------------------------------------------------
// Reset compositor state on thread/draft change
// ------------------------------------------------------------------
useEffect(() => {
resetComposerMenuHighlight();
setComposerHighlightedItemId(null);
setComposerCursor(collapseExpandedComposerCursor(promptRef.current, promptRef.current.length));
setComposerTrigger(detectComposerTrigger(promptRef.current, promptRef.current.length));
dragDepthRef.current = 0;
setIsDragOverComposer(false);
}, [activeThreadId, draftId, promptRef, resetComposerMenuHighlight]);
}, [draftId, activeThreadId, promptRef]);
// ------------------------------------------------------------------
// Footer compact layout observation
@@ -1544,7 +1574,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
{ expectedText: snapshot.value.slice(trigger.rangeStart, replacementRangeEnd) },
);
if (applied) {
resetComposerMenuHighlight();
setComposerHighlightedItemId(null);
}
return;
}
@@ -1555,7 +1585,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
focusEditorAfterReplace: false,
});
if (applied) {
resetComposerMenuHighlight();
setComposerHighlightedItemId(null);
setIsComposerModelPickerOpen(true);
}
return;
@@ -1565,7 +1595,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
expectedText: snapshot.value.slice(trigger.rangeStart, trigger.rangeEnd),
});
if (applied) {
resetComposerMenuHighlight();
setComposerHighlightedItemId(null);
}
return;
}
@@ -1583,7 +1613,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
{ expectedText: snapshot.value.slice(trigger.rangeStart, replacementRangeEnd) },
);
if (applied) {
resetComposerMenuHighlight();
setComposerHighlightedItemId(null);
}
return;
}
@@ -1601,31 +1631,37 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
{ expectedText: snapshot.value.slice(trigger.rangeStart, replacementRangeEnd) },
);
if (applied) {
resetComposerMenuHighlight();
setComposerHighlightedItemId(null);
}
return;
}
},
[
applyPromptReplacement,
handleInteractionModeChange,
resolveActiveComposerTrigger,
resetComposerMenuHighlight,
],
[applyPromptReplacement, handleInteractionModeChange, resolveActiveComposerTrigger],
);
const onComposerMenuItemHighlighted = useCallback(
(itemId: string | null) => {
setComposerMenuHighlightedItemId(itemId);
setComposerHighlightedItemId(itemId);
setComposerHighlightedSearchKey(composerMenuSearchKey);
},
[setComposerMenuHighlightedItemId],
[composerMenuSearchKey],
);
const nudgeComposerMenuHighlight = useCallback(
(key: "ArrowDown" | "ArrowUp") => {
nudgeStoredComposerMenuHighlight(key);
if (composerMenuItems.length === 0) return;
const highlightedIndex = composerMenuItems.findIndex(
(item) => item.id === composerHighlightedItemId,
);
const normalizedIndex =
highlightedIndex >= 0 ? highlightedIndex : key === "ArrowDown" ? -1 : 0;
const offset = key === "ArrowDown" ? 1 : -1;
const nextIndex =
(normalizedIndex + offset + composerMenuItems.length) % composerMenuItems.length;
const nextItem = composerMenuItems[nextIndex];
setComposerHighlightedItemId(nextItem?.id ?? null);
},
[nudgeStoredComposerMenuHighlight],
[composerHighlightedItemId, composerMenuItems],
);
const blurMobileComposerAfterSend = useCallback(() => {
@@ -1918,7 +1954,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
}) => {
const promptForState = options?.prompt ?? promptRef.current;
const cursor = clampCollapsedComposerCursor(promptForState, options?.cursor ?? 0);
resetComposerMenuHighlight();
setComposerHighlightedItemId(null);
setComposerCursor(cursor);
setComposerTrigger(
options?.detectTrigger
@@ -1930,7 +1966,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
);
},
addTerminalContext: (selection: TerminalContextSelection) => {
if (!activeThread) return;
if (!activeThreadId) return;
const snapshot = composerEditorRef.current?.readSnapshot() ?? {
value: promptRef.current,
cursor: composerCursor,
@@ -1950,7 +1986,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
insertion.prompt,
{
id: randomUUID(),
threadId: activeThread.id,
threadId: activeThreadId,
createdAt: new Date().toISOString(),
...selection,
},
@@ -1980,7 +2016,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
}),
}),
[
activeThread,
activeThreadId,
composerDraftTarget,
composerCursor,
composerTerminalContexts,
@@ -2005,7 +2041,6 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
selectedPromptEffort,
selectedProvider,
selectedProviderModels,
resetComposerMenuHighlight,
],
);
@@ -1,124 +0,0 @@
import { useCallback, useMemo, useRef, useState } from "react";
import type { ComposerCommandItem } from "./ComposerCommandMenu";
import { resolveComposerMenuActiveItemId } from "./composerMenuHighlight";
type ComposerMenuHighlightState = {
readonly itemId: string | null;
readonly searchKey: string | null;
readonly observedSearchKey: string | null;
readonly menuOpen: boolean;
};
function createResetHighlightState(input: {
readonly menuOpen: boolean;
readonly searchKey: string | null;
}): ComposerMenuHighlightState {
return {
itemId: null,
searchKey: null,
observedSearchKey: input.searchKey,
menuOpen: input.menuOpen,
};
}
function sameHighlightState(
left: ComposerMenuHighlightState,
right: ComposerMenuHighlightState,
): boolean {
return (
left.itemId === right.itemId &&
left.searchKey === right.searchKey &&
left.observedSearchKey === right.observedSearchKey &&
left.menuOpen === right.menuOpen
);
}
export function useComposerMenuHighlight(input: {
readonly items: ReadonlyArray<ComposerCommandItem>;
readonly menuOpen: boolean;
readonly searchKey: string | null;
}) {
const inputRef = useRef(input);
inputRef.current = input;
const [storedHighlightState, setStoredHighlightState] = useState<ComposerMenuHighlightState>(() =>
createResetHighlightState(input),
);
let highlightState = storedHighlightState;
if (
highlightState.menuOpen !== input.menuOpen ||
highlightState.observedSearchKey !== input.searchKey
) {
highlightState = createResetHighlightState(input);
setStoredHighlightState(highlightState);
}
const activeItemId = useMemo(() => {
if (!input.menuOpen) return null;
return resolveComposerMenuActiveItemId({
items: input.items,
highlightedItemId: highlightState.itemId,
currentSearchKey: input.searchKey,
highlightedSearchKey: highlightState.searchKey,
});
}, [
highlightState.itemId,
highlightState.searchKey,
input.items,
input.menuOpen,
input.searchKey,
]);
const activeItemIdRef = useRef(activeItemId);
activeItemIdRef.current = activeItemId;
const reset = useCallback(() => {
const currentInput = inputRef.current;
setStoredHighlightState((existing) => {
const next = createResetHighlightState(currentInput);
return sameHighlightState(existing, next) ? existing : next;
});
}, []);
const setHighlightedItemId = useCallback((itemId: string | null) => {
const currentInput = inputRef.current;
setStoredHighlightState((existing) => {
const next: ComposerMenuHighlightState = {
itemId,
searchKey: itemId === null ? null : currentInput.searchKey,
observedSearchKey: currentInput.searchKey,
menuOpen: currentInput.menuOpen,
};
return sameHighlightState(existing, next) ? existing : next;
});
}, []);
const nudge = useCallback(
(key: "ArrowDown" | "ArrowUp") => {
const currentInput = inputRef.current;
if (!currentInput.menuOpen || currentInput.items.length === 0) return;
const currentActiveItemId = activeItemIdRef.current;
const activeIndex = currentActiveItemId
? currentInput.items.findIndex((item) => item.id === currentActiveItemId)
: -1;
const normalizedIndex = activeIndex >= 0 ? activeIndex : key === "ArrowDown" ? -1 : 0;
const offset = key === "ArrowDown" ? 1 : -1;
const nextIndex =
(normalizedIndex + offset + currentInput.items.length) % currentInput.items.length;
const nextItem = currentInput.items[nextIndex];
setHighlightedItemId(nextItem?.id ?? null);
},
[setHighlightedItemId],
);
return useMemo(
() => ({
activeItemId,
nudge,
reset,
setHighlightedItemId,
}),
[activeItemId, nudge, reset, setHighlightedItemId],
);
}
+29
View File
@@ -95,6 +95,35 @@ export function deriveLatestContextWindowSnapshot(
return null;
}
export function contextWindowSnapshotsEqual(
left: ContextWindowSnapshot | null,
right: ContextWindowSnapshot | null,
): boolean {
if (left === right) return true;
if (left === null || right === null) return false;
return (
left.usedTokens === right.usedTokens &&
left.totalProcessedTokens === right.totalProcessedTokens &&
left.maxTokens === right.maxTokens &&
left.remainingTokens === right.remainingTokens &&
left.usedPercentage === right.usedPercentage &&
left.remainingPercentage === right.remainingPercentage &&
left.inputTokens === right.inputTokens &&
left.cachedInputTokens === right.cachedInputTokens &&
left.outputTokens === right.outputTokens &&
left.reasoningOutputTokens === right.reasoningOutputTokens &&
left.lastUsedTokens === right.lastUsedTokens &&
left.lastInputTokens === right.lastInputTokens &&
left.lastCachedInputTokens === right.lastCachedInputTokens &&
left.lastOutputTokens === right.lastOutputTokens &&
left.lastReasoningOutputTokens === right.lastReasoningOutputTokens &&
left.toolUses === right.toolUses &&
left.durationMs === right.durationMs &&
left.compactsAutomatically === right.compactsAutomatically &&
left.updatedAt === right.updatedAt
);
}
export function formatContextWindowTokens(value: number | null): string {
if (value === null || !Number.isFinite(value)) {
return "0";
+108
View File
@@ -0,0 +1,108 @@
import {
EnvironmentId,
EventId,
type OrchestrationThreadActivity,
ThreadId,
TurnId,
} from "@t3tools/contracts";
import { describe, expect, it } from "vite-plus/test";
import { type AppState, type EnvironmentState } from "./store";
import { createContextWindowSnapshotSelectorByRef } from "./storeSelectors";
const environmentId = EnvironmentId.make("environment-local");
const threadId = ThreadId.make("thread-1");
const threadRef = { environmentId, threadId };
function makeActivity(id: string, kind: string, payload: unknown): OrchestrationThreadActivity {
return {
id: EventId.make(id),
tone: "info",
kind,
summary: kind,
payload,
turnId: TurnId.make("turn-1"),
createdAt: `2026-06-17T16:00:${id.padStart(2, "0")}.000Z`,
};
}
function makeState(activities: ReadonlyArray<OrchestrationThreadActivity>): AppState {
const environmentState: EnvironmentState = {
projectIds: [],
projectById: {},
threadIds: [threadId],
threadIdsByProjectId: {},
threadShellById: {},
threadSessionById: {},
threadTurnStateById: {},
messageIdsByThreadId: {},
messageByThreadId: {},
activityIdsByThreadId: {
[threadId]: activities.map((activity) => activity.id),
},
activityByThreadId: {
[threadId]: Object.fromEntries(
activities.map((activity) => [activity.id, activity] as const),
) as Record<string, OrchestrationThreadActivity>,
},
proposedPlanIdsByThreadId: {},
proposedPlanByThreadId: {},
turnDiffIdsByThreadId: {},
turnDiffSummaryByThreadId: {},
sidebarThreadSummaryById: {},
bootstrapComplete: true,
};
return {
activeEnvironmentId: environmentId,
environmentStateById: {
[environmentId]: environmentState,
},
};
}
describe("storeSelectors", () => {
it("reuses the context window snapshot when unrelated activities append", () => {
const contextActivity = makeActivity("1", "context-window.updated", {
usedTokens: 42_000,
maxTokens: 258_000,
totalProcessedTokens: 90_000,
});
const selector = createContextWindowSnapshotSelectorByRef(threadRef);
const first = selector(makeState([contextActivity]));
const second = selector(
makeState([contextActivity, makeActivity("2", "tool.completed", { toolName: "profile" })]),
);
expect(first).not.toBeNull();
expect(second).toBe(first);
});
it("returns a new context window snapshot when context usage changes", () => {
const selector = createContextWindowSnapshotSelectorByRef(threadRef);
const first = selector(
makeState([
makeActivity("1", "context-window.updated", {
usedTokens: 42_000,
maxTokens: 258_000,
}),
]),
);
const second = selector(
makeState([
makeActivity("1", "context-window.updated", {
usedTokens: 42_000,
maxTokens: 258_000,
}),
makeActivity("2", "context-window.updated", {
usedTokens: 43_000,
maxTokens: 258_000,
}),
]),
);
expect(first).not.toBeNull();
expect(second).not.toBe(first);
expect(second?.usedTokens).toBe(43_000);
});
});
+51
View File
@@ -1,4 +1,9 @@
import { type ScopedProjectRef, type ScopedThreadRef, type ThreadId } from "@t3tools/contracts";
import {
contextWindowSnapshotsEqual,
deriveLatestContextWindowSnapshot,
type ContextWindowSnapshot,
} from "./lib/contextWindow";
import { selectEnvironmentState, type AppState, type EnvironmentState } from "./store";
import { type Project, type Thread } from "./types";
import { getThreadFromEnvironmentState } from "./threadDerivation";
@@ -45,6 +50,52 @@ export function createThreadSelectorByRef(
return createScopedThreadSelector(() => ref);
}
export function createContextWindowSnapshotSelectorByRef(
ref: ScopedThreadRef | null | undefined,
): (state: AppState) => ContextWindowSnapshot | null {
let previousEnvironmentState: EnvironmentState | undefined;
let previousThreadId: ThreadId | undefined;
let previousActivityIds: readonly string[] | undefined;
let previousSnapshot: ContextWindowSnapshot | null = null;
return (state) => {
if (!ref) {
previousEnvironmentState = undefined;
previousThreadId = undefined;
previousActivityIds = undefined;
previousSnapshot = null;
return null;
}
const environmentState = selectEnvironmentState(state, ref.environmentId);
const activityIds = environmentState.activityIdsByThreadId[ref.threadId];
if (
previousEnvironmentState === environmentState &&
previousThreadId === ref.threadId &&
previousActivityIds === activityIds
) {
return previousSnapshot;
}
const activities =
activityIds?.flatMap((activityId) => {
const activity = environmentState.activityByThreadId[ref.threadId]?.[activityId];
return activity ? [activity] : [];
}) ?? [];
const nextSnapshot = deriveLatestContextWindowSnapshot(activities);
previousEnvironmentState = environmentState;
previousThreadId = ref.threadId;
previousActivityIds = activityIds;
if (contextWindowSnapshotsEqual(previousSnapshot, nextSnapshot)) {
return previousSnapshot;
}
previousSnapshot = nextSnapshot;
return nextSnapshot;
};
}
export function createThreadSelectorAcrossEnvironments(
threadId: ThreadId | null | undefined,
): (state: AppState) => Thread | undefined {
@@ -1,26 +1,28 @@
diff --git a/dist/editor/editor.js b/dist/editor/editor.js
index e8013fc6eb6f243a6c912facf3fc0319ac66a8d0..80c82df4cdeb828bd331f5ec2f443d216bedc304 100644
index 4346c77a4e43a98c8524ea5186559fdee7433174..bb2a7ecd1d7f497916a5f220215d5191b095575b 100644
--- a/dist/editor/editor.js
+++ b/dist/editor/editor.js
@@ -77,15 +77,12 @@ var Editor = class {
@@ -77,16 +77,13 @@ var Editor = class {
this.#options = options;
}
edit(component) {
- const { useTokenTransformer, enableGutterUtility, enableLineSelection, expandUnchanged, diffStyle, lineHoverHighlight,...rest } = component.options;
- if (useTokenTransformer !== true || enableGutterUtility === true || enableLineSelection === true || expandUnchanged !== true && Object.hasOwn(component, "fileDiff") || diffStyle === "unified" || lineHoverHighlight !== "disabled") {
+ const { useTokenTransformer, expandUnchanged, diffStyle,...rest } = component.options;
const isDiff = component.type === "file-diff";
- if (useTokenTransformer !== true || enableGutterUtility === true || enableLineSelection === true || lineHoverHighlight !== "disabled" || expandUnchanged !== true && isDiff || diffStyle === "unified" && isDiff) {
+ if (useTokenTransformer !== true || expandUnchanged !== true && isDiff || diffStyle === "unified" && isDiff) {
+ if (useTokenTransformer !== true || expandUnchanged !== true && Object.hasOwn(component, "fileDiff") || diffStyle === "unified") {
component.setOptions({
...rest,
useTokenTransformer: true,
- enableGutterUtility: false,
- enableLineSelection: false,
- lineHoverHighlight: "disabled",
expandUnchanged: true,
diffStyle: "split"
- diffStyle: "split",
- lineHoverHighlight: "disabled"
+ diffStyle: "split"
});
@@ -511,6 +508,7 @@ var Editor = class {
component.rerender();
}
@@ -481,6 +478,7 @@ var Editor = class {
return lineNumber - 1;
};
this.#editorEventDisposes.push(addEventListener(gutterEl, "pointerdown", (e) => {
@@ -45,7 +47,7 @@ index cb8e2026fb5d7a19f489c0a2402efbcb7dff3322..510fad6364d4a2214c7dd65fe2b114f1
return merged;
}
diff --git a/package.json b/package.json
index d1558633de87044b7aa96cff09443db11f163cec..c0b16f0a0bec6fba2026f24f38b2c0a8fa06af7c 100644
index cff9c6b2a955e7568f44279a5b706da164c4f142..3d1f25f8bd1be682549677718d9ed8433872c854 100644
--- a/package.json
+++ b/package.json
@@ -55,6 +55,18 @@
+336 -354
View File
File diff suppressed because it is too large. Load diff
+2 -3
View File
@@ -17,7 +17,7 @@ catalog:
"@effect/vitest": 4.0.0-beta.78
"@noble/curves": 1.9.1
"@noble/hashes": 1.8.0
"@pierre/diffs": 1.3.0-beta.5
"@pierre/diffs": 1.3.0-beta.4
"@types/node": 24.12.4
"@typescript/native-preview": 7.0.0-dev.20260604.1
"@vitest/runner": 4.1.8
@@ -56,7 +56,6 @@ overrides:
"@effect/vitest>@vitest/runner": "-"
"@effect/vitest>vitest": "-"
"@expo/metro-config": 56.0.13
"@pierre/diffs>@shikijs/transformers": ^4.2.0
"@types/node": "catalog:"
effect: "catalog:"
vite: "catalog:"
@@ -78,7 +77,7 @@ patchedDependencies:
"@effect/[email protected]": patches/@[email protected]
"@expo/[email protected]": patches/@expo%[email protected]
"@ff-labs/[email protected]": patches/@[email protected]
"@pierre/[email protected].5": patches/@pierre%[email protected].5.patch
"@pierre/[email protected].4": patches/@pierre%[email protected].4.patch
[email protected]: patches/[email protected]
[email protected]: patches/[email protected]