agentix-cli 0.192.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 +3 -3
- 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-N6WWCFBO.js → App-HBM52GXI.js} +2 -2
- package/dist/{ChatApp-JMSINKZP.js → ChatApp-N4P7M2TD.js} +2 -2
- package/dist/{absorb-eval-4LJ4R7GN.js → absorb-eval-HRWWPKT3.js} +2 -2
- package/dist/{adapter-2Y3PQ5IZ.js → adapter-X6T3YBUB.js} +2 -2
- package/dist/{agent-RSOKWOZ2.js → agent-3B4RMEDI.js} +2 -2
- package/dist/{board-dashboard-M3HOVCLM.js → board-dashboard-YCRGMNAT.js} +3668 -7064
- package/dist/board-dashboard-YCRGMNAT.js.map +1 -0
- package/dist/{chunk-4IHQSNE3.js → chunk-2GCPSAXQ.js} +2 -2
- package/dist/{chunk-PNWXXDTE.js → chunk-2KYGPVTX.js} +2 -2
- package/dist/chunk-3FZ6WHKX.js +2 -0
- package/dist/chunk-3FZ6WHKX.js.map +1 -0
- package/dist/{chunk-RZS4BHCW.js → chunk-6NQ7KYJH.js} +2 -2
- package/dist/{chunk-BSMT7MK4.js → chunk-7L54Z4EH.js} +2 -2
- package/dist/{chunk-WWFMIAYZ.js → chunk-BOCLWYWL.js} +2 -2
- package/dist/chunk-F2FJXKDG.js +7 -0
- package/dist/{chunk-Y7HU4GHT.js.map → chunk-F2FJXKDG.js.map} +1 -1
- package/dist/{chunk-OPBPH7IB.js → chunk-F3CMNSON.js} +2 -2
- package/dist/{chunk-6FHKA62Y.js → chunk-FO762MEC.js} +2 -2
- package/dist/{chunk-5XGQE2SN.js → chunk-HNZEXUNM.js} +2 -2
- package/dist/{chunk-RZPQML3W.js → chunk-HOZZUN47.js} +2 -2
- package/dist/chunk-HPRLRD4P.js +6 -0
- package/dist/chunk-HPRLRD4P.js.map +1 -0
- package/dist/chunk-I45E5TLK.js +934 -0
- package/dist/chunk-I45E5TLK.js.map +1 -0
- package/dist/{chunk-VGQDLAX3.js → chunk-K2BEV3BD.js} +2 -2
- package/dist/chunk-KE6BF4ZJ.js +2 -0
- package/dist/chunk-KE6BF4ZJ.js.map +1 -0
- package/dist/{chunk-2HPVL6UM.js → chunk-KXJRXRSD.js} +2 -2
- package/dist/{chunk-HNTWVZMH.js → chunk-LQIF2OHS.js} +2 -2
- package/dist/chunk-M2E3CNFS.js +38 -0
- package/dist/chunk-M2E3CNFS.js.map +1 -0
- package/dist/chunk-MB5CBY2C.js +189 -0
- package/dist/chunk-MB5CBY2C.js.map +1 -0
- package/dist/{chunk-QQTSGXFB.js → chunk-MC3ZZA5G.js} +2 -2
- package/dist/{chunk-2FCYIEKT.js → chunk-OEG476JY.js} +94 -91
- package/dist/chunk-OEG476JY.js.map +1 -0
- package/dist/chunk-P6WSD2UR.js +116 -0
- package/dist/chunk-P6WSD2UR.js.map +1 -0
- package/dist/{chunk-7NXFW4LM.js → chunk-PMSL4A5Y.js} +3 -3
- package/dist/{chunk-KZPZ2O2F.js → chunk-PO2SORKY.js} +36 -36
- package/dist/chunk-PO2SORKY.js.map +1 -0
- package/dist/{chunk-6DGMUN2Q.js → chunk-PX7PWXBI.js} +2 -2
- package/dist/{chunk-UUQ2AHUL.js → chunk-RW5FKJRE.js} +2 -2
- package/dist/{chunk-BZ2HOV4M.js → chunk-S42KBXNO.js} +332 -317
- package/dist/chunk-S42KBXNO.js.map +1 -0
- package/dist/{chunk-54LKUDJZ.js → chunk-UOIWIVU3.js} +2 -2
- package/dist/{chunk-JW3ZHQ7U.js → chunk-VX4PSOKU.js} +2 -2
- package/dist/{chunk-VG3NUHJX.js → chunk-XH36J3Z2.js} +2 -2
- package/dist/{chunk-FFPF7SAD.js → chunk-ZALVAXQ4.js} +2 -2
- package/dist/cli.js +1 -1
- package/dist/{client-CFS5VY26.js → client-YN3T56NM.js} +2 -2
- package/dist/{config-4R6DCRCN.js → config-G7T3TMWE.js} +2 -2
- package/dist/{config-mutate-EG5PS7KW.js → config-mutate-6CRKZQVQ.js} +2 -2
- package/dist/config-mutator-7VS3J5BY.js +2 -0
- package/dist/{contributions-G4FZ2PKZ.js → contributions-6VZ4OXJ5.js} +2 -2
- package/dist/{doctor-4VQ5RFWH.js → doctor-GFZZTK7C.js} +2 -2
- package/dist/{follow-up-tool-JJSFOO5D.js → follow-up-tool-NVP56W7E.js} +2 -2
- package/dist/{hub-Z3KDKP7M.js → hub-B434CABZ.js} +2 -2
- package/dist/index.d.ts +119 -7
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/{program-6UF4K6CK.js → program-IDRN5TAM.js} +255 -255
- package/dist/program-IDRN5TAM.js.map +1 -0
- package/dist/{promote-WJ5HXGJG.js → promote-3P6PGJOW.js} +2 -2
- package/dist/{query-7JPB2UBE.js → query-E4V7TS5S.js} +2 -2
- package/dist/query-runs-AENEZOM6.js +2 -0
- package/dist/{query-settings-O53GJRCB.js → query-settings-C5UBKJMN.js} +2 -2
- package/dist/registry-IG324PR3.js +2 -0
- package/dist/{request-planner-25WOUCP7.js → request-planner-G6IAUMSE.js} +2 -2
- package/dist/{review-candidates-KU3B6T5E.js → review-candidates-ZL2SJXWC.js} +2 -2
- package/dist/{routing-SJQB4SJM.js → routing-2IBIZYQU.js} +2 -2
- package/dist/schedule-tool-QCTT2R3B.js +2 -0
- package/dist/{scheduler-W3TMCBUH.js → scheduler-ZGB7IKZQ.js} +2 -2
- package/dist/{seat-NDZLFK4N.js → seat-CFY7LMPS.js} +2 -2
- package/dist/{select-3D3GZOBS.js → select-MU52ACKG.js} +2 -2
- package/dist/self-ELWZIMVY.js +2 -0
- package/dist/{set-enabled-ZUTWWK5S.js → set-enabled-XRNSYEI3.js} +2 -2
- package/dist/{sprint-tool-CAARUDXM.js → sprint-tool-E4MABD2N.js} +2 -2
- package/dist/{tool-3UIRQJZF.js → tool-V5Z4KWK7.js} +2 -2
- package/dist/{tool-HK7VOPB3.js → tool-W6M7GYRZ.js} +2 -2
- package/dist/{tool-GKPYCNZ3.js → tool-ZYVT4VUU.js} +2 -2
- package/dist/{wiki-F4YT226F.js → wiki-VP6XRWIS.js} +2 -2
- package/dist/wiki-enrich-LUFXPUYY.js +2 -0
- package/dist/wiki-enrich-LUFXPUYY.js.map +1 -0
- package/package.json +1 -1
- package/dist/board-dashboard-M3HOVCLM.js.map +0 -1
- package/dist/chunk-2FCYIEKT.js.map +0 -1
- package/dist/chunk-BZ2HOV4M.js.map +0 -1
- package/dist/chunk-CXAKD7XW.js +0 -114
- package/dist/chunk-CXAKD7XW.js.map +0 -1
- package/dist/chunk-CZMVJP7O.js +0 -2
- package/dist/chunk-CZMVJP7O.js.map +0 -1
- package/dist/chunk-E3UQEMNV.js +0 -188
- package/dist/chunk-E3UQEMNV.js.map +0 -1
- package/dist/chunk-JNJVRSOL.js +0 -36
- package/dist/chunk-JNJVRSOL.js.map +0 -1
- package/dist/chunk-KZPZ2O2F.js.map +0 -1
- package/dist/chunk-ORBEL4I4.js +0 -888
- package/dist/chunk-ORBEL4I4.js.map +0 -1
- package/dist/chunk-Y7HU4GHT.js +0 -7
- package/dist/config-mutator-YDVTCBQZ.js +0 -2
- package/dist/program-6UF4K6CK.js.map +0 -1
- package/dist/query-runs-VXS572PQ.js +0 -6
- package/dist/query-runs-VXS572PQ.js.map +0 -1
- package/dist/registry-WNKSI445.js +0 -2
- package/dist/schedule-tool-T6FHG77E.js +0 -2
- package/dist/self-SO6GCVYD.js +0 -2
- package/dist/wiki-enrich-E6YYAI2T.js +0 -2
- /package/dist/{App-N6WWCFBO.js.map → App-HBM52GXI.js.map} +0 -0
- /package/dist/{ChatApp-JMSINKZP.js.map → ChatApp-N4P7M2TD.js.map} +0 -0
- /package/dist/{absorb-eval-4LJ4R7GN.js.map → absorb-eval-HRWWPKT3.js.map} +0 -0
- /package/dist/{adapter-2Y3PQ5IZ.js.map → adapter-X6T3YBUB.js.map} +0 -0
- /package/dist/{agent-RSOKWOZ2.js.map → agent-3B4RMEDI.js.map} +0 -0
- /package/dist/{chunk-4IHQSNE3.js.map → chunk-2GCPSAXQ.js.map} +0 -0
- /package/dist/{chunk-PNWXXDTE.js.map → chunk-2KYGPVTX.js.map} +0 -0
- /package/dist/{chunk-RZS4BHCW.js.map → chunk-6NQ7KYJH.js.map} +0 -0
- /package/dist/{chunk-BSMT7MK4.js.map → chunk-7L54Z4EH.js.map} +0 -0
- /package/dist/{chunk-WWFMIAYZ.js.map → chunk-BOCLWYWL.js.map} +0 -0
- /package/dist/{chunk-OPBPH7IB.js.map → chunk-F3CMNSON.js.map} +0 -0
- /package/dist/{chunk-6FHKA62Y.js.map → chunk-FO762MEC.js.map} +0 -0
- /package/dist/{chunk-5XGQE2SN.js.map → chunk-HNZEXUNM.js.map} +0 -0
- /package/dist/{chunk-RZPQML3W.js.map → chunk-HOZZUN47.js.map} +0 -0
- /package/dist/{chunk-VGQDLAX3.js.map → chunk-K2BEV3BD.js.map} +0 -0
- /package/dist/{chunk-2HPVL6UM.js.map → chunk-KXJRXRSD.js.map} +0 -0
- /package/dist/{chunk-HNTWVZMH.js.map → chunk-LQIF2OHS.js.map} +0 -0
- /package/dist/{chunk-QQTSGXFB.js.map → chunk-MC3ZZA5G.js.map} +0 -0
- /package/dist/{chunk-7NXFW4LM.js.map → chunk-PMSL4A5Y.js.map} +0 -0
- /package/dist/{chunk-6DGMUN2Q.js.map → chunk-PX7PWXBI.js.map} +0 -0
- /package/dist/{chunk-UUQ2AHUL.js.map → chunk-RW5FKJRE.js.map} +0 -0
- /package/dist/{chunk-54LKUDJZ.js.map → chunk-UOIWIVU3.js.map} +0 -0
- /package/dist/{chunk-JW3ZHQ7U.js.map → chunk-VX4PSOKU.js.map} +0 -0
- /package/dist/{chunk-VG3NUHJX.js.map → chunk-XH36J3Z2.js.map} +0 -0
- /package/dist/{chunk-FFPF7SAD.js.map → chunk-ZALVAXQ4.js.map} +0 -0
- /package/dist/{client-CFS5VY26.js.map → client-YN3T56NM.js.map} +0 -0
- /package/dist/{config-4R6DCRCN.js.map → config-G7T3TMWE.js.map} +0 -0
- /package/dist/{config-mutate-EG5PS7KW.js.map → config-mutate-6CRKZQVQ.js.map} +0 -0
- /package/dist/{config-mutator-YDVTCBQZ.js.map → config-mutator-7VS3J5BY.js.map} +0 -0
- /package/dist/{contributions-G4FZ2PKZ.js.map → contributions-6VZ4OXJ5.js.map} +0 -0
- /package/dist/{doctor-4VQ5RFWH.js.map → doctor-GFZZTK7C.js.map} +0 -0
- /package/dist/{follow-up-tool-JJSFOO5D.js.map → follow-up-tool-NVP56W7E.js.map} +0 -0
- /package/dist/{hub-Z3KDKP7M.js.map → hub-B434CABZ.js.map} +0 -0
- /package/dist/{promote-WJ5HXGJG.js.map → promote-3P6PGJOW.js.map} +0 -0
- /package/dist/{query-7JPB2UBE.js.map → query-E4V7TS5S.js.map} +0 -0
- /package/dist/{registry-WNKSI445.js.map → query-runs-AENEZOM6.js.map} +0 -0
- /package/dist/{query-settings-O53GJRCB.js.map → query-settings-C5UBKJMN.js.map} +0 -0
- /package/dist/{routing-SJQB4SJM.js.map → registry-IG324PR3.js.map} +0 -0
- /package/dist/{request-planner-25WOUCP7.js.map → request-planner-G6IAUMSE.js.map} +0 -0
- /package/dist/{review-candidates-KU3B6T5E.js.map → review-candidates-ZL2SJXWC.js.map} +0 -0
- /package/dist/{schedule-tool-T6FHG77E.js.map → routing-2IBIZYQU.js.map} +0 -0
- /package/dist/{scheduler-W3TMCBUH.js.map → schedule-tool-QCTT2R3B.js.map} +0 -0
- /package/dist/{seat-NDZLFK4N.js.map → scheduler-ZGB7IKZQ.js.map} +0 -0
- /package/dist/{self-SO6GCVYD.js.map → seat-CFY7LMPS.js.map} +0 -0
- /package/dist/{select-3D3GZOBS.js.map → select-MU52ACKG.js.map} +0 -0
- /package/dist/{wiki-F4YT226F.js.map → self-ELWZIMVY.js.map} +0 -0
- /package/dist/{set-enabled-ZUTWWK5S.js.map → set-enabled-XRNSYEI3.js.map} +0 -0
- /package/dist/{sprint-tool-CAARUDXM.js.map → sprint-tool-E4MABD2N.js.map} +0 -0
- /package/dist/{tool-3UIRQJZF.js.map → tool-V5Z4KWK7.js.map} +0 -0
- /package/dist/{tool-HK7VOPB3.js.map → tool-W6M7GYRZ.js.map} +0 -0
- /package/dist/{tool-GKPYCNZ3.js.map → tool-ZYVT4VUU.js.map} +0 -0
- /package/dist/{wiki-enrich-E6YYAI2T.js.map → wiki-VP6XRWIS.js.map} +0 -0
package/README.md
CHANGED
|
@@ -66,7 +66,7 @@ What it costs depends on your model account (a Claude subscription, or an API ke
|
|
|
66
66
|
|
|
67
67
|
**First result you can see.** **Terminal:** `agentx content drafts` lists one draft per planned post, each with the past posts it followed.
|
|
68
68
|
|
|
69
|
-

|
|
70
70
|
|
|
71
71
|
[Draft posts in your voice](docs/jobs/content.md)
|
|
72
72
|
|
|
@@ -112,9 +112,9 @@ What it costs depends on your model account (a Claude subscription, or an API ke
|
|
|
112
112
|
|
|
113
113
|
**What it costs.** Nothing: counting and caps run on your machine.
|
|
114
114
|
|
|
115
|
-
**First result you can see.** **Browser:** open your dashboard and select **Cost** in the
|
|
115
|
+
**First result you can see.** **Browser:** open your dashboard and select **Cost** in the Hub's nav. Each agent's row shows its spend against its cap, and **Monthly budgets** shows all agents, each project and each capped agent.
|
|
116
116
|
|
|
117
|
-

|
|
118
118
|
|
|
119
119
|
[Set a monthly budget](docs/help/costs.md#set-a-monthly-budget-for-an-agent)
|
|
120
120
|
|
|
@@ -14,11 +14,20 @@ import AppKit
|
|
|
14
14
|
/// {"cmd":"say","text":"The export button is top right."}
|
|
15
15
|
/// {"cmd":"clear"} drop the highlight
|
|
16
16
|
/// {"cmd":"park"} return beside the person's own pointer, no highlight
|
|
17
|
+
/// {"cmd":"wait","seconds":45} the owner waits on the person: Skip and
|
|
18
|
+
/// a countdown on the tag; 0 takes them away
|
|
17
19
|
/// {"cmd":"ping"} nothing; keeps an idle overlay alive
|
|
18
20
|
///
|
|
19
21
|
/// and reports on stdout what the person did to it, one JSON object per line:
|
|
20
22
|
///
|
|
21
23
|
/// {"event":"dismiss"} the × on the name tag was clicked; it then fades out
|
|
24
|
+
/// {"event":"skip"} Skip was clicked: the owner stops waiting
|
|
25
|
+
///
|
|
26
|
+
/// The arrow rests (#1591): `--rest` seconds after its last move or wait
|
|
27
|
+
/// it fades out with its highlight, and comes back on the next move. A
|
|
28
|
+
/// park while resting moves it unseen. The tag stays, so the × and Skip
|
|
29
|
+
/// are always there to use. `--tag-only` draws no arrow at all, only the
|
|
30
|
+
/// tag: the controls of a lesson whose pointer is the character.
|
|
22
31
|
///
|
|
23
32
|
/// Coordinates are accessibility coordinates (top-left origin, global),
|
|
24
33
|
/// the same as `read`, `ocr` and `point`.
|
|
@@ -137,14 +146,21 @@ enum Presence {
|
|
|
137
146
|
let ring: NSPanel
|
|
138
147
|
let color: NSColor
|
|
139
148
|
let posFile: String?
|
|
149
|
+
let tagOnly: Bool
|
|
150
|
+
/// Seconds after the last move or wait before the arrow rests; 0 never.
|
|
151
|
+
let rest: TimeInterval
|
|
152
|
+
var lastAction = Date()
|
|
153
|
+
private(set) var resting = false
|
|
140
154
|
var at: CGPoint // tip position, AppKit coordinates
|
|
141
155
|
/// The tag's top-left once the person has dragged it; nil rides with the arrow.
|
|
142
156
|
var pinned: NSPoint?
|
|
143
157
|
var timer: Timer?
|
|
144
158
|
|
|
145
|
-
init(color: NSColor, initial: String, name: String, posFile: String
|
|
159
|
+
init(color: NSColor, initial: String, name: String, posFile: String?, tagOnly: Bool = false, rest: TimeInterval = 0) {
|
|
146
160
|
self.color = color
|
|
147
161
|
self.posFile = posFile
|
|
162
|
+
self.tagOnly = tagOnly
|
|
163
|
+
self.rest = rest
|
|
148
164
|
arrow = Presence.panel(NSRect(origin: .zero, size: ArrowView.size))
|
|
149
165
|
arrow.contentView = ArrowView(color: color)
|
|
150
166
|
tag = PresenceTag(color: color, initial: initial, name: name)
|
|
@@ -168,17 +184,47 @@ enum Presence {
|
|
|
168
184
|
self.place(self.at)
|
|
169
185
|
}
|
|
170
186
|
place(at)
|
|
171
|
-
for p in [arrow, tagPanel] {
|
|
187
|
+
for p in tagOnly ? [tagPanel] : [arrow, tagPanel] {
|
|
172
188
|
p.alphaValue = 0
|
|
173
189
|
p.orderFrontRegardless()
|
|
174
190
|
}
|
|
175
191
|
NSAnimationContext.runAnimationGroup { ctx in
|
|
176
192
|
ctx.duration = 0.2
|
|
177
|
-
arrow.animator().alphaValue = 1
|
|
193
|
+
if !tagOnly { arrow.animator().alphaValue = 1 }
|
|
178
194
|
tagPanel.animator().alphaValue = 1
|
|
179
195
|
}
|
|
180
196
|
}
|
|
181
197
|
|
|
198
|
+
/// Top centre of the main screen, below a window's tab bar and
|
|
199
|
+
/// toolbar so it covers neither: where a tag with no arrow to ride
|
|
200
|
+
/// sits until it is dragged.
|
|
201
|
+
static func topCentre(width: CGFloat) -> NSPoint {
|
|
202
|
+
let v = NSScreen.main?.visibleFrame ?? NSRect(x: 0, y: 0, width: 1440, height: 900)
|
|
203
|
+
return NSPoint(x: v.midX - width / 2, y: v.maxY - 96)
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/// No move or wait for `rest` seconds: the arrow and its highlight
|
|
207
|
+
/// fade out. The overlay stays, and so does the tag.
|
|
208
|
+
func restIfIdle() {
|
|
209
|
+
guard !tagOnly, rest > 0, !resting, Date().timeIntervalSince(lastAction) > rest else { return }
|
|
210
|
+
resting = true
|
|
211
|
+
ring.orderOut(nil)
|
|
212
|
+
NSAnimationContext.runAnimationGroup { ctx in
|
|
213
|
+
ctx.duration = 0.4
|
|
214
|
+
arrow.animator().alphaValue = 0
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
private func wake() {
|
|
219
|
+
lastAction = Date()
|
|
220
|
+
guard resting else { return }
|
|
221
|
+
resting = false
|
|
222
|
+
NSAnimationContext.runAnimationGroup { ctx in
|
|
223
|
+
ctx.duration = 0.2
|
|
224
|
+
arrow.animator().alphaValue = 1
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
182
228
|
/// Just below and right of the person's real pointer, so handing
|
|
183
229
|
/// back reads as returning to them, without covering their cursor.
|
|
184
230
|
static func parking() -> CGPoint {
|
|
@@ -192,6 +238,11 @@ enum Presence {
|
|
|
192
238
|
arrow.setFrameOrigin(NSPoint(x: tip.x - ArrowView.tip.x, y: tip.y - ArrowView.tip.y))
|
|
193
239
|
if tag.dragged { return }
|
|
194
240
|
let size = tagPanel.frame.size
|
|
241
|
+
if tagOnly {
|
|
242
|
+
let top = pinned ?? Controller.topCentre(width: size.width)
|
|
243
|
+
tagPanel.setFrameOrigin(NSPoint(x: top.x, y: top.y - size.height))
|
|
244
|
+
return
|
|
245
|
+
}
|
|
195
246
|
var top = pinned ?? NSPoint(x: tip.x + 20, y: tip.y - 26)
|
|
196
247
|
if pinned == nil {
|
|
197
248
|
// Near the right edge the tag sits to the left of the arrow.
|
|
@@ -230,7 +281,8 @@ enum Presence {
|
|
|
230
281
|
func handle(_ obj: [String: Any]) {
|
|
231
282
|
switch obj["cmd"] as? String {
|
|
232
283
|
case "move":
|
|
233
|
-
guard let x = obj["x"] as? Double, let y = obj["y"] as? Double else { return }
|
|
284
|
+
guard !tagOnly, let x = obj["x"] as? Double, let y = obj["y"] as? Double else { return }
|
|
285
|
+
wake()
|
|
234
286
|
let w = obj["w"] as? Double ?? 0, h = obj["h"] as? Double ?? 0
|
|
235
287
|
let rect = CGRect(x: x, y: y, width: w, height: h)
|
|
236
288
|
// Aim just inside the control's lower-left third, so the
|
|
@@ -244,8 +296,14 @@ enum Presence {
|
|
|
244
296
|
case "clear":
|
|
245
297
|
highlight(nil)
|
|
246
298
|
case "park":
|
|
299
|
+
guard !tagOnly else { return }
|
|
300
|
+
// Resting, it goes back unseen: only a move shows it again.
|
|
247
301
|
highlight(nil)
|
|
248
302
|
glide(to: Controller.parking())
|
|
303
|
+
case "wait":
|
|
304
|
+
lastAction = Date()
|
|
305
|
+
tag.setWait(obj["seconds"] as? Double ?? 0)
|
|
306
|
+
place(at)
|
|
249
307
|
default:
|
|
250
308
|
break
|
|
251
309
|
}
|
|
@@ -271,10 +329,11 @@ enum Presence {
|
|
|
271
329
|
|
|
272
330
|
/// Read commands until stdin closes, the owner dies, or it goes idle.
|
|
273
331
|
static func run(name: String, initial: String, colorHex: String?, parent: pid_t?, idle: TimeInterval,
|
|
274
|
-
posFile: String? = nil) {
|
|
332
|
+
posFile: String? = nil, tagOnly: Bool = false, rest: TimeInterval = 0) {
|
|
275
333
|
let app = NSApplication.shared
|
|
276
334
|
app.setActivationPolicy(.accessory)
|
|
277
|
-
let ctl = Controller(color: color(hex: colorHex), initial: initial, name: name, posFile: posFile
|
|
335
|
+
let ctl = Controller(color: color(hex: colorHex), initial: initial, name: name, posFile: posFile,
|
|
336
|
+
tagOnly: tagOnly, rest: rest)
|
|
278
337
|
var lastCommand = Date()
|
|
279
338
|
var quitting = false
|
|
280
339
|
// Main thread only. The fade is a courtesy: exit follows regardless.
|
|
@@ -289,6 +348,11 @@ enum Presence {
|
|
|
289
348
|
FileHandle.standardOutput.write("{\"event\":\"dismiss\"}\n".data(using: .utf8)!)
|
|
290
349
|
quit()
|
|
291
350
|
}
|
|
351
|
+
ctl.tag.onSkip = {
|
|
352
|
+
FileHandle.standardOutput.write("{\"event\":\"skip\"}\n".data(using: .utf8)!)
|
|
353
|
+
}
|
|
354
|
+
// Checked often enough that the rest lands close to its second.
|
|
355
|
+
Timer.scheduledTimer(withTimeInterval: 0.5, repeats: true) { _ in ctl.restIfIdle() }
|
|
292
356
|
DispatchQueue(label: "tn.acme.agentx.presence.stdin").async {
|
|
293
357
|
while let line = readLine(strippingNewline: true) {
|
|
294
358
|
guard let data = line.data(using: .utf8),
|
|
@@ -8,6 +8,7 @@ import AppKit
|
|
|
8
8
|
///
|
|
9
9
|
/// drag anywhere move it; it stays there (pinned) for this agent
|
|
10
10
|
/// click × close: the owner ends what it was showing
|
|
11
|
+
/// click Skip while the owner waits on the person: stop waiting
|
|
11
12
|
/// double-click bubble dismiss the bubble for the rest of this overlay
|
|
12
13
|
/// double-click name unpin; it rides next to the arrow again
|
|
13
14
|
///
|
|
@@ -29,8 +30,15 @@ final class PresenceTag: NSView {
|
|
|
29
30
|
var onUnpin: (() -> Void)?
|
|
30
31
|
/// Called when the × in the badge row is clicked.
|
|
31
32
|
var onClose: (() -> Void)?
|
|
33
|
+
/// Called when Skip is clicked, while there is a wait to skip.
|
|
34
|
+
var onSkip: (() -> Void)?
|
|
32
35
|
/// A click that started on the × and has not moved: a close, not a drag.
|
|
33
36
|
private var pressingClose = false
|
|
37
|
+
private var pressingSkip = false
|
|
38
|
+
/// While the owner waits on the person: when the wait runs out. Skip
|
|
39
|
+
/// and the seconds left show in the badge row until then.
|
|
40
|
+
private var waitUntil: Date?
|
|
41
|
+
private var countdown: Timer?
|
|
34
42
|
/// A double-click on the bubble hides it; later lines stay hidden too.
|
|
35
43
|
private(set) var dismissed = false
|
|
36
44
|
|
|
@@ -61,9 +69,27 @@ final class PresenceTag: NSView {
|
|
|
61
69
|
|
|
62
70
|
private static let nameAttrs: [NSAttributedString.Key: Any] = [.font: NSFont.systemFont(ofSize: 11, weight: .semibold)]
|
|
63
71
|
private var nameWidth: CGFloat { (name as NSString).size(withAttributes: PresenceTag.nameAttrs).width + 14 }
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
private var
|
|
72
|
+
/// "Skip · 45s" is measured at its widest, so the row does not jitter.
|
|
73
|
+
private static let skipWidth: CGFloat = ("Skip · 88s" as NSString).size(withAttributes: nameAttrs).width + 14
|
|
74
|
+
private var skipShown: Bool { waitUntil != nil }
|
|
75
|
+
private var rowWidth: CGFloat { 24 + 4 + nameWidth + 4 + (skipShown ? PresenceTag.skipWidth + 4 : 0) + 18 }
|
|
76
|
+
/// Skip, right of the name pill, while there is a wait.
|
|
77
|
+
private var skipRect: NSRect { NSRect(x: 24 + 4 + nameWidth + 4, y: bounds.maxY - 24 + 3, width: PresenceTag.skipWidth, height: 18) }
|
|
78
|
+
/// The close button, at the end of the row.
|
|
79
|
+
private var closeRect: NSRect { NSRect(x: rowWidth - 18, y: bounds.maxY - 24 + 3, width: 18, height: 18) }
|
|
80
|
+
|
|
81
|
+
/// Show Skip and count down `seconds`; 0 or less hides them.
|
|
82
|
+
func setWait(_ seconds: Double) {
|
|
83
|
+
countdown?.invalidate()
|
|
84
|
+
countdown = nil
|
|
85
|
+
waitUntil = seconds > 0 ? Date().addingTimeInterval(seconds) : nil
|
|
86
|
+
if waitUntil != nil {
|
|
87
|
+
countdown = Timer.scheduledTimer(withTimeInterval: 1, repeats: true) { [weak self] _ in self?.needsDisplay = true }
|
|
88
|
+
}
|
|
89
|
+
refit()
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
private var secondsLeft: Int { max(0, Int((waitUntil?.timeIntervalSinceNow ?? 0).rounded(.up))) }
|
|
67
93
|
|
|
68
94
|
override var fittingSize: NSSize {
|
|
69
95
|
guard !box.isHidden else { return NSSize(width: rowWidth, height: PresenceTag.rowHeight) }
|
|
@@ -104,6 +130,14 @@ final class PresenceTag: NSView {
|
|
|
104
130
|
color.setFill(); NSBezierPath(roundedRect: pill, xRadius: 9, yRadius: 9).fill()
|
|
105
131
|
draw(name, in: pill, size: 11, weight: .semibold)
|
|
106
132
|
|
|
133
|
+
if skipShown {
|
|
134
|
+
let skip = skipRect
|
|
135
|
+
Brand.paper.setFill(); NSBezierPath(roundedRect: skip, xRadius: 9, yRadius: 9).fill()
|
|
136
|
+
color.setStroke()
|
|
137
|
+
let edge = NSBezierPath(roundedRect: skip.insetBy(dx: 0.75, dy: 0.75), xRadius: 8.25, yRadius: 8.25); edge.lineWidth = 1.5; edge.stroke()
|
|
138
|
+
draw("Skip · \(secondsLeft)s", in: skip, size: 11, weight: .semibold, color: color)
|
|
139
|
+
}
|
|
140
|
+
|
|
107
141
|
let close = closeRect
|
|
108
142
|
Brand.paper.setFill(); NSBezierPath(ovalIn: close).fill()
|
|
109
143
|
color.setStroke()
|
|
@@ -139,7 +173,9 @@ final class PresenceTag: NSView {
|
|
|
139
173
|
dragFrom = nil
|
|
140
174
|
return
|
|
141
175
|
}
|
|
142
|
-
|
|
176
|
+
let p = convert(event.locationInWindow, from: nil)
|
|
177
|
+
pressingClose = closeRect.insetBy(dx: -3, dy: -3).contains(p)
|
|
178
|
+
pressingSkip = skipShown && skipRect.insetBy(dx: -2, dy: -3).contains(p)
|
|
143
179
|
dragFrom = NSEvent.mouseLocation
|
|
144
180
|
windowFrom = window?.frame.origin ?? .zero
|
|
145
181
|
dragged = false
|
|
@@ -155,8 +191,9 @@ final class PresenceTag: NSView {
|
|
|
155
191
|
}
|
|
156
192
|
|
|
157
193
|
override func mouseUp(with event: NSEvent) {
|
|
158
|
-
defer { dragFrom = nil; dragged = false; pressingClose = false }
|
|
194
|
+
defer { dragFrom = nil; dragged = false; pressingClose = false; pressingSkip = false }
|
|
159
195
|
if pressingClose && !dragged { onClose?(); return }
|
|
196
|
+
if pressingSkip && !dragged { setWait(0); onSkip?(); return }
|
|
160
197
|
guard dragged, let w = window else { return }
|
|
161
198
|
onPin?(NSPoint(x: w.frame.minX, y: w.frame.maxY))
|
|
162
199
|
}
|
|
@@ -314,7 +314,8 @@ case "presence":
|
|
|
314
314
|
Presence.run(name: name, initial: flag("initial") ?? String(name.prefix(1)).uppercased(),
|
|
315
315
|
colorHex: flag("color"), parent: flag("parent").flatMap { pid_t($0) },
|
|
316
316
|
idle: flag("idle").flatMap { TimeInterval($0) } ?? 60,
|
|
317
|
-
posFile: flag("pos-file"))
|
|
317
|
+
posFile: flag("pos-file"), tagOnly: args.contains("--tag-only"),
|
|
318
|
+
rest: flag("rest").flatMap { TimeInterval($0) } ?? 0)
|
|
318
319
|
|
|
319
320
|
case "notify":
|
|
320
321
|
// A banner under AgentX Helper's name and icon. Exit 2 means macOS has
|
|
@@ -269,7 +269,8 @@ enum AgentClient {
|
|
|
269
269
|
}
|
|
270
270
|
|
|
271
271
|
/// `handsFree`: the microphone had opened by itself, no key held.
|
|
272
|
-
|
|
272
|
+
/// `request`: the open-requests row on the daemon this answers (#1455).
|
|
273
|
+
static func ask(_ message: String, agent: String, handsFree: Bool = false, request: String? = nil) async throws -> Answer {
|
|
273
274
|
var req = URLRequest(url: URL(string: "\(Config.daemonURL)/ask")!)
|
|
274
275
|
req.httpMethod = "POST"
|
|
275
276
|
// An agent turn routinely takes minutes. The default 60s would cut
|
|
@@ -280,9 +281,16 @@ enum AgentClient {
|
|
|
280
281
|
// No agent known: the daemon answers with its default agent.
|
|
281
282
|
if !agent.isEmpty { payload["agent"] = agent }
|
|
282
283
|
if handsFree { payload["handsFree"] = true }
|
|
284
|
+
if let request { payload["request"] = request }
|
|
283
285
|
req.httpBody = try JSONSerialization.data(withJSONObject: payload)
|
|
284
286
|
|
|
285
287
|
let (data, response) = try await URLSession.shared.data(for: req)
|
|
288
|
+
return try answer(from: data, status: (response as? HTTPURLResponse)?.statusCode)
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/// An /ask reply as the app uses it. Also reads the reply the daemon
|
|
292
|
+
/// kept for an open request (GET /voice/requests/:id).
|
|
293
|
+
static func answer(from data: Data, status: Int?) throws -> Answer {
|
|
286
294
|
struct UiButton: Decodable { let label: String; let url: String }
|
|
287
295
|
struct UiMedia: Decodable { let type: String; let url: String; let caption: String? }
|
|
288
296
|
struct Ui: Decodable { let buttons: [UiButton]?; let media: UiMedia? }
|
|
@@ -309,15 +317,15 @@ enum AgentClient {
|
|
|
309
317
|
// speakable explanation into `text`. Falling through to the error
|
|
310
318
|
// path here is what made "she is still working" sound like "that
|
|
311
319
|
// didn't work".
|
|
312
|
-
if
|
|
320
|
+
if status == 202,
|
|
313
321
|
let queuedText = reply?.text, !queuedText.isEmpty {
|
|
314
322
|
return Answer(text: queuedText, written: nil, buttons: [], imageURL: nil,
|
|
315
323
|
durationMs: reply?.duration, agentID: reply?.agentId, voice: voice)
|
|
316
324
|
}
|
|
317
325
|
|
|
318
|
-
if let
|
|
326
|
+
if let status, !(200..<300).contains(status) {
|
|
319
327
|
let detail = reply?.error ?? String(data: data.prefix(200), encoding: .utf8) ?? ""
|
|
320
|
-
throw VoiceError.api("daemon HTTP \(
|
|
328
|
+
throw VoiceError.api("daemon HTTP \(status): \(detail)")
|
|
321
329
|
}
|
|
322
330
|
if let err = reply?.error, !err.isEmpty { throw VoiceError.api(err) }
|
|
323
331
|
guard let text = reply?.text ?? reply?.full, !text.isEmpty else {
|
|
@@ -337,4 +345,99 @@ enum AgentClient {
|
|
|
337
345
|
durationMs: reply?.duration, agentID: reply?.agentId, voice: voice,
|
|
338
346
|
presenceMode: reply?.presence?.mode)
|
|
339
347
|
}
|
|
348
|
+
|
|
349
|
+
// MARK: Open requests
|
|
350
|
+
//
|
|
351
|
+
// The open-requests list is kept by the daemon (#1455), so it survives
|
|
352
|
+
// a restart and heard on one client is heard on all. See
|
|
353
|
+
// src/daemon/voice-requests-api.ts. None of these throw: without the
|
|
354
|
+
// daemon the app keeps its own list as before.
|
|
355
|
+
|
|
356
|
+
private struct RemoteRow: Decodable {
|
|
357
|
+
let id: String
|
|
358
|
+
let agentId: String
|
|
359
|
+
let question: String
|
|
360
|
+
let state: String
|
|
361
|
+
let sentAt: Double
|
|
362
|
+
let since: Double
|
|
363
|
+
let heard: Bool
|
|
364
|
+
let error: String?
|
|
365
|
+
|
|
366
|
+
var remote: OpenRequests.Remote {
|
|
367
|
+
OpenRequests.Remote(key: id, agentID: agentId, question: question,
|
|
368
|
+
sentAt: Date(timeIntervalSince1970: sentAt / 1000),
|
|
369
|
+
since: Date(timeIntervalSince1970: since / 1000),
|
|
370
|
+
state: state, heard: heard, error: error)
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
/// A new row on the daemon: its id, or nil when the daemon has none.
|
|
375
|
+
static func openRequest(agentID: String, question: String, waiting: Bool) async -> String? {
|
|
376
|
+
struct Reply: Decodable { let request: RemoteRow? }
|
|
377
|
+
guard let (data, _) = try? await post("/voice/requests",
|
|
378
|
+
["agentId": agentID, "question": question, "waiting": waiting], timeout: 3)
|
|
379
|
+
else { return nil }
|
|
380
|
+
return (try? JSONDecoder().decode(Reply.self, from: data))?.request?.id
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
/// A follow-up continues the row `key` on the daemon: its words now,
|
|
384
|
+
/// not heard.
|
|
385
|
+
static func continueRequest(_ key: String, question: String, waiting: Bool) async {
|
|
386
|
+
_ = try? await post("/voice/requests/\(key)/continue", ["question": question, "waiting": waiting], timeout: 3)
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
/// What reading the daemon's list gave.
|
|
390
|
+
enum RequestsRead {
|
|
391
|
+
case rows([OpenRequests.Remote])
|
|
392
|
+
/// It answered, but keeps no list (older than it, or no SQLite).
|
|
393
|
+
case noList
|
|
394
|
+
/// It did not answer at all.
|
|
395
|
+
case unreachable
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
/// The daemon's open rows.
|
|
399
|
+
static func openRequests() async -> RequestsRead {
|
|
400
|
+
struct Reply: Decodable { let requests: [RemoteRow] }
|
|
401
|
+
guard let url = URL(string: "\(Config.daemonURL)/voice/requests") else { return .unreachable }
|
|
402
|
+
var req = URLRequest(url: url)
|
|
403
|
+
req.timeoutInterval = 3
|
|
404
|
+
guard let (data, response) = try? await URLSession.shared.data(for: req) else { return .unreachable }
|
|
405
|
+
guard (response as? HTTPURLResponse)?.statusCode == 200,
|
|
406
|
+
let rows = (try? JSONDecoder().decode(Reply.self, from: data))?.requests else { return .noList }
|
|
407
|
+
return .rows(rows.map(\.remote))
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
/// The answer the daemon kept for a row, for one the app did not ask
|
|
411
|
+
/// itself (found on the daemon after a restart).
|
|
412
|
+
static func requestAnswer(_ key: String) async -> Answer? {
|
|
413
|
+
guard let url = URL(string: "\(Config.daemonURL)/voice/requests/\(key)") else { return nil }
|
|
414
|
+
var req = URLRequest(url: url)
|
|
415
|
+
req.timeoutInterval = 5
|
|
416
|
+
guard let (data, response) = try? await URLSession.shared.data(for: req),
|
|
417
|
+
(response as? HTTPURLResponse)?.statusCode == 200,
|
|
418
|
+
let obj = try? JSONSerialization.jsonObject(with: data) as? [String: Any],
|
|
419
|
+
let reply = obj["reply"] as? [String: Any],
|
|
420
|
+
let replyData = try? JSONSerialization.data(withJSONObject: reply) else { return nil }
|
|
421
|
+
return try? answer(from: replyData, status: 200)
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
/// Played or opened: heard on every client.
|
|
425
|
+
static func requestHeard(_ key: String) async {
|
|
426
|
+
_ = try? await post("/voice/requests/\(key)/heard", [:], timeout: 3)
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
/// The row leaves the list; `stop` also stops its agent's turn.
|
|
430
|
+
static func closeRequest(_ key: String, stop: Bool) async {
|
|
431
|
+
_ = try? await post("/voice/requests/\(key)/close", ["stop": stop], timeout: 5)
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
/// Undo a close.
|
|
435
|
+
static func reopenRequest(_ key: String) async {
|
|
436
|
+
_ = try? await post("/voice/requests/\(key)/reopen", [:], timeout: 3)
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
/// "Close heard": every heard answer and every failure.
|
|
440
|
+
static func closeHeardRequests() async {
|
|
441
|
+
_ = try? await post("/voice/requests/close-heard", [:], timeout: 3)
|
|
442
|
+
}
|
|
340
443
|
}
|
|
@@ -43,15 +43,6 @@ enum Config {
|
|
|
43
43
|
set { UserDefaults.standard.set(newValue, forKey: "playMode") }
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
/// "Play answers at once" in the menu: an answer plays as soon as it is
|
|
47
|
-
/// back, as before #1455. Off by default: it waits as "not heard" in the
|
|
48
|
-
/// open-requests list until picked. A UI choice for now; the setting in
|
|
49
|
-
/// agentx.json comes with the Settings window's Answers group.
|
|
50
|
-
static var playAnswersAtOnce: Bool {
|
|
51
|
-
get { UserDefaults.standard.bool(forKey: "playAnswersAtOnce") }
|
|
52
|
-
set { UserDefaults.standard.set(newValue, forKey: "playAnswersAtOnce") }
|
|
53
|
-
}
|
|
54
|
-
|
|
55
46
|
/// Where the pill was last dragged to (its bottom-left corner, in
|
|
56
47
|
/// screen points). Nil: the default corner.
|
|
57
48
|
static var pillOrigin: CGPoint? {
|
|
@@ -249,7 +249,8 @@ final class HistoryWindow: NSObject {
|
|
|
249
249
|
let store = HistoryStore()
|
|
250
250
|
private var window: NSWindow?
|
|
251
251
|
|
|
252
|
-
|
|
252
|
+
/// `agent`: open on that agent's conversations; nil keeps the filter.
|
|
253
|
+
func show(agent: String? = nil) {
|
|
253
254
|
if window == nil {
|
|
254
255
|
let w = NSWindow(contentRect: NSRect(x: 0, y: 0, width: 860, height: 560),
|
|
255
256
|
styleMask: [.titled, .closable, .miniaturizable, .resizable],
|
|
@@ -261,7 +262,7 @@ final class HistoryWindow: NSObject {
|
|
|
261
262
|
window = w
|
|
262
263
|
}
|
|
263
264
|
store.agents = []
|
|
264
|
-
store.reload()
|
|
265
|
+
if let agent, store.agent != agent { store.agent = agent } else { store.reload() }
|
|
265
266
|
NSApp.activate(ignoringOtherApps: true)
|
|
266
267
|
window?.makeKeyAndOrderFront(nil)
|
|
267
268
|
}
|