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,419 @@
1
+ import QtQuick
2
+ import QtQuick.Layouts
3
+ import "board.js" as Board
4
+ import "hiding.js" as Hiding
5
+
6
+ // The departure board style's session list: one flap row per session (a
7
+ // lamp, its age, name, agent, status word and what it does now), newest
8
+ // first as the daemon sends them, the plan usage in the board's header. The
9
+ // rows are slots: when the order changes they stay put and their flaps
10
+ // riffle to the new text, like a real departure board. Nothing is picked
11
+ // when the list opens; a click on a row opens BoardDetail.qml under the
12
+ // board: a waiting session's request with its keys, any other's last prompt
13
+ // with Jump and Hide (VIA-PARITY §28). Hiding asks first (§29).
14
+ ColumnLayout {
15
+ id: list
16
+ // The most the list may take; past that the picked session's panel
17
+ // scrolls inside, so its keys or stamps never drop out of sight.
18
+ property real maxHeight: 100000
19
+ required property var client
20
+ // The rows, as the host cuts them ("Sessions shown"), and how many it left out.
21
+ property var sessions: []
22
+ property int moreCount: 0
23
+ property bool showingAll: false
24
+ property string usageAgent: "claude"
25
+ property var spend: null
26
+ property bool shortcuts: false
27
+ property string iconFont: ""
28
+ signal moreRequested(bool all)
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
+ readonly property var rows: sessions
41
+ // Bumped each time the list opens: every flap riffles as the board comes down.
42
+ property int riffleSerial: 0
43
+ property string selectedId: ""
44
+ readonly property var selected: rows.find(s => s.id === selectedId) || null
45
+ readonly property var selectedRequest: selected ? Board.pendingFor(selected.id, client.approvals, client.questions) : null
46
+
47
+ // Opened again: start over, as a fresh look at the board.
48
+ function reset() {
49
+ selectedId = "";
50
+ flashes = ({});
51
+ hideAsk = null;
52
+ riffleSerial++;
53
+ }
54
+
55
+ // A hide asked from the picked row, not yet confirmed: { folder, text,
56
+ // sessionId }. The question recounts on every snapshot and goes with its
57
+ // session; picking another row, KEEP, Esc or the list closing drop it.
58
+ property var hideAsk: null
59
+ readonly property var hideRule: hideAsk ? Hiding.question(hideAsk, hideAsk.sessionId, rows) : null
60
+ onSelectedIdChanged: hideAsk = null
61
+ function askHide(folder) {
62
+ if (!selected) return;
63
+ hideAsk = { folder: folder, text: folder ? selected.cwd || "" : selected.title || "", sessionId: selected.id };
64
+ }
65
+ function confirmHide() {
66
+ const session = selected;
67
+ const ask = hideAsk;
68
+ hideAsk = null;
69
+ if (!session || !ask) return;
70
+ selectedId = "";
71
+ if (ask.folder) list.hideFolder(session);
72
+ else list.hidePrompt(session);
73
+ }
74
+ // Esc: drops an open question first. True when there was one.
75
+ function cancelHide() {
76
+ if (!hideRule) return false;
77
+ hideAsk = null;
78
+ return true;
79
+ }
80
+
81
+ // The request the host's keys answer: the first question, else the first
82
+ // request (⌃Y ⌃N ⌃A, ⌃1…⌃9). Its keys show their shortcuts; no other's do.
83
+ readonly property var keyed: client.questions.length > 0 ? client.questions[0] : client.approvals[0] || null
84
+
85
+ // ⌃1…⌃9: the first question's option, its row picked so you see it go.
86
+ function pick(index, label) {
87
+ const question = client.questions[0];
88
+ if (!question) return;
89
+ selectedId = question.sessionId;
90
+ if (Board.instant(question)) {
91
+ const answers = {};
92
+ answers[question.questions[index].question] = label;
93
+ client.answer(question.id, answers);
94
+ } else detail.pick(index, label);
95
+ }
96
+
97
+ property real now: Date.now()
98
+ Timer {
99
+ interval: 30000
100
+ repeat: true
101
+ running: true
102
+ onTriggered: list.now = Date.now()
103
+ }
104
+
105
+ // A wide board (Topside's own list window) has an AGENT column and a
106
+ // longer NOW; SekaiPop's 480 wide popup leaves the agent to its mark.
107
+ readonly property bool wide: width >= 700
108
+ // Lamp, 3 + 11 (+ 6) + 8 + 8 flaps, the mark, and the gaps. On a wide
109
+ // board NOW keeps 12 (NOT TRACKED fits; only a working session's activity
110
+ // is longer, and its panel has it in full) and SESSION takes the rest, up
111
+ // to 24, so a name isn't cut while NOW runs on empty.
112
+ readonly property real cell: Math.max(9, Math.min(17, Math.floor((width - 24 - 28 - 10 - 18 - 60) / (wide ? 37 : 30.9) / 1.12)))
113
+ readonly property real step: cell + Math.max(1, Math.round(cell / 9))
114
+ readonly property int spare: !wide ? 19
115
+ : Math.max(18, Math.floor((width - 24 - Math.round(cell * 0.9) - 10 - 60 - Math.round(cell * 1.1)) / step) - 17)
116
+ readonly property int sessionLength: !wide ? 11 : Math.max(10, Math.min(24, spare - 12))
117
+ readonly property int nowLength: Math.max(8, spare - sessionLength)
118
+
119
+ // Whose plan the header shows: the picked row's session, else the newest;
120
+ // never the row under the pointer, so nothing shifts as you move.
121
+ readonly property var planSession: selected || (sessions.length > 0 ? sessions[0] : null)
122
+ readonly property var usage: client.usage[planSession ? planSession.agent : usageAgent] || null
123
+ readonly property var planSpend: planSession ? client.spend[planSession.id] || null : null
124
+
125
+ // Words a row flips to for a moment: ALLOWED, DENIED, HIDDEN…
126
+ property var flashes: ({})
127
+ function flash(id, word) {
128
+ const next = Object.assign({}, flashes);
129
+ next[id] = word;
130
+ flashes = next;
131
+ flashClear.restart();
132
+ }
133
+ Timer {
134
+ id: flashClear
135
+ interval: 1400
136
+ onTriggered: list.flashes = ({})
137
+ }
138
+ readonly property var windows: [
139
+ { label: "5H", window: usage ? usage.fiveHour : undefined },
140
+ { label: "7D", window: usage ? usage.sevenDay : undefined },
141
+ ].filter(w => w.window && w.window.resetsAt > now / 1000)
142
+
143
+ spacing: 10
144
+
145
+ component HeadText: Text {
146
+ color: "#f5c84b"
147
+ font.family: Theme.monoFont
148
+ font.pixelSize: 10
149
+ font.weight: Font.Bold
150
+ font.letterSpacing: 1.8
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" : "#8e94a6"
158
+ HoverHandler {
159
+ id: keyHover
160
+ cursorShape: Qt.PointingHandCursor
161
+ }
162
+ TapHandler {
163
+ onTapped: key.clicked()
164
+ }
165
+ }
166
+
167
+ Rectangle {
168
+ Layout.fillWidth: true
169
+ implicitHeight: board.implicitHeight + 24
170
+ radius: 12
171
+ border.color: "#2e3038"
172
+ gradient: Gradient {
173
+ GradientStop { position: 0; color: "#17181c" }
174
+ GradientStop { position: 1; color: "#0c0d10" }
175
+ }
176
+
177
+ ColumnLayout {
178
+ id: board
179
+ anchors.fill: parent
180
+ anchors.margins: 12
181
+ spacing: 4
182
+
183
+ RowLayout {
184
+ Layout.fillWidth: true
185
+ spacing: 10
186
+ HeadText {
187
+ text: "TOPSIDE · DEPARTURES"
188
+ Layout.fillWidth: true
189
+ }
190
+ HeadText {
191
+ visible: !list.client.connected
192
+ text: "OFFLINE"
193
+ color: Theme.reminder
194
+ }
195
+ Repeater {
196
+ model: list.client.connected ? list.windows : []
197
+ delegate: HeadText {
198
+ required property var modelData
199
+ readonly property int used: Math.round(modelData.window.usedPercentage)
200
+ text: modelData.label + " " + used + "%"
201
+ color: used >= 80 ? Theme.reminder : used >= 50 ? Theme.waiting : Theme.done
202
+ }
203
+ }
204
+ HeadText {
205
+ visible: list.client.connected && list.windows.length === 0 && list.planSpend !== null && list.planSpend.cost > 0
206
+ text: list.planSpend ? "$" + list.planSpend.cost.toFixed(2) : ""
207
+ }
208
+ HeadText {
209
+ text: Qt.formatTime(new Date(list.now), "hh:mm")
210
+ }
211
+ // The speaker flips Sounds; a host that has them turns it on.
212
+ HeadKey {
213
+ visible: list.iconFont !== "" && list.soundSwitch
214
+ text: list.soundsOn ? "volume_up" : "volume_off"
215
+ onClicked: list.soundsToggled()
216
+ }
217
+ HeadKey {
218
+ visible: list.iconFont !== ""
219
+ text: "settings"
220
+ onClicked: list.settingsRequested()
221
+ }
222
+ HeadKey {
223
+ visible: list.iconFont !== "" && list.client.connected
224
+ text: "power_settings_new"
225
+ onClicked: list.quitRequested()
226
+ }
227
+ }
228
+
229
+ // Column heads, over the flaps they name.
230
+ Row {
231
+ visible: list.rows.length > 0
232
+ spacing: 0
233
+ Repeater {
234
+ model: [["", Math.round(list.cell * 0.9) + 10 + 10], ["AGE", 3], ["SESSION", list.sessionLength], ["", -1]].concat(list.wide ? [["AGENT", 6]] : []).concat([["STATUS", 8], ["NOW", list.nowLength]])
235
+ delegate: Text {
236
+ required property var modelData
237
+ width: modelData[1] < 0 ? Math.round(list.cell * 1.1) + 10 : modelData[0] === "" ? modelData[1] : modelData[1] * list.cell * 1.12 + 10
238
+ text: modelData[0]
239
+ color: "#8e94a6"
240
+ font.family: Theme.monoFont
241
+ font.pixelSize: 9
242
+ font.letterSpacing: 1.6
243
+ }
244
+ }
245
+ }
246
+
247
+ Repeater {
248
+ // A count, not the array: every snapshot from the daemon is a new array,
249
+ // and a Repeater given one throws its items away and makes them again
250
+ // (the tickets swung in, the flaps riffled, every few seconds). With a
251
+ // count they stay, and only what they show changes.
252
+ model: list.rows.length
253
+ delegate: Item {
254
+ id: row
255
+ required property int index
256
+ readonly property var modelData: list.rows[index] || ({})
257
+ readonly property var request: Board.pendingFor(modelData.id, list.client.approvals, list.client.questions)
258
+ // A session the open hide question would catch reads HIDE? in red, lamp included.
259
+ readonly property bool caught: list.hideRule !== null && list.hideRule.caught.indexOf(modelData.id) >= 0
260
+ readonly property string word: caught ? "HIDE?" : list.flashes[modelData.id] || Board.statusWord(modelData, request ? request.kind : "", false)
261
+ readonly property bool chosen: list.selectedId === modelData.id
262
+ // Picking a row puts the others in the dark, as a spotlight would;
263
+ // the pointer brings one halfway back.
264
+ readonly property bool shaded: list.selectedId !== "" && !chosen
265
+ Layout.fillWidth: true
266
+ implicitHeight: line.implicitHeight + 6
267
+ opacity: shaded ? (rowHover.hovered ? 0.75 : 0.38) : 1
268
+ Behavior on opacity {
269
+ NumberAnimation { duration: 160 }
270
+ }
271
+
272
+ // The picked row is framed in the board's amber.
273
+ Rectangle {
274
+ visible: row.chosen
275
+ x: line.x - 5
276
+ width: line.width + 10
277
+ height: parent.height
278
+ radius: 5
279
+ color: "transparent"
280
+ border.color: "#f5c84b"
281
+ border.width: 1.5
282
+ }
283
+
284
+ // The pointer: amber on the picked row, a hint under the mouse.
285
+ Text {
286
+ anchors.verticalCenter: parent.verticalCenter
287
+ x: -2
288
+ text: "▶"
289
+ visible: row.chosen || rowHover.hovered
290
+ color: row.chosen ? "#f5c84b" : "#5c606c"
291
+ font.pixelSize: Math.round(list.cell * 0.7)
292
+ }
293
+
294
+ RowLayout {
295
+ id: line
296
+ anchors.verticalCenter: parent.verticalCenter
297
+ x: Math.round(list.cell * 0.9)
298
+ spacing: 10
299
+ Rectangle {
300
+ width: 10
301
+ height: 10
302
+ radius: 5
303
+ color: Theme[Board.statusTone(row.word)]
304
+ opacity: row.request && lampBlink.dim ? 0.3 : 1
305
+ }
306
+ FlapText { riffleSerial: list.riffleSerial; text: Board.age(row.modelData.startedAt, list.now); length: 3; cell: list.cell; color: "#9a9ca6"; lit: row.chosen }
307
+ FlapText { riffleSerial: list.riffleSerial; text: Board.sessionName(row.modelData); length: list.sessionLength; cell: list.cell; lit: row.chosen }
308
+ AgentIcon { agent: row.modelData.agent; size: Math.round(list.cell * 1.1) }
309
+ FlapText { riffleSerial: list.riffleSerial; visible: list.wide; text: row.modelData.agent; length: 6; cell: list.cell; color: "#9a9ca6"; lit: row.chosen }
310
+ FlapText { riffleSerial: list.riffleSerial; text: row.word; length: 8; cell: list.cell; color: Theme[Board.statusTone(row.word)]; lit: row.chosen }
311
+ FlapText { riffleSerial: list.riffleSerial; text: Board.nowLine(row.modelData); length: list.nowLength; cell: list.cell; color: "#9a9ca6"; lit: row.chosen }
312
+ }
313
+
314
+ HoverHandler {
315
+ id: rowHover
316
+ cursorShape: Qt.PointingHandCursor
317
+ onHoveredChanged: list.hovered(hovered ? row.modelData.id : "")
318
+ }
319
+ TapHandler {
320
+ onTapped: list.selectedId = row.chosen ? "" : row.modelData.id
321
+ }
322
+ }
323
+ }
324
+
325
+ // Nothing to list: say why, and what to do.
326
+ RowLayout {
327
+ visible: list.rows.length === 0
328
+ spacing: 10
329
+ Layout.topMargin: 4
330
+ FlapText { riffleSerial: list.riffleSerial; text: list.client.connected ? "NO" : "TOPSIDE"; length: 10; cell: list.cell }
331
+ FlapText { riffleSerial: list.riffleSerial;
332
+ text: list.client.connected ? "DEPARTURES" : "STOPPED"
333
+ length: 10
334
+ cell: list.cell
335
+ color: list.client.connected ? Theme.idle : Theme.reminder
336
+ blinking: !list.client.connected
337
+ }
338
+ }
339
+ Text {
340
+ visible: list.rows.length === 0
341
+ text: list.client.connected ? "Start claude, codex, pi or omp in a terminal and it shows up here." : "Sessions aren't tracked while Topside is stopped."
342
+ color: "#8e94a6"
343
+ font.family: Theme.font
344
+ font.pixelSize: 12
345
+ wrapMode: Text.Wrap
346
+ Layout.fillWidth: true
347
+ Layout.topMargin: 4
348
+ }
349
+ KeyCap {
350
+ visible: !list.client.connected
351
+ label: "Start"
352
+ sub: "Topside"
353
+ go: true
354
+ Layout.alignment: Qt.AlignRight
355
+ onClicked: list.startRequested()
356
+ }
357
+
358
+ // "Sessions shown" cut the list: the rest are one key away.
359
+ RowLayout {
360
+ visible: list.moreCount > 0 || list.showingAll
361
+ Layout.fillWidth: true
362
+ Layout.topMargin: 4
363
+ FlapText { riffleSerial: list.riffleSerial;
364
+ text: list.showingAll ? "ALL SHOWN" : "+" + list.moreCount + " MORE"
365
+ length: 9
366
+ cell: Math.max(8, list.cell - 2)
367
+ color: "#9a9ca6"
368
+ Layout.fillWidth: true
369
+ }
370
+ KeyCap {
371
+ label: list.showingAll ? "Less" : "More"
372
+ onClicked: list.moreRequested(!list.showingAll)
373
+ }
374
+ }
375
+ }
376
+ }
377
+
378
+ QtObject {
379
+ id: lampBlink
380
+ property bool dim: false
381
+ }
382
+ Timer {
383
+ interval: 500
384
+ repeat: true
385
+ running: list.client.approvals.length + list.client.questions.length > 0
386
+ onTriggered: lampBlink.dim = !lampBlink.dim
387
+ }
388
+
389
+ BoardDetail {
390
+ id: detail
391
+ // What's left under the rail or the rows, less what sits below it.
392
+ maxHeight: list.maxHeight - y - (jumpErrorText.visible ? jumpErrorText.height + list.spacing : 0)
393
+ visible: list.selected !== null
394
+ client: list.client
395
+ session: list.selected
396
+ request: list.selectedRequest
397
+ shortcuts: list.shortcuts && list.selectedRequest !== null && list.selectedRequest.item === list.keyed
398
+ canHide: true
399
+ Layout.fillWidth: true
400
+ hideQuestion: list.hideRule ? Hiding.questionText(list.hideRule, "row") : ""
401
+ hideCount: list.hideRule ? list.hideRule.caught.length : 0
402
+ onHideFolder: list.askHide(true)
403
+ onHidePrompt: list.askHide(false)
404
+ onHideConfirmed: list.confirmHide()
405
+ onHideKept: list.hideAsk = null
406
+ onAnswered: word => list.flash(list.selectedId, word)
407
+ }
408
+
409
+ Text {
410
+ id: jumpErrorText
411
+ visible: list.client.jumpError !== ""
412
+ text: list.client.jumpError
413
+ color: Theme.reminder
414
+ font.family: Theme.font
415
+ font.pixelSize: 12
416
+ wrapMode: Text.Wrap
417
+ Layout.fillWidth: true
418
+ }
419
+ }
@@ -0,0 +1,189 @@
1
+ import QtQuick
2
+ import QtQuick.Layouts
3
+ import "board.js" as Board
4
+
5
+ // The departure board style's notification: a split-flap board that clacks
6
+ // into place with the session, its agent and a status word you can read
7
+ // across the room (WAITING, QUESTION, SECURITY, DELAYED, ARRIVED), the
8
+ // request on a second line, and up to two more waiting sessions under it.
9
+ // BoardDetail.qml hangs under it with the change and the keys.
10
+ ColumnLayout {
11
+ id: notice
12
+ required property var client
13
+ // What it shows: the first waiting request (Board.pending()), else the
14
+ // session whose turn just finished.
15
+ property var request: null
16
+ property var finishedSession: null
17
+ // The ones waiting behind it.
18
+ property var queue: []
19
+ // Its reminder is showing: DELAYED, blinking red.
20
+ property bool reminding: false
21
+ property bool shortcuts: false
22
+ property bool closable: false
23
+ // The most it may take: past that, the panel under the board scrolls
24
+ // inside and the board itself stays put.
25
+ property real maxHeight: 100000
26
+ // Bumped each time the board comes down again: every flap riffles.
27
+ property int riffleSerial: 0
28
+ signal closeRequested()
29
+ signal dismissed()
30
+
31
+ readonly property var session: request ? sessionFor(request.sessionId) : finishedSession
32
+ readonly property string word: Board.statusWord(session, request ? request.kind : "", reminding)
33
+ readonly property string message: !request ? (session ? session.lastPrompt || "Done" : "")
34
+ : request.kind === "question" ? (request.item.questions[0] ? request.item.questions[0].question : "Question")
35
+ : Board.requestLine(request.item)
36
+
37
+ function sessionFor(id) {
38
+ return client.sessions.find(s => s.id === id) || null;
39
+ }
40
+ function tone(word) {
41
+ return Theme[Board.statusTone(word)];
42
+ }
43
+ function clock(ms) {
44
+ return Qt.formatTime(new Date(ms), "hh:mm");
45
+ }
46
+ // For ⌃1…⌃9 on the host.
47
+ function pick(index, label) {
48
+ detail.pick(index, label);
49
+ }
50
+
51
+ property real now: Date.now()
52
+ Timer {
53
+ interval: 30000
54
+ repeat: true
55
+ running: true
56
+ onTriggered: notice.now = Date.now()
57
+ }
58
+
59
+ // The flaps keep the board's own size; a wider board only holds more of
60
+ // them: the session's name and the message line run to its edge.
61
+ readonly property real cell: Math.max(10, Math.min(19, Math.floor(width / 30)))
62
+ readonly property int pad: 13
63
+ readonly property int gap: 10
64
+ readonly property real step: cell + Math.max(1, Math.round(cell / 9))
65
+ readonly property int messageLength: Math.max(10, Math.floor((width - 2 * pad) / step))
66
+ // Time (5), the mark, status (8) and the gaps take the rest of the row.
67
+ readonly property int nameLength: Math.max(10, Math.floor((width - 2 * pad - 3 * gap - Math.round(cell * 1.1)) / step) - 13)
68
+ // The panel under the board keeps the usual type; only the flaps grow.
69
+ readonly property int textSize: 11
70
+
71
+ spacing: Math.round(notice.gap)
72
+
73
+ Rectangle {
74
+ id: face
75
+ Layout.fillWidth: true
76
+ implicitHeight: board.implicitHeight + 2 * notice.pad
77
+ radius: Math.round(notice.pad * 0.9)
78
+ border.color: "#2e3038"
79
+ gradient: Gradient {
80
+ GradientStop { position: 0; color: "#17181c" }
81
+ GradientStop { position: 1; color: "#0c0d10" }
82
+ }
83
+
84
+ ColumnLayout {
85
+ id: board
86
+ anchors.fill: parent
87
+ anchors.margins: notice.pad
88
+ spacing: Math.round(notice.cell / 3)
89
+
90
+ RowLayout {
91
+ Layout.fillWidth: true
92
+ Text {
93
+ text: "TOPSIDE" + (notice.queue.length > 0 ? " · 1 OF " + (notice.queue.length + 1) : "")
94
+ color: "#f5c84b"
95
+ font.family: Theme.monoFont
96
+ font.pixelSize: Math.max(10, Math.round(notice.cell * 0.45))
97
+ font.weight: Font.Bold
98
+ font.letterSpacing: 2.2
99
+ Layout.fillWidth: true
100
+ }
101
+ Text {
102
+ text: Qt.formatDateTime(new Date(notice.now), "ddd hh:mm").toUpperCase()
103
+ color: "#f5c84b"
104
+ font.family: Theme.monoFont
105
+ font.pixelSize: Math.max(10, Math.round(notice.cell * 0.45))
106
+ font.weight: Font.Bold
107
+ font.letterSpacing: 2.2
108
+ }
109
+ Text {
110
+ visible: notice.closable
111
+ text: "✕"
112
+ color: closeHover.hovered ? "#ffffff" : "#8e94a6"
113
+ font.pixelSize: Math.max(13, Math.round(notice.cell * 0.6))
114
+ Layout.leftMargin: 8
115
+ HoverHandler {
116
+ id: closeHover
117
+ cursorShape: Qt.PointingHandCursor
118
+ }
119
+ TapHandler {
120
+ onTapped: notice.closeRequested()
121
+ }
122
+ }
123
+ }
124
+
125
+ RowLayout {
126
+ spacing: notice.gap
127
+ FlapText { riffleSerial: notice.riffleSerial;
128
+ text: notice.clock(notice.request ? notice.request.createdAt : notice.now)
129
+ length: 5
130
+ cell: notice.cell
131
+ color: "#9a9ca6"
132
+ }
133
+ FlapText { riffleSerial: notice.riffleSerial;
134
+ text: Board.sessionName(notice.session)
135
+ length: notice.nameLength
136
+ cell: notice.cell
137
+ }
138
+ AgentIcon {
139
+ agent: notice.session ? notice.session.agent : "claude"
140
+ size: Math.round(notice.cell * 1.1)
141
+ }
142
+ FlapText { riffleSerial: notice.riffleSerial;
143
+ text: notice.word
144
+ length: 8
145
+ cell: notice.cell
146
+ color: notice.tone(notice.word)
147
+ blinking: notice.word === "DELAYED"
148
+ }
149
+ }
150
+
151
+ FlapText { riffleSerial: notice.riffleSerial;
152
+ text: notice.message
153
+ length: notice.messageLength
154
+ cell: notice.cell
155
+ }
156
+
157
+ // Who else waits: dimmer rows, oldest first.
158
+ Repeater {
159
+ // A count, so a new snapshot doesn't make the rows again.
160
+ model: Math.min(2, notice.queue.length)
161
+ delegate: RowLayout {
162
+ required property int index
163
+ readonly property var modelData: notice.queue[index] || ({})
164
+ readonly property var waiting: notice.sessionFor(modelData.sessionId)
165
+ readonly property string word: Board.statusWord(waiting, modelData.kind, false)
166
+ opacity: 0.5
167
+ spacing: notice.gap
168
+ FlapText { riffleSerial: notice.riffleSerial; text: notice.clock(modelData.createdAt); length: 5; cell: notice.cell; color: "#9a9ca6" }
169
+ FlapText { riffleSerial: notice.riffleSerial; text: Board.sessionName(parent.waiting); length: notice.nameLength; cell: notice.cell }
170
+ AgentIcon { agent: parent.waiting ? parent.waiting.agent : "claude"; size: Math.round(notice.cell * 1.1) }
171
+ FlapText { riffleSerial: notice.riffleSerial; text: parent.word; length: 8; cell: notice.cell; color: notice.tone(parent.word) }
172
+ }
173
+ }
174
+ }
175
+ }
176
+
177
+ BoardDetail {
178
+ id: detail
179
+ client: notice.client
180
+ session: notice.session
181
+ request: notice.request
182
+ finished: notice.request === null
183
+ shortcuts: notice.shortcuts
184
+ size: notice.textSize
185
+ maxHeight: notice.maxHeight - face.implicitHeight - notice.spacing
186
+ Layout.fillWidth: true
187
+ onDismissed: notice.dismissed()
188
+ }
189
+ }
@@ -0,0 +1,55 @@
1
+ import QtQuick
2
+
3
+ // One answer on a card, as Topside's CardButton: "dark" (a raised grey),
4
+ // "light" (near the text color, for the main answer) or "danger" (crimson).
5
+ Rectangle {
6
+ id: button
7
+ property string label
8
+ property string style: "dark"
9
+ // Its key, shown dimmed after the label, e.g. "⌃Y".
10
+ property string shortcut: ""
11
+ signal clicked()
12
+
13
+ readonly property real lift: hover.hovered ? 0.06 : 0
14
+
15
+ implicitWidth: content.implicitWidth + 28
16
+ implicitHeight: 30
17
+ radius: Theme.buttonRadius
18
+ color: style === "light" ? Theme.level(0.88 - lift)
19
+ : style === "danger" ? Qt.rgba(Theme.crimson.r, Theme.crimson.g, Theme.crimson.b, 1 - lift * 2)
20
+ : Theme.level(0.14 + lift)
21
+
22
+ Behavior on color { ColorAnimation { duration: 120 } }
23
+
24
+ Row {
25
+ id: content
26
+ anchors.centerIn: parent
27
+ spacing: 6
28
+ Text {
29
+ font.family: Theme.font
30
+ text: button.label
31
+ color: button.style === "light" ? Theme.bg : button.style === "danger" ? "white" : Theme.fg
32
+ font.pixelSize: Theme.s(13)
33
+ font.weight: Font.DemiBold
34
+ anchors.verticalCenter: parent.verticalCenter
35
+ }
36
+ Text {
37
+ font.family: Theme.font
38
+ visible: button.shortcut !== ""
39
+ text: button.shortcut
40
+ color: button.style === "light" ? Theme.bg : button.style === "danger" ? "white" : Theme.fg
41
+ opacity: 0.45
42
+ font.pixelSize: Theme.s(11)
43
+ font.weight: Font.Medium
44
+ anchors.verticalCenter: parent.verticalCenter
45
+ }
46
+ }
47
+
48
+ HoverHandler {
49
+ id: hover
50
+ cursorShape: Qt.PointingHandCursor
51
+ }
52
+ TapHandler {
53
+ onTapped: button.clicked()
54
+ }
55
+ }