reevesagents 1.2.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +183 -0
- package/CHANGELOG.md +61 -0
- package/README.md +292 -171
- package/dist/{chunk-4Q3JF22J.js → chunk-2LC6V55H.js} +2 -2
- package/dist/chunk-4W6MVOPK.js +29 -0
- 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-YMUISYYB.js +5426 -0
- package/dist/chunk-Z2JHNE7V.js +317 -0
- package/dist/cli.d.ts +4 -1
- package/dist/cli.js +442 -49
- 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-TGRU5BFX.js} +1543 -797
- package/dist/{server-Z2YTGWSX.js → server-GYB53IBP.js} +267 -136
- package/dist/server-H2XEJQYT.js +622 -0
- package/dist/{tui-launch-7RGFE5KY.js → tui-launch-45ERRX5M.js} +2 -2
- package/dist/web/app.css +371 -26
- package/dist/web/app.js +717 -51
- package/dist/web/index.html +115 -10
- package/package.json +25 -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,63 @@
|
|
|
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',
|
|
170
|
+
'web.doctorSubtitle': 'Environment health checks for this machine.',
|
|
171
|
+
'web.refresh': 'Refresh',
|
|
172
|
+
'web.aboutSubtitle': 'Local tmux-first workspace manager for AI CLI agents.',
|
|
173
|
+
'web.configSubtitle': 'Edit global settings.',
|
|
174
|
+
'web.save': 'Save',
|
|
175
|
+
'web.presetsSubtitle': 'Saved agent-team templates.',
|
|
176
|
+
'web.saveCurrentRun': 'Save current run',
|
|
177
|
+
'web.auth': 'Auth',
|
|
178
|
+
'web.authDefaultLogin': 'Default login',
|
|
179
|
+
'web.authApiKey': 'API key',
|
|
180
|
+
'web.authHelp': 'Default uses the signed-in CLI session. API key forces key-based auth.',
|
|
181
|
+
'web.effort': 'Reasoning effort',
|
|
182
|
+
'web.effortLow': 'Low',
|
|
183
|
+
'web.effortMedium': 'Medium',
|
|
184
|
+
'web.effortHigh': 'High',
|
|
185
|
+
'web.effortXhigh': 'Extra high',
|
|
186
|
+
'web.effortMax': 'Max',
|
|
187
|
+
'web.effortHelp': 'Higher effort spends more on reasoning. Provider default is safest.',
|
|
137
188
|
}
|
|
138
189
|
|
|
139
190
|
const el = {
|
|
@@ -142,7 +193,6 @@
|
|
|
142
193
|
sidebarCount: document.getElementById('sidebar-count'),
|
|
143
194
|
conn: document.getElementById('conn'),
|
|
144
195
|
brandDuck: document.getElementById('brand-duck'),
|
|
145
|
-
brandBeta: document.getElementById('brand-beta'),
|
|
146
196
|
languageLabel: document.getElementById('language-label'),
|
|
147
197
|
languageSelect: document.getElementById('language-select'),
|
|
148
198
|
stageTitle: document.getElementById('stage-title'),
|
|
@@ -167,14 +217,16 @@
|
|
|
167
217
|
fProvider: document.getElementById('f-provider'),
|
|
168
218
|
providerGrid: document.getElementById('provider-grid'),
|
|
169
219
|
fModel: document.getElementById('f-model'),
|
|
220
|
+
fAuthMode: document.getElementById('f-auth-mode'),
|
|
221
|
+
fEffort: document.getElementById('f-effort'),
|
|
222
|
+
authModeField: document.getElementById('auth-mode-field'),
|
|
223
|
+
effortField: document.getElementById('effort-field'),
|
|
170
224
|
fPermissions: document.getElementById('f-permissions'),
|
|
171
225
|
permissionGrid: document.getElementById('permission-grid'),
|
|
172
226
|
fNickname: document.getElementById('f-nickname'),
|
|
173
227
|
fRunName: document.getElementById('f-run-name'),
|
|
174
228
|
fAgentRun: document.getElementById('f-agent-run'),
|
|
175
|
-
fMode: document.getElementById('f-mode'),
|
|
176
229
|
agentRunField: document.getElementById('agent-run-field'),
|
|
177
|
-
modeField: document.getElementById('mode-field'),
|
|
178
230
|
runNameField: document.getElementById('run-name-field'),
|
|
179
231
|
fCwd: document.getElementById('f-cwd'),
|
|
180
232
|
cwdField: document.getElementById('cwd-field'),
|
|
@@ -182,19 +234,57 @@
|
|
|
182
234
|
newError: document.getElementById('new-error'),
|
|
183
235
|
newCancel: document.getElementById('new-cancel'),
|
|
184
236
|
newSubmit: document.getElementById('new-submit'),
|
|
237
|
+
agentControlBtn: document.getElementById('agent-control-btn'),
|
|
238
|
+
mcpDialog: document.getElementById('mcp-dialog'),
|
|
239
|
+
mcpDialogTitle: document.getElementById('mcp-dialog-title'),
|
|
240
|
+
mcpDialogSubtitle: document.getElementById('mcp-dialog-subtitle'),
|
|
241
|
+
mcpHostList: document.getElementById('mcp-host-list'),
|
|
242
|
+
mcpEmpty: document.getElementById('mcp-empty'),
|
|
243
|
+
mcpError: document.getElementById('mcp-error'),
|
|
244
|
+
mcpAttachAll: document.getElementById('mcp-attach-all'),
|
|
245
|
+
mcpClose: document.getElementById('mcp-close'),
|
|
246
|
+
doctorBtn: document.getElementById('doctor-btn'),
|
|
247
|
+
doctorDialog: document.getElementById('doctor-dialog'),
|
|
248
|
+
doctorList: document.getElementById('doctor-list'),
|
|
249
|
+
doctorError: document.getElementById('doctor-error'),
|
|
250
|
+
doctorRefresh: document.getElementById('doctor-refresh'),
|
|
251
|
+
doctorClose: document.getElementById('doctor-close'),
|
|
252
|
+
aboutBtn: document.getElementById('about-btn'),
|
|
253
|
+
aboutDialog: document.getElementById('about-dialog'),
|
|
254
|
+
aboutList: document.getElementById('about-list'),
|
|
255
|
+
aboutClose: document.getElementById('about-close'),
|
|
256
|
+
configBtn: document.getElementById('config-btn'),
|
|
257
|
+
configDialog: document.getElementById('config-dialog'),
|
|
258
|
+
configList: document.getElementById('config-list'),
|
|
259
|
+
configError: document.getElementById('config-error'),
|
|
260
|
+
configSave: document.getElementById('config-save'),
|
|
261
|
+
configClose: document.getElementById('config-close'),
|
|
262
|
+
presetsBtn: document.getElementById('presets-btn'),
|
|
263
|
+
presetsDialog: document.getElementById('presets-dialog'),
|
|
264
|
+
presetsList: document.getElementById('presets-list'),
|
|
265
|
+
presetNameInput: document.getElementById('preset-name-input'),
|
|
266
|
+
presetSave: document.getElementById('preset-save'),
|
|
267
|
+
presetsError: document.getElementById('presets-error'),
|
|
268
|
+
presetsClose: document.getElementById('presets-close'),
|
|
185
269
|
}
|
|
186
270
|
|
|
187
271
|
let runs = []
|
|
188
272
|
let history = []
|
|
273
|
+
let approvals = []
|
|
189
274
|
let providers = []
|
|
275
|
+
let appVersion = ''
|
|
190
276
|
let language = 'en'
|
|
191
277
|
let languages = []
|
|
192
278
|
let messages = WEB_EN
|
|
193
|
-
let prebetaOrchestrator = false
|
|
194
279
|
let selectedId = null
|
|
195
280
|
let session = null // { id, ws, term, fit, observer }
|
|
196
281
|
let createContext = { kind: 'run', runId: '' }
|
|
197
282
|
let createSubmitting = false
|
|
283
|
+
let mcpHosts = []
|
|
284
|
+
let mcpBusy = false
|
|
285
|
+
let mcpLoading = false
|
|
286
|
+
let mcpLoadFailed = false
|
|
287
|
+
let doctorLoading = false
|
|
198
288
|
|
|
199
289
|
// --- http helpers ---------------------------------------------------------
|
|
200
290
|
|
|
@@ -230,7 +320,8 @@
|
|
|
230
320
|
providers = data.providers || []
|
|
231
321
|
runs = data.runs || []
|
|
232
322
|
history = data.history || []
|
|
233
|
-
|
|
323
|
+
approvals = data.approvals || []
|
|
324
|
+
appVersion = data.version || ''
|
|
234
325
|
applyLanguage(data.language)
|
|
235
326
|
renderProviders()
|
|
236
327
|
renderSidebar()
|
|
@@ -249,6 +340,7 @@
|
|
|
249
340
|
runs = data.runs
|
|
250
341
|
}
|
|
251
342
|
if (Array.isArray(data.history)) history = data.history
|
|
343
|
+
if (Array.isArray(data.approvals)) approvals = data.approvals
|
|
252
344
|
renderSidebar()
|
|
253
345
|
reconcileCreateDialog()
|
|
254
346
|
reconcileSelectedAgent()
|
|
@@ -296,13 +388,24 @@
|
|
|
296
388
|
}
|
|
297
389
|
|
|
298
390
|
function applyStaticTranslations() {
|
|
299
|
-
el.brandBeta.textContent = prebetaOrchestrator ? t('web.prebeta') : t('web.beta')
|
|
300
391
|
el.languageLabel.textContent = t('web.languageTitle')
|
|
301
392
|
el.languageSelect.setAttribute('aria-label', t('web.languageTitle'))
|
|
302
393
|
el.languageSelect.parentElement.title = t('web.languageTitle')
|
|
303
394
|
el.newAgentBtn.textContent = t('web.newAgent')
|
|
304
395
|
el.newRunBtn.textContent = t('web.newRun')
|
|
305
396
|
el.newRunBtn.title = t('web.newRunTitle')
|
|
397
|
+
el.agentControlBtn.textContent = t('web.agentControl')
|
|
398
|
+
el.agentControlBtn.title = t('web.agentControlTitle')
|
|
399
|
+
el.configBtn.textContent = t('web.config')
|
|
400
|
+
el.presetsBtn.textContent = t('web.presets')
|
|
401
|
+
el.doctorBtn.textContent = t('web.doctor')
|
|
402
|
+
el.aboutBtn.textContent = t('web.about')
|
|
403
|
+
el.mcpDialogTitle.textContent = t('web.mcpTitle')
|
|
404
|
+
el.mcpDialogSubtitle.textContent = t('web.mcpSubtitle')
|
|
405
|
+
el.mcpEmpty.textContent = t('web.mcpEmpty')
|
|
406
|
+
el.mcpAttachAll.textContent = t('web.mcpAttachAll')
|
|
407
|
+
el.mcpClose.textContent = t('web.mcpClose')
|
|
408
|
+
if (el.mcpDialog.open) renderMcpHosts()
|
|
306
409
|
el.emptyNewRun.textContent = t('web.newRun')
|
|
307
410
|
el.overlayNewRun.textContent = t('web.newRun')
|
|
308
411
|
el.overlayNewAgent.textContent = t('web.newAgent')
|
|
@@ -336,9 +439,6 @@
|
|
|
336
439
|
document.querySelector('#f-permissions option[value="ask"]').textContent = t('web.askFirst')
|
|
337
440
|
document.querySelector('#f-permissions option[value="skip"]').textContent = t('web.skipPrompts')
|
|
338
441
|
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
442
|
document.querySelector('#cwd-field .field-label').textContent = t('web.workingDirectory')
|
|
343
443
|
document.querySelector('#f-cwd').placeholder = t('web.cwdPlaceholder')
|
|
344
444
|
document.querySelector('#prompt-field .field-label').innerHTML = `${t('web.initialPrompt')} <span class="field-opt">${t('web.initialPromptOpt')}</span>`
|
|
@@ -348,7 +448,6 @@
|
|
|
348
448
|
setText('#model-help', t('web.modelHelp'))
|
|
349
449
|
setText('#permissions-help', t('web.permissionsHelp'))
|
|
350
450
|
setText('#agent-name-help', t('web.agentNameHelp'))
|
|
351
|
-
setText('#mode-help', t('web.modeHelp'))
|
|
352
451
|
setText('#cwd-help', t('web.cwdHelp'))
|
|
353
452
|
setText('#prompt-help', t('web.promptHelp'))
|
|
354
453
|
el.newCancel.textContent = t('web.cancel')
|
|
@@ -357,6 +456,34 @@
|
|
|
357
456
|
el.stageTitle.textContent = t('web.noAgentSelected')
|
|
358
457
|
el.stageSub.textContent = t('web.noAgentSub')
|
|
359
458
|
}
|
|
459
|
+
document.querySelector('#auth-mode-field .field-label').textContent = t('web.auth')
|
|
460
|
+
document.querySelector('#f-auth-mode option[value=""]').textContent = t('web.authDefaultLogin')
|
|
461
|
+
document.querySelector('#f-auth-mode option[value="api-key"]').textContent = t('web.authApiKey')
|
|
462
|
+
document.querySelector('#auth-mode-field .field-help').textContent = t('web.authHelp')
|
|
463
|
+
document.querySelector('#effort-field .field-label').textContent = t('web.effort')
|
|
464
|
+
document.querySelector('#f-effort option[value=""]').textContent = t('web.providerDefault')
|
|
465
|
+
document.querySelector('#f-effort option[value="low"]').textContent = t('web.effortLow')
|
|
466
|
+
document.querySelector('#f-effort option[value="medium"]').textContent = t('web.effortMedium')
|
|
467
|
+
document.querySelector('#f-effort option[value="high"]').textContent = t('web.effortHigh')
|
|
468
|
+
document.querySelector('#f-effort option[value="xhigh"]').textContent = t('web.effortXhigh')
|
|
469
|
+
document.querySelector('#f-effort option[value="max"]').textContent = t('web.effortMax')
|
|
470
|
+
document.querySelector('#effort-field .field-help').textContent = t('web.effortHelp')
|
|
471
|
+
document.querySelector('#doctor-dialog .dialog-title').textContent = t('web.doctor')
|
|
472
|
+
document.querySelector('#doctor-dialog .dialog-subtitle').textContent = t('web.doctorSubtitle')
|
|
473
|
+
el.doctorRefresh.textContent = t('web.refresh')
|
|
474
|
+
el.doctorClose.textContent = t('web.mcpClose')
|
|
475
|
+
document.querySelector('#about-dialog .dialog-title').textContent = `${t('web.about')} ReevesAgents`
|
|
476
|
+
document.querySelector('#about-dialog .dialog-subtitle').textContent = t('web.aboutSubtitle')
|
|
477
|
+
el.aboutClose.textContent = t('web.mcpClose')
|
|
478
|
+
document.querySelector('#config-dialog .dialog-title').textContent = t('web.config')
|
|
479
|
+
document.querySelector('#config-dialog .dialog-subtitle').textContent = t('web.configSubtitle')
|
|
480
|
+
el.configSave.textContent = t('web.save')
|
|
481
|
+
el.configClose.textContent = t('web.mcpClose')
|
|
482
|
+
document.querySelector('#presets-dialog .dialog-title').textContent = t('web.presets')
|
|
483
|
+
document.querySelector('#presets-dialog .dialog-subtitle').textContent = t('web.presetsSubtitle')
|
|
484
|
+
document.querySelector('#preset-save-field .field-label').textContent = t('web.saveCurrentRun')
|
|
485
|
+
el.presetSave.textContent = t('web.saveCurrentRun')
|
|
486
|
+
el.presetsClose.textContent = t('web.mcpClose')
|
|
360
487
|
renderSidebar()
|
|
361
488
|
}
|
|
362
489
|
|
|
@@ -396,16 +523,13 @@
|
|
|
396
523
|
|
|
397
524
|
function renderProviders() {
|
|
398
525
|
const current = el.fProvider.value
|
|
399
|
-
const mode = selectedCreateMode()
|
|
400
526
|
el.fProvider.innerHTML = ''
|
|
401
527
|
el.providerGrid.innerHTML = ''
|
|
402
528
|
for (const p of providers) {
|
|
403
529
|
const opt = document.createElement('option')
|
|
404
530
|
opt.value = p.id
|
|
405
|
-
const supported = mode !== 'orchestrator' || p.orchestrator === true
|
|
406
531
|
opt.textContent = p.available ? p.name : `${p.name} (${t('web.notInstalled')})`
|
|
407
|
-
|
|
408
|
-
opt.disabled = !p.available || !supported
|
|
532
|
+
opt.disabled = !p.available
|
|
409
533
|
el.fProvider.appendChild(opt)
|
|
410
534
|
|
|
411
535
|
const choice = document.createElement('button')
|
|
@@ -431,7 +555,7 @@
|
|
|
431
555
|
body.appendChild(name)
|
|
432
556
|
const meta = document.createElement('span')
|
|
433
557
|
meta.className = 'provider-meta'
|
|
434
|
-
meta.textContent = providerMeta(p
|
|
558
|
+
meta.textContent = providerMeta(p)
|
|
435
559
|
body.appendChild(meta)
|
|
436
560
|
choice.appendChild(body)
|
|
437
561
|
el.providerGrid.appendChild(choice)
|
|
@@ -442,13 +566,12 @@
|
|
|
442
566
|
else if (firstAvailable) el.fProvider.value = firstAvailable.value
|
|
443
567
|
updateProviderSelection()
|
|
444
568
|
renderModels()
|
|
569
|
+
updateLaunchKnobVisibility()
|
|
445
570
|
updateCreateSubmitState()
|
|
446
571
|
}
|
|
447
572
|
|
|
448
|
-
function providerMeta(provider
|
|
573
|
+
function providerMeta(provider) {
|
|
449
574
|
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
575
|
return t('web.ready')
|
|
453
576
|
}
|
|
454
577
|
|
|
@@ -458,6 +581,7 @@
|
|
|
458
581
|
el.fProvider.value = providerId
|
|
459
582
|
updateProviderSelection()
|
|
460
583
|
renderModels()
|
|
584
|
+
updateLaunchKnobVisibility()
|
|
461
585
|
updateCreateSubmitState()
|
|
462
586
|
}
|
|
463
587
|
|
|
@@ -518,6 +642,18 @@
|
|
|
518
642
|
updateCreateSubmitState()
|
|
519
643
|
}
|
|
520
644
|
|
|
645
|
+
// auth_mode only applies to Claude Code; reasoning effort applies to cc and codex.
|
|
646
|
+
// Hide the irrelevant knobs and reset them so a stale value is never submitted.
|
|
647
|
+
function updateLaunchKnobVisibility() {
|
|
648
|
+
const provider = el.fProvider.value
|
|
649
|
+
const showAuthMode = provider === 'cc'
|
|
650
|
+
const showEffort = provider === 'cc' || provider === 'codex'
|
|
651
|
+
el.authModeField.hidden = !showAuthMode
|
|
652
|
+
el.effortField.hidden = !showEffort
|
|
653
|
+
if (!showAuthMode) el.fAuthMode.value = ''
|
|
654
|
+
if (!showEffort) el.fEffort.value = ''
|
|
655
|
+
}
|
|
656
|
+
|
|
521
657
|
function updatePermissionSelection() {
|
|
522
658
|
for (const option of el.permissionGrid.querySelectorAll('.permission-option')) {
|
|
523
659
|
const active = option.dataset.permission === el.fPermissions.value
|
|
@@ -736,6 +872,24 @@
|
|
|
736
872
|
}
|
|
737
873
|
el.sidebarList.innerHTML = ''
|
|
738
874
|
|
|
875
|
+
if (approvals.length > 0) {
|
|
876
|
+
const group = document.createElement('div')
|
|
877
|
+
group.className = 'approvals-group'
|
|
878
|
+
const head = document.createElement('div')
|
|
879
|
+
head.className = 'approvals-head'
|
|
880
|
+
const title = document.createElement('span')
|
|
881
|
+
title.className = 'approvals-title'
|
|
882
|
+
title.textContent = t('web.approvalsTitle')
|
|
883
|
+
head.appendChild(title)
|
|
884
|
+
const count = document.createElement('span')
|
|
885
|
+
count.className = 'approvals-count'
|
|
886
|
+
count.textContent = String(approvals.length)
|
|
887
|
+
head.appendChild(count)
|
|
888
|
+
group.appendChild(head)
|
|
889
|
+
for (const approval of approvals) group.appendChild(renderApproval(approval))
|
|
890
|
+
el.sidebarList.appendChild(group)
|
|
891
|
+
}
|
|
892
|
+
|
|
739
893
|
for (const run of runsWithAgents) {
|
|
740
894
|
const group = document.createElement('div')
|
|
741
895
|
group.className = 'run-group'
|
|
@@ -753,7 +907,7 @@
|
|
|
753
907
|
headBody.appendChild(name)
|
|
754
908
|
const meta = document.createElement('span')
|
|
755
909
|
meta.className = 'run-meta'
|
|
756
|
-
meta.textContent = `${statusLabel(run.status)} · ${
|
|
910
|
+
meta.textContent = `${statusLabel(run.status)} · ${agentCountLabel(run.terminals.length)}`
|
|
757
911
|
headBody.appendChild(meta)
|
|
758
912
|
head.appendChild(headBody)
|
|
759
913
|
|
|
@@ -817,6 +971,60 @@
|
|
|
817
971
|
updateCreateActions()
|
|
818
972
|
}
|
|
819
973
|
|
|
974
|
+
function renderApproval(approval) {
|
|
975
|
+
const item = document.createElement('div')
|
|
976
|
+
item.className = 'approval-card'
|
|
977
|
+
item.dataset.risk = approval.risk
|
|
978
|
+
if (approval.color) item.style.setProperty('--run-color', approval.color)
|
|
979
|
+
|
|
980
|
+
const body = document.createElement('div')
|
|
981
|
+
body.className = 'approval-body'
|
|
982
|
+
const action = document.createElement('span')
|
|
983
|
+
action.className = 'approval-action'
|
|
984
|
+
action.textContent = approval.action
|
|
985
|
+
action.title = approval.action
|
|
986
|
+
body.appendChild(action)
|
|
987
|
+
const meta = document.createElement('span')
|
|
988
|
+
meta.className = 'approval-meta'
|
|
989
|
+
meta.textContent = `${approval.agent_nickname} · ${approval.run_name} · ${approval.risk}`
|
|
990
|
+
body.appendChild(meta)
|
|
991
|
+
if (approval.summary) {
|
|
992
|
+
const summary = document.createElement('span')
|
|
993
|
+
summary.className = 'approval-summary'
|
|
994
|
+
summary.textContent = approval.summary
|
|
995
|
+
body.appendChild(summary)
|
|
996
|
+
}
|
|
997
|
+
item.appendChild(body)
|
|
998
|
+
|
|
999
|
+
const actions = document.createElement('div')
|
|
1000
|
+
actions.className = 'approval-actions'
|
|
1001
|
+
const approve = document.createElement('button')
|
|
1002
|
+
approve.className = 'approval-approve'
|
|
1003
|
+
approve.type = 'button'
|
|
1004
|
+
approve.textContent = t('web.approve')
|
|
1005
|
+
approve.addEventListener('click', () => resolveApproval(approval, 'approved'))
|
|
1006
|
+
actions.appendChild(approve)
|
|
1007
|
+
const deny = document.createElement('button')
|
|
1008
|
+
deny.className = 'approval-deny'
|
|
1009
|
+
deny.type = 'button'
|
|
1010
|
+
deny.textContent = t('web.deny')
|
|
1011
|
+
deny.addEventListener('click', () => resolveApproval(approval, 'denied'))
|
|
1012
|
+
actions.appendChild(deny)
|
|
1013
|
+
item.appendChild(actions)
|
|
1014
|
+
return item
|
|
1015
|
+
}
|
|
1016
|
+
|
|
1017
|
+
async function resolveApproval(approval, decision) {
|
|
1018
|
+
try {
|
|
1019
|
+
await api('POST', `/api/approvals/${encodeURIComponent(approval.id)}/resolve`, { decision })
|
|
1020
|
+
approvals = approvals.filter(item => item.id !== approval.id)
|
|
1021
|
+
renderSidebar()
|
|
1022
|
+
await refreshState()
|
|
1023
|
+
} catch (err) {
|
|
1024
|
+
alert(err.message)
|
|
1025
|
+
}
|
|
1026
|
+
}
|
|
1027
|
+
|
|
820
1028
|
function renderHistoryRecord(record) {
|
|
821
1029
|
const item = document.createElement('div')
|
|
822
1030
|
item.className = 'history-card'
|
|
@@ -833,7 +1041,7 @@
|
|
|
833
1041
|
const meta = document.createElement('span')
|
|
834
1042
|
meta.className = 'history-meta'
|
|
835
1043
|
const provider = record.root_provider_label || t('web.noRootProvider')
|
|
836
|
-
meta.textContent = `${
|
|
1044
|
+
meta.textContent = `${statusLabel(record.status)} · ${agentCountLabel(record.agent_count)} · ${provider}`
|
|
837
1045
|
body.appendChild(meta)
|
|
838
1046
|
item.appendChild(body)
|
|
839
1047
|
|
|
@@ -885,6 +1093,13 @@
|
|
|
885
1093
|
if (agent.model) meta.append(document.createTextNode(` · ${agent.model}`))
|
|
886
1094
|
body.appendChild(nm)
|
|
887
1095
|
body.appendChild(meta)
|
|
1096
|
+
if (agent.task) {
|
|
1097
|
+
const task = document.createElement('span')
|
|
1098
|
+
task.className = 'card-task'
|
|
1099
|
+
task.textContent = agent.task
|
|
1100
|
+
task.title = agent.task
|
|
1101
|
+
body.appendChild(task)
|
|
1102
|
+
}
|
|
888
1103
|
open.appendChild(body)
|
|
889
1104
|
card.appendChild(open)
|
|
890
1105
|
|
|
@@ -989,7 +1204,7 @@
|
|
|
989
1204
|
renderSidebar()
|
|
990
1205
|
el.overlay.hidden = true
|
|
991
1206
|
el.stageTitle.textContent = found ? found.terminal.nickname : id
|
|
992
|
-
el.stageSub.textContent = found ? `${
|
|
1207
|
+
el.stageSub.textContent = found ? `${found.terminal.provider_label || found.terminal.provider} · ${found.run.name}` : ''
|
|
993
1208
|
if (found) el.termWrap.style.setProperty('--agent-color', found.terminal.color)
|
|
994
1209
|
setStageStatus('connecting', t('web.connecting'))
|
|
995
1210
|
|
|
@@ -1046,7 +1261,7 @@
|
|
|
1046
1261
|
return
|
|
1047
1262
|
}
|
|
1048
1263
|
el.stageTitle.textContent = found.terminal.nickname
|
|
1049
|
-
el.stageSub.textContent = `${
|
|
1264
|
+
el.stageSub.textContent = `${found.terminal.provider_label || found.terminal.provider} · ${found.run.name}`
|
|
1050
1265
|
el.termWrap.style.setProperty('--agent-color', found.terminal.color)
|
|
1051
1266
|
setOverlayCopy(disabledReasonLabel(found.terminal), t('web.unavailableBody'))
|
|
1052
1267
|
setStageStatus('closed', disabledReasonLabel(found.terminal))
|
|
@@ -1194,6 +1409,8 @@
|
|
|
1194
1409
|
el.fNickname.value = ''
|
|
1195
1410
|
el.fRunName.value = ''
|
|
1196
1411
|
el.fModel.value = ''
|
|
1412
|
+
el.fAuthMode.value = ''
|
|
1413
|
+
el.fEffort.value = ''
|
|
1197
1414
|
el.fPermissions.value = 'ask'
|
|
1198
1415
|
el.fPrompt.value = ''
|
|
1199
1416
|
el.fCwd.value = ''
|
|
@@ -1234,7 +1451,7 @@
|
|
|
1234
1451
|
const opt = document.createElement('option')
|
|
1235
1452
|
opt.value = run.id
|
|
1236
1453
|
const count = agentCountLabel(run.terminals.length)
|
|
1237
|
-
opt.textContent = `${run.name} · ${
|
|
1454
|
+
opt.textContent = `${run.name} · ${count}`
|
|
1238
1455
|
el.fAgentRun.appendChild(opt)
|
|
1239
1456
|
}
|
|
1240
1457
|
const hasCurrent = [...el.fAgentRun.options].some(opt => opt.value === current)
|
|
@@ -1248,17 +1465,10 @@
|
|
|
1248
1465
|
return runs.find(item => item.id === createContext.runId && item.status === 'running') || null
|
|
1249
1466
|
}
|
|
1250
1467
|
|
|
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
1468
|
function syncCreateFields() {
|
|
1258
1469
|
const addingToRun = createContext.kind === 'agent'
|
|
1259
1470
|
if (addingToRun) populateAgentRunSelect(createContext.runId)
|
|
1260
1471
|
const run = selectedRunForCreate()
|
|
1261
|
-
const mode = selectedCreateMode()
|
|
1262
1472
|
el.dialog.dataset.intent = addingToRun ? 'agent' : 'run'
|
|
1263
1473
|
el.dialogTitle.textContent = addingToRun ? t('web.addAgent') : t('web.newRun')
|
|
1264
1474
|
el.dialogSubtitle.textContent = addingToRun
|
|
@@ -1269,19 +1479,16 @@
|
|
|
1269
1479
|
el.createAgentTab.setAttribute('aria-selected', String(addingToRun))
|
|
1270
1480
|
el.agentRunField.hidden = !addingToRun
|
|
1271
1481
|
el.runNameField.hidden = addingToRun
|
|
1272
|
-
el.modeField.hidden = !prebetaOrchestrator || addingToRun
|
|
1273
1482
|
el.cwdField.hidden = addingToRun
|
|
1274
1483
|
el.targetRunNote.hidden = !addingToRun
|
|
1275
1484
|
if (addingToRun && run) {
|
|
1276
1485
|
const count = agentCountLabel(run.terminals.length)
|
|
1277
|
-
el.targetRunNote.textContent = t('web.addingTo', { name: run.name,
|
|
1486
|
+
el.targetRunNote.textContent = t('web.addingTo', { name: run.name, count })
|
|
1278
1487
|
} else {
|
|
1279
1488
|
el.targetRunNote.textContent = ''
|
|
1280
1489
|
}
|
|
1281
1490
|
el.fNickname.placeholder = addingToRun ? 'reviewer' : 'lead'
|
|
1282
|
-
el.fPrompt.placeholder =
|
|
1283
|
-
? t('web.orchestratorPromptPlaceholder')
|
|
1284
|
-
: t('web.promptPlaceholder')
|
|
1491
|
+
el.fPrompt.placeholder = t('web.promptPlaceholder')
|
|
1285
1492
|
renderProviders()
|
|
1286
1493
|
updatePermissionSelection()
|
|
1287
1494
|
updateCreateActions()
|
|
@@ -1317,13 +1524,14 @@
|
|
|
1317
1524
|
const payload = {
|
|
1318
1525
|
provider,
|
|
1319
1526
|
model: el.fModel.value,
|
|
1527
|
+
auth_mode: el.fAuthMode.value,
|
|
1528
|
+
effort: el.fEffort.value,
|
|
1320
1529
|
permissions: el.fPermissions.value,
|
|
1321
1530
|
nickname: el.fNickname.value.trim(),
|
|
1322
1531
|
prompt: el.fPrompt.value,
|
|
1323
1532
|
run_id: createContext.kind === 'agent' ? createContext.runId : undefined,
|
|
1324
1533
|
run_name: createContext.kind === 'run' ? el.fRunName.value.trim() || undefined : undefined,
|
|
1325
1534
|
working_dir: createContext.kind === 'run' ? el.fCwd.value.trim() || undefined : undefined,
|
|
1326
|
-
mode: createContext.kind === 'run' ? selectedCreateMode() : undefined,
|
|
1327
1535
|
}
|
|
1328
1536
|
createSubmitting = true
|
|
1329
1537
|
updateCreateSubmitState()
|
|
@@ -1350,10 +1558,472 @@
|
|
|
1350
1558
|
}
|
|
1351
1559
|
}
|
|
1352
1560
|
|
|
1561
|
+
// --- agent control (MCP installer) ----------------------------------------
|
|
1562
|
+
|
|
1563
|
+
function openAboutDialog() {
|
|
1564
|
+
el.aboutList.innerHTML = ''
|
|
1565
|
+
const rows = [
|
|
1566
|
+
[t('web.aboutVersion'), appVersion || t('web.unknown')],
|
|
1567
|
+
[t('web.aboutPurpose'), t('web.aboutPurposeValue')],
|
|
1568
|
+
[t('web.aboutInterface'), t('web.aboutInterfaceValue')],
|
|
1569
|
+
[t('web.aboutRuntime'), t('web.aboutRuntimeValue')],
|
|
1570
|
+
[t('web.aboutProviders'), providers.map(p => p.name).join(', ') || t('web.aboutProvidersNone')],
|
|
1571
|
+
[t('web.aboutLicense'), 'Apache-2.0'],
|
|
1572
|
+
]
|
|
1573
|
+
for (const [label, value] of rows) {
|
|
1574
|
+
const row = document.createElement('div')
|
|
1575
|
+
row.className = 'about-row'
|
|
1576
|
+
const k = document.createElement('span')
|
|
1577
|
+
k.className = 'about-key'
|
|
1578
|
+
k.textContent = label
|
|
1579
|
+
const v = document.createElement('span')
|
|
1580
|
+
v.className = 'about-value'
|
|
1581
|
+
v.textContent = value
|
|
1582
|
+
row.appendChild(k)
|
|
1583
|
+
row.appendChild(v)
|
|
1584
|
+
el.aboutList.appendChild(row)
|
|
1585
|
+
}
|
|
1586
|
+
const repoRow = document.createElement('div')
|
|
1587
|
+
repoRow.className = 'about-row'
|
|
1588
|
+
const repoKey = document.createElement('span')
|
|
1589
|
+
repoKey.className = 'about-key'
|
|
1590
|
+
repoKey.textContent = t('web.aboutRepository')
|
|
1591
|
+
const link = document.createElement('a')
|
|
1592
|
+
link.className = 'about-value about-link'
|
|
1593
|
+
link.href = 'https://github.com/mertkayacs/reevesagents'
|
|
1594
|
+
link.textContent = 'github.com/mertkayacs/reevesagents'
|
|
1595
|
+
link.target = '_blank'
|
|
1596
|
+
link.rel = 'noreferrer'
|
|
1597
|
+
repoRow.appendChild(repoKey)
|
|
1598
|
+
repoRow.appendChild(link)
|
|
1599
|
+
el.aboutList.appendChild(repoRow)
|
|
1600
|
+
el.aboutDialog.showModal()
|
|
1601
|
+
}
|
|
1602
|
+
|
|
1603
|
+
function openDoctorDialog() {
|
|
1604
|
+
el.doctorError.hidden = true
|
|
1605
|
+
el.doctorDialog.showModal()
|
|
1606
|
+
loadDoctor()
|
|
1607
|
+
}
|
|
1608
|
+
|
|
1609
|
+
async function loadDoctor() {
|
|
1610
|
+
if (doctorLoading) return
|
|
1611
|
+
doctorLoading = true
|
|
1612
|
+
el.doctorRefresh.disabled = true
|
|
1613
|
+
el.doctorError.hidden = true
|
|
1614
|
+
el.doctorList.textContent = t('web.runningChecks')
|
|
1615
|
+
try {
|
|
1616
|
+
const result = await api('GET', '/api/doctor')
|
|
1617
|
+
renderDoctorChecks((result && result.checks) || [])
|
|
1618
|
+
} catch (err) {
|
|
1619
|
+
el.doctorList.textContent = ''
|
|
1620
|
+
el.doctorError.hidden = false
|
|
1621
|
+
el.doctorError.textContent = err.message
|
|
1622
|
+
} finally {
|
|
1623
|
+
doctorLoading = false
|
|
1624
|
+
el.doctorRefresh.disabled = false
|
|
1625
|
+
}
|
|
1626
|
+
}
|
|
1627
|
+
|
|
1628
|
+
function renderDoctorChecks(checks) {
|
|
1629
|
+
el.doctorList.innerHTML = ''
|
|
1630
|
+
for (const check of checks) {
|
|
1631
|
+
const row = document.createElement('div')
|
|
1632
|
+
row.className = 'doctor-check'
|
|
1633
|
+
row.dataset.status = check.status
|
|
1634
|
+
const name = document.createElement('span')
|
|
1635
|
+
name.className = 'doctor-check-name'
|
|
1636
|
+
name.textContent = check.name
|
|
1637
|
+
const status = document.createElement('span')
|
|
1638
|
+
status.className = 'doctor-check-status'
|
|
1639
|
+
status.textContent = check.status
|
|
1640
|
+
const detail = document.createElement('span')
|
|
1641
|
+
detail.className = 'doctor-check-detail'
|
|
1642
|
+
detail.textContent = check.detail
|
|
1643
|
+
detail.title = check.detail
|
|
1644
|
+
row.appendChild(name)
|
|
1645
|
+
row.appendChild(status)
|
|
1646
|
+
row.appendChild(detail)
|
|
1647
|
+
el.doctorList.appendChild(row)
|
|
1648
|
+
}
|
|
1649
|
+
}
|
|
1650
|
+
|
|
1651
|
+
function openMcpDialog() {
|
|
1652
|
+
setMcpError(null)
|
|
1653
|
+
mcpHosts = []
|
|
1654
|
+
mcpLoading = true
|
|
1655
|
+
mcpLoadFailed = false
|
|
1656
|
+
renderMcpHosts()
|
|
1657
|
+
el.mcpDialog.showModal()
|
|
1658
|
+
loadMcpHosts()
|
|
1659
|
+
}
|
|
1660
|
+
|
|
1661
|
+
async function loadMcpHosts() {
|
|
1662
|
+
mcpLoading = true
|
|
1663
|
+
mcpLoadFailed = false
|
|
1664
|
+
renderMcpHosts()
|
|
1665
|
+
try {
|
|
1666
|
+
const data = await api('GET', '/api/mcp-hosts')
|
|
1667
|
+
mcpHosts = (data && data.hosts) || []
|
|
1668
|
+
setMcpError(null)
|
|
1669
|
+
} catch (err) {
|
|
1670
|
+
mcpHosts = []
|
|
1671
|
+
mcpLoadFailed = true
|
|
1672
|
+
setMcpError(t('web.mcpLoadError', { message: err.message }))
|
|
1673
|
+
} finally {
|
|
1674
|
+
mcpLoading = false
|
|
1675
|
+
renderMcpHosts()
|
|
1676
|
+
}
|
|
1677
|
+
}
|
|
1678
|
+
|
|
1679
|
+
function hostStatusLabel(host) {
|
|
1680
|
+
if (!host.installed) return t('web.mcpNotInstalled')
|
|
1681
|
+
if (host.manual) return t('web.mcpManual')
|
|
1682
|
+
return host.attached ? t('web.mcpAttached') : t('web.mcpDetached')
|
|
1683
|
+
}
|
|
1684
|
+
|
|
1685
|
+
function hostStatusKind(host) {
|
|
1686
|
+
if (!host.installed) return 'absent'
|
|
1687
|
+
if (host.manual) return 'manual'
|
|
1688
|
+
return host.attached ? 'attached' : 'detached'
|
|
1689
|
+
}
|
|
1690
|
+
|
|
1691
|
+
function renderMcpHosts() {
|
|
1692
|
+
el.mcpHostList.innerHTML = ''
|
|
1693
|
+
if (mcpLoading) {
|
|
1694
|
+
el.mcpEmpty.hidden = true
|
|
1695
|
+
const row = document.createElement('div')
|
|
1696
|
+
row.className = 'mcp-host-row'
|
|
1697
|
+
row.dataset.state = 'loading'
|
|
1698
|
+
const body = document.createElement('div')
|
|
1699
|
+
body.className = 'mcp-host-body'
|
|
1700
|
+
const name = document.createElement('span')
|
|
1701
|
+
name.className = 'mcp-host-name'
|
|
1702
|
+
name.textContent = t('web.loading')
|
|
1703
|
+
body.appendChild(name)
|
|
1704
|
+
row.appendChild(body)
|
|
1705
|
+
const status = document.createElement('span')
|
|
1706
|
+
status.className = 'mcp-host-status'
|
|
1707
|
+
status.textContent = t('web.loading')
|
|
1708
|
+
row.appendChild(status)
|
|
1709
|
+
el.mcpHostList.appendChild(row)
|
|
1710
|
+
el.mcpAttachAll.disabled = true
|
|
1711
|
+
return
|
|
1712
|
+
}
|
|
1713
|
+
if (mcpLoadFailed) {
|
|
1714
|
+
el.mcpEmpty.hidden = true
|
|
1715
|
+
el.mcpAttachAll.disabled = true
|
|
1716
|
+
return
|
|
1717
|
+
}
|
|
1718
|
+
el.mcpEmpty.hidden = mcpHosts.length > 0
|
|
1719
|
+
for (const host of mcpHosts) {
|
|
1720
|
+
const row = document.createElement('div')
|
|
1721
|
+
row.className = 'mcp-host-row'
|
|
1722
|
+
row.dataset.state = hostStatusKind(host)
|
|
1723
|
+
|
|
1724
|
+
const body = document.createElement('div')
|
|
1725
|
+
body.className = 'mcp-host-body'
|
|
1726
|
+
const name = document.createElement('span')
|
|
1727
|
+
name.className = 'mcp-host-name'
|
|
1728
|
+
name.textContent = host.label
|
|
1729
|
+
body.appendChild(name)
|
|
1730
|
+
const meta = document.createElement('span')
|
|
1731
|
+
meta.className = 'mcp-host-meta'
|
|
1732
|
+
meta.textContent = host.bin
|
|
1733
|
+
body.appendChild(meta)
|
|
1734
|
+
row.appendChild(body)
|
|
1735
|
+
|
|
1736
|
+
const status = document.createElement('span')
|
|
1737
|
+
status.className = 'mcp-host-status'
|
|
1738
|
+
status.textContent = hostStatusLabel(host)
|
|
1739
|
+
row.appendChild(status)
|
|
1740
|
+
|
|
1741
|
+
if (host.installed && !host.manual) {
|
|
1742
|
+
const btn = document.createElement('button')
|
|
1743
|
+
btn.type = 'button'
|
|
1744
|
+
btn.className = 'mcp-host-action'
|
|
1745
|
+
btn.dataset.kind = host.attached ? 'detach' : 'attach'
|
|
1746
|
+
btn.textContent = host.attached ? t('web.mcpDetach') : t('web.mcpAttach')
|
|
1747
|
+
btn.title = host.attached ? t('web.mcpDetachHint') : t('web.mcpAttachHint')
|
|
1748
|
+
btn.disabled = mcpBusy
|
|
1749
|
+
btn.addEventListener('click', () => host.attached ? detachHost(host) : attachHost(host))
|
|
1750
|
+
row.appendChild(btn)
|
|
1751
|
+
} else if (host.manual) {
|
|
1752
|
+
const note = document.createElement('span')
|
|
1753
|
+
note.className = 'mcp-host-note'
|
|
1754
|
+
note.textContent = t('web.mcpManualHint')
|
|
1755
|
+
row.appendChild(note)
|
|
1756
|
+
}
|
|
1757
|
+
el.mcpHostList.appendChild(row)
|
|
1758
|
+
}
|
|
1759
|
+
el.mcpAttachAll.disabled = mcpBusy || mcpLoading || !mcpHosts.some(h => h.installed && !h.manual && !h.attached)
|
|
1760
|
+
}
|
|
1761
|
+
|
|
1762
|
+
function setMcpError(message) {
|
|
1763
|
+
if (!message) { el.mcpError.hidden = true; el.mcpError.textContent = ''; return }
|
|
1764
|
+
el.mcpError.textContent = message
|
|
1765
|
+
el.mcpError.hidden = false
|
|
1766
|
+
}
|
|
1767
|
+
|
|
1768
|
+
function applyMcpResult(data) {
|
|
1769
|
+
if (data && Array.isArray(data.hosts)) {
|
|
1770
|
+
mcpLoadFailed = false
|
|
1771
|
+
mcpHosts = data.hosts
|
|
1772
|
+
renderMcpHosts()
|
|
1773
|
+
}
|
|
1774
|
+
}
|
|
1775
|
+
|
|
1776
|
+
async function attachHost(host) {
|
|
1777
|
+
if (mcpBusy || mcpLoading) return
|
|
1778
|
+
mcpBusy = true
|
|
1779
|
+
setMcpError(null)
|
|
1780
|
+
renderMcpHosts()
|
|
1781
|
+
try {
|
|
1782
|
+
const data = await api('POST', '/api/mcp-hosts/attach', { key: host.key })
|
|
1783
|
+
applyMcpResult(data)
|
|
1784
|
+
if (data && data.result && data.result.ok === false) {
|
|
1785
|
+
setMcpError(t('web.mcpAttachError', { name: host.label, message: data.result.message }))
|
|
1786
|
+
}
|
|
1787
|
+
} catch (err) {
|
|
1788
|
+
setMcpError(t('web.mcpAttachError', { name: host.label, message: err.message }))
|
|
1789
|
+
} finally {
|
|
1790
|
+
mcpBusy = false
|
|
1791
|
+
renderMcpHosts()
|
|
1792
|
+
}
|
|
1793
|
+
}
|
|
1794
|
+
|
|
1795
|
+
async function detachHost(host) {
|
|
1796
|
+
if (mcpBusy || mcpLoading) return
|
|
1797
|
+
mcpBusy = true
|
|
1798
|
+
setMcpError(null)
|
|
1799
|
+
renderMcpHosts()
|
|
1800
|
+
try {
|
|
1801
|
+
const data = await api('POST', '/api/mcp-hosts/detach', { key: host.key })
|
|
1802
|
+
applyMcpResult(data)
|
|
1803
|
+
if (data && data.result && data.result.ok === false) {
|
|
1804
|
+
setMcpError(t('web.mcpDetachError', { name: host.label, message: data.result.message }))
|
|
1805
|
+
}
|
|
1806
|
+
} catch (err) {
|
|
1807
|
+
setMcpError(t('web.mcpDetachError', { name: host.label, message: err.message }))
|
|
1808
|
+
} finally {
|
|
1809
|
+
mcpBusy = false
|
|
1810
|
+
renderMcpHosts()
|
|
1811
|
+
}
|
|
1812
|
+
}
|
|
1813
|
+
|
|
1814
|
+
async function attachAllHosts() {
|
|
1815
|
+
if (mcpBusy || mcpLoading || mcpLoadFailed) return
|
|
1816
|
+
mcpBusy = true
|
|
1817
|
+
setMcpError(null)
|
|
1818
|
+
renderMcpHosts()
|
|
1819
|
+
try {
|
|
1820
|
+
const data = await api('POST', '/api/mcp-hosts/attach-all', {})
|
|
1821
|
+
applyMcpResult(data)
|
|
1822
|
+
const failed = ((data && data.results) || []).filter(r => !r.ok)
|
|
1823
|
+
if (failed.length > 0) setMcpError(t('web.mcpAttachAllError', { message: failed.map(r => r.message).join('; ') }))
|
|
1824
|
+
} catch (err) {
|
|
1825
|
+
setMcpError(t('web.mcpAttachAllError', { message: err.message }))
|
|
1826
|
+
} finally {
|
|
1827
|
+
mcpBusy = false
|
|
1828
|
+
renderMcpHosts()
|
|
1829
|
+
}
|
|
1830
|
+
}
|
|
1831
|
+
|
|
1832
|
+
// --- config panel ---------------------------------------------------------
|
|
1833
|
+
|
|
1834
|
+
function openConfigDialog() {
|
|
1835
|
+
el.configError.hidden = true
|
|
1836
|
+
el.configDialog.showModal()
|
|
1837
|
+
loadConfig()
|
|
1838
|
+
}
|
|
1839
|
+
|
|
1840
|
+
async function loadConfig() {
|
|
1841
|
+
el.configError.hidden = true
|
|
1842
|
+
el.configList.textContent = t('web.loading')
|
|
1843
|
+
try {
|
|
1844
|
+
const payload = await api('GET', '/api/config')
|
|
1845
|
+
renderConfigFields(payload)
|
|
1846
|
+
} catch (err) {
|
|
1847
|
+
el.configList.textContent = ''
|
|
1848
|
+
el.configError.hidden = false
|
|
1849
|
+
el.configError.textContent = err.message
|
|
1850
|
+
}
|
|
1851
|
+
}
|
|
1852
|
+
|
|
1853
|
+
function renderConfigFields(payload) {
|
|
1854
|
+
el.configList.innerHTML = ''
|
|
1855
|
+
const config = (payload && payload.config) || {}
|
|
1856
|
+
const fields = (payload && payload.fields) || []
|
|
1857
|
+
for (const field of fields) {
|
|
1858
|
+
const row = document.createElement('label')
|
|
1859
|
+
row.className = 'field config-field'
|
|
1860
|
+
const label = document.createElement('span')
|
|
1861
|
+
label.className = 'field-label'
|
|
1862
|
+
label.textContent = field.label
|
|
1863
|
+
row.appendChild(label)
|
|
1864
|
+
if (field.kind === 'permissions') {
|
|
1865
|
+
const select = document.createElement('select')
|
|
1866
|
+
select.dataset.key = field.key
|
|
1867
|
+
for (const value of ['ask', 'skip']) {
|
|
1868
|
+
const opt = document.createElement('option')
|
|
1869
|
+
opt.value = value
|
|
1870
|
+
opt.textContent = value === 'ask' ? t('web.askFirst') : t('web.skipPrompts')
|
|
1871
|
+
select.appendChild(opt)
|
|
1872
|
+
}
|
|
1873
|
+
select.value = config[field.key] === 'skip' ? 'skip' : 'ask'
|
|
1874
|
+
row.appendChild(select)
|
|
1875
|
+
} else {
|
|
1876
|
+
const input = document.createElement('input')
|
|
1877
|
+
input.type = 'number'
|
|
1878
|
+
input.dataset.key = field.key
|
|
1879
|
+
input.min = field.kind === 'nonneg-int' ? '0' : '1'
|
|
1880
|
+
input.step = '1'
|
|
1881
|
+
input.value = String(config[field.key] ?? '')
|
|
1882
|
+
row.appendChild(input)
|
|
1883
|
+
}
|
|
1884
|
+
el.configList.appendChild(row)
|
|
1885
|
+
}
|
|
1886
|
+
}
|
|
1887
|
+
|
|
1888
|
+
async function saveConfig() {
|
|
1889
|
+
el.configError.hidden = true
|
|
1890
|
+
const patch = {}
|
|
1891
|
+
for (const node of el.configList.querySelectorAll('[data-key]')) {
|
|
1892
|
+
const key = node.dataset.key
|
|
1893
|
+
patch[key] = node.tagName === 'SELECT' ? node.value : Number(node.value)
|
|
1894
|
+
}
|
|
1895
|
+
try {
|
|
1896
|
+
const payload = await api('POST', '/api/config', patch)
|
|
1897
|
+
renderConfigFields(payload)
|
|
1898
|
+
} catch (err) {
|
|
1899
|
+
el.configError.hidden = false
|
|
1900
|
+
el.configError.textContent = err.message
|
|
1901
|
+
}
|
|
1902
|
+
}
|
|
1903
|
+
|
|
1904
|
+
// --- presets panel --------------------------------------------------------
|
|
1905
|
+
|
|
1906
|
+
function openPresetsDialog() {
|
|
1907
|
+
el.presetsError.hidden = true
|
|
1908
|
+
el.presetNameInput.value = ''
|
|
1909
|
+
el.presetsDialog.showModal()
|
|
1910
|
+
loadPresets()
|
|
1911
|
+
}
|
|
1912
|
+
|
|
1913
|
+
async function loadPresets() {
|
|
1914
|
+
el.presetsError.hidden = true
|
|
1915
|
+
el.presetsList.textContent = t('web.loading')
|
|
1916
|
+
try {
|
|
1917
|
+
const payload = await api('GET', '/api/presets')
|
|
1918
|
+
renderPresets((payload && payload.presets) || [])
|
|
1919
|
+
} catch (err) {
|
|
1920
|
+
el.presetsList.textContent = ''
|
|
1921
|
+
el.presetsError.hidden = false
|
|
1922
|
+
el.presetsError.textContent = err.message
|
|
1923
|
+
}
|
|
1924
|
+
}
|
|
1925
|
+
|
|
1926
|
+
function renderPresets(presets) {
|
|
1927
|
+
el.presetsList.innerHTML = ''
|
|
1928
|
+
for (const preset of presets) {
|
|
1929
|
+
const row = document.createElement('div')
|
|
1930
|
+
row.className = 'mcp-host-row'
|
|
1931
|
+
|
|
1932
|
+
const body = document.createElement('div')
|
|
1933
|
+
body.className = 'mcp-host-body'
|
|
1934
|
+
const name = document.createElement('span')
|
|
1935
|
+
name.className = 'mcp-host-name'
|
|
1936
|
+
const agents = 1 + (Array.isArray(preset.workers) ? preset.workers.length : 0)
|
|
1937
|
+
name.textContent = `${preset.name} (${agentCountLabel(agents)})`
|
|
1938
|
+
body.appendChild(name)
|
|
1939
|
+
if (preset.description) {
|
|
1940
|
+
const meta = document.createElement('span')
|
|
1941
|
+
meta.className = 'mcp-host-meta'
|
|
1942
|
+
meta.textContent = preset.description
|
|
1943
|
+
body.appendChild(meta)
|
|
1944
|
+
}
|
|
1945
|
+
row.appendChild(body)
|
|
1946
|
+
|
|
1947
|
+
const start = document.createElement('button')
|
|
1948
|
+
start.type = 'button'
|
|
1949
|
+
start.className = 'mcp-host-action'
|
|
1950
|
+
start.textContent = t('web.start')
|
|
1951
|
+
start.addEventListener('click', () => startPreset(preset.name))
|
|
1952
|
+
row.appendChild(start)
|
|
1953
|
+
|
|
1954
|
+
const del = document.createElement('button')
|
|
1955
|
+
del.type = 'button'
|
|
1956
|
+
del.className = 'mcp-host-action'
|
|
1957
|
+
del.dataset.kind = 'detach'
|
|
1958
|
+
del.textContent = t('common.delete')
|
|
1959
|
+
del.addEventListener('click', () => deletePreset(preset.name))
|
|
1960
|
+
row.appendChild(del)
|
|
1961
|
+
|
|
1962
|
+
el.presetsList.appendChild(row)
|
|
1963
|
+
}
|
|
1964
|
+
}
|
|
1965
|
+
|
|
1966
|
+
async function startPreset(name) {
|
|
1967
|
+
el.presetsError.hidden = true
|
|
1968
|
+
try {
|
|
1969
|
+
await api('POST', `/api/presets/${encodeURIComponent(name)}/start`, {})
|
|
1970
|
+
el.presetsDialog.close()
|
|
1971
|
+
await refreshState()
|
|
1972
|
+
} catch (err) {
|
|
1973
|
+
el.presetsError.hidden = false
|
|
1974
|
+
el.presetsError.textContent = err.message
|
|
1975
|
+
}
|
|
1976
|
+
}
|
|
1977
|
+
|
|
1978
|
+
async function deletePreset(name) {
|
|
1979
|
+
if (!confirm(`Delete preset "${name}"?`)) return
|
|
1980
|
+
el.presetsError.hidden = true
|
|
1981
|
+
try {
|
|
1982
|
+
await api('POST', `/api/presets/${encodeURIComponent(name)}/delete`, { confirm: true })
|
|
1983
|
+
await loadPresets()
|
|
1984
|
+
} catch (err) {
|
|
1985
|
+
el.presetsError.hidden = false
|
|
1986
|
+
el.presetsError.textContent = err.message
|
|
1987
|
+
}
|
|
1988
|
+
}
|
|
1989
|
+
|
|
1990
|
+
async function savePreset() {
|
|
1991
|
+
el.presetsError.hidden = true
|
|
1992
|
+
const runId = preferredRunId()
|
|
1993
|
+
if (!runId) {
|
|
1994
|
+
el.presetsError.hidden = false
|
|
1995
|
+
el.presetsError.textContent = t('web.presetsNoRun')
|
|
1996
|
+
return
|
|
1997
|
+
}
|
|
1998
|
+
const name = el.presetNameInput.value.trim()
|
|
1999
|
+
try {
|
|
2000
|
+
const payload = await api('POST', '/api/presets/save', { run_id: runId, name, description: '' })
|
|
2001
|
+
el.presetNameInput.value = ''
|
|
2002
|
+
renderPresets((payload && payload.presets) || [])
|
|
2003
|
+
} catch (err) {
|
|
2004
|
+
el.presetsError.hidden = false
|
|
2005
|
+
el.presetsError.textContent = err.message
|
|
2006
|
+
}
|
|
2007
|
+
}
|
|
2008
|
+
|
|
1353
2009
|
// --- wire up --------------------------------------------------------------
|
|
1354
2010
|
|
|
1355
2011
|
el.newAgentBtn.addEventListener('click', () => openAgentDialog(preferredRunId()))
|
|
1356
2012
|
el.newRunBtn.addEventListener('click', openRunDialog)
|
|
2013
|
+
el.agentControlBtn.addEventListener('click', openMcpDialog)
|
|
2014
|
+
el.mcpClose.addEventListener('click', () => el.mcpDialog.close())
|
|
2015
|
+
el.mcpAttachAll.addEventListener('click', attachAllHosts)
|
|
2016
|
+
el.doctorBtn.addEventListener('click', openDoctorDialog)
|
|
2017
|
+
el.doctorRefresh.addEventListener('click', loadDoctor)
|
|
2018
|
+
el.doctorClose.addEventListener('click', () => el.doctorDialog.close())
|
|
2019
|
+
el.aboutBtn.addEventListener('click', openAboutDialog)
|
|
2020
|
+
el.aboutClose.addEventListener('click', () => el.aboutDialog.close())
|
|
2021
|
+
el.configBtn.addEventListener('click', openConfigDialog)
|
|
2022
|
+
el.configSave.addEventListener('click', saveConfig)
|
|
2023
|
+
el.configClose.addEventListener('click', () => el.configDialog.close())
|
|
2024
|
+
el.presetsBtn.addEventListener('click', openPresetsDialog)
|
|
2025
|
+
el.presetSave.addEventListener('click', savePreset)
|
|
2026
|
+
el.presetsClose.addEventListener('click', () => el.presetsDialog.close())
|
|
1357
2027
|
el.emptyNewRun.addEventListener('click', openRunDialog)
|
|
1358
2028
|
el.overlayNewRun.addEventListener('click', openRunDialog)
|
|
1359
2029
|
el.overlayNewAgent.addEventListener('click', () => openAgentDialog(preferredRunId()))
|
|
@@ -1377,10 +2047,10 @@
|
|
|
1377
2047
|
createContext.runId = el.fAgentRun.value
|
|
1378
2048
|
syncCreateFields()
|
|
1379
2049
|
})
|
|
1380
|
-
el.fMode.addEventListener('change', syncCreateFields)
|
|
1381
2050
|
el.fProvider.addEventListener('change', () => {
|
|
1382
2051
|
updateProviderSelection()
|
|
1383
2052
|
renderModels()
|
|
2053
|
+
updateLaunchKnobVisibility()
|
|
1384
2054
|
})
|
|
1385
2055
|
el.languageSelect.addEventListener('change', async () => {
|
|
1386
2056
|
try {
|
|
@@ -1401,10 +2071,6 @@
|
|
|
1401
2071
|
}
|
|
1402
2072
|
el.form.addEventListener('submit', submitNew)
|
|
1403
2073
|
|
|
1404
|
-
function modeLabel(mode) {
|
|
1405
|
-
return mode === 'orchestrator' ? t('web.orchestrator') : t('web.spawner')
|
|
1406
|
-
}
|
|
1407
|
-
|
|
1408
2074
|
function roleLabel(role) {
|
|
1409
2075
|
return role === 'root' ? t('web.roleRoot') : t('web.roleWorker')
|
|
1410
2076
|
}
|