Skip to content

Commit 1e3b4dc

Browse files
Merge remote-tracking branch 'upstream/main' into fix/failed-git-action-refreshes-status
# Conflicts: # apps/server/src/ws.test.ts
2 parents 833261e + 9a5c197 commit 1e3b4dc

158 files changed

Lines changed: 5085 additions & 590 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.

‎.github/workflows/ci.yml‎

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,41 @@ jobs:
192192
if: ${{ !cancelled() && steps.build.outcome == 'success' }}
193193
run: node apps/desktop/scripts/verify-preload-bundle.mjs
194194

195+
# Browser tests run source modules; this boots the production chunk graph. The
196+
# desktop build above already produced apps/web/dist, and the client waits about
197+
# 15s for a session that never comes, so this runs here instead of in Test Web,
198+
# which gates the whole run. Chromium comes from the cache Test Web shares.
199+
- name: Resolve Playwright version
200+
id: playwright_version
201+
if: ${{ !cancelled() && steps.build.outcome == 'success' && needs.changes.outputs.test_web != 'false' }}
202+
run: echo "version=$(node -p "require('./apps/web/node_modules/playwright/package.json').version")" >> "$GITHUB_OUTPUT"
203+
204+
- name: Cache Chromium
205+
id: chromium_cache
206+
if: ${{ !cancelled() && steps.build.outcome == 'success' && needs.changes.outputs.test_web != 'false' }}
207+
uses: actions/cache@v6
208+
with:
209+
path: ~/.cache/ms-playwright
210+
key: playwright-chromium-shell-${{ runner.os }}-${{ runner.arch }}-${{ steps.playwright_version.outputs.version }}
211+
212+
- name: Install Chromium for the built web client boot check
213+
if: ${{ !cancelled() && steps.build.outcome == 'success' && needs.changes.outputs.test_web != 'false' && steps.chromium_cache.outputs.cache-hit != 'true' }}
214+
run: node apps/web/node_modules/playwright/cli.js install --only-shell chromium
215+
216+
- name: Install missing Chromium system dependencies
217+
if: ${{ !cancelled() && steps.build.outcome == 'success' && needs.changes.outputs.test_web != 'false' }}
218+
run: |
219+
browser=$(find "$HOME/.cache/ms-playwright" -name chrome-headless-shell -type f -print -quit)
220+
test -n "$browser"
221+
if ldd "$browser" | grep '=> not found'; then
222+
node apps/web/node_modules/playwright/cli.js install-deps chromium
223+
fi
224+
225+
- name: Boot the built web client
226+
if: ${{ !cancelled() && steps.build.outcome == 'success' && needs.changes.outputs.test_web != 'false' }}
227+
timeout-minutes: 3
228+
run: node apps/web/scripts/verify-built-boot.ts
229+
195230
- name: Typecheck
196231
if: ${{ !cancelled() && steps.typecheck.outcome == 'success' }}
197232
timeout-minutes: 5
@@ -340,12 +375,6 @@ jobs:
340375
- name: Test
341376
run: vp run --filter @t3tools/web test
342377

343-
# Browser tests run source modules; this boots the production chunk graph.
344-
- name: Boot the built web client
345-
run: |
346-
vp run --filter @t3tools/web build
347-
node apps/web/scripts/verify-built-boot.ts
348-
349378
# apps/server sets `fileParallelism: false`, so its test files run strictly
350379
# one at a time. Sharding spreads them over separate runners instead of
351380
# separate workers, so no two server test files ever share a machine and the

‎apps/mobile/src/components/ui/Dialog.android.tsx‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
Text,
1111
useNativeState,
1212
} from "@expo/ui/jetpack-compose";
13+
import { verticalScroll } from "@expo/ui/jetpack-compose/modifiers";
1314

1415
import { useAppearancePreferences } from "../../features/settings/appearance/AppearancePreferencesProvider";
1516
import { useScaledTextRole } from "../../features/settings/appearance/useScaledTextRole";
@@ -252,7 +253,9 @@ function DialogPresentation(props: DialogPresentationProps) {
252253
</AlertDialog.Text>
253254
) : props.request.message ? (
254255
<AlertDialog.Text>
255-
<Text style={bodyTypography}>{props.request.message}</Text>
256+
<Text modifiers={[verticalScroll()]} style={bodyTypography}>
257+
{props.request.message}
258+
</Text>
256259
</AlertDialog.Text>
257260
) : null}
258261
{actions.length > 1 ? (

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ import type { ThreadContentPresentation } from "./threadContentPresentation";
208208
import { resolveThreadFeedSubmissionAnchor } from "./thread-feed-live-follow";
209209
import { useOpenLinkedThread } from "./useOpenLinkedThread";
210210
import { useGlobalVoiceInput } from "../voice-input/VoiceInputProvider";
211+
import type { OrchestrationV2ProviderSession } from "@t3tools/contracts";
211212

212213
export interface ThreadDetailScreenProps {
213214
readonly header?: React.ReactNode;
@@ -240,6 +241,7 @@ export interface ThreadDetailScreenProps {
240241
readonly activeWorkStartedAt: string | null;
241242
readonly runlessWorkActive?: boolean;
242243
readonly providerSubagentStatus?: ProviderSubagentStatus | null;
244+
readonly extensionStatuses?: NonNullable<OrchestrationV2ProviderSession["extensionStatuses"]>;
243245
readonly isCompacting: boolean;
244246
readonly creationState:
245247
| {
@@ -735,6 +737,13 @@ function ThreadDetailBody(
735737
const pendingBackgroundWork = presentPendingBackgroundWork(
736738
props.selectedThread.pendingBackgroundTasks,
737739
);
740+
const extensionStatus = props.extensionStatuses?.length
741+
? {
742+
label: `Pi · ${props.extensionStatuses.map((status) => status.text).join(" · ")}`,
743+
onPress: () =>
744+
Dialog.alert("Pi", props.extensionStatuses?.map((status) => status.text).join("\n\n")),
745+
}
746+
: null;
738747
const floatingStatus = ((): FloatingWorkingStatus | null => {
739748
const connectionStatus = connectionFloatingStatus({
740749
connectionError: connectionRetrying ? retryConnectionError : props.connectionError,
@@ -864,6 +873,9 @@ function ThreadDetailBody(
864873
accessibilityLabel: `${goal.title}: ${goal.objective}`,
865874
};
866875
}
876+
if (extensionStatus !== null && contentPresentationKind === "ready") {
877+
return { kind: "extension", ...extensionStatus };
878+
}
867879
return null;
868880
})();
869881
const showWorkingControl = floatingStatus !== null;
@@ -1602,6 +1614,16 @@ function ThreadDetailBody(
16021614
<FloatingWorkingControl
16031615
colorScheme={isDarkMode ? "dark" : "light"}
16041616
status={floatingStatus}
1617+
extensionStatus={
1618+
floatingStatus !== null &&
1619+
(floatingStatus.kind === "working" ||
1620+
floatingStatus.kind === "compacting" ||
1621+
floatingStatus.kind === "background" ||
1622+
floatingStatus.kind === "goal" ||
1623+
floatingStatus.kind === "lifecycle")
1624+
? extensionStatus
1625+
: null
1626+
}
16051627
lift={floatingControlLift}
16061628
devicePreview={
16071629
devicePreviews.length > 0

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -991,6 +991,7 @@ function ThreadRouteContent(
991991
}
992992
isCompacting={composer.isCompacting}
993993
runlessWorkActive={composer.runlessWorkActive}
994+
extensionStatuses={composer.extensionStatuses}
994995
providerSubagentStatus={composer.providerSubagentStatus}
995996
creationState={creationState}
996997
setupWorkingStartedAt={

‎apps/mobile/src/features/threads/floating-working-control.tsx‎

Lines changed: 59 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ export const FLOATING_WORKING_CONTROL_COVERAGE = CONTROL_OVERLAY_OFFSET + CONTRO
6969
export function FloatingWorkingControl(props: {
7070
readonly colorScheme: "light" | "dark";
7171
readonly status: FloatingWorkingStatus | null;
72+
readonly extensionStatus?: { readonly label: string; readonly onPress: () => void } | null;
7273
readonly devicePreview: { readonly count: number; readonly onPress: () => void } | null;
7374
readonly browserPreview: { readonly count: number; readonly onPress: () => void } | null;
7475
readonly showScrollToEnd: boolean;
@@ -84,6 +85,10 @@ export function FloatingWorkingControl(props: {
8485
const [overlayWidth, setOverlayWidth] = useState(windowWidth);
8586
const [queueWidth, setQueueWidth] = useState(0);
8687
const [actionWidth, setActionWidth] = useState(0);
88+
const [extensionWidth, setExtensionWidth] = useState(0);
89+
const extensionStatus = props.extensionStatus ?? null;
90+
const extensionOnly = props.status?.kind === "extension";
91+
const useGlass = NATIVE_LIQUID_GLASS_SUPPORTED && !extensionOnly;
8792
const action =
8893
props.status?.kind === "background" ||
8994
props.status?.kind === "lifecycle" ||
@@ -96,7 +101,7 @@ export function FloatingWorkingControl(props: {
96101
const [previewWidth, setPreviewWidth] = useState(0);
97102
const agents = props.agents;
98103
const hasAgents = agents !== null;
99-
const labelWidth = Math.max(
104+
const availableLabelWidth = Math.max(
100105
0,
101106
Math.min(overlayWidth, windowWidth) -
102107
CONTROL_HEIGHT -
@@ -106,6 +111,10 @@ export function FloatingWorkingControl(props: {
106111
(hasAgents ? agentsWidth : 0) -
107112
(hasPreview ? previewWidth : 0),
108113
);
114+
const labelWidth = Math.max(
115+
0,
116+
availableLabelWidth - (extensionStatus === null ? 0 : extensionWidth),
117+
);
109118
const separationProgress = useSharedValue(props.showScrollToEnd ? 1 : 0);
110119

111120
// oxlint-disable-next-line t3code/no-unreasoned-state-sync -- animates the Reanimated separation value when scroll-to-end visibility changes
@@ -163,10 +172,16 @@ export function FloatingWorkingControl(props: {
163172
(props.devicePreview !== null && props.browserPreview !== null);
164173
const statusInteractive =
165174
props.status?.kind === "connection" ||
175+
props.status?.kind === "extension" ||
166176
props.status?.kind === "child-input" ||
167177
props.status?.kind === "background";
168178
const capsuleInteractive =
169-
statusInteractive || action !== null || hasQueue || hasAgents || hasPreview;
179+
statusInteractive ||
180+
extensionStatus !== null ||
181+
action !== null ||
182+
hasQueue ||
183+
hasAgents ||
184+
hasPreview;
170185
const statusContent =
171186
props.status !== null ? (
172187
<View
@@ -181,7 +196,9 @@ export function FloatingWorkingControl(props: {
181196
>
182197
<FloatingStatusLabel
183198
key={
184-
props.status.kind === "working" || props.status.kind === "compacting"
199+
props.status.kind === "working" ||
200+
props.status.kind === "compacting" ||
201+
props.status.kind === "extension"
185202
? props.status.kind
186203
: `${props.status.kind}:${props.status.label}`
187204
}
@@ -195,6 +212,22 @@ export function FloatingWorkingControl(props: {
195212
const capsuleContent = (
196213
<View className="flex-row items-center">
197214
{statusContent}
215+
{extensionStatus !== null ? (
216+
<Pressable
217+
accessibilityRole="button"
218+
accessibilityLabel={extensionStatus.label}
219+
accessibilityHint="Shows the full Pi status"
220+
onPress={extensionStatus.onPress}
221+
onLayout={(event) => setExtensionWidth(settleWidth(event.nativeEvent.layout.width))}
222+
style={{ maxWidth: availableLabelWidth * 0.5 }}
223+
className="h-11 flex-row items-center px-3 active:opacity-70"
224+
>
225+
{hasStatus ? <View className="absolute left-0 h-4 w-px bg-border" /> : null}
226+
<Text className="shrink font-t3-medium text-xs text-foreground" numberOfLines={1}>
227+
{extensionStatus.label}
228+
</Text>
229+
</Pressable>
230+
) : null}
198231
{action !== null ? (
199232
<View
200233
onLayout={(event) => setActionWidth(settleWidth(event.nativeEvent.layout.width))}
@@ -273,10 +306,10 @@ export function FloatingWorkingControl(props: {
273306
className="absolute left-0 right-0 z-20 items-center"
274307
style={[{ top: -CONTROL_OVERLAY_OFFSET }, liftStyle]}
275308
onLayout={(event) => setOverlayWidth(event.nativeEvent.layout.width)}
276-
entering={NATIVE_LIQUID_GLASS_SUPPORTED || reducedMotion ? undefined : CONTROL_ENTERING}
277-
exiting={NATIVE_LIQUID_GLASS_SUPPORTED || reducedMotion ? undefined : CONTROL_EXITING}
309+
entering={useGlass || extensionOnly || reducedMotion ? undefined : CONTROL_ENTERING}
310+
exiting={useGlass || extensionOnly || reducedMotion ? undefined : CONTROL_EXITING}
278311
>
279-
{hasCapsule && NATIVE_LIQUID_GLASS_SUPPORTED ? (
312+
{hasCapsule && useGlass ? (
280313
<UniwindGlassContainer
281314
spacing={GLASS_MERGE_SPACING}
282315
pointerEvents="box-none"
@@ -374,6 +407,23 @@ function FloatingStatusLabel(props: {
374407
readonly status: FloatingWorkingStatus;
375408
readonly onLayout: (event: LayoutChangeEvent) => void;
376409
}) {
410+
if (props.status.kind === "extension") {
411+
return (
412+
<StatusLabelRow
413+
accessibilityLabel={props.status.label}
414+
accessibilityRole="button"
415+
onPress={props.status.onPress}
416+
onLayout={props.onLayout}
417+
className="gap-1.5"
418+
animated={false}
419+
>
420+
<Text className="shrink font-t3-medium text-xs text-foreground" numberOfLines={1}>
421+
{props.status.label}
422+
</Text>
423+
<SymbolView name="chevron.down" size={10} tintColorClassName="accent-foreground" />
424+
</StatusLabelRow>
425+
);
426+
}
377427
if (props.status.kind === "syncing") {
378428
return (
379429
<StatusLabelRow
@@ -546,6 +596,7 @@ function FloatingStatusLabel(props: {
546596
}
547597

548598
function StatusLabelRow(props: {
599+
readonly animated?: boolean;
549600
readonly accessibilityLabel?: string;
550601
readonly accessibilityRole?: "button";
551602
readonly className?: string;
@@ -558,8 +609,8 @@ function StatusLabelRow(props: {
558609
return (
559610
<Animated.View
560611
className="absolute max-w-full"
561-
entering={reducedMotion ? undefined : LABEL_ENTERING}
562-
exiting={reducedMotion ? undefined : LABEL_EXITING}
612+
entering={props.animated === false || reducedMotion ? undefined : LABEL_ENTERING}
613+
exiting={props.animated === false || reducedMotion ? undefined : LABEL_EXITING}
563614
onLayout={props.onLayout}
564615
>
565616
{props.onPress ? (

‎apps/mobile/src/features/threads/floating-working-status.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ export type FloatingWorkingStatus =
3838
readonly action: FloatingStatusAction | null;
3939
}
4040
| { readonly kind: "goal"; readonly label: string; readonly accessibilityLabel: string }
41+
| { readonly kind: "extension"; readonly label: string; readonly onPress: () => void }
4142
| { readonly kind: "preparing"; readonly label: string }
4243
| {
4344
readonly kind: "connection";

‎apps/mobile/src/state/use-thread-composer-state.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import type { ThreadCheckpointSummary } from "@t3tools/client-runtime/state/thre
99
import { resolvePendingHandoff } from "@t3tools/client-runtime/handoff";
1010
import {
1111
deriveProviderSubagentStatus,
12+
deriveProviderExtensionStatuses,
1213
deriveResumableRunId,
1314
deriveRunlessWorkStartedAt,
1415
deriveThreadActivityRun,
@@ -874,6 +875,9 @@ export function useThreadComposerState(input: {
874875
dispatchingQueuedMessageId,
875876
activeWorkStartedAt,
876877
runlessWorkActive,
878+
extensionStatuses: deriveProviderExtensionStatuses(
879+
selectedThreadProjection?.projection ?? null,
880+
),
877881
providerSubagentStatus,
878882
isCompacting,
879883
composerDraftKey,

‎apps/server/src/auth/EnvironmentAuth.test.ts‎

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -785,6 +785,45 @@ it.layer(Layer.mergeAll(NodeServices.layer, NodePlatformCrypto.layer))(
785785
),
786786
);
787787

788+
it.effect.each(["DPoP", "dpop", "dPoP"])(
789+
"accepts %s for a proof-bound HTTP request",
790+
(scheme) =>
791+
Effect.gen(function* () {
792+
const serverAuth = yield* EnvironmentAuth.EnvironmentAuth;
793+
const key = makeDpopKey();
794+
const { access_token: token } =
795+
yield* serverAuth.exchangeBootstrapCredentialForAccessToken(
796+
"desktop-bootstrap-token",
797+
["orchestration:read"],
798+
requestMetadata,
799+
{ proofKeyThumbprint: key.thumbprint },
800+
);
801+
const iat = Math.floor((yield* DateTime.now).epochMilliseconds / 1_000);
802+
const request = {
803+
method: "GET",
804+
url: "/api/auth/session",
805+
cookies: {},
806+
headers: {
807+
host: "192.168.1.50:3773",
808+
authorization: `${scheme} ${token}`,
809+
dpop: key.sign({
810+
method: "GET",
811+
url: "http://192.168.1.50:3773/api/auth/session",
812+
token,
813+
iat,
814+
}),
815+
},
816+
} as never;
817+
expect((yield* serverAuth.authenticateHttpRequest(request)).sessionId).toBeTypeOf(
818+
"string",
819+
);
820+
}).pipe(
821+
Effect.provide(
822+
layerEnvironmentAuth({ desktopBootstrapToken: "desktop-bootstrap-token" }),
823+
),
824+
),
825+
);
826+
788827
it.effect("rejects a replayed proof on a bound RPC socket ticket", () =>
789828
Effect.gen(function* () {
790829
const serverAuth = yield* EnvironmentAuth.EnvironmentAuth;

‎apps/server/src/auth/EnvironmentAuth.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,7 @@ export function parseBearerToken(request: HttpServerRequest.HttpServerRequest):
640640

641641
function parseDpopToken(request: HttpServerRequest.HttpServerRequest): string | null {
642642
const header = request.headers["authorization"];
643-
if (typeof header !== "string" || !header.startsWith(DPOP_AUTHORIZATION_PREFIX)) {
643+
if (typeof header !== "string" || !/^DPoP /i.test(header)) {
644644
return null;
645645
}
646646
const token = header.slice(DPOP_AUTHORIZATION_PREFIX.length).trim();

0 commit comments

Comments
 (0)