Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,10 @@ export async function createWorkspaceWindowContainer(): Promise<WorkspaceWindowC
available: analyticsDebugAvailable,
eventStreamClient: tuttidEventStreamClient
});
const workspaceUiMode = routeView === "agent" ? "agent" : "os";
const reporterService = registerReporterServices(registry, {
tuttidClient,
mode: routeView === "agent" ? "agent" : "os"
mode: workspaceUiMode
});
const reportPredefinePageview = shouldReportPredefinePageview(
window.location.search
Expand Down Expand Up @@ -261,6 +262,7 @@ export async function createWorkspaceWindowContainer(): Promise<WorkspaceWindowC
terminalCommandRunner: createAgentProviderTerminalCommandRunner(
desktopApi.runtime
),
uiMode: workspaceUiMode,
windowLifecycle,
workspaceId: activeWorkspaceID,
workspaceUserProjectService
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,8 @@ test("desktop agent activity adapter forwards typed submit diagnostics", async (
};
}
}),
runtimeApi: createRuntimeApi()
runtimeApi: createRuntimeApi(),
uiMode: "os"
});

const result = await adapter.sendInput({
Expand Down Expand Up @@ -484,7 +485,8 @@ test("desktop agent activity adapter forwards typed submit diagnostics", async (
guidance: true,
submitDiagnostics: {
submittedAtUnixMs: 1234,
source: "agent-gui"
source: "agent-gui",
uiMode: "os"
}
} satisfies SendWorkspaceAgentSessionInputRequest,
signal: controller.signal,
Expand Down Expand Up @@ -1363,7 +1365,8 @@ test("desktop agent activity adapter sends plan mode when creating sessions", as
});
}
}),
runtimeApi: createRuntimeApi()
runtimeApi: createRuntimeApi(),
uiMode: "agent"
});

const session = await adapter.createSession({
Expand Down Expand Up @@ -1400,7 +1403,8 @@ test("desktop agent activity adapter sends plan mode when creating sessions", as
submitDiagnostics: {
blockCount: 1,
submittedAtUnixMs: 12345,
source: "agent-gui"
source: "agent-gui",
uiMode: "agent"
},
model: "gpt-5.5-codex-spark",
noProject: null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import {
TuttidProtocolError
} from "@tutti-os/client-tuttid-ts";
import type { DesktopRuntimeApi } from "@preload/types";
import type { DesktopWorkspaceUiMode } from "@shared/preferences";
import { getActiveLocale } from "../../../i18n/runtime.ts";
import { wrapLocalizedTuttidErrorIfSpecific } from "../../../lib/desktopErrors.ts";
import { agentActivityComposerOptionsFromTuttidResult } from "../../../lib/agentComposerOptionsProjection.ts";
Expand All @@ -54,6 +55,21 @@ export interface CreateDesktopAgentActivityAdapterInput {
workspaceId: string,
recordingId: string
) => void;
uiMode?: DesktopWorkspaceUiMode;
}

function submitDiagnosticsWithUiMode<T extends { submitDiagnostics?: object }>(
input: T,
uiMode: DesktopWorkspaceUiMode | undefined
): T {
if (!uiMode) return input;
return {
...input,
submitDiagnostics: {
...input.submitDiagnostics,
uiMode
}
};
}

// Cold ACP/model discovery is materially slower on Windows (Cursor can take
Expand Down Expand Up @@ -126,7 +142,8 @@ export function createDesktopAgentActivityAdapter({
tuttidClient,
runtimeApi,
takePendingSessionRecording,
restorePendingSessionRecording
restorePendingSessionRecording,
uiMode
}: CreateDesktopAgentActivityAdapterInput): DesktopAgentActivityCommandAdapter {
return {
async listSessions(input) {
Expand Down Expand Up @@ -286,13 +303,16 @@ export function createDesktopAgentActivityAdapter({
const agentTargetId = requiredAgentTargetId(input.agentTargetId);
recordingId = takePendingSessionRecording?.(input.workspaceId) ?? null;
const request = tuttiCreateWorkspaceAgentSessionRequestFromActivity(
{
...input,
agentSessionId,
agentTargetId,
noProject:
input.noProject ?? (normalizeText(input.cwd) ? null : true)
},
submitDiagnosticsWithUiMode(
{
...input,
agentSessionId,
agentTargetId,
noProject:
input.noProject ?? (normalizeText(input.cwd) ? null : true)
},
uiMode
),
{ recordingId }
);
const session = await tuttidClient.createWorkspaceAgentSession(
Expand Down Expand Up @@ -348,8 +368,9 @@ export function createDesktopAgentActivityAdapter({
submitDiagnostics: input.submitDiagnostics,
workspaceId: input.workspaceId
});
const request =
tuttiSendWorkspaceAgentSessionInputRequestFromActivity(input);
const request = tuttiSendWorkspaceAgentSessionInputRequestFromActivity(
submitDiagnosticsWithUiMode(input, uiMode)
);
let result: Awaited<
ReturnType<TuttidClient["sendWorkspaceAgentSessionInput"]>
>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import type {
WorkspaceAgentProvider
} from "@tutti-os/client-tuttid-ts";
import type { DesktopHostFilesApi, DesktopRuntimeApi } from "@preload/types";
import type { DesktopWorkspaceUiMode } from "@shared/preferences";
import type { IReporterService } from "../../../analytics/services/reporterService.interface.ts";
import {
normalizeComposerSettings,
Expand Down Expand Up @@ -98,6 +99,7 @@ export interface WorkspaceAgentActivityServiceDependencies {
) => WorkspaceAgentProvider | null;
workspaceUserProjectService?: IWorkspaceUserProjectService;
sessionReplayEnabled?: boolean;
uiMode?: DesktopWorkspaceUiMode;
}

type WorkspaceAgentActivityEntry = WorkspaceAgentSessionEngineHost;
Expand Down Expand Up @@ -1074,6 +1076,7 @@ export class WorkspaceAgentActivityService
reconcileSession: (command, signal) =>
this.executeSessionReconcileCommand(command, signal),
runtimeApi: this.dependencies.runtimeApi,
uiMode: this.dependencies.uiMode,
executeEngineSendInput: async (input, options) => {
try {
const result = await this.executeSendInputEffect(input, options);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
import type { AgentActivityRuntimeActivateSessionInput } from "@tutti-os/agent-gui";
import type { TuttidClient } from "@tutti-os/client-tuttid-ts";
import type { DesktopRuntimeApi } from "@preload/types";
import type { DesktopWorkspaceUiMode } from "@shared/preferences";
import type { AgentHostAgentSessionComposerSettings } from "@shared/contracts/dto";
import {
createDesktopAgentActivityAdapter,
Expand Down Expand Up @@ -68,6 +69,7 @@ interface CreateWorkspaceAgentSessionEngineHostInput {
signal?: AbortSignal
): Promise<unknown>;
runtimeApi: Pick<DesktopRuntimeApi, "logTerminalDiagnostic">;
uiMode?: DesktopWorkspaceUiMode;
takePendingSessionRecording?(workspaceId: string): string | null;
restorePendingSessionRecording?(
workspaceId: string,
Expand Down Expand Up @@ -162,6 +164,7 @@ export function createWorkspaceAgentSessionEngineHost(
const adapter = createDesktopAgentActivityAdapter({
tuttidClient: input.tuttidClient,
runtimeApi: input.runtimeApi,
uiMode: input.uiMode,
takePendingSessionRecording: input.takePendingSessionRecording,
restorePendingSessionRecording: input.restorePendingSessionRecording
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import type { IReporterService } from "../../analytics/services/reporterService.
import type { IWorkspaceUserProjectService } from "../../workspace-user-project/index.ts";
import type { IDesktopPreferencesService } from "../../desktop-preferences/services/desktopPreferencesService.interface.ts";
import type { NotificationService } from "@tutti-os/ui-notifications";
import type { DesktopWorkspaceUiMode } from "@shared/preferences";
import {
AGENT_SESSION_RECORDING_FLAG,
EARLY_ACCESS_AGENT_INTEGRATIONS_FLAG,
Expand Down Expand Up @@ -65,6 +66,7 @@ export interface WorkspaceAgentServiceRegistrationInput {
provider: string;
}) => string;
terminalCommandRunner: AgentProviderTerminalCommandRunner;
uiMode: DesktopWorkspaceUiMode;
windowLifecycle: WorkspaceWindowLifecycle;
workspaceId: string;
workspaceUserProjectService?: IWorkspaceUserProjectService;
Expand Down
Loading
Loading