Skip to content

Commit 6c7c95c

Browse files
Merge remote-tracking branch 'origin/main' into fix/issue-26437
2 parents 89fa25d + 0160c44 commit 6c7c95c

66 files changed

Lines changed: 1486 additions & 1349 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/settings/DesktopClientSettings.test.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ const clientSettings: ClientSettings = {
3434
confirmThreadDelete: false,
3535
confirmThreadUnpin: false,
3636
contextWindowMeterEnabled: false,
37-
composerCollapseOnScroll: true,
3837
diffFilesCollapsed: true,
3938
diffIgnoreWhitespace: true,
4039
diffLayout: "stacked",

‎apps/mobile/metro.config.js‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,6 @@ async function generateMobileThirdPartyLicenses() {
5656
const manifest = await generateThirdPartyLicenseManifest({
5757
configFile: path.join(workspaceRoot, "third-party-licenses.config.json"),
5858
packageManifests: [{ bundle: "mobile", path: path.join(__dirname, "package.json") }],
59-
allowMissingGeneratedNotices:
60-
process.env.NODE_ENV !== "production" &&
61-
process.env.EAS_BUILD !== "true" &&
62-
process.env.T3CODE_LICENSES_STRICT !== "1",
6359
});
6460

6561
await Promise.all([

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,8 @@ import { useSafeAreaInsets } from "react-native-safe-area-context";
3030
import { SymbolView, type AppSymbolName } from "../../components/ui/AppSymbol";
3131
import { AppText as Text, AppTextInput as TextInput } from "../../components/ui/AppText";
3232
import { EnvironmentMachineSymbol } from "../../components/EnvironmentMachineSymbol";
33-
import { useLinkableMachines } from "../../state/peerLinks";
33+
import { peerLinkEnvironment, useLinkableMachines } from "../../state/peerLinks";
3434
import { mintPairingCodeOn } from "../../state/peerPairingCode";
35-
import { serverEnvironment } from "../../state/server";
3635
import { useEnvironmentScope, usePreparedConnection } from "../../state/session";
3736
import { useAtomCommand } from "../../state/use-atom-command";
3837
import { ListChoiceRow as SettingsChoiceRow } from "../../components/ui/ListChoiceRow";
@@ -107,13 +106,13 @@ function PendingLinkRequest(props: {
107106
const [open, setOpen] = useState(false);
108107
const [declining, setDeclining] = useState(false);
109108
const [error, setError] = useState<string | null>(null);
110-
const answer = useAtomCommand(serverEnvironment.answerLinkRequest, {
109+
const answer = useAtomCommand(peerLinkEnvironment.answerRequest, {
111110
label: "decline link request",
112111
reportFailure: false,
113112
reportDefect: false,
114113
});
115114
const canAnswer = useAtomValue(
116-
serverEnvironment.answerLinkRequest.permissionAtom(props.environmentId),
115+
peerLinkEnvironment.answerRequest.permissionAtom(props.environmentId),
117116
);
118117
const target = linkRequestTargetName(item);
119118

@@ -244,7 +243,7 @@ function LinkRequestSheet(props: {
244243
const [mintFailed, setMintFailed] = useState<ReadonlySet<EnvironmentId>>(new Set());
245244
// Submit then a tap can both run before a re-render; this guard is synchronous.
246245
const inFlight = useRef(false);
247-
const answer = useAtomCommand(serverEnvironment.answerLinkRequest, {
246+
const answer = useAtomCommand(peerLinkEnvironment.answerRequest, {
248247
label: "answer link request",
249248
// The failure cause holds the request, and with it the code; keep it out of the console.
250249
reportFailure: false,

‎apps/mobile/src/features/threads/thread-subagent-group.tsx‎

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import type {
77
EnvironmentId,
88
OrchestrationV2Subagent,
99
OrchestrationV2TurnItem,
10+
ServerProvider,
1011
} from "@t3tools/contracts";
1112
import { Pressable, View, type ColorValue } from "react-native";
1213

@@ -41,14 +42,22 @@ function SubagentElapsed({ agents }: { readonly agents: ReadonlyArray<AgentTimin
4142

4243
function SubagentAvatar(props: {
4344
readonly item: SubagentItem;
44-
readonly iconUrl?: string | null | undefined;
45+
readonly provider: ServerProvider | undefined;
4546
}) {
47+
// A remote task's own driver is only a "remote" label.
48+
const driver =
49+
props.provider?.driver ??
50+
(props.item.remoteChild === undefined ? props.item.driver : undefined);
4651
return (
4752
<View
4853
accessible={false}
4954
className="h-7 w-7 shrink-0 items-center justify-center rounded-full border border-border bg-card"
5055
>
51-
<ProviderIcon provider={props.item.driver} iconUrl={props.iconUrl} size={15} />
56+
{driver === undefined ? (
57+
<SymbolView name="sparkles" size={13} tintColorClassName="accent-icon-muted" />
58+
) : (
59+
<ProviderIcon provider={driver} iconUrl={props.provider?.iconUrl} size={15} />
60+
)}
5261
</View>
5362
);
5463
}
@@ -91,11 +100,11 @@ export function ThreadSubagentGroup(props: {
91100
const expanded = props.expandedRows[props.anchorKey] ?? false;
92101
const serverConfigs = useServerConfigs();
93102
// A task in a linked environment runs a provider instance of that environment.
94-
const iconUrl = (item: SubagentItem) =>
103+
const providerOf = (item: SubagentItem) =>
95104
(item.remoteChild === undefined
96105
? config
97106
: serverConfigs.get(item.remoteChild.environmentId)
98-
)?.providers.find((provider) => provider.instanceId === item.providerInstanceId)?.iconUrl;
107+
)?.providers.find((provider) => provider.instanceId === item.providerInstanceId);
99108
return (
100109
<WorkLogBlock>
101110
{grouped ? (
@@ -109,7 +118,7 @@ export function ThreadSubagentGroup(props: {
109118
<View className="flex-row items-center">
110119
{agents.slice(0, 3).map((agent, index) => (
111120
<View key={agent.item.id} style={{ marginLeft: index === 0 ? 0 : -7 }}>
112-
<SubagentAvatar item={agent.item} iconUrl={iconUrl(agent.item)} />
121+
<SubagentAvatar item={agent.item} provider={providerOf(agent.item)} />
113122
</View>
114123
))}
115124
{agents.length > 3 ? (

‎apps/server/src/mcp/OrchestratorMcpService.test.ts‎

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2694,6 +2694,71 @@ describe("OrchestratorMcpService thread lookup", () => {
26942694
);
26952695
});
26962696

2697+
describe("OrchestratorMcpService thread list", () => {
2698+
const client: McpInvocationScope = {
2699+
environmentId: EnvironmentId.make("environment:thread-list"),
2700+
requestNamespace: "client:thread-list",
2701+
thread: undefined,
2702+
client: { sessionId: "thread-list", label: "Claude Code", access: "full-access" },
2703+
capabilities: new Set(["orchestration"]),
2704+
issuedAt: 1,
2705+
};
2706+
const shell = (id: string, projectId: string, snoozed: boolean) => ({
2707+
...liveThreadShell(ThreadId.make(id)),
2708+
projectId: ProjectId.make(projectId),
2709+
status: "completed" as const,
2710+
snoozedUntil: snoozed ? DateTime.makeUnsafe("2099-01-01T00:00:00Z") : null,
2711+
});
2712+
const shells = [
2713+
shell("thread:a-snoozed", "project:a", true),
2714+
shell("thread:a-awake", "project:a", false),
2715+
shell("thread:b-snoozed", "project:b", true),
2716+
];
2717+
const service = layerOrchestratorService.pipe(
2718+
Layer.provide(
2719+
Layer.mergeAll(
2720+
NodeServices.layer,
2721+
Layer.mock(ThreadManagementService.ThreadManagementService)({
2722+
listProjectThreads: (input) =>
2723+
Effect.succeed(
2724+
shells.filter(
2725+
(thread) => input.projectId === undefined || thread.projectId === input.projectId,
2726+
),
2727+
),
2728+
}),
2729+
ServerSettings.layerTest(),
2730+
Layer.mock(ProviderRegistry.ProviderRegistry)({ getProviders: Effect.succeed([]) }),
2731+
Layer.mock(ProviderAdapterRegistry.ProviderAdapterRegistryV2)({
2732+
list: () => Effect.succeed([]),
2733+
}),
2734+
Layer.mock(ProjectService.ProjectService)({}),
2735+
Layer.mock(SecretRequests.SecretRequests)({}),
2736+
Layer.mock(RemoteDelegation.RemoteDelegation)({}),
2737+
Layer.mock(ScheduledTaskService.ScheduledTaskService)({}),
2738+
),
2739+
),
2740+
);
2741+
2742+
it.effect("lists snoozed threads across every project with allProjects", () =>
2743+
Effect.gen(function* () {
2744+
const mcp = yield* OrchestratorMcpService.OrchestratorMcpService;
2745+
const listed = yield* mcp.listThreads(client, {
2746+
allProjects: true,
2747+
projectId: ProjectId.make("project:a"),
2748+
snoozed: true,
2749+
});
2750+
assert.equal(listed.projectId, null);
2751+
assert.deepStrictEqual(
2752+
listed.threads.map((thread) => [thread.threadId, thread.projectId]),
2753+
[
2754+
["thread:a-snoozed", "project:a"],
2755+
["thread:b-snoozed", "project:b"],
2756+
],
2757+
);
2758+
}).pipe(Effect.provide(service)),
2759+
);
2760+
});
2761+
26972762
describe("OrchestratorMcpService thread stop", () => {
26982763
const driver = ProviderDriverKind.make("codex");
26992764
const instanceId = ProviderInstanceId.make("codex");

‎apps/server/src/mcp/OrchestratorMcpService.ts‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -755,6 +755,7 @@ function listItemFromShell(
755755
): OrchestratorMcpThreadListItem {
756756
return {
757757
threadId: shell.id,
758+
projectId: shell.projectId,
758759
title: shell.title,
759760
link: formatThreadLink({ environmentId, threadId: shell.id }),
760761
createdBy: shell.createdBy,
@@ -2764,10 +2765,12 @@ const make = Effect.gen(function* () {
27642765
),
27652766
listThreads: Effect.fn("OrchestratorMcpService.listThreads")(function* (scope, input) {
27662767
const { parent } = yield* loadCaller(scope);
2767-
const projectId = yield* resolveProjectTarget(parent, input.projectId);
2768+
const projectId = input.allProjects
2769+
? null
2770+
: yield* resolveProjectTarget(parent, input.projectId);
27682771
const projectThreads = yield* threadManagement
27692772
.listProjectThreads({
2770-
projectId,
2773+
projectId: projectId ?? undefined,
27712774
includeSubagents: input.includeSubagents !== false,
27722775
})
27732776
.pipe(

‎apps/server/src/mcp/toolkits/orchestrator/tools.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ const CreateThreadsTool = Tool.make("create_threads", {
222222

223223
const ThreadListTool = Tool.make("t3_thread_list", {
224224
description:
225-
"List threads in a project, newest first. Omit `projectId` for yours. Filter by status, title, settled, or snoozed. Page with the cursor.",
225+
"List threads newest first, in one project or with `allProjects`. Page with `cursor`.",
226226
parameters: OrchestratorMcpThreadListInput,
227227
success: OrchestratorMcpThreadListResult,
228228
failure: OrchestratorMcpFailure,

‎apps/server/src/orchestration-v2/ThreadManagementService.ts‎

Lines changed: 32 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -279,12 +279,14 @@ export class ThreadManagementProjectionLoadError extends Schema.TaggedError<Thre
279279
export class ThreadManagementProjectThreadsListError extends Schema.TaggedError<ThreadManagementProjectThreadsListError>()(
280280
"ThreadManagementProjectThreadsListError",
281281
{
282-
projectId: ProjectId,
282+
projectId: Schema.optional(ProjectId),
283283
cause: Schema.Defect(),
284284
},
285285
) {
286286
override get message(): string {
287-
return `Unable to list threads in project ${this.projectId}.`;
287+
return this.projectId === undefined
288+
? "Unable to list threads."
289+
: `Unable to list threads in project ${this.projectId}.`;
288290
}
289291
}
290292

@@ -404,8 +406,9 @@ export interface ThreadManagementServiceShape {
404406
Orchestrator.OrchestratorV2Error
405407
>;
406408
readonly getThreadShell: Orchestrator.OrchestratorV2["Service"]["getThreadShell"];
409+
/** Omit `projectId` to list every project's threads. */
407410
readonly listProjectThreads: (input: {
408-
readonly projectId: ProjectId;
411+
readonly projectId?: ProjectId | undefined;
409412
readonly includeSubagents: boolean;
410413
}) => Effect.Effect<ReadonlyArray<OrchestrationV2ThreadShell>, ThreadManagementError>;
411414
readonly sendToThread: (
@@ -736,27 +739,32 @@ const make = Effect.gen(function* () {
736739
);
737740

738741
const listProjectThreads: ThreadManagementServiceShape["listProjectThreads"] = (input) =>
739-
orchestrator.getShellSnapshot({ projectId: input.projectId, location: "active" }).pipe(
740-
Effect.mapError(
741-
(cause) =>
742-
new ThreadManagementProjectThreadsListError({
743-
projectId: input.projectId,
744-
cause,
745-
}),
746-
),
747-
Effect.map((snapshot) =>
748-
snapshot.threads
749-
.filter(
750-
(thread) =>
751-
input.includeSubagents || thread.lineage.relationshipToParent !== "subagent",
752-
)
753-
.toSorted(
754-
(left, right) =>
755-
DateTime.toEpochMillis(right.updatedAt) - DateTime.toEpochMillis(left.updatedAt) ||
756-
right.id.localeCompare(left.id),
757-
),
758-
),
759-
);
742+
orchestrator
743+
.getShellSnapshot({
744+
location: "active",
745+
...(input.projectId === undefined ? {} : { projectId: input.projectId }),
746+
})
747+
.pipe(
748+
Effect.mapError(
749+
(cause) =>
750+
new ThreadManagementProjectThreadsListError({
751+
projectId: input.projectId,
752+
cause,
753+
}),
754+
),
755+
Effect.map((snapshot) =>
756+
snapshot.threads
757+
.filter(
758+
(thread) =>
759+
input.includeSubagents || thread.lineage.relationshipToParent !== "subagent",
760+
)
761+
.toSorted(
762+
(left, right) =>
763+
DateTime.toEpochMillis(right.updatedAt) - DateTime.toEpochMillis(left.updatedAt) ||
764+
right.id.localeCompare(left.id),
765+
),
766+
),
767+
);
760768

761769
const sendToThread: ThreadManagementServiceShape["sendToThread"] = Effect.fn(
762770
"ThreadManagementService.sendToThread",
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"claudeSystemAppendBytes": 5135,
33
"codexAdditionalContextBytes": 5687,
4-
"mcpToolListJsonBytes": 45861
4+
"mcpToolListJsonBytes": 45842
55
}

‎apps/web/src/components/BranchToolbar.logic.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,12 @@ export function shouldShowComposerContextStrip(input: {
6666
hasActiveProject: boolean;
6767
isGitRepo: boolean;
6868
showEnvironmentIndicator: boolean;
69-
hostsRestingComposerControls: boolean;
7069
}): boolean {
70+
// A new thread always shows the strip, since it names the permissions the first send uses.
7171
return (
7272
input.hasActiveProject &&
73-
(input.isDraftHeroState || input.persistInActiveThreads) &&
74-
(input.isGitRepo || input.showEnvironmentIndicator || input.hostsRestingComposerControls)
73+
(input.isDraftHeroState ||
74+
(input.persistInActiveThreads && (input.isGitRepo || input.showEnvironmentIndicator)))
7575
);
7676
}
7777

0 commit comments

Comments
 (0)