shadok-ai 0.19.10 → 0.19.11
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/package.json +1 -1
- package/public/index.html +57 -16
package/package.json
CHANGED
package/public/index.html
CHANGED
|
@@ -287,6 +287,7 @@
|
|
|
287
287
|
#verMenu .vm-label { color: var(--text-dim); }
|
|
288
288
|
#verMenu .vm-check { display: flex; align-items: center; gap: 6px; margin-top: 9px; cursor: pointer; }
|
|
289
289
|
#verMenu .vm-hint { color: var(--text-dim); font-size: 10px; margin-top: 7px; line-height: 1.4; }
|
|
290
|
+
#verMenu .vm-hint.danger { color: #e2564a; }
|
|
290
291
|
#verMenu .vm-btn { margin-top: 10px; width: 100%; padding: 6px 10px; font-size: 11px; cursor: pointer;
|
|
291
292
|
color: var(--text, #e8e8ea); background: transparent; border: 1px solid var(--line, #3a3d42); border-radius: 6px; }
|
|
292
293
|
#verMenu .vm-btn:hover { border-color: var(--amber, #d0a000); }
|
|
@@ -3433,7 +3434,14 @@
|
|
|
3433
3434
|
</select>
|
|
3434
3435
|
</div>
|
|
3435
3436
|
<div class="vm-hint" id="vmChannelHint"></div>
|
|
3436
|
-
<
|
|
3437
|
+
<div class="vm-row"><span class="vm-label">Permissions</span>
|
|
3438
|
+
<select id="permModeSel">
|
|
3439
|
+
<option value="default">Ask before each action</option>
|
|
3440
|
+
<option value="acceptEdits">Auto-apply edits</option>
|
|
3441
|
+
<option value="auto">Auto mode — no prompts</option>
|
|
3442
|
+
<option value="bypassPermissions">Bypass — 0 questions ⚠️</option>
|
|
3443
|
+
</select>
|
|
3444
|
+
</div>
|
|
3437
3445
|
<div class="vm-hint" id="vmModeHint"></div>
|
|
3438
3446
|
<label class="vm-check"><input type="checkbox" id="ledgerChk"><span>Shared ledger</span></label>
|
|
3439
3447
|
<div class="vm-hint" id="vmLedgerHint"></div>
|
|
@@ -9652,7 +9660,7 @@
|
|
|
9652
9660
|
const verMenu = document.getElementById("verMenu");
|
|
9653
9661
|
const autoUpdateChk = document.getElementById("autoUpdateChk");
|
|
9654
9662
|
const updChannelSel = document.getElementById("updChannelSel");
|
|
9655
|
-
const
|
|
9663
|
+
const permModeSel = document.getElementById("permModeSel");
|
|
9656
9664
|
const ledgerChk = document.getElementById("ledgerChk");
|
|
9657
9665
|
const restartAllBtn = document.getElementById("restartAllBtn");
|
|
9658
9666
|
|
|
@@ -9715,6 +9723,33 @@
|
|
|
9715
9723
|
: "Group isolation did NOT complete — agents are running un-isolated (commons). Check the server logs; it retries on the next restart.";
|
|
9716
9724
|
}
|
|
9717
9725
|
|
|
9726
|
+
// The permission mode every NEW agent spawns in. The dropdown lists the four
|
|
9727
|
+
// useful rungs; the server accepts more (manual/dontAsk/plan, settable via the
|
|
9728
|
+
// API or config). If the instance is on one of those, we show it as a
|
|
9729
|
+
// read-through option rather than snapping the menu to a mode nobody picked.
|
|
9730
|
+
const PERM_MODE_HINTS = {
|
|
9731
|
+
default: "New agents ask before each action.",
|
|
9732
|
+
acceptEdits: "New agents auto-apply file edits, and ask before other actions.",
|
|
9733
|
+
auto: "New agents start in auto mode (Shift+Tab): no prompts, though a risky action can still be refused.",
|
|
9734
|
+
bypassPermissions: "⚠️ No permission checks at all — any command runs with no question. Agents aren't sandboxed and read untrusted content; a prompt injection could do real damage.",
|
|
9735
|
+
};
|
|
9736
|
+
function renderPermMode(mode) {
|
|
9737
|
+
const m = mode || "default";
|
|
9738
|
+
const known = Object.prototype.hasOwnProperty.call(PERM_MODE_HINTS, m);
|
|
9739
|
+
let extra = permModeSel.querySelector('option[data-extra="1"]');
|
|
9740
|
+
if (!known) {
|
|
9741
|
+
if (!extra) { extra = document.createElement("option"); extra.dataset.extra = "1"; permModeSel.appendChild(extra); }
|
|
9742
|
+
extra.value = m; extra.textContent = "Mode: " + m;
|
|
9743
|
+
} else if (extra) {
|
|
9744
|
+
extra.remove();
|
|
9745
|
+
}
|
|
9746
|
+
permModeSel.value = m;
|
|
9747
|
+
permModeSel.dataset.applied = m;
|
|
9748
|
+
const hint = document.getElementById("vmModeHint");
|
|
9749
|
+
hint.textContent = PERM_MODE_HINTS[m] || ("Mode: " + m + ".");
|
|
9750
|
+
hint.classList.toggle("danger", m === "bypassPermissions");
|
|
9751
|
+
}
|
|
9752
|
+
|
|
9718
9753
|
function renderVerMenu() {
|
|
9719
9754
|
if (!lastVersion || verMenu.hidden) return;
|
|
9720
9755
|
const m = lastVersion;
|
|
@@ -9733,13 +9768,7 @@
|
|
|
9733
9768
|
document.getElementById("vmChannelHint").textContent = ch === "alpha"
|
|
9734
9769
|
? "Every merge, as soon as it ships — newest work, freshest bugs."
|
|
9735
9770
|
: "Only promoted releases. Quieter, and what a fresh install gets.";
|
|
9736
|
-
|
|
9737
|
-
acceptEditsChk.checked = autoOn;
|
|
9738
|
-
document.getElementById("vmModeHint").textContent = autoOn
|
|
9739
|
-
? "New agents start in auto mode (Shift+Tab), running without prompts."
|
|
9740
|
-
: (m.permissionMode && m.permissionMode !== "default"
|
|
9741
|
-
? "Mode: " + m.permissionMode + "."
|
|
9742
|
-
: "New agents ask before each action.");
|
|
9771
|
+
renderPermMode(m.permissionMode || "default");
|
|
9743
9772
|
ledgerChk.checked = !!m.ledgerEnabled;
|
|
9744
9773
|
document.getElementById("vmLedgerHint").textContent = m.ledgerEnabled
|
|
9745
9774
|
? "Agents verify a status before re-raising it. Toggling restarts all agents."
|
|
@@ -9974,19 +10003,31 @@
|
|
|
9974
10003
|
updChannelSel.value = channel === "alpha" ? "beta" : "alpha"; // revert on failure
|
|
9975
10004
|
}
|
|
9976
10005
|
});
|
|
9977
|
-
|
|
9978
|
-
const
|
|
10006
|
+
permModeSel.addEventListener("change", async () => {
|
|
10007
|
+
const mode = permModeSel.value;
|
|
10008
|
+
const prev = permModeSel.dataset.applied || "default";
|
|
10009
|
+
if (mode === prev) return;
|
|
10010
|
+
// Bypass runs every new agent with no permission checks at all; make the
|
|
10011
|
+
// operator confirm it explicitly (same native confirm() as End agent etc.).
|
|
10012
|
+
if (mode === "bypassPermissions" && !confirm(
|
|
10013
|
+
"Switch every NEW agent to Bypass (0 questions)?\n\n" +
|
|
10014
|
+
"Agents will run with NO permission checks — any shell command, any file write, " +
|
|
10015
|
+
"nothing is ever asked. They are not sandboxed, run as your user, and read " +
|
|
10016
|
+
"untrusted content (web pages, cloned repos, messages), so a prompt injection " +
|
|
10017
|
+
"could do real damage.\n\nOnly enable this if you understand the risk."
|
|
10018
|
+
)) { permModeSel.value = prev; return; }
|
|
9979
10019
|
try {
|
|
9980
10020
|
const r = await fetch("/permission-mode", {
|
|
9981
10021
|
method: "POST",
|
|
9982
10022
|
headers: { "content-type": "application/json" },
|
|
9983
|
-
body: JSON.stringify({ mode
|
|
10023
|
+
body: JSON.stringify({ mode }),
|
|
9984
10024
|
});
|
|
9985
10025
|
if (!r.ok) throw new Error("refused");
|
|
9986
|
-
//
|
|
9987
|
-
// affects agents started after this — running ones keep their mode.
|
|
10026
|
+
// Optimistic; the server also echoes the new mode over WS (renderVerMenu).
|
|
10027
|
+
// Only affects agents started after this — running ones keep their mode.
|
|
10028
|
+
renderPermMode(mode);
|
|
9988
10029
|
} catch {
|
|
9989
|
-
|
|
10030
|
+
permModeSel.value = prev; // revert on failure
|
|
9990
10031
|
}
|
|
9991
10032
|
});
|
|
9992
10033
|
ledgerChk.addEventListener("change", async () => {
|
|
@@ -14914,7 +14955,7 @@
|
|
|
14914
14955
|
// the reason, rather than a control that silently snaps back.
|
|
14915
14956
|
function applyAdminOnlyControls(amAdmin) {
|
|
14916
14957
|
const why = amAdmin ? "" : "Admin only";
|
|
14917
|
-
for (const id of ["autoUpdateChk", "updChannelSel", "
|
|
14958
|
+
for (const id of ["autoUpdateChk", "updChannelSel", "permModeSel", "ledgerChk", "restartAllBtn", "reloginBtn"]) {
|
|
14918
14959
|
const el = $(id);
|
|
14919
14960
|
if (!el) continue;
|
|
14920
14961
|
el.disabled = !amAdmin;
|