Move Qt/Tauri/full Web SPA under archive/, ship hermit as CLI/TUI plus libcstcore and cst-webui/1 HTTP+SSE (turn lifecycle hooks, capabilities). Co-authored-by: Cursor <cursoragent@cursor.com>
123 lines
3.5 KiB
QML
123 lines
3.5 KiB
QML
import QtQuick
|
|
import QtQuick.Controls
|
|
import QtQuick.Layouts
|
|
|
|
// The engine's on_permission hook is blocked on this dialog: nothing runs
|
|
// until one of the three answers goes back.
|
|
Dialog {
|
|
id: dialog
|
|
property string tool: ""
|
|
property string detail: ""
|
|
property string preview: ""
|
|
signal answered(int choice)
|
|
|
|
modal: true
|
|
anchors.centerIn: parent
|
|
width: Math.min(760, parent ? parent.width - 60 : 760)
|
|
padding: Theme.pad
|
|
title: ""
|
|
|
|
background: Rectangle {
|
|
color: Theme.surface
|
|
border.width: 1
|
|
border.color: Theme.border
|
|
radius: Theme.radius
|
|
}
|
|
|
|
contentItem: ColumnLayout {
|
|
spacing: Theme.gap
|
|
|
|
RowLayout {
|
|
spacing: Theme.gap
|
|
Rectangle {
|
|
width: 8
|
|
height: 8
|
|
radius: 4
|
|
color: Theme.warn
|
|
}
|
|
Text {
|
|
text: "Permission requested"
|
|
color: Theme.text
|
|
font.pixelSize: Theme.bodySize + 1
|
|
font.bold: true
|
|
}
|
|
Text {
|
|
Layout.fillWidth: true
|
|
elide: Text.ElideRight
|
|
text: dialog.tool
|
|
color: Theme.warn
|
|
font.family: Theme.mono
|
|
font.pixelSize: Theme.monoSize
|
|
}
|
|
}
|
|
|
|
Text {
|
|
Layout.fillWidth: true
|
|
visible: dialog.detail.length > 0
|
|
text: dialog.detail
|
|
color: Theme.textDim
|
|
font.pixelSize: Theme.bodySize
|
|
wrapMode: Text.Wrap
|
|
}
|
|
|
|
Rectangle {
|
|
Layout.fillWidth: true
|
|
Layout.preferredHeight: Math.min(320, previewText.implicitHeight + Theme.pad * 2)
|
|
visible: dialog.preview.length > 0
|
|
color: Theme.bg
|
|
radius: Theme.radiusSm
|
|
border.width: 1
|
|
border.color: Theme.border
|
|
|
|
Flickable {
|
|
id: flick
|
|
anchors.fill: parent
|
|
anchors.margins: 8
|
|
contentWidth: previewText.width
|
|
contentHeight: previewText.height
|
|
clip: true
|
|
ScrollBar.vertical: ScrollBar {}
|
|
|
|
Text {
|
|
id: previewText
|
|
width: Math.max(flick.width, implicitWidth)
|
|
text: dialog.preview
|
|
color: Theme.text
|
|
font.family: Theme.mono
|
|
font.pixelSize: Theme.monoSize
|
|
textFormat: Text.PlainText
|
|
}
|
|
}
|
|
}
|
|
|
|
Text {
|
|
Layout.fillWidth: true
|
|
text: "“Always” is remembered for this tool in .agent/permissions.json — the TUI and the CLI see the same decision."
|
|
color: Theme.textFaint
|
|
font.pixelSize: Theme.smallSize
|
|
wrapMode: Text.Wrap
|
|
}
|
|
}
|
|
|
|
footer: DialogButtonBox {
|
|
spacing: Theme.gap
|
|
padding: Theme.pad
|
|
Button {
|
|
text: "Deny"
|
|
DialogButtonBox.buttonRole: DialogButtonBox.RejectRole
|
|
onClicked: { dialog.answered(0); dialog.close() }
|
|
}
|
|
Button {
|
|
text: "Once"
|
|
highlighted: true
|
|
DialogButtonBox.buttonRole: DialogButtonBox.AcceptRole
|
|
onClicked: { dialog.answered(1); dialog.close() }
|
|
}
|
|
Button {
|
|
text: "Always"
|
|
DialogButtonBox.buttonRole: DialogButtonBox.ActionRole
|
|
onClicked: { dialog.answered(2); dialog.close() }
|
|
}
|
|
}
|
|
}
|