diff --git a/apps/mobile/src/j5/agents/AgentDetailsModal.tsx b/apps/mobile/src/j5/agents/AgentDetailsModal.tsx
new file mode 100644
index 000000000000..e1e1e8d49097
--- /dev/null
+++ b/apps/mobile/src/j5/agents/AgentDetailsModal.tsx
@@ -0,0 +1,88 @@
+import { squashAtomCommandFailure } from "@t3tools/client-runtime/state/runtime";
+import type { AgentPersonaCatalogRow } from "@t3tools/client-runtime/j5/agent-personas";
+import type { AgentPersonaModelTarget, EnvironmentId } from "@t3tools/contracts";
+import { useEffect, useState } from "react";
+import { Modal, Pressable, ScrollView, View } from "react-native";
+import { SafeAreaView } from "react-native-safe-area-context";
+
+import { AppText as Text } from "../../components/ui/AppText";
+import { ListRowLayout } from "../../components/ui/ListRowLayout";
+import { SettingsSection } from "../../features/settings/components/SettingsSection";
+import { cn } from "../../lib/cn";
+import { useAtomCommand } from "../../state/use-atom-command";
+import { agentPersonaEnvironment } from "./agentPersonaAtoms";
+import { personaDetailRows } from "./personaDetails";
+
+/** A persona the person can't edit, such as one from a folder, shown read-only. */
+export function AgentDetailsModal(props: {
+ readonly environmentId: EnvironmentId;
+ readonly persona: AgentPersonaCatalogRow;
+ readonly usageLine: string | null;
+ readonly onClose: () => void;
+}) {
+ const [models, setModels] = useState<
+ | { readonly status: "loading" }
+ | { readonly status: "failed" }
+ | {
+ readonly status: "loaded";
+ readonly route: readonly [AgentPersonaModelTarget, AgentPersonaModelTarget];
+ }
+ >({ status: "loading" });
+ const read = useAtomCommand(agentPersonaEnvironment.readAgentPersona, { reportFailure: false });
+ const personaId = props.persona.personaId;
+ // oxlint-disable-next-line t3code/react-effect-budget -- loads the persona's models once when the sheet opens; the read is a command, not an atom.
+ useEffect(() => {
+ let cancelled = false;
+ void read({ environmentId: props.environmentId, input: { personaId } })
+ .then((result) => {
+ if (cancelled) return;
+ if (result._tag === "Failure") throw squashAtomCommandFailure(result);
+ setModels({ status: "loaded", route: result.value.definition.modelRoute });
+ })
+ .catch(() => {
+ if (!cancelled) setModels({ status: "failed" });
+ });
+ return () => {
+ cancelled = true;
+ };
+ }, [props.environmentId, personaId, read]);
+ const rows = personaDetailRows(props.persona, models, props.usageLine);
+ return (
+
+ {/* SafeAreaView takes no className, so the theme surface and flex go on a View. */}
+
+
+
+
+ {props.persona.displayName}
+
+
+ Done
+
+
+
+
+ {rows.map((row, index) => (
+ 0 && "border-t border-border-subtle")}
+ >
+
+
+ ))}
+
+
+
+
+
+ );
+}
diff --git a/apps/mobile/src/j5/agents/AgentLibrarySettingsScreen.tsx b/apps/mobile/src/j5/agents/AgentLibrarySettingsScreen.tsx
index b7f531c72bc5..4dbb9f095cc3 100644
--- a/apps/mobile/src/j5/agents/AgentLibrarySettingsScreen.tsx
+++ b/apps/mobile/src/j5/agents/AgentLibrarySettingsScreen.tsx
@@ -7,6 +7,7 @@ import {
agentPersonaDuplicateDraft,
type AgentPersonaCreateDraft,
} from "@t3tools/client-runtime/j5/agent-personas";
+import { AgentDetailsModal } from "./AgentDetailsModal";
import { AgentEditorModal } from "./AgentEditorModal";
import { AgentFolderPickerModal } from "./AgentFolderPickerModal";
import { sendWhenReconnected } from "./watchEnvironmentSessions";
@@ -141,6 +142,7 @@ function OwnerAgentLibrarySettingsScreen() {
} | null>(null);
const [notification, setNotification] = useState(null);
const [creating, setCreating] = useState<{ initial?: AgentPersonaCreateDraft } | null>(null);
+ const [viewing, setViewing] = useState(null);
const dismissNotification = useCallback(() => setNotification(null), []);
const importAgents = useAtomCommand(agentPersonaEnvironment.importAgentPersonas, {
reportFailure: false,
@@ -314,6 +316,7 @@ function OwnerAgentLibrarySettingsScreen() {
? []
: presentAgentPersonaCatalog(catalog.data);
+ const viewedPersona = personas.find((persona) => persona.personaId === viewing);
const folders = librarySources.data?.folders ?? [];
const environmentLabel =
connectedEnvironments.find(
@@ -427,17 +430,13 @@ function OwnerAgentLibrarySettingsScreen() {
{
- const entry = usageById.get(persona.personaId);
- return entry === undefined ? null : presentAgentPersonaUsage(entry).line;
- })()}
borderTop={index > 0}
locked={locked}
busy={busy}
otherEnvironments={otherEnvironments}
onToggle={(enabled) => void toggleAgent(persona.personaId, enabled)}
onEdit={
- persona.edit && effectiveEnvironmentId
+ persona.edit && effectiveEnvironmentId && canOperate
? () => {
if (persona.edit && effectiveEnvironmentId)
setEditing({
@@ -447,6 +446,7 @@ function OwnerAgentLibrarySettingsScreen() {
}
: null
}
+ onDetails={() => setViewing(persona.personaId)}
onDuplicate={() => void duplicatePersona(persona.personaId)}
onExport={() => void exportPersona(persona.personaId)}
onCopy={(target) => void copyPersona(persona.personaId, target)}
@@ -547,6 +547,18 @@ function OwnerAgentLibrarySettingsScreen() {
}}
/>
) : null}
+ {viewedPersona && effectiveEnvironmentId ? (
+ {
+ const entry = usageById.get(viewedPersona.personaId);
+ return entry === undefined ? null : presentAgentPersonaUsage(entry).line;
+ })()}
+ onClose={() => setViewing(null)}
+ />
+ ) : null}
{editing ? (
[number];
/** One persona as a settings row: name and status, its switch, and the rest in a menu. */
function PersonaRow(props: {
readonly persona: PresentedPersona;
- readonly usageLine: string | null;
readonly borderTop: boolean;
readonly locked: boolean;
readonly busy: boolean;
@@ -629,6 +640,7 @@ function PersonaRow(props: {
}>;
readonly onToggle: (enabled: boolean) => void;
readonly onEdit: (() => void) | null;
+ readonly onDetails: () => void;
readonly onDuplicate: () => void;
readonly onExport: () => void;
readonly onCopy: (target: { environmentId: EnvironmentId; label: string }) => void;
@@ -636,41 +648,12 @@ function PersonaRow(props: {
readonly onRestore: () => void;
}) {
const { persona } = props;
- const status = [
- persona.removed ? "Removed" : persona.availabilityLabel,
- persona.originLabel,
- persona.unsandboxed ? "Full access" : null,
- props.usageLine,
- ]
- .filter(Boolean)
- .join(" · ");
const unavailable = !persona.removed && persona.availability !== "available";
const actions = personaRowActions(
{ removed: persona.removed, editable: props.onEdit !== null },
props.otherEnvironments.length > 0,
);
const onEdit = actions.includes("edit") ? props.onEdit : null;
- const content = (
- <>
-
- {persona.displayName}
-
-
- {status}
-
- {unavailable && persona.blockedReasons[0] ? (
-
- {persona.blockedReasons[0]}
-
- ) : null}
- >
- );
return (
- {onEdit ? (
-
- {content}
-
- ) : (
-
+
- {content}
-
- )}
+ {persona.displayName}
+
+ {persona.removed ? Removed : null}
+ {unavailable && persona.blockedReasons[0] ? (
+
+ {persona.blockedReasons[0]}
+
+ ) : null}
+
{persona.removed ? null : (
{
const action = nativeEvent.event;
if (action === "edit") onEdit?.();
+ else if (action === "details") props.onDetails();
else if (action === "duplicate") props.onDuplicate();
else if (action === "export") props.onExport();
else if (action === "remove") props.onRemove();
diff --git a/apps/mobile/src/j5/agents/personaDetails.test.ts b/apps/mobile/src/j5/agents/personaDetails.test.ts
new file mode 100644
index 000000000000..2d6017bb1bdd
--- /dev/null
+++ b/apps/mobile/src/j5/agents/personaDetails.test.ts
@@ -0,0 +1,67 @@
+import type { AgentPersonaModelTarget } from "@t3tools/contracts";
+import { describe, expect, it } from "vite-plus/test";
+
+import { personaDetailRows } from "./personaDetails";
+
+const persona = {
+ origin: { kind: "folder", path: "/srv/personas/luna.yaml" },
+ originLabel: "Folder · personas",
+ authority: "Read only (default), Full access",
+ description: "Reviews changes.",
+ availabilityLabel: "Available",
+ blockedReasons: [],
+ route: "Codex · gpt-6-luna · primary",
+} as unknown as Parameters[0];
+
+const target = (driver: string, model: string, reasoningEffort: string) =>
+ ({ driver, model, reasoningEffort }) as unknown as AgentPersonaModelTarget;
+
+const rowsOf = (rows: ReturnType) =>
+ rows.map(({ label, value }) => [label, value]);
+
+describe("personaDetailRows", () => {
+ it("shows a folder persona's path, access, both models and description", () => {
+ expect(
+ rowsOf(
+ personaDetailRows(
+ persona,
+ {
+ status: "loaded",
+ route: [target("codex", "gpt-6-luna", "low"), target("claudeAgent", "haiku", "low")],
+ },
+ null,
+ ),
+ ),
+ ).toEqual([
+ ["Status", "Available"],
+ ["Source", "/srv/personas/luna.yaml"],
+ ["Access", "Read only (default), Full access"],
+ ["Primary model", "Codex · gpt-6-luna · low"],
+ ["Fallback model", "Claude · haiku · low"],
+ ["Description", "Reviews changes."],
+ ]);
+ });
+
+ it("falls back to the catalog's route when the definition can't be read", () => {
+ const rows = rowsOf(personaDetailRows(persona, { status: "failed" }, null));
+ expect(rows).toContainEqual(["Model", "Codex · gpt-6-luna · primary"]);
+ expect(rows.map(([label]) => label)).not.toContain("Primary model");
+ });
+
+ it("lists every blocked reason in danger text, and usage when there is any", () => {
+ const rows = personaDetailRows(
+ {
+ ...persona,
+ availabilityLabel: "Blocked",
+ blockedReasons: ["Primary is off", "Fallback is off"],
+ },
+ { status: "loading" },
+ "3 tasks",
+ );
+ expect(rows.filter(({ tone }) => tone === "danger").map(({ value }) => value)).toEqual([
+ "Primary is off",
+ "Fallback is off",
+ ]);
+ expect(rows.at(-1)).toEqual({ label: "Usage", value: "3 tasks" });
+ });
+});
diff --git a/apps/mobile/src/j5/agents/personaDetails.ts b/apps/mobile/src/j5/agents/personaDetails.ts
new file mode 100644
index 000000000000..afcf5f71afca
--- /dev/null
+++ b/apps/mobile/src/j5/agents/personaDetails.ts
@@ -0,0 +1,60 @@
+import type { AgentPersonaCatalogRow } from "@t3tools/client-runtime/j5/agent-personas";
+import { PROVIDER_DISPLAY_NAMES, type AgentPersonaModelTarget } from "@t3tools/contracts";
+
+export interface PersonaDetailRow {
+ readonly label: string;
+ readonly value: string;
+ readonly tone?: "danger";
+}
+
+const modelLabel = (target: AgentPersonaModelTarget) =>
+ [
+ PROVIDER_DISPLAY_NAMES[target.driver] ?? target.driver,
+ target.model,
+ target.reasoningEffort,
+ ].join(" · ");
+
+/**
+ * What the read-only sheet shows for a persona the person can't edit. Models come from the
+ * definition, read on open: `null` while it loads, and the catalog's resolved route if it fails.
+ */
+export function personaDetailRows(
+ persona: Pick<
+ AgentPersonaCatalogRow,
+ | "origin"
+ | "originLabel"
+ | "authority"
+ | "description"
+ | "availabilityLabel"
+ | "blockedReasons"
+ | "route"
+ >,
+ models:
+ | { readonly status: "loading" }
+ | { readonly status: "failed" }
+ | {
+ readonly status: "loaded";
+ readonly route: readonly [AgentPersonaModelTarget, AgentPersonaModelTarget];
+ },
+ usageLine: string | null,
+): ReadonlyArray {
+ const source = persona.origin?.kind === "folder" ? persona.origin.path : persona.originLabel;
+ return [
+ { label: "Status", value: persona.availabilityLabel },
+ ...persona.blockedReasons.map((reason) => ({
+ label: "Reason",
+ value: reason,
+ tone: "danger" as const,
+ })),
+ ...(source === null ? [] : [{ label: "Source", value: source }]),
+ { label: "Access", value: persona.authority },
+ ...(models.status === "loaded"
+ ? [
+ { label: "Primary model", value: modelLabel(models.route[0]) },
+ { label: "Fallback model", value: modelLabel(models.route[1]) },
+ ]
+ : [{ label: "Model", value: models.status === "loading" ? "Loading…" : persona.route }]),
+ { label: "Description", value: persona.description },
+ ...(usageLine === null ? [] : [{ label: "Usage", value: usageLine }]),
+ ];
+}
diff --git a/apps/mobile/src/j5/agents/personaRowActions.test.ts b/apps/mobile/src/j5/agents/personaRowActions.test.ts
index 43c5cce82826..74ee660ada5e 100644
--- a/apps/mobile/src/j5/agents/personaRowActions.test.ts
+++ b/apps/mobile/src/j5/agents/personaRowActions.test.ts
@@ -7,9 +7,10 @@ describe("personaRowActions", () => {
expect(personaRowActions({ removed: true, editable: true }, true)).toEqual(["restore"]);
});
- it("offers Edit only for an editable persona, and Copy only with another environment", () => {
+ it("offers Edit and Details only for an editable persona, and Copy only with another environment", () => {
expect(personaRowActions({ removed: false, editable: true }, true)).toEqual([
"edit",
+ "details",
"duplicate",
"export",
"copy",
diff --git a/apps/mobile/src/j5/agents/personaRowActions.ts b/apps/mobile/src/j5/agents/personaRowActions.ts
index 821178aab62f..ad3c57e29f0f 100644
--- a/apps/mobile/src/j5/agents/personaRowActions.ts
+++ b/apps/mobile/src/j5/agents/personaRowActions.ts
@@ -1,13 +1,23 @@
-export type PersonaRowAction = "edit" | "duplicate" | "export" | "copy" | "remove" | "restore";
+export type PersonaRowAction =
+ | "edit"
+ | "details"
+ | "duplicate"
+ | "export"
+ | "copy"
+ | "remove"
+ | "restore";
-/** What a Personas settings row offers, in menu order. A removed persona offers only Restore. */
+/**
+ * What a Personas settings row offers, in menu order. A removed persona offers only Restore.
+ * Details is here only where a tap opens the editor; elsewhere the tap already opens the sheet.
+ */
export function personaRowActions(
persona: { readonly removed: boolean; readonly editable: boolean },
hasOtherEnvironments: boolean,
): ReadonlyArray {
if (persona.removed) return ["restore"];
return [
- ...(persona.editable ? (["edit"] as const) : []),
+ ...(persona.editable ? (["edit", "details"] as const) : []),
"duplicate",
"export",
...(hasOtherEnvironments ? (["copy"] as const) : []),