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
package/shell/pill.qml ADDED
@@ -0,0 +1,279 @@
1
+ import QtQuick
2
+ import QtQuick.Layouts
3
+ import Quickshell
4
+ import Quickshell.Io
5
+ import "core"
6
+
7
+ // Standalone pill for Hyprland without DMS. Position and look come from
8
+ // ~/.config/topside/config.json ("pill": {"position": "top-center"}, "theme",
9
+ // "appearance", "fontSize") and follow the file live. exclusiveZone 0 keeps it out of the bar's way.
10
+ ShellRoot {
11
+ id: root
12
+
13
+ property string position: "top-center"
14
+ property bool open: false
15
+ // A completion card: the session whose turn just ended, shown alone for
16
+ // 5 s, longer while the pointer rests on it. "" for none.
17
+ property string finishedId: ""
18
+ readonly property var finishedSession: finishedId === "" ? null : client.sessions.find(s => s.id === finishedId) || null
19
+ readonly property bool showCompletion: open && finishedSession !== null && finishedSession.status === "done"
20
+ && client.approvals.length + client.questions.length === 0
21
+
22
+ onOpenChanged: if (!open) finishedId = ""
23
+
24
+ Timer {
25
+ id: cardTimer
26
+ interval: 5000
27
+ onTriggered: {
28
+ if (cardHover.hovered) {
29
+ restart();
30
+ return;
31
+ }
32
+ if (root.showCompletion) root.open = false;
33
+ root.finishedId = "";
34
+ }
35
+ }
36
+
37
+ function configPath() {
38
+ const explicit = Quickshell.env("TOPSIDE_CONFIG");
39
+ if (explicit) return explicit;
40
+ const xdg = Quickshell.env("XDG_CONFIG_HOME");
41
+ return (xdg ? xdg : Quickshell.env("HOME") + "/.config") + "/topside/config.json";
42
+ }
43
+
44
+ // `topside pill position|theme|mode|text-size` write the file; it already
45
+ // holds checked values, and the theme reads an unknown name as Topside Black.
46
+ function applyConfig(text) {
47
+ try {
48
+ const parsed = JSON.parse(text);
49
+ const value = parsed && parsed.pill && parsed.pill.position;
50
+ if (typeof value === "string" && value.indexOf("-") > 0) root.position = value;
51
+ Theme.name = typeof parsed.theme === "string" ? parsed.theme : "topsideBlack";
52
+ Theme.mode = ["light", "dark", "system"].indexOf(parsed.appearance) >= 0 ? parsed.appearance : "dark";
53
+ Theme.content = Number.isInteger(parsed.fontSize) && parsed.fontSize >= 10 && parsed.fontSize <= 14 ? parsed.fontSize : 11;
54
+ } catch (e) {
55
+ // Broken file: keep what's there.
56
+ }
57
+ }
58
+
59
+ // "System" follows the desktop's color-scheme setting (the one the
60
+ // freedesktop portal reports), live.
61
+ Process {
62
+ command: ["sh", "-c", "gsettings get org.gnome.desktop.interface color-scheme; exec gsettings monitor org.gnome.desktop.interface color-scheme"]
63
+ running: true
64
+ stdout: SplitParser {
65
+ onRead: line => Theme.systemDark = line.indexOf("prefer-dark") >= 0
66
+ }
67
+ }
68
+
69
+ function sessionFor(sessionId) {
70
+ return client.sessions.find(s => s.id === sessionId) || null;
71
+ }
72
+
73
+ TopsideClient {
74
+ id: client
75
+ onRequested: root.open = true
76
+ onJumped: root.open = false
77
+ // A pending request wins over a completion card; an open list isn't taken over.
78
+ onFinished: session => {
79
+ if (root.open || approvals.length + questions.length > 0) return;
80
+ root.finishedId = session.id;
81
+ root.open = true;
82
+ cardTimer.restart();
83
+ }
84
+ }
85
+
86
+ FileView {
87
+ path: root.configPath()
88
+ watchChanges: true
89
+ printErrors: false
90
+ onLoaded: root.applyConfig(text())
91
+ onFileChanged: reload()
92
+ }
93
+
94
+ PanelWindow {
95
+ id: win
96
+ readonly property string vertical: root.position.split("-")[0]
97
+ readonly property string horizontal: root.position.split("-")[1]
98
+
99
+ anchors.top: vertical === "top"
100
+ anchors.bottom: vertical === "bottom"
101
+ anchors.left: horizontal === "left"
102
+ anchors.right: horizontal === "right"
103
+ margins.top: 8
104
+ margins.bottom: 8
105
+ margins.left: 8
106
+ margins.right: 8
107
+ exclusiveZone: 0
108
+ color: "transparent"
109
+ implicitWidth: body.implicitWidth
110
+ implicitHeight: body.implicitHeight
111
+
112
+ Rectangle {
113
+ id: body
114
+ radius: Theme.radius
115
+ color: Theme.bg
116
+ implicitWidth: Math.max(240, column.implicitWidth + Theme.pad * 2)
117
+ implicitHeight: column.implicitHeight + Theme.pad * 2
118
+
119
+ ColumnLayout {
120
+ id: column
121
+ x: Theme.pad
122
+ y: Theme.pad
123
+ width: Math.max(220, implicitWidth)
124
+ spacing: 6
125
+
126
+ // Collapsed header: one dot per session, a short summary, click to open.
127
+ RowLayout {
128
+ id: header
129
+ spacing: 8
130
+ Layout.fillWidth: true
131
+
132
+ AppLogo {
133
+ cell: 1.5
134
+ color: Theme.fgDim
135
+ Layout.alignment: Qt.AlignVCenter
136
+ }
137
+
138
+ Row {
139
+ spacing: 4
140
+ Repeater {
141
+ model: client.sessions.slice(0, 5)
142
+ delegate: Rectangle {
143
+ required property var modelData
144
+ width: 8
145
+ height: 8
146
+ radius: 4
147
+ color: Theme.statusColor(modelData.status)
148
+ }
149
+ }
150
+ Rectangle {
151
+ visible: !client.connected
152
+ width: 8
153
+ height: 8
154
+ radius: 4
155
+ color: Theme.offline
156
+ }
157
+ }
158
+
159
+ Text {
160
+ Layout.fillWidth: true
161
+ text: !client.connected ? "daemon offline"
162
+ : client.approvals.length + client.questions.length > 0 ? (client.approvals.length + client.questions.length) + " waiting for you"
163
+ : client.sessions.length === 0 ? "no sessions"
164
+ : client.sessions.length + (client.sessions.length === 1 ? " session" : " sessions")
165
+ color: client.approvals.length + client.questions.length > 0 ? Theme.waiting : Theme.fg
166
+ font.pixelSize: Theme.title
167
+ elide: Text.ElideRight
168
+ }
169
+
170
+ UsageLine {
171
+ id: usageLine
172
+ // The newest session's agent: each agent has its own plan.
173
+ agent: client.sessions.length > 0 ? client.sessions[0].agent : "claude"
174
+ usage: client.usage[agent] || null
175
+ spend: client.sessions.length > 0 ? (client.spend[client.sessions[0].id] || null) : null
176
+ visible: root.open && client.approvals.length + client.questions.length === 0 && !empty
177
+ Layout.alignment: Qt.AlignVCenter
178
+ }
179
+
180
+ Text {
181
+ text: root.open ? "▴" : "▾"
182
+ color: Theme.fgDim
183
+ font.pixelSize: Theme.s(12)
184
+ }
185
+
186
+ // Quit, as the Mac's power button: closes the pill. The daemon keeps
187
+ // running for the DMS widget or the next `topside pill`.
188
+ Text {
189
+ text: "⏻"
190
+ color: quitHover.hovered ? Theme.fg : Theme.fgDim
191
+ font.pixelSize: Theme.s(13)
192
+ HoverHandler {
193
+ id: quitHover
194
+ cursorShape: Qt.PointingHandCursor
195
+ }
196
+ TapHandler {
197
+ onTapped: Qt.quit()
198
+ }
199
+ }
200
+
201
+ TapHandler {
202
+ onTapped: root.open = !root.open
203
+ }
204
+ }
205
+
206
+ Rectangle {
207
+ visible: root.open
208
+ Layout.fillWidth: true
209
+ height: 1
210
+ color: Theme.bgRaised
211
+ }
212
+
213
+ Loader {
214
+ active: root.showCompletion
215
+ visible: active
216
+ Layout.fillWidth: true
217
+ Layout.preferredWidth: 420
218
+ sourceComponent: CompletionCard {
219
+ session: root.finishedSession
220
+ onJump: client.jump(root.finishedId)
221
+ }
222
+ HoverHandler {
223
+ id: cardHover
224
+ }
225
+ }
226
+
227
+ Repeater {
228
+ model: root.open ? client.questions : []
229
+ delegate: QuestionRow {
230
+ required property var modelData
231
+ question: modelData
232
+ session: root.sessionFor(modelData.sessionId)
233
+ Layout.fillWidth: true
234
+ onAnswered: answers => client.answer(modelData.id, answers)
235
+ onOpenTerminal: client.jump(modelData.sessionId)
236
+ }
237
+ }
238
+
239
+ Repeater {
240
+ model: root.open ? client.approvals : []
241
+ delegate: ApprovalRow {
242
+ required property var modelData
243
+ approval: modelData
244
+ session: root.sessionFor(modelData.sessionId)
245
+ Layout.fillWidth: true
246
+ onDecided: decision => client.decide(modelData.id, decision)
247
+ onJump: client.jump(modelData.sessionId)
248
+ }
249
+ }
250
+
251
+ Repeater {
252
+ model: root.open && !root.showCompletion ? client.sessions : []
253
+ delegate: SessionRow {
254
+ required property var modelData
255
+ session: modelData
256
+ Layout.fillWidth: true
257
+ onActivated: client.jump(modelData.id)
258
+ }
259
+ }
260
+
261
+ Text {
262
+ visible: root.open && client.jumpError !== ""
263
+ text: client.jumpError
264
+ color: Theme.deny
265
+ font.pixelSize: Theme.content
266
+ wrapMode: Text.Wrap
267
+ Layout.fillWidth: true
268
+ }
269
+
270
+ Text {
271
+ visible: root.open && client.sessions.length === 0
272
+ text: client.connected ? "Start claude, codex, pi or omp in a terminal." : "Run: systemctl --user start topside"
273
+ color: Theme.fgDim
274
+ font.pixelSize: Theme.content
275
+ }
276
+ }
277
+ }
278
+ }
279
+ }
@@ -0,0 +1,150 @@
1
+ import QtQuick
2
+ import "core" as Topside
3
+ import "core/ticket.js" as Ticket
4
+
5
+ // Topside's entry in SekaiPop's bar, the DMS widget's pill: the newest
6
+ // session's mascot, then one dot per session and the number waiting. With
7
+ // no session, Topside's sign, the three status dots (red while offline).
8
+ // The shell draws the pill around it and opens Popup.qml on a left click.
9
+ Item {
10
+ id: root
11
+ required property var host
12
+ readonly property var service: host.service
13
+ readonly property var client: service ? service.client : null
14
+ readonly property bool connected: client !== null && client.connected
15
+ readonly property var sessions: client ? client.sessions : []
16
+ readonly property real unit: 16
17
+ // On a lying bar, Style: Board shows flaps and Style: Ticket a little
18
+ // receipt printer, in place of the mascot and dots.
19
+ readonly property bool flaps: service !== null && service.style === "board" && !host.bar.vertical
20
+ readonly property bool printer: service !== null && service.style === "kitchen" && !host.bar.vertical
21
+ readonly property bool own: flaps || printer
22
+
23
+ // No tooltip: the entry already says it (flaps, printer, dots), and one
24
+ // popping up on every pass of the pointer got in the way.
25
+ property string tip: ""
26
+
27
+ implicitWidth: grid.implicitWidth
28
+ implicitHeight: grid.implicitHeight
29
+
30
+ // "System" follows the shell's light or dark mode.
31
+ Binding { target: Topside.Theme; property: "systemDark"; value: root.host.theme.dark }
32
+
33
+ // Match SekaiPop: the shell's look on every card.
34
+ ShellLook { theme: root.host.theme; on: root.service !== null && root.service.matchShell }
35
+
36
+ // Where this monitor's entry is, for the card that opens by itself
37
+ // (Floating.qml), and the shell's icon font, which the service lacks.
38
+ Binding { target: root.service; property: "iconFont"; value: root.host.theme.iconFont; when: root.service !== null }
39
+ function register() {
40
+ if (root.service && root.host.screenName !== "") root.service.registerEntry(root.host.screenName, root, root.host.bar.edge);
41
+ }
42
+ Component.onCompleted: register()
43
+ Connections {
44
+ target: root.host
45
+ function onScreenNameChanged() { root.register(); }
46
+ }
47
+ Connections {
48
+ target: root.host.bar
49
+ function onEdgeChanged() { root.register(); }
50
+ }
51
+ onServiceChanged: register()
52
+ Component.onDestruction: if (root.service) root.service.unregisterEntry(root.host.screenName, root)
53
+
54
+ Grid {
55
+ id: grid
56
+ columns: root.host.bar.vertical ? 1 : 99
57
+ spacing: 4
58
+ horizontalItemAlignment: Grid.AlignHCenter
59
+ verticalItemAlignment: Grid.AlignVCenter
60
+
61
+ // Style: Board. A tiny flap display: how many wait, else how many run.
62
+ Topside.FlapText {
63
+ visible: root.flaps
64
+ text: !root.connected ? "OFF" : root.service && root.service.waitingCount > 0 ? root.service.waitingCount + " WAIT" : root.sessions.length + " RUN"
65
+ length: 6
66
+ cell: 11
67
+ color: !root.connected ? Topside.Theme.reminder : root.service && root.service.waitingCount > 0 ? Topside.Theme.waiting : "#f3efe2"
68
+ }
69
+
70
+ // Style: Ticket. A receipt printer: its light (amber while something
71
+ // waits, red offline), the paper slot, and what it says.
72
+ Row {
73
+ visible: root.printer
74
+ spacing: 6
75
+ Rectangle {
76
+ anchors.verticalCenter: parent.verticalCenter
77
+ width: 7
78
+ height: 7
79
+ radius: 4
80
+ color: !root.connected ? Topside.Theme.reminder : root.service && root.service.waitingCount > 0 ? Topside.Theme.waiting : Topside.Theme.done
81
+ opacity: root.service && root.service.waitingCount > 0 && printerBlink.dim ? 0.3 : 1
82
+ }
83
+ Rectangle {
84
+ anchors.verticalCenter: parent.verticalCenter
85
+ width: 26
86
+ height: 4
87
+ radius: 2
88
+ color: "#000000"
89
+ border.color: "#44464e"
90
+ }
91
+ Text {
92
+ anchors.verticalCenter: parent.verticalCenter
93
+ text: root.service ? Ticket.printerLine(root.connected, root.sessions, root.service.waitingCount) : ""
94
+ color: !root.connected ? Topside.Theme.reminder : root.service && root.service.waitingCount > 0 ? Topside.Theme.waiting : root.host.theme.ink ?? "#e8e4d8"
95
+ font.family: Topside.Theme.monoFont
96
+ font.pixelSize: 11
97
+ font.weight: Font.Bold
98
+ font.letterSpacing: 1
99
+ }
100
+ }
101
+
102
+ Topside.MascotBadge {
103
+ // A reminder shows its own session's mascot, red, with a blinking "!".
104
+ readonly property string reminding: root.service ? root.service.remindingSession : ""
105
+ readonly property var shown: reminding !== "" ? root.service.sessionFor(reminding) : root.sessions[0]
106
+ visible: !root.own && root.connected && root.sessions.length > 0
107
+ agent: visible && shown ? shown.agent : "claude"
108
+ status: !visible || !shown ? "idle" : reminding !== "" ? "reminder" : shown.status
109
+ cell: root.unit / 6
110
+ }
111
+
112
+ Topside.StatusDots {
113
+ visible: !root.own && (!root.connected || root.sessions.length === 0)
114
+ offline: !root.connected
115
+ size: Math.round(root.unit * 0.32)
116
+ }
117
+
118
+ Repeater {
119
+ model: root.service && !root.own ? root.sessions.slice(0, root.service.maxDots) : []
120
+ delegate: Rectangle {
121
+ required property var modelData
122
+ width: Math.round(root.unit * 0.4)
123
+ height: width
124
+ radius: width / 2
125
+ color: Topside.Theme.statusColor(modelData.status)
126
+ }
127
+ }
128
+
129
+ Text {
130
+ visible: !root.own && root.service !== null && root.service.waitingCount > 0
131
+ text: root.service ? root.service.waitingCount : ""
132
+ color: Topside.Theme.waiting
133
+ font.family: root.host.theme.fontFamily
134
+ font.pixelSize: 13
135
+ font.bold: true
136
+ }
137
+ }
138
+
139
+ QtObject {
140
+ id: printerBlink
141
+ property bool dim: false
142
+ }
143
+ Timer {
144
+ interval: 600
145
+ repeat: true
146
+ running: root.printer && root.service !== null && root.service.waitingCount > 0
147
+ onTriggered: printerBlink.dim = !printerBlink.dim
148
+ onRunningChanged: if (!running) printerBlink.dim = false
149
+ }
150
+ }