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,717 @@
1
+ import QtQuick
2
+ import QtQuick.Layouts
3
+ import "board.js" as Board
4
+ import "ticket.js" as Ticket
5
+ import "hiding.js" as Hiding
6
+ import QtQuick.Shapes
7
+
8
+ // The Ticket style's session list: the kitchen rail. A dark shift report
9
+ // heads it with the plan usage; under it every session is a small ticket
10
+ // clipped to one rail, five at most, newest first, waiting ones hanging
11
+ // lower so you see them, and every waiting one on the first page
12
+ // (Ticket.rail, VIA-PARITY §28). The rest sit on the spike at the end of the
13
+ // rail; a click on it swaps the next five onto the rail. A ticket whose place
14
+ // changes slides there and swings again from its magnet.
15
+ // Nothing is picked when the list opens. A click on a ticket unclips it: the
16
+ // full ticket (TicketDetail.qml) drops below the rails. Hiding asks first
17
+ // (§29): the tickets it would take get a dashed red outline and WILL HIDE.
18
+ ColumnLayout {
19
+ id: list
20
+ // The most the list may take; past that the picked session's panel
21
+ // scrolls inside, so its keys or stamps never drop out of sight.
22
+ property real maxHeight: 100000
23
+ required property var client
24
+ property var sessions: []
25
+ property string usageAgent: "claude"
26
+ property var spend: null
27
+ property bool shortcuts: false
28
+ property string iconFont: ""
29
+ signal hovered(string sessionId)
30
+ signal hideFolder(var session)
31
+ signal hidePrompt(var session)
32
+ signal settingsRequested()
33
+ // The speaker left of the gear: off unless the host has sounds to switch.
34
+ property bool soundSwitch: false
35
+ property bool soundsOn: false
36
+ signal soundsToggled()
37
+ signal quitRequested()
38
+ signal startRequested()
39
+
40
+ // Every session, newest first, five to a page; the rail shows one page.
41
+ readonly property var everyone: sessions
42
+ readonly property int perRail: 5
43
+ readonly property var shownRail: Ticket.rail(everyone, page, perRail)
44
+ readonly property int pages: shownRail.pages
45
+ property int page: 0
46
+ onPagesChanged: if (page >= pages) page = 0
47
+ readonly property var rows: shownRail.rows
48
+ readonly property bool spiked: everyone.length > perRail
49
+ // How many wait on the spike: every ticket not on this page.
50
+ readonly property int onSpike: shownRail.onSpike
51
+ // Where each ticket hung before this change of rows, so one that moves
52
+ // slides from there. Taken after the tickets have read it.
53
+ property var places: ({})
54
+ function notePlaces() {
55
+ const next = {};
56
+ rows.forEach((s, i) => next[s.id] = i);
57
+ places = next;
58
+ }
59
+ onRowsChanged: Qt.callLater(notePlaces)
60
+ readonly property var items: rows.concat(spiked ? [{ spike: true }] : [])
61
+ property string selectedId: ""
62
+ readonly property var selected: rows.find(s => s.id === selectedId) || null
63
+ readonly property var selectedRequest: selected ? Board.pendingFor(selected.id, client.approvals, client.questions) : null
64
+
65
+ // Opened again: start over, as a fresh look at the rail.
66
+ function reset() {
67
+ selectedId = "";
68
+ page = 0;
69
+ hideAsk = null;
70
+ }
71
+
72
+ // A hide asked from the picked ticket, not yet confirmed: { folder, text,
73
+ // sessionId }. It recounts on every snapshot (every session, not only this
74
+ // page) and goes with its session; picking another ticket, KEEP, Esc or the
75
+ // list closing drop it.
76
+ property var hideAsk: null
77
+ readonly property var hideRule: hideAsk ? Hiding.question(hideAsk, hideAsk.sessionId, everyone) : null
78
+ onSelectedIdChanged: hideAsk = null
79
+ function askHide(folder) {
80
+ if (!selected) return;
81
+ hideAsk = { folder: folder, text: folder ? selected.cwd || "" : selected.title || "", sessionId: selected.id };
82
+ }
83
+ function confirmHide() {
84
+ const session = selected;
85
+ const ask = hideAsk;
86
+ hideAsk = null;
87
+ if (!session || !ask) return;
88
+ selectedId = "";
89
+ if (ask.folder) list.hideFolder(session);
90
+ else list.hidePrompt(session);
91
+ }
92
+ function cancelHide() {
93
+ if (!hideRule) return false;
94
+ hideAsk = null;
95
+ return true;
96
+ }
97
+
98
+ readonly property var keyed: client.questions.length > 0 ? client.questions[0] : client.approvals[0] || null
99
+
100
+ // ⌃Y ⌃N ⌃A from the host: the picked ticket's stamp, when it shows that request.
101
+ function stampKey(approvalId, decision) {
102
+ return detail.visible && detail.stampKey(approvalId, decision);
103
+ }
104
+
105
+ // ⌃1…⌃9: the first question's option, its ticket picked so you see it stamped.
106
+ function pick(index, label) {
107
+ const question = client.questions[0];
108
+ if (!question) return;
109
+ // Its ticket may hang on another page: go there first. The id goes
110
+ // first so the page change doesn't pick another waiting ticket.
111
+ selectedId = question.sessionId;
112
+ const at = Ticket.pageOf(everyone, question.sessionId, perRail);
113
+ if (at >= 0) page = at;
114
+ detail.pick(index, label);
115
+ }
116
+
117
+ property real now: Date.now()
118
+ Timer {
119
+ interval: 30000
120
+ repeat: true
121
+ running: true
122
+ onTriggered: list.now = Date.now()
123
+ }
124
+
125
+ // Whose plan the shift report shows: the picked ticket's session, else
126
+ // the newest. Never the one under the pointer: the report would change
127
+ // height as you move across the rail, and the rail would jump.
128
+ readonly property var planSession: selected || (sessions.length > 0 ? sessions[0] : null)
129
+ readonly property string planAgent: planSession ? planSession.agent : usageAgent
130
+ readonly property var plan: Ticket.planRows(client.usage[planAgent] || null, planAgent,
131
+ planSession ? client.spend[planSession.id] || null : null, client.connected, now / 1000)
132
+
133
+ readonly property int gap: 10
134
+ readonly property int spikeWidth: 90
135
+ // Five tickets fill the rail, edge to edge; the spike, when there is one,
136
+ // takes its room at the end.
137
+ readonly property real miniWidth: Math.floor((width - 2 * 14 - (spiked ? spikeWidth + gap : 0) - (perRail - 1) * gap) / perRail)
138
+
139
+ spacing: 12
140
+
141
+ component Mono: Text {
142
+ font.family: Theme.monoFont
143
+ font.pixelSize: 11
144
+ color: Ticket.ink
145
+ }
146
+ // Written in chalk on the menu board.
147
+ component Chalk: Mono {
148
+ font.family: menuBoard.chalkFont
149
+ font.pixelSize: 13
150
+ color: "#e9e6dc"
151
+ }
152
+ component HeadKey: Text {
153
+ id: key
154
+ signal clicked()
155
+ font.family: list.iconFont
156
+ font.pixelSize: 16
157
+ color: keyHover.hovered ? "#ffffff" : "#bdbab0"
158
+ HoverHandler {
159
+ id: keyHover
160
+ cursorShape: Qt.PointingHandCursor
161
+ }
162
+ TapHandler {
163
+ onTapped: key.clicked()
164
+ }
165
+ }
166
+
167
+ // The shift report: plan usage, how many on the rail, settings and quit,
168
+ // chalked on the kitchen's menu board above the rail.
169
+ ChalkBoard {
170
+ id: menuBoard
171
+ Layout.fillWidth: true
172
+ implicitHeight: report.implicitHeight + 2 * inset
173
+ ColumnLayout {
174
+ id: report
175
+ x: menuBoard.inset
176
+ y: menuBoard.inset
177
+ width: parent.width - 2 * menuBoard.inset
178
+ spacing: 6
179
+ RowLayout {
180
+ Layout.fillWidth: true
181
+ spacing: 10
182
+ Chalk {
183
+ text: "SHIFT"
184
+ color: "#ffffff"
185
+ font.weight: Font.Bold
186
+ font.letterSpacing: 2.5
187
+ }
188
+ Chalk {
189
+ text: list.rows.length + " ON THE RAIL"
190
+ color: "#e9e6dc"
191
+ Layout.fillWidth: true
192
+ }
193
+ // The speaker flips Sounds; a host that has them turns it on.
194
+ HeadKey {
195
+ visible: list.iconFont !== "" && list.soundSwitch
196
+ text: list.soundsOn ? "volume_up" : "volume_off"
197
+ onClicked: list.soundsToggled()
198
+ }
199
+ HeadKey {
200
+ visible: list.iconFont !== ""
201
+ text: "settings"
202
+ onClicked: list.settingsRequested()
203
+ }
204
+ HeadKey {
205
+ visible: list.iconFont !== "" && list.client.connected
206
+ text: "power_settings_new"
207
+ onClicked: list.quitRequested()
208
+ }
209
+ }
210
+ // Always two lines (Ticket.planRows), so the rail never moves.
211
+ Repeater {
212
+ model: list.plan
213
+ delegate: RowLayout {
214
+ id: planLine
215
+ required property var modelData
216
+ readonly property var row: modelData
217
+ Layout.fillWidth: true
218
+ implicitHeight: 16
219
+ spacing: 8
220
+ Chalk {
221
+ text: planLine.row.label
222
+ color: planLine.row.label === "PRINTER OFFLINE" ? "#f2a19a" : "#e9e6dc"
223
+ font.weight: planLine.row.label === "PRINTER OFFLINE" ? Font.Bold : Font.Normal
224
+ Layout.preferredWidth: planLine.row.label.length > 8 ? -1 : 64
225
+ }
226
+ // The bar: filled, or dashed while there's nothing to show.
227
+ Item {
228
+ visible: planLine.row.percent !== -1
229
+ Layout.fillWidth: true
230
+ implicitHeight: 5
231
+ Rectangle {
232
+ visible: planLine.row.percent !== null
233
+ anchors.fill: parent
234
+ color: "#3c443e"
235
+ Rectangle {
236
+ width: parent.width * Math.min(100, planLine.row.percent || 0) / 100
237
+ height: parent.height
238
+ color: planLine.row.percent >= 80 ? "#f2a19a" : planLine.row.percent >= 50 ? "#f7c58b" : "#a8e6a1"
239
+ }
240
+ }
241
+ Row {
242
+ visible: planLine.row.percent === null
243
+ anchors.verticalCenter: parent.verticalCenter
244
+ spacing: 3
245
+ clip: true
246
+ width: parent.width
247
+ Repeater {
248
+ model: Math.max(0, Math.floor(parent.width / 7))
249
+ delegate: Rectangle {
250
+ width: 4
251
+ height: 1
252
+ color: "#8d918a"
253
+ }
254
+ }
255
+ }
256
+ }
257
+ Chalk {
258
+ visible: planLine.row.value !== ""
259
+ text: planLine.row.value
260
+ color: "#ffffff"
261
+ font.weight: Font.Bold
262
+ Layout.fillWidth: planLine.row.percent === -1
263
+ }
264
+ Chalk {
265
+ visible: planLine.row.note !== ""
266
+ text: planLine.row.note
267
+ color: "#bdbab0"
268
+ elide: Text.ElideRight
269
+ horizontalAlignment: Text.AlignRight
270
+ Layout.fillWidth: planLine.row.percent === -1 && planLine.row.value === ""
271
+ // A hint (no reading yet) takes the dashed bar's room, so it's never cut.
272
+ Layout.maximumWidth: planLine.row.percent === -1 || planLine.row.percent === null ? -1 : 190
273
+ }
274
+ }
275
+ }
276
+ }
277
+ }
278
+
279
+ // The rail: one, five tickets at most, then the spike.
280
+ Item {
281
+ id: rail
282
+ readonly property int railIndex: 0
283
+ Layout.fillWidth: true
284
+ implicitHeight: hang.implicitHeight + 12
285
+
286
+ // The bar itself.
287
+ Rectangle {
288
+ width: parent.width
289
+ height: 12
290
+ radius: 6
291
+ gradient: Gradient {
292
+ GradientStop { position: 0; color: list.client.connected ? "#e8ebf0" : "#6b6f76" }
293
+ GradientStop { position: 0.6; color: list.client.connected ? "#8b919c" : "#4a4e55" }
294
+ GradientStop { position: 1; color: list.client.connected ? "#5d626b" : "#34373c" }
295
+ }
296
+ }
297
+
298
+ Row {
299
+ id: hang
300
+ x: 14
301
+ y: 6
302
+ spacing: list.gap
303
+ Repeater {
304
+ // A count, not the array: every snapshot from the daemon is a new array,
305
+ // and a Repeater given one throws its items away and makes them again
306
+ // (the tickets swung in, the flaps riffled, every few seconds). With a
307
+ // count they stay, and only what they show changes.
308
+ model: list.items.length
309
+ delegate: Loader {
310
+ required property int index
311
+ readonly property var modelData: list.items[index] || ({})
312
+ readonly property int slotIndex: rail.railIndex * list.perRail + index
313
+ sourceComponent: modelData.spike ? spikeItem : miniTicket
314
+ }
315
+ }
316
+ }
317
+ }
318
+
319
+
320
+ // A session's small ticket on the rail.
321
+ Component {
322
+ id: miniTicket
323
+ Item {
324
+ id: mini
325
+ readonly property var session: parent ? parent.modelData : null
326
+ readonly property int place: parent ? parent.slotIndex : 0
327
+ readonly property var request: session ? Board.pendingFor(session.id, list.client.approvals, list.client.questions) : null
328
+ readonly property bool chosen: session !== null && list.selectedId === session.id
329
+ readonly property bool waits: request !== null
330
+ readonly property bool caught: session !== null && list.hideRule !== null && list.hideRule.caught.indexOf(session.id) >= 0
331
+ readonly property real tilt: [-2.5, 2, -1.5, 3, -2][place % 5]
332
+ // Another ticket took this slot: one that hung elsewhere on the rail
333
+ // slides over from there and swings again, as if taken off and hung
334
+ // back up (VIA-PARITY §28).
335
+ readonly property string sessionId: session ? session.id || "" : ""
336
+ property string shownId: ""
337
+ onSessionIdChanged: {
338
+ const from = list.places[sessionId];
339
+ if (shownId !== "" && sessionId !== "" && from !== undefined && from !== place) {
340
+ slide.stop();
341
+ shift.x = (from - place) * (list.miniWidth + list.gap);
342
+ slide.restart();
343
+ swingIn.restart();
344
+ }
345
+ shownId = sessionId;
346
+ }
347
+ Component.onCompleted: shownId = sessionId
348
+ transform: Translate {
349
+ id: shift
350
+ }
351
+ NumberAnimation {
352
+ id: slide
353
+ target: shift
354
+ property: "x"
355
+ to: 0
356
+ duration: 480
357
+ easing.type: Easing.OutBack
358
+ easing.overshoot: 1.6
359
+ }
360
+ width: list.miniWidth
361
+ implicitHeight: face.implicitHeight + (waits ? 22 : 0) + (chosen ? 10 : 0)
362
+
363
+ // The magnet that holds it to the rail, in the ink of its tag: the
364
+ // paper hangs from it, so it stays put while the paper swings. The
365
+ // picked ticket's is bigger, ringed in amber.
366
+ Item {
367
+ id: magnet
368
+ z: 2
369
+ readonly property int size: mini.chosen ? 20 : 16
370
+ x: mini.width / 2 - size / 2
371
+ y: -size / 2
372
+ width: size
373
+ height: size
374
+ // Its shadow on the rail and the paper.
375
+ Rectangle {
376
+ x: 1.5
377
+ y: 2.5
378
+ width: parent.width
379
+ height: parent.height
380
+ radius: width / 2
381
+ color: "#000000"
382
+ opacity: 0.35
383
+ }
384
+ Rectangle {
385
+ anchors.fill: parent
386
+ radius: width / 2
387
+ border.width: mini.chosen ? 2 : 1
388
+ border.color: mini.chosen ? "#f5c84b" : Qt.darker(Ticket.tagInk(mini.session), 1.6)
389
+ gradient: Gradient {
390
+ GradientStop { position: 0; color: Qt.lighter(Ticket.tagInk(mini.session), 1.45) }
391
+ GradientStop { position: 1; color: Qt.darker(Ticket.tagInk(mini.session), 1.25) }
392
+ }
393
+ }
394
+ // The shine.
395
+ Rectangle {
396
+ x: parent.width * 0.26
397
+ y: parent.height * 0.2
398
+ width: parent.width * 0.3
399
+ height: width * 0.7
400
+ radius: height / 2
401
+ color: "#ffffff"
402
+ opacity: 0.55
403
+ }
404
+ }
405
+
406
+ // A waiting ticket, and the picked one, hang lower on a string from
407
+ // their magnet.
408
+ Rectangle {
409
+ visible: face.y > 0
410
+ x: mini.width / 2 - 1
411
+ width: 2
412
+ height: face.y + 2
413
+ color: "#9aa0aa"
414
+ }
415
+
416
+ Paper {
417
+ id: face
418
+ y: (mini.waits ? 22 : 0) + (mini.chosen ? 10 : 0)
419
+ width: mini.width
420
+ implicitHeight: info.implicitHeight + 26 + tooth
421
+ height: implicitHeight
422
+ transformOrigin: Item.Top
423
+ rotation: mini.chosen || hover.hovered ? 0 : mini.tilt
424
+ // Paper is paper: never see-through. A session on break is just an
425
+ // older, greyer slip; the picked one hangs lower, its magnet lit.
426
+ color: mini.session && mini.session.status === "idle" ? "#e6e1d3" : Ticket.paper
427
+ Behavior on y {
428
+ NumberAnimation { duration: 200; easing.type: Easing.OutBack }
429
+ }
430
+ Behavior on rotation {
431
+ NumberAnimation { duration: 200 }
432
+ }
433
+ // Clipped on, it swings a little before it settles.
434
+ transform: Rotation {
435
+ id: swing
436
+ origin.x: face.width / 2
437
+ angle: 0
438
+ }
439
+ SequentialAnimation {
440
+ id: swingIn
441
+ running: true
442
+ PropertyAction { target: swing; property: "angle"; value: 9 }
443
+ PauseAnimation { duration: mini.place * 70 }
444
+ NumberAnimation { target: swing; property: "angle"; to: -6; duration: 380; easing.type: Easing.OutQuad }
445
+ NumberAnimation { target: swing; property: "angle"; to: 2; duration: 300; easing.type: Easing.InOutQuad }
446
+ NumberAnimation { target: swing; property: "angle"; to: 0; duration: 300; easing.type: Easing.OutQuad }
447
+ }
448
+
449
+ ColumnLayout {
450
+ id: info
451
+ x: 11
452
+ y: 14
453
+ width: parent.width - 22
454
+ spacing: 3
455
+ AgentIcon {
456
+ agent: mini.session ? mini.session.agent : "claude"
457
+ size: 22
458
+ }
459
+ Mono {
460
+ text: mini.session ? Board.sessionName(mini.session).toUpperCase() : ""
461
+ font.pixelSize: 13
462
+ font.weight: Font.Bold
463
+ elide: Text.ElideRight
464
+ Layout.fillWidth: true
465
+ }
466
+ Mono {
467
+ text: mini.session ? Board.age(mini.session.startedAt, list.now) : ""
468
+ color: Ticket.faint
469
+ }
470
+ Mono {
471
+ text: mini.session ? Board.nowLine(mini.session) : ""
472
+ wrapMode: Text.Wrap
473
+ maximumLineCount: 2
474
+ elide: Text.ElideRight
475
+ Layout.fillWidth: true
476
+ }
477
+ // The tag stamp at the ticket's right, as the stamps on a full ticket.
478
+ Rectangle {
479
+ Layout.topMargin: 5
480
+ Layout.alignment: Qt.AlignRight
481
+ implicitWidth: tagText.implicitWidth + 10
482
+ implicitHeight: tagText.implicitHeight + 2
483
+ color: "transparent"
484
+ border.width: 2
485
+ border.color: mini.caught ? Ticket.red : Ticket.tagInk(mini.session)
486
+ rotation: -4
487
+ opacity: mini.waits && blink.dim ? 0.35 : 1
488
+ Mono {
489
+ id: tagText
490
+ anchors.centerIn: parent
491
+ text: mini.caught ? "WILL HIDE" : Ticket.tag(mini.session)
492
+ color: mini.caught ? Ticket.red : Ticket.tagInk(mini.session)
493
+ font.weight: Font.Bold
494
+ font.letterSpacing: 1
495
+ }
496
+ }
497
+ }
498
+
499
+ // A ticket the open hide question would take: a dashed red outline.
500
+ Shape {
501
+ visible: mini.caught
502
+ x: -4
503
+ y: -4
504
+ width: face.width + 8
505
+ height: face.height + 8
506
+ ShapePath {
507
+ strokeColor: Ticket.red
508
+ strokeWidth: 2
509
+ strokeStyle: ShapePath.DashLine
510
+ dashPattern: [4, 3]
511
+ fillColor: "transparent"
512
+ startX: 0; startY: 0
513
+ PathLine { x: face.width + 8; y: 0 }
514
+ PathLine { x: face.width + 8; y: face.height + 8 }
515
+ PathLine { x: 0; y: face.height + 8 }
516
+ PathLine { x: 0; y: 0 }
517
+ }
518
+ }
519
+
520
+ HoverHandler {
521
+ id: hover
522
+ cursorShape: Qt.PointingHandCursor
523
+ onHoveredChanged: list.hovered(hovered && mini.session ? mini.session.id : "")
524
+ }
525
+ TapHandler {
526
+ onTapped: list.selectedId = mini.chosen ? "" : mini.session.id
527
+ }
528
+ }
529
+ }
530
+ }
531
+
532
+ // The spike at the end: the tickets past "Sessions shown", pierced.
533
+ Component {
534
+ id: spikeItem
535
+ Item {
536
+ id: spike
537
+ width: list.spikeWidth
538
+ implicitHeight: 150
539
+ Rectangle {
540
+ x: spike.width / 2 - 1
541
+ y: 8
542
+ width: 3
543
+ height: 110
544
+ gradient: Gradient {
545
+ GradientStop { position: 0; color: "#dddddd" }
546
+ GradientStop { position: 1; color: "#777777" }
547
+ }
548
+ }
549
+ Repeater {
550
+ model: Math.min(4, Math.max(1, list.onSpike))
551
+ delegate: Rectangle {
552
+ required property int index
553
+ x: spike.width / 2 - 34
554
+ y: 34 + index * 16
555
+ width: 68
556
+ height: 30
557
+ color: Ticket.paper
558
+ rotation: [-8, 6, -3, 9][index]
559
+ opacity: 1
560
+ }
561
+ }
562
+ Text {
563
+ anchors.horizontalCenter: parent.horizontalCenter
564
+ y: 124
565
+ text: list.page === list.pages - 1 ? "◂ BACK" : "+" + list.onSpike + " ON SPIKE"
566
+ color: spikeHover.hovered ? "#ffffff" : "#e8e4d8"
567
+ font.family: Theme.monoFont
568
+ font.pixelSize: 12
569
+ font.weight: Font.Bold
570
+ }
571
+ HoverHandler {
572
+ id: spikeHover
573
+ cursorShape: Qt.PointingHandCursor
574
+ }
575
+ TapHandler {
576
+ onTapped: list.page = (list.page + 1) % list.pages
577
+ }
578
+ }
579
+ }
580
+
581
+ // Nothing on the rail: say why, and what to do.
582
+ Item {
583
+ visible: list.rows.length === 0
584
+ Layout.fillWidth: true
585
+ implicitHeight: 12
586
+ Rectangle {
587
+ width: parent.width
588
+ height: 12
589
+ radius: 6
590
+ gradient: Gradient {
591
+ GradientStop { position: 0; color: list.client.connected ? "#e8ebf0" : "#6b6f76" }
592
+ GradientStop { position: 0.6; color: list.client.connected ? "#8b919c" : "#4a4e55" }
593
+ GradientStop { position: 1; color: list.client.connected ? "#5d626b" : "#34373c" }
594
+ }
595
+ }
596
+ }
597
+ Paper {
598
+ visible: list.rows.length === 0
599
+ Layout.alignment: Qt.AlignHCenter
600
+ Layout.preferredWidth: Math.min(320, list.width - 40)
601
+ implicitHeight: note.implicitHeight + 34 + tooth
602
+ rotation: -2
603
+ ColumnLayout {
604
+ id: note
605
+ x: 16
606
+ y: 16
607
+ width: parent.width - 32
608
+ spacing: 6
609
+ Mono {
610
+ text: list.client.connected ? "NO ORDERS" : "PRINTER OFFLINE"
611
+ font.pixelSize: 19
612
+ font.weight: Font.Bold
613
+ Layout.alignment: Qt.AlignHCenter
614
+ }
615
+ Mono {
616
+ text: list.client.connected ? "Kitchen's quiet. Start claude, codex, pi or omp in a terminal and its ticket clips on here." : "Topside isn't running, so nothing prints."
617
+ color: Ticket.faint
618
+ wrapMode: Text.Wrap
619
+ horizontalAlignment: Text.AlignHCenter
620
+ Layout.fillWidth: true
621
+ }
622
+ Stamp {
623
+ visible: !list.client.connected
624
+ label: "Start Topside"
625
+ ink: Ticket.green
626
+ Layout.alignment: Qt.AlignHCenter
627
+ Layout.topMargin: 6
628
+ onClicked: list.startRequested()
629
+ }
630
+ }
631
+ }
632
+
633
+ // The picked ticket, unclipped and dropped below the rails.
634
+ TicketDetail {
635
+ id: detail
636
+ // What's left under the rail or the rows, less what sits below it.
637
+ maxHeight: list.maxHeight - y - (jumpErrorText.visible ? jumpErrorText.height + list.spacing : 0)
638
+ visible: list.selected !== null
639
+ client: list.client
640
+ session: list.selected
641
+ request: list.selectedRequest
642
+ shortcuts: list.shortcuts && list.selectedRequest !== null && list.selectedRequest.item === list.keyed
643
+ canHide: true
644
+ closable: true
645
+ Layout.fillWidth: true
646
+ Layout.leftMargin: 6
647
+ Layout.rightMargin: 6
648
+ Layout.topMargin: 6
649
+ implicitWidth: list.width
650
+ rotation: -4 * lift
651
+ opacity: 1 - lift
652
+ property real lift: 0
653
+ onLeavingChanged: {
654
+ if (leaving) liftAway.restart();
655
+ else {
656
+ liftAway.stop();
657
+ lift = 0;
658
+ }
659
+ }
660
+ hideQuestion: list.hideRule ? Hiding.questionText(list.hideRule, "ticket") : ""
661
+ hideCount: list.hideRule ? list.hideRule.caught.length : 0
662
+ onHideFolder: list.askHide(true)
663
+ onHidePrompt: list.askHide(false)
664
+ onHideConfirmed: list.confirmHide()
665
+ onHideKept: list.hideAsk = null
666
+ onCloseRequested: list.selectedId = ""
667
+ // Each pick drops in from the rail.
668
+ transform: Scale {
669
+ id: drop
670
+ origin.x: detail.width / 2
671
+ xScale: 1
672
+ yScale: 1
673
+ }
674
+ // A new pick drops in; a new snapshot of the same session doesn't.
675
+ readonly property string pickedId: session ? session.id : ""
676
+ onPickedIdChanged: if (pickedId !== "") unclip.restart()
677
+ }
678
+ NumberAnimation {
679
+ id: liftAway
680
+ target: detail
681
+ property: "lift"
682
+ from: 0
683
+ to: 1
684
+ duration: 380
685
+ }
686
+ NumberAnimation {
687
+ id: unclip
688
+ target: drop
689
+ properties: "xScale,yScale"
690
+ from: 0.6
691
+ to: 1
692
+ duration: 380
693
+ easing.type: Easing.OutBack
694
+ }
695
+
696
+ Text {
697
+ id: jumpErrorText
698
+ visible: list.client.jumpError !== ""
699
+ text: list.client.jumpError
700
+ color: Theme.reminder
701
+ font.family: Theme.font
702
+ font.pixelSize: 12
703
+ wrapMode: Text.Wrap
704
+ Layout.fillWidth: true
705
+ }
706
+
707
+ QtObject {
708
+ id: blink
709
+ property bool dim: false
710
+ }
711
+ Timer {
712
+ interval: 600
713
+ repeat: true
714
+ running: list.client.approvals.length + list.client.questions.length > 0
715
+ onTriggered: blink.dim = !blink.dim
716
+ }
717
+ }