Skip to content

Commit 2fd8caa

Browse files
committed
Merge main into fix-composer-banner-layout
2 parents be307a4 + d4d5d12 commit 2fd8caa

178 files changed

Lines changed: 10579 additions & 4962 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎apps/desktop/src/preview/Manager.test.ts‎

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3506,7 +3506,10 @@ describe("PreviewManager", () => {
35063506
listeners.set(event, listener);
35073507
}),
35083508
once: vi.fn((event: string, listener: (...args: unknown[]) => void) => {
3509-
listeners.set(event, listener);
3509+
listeners.set(event, (...args) => {
3510+
listeners.delete(event);
3511+
listener(...args);
3512+
});
35103513
}),
35113514
off: vi.fn(),
35123515
ipc: { on: vi.fn(), off: vi.fn(), removeListener: vi.fn() },
@@ -3528,11 +3531,23 @@ describe("PreviewManager", () => {
35283531
const pick = yield* manager.pickElement("tab_1").pipe(Effect.forkChild);
35293532
yield* Effect.yieldNow;
35303533

3531-
listeners.get("did-start-navigation")?.({}, "about:blank", false, false);
3534+
listeners.get("did-start-navigation")?.({
3535+
url: "about:blank",
3536+
isSameDocument: false,
3537+
isMainFrame: false,
3538+
frame: null,
3539+
});
35323540
yield* Effect.yieldNow;
35333541
expect(pick.pollUnsafe()).toBeUndefined();
35343542

3535-
listeners.get("did-start-navigation")?.({}, "https://example.com/next", false, true);
3543+
listeners.get("did-start-navigation")?.({
3544+
url: "https://example.com/next",
3545+
isSameDocument: false,
3546+
isMainFrame: true,
3547+
frame: null,
3548+
});
3549+
yield* Effect.yieldNow;
3550+
expect(pick.pollUnsafe()).toBeDefined();
35363551
expect(yield* Fiber.join(pick)).toBeNull();
35373552
}),
35383553
),

‎apps/desktop/src/preview/Manager.ts‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2566,12 +2566,9 @@ const makeNativeOperations = Effect.fn("PreviewManager.makeOperations")(function
25662566
};
25672567
const onDestroyed = () => settle(null);
25682568
const onNavigated = (
2569-
_event: Electron.Event,
2570-
_url: string,
2571-
_isInPlace: boolean,
2572-
isMainFrame: boolean,
2569+
event: Electron.Event<Electron.WebContentsDidStartNavigationEventParams>,
25732570
) => {
2574-
if (isMainFrame) settle(null);
2571+
if (event.isMainFrame) settle(null);
25752572
};
25762573
const registerPickElement = Effect.fn("PreviewManager.registerPickElement")(function* () {
25772574
// Two picks on one tab can overlap. Swap this session in and cancel
@@ -2592,7 +2589,7 @@ const makeNativeOperations = Effect.fn("PreviewManager.makeOperations")(function
25922589
yield* attempt({ operation: "pickElement.register", tabId, webContentsId: wc.id }, () => {
25932590
wc.ipc.on(ELEMENT_PICKED_CHANNEL, onMessage);
25942591
wc.once("destroyed", onDestroyed);
2595-
wc.once("did-start-navigation", onNavigated);
2592+
wc.on("did-start-navigation", onNavigated);
25962593
if (!wc.isFocused()) wc.focus();
25972594
wc.send(START_PICK_CHANNEL, annotationTheme);
25982595
});

‎apps/mobile/app.config.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ const config: ExpoConfig = {
214214
slug: "t3-code",
215215
platforms: ["ios", "android"],
216216
scheme: variant.scheme,
217-
version: "1.2.0",
217+
version: "1.2.1",
218218
runtimeVersion: {
219219
// Development manifests resolve on every launch, so avoid fingerprint's
220220
// expensive native-project calculation there. Preview and production stay

‎apps/mobile/modules/t3-markdown-text/src/nativeMarkdownText.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ function appendRun(
319319
}
320320

321321
const SKILL_TOKEN_REGEX =
322-
/(^|\s)\$(?![0-9][0-9_]*(?:[kKmMbBtT]|[eE][0-9]+)?(?:\s|$))(?=[a-zA-Z0-9:_-]*[a-zA-Z])([a-zA-Z0-9][a-zA-Z0-9:_-]*)(?=\s|$)/g;
322+
/(^|\s)\p{Sc}(?![0-9][0-9_]*(?:[kKmMbBtT]|[eE][0-9]+)?(?:\s|$))(?=[a-zA-Z0-9:_-]*[a-zA-Z])([a-zA-Z0-9][a-zA-Z0-9:_-]*)(?=\s|$)/gu;
323323

324324
function formatSkillLabel(skill: SelectableMarkdownSkill): string {
325325
const displayName = skill.displayName?.trim();
@@ -359,7 +359,7 @@ function decorateSkillRuns(
359359
continue;
360360
}
361361
const start = (match.index ?? 0) + prefix.length;
362-
const end = start + name.length + 1;
362+
const end = (match.index ?? 0) + match[0].length;
363363
if (start > cursor) {
364364
decorated.push({ ...run, text: run.text.slice(cursor, start) });
365365
}

‎apps/mobile/package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@
9393
"expo-image": "~57.0.3",
9494
"expo-image-manipulator": "~57.0.17",
9595
"expo-image-picker": "~57.0.14",
96+
"expo-keep-awake": "~57.0.2",
9697
"expo-linking": "~57.0.8",
9798
"expo-network": "~57.0.1",
9899
"expo-notifications": "~57.0.15",

‎apps/mobile/src/components/AppSymbol.tsx‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ import IconServer from "@tabler/icons-react-native/IconServer";
8282
import IconSettings from "@tabler/icons-react-native/IconSettings";
8383
import IconSparkles from "@tabler/icons-react-native/IconSparkles";
8484
import IconStack2 from "@tabler/icons-react-native/IconStack2";
85+
import IconStar from "@tabler/icons-react-native/IconStar";
86+
import IconStarFilled from "@tabler/icons-react-native/IconStarFilled";
8587
import IconStethoscope from "@tabler/icons-react-native/IconStethoscope";
8688
import IconSun from "@tabler/icons-react-native/IconSun";
8789
import IconTerminal2 from "@tabler/icons-react-native/IconTerminal2";
@@ -180,6 +182,8 @@ const ANDROID_ICON_BY_SF_SYMBOL: Partial<Record<SFSymbol, Icon>> = {
180182
"square.and.pencil": IconEdit,
181183
"square.grid.2x2": IconApps,
182184
"square.split.2x1": IconLayoutColumns,
185+
star: IconStar,
186+
"star.fill": IconStarFilled,
183187
"sun.max": IconSun,
184188
"stop.fill": IconPlayerStopFilled,
185189
terminal: IconTerminal2,

‎apps/mobile/src/components/ComposerEditor.tsx‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,9 @@ export function ComposerEditor({
155155
const selectedReference = selected
156156
? collectComposerContextReferences(selected.source)[0]
157157
: undefined;
158-
const selectedSkill = selected?.source.startsWith("$")
159-
? props.skills?.find((skill) => skill.name === selected.source.slice(1))
158+
const selectedSkillName = selected?.source.match(/^\p{Sc}(.+)$/u)?.[1];
159+
const selectedSkill = selectedSkillName
160+
? props.skills?.find((skill) => skill.name === selectedSkillName)
160161
: undefined;
161162
const record = draft.context?.records.find(
162163
(entry) => entry.contextId === selectedReference?.contextId,

‎apps/mobile/src/features/threads/ThreadDetailScreen.tsx‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type { WorktreeSetupCardProps } from "./worktree-setup-card";
12
import type { ComposerTextPaste } from "../../native/T3ComposerEditor.types";
23
import { type EnvironmentConnectionPhase } from "@t3tools/client-runtime/connection";
34
import {
@@ -106,6 +107,8 @@ import type { ThreadContentPresentation } from "./threadContentPresentation";
106107
import { resolveThreadFeedSubmissionAnchor } from "./thread-feed-live-follow";
107108

108109
export interface ThreadDetailScreenProps {
110+
readonly worktreeSetup?: WorktreeSetupCardProps | null;
111+
readonly setupWorkingStartedAt?: string | null;
109112
readonly selectedThread: OrchestrationThreadShell;
110113
readonly contentPresentation: ThreadContentPresentation;
111114
readonly screenTone: StatusTone;
@@ -361,6 +364,8 @@ export const ThreadDetailScreen = memo(function ThreadDetailScreen(props: Thread
361364
return null;
362365
}
363366
if (props.creationState?.kind === "preparing") {
367+
// The setup header already reports progress in the feed.
368+
if (props.worktreeSetup) return null;
364369
return {
365370
kind: "preparing",
366371
label: props.creationState.preparingWorktree ? "Setting up worktree…" : "Starting…",
@@ -873,6 +878,8 @@ export const ThreadDetailScreen = memo(function ThreadDetailScreen(props: Thread
873878
threadId={props.selectedThread.id}
874879
workspaceRoot={props.threadCwd}
875880
feed={props.selectedThreadFeed}
881+
worktreeSetup={props.worktreeSetup}
882+
setupWorkingStartedAt={props.setupWorkingStartedAt}
876883
queuedMessages={props.queuedMessages}
877884
dispatchingMessageId={props.dispatchingMessageId}
878885
onEditPendingMessage={handleEditPendingMessage}

‎apps/mobile/src/features/threads/ThreadFeed.tsx‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
import {
2+
WorktreeWorkingHeader,
3+
WorktreeSetupCard,
4+
type WorktreeSetupCardProps,
5+
} from "./worktree-setup-card";
16
import * as Haptics from "expo-haptics";
27
import { KeyboardAwareLegendList } from "@legendapp/list/keyboard";
38
import { useViewabilityAmount, type LegendListRef } from "@legendapp/list/react-native";
@@ -240,6 +245,8 @@ function isFreshTimestamp(input: string): boolean {
240245
}
241246

242247
export interface ThreadFeedProps {
248+
readonly worktreeSetup?: WorktreeSetupCardProps | null;
249+
readonly setupWorkingStartedAt?: string | null;
243250
readonly queuedMessages: ReadonlyArray<QueuedThreadMessage>;
244251
readonly dispatchingMessageId: MessageId | null;
245252
readonly onEditPendingMessage: (message: QueuedThreadMessage) => void;
@@ -2273,6 +2280,8 @@ export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) {
22732280
// even when the final message update arrives before the turn settles.
22742281
const listAppearanceData = useMemo(
22752282
() => ({
2283+
worktreeSetup: props.worktreeSetup,
2284+
setupWorkingStartedAt: props.setupWorkingStartedAt,
22762285
dispatchingMessageId: props.dispatchingMessageId,
22772286
unsettledTurnId,
22782287
copiedRowId,
@@ -2287,6 +2296,8 @@ export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) {
22872296
viewportWidth,
22882297
}),
22892298
[
2299+
props.worktreeSetup,
2300+
props.setupWorkingStartedAt,
22902301
props.dispatchingMessageId,
22912302
unsettledTurnId,
22922303
copiedRowId,
@@ -2454,6 +2465,9 @@ export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) {
24542465
props.latestTurn,
24552466
],
24562467
);
2468+
const setupAnchorIndex = presentedFeed.findIndex(
2469+
(entry) => entry.type === "message" && entry.message.role === "user",
2470+
);
24572471
// The empty↔filled key below remounts the list and resets its imperative
24582472
// content-inset override. Seed the fresh instance synchronously with the
24592473
// current overlay height before the scroll integration's next reaction;
@@ -2765,10 +2779,19 @@ export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) {
27652779
skills: props.skills,
27662780
onUseArtifactTemplate: props.onUseArtifactTemplate,
27672781
})}
2782+
{props.worktreeSetup && info.index === setupAnchorIndex ? (
2783+
<WorktreeSetupCard key={props.threadId} {...props.worktreeSetup} />
2784+
) : props.setupWorkingStartedAt && info.index === setupAnchorIndex ? (
2785+
<WorktreeWorkingHeader startedAt={props.setupWorkingStartedAt} />
2786+
) : null}
27682787
</ThreadMediaVisibility>
27692788
</Animated.View>
27702789
),
27712790
[
2791+
props.worktreeSetup,
2792+
props.setupWorkingStartedAt,
2793+
props.threadId,
2794+
setupAnchorIndex,
27722795
props.dispatchingMessageId,
27732796
props.onEditPendingMessage,
27742797
copiedRowId,
@@ -2944,6 +2967,9 @@ export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) {
29442967
ListHeaderComponent={
29452968
<>
29462969
{usesNativeAutomaticInsets ? null : <View style={{ height: topContentInset }} />}
2970+
{setupAnchorIndex < 0 && props.worktreeSetup ? (
2971+
<WorktreeSetupCard key={props.threadId} {...props.worktreeSetup} />
2972+
) : null}
29472973
{props.loadEarlier != null ? (
29482974
<Pressable
29492975
onPress={props.loadEarlier.onLoadEarlier}
@@ -2964,6 +2990,7 @@ export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) {
29642990
/>
29652991
</View>
29662992
{presentedFeed.length === 0 &&
2993+
!props.worktreeSetup &&
29672994
props.activeWorkStartedAt === null &&
29682995
props.contentPresentation.kind === "ready" ? (
29692996
<View pointerEvents="none" style={StyleSheet.absoluteFill}>

0 commit comments

Comments
 (0)