topside-arch 0.0.0-stage → 0.1.1

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 (92) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +213 -2
  3. package/contrib/aur/PKGBUILD +35 -0
  4. package/contrib/aur/topside-arch.install +25 -0
  5. package/contrib/icons/hicolor/scalable/apps/topside.svg +28 -0
  6. package/contrib/systemd/topside.service +10 -0
  7. package/contrib/themes/sakura.json +31 -0
  8. package/dist/adapters/claude/attach.js +92 -0
  9. package/dist/adapters/claude/hook-event.js +173 -0
  10. package/dist/adapters/claude/one-shot.js +30 -0
  11. package/dist/adapters/claude/settings.js +78 -0
  12. package/dist/adapters/claude/usage.js +76 -0
  13. package/dist/adapters/codex/codex.js +73 -0
  14. package/dist/adapters/codex/patch.js +39 -0
  15. package/dist/adapters/codex/usage.js +77 -0
  16. package/dist/adapters/pi/extension.js +271 -0
  17. package/dist/adapters/pi/risk-gate.js +256 -0
  18. package/dist/cli/commands.js +563 -0
  19. package/dist/cli/hook-log.js +32 -0
  20. package/dist/cli/main.js +100 -0
  21. package/dist/daemon/preview.js +70 -0
  22. package/dist/daemon/processes.js +105 -0
  23. package/dist/daemon/server.js +437 -0
  24. package/dist/daemon/session-state.js +173 -0
  25. package/dist/daemon/store.js +176 -0
  26. package/dist/dms/setup.js +126 -0
  27. package/dist/hosts/hosts.js +39 -0
  28. package/dist/jump/jump.js +199 -0
  29. package/dist/pill/config.js +92 -0
  30. package/dist/pill/launch.js +38 -0
  31. package/dist/sekaipop/setup.js +210 -0
  32. package/dist/shared/ancestry.js +27 -0
  33. package/dist/shared/client.js +29 -0
  34. package/dist/shared/package.js +25 -0
  35. package/dist/shared/paths.js +69 -0
  36. package/dist/shared/protocol.js +35 -0
  37. package/dist/shared/qml-lib.js +32 -0
  38. package/dist/shared/result.js +6 -0
  39. package/dist/shared/terminal.js +42 -0
  40. package/dist/themes/themes.js +84 -0
  41. package/package.json +49 -4
  42. package/shell/core/AgentIcon.qml +24 -0
  43. package/shell/core/AppLogo.qml +48 -0
  44. package/shell/core/ApprovalRow.qml +197 -0
  45. package/shell/core/BoardDetail.qml +296 -0
  46. package/shell/core/BoardList.qml +433 -0
  47. package/shell/core/BoardNotice.qml +187 -0
  48. package/shell/core/CardButton.qml +55 -0
  49. package/shell/core/CardHeader.qml +46 -0
  50. package/shell/core/ChalkBoard.qml +99 -0
  51. package/shell/core/CompletionCard.qml +106 -0
  52. package/shell/core/FlapText.qml +95 -0
  53. package/shell/core/KeyCap.qml +72 -0
  54. package/shell/core/Mascot.qml +13 -0
  55. package/shell/core/MascotBadge.qml +40 -0
  56. package/shell/core/MascotEffect.qml +40 -0
  57. package/shell/core/Paper.qml +54 -0
  58. package/shell/core/PixelGrid.qml +40 -0
  59. package/shell/core/QuestionRow.qml +161 -0
  60. package/shell/core/SessionRow.qml +220 -0
  61. package/shell/core/Stamp.qml +62 -0
  62. package/shell/core/StatusDots.qml +33 -0
  63. package/shell/core/Surface.qml +32 -0
  64. package/shell/core/Tag.qml +22 -0
  65. package/shell/core/TerminalIcon.qml +34 -0
  66. package/shell/core/Theme.qml +100 -0
  67. package/shell/core/TicketDetail.qml +588 -0
  68. package/shell/core/TicketList.qml +639 -0
  69. package/shell/core/TicketNotice.qml +198 -0
  70. package/shell/core/TopsideClient.qml +198 -0
  71. package/shell/core/UsageLine.qml +106 -0
  72. package/shell/core/agents.js +79 -0
  73. package/shell/core/board.js +138 -0
  74. package/shell/core/hiding.js +29 -0
  75. package/shell/core/pixels.js +542 -0
  76. package/shell/core/qmldir +30 -0
  77. package/shell/core/sounds.js +31 -0
  78. package/shell/core/themes.js +195 -0
  79. package/shell/core/ticket.js +131 -0
  80. package/shell/dms-plugin/TopsideSettings.qml +696 -0
  81. package/shell/dms-plugin/TopsideWidget.qml +572 -0
  82. package/shell/dms-plugin/plugin.json +14 -0
  83. package/shell/pill.qml +279 -0
  84. package/shell/sekaipop-plugin/Bar.qml +151 -0
  85. package/shell/sekaipop-plugin/Card.qml +291 -0
  86. package/shell/sekaipop-plugin/Floating.qml +83 -0
  87. package/shell/sekaipop-plugin/ListWindow.qml +156 -0
  88. package/shell/sekaipop-plugin/Popup.qml +70 -0
  89. package/shell/sekaipop-plugin/Service.qml +414 -0
  90. package/shell/sekaipop-plugin/ShellLook.qml +43 -0
  91. package/shell/sekaipop-plugin/StyledCard.qml +179 -0
  92. package/shell/sekaipop-plugin/plugin.json +109 -0
@@ -0,0 +1,48 @@
1
+ import QtQuick
2
+ import "agents.js" as Agents
3
+
4
+ // Topside's logotype from the shared pixel file: "TOPS", three status dots
5
+ // (working, waiting, done) standing in for the "I", then "DE". The dots
6
+ // belong to no agent.
7
+ Row {
8
+ id: logo
9
+ property real cell: 2
10
+ property color color: Theme.fg
11
+
12
+ spacing: cell * Agents.logotype.letterGap
13
+
14
+ Repeater {
15
+ model: Agents.logotype.before.split("")
16
+ delegate: PixelGrid {
17
+ required property string modelData
18
+ pixels: Agents.glyphs[modelData]
19
+ color: logo.color
20
+ cell: logo.cell
21
+ }
22
+ }
23
+
24
+ Column {
25
+ spacing: logo.cell * Agents.logotype.dotGap
26
+ anchors.verticalCenter: parent.verticalCenter
27
+ Repeater {
28
+ model: Agents.logotype.dots.map(name => Theme[name])
29
+ delegate: Rectangle {
30
+ required property color modelData
31
+ width: logo.cell * Agents.logotype.dotSize
32
+ height: width
33
+ radius: width / 2
34
+ color: modelData
35
+ }
36
+ }
37
+ }
38
+
39
+ Repeater {
40
+ model: Agents.logotype.after.split("")
41
+ delegate: PixelGrid {
42
+ required property string modelData
43
+ pixels: Agents.glyphs[modelData]
44
+ color: logo.color
45
+ cell: logo.cell
46
+ }
47
+ }
48
+ }
@@ -0,0 +1,197 @@
1
+ import QtQuick
2
+ import QtQuick.Layouts
3
+
4
+ // A tool call waiting for an answer, laid out as Topside's permission card:
5
+ // the session's row, "Allow <tool>", the change in a box (a diff with line
6
+ // numbers for edits and writes, the command otherwise), then the answers.
7
+ // Always shows only when the agent offers something to remember; Auto mode
8
+ // only for Claude Code, the one agent that takes it from a hook.
9
+ ColumnLayout {
10
+ id: card
11
+ required property var approval
12
+ property var session: null
13
+ // Show the keys on the buttons: only where they work (the DMS popout's
14
+ // first card).
15
+ property bool shortcuts: false
16
+ signal decided(string decision)
17
+ signal jump()
18
+
19
+ readonly property string toolName: approval.toolName || ""
20
+ readonly property string file: approval.file || ""
21
+ readonly property string always: approval.always || ""
22
+ readonly property bool claude: !session || session.agent === "claude"
23
+ // The box always shows something: the preview, else the one-line command.
24
+ readonly property var lines: (approval.preview || []).length > 0 ? approval.preview
25
+ : [{ kind: "context", text: (approval.summary || "").replace(toolName + ": ", "") }]
26
+ readonly property int added: lines.filter(l => l.kind === "add").length
27
+ readonly property int removed: lines.filter(l => l.kind === "remove").length
28
+
29
+ // Removed lines count the old side, added lines the new one, as in a unified diff.
30
+ readonly property var numbers: {
31
+ let before = 0;
32
+ let after = 0;
33
+ return lines.map(l => l.kind === "remove" ? ++before
34
+ : l.kind === "add" ? ++after
35
+ : l.kind === "context" ? (++after, ++before)
36
+ : "");
37
+ }
38
+
39
+ function foreground(kind) {
40
+ return kind === "add" ? Theme.done : kind === "remove" ? Theme.reminder
41
+ : kind === "more" ? Theme.fgFaint : Theme.level(0.85);
42
+ }
43
+
44
+ spacing: 12
45
+
46
+ CardHeader {
47
+ session: card.session
48
+ Layout.fillWidth: true
49
+ onJump: card.jump()
50
+ }
51
+
52
+ Row {
53
+ spacing: 7
54
+ Text {
55
+ font.family: Theme.font
56
+ text: "⚠"
57
+ color: Theme.waiting
58
+ font.pixelSize: Theme.s(13)
59
+ font.weight: Font.Bold
60
+ }
61
+ Text {
62
+ text: "Allow " + card.toolName
63
+ color: Theme.fg
64
+ font.family: Theme.monoFont
65
+ font.pixelSize: Theme.s(13)
66
+ font.weight: Font.Bold
67
+ }
68
+ }
69
+
70
+ Surface {
71
+ Layout.fillWidth: true
72
+ implicitHeight: box.implicitHeight + (card.file ? 4 : 18)
73
+
74
+ Column {
75
+ id: box
76
+ y: card.file ? 0 : 9
77
+ width: parent.width
78
+
79
+ Row {
80
+ visible: card.file !== ""
81
+ x: 12
82
+ height: 28
83
+ spacing: 8
84
+ Repeater {
85
+ model: [
86
+ { text: card.file, color: Theme.level(0.75), show: true },
87
+ { text: "+" + card.added, color: Theme.done, show: card.added > 0 },
88
+ { text: "−" + card.removed, color: Theme.reminder, show: card.removed > 0 },
89
+ ]
90
+ delegate: Text {
91
+ required property var modelData
92
+ visible: modelData.show
93
+ text: modelData.text
94
+ color: modelData.color
95
+ font.family: Theme.monoFont
96
+ font.pixelSize: Theme.s(12)
97
+ font.weight: Font.DemiBold
98
+ anchors.verticalCenter: parent.verticalCenter
99
+ }
100
+ }
101
+ }
102
+
103
+ Repeater {
104
+ model: card.lines
105
+ delegate: Rectangle {
106
+ id: line
107
+ required property var modelData
108
+ required property int index
109
+ readonly property color ink: card.foreground(modelData.kind)
110
+ width: box.width
111
+ height: Math.max(21, content.implicitHeight)
112
+ color: modelData.kind === "add" ? Qt.rgba(Theme.done.r, Theme.done.g, Theme.done.b, 0.14)
113
+ : modelData.kind === "remove" ? Qt.rgba(Theme.reminder.r, Theme.reminder.g, Theme.reminder.b, 0.14)
114
+ : "transparent"
115
+
116
+ Row {
117
+ id: content
118
+ x: card.file ? 0 : 12
119
+ width: parent.width - x - 8
120
+ anchors.verticalCenter: parent.verticalCenter
121
+
122
+ Text {
123
+ visible: card.file !== ""
124
+ width: 30
125
+ text: card.numbers[line.index]
126
+ horizontalAlignment: Text.AlignRight
127
+ color: Qt.rgba(line.ink.r, line.ink.g, line.ink.b, 0.55)
128
+ font.family: Theme.monoFont
129
+ font.pixelSize: Theme.s(12)
130
+ }
131
+ Text {
132
+ visible: card.file !== ""
133
+ width: 30
134
+ text: line.modelData.kind === "add" ? "+" : line.modelData.kind === "remove" ? "−" : ""
135
+ horizontalAlignment: Text.AlignHCenter
136
+ color: line.ink
137
+ font.family: Theme.monoFont
138
+ font.pixelSize: Theme.s(12)
139
+ }
140
+ Text {
141
+ width: content.width - (card.file ? 60 : 0)
142
+ text: line.modelData.text
143
+ color: line.ink
144
+ font.family: Theme.monoFont
145
+ font.pixelSize: Theme.s(12)
146
+ elide: Text.ElideRight
147
+ textFormat: Text.PlainText
148
+ }
149
+ }
150
+ }
151
+ }
152
+ }
153
+ }
154
+
155
+ RowLayout {
156
+ spacing: 10
157
+ Layout.fillWidth: true
158
+
159
+ CardButton {
160
+ label: "Deny"
161
+ shortcut: card.shortcuts ? "⌃N" : ""
162
+ Layout.fillWidth: true
163
+ onClicked: card.decided("deny")
164
+ }
165
+ CardButton {
166
+ visible: card.always !== ""
167
+ label: "Always"
168
+ shortcut: card.shortcuts ? "⌃A" : ""
169
+ Layout.fillWidth: true
170
+ onClicked: card.decided("always")
171
+ }
172
+ CardButton {
173
+ label: "Allow"
174
+ shortcut: card.shortcuts ? "⌃Y" : ""
175
+ style: "light"
176
+ Layout.fillWidth: true
177
+ onClicked: card.decided("allow")
178
+ }
179
+ CardButton {
180
+ visible: card.claude
181
+ label: "Auto mode"
182
+ style: "danger"
183
+ Layout.fillWidth: true
184
+ onClicked: card.decided("auto")
185
+ }
186
+ }
187
+
188
+ Text {
189
+ font.family: Theme.font
190
+ visible: card.always !== ""
191
+ text: "Always: " + card.always
192
+ color: Theme.fgFaint
193
+ font.pixelSize: Theme.s(11)
194
+ elide: Text.ElideRight
195
+ Layout.fillWidth: true
196
+ }
197
+ }
@@ -0,0 +1,296 @@
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.
12
+ Rectangle {
13
+ id: panel
14
+ required property var client
15
+ property var session: null
16
+ // A waiting request of the session, as Board.pending() gives it, or null.
17
+ property var request: null
18
+ // A finished turn's card: prompt and reply, with Clear and Jump.
19
+ property bool finished: false
20
+ // Show ⌃Y, ⌃N… under the keys: only where they work.
21
+ property bool shortcuts: false
22
+ property bool canHide: false
23
+ // The text size; keys and lines grow with it (the notice is bigger than the list).
24
+ property int size: 11
25
+ // Taller than this, the text scrolls inside and the keys stay in view.
26
+ property real maxHeight: 100000
27
+ signal dismissed()
28
+ // An answer went out: its word for the board to flip to (ALLOWED, DENIED…).
29
+ signal answered(string word)
30
+ signal hideFolder()
31
+ signal hidePrompt()
32
+
33
+ readonly property var approval: request && request.kind === "approval" ? request.item : null
34
+ readonly property var question: request && request.kind === "question" ? request.item : null
35
+ readonly property string agent: session ? session.agent : "claude"
36
+ readonly property var lines: approval ? ((approval.preview || []).length > 0 ? approval.preview
37
+ : [{ kind: "context", text: String(approval.summary || "").replace(approval.toolName + ": ", "") }]) : []
38
+ readonly property int added: lines.filter(l => l.kind === "add").length
39
+ readonly property int removed: lines.filter(l => l.kind === "remove").length
40
+
41
+ // The risk gate blocks a pi or omp request by itself after 25 s.
42
+ property real now: Date.now()
43
+ Timer {
44
+ interval: 1000
45
+ repeat: true
46
+ running: panel.approval !== null && Board.gated(panel.agent)
47
+ onTriggered: panel.now = Date.now()
48
+ }
49
+
50
+ readonly property color ink: "#d6dae4"
51
+ readonly property color dim: "#8e94a6"
52
+
53
+ color: "#121318"
54
+ border.color: "#2e3038"
55
+ radius: 12
56
+ implicitHeight: body.implicitHeight + 2 * body.anchors.margins
57
+
58
+ component Line: Text {
59
+ color: panel.ink
60
+ font.family: Theme.monoFont
61
+ font.pixelSize: panel.size
62
+ wrapMode: Text.Wrap
63
+ Layout.fillWidth: true
64
+ }
65
+ // Hiding is a side door, not an answer: quiet text, never a key.
66
+ component QuietLink: Text {
67
+ id: link
68
+ signal clicked()
69
+ color: linkHover.hovered ? panel.ink : panel.dim
70
+ font.family: Theme.monoFont
71
+ font.pixelSize: Math.max(10, panel.size - 2)
72
+ font.underline: linkHover.hovered
73
+ HoverHandler {
74
+ id: linkHover
75
+ cursorShape: Qt.PointingHandCursor
76
+ }
77
+ TapHandler {
78
+ onTapped: link.clicked()
79
+ }
80
+ }
81
+
82
+ ColumnLayout {
83
+ id: body
84
+ anchors.fill: parent
85
+ anchors.margins: Math.round(panel.size * 1.1)
86
+ spacing: Math.round(panel.size / 2)
87
+
88
+ // What it says scrolls on its own when it's long; the keys stay put.
89
+ Flickable {
90
+ id: scroller
91
+ Layout.fillWidth: true
92
+ Layout.preferredHeight: Math.min(info.implicitHeight, Math.max(60, panel.maxHeight - keyRow.implicitHeight - 2 * body.anchors.margins - body.spacing))
93
+ contentHeight: info.implicitHeight
94
+ clip: true
95
+ boundsBehavior: Flickable.StopAtBounds
96
+ interactive: contentHeight > height
97
+ ColumnLayout {
98
+ id: info
99
+ width: scroller.width
100
+ spacing: body.spacing
101
+
102
+ Line {
103
+ text: panel.session ? Board.sessionName(panel.session) + " · " + Agents.style(panel.agent).name + " · " + String(panel.session.cwd || "").replace(/^\/home\/[^/]+/, "~") : ""
104
+ color: panel.dim
105
+ elide: Text.ElideRight
106
+ wrapMode: Text.NoWrap
107
+ }
108
+
109
+ // A request: what it wants to do.
110
+ Line {
111
+ visible: panel.approval !== null
112
+ text: panel.approval ? "⚠ Allow " + panel.approval.toolName + (panel.approval.file ? " · " + panel.approval.file : "")
113
+ + (panel.added + panel.removed > 0 ? " +" + panel.added + " −" + panel.removed : "") : ""
114
+ color: Theme.waiting
115
+ font.weight: Font.Bold
116
+ }
117
+ Repeater {
118
+ model: panel.lines
119
+ delegate: Line {
120
+ required property var modelData
121
+ text: (modelData.kind === "add" ? "+ " : modelData.kind === "remove" ? "− " : modelData.kind === "more" ? "" : " ") + modelData.text
122
+ color: modelData.kind === "add" ? "#7fd093" : modelData.kind === "remove" ? "#f08a8a" : modelData.kind === "more" ? panel.dim : panel.ink
123
+ wrapMode: Text.NoWrap
124
+ elide: Text.ElideRight
125
+ }
126
+ }
127
+ Line {
128
+ visible: panel.approval !== null && Board.gated(panel.agent)
129
+ text: panel.approval ? "Risky command. Blocked by itself in " + Board.gateLeft(panel.approval, panel.now) + " s." : ""
130
+ color: Theme.reminder
131
+ }
132
+
133
+ // A question: what Claude asks. Several questions or several choices
134
+ // take the full question card.
135
+ Line {
136
+ visible: panel.question !== null && Board.instant(panel.question)
137
+ text: panel.question && panel.question.questions[0] ? panel.question.questions[0].question : ""
138
+ color: Theme.ask
139
+ font.weight: Font.Bold
140
+ }
141
+ Loader {
142
+ id: fullQuestion
143
+ active: panel.question !== null && !Board.instant(panel.question)
144
+ visible: active
145
+ Layout.fillWidth: true
146
+ sourceComponent: QuestionRow {
147
+ question: panel.question
148
+ session: panel.session
149
+ onAnswered: answers => panel.client.answer(panel.question.id, answers)
150
+ onOpenTerminal: panel.client.jump(panel.question.sessionId)
151
+ }
152
+ }
153
+
154
+ // A finished turn, or any other session: your prompt, then the reply or what it does.
155
+ Line {
156
+ visible: panel.request === null && panel.session !== null && (panel.session.lastPrompt || "") !== ""
157
+ text: panel.session ? "You: " + panel.session.lastPrompt : ""
158
+ }
159
+ Text {
160
+ // The agent's last reply, for a finished turn and for any session
161
+ // picked on the list: what it said is what you came to see. The
162
+ // notice keeps it short; the list's panel scrolls instead.
163
+ visible: panel.request === null && panel.session !== null && (panel.session.lastMessage || "") !== ""
164
+ text: panel.session ? panel.session.lastMessage || "" : ""
165
+ textFormat: Text.MarkdownText
166
+ color: "#c9cede"
167
+ font.family: Theme.font
168
+ font.pixelSize: panel.size + 1
169
+ wrapMode: Text.Wrap
170
+ maximumLineCount: panel.finished ? 6 : 60
171
+ elide: Text.ElideRight
172
+ Layout.fillWidth: true
173
+ }
174
+ Line {
175
+ visible: panel.request === null && !panel.finished && panel.session !== null
176
+ text: panel.session ? "Now: " + Board.nowLine(panel.session) : ""
177
+ color: panel.dim
178
+ }
179
+
180
+ }
181
+ }
182
+
183
+ RowLayout {
184
+ id: keyRow
185
+ // Every key as wide as the widest one shown, so they read as one set.
186
+ readonly property real keyWidth: {
187
+ let w = 0;
188
+ for (const child of children)
189
+ if (child.isKey && child.visible) w = Math.max(w, child.implicitWidth);
190
+ return w;
191
+ }
192
+ spacing: 8
193
+ Layout.topMargin: 4
194
+ Layout.fillWidth: true
195
+
196
+ // Any other session: hiding, quietly, on the left.
197
+ QuietLink {
198
+ visible: panel.request === null && !panel.finished && panel.canHide
199
+ text: "hide this folder"
200
+ onClicked: panel.hideFolder()
201
+ }
202
+ QuietLink {
203
+ visible: panel.request === null && !panel.finished && panel.canHide && (panel.session ? panel.session.title || "" : "") !== ""
204
+ text: "· hide prompts like it"
205
+ onClicked: panel.hidePrompt()
206
+ }
207
+ Item { Layout.fillWidth: true }
208
+
209
+ // A request.
210
+ KeyCap {
211
+ size: panel.size
212
+ Layout.preferredWidth: keyRow.keyWidth
213
+ visible: panel.approval !== null
214
+ label: Board.gated(panel.agent) ? "Block" : "Deny"
215
+ sub: panel.shortcuts ? "⌃N" : ""
216
+ onClicked: panel.decide("deny", "DENIED")
217
+ }
218
+ KeyCap {
219
+ size: panel.size
220
+ Layout.preferredWidth: keyRow.keyWidth
221
+ visible: panel.approval !== null && (panel.approval.always || "") !== ""
222
+ label: "Always"
223
+ sub: panel.shortcuts ? "⌃A" : "this session"
224
+ onClicked: panel.decide("always", "ALWAYS")
225
+ }
226
+ KeyCap {
227
+ size: panel.size
228
+ Layout.preferredWidth: keyRow.keyWidth
229
+ visible: panel.approval !== null && panel.agent === "claude"
230
+ label: "Auto"
231
+ sub: "mode"
232
+ onClicked: panel.decide("auto", "AUTO")
233
+ }
234
+ KeyCap {
235
+ size: panel.size
236
+ Layout.preferredWidth: keyRow.keyWidth
237
+ visible: panel.approval !== null
238
+ label: Board.gated(panel.agent) ? "Run it" : "Allow"
239
+ sub: panel.shortcuts ? "⌃Y" : ""
240
+ go: true
241
+ onClicked: panel.decide("allow", "ALLOWED")
242
+ }
243
+
244
+ // A question with one click per option.
245
+ Repeater {
246
+ model: panel.question !== null && Board.instant(panel.question) ? panel.question.questions[0].options : []
247
+ delegate: KeyCap {
248
+ size: panel.size
249
+ Layout.preferredWidth: keyRow.keyWidth
250
+ required property var modelData
251
+ required property int index
252
+ label: modelData.label
253
+ sub: panel.shortcuts ? "⌃" + (index + 1) : "gate " + (index + 1)
254
+ go: index === 0
255
+ onClicked: panel.pick(0, modelData.label)
256
+ }
257
+ }
258
+
259
+ // A finished turn, or any session.
260
+ KeyCap {
261
+ size: panel.size
262
+ Layout.preferredWidth: keyRow.keyWidth
263
+ visible: panel.finished
264
+ label: "Got it"
265
+ onClicked: panel.dismissed()
266
+ }
267
+ KeyCap {
268
+ size: panel.size
269
+ Layout.preferredWidth: keyRow.keyWidth
270
+ visible: panel.request === null && panel.session !== null
271
+ label: "Jump"
272
+ sub: panel.shortcuts ? "⌃J" : "to terminal"
273
+ go: true
274
+ onClicked: panel.client.jump(panel.session.id)
275
+ }
276
+ }
277
+ }
278
+
279
+ function decide(decision, word) {
280
+ panel.client.decide(panel.approval.id, decision);
281
+ panel.answered(Board.gated(panel.agent) && decision === "deny" ? "BLOCKED" : word);
282
+ }
283
+
284
+ // ⌃1…⌃9, and a click on an option: one question, one choice, answered at once.
285
+ function pick(index, label) {
286
+ if (!panel.question) return;
287
+ if (!Board.instant(panel.question)) {
288
+ if (fullQuestion.item) fullQuestion.item.pick(index, label);
289
+ return;
290
+ }
291
+ const answers = {};
292
+ answers[panel.question.questions[index].question] = label;
293
+ panel.client.answer(panel.question.id, answers);
294
+ panel.answered("ANSWERED");
295
+ }
296
+ }