@clagentic/console 1.11.0-beta.1 → 1.11.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -1
- package/bin/cli.js +24 -14
- package/lib/bash-auto-approve.js +1 -1
- package/lib/build-sha.json +2 -2
- package/lib/cli/arg-validation.js +50 -0
- package/lib/cli/daemon-launch.js +5 -4
- package/lib/cli/menus.js +2 -2
- package/lib/cli/session-subcommands.js +3 -2
- package/lib/daemon.js +18 -1
- package/lib/identity/index.js +9 -4
- package/lib/permission-mode-policy.js +2 -2
- package/lib/permission-settings.js +96 -0
- package/lib/project-connection.js +9 -11
- package/lib/project-loop.js +24 -3
- package/lib/project-permission-settings.js +59 -0
- package/lib/project-prompt-responses.js +7 -3
- package/lib/project-sessions.js +93 -41
- package/lib/project.js +11 -13
- package/lib/public/app.js +1 -2
- package/lib/public/css/overlays.css +0 -3
- package/lib/public/css/scheduler-modal.css +5 -0
- package/lib/public/index.html +44 -8
- package/lib/public/modules/app-loop-ui.js +11 -1
- package/lib/public/modules/app-messages.js +4 -13
- package/lib/public/modules/app-panels.js +1 -1
- package/lib/public/modules/app-rate-limit.js +1 -1
- package/lib/public/modules/approve-tools-toggle.js +33 -0
- package/lib/public/modules/loop-hooks-warning.js +20 -0
- package/lib/public/modules/mode-options.js +16 -0
- package/lib/public/modules/permission-settings.js +56 -0
- package/lib/public/modules/project-settings.js +3 -0
- package/lib/public/modules/scheduler-config.js +12 -0
- package/lib/public/modules/scheduler.js +8 -0
- package/lib/public/modules/server-settings.js +5 -9
- package/lib/public/modules/settings-defaults.js +18 -4
- package/lib/scheduler.js +4 -0
- package/lib/sdk-bridge.js +74 -40
- package/lib/server.js +9 -3
- package/lib/session-input-ipc.js +1 -0
- package/lib/session-input.js +41 -4
- package/lib/session-resume.js +2 -0
- package/lib/sessions.js +67 -2
- package/lib/updater.js +8 -2
- package/lib/ws-schema.js +5 -2
- package/lib/yoke/adapters/claude.js +0 -10
- package/package.json +1 -1
|
@@ -9,6 +9,8 @@ import { showConfirm } from './app-misc.js';
|
|
|
9
9
|
import { openRalphWizard } from './app-loop-wizard.js';
|
|
10
10
|
import { openSchedulerToTab } from './scheduler.js';
|
|
11
11
|
import { renderModelList, renderModeList, renderEffortBar, renderThinkingBar } from './settings-defaults.js';
|
|
12
|
+
import { approveToolsCardHtml, bindApproveToolsToggle } from './approve-tools-toggle.js';
|
|
13
|
+
import { loopHooksWarningHtml } from './loop-hooks-warning.js';
|
|
12
14
|
|
|
13
15
|
// Execution modal: module-internal UI var (not in store)
|
|
14
16
|
var pendingIterations = 20;
|
|
@@ -167,7 +169,7 @@ function startLoopFromUi() {
|
|
|
167
169
|
function sendLoopStart() {
|
|
168
170
|
var ws = getWs();
|
|
169
171
|
if (ws && ws.readyState === 1) {
|
|
170
|
-
var msg = { type: "loop_start", maxIterations: pendingIterations };
|
|
172
|
+
var msg = { type: "loop_start", maxIterations: pendingIterations, approveToolsAutomatically: _previewApproveTools };
|
|
171
173
|
if (Object.keys(_previewLoopSettings).length > 0) {
|
|
172
174
|
msg.settings = _previewLoopSettings;
|
|
173
175
|
}
|
|
@@ -806,6 +808,7 @@ export function openRalphPreviewModal() {
|
|
|
806
808
|
if (runBtn) runBtn.disabled = !store.get('ralphFilesReady').bothReady;
|
|
807
809
|
|
|
808
810
|
_previewLoopSettings = {};
|
|
811
|
+
_previewApproveTools = true;
|
|
809
812
|
showRalphPreviewTab("prompt");
|
|
810
813
|
modal.classList.remove("hidden");
|
|
811
814
|
refreshIcons();
|
|
@@ -819,6 +822,9 @@ function closeRalphPreviewModal() {
|
|
|
819
822
|
|
|
820
823
|
// Pending loop settings for the preview modal (saved to LOOP.json on launch)
|
|
821
824
|
var _previewLoopSettings = {};
|
|
825
|
+
// "Approve tools automatically during this loop" for the loop being started;
|
|
826
|
+
// on until the person turns it off.
|
|
827
|
+
var _previewApproveTools = true;
|
|
822
828
|
|
|
823
829
|
function getPreviewLoopSettings() { return _previewLoopSettings; }
|
|
824
830
|
|
|
@@ -878,6 +884,8 @@ function renderPreviewModelTab(bodyEl) {
|
|
|
878
884
|
'<input id="rp-thinking-budget" type="number" class="settings-budget-input" min="1024" max="128000" step="1024" value="10000">' +
|
|
879
885
|
'</div>' +
|
|
880
886
|
'</div></div>' +
|
|
887
|
+
approveToolsCardHtml("rp") +
|
|
888
|
+
loopHooksWarningHtml(_previewLoopSettings) +
|
|
881
889
|
'</div>';
|
|
882
890
|
|
|
883
891
|
function savePreviewSetting(key, value) {
|
|
@@ -912,4 +920,6 @@ function renderPreviewModelTab(bodyEl) {
|
|
|
912
920
|
renderModeList("rp", opts);
|
|
913
921
|
renderEffortBar("rp", opts);
|
|
914
922
|
renderThinkingBar("rp", opts);
|
|
923
|
+
// Sent with loop_start, which puts it on the loop's record.
|
|
924
|
+
bindApproveToolsToggle("rp", _previewApproveTools, function (approve) { _previewApproveTools = approve; });
|
|
915
925
|
}
|
|
@@ -41,6 +41,7 @@ import { handleFsRead, refreshIfOpen } from './filebrowser.js';
|
|
|
41
41
|
import { isProjectSettingsOpen, refreshProjectSettingsModels, handleInstructionsRead, handleInstructionsWrite, handleProjectEnv, handleProjectEnvSaved, handleProjectSharedEnv, handleProjectSharedEnvSaved, handleProjectOwnerChanged, updateLiteVisibility, handleLiteProjectStatus, handleLiteEnrollResult, handleLiteUnenrollResult } from './project-settings.js';
|
|
42
42
|
import { updateSettingsModels, updateSettingsStats, updateDaemonConfig, handleSharedEnv, handleSharedEnvSaved, updateSsLiteVisibility } from './server-settings.js';
|
|
43
43
|
import { handleRenameCustomIconResult } from './custom-icons-settings.js';
|
|
44
|
+
import { handlePermissionSettings, handlePermissionModeApplied } from './permission-settings.js';
|
|
44
45
|
import { handleTermList, handleTermCreated, sendTerminalCommand, handleTermOutput, handleTermResized, handleTermExited, handleTermClosed } from './terminal.js';
|
|
45
46
|
import { updateTerminalList, handleContextSourcesState } from './context-sources.js';
|
|
46
47
|
import { handleNotesList, handleNoteCreated, handleNoteUpdated, handleNoteDeleted } from './sticky-notes.js';
|
|
@@ -191,19 +192,6 @@ registerHandlers({
|
|
|
191
192
|
if (msg.ownerLocked !== undefined) store.set({ ownerLocked: !!msg.ownerLocked });
|
|
192
193
|
if (msg.osUsers !== undefined) store.set({ isOsUsers: !!msg.osUsers });
|
|
193
194
|
if (msg.lanHost) window.__lanHost = msg.lanHost;
|
|
194
|
-
if (msg.dangerouslySkipPermissions) {
|
|
195
|
-
store.set({ skipPermsEnabled: true });
|
|
196
|
-
var spBanner = document.getElementById("skip-perms-pill");
|
|
197
|
-
if (spBanner) spBanner.classList.remove("hidden");
|
|
198
|
-
}
|
|
199
|
-
if (msg.dangerouslySkipPermissionsBlocked) {
|
|
200
|
-
// The server config has dangerouslySkipPermissions=true but it is disabled
|
|
201
|
-
// because multi-user mode is active. Warn admins so they know the config
|
|
202
|
-
// flag has no effect and remove it to avoid confusion.
|
|
203
|
-
if (store.get('permissions') && store.get('permissions').projectSettings !== false) {
|
|
204
|
-
showToast("dangerouslySkipPermissions is set in config but is disabled in multi-user mode. All users have normal tool-approval rules.", "warn");
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
195
|
updateProjectList(msg);
|
|
208
196
|
if (msg.liteInstalled !== undefined) {
|
|
209
197
|
updateLiteVisibility(!!msg.liteInstalled);
|
|
@@ -303,6 +291,9 @@ registerHandlers({
|
|
|
303
291
|
applyVendorRegistry(msg);
|
|
304
292
|
},
|
|
305
293
|
|
|
294
|
+
permission_settings: handlePermissionSettings,
|
|
295
|
+
permission_mode_applied: handlePermissionModeApplied,
|
|
296
|
+
|
|
306
297
|
config_state: function (msg) {
|
|
307
298
|
var _cs = {};
|
|
308
299
|
if (msg.model) _cs.currentModel = msg.model;
|
|
@@ -267,7 +267,7 @@ function rebuildModeList() {
|
|
|
267
267
|
appendUnavailableNote(configModeList, modeGate.reason);
|
|
268
268
|
return;
|
|
269
269
|
}
|
|
270
|
-
var options = modeOptions(currentCapabilities(),
|
|
270
|
+
var options = modeOptions(currentCapabilities(), false);
|
|
271
271
|
for (var i = 0; i < options.length; i++) {
|
|
272
272
|
var opt = options[i];
|
|
273
273
|
var btn = document.createElement("button");
|
|
@@ -327,7 +327,7 @@ export function updateRateLimitUsage(msg) {
|
|
|
327
327
|
rateLimitUsageEl.className = "top-bar-pill pill-dim usage-check-link";
|
|
328
328
|
rateLimitUsageEl.target = "_blank";
|
|
329
329
|
rateLimitUsageEl.rel = "noopener";
|
|
330
|
-
var ref = document.getElementById("
|
|
330
|
+
var ref = document.getElementById("client-count");
|
|
331
331
|
topBarActions.insertBefore(rateLimitUsageEl, ref);
|
|
332
332
|
}
|
|
333
333
|
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// approve-tools-toggle.js - the "Approve tools automatically during this loop"
|
|
2
|
+
// choice, shown on a loop's settings (the task detail panel and the loop preview
|
|
3
|
+
// before it starts). On is the default and what every loop did before the
|
|
4
|
+
// choice existed; off makes the loop's tool calls ask like any other session's.
|
|
5
|
+
// The loop's questions and plan mode stay refused either way.
|
|
6
|
+
|
|
7
|
+
/** The settings card for the choice; `prefix` keeps the element ids apart. */
|
|
8
|
+
export function approveToolsCardHtml(prefix) {
|
|
9
|
+
return '<div class="settings-card"><div class="settings-field">' +
|
|
10
|
+
'<label class="settings-toggle-row">' +
|
|
11
|
+
'<div>' +
|
|
12
|
+
'<span class="settings-label">Approve tools automatically during this loop</span>' +
|
|
13
|
+
'<div class="settings-hint">On: the loop runs every tool without asking. Off: its tool calls ask first, like any session. The loop still cannot ask you questions or enter plan mode.</div>' +
|
|
14
|
+
'</div>' +
|
|
15
|
+
'<input type="checkbox" id="' + prefix + '-approve-tools">' +
|
|
16
|
+
'<span class="toggle-track"><span class="toggle-thumb"></span></span>' +
|
|
17
|
+
'</label>' +
|
|
18
|
+
'</div></div>';
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Sets the checkbox from the record's value (absent means on) and reports a
|
|
23
|
+
* change as true or false.
|
|
24
|
+
* @param {string} prefix
|
|
25
|
+
* @param {*} value - the record's approveToolsAutomatically
|
|
26
|
+
* @param {function(boolean): void} onChange
|
|
27
|
+
*/
|
|
28
|
+
export function bindApproveToolsToggle(prefix, value, onChange) {
|
|
29
|
+
var el = document.getElementById(prefix + "-approve-tools");
|
|
30
|
+
if (!el) return;
|
|
31
|
+
el.checked = value !== false;
|
|
32
|
+
el.onchange = function () { onChange(el.checked); };
|
|
33
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// loop-hooks-warning.js - the notice shown on a loop's settings when its
|
|
2
|
+
// LOOP.json turns hooks off (settings.disableAllHooks). The setting is the
|
|
3
|
+
// loop author's own and is kept as written; this only says what it does.
|
|
4
|
+
// disableAllHooks is not limited to a loop's own hooks: it also turns off the
|
|
5
|
+
// hooks you set up yourself, including PreToolUse guard hooks that block or
|
|
6
|
+
// confirm tool calls. Import-free so it can be exercised without the frontend
|
|
7
|
+
// module graph.
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The warning card, or an empty string when the loop does not turn hooks off.
|
|
11
|
+
* @param {?object} settings - the loop's LOOP.json settings.
|
|
12
|
+
* @returns {string} HTML.
|
|
13
|
+
*/
|
|
14
|
+
export function loopHooksWarningHtml(settings) {
|
|
15
|
+
if (!settings || settings.disableAllHooks !== true) return "";
|
|
16
|
+
return '<div class="settings-card"><div class="settings-field">' +
|
|
17
|
+
'<span class="settings-label">Hooks are turned off for this loop</span>' +
|
|
18
|
+
'<div class="settings-hint" role="alert">This loop sets disableAllHooks. That also turns off your own hooks, including PreToolUse guard hooks, so a guard you rely on will not run for this loop’s tool calls.</div>' +
|
|
19
|
+
'</div></div>';
|
|
20
|
+
}
|
|
@@ -25,6 +25,22 @@ var CAPABILITY_MODES = [
|
|
|
25
25
|
|
|
26
26
|
var FULL_AUTO = { value: "bypassPermissions", label: "Bypass permissions", hint: "Skips permission checks and approves every action." };
|
|
27
27
|
|
|
28
|
+
/**
|
|
29
|
+
* The modes only some agents run (Don't ask, Auto), for the settings pages'
|
|
30
|
+
* default-mode picker, which lists the base modes with its own wording: those
|
|
31
|
+
* of them the agent declares, with the hint under the picker's `desc` name.
|
|
32
|
+
* @param {?object} capabilities - the agent's capabilities.
|
|
33
|
+
* @returns {{value: string, label: string, desc: string}[]}
|
|
34
|
+
*/
|
|
35
|
+
export function capabilityModeOptions(capabilities) {
|
|
36
|
+
var declared = capabilities && Array.isArray(capabilities.permissionModes) ? capabilities.permissionModes : [];
|
|
37
|
+
return CAPABILITY_MODES.filter(function (m) {
|
|
38
|
+
return declared.indexOf(m.value) !== -1;
|
|
39
|
+
}).map(function (m) {
|
|
40
|
+
return { value: m.value, label: m.label, desc: m.hint };
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
28
44
|
/**
|
|
29
45
|
* @param {?object} capabilities - the session vendor's capabilities.
|
|
30
46
|
* @param {boolean} fullAutoEnabled
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// permission-settings.js - the server-wide permission settings on the server
|
|
2
|
+
// settings page: "Auto-approve read-only tools" and "Mode for sessions opened
|
|
3
|
+
// by the CLI or a trigger". The server holds the values and sends them on
|
|
4
|
+
// connect and after every change; only an administrator's change is accepted.
|
|
5
|
+
// The two message handlers are registered by app-messages.js.
|
|
6
|
+
|
|
7
|
+
import { showToast } from './utils.js';
|
|
8
|
+
import { renderModeList } from './settings-defaults.js';
|
|
9
|
+
import { capabilitiesFor, defaultVendorId } from './vendor-registry.js';
|
|
10
|
+
|
|
11
|
+
// The defaults, which are also what the server runs with until it says otherwise.
|
|
12
|
+
var current = { autoApproveReadOnly: true, openedSessionMode: "acceptEdits" };
|
|
13
|
+
var sendSetting = null;
|
|
14
|
+
|
|
15
|
+
function change(values) {
|
|
16
|
+
if (sendSetting) sendSetting("set_permission_settings", values);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Draws both controls from the latest values. sendMsg(type, data) is the page's
|
|
21
|
+
* WebSocket sender; it is kept for the controls to use.
|
|
22
|
+
*/
|
|
23
|
+
export function renderPermissionSettings(sendMsg) {
|
|
24
|
+
if (sendMsg) sendSetting = sendMsg;
|
|
25
|
+
|
|
26
|
+
var toggle = document.getElementById("ss-auto-approve-readonly");
|
|
27
|
+
if (toggle) {
|
|
28
|
+
toggle.checked = current.autoApproveReadOnly !== false;
|
|
29
|
+
toggle.onchange = function () { change({ autoApproveReadOnly: toggle.checked }); };
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
renderModeList("ss-opened", {
|
|
33
|
+
currentMode: current.openedSessionMode,
|
|
34
|
+
capabilities: capabilitiesFor(defaultVendorId()),
|
|
35
|
+
modeMsgType: "set_permission_settings",
|
|
36
|
+
sendMsg: function (type, data) { change({ openedSessionMode: data.mode }); },
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function handlePermissionSettings(msg) {
|
|
41
|
+
current = {
|
|
42
|
+
autoApproveReadOnly: msg.autoApproveReadOnly !== false,
|
|
43
|
+
openedSessionMode: typeof msg.openedSessionMode === "string" && msg.openedSessionMode ? msg.openedSessionMode : "acceptEdits",
|
|
44
|
+
};
|
|
45
|
+
renderPermissionSettings();
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// The result of choosing "Apply to running sessions" with a new default mode.
|
|
49
|
+
export function handlePermissionModeApplied(msg) {
|
|
50
|
+
var skipped = Array.isArray(msg.skipped) ? msg.skipped : [];
|
|
51
|
+
var text = "Mode applied to " + msg.applied + " session" + (msg.applied === 1 ? "" : "s") + ".";
|
|
52
|
+
if (skipped.length > 0) {
|
|
53
|
+
text += " " + skipped.length + " skipped: " + skipped.map(function (s) { return s.reason; }).filter(function (r, i, all) { return all.indexOf(r) === i; }).join("; ");
|
|
54
|
+
}
|
|
55
|
+
showToast(text, skipped.length > 0 ? "warn" : "info");
|
|
56
|
+
}
|
|
@@ -7,6 +7,7 @@ import { renderProjectIcon } from './project-icon.js';
|
|
|
7
7
|
import { pushOverlayState, popOverlayState } from './overlay-history.js';
|
|
8
8
|
import { closeFileViewer } from './filebrowser.js';
|
|
9
9
|
import { renderModelList, renderModeList, renderEffortBar, renderThinkingBar, renderBetaCard } from './settings-defaults.js';
|
|
10
|
+
import { capabilitiesFor, defaultVendorId } from './vendor-registry.js';
|
|
10
11
|
|
|
11
12
|
var ctx = null;
|
|
12
13
|
var panelEl = null;
|
|
@@ -600,6 +601,8 @@ function psDefaultsOpts() {
|
|
|
600
601
|
currentThinking: ctx.currentThinking || "adaptive",
|
|
601
602
|
currentThinkingBudget: ctx.currentThinkingBudget || 10000,
|
|
602
603
|
currentBetas: ctx.currentBetas || [],
|
|
604
|
+
capabilities: capabilitiesFor(defaultVendorId()),
|
|
605
|
+
applyToRunning: true,
|
|
603
606
|
sendMsg: psSendMsg,
|
|
604
607
|
modelMsgType: "set_project_default_model",
|
|
605
608
|
modeMsgType: "set_project_default_mode",
|
|
@@ -774,6 +774,10 @@ export function openCreateModalWithRecord(rec, anchorEl) {
|
|
|
774
774
|
var skipRunningEl = document.getElementById("sched-skip-running");
|
|
775
775
|
if (skipRunningEl) skipRunningEl.checked = rec.skipIfRunning !== false;
|
|
776
776
|
|
|
777
|
+
// A record that never had the setting approves tools, as it always did.
|
|
778
|
+
var approveToolsEl = document.getElementById("sched-approve-tools");
|
|
779
|
+
if (approveToolsEl) approveToolsEl.checked = rec.approveToolsAutomatically !== false;
|
|
780
|
+
|
|
777
781
|
// Set iterations + review checkbox
|
|
778
782
|
var hasReview = rec.maxIterations && rec.maxIterations > 1;
|
|
779
783
|
var iterInput = document.getElementById("sched-create-iterations");
|
|
@@ -945,6 +949,10 @@ export function openCreateModal(date, hour, anchorEl) {
|
|
|
945
949
|
if (reviewCheck) reviewCheck.checked = false;
|
|
946
950
|
var reviewCount = document.getElementById("sched-review-count");
|
|
947
951
|
if (reviewCount) reviewCount.classList.add("hidden");
|
|
952
|
+
// A new schedule approves tools automatically, as every loop did before the
|
|
953
|
+
// setting existed; openCreateModalWithRecord sets the record's value after.
|
|
954
|
+
var approveToolsReset = document.getElementById("sched-approve-tools");
|
|
955
|
+
if (approveToolsReset) approveToolsReset.checked = true;
|
|
948
956
|
// (task is always visible, no accordion reset needed)
|
|
949
957
|
|
|
950
958
|
// Reset color
|
|
@@ -1515,6 +1523,8 @@ function submitCreateSchedule() {
|
|
|
1515
1523
|
|
|
1516
1524
|
var skipRunningEl = document.getElementById("sched-skip-running");
|
|
1517
1525
|
var skipIfRunning = skipRunningEl ? skipRunningEl.checked : true;
|
|
1526
|
+
var approveToolsEl = document.getElementById("sched-approve-tools");
|
|
1527
|
+
var approveToolsAutomatically = approveToolsEl ? approveToolsEl.checked : true;
|
|
1518
1528
|
|
|
1519
1529
|
var reviewCheckSubmit = document.getElementById("sched-review-check");
|
|
1520
1530
|
var maxIterations = 1;
|
|
@@ -1542,6 +1552,7 @@ function submitCreateSchedule() {
|
|
|
1542
1552
|
intervalEnd: intervalEnd,
|
|
1543
1553
|
maxIterations: maxIterations,
|
|
1544
1554
|
skipIfRunning: skipIfRunning,
|
|
1555
|
+
approveToolsAutomatically: approveToolsAutomatically,
|
|
1545
1556
|
},
|
|
1546
1557
|
});
|
|
1547
1558
|
} else {
|
|
@@ -1561,6 +1572,7 @@ function submitCreateSchedule() {
|
|
|
1561
1572
|
intervalEnd: intervalEnd,
|
|
1562
1573
|
maxIterations: maxIterations,
|
|
1563
1574
|
skipIfRunning: skipIfRunning,
|
|
1575
|
+
approveToolsAutomatically: approveToolsAutomatically,
|
|
1564
1576
|
},
|
|
1565
1577
|
});
|
|
1566
1578
|
}
|
|
@@ -10,6 +10,8 @@ import { showToast } from './utils.js';
|
|
|
10
10
|
import { pushOverlayState, popOverlayState } from './overlay-history.js';
|
|
11
11
|
import { renderModelList, renderModeList, renderEffortBar, renderThinkingBar } from './settings-defaults.js';
|
|
12
12
|
import { store } from './store.js';
|
|
13
|
+
import { approveToolsCardHtml, bindApproveToolsToggle } from './approve-tools-toggle.js';
|
|
14
|
+
import { loopHooksWarningHtml } from './loop-hooks-warning.js';
|
|
13
15
|
import { initSchedulerConfig, setupCreateModal, openCreateModal, openCreateModalWithRecord, closeCreateModal, removePreview, getPreviewEl, showPreviewOnCell, showPreviewOnSlot, showPreviewForCreate, applyDraggedTask, parseCronSimple } from './scheduler-config.js';
|
|
14
16
|
import { initSchedulerHistory, renderHistory, _lastFiles as lastLoopFiles } from './scheduler-history.js';
|
|
15
17
|
import { positionPopover } from './popover-position.js';
|
|
@@ -792,6 +794,8 @@ function renderModelTab(bodyEl, rec) {
|
|
|
792
794
|
'<input id="ls-thinking-budget" type="number" class="settings-budget-input" min="1024" max="128000" step="1024" value="10000">' +
|
|
793
795
|
'</div>' +
|
|
794
796
|
'</div></div>' +
|
|
797
|
+
approveToolsCardHtml("ls") +
|
|
798
|
+
loopHooksWarningHtml(settings) +
|
|
795
799
|
'</div>';
|
|
796
800
|
|
|
797
801
|
function saveLoopSetting(key, value) {
|
|
@@ -833,6 +837,10 @@ function renderModelTab(bodyEl, rec) {
|
|
|
833
837
|
renderModeList("ls", opts);
|
|
834
838
|
renderEffortBar("ls", opts);
|
|
835
839
|
renderThinkingBar("ls", opts);
|
|
840
|
+
// The choice lives on the loop's record, not in LOOP.json.
|
|
841
|
+
bindApproveToolsToggle("ls", rec.approveToolsAutomatically, function (approve) {
|
|
842
|
+
send({ type: "loop_registry_update", id: rec.id, data: { approveToolsAutomatically: approve } });
|
|
843
|
+
});
|
|
836
844
|
}
|
|
837
845
|
|
|
838
846
|
// --- Chat reparenting ---
|
|
@@ -6,6 +6,8 @@ import { parseEnvString, looksLikeEnv } from './project-settings.js';
|
|
|
6
6
|
import { checkAdminAccess, loadAdminSection } from './admin.js';
|
|
7
7
|
import { closeFileViewer } from './filebrowser.js';
|
|
8
8
|
import { renderModelList, renderModeList, renderEffortBar, renderThinkingBar, renderBetaCard, isSonnetModel } from './settings-defaults.js';
|
|
9
|
+
import { capabilitiesFor, defaultVendorId } from './vendor-registry.js';
|
|
10
|
+
import { renderPermissionSettings } from './permission-settings.js';
|
|
9
11
|
import { initCustomIconsSettings, initCustomIconsUpload, loadCustomIcons } from './custom-icons-settings.js';
|
|
10
12
|
import { formatBytes } from './app-panels.js';
|
|
11
13
|
import { registerHandlers } from './app-messages.js';
|
|
@@ -595,7 +597,6 @@ function populateSettings() {
|
|
|
595
597
|
var versionEl = document.getElementById("settings-server-version");
|
|
596
598
|
var slugEl = document.getElementById("settings-project-slug");
|
|
597
599
|
var wsPathEl = document.getElementById("settings-ws-path");
|
|
598
|
-
var skipPermsEl = document.getElementById("settings-skip-perms");
|
|
599
600
|
|
|
600
601
|
// Nav header defaults to hostname (updated by updateDaemonConfig)
|
|
601
602
|
if (nameEl && !nameEl.textContent) nameEl.textContent = "Server";
|
|
@@ -606,14 +607,6 @@ function populateSettings() {
|
|
|
606
607
|
if (slugEl) slugEl.textContent = ctx.currentSlug || "(default)";
|
|
607
608
|
if (wsPathEl) wsPathEl.textContent = ctx.wsPath || "/ws";
|
|
608
609
|
|
|
609
|
-
// Skip permissions
|
|
610
|
-
var spBanner = document.getElementById("skip-perms-pill");
|
|
611
|
-
if (skipPermsEl) {
|
|
612
|
-
var isSkip = spBanner && !spBanner.classList.contains("hidden");
|
|
613
|
-
skipPermsEl.textContent = isSkip ? "Enabled" : "Disabled";
|
|
614
|
-
skipPermsEl.classList.toggle("settings-badge-on", isSkip);
|
|
615
|
-
}
|
|
616
|
-
|
|
617
610
|
// Sync notification toggles
|
|
618
611
|
syncNotifToggles();
|
|
619
612
|
|
|
@@ -623,6 +616,7 @@ function populateSettings() {
|
|
|
623
616
|
updateEffortBar();
|
|
624
617
|
updateThinkingBar();
|
|
625
618
|
updateSsBetaCard();
|
|
619
|
+
renderPermissionSettings(ssSendMsg);
|
|
626
620
|
}
|
|
627
621
|
|
|
628
622
|
function syncNotifToggles() {
|
|
@@ -655,6 +649,8 @@ function ssDefaultsOpts() {
|
|
|
655
649
|
currentThinking: ctx.currentThinking || "adaptive",
|
|
656
650
|
currentThinkingBudget: ctx.currentThinkingBudget || 10000,
|
|
657
651
|
currentBetas: ctx.currentBetas || [],
|
|
652
|
+
capabilities: capabilitiesFor(defaultVendorId()),
|
|
653
|
+
applyToRunning: true,
|
|
658
654
|
sendMsg: ssSendMsg,
|
|
659
655
|
// lr-db0437: was "set_model" — the session-scoped message type, wrong for
|
|
660
656
|
// a server DEFAULT picker. Every sibling control on this same panel
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
import { refreshIcons } from './icons.js';
|
|
5
5
|
import { isSonnetModel } from './model-families.js';
|
|
6
|
+
import { capabilityModeOptions } from './mode-options.js';
|
|
6
7
|
|
|
7
8
|
export var MODE_OPTIONS = [
|
|
8
9
|
{ value: "default", label: "Default", desc: "Claude asks for permission before running tools and editing files." },
|
|
@@ -230,7 +231,13 @@ export function renderModelList(prefix, opts) {
|
|
|
230
231
|
}
|
|
231
232
|
|
|
232
233
|
/**
|
|
233
|
-
* Render mode list into `${prefix}-mode-list
|
|
234
|
+
* Render mode list into `${prefix}-mode-list`.
|
|
235
|
+
*
|
|
236
|
+
* opts.capabilities (an agent's capabilities) adds Don't ask and Auto when that
|
|
237
|
+
* agent declares them; without it the list is the three base modes. A picker
|
|
238
|
+
* for a default also names `${prefix}-mode-apply` (opts.applyToRunning): the
|
|
239
|
+
* "Apply to running sessions" choice, sent with the pick and then cleared, so
|
|
240
|
+
* it is off again for the next change.
|
|
234
241
|
*/
|
|
235
242
|
export function renderModeList(prefix, opts) {
|
|
236
243
|
var listEl = document.getElementById(prefix + "-mode-list");
|
|
@@ -238,8 +245,9 @@ export function renderModeList(prefix, opts) {
|
|
|
238
245
|
|
|
239
246
|
var currentMode = opts.currentMode || "default";
|
|
240
247
|
listEl.innerHTML = "";
|
|
248
|
+
var modes = MODE_OPTIONS.concat(capabilityModeOptions(opts.capabilities));
|
|
241
249
|
|
|
242
|
-
for (var i = 0; i <
|
|
250
|
+
for (var i = 0; i < modes.length; i++) {
|
|
243
251
|
(function (opt) {
|
|
244
252
|
var item = document.createElement("div");
|
|
245
253
|
item.className = "settings-model-item" + (opt.value === currentMode ? " active" : "");
|
|
@@ -255,14 +263,20 @@ export function renderModeList(prefix, opts) {
|
|
|
255
263
|
item.appendChild(descSpan);
|
|
256
264
|
|
|
257
265
|
item.addEventListener("click", function () {
|
|
258
|
-
|
|
266
|
+
var data = { mode: opt.value };
|
|
267
|
+
var applyEl = opts.applyToRunning ? document.getElementById(prefix + "-mode-apply") : null;
|
|
268
|
+
if (applyEl && applyEl.checked) {
|
|
269
|
+
data.applyToRunning = true;
|
|
270
|
+
applyEl.checked = false;
|
|
271
|
+
}
|
|
272
|
+
opts.sendMsg(opts.modeMsgType, data);
|
|
259
273
|
var items = listEl.querySelectorAll(".settings-model-item");
|
|
260
274
|
for (var j = 0; j < items.length; j++) items[j].classList.remove("active");
|
|
261
275
|
item.classList.add("active");
|
|
262
276
|
});
|
|
263
277
|
|
|
264
278
|
listEl.appendChild(item);
|
|
265
|
-
})(
|
|
279
|
+
})(modes[i]);
|
|
266
280
|
}
|
|
267
281
|
}
|
|
268
282
|
|
package/lib/scheduler.js
CHANGED
|
@@ -339,6 +339,9 @@ function createLoopRegistry(opts) {
|
|
|
339
339
|
prompt: data.prompt || null,
|
|
340
340
|
skipIfRunning: data.skipIfRunning !== undefined ? data.skipIfRunning : true,
|
|
341
341
|
intervalEnd: data.intervalEnd || null,
|
|
342
|
+
// "Approve tools automatically during this loop": only an explicit false
|
|
343
|
+
// turns it off, and a record from before the field existed approves.
|
|
344
|
+
approveToolsAutomatically: data.approveToolsAutomatically !== false,
|
|
342
345
|
runs: [],
|
|
343
346
|
};
|
|
344
347
|
if (rec.cron && rec.enabled) {
|
|
@@ -376,6 +379,7 @@ function createLoopRegistry(opts) {
|
|
|
376
379
|
if (data.linkedTaskId !== undefined) rec.linkedTaskId = data.linkedTaskId;
|
|
377
380
|
if (data.skipIfRunning !== undefined) rec.skipIfRunning = data.skipIfRunning;
|
|
378
381
|
if (data.intervalEnd !== undefined) rec.intervalEnd = data.intervalEnd;
|
|
382
|
+
if (typeof data.approveToolsAutomatically === "boolean") rec.approveToolsAutomatically = data.approveToolsAutomatically;
|
|
379
383
|
rec.updatedAt = Date.now();
|
|
380
384
|
if (rec.cron && rec.enabled) {
|
|
381
385
|
rec.nextRunAt = nextRunTime(rec.cron);
|