Skip to content
Source
Sign inSign up
pingdotgg/t3code

feat(mobile): add dynamic workflows to the Agents sheet #18642

MergedBil0000(GitHub profile, opens in a new tab)merged 1 commit intomain fromrefs/pull/18642/headmerged by juliusmarminge View on GitHub

Showing 16 changed files with 122 additions and 21 deletions (loading 14).

x
0 of 16 viewed, 16 left
65 additions and 0 deletionsapps/mobile/src/features/threads/SubagentStopButton.tsxAdded
View file
@@ -0,0 +1,65 @@
+import { useAtomValue } from "@effect/atom-react";
+import type { EnvironmentId, OrchestrationV2Subagent } from "@t3tools/contracts";
+import { useState } from "react";
+import { View } from "react-native";
+​
+import * as Dialog from "../../components/ui/Dialog";
+import { IconButton } from "../../components/ui/IconButton";
+import { orchestrationEnvironment } from "../../state/orchestration";
+import { threadEnvironment } from "../../state/threads";
+import { useAtomCommand } from "../../state/use-atom-command";
+import {
+ resolveSubagentRowPresentation,
+ resolveSubagentStopTarget,
+} from "./threadAgentsPresentation";
+​
+export function SubagentStopButton(props: {
+ readonly environmentId: EnvironmentId;
+ readonly subagent: OrchestrationV2Subagent;
+ readonly className?: string;
+}) {
+ const target = resolveSubagentStopTarget(props.subagent);
+ const canStop = useAtomValue(
+ orchestrationEnvironment.stopWorkflow.permissionAtom(props.environmentId),
+ );
+ const stopWorkflow = useAtomCommand(orchestrationEnvironment.stopWorkflow);
+ const interruptTurn = useAtomCommand(threadEnvironment.interruptTurn);
+ const [stopping, setStopping] = useState(false);
+​
+ if (target === null || !canStop) return null;
+​