topside-arch 0.0.0-stage → 0.1.2

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 (95) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +217 -2
  3. package/contrib/aur/.SRCINFO +20 -0
  4. package/contrib/aur/PKGBUILD +35 -0
  5. package/contrib/aur/topside-arch.install +28 -0
  6. package/contrib/icons/hicolor/scalable/apps/topside.svg +28 -0
  7. package/contrib/systemd/topside.service +10 -0
  8. package/contrib/themes/sakura.json +31 -0
  9. package/dist/adapters/claude/attach.js +92 -0
  10. package/dist/adapters/claude/hook-event.js +173 -0
  11. package/dist/adapters/claude/one-shot.js +30 -0
  12. package/dist/adapters/claude/settings.js +78 -0
  13. package/dist/adapters/claude/usage.js +76 -0
  14. package/dist/adapters/codex/codex.js +73 -0
  15. package/dist/adapters/codex/patch.js +39 -0
  16. package/dist/adapters/codex/usage.js +77 -0
  17. package/dist/adapters/pi/extension.js +271 -0
  18. package/dist/adapters/pi/risk-gate.js +256 -0
  19. package/dist/cli/commands.js +615 -0
  20. package/dist/cli/hook-log.js +32 -0
  21. package/dist/cli/main.js +100 -0
  22. package/dist/daemon/preview.js +70 -0
  23. package/dist/daemon/processes.js +105 -0
  24. package/dist/daemon/server.js +437 -0
  25. package/dist/daemon/session-state.js +179 -0
  26. package/dist/daemon/store.js +176 -0
  27. package/dist/dms/setup.js +137 -0
  28. package/dist/hosts/hosts.js +39 -0
  29. package/dist/jump/jump.js +199 -0
  30. package/dist/pill/config.js +92 -0
  31. package/dist/pill/launch.js +38 -0
  32. package/dist/sekaipop/setup.js +267 -0
  33. package/dist/service/unit.js +77 -0
  34. package/dist/shared/ancestry.js +27 -0
  35. package/dist/shared/client.js +29 -0
  36. package/dist/shared/package.js +25 -0
  37. package/dist/shared/paths.js +69 -0
  38. package/dist/shared/protocol.js +35 -0
  39. package/dist/shared/qml-lib.js +33 -0
  40. package/dist/shared/result.js +6 -0
  41. package/dist/shared/terminal.js +42 -0
  42. package/dist/themes/themes.js +84 -0
  43. package/package.json +49 -4
  44. package/shell/core/AgentIcon.qml +24 -0
  45. package/shell/core/AppLogo.qml +48 -0
  46. package/shell/core/ApprovalRow.qml +197 -0
  47. package/shell/core/BoardDetail.qml +336 -0
  48. package/shell/core/BoardList.qml +419 -0
  49. package/shell/core/BoardNotice.qml +189 -0
  50. package/shell/core/CardButton.qml +55 -0
  51. package/shell/core/CardHeader.qml +46 -0
  52. package/shell/core/ChalkBoard.qml +99 -0
  53. package/shell/core/CompletionCard.qml +106 -0
  54. package/shell/core/FlapText.qml +110 -0
  55. package/shell/core/KeyCap.qml +72 -0
  56. package/shell/core/Mascot.qml +13 -0
  57. package/shell/core/MascotBadge.qml +40 -0
  58. package/shell/core/MascotEffect.qml +40 -0
  59. package/shell/core/Paper.qml +54 -0
  60. package/shell/core/PixelGrid.qml +40 -0
  61. package/shell/core/QuestionRow.qml +161 -0
  62. package/shell/core/SessionRow.qml +257 -0
  63. package/shell/core/Stamp.qml +62 -0
  64. package/shell/core/StatusDots.qml +33 -0
  65. package/shell/core/Surface.qml +32 -0
  66. package/shell/core/Tag.qml +22 -0
  67. package/shell/core/TerminalIcon.qml +34 -0
  68. package/shell/core/Theme.qml +100 -0
  69. package/shell/core/TicketDetail.qml +657 -0
  70. package/shell/core/TicketList.qml +717 -0
  71. package/shell/core/TicketNotice.qml +198 -0
  72. package/shell/core/TopsideClient.qml +201 -0
  73. package/shell/core/UsageLine.qml +106 -0
  74. package/shell/core/agents.js +79 -0
  75. package/shell/core/board.js +132 -0
  76. package/shell/core/hiding.js +68 -0
  77. package/shell/core/pixels.js +542 -0
  78. package/shell/core/qmldir +30 -0
  79. package/shell/core/sounds.js +31 -0
  80. package/shell/core/themes.js +195 -0
  81. package/shell/core/ticket.js +170 -0
  82. package/shell/dms-plugin/TopsideSettings.qml +696 -0
  83. package/shell/dms-plugin/TopsideWidget.qml +554 -0
  84. package/shell/dms-plugin/plugin.json +14 -0
  85. package/shell/pill.qml +279 -0
  86. package/shell/sekaipop-plugin/Bar.qml +150 -0
  87. package/shell/sekaipop-plugin/Card.qml +296 -0
  88. package/shell/sekaipop-plugin/Floating.qml +74 -0
  89. package/shell/sekaipop-plugin/ListWindow.qml +156 -0
  90. package/shell/sekaipop-plugin/Popup.qml +70 -0
  91. package/shell/sekaipop-plugin/Service.qml +418 -0
  92. package/shell/sekaipop-plugin/ShellLook.qml +43 -0
  93. package/shell/sekaipop-plugin/StyledCard.qml +194 -0
  94. package/shell/sekaipop-plugin/place.js +28 -0
  95. package/shell/sekaipop-plugin/plugin.json +109 -0
@@ -0,0 +1,657 @@
1
+ import QtQuick
2
+ import QtQuick.Shapes
3
+ import QtQuick.Layouts
4
+ import "agents.js" as Agents
5
+ import "board.js" as Board
6
+ import "ticket.js" as Ticket
7
+
8
+ // One order ticket on paper, the heart of the Ticket style: the session it's
9
+ // for, a big line saying what it wants, the change or the command, and the
10
+ // rubber stamps that answer it. A pressed stamp slams its word onto the
11
+ // paper, the ticket is torn off (`leaving`), and only then does the answer
12
+ // go. For a finished turn it's ORDER UP! with your prompt and the reply; for
13
+ // any other session, your prompt, what it does now, JUMP, and quiet "Hide"
14
+ // links. Hiding asks first: with `hideQuestion` set, a dashed red box with
15
+ // the question and HIDE N / KEEP stamps takes the links' place (VIA-PARITY
16
+ // §29). It answers through the client itself; hiding and dismissing are the
17
+ // host's, so they go out as signals.
18
+ Paper {
19
+ id: ticket
20
+ required property var client
21
+ property var session: null
22
+ // A waiting request of the session, as Board.pending() gives it, or null.
23
+ property var request: null
24
+ property bool finished: false
25
+ property bool reminding: false
26
+ property bool shortcuts: false
27
+ property bool canHide: false
28
+ property bool closable: false
29
+ // The text size; the notice prints bigger than the list.
30
+ property int size: 12
31
+ // Taller than this, the middle scrolls inside.
32
+ property real maxHeight: 100000
33
+ // Everything but the middle: the band, the head, the stamps, the margins
34
+ // (the dashes' and the headline's spacing are the size * 3).
35
+ readonly property real fixedHeight: {
36
+ let h = body.y + Math.round(size * 1.4) + tooth + size * 3;
37
+ for (const child of body.children)
38
+ if (child !== scroller && child.visible) h += child.implicitHeight + body.spacing;
39
+ return h;
40
+ }
41
+ signal dismissed()
42
+ signal hideFolder()
43
+ signal hidePrompt()
44
+ signal closeRequested()
45
+ // An open hide question: its text ("Hide 2 tickets in web-app, …?") and count.
46
+ property string hideQuestion: ""
47
+ property int hideCount: 0
48
+ signal hideConfirmed()
49
+ signal hideKept()
50
+
51
+ // Stamped and being torn off: the holder lifts it away.
52
+ property bool leaving: false
53
+
54
+ readonly property var approval: request && request.kind === "approval" ? request.item : null
55
+ readonly property var question: request && request.kind === "question" ? request.item : null
56
+ readonly property string agent: session ? session.agent : "claude"
57
+ readonly property bool gated: approval !== null && Board.gated(agent)
58
+ readonly property var lines: approval ? (approval.preview || []) : []
59
+ readonly property string command: approval && lines.length === 0 ? String(approval.summary || "").replace(approval.toolName + ": ", "") : ""
60
+ readonly property int added: lines.filter(l => l.kind === "add").length
61
+ readonly property int removed: lines.filter(l => l.kind === "remove").length
62
+ readonly property int waited: request && reminding ? Math.max(1, Math.round((now - request.createdAt) / 60000)) : 0
63
+ readonly property string band: Ticket.band(request, session, reminding)
64
+
65
+ property real now: Date.now()
66
+ Timer {
67
+ interval: 1000
68
+ repeat: true
69
+ running: ticket.visible
70
+ onTriggered: ticket.now = Date.now()
71
+ }
72
+
73
+ implicitHeight: body.implicitHeight + body.y + Math.round(size * 1.4) + tooth
74
+
75
+ // A new ticket in the same place starts clean.
76
+ // By id: every snapshot brings new objects for the same session and
77
+ // request, and resetting on those cut a stamp short.
78
+ readonly property string ticketKey: (request ? request.item.id : "") + "/" + (session ? session.id : "")
79
+ onTicketKeyChanged: reset()
80
+ function reset() {
81
+ mark.visible = false;
82
+ ticket.leaving = false;
83
+ pending.fn = null;
84
+ settle.stop();
85
+ tearOff.stop();
86
+ // The last ticket's put-it-back would wipe this one's answer.
87
+ backAgain.stop();
88
+ }
89
+
90
+ // Press a stamp: its word lands on the paper, the ticket tears off, then
91
+ // `fn` runs (the answer, the jump, the dismissal).
92
+ function press(action, label, fn) {
93
+ if (mark.visible) return;
94
+ mark.word = Ticket.stampWord(action, label);
95
+ mark.bad = Ticket.stampBad(action);
96
+ mark.visible = true;
97
+ slam.restart();
98
+ pending.fn = fn;
99
+ settle.restart();
100
+ }
101
+ QtObject {
102
+ id: pending
103
+ property var fn: null
104
+ }
105
+ Timer {
106
+ id: settle
107
+ interval: 560
108
+ onTriggered: {
109
+ ticket.leaving = true;
110
+ tearOff.restart();
111
+ }
112
+ }
113
+ Timer {
114
+ id: tearOff
115
+ interval: 420
116
+ onTriggered: {
117
+ const fn = pending.fn;
118
+ pending.fn = null;
119
+ if (fn) fn();
120
+ // A jump leaves the same ticket in place: put it back.
121
+ backAgain.restart();
122
+ }
123
+ }
124
+ Timer {
125
+ id: backAgain
126
+ interval: 1400
127
+ onTriggered: ticket.reset()
128
+ }
129
+
130
+ // ⌃1…⌃9 from the host, and a stamp on an option.
131
+ function pick(index, label) {
132
+ if (!ticket.question) return;
133
+ if (!Board.instant(ticket.question)) {
134
+ if (fullQuestion.item) fullQuestion.item.pick(index, label);
135
+ return;
136
+ }
137
+ const q = ticket.question;
138
+ ticket.press("answer", label, () => {
139
+ const answers = {};
140
+ answers[q.questions[index].question] = label;
141
+ ticket.client.answer(q.id, answers);
142
+ });
143
+ }
144
+ // A card shortcut (⌃Y ⌃N ⌃A) for this ticket's request: the stamp its key
145
+ // is printed on, slam and tear included, as a click. True when it's ours.
146
+ function stampKey(approvalId, decision) {
147
+ if (!ticket.approval || ticket.approval.id !== approvalId) return false;
148
+ ticket.decide(Ticket.stampFor(decision, ticket.gated));
149
+ return true;
150
+ }
151
+ function decide(action) {
152
+ const a = ticket.approval;
153
+ const decision = action === "block" ? "deny" : action === "run" ? "allow" : action;
154
+ ticket.press(action, "", () => ticket.client.decide(a.id, decision));
155
+ }
156
+
157
+ component Words: Text {
158
+ color: Ticket.ink
159
+ font.family: Theme.monoFont
160
+ font.pixelSize: ticket.size
161
+ wrapMode: Text.Wrap
162
+ Layout.fillWidth: true
163
+ }
164
+ component Small: Words {
165
+ color: Ticket.faint
166
+ font.pixelSize: Math.max(10, ticket.size - 2)
167
+ }
168
+ component Dashes: Item {
169
+ Layout.fillWidth: true
170
+ Layout.topMargin: Math.round(ticket.size * 0.4)
171
+ Layout.bottomMargin: Math.round(ticket.size * 0.4)
172
+ implicitHeight: 2
173
+ clip: true
174
+ Row {
175
+ spacing: 4
176
+ Repeater {
177
+ model: Math.max(0, Math.ceil(ticket.width / 9))
178
+ delegate: Rectangle {
179
+ width: 5
180
+ height: 2
181
+ color: Ticket.rule
182
+ }
183
+ }
184
+ }
185
+ }
186
+ // A receipt line: the label, dot leaders across, the value at the right,
187
+ // so the eye follows the dots from one to the other on a wide ticket.
188
+ component Pair: RowLayout {
189
+ property string label
190
+ property string value
191
+ Layout.fillWidth: true
192
+ spacing: 6
193
+ Words {
194
+ text: parent.label
195
+ Layout.fillWidth: false
196
+ }
197
+ Words {
198
+ text: " ·".repeat(160)
199
+ color: Ticket.rule
200
+ wrapMode: Text.NoWrap
201
+ maximumLineCount: 1
202
+ clip: true
203
+ Layout.fillWidth: true
204
+ Layout.minimumWidth: 0
205
+ }
206
+ Words {
207
+ text: parent.value
208
+ font.weight: Font.Bold
209
+ Layout.fillWidth: false
210
+ }
211
+ }
212
+ component QuietLink: Text {
213
+ id: link
214
+ signal clicked()
215
+ color: linkHover.hovered ? Ticket.ink : Ticket.faint
216
+ font.family: Theme.monoFont
217
+ font.pixelSize: Math.max(10, ticket.size - 2)
218
+ font.underline: linkHover.hovered
219
+ HoverHandler {
220
+ id: linkHover
221
+ cursorShape: Qt.PointingHandCursor
222
+ }
223
+ TapHandler {
224
+ onTapped: link.clicked()
225
+ }
226
+ }
227
+
228
+ // The band: a reminder's second notice, the risk gate's hazard stripes.
229
+ Rectangle {
230
+ id: bandStrip
231
+ visible: ticket.band !== ""
232
+ width: parent.width
233
+ height: visible ? Math.round(ticket.size * 2) : 0
234
+ color: ticket.band === "2ND NOTICE" ? Ticket.red : Ticket.ink
235
+ clip: true
236
+ Canvas {
237
+ visible: ticket.band === "HAZARD"
238
+ anchors.fill: parent
239
+ onPaint: {
240
+ const ctx = getContext("2d");
241
+ ctx.reset();
242
+ ctx.fillStyle = "#f3c623";
243
+ for (let x = -height; x < width + height; x += 20) {
244
+ ctx.beginPath();
245
+ ctx.moveTo(x, height);
246
+ ctx.lineTo(x + 10, height);
247
+ ctx.lineTo(x + 10 + height, 0);
248
+ ctx.lineTo(x + height, 0);
249
+ ctx.closePath();
250
+ ctx.fill();
251
+ }
252
+ }
253
+ onWidthChanged: requestPaint()
254
+ }
255
+ Rectangle {
256
+ visible: ticket.band === "HAZARD"
257
+ anchors.centerIn: parent
258
+ width: bandText.implicitWidth + 16
259
+ height: bandText.implicitHeight + 2
260
+ color: Ticket.ink
261
+ }
262
+ Text {
263
+ id: bandText
264
+ anchors.centerIn: parent
265
+ text: ticket.band
266
+ color: "#ffffff"
267
+ font.family: Theme.monoFont
268
+ font.pixelSize: ticket.size
269
+ font.weight: Font.Bold
270
+ font.letterSpacing: ticket.size * 0.3
271
+ }
272
+ }
273
+
274
+ ColumnLayout {
275
+ id: body
276
+ x: Math.round(ticket.size * 1.5)
277
+ y: bandStrip.height + Math.round(ticket.size * 1.2)
278
+ width: parent.width - 2 * x
279
+ spacing: Math.round(ticket.size * 0.25)
280
+
281
+ Small {
282
+ text: "TOPSIDE · ORDER " + Ticket.orderNumber(ticket.session ? ticket.session.id : "")
283
+ horizontalAlignment: Text.AlignHCenter
284
+ font.letterSpacing: 1.5
285
+ }
286
+ RowLayout {
287
+ Layout.fillWidth: true
288
+ Words {
289
+ text: ticket.session ? Board.sessionName(ticket.session).toUpperCase() : ""
290
+ font.pixelSize: ticket.size + 3
291
+ font.weight: Font.Bold
292
+ elide: Text.ElideRight
293
+ wrapMode: Text.NoWrap
294
+ }
295
+ Words {
296
+ text: Qt.formatTime(new Date(ticket.request ? ticket.request.createdAt : ticket.now), "hh:mm")
297
+ Layout.fillWidth: false
298
+ }
299
+ }
300
+ Small {
301
+ text: ticket.session ? (Agents.style(ticket.agent).name + " · " + String(ticket.session.cwd || "").replace(/^\/home\/[^/]+/, "~")).toUpperCase() : ""
302
+ elide: Text.ElideMiddle
303
+ wrapMode: Text.NoWrap
304
+ }
305
+ Dashes {}
306
+
307
+ Words {
308
+ text: Ticket.headline(ticket.request, ticket.session, ticket.finished, ticket.waited)
309
+ horizontalAlignment: Text.AlignHCenter
310
+ font.pixelSize: Math.round(ticket.size * 1.9)
311
+ font.weight: Font.Bold
312
+ Layout.topMargin: Math.round(ticket.size * 0.3)
313
+ Layout.bottomMargin: Math.round(ticket.size * 0.4)
314
+ }
315
+
316
+ // What it says scrolls on its own when it's long; the head and the
317
+ // stamps stay put.
318
+ Flickable {
319
+ id: scroller
320
+ Layout.fillWidth: true
321
+ Layout.preferredHeight: Math.min(middle.implicitHeight, Math.max(60, ticket.maxHeight - ticket.fixedHeight))
322
+ contentHeight: middle.implicitHeight
323
+ clip: true
324
+ boundsBehavior: Flickable.StopAtBounds
325
+ interactive: contentHeight > height
326
+ ColumnLayout {
327
+ id: middle
328
+ width: scroller.width
329
+ spacing: body.spacing
330
+ // A request: the file and its change, or the command.
331
+ Pair {
332
+ visible: ticket.approval !== null && (ticket.approval.file || "") !== ""
333
+ label: ticket.approval ? ticket.approval.toolName + " " + (ticket.approval.file || "") : ""
334
+ value: "+" + ticket.added + " −" + ticket.removed
335
+ }
336
+ Repeater {
337
+ model: ticket.lines
338
+ delegate: Words {
339
+ required property var modelData
340
+ text: (modelData.kind === "add" ? "+ " : modelData.kind === "remove" ? "− " : modelData.kind === "more" ? "" : " ") + modelData.text
341
+ color: modelData.kind === "add" ? Ticket.green : modelData.kind === "remove" ? Ticket.red : modelData.kind === "more" ? Ticket.faint : Ticket.ink
342
+ wrapMode: Text.NoWrap
343
+ elide: Text.ElideRight
344
+ }
345
+ }
346
+ Words {
347
+ visible: ticket.command !== ""
348
+ text: "$ " + ticket.command
349
+ font.weight: Font.Bold
350
+ wrapMode: Text.WrapAnywhere
351
+ maximumLineCount: 4
352
+ elide: Text.ElideRight
353
+ }
354
+ Pair {
355
+ visible: ticket.gated
356
+ label: "AUTO-VOID IN"
357
+ value: ticket.approval ? Board.gateLeft(ticket.approval, ticket.now) + " S" : ""
358
+ }
359
+
360
+ // A question: the question, then a stamp per option; several questions
361
+ // or several choices take the full question card.
362
+ Words {
363
+ visible: ticket.question !== null && Board.instant(ticket.question)
364
+ text: ticket.question && ticket.question.questions[0] ? ticket.question.questions[0].question : ""
365
+ font.pixelSize: ticket.size + 1
366
+ }
367
+ Loader {
368
+ id: fullQuestion
369
+ active: ticket.question !== null && !Board.instant(ticket.question)
370
+ visible: active
371
+ Layout.fillWidth: true
372
+ sourceComponent: QuestionRow {
373
+ question: ticket.question
374
+ session: ticket.session
375
+ onAnswered: answers => ticket.client.answer(ticket.question.id, answers)
376
+ onOpenTerminal: ticket.client.jump(ticket.question.sessionId)
377
+ }
378
+ }
379
+
380
+ // A finished turn or any other session: your prompt, then the reply or what it does.
381
+ Small {
382
+ visible: ticket.request === null && ticket.session !== null && (ticket.session.lastPrompt || "") !== ""
383
+ text: "YOU:"
384
+ }
385
+ Words {
386
+ visible: ticket.request === null && ticket.session !== null && (ticket.session.lastPrompt || "") !== ""
387
+ text: ticket.session ? ticket.session.lastPrompt || "" : ""
388
+ maximumLineCount: 3
389
+ elide: Text.ElideRight
390
+ }
391
+ Text {
392
+ // The agent's last reply, for a finished turn and for any session
393
+ // picked on the list: what it said is what you came to see. The
394
+ // notice keeps it short; the list's panel scrolls instead.
395
+ visible: ticket.request === null && ticket.session !== null && (ticket.session.lastMessage || "") !== ""
396
+ text: ticket.session ? ticket.session.lastMessage || "" : ""
397
+ textFormat: Text.MarkdownText
398
+ color: Ticket.ink
399
+ font.family: Theme.font
400
+ font.pixelSize: ticket.size + 1
401
+ wrapMode: Text.Wrap
402
+ maximumLineCount: ticket.finished ? 6 : 60
403
+ elide: Text.ElideRight
404
+ Layout.fillWidth: true
405
+ Layout.topMargin: Math.round(ticket.size * 0.4)
406
+ }
407
+ Pair {
408
+ visible: ticket.request === null && !ticket.finished && ticket.session !== null
409
+ // A blank line between what was said and the receipt lines.
410
+ Layout.topMargin: Math.round(ticket.size * 1.2)
411
+ label: "NOW"
412
+ value: ticket.session ? Board.nowLine(ticket.session).toUpperCase() : ""
413
+ }
414
+ Pair {
415
+ visible: ticket.request === null && !ticket.finished && ticket.session !== null
416
+ label: "FOR"
417
+ value: ticket.session ? Board.age(ticket.session.startedAt, ticket.now) : ""
418
+ }
419
+ }
420
+ }
421
+
422
+ Dashes {}
423
+
424
+ Flow {
425
+ id: stampRow
426
+ // Stamps sit at the ticket's right, as the board's keys do, the yes
427
+ // stamp last; a row too long for the paper wraps.
428
+ Layout.alignment: Qt.AlignRight
429
+ Layout.preferredWidth: Math.min(shownWidth, body.width)
430
+ spacing: Math.round(ticket.size * 0.6)
431
+ // Every stamp as wide as the widest one shown.
432
+ readonly property real stampWidth: {
433
+ let w = 0;
434
+ for (const child of children)
435
+ if (child.isKey && child.visible) w = Math.max(w, child.implicitWidth);
436
+ return w;
437
+ }
438
+ readonly property real shownWidth: {
439
+ let n = 0;
440
+ for (const child of children)
441
+ if (child.isKey && child.visible) n++;
442
+ return n > 0 ? n * stampWidth + (n - 1) * spacing : 0;
443
+ }
444
+
445
+ // A request.
446
+ Stamp {
447
+ width: stampRow.stampWidth
448
+ visible: ticket.approval !== null
449
+ size: ticket.size
450
+ label: ticket.gated ? "Block" : "Deny"
451
+ sub: ticket.shortcuts ? "⌃N" : ""
452
+ ink: Ticket.red
453
+ tilt: -1.5
454
+ onClicked: ticket.decide(ticket.gated ? "block" : "deny")
455
+ }
456
+ Stamp {
457
+ width: stampRow.stampWidth
458
+ visible: ticket.approval !== null && (ticket.approval.always || "") !== ""
459
+ size: ticket.size
460
+ label: "Always"
461
+ sub: ticket.shortcuts ? "⌃A" : ""
462
+ tilt: 1.2
463
+ onClicked: ticket.decide("always")
464
+ }
465
+ Stamp {
466
+ width: stampRow.stampWidth
467
+ visible: ticket.approval !== null && ticket.agent === "claude"
468
+ size: ticket.size
469
+ label: "Auto"
470
+ tilt: -0.8
471
+ onClicked: ticket.decide("auto")
472
+ }
473
+ Stamp {
474
+ width: stampRow.stampWidth
475
+ visible: ticket.approval !== null
476
+ size: ticket.size
477
+ label: ticket.gated ? "Run it" : "Allow"
478
+ sub: ticket.shortcuts ? "⌃Y" : ""
479
+ ink: Ticket.green
480
+ tilt: 1.5
481
+ onClicked: ticket.decide(ticket.gated ? "run" : "allow")
482
+ }
483
+
484
+ // A question with one stamp per option.
485
+ Repeater {
486
+ model: ticket.question !== null && Board.instant(ticket.question) ? ticket.question.questions[0].options : []
487
+ delegate: Stamp {
488
+ width: stampRow.stampWidth
489
+ required property var modelData
490
+ required property int index
491
+ size: ticket.size
492
+ label: (index + 1) + " · " + modelData.label
493
+ sub: ticket.shortcuts ? "⌃" + (index + 1) : ""
494
+ ink: index === 0 ? Ticket.green : Ticket.ink
495
+ tilt: index % 2 === 0 ? -1.2 : 1.2
496
+ onClicked: ticket.pick(0, modelData.label)
497
+ }
498
+ }
499
+
500
+ // A finished turn, or any session.
501
+ Stamp {
502
+ width: stampRow.stampWidth
503
+ visible: ticket.finished
504
+ size: ticket.size
505
+ label: "Spike it"
506
+ tilt: -1.2
507
+ onClicked: ticket.press("spike", "", () => ticket.dismissed())
508
+ }
509
+ Stamp {
510
+ width: stampRow.stampWidth
511
+ visible: ticket.request === null && ticket.session !== null
512
+ size: ticket.size
513
+ label: ticket.finished ? "Show me" : "Jump"
514
+ sub: ticket.shortcuts ? "⌃J" : ""
515
+ ink: Ticket.green
516
+ tilt: 1.2
517
+ onClicked: {
518
+ const id = ticket.session.id;
519
+ ticket.press("jump", "", () => ticket.client.jump(id));
520
+ }
521
+ }
522
+ }
523
+
524
+ // Hiding is a side door, not an answer: quiet text.
525
+ RowLayout {
526
+ visible: ticket.request === null && !ticket.finished && ticket.canHide && ticket.hideQuestion === ""
527
+ spacing: 6
528
+ Layout.topMargin: Math.round(ticket.size * 0.4)
529
+ QuietLink {
530
+ text: "Hide this folder"
531
+ onClicked: ticket.hideFolder()
532
+ }
533
+ QuietLink {
534
+ visible: (ticket.session ? ticket.session.title || "" : "") !== ""
535
+ text: "· Hide prompts like it"
536
+ onClicked: ticket.hidePrompt()
537
+ }
538
+ }
539
+
540
+ // The hide question, in a dashed red box where the links were.
541
+ Item {
542
+ id: askBox
543
+ visible: ticket.hideQuestion !== ""
544
+ Layout.fillWidth: true
545
+ Layout.topMargin: Math.round(ticket.size * 0.4)
546
+ implicitHeight: askColumn.implicitHeight + 20
547
+ Shape {
548
+ anchors.fill: parent
549
+ ShapePath {
550
+ strokeColor: Ticket.red
551
+ strokeWidth: 1.5
552
+ strokeStyle: ShapePath.DashLine
553
+ dashPattern: [4, 3]
554
+ fillColor: "transparent"
555
+ startX: 1; startY: 1
556
+ PathLine { x: askBox.width - 1; y: 1 }
557
+ PathLine { x: askBox.width - 1; y: askBox.height - 1 }
558
+ PathLine { x: 1; y: askBox.height - 1 }
559
+ PathLine { x: 1; y: 1 }
560
+ }
561
+ }
562
+ ColumnLayout {
563
+ id: askColumn
564
+ x: 10
565
+ y: 10
566
+ width: parent.width - 20
567
+ spacing: 8
568
+ Words {
569
+ text: ticket.hideQuestion
570
+ color: Ticket.red
571
+ wrapMode: Text.Wrap
572
+ Layout.fillWidth: true
573
+ }
574
+ RowLayout {
575
+ spacing: 10
576
+ Item { Layout.fillWidth: true }
577
+ Stamp {
578
+ size: ticket.size
579
+ label: "Keep"
580
+ tilt: -1.2
581
+ onClicked: ticket.hideKept()
582
+ }
583
+ Stamp {
584
+ size: ticket.size
585
+ label: "Hide " + ticket.hideCount
586
+ ink: Ticket.red
587
+ tilt: 1.2
588
+ onClicked: ticket.hideConfirmed()
589
+ }
590
+ }
591
+ }
592
+ }
593
+ }
594
+
595
+ Text {
596
+ visible: ticket.closable
597
+ anchors.right: parent.right
598
+ anchors.top: parent.top
599
+ anchors.margins: Math.round(ticket.size * 0.6)
600
+ anchors.topMargin: bandStrip.height + Math.round(ticket.size * 0.6)
601
+ text: "✕"
602
+ color: closeHover.hovered ? Ticket.ink : Ticket.faint
603
+ font.pixelSize: ticket.size + 1
604
+ HoverHandler {
605
+ id: closeHover
606
+ cursorShape: Qt.PointingHandCursor
607
+ }
608
+ TapHandler {
609
+ onTapped: ticket.closeRequested()
610
+ }
611
+ }
612
+
613
+ // The stamp's mark: slammed on crooked, in a double box of ink.
614
+ Rectangle {
615
+ id: mark
616
+ property string word: ""
617
+ property bool bad: false
618
+ visible: false
619
+ anchors.centerIn: parent
620
+ anchors.verticalCenterOffset: -parent.height * 0.04
621
+ width: markText.implicitWidth + ticket.size * 2
622
+ height: markText.implicitHeight + ticket.size
623
+ color: "transparent"
624
+ border.width: 4
625
+ border.color: bad ? Ticket.red : Ticket.green
626
+ radius: 8
627
+ rotation: -12
628
+ opacity: 0.88
629
+ Rectangle {
630
+ anchors.fill: parent
631
+ anchors.margins: 6
632
+ color: "transparent"
633
+ border.width: 2
634
+ border.color: parent.border.color
635
+ radius: 4
636
+ }
637
+ Text {
638
+ id: markText
639
+ anchors.centerIn: parent
640
+ text: mark.word
641
+ color: mark.border.color
642
+ font.family: Theme.monoFont
643
+ font.pixelSize: Math.round(ticket.size * 2.4)
644
+ font.weight: Font.Black
645
+ font.letterSpacing: ticket.size * 0.25
646
+ }
647
+ NumberAnimation on scale {
648
+ id: slam
649
+ running: false
650
+ from: 2.6
651
+ to: 1
652
+ duration: 260
653
+ easing.type: Easing.OutBack
654
+ easing.overshoot: 2.2
655
+ }
656
+ }
657
+ }