Skip to content

Commit 8fe8fba

Browse files
committed
Merge remote-tracking branch 'github/main' into takeover-26643
2 parents f7c0521 + 32ecd71 commit 8fe8fba

186 files changed

Lines changed: 8191 additions & 1085 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/ipc/channels.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export const SNAP_SHOT_EVENT_CHANNEL = "desktop:snap-shot-event";
1414
export const WEB_LINK_OPEN_CHANNEL = "desktop:web-link-open";
1515
export const WEB_LINK_READY_CHANNEL = "desktop:web-link-ready";
1616
export const QUIT_SHORTCUT_CHANNEL = "desktop:quit-shortcut";
17+
export const TRACKPAD_SCROLL_BEGIN_CHANNEL = "desktop:trackpad-scroll-begin";
1718
export const TRACKPAD_SCROLL_END_CHANNEL = "desktop:trackpad-scroll-end";
1819
export const GET_WINDOW_FULLSCREEN_STATE_CHANNEL = "desktop:get-window-fullscreen-state";
1920
export const WINDOW_FULLSCREEN_STATE_CHANNEL = "desktop:window-fullscreen-state";

‎apps/desktop/src/preload.ts‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,11 @@ contextBridge.exposeInMainWorld("desktopBridge", {
9191
ipcRenderer.on(IpcChannels.SET_NOTIFICATION_BADGE_CHANNEL, handler);
9292
return () => ipcRenderer.removeListener(IpcChannels.SET_NOTIFICATION_BADGE_CHANNEL, handler);
9393
},
94+
onTrackpadScrollBegin: (listener) => {
95+
const handler = () => listener();
96+
ipcRenderer.on(IpcChannels.TRACKPAD_SCROLL_BEGIN_CHANNEL, handler);
97+
return () => ipcRenderer.removeListener(IpcChannels.TRACKPAD_SCROLL_BEGIN_CHANNEL, handler);
98+
},
9499
onTrackpadScrollEnd: (listener) => {
95100
const handler = () => listener();
96101
ipcRenderer.on(IpcChannels.TRACKPAD_SCROLL_END_CHANNEL, handler);

‎apps/desktop/src/window/DesktopWindow.ts‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import {
2323
MENU_ACTION_CHANNEL,
2424
QUIT_SHORTCUT_CHANNEL,
2525
SNAP_SHOT_EVENT_CHANNEL,
26+
TRACKPAD_SCROLL_BEGIN_CHANNEL,
2627
TRACKPAD_SCROLL_END_CHANNEL,
2728
WINDOW_FULLSCREEN_STATE_CHANNEL,
2829
} from "../ipc/channels.ts";
@@ -652,7 +653,11 @@ export const make = Effect.gen(function* () {
652653
}
653654
});
654655
window.webContents.on("input-event", (_event, input) => {
655-
if (input.type === "gestureScrollEnd") window.webContents.send(TRACKPAD_SCROLL_END_CHANNEL);
656+
if (input.type === "gestureScrollBegin") {
657+
window.webContents.send(TRACKPAD_SCROLL_BEGIN_CHANNEL);
658+
} else if (input.type === "gestureScrollEnd") {
659+
window.webContents.send(TRACKPAD_SCROLL_END_CHANNEL);
660+
}
656661
});
657662
// Ctrl+wheel bypasses menus; guest contents emit their own zoom-changed event.
658663
window.webContents.on("zoom-changed", (_event, direction) => {

‎apps/mobile/src/features/review/reviewModel.ts‎

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -534,17 +534,22 @@ export function buildReviewSectionItems(input: {
534534
},
535535
);
536536

537-
const gitItems = input.gitSections.map<ReviewSectionItem>((section) => ({
538-
id: `git:${section.kind}`,
539-
kind: section.kind,
540-
title: section.title,
541-
subtitle: gitSubtitle(section),
542-
diff: section.diff,
543-
source: section,
544-
...(section.files ? { files: section.files } : {}),
545-
truncated: section.truncated,
546-
isLoading: false,
547-
}));
537+
const gitItems = input.gitSections
538+
.filter(
539+
(section): section is typeof section & { kind: ReviewSectionKind } =>
540+
section.kind !== "commit",
541+
)
542+
.map<ReviewSectionItem>((section) => ({
543+
id: `git:${section.kind}`,
544+
kind: section.kind,
545+
title: section.title,
546+
subtitle: gitSubtitle(section),
547+
diff: section.diff,
548+
source: section,
549+
...(section.files ? { files: section.files } : {}),
550+
truncated: section.truncated,
551+
isLoading: false,
552+
}));
548553
const hasChangesItem = gitItems.some((item) => item.id === CHANGES_SECTION_ID);
549554
const visibleGitItems =
550555
input.loadingGitSections && !hasChangesItem

‎apps/mobile/src/features/settings/SettingsEnvironmentDetailRouteScreen.tsx‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,10 @@ function EnvironmentDetail({ environmentId }: { readonly environmentId: Environm
294294
void run("refresh", async () => {
295295
if (!readEnvironmentScope(environmentId, AuthOrchestrationReadScope))
296296
return;
297-
const result = await refreshProviders({ environmentId, input: {} });
297+
const result = await refreshProviders({
298+
environmentId,
299+
input: { reloadSecrets: true },
300+
});
298301
if (AsyncResult.isFailure(result)) throw squashAtomCommandFailure(result);
299302
setNotice("Provider status refreshed.");
300303
});

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

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ import type {
4646
ScopedThreadRef,
4747
ServerConfig as T3ServerConfig,
4848
UsageLimitsReport,
49+
RunId,
4950
} from "@t3tools/contracts";
5051
import {
5152
appendCodexArtifactTemplateUsePrompt,
@@ -156,8 +157,10 @@ import {
156157
import { appAtomRegistry } from "../../state/atom-registry";
157158
import { threadStreamHaptics } from "./threadStreamHaptics";
158159
import { useAtomCommand } from "../../state/use-atom-command";
160+
import { orchestrationEnvironment } from "../../state/orchestration";
159161
import { useDelayedStatus } from "../../lib/useDelayedStatus";
160162
import type { PendingUserInputDraftAnswer } from "@t3tools/client-runtime/state/pending-user-input";
163+
import type { RunStopPresentation } from "@t3tools/client-runtime/state/thread-execution";
161164
import type {
162165
PendingApproval,
163166
PendingUserInput,
@@ -339,6 +342,9 @@ const threadVisitTracker = createThreadVisitTracker({
339342

340343
// Past the composer's 180 ms height animation.
341344
const COMPOSER_HEIGHT_SETTLE_MS = 220;
345+
const NO_RUN_STOP_ATOM = Atom.make<RunStopPresentation | null>(null).pipe(
346+
Atom.withLabel("mobile-thread-run-stop:empty"),
347+
);
342348

343349
// Connection failures survive retries and app suspension.
344350
const RECONNECT_ERROR_DELAY_MS = 5_000;
@@ -539,6 +545,50 @@ function ThreadDetailBody(props: ThreadDetailScreenProps) {
539545
const unsettleThread = useAtomCommand(threadEnvironment.unsettle, { reportFailure: false });
540546
const updateMetadata = useAtomCommand(threadEnvironment.updateMetadata, { reportFailure: false });
541547
const visitThread = useAtomCommand(threadEnvironment.visit, { reportFailure: false });
548+
const anyRunStop = useAtomValue(
549+
props.selectedThreadDetailRef === null
550+
? NO_RUN_STOP_ATOM
551+
: environmentThreadDetails.runStopAtom(props.selectedThreadDetailRef),
552+
);
553+
// A background Stop matters only while that work is still pending.
554+
const runStop =
555+
anyRunStop?.background && props.selectedThread.pendingBackgroundTasks.length === 0
556+
? null
557+
: anyRunStop;
558+
const forceStopThread = useAtomCommand(orchestrationEnvironment.forceStopThread, {
559+
reportFailure: false,
560+
});
561+
const canForceStop =
562+
useAtomValue(orchestrationEnvironment.forceStopThread.permissionAtom(props.environmentId)) &&
563+
props.serverConfig?.environment.capabilities.threadForceStop === true;
564+
const [forceStoppingKey, setForceStoppingKey] = useState<string | null>(null);
565+
// The run that ignored Stop, so a confirmation left open cannot hit a newer run.
566+
const forceStop = async (runId: RunId | undefined) => {
567+
const threadKey = selectedThreadKey;
568+
setForceStoppingKey(threadKey);
569+
const result = await forceStopThread({
570+
environmentId: props.environmentId,
571+
input:
572+
runId === undefined
573+
? { threadId: props.selectedThread.id }
574+
: { threadId: props.selectedThread.id, runId },
575+
});
576+
setForceStoppingKey((current) => (current === threadKey ? null : current));
577+
if (result._tag === "Failure") {
578+
if (!isAtomCommandInterrupted(result)) Dialog.alert("Could not force stop the agent");
579+
return;
580+
}
581+
const others = result.value.sharedWithThreadIds.length;
582+
if (result.value.outcome === "releasing") {
583+
Dialog.alert("Turn stopped; the agent is still shutting down");
584+
}
585+
if (result.value.outcome === "shared") {
586+
Dialog.alert(
587+
"Turn stopped; the agent process kept running",
588+
`It is shared with ${others === 0 ? "other" : others} working ${others === 1 ? "thread" : "threads"}. Stop those to free it.`,
589+
);
590+
}
591+
};
542592
const [statusRequest, setStatusRequest] = useState<{ threadKey: string } | null>(null);
543593
const statusPending = statusRequest?.threadKey === selectedThreadKey;
544594
const [lifecycleNow, setLifecycleNow] = useState(() => new Date().toISOString());
@@ -630,6 +680,32 @@ function ThreadDetailBody(props: ThreadDetailScreenProps) {
630680
if (connectionStatus !== null && !props.draftMode) {
631681
return connectionStatus;
632682
}
683+
// Before the request check: an agent stuck on an approval may also ignore Stop.
684+
if (runStop !== null && contentPresentationKind === "ready") {
685+
const unresponsive = runStop.state === "unresponsive";
686+
return {
687+
kind: "stop",
688+
unresponsive,
689+
label: unresponsive ? "Not responding to Stop" : "Stopping…",
690+
action:
691+
unresponsive && canForceStop
692+
? {
693+
label: forceStoppingKey === selectedThreadKey ? "Force stopping..." : "Force stop",
694+
accessibilityLabel: "Force stop the agent",
695+
disabled: forceStoppingKey === selectedThreadKey,
696+
onPress: () =>
697+
Dialog.confirm({
698+
title: "Force stop the agent?",
699+
message:
700+
"It has not answered Stop. Force stop ends the turn and kills the agent's processes, unless other working threads share them.",
701+
confirmText: "Force stop",
702+
destructive: true,
703+
onConfirm: () => void forceStop(runStop.runId),
704+
}),
705+
}
706+
: null,
707+
};
708+
}
633709
if (props.activePendingApproval !== null || props.activePendingUserInput !== null) {
634710
return null;
635711
}

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

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,9 @@ export function FloatingWorkingControl(props: {
8383
const [queueWidth, setQueueWidth] = useState(0);
8484
const [actionWidth, setActionWidth] = useState(0);
8585
const action =
86-
props.status?.kind === "background" || props.status?.kind === "lifecycle"
86+
props.status?.kind === "background" ||
87+
props.status?.kind === "lifecycle" ||
88+
props.status?.kind === "stop"
8789
? props.status.action
8890
: null;
8991
const [agentsWidth, setAgentsWidth] = useState(0);
@@ -471,6 +473,30 @@ function FloatingStatusLabel(props: {
471473
</StatusLabelRow>
472474
);
473475
}
476+
if (props.status.kind === "stop") {
477+
return (
478+
<StatusLabelRow
479+
key="stop"
480+
accessibilityLabel={props.status.label}
481+
className="gap-2"
482+
onLayout={props.onLayout}
483+
>
484+
{props.status.unresponsive ? (
485+
<SymbolView
486+
name="exclamationmark.triangle"
487+
size={13}
488+
tintColorClassName="accent-warning-foreground"
489+
type="monochrome"
490+
/>
491+
) : (
492+
<AppActivityIndicator size="small" colorClassName="accent-icon-muted" />
493+
)}
494+
<Text className="shrink font-t3-medium text-xs text-foreground" numberOfLines={1}>
495+
{props.status.label}
496+
</Text>
497+
</StatusLabelRow>
498+
);
499+
}
474500
if (props.status.kind === "goal") {
475501
return (
476502
<StatusLabelRow

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ export type FloatingWorkingStatus =
3131
readonly label: string;
3232
readonly action: FloatingStatusAction;
3333
}
34+
| {
35+
readonly kind: "stop";
36+
readonly label: string;
37+
readonly unresponsive: boolean;
38+
readonly action: FloatingStatusAction | null;
39+
}
3440
| { readonly kind: "goal"; readonly label: string; readonly accessibilityLabel: string }
3541
| { readonly kind: "preparing"; readonly label: string }
3642
| {

‎apps/mobile/src/lib/threadActivity.test.ts‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -846,7 +846,7 @@ describe("buildThreadFeed", () => {
846846
expect(collapsed[1]).toMatchObject({
847847
type: "run-fold",
848848
createdAt: "2026-06-20T00:00:01.500Z",
849-
label: "Worked for 2.0s",
849+
label: "Worked for 2s",
850850
});
851851

852852
const expanded = deriveThreadFeedPresentation(feed, latestRun, new Set([runId]));
@@ -1100,10 +1100,10 @@ describe("buildThreadFeed", () => {
11001100
const settled = deriveThreadFeedPresentation(feed(false), null, new Set());
11011101
expect(shape(settled)).toEqual([
11021102
"user:launch",
1103-
"fold:Worked for 8.0s",
1103+
"fold:Worked for 8s",
11041104
"assistant:launch-answer",
11051105
"user:resume",
1106-
"fold:Worked for 8.0s",
1106+
"fold:Worked for 8s",
11071107
"assistant:resume-answer",
11081108
]);
11091109
const launchFold = settled.find((entry) => entry.type === "run-fold");
@@ -1112,11 +1112,11 @@ describe("buildThreadFeed", () => {
11121112
shape(deriveThreadFeedPresentation(feed(false), null, new Set([launchFold.runId]))),
11131113
).toEqual([
11141114
"user:launch",
1115-
"fold:Worked for 8.0s",
1115+
"fold:Worked for 8s",
11161116
"activity-group",
11171117
"assistant:launch-answer",
11181118
"user:resume",
1119-
"fold:Worked for 8.0s",
1119+
"fold:Worked for 8s",
11201120
"assistant:resume-answer",
11211121
]);
11221122

@@ -1133,7 +1133,7 @@ describe("buildThreadFeed", () => {
11331133
),
11341134
).toEqual([
11351135
"user:launch",
1136-
"fold:Worked for 8.0s",
1136+
"fold:Worked for 8s",
11371137
"assistant:launch-answer",
11381138
"user:resume",
11391139
"activity-group",

‎apps/server/package.json‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@
7878
"@opencode-ai/sdk": "^1.3.15",
7979
"@t3tools/contracts": "workspace:*",
8080
"@t3tools/provider-testing": "workspace:*",
81+
"@t3tools/secret-provider-core": "workspace:*",
82+
"@t3tools/secret-provider-definitions": "workspace:*",
83+
"@t3tools/secret-provider-onepassword": "workspace:*",
8184
"@t3tools/shared": "workspace:*",
8285
"@t3tools/source-control-testing": "workspace:*",
8386
"@t3tools/ssh": "workspace:*",

0 commit comments

Comments
 (0)