Commit f868760
authored
## Summary
Sub-PR for #5302 desktop migration Day 3 — Swift client adaptation for
Python backend.
**Path updates (5 endpoints):**
- `v2/chat/initial-message` → `v2/initial-message`
- `v2/agent/provision` → `v1/agent/vm-ensure`
- `v2/agent/status` → `v1/agent/vm-status`
- `v1/personas/check-username` → `v1/apps/check-username`
- `v1/personas/generate-prompt` → `v1/app/generate-prompts` (POST→GET)
**Decoder hardening:**
- `ServerConversation.createdAt`: `decodeIfPresent` with `Date()`
fallback
- `ActionItemsListResponse`: custom decoder tries `"action_items"` then
`"items"` key (Python action-items vs staged-tasks endpoints)
- `AgentProvisionResponse`/`AgentStatusResponse`: fields made optional,
added `hasVm` field for Python's minimal response shape
- `UsernameAvailableResponse`: supports both `is_taken` (Python) and
`available` (Rust) via custom decoder
**Graceful no-ops (3 endpoints removed from Python):**
- `recordLlmUsage()` → no-op with log
- `fetchTotalOmiAICost()` → returns nil immediately
- `getChatMessageCount()` → returns 0 immediately
**Remove staged-tasks migration (no longer needed):**
- Removed `migrateStagedTasks()` and
`migrateConversationItemsToStaged()` from APIClient
- Removed migration callers and helper functions from TasksStore
## Files changed
- `desktop/Desktop/Sources/APIClient.swift` — all path/decoder/no-op
changes
- `desktop/Desktop/Sources/AgentVMService.swift` — adapt to optional
AgentVM response fields
- `desktop/Desktop/Sources/Stores/TasksStore.swift` — remove migration
functions and callers
## Notes
- `regeneratePersonaPrompt()` now points to `v1/app/generate-prompts`
(GET). The response shape differs from the old
`v1/personas/generate-prompt` — may need attention if called.
- AgentVM endpoints (`vm-ensure`, `vm-status`) return minimal `{has_vm,
status}` from Python vs full VM details from Rust. The service
gracefully degrades but won't have `authToken`/`ip` until those are
added to Python responses.
## Test plan
- [ ] Verify Swift compiles (no build errors from optional changes)
- [ ] Mac Mini desktop test: app launches, no crash on startup
- [ ] Verify action items load (ActionItemsListResponse decoder)
- [ ] Verify username check works on persona page
🤖 Generated with [Claude Code](https://claude.com/claude-code)
File tree
3 files changed
+91
-148
lines changed- desktop/Desktop/Sources
- Stores
3 files changed
+91
-148
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
405 | 405 | | |
406 | 406 | | |
407 | 407 | | |
408 | | - | |
| 408 | + | |
409 | 409 | | |
410 | | - | |
411 | | - | |
412 | | - | |
413 | | - | |
414 | | - | |
415 | | - | |
| 410 | + | |
| 411 | + | |
416 | 412 | | |
417 | 413 | | |
418 | 414 | | |
| |||
581 | 577 | | |
582 | 578 | | |
583 | 579 | | |
584 | | - | |
| 580 | + | |
585 | 581 | | |
586 | 582 | | |
587 | 583 | | |
| |||
1454 | 1450 | | |
1455 | 1451 | | |
1456 | 1452 | | |
1457 | | - | |
| 1453 | + | |
1458 | 1454 | | |
1459 | 1455 | | |
1460 | 1456 | | |
1461 | 1457 | | |
| 1458 | + | |
1462 | 1459 | | |
1463 | 1460 | | |
1464 | 1461 | | |
| 1462 | + | |
| 1463 | + | |
| 1464 | + | |
| 1465 | + | |
| 1466 | + | |
| 1467 | + | |
| 1468 | + | |
| 1469 | + | |
| 1470 | + | |
| 1471 | + | |
| 1472 | + | |
1465 | 1473 | | |
1466 | 1474 | | |
1467 | 1475 | | |
| |||
1890 | 1898 | | |
1891 | 1899 | | |
1892 | 1900 | | |
1893 | | - | |
1894 | | - | |
1895 | | - | |
1896 | | - | |
1897 | | - | |
1898 | | - | |
1899 | | - | |
1900 | | - | |
1901 | | - | |
1902 | | - | |
1903 | | - | |
1904 | 1901 | | |
1905 | 1902 | | |
1906 | 1903 | | |
| |||
3148 | 3145 | | |
3149 | 3146 | | |
3150 | 3147 | | |
3151 | | - | |
3152 | | - | |
| 3148 | + | |
3153 | 3149 | | |
3154 | 3150 | | |
3155 | 3151 | | |
3156 | 3152 | | |
3157 | | - | |
| 3153 | + | |
3158 | 3154 | | |
3159 | 3155 | | |
3160 | 3156 | | |
| |||
3252 | 3248 | | |
3253 | 3249 | | |
3254 | 3250 | | |
3255 | | - | |
| 3251 | + | |
3256 | 3252 | | |
3257 | | - | |
| 3253 | + | |
| 3254 | + | |
| 3255 | + | |
| 3256 | + | |
| 3257 | + | |
| 3258 | + | |
| 3259 | + | |
| 3260 | + | |
| 3261 | + | |
| 3262 | + | |
| 3263 | + | |
| 3264 | + | |
| 3265 | + | |
| 3266 | + | |
| 3267 | + | |
| 3268 | + | |
| 3269 | + | |
| 3270 | + | |
| 3271 | + | |
3258 | 3272 | | |
3259 | 3273 | | |
3260 | 3274 | | |
| |||
4087 | 4101 | | |
4088 | 4102 | | |
4089 | 4103 | | |
4090 | | - | |
| 4104 | + | |
4091 | 4105 | | |
4092 | 4106 | | |
4093 | 4107 | | |
| |||
4236 | 4250 | | |
4237 | 4251 | | |
4238 | 4252 | | |
4239 | | - | |
4240 | | - | |
| 4253 | + | |
| 4254 | + | |
| 4255 | + | |
4241 | 4256 | | |
4242 | | - | |
4243 | | - | |
| 4257 | + | |
| 4258 | + | |
| 4259 | + | |
| 4260 | + | |
| 4261 | + | |
| 4262 | + | |
| 4263 | + | |
| 4264 | + | |
| 4265 | + | |
| 4266 | + | |
| 4267 | + | |
4244 | 4268 | | |
4245 | 4269 | | |
4246 | 4270 | | |
4247 | 4271 | | |
4248 | | - | |
| 4272 | + | |
4249 | 4273 | | |
4250 | 4274 | | |
4251 | 4275 | | |
4252 | | - | |
4253 | | - | |
| 4276 | + | |
| 4277 | + | |
| 4278 | + | |
4254 | 4279 | | |
4255 | | - | |
4256 | | - | |
4257 | | - | |
| 4280 | + | |
| 4281 | + | |
| 4282 | + | |
4258 | 4283 | | |
| 4284 | + | |
| 4285 | + | |
| 4286 | + | |
| 4287 | + | |
| 4288 | + | |
| 4289 | + | |
| 4290 | + | |
| 4291 | + | |
| 4292 | + | |
4259 | 4293 | | |
4260 | 4294 | | |
4261 | 4295 | | |
4262 | 4296 | | |
4263 | | - | |
| 4297 | + | |
4264 | 4298 | | |
4265 | 4299 | | |
4266 | 4300 | | |
| |||
4365 | 4399 | | |
4366 | 4400 | | |
4367 | 4401 | | |
4368 | | - | |
4369 | | - | |
4370 | | - | |
4371 | | - | |
4372 | | - | |
4373 | | - | |
4374 | | - | |
4375 | | - | |
4376 | | - | |
4377 | | - | |
4378 | | - | |
4379 | | - | |
4380 | | - | |
4381 | | - | |
4382 | | - | |
4383 | | - | |
4384 | | - | |
4385 | | - | |
4386 | | - | |
4387 | | - | |
4388 | | - | |
4389 | | - | |
4390 | | - | |
| 4402 | + | |
| 4403 | + | |
4391 | 4404 | | |
4392 | 4405 | | |
4393 | 4406 | | |
4394 | | - | |
4395 | | - | |
4396 | | - | |
4397 | | - | |
4398 | | - | |
4399 | | - | |
4400 | | - | |
4401 | | - | |
4402 | | - | |
4403 | | - | |
| 4407 | + | |
| 4408 | + | |
| 4409 | + | |
4404 | 4410 | | |
4405 | 4411 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
| 27 | + | |
27 | 28 | | |
28 | | - | |
29 | | - | |
| 29 | + | |
| 30 | + | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
33 | | - | |
| 34 | + | |
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
38 | | - | |
| 39 | + | |
39 | 40 | | |
40 | 41 | | |
| 42 | + | |
41 | 43 | | |
42 | | - | |
43 | | - | |
| 44 | + | |
| 45 | + | |
44 | 46 | | |
45 | | - | |
| 47 | + | |
46 | 48 | | |
47 | 49 | | |
48 | 50 | | |
| |||
76 | 78 | | |
77 | 79 | | |
78 | 80 | | |
79 | | - | |
| 81 | + | |
80 | 82 | | |
81 | 83 | | |
82 | 84 | | |
83 | 85 | | |
84 | 86 | | |
85 | 87 | | |
86 | 88 | | |
87 | | - | |
| 89 | + | |
88 | 90 | | |
89 | | - | |
| 91 | + | |
90 | 92 | | |
91 | 93 | | |
92 | 94 | | |
93 | 95 | | |
94 | | - | |
| 96 | + | |
95 | 97 | | |
96 | 98 | | |
97 | 99 | | |
| |||
111 | 113 | | |
112 | 114 | | |
113 | 115 | | |
114 | | - | |
| 116 | + | |
115 | 117 | | |
116 | 118 | | |
117 | 119 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
448 | 448 | | |
449 | 449 | | |
450 | 450 | | |
451 | | - | |
452 | | - | |
453 | 451 | | |
454 | 452 | | |
455 | 453 | | |
| |||
808 | 806 | | |
809 | 807 | | |
810 | 808 | | |
811 | | - | |
812 | | - | |
813 | | - | |
814 | | - | |
815 | | - | |
816 | | - | |
817 | | - | |
818 | | - | |
819 | | - | |
820 | | - | |
821 | | - | |
822 | | - | |
823 | | - | |
824 | | - | |
825 | | - | |
826 | | - | |
827 | | - | |
828 | | - | |
829 | | - | |
830 | | - | |
831 | | - | |
832 | | - | |
833 | | - | |
834 | | - | |
835 | | - | |
836 | | - | |
837 | | - | |
838 | | - | |
839 | | - | |
840 | | - | |
841 | | - | |
842 | | - | |
843 | | - | |
844 | | - | |
845 | | - | |
846 | | - | |
847 | | - | |
848 | | - | |
849 | | - | |
850 | | - | |
851 | | - | |
852 | | - | |
853 | | - | |
854 | | - | |
855 | | - | |
856 | | - | |
857 | | - | |
858 | | - | |
859 | | - | |
860 | | - | |
861 | | - | |
862 | | - | |
863 | | - | |
864 | | - | |
865 | | - | |
866 | | - | |
867 | | - | |
868 | | - | |
869 | | - | |
870 | | - | |
871 | | - | |
872 | | - | |
873 | | - | |
874 | 809 | | |
875 | 810 | | |
876 | 811 | | |
| |||
0 commit comments