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
1 change: 1 addition & 0 deletions apps/mobile/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"@expo/ui": "0.2.0-beta.9",
"@modelcontextprotocol/ext-apps": "^1.2.2",
"@modelcontextprotocol/sdk": "^1.29.0",
"@posthog/api-client": "workspace:*",
"@posthog/shared": "workspace:*",
"@react-native-async-storage/async-storage": "^2.2.0",
"@react-native-community/netinfo": "^12.0.1",
Expand Down
2 changes: 1 addition & 1 deletion apps/mobile/src/app/automation/[id].tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Text } from "@components/text";
import { TaskAutomationValidationError } from "@posthog/api-client/posthog-client";
import { Stack, useLocalSearchParams, useRouter } from "expo-router";
import { useState } from "react";
import {
Expand All @@ -10,7 +11,6 @@ import {
ScrollView,
View,
} from "react-native";
import { TaskAutomationValidationError } from "@/features/tasks/api";
import { AutomationDetail } from "@/features/tasks/components/AutomationDetail";
import { AutomationForm } from "@/features/tasks/components/AutomationForm";
import {
Expand Down
2 changes: 1 addition & 1 deletion apps/mobile/src/app/automation/create.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { TaskAutomationValidationError } from "@posthog/api-client/posthog-client";
import { getCalendars } from "expo-localization";
import { Stack, useLocalSearchParams, useRouter } from "expo-router";
import { useMemo, useRef, useState } from "react";
Expand All @@ -10,7 +11,6 @@ import {
View,
} from "react-native";
import { Text } from "@/components/text";
import { TaskAutomationValidationError } from "@/features/tasks/api";
import { AutomationForm } from "@/features/tasks/components/AutomationForm";
import { useCreateTaskAutomation } from "@/features/tasks/hooks/useAutomations";
import { useSkillStoreSkill } from "@/features/tasks/skills/hooks";
Expand Down
9 changes: 6 additions & 3 deletions apps/mobile/src/app/task/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { useReanimatedKeyboardAnimation } from "react-native-keyboard-controller
import Animated, { useAnimatedStyle } from "react-native-reanimated";
import { FloatingBackButton } from "@/components/FloatingBackButton";
import { usePreferencesStore } from "@/features/preferences/stores/preferencesStore";
import { getTask, runTaskInCloud } from "@/features/tasks/api";
import { runTaskInCloud } from "@/features/tasks/api";
import { CustomImageBadge } from "@/features/tasks/components/CustomImageBadge";
import { FloatingTaskHeader } from "@/features/tasks/components/FloatingTaskHeader";
import { PrDiffStatsBadge } from "@/features/tasks/components/PrDiffStatsBadge";
Expand Down Expand Up @@ -67,6 +67,7 @@ import {
useAnalytics,
} from "@/lib/analytics";
import { logger } from "@/lib/logger";
import { getPostHogApiClient } from "@/lib/posthogApiClient";
import { useThemeColors } from "@/lib/theme";

const log = logger.scope("task-detail");
Expand Down Expand Up @@ -221,7 +222,8 @@ export default function TaskDetailScreen() {
setLoading(true);
setError(null);

getTask(taskId)
getPostHogApiClient()
.getTask(taskId)
.then((fetchedTask) => {
if (cancelled) return;
setTask(fetchedTask);
Expand Down Expand Up @@ -252,7 +254,8 @@ export default function TaskDetailScreen() {
if (retrying) return;

let cancelled = false;
getTask(taskId)
getPostHogApiClient()
.getTask(taskId)
.then((freshTask) => {
if (cancelled) return;
setTask(freshTask);
Expand Down
5 changes: 3 additions & 2 deletions apps/mobile/src/app/task/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import {
import Animated, { runOnJS, useAnimatedStyle } from "react-native-reanimated";
import { useVoiceRecording } from "@/features/chat";
import { usePreferencesStore } from "@/features/preferences/stores/preferencesStore";
import { createTask, runTaskInCloud } from "@/features/tasks/api";
import { runTaskInCloud } from "@/features/tasks/api";
import { GitHubConnectionPrompt } from "@/features/tasks/components/GitHubConnectionPrompt";
import { GitHubLoadNotice } from "@/features/tasks/components/GitHubLoadNotice";
import { AttachmentSheet } from "@/features/tasks/composer/attachments/AttachmentSheet";
Expand Down Expand Up @@ -80,6 +80,7 @@ import {
} from "@/features/tasks/utils/repositorySelection";
import { useScreenInsets } from "@/hooks/useScreenInsets";
import { logger } from "@/lib/logger";
import { getPostHogApiClient } from "@/lib/posthogApiClient";
import { toRgba, useThemeColors } from "@/lib/theme";

const log = logger.scope("task-create");
Expand Down Expand Up @@ -308,7 +309,7 @@ export default function NewTaskScreen() {
? `Attached: ${attachments[0].fileName}`
: `Attached ${attachments.length} files`);

const task = await createTask({
const task = await getPostHogApiClient().createTask({
description: descriptionText,
title: descriptionText.slice(0, 100),
repository: selection.repository ?? undefined,
Expand Down
7 changes: 5 additions & 2 deletions apps/mobile/src/features/chat/components/ToolMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -659,9 +659,12 @@ function CreateTaskPreview({

try {
// Dynamic import to avoid circular dependency
const { createTask, runTaskInCloud } = await import("../../tasks/api");
const [{ runTaskInCloud }, { getPostHogApiClient }] = await Promise.all([
import("../../tasks/api"),
import("@/lib/posthogApiClient"),
]);

const task = await createTask({
const task = await getPostHogApiClient().createTask({
title: args.title,
description: args.description,
repository: args.repository,
Expand Down
3 changes: 1 addition & 2 deletions apps/mobile/src/features/inbox/api.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { HttpError } from "@/features/tasks/api";
import { authedFetch, getBaseUrl, getProjectId } from "@/lib/api";
import { authedFetch, getBaseUrl, getProjectId, HttpError } from "@/lib/api";
import { logger } from "@/lib/logger";
import type { DismissalReasonOptionValue } from "./constants";

Expand Down
5 changes: 3 additions & 2 deletions apps/mobile/src/features/inbox/components/TinderView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
} from "react-native-safe-area-context";
import { MarkdownText } from "@/features/chat/components/MarkdownText";
import { usePreferencesStore } from "@/features/preferences/stores/preferencesStore";
import { createTask, runTaskInCloud } from "@/features/tasks/api";
import { runTaskInCloud } from "@/features/tasks/api";
import { DEFAULT_MODEL } from "@/features/tasks/composer/options";
import type {
CreateTaskOptions,
Expand All @@ -29,6 +29,7 @@ import {
useAnalytics,
} from "@/lib/analytics";
import { logger } from "@/lib/logger";
import { getPostHogApiClient } from "@/lib/posthogApiClient";
import { useThemeColors } from "@/lib/theme";
import { getReportRepository } from "../api";
import { useDismissedReportsStore } from "../stores/dismissedReportsStore";
Expand Down Expand Up @@ -239,7 +240,7 @@ export function TinderView({

// 3. Create the task
const prompt = `Act on this signal report. Investigate the root cause, implement the fix, and open a PR if appropriate.\n\n${report.summary ?? ""}`;
const task = await createTask({
const task = await getPostHogApiClient().createTask({
description: prompt,
title: prompt.slice(0, 255),
repository: match?.repository ?? repo ?? undefined,
Expand Down
Loading
Loading