GeezerVison is showing github.com — fix(mobile): untitled subagent rows no longer end in a broken charact… · pingdotgg/t3code@4328d9c
File tree
Expand file treeCollapse file tree
Open diff view settings
apps/mobile/src/features/threads packages/client-runtime/src/state
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: apps/mobile/src/features/threads/threadAgentsPresentation.test.ts +5Lines changed: 5 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -64,10 +64,15 @@ describe("resolveSubagentRowPresentation", () => { |
64 | 64 |
|
65 | 65 | it("falls back to a trimmed prompt when the agent has no title", () => { |
66 | 66 | const long = resolveSubagentRowPresentation({ ...base, prompt: "x".repeat(200) }); |
| 67 | + const emoji = resolveSubagentRowPresentation({ |
| 68 | + ...base, |
| 69 | + prompt: `${"x".repeat(76)}😀 and more`, |
| 70 | + }); |
67 | 71 | const titled = resolveSubagentRowPresentation({ ...base, title: "Subagent: /root/my_worker" }); |
68 | 72 |
|
69 | 73 | expect(long.title).toHaveLength(80); |
70 | 74 | expect(long.title.endsWith("...")).toBe(true); |
| 75 | + expect(emoji.title).toBe(`${"x".repeat(76)}...`); |
71 | 76 | expect(titled.title).toBe("My Worker"); |
72 | 77 | }); |
73 | 78 |
|
|
Collapse file
Copy file name to clipboardExpand all lines: apps/mobile/src/features/threads/threadAgentsPresentation.ts +2-5Lines changed: 2 additions & 5 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
7 | 7 | } from "@t3tools/client-runtime/state/subagent-display"; |
8 | 8 | import { |
9 | 9 | isActiveSubagentStatus, |
| 10 | + promptTitle, |
10 | 11 | type RuntimeSubagent, |
11 | 12 | type SubagentWorkflowGroup, |
12 | 13 | } from "@t3tools/client-runtime/state/subagentRuntime"; |
@@ -22,8 +23,6 @@ import { msg } from "gt-react-native"; |
22 | 23 |
|
23 | 24 | import { m, type MessageResolver } from "../../i18n/messages"; |
24 | 25 |
|
25 | | -const PROMPT_TITLE_LIMIT = 80; |
26 | | - |
27 | 26 | export type SubagentRowTone = "working" | "completed" | "failed" | "stopped"; |
28 | 27 |
|
29 | 28 | export interface SubagentRowPresentation { |
@@ -82,9 +81,7 @@ function rowTitle( |
82 | 81 | if (title) return formatSubagentDisplayTitle(title); |
83 | 82 | const prompt = subagent.prompt.trim(); |
84 | 83 | if (prompt.length === 0) return resolve(msg("Subagent")); |
85 | | - return prompt.length > PROMPT_TITLE_LIMIT |
86 | | - ? `${prompt.slice(0, PROMPT_TITLE_LIMIT - 3)}...` |
87 | | - : prompt; |
| 84 | + return promptTitle(prompt); |
88 | 85 | } |
89 | 86 |
|
90 | 87 | function rowTone(status: OrchestrationV2Subagent["status"]): SubagentRowTone { |
|
Collapse file
Copy file name to clipboardExpand all lines: packages/client-runtime/src/state/subagentRuntime.ts +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -186,7 +186,7 @@ function workflowMembersToRuntime( |
186 | 186 | }); |
187 | 187 | } |
188 | 188 |
|
189 | | -function promptTitle(prompt: string): string { |
| 189 | +export function promptTitle(prompt: string): string { |
190 | 190 | if (prompt.length <= 80) return prompt; |
191 | 191 | let end = 77; |
192 | 192 | const previous = prompt.charCodeAt(end - 1); |
|