diff --git a/apps/mobile/src/features/threads/PendingApprovalCard.tsx b/apps/mobile/src/features/threads/PendingApprovalCard.tsx index 8bd11b40a2..dbb59a99f2 100644 --- a/apps/mobile/src/features/threads/PendingApprovalCard.tsx +++ b/apps/mobile/src/features/threads/PendingApprovalCard.tsx @@ -14,13 +14,10 @@ export interface PendingApprovalCardProps { } export function PendingApprovalCard(props: PendingApprovalCardProps) { -<<<<<<< HEAD // Opaque for the same reason as PendingUserInputCard: nothing blurs the feed // behind this card, so a translucent surface bleeds messages through it. -======= const canRespond = props.approval.responseCapability === "live"; const disabled = !canRespond || props.respondingApprovalId === props.approval.requestId; ->>>>>>> 79c36e6204 (Complete orchestration V2 frontend cutover) return ( diff --git a/apps/mobile/src/features/threads/PendingUserInputCard.tsx b/apps/mobile/src/features/threads/PendingUserInputCard.tsx index 82ed65af02..ec0cfdb7c9 100644 --- a/apps/mobile/src/features/threads/PendingUserInputCard.tsx +++ b/apps/mobile/src/features/threads/PendingUserInputCard.tsx @@ -20,13 +20,10 @@ export interface PendingUserInputCardProps { } export function PendingUserInputCard(props: PendingUserInputCardProps) { -<<<<<<< HEAD // The surface is opaque on purpose: the card floats over the thread feed // with no blur behind it, so a translucent background renders the questions // on top of whatever message happens to sit underneath. -======= const canRespond = props.pendingUserInput.responseCapability === "live"; ->>>>>>> 79c36e6204 (Complete orchestration V2 frontend cutover) return ( diff --git a/apps/mobile/src/features/threads/ThreadFeed.tsx b/apps/mobile/src/features/threads/ThreadFeed.tsx index 7cb2661141..7b56a4ca04 100644 --- a/apps/mobile/src/features/threads/ThreadFeed.tsx +++ b/apps/mobile/src/features/threads/ThreadFeed.tsx @@ -1641,7 +1641,6 @@ export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) { reportHeaderMaterialVisibility(false); }, [props.threadId, reportHeaderMaterialVisibility]); -<<<<<<< HEAD // A thread switch opens pinned to the end; a send explicitly returns to the // live edge (ThreadDetailScreen scrolls the new message into place). Both // re-arm follow regardless of where the user had scrolled before. @@ -1656,17 +1655,6 @@ export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) { } }, [props.anchorMessageId, setEndFollow]); - const expandedWorkGroupIds = useMemo(() => { - const ids = new Set(); - for (const [groupId, expanded] of Object.entries(expandedWorkGroups)) { - if (expanded) { - ids.add(groupId); - } - } - return ids; - }, [expandedWorkGroups]); -======= ->>>>>>> 0c15987295 (fix: reconcile rebase with latest main) const presentedFeed = useMemo( () => deriveThreadFeedPresentation( diff --git a/apps/mobile/src/lib/threadActivity.ts b/apps/mobile/src/lib/threadActivity.ts index 393882ec43..5d0355d883 100644 --- a/apps/mobile/src/lib/threadActivity.ts +++ b/apps/mobile/src/lib/threadActivity.ts @@ -80,37 +80,6 @@ export interface ThreadFeedMessage { readonly projectedItem: OrchestrationV2ProjectedTurnItem; } -<<<<<<< HEAD -const MAX_VISIBLE_WORK_LOG_ENTRIES = 1; - -type WorkLogToolLifecycleStatus = "inProgress" | "completed" | "failed" | "declined" | "stopped"; - -interface WorkLogEntry { - id: string; - createdAt: string; - turnId: TurnId | null; - label: string; - detail?: string; - command?: string; - rawCommand?: string; - changedFiles?: ReadonlyArray; - tone: "thinking" | "tool" | "info" | "error"; - toolTitle?: string; - itemType?: ToolLifecycleItemType; - requestKind?: PendingApproval["requestKind"]; - toolLifecycleStatus?: WorkLogToolLifecycleStatus; - toolData?: unknown; -} - -interface DerivedWorkLogEntry extends WorkLogEntry { - activityKind: OrchestrationThreadActivity["kind"]; - collapseKey?: string; - /** Grouping key for subagent lifecycle rows (one row per agent). */ - taskId?: string; -} - -======= ->>>>>>> 79c36e6204 (Complete orchestration V2 frontend cutover) type RawThreadFeedEntry = | { readonly type: "message"; @@ -175,323 +144,6 @@ function normalizeDraftAnswer(value: string | undefined): string | null { function resolvePendingUserInputAnswer( draft: PendingUserInputDraftAnswer | undefined, ): string | null { -<<<<<<< HEAD - const customAnswer = normalizeDraftAnswer(draft?.customAnswer); - if (customAnswer) { - return customAnswer; - } - return normalizeDraftAnswer(draft?.selectedOptionLabel); -} - -/** Codex children settle via task.updated (idle/failed/interrupted), never - * task.completed — these rows are mobile's only terminal signal for them. */ -const MOBILE_TERMINAL_UPDATE_STATUSES: ReadonlySet = new Set([ - "idle", - "completed", - "failed", - "cancelled", - "interrupted", -]); - -function isTerminalBypassUpdate(activity: OrchestrationThreadActivity): boolean { - if (activity.kind !== "task.updated") { - return false; - } - const payload = - activity.payload && typeof activity.payload === "object" - ? (activity.payload as Record) - : null; - return ( - payload?.timelineBypass === true && - typeof payload.status === "string" && - MOBILE_TERMINAL_UPDATE_STATUSES.has(payload.status) - ); -} - -/** - * Quiet-timeline guarantee (mirrors web's session-logic): agent-internal - * activity lives in the Agents sheet, not the work log. Terminal rows are - * kept — with no Agents surface on mobile they are the terminal signal - * (a surface that hides rows must keep its own terminal signal). That means - * task.completed (Claude) AND terminal bypassed task.updated (Codex, whose - * children never emit task.completed — review finding). - */ -function isAgentInternalActivity(activity: OrchestrationThreadActivity): boolean { - const payload = - activity.payload && typeof activity.payload === "object" - ? (activity.payload as Record) - : null; - if (!payload) { - return false; - } - const isTerminalTaskRow = activity.kind === "task.completed" || isTerminalBypassUpdate(activity); - if (payload.timelineBypass === true && !isTerminalTaskRow) { - return true; - } - // agentId marks ownership, not "hide me": a NESTED AGENT's terminal row is - // the only signal mobile gets (no Agents sheet), so it stays. Only an - // agent's own background work (stamped "background") is internal — same - // rule as web (review finding: hiding on agentId alone dropped nested - // completions with no replacement UI). - const ownedByAgent = typeof payload.agentId === "string" && payload.agentId.trim().length > 0; - if (!ownedByAgent) { - return false; - } - return !(isTerminalTaskRow && payload.agentKind === "agent"); -} - -function deriveWorkLogEntries( - activities: ReadonlyArray, -): DerivedWorkLogEntry[] { - const ordered = Arr.sort(activities, activityOrder); - const entries: DerivedWorkLogEntry[] = []; - for (const activity of ordered) { - if (activity.kind === "tool.started") continue; - if (activity.kind === "task.started") continue; - // Terminal bypassed updates pass: Codex children's only terminal signal. - if (activity.kind === "task.updated" && !isTerminalBypassUpdate(activity)) continue; - if (activity.kind === "tool.progress") continue; - if (activity.kind === "context-window.updated") continue; - if (activity.summary === "Checkpoint captured") continue; - if (isPlanBoundaryToolActivity(activity)) continue; - if (isAgentInternalActivity(activity)) continue; - entries.push(toDerivedWorkLogEntry(activity)); - } - return collapseDerivedWorkLogEntries(entries); -} - -function isPlanBoundaryToolActivity(activity: OrchestrationThreadActivity): boolean { - if (activity.kind !== "tool.updated" && activity.kind !== "tool.completed") { - return false; - } - - const payload = - activity.payload && typeof activity.payload === "object" - ? (activity.payload as Record) - : null; - return typeof payload?.detail === "string" && payload.detail.startsWith("ExitPlanMode:"); -} - -function toDerivedWorkLogEntry(activity: OrchestrationThreadActivity): DerivedWorkLogEntry { - const payload = - activity.payload && typeof activity.payload === "object" - ? (activity.payload as Record) - : null; - const commandPreview = extractToolCommand(payload); - const changedFiles = extractChangedFiles(payload); - const title = extractToolTitle(payload); - // task.updated included: terminal bypassed updates (Codex children's only - // terminal signal) must carry task identity so they collapse per child - // instead of stacking anonymous "Task idle" rows. - const isTaskActivity = - activity.kind === "task.progress" || - activity.kind === "task.completed" || - activity.kind === "task.updated"; - const taskSummary = - isTaskActivity && typeof payload?.summary === "string" && payload.summary.length > 0 - ? payload.summary - : null; - const taskDetailAsLabel = - isTaskActivity && - !taskSummary && - typeof payload?.detail === "string" && - payload.detail.length > 0 - ? payload.detail - : null; - const taskLabel = taskSummary || taskDetailAsLabel; - const taskId = - isTaskActivity && typeof payload?.taskId === "string" && payload.taskId.length > 0 - ? payload.taskId - : undefined; - const entry: DerivedWorkLogEntry = { - id: activity.id, - createdAt: activity.createdAt, - turnId: activity.turnId, - ...(taskId ? { taskId } : {}), - label: taskLabel || activity.summary, - tone: - activity.kind === "task.progress" - ? "thinking" - : activity.tone === "approval" - ? "info" - : activity.tone, - activityKind: activity.kind, - }; - const itemType = extractWorkLogItemType(payload); - const requestKind = extractWorkLogRequestKind(payload); - if ( - !taskDetailAsLabel && - payload && - typeof payload.detail === "string" && - payload.detail.length > 0 - ) { - const detail = stripTrailingExitCode(payload.detail).output; - if (detail) { - entry.detail = detail; - } - } - if (commandPreview.command) { - entry.command = commandPreview.command; - } - if (commandPreview.rawCommand) { - entry.rawCommand = commandPreview.rawCommand; - } - if (changedFiles.length > 0) { - entry.changedFiles = changedFiles; - } - if (title) { - entry.toolTitle = title; - } - if (itemType === "mcp_tool_call") { - const data = asRecord(payload?.data); - if (data?.item !== undefined) { - entry.toolData = data.item; - } - } - if (itemType) { - entry.itemType = itemType; - } - if (requestKind) { - entry.requestKind = requestKind; - } - let toolLifecycleStatus = extractWorkLogToolLifecycleStatus(payload); - if (!toolLifecycleStatus && activity.kind === "tool.completed") { - toolLifecycleStatus = "completed"; - } - if (toolLifecycleStatus) { - entry.toolLifecycleStatus = toolLifecycleStatus; - } - const collapseKey = deriveToolLifecycleCollapseKey(entry); - if (collapseKey) { - entry.collapseKey = collapseKey; - } - return entry; -} - -function collapseDerivedWorkLogEntries( - entries: ReadonlyArray, -): DerivedWorkLogEntry[] { - const collapsed: DerivedWorkLogEntry[] = []; - // Subagent rows collapse by identity, not adjacency (quiet-timeline - // guarantee; mirrors web's session-logic). - const taskRowIndex = new Map(); - for (const entry of entries) { - const isTaskRow = - entry.taskId !== undefined && - (entry.activityKind === "task.progress" || - entry.activityKind === "task.completed" || - entry.activityKind === "task.updated"); - if (isTaskRow && entry.taskId !== undefined) { - const existingIndex = taskRowIndex.get(entry.taskId); - if (existingIndex !== undefined) { - collapsed[existingIndex] = mergeDerivedWorkLogEntries(collapsed[existingIndex]!, entry); - continue; - } - taskRowIndex.set(entry.taskId, collapsed.length); - collapsed.push(entry); - continue; - } - const previous = collapsed.at(-1); - if (previous && shouldCollapseToolLifecycleEntries(previous, entry)) { - collapsed[collapsed.length - 1] = mergeDerivedWorkLogEntries(previous, entry); - continue; - } - collapsed.push(entry); - } - return collapsed; -} - -function shouldCollapseToolLifecycleEntries( - previous: DerivedWorkLogEntry, - next: DerivedWorkLogEntry, -): boolean { - if (previous.activityKind !== "tool.updated" && previous.activityKind !== "tool.completed") { - return false; - } - if (next.activityKind !== "tool.updated" && next.activityKind !== "tool.completed") { - return false; - } - if (previous.activityKind === "tool.completed") { - return false; - } - return previous.collapseKey !== undefined && previous.collapseKey === next.collapseKey; -} - -function mergeDerivedWorkLogEntries( - previous: DerivedWorkLogEntry, - next: DerivedWorkLogEntry, -): DerivedWorkLogEntry { - const changedFiles = mergeChangedFiles(previous.changedFiles, next.changedFiles); - const detail = next.detail ?? previous.detail; - const command = next.command ?? previous.command; - const rawCommand = next.rawCommand ?? previous.rawCommand; - const toolTitle = next.toolTitle ?? previous.toolTitle; - const itemType = next.itemType ?? previous.itemType; - const requestKind = next.requestKind ?? previous.requestKind; - const collapseKey = next.collapseKey ?? previous.collapseKey; - const toolLifecycleStatus = next.toolLifecycleStatus ?? previous.toolLifecycleStatus; - const toolData = next.toolData ?? previous.toolData; - return { - ...previous, - ...next, - ...(detail ? { detail } : {}), - ...(command ? { command } : {}), - ...(rawCommand ? { rawCommand } : {}), - ...(changedFiles.length > 0 ? { changedFiles } : {}), - ...(toolTitle ? { toolTitle } : {}), - ...(itemType ? { itemType } : {}), - ...(requestKind ? { requestKind } : {}), - ...(collapseKey ? { collapseKey } : {}), - ...(toolLifecycleStatus ? { toolLifecycleStatus } : {}), - ...(toolData !== undefined ? { toolData } : {}), - }; -} - -function mergeChangedFiles( - previous: ReadonlyArray | undefined, - next: ReadonlyArray | undefined, -): string[] { - const merged = [...(previous ?? []), ...(next ?? [])]; - if (merged.length === 0) { - return []; - } - return [...new Set(merged)]; -} - -function deriveToolLifecycleCollapseKey(entry: DerivedWorkLogEntry): string | undefined { - if (entry.activityKind !== "tool.updated" && entry.activityKind !== "tool.completed") { - return undefined; - } - const normalizedLabel = normalizeCompactToolLabel(entry.toolTitle ?? entry.label); - const detail = entry.detail?.trim() ?? ""; - const itemType = entry.itemType ?? ""; - if (normalizedLabel.length === 0 && detail.length === 0 && itemType.length === 0) { - return undefined; - } - return [itemType, normalizedLabel, detail].join("\u001f"); -} - -function normalizeCompactToolLabel(value: string): string { - return value.replace(/\s+(?:complete|completed)\s*$/i, "").trim(); -} - -function workLogEntryIsToolLike(entry: WorkLogEntry): boolean { - if (entry.tone === "tool" || entry.tone === "thinking" || entry.tone === "error") { - return true; - } - if (entry.command !== undefined && entry.command.trim().length > 0) { - return true; - } - if (entry.requestKind !== undefined) { - return true; - } - return entry.itemType !== undefined && isToolLifecycleItemType(entry.itemType); -} - -function toolDetailTextLooksLikeFailure(text: string): boolean { - const normalized = text.toLowerCase(); -======= ->>>>>>> 79c36e6204 (Complete orchestration V2 frontend cutover) return ( <<<<<<< HEAD normalized.includes("file not found") || diff --git a/apps/server/src/auth/RpcAuthorization.ts b/apps/server/src/auth/RpcAuthorization.ts index 555bcec598..e5cae34d58 100644 --- a/apps/server/src/auth/RpcAuthorization.ts +++ b/apps/server/src/auth/RpcAuthorization.ts @@ -21,16 +21,6 @@ type WsRpcMethod = RpcGroup.Rpcs["_tag"]; * runtime failure. */ export const RPC_REQUIRED_SCOPES = { -<<<<<<< HEAD - [ORCHESTRATION_WS_METHODS.dispatchCommand]: AuthOrchestrationOperateScope, - [ORCHESTRATION_WS_METHODS.getWorkflowScript]: AuthOrchestrationReadScope, - [ORCHESTRATION_WS_METHODS.getTurnDiff]: AuthOrchestrationReadScope, - [ORCHESTRATION_WS_METHODS.getFullThreadDiff]: AuthOrchestrationReadScope, - [ORCHESTRATION_WS_METHODS.searchThreads]: AuthOrchestrationReadScope, - [ORCHESTRATION_WS_METHODS.subscribeShell]: AuthOrchestrationReadScope, - [ORCHESTRATION_WS_METHODS.getArchivedShellSnapshot]: AuthOrchestrationReadScope, - [ORCHESTRATION_WS_METHODS.subscribeThread]: AuthOrchestrationReadScope, -======= [ORCHESTRATION_V2_WS_METHODS.dispatchCommand]: AuthOrchestrationOperateScope, [ORCHESTRATION_V2_WS_METHODS.getTurnDiff]: AuthOrchestrationReadScope, [ORCHESTRATION_V2_WS_METHODS.getFullThreadDiff]: AuthOrchestrationReadScope, @@ -42,7 +32,6 @@ export const RPC_REQUIRED_SCOPES = { [ORCHESTRATION_V2_WS_METHODS.subscribeShell]: AuthOrchestrationReadScope, [ORCHESTRATION_V2_WS_METHODS.subscribeThread]: AuthOrchestrationReadScope, [WS_METHODS.projectsMutate]: AuthOrchestrationOperateScope, ->>>>>>> 0c15987295 (fix: reconcile rebase with latest main) [WS_METHODS.serverProbe]: AuthOrchestrationReadScope, [WS_METHODS.serverGetConfig]: AuthOrchestrationReadScope, [WS_METHODS.serverRefreshProviders]: AuthOrchestrationOperateScope, diff --git a/apps/web/src/components/chat/ComposerPrimaryActions.tsx b/apps/web/src/components/chat/ComposerPrimaryActions.tsx index 79d6da968e..d0dcce9c6c 100644 --- a/apps/web/src/components/chat/ComposerPrimaryActions.tsx +++ b/apps/web/src/components/chat/ComposerPrimaryActions.tsx @@ -79,7 +79,6 @@ export const ComposerPrimaryActions = memo(function ComposerPrimaryActions({ const stageBackdropVariant = useSidebarStageBackdropVariant( environmentIdentificationMode === "artwork", ); ->>>>>>> ab978b6ee3 (fix: reconcile rebase with latest main) const renderStopGenerationButton = (insidePendingAction: boolean) => (