Commit d168221
authored
feat(admin): add machine start/stop controls to kiloclaw instance detail (#1066)
## Summary
Adds machine-level Start/Stop buttons to the KiloClaw admin instance
detail page (`/admin/kiloclaw/[id]`). These call the kiloclaw worker's
existing `POST /api/platform/start` and `POST /api/platform/stop`
endpoints via two new admin tRPC mutations (`machineStart`,
`machineStop`).
The buttons are always clickable regardless of the DO's reported machine
state. This is intentional — the primary use case is admin recovery when
the Durable Object state and the actual Fly machine state have drifted
out of sync, so we need to be able to force a start or stop even if the
DO thinks the machine is already in that state.
The existing Gateway Process card controls the openclaw process *inside*
the machine; this new Machine Controls card operates on the Fly machine
itself.
## Verification
- [x] `pnpm typecheck` — passed (only pre-existing errors in
`email-mailgun.ts` unrelated to this change)
- [ ] Manual verification of UI and machine start/stop behavior
## Visual Changes
| Before | After |
| ------ | ----- |
| No machine controls on instance detail page | New "Machine Controls"
card with Start/Stop buttons and status badge, between Live Worker
Status and Gateway Process cards |
## Reviewer Notes
- The two new tRPC mutations follow the exact same pattern as the
existing `gatewayStart`/`gatewayStop` mutations (same input schema,
error handling, logging).
- Buttons are only disabled during in-flight requests — no state-based
gating — per the requirement to always allow forcing start/stop for
recovery scenarios.
- The card only renders when the instance is active and has a
`flyMachineId` (same guard as the gateway controls card).2 files changed
Lines changed: 98 additions & 0 deletions
File tree
- src
- app/admin/components/KiloclawInstances
- routers
Lines changed: 76 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
394 | 394 | | |
395 | 395 | | |
396 | 396 | | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
397 | 427 | | |
398 | 428 | | |
399 | 429 | | |
| |||
494 | 524 | | |
495 | 525 | | |
496 | 526 | | |
| 527 | + | |
497 | 528 | | |
498 | 529 | | |
499 | 530 | | |
| |||
790 | 821 | | |
791 | 822 | | |
792 | 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 | + | |
793 | 869 | | |
794 | 870 | | |
795 | 871 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
448 | 448 | | |
449 | 449 | | |
450 | 450 | | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
451 | 473 | | |
452 | 474 | | |
453 | 475 | | |
| |||
0 commit comments