Skip to content

Commit dde4532

Browse files
refactor(mobile): keep canonical session helpers
Generated-By: PostHog Code Task-Id: c1bbe3cf-742b-4b24-bf96-d11a18b4cf22
1 parent cc577f1 commit dde4532

4 files changed

Lines changed: 16 additions & 10 deletions

File tree

apps/mobile/src/features/tasks/api.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1-
import type { Adapter,
2-
ExecutionMode, StoredLogEntry, Task, TaskRun } from "@posthog/shared";
1+
import type {
2+
Adapter,
3+
ExecutionMode,
4+
StoredLogEntry,
5+
Task,
6+
TaskRun,
7+
} from "@posthog/shared";
38
import { fetch } from "expo/fetch";
49
import {
510
authedFetch,

apps/mobile/src/features/tasks/components/AutomationForm.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import { Text } from "@components/text";
2+
import type { CreateTaskAutomationOptions } from "@posthog/api-client/posthog-client";
23
import {
34
type AutomationScheduleDraft,
45
buildCronExpression,
56
createDefaultScheduleDraft,
67
deriveAutomationName,
78
parseCronExpression,
89
} from "@posthog/core/automations/automationSchedule";
9-
import type { CreateTaskAutomationOptions } from "@posthog/api-client/posthog-client";
1010
import { CaretDown, GithubLogo } from "phosphor-react-native";
1111
import { type MutableRefObject, useEffect, useMemo, useState } from "react";
1212
import {

apps/mobile/src/features/tasks/hooks/useWarmTask.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,10 @@ export function useWarmTask({
8787
runtime_adapter: warmRuntimeAdapter,
8888
model: warmModel,
8989
reasoning_effort: warmReasoningEffort,
90-
...(warmSandboxEnvironmentId
91-
? { sandbox_environment_id: warmSandboxEnvironmentId }
92-
: {}),
93-
...(warmCustomImageId ? { custom_image_id: warmCustomImageId } : {}),
90+
...(warmSandboxEnvironmentId
91+
? { sandbox_environment_id: warmSandboxEnvironmentId }
92+
: {}),
93+
...(warmCustomImageId ? { custom_image_id: warmCustomImageId } : {}),
9494
})
9595
.catch((error) => {
9696
lastWarmedKeyRef.current = null;

apps/mobile/src/features/tasks/stores/taskSessionStore.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
import { convertStoredEntriesToPortableSessionEvents } from "@posthog/core/sessions/portableSessionEvents";
12
import {
23
type CloudTaskUpdatePayload,
34
isTerminalStatus,
45
type StoredLogEntry,
6+
serializeCloudPrompt,
57
type Task,
68
} from "@posthog/shared";
79
import * as Haptics from "expo-haptics";
@@ -18,7 +20,6 @@ import {
1820
sendCloudCommand,
1921
} from "../api";
2022
import { buildCloudPromptBlocks } from "../composer/attachments/buildCloudPrompt";
21-
import { serializeCloudPrompt } from "../composer/attachments/cloudPrompt";
2223
import type { PendingAttachment } from "../composer/attachments/types";
2324
import {
2425
type WatchCloudTaskHandle,
@@ -30,7 +31,6 @@ import type {
3031
SessionNotification,
3132
SessionNotificationAttachment,
3233
} from "../types";
33-
import { convertStoredEntriesToEvents } from "../utils/parseSessionLogs";
3434
import { playbackRateForTaskDuration } from "../utils/playbackRate";
3535
import { playCompletionSound } from "../utils/sounds";
3636
import { useAttachmentEchoStore } from "./attachmentEchoStore";
@@ -1025,7 +1025,8 @@ export const useTaskSessionStore = create<TaskSessionStore>((set, get) => ({
10251025
? update.newEntries
10261026
: dedupAgainstLocalEchoes(update.newEntries, echoSet);
10271027

1028-
const events = convertStoredEntriesToEvents(dedupedEntries);
1028+
const events =
1029+
convertStoredEntriesToPortableSessionEvents(dedupedEntries);
10291030
// Snapshots are S3-backed and lose attachment metadata; reattach from
10301031
// the local echo store so historical user messages keep their images.
10311032
if (isSnapshot) {

0 commit comments

Comments
 (0)