Commit dc756e5
authored
feat(gastown): add mayor edit tools and manual editing UI (#1076)
* feat(gastown): add mayor edit capabilities and manual bead/agent/convoy editing
Adds 7 new mayor edit tools (gt_bead_update, gt_bead_reassign, gt_agent_reset,
gt_convoy_close, gt_bead_delete, gt_escalation_acknowledge, gt_bead_fail) with
corresponding PATCH endpoints. Adds dashboard UI edit controls (status dropdowns,
editable fields, unhook/reset buttons). Updates mayor system prompt with
Surgical Editing section documenting the new capabilities.
Closes #996
* feat(gastown): make all bead fields user-editable in dashboard UI and API
Expand the PATCH /beads/:id endpoint to accept type, rig_id, and
parent_bead_id in addition to existing fields. Add corresponding
updateBeadFields support. Dashboard UI gains: labels input (comma-
separated), metadata textarea (JSON), type/rig/parent dropdowns,
in_review status option, Load button to populate the form from an
existing bead, and an Edit button in the beads table for one-click
editing. Also adds priority column to the beads table and failed
badge style.
* feat(gastown): add bead editing UI to BeadPanel drawer
Add updateBead tRPC mutation to the gastown worker router accepting all
editable bead fields (title, body, status, priority, type, labels,
metadata, rig_id, parent_bead_id). The BeadPanel drawer now has a pencil
icon toggle that switches to edit mode: title becomes an input, status/
type/priority become selects, and labels/body/metadata/rig_id/parent
fields appear as additional inputs. Save computes a diff against the
original bead and only sends changed fields. Regenerated router.d.ts
type declarations.
* fix(gastown): move Save button to top of bead edit form
The Save button was at the bottom of the edit fields section, making
it hard to find when only changing status/type/priority. Moved it
inline with the status/type/priority selects so it's always visible
at the top of the edit form. Removed the duplicate Save/Cancel bar
from the bottom.
* fix(gastown): address PR review feedback — security, lint, and formatting
- Remove bead type from editable fields to prevent inconsistent state
(type changes require satellite metadata tables that aren't created)
- Add rig ownership check in handleMayorBeadUpdate matching the pattern
in handleMayorBeadDelete — rejects updates to beads in other rigs
- Fix reassign atomicity: hook new agent before unhooking old one so
failures don't leave beads unassigned
- Fix reassign unhook safety: verify old agent is still hooked to this
specific bead before unhooking (stale assignee_agent_bead_id)
- Fix reassign response: return updated bead instead of { reassigned }
to match client contract
- Fix ESLint: void floating promises, destructure useMutation result
- Fix Prettier formatting in 5 files
- Regenerate router.d.ts type declarations
* fix(gastown): enforce rig scoping on reassign, reset, and tRPC updateBead
- Reassign: validate target agent belongs to the specified rig and
verify bead belongs to the rig before allowing reassignment
- Agent reset: verify agent belongs to the specified rig before
allowing reset (prevents cross-rig reset via any valid rig ID)
- tRPC updateBead: verify bead belongs to the specified rig before
allowing mutation (mirrors the HTTP handler fix)
* fix(gastown): address second round of PR review feedback
- Fix pre-existing type errors: use sql.exec() directly for dynamic
SET clause queries where query() can't statically verify param count
- Clear closed_at when reopening a previously-closed bead (status
transition away from 'closed' now nulls out the stale timestamp)
- Add in_review to gt_bead_update tool status enum and client type
- Remove Type dropdown from debug dashboard (API no longer accepts it)
* fix(gastown): address third round of PR review feedback
- Dashboard unhook: use mayorApi() with mayor route instead of api()
with the rig route, so the bearer token is sent correctly
- Dashboard bead table: use b.bead_id (the actual PK) instead of b.id
(undefined), and b.assignee_agent_bead_id for the assignee column
- BeadPanel metadata: reject save with inline error when metadata JSON
is invalid instead of silently dropping the field. Error clears on
edit and displays with red border on the textarea.1 parent 82b7c49 commit dc756e5
15 files changed
Lines changed: 2193 additions & 102 deletions
File tree
- cloudflare-gastown
- container/plugin
- src
- db/tables
- dos
- town
- handlers
- prompts
- trpc
- ui
- src
- components/gastown/drawer-panels
- lib/gastown/types
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
348 | 348 | | |
349 | 349 | | |
350 | 350 | | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
351 | 409 | | |
352 | 410 | | |
353 | 411 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
124 | 131 | | |
125 | 132 | | |
126 | 133 | | |
| |||
245 | 252 | | |
246 | 253 | | |
247 | 254 | | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
248 | 342 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
244 | 244 | | |
245 | 245 | | |
246 | 246 | | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
247 | 360 | | |
248 | 361 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
0 commit comments