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,336 @@
1
+ import QtQuick
2
+ import QtQuick.Layouts
3
+ import "agents.js" as Agents
4
+ import "board.js" as Board
5
+
6
+ // The panel under the departure board: what the board's row can't say. For
7
+ // a waiting request, the change or the command and its keys; for a question,
8
+ // one key per option; for a finished turn, your prompt and the reply; for
9
+ // any other session, your last prompt, what it does now, Jump and Hide.
10
+ // It answers through the client itself; hiding and dismissing are the
11
+ // host's, so they go out as signals. Hiding asks first: with `hideQuestion`
12
+ // set, the question and HIDE N / KEEP take the keys' place (VIA-PARITY §29).
13
+ Rectangle {
14
+ id: panel
15
+ required property var client
16
+ property var session: null
17
+ // A waiting request of the session, as Board.pending() gives it, or null.
18
+ property var request: null
19
+ // A finished turn's card: prompt and reply, with Clear and Jump.
20
+ property bool finished: false
21
+ // Show ⌃Y, ⌃N… under the keys: only where they work.
22
+ property bool shortcuts: false
23
+ property bool canHide: false
24
+ // The text size; keys and lines grow with it (the notice is bigger than the list).
25
+ property int size: 11
26
+ // Taller than this, the text scrolls inside and the keys stay in view.
27
+ property real maxHeight: 100000
28
+ signal dismissed()
29
+ // An answer went out: its word for the board to flip to (ALLOWED, DENIED…).
30
+ signal answered(string word)
31
+ signal hideFolder()
32
+ signal hidePrompt()
33
+ // An open hide question: its text ("Hide 2 rows in web-app, …?") and count.
34
+ property string hideQuestion: ""
35
+ property int hideCount: 0
36
+ readonly property bool asking: hideQuestion !== ""
37
+ signal hideConfirmed()
38
+ signal hideKept()
39
+
40
+ readonly property var approval: request && request.kind === "approval" ? request.item : null
41
+ readonly property var question: request && request.kind === "question" ? request.item : null
42
+ readonly property string agent: session ? session.agent : "claude"
43
+ readonly property var lines: approval ? ((approval.preview || []).length > 0 ? approval.preview
44
+ : [{ kind: "context", text: String(approval.summary || "").replace(approval.toolName + ": ", "") }]) : []
45
+ readonly property int added: lines.filter(l => l.kind === "add").length
46
+ readonly property int removed: lines.filter(l => l.kind === "remove").length
47
+
48
+ // The risk gate blocks a pi or omp request by itself after 25 s.
49
+ property real now: Date.now()
50
+ Timer {
51
+ interval: 1000
52
+ repeat: true
53
+ running: panel.approval !== null && Board.gated(panel.agent)
54
+ onTriggered: panel.now = Date.now()
55
+ }
56
+
57
+ readonly property color ink: "#d6dae4"
58
+ readonly property color dim: "#8e94a6"
59
+
60
+ color: "#121318"
61
+ border.color: "#2e3038"
62
+ radius: 12
63
+ implicitHeight: body.implicitHeight + 2 * body.anchors.margins
64
+
65
+ component Line: Text {
66
+ color: panel.ink
67
+ font.family: Theme.monoFont
68
+ font.pixelSize: panel.size
69
+ wrapMode: Text.Wrap
70
+ Layout.fillWidth: true
71
+ }
72
+ // Hiding is a side door, not an answer: quiet text, never a key.
73
+ component QuietLink: Text {
74
+ id: link
75
+ signal clicked()
76
+ color: linkHover.hovered ? panel.ink : panel.dim
77
+ font.family: Theme.monoFont
78
+ font.pixelSize: Math.max(10, panel.size - 2)
79
+ font.underline: linkHover.hovered
80
+ HoverHandler {
81
+ id: linkHover
82
+ cursorShape: Qt.PointingHandCursor
83
+ }
84
+ TapHandler {
85
+ onTapped: link.clicked()
86
+ }
87
+ }
88
+
89
+ ColumnLayout {
90
+ id: body
91
+ anchors.fill: parent
92
+ anchors.margins: Math.round(panel.size * 1.1)
93
+ spacing: Math.round(panel.size / 2)
94
+
95
+ // What it says scrolls on its own when it's long; the keys stay put.
96
+ Flickable {
97
+ id: scroller
98
+ Layout.fillWidth: true
99
+ Layout.preferredHeight: Math.min(info.implicitHeight, Math.max(60, panel.maxHeight - (panel.asking ? askBox.implicitHeight : keyRow.implicitHeight) - 2 * body.anchors.margins - body.spacing))
100
+ contentHeight: info.implicitHeight
101
+ clip: true
102
+ boundsBehavior: Flickable.StopAtBounds
103
+ interactive: contentHeight > height
104
+ ColumnLayout {
105
+ id: info
106
+ width: scroller.width
107
+ spacing: body.spacing
108
+
109
+ Line {
110
+ text: panel.session ? Board.sessionName(panel.session) + " · " + Agents.style(panel.agent).name + " · " + String(panel.session.cwd || "").replace(/^\/home\/[^/]+/, "~") : ""
111
+ color: panel.dim
112
+ elide: Text.ElideRight
113
+ wrapMode: Text.NoWrap
114
+ }
115
+
116
+ // A request: what it wants to do.
117
+ Line {
118
+ visible: panel.approval !== null
119
+ text: panel.approval ? "⚠ Allow " + panel.approval.toolName + (panel.approval.file ? " · " + panel.approval.file : "")
120
+ + (panel.added + panel.removed > 0 ? " +" + panel.added + " −" + panel.removed : "") : ""
121
+ color: Theme.waiting
122
+ font.weight: Font.Bold
123
+ }
124
+ Repeater {
125
+ model: panel.lines
126
+ delegate: Line {
127
+ required property var modelData
128
+ text: (modelData.kind === "add" ? "+ " : modelData.kind === "remove" ? "− " : modelData.kind === "more" ? "" : " ") + modelData.text
129
+ color: modelData.kind === "add" ? "#7fd093" : modelData.kind === "remove" ? "#f08a8a" : modelData.kind === "more" ? panel.dim : panel.ink
130
+ wrapMode: Text.NoWrap
131
+ elide: Text.ElideRight
132
+ }
133
+ }
134
+ Line {
135
+ visible: panel.approval !== null && Board.gated(panel.agent)
136
+ text: panel.approval ? "Risky command. Blocked by itself in " + Board.gateLeft(panel.approval, panel.now) + " s." : ""
137
+ color: Theme.reminder
138
+ }
139
+
140
+ // A question: what Claude asks. Several questions or several choices
141
+ // take the full question card.
142
+ Line {
143
+ visible: panel.question !== null && Board.instant(panel.question)
144
+ text: panel.question && panel.question.questions[0] ? panel.question.questions[0].question : ""
145
+ color: Theme.ask
146
+ font.weight: Font.Bold
147
+ }
148
+ Loader {
149
+ id: fullQuestion
150
+ active: panel.question !== null && !Board.instant(panel.question)
151
+ visible: active
152
+ Layout.fillWidth: true
153
+ sourceComponent: QuestionRow {
154
+ question: panel.question
155
+ session: panel.session
156
+ onAnswered: answers => panel.client.answer(panel.question.id, answers)
157
+ onOpenTerminal: panel.client.jump(panel.question.sessionId)
158
+ }
159
+ }
160
+
161
+ // A finished turn, or any other session: your prompt, then the reply or what it does.
162
+ Line {
163
+ visible: panel.request === null && panel.session !== null && (panel.session.lastPrompt || "") !== ""
164
+ text: panel.session ? "You: " + panel.session.lastPrompt : ""
165
+ }
166
+ Text {
167
+ // The agent's last reply, for a finished turn and for any session
168
+ // picked on the list: what it said is what you came to see. The
169
+ // notice keeps it short; the list's panel scrolls instead.
170
+ visible: panel.request === null && panel.session !== null && (panel.session.lastMessage || "") !== ""
171
+ text: panel.session ? panel.session.lastMessage || "" : ""
172
+ textFormat: Text.MarkdownText
173
+ color: "#c9cede"
174
+ font.family: Theme.font
175
+ font.pixelSize: panel.size + 1
176
+ wrapMode: Text.Wrap
177
+ maximumLineCount: panel.finished ? 6 : 60
178
+ elide: Text.ElideRight
179
+ Layout.fillWidth: true
180
+ }
181
+ Line {
182
+ visible: panel.request === null && !panel.finished && panel.session !== null
183
+ text: panel.session ? "Now: " + Board.nowLine(panel.session) : ""
184
+ color: panel.dim
185
+ }
186
+
187
+ }
188
+ }
189
+
190
+ RowLayout {
191
+ id: keyRow
192
+ visible: !panel.asking
193
+ // Every key as wide as the widest one shown, so they read as one set.
194
+ readonly property real keyWidth: {
195
+ let w = 0;
196
+ for (const child of children)
197
+ if (child.isKey && child.visible) w = Math.max(w, child.implicitWidth);
198
+ return w;
199
+ }
200
+ spacing: 8
201
+ Layout.topMargin: 4
202
+ Layout.fillWidth: true
203
+
204
+ // Any other session: hiding, quietly, on the left.
205
+ QuietLink {
206
+ visible: panel.request === null && !panel.finished && panel.canHide
207
+ text: "hide this folder"
208
+ onClicked: panel.hideFolder()
209
+ }
210
+ QuietLink {
211
+ visible: panel.request === null && !panel.finished && panel.canHide && (panel.session ? panel.session.title || "" : "") !== ""
212
+ text: "· hide prompts like it"
213
+ onClicked: panel.hidePrompt()
214
+ }
215
+ Item { Layout.fillWidth: true }
216
+
217
+ // A request.
218
+ KeyCap {
219
+ size: panel.size
220
+ Layout.preferredWidth: keyRow.keyWidth
221
+ visible: panel.approval !== null
222
+ label: Board.gated(panel.agent) ? "Block" : "Deny"
223
+ sub: panel.shortcuts ? "⌃N" : ""
224
+ onClicked: panel.decide("deny", "DENIED")
225
+ }
226
+ KeyCap {
227
+ size: panel.size
228
+ Layout.preferredWidth: keyRow.keyWidth
229
+ visible: panel.approval !== null && (panel.approval.always || "") !== ""
230
+ label: "Always"
231
+ sub: panel.shortcuts ? "⌃A" : "this session"
232
+ onClicked: panel.decide("always", "ALWAYS")
233
+ }
234
+ KeyCap {
235
+ size: panel.size
236
+ Layout.preferredWidth: keyRow.keyWidth
237
+ visible: panel.approval !== null && panel.agent === "claude"
238
+ label: "Auto"
239
+ sub: "mode"
240
+ onClicked: panel.decide("auto", "AUTO")
241
+ }
242
+ KeyCap {
243
+ size: panel.size
244
+ Layout.preferredWidth: keyRow.keyWidth
245
+ visible: panel.approval !== null
246
+ label: Board.gated(panel.agent) ? "Run it" : "Allow"
247
+ sub: panel.shortcuts ? "⌃Y" : ""
248
+ go: true
249
+ onClicked: panel.decide("allow", "ALLOWED")
250
+ }
251
+
252
+ // A question with one click per option.
253
+ Repeater {
254
+ model: panel.question !== null && Board.instant(panel.question) ? panel.question.questions[0].options : []
255
+ delegate: KeyCap {
256
+ size: panel.size
257
+ Layout.preferredWidth: keyRow.keyWidth
258
+ required property var modelData
259
+ required property int index
260
+ label: modelData.label
261
+ sub: panel.shortcuts ? "⌃" + (index + 1) : "gate " + (index + 1)
262
+ go: index === 0
263
+ onClicked: panel.pick(0, modelData.label)
264
+ }
265
+ }
266
+
267
+ // A finished turn, or any session.
268
+ KeyCap {
269
+ size: panel.size
270
+ Layout.preferredWidth: keyRow.keyWidth
271
+ visible: panel.finished
272
+ label: "Got it"
273
+ onClicked: panel.dismissed()
274
+ }
275
+ KeyCap {
276
+ size: panel.size
277
+ Layout.preferredWidth: keyRow.keyWidth
278
+ visible: panel.request === null && panel.session !== null
279
+ label: "Jump"
280
+ sub: panel.shortcuts ? "⌃J" : "to terminal"
281
+ go: true
282
+ onClicked: panel.client.jump(panel.session.id)
283
+ }
284
+ }
285
+
286
+ // The hide question, in place of the links and keys.
287
+ ColumnLayout {
288
+ id: askBox
289
+ visible: panel.asking
290
+ spacing: 8
291
+ Layout.topMargin: 4
292
+ Layout.fillWidth: true
293
+ Text {
294
+ text: panel.hideQuestion
295
+ color: Theme.reminder
296
+ font.family: Theme.monoFont
297
+ font.pixelSize: panel.size + 1
298
+ wrapMode: Text.Wrap
299
+ Layout.fillWidth: true
300
+ }
301
+ RowLayout {
302
+ spacing: 8
303
+ Item { Layout.fillWidth: true }
304
+ KeyCap {
305
+ size: panel.size
306
+ label: "Keep"
307
+ onClicked: panel.hideKept()
308
+ }
309
+ KeyCap {
310
+ size: panel.size
311
+ label: "Hide " + panel.hideCount
312
+ go: true
313
+ onClicked: panel.hideConfirmed()
314
+ }
315
+ }
316
+ }
317
+ }
318
+
319
+ function decide(decision, word) {
320
+ panel.client.decide(panel.approval.id, decision);
321
+ panel.answered(Board.gated(panel.agent) && decision === "deny" ? "BLOCKED" : word);
322
+ }
323
+
324
+ // ⌃1…⌃9, and a click on an option: one question, one choice, answered at once.
325
+ function pick(index, label) {
326
+ if (!panel.question) return;
327
+ if (!Board.instant(panel.question)) {
328
+ if (fullQuestion.item) fullQuestion.item.pick(index, label);
329
+ return;
330
+ }
331
+ const answers = {};
332
+ answers[panel.question.questions[index].question] = label;
333
+ panel.client.answer(panel.question.id, answers);
334
+ panel.answered("ANSWERED");
335
+ }
336
+ }