clawdex-mobile 2.0.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/.github/workflows/pages.yml +41 -0
  2. package/AGENTS.md +263 -110
  3. package/README.md +11 -0
  4. package/apps/mobile/.env.example +2 -2
  5. package/apps/mobile/App.tsx +175 -14
  6. package/apps/mobile/app.json +27 -9
  7. package/apps/mobile/eas.json +14 -4
  8. package/apps/mobile/package.json +13 -13
  9. package/apps/mobile/src/api/__tests__/chatMapping.test.ts +219 -0
  10. package/apps/mobile/src/api/__tests__/client.test.ts +579 -6
  11. package/apps/mobile/src/api/__tests__/ws.test.ts +27 -0
  12. package/apps/mobile/src/api/account.ts +47 -0
  13. package/apps/mobile/src/api/chatMapping.ts +435 -18
  14. package/apps/mobile/src/api/client.ts +296 -36
  15. package/apps/mobile/src/api/rateLimits.ts +143 -0
  16. package/apps/mobile/src/api/types.ts +106 -0
  17. package/apps/mobile/src/api/ws.ts +10 -1
  18. package/apps/mobile/src/components/ChatHeader.tsx +12 -12
  19. package/apps/mobile/src/components/ChatInput.tsx +154 -88
  20. package/apps/mobile/src/components/ChatMessage.tsx +548 -93
  21. package/apps/mobile/src/components/ComposerUsageLimits.tsx +167 -0
  22. package/apps/mobile/src/components/SelectionSheet.tsx +466 -0
  23. package/apps/mobile/src/components/ToolBlock.tsx +17 -15
  24. package/apps/mobile/src/components/VoiceRecordingWaveform.tsx +181 -0
  25. package/apps/mobile/src/components/WorkspacePickerModal.tsx +572 -0
  26. package/apps/mobile/src/components/__tests__/chat-input-layout.test.ts +35 -0
  27. package/apps/mobile/src/components/__tests__/chatImageSource.test.ts +44 -0
  28. package/apps/mobile/src/components/__tests__/composerUsageLimits.test.ts +138 -0
  29. package/apps/mobile/src/components/__tests__/voiceWaveform.test.ts +31 -0
  30. package/apps/mobile/src/components/chat-input-layout.ts +59 -0
  31. package/apps/mobile/src/components/chatImageSource.ts +86 -0
  32. package/apps/mobile/src/components/usageLimitBadges.ts +109 -0
  33. package/apps/mobile/src/components/voiceWaveform.ts +46 -0
  34. package/apps/mobile/src/config.ts +9 -2
  35. package/apps/mobile/src/hooks/useVoiceRecorder.ts +8 -1
  36. package/apps/mobile/src/navigation/DrawerContent.tsx +607 -457
  37. package/apps/mobile/src/navigation/__tests__/chatThreadTree.test.ts +89 -0
  38. package/apps/mobile/src/navigation/__tests__/drawerChats.test.ts +65 -0
  39. package/apps/mobile/src/navigation/chatThreadTree.ts +191 -0
  40. package/apps/mobile/src/navigation/drawerChats.ts +9 -0
  41. package/apps/mobile/src/screens/GitScreen.tsx +2 -0
  42. package/apps/mobile/src/screens/MainScreen.tsx +4244 -1237
  43. package/apps/mobile/src/screens/OnboardingScreen.tsx +2 -0
  44. package/apps/mobile/src/screens/SettingsScreen.tsx +256 -226
  45. package/apps/mobile/src/screens/TerminalScreen.tsx +2 -5
  46. package/apps/mobile/src/screens/__tests__/agentThreadDisplay.test.ts +80 -0
  47. package/apps/mobile/src/screens/__tests__/agentThreads.test.ts +170 -0
  48. package/apps/mobile/src/screens/__tests__/planCardState.test.ts +88 -0
  49. package/apps/mobile/src/screens/__tests__/subAgentTranscript.test.ts +102 -0
  50. package/apps/mobile/src/screens/__tests__/transcriptMessages.test.ts +97 -0
  51. package/apps/mobile/src/screens/agentThreadDisplay.ts +261 -0
  52. package/apps/mobile/src/screens/agentThreads.ts +167 -0
  53. package/apps/mobile/src/screens/planCardState.ts +40 -0
  54. package/apps/mobile/src/screens/subAgentTranscript.ts +149 -0
  55. package/apps/mobile/src/screens/transcriptMessages.ts +102 -0
  56. package/apps/mobile/src/theme.ts +6 -12
  57. package/docs/codex-app-server-cli-gap-tracker.md +14 -5
  58. package/docs/privacy-policy.md +54 -0
  59. package/docs/setup-and-operations.md +4 -3
  60. package/docs/terms-of-service.md +33 -0
  61. package/package.json +3 -3
  62. package/services/mac-bridge/package.json +6 -6
  63. package/services/rust-bridge/Cargo.lock +58 -363
  64. package/services/rust-bridge/Cargo.toml +2 -2
  65. package/services/rust-bridge/package.json +1 -1
  66. package/services/rust-bridge/src/main.rs +507 -9
  67. package/site/index.html +54 -0
  68. package/site/privacy/index.html +80 -0
  69. package/site/styles.css +135 -0
  70. package/site/support/index.html +51 -0
  71. package/site/terms/index.html +68 -0
@@ -40,6 +40,7 @@ describe('chatMapping', () => {
40
40
  expect(chat.messages).toHaveLength(3);
41
41
  expect(chat.messages[0].role).toBe('user');
42
42
  expect(chat.messages[1].role).toBe('system');
43
+ expect(chat.messages[1].systemKind).toBe('tool');
43
44
  expect(chat.messages[1].content).toContain('• Ran `git status --short`');
44
45
  expect(chat.messages[1].content).toContain('M apps/mobile/src/api/ws.ts');
45
46
  expect(chat.messages[2].role).toBe('assistant');
@@ -90,12 +91,230 @@ describe('chatMapping', () => {
90
91
 
91
92
  const systemMessages = chat.messages.filter((message) => message.role === 'system');
92
93
  expect(systemMessages).toHaveLength(4);
94
+ expect(systemMessages.every((message) => message.systemKind === 'tool')).toBe(true);
93
95
  expect(systemMessages[0].content).toContain('• Explored');
94
96
  expect(systemMessages[1].content).toContain('• Searched web for "react native keyboard inset"');
95
97
  expect(systemMessages[2].content).toContain('• Called tool `filesystem / read_file`');
96
98
  expect(systemMessages[3].content).toContain('• Applied file changes');
97
99
  });
98
100
 
101
+ it('extracts the latest structured persisted plan for workflow rehydration', () => {
102
+ const chat = mapChat(
103
+ toRawThread({
104
+ id: 'thr_plan',
105
+ preview: 'plan',
106
+ createdAt: 1700000000,
107
+ updatedAt: 1700000005,
108
+ status: { type: 'idle' },
109
+ turns: [
110
+ {
111
+ id: 'turn_plan',
112
+ status: 'completed',
113
+ items: [
114
+ {
115
+ type: 'plan',
116
+ id: 'plan_structured',
117
+ explanation: 'Tighten the workflow-card state handling.',
118
+ plan: [
119
+ {
120
+ step: 'Extract the workflow card state into a helper',
121
+ status: 'completed',
122
+ },
123
+ {
124
+ step: 'Render approval inline in the top card',
125
+ status: 'inProgress',
126
+ },
127
+ ],
128
+ },
129
+ ],
130
+ },
131
+ ],
132
+ })
133
+ );
134
+
135
+ expect(chat.latestPlan).toEqual({
136
+ threadId: 'thr_plan',
137
+ turnId: 'turn_plan',
138
+ explanation: 'Tighten the workflow-card state handling.',
139
+ steps: [
140
+ {
141
+ step: 'Extract the workflow card state into a helper',
142
+ status: 'completed',
143
+ },
144
+ {
145
+ step: 'Render approval inline in the top card',
146
+ status: 'inProgress',
147
+ },
148
+ ],
149
+ });
150
+ expect(chat.latestTurnPlan).toEqual(chat.latestPlan);
151
+ expect(chat.latestTurnStatus).toBe('completed');
152
+ });
153
+
154
+ it('derives workflow plan state from persisted plan text when structured fields are absent', () => {
155
+ const chat = mapChat(
156
+ toRawThread({
157
+ id: 'thr_plan_text',
158
+ preview: 'plan text',
159
+ createdAt: 1700000000,
160
+ updatedAt: 1700000005,
161
+ status: { type: 'idle' },
162
+ turns: [
163
+ {
164
+ id: 'turn_plan_text',
165
+ status: 'completed',
166
+ items: [
167
+ {
168
+ type: 'plan',
169
+ id: 'plan_text',
170
+ text: [
171
+ 'Workflow Card Cleanup Plan',
172
+ 'Summary',
173
+ 'Tighten the workflow-card transitions without broad MainScreen churn.',
174
+ '1. Extract the card state resolver',
175
+ '2. Rehydrate the card from persisted plan data',
176
+ ].join('\n'),
177
+ },
178
+ ],
179
+ },
180
+ ],
181
+ })
182
+ );
183
+
184
+ expect(chat.latestPlan).toEqual({
185
+ threadId: 'thr_plan_text',
186
+ turnId: 'turn_plan_text',
187
+ explanation:
188
+ 'Tighten the workflow-card transitions without broad MainScreen churn.',
189
+ steps: [
190
+ {
191
+ step: 'Extract the card state resolver',
192
+ status: 'pending',
193
+ },
194
+ {
195
+ step: 'Rehydrate the card from persisted plan data',
196
+ status: 'pending',
197
+ },
198
+ ],
199
+ });
200
+ expect(chat.latestTurnPlan).toEqual(chat.latestPlan);
201
+ expect(chat.latestTurnStatus).toBe('completed');
202
+ });
203
+
204
+ it('keeps the latest structured plan even after later non-plan turns', () => {
205
+ const chat = mapChat(
206
+ toRawThread({
207
+ id: 'thr_plan_history',
208
+ preview: 'history',
209
+ createdAt: 1700000000,
210
+ updatedAt: 1700000006,
211
+ status: { type: 'idle' },
212
+ turns: [
213
+ {
214
+ id: 'turn_plan',
215
+ status: 'completed',
216
+ items: [
217
+ {
218
+ type: 'plan',
219
+ id: 'plan_history',
220
+ explanation: 'Review the workflow-card UX before coding.',
221
+ plan: [
222
+ {
223
+ step: 'Audit the top-card state transitions',
224
+ status: 'completed',
225
+ },
226
+ ],
227
+ },
228
+ ],
229
+ },
230
+ {
231
+ id: 'turn_execution',
232
+ status: 'completed',
233
+ items: [
234
+ {
235
+ type: 'agentMessage',
236
+ id: 'assistant_1',
237
+ text: 'Implemented the change.',
238
+ },
239
+ ],
240
+ },
241
+ ],
242
+ })
243
+ );
244
+
245
+ expect(chat.latestPlan).toEqual({
246
+ threadId: 'thr_plan_history',
247
+ turnId: 'turn_plan',
248
+ explanation: 'Review the workflow-card UX before coding.',
249
+ steps: [
250
+ {
251
+ step: 'Audit the top-card state transitions',
252
+ status: 'completed',
253
+ },
254
+ ],
255
+ });
256
+ expect(chat.latestTurnPlan).toBeNull();
257
+ expect(chat.latestTurnStatus).toBe('completed');
258
+ });
259
+
260
+ it('maps sub-agent source metadata and collaboration items', () => {
261
+ const chat = mapChat(
262
+ toRawThread({
263
+ id: 'thr_sub',
264
+ preview: 'worker',
265
+ agentNickname: 'Atlas',
266
+ agentRole: 'explorer',
267
+ createdAt: 1700000000,
268
+ updatedAt: 1700000004,
269
+ status: { type: 'idle' },
270
+ source: {
271
+ subagent: {
272
+ thread_spawn: {
273
+ parent_thread_id: 'thr_root',
274
+ depth: 1,
275
+ },
276
+ },
277
+ },
278
+ turns: [
279
+ {
280
+ status: 'completed',
281
+ items: [
282
+ {
283
+ type: 'collabToolCall',
284
+ id: 'collab1',
285
+ tool: 'spawn_agent',
286
+ status: 'completed',
287
+ prompt: 'Inspect the websocket protocol and summarize it',
288
+ receiver_thread_ids: ['thr_sub'],
289
+ sender_thread_id: 'thr_root',
290
+ agentStatus: 'running',
291
+ },
292
+ ],
293
+ },
294
+ ],
295
+ })
296
+ );
297
+
298
+ expect(chat.sourceKind).toBe('subAgentThreadSpawn');
299
+ expect(chat.parentThreadId).toBe('thr_root');
300
+ expect(chat.subAgentDepth).toBe(1);
301
+ expect(chat.agentNickname).toBe('Atlas');
302
+ expect(chat.agentRole).toBe('explorer');
303
+ expect(chat.messages).toHaveLength(1);
304
+ expect(chat.messages[0].role).toBe('system');
305
+ expect(chat.messages[0].systemKind).toBe('subAgent');
306
+ expect(chat.messages[0].content).toContain('• Spawned sub-agent');
307
+ expect(chat.messages[0].content).toContain('Prompt: Inspect the websocket protocol');
308
+ expect(chat.messages[0].content).toContain('Thread: thr_sub');
309
+ expect(chat.messages[0].subAgentMeta).toEqual({
310
+ tool: 'spawn_agent',
311
+ prompt: 'Inspect the websocket protocol and summarize it',
312
+ senderThreadId: 'thr_root',
313
+ receiverThreadIds: ['thr_sub'],
314
+ agentStatus: 'running',
315
+ });
316
+ });
317
+
99
318
  it('maps user mention attachments into readable file markers', () => {
100
319
  const chat = mapChat(
101
320
  toRawThread({