reevesagents 1.2.0 → 1.3.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/CHANGELOG.md +41 -0
- package/README.ar.md +397 -0
- package/README.de.md +406 -0
- package/README.es.md +418 -0
- package/README.fr.md +340 -0
- package/README.it.md +400 -0
- package/README.md +290 -171
- package/README.pt.md +417 -0
- package/README.ru.md +401 -0
- package/README.tr.md +415 -0
- package/README.zh-Hans.md +340 -0
- package/dist/chunk-4LWTEYRI.js +4878 -0
- package/dist/chunk-4W6MVOPK.js +29 -0
- package/dist/{chunk-4Q3JF22J.js → chunk-5DOCQLT7.js} +2 -2
- package/dist/{chunk-MVMGFG4W.js → chunk-65LHCGPC.js} +836 -263
- package/dist/chunk-D24DQQ6V.js +0 -0
- package/dist/chunk-HS6TOISU.js +30 -0
- package/dist/chunk-Z2JHNE7V.js +317 -0
- package/dist/cli.d.ts +4 -1
- package/dist/cli.js +374 -45
- package/dist/extras-25AF6TAR.js +0 -0
- package/dist/index.d.ts +13 -37
- package/dist/index.js +13 -19
- package/dist/open-browser-DRSIJQ37.js +0 -0
- package/dist/{router-WCFLHJV7.js → router-I4WDR7CD.js} +1478 -764
- package/dist/server-H2XEJQYT.js +622 -0
- package/dist/{server-Z2YTGWSX.js → server-ZJKAIRL5.js} +261 -135
- package/dist/{tui-launch-7RGFE5KY.js → tui-launch-VHLX6JOW.js} +2 -2
- package/dist/web/app.css +321 -13
- package/dist/web/app.js +626 -51
- package/dist/web/index.html +115 -10
- package/package.json +22 -18
- package/dist/chunk-3IXII4H5.js +0 -129
- package/dist/chunk-DHAW6OY3.js +0 -40
- package/dist/chunk-G6FN75ZW.js +0 -2393
- package/dist/chunk-JY4ZTTRK.js +0 -172
- package/dist/chunk-LUW6GCPO.js +0 -108
package/dist/web/app.js
CHANGED
|
@@ -21,8 +21,6 @@
|
|
|
21
21
|
|
|
22
22
|
const WEB_EN = {
|
|
23
23
|
'common.delete': 'Delete',
|
|
24
|
-
'web.beta': 'web · beta',
|
|
25
|
-
'web.prebeta': 'web · pre-beta MCP',
|
|
26
24
|
'web.live': 'live',
|
|
27
25
|
'web.offline': 'offline',
|
|
28
26
|
'web.languageTitle': 'Language',
|
|
@@ -57,7 +55,6 @@
|
|
|
57
55
|
'web.skipPromptsMeta': 'Use only in trusted workspaces',
|
|
58
56
|
'web.agentName': 'Agent name',
|
|
59
57
|
'web.optional': 'optional',
|
|
60
|
-
'web.newRunMode': 'New run mode',
|
|
61
58
|
'web.workingDirectory': 'Working directory',
|
|
62
59
|
'web.cwdPlaceholder': 'defaults to the server directory',
|
|
63
60
|
'web.initialPrompt': 'Initial prompt',
|
|
@@ -68,20 +65,19 @@
|
|
|
68
65
|
'web.modelHelp': 'Provider default is safest when unsure.',
|
|
69
66
|
'web.permissionsHelp': 'Ask first is safer. Skip prompts only in trusted workspaces.',
|
|
70
67
|
'web.agentNameHelp': 'Optional display name and tmux window name.',
|
|
71
|
-
'web.modeHelp': 'Normal runs are direct agent workspaces. Orchestrator MCP is pre-beta.',
|
|
72
68
|
'web.cwdHelp': 'Agents start in this directory.',
|
|
73
69
|
'web.promptHelp': 'Sent to the agent after its window opens.',
|
|
74
70
|
'web.promptPlaceholder': 'What should this agent start working on?',
|
|
75
|
-
'web.orchestratorPromptPlaceholder': 'What should this orchestrator agent start working on?',
|
|
76
71
|
'web.cancel': 'Cancel',
|
|
77
72
|
'web.create': 'Create',
|
|
78
73
|
'web.providerDefault': 'Provider default',
|
|
79
74
|
'web.notInstalled': 'Not installed',
|
|
80
|
-
'web.spawnerOnly': 'Agent run only',
|
|
81
|
-
'web.readyOrchestrator': 'Ready · Orchestrator',
|
|
82
75
|
'web.ready': 'Ready',
|
|
83
76
|
'web.history': 'History',
|
|
84
77
|
'web.archived': 'archived',
|
|
78
|
+
'web.approvalsTitle': 'Pending approvals',
|
|
79
|
+
'web.approve': 'Approve',
|
|
80
|
+
'web.deny': 'Deny',
|
|
85
81
|
'web.noRootProvider': 'no root provider',
|
|
86
82
|
'web.addAgentTitle': 'add agent to {{name}}',
|
|
87
83
|
'web.stopRunTitle': 'stop run {{name}}',
|
|
@@ -117,11 +113,9 @@
|
|
|
117
113
|
'web.createRunFirst': 'Create a run first. Agents are added inside active runs.',
|
|
118
114
|
'web.runInactive': 'This run is no longer active.',
|
|
119
115
|
'web.noProvider': 'No installed provider is available for this mode.',
|
|
120
|
-
'web.addingTo': 'Adding to {{name}} · {{
|
|
116
|
+
'web.addingTo': 'Adding to {{name}} · {{count}}',
|
|
121
117
|
'web.oneAgent': '{{count}} agent',
|
|
122
118
|
'web.manyAgents': '{{count}} agents',
|
|
123
|
-
'web.spawner': 'Agent run',
|
|
124
|
-
'web.orchestrator': 'Orchestrator MCP',
|
|
125
119
|
'web.roleRoot': 'root',
|
|
126
120
|
'web.roleWorker': 'worker',
|
|
127
121
|
'web.statusQueued': 'queued',
|
|
@@ -134,6 +128,45 @@
|
|
|
134
128
|
'web.statusRunning': 'running',
|
|
135
129
|
'web.unknown': 'unknown',
|
|
136
130
|
'web.useProvider': 'use {{name}}',
|
|
131
|
+
'web.agentControl': 'Agent control',
|
|
132
|
+
'web.agentControlTitle': 'attach the reevesagents MCP to your CLIs',
|
|
133
|
+
'web.mcpTitle': 'Agent control',
|
|
134
|
+
'web.mcpSubtitle': 'Attach the reevesagents MCP to your CLIs so an agent can spawn and drive other agents.',
|
|
135
|
+
'web.mcpEmpty': 'No MCP-capable CLI was found on this machine.',
|
|
136
|
+
'web.mcpAttachAll': 'Attach all',
|
|
137
|
+
'web.mcpClose': 'Close',
|
|
138
|
+
'web.mcpAttach': 'Attach',
|
|
139
|
+
'web.mcpDetach': 'Detach',
|
|
140
|
+
'web.mcpAttached': 'Attached',
|
|
141
|
+
'web.mcpDetached': 'Not attached',
|
|
142
|
+
'web.mcpManual': 'Manual setup',
|
|
143
|
+
'web.mcpNotInstalled': 'Not installed',
|
|
144
|
+
'web.mcpManualHint': 'add it from this CLI by hand',
|
|
145
|
+
'web.mcpAttachHint': 'add the MCP to this CLI',
|
|
146
|
+
'web.mcpDetachHint': 'remove the MCP from this CLI',
|
|
147
|
+
'web.mcpAttachError': 'Could not attach {{name}}: {{message}}',
|
|
148
|
+
'web.mcpDetachError': 'Could not detach {{name}}: {{message}}',
|
|
149
|
+
'web.mcpAttachAllError': 'Could not attach all: {{message}}',
|
|
150
|
+
'web.mcpLoadError': 'Could not load MCP hosts: {{message}}',
|
|
151
|
+
'web.config': 'Config',
|
|
152
|
+
'web.presets': 'Presets',
|
|
153
|
+
'web.doctor': 'Doctor',
|
|
154
|
+
'web.about': 'About',
|
|
155
|
+
'web.loading': 'Loading...',
|
|
156
|
+
'web.runningChecks': 'Running checks...',
|
|
157
|
+
'web.start': 'Start',
|
|
158
|
+
'web.presetsNoRun': 'Open a run first, then save it as a preset.',
|
|
159
|
+
'web.aboutVersion': 'Version',
|
|
160
|
+
'web.aboutPurpose': 'Purpose',
|
|
161
|
+
'web.aboutPurposeValue': 'Local tmux-first workspace manager for AI CLI agents',
|
|
162
|
+
'web.aboutInterface': 'Interface',
|
|
163
|
+
'web.aboutInterfaceValue': 'Ink TUI, Web UI, and agent run CLI',
|
|
164
|
+
'web.aboutRuntime': 'Runtime',
|
|
165
|
+
'web.aboutRuntimeValue': 'tmux sessions and provider CLI windows',
|
|
166
|
+
'web.aboutProviders': 'Providers',
|
|
167
|
+
'web.aboutProvidersNone': 'none detected',
|
|
168
|
+
'web.aboutLicense': 'License',
|
|
169
|
+
'web.aboutRepository': 'Repository',
|
|
137
170
|
}
|
|
138
171
|
|
|
139
172
|
const el = {
|
|
@@ -142,7 +175,6 @@
|
|
|
142
175
|
sidebarCount: document.getElementById('sidebar-count'),
|
|
143
176
|
conn: document.getElementById('conn'),
|
|
144
177
|
brandDuck: document.getElementById('brand-duck'),
|
|
145
|
-
brandBeta: document.getElementById('brand-beta'),
|
|
146
178
|
languageLabel: document.getElementById('language-label'),
|
|
147
179
|
languageSelect: document.getElementById('language-select'),
|
|
148
180
|
stageTitle: document.getElementById('stage-title'),
|
|
@@ -167,14 +199,16 @@
|
|
|
167
199
|
fProvider: document.getElementById('f-provider'),
|
|
168
200
|
providerGrid: document.getElementById('provider-grid'),
|
|
169
201
|
fModel: document.getElementById('f-model'),
|
|
202
|
+
fAuthMode: document.getElementById('f-auth-mode'),
|
|
203
|
+
fEffort: document.getElementById('f-effort'),
|
|
204
|
+
authModeField: document.getElementById('auth-mode-field'),
|
|
205
|
+
effortField: document.getElementById('effort-field'),
|
|
170
206
|
fPermissions: document.getElementById('f-permissions'),
|
|
171
207
|
permissionGrid: document.getElementById('permission-grid'),
|
|
172
208
|
fNickname: document.getElementById('f-nickname'),
|
|
173
209
|
fRunName: document.getElementById('f-run-name'),
|
|
174
210
|
fAgentRun: document.getElementById('f-agent-run'),
|
|
175
|
-
fMode: document.getElementById('f-mode'),
|
|
176
211
|
agentRunField: document.getElementById('agent-run-field'),
|
|
177
|
-
modeField: document.getElementById('mode-field'),
|
|
178
212
|
runNameField: document.getElementById('run-name-field'),
|
|
179
213
|
fCwd: document.getElementById('f-cwd'),
|
|
180
214
|
cwdField: document.getElementById('cwd-field'),
|
|
@@ -182,19 +216,54 @@
|
|
|
182
216
|
newError: document.getElementById('new-error'),
|
|
183
217
|
newCancel: document.getElementById('new-cancel'),
|
|
184
218
|
newSubmit: document.getElementById('new-submit'),
|
|
219
|
+
agentControlBtn: document.getElementById('agent-control-btn'),
|
|
220
|
+
mcpDialog: document.getElementById('mcp-dialog'),
|
|
221
|
+
mcpDialogTitle: document.getElementById('mcp-dialog-title'),
|
|
222
|
+
mcpDialogSubtitle: document.getElementById('mcp-dialog-subtitle'),
|
|
223
|
+
mcpHostList: document.getElementById('mcp-host-list'),
|
|
224
|
+
mcpEmpty: document.getElementById('mcp-empty'),
|
|
225
|
+
mcpError: document.getElementById('mcp-error'),
|
|
226
|
+
mcpAttachAll: document.getElementById('mcp-attach-all'),
|
|
227
|
+
mcpClose: document.getElementById('mcp-close'),
|
|
228
|
+
doctorBtn: document.getElementById('doctor-btn'),
|
|
229
|
+
doctorDialog: document.getElementById('doctor-dialog'),
|
|
230
|
+
doctorList: document.getElementById('doctor-list'),
|
|
231
|
+
doctorError: document.getElementById('doctor-error'),
|
|
232
|
+
doctorRefresh: document.getElementById('doctor-refresh'),
|
|
233
|
+
doctorClose: document.getElementById('doctor-close'),
|
|
234
|
+
aboutBtn: document.getElementById('about-btn'),
|
|
235
|
+
aboutDialog: document.getElementById('about-dialog'),
|
|
236
|
+
aboutList: document.getElementById('about-list'),
|
|
237
|
+
aboutClose: document.getElementById('about-close'),
|
|
238
|
+
configBtn: document.getElementById('config-btn'),
|
|
239
|
+
configDialog: document.getElementById('config-dialog'),
|
|
240
|
+
configList: document.getElementById('config-list'),
|
|
241
|
+
configError: document.getElementById('config-error'),
|
|
242
|
+
configSave: document.getElementById('config-save'),
|
|
243
|
+
configClose: document.getElementById('config-close'),
|
|
244
|
+
presetsBtn: document.getElementById('presets-btn'),
|
|
245
|
+
presetsDialog: document.getElementById('presets-dialog'),
|
|
246
|
+
presetsList: document.getElementById('presets-list'),
|
|
247
|
+
presetNameInput: document.getElementById('preset-name-input'),
|
|
248
|
+
presetSave: document.getElementById('preset-save'),
|
|
249
|
+
presetsError: document.getElementById('presets-error'),
|
|
250
|
+
presetsClose: document.getElementById('presets-close'),
|
|
185
251
|
}
|
|
186
252
|
|
|
187
253
|
let runs = []
|
|
188
254
|
let history = []
|
|
255
|
+
let approvals = []
|
|
189
256
|
let providers = []
|
|
257
|
+
let appVersion = ''
|
|
190
258
|
let language = 'en'
|
|
191
259
|
let languages = []
|
|
192
260
|
let messages = WEB_EN
|
|
193
|
-
let prebetaOrchestrator = false
|
|
194
261
|
let selectedId = null
|
|
195
262
|
let session = null // { id, ws, term, fit, observer }
|
|
196
263
|
let createContext = { kind: 'run', runId: '' }
|
|
197
264
|
let createSubmitting = false
|
|
265
|
+
let mcpHosts = []
|
|
266
|
+
let mcpBusy = false
|
|
198
267
|
|
|
199
268
|
// --- http helpers ---------------------------------------------------------
|
|
200
269
|
|
|
@@ -230,7 +299,8 @@
|
|
|
230
299
|
providers = data.providers || []
|
|
231
300
|
runs = data.runs || []
|
|
232
301
|
history = data.history || []
|
|
233
|
-
|
|
302
|
+
approvals = data.approvals || []
|
|
303
|
+
appVersion = data.version || ''
|
|
234
304
|
applyLanguage(data.language)
|
|
235
305
|
renderProviders()
|
|
236
306
|
renderSidebar()
|
|
@@ -249,6 +319,7 @@
|
|
|
249
319
|
runs = data.runs
|
|
250
320
|
}
|
|
251
321
|
if (Array.isArray(data.history)) history = data.history
|
|
322
|
+
if (Array.isArray(data.approvals)) approvals = data.approvals
|
|
252
323
|
renderSidebar()
|
|
253
324
|
reconcileCreateDialog()
|
|
254
325
|
reconcileSelectedAgent()
|
|
@@ -296,13 +367,24 @@
|
|
|
296
367
|
}
|
|
297
368
|
|
|
298
369
|
function applyStaticTranslations() {
|
|
299
|
-
el.brandBeta.textContent = prebetaOrchestrator ? t('web.prebeta') : t('web.beta')
|
|
300
370
|
el.languageLabel.textContent = t('web.languageTitle')
|
|
301
371
|
el.languageSelect.setAttribute('aria-label', t('web.languageTitle'))
|
|
302
372
|
el.languageSelect.parentElement.title = t('web.languageTitle')
|
|
303
373
|
el.newAgentBtn.textContent = t('web.newAgent')
|
|
304
374
|
el.newRunBtn.textContent = t('web.newRun')
|
|
305
375
|
el.newRunBtn.title = t('web.newRunTitle')
|
|
376
|
+
el.agentControlBtn.textContent = t('web.agentControl')
|
|
377
|
+
el.agentControlBtn.title = t('web.agentControlTitle')
|
|
378
|
+
el.configBtn.textContent = t('web.config')
|
|
379
|
+
el.presetsBtn.textContent = t('web.presets')
|
|
380
|
+
el.doctorBtn.textContent = t('web.doctor')
|
|
381
|
+
el.aboutBtn.textContent = t('web.about')
|
|
382
|
+
el.mcpDialogTitle.textContent = t('web.mcpTitle')
|
|
383
|
+
el.mcpDialogSubtitle.textContent = t('web.mcpSubtitle')
|
|
384
|
+
el.mcpEmpty.textContent = t('web.mcpEmpty')
|
|
385
|
+
el.mcpAttachAll.textContent = t('web.mcpAttachAll')
|
|
386
|
+
el.mcpClose.textContent = t('web.mcpClose')
|
|
387
|
+
if (el.mcpDialog.open) renderMcpHosts()
|
|
306
388
|
el.emptyNewRun.textContent = t('web.newRun')
|
|
307
389
|
el.overlayNewRun.textContent = t('web.newRun')
|
|
308
390
|
el.overlayNewAgent.textContent = t('web.newAgent')
|
|
@@ -336,9 +418,6 @@
|
|
|
336
418
|
document.querySelector('#f-permissions option[value="ask"]').textContent = t('web.askFirst')
|
|
337
419
|
document.querySelector('#f-permissions option[value="skip"]').textContent = t('web.skipPrompts')
|
|
338
420
|
document.querySelector('#agent-name-field .field-label').innerHTML = `${t('web.agentName')} <span class="field-opt">${t('web.optional')}</span>`
|
|
339
|
-
document.querySelector('#mode-field .field-label').textContent = t('web.newRunMode')
|
|
340
|
-
document.querySelector('#f-mode option[value="spawner"]').textContent = t('web.spawner')
|
|
341
|
-
document.querySelector('#f-mode option[value="orchestrator"]').textContent = `${t('web.orchestrator')} · pre-beta`
|
|
342
421
|
document.querySelector('#cwd-field .field-label').textContent = t('web.workingDirectory')
|
|
343
422
|
document.querySelector('#f-cwd').placeholder = t('web.cwdPlaceholder')
|
|
344
423
|
document.querySelector('#prompt-field .field-label').innerHTML = `${t('web.initialPrompt')} <span class="field-opt">${t('web.initialPromptOpt')}</span>`
|
|
@@ -348,7 +427,6 @@
|
|
|
348
427
|
setText('#model-help', t('web.modelHelp'))
|
|
349
428
|
setText('#permissions-help', t('web.permissionsHelp'))
|
|
350
429
|
setText('#agent-name-help', t('web.agentNameHelp'))
|
|
351
|
-
setText('#mode-help', t('web.modeHelp'))
|
|
352
430
|
setText('#cwd-help', t('web.cwdHelp'))
|
|
353
431
|
setText('#prompt-help', t('web.promptHelp'))
|
|
354
432
|
el.newCancel.textContent = t('web.cancel')
|
|
@@ -396,16 +474,13 @@
|
|
|
396
474
|
|
|
397
475
|
function renderProviders() {
|
|
398
476
|
const current = el.fProvider.value
|
|
399
|
-
const mode = selectedCreateMode()
|
|
400
477
|
el.fProvider.innerHTML = ''
|
|
401
478
|
el.providerGrid.innerHTML = ''
|
|
402
479
|
for (const p of providers) {
|
|
403
480
|
const opt = document.createElement('option')
|
|
404
481
|
opt.value = p.id
|
|
405
|
-
const supported = mode !== 'orchestrator' || p.orchestrator === true
|
|
406
482
|
opt.textContent = p.available ? p.name : `${p.name} (${t('web.notInstalled')})`
|
|
407
|
-
|
|
408
|
-
opt.disabled = !p.available || !supported
|
|
483
|
+
opt.disabled = !p.available
|
|
409
484
|
el.fProvider.appendChild(opt)
|
|
410
485
|
|
|
411
486
|
const choice = document.createElement('button')
|
|
@@ -431,7 +506,7 @@
|
|
|
431
506
|
body.appendChild(name)
|
|
432
507
|
const meta = document.createElement('span')
|
|
433
508
|
meta.className = 'provider-meta'
|
|
434
|
-
meta.textContent = providerMeta(p
|
|
509
|
+
meta.textContent = providerMeta(p)
|
|
435
510
|
body.appendChild(meta)
|
|
436
511
|
choice.appendChild(body)
|
|
437
512
|
el.providerGrid.appendChild(choice)
|
|
@@ -442,13 +517,12 @@
|
|
|
442
517
|
else if (firstAvailable) el.fProvider.value = firstAvailable.value
|
|
443
518
|
updateProviderSelection()
|
|
444
519
|
renderModels()
|
|
520
|
+
updateLaunchKnobVisibility()
|
|
445
521
|
updateCreateSubmitState()
|
|
446
522
|
}
|
|
447
523
|
|
|
448
|
-
function providerMeta(provider
|
|
524
|
+
function providerMeta(provider) {
|
|
449
525
|
if (!provider.available) return t('web.notInstalled')
|
|
450
|
-
if (!supported) return t('web.spawnerOnly')
|
|
451
|
-
if (selectedCreateMode() === 'orchestrator' && provider.orchestrator) return t('web.readyOrchestrator')
|
|
452
526
|
return t('web.ready')
|
|
453
527
|
}
|
|
454
528
|
|
|
@@ -458,6 +532,7 @@
|
|
|
458
532
|
el.fProvider.value = providerId
|
|
459
533
|
updateProviderSelection()
|
|
460
534
|
renderModels()
|
|
535
|
+
updateLaunchKnobVisibility()
|
|
461
536
|
updateCreateSubmitState()
|
|
462
537
|
}
|
|
463
538
|
|
|
@@ -518,6 +593,18 @@
|
|
|
518
593
|
updateCreateSubmitState()
|
|
519
594
|
}
|
|
520
595
|
|
|
596
|
+
// auth_mode only applies to Claude Code; reasoning effort applies to cc and codex.
|
|
597
|
+
// Hide the irrelevant knobs and reset them so a stale value is never submitted.
|
|
598
|
+
function updateLaunchKnobVisibility() {
|
|
599
|
+
const provider = el.fProvider.value
|
|
600
|
+
const showAuthMode = provider === 'cc'
|
|
601
|
+
const showEffort = provider === 'cc' || provider === 'codex'
|
|
602
|
+
el.authModeField.hidden = !showAuthMode
|
|
603
|
+
el.effortField.hidden = !showEffort
|
|
604
|
+
if (!showAuthMode) el.fAuthMode.value = ''
|
|
605
|
+
if (!showEffort) el.fEffort.value = ''
|
|
606
|
+
}
|
|
607
|
+
|
|
521
608
|
function updatePermissionSelection() {
|
|
522
609
|
for (const option of el.permissionGrid.querySelectorAll('.permission-option')) {
|
|
523
610
|
const active = option.dataset.permission === el.fPermissions.value
|
|
@@ -736,6 +823,24 @@
|
|
|
736
823
|
}
|
|
737
824
|
el.sidebarList.innerHTML = ''
|
|
738
825
|
|
|
826
|
+
if (approvals.length > 0) {
|
|
827
|
+
const group = document.createElement('div')
|
|
828
|
+
group.className = 'approvals-group'
|
|
829
|
+
const head = document.createElement('div')
|
|
830
|
+
head.className = 'approvals-head'
|
|
831
|
+
const title = document.createElement('span')
|
|
832
|
+
title.className = 'approvals-title'
|
|
833
|
+
title.textContent = t('web.approvalsTitle')
|
|
834
|
+
head.appendChild(title)
|
|
835
|
+
const count = document.createElement('span')
|
|
836
|
+
count.className = 'approvals-count'
|
|
837
|
+
count.textContent = String(approvals.length)
|
|
838
|
+
head.appendChild(count)
|
|
839
|
+
group.appendChild(head)
|
|
840
|
+
for (const approval of approvals) group.appendChild(renderApproval(approval))
|
|
841
|
+
el.sidebarList.appendChild(group)
|
|
842
|
+
}
|
|
843
|
+
|
|
739
844
|
for (const run of runsWithAgents) {
|
|
740
845
|
const group = document.createElement('div')
|
|
741
846
|
group.className = 'run-group'
|
|
@@ -753,7 +858,7 @@
|
|
|
753
858
|
headBody.appendChild(name)
|
|
754
859
|
const meta = document.createElement('span')
|
|
755
860
|
meta.className = 'run-meta'
|
|
756
|
-
meta.textContent = `${statusLabel(run.status)} · ${
|
|
861
|
+
meta.textContent = `${statusLabel(run.status)} · ${agentCountLabel(run.terminals.length)}`
|
|
757
862
|
headBody.appendChild(meta)
|
|
758
863
|
head.appendChild(headBody)
|
|
759
864
|
|
|
@@ -817,6 +922,60 @@
|
|
|
817
922
|
updateCreateActions()
|
|
818
923
|
}
|
|
819
924
|
|
|
925
|
+
function renderApproval(approval) {
|
|
926
|
+
const item = document.createElement('div')
|
|
927
|
+
item.className = 'approval-card'
|
|
928
|
+
item.dataset.risk = approval.risk
|
|
929
|
+
if (approval.color) item.style.setProperty('--run-color', approval.color)
|
|
930
|
+
|
|
931
|
+
const body = document.createElement('div')
|
|
932
|
+
body.className = 'approval-body'
|
|
933
|
+
const action = document.createElement('span')
|
|
934
|
+
action.className = 'approval-action'
|
|
935
|
+
action.textContent = approval.action
|
|
936
|
+
action.title = approval.action
|
|
937
|
+
body.appendChild(action)
|
|
938
|
+
const meta = document.createElement('span')
|
|
939
|
+
meta.className = 'approval-meta'
|
|
940
|
+
meta.textContent = `${approval.agent_nickname} · ${approval.run_name} · ${approval.risk}`
|
|
941
|
+
body.appendChild(meta)
|
|
942
|
+
if (approval.summary) {
|
|
943
|
+
const summary = document.createElement('span')
|
|
944
|
+
summary.className = 'approval-summary'
|
|
945
|
+
summary.textContent = approval.summary
|
|
946
|
+
body.appendChild(summary)
|
|
947
|
+
}
|
|
948
|
+
item.appendChild(body)
|
|
949
|
+
|
|
950
|
+
const actions = document.createElement('div')
|
|
951
|
+
actions.className = 'approval-actions'
|
|
952
|
+
const approve = document.createElement('button')
|
|
953
|
+
approve.className = 'approval-approve'
|
|
954
|
+
approve.type = 'button'
|
|
955
|
+
approve.textContent = t('web.approve')
|
|
956
|
+
approve.addEventListener('click', () => resolveApproval(approval, 'approved'))
|
|
957
|
+
actions.appendChild(approve)
|
|
958
|
+
const deny = document.createElement('button')
|
|
959
|
+
deny.className = 'approval-deny'
|
|
960
|
+
deny.type = 'button'
|
|
961
|
+
deny.textContent = t('web.deny')
|
|
962
|
+
deny.addEventListener('click', () => resolveApproval(approval, 'denied'))
|
|
963
|
+
actions.appendChild(deny)
|
|
964
|
+
item.appendChild(actions)
|
|
965
|
+
return item
|
|
966
|
+
}
|
|
967
|
+
|
|
968
|
+
async function resolveApproval(approval, decision) {
|
|
969
|
+
try {
|
|
970
|
+
await api('POST', `/api/approvals/${encodeURIComponent(approval.id)}/resolve`, { decision })
|
|
971
|
+
approvals = approvals.filter(item => item.id !== approval.id)
|
|
972
|
+
renderSidebar()
|
|
973
|
+
await refreshState()
|
|
974
|
+
} catch (err) {
|
|
975
|
+
alert(err.message)
|
|
976
|
+
}
|
|
977
|
+
}
|
|
978
|
+
|
|
820
979
|
function renderHistoryRecord(record) {
|
|
821
980
|
const item = document.createElement('div')
|
|
822
981
|
item.className = 'history-card'
|
|
@@ -833,7 +992,7 @@
|
|
|
833
992
|
const meta = document.createElement('span')
|
|
834
993
|
meta.className = 'history-meta'
|
|
835
994
|
const provider = record.root_provider_label || t('web.noRootProvider')
|
|
836
|
-
meta.textContent = `${
|
|
995
|
+
meta.textContent = `${statusLabel(record.status)} · ${agentCountLabel(record.agent_count)} · ${provider}`
|
|
837
996
|
body.appendChild(meta)
|
|
838
997
|
item.appendChild(body)
|
|
839
998
|
|
|
@@ -885,6 +1044,13 @@
|
|
|
885
1044
|
if (agent.model) meta.append(document.createTextNode(` · ${agent.model}`))
|
|
886
1045
|
body.appendChild(nm)
|
|
887
1046
|
body.appendChild(meta)
|
|
1047
|
+
if (agent.task) {
|
|
1048
|
+
const task = document.createElement('span')
|
|
1049
|
+
task.className = 'card-task'
|
|
1050
|
+
task.textContent = agent.task
|
|
1051
|
+
task.title = agent.task
|
|
1052
|
+
body.appendChild(task)
|
|
1053
|
+
}
|
|
888
1054
|
open.appendChild(body)
|
|
889
1055
|
card.appendChild(open)
|
|
890
1056
|
|
|
@@ -989,7 +1155,7 @@
|
|
|
989
1155
|
renderSidebar()
|
|
990
1156
|
el.overlay.hidden = true
|
|
991
1157
|
el.stageTitle.textContent = found ? found.terminal.nickname : id
|
|
992
|
-
el.stageSub.textContent = found ? `${
|
|
1158
|
+
el.stageSub.textContent = found ? `${found.terminal.provider_label || found.terminal.provider} · ${found.run.name}` : ''
|
|
993
1159
|
if (found) el.termWrap.style.setProperty('--agent-color', found.terminal.color)
|
|
994
1160
|
setStageStatus('connecting', t('web.connecting'))
|
|
995
1161
|
|
|
@@ -1046,7 +1212,7 @@
|
|
|
1046
1212
|
return
|
|
1047
1213
|
}
|
|
1048
1214
|
el.stageTitle.textContent = found.terminal.nickname
|
|
1049
|
-
el.stageSub.textContent = `${
|
|
1215
|
+
el.stageSub.textContent = `${found.terminal.provider_label || found.terminal.provider} · ${found.run.name}`
|
|
1050
1216
|
el.termWrap.style.setProperty('--agent-color', found.terminal.color)
|
|
1051
1217
|
setOverlayCopy(disabledReasonLabel(found.terminal), t('web.unavailableBody'))
|
|
1052
1218
|
setStageStatus('closed', disabledReasonLabel(found.terminal))
|
|
@@ -1194,6 +1360,8 @@
|
|
|
1194
1360
|
el.fNickname.value = ''
|
|
1195
1361
|
el.fRunName.value = ''
|
|
1196
1362
|
el.fModel.value = ''
|
|
1363
|
+
el.fAuthMode.value = ''
|
|
1364
|
+
el.fEffort.value = ''
|
|
1197
1365
|
el.fPermissions.value = 'ask'
|
|
1198
1366
|
el.fPrompt.value = ''
|
|
1199
1367
|
el.fCwd.value = ''
|
|
@@ -1234,7 +1402,7 @@
|
|
|
1234
1402
|
const opt = document.createElement('option')
|
|
1235
1403
|
opt.value = run.id
|
|
1236
1404
|
const count = agentCountLabel(run.terminals.length)
|
|
1237
|
-
opt.textContent = `${run.name} · ${
|
|
1405
|
+
opt.textContent = `${run.name} · ${count}`
|
|
1238
1406
|
el.fAgentRun.appendChild(opt)
|
|
1239
1407
|
}
|
|
1240
1408
|
const hasCurrent = [...el.fAgentRun.options].some(opt => opt.value === current)
|
|
@@ -1248,17 +1416,10 @@
|
|
|
1248
1416
|
return runs.find(item => item.id === createContext.runId && item.status === 'running') || null
|
|
1249
1417
|
}
|
|
1250
1418
|
|
|
1251
|
-
function selectedCreateMode() {
|
|
1252
|
-
const run = selectedRunForCreate()
|
|
1253
|
-
if (run) return run.mode || 'spawner'
|
|
1254
|
-
return prebetaOrchestrator && el.fMode.value === 'orchestrator' ? 'orchestrator' : 'spawner'
|
|
1255
|
-
}
|
|
1256
|
-
|
|
1257
1419
|
function syncCreateFields() {
|
|
1258
1420
|
const addingToRun = createContext.kind === 'agent'
|
|
1259
1421
|
if (addingToRun) populateAgentRunSelect(createContext.runId)
|
|
1260
1422
|
const run = selectedRunForCreate()
|
|
1261
|
-
const mode = selectedCreateMode()
|
|
1262
1423
|
el.dialog.dataset.intent = addingToRun ? 'agent' : 'run'
|
|
1263
1424
|
el.dialogTitle.textContent = addingToRun ? t('web.addAgent') : t('web.newRun')
|
|
1264
1425
|
el.dialogSubtitle.textContent = addingToRun
|
|
@@ -1269,19 +1430,16 @@
|
|
|
1269
1430
|
el.createAgentTab.setAttribute('aria-selected', String(addingToRun))
|
|
1270
1431
|
el.agentRunField.hidden = !addingToRun
|
|
1271
1432
|
el.runNameField.hidden = addingToRun
|
|
1272
|
-
el.modeField.hidden = !prebetaOrchestrator || addingToRun
|
|
1273
1433
|
el.cwdField.hidden = addingToRun
|
|
1274
1434
|
el.targetRunNote.hidden = !addingToRun
|
|
1275
1435
|
if (addingToRun && run) {
|
|
1276
1436
|
const count = agentCountLabel(run.terminals.length)
|
|
1277
|
-
el.targetRunNote.textContent = t('web.addingTo', { name: run.name,
|
|
1437
|
+
el.targetRunNote.textContent = t('web.addingTo', { name: run.name, count })
|
|
1278
1438
|
} else {
|
|
1279
1439
|
el.targetRunNote.textContent = ''
|
|
1280
1440
|
}
|
|
1281
1441
|
el.fNickname.placeholder = addingToRun ? 'reviewer' : 'lead'
|
|
1282
|
-
el.fPrompt.placeholder =
|
|
1283
|
-
? t('web.orchestratorPromptPlaceholder')
|
|
1284
|
-
: t('web.promptPlaceholder')
|
|
1442
|
+
el.fPrompt.placeholder = t('web.promptPlaceholder')
|
|
1285
1443
|
renderProviders()
|
|
1286
1444
|
updatePermissionSelection()
|
|
1287
1445
|
updateCreateActions()
|
|
@@ -1317,13 +1475,14 @@
|
|
|
1317
1475
|
const payload = {
|
|
1318
1476
|
provider,
|
|
1319
1477
|
model: el.fModel.value,
|
|
1478
|
+
auth_mode: el.fAuthMode.value,
|
|
1479
|
+
effort: el.fEffort.value,
|
|
1320
1480
|
permissions: el.fPermissions.value,
|
|
1321
1481
|
nickname: el.fNickname.value.trim(),
|
|
1322
1482
|
prompt: el.fPrompt.value,
|
|
1323
1483
|
run_id: createContext.kind === 'agent' ? createContext.runId : undefined,
|
|
1324
1484
|
run_name: createContext.kind === 'run' ? el.fRunName.value.trim() || undefined : undefined,
|
|
1325
1485
|
working_dir: createContext.kind === 'run' ? el.fCwd.value.trim() || undefined : undefined,
|
|
1326
|
-
mode: createContext.kind === 'run' ? selectedCreateMode() : undefined,
|
|
1327
1486
|
}
|
|
1328
1487
|
createSubmitting = true
|
|
1329
1488
|
updateCreateSubmitState()
|
|
@@ -1350,10 +1509,430 @@
|
|
|
1350
1509
|
}
|
|
1351
1510
|
}
|
|
1352
1511
|
|
|
1512
|
+
// --- agent control (MCP installer) ----------------------------------------
|
|
1513
|
+
|
|
1514
|
+
function openAboutDialog() {
|
|
1515
|
+
el.aboutList.innerHTML = ''
|
|
1516
|
+
const rows = [
|
|
1517
|
+
[t('web.aboutVersion'), appVersion || t('web.unknown')],
|
|
1518
|
+
[t('web.aboutPurpose'), t('web.aboutPurposeValue')],
|
|
1519
|
+
[t('web.aboutInterface'), t('web.aboutInterfaceValue')],
|
|
1520
|
+
[t('web.aboutRuntime'), t('web.aboutRuntimeValue')],
|
|
1521
|
+
[t('web.aboutProviders'), providers.map(p => p.name).join(', ') || t('web.aboutProvidersNone')],
|
|
1522
|
+
[t('web.aboutLicense'), 'Apache-2.0'],
|
|
1523
|
+
]
|
|
1524
|
+
for (const [label, value] of rows) {
|
|
1525
|
+
const row = document.createElement('div')
|
|
1526
|
+
row.className = 'about-row'
|
|
1527
|
+
const k = document.createElement('span')
|
|
1528
|
+
k.className = 'about-key'
|
|
1529
|
+
k.textContent = label
|
|
1530
|
+
const v = document.createElement('span')
|
|
1531
|
+
v.className = 'about-value'
|
|
1532
|
+
v.textContent = value
|
|
1533
|
+
row.appendChild(k)
|
|
1534
|
+
row.appendChild(v)
|
|
1535
|
+
el.aboutList.appendChild(row)
|
|
1536
|
+
}
|
|
1537
|
+
const repoRow = document.createElement('div')
|
|
1538
|
+
repoRow.className = 'about-row'
|
|
1539
|
+
const repoKey = document.createElement('span')
|
|
1540
|
+
repoKey.className = 'about-key'
|
|
1541
|
+
repoKey.textContent = t('web.aboutRepository')
|
|
1542
|
+
const link = document.createElement('a')
|
|
1543
|
+
link.className = 'about-value about-link'
|
|
1544
|
+
link.href = 'https://github.com/mertkayacs/reevesagents'
|
|
1545
|
+
link.textContent = 'github.com/mertkayacs/reevesagents'
|
|
1546
|
+
link.target = '_blank'
|
|
1547
|
+
link.rel = 'noreferrer'
|
|
1548
|
+
repoRow.appendChild(repoKey)
|
|
1549
|
+
repoRow.appendChild(link)
|
|
1550
|
+
el.aboutList.appendChild(repoRow)
|
|
1551
|
+
el.aboutDialog.showModal()
|
|
1552
|
+
}
|
|
1553
|
+
|
|
1554
|
+
function openDoctorDialog() {
|
|
1555
|
+
el.doctorError.hidden = true
|
|
1556
|
+
el.doctorDialog.showModal()
|
|
1557
|
+
loadDoctor()
|
|
1558
|
+
}
|
|
1559
|
+
|
|
1560
|
+
async function loadDoctor() {
|
|
1561
|
+
el.doctorError.hidden = true
|
|
1562
|
+
el.doctorList.textContent = t('web.runningChecks')
|
|
1563
|
+
try {
|
|
1564
|
+
const result = await api('GET', '/api/doctor')
|
|
1565
|
+
renderDoctorChecks((result && result.checks) || [])
|
|
1566
|
+
} catch (err) {
|
|
1567
|
+
el.doctorList.textContent = ''
|
|
1568
|
+
el.doctorError.hidden = false
|
|
1569
|
+
el.doctorError.textContent = err.message
|
|
1570
|
+
}
|
|
1571
|
+
}
|
|
1572
|
+
|
|
1573
|
+
function renderDoctorChecks(checks) {
|
|
1574
|
+
el.doctorList.innerHTML = ''
|
|
1575
|
+
for (const check of checks) {
|
|
1576
|
+
const row = document.createElement('div')
|
|
1577
|
+
row.className = 'doctor-check'
|
|
1578
|
+
row.dataset.status = check.status
|
|
1579
|
+
const name = document.createElement('span')
|
|
1580
|
+
name.className = 'doctor-check-name'
|
|
1581
|
+
name.textContent = check.name
|
|
1582
|
+
const status = document.createElement('span')
|
|
1583
|
+
status.className = 'doctor-check-status'
|
|
1584
|
+
status.textContent = check.status
|
|
1585
|
+
const detail = document.createElement('span')
|
|
1586
|
+
detail.className = 'doctor-check-detail'
|
|
1587
|
+
detail.textContent = check.detail
|
|
1588
|
+
detail.title = check.detail
|
|
1589
|
+
row.appendChild(name)
|
|
1590
|
+
row.appendChild(status)
|
|
1591
|
+
row.appendChild(detail)
|
|
1592
|
+
el.doctorList.appendChild(row)
|
|
1593
|
+
}
|
|
1594
|
+
}
|
|
1595
|
+
|
|
1596
|
+
function openMcpDialog() {
|
|
1597
|
+
setMcpError(null)
|
|
1598
|
+
el.mcpHostList.innerHTML = ''
|
|
1599
|
+
el.mcpEmpty.hidden = true
|
|
1600
|
+
el.mcpDialog.showModal()
|
|
1601
|
+
loadMcpHosts()
|
|
1602
|
+
}
|
|
1603
|
+
|
|
1604
|
+
async function loadMcpHosts() {
|
|
1605
|
+
try {
|
|
1606
|
+
const data = await api('GET', '/api/mcp-hosts')
|
|
1607
|
+
mcpHosts = (data && data.hosts) || []
|
|
1608
|
+
renderMcpHosts()
|
|
1609
|
+
} catch (err) {
|
|
1610
|
+
setMcpError(t('web.mcpLoadError', { message: err.message }))
|
|
1611
|
+
}
|
|
1612
|
+
}
|
|
1613
|
+
|
|
1614
|
+
function hostStatusLabel(host) {
|
|
1615
|
+
if (!host.installed) return t('web.mcpNotInstalled')
|
|
1616
|
+
if (host.manual) return t('web.mcpManual')
|
|
1617
|
+
return host.attached ? t('web.mcpAttached') : t('web.mcpDetached')
|
|
1618
|
+
}
|
|
1619
|
+
|
|
1620
|
+
function hostStatusKind(host) {
|
|
1621
|
+
if (!host.installed) return 'absent'
|
|
1622
|
+
if (host.manual) return 'manual'
|
|
1623
|
+
return host.attached ? 'attached' : 'detached'
|
|
1624
|
+
}
|
|
1625
|
+
|
|
1626
|
+
function renderMcpHosts() {
|
|
1627
|
+
el.mcpHostList.innerHTML = ''
|
|
1628
|
+
el.mcpEmpty.hidden = mcpHosts.length > 0
|
|
1629
|
+
for (const host of mcpHosts) {
|
|
1630
|
+
const row = document.createElement('div')
|
|
1631
|
+
row.className = 'mcp-host-row'
|
|
1632
|
+
row.dataset.state = hostStatusKind(host)
|
|
1633
|
+
|
|
1634
|
+
const body = document.createElement('div')
|
|
1635
|
+
body.className = 'mcp-host-body'
|
|
1636
|
+
const name = document.createElement('span')
|
|
1637
|
+
name.className = 'mcp-host-name'
|
|
1638
|
+
name.textContent = host.label
|
|
1639
|
+
body.appendChild(name)
|
|
1640
|
+
const meta = document.createElement('span')
|
|
1641
|
+
meta.className = 'mcp-host-meta'
|
|
1642
|
+
meta.textContent = host.bin
|
|
1643
|
+
body.appendChild(meta)
|
|
1644
|
+
row.appendChild(body)
|
|
1645
|
+
|
|
1646
|
+
const status = document.createElement('span')
|
|
1647
|
+
status.className = 'mcp-host-status'
|
|
1648
|
+
status.textContent = hostStatusLabel(host)
|
|
1649
|
+
row.appendChild(status)
|
|
1650
|
+
|
|
1651
|
+
if (host.installed && !host.manual) {
|
|
1652
|
+
const btn = document.createElement('button')
|
|
1653
|
+
btn.type = 'button'
|
|
1654
|
+
btn.className = 'mcp-host-action'
|
|
1655
|
+
btn.dataset.kind = host.attached ? 'detach' : 'attach'
|
|
1656
|
+
btn.textContent = host.attached ? t('web.mcpDetach') : t('web.mcpAttach')
|
|
1657
|
+
btn.title = host.attached ? t('web.mcpDetachHint') : t('web.mcpAttachHint')
|
|
1658
|
+
btn.disabled = mcpBusy
|
|
1659
|
+
btn.addEventListener('click', () => host.attached ? detachHost(host) : attachHost(host))
|
|
1660
|
+
row.appendChild(btn)
|
|
1661
|
+
} else if (host.manual) {
|
|
1662
|
+
const note = document.createElement('span')
|
|
1663
|
+
note.className = 'mcp-host-note'
|
|
1664
|
+
note.textContent = t('web.mcpManualHint')
|
|
1665
|
+
row.appendChild(note)
|
|
1666
|
+
}
|
|
1667
|
+
el.mcpHostList.appendChild(row)
|
|
1668
|
+
}
|
|
1669
|
+
el.mcpAttachAll.disabled = mcpBusy || !mcpHosts.some(h => h.installed && !h.manual && !h.attached)
|
|
1670
|
+
}
|
|
1671
|
+
|
|
1672
|
+
function setMcpError(message) {
|
|
1673
|
+
if (!message) { el.mcpError.hidden = true; el.mcpError.textContent = ''; return }
|
|
1674
|
+
el.mcpError.textContent = message
|
|
1675
|
+
el.mcpError.hidden = false
|
|
1676
|
+
}
|
|
1677
|
+
|
|
1678
|
+
function applyMcpResult(data) {
|
|
1679
|
+
if (data && Array.isArray(data.hosts)) {
|
|
1680
|
+
mcpHosts = data.hosts
|
|
1681
|
+
renderMcpHosts()
|
|
1682
|
+
}
|
|
1683
|
+
}
|
|
1684
|
+
|
|
1685
|
+
async function attachHost(host) {
|
|
1686
|
+
if (mcpBusy) return
|
|
1687
|
+
mcpBusy = true
|
|
1688
|
+
setMcpError(null)
|
|
1689
|
+
renderMcpHosts()
|
|
1690
|
+
try {
|
|
1691
|
+
const data = await api('POST', '/api/mcp-hosts/attach', { key: host.key })
|
|
1692
|
+
applyMcpResult(data)
|
|
1693
|
+
if (data && data.result && data.result.ok === false) {
|
|
1694
|
+
setMcpError(t('web.mcpAttachError', { name: host.label, message: data.result.message }))
|
|
1695
|
+
}
|
|
1696
|
+
} catch (err) {
|
|
1697
|
+
setMcpError(t('web.mcpAttachError', { name: host.label, message: err.message }))
|
|
1698
|
+
} finally {
|
|
1699
|
+
mcpBusy = false
|
|
1700
|
+
renderMcpHosts()
|
|
1701
|
+
}
|
|
1702
|
+
}
|
|
1703
|
+
|
|
1704
|
+
async function detachHost(host) {
|
|
1705
|
+
if (mcpBusy) return
|
|
1706
|
+
mcpBusy = true
|
|
1707
|
+
setMcpError(null)
|
|
1708
|
+
renderMcpHosts()
|
|
1709
|
+
try {
|
|
1710
|
+
const data = await api('POST', '/api/mcp-hosts/detach', { key: host.key })
|
|
1711
|
+
applyMcpResult(data)
|
|
1712
|
+
if (data && data.result && data.result.ok === false) {
|
|
1713
|
+
setMcpError(t('web.mcpDetachError', { name: host.label, message: data.result.message }))
|
|
1714
|
+
}
|
|
1715
|
+
} catch (err) {
|
|
1716
|
+
setMcpError(t('web.mcpDetachError', { name: host.label, message: err.message }))
|
|
1717
|
+
} finally {
|
|
1718
|
+
mcpBusy = false
|
|
1719
|
+
renderMcpHosts()
|
|
1720
|
+
}
|
|
1721
|
+
}
|
|
1722
|
+
|
|
1723
|
+
async function attachAllHosts() {
|
|
1724
|
+
if (mcpBusy) return
|
|
1725
|
+
mcpBusy = true
|
|
1726
|
+
setMcpError(null)
|
|
1727
|
+
renderMcpHosts()
|
|
1728
|
+
try {
|
|
1729
|
+
const data = await api('POST', '/api/mcp-hosts/attach-all', {})
|
|
1730
|
+
applyMcpResult(data)
|
|
1731
|
+
const failed = ((data && data.results) || []).filter(r => !r.ok)
|
|
1732
|
+
if (failed.length > 0) setMcpError(t('web.mcpAttachAllError', { message: failed.map(r => r.message).join('; ') }))
|
|
1733
|
+
} catch (err) {
|
|
1734
|
+
setMcpError(t('web.mcpAttachAllError', { message: err.message }))
|
|
1735
|
+
} finally {
|
|
1736
|
+
mcpBusy = false
|
|
1737
|
+
renderMcpHosts()
|
|
1738
|
+
}
|
|
1739
|
+
}
|
|
1740
|
+
|
|
1741
|
+
// --- config panel ---------------------------------------------------------
|
|
1742
|
+
|
|
1743
|
+
function openConfigDialog() {
|
|
1744
|
+
el.configError.hidden = true
|
|
1745
|
+
el.configDialog.showModal()
|
|
1746
|
+
loadConfig()
|
|
1747
|
+
}
|
|
1748
|
+
|
|
1749
|
+
async function loadConfig() {
|
|
1750
|
+
el.configError.hidden = true
|
|
1751
|
+
el.configList.textContent = t('web.loading')
|
|
1752
|
+
try {
|
|
1753
|
+
const payload = await api('GET', '/api/config')
|
|
1754
|
+
renderConfigFields(payload)
|
|
1755
|
+
} catch (err) {
|
|
1756
|
+
el.configList.textContent = ''
|
|
1757
|
+
el.configError.hidden = false
|
|
1758
|
+
el.configError.textContent = err.message
|
|
1759
|
+
}
|
|
1760
|
+
}
|
|
1761
|
+
|
|
1762
|
+
function renderConfigFields(payload) {
|
|
1763
|
+
el.configList.innerHTML = ''
|
|
1764
|
+
const config = (payload && payload.config) || {}
|
|
1765
|
+
const fields = (payload && payload.fields) || []
|
|
1766
|
+
for (const field of fields) {
|
|
1767
|
+
const row = document.createElement('label')
|
|
1768
|
+
row.className = 'field config-field'
|
|
1769
|
+
const label = document.createElement('span')
|
|
1770
|
+
label.className = 'field-label'
|
|
1771
|
+
label.textContent = field.label
|
|
1772
|
+
row.appendChild(label)
|
|
1773
|
+
if (field.kind === 'permissions') {
|
|
1774
|
+
const select = document.createElement('select')
|
|
1775
|
+
select.dataset.key = field.key
|
|
1776
|
+
for (const value of ['ask', 'skip']) {
|
|
1777
|
+
const opt = document.createElement('option')
|
|
1778
|
+
opt.value = value
|
|
1779
|
+
opt.textContent = value === 'ask' ? t('web.askFirst') : t('web.skipPrompts')
|
|
1780
|
+
select.appendChild(opt)
|
|
1781
|
+
}
|
|
1782
|
+
select.value = config[field.key] === 'skip' ? 'skip' : 'ask'
|
|
1783
|
+
row.appendChild(select)
|
|
1784
|
+
} else {
|
|
1785
|
+
const input = document.createElement('input')
|
|
1786
|
+
input.type = 'number'
|
|
1787
|
+
input.dataset.key = field.key
|
|
1788
|
+
input.min = field.kind === 'nonneg-int' ? '0' : '1'
|
|
1789
|
+
input.step = '1'
|
|
1790
|
+
input.value = String(config[field.key] ?? '')
|
|
1791
|
+
row.appendChild(input)
|
|
1792
|
+
}
|
|
1793
|
+
el.configList.appendChild(row)
|
|
1794
|
+
}
|
|
1795
|
+
}
|
|
1796
|
+
|
|
1797
|
+
async function saveConfig() {
|
|
1798
|
+
el.configError.hidden = true
|
|
1799
|
+
const patch = {}
|
|
1800
|
+
for (const node of el.configList.querySelectorAll('[data-key]')) {
|
|
1801
|
+
const key = node.dataset.key
|
|
1802
|
+
patch[key] = node.tagName === 'SELECT' ? node.value : Number(node.value)
|
|
1803
|
+
}
|
|
1804
|
+
try {
|
|
1805
|
+
const payload = await api('POST', '/api/config', patch)
|
|
1806
|
+
renderConfigFields(payload)
|
|
1807
|
+
} catch (err) {
|
|
1808
|
+
el.configError.hidden = false
|
|
1809
|
+
el.configError.textContent = err.message
|
|
1810
|
+
}
|
|
1811
|
+
}
|
|
1812
|
+
|
|
1813
|
+
// --- presets panel --------------------------------------------------------
|
|
1814
|
+
|
|
1815
|
+
function openPresetsDialog() {
|
|
1816
|
+
el.presetsError.hidden = true
|
|
1817
|
+
el.presetNameInput.value = ''
|
|
1818
|
+
el.presetsDialog.showModal()
|
|
1819
|
+
loadPresets()
|
|
1820
|
+
}
|
|
1821
|
+
|
|
1822
|
+
async function loadPresets() {
|
|
1823
|
+
el.presetsError.hidden = true
|
|
1824
|
+
el.presetsList.textContent = t('web.loading')
|
|
1825
|
+
try {
|
|
1826
|
+
const payload = await api('GET', '/api/presets')
|
|
1827
|
+
renderPresets((payload && payload.presets) || [])
|
|
1828
|
+
} catch (err) {
|
|
1829
|
+
el.presetsList.textContent = ''
|
|
1830
|
+
el.presetsError.hidden = false
|
|
1831
|
+
el.presetsError.textContent = err.message
|
|
1832
|
+
}
|
|
1833
|
+
}
|
|
1834
|
+
|
|
1835
|
+
function renderPresets(presets) {
|
|
1836
|
+
el.presetsList.innerHTML = ''
|
|
1837
|
+
for (const preset of presets) {
|
|
1838
|
+
const row = document.createElement('div')
|
|
1839
|
+
row.className = 'mcp-host-row'
|
|
1840
|
+
|
|
1841
|
+
const body = document.createElement('div')
|
|
1842
|
+
body.className = 'mcp-host-body'
|
|
1843
|
+
const name = document.createElement('span')
|
|
1844
|
+
name.className = 'mcp-host-name'
|
|
1845
|
+
const agents = 1 + (Array.isArray(preset.workers) ? preset.workers.length : 0)
|
|
1846
|
+
name.textContent = `${preset.name} (${agentCountLabel(agents)})`
|
|
1847
|
+
body.appendChild(name)
|
|
1848
|
+
if (preset.description) {
|
|
1849
|
+
const meta = document.createElement('span')
|
|
1850
|
+
meta.className = 'mcp-host-meta'
|
|
1851
|
+
meta.textContent = preset.description
|
|
1852
|
+
body.appendChild(meta)
|
|
1853
|
+
}
|
|
1854
|
+
row.appendChild(body)
|
|
1855
|
+
|
|
1856
|
+
const start = document.createElement('button')
|
|
1857
|
+
start.type = 'button'
|
|
1858
|
+
start.className = 'mcp-host-action'
|
|
1859
|
+
start.textContent = t('web.start')
|
|
1860
|
+
start.addEventListener('click', () => startPreset(preset.name))
|
|
1861
|
+
row.appendChild(start)
|
|
1862
|
+
|
|
1863
|
+
const del = document.createElement('button')
|
|
1864
|
+
del.type = 'button'
|
|
1865
|
+
del.className = 'mcp-host-action'
|
|
1866
|
+
del.dataset.kind = 'detach'
|
|
1867
|
+
del.textContent = t('common.delete')
|
|
1868
|
+
del.addEventListener('click', () => deletePreset(preset.name))
|
|
1869
|
+
row.appendChild(del)
|
|
1870
|
+
|
|
1871
|
+
el.presetsList.appendChild(row)
|
|
1872
|
+
}
|
|
1873
|
+
}
|
|
1874
|
+
|
|
1875
|
+
async function startPreset(name) {
|
|
1876
|
+
el.presetsError.hidden = true
|
|
1877
|
+
try {
|
|
1878
|
+
await api('POST', `/api/presets/${encodeURIComponent(name)}/start`, {})
|
|
1879
|
+
el.presetsDialog.close()
|
|
1880
|
+
await refreshState()
|
|
1881
|
+
} catch (err) {
|
|
1882
|
+
el.presetsError.hidden = false
|
|
1883
|
+
el.presetsError.textContent = err.message
|
|
1884
|
+
}
|
|
1885
|
+
}
|
|
1886
|
+
|
|
1887
|
+
async function deletePreset(name) {
|
|
1888
|
+
if (!confirm(`Delete preset "${name}"?`)) return
|
|
1889
|
+
el.presetsError.hidden = true
|
|
1890
|
+
try {
|
|
1891
|
+
await api('POST', `/api/presets/${encodeURIComponent(name)}/delete`, { confirm: true })
|
|
1892
|
+
await loadPresets()
|
|
1893
|
+
} catch (err) {
|
|
1894
|
+
el.presetsError.hidden = false
|
|
1895
|
+
el.presetsError.textContent = err.message
|
|
1896
|
+
}
|
|
1897
|
+
}
|
|
1898
|
+
|
|
1899
|
+
async function savePreset() {
|
|
1900
|
+
el.presetsError.hidden = true
|
|
1901
|
+
const runId = preferredRunId()
|
|
1902
|
+
if (!runId) {
|
|
1903
|
+
el.presetsError.hidden = false
|
|
1904
|
+
el.presetsError.textContent = t('web.presetsNoRun')
|
|
1905
|
+
return
|
|
1906
|
+
}
|
|
1907
|
+
const name = el.presetNameInput.value.trim()
|
|
1908
|
+
try {
|
|
1909
|
+
const payload = await api('POST', '/api/presets/save', { run_id: runId, name, description: '' })
|
|
1910
|
+
el.presetNameInput.value = ''
|
|
1911
|
+
renderPresets((payload && payload.presets) || [])
|
|
1912
|
+
} catch (err) {
|
|
1913
|
+
el.presetsError.hidden = false
|
|
1914
|
+
el.presetsError.textContent = err.message
|
|
1915
|
+
}
|
|
1916
|
+
}
|
|
1917
|
+
|
|
1353
1918
|
// --- wire up --------------------------------------------------------------
|
|
1354
1919
|
|
|
1355
1920
|
el.newAgentBtn.addEventListener('click', () => openAgentDialog(preferredRunId()))
|
|
1356
1921
|
el.newRunBtn.addEventListener('click', openRunDialog)
|
|
1922
|
+
el.agentControlBtn.addEventListener('click', openMcpDialog)
|
|
1923
|
+
el.mcpClose.addEventListener('click', () => el.mcpDialog.close())
|
|
1924
|
+
el.mcpAttachAll.addEventListener('click', attachAllHosts)
|
|
1925
|
+
el.doctorBtn.addEventListener('click', openDoctorDialog)
|
|
1926
|
+
el.doctorRefresh.addEventListener('click', loadDoctor)
|
|
1927
|
+
el.doctorClose.addEventListener('click', () => el.doctorDialog.close())
|
|
1928
|
+
el.aboutBtn.addEventListener('click', openAboutDialog)
|
|
1929
|
+
el.aboutClose.addEventListener('click', () => el.aboutDialog.close())
|
|
1930
|
+
el.configBtn.addEventListener('click', openConfigDialog)
|
|
1931
|
+
el.configSave.addEventListener('click', saveConfig)
|
|
1932
|
+
el.configClose.addEventListener('click', () => el.configDialog.close())
|
|
1933
|
+
el.presetsBtn.addEventListener('click', openPresetsDialog)
|
|
1934
|
+
el.presetSave.addEventListener('click', savePreset)
|
|
1935
|
+
el.presetsClose.addEventListener('click', () => el.presetsDialog.close())
|
|
1357
1936
|
el.emptyNewRun.addEventListener('click', openRunDialog)
|
|
1358
1937
|
el.overlayNewRun.addEventListener('click', openRunDialog)
|
|
1359
1938
|
el.overlayNewAgent.addEventListener('click', () => openAgentDialog(preferredRunId()))
|
|
@@ -1377,10 +1956,10 @@
|
|
|
1377
1956
|
createContext.runId = el.fAgentRun.value
|
|
1378
1957
|
syncCreateFields()
|
|
1379
1958
|
})
|
|
1380
|
-
el.fMode.addEventListener('change', syncCreateFields)
|
|
1381
1959
|
el.fProvider.addEventListener('change', () => {
|
|
1382
1960
|
updateProviderSelection()
|
|
1383
1961
|
renderModels()
|
|
1962
|
+
updateLaunchKnobVisibility()
|
|
1384
1963
|
})
|
|
1385
1964
|
el.languageSelect.addEventListener('change', async () => {
|
|
1386
1965
|
try {
|
|
@@ -1401,10 +1980,6 @@
|
|
|
1401
1980
|
}
|
|
1402
1981
|
el.form.addEventListener('submit', submitNew)
|
|
1403
1982
|
|
|
1404
|
-
function modeLabel(mode) {
|
|
1405
|
-
return mode === 'orchestrator' ? t('web.orchestrator') : t('web.spawner')
|
|
1406
|
-
}
|
|
1407
|
-
|
|
1408
1983
|
function roleLabel(role) {
|
|
1409
1984
|
return role === 'root' ? t('web.roleRoot') : t('web.roleWorker')
|
|
1410
1985
|
}
|