agentix-cli 0.193.0 → 0.194.0
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.
- package/README.md +1 -1
- package/apps/mac-helper/Sources/AgentXHelper/Presence.swift +70 -6
- package/apps/mac-helper/Sources/AgentXHelper/PresenceTag.swift +42 -5
- package/apps/mac-helper/Sources/AgentXHelper/main.swift +2 -1
- package/apps/mac-voice/Sources/AgentXVoice/AgentClient.swift +107 -4
- package/apps/mac-voice/Sources/AgentXVoice/Config.swift +0 -9
- package/apps/mac-voice/Sources/AgentXVoice/HistoryWindow.swift +3 -2
- package/apps/mac-voice/Sources/AgentXVoice/OpenRequests.swift +276 -8
- package/apps/mac-voice/Sources/AgentXVoice/RequestsWindow.swift +357 -26
- package/apps/mac-voice/Sources/AgentXVoice/SettingsWindow.swift +27 -0
- package/apps/mac-voice/Sources/AgentXVoice/StatusMenu.swift +17 -2
- package/apps/mac-voice/Sources/AgentXVoice/VoiceSettings.swift +23 -1
- package/apps/mac-voice/Sources/AgentXVoice/main.swift +335 -30
- package/dist/{App-6TNGC3UR.js → App-HBM52GXI.js} +2 -2
- package/dist/{ChatApp-FUDLZ6HZ.js → ChatApp-N4P7M2TD.js} +2 -2
- package/dist/{absorb-eval-YSWPPGQF.js → absorb-eval-HRWWPKT3.js} +2 -2
- package/dist/{adapter-EEBNOFDS.js → adapter-X6T3YBUB.js} +2 -2
- package/dist/{agent-QX2POUEM.js → agent-3B4RMEDI.js} +2 -2
- package/dist/{board-dashboard-VVFHNABJ.js → board-dashboard-YCRGMNAT.js} +1405 -5252
- package/dist/board-dashboard-YCRGMNAT.js.map +1 -0
- package/dist/{chunk-2O72AHK5.js → chunk-2GCPSAXQ.js} +2 -2
- package/dist/{chunk-KHKG7H6Q.js → chunk-2KYGPVTX.js} +2 -2
- package/dist/chunk-3FZ6WHKX.js +2 -0
- package/dist/{chunk-MQRAQJSS.js.map → chunk-3FZ6WHKX.js.map} +1 -1
- package/dist/{chunk-HNA4BW47.js → chunk-6NQ7KYJH.js} +2 -2
- package/dist/{chunk-Z2NYUCTE.js → chunk-7L54Z4EH.js} +2 -2
- package/dist/{chunk-EH7Y2W77.js → chunk-BOCLWYWL.js} +2 -2
- package/dist/chunk-F2FJXKDG.js +7 -0
- package/dist/{chunk-DS2ZIVIH.js.map → chunk-F2FJXKDG.js.map} +1 -1
- package/dist/{chunk-OYXB6KZX.js → chunk-F3CMNSON.js} +2 -2
- package/dist/{chunk-52NME3AU.js → chunk-FO762MEC.js} +2 -2
- package/dist/{chunk-AAL5WIXB.js → chunk-HNZEXUNM.js} +2 -2
- package/dist/{chunk-H5XBQWAI.js → chunk-HOZZUN47.js} +2 -2
- package/dist/chunk-I45E5TLK.js +934 -0
- package/dist/chunk-I45E5TLK.js.map +1 -0
- package/dist/{chunk-Q7ZPW55P.js → chunk-K2BEV3BD.js} +2 -2
- package/dist/{chunk-QTBFMRJ2.js → chunk-KE6BF4ZJ.js} +2 -2
- package/dist/{chunk-DACZSUCN.js → chunk-KXJRXRSD.js} +2 -2
- package/dist/{chunk-TDZDIDFG.js → chunk-LQIF2OHS.js} +2 -2
- package/dist/chunk-M2E3CNFS.js +38 -0
- package/dist/chunk-M2E3CNFS.js.map +1 -0
- package/dist/{chunk-22WO5X4L.js → chunk-MB5CBY2C.js} +106 -106
- package/dist/chunk-MB5CBY2C.js.map +1 -0
- package/dist/{chunk-JGZ6CA5L.js → chunk-MC3ZZA5G.js} +2 -2
- package/dist/{chunk-PSP3NAFU.js → chunk-OEG476JY.js} +79 -76
- package/dist/chunk-OEG476JY.js.map +1 -0
- package/dist/{chunk-6ZAQ3IT5.js → chunk-P6WSD2UR.js} +23 -23
- package/dist/chunk-P6WSD2UR.js.map +1 -0
- package/dist/{chunk-GLYBXXO7.js → chunk-PMSL4A5Y.js} +3 -3
- package/dist/{chunk-VK2TW3RL.js → chunk-PO2SORKY.js} +2 -2
- package/dist/{chunk-N56EHPTR.js → chunk-PX7PWXBI.js} +2 -2
- package/dist/{chunk-EI3TZ52P.js → chunk-RW5FKJRE.js} +2 -2
- package/dist/{chunk-462FRP7L.js → chunk-S42KBXNO.js} +332 -319
- package/dist/chunk-S42KBXNO.js.map +1 -0
- package/dist/{chunk-6FUWODBV.js → chunk-UOIWIVU3.js} +2 -2
- package/dist/{chunk-2VQ3VKBR.js → chunk-VX4PSOKU.js} +2 -2
- package/dist/{chunk-FEXG2PKQ.js → chunk-XH36J3Z2.js} +2 -2
- package/dist/{chunk-MQV3IU6F.js → chunk-ZALVAXQ4.js} +2 -2
- package/dist/cli.js +1 -1
- package/dist/{client-5USANRIL.js → client-YN3T56NM.js} +2 -2
- package/dist/{config-N7DHUZMH.js → config-G7T3TMWE.js} +2 -2
- package/dist/{config-mutate-OVUXNS5X.js → config-mutate-6CRKZQVQ.js} +2 -2
- package/dist/config-mutator-7VS3J5BY.js +2 -0
- package/dist/{contributions-LTDE6UOQ.js → contributions-6VZ4OXJ5.js} +2 -2
- package/dist/{doctor-C3DTKR7C.js → doctor-GFZZTK7C.js} +2 -2
- package/dist/{follow-up-tool-NCFOTJ5Y.js → follow-up-tool-NVP56W7E.js} +2 -2
- package/dist/{hub-F3X7NL4B.js → hub-B434CABZ.js} +2 -2
- package/dist/index.d.ts +38 -6
- package/dist/index.js +1 -1
- package/dist/{program-6HWZZ2D3.js → program-IDRN5TAM.js} +238 -238
- package/dist/program-IDRN5TAM.js.map +1 -0
- package/dist/{promote-FSOPSHJ4.js → promote-3P6PGJOW.js} +2 -2
- package/dist/{query-UDRKDTSB.js → query-E4V7TS5S.js} +2 -2
- package/dist/{query-settings-DJGEGG62.js → query-settings-C5UBKJMN.js} +2 -2
- package/dist/{registry-AVGT5KPR.js → registry-IG324PR3.js} +2 -2
- package/dist/{request-planner-SAQX26AR.js → request-planner-G6IAUMSE.js} +2 -2
- package/dist/{review-candidates-67MPNU42.js → review-candidates-ZL2SJXWC.js} +2 -2
- package/dist/{routing-7DUO5PI7.js → routing-2IBIZYQU.js} +2 -2
- package/dist/schedule-tool-QCTT2R3B.js +2 -0
- package/dist/{scheduler-3IADVHIN.js → scheduler-ZGB7IKZQ.js} +2 -2
- package/dist/{seat-YWSYQBCW.js → seat-CFY7LMPS.js} +2 -2
- package/dist/{select-PA7AHZ3W.js → select-MU52ACKG.js} +2 -2
- package/dist/self-ELWZIMVY.js +2 -0
- package/dist/{set-enabled-DD6L2ZQ6.js → set-enabled-XRNSYEI3.js} +2 -2
- package/dist/{sprint-tool-PKJA6LYF.js → sprint-tool-E4MABD2N.js} +2 -2
- package/dist/{tool-WJ72TBMV.js → tool-V5Z4KWK7.js} +2 -2
- package/dist/{tool-PJSLWK45.js → tool-W6M7GYRZ.js} +2 -2
- package/dist/{tool-KOGZBOCR.js → tool-ZYVT4VUU.js} +2 -2
- package/dist/{wiki-HQBMWH23.js → wiki-VP6XRWIS.js} +2 -2
- package/dist/wiki-enrich-LUFXPUYY.js +2 -0
- package/package.json +1 -1
- package/dist/board-dashboard-VVFHNABJ.js.map +0 -1
- package/dist/chunk-22WO5X4L.js.map +0 -1
- package/dist/chunk-462FRP7L.js.map +0 -1
- package/dist/chunk-6ZAQ3IT5.js.map +0 -1
- package/dist/chunk-BKTKJNCR.js +0 -36
- package/dist/chunk-BKTKJNCR.js.map +0 -1
- package/dist/chunk-DS2ZIVIH.js +0 -7
- package/dist/chunk-MQRAQJSS.js +0 -2
- package/dist/chunk-PSP3NAFU.js.map +0 -1
- package/dist/chunk-RDENYWNG.js +0 -898
- package/dist/chunk-RDENYWNG.js.map +0 -1
- package/dist/config-mutator-OK7CDCHW.js +0 -2
- package/dist/program-6HWZZ2D3.js.map +0 -1
- package/dist/schedule-tool-LZOW5SVQ.js +0 -2
- package/dist/self-KACQLLDA.js +0 -2
- package/dist/wiki-enrich-7RPM5DQF.js +0 -2
- /package/dist/{App-6TNGC3UR.js.map → App-HBM52GXI.js.map} +0 -0
- /package/dist/{ChatApp-FUDLZ6HZ.js.map → ChatApp-N4P7M2TD.js.map} +0 -0
- /package/dist/{absorb-eval-YSWPPGQF.js.map → absorb-eval-HRWWPKT3.js.map} +0 -0
- /package/dist/{adapter-EEBNOFDS.js.map → adapter-X6T3YBUB.js.map} +0 -0
- /package/dist/{agent-QX2POUEM.js.map → agent-3B4RMEDI.js.map} +0 -0
- /package/dist/{chunk-2O72AHK5.js.map → chunk-2GCPSAXQ.js.map} +0 -0
- /package/dist/{chunk-KHKG7H6Q.js.map → chunk-2KYGPVTX.js.map} +0 -0
- /package/dist/{chunk-HNA4BW47.js.map → chunk-6NQ7KYJH.js.map} +0 -0
- /package/dist/{chunk-Z2NYUCTE.js.map → chunk-7L54Z4EH.js.map} +0 -0
- /package/dist/{chunk-EH7Y2W77.js.map → chunk-BOCLWYWL.js.map} +0 -0
- /package/dist/{chunk-OYXB6KZX.js.map → chunk-F3CMNSON.js.map} +0 -0
- /package/dist/{chunk-52NME3AU.js.map → chunk-FO762MEC.js.map} +0 -0
- /package/dist/{chunk-AAL5WIXB.js.map → chunk-HNZEXUNM.js.map} +0 -0
- /package/dist/{chunk-H5XBQWAI.js.map → chunk-HOZZUN47.js.map} +0 -0
- /package/dist/{chunk-Q7ZPW55P.js.map → chunk-K2BEV3BD.js.map} +0 -0
- /package/dist/{chunk-QTBFMRJ2.js.map → chunk-KE6BF4ZJ.js.map} +0 -0
- /package/dist/{chunk-DACZSUCN.js.map → chunk-KXJRXRSD.js.map} +0 -0
- /package/dist/{chunk-TDZDIDFG.js.map → chunk-LQIF2OHS.js.map} +0 -0
- /package/dist/{chunk-JGZ6CA5L.js.map → chunk-MC3ZZA5G.js.map} +0 -0
- /package/dist/{chunk-GLYBXXO7.js.map → chunk-PMSL4A5Y.js.map} +0 -0
- /package/dist/{chunk-VK2TW3RL.js.map → chunk-PO2SORKY.js.map} +0 -0
- /package/dist/{chunk-N56EHPTR.js.map → chunk-PX7PWXBI.js.map} +0 -0
- /package/dist/{chunk-EI3TZ52P.js.map → chunk-RW5FKJRE.js.map} +0 -0
- /package/dist/{chunk-6FUWODBV.js.map → chunk-UOIWIVU3.js.map} +0 -0
- /package/dist/{chunk-2VQ3VKBR.js.map → chunk-VX4PSOKU.js.map} +0 -0
- /package/dist/{chunk-FEXG2PKQ.js.map → chunk-XH36J3Z2.js.map} +0 -0
- /package/dist/{chunk-MQV3IU6F.js.map → chunk-ZALVAXQ4.js.map} +0 -0
- /package/dist/{client-5USANRIL.js.map → client-YN3T56NM.js.map} +0 -0
- /package/dist/{config-N7DHUZMH.js.map → config-G7T3TMWE.js.map} +0 -0
- /package/dist/{config-mutate-OVUXNS5X.js.map → config-mutate-6CRKZQVQ.js.map} +0 -0
- /package/dist/{config-mutator-OK7CDCHW.js.map → config-mutator-7VS3J5BY.js.map} +0 -0
- /package/dist/{contributions-LTDE6UOQ.js.map → contributions-6VZ4OXJ5.js.map} +0 -0
- /package/dist/{doctor-C3DTKR7C.js.map → doctor-GFZZTK7C.js.map} +0 -0
- /package/dist/{follow-up-tool-NCFOTJ5Y.js.map → follow-up-tool-NVP56W7E.js.map} +0 -0
- /package/dist/{hub-F3X7NL4B.js.map → hub-B434CABZ.js.map} +0 -0
- /package/dist/{promote-FSOPSHJ4.js.map → promote-3P6PGJOW.js.map} +0 -0
- /package/dist/{query-UDRKDTSB.js.map → query-E4V7TS5S.js.map} +0 -0
- /package/dist/{query-settings-DJGEGG62.js.map → query-settings-C5UBKJMN.js.map} +0 -0
- /package/dist/{registry-AVGT5KPR.js.map → registry-IG324PR3.js.map} +0 -0
- /package/dist/{request-planner-SAQX26AR.js.map → request-planner-G6IAUMSE.js.map} +0 -0
- /package/dist/{review-candidates-67MPNU42.js.map → review-candidates-ZL2SJXWC.js.map} +0 -0
- /package/dist/{routing-7DUO5PI7.js.map → routing-2IBIZYQU.js.map} +0 -0
- /package/dist/{schedule-tool-LZOW5SVQ.js.map → schedule-tool-QCTT2R3B.js.map} +0 -0
- /package/dist/{scheduler-3IADVHIN.js.map → scheduler-ZGB7IKZQ.js.map} +0 -0
- /package/dist/{seat-YWSYQBCW.js.map → seat-CFY7LMPS.js.map} +0 -0
- /package/dist/{select-PA7AHZ3W.js.map → select-MU52ACKG.js.map} +0 -0
- /package/dist/{self-KACQLLDA.js.map → self-ELWZIMVY.js.map} +0 -0
- /package/dist/{set-enabled-DD6L2ZQ6.js.map → set-enabled-XRNSYEI3.js.map} +0 -0
- /package/dist/{sprint-tool-PKJA6LYF.js.map → sprint-tool-E4MABD2N.js.map} +0 -0
- /package/dist/{tool-WJ72TBMV.js.map → tool-V5Z4KWK7.js.map} +0 -0
- /package/dist/{tool-PJSLWK45.js.map → tool-W6M7GYRZ.js.map} +0 -0
- /package/dist/{tool-KOGZBOCR.js.map → tool-ZYVT4VUU.js.map} +0 -0
- /package/dist/{wiki-HQBMWH23.js.map → wiki-VP6XRWIS.js.map} +0 -0
- /package/dist/{wiki-enrich-7RPM5DQF.js.map → wiki-enrich-LUFXPUYY.js.map} +0 -0
|
@@ -7,10 +7,16 @@ import SwiftUI
|
|
|
7
7
|
/// It opens three ways. Hovering the pill for half a second opens it for
|
|
8
8
|
/// as long as the pointer is on the pill or the list. A click on the mini
|
|
9
9
|
/// orbs or on "1 new", or ⌘⌥O, opens it until Esc or a click elsewhere,
|
|
10
|
-
/// with the keyboard in it: ↑ ↓ move, Return picks, Esc hides.
|
|
11
|
-
/// row is the app's to do (`onPick`).
|
|
10
|
+
/// with the keyboard in it: ↑ ↓ move, Return picks, ⌘⌫ closes, Esc hides.
|
|
11
|
+
/// Picking or closing a row is the app's to do (`onPick`, `onClose`). A
|
|
12
|
+
/// thinking row asks before it closes: let it finish (Return), stop the
|
|
13
|
+
/// agent (Tab, then Return or Space), or keep it (Esc). What the rows say comes from
|
|
12
14
|
/// OpenRequests.swift, which is tested without a window.
|
|
13
15
|
///
|
|
16
|
+
/// Past five rows the list groups by agent: one row per agent, and picking
|
|
17
|
+
/// it opens that agent's rows, with a way back (← or Esc) and to its
|
|
18
|
+
/// History.
|
|
19
|
+
///
|
|
14
20
|
/// A floating non-activating panel like the pill, so opening it never
|
|
15
21
|
/// takes the keyboard from the app in front unless the owner asked for
|
|
16
22
|
/// the keyboard (a click or the shortcut).
|
|
@@ -40,7 +46,15 @@ final class RequestsWindow: NSPanel {
|
|
|
40
46
|
private static let headerHeight: CGFloat = 40
|
|
41
47
|
private static let rowHeight: CGFloat = 52
|
|
42
48
|
private static let bottomPadding: CGFloat = 8
|
|
43
|
-
|
|
49
|
+
/// "Close heard", and Undo after a close.
|
|
50
|
+
private static let footerHeight: CGFloat = 34
|
|
51
|
+
private static let emptyHeight: CGFloat = 104
|
|
52
|
+
/// A failed row opened: its reason and Ask again under it.
|
|
53
|
+
private static let reasonHeight: CGFloat = 56
|
|
54
|
+
/// "Can’t reach AgentX on this Mac", with Try now and the dashboard.
|
|
55
|
+
private static let unreachableHeight: CGFloat = 92
|
|
56
|
+
/// Two placeholder rows while the daemon is slow to answer.
|
|
57
|
+
private static let loadingRows = 2
|
|
44
58
|
|
|
45
59
|
/// Counts the thinking clocks while the list shows.
|
|
46
60
|
private var tick: Timer?
|
|
@@ -63,6 +77,8 @@ final class RequestsWindow: NSPanel {
|
|
|
63
77
|
|
|
64
78
|
let surface = Surface(frame: frame)
|
|
65
79
|
contentView = surface
|
|
80
|
+
model.onOpenAgent = { [weak self] agent in MainActor.assumeIsolated { self?.openAgent(agent) } }
|
|
81
|
+
model.onBack = { [weak self] in MainActor.assumeIsolated { self?.back() } }
|
|
66
82
|
let host = RequestsHost(rootView: RequestsView(model: model))
|
|
67
83
|
host.frame = surface.bounds
|
|
68
84
|
host.autoresizingMask = [.width, .height]
|
|
@@ -110,18 +126,53 @@ final class RequestsWindow: NSPanel {
|
|
|
110
126
|
leaveCheck = nil
|
|
111
127
|
model.keyboard = false
|
|
112
128
|
model.selected = nil
|
|
129
|
+
model.confirming = nil
|
|
130
|
+
model.opened = nil
|
|
131
|
+
model.expanded = nil
|
|
113
132
|
orderOut(nil)
|
|
114
133
|
}
|
|
115
134
|
|
|
135
|
+
/// An agent's row in the grouped list was picked: its rows show.
|
|
136
|
+
@MainActor
|
|
137
|
+
func openAgent(_ agentID: String) {
|
|
138
|
+
model.opened = agentID
|
|
139
|
+
model.selected = nil
|
|
140
|
+
reload()
|
|
141
|
+
if model.keyboard { model.selected = model.rows.first?.id }
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/// Back from an agent's rows to one row per agent, on that agent.
|
|
145
|
+
@MainActor
|
|
146
|
+
func back() {
|
|
147
|
+
guard let agent = model.opened else { return }
|
|
148
|
+
model.opened = nil
|
|
149
|
+
reload()
|
|
150
|
+
model.selected = model.rows.first { $0.agent == agent }?.id
|
|
151
|
+
}
|
|
152
|
+
|
|
116
153
|
/// The rows again, and the list's size and place for them. Cheap:
|
|
117
154
|
/// SwiftUI redraws only what changed.
|
|
118
155
|
@MainActor
|
|
119
156
|
func reload() {
|
|
120
157
|
guard mode != nil else { return }
|
|
121
158
|
let pill = pillFrame()
|
|
159
|
+
// The agent opened has no rows left: back to every agent.
|
|
160
|
+
if model.opened != nil && rows(true).isEmpty { model.opened = nil }
|
|
122
161
|
let count = rows(true).count
|
|
123
|
-
let
|
|
124
|
-
|
|
162
|
+
let footer = count > 0 || model.undo != nil ? Self.footerHeight : 0
|
|
163
|
+
var height: CGFloat
|
|
164
|
+
switch model.status {
|
|
165
|
+
case .loading where count == 0:
|
|
166
|
+
height = Self.headerHeight + CGFloat(Self.loadingRows) * Self.rowHeight + Self.bottomPadding
|
|
167
|
+
case .unreachable:
|
|
168
|
+
height = Self.headerHeight + Self.unreachableHeight + CGFloat(count) * Self.rowHeight + Self.bottomPadding + footer
|
|
169
|
+
default:
|
|
170
|
+
height = (count == 0 ? Self.emptyHeight
|
|
171
|
+
: Self.headerHeight + CGFloat(count) * Self.rowHeight + Self.bottomPadding) + footer
|
|
172
|
+
}
|
|
173
|
+
if let open = model.expanded, rows(true).contains(where: { $0.id == open && $0.reason != nil }) {
|
|
174
|
+
height += Self.reasonHeight
|
|
175
|
+
}
|
|
125
176
|
let screen = NSScreen.screens.first { $0.frame.intersects(pill) } ?? NSScreen.main ?? NSScreen.screens.first
|
|
126
177
|
guard let visible = screen?.visibleFrame else { return }
|
|
127
178
|
let spot = PillPlacement.list(width: Self.width, height: height, pill: pill, visible: visible)
|
|
@@ -129,6 +180,8 @@ final class RequestsWindow: NSPanel {
|
|
|
129
180
|
let fresh = rows(above)
|
|
130
181
|
if model.rows != fresh { model.rows = fresh }
|
|
131
182
|
if let s = model.selected, !fresh.contains(where: { $0.id == s }) { model.selected = nil }
|
|
183
|
+
if let c = model.confirming, !fresh.contains(where: { $0.id == c && $0.cue == .thinking }) { model.confirming = nil }
|
|
184
|
+
if let e = model.expanded, !fresh.contains(where: { $0.id == e && $0.reason != nil }) { model.expanded = nil }
|
|
132
185
|
if frame != spot.frame { setFrame(spot.frame, display: true) }
|
|
133
186
|
}
|
|
134
187
|
|
|
@@ -181,17 +234,36 @@ final class RequestsWindow: NSPanel {
|
|
|
181
234
|
@MainActor
|
|
182
235
|
private func key(_ event: NSEvent) -> Bool {
|
|
183
236
|
let ids = model.rows.map(\.id)
|
|
237
|
+
// A thinking row asking before it closes: Return lets it finish,
|
|
238
|
+
// Tab moves to Stop (never the default), Esc keeps it.
|
|
239
|
+
if let id = model.confirming {
|
|
240
|
+
switch event.keyCode {
|
|
241
|
+
case 48: model.confirmOnStop.toggle() // Tab
|
|
242
|
+
case 36, 76: model.onConfirm?(id, model.confirmOnStop ? .stop : .letItFinish)
|
|
243
|
+
case 49 where model.confirmOnStop: model.onConfirm?(id, .stop) // Space
|
|
244
|
+
case 53: model.onConfirm?(id, .keep)
|
|
245
|
+
default: break
|
|
246
|
+
}
|
|
247
|
+
return true
|
|
248
|
+
}
|
|
184
249
|
switch event.keyCode {
|
|
250
|
+
case 51 where event.modifierFlags.contains(.command): // ⌘⌫
|
|
251
|
+
if let id = model.selected, model.agent(of: id) == nil { model.onClose?(id) }
|
|
252
|
+
return true
|
|
253
|
+
case 123 where model.opened != nil: // ←
|
|
254
|
+
back()
|
|
255
|
+
return true
|
|
185
256
|
case 125, 126: // ↓ ↑
|
|
186
257
|
model.keyboard = true
|
|
187
258
|
model.selected = OpenRequests.move(model.selected, by: event.keyCode == 125 ? 1 : -1, in: ids)
|
|
188
259
|
return true
|
|
189
260
|
case 36, 76: // Return, Enter
|
|
190
261
|
guard let id = model.selected else { return true }
|
|
191
|
-
|
|
262
|
+
// A failed row already opened: Return asks again.
|
|
263
|
+
if model.expanded == id { model.onAskAgain?(id) } else { model.pick(id) }
|
|
192
264
|
return true
|
|
193
|
-
case 53: // Esc
|
|
194
|
-
dismissList()
|
|
265
|
+
case 53: // Esc: back from an agent's rows, else hide
|
|
266
|
+
if model.opened != nil { back() } else { dismissList() }
|
|
195
267
|
return true
|
|
196
268
|
default:
|
|
197
269
|
return false
|
|
@@ -199,9 +271,20 @@ final class RequestsWindow: NSPanel {
|
|
|
199
271
|
}
|
|
200
272
|
|
|
201
273
|
/// The row the keyboard is on, while the list shows: the talk key then
|
|
202
|
-
/// talks to its agent.
|
|
274
|
+
/// talks to its agent. Never an agent's row.
|
|
275
|
+
@MainActor
|
|
276
|
+
var selectedRow: Int? {
|
|
277
|
+
guard isOpen, let id = model.selected, model.agent(of: id) == nil else { return nil }
|
|
278
|
+
return id
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
/// The agent of the agent's row the keyboard is on, while the list
|
|
282
|
+
/// shows; or the agent opened.
|
|
203
283
|
@MainActor
|
|
204
|
-
var
|
|
284
|
+
var selectedAgent: String? {
|
|
285
|
+
guard isOpen else { return nil }
|
|
286
|
+
return model.selected.flatMap(model.agent(of:)) ?? model.opened
|
|
287
|
+
}
|
|
205
288
|
}
|
|
206
289
|
|
|
207
290
|
/// Takes the first click even while the list is not the key window, so a
|
|
@@ -231,17 +314,79 @@ final class RequestsModel: ObservableObject {
|
|
|
231
314
|
/// The whole row, as VoiceOver reads it.
|
|
232
315
|
let voiceOver: String
|
|
233
316
|
/// What picking it does, for VoiceOver: "Listen", "Show the
|
|
234
|
-
/// answer", "See why"; nil while there is nothing to hear yet.
|
|
317
|
+
/// answer", "See why", "Open"; nil while there is nothing to hear yet.
|
|
235
318
|
let action: String?
|
|
319
|
+
/// An agent's row in the grouped list: the agent it opens.
|
|
320
|
+
var agent: String? = nil
|
|
321
|
+
/// Why it failed, in one line: shown under the row once picked.
|
|
322
|
+
var reason: String? = nil
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
/// Where the list stands with the daemon that keeps it.
|
|
326
|
+
enum Status: Equatable {
|
|
327
|
+
/// The daemon answered the last read.
|
|
328
|
+
case ready
|
|
329
|
+
/// The first read is taking longer than half a second.
|
|
330
|
+
case loading
|
|
331
|
+
/// The daemon did not answer: the rows come back when it does.
|
|
332
|
+
case unreachable
|
|
236
333
|
}
|
|
237
334
|
|
|
238
335
|
@Published var rows: [Row] = []
|
|
336
|
+
@Published var status: Status = .ready
|
|
337
|
+
/// The failed row opened in place, with its reason and Ask again.
|
|
338
|
+
@Published var expanded: Int?
|
|
339
|
+
/// "Ask again" on a failed row. Set by the app.
|
|
340
|
+
var onAskAgain: ((Int) -> Void)?
|
|
341
|
+
/// "Try now" while the daemon is unreachable. Set by the app.
|
|
342
|
+
var onRetry: (() -> Void)?
|
|
343
|
+
/// "Open the dashboard". Set by the app.
|
|
344
|
+
var onDashboard: (() -> Void)?
|
|
239
345
|
/// The row the keyboard is on.
|
|
240
346
|
@Published var selected: Int?
|
|
241
347
|
/// The keyboard is in the list: the selected row has a ring.
|
|
242
348
|
@Published var keyboard = false
|
|
243
349
|
/// A row was clicked, or Return pressed on it. Set by the app.
|
|
244
350
|
var onPick: ((Int) -> Void)?
|
|
351
|
+
/// An agent's row picked: open it. Set by the window.
|
|
352
|
+
var onOpenAgent: ((String) -> Void)?
|
|
353
|
+
/// The agent whose rows show, in the grouped list; nil for all.
|
|
354
|
+
@Published var opened: String?
|
|
355
|
+
/// Its name, for the header.
|
|
356
|
+
@Published var openedName = ""
|
|
357
|
+
/// "History" beside an agent opened: its earlier conversations.
|
|
358
|
+
var onHistory: ((String) -> Void)?
|
|
359
|
+
|
|
360
|
+
func agent(of id: Int) -> String? { rows.first { $0.id == id }?.agent }
|
|
361
|
+
|
|
362
|
+
/// A row clicked, or Return on it: an agent's row opens, a request is
|
|
363
|
+
/// the app's to pick.
|
|
364
|
+
func pick(_ id: Int) {
|
|
365
|
+
if let agent = agent(of: id) { onOpenAgent?(agent) } else { onPick?(id) }
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
/// The row's × or ⌘⌫. Set by the app.
|
|
369
|
+
var onClose: ((Int) -> Void)?
|
|
370
|
+
/// What to do with a thinking row being closed.
|
|
371
|
+
enum CloseChoice { case letItFinish, stop, keep }
|
|
372
|
+
/// The thinking row asking before it closes.
|
|
373
|
+
@Published var confirming: Int? {
|
|
374
|
+
didSet { if confirming != oldValue { confirmOnStop = false } }
|
|
375
|
+
}
|
|
376
|
+
/// Tab moved the confirm to "Stop".
|
|
377
|
+
@Published var confirmOnStop = false
|
|
378
|
+
var onConfirm: ((Int, CloseChoice) -> Void)?
|
|
379
|
+
/// "Closed Ops’s request", with Undo, for a few seconds after a close.
|
|
380
|
+
@Published var undo: String?
|
|
381
|
+
var onUndo: (() -> Void)?
|
|
382
|
+
/// "Close heard": every heard answer and every failure.
|
|
383
|
+
var onCloseHeard: (() -> Void)?
|
|
384
|
+
/// The header's back arrow, beside an agent opened. Set by the window.
|
|
385
|
+
var onBack: (() -> Void)?
|
|
386
|
+
/// Every request, however the rows are grouped. Set by the app.
|
|
387
|
+
@Published var total = 0
|
|
388
|
+
/// A heard answer or a failure in the list. Set by the app.
|
|
389
|
+
@Published var hasHeard = false
|
|
245
390
|
}
|
|
246
391
|
|
|
247
392
|
struct RequestsView: View {
|
|
@@ -250,10 +395,26 @@ struct RequestsView: View {
|
|
|
250
395
|
var body: some View {
|
|
251
396
|
VStack(alignment: .leading, spacing: 0) {
|
|
252
397
|
HStack(spacing: 8) {
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
398
|
+
if let agent = model.opened {
|
|
399
|
+
Button(action: { model.onBack?() }) {
|
|
400
|
+
Image(systemName: "chevron.left").font(.system(size: 11, weight: .bold))
|
|
401
|
+
}
|
|
402
|
+
.buttonStyle(.borderless)
|
|
403
|
+
.help("Every agent (←)")
|
|
404
|
+
.accessibilityLabel("Back to every agent")
|
|
405
|
+
Text(model.openedName)
|
|
406
|
+
.font(.system(size: 13, weight: .bold))
|
|
407
|
+
.lineLimit(1)
|
|
408
|
+
Button("History") { model.onHistory?(agent) }
|
|
409
|
+
.buttonStyle(.borderless)
|
|
410
|
+
.font(.system(size: 12))
|
|
411
|
+
.accessibilityHint("Opens \(model.openedName)’s earlier conversations")
|
|
412
|
+
} else {
|
|
413
|
+
Text("Open requests")
|
|
414
|
+
.font(.system(size: 13, weight: .bold))
|
|
415
|
+
}
|
|
416
|
+
if model.opened == nil && model.total > 0 {
|
|
417
|
+
Text("\(model.total)")
|
|
257
418
|
.font(.system(size: 11, weight: .bold).monospacedDigit())
|
|
258
419
|
.foregroundStyle(.secondary)
|
|
259
420
|
.padding(.horizontal, 7)
|
|
@@ -267,14 +428,26 @@ struct RequestsView: View {
|
|
|
267
428
|
}
|
|
268
429
|
.padding(.horizontal, 14)
|
|
269
430
|
.frame(height: 40)
|
|
270
|
-
.accessibilityElement(children: .combine)
|
|
431
|
+
.accessibilityElement(children: model.opened == nil ? .combine : .contain)
|
|
271
432
|
.accessibilityAddTraits(.isHeader)
|
|
272
433
|
|
|
273
|
-
if model.
|
|
434
|
+
if model.status == .unreachable {
|
|
435
|
+
Unreachable(retry: { model.onRetry?() }, dashboard: { model.onDashboard?() })
|
|
436
|
+
}
|
|
437
|
+
if model.rows.isEmpty && model.status == .loading {
|
|
438
|
+
VStack(spacing: 0) {
|
|
439
|
+
ForEach(0..<2, id: \.self) { _ in LoadingRow() }
|
|
440
|
+
}
|
|
441
|
+
.padding(.horizontal, 6)
|
|
442
|
+
.accessibilityElement(children: .ignore)
|
|
443
|
+
.accessibilityLabel("Loading open requests")
|
|
444
|
+
} else if model.rows.isEmpty && model.status == .unreachable {
|
|
445
|
+
EmptyView()
|
|
446
|
+
} else if model.rows.isEmpty {
|
|
274
447
|
VStack(alignment: .leading, spacing: 2) {
|
|
275
448
|
Text("Nothing open")
|
|
276
449
|
.font(.system(size: 13, weight: .semibold))
|
|
277
|
-
Text("Hold ⌥Space and ask any agent.")
|
|
450
|
+
Text("Hold ⌥Space and ask any agent. Each request shows here until you close it.")
|
|
278
451
|
.font(.system(size: 12))
|
|
279
452
|
.foregroundStyle(.secondary)
|
|
280
453
|
}
|
|
@@ -285,11 +458,24 @@ struct RequestsView: View {
|
|
|
285
458
|
ScrollView(.vertical) {
|
|
286
459
|
VStack(spacing: 0) {
|
|
287
460
|
ForEach(model.rows) { row in
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
461
|
+
Group {
|
|
462
|
+
if model.confirming == row.id {
|
|
463
|
+
CloseConfirm(row: row, onStop: model.confirmOnStop,
|
|
464
|
+
choose: { model.onConfirm?(row.id, $0) })
|
|
465
|
+
} else {
|
|
466
|
+
VStack(alignment: .leading, spacing: 0) {
|
|
467
|
+
RequestRow(row: row,
|
|
468
|
+
selected: model.selected == row.id,
|
|
469
|
+
ring: model.keyboard && model.selected == row.id,
|
|
470
|
+
pick: { model.pick(row.id) },
|
|
471
|
+
close: { model.onClose?(row.id) })
|
|
472
|
+
if model.expanded == row.id, let reason = row.reason {
|
|
473
|
+
FailedReason(reason: reason, askAgain: { model.onAskAgain?(row.id) })
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
.id(row.id)
|
|
293
479
|
}
|
|
294
480
|
}
|
|
295
481
|
.padding(.horizontal, 6)
|
|
@@ -302,6 +488,136 @@ struct RequestsView: View {
|
|
|
302
488
|
}
|
|
303
489
|
}
|
|
304
490
|
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .top)
|
|
491
|
+
.safeAreaInset(edge: .bottom, spacing: 0) {
|
|
492
|
+
if !model.rows.isEmpty || model.undo != nil { footer }
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
/// "Close heard" on the left; after a close, its line and Undo.
|
|
497
|
+
private var footer: some View {
|
|
498
|
+
HStack(spacing: 8) {
|
|
499
|
+
if !model.rows.isEmpty {
|
|
500
|
+
Button("Close heard") { model.onCloseHeard?() }
|
|
501
|
+
.buttonStyle(.borderless)
|
|
502
|
+
.font(.system(size: 12))
|
|
503
|
+
.disabled(!model.hasHeard)
|
|
504
|
+
.accessibilityHint("Closes every heard answer and every failure")
|
|
505
|
+
}
|
|
506
|
+
Spacer(minLength: 0)
|
|
507
|
+
if let undo = model.undo {
|
|
508
|
+
Text(undo)
|
|
509
|
+
.font(.system(size: 12))
|
|
510
|
+
.foregroundStyle(.secondary)
|
|
511
|
+
.lineLimit(1)
|
|
512
|
+
Button("Undo") { model.onUndo?() }
|
|
513
|
+
.buttonStyle(.borderless)
|
|
514
|
+
.font(.system(size: 12, weight: .semibold))
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
.padding(.horizontal, 14)
|
|
518
|
+
.frame(height: 34)
|
|
519
|
+
.overlay(alignment: .top) { Divider().opacity(0.5) }
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
/// A failed row, picked: why, in one line, and Ask again, which sends the
|
|
524
|
+
/// same words to the same agent as a new request.
|
|
525
|
+
struct FailedReason: View {
|
|
526
|
+
let reason: String
|
|
527
|
+
let askAgain: () -> Void
|
|
528
|
+
|
|
529
|
+
var body: some View {
|
|
530
|
+
VStack(alignment: .leading, spacing: 6) {
|
|
531
|
+
Text(reason)
|
|
532
|
+
.font(.system(size: 12))
|
|
533
|
+
.lineLimit(1)
|
|
534
|
+
.truncationMode(.tail)
|
|
535
|
+
Button(OpenRequests.askAgain, action: askAgain)
|
|
536
|
+
.buttonStyle(.bordered)
|
|
537
|
+
.controlSize(.small)
|
|
538
|
+
.font(.system(size: 11.5))
|
|
539
|
+
}
|
|
540
|
+
.padding(.leading, 40)
|
|
541
|
+
.padding(.trailing, 8)
|
|
542
|
+
.frame(maxWidth: .infinity, minHeight: 56, maxHeight: 56, alignment: .topLeading)
|
|
543
|
+
.accessibilityElement(children: .contain)
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
/// The daemon did not answer the last read: the rows are kept by AgentX
|
|
548
|
+
/// and come back when it answers. The app tries again every few seconds.
|
|
549
|
+
struct Unreachable: View {
|
|
550
|
+
let retry: () -> Void
|
|
551
|
+
let dashboard: () -> Void
|
|
552
|
+
|
|
553
|
+
var body: some View {
|
|
554
|
+
VStack(alignment: .leading, spacing: 6) {
|
|
555
|
+
Text(OpenRequests.unreachableTitle)
|
|
556
|
+
.font(.system(size: 13, weight: .semibold))
|
|
557
|
+
Text(OpenRequests.unreachableBody)
|
|
558
|
+
.font(.system(size: 12))
|
|
559
|
+
.foregroundStyle(.secondary)
|
|
560
|
+
.fixedSize(horizontal: false, vertical: true)
|
|
561
|
+
HStack(spacing: 6) {
|
|
562
|
+
Button("Try now", action: retry)
|
|
563
|
+
Button("Open the dashboard", action: dashboard)
|
|
564
|
+
}
|
|
565
|
+
.buttonStyle(.bordered)
|
|
566
|
+
.controlSize(.small)
|
|
567
|
+
.font(.system(size: 11.5))
|
|
568
|
+
}
|
|
569
|
+
.padding(.horizontal, 14)
|
|
570
|
+
.frame(maxWidth: .infinity, minHeight: 92, maxHeight: 92, alignment: .topLeading)
|
|
571
|
+
.accessibilityElement(children: .contain)
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
/// A grey placeholder row while the daemon is slow with the first read.
|
|
576
|
+
struct LoadingRow: View {
|
|
577
|
+
var body: some View {
|
|
578
|
+
HStack(spacing: 10) {
|
|
579
|
+
Circle().fill(Color.primary.opacity(0.08)).frame(width: 22, height: 22)
|
|
580
|
+
VStack(alignment: .leading, spacing: 6) {
|
|
581
|
+
Capsule().fill(Color.primary.opacity(0.08)).frame(width: 130, height: 9)
|
|
582
|
+
Capsule().fill(Color.primary.opacity(0.06)).frame(width: 220, height: 9)
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
.padding(.horizontal, 8)
|
|
586
|
+
.frame(maxWidth: .infinity, minHeight: 52, maxHeight: 52, alignment: .leading)
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
/// A thinking row being closed asks first: "Writer is still thinking",
|
|
591
|
+
/// let it finish (the default), stop it (never the default), or keep it.
|
|
592
|
+
struct CloseConfirm: View {
|
|
593
|
+
let row: RequestsModel.Row
|
|
594
|
+
/// Tab moved the keyboard to Stop.
|
|
595
|
+
let onStop: Bool
|
|
596
|
+
let choose: (RequestsModel.CloseChoice) -> Void
|
|
597
|
+
|
|
598
|
+
var body: some View {
|
|
599
|
+
VStack(alignment: .leading, spacing: 4) {
|
|
600
|
+
Text(OpenRequests.stillThinking(name: row.name))
|
|
601
|
+
.font(.system(size: 12.5, weight: .semibold))
|
|
602
|
+
.lineLimit(1)
|
|
603
|
+
HStack(spacing: 6) {
|
|
604
|
+
Button(OpenRequests.letItFinish) { choose(.letItFinish) }
|
|
605
|
+
.buttonStyle(.borderedProminent)
|
|
606
|
+
.tint(onStop ? Color.secondary : RequestRow.blue)
|
|
607
|
+
Button(OpenRequests.stopAgent(name: row.name)) { choose(.stop) }
|
|
608
|
+
.buttonStyle(.bordered)
|
|
609
|
+
.overlay(RoundedRectangle(cornerRadius: 6).strokeBorder(RequestRow.red, lineWidth: onStop ? 2 : 0))
|
|
610
|
+
Button(OpenRequests.keep) { choose(.keep) }
|
|
611
|
+
.buttonStyle(.bordered)
|
|
612
|
+
}
|
|
613
|
+
.controlSize(.small)
|
|
614
|
+
.font(.system(size: 11.5))
|
|
615
|
+
}
|
|
616
|
+
.padding(.horizontal, 8)
|
|
617
|
+
.frame(maxWidth: .infinity, minHeight: 52, maxHeight: 52, alignment: .leading)
|
|
618
|
+
.background(RoundedRectangle(cornerRadius: 10, style: .continuous).fill(Color.primary.opacity(0.06)))
|
|
619
|
+
.accessibilityElement(children: .contain)
|
|
620
|
+
.accessibilityLabel(OpenRequests.stillThinking(name: row.name))
|
|
305
621
|
}
|
|
306
622
|
}
|
|
307
623
|
|
|
@@ -313,6 +629,8 @@ struct RequestRow: View {
|
|
|
313
629
|
/// The keyboard is on this row.
|
|
314
630
|
let ring: Bool
|
|
315
631
|
let pick: () -> Void
|
|
632
|
+
/// The × on hover and on the keyboard's row.
|
|
633
|
+
let close: () -> Void
|
|
316
634
|
@State private var hovering = false
|
|
317
635
|
|
|
318
636
|
/// The "not heard" blue, lighter in dark so it reads on the dark pill.
|
|
@@ -354,9 +672,21 @@ struct RequestRow: View {
|
|
|
354
672
|
.truncationMode(.tail)
|
|
355
673
|
}
|
|
356
674
|
Spacer(minLength: 4)
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
675
|
+
if (hovering || selected) && row.agent == nil {
|
|
676
|
+
Button(action: close) {
|
|
677
|
+
Image(systemName: "xmark")
|
|
678
|
+
.font(.system(size: 10, weight: .bold))
|
|
679
|
+
.frame(width: 20, height: 20)
|
|
680
|
+
.background(Circle().fill(Color.primary.opacity(0.08)))
|
|
681
|
+
}
|
|
682
|
+
.buttonStyle(.plain)
|
|
683
|
+
.help("Close (⌘⌫)")
|
|
684
|
+
.accessibilityLabel("Close")
|
|
685
|
+
} else {
|
|
686
|
+
Text(row.ago)
|
|
687
|
+
.font(.system(size: 11))
|
|
688
|
+
.foregroundStyle(.secondary)
|
|
689
|
+
}
|
|
360
690
|
}
|
|
361
691
|
.padding(.horizontal, 8)
|
|
362
692
|
.frame(maxWidth: .infinity, minHeight: 52, maxHeight: 52, alignment: .leading)
|
|
@@ -374,6 +704,7 @@ struct RequestRow: View {
|
|
|
374
704
|
if let action = row.action {
|
|
375
705
|
Button(action, action: pick)
|
|
376
706
|
}
|
|
707
|
+
if row.agent == nil { Button("Close", action: close) }
|
|
377
708
|
}
|
|
378
709
|
}
|
|
379
710
|
|
|
@@ -387,6 +387,33 @@ private struct GeneralTab: View {
|
|
|
387
387
|
: Binding(get: { model.draft?.general.animations ?? "off" },
|
|
388
388
|
set: { model.draft?.general.animations = $0 }))
|
|
389
389
|
}
|
|
390
|
+
if draft.general.answers != nil {
|
|
391
|
+
Section {
|
|
392
|
+
Picker("When an answer is ready", selection: Binding(
|
|
393
|
+
get: { model.draft?.general.answers ?? "wait" },
|
|
394
|
+
set: { model.draft?.general.answers = $0 })) {
|
|
395
|
+
Text("Wait until I pick it").tag("wait")
|
|
396
|
+
Text("Play it at once").tag("play")
|
|
397
|
+
}
|
|
398
|
+
if let sounds = draft.general.readySounds, !sounds.isEmpty {
|
|
399
|
+
// Picking one plays it once, so the choice is heard.
|
|
400
|
+
Picker("Soft sound", selection: Binding(
|
|
401
|
+
get: { model.draft?.general.readySound ?? "Pop" },
|
|
402
|
+
set: { model.draft?.general.readySound = $0; NSSound(named: $0)?.play() })) {
|
|
403
|
+
ForEach(sounds, id: \.self) { Text($0).tag($0) }
|
|
404
|
+
}
|
|
405
|
+
.disabled((model.draft?.general.answers ?? "wait") != "wait")
|
|
406
|
+
}
|
|
407
|
+
Toggle("Open the list on hover", isOn: Binding(
|
|
408
|
+
get: { model.draft?.general.listOnHover ?? true },
|
|
409
|
+
set: { model.draft?.general.listOnHover = $0 }))
|
|
410
|
+
} header: {
|
|
411
|
+
Text("Answers")
|
|
412
|
+
} footer: {
|
|
413
|
+
Text("Waiting: a soft sound and a blue dot, and the answer plays when you pick it in the open-requests list (⌘⌥O). Off for hover: only a click or ⌘⌥O opens the list.")
|
|
414
|
+
.font(.caption).foregroundStyle(.secondary)
|
|
415
|
+
}
|
|
416
|
+
}
|
|
390
417
|
if draft.general.card != nil {
|
|
391
418
|
AnswerCardSection(card: Binding(get: { model.draft?.general.card ?? .standard },
|
|
392
419
|
set: { model.draft?.general.card = $0 }))
|
|
@@ -45,6 +45,13 @@ final class StatusMenu: NSObject, NSMenuDelegate {
|
|
|
45
45
|
var shortcut: (String) -> String? = { _ in nil }
|
|
46
46
|
/// "Open requests…": the list, with the keyboard in it.
|
|
47
47
|
var onOpenRequests: (() -> Void)?
|
|
48
|
+
/// voice.answers is "play": answers play as soon as they are back.
|
|
49
|
+
/// Set by the app from the daemon's settings.
|
|
50
|
+
var playsAnswersAtOnce = false {
|
|
51
|
+
didSet { if playsAnswersAtOnce != oldValue { rebuild() } }
|
|
52
|
+
}
|
|
53
|
+
/// "Play answers at once" ticked or unticked: the app saves it.
|
|
54
|
+
var onPlayAtOnce: ((Bool) -> Void)?
|
|
48
55
|
|
|
49
56
|
/// Set by the app.
|
|
50
57
|
var onStop: (() -> Void)?
|
|
@@ -265,7 +272,7 @@ final class StatusMenu: NSObject, NSMenuDelegate {
|
|
|
265
272
|
// Answers wait as "not heard" until picked (#1455); ticked, they play
|
|
266
273
|
// as soon as they are back, as before.
|
|
267
274
|
let atOnce = action("Play answers at once", #selector(togglePlayAtOnce), key: "")
|
|
268
|
-
atOnce.state =
|
|
275
|
+
atOnce.state = playsAnswersAtOnce ? .on : .off
|
|
269
276
|
menu.addItem(atOnce)
|
|
270
277
|
if let held = floor.menuTitle(now: Date().timeIntervalSince1970) {
|
|
271
278
|
menu.addItem(disabled(held))
|
|
@@ -343,7 +350,15 @@ final class StatusMenu: NSObject, NSMenuDelegate {
|
|
|
343
350
|
|
|
344
351
|
@objc private func stop() { onStop?() }
|
|
345
352
|
@objc private func openRequests() { onOpenRequests?() }
|
|
346
|
-
@objc private func togglePlayAtOnce() {
|
|
353
|
+
@objc private func togglePlayAtOnce() { onPlayAtOnce?(!playsAnswersAtOnce) }
|
|
354
|
+
|
|
355
|
+
/// Talk to `id` from now on, as picking it in the menu does.
|
|
356
|
+
func choose(_ id: String) {
|
|
357
|
+
guard id != Config.effectiveAgentID else { return }
|
|
358
|
+
Config.chosenAgentID = id
|
|
359
|
+
onTargetChanged?(id)
|
|
360
|
+
rebuild()
|
|
361
|
+
}
|
|
347
362
|
@objc private func takeFloorBack() { onTakeFloorBack?() }
|
|
348
363
|
|
|
349
364
|
@objc private func toggleHold() {
|
|
@@ -39,14 +39,29 @@ struct VoiceSettings: Codable, Equatable {
|
|
|
39
39
|
/// "off", "rarely", "sometimes" or "often". Nil from a daemon
|
|
40
40
|
/// older than the animations.
|
|
41
41
|
var animations: String?
|
|
42
|
+
/// When an answer is ready (#1455): "wait" until it is picked, or
|
|
43
|
+
/// "play" at once. Nil from a daemon older than the open-requests
|
|
44
|
+
/// list: the app waits.
|
|
45
|
+
var answers: String?
|
|
46
|
+
/// The Mac sound played once when an answer is ready and waits,
|
|
47
|
+
/// and the sounds it may be. Nil from an older daemon: "Pop".
|
|
48
|
+
var readySound: String?
|
|
49
|
+
var readySounds: [String]?
|
|
50
|
+
/// Half a second's hover on the pill opens the open-requests list.
|
|
51
|
+
/// Nil from an older daemon: on.
|
|
52
|
+
var listOnHover: Bool?
|
|
42
53
|
|
|
43
54
|
init(provider: String, fallback: String, stt: String, localStt: String = "mlx-whisper",
|
|
44
55
|
endOfTurn: String = "vad", hotkeys: Hotkeys, card: Card? = nil, look: String? = nil,
|
|
45
|
-
startReduced: Bool? = nil, stroll: Bool? = nil, animations: String? = nil
|
|
56
|
+
startReduced: Bool? = nil, stroll: Bool? = nil, animations: String? = nil,
|
|
57
|
+
answers: String? = nil, readySound: String? = nil, readySounds: [String]? = nil,
|
|
58
|
+
listOnHover: Bool? = nil) {
|
|
46
59
|
self.provider = provider; self.fallback = fallback; self.stt = stt
|
|
47
60
|
self.localStt = localStt; self.endOfTurn = endOfTurn; self.hotkeys = hotkeys
|
|
48
61
|
self.card = card; self.look = look; self.startReduced = startReduced
|
|
49
62
|
self.stroll = stroll; self.animations = animations
|
|
63
|
+
self.answers = answers; self.listOnHover = listOnHover
|
|
64
|
+
self.readySound = readySound; self.readySounds = readySounds
|
|
50
65
|
}
|
|
51
66
|
|
|
52
67
|
/// A daemon from before these fields leaves them out: the defaults.
|
|
@@ -63,6 +78,10 @@ struct VoiceSettings: Codable, Equatable {
|
|
|
63
78
|
startReduced = try c.decodeIfPresent(Bool.self, forKey: .startReduced)
|
|
64
79
|
stroll = try c.decodeIfPresent(Bool.self, forKey: .stroll)
|
|
65
80
|
animations = try c.decodeIfPresent(String.self, forKey: .animations)
|
|
81
|
+
answers = try c.decodeIfPresent(String.self, forKey: .answers)
|
|
82
|
+
readySound = try c.decodeIfPresent(String.self, forKey: .readySound)
|
|
83
|
+
readySounds = try c.decodeIfPresent([String].self, forKey: .readySounds)
|
|
84
|
+
listOnHover = try c.decodeIfPresent(Bool.self, forKey: .listOnHover)
|
|
66
85
|
}
|
|
67
86
|
}
|
|
68
87
|
struct Voice: Codable, Equatable {
|
|
@@ -125,6 +144,9 @@ struct VoiceSettings: Codable, Equatable {
|
|
|
125
144
|
if let start = self.general.startReduced, start != old.general.startReduced { general["startReduced"] = start }
|
|
126
145
|
if let stroll = self.general.stroll, stroll != old.general.stroll { general["stroll"] = stroll }
|
|
127
146
|
if let often = self.general.animations, often != old.general.animations { general["animations"] = often }
|
|
147
|
+
if let answers = self.general.answers, answers != old.general.answers { general["answers"] = answers }
|
|
148
|
+
if let sound = self.general.readySound, sound != old.general.readySound { general["readySound"] = sound }
|
|
149
|
+
if let hover = self.general.listOnHover, hover != old.general.listOnHover { general["listOnHover"] = hover }
|
|
128
150
|
var keys: [String: Any] = [:]
|
|
129
151
|
if self.general.hotkeys.talk != old.general.hotkeys.talk { keys["talk"] = self.general.hotkeys.talk }
|
|
130
152
|
if self.general.hotkeys.stop != old.general.hotkeys.stop { keys["stop"] = self.general.hotkeys.stop }
|